mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-04-29 04:00:09 +00:00
22 lines
No EOL
830 B
JavaScript
22 lines
No EOL
830 B
JavaScript
// src/lib/stack-app/api-keys/index.ts
|
|
import { filterUndefined } from "@stackframe/stack-shared/dist/utils/objects";
|
|
async function apiKeyCreationOptionsToCrud(type, userIdOrTeamId, options) {
|
|
return {
|
|
description: options.description,
|
|
expires_at_millis: options.expiresAt == null ? options.expiresAt : options.expiresAt.getTime(),
|
|
is_public: options.isPublic,
|
|
...type === "user" ? { user_id: userIdOrTeamId } : { team_id: userIdOrTeamId }
|
|
};
|
|
}
|
|
async function apiKeyUpdateOptionsToCrud(type, options) {
|
|
return filterUndefined({
|
|
description: options.description,
|
|
expires_at_millis: options.expiresAt == null ? options.expiresAt : options.expiresAt.getTime(),
|
|
revoked: options.revoked
|
|
});
|
|
}
|
|
export {
|
|
apiKeyCreationOptionsToCrud,
|
|
apiKeyUpdateOptionsToCrud
|
|
};
|
|
//# sourceMappingURL=index.js.map
|