@stackframe/stack 2.7.21 → 2.7.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +2 -2
- package/dist/admin-app-impl-CTQhv9tV.d.ts +395 -0
- package/dist/admin-app-impl-DpyRKp1e.d.mts +395 -0
- package/dist/components/selected-team-switcher.d.mts +18 -6
- package/dist/components/selected-team-switcher.d.ts +18 -6
- package/dist/components/team-icon.d.mts +18 -6
- package/dist/components/team-icon.d.ts +18 -6
- package/dist/components-page/stack-handler.d.mts +18 -6
- package/dist/components-page/stack-handler.d.ts +18 -6
- package/dist/esm/lib/stack-app/api-keys/index.js +14 -0
- package/dist/esm/lib/stack-app/api-keys/index.js.map +1 -0
- package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js +291 -0
- package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -0
- package/dist/esm/lib/{stack-app.js → stack-app/apps/implementations/client-app-impl.js} +37 -1109
- package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -0
- package/dist/esm/lib/stack-app/apps/implementations/common.js +142 -0
- package/dist/esm/lib/stack-app/apps/implementations/common.js.map +1 -0
- package/dist/esm/lib/stack-app/apps/implementations/index.js +24 -0
- package/dist/esm/lib/stack-app/apps/implementations/index.js.map +1 -0
- package/dist/esm/lib/stack-app/apps/implementations/server-app-impl.js +527 -0
- package/dist/esm/lib/stack-app/apps/implementations/server-app-impl.js.map +1 -0
- package/dist/esm/lib/stack-app/apps/index.js +16 -0
- package/dist/esm/lib/stack-app/apps/index.js.map +1 -0
- package/dist/esm/lib/stack-app/apps/interfaces/admin-app.js +7 -0
- package/dist/esm/lib/stack-app/apps/interfaces/admin-app.js.map +1 -0
- package/dist/esm/lib/stack-app/apps/interfaces/client-app.js +7 -0
- package/dist/esm/lib/stack-app/apps/interfaces/client-app.js.map +1 -0
- package/dist/esm/lib/stack-app/apps/interfaces/server-app.js +7 -0
- package/dist/esm/lib/stack-app/apps/interfaces/server-app.js.map +1 -0
- package/dist/esm/lib/stack-app/common.js +6 -0
- package/dist/esm/lib/stack-app/common.js.map +1 -0
- package/dist/esm/lib/stack-app/connected-accounts/index.js +1 -0
- package/dist/esm/lib/stack-app/connected-accounts/index.js.map +1 -0
- package/dist/esm/lib/stack-app/contact-channels/index.js +39 -0
- package/dist/esm/lib/stack-app/contact-channels/index.js.map +1 -0
- package/dist/esm/lib/stack-app/email-templates/index.js +11 -0
- package/dist/esm/lib/stack-app/email-templates/index.js.map +1 -0
- package/dist/esm/lib/stack-app/index.js +16 -0
- package/dist/esm/lib/stack-app/index.js.map +1 -0
- package/dist/esm/lib/stack-app/permissions/index.js +20 -0
- package/dist/esm/lib/stack-app/permissions/index.js.map +1 -0
- package/dist/esm/lib/stack-app/project-configs/index.js +1 -0
- package/dist/esm/lib/stack-app/project-configs/index.js.map +1 -0
- package/dist/esm/lib/stack-app/projects/index.js +57 -0
- package/dist/esm/lib/stack-app/projects/index.js.map +1 -0
- package/dist/esm/lib/stack-app/teams/index.js +38 -0
- package/dist/esm/lib/stack-app/teams/index.js.map +1 -0
- package/dist/esm/lib/stack-app/users/index.js +47 -0
- package/dist/esm/lib/stack-app/users/index.js.map +1 -0
- package/dist/generated/quetzal-translations.d.mts +2 -2
- package/dist/generated/quetzal-translations.d.ts +2 -2
- package/dist/{lib/stack-app.d.mts → index-C7D6Vt7X.d.mts} +138 -354
- package/dist/{lib/stack-app.d.ts → index-DQk7XJpU.d.ts} +138 -354
- package/dist/index.d.mts +17 -5
- package/dist/index.d.ts +17 -5
- package/dist/lib/hooks.d.mts +17 -5
- package/dist/lib/hooks.d.ts +17 -5
- package/dist/lib/stack-app/api-keys/index.d.mts +40 -0
- package/dist/lib/stack-app/api-keys/index.d.ts +40 -0
- package/dist/lib/stack-app/api-keys/index.js +39 -0
- package/dist/lib/stack-app/api-keys/index.js.map +1 -0
- package/dist/lib/stack-app/apps/implementations/admin-app-impl.d.mts +30 -0
- package/dist/lib/stack-app/apps/implementations/admin-app-impl.d.ts +30 -0
- package/dist/lib/stack-app/apps/implementations/admin-app-impl.js +316 -0
- package/dist/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -0
- package/dist/lib/stack-app/apps/implementations/client-app-impl.d.mts +30 -0
- package/dist/lib/stack-app/apps/implementations/client-app-impl.d.ts +30 -0
- package/dist/lib/{stack-app.js → stack-app/apps/implementations/client-app-impl.js} +75 -1152
- package/dist/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -0
- package/dist/lib/stack-app/apps/implementations/common.d.mts +45 -0
- package/dist/lib/stack-app/apps/implementations/common.d.ts +45 -0
- package/dist/lib/stack-app/apps/implementations/common.js +187 -0
- package/dist/lib/stack-app/apps/implementations/common.js.map +1 -0
- package/dist/lib/stack-app/apps/implementations/index.d.mts +36 -0
- package/dist/lib/stack-app/apps/implementations/index.d.ts +36 -0
- package/dist/lib/stack-app/apps/implementations/index.js +51 -0
- package/dist/lib/stack-app/apps/implementations/index.js.map +1 -0
- package/dist/lib/stack-app/apps/implementations/server-app-impl.d.mts +30 -0
- package/dist/lib/stack-app/apps/implementations/server-app-impl.d.ts +30 -0
- package/dist/lib/stack-app/apps/implementations/server-app-impl.js +552 -0
- package/dist/lib/stack-app/apps/implementations/server-app-impl.js.map +1 -0
- package/dist/lib/stack-app/apps/index.d.mts +23 -0
- package/dist/lib/stack-app/apps/index.d.ts +23 -0
- package/dist/lib/stack-app/apps/index.js +37 -0
- package/dist/lib/stack-app/apps/index.js.map +1 -0
- package/dist/lib/stack-app/apps/interfaces/admin-app.d.mts +23 -0
- package/dist/lib/stack-app/apps/interfaces/admin-app.d.ts +23 -0
- package/dist/lib/stack-app/apps/interfaces/admin-app.js +32 -0
- package/dist/lib/stack-app/apps/interfaces/admin-app.js.map +1 -0
- package/dist/lib/stack-app/apps/interfaces/client-app.d.mts +23 -0
- package/dist/lib/stack-app/apps/interfaces/client-app.d.ts +23 -0
- package/dist/lib/stack-app/apps/interfaces/client-app.js +32 -0
- package/dist/lib/stack-app/apps/interfaces/client-app.js.map +1 -0
- package/dist/lib/stack-app/apps/interfaces/server-app.d.mts +23 -0
- package/dist/lib/stack-app/apps/interfaces/server-app.d.ts +23 -0
- package/dist/lib/stack-app/apps/interfaces/server-app.js +32 -0
- package/dist/lib/stack-app/apps/interfaces/server-app.js.map +1 -0
- package/dist/lib/stack-app/common.d.mts +63 -0
- package/dist/lib/stack-app/common.d.ts +63 -0
- package/dist/lib/stack-app/common.js +31 -0
- package/dist/lib/stack-app/common.js.map +1 -0
- package/dist/lib/stack-app/connected-accounts/index.d.mts +13 -0
- package/dist/lib/stack-app/connected-accounts/index.d.ts +13 -0
- package/dist/lib/stack-app/connected-accounts/index.js +19 -0
- package/dist/lib/stack-app/connected-accounts/index.js.map +1 -0
- package/dist/lib/stack-app/contact-channels/index.d.mts +38 -0
- package/dist/lib/stack-app/contact-channels/index.d.ts +38 -0
- package/dist/lib/stack-app/contact-channels/index.js +67 -0
- package/dist/lib/stack-app/contact-channels/index.js.map +1 -0
- package/dist/lib/stack-app/email-templates/index.d.mts +15 -0
- package/dist/lib/stack-app/email-templates/index.d.ts +15 -0
- package/dist/lib/stack-app/email-templates/index.js +36 -0
- package/dist/lib/stack-app/email-templates/index.js.map +1 -0
- package/dist/lib/stack-app/index.d.mts +23 -0
- package/dist/lib/stack-app/index.d.ts +23 -0
- package/dist/lib/stack-app/index.js +38 -0
- package/dist/lib/stack-app/index.js.map +1 -0
- package/dist/lib/stack-app/permissions/index.d.mts +21 -0
- package/dist/lib/stack-app/permissions/index.d.ts +21 -0
- package/dist/lib/stack-app/permissions/index.js +46 -0
- package/dist/lib/stack-app/permissions/index.js.map +1 -0
- package/dist/lib/stack-app/project-configs/index.d.mts +82 -0
- package/dist/lib/stack-app/project-configs/index.d.ts +82 -0
- package/dist/lib/stack-app/project-configs/index.js +19 -0
- package/dist/lib/stack-app/project-configs/index.js.map +1 -0
- package/dist/lib/stack-app/projects/index.d.mts +23 -0
- package/dist/lib/stack-app/projects/index.d.ts +23 -0
- package/dist/lib/stack-app/projects/index.js +83 -0
- package/dist/lib/stack-app/projects/index.js.map +1 -0
- package/dist/lib/stack-app/teams/index.d.mts +23 -0
- package/dist/lib/stack-app/teams/index.d.ts +23 -0
- package/dist/lib/stack-app/teams/index.js +66 -0
- package/dist/lib/stack-app/teams/index.js.map +1 -0
- package/dist/lib/stack-app/users/index.d.mts +23 -0
- package/dist/lib/stack-app/users/index.d.ts +23 -0
- package/dist/lib/stack-app/users/index.js +74 -0
- package/dist/lib/stack-app/users/index.js.map +1 -0
- package/dist/providers/stack-provider-client.d.mts +17 -5
- package/dist/providers/stack-provider-client.d.ts +17 -5
- package/dist/providers/stack-provider.d.mts +18 -6
- package/dist/providers/stack-provider.d.ts +18 -6
- package/package.json +4 -4
- package/dist/esm/lib/stack-app.js.map +0 -1
- package/dist/lib/stack-app.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { A as AdminOwnedProject, j as AdminProject, k as AdminProjectCreateOptions, l as AdminProjectUpdateOptions, x as Auth, C as CurrentInternalServerUser, y as CurrentInternalUser, z as CurrentServerUser, B as CurrentUser, E as EditableTeamMemberProfile, P as Project, m as ServerListUsersOptions, n as ServerTeam, o as ServerTeamCreateOptions, p as ServerTeamMemberProfile, q as ServerTeamUpdateOptions, r as ServerTeamUser, D as ServerUser, F as Session, S as StackAdminApp, c as StackAdminAppConstructor, d as StackAdminAppConstructorOptions, a as StackClientApp, e as StackClientAppConstructor, f as StackClientAppConstructorOptions, g as StackClientAppJson, b as StackServerApp, h as StackServerAppConstructor, i as StackServerAppConstructorOptions, T as Team, s as TeamCreateOptions, t as TeamInvitation, u as TeamMemberProfile, v as TeamUpdateOptions, w as TeamUser, U as User } from './index-DQk7XJpU.js';
|
|
2
|
+
export { AdminDomainConfig, AdminEmailConfig, AdminOAuthProviderConfig, AdminProjectConfig, AdminProjectConfigUpdateOptions, OAuthProviderConfig, ProjectConfig } from './lib/stack-app/project-configs/index.js';
|
|
3
|
+
export { ApiKey, ApiKeyBase, ApiKeyBaseCrudRead, ApiKeyCreateOptions, ApiKeyFirstView } from './lib/stack-app/api-keys/index.js';
|
|
4
|
+
export { GetUserOptions, HandlerUrls, OAuthScopesOnSignIn, stackAppInternalsSymbol } from './lib/stack-app/common.js';
|
|
5
|
+
export { Connection, OAuthConnection } from './lib/stack-app/connected-accounts/index.js';
|
|
6
|
+
export { ContactChannel } from './lib/stack-app/contact-channels/index.js';
|
|
7
|
+
export { AdminTeamPermission, AdminTeamPermissionDefinition, AdminTeamPermissionDefinitionCreateOptions, AdminTeamPermissionDefinitionUpdateOptions, TeamPermission } from './lib/stack-app/permissions/index.js';
|
|
2
8
|
export { default as StackHandler } from './components-page/stack-handler.js';
|
|
3
9
|
export { useStackApp, useUser } from './lib/hooks.js';
|
|
4
10
|
export { default as StackProvider } from './providers/stack-provider.js';
|
|
@@ -20,15 +26,21 @@ export { OAuthButtonGroup } from './components/oauth-button-group.js';
|
|
|
20
26
|
export { SelectedTeamSwitcher } from './components/selected-team-switcher.js';
|
|
21
27
|
export { UserButton } from './components/user-button.js';
|
|
22
28
|
import '@stackframe/stack-shared';
|
|
23
|
-
import '@stackframe/stack-shared/dist/helpers/production-mode';
|
|
24
|
-
import '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
25
29
|
import '@stackframe/stack-shared/dist/interface/crud/current-user';
|
|
30
|
+
import '@stackframe/stack-shared/dist/utils/results';
|
|
31
|
+
import '@stackframe/stack-shared/dist/helpers/production-mode';
|
|
32
|
+
import '@stackframe/stack-shared/dist/interface/crud/projects';
|
|
26
33
|
import '@stackframe/stack-shared/dist/interface/crud/email-templates';
|
|
27
|
-
import '@stackframe/stack-shared/dist/interface/crud/team-permissions';
|
|
28
34
|
import '@stackframe/stack-shared/dist/sessions';
|
|
35
|
+
import './lib/stack-app/email-templates/index.js';
|
|
36
|
+
import '@stackframe/stack-shared/dist/interface/crud/teams';
|
|
29
37
|
import '@stackframe/stack-shared/dist/utils/json';
|
|
38
|
+
import '@stackframe/stack-shared/dist/interface/crud/users';
|
|
30
39
|
import '@stackframe/stack-shared/dist/utils/oauth';
|
|
31
|
-
import '@stackframe/stack-shared/dist/
|
|
40
|
+
import '@stackframe/stack-shared/dist/interface/adminInterface';
|
|
41
|
+
import '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
42
|
+
import '@stackframe/stack-shared/dist/interface/crud/contact-channels';
|
|
43
|
+
import '@stackframe/stack-shared/dist/interface/crud/team-permissions';
|
|
32
44
|
import './components-page/error-page.js';
|
|
33
45
|
import 'react/jsx-runtime';
|
|
34
46
|
import './components-page/magic-link-callback.js';
|
package/dist/lib/hooks.d.mts
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
import { CurrentInternalUser, CurrentUser,
|
|
1
|
+
import { y as CurrentInternalUser, B as CurrentUser, a as StackClientApp } from '../index-C7D6Vt7X.mjs';
|
|
2
|
+
import { GetUserOptions as GetUserOptions$1 } from './stack-app/common.mjs';
|
|
2
3
|
import '@stackframe/stack-shared';
|
|
3
|
-
import '@stackframe/stack-shared/dist/helpers/production-mode';
|
|
4
|
-
import '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
5
4
|
import '@stackframe/stack-shared/dist/interface/crud/current-user';
|
|
5
|
+
import '@stackframe/stack-shared/dist/utils/results';
|
|
6
|
+
import '@stackframe/stack-shared/dist/helpers/production-mode';
|
|
7
|
+
import '@stackframe/stack-shared/dist/interface/crud/projects';
|
|
6
8
|
import '@stackframe/stack-shared/dist/interface/crud/email-templates';
|
|
7
|
-
import '@stackframe/stack-shared/dist/interface/crud/team-permissions';
|
|
8
9
|
import '@stackframe/stack-shared/dist/sessions';
|
|
10
|
+
import './stack-app/api-keys/index.mjs';
|
|
11
|
+
import '@stackframe/stack-shared/dist/interface/adminInterface';
|
|
12
|
+
import '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
13
|
+
import './stack-app/email-templates/index.mjs';
|
|
14
|
+
import './stack-app/permissions/index.mjs';
|
|
15
|
+
import '@stackframe/stack-shared/dist/interface/crud/team-permissions';
|
|
16
|
+
import '@stackframe/stack-shared/dist/interface/crud/teams';
|
|
9
17
|
import '@stackframe/stack-shared/dist/utils/json';
|
|
18
|
+
import '@stackframe/stack-shared/dist/interface/crud/users';
|
|
10
19
|
import '@stackframe/stack-shared/dist/utils/oauth';
|
|
11
|
-
import '
|
|
20
|
+
import './stack-app/connected-accounts/index.mjs';
|
|
21
|
+
import './stack-app/contact-channels/index.mjs';
|
|
22
|
+
import '@stackframe/stack-shared/dist/interface/crud/contact-channels';
|
|
23
|
+
import './stack-app/project-configs/index.mjs';
|
|
12
24
|
|
|
13
25
|
type GetUserOptions = GetUserOptions$1<true> & {
|
|
14
26
|
projectIdMustMatch?: string;
|
package/dist/lib/hooks.d.ts
CHANGED
|
@@ -1,14 +1,26 @@
|
|
|
1
|
-
import { CurrentInternalUser, CurrentUser,
|
|
1
|
+
import { y as CurrentInternalUser, B as CurrentUser, a as StackClientApp } from '../index-DQk7XJpU.js';
|
|
2
|
+
import { GetUserOptions as GetUserOptions$1 } from './stack-app/common.js';
|
|
2
3
|
import '@stackframe/stack-shared';
|
|
3
|
-
import '@stackframe/stack-shared/dist/helpers/production-mode';
|
|
4
|
-
import '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
5
4
|
import '@stackframe/stack-shared/dist/interface/crud/current-user';
|
|
5
|
+
import '@stackframe/stack-shared/dist/utils/results';
|
|
6
|
+
import '@stackframe/stack-shared/dist/helpers/production-mode';
|
|
7
|
+
import '@stackframe/stack-shared/dist/interface/crud/projects';
|
|
6
8
|
import '@stackframe/stack-shared/dist/interface/crud/email-templates';
|
|
7
|
-
import '@stackframe/stack-shared/dist/interface/crud/team-permissions';
|
|
8
9
|
import '@stackframe/stack-shared/dist/sessions';
|
|
10
|
+
import './stack-app/api-keys/index.js';
|
|
11
|
+
import '@stackframe/stack-shared/dist/interface/adminInterface';
|
|
12
|
+
import '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
13
|
+
import './stack-app/email-templates/index.js';
|
|
14
|
+
import './stack-app/permissions/index.js';
|
|
15
|
+
import '@stackframe/stack-shared/dist/interface/crud/team-permissions';
|
|
16
|
+
import '@stackframe/stack-shared/dist/interface/crud/teams';
|
|
9
17
|
import '@stackframe/stack-shared/dist/utils/json';
|
|
18
|
+
import '@stackframe/stack-shared/dist/interface/crud/users';
|
|
10
19
|
import '@stackframe/stack-shared/dist/utils/oauth';
|
|
11
|
-
import '
|
|
20
|
+
import './stack-app/connected-accounts/index.js';
|
|
21
|
+
import './stack-app/contact-channels/index.js';
|
|
22
|
+
import '@stackframe/stack-shared/dist/interface/crud/contact-channels';
|
|
23
|
+
import './stack-app/project-configs/index.js';
|
|
12
24
|
|
|
13
25
|
type GetUserOptions = GetUserOptions$1<true> & {
|
|
14
26
|
projectIdMustMatch?: string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ApiKeyCreateCrudRequest } from '@stackframe/stack-shared/dist/interface/adminInterface';
|
|
2
|
+
import { ApiKeysCrud } from '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
3
|
+
|
|
4
|
+
type ApiKeyBase = {
|
|
5
|
+
id: string;
|
|
6
|
+
description: string;
|
|
7
|
+
expiresAt: Date;
|
|
8
|
+
manuallyRevokedAt: Date | null;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
isValid(): boolean;
|
|
11
|
+
whyInvalid(): "expired" | "manually-revoked" | null;
|
|
12
|
+
revoke(): Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
type ApiKeyBaseCrudRead = Pick<ApiKeysCrud["Admin"]["Read"], "id" | "created_at_millis" | "description" | "expires_at_millis" | "manually_revoked_at_millis">;
|
|
15
|
+
type ApiKeyFirstView = {
|
|
16
|
+
publishableClientKey?: string;
|
|
17
|
+
secretServerKey?: string;
|
|
18
|
+
superSecretAdminKey?: string;
|
|
19
|
+
} & ApiKeyBase;
|
|
20
|
+
type ApiKey = {
|
|
21
|
+
publishableClientKey: null | {
|
|
22
|
+
lastFour: string;
|
|
23
|
+
};
|
|
24
|
+
secretServerKey: null | {
|
|
25
|
+
lastFour: string;
|
|
26
|
+
};
|
|
27
|
+
superSecretAdminKey: null | {
|
|
28
|
+
lastFour: string;
|
|
29
|
+
};
|
|
30
|
+
} & ApiKeyBase;
|
|
31
|
+
type ApiKeyCreateOptions = {
|
|
32
|
+
description: string;
|
|
33
|
+
expiresAt: Date;
|
|
34
|
+
hasPublishableClientKey: boolean;
|
|
35
|
+
hasSecretServerKey: boolean;
|
|
36
|
+
hasSuperSecretAdminKey: boolean;
|
|
37
|
+
};
|
|
38
|
+
declare function apiKeyCreateOptionsToCrud(options: ApiKeyCreateOptions): ApiKeyCreateCrudRequest;
|
|
39
|
+
|
|
40
|
+
export { type ApiKey, type ApiKeyBase, type ApiKeyBaseCrudRead, type ApiKeyCreateOptions, type ApiKeyFirstView, apiKeyCreateOptionsToCrud };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ApiKeyCreateCrudRequest } from '@stackframe/stack-shared/dist/interface/adminInterface';
|
|
2
|
+
import { ApiKeysCrud } from '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
3
|
+
|
|
4
|
+
type ApiKeyBase = {
|
|
5
|
+
id: string;
|
|
6
|
+
description: string;
|
|
7
|
+
expiresAt: Date;
|
|
8
|
+
manuallyRevokedAt: Date | null;
|
|
9
|
+
createdAt: Date;
|
|
10
|
+
isValid(): boolean;
|
|
11
|
+
whyInvalid(): "expired" | "manually-revoked" | null;
|
|
12
|
+
revoke(): Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
type ApiKeyBaseCrudRead = Pick<ApiKeysCrud["Admin"]["Read"], "id" | "created_at_millis" | "description" | "expires_at_millis" | "manually_revoked_at_millis">;
|
|
15
|
+
type ApiKeyFirstView = {
|
|
16
|
+
publishableClientKey?: string;
|
|
17
|
+
secretServerKey?: string;
|
|
18
|
+
superSecretAdminKey?: string;
|
|
19
|
+
} & ApiKeyBase;
|
|
20
|
+
type ApiKey = {
|
|
21
|
+
publishableClientKey: null | {
|
|
22
|
+
lastFour: string;
|
|
23
|
+
};
|
|
24
|
+
secretServerKey: null | {
|
|
25
|
+
lastFour: string;
|
|
26
|
+
};
|
|
27
|
+
superSecretAdminKey: null | {
|
|
28
|
+
lastFour: string;
|
|
29
|
+
};
|
|
30
|
+
} & ApiKeyBase;
|
|
31
|
+
type ApiKeyCreateOptions = {
|
|
32
|
+
description: string;
|
|
33
|
+
expiresAt: Date;
|
|
34
|
+
hasPublishableClientKey: boolean;
|
|
35
|
+
hasSecretServerKey: boolean;
|
|
36
|
+
hasSuperSecretAdminKey: boolean;
|
|
37
|
+
};
|
|
38
|
+
declare function apiKeyCreateOptionsToCrud(options: ApiKeyCreateOptions): ApiKeyCreateCrudRequest;
|
|
39
|
+
|
|
40
|
+
export { type ApiKey, type ApiKeyBase, type ApiKeyBaseCrudRead, type ApiKeyCreateOptions, type ApiKeyFirstView, apiKeyCreateOptionsToCrud };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/lib/stack-app/api-keys/index.ts
|
|
21
|
+
var api_keys_exports = {};
|
|
22
|
+
__export(api_keys_exports, {
|
|
23
|
+
apiKeyCreateOptionsToCrud: () => apiKeyCreateOptionsToCrud
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(api_keys_exports);
|
|
26
|
+
function apiKeyCreateOptionsToCrud(options) {
|
|
27
|
+
return {
|
|
28
|
+
description: options.description,
|
|
29
|
+
expires_at_millis: options.expiresAt.getTime(),
|
|
30
|
+
has_publishable_client_key: options.hasPublishableClientKey,
|
|
31
|
+
has_secret_server_key: options.hasSecretServerKey,
|
|
32
|
+
has_super_secret_admin_key: options.hasSuperSecretAdminKey
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
+
0 && (module.exports = {
|
|
37
|
+
apiKeyCreateOptionsToCrud
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/lib/stack-app/api-keys/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { ApiKeyCreateCrudRequest } from \"@stackframe/stack-shared/dist/interface/adminInterface\";\nimport { ApiKeysCrud } from \"@stackframe/stack-shared/dist/interface/crud/api-keys\";\n\n\nexport type ApiKeyBase = {\n id: string,\n description: string,\n expiresAt: Date,\n manuallyRevokedAt: Date | null,\n createdAt: Date,\n isValid(): boolean,\n whyInvalid(): \"expired\" | \"manually-revoked\" | null,\n revoke(): Promise<void>,\n};\n\nexport type ApiKeyBaseCrudRead = Pick<ApiKeysCrud[\"Admin\"][\"Read\"], \"id\" | \"created_at_millis\" | \"description\" | \"expires_at_millis\" | \"manually_revoked_at_millis\">;\n\nexport type ApiKeyFirstView = {\n publishableClientKey?: string,\n secretServerKey?: string,\n superSecretAdminKey?: string,\n} & ApiKeyBase;\n\nexport type ApiKey = {\n publishableClientKey: null | {\n lastFour: string,\n },\n secretServerKey: null | {\n lastFour: string,\n },\n superSecretAdminKey: null | {\n lastFour: string,\n },\n} & ApiKeyBase;\n\nexport type ApiKeyCreateOptions = {\n description: string,\n expiresAt: Date,\n hasPublishableClientKey: boolean,\n hasSecretServerKey: boolean,\n hasSuperSecretAdminKey: boolean,\n};\nexport function apiKeyCreateOptionsToCrud(options: ApiKeyCreateOptions): ApiKeyCreateCrudRequest {\n return {\n description: options.description,\n expires_at_millis: options.expiresAt.getTime(),\n has_publishable_client_key: options.hasPublishableClientKey,\n has_secret_server_key: options.hasSecretServerKey,\n has_super_secret_admin_key: options.hasSuperSecretAdminKey,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8CO,SAAS,0BAA0B,SAAuD;AAC/F,SAAO;AAAA,IACL,aAAa,QAAQ;AAAA,IACrB,mBAAmB,QAAQ,UAAU,QAAQ;AAAA,IAC7C,4BAA4B,QAAQ;AAAA,IACpC,uBAAuB,QAAQ;AAAA,IAC/B,4BAA4B,QAAQ;AAAA,EACtC;AACF;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import '@stackframe/stack-shared/dist/sessions';
|
|
2
|
+
import '@stackframe/stack-shared/dist/interface/crud/current-user';
|
|
3
|
+
import '../../../../index-C7D6Vt7X.mjs';
|
|
4
|
+
import '../../common.mjs';
|
|
5
|
+
import '@stackframe/stack-shared';
|
|
6
|
+
import '@stackframe/stack-shared/dist/utils/results';
|
|
7
|
+
import '../../permissions/index.mjs';
|
|
8
|
+
import '@stackframe/stack-shared/dist/interface/adminInterface';
|
|
9
|
+
import '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
10
|
+
import '@stackframe/stack-shared/dist/interface/crud/email-templates';
|
|
11
|
+
import '@stackframe/stack-shared/dist/interface/crud/projects';
|
|
12
|
+
import '../../api-keys/index.mjs';
|
|
13
|
+
import '../../email-templates/index.mjs';
|
|
14
|
+
export { _ as _StackAdminAppImplIncomplete } from '../../../../admin-app-impl-DpyRKp1e.mjs';
|
|
15
|
+
import '@stackframe/stack-shared/dist/helpers/production-mode';
|
|
16
|
+
import '@stackframe/stack-shared/dist/interface/crud/teams';
|
|
17
|
+
import '@stackframe/stack-shared/dist/utils/json';
|
|
18
|
+
import '@stackframe/stack-shared/dist/interface/crud/users';
|
|
19
|
+
import '@stackframe/stack-shared/dist/utils/oauth';
|
|
20
|
+
import '../../connected-accounts/index.mjs';
|
|
21
|
+
import '../../contact-channels/index.mjs';
|
|
22
|
+
import '@stackframe/stack-shared/dist/interface/crud/contact-channels';
|
|
23
|
+
import '../../project-configs/index.mjs';
|
|
24
|
+
import '@stackframe/stack-shared/dist/interface/crud/team-permissions';
|
|
25
|
+
import '@stackframe/stack-shared/dist/interface/crud/team-invitation';
|
|
26
|
+
import '@stackframe/stack-shared/dist/interface/crud/team-member-profiles';
|
|
27
|
+
import '@stackframe/stack-shared/dist/utils/stores';
|
|
28
|
+
import '../../../cookie.mjs';
|
|
29
|
+
import './common.mjs';
|
|
30
|
+
import '@stackframe/stack-shared/dist/utils/caches';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import '@stackframe/stack-shared/dist/sessions';
|
|
2
|
+
import '@stackframe/stack-shared/dist/interface/crud/current-user';
|
|
3
|
+
import '../../../../index-DQk7XJpU.js';
|
|
4
|
+
import '../../common.js';
|
|
5
|
+
import '@stackframe/stack-shared';
|
|
6
|
+
import '@stackframe/stack-shared/dist/utils/results';
|
|
7
|
+
import '../../permissions/index.js';
|
|
8
|
+
import '@stackframe/stack-shared/dist/interface/adminInterface';
|
|
9
|
+
import '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
10
|
+
import '@stackframe/stack-shared/dist/interface/crud/email-templates';
|
|
11
|
+
import '@stackframe/stack-shared/dist/interface/crud/projects';
|
|
12
|
+
import '../../api-keys/index.js';
|
|
13
|
+
import '../../email-templates/index.js';
|
|
14
|
+
export { _ as _StackAdminAppImplIncomplete } from '../../../../admin-app-impl-CTQhv9tV.js';
|
|
15
|
+
import '@stackframe/stack-shared/dist/helpers/production-mode';
|
|
16
|
+
import '@stackframe/stack-shared/dist/interface/crud/teams';
|
|
17
|
+
import '@stackframe/stack-shared/dist/utils/json';
|
|
18
|
+
import '@stackframe/stack-shared/dist/interface/crud/users';
|
|
19
|
+
import '@stackframe/stack-shared/dist/utils/oauth';
|
|
20
|
+
import '../../connected-accounts/index.js';
|
|
21
|
+
import '../../contact-channels/index.js';
|
|
22
|
+
import '@stackframe/stack-shared/dist/interface/crud/contact-channels';
|
|
23
|
+
import '../../project-configs/index.js';
|
|
24
|
+
import '@stackframe/stack-shared/dist/interface/crud/team-permissions';
|
|
25
|
+
import '@stackframe/stack-shared/dist/interface/crud/team-invitation';
|
|
26
|
+
import '@stackframe/stack-shared/dist/interface/crud/team-member-profiles';
|
|
27
|
+
import '@stackframe/stack-shared/dist/utils/stores';
|
|
28
|
+
import '../../../cookie.js';
|
|
29
|
+
import './common.js';
|
|
30
|
+
import '@stackframe/stack-shared/dist/utils/caches';
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/lib/stack-app/apps/implementations/admin-app-impl.ts
|
|
21
|
+
var admin_app_impl_exports = {};
|
|
22
|
+
__export(admin_app_impl_exports, {
|
|
23
|
+
_StackAdminAppImplIncomplete: () => _StackAdminAppImplIncomplete
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(admin_app_impl_exports);
|
|
26
|
+
var import_stack_shared = require("@stackframe/stack-shared");
|
|
27
|
+
var import_production_mode = require("@stackframe/stack-shared/dist/helpers/production-mode");
|
|
28
|
+
var import_errors = require("@stackframe/stack-shared/dist/utils/errors");
|
|
29
|
+
var import_objects = require("@stackframe/stack-shared/dist/utils/objects");
|
|
30
|
+
var import_results = require("@stackframe/stack-shared/dist/utils/results");
|
|
31
|
+
var import_react = require("react");
|
|
32
|
+
var import_api_keys = require("../../api-keys");
|
|
33
|
+
var import_common = require("../../common");
|
|
34
|
+
var import_email_templates = require("../../email-templates");
|
|
35
|
+
var import_permissions = require("../../permissions");
|
|
36
|
+
var import_projects = require("../../projects");
|
|
37
|
+
var import_common2 = require("./common");
|
|
38
|
+
var import_common3 = require("./common");
|
|
39
|
+
var import_server_app_impl = require("./server-app-impl");
|
|
40
|
+
var _StackAdminAppImplIncomplete = class extends import_server_app_impl._StackServerAppImplIncomplete {
|
|
41
|
+
constructor(options) {
|
|
42
|
+
super({
|
|
43
|
+
interface: new import_stack_shared.StackAdminInterface({
|
|
44
|
+
getBaseUrl: () => (0, import_common2.getBaseUrl)(options.baseUrl),
|
|
45
|
+
projectId: options.projectId ?? (0, import_common2.getDefaultProjectId)(),
|
|
46
|
+
clientVersion: import_common2.clientVersion,
|
|
47
|
+
..."projectOwnerSession" in options ? {
|
|
48
|
+
projectOwnerSession: options.projectOwnerSession
|
|
49
|
+
} : {
|
|
50
|
+
publishableClientKey: options.publishableClientKey ?? (0, import_common2.getDefaultPublishableClientKey)(),
|
|
51
|
+
secretServerKey: options.secretServerKey ?? (0, import_common2.getDefaultSecretServerKey)(),
|
|
52
|
+
superSecretAdminKey: options.superSecretAdminKey ?? (0, import_common2.getDefaultSuperSecretAdminKey)()
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
baseUrl: options.baseUrl,
|
|
56
|
+
projectId: options.projectId,
|
|
57
|
+
tokenStore: options.tokenStore,
|
|
58
|
+
urls: options.urls,
|
|
59
|
+
oauthScopesOnSignIn: options.oauthScopesOnSignIn,
|
|
60
|
+
redirectMethod: options.redirectMethod
|
|
61
|
+
});
|
|
62
|
+
this._adminProjectCache = (0, import_common2.createCache)(async () => {
|
|
63
|
+
return await this._interface.getProject();
|
|
64
|
+
});
|
|
65
|
+
this._apiKeysCache = (0, import_common2.createCache)(async () => {
|
|
66
|
+
return await this._interface.listApiKeys();
|
|
67
|
+
});
|
|
68
|
+
this._adminEmailTemplatesCache = (0, import_common2.createCache)(async () => {
|
|
69
|
+
return await this._interface.listEmailTemplates();
|
|
70
|
+
});
|
|
71
|
+
this._adminTeamPermissionDefinitionsCache = (0, import_common2.createCache)(async () => {
|
|
72
|
+
return await this._interface.listPermissionDefinitions();
|
|
73
|
+
});
|
|
74
|
+
this._svixTokenCache = (0, import_common2.createCache)(async () => {
|
|
75
|
+
return await this._interface.getSvixToken();
|
|
76
|
+
});
|
|
77
|
+
this._metricsCache = (0, import_common2.createCache)(async () => {
|
|
78
|
+
return await this._interface.getMetrics();
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
_adminOwnedProjectFromCrud(data, onRefresh) {
|
|
82
|
+
if (this._tokenStoreInit !== null) {
|
|
83
|
+
throw new import_errors.StackAssertionError("Owned apps must always have tokenStore === null \u2014 did you not create this project with app._createOwnedApp()?");
|
|
84
|
+
;
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
...this._adminProjectFromCrud(data, onRefresh),
|
|
88
|
+
app: this
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
_adminProjectFromCrud(data, onRefresh) {
|
|
92
|
+
if (data.id !== this.projectId) {
|
|
93
|
+
throw new import_errors.StackAssertionError(`The project ID of the provided project JSON (${data.id}) does not match the project ID of the app (${this.projectId})!`);
|
|
94
|
+
}
|
|
95
|
+
const app = this;
|
|
96
|
+
return {
|
|
97
|
+
id: data.id,
|
|
98
|
+
displayName: data.display_name,
|
|
99
|
+
description: data.description,
|
|
100
|
+
createdAt: new Date(data.created_at_millis),
|
|
101
|
+
userCount: data.user_count,
|
|
102
|
+
isProductionMode: data.is_production_mode,
|
|
103
|
+
config: {
|
|
104
|
+
id: data.config.id,
|
|
105
|
+
signUpEnabled: data.config.sign_up_enabled,
|
|
106
|
+
credentialEnabled: data.config.credential_enabled,
|
|
107
|
+
magicLinkEnabled: data.config.magic_link_enabled,
|
|
108
|
+
passkeyEnabled: data.config.passkey_enabled,
|
|
109
|
+
clientTeamCreationEnabled: data.config.client_team_creation_enabled,
|
|
110
|
+
clientUserDeletionEnabled: data.config.client_user_deletion_enabled,
|
|
111
|
+
allowLocalhost: data.config.allow_localhost,
|
|
112
|
+
oauthProviders: data.config.oauth_providers.map((p) => p.type === "shared" ? {
|
|
113
|
+
id: p.id,
|
|
114
|
+
enabled: p.enabled,
|
|
115
|
+
type: "shared"
|
|
116
|
+
} : {
|
|
117
|
+
id: p.id,
|
|
118
|
+
enabled: p.enabled,
|
|
119
|
+
type: "standard",
|
|
120
|
+
clientId: p.client_id ?? (0, import_errors.throwErr)("Client ID is missing"),
|
|
121
|
+
clientSecret: p.client_secret ?? (0, import_errors.throwErr)("Client secret is missing"),
|
|
122
|
+
facebookConfigId: p.facebook_config_id,
|
|
123
|
+
microsoftTenantId: p.microsoft_tenant_id
|
|
124
|
+
}),
|
|
125
|
+
emailConfig: data.config.email_config.type === "shared" ? {
|
|
126
|
+
type: "shared"
|
|
127
|
+
} : {
|
|
128
|
+
type: "standard",
|
|
129
|
+
host: data.config.email_config.host ?? (0, import_errors.throwErr)("Email host is missing"),
|
|
130
|
+
port: data.config.email_config.port ?? (0, import_errors.throwErr)("Email port is missing"),
|
|
131
|
+
username: data.config.email_config.username ?? (0, import_errors.throwErr)("Email username is missing"),
|
|
132
|
+
password: data.config.email_config.password ?? (0, import_errors.throwErr)("Email password is missing"),
|
|
133
|
+
senderName: data.config.email_config.sender_name ?? (0, import_errors.throwErr)("Email sender name is missing"),
|
|
134
|
+
senderEmail: data.config.email_config.sender_email ?? (0, import_errors.throwErr)("Email sender email is missing")
|
|
135
|
+
},
|
|
136
|
+
domains: data.config.domains.map((d) => ({
|
|
137
|
+
domain: d.domain,
|
|
138
|
+
handlerPath: d.handler_path
|
|
139
|
+
})),
|
|
140
|
+
createTeamOnSignUp: data.config.create_team_on_sign_up,
|
|
141
|
+
teamCreatorDefaultPermissions: data.config.team_creator_default_permissions,
|
|
142
|
+
teamMemberDefaultPermissions: data.config.team_member_default_permissions
|
|
143
|
+
},
|
|
144
|
+
async update(update) {
|
|
145
|
+
await app._interface.updateProject((0, import_projects.adminProjectUpdateOptionsToCrud)(update));
|
|
146
|
+
await onRefresh();
|
|
147
|
+
},
|
|
148
|
+
async delete() {
|
|
149
|
+
await app._interface.deleteProject();
|
|
150
|
+
},
|
|
151
|
+
async getProductionModeErrors() {
|
|
152
|
+
return (0, import_production_mode.getProductionModeErrors)(data);
|
|
153
|
+
},
|
|
154
|
+
useProductionModeErrors() {
|
|
155
|
+
return (0, import_production_mode.getProductionModeErrors)(data);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
_adminEmailTemplateFromCrud(data) {
|
|
160
|
+
return {
|
|
161
|
+
type: data.type,
|
|
162
|
+
subject: data.subject,
|
|
163
|
+
content: data.content,
|
|
164
|
+
isDefault: data.is_default
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
async getProject() {
|
|
168
|
+
return this._adminProjectFromCrud(
|
|
169
|
+
import_results.Result.orThrow(await this._adminProjectCache.getOrWait([], "write-only")),
|
|
170
|
+
() => this._refreshProject()
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
useProject() {
|
|
174
|
+
const crud = (0, import_common3.useAsyncCache)(this._adminProjectCache, [], "useProjectAdmin()");
|
|
175
|
+
return (0, import_react.useMemo)(() => this._adminProjectFromCrud(
|
|
176
|
+
crud,
|
|
177
|
+
() => this._refreshProject()
|
|
178
|
+
), [crud]);
|
|
179
|
+
}
|
|
180
|
+
_createApiKeyBaseFromCrud(data) {
|
|
181
|
+
const app = this;
|
|
182
|
+
return {
|
|
183
|
+
id: data.id,
|
|
184
|
+
description: data.description,
|
|
185
|
+
expiresAt: new Date(data.expires_at_millis),
|
|
186
|
+
manuallyRevokedAt: data.manually_revoked_at_millis ? new Date(data.manually_revoked_at_millis) : null,
|
|
187
|
+
createdAt: new Date(data.created_at_millis),
|
|
188
|
+
isValid() {
|
|
189
|
+
return this.whyInvalid() === null;
|
|
190
|
+
},
|
|
191
|
+
whyInvalid() {
|
|
192
|
+
if (this.expiresAt.getTime() < Date.now()) return "expired";
|
|
193
|
+
if (this.manuallyRevokedAt) return "manually-revoked";
|
|
194
|
+
return null;
|
|
195
|
+
},
|
|
196
|
+
async revoke() {
|
|
197
|
+
const res = await app._interface.revokeApiKeyById(data.id);
|
|
198
|
+
await app._refreshApiKeys();
|
|
199
|
+
return res;
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
_createApiKeyFromCrud(data) {
|
|
204
|
+
return {
|
|
205
|
+
...this._createApiKeyBaseFromCrud(data),
|
|
206
|
+
publishableClientKey: data.publishable_client_key ? { lastFour: data.publishable_client_key.last_four } : null,
|
|
207
|
+
secretServerKey: data.secret_server_key ? { lastFour: data.secret_server_key.last_four } : null,
|
|
208
|
+
superSecretAdminKey: data.super_secret_admin_key ? { lastFour: data.super_secret_admin_key.last_four } : null
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
_createApiKeyFirstViewFromCrud(data) {
|
|
212
|
+
return {
|
|
213
|
+
...this._createApiKeyBaseFromCrud(data),
|
|
214
|
+
publishableClientKey: data.publishable_client_key,
|
|
215
|
+
secretServerKey: data.secret_server_key,
|
|
216
|
+
superSecretAdminKey: data.super_secret_admin_key
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
async listApiKeys() {
|
|
220
|
+
const crud = import_results.Result.orThrow(await this._apiKeysCache.getOrWait([], "write-only"));
|
|
221
|
+
return crud.map((j) => this._createApiKeyFromCrud(j));
|
|
222
|
+
}
|
|
223
|
+
useApiKeys() {
|
|
224
|
+
const crud = (0, import_common3.useAsyncCache)(this._apiKeysCache, [], "useApiKeys()");
|
|
225
|
+
return (0, import_react.useMemo)(() => {
|
|
226
|
+
return crud.map((j) => this._createApiKeyFromCrud(j));
|
|
227
|
+
}, [crud]);
|
|
228
|
+
}
|
|
229
|
+
async createApiKey(options) {
|
|
230
|
+
const crud = await this._interface.createApiKey((0, import_api_keys.apiKeyCreateOptionsToCrud)(options));
|
|
231
|
+
await this._refreshApiKeys();
|
|
232
|
+
return this._createApiKeyFirstViewFromCrud(crud);
|
|
233
|
+
}
|
|
234
|
+
useEmailTemplates() {
|
|
235
|
+
const crud = (0, import_common3.useAsyncCache)(this._adminEmailTemplatesCache, [], "useEmailTemplates()");
|
|
236
|
+
return (0, import_react.useMemo)(() => {
|
|
237
|
+
return crud.map((j) => this._adminEmailTemplateFromCrud(j));
|
|
238
|
+
}, [crud]);
|
|
239
|
+
}
|
|
240
|
+
async listEmailTemplates() {
|
|
241
|
+
const crud = import_results.Result.orThrow(await this._adminEmailTemplatesCache.getOrWait([], "write-only"));
|
|
242
|
+
return crud.map((j) => this._adminEmailTemplateFromCrud(j));
|
|
243
|
+
}
|
|
244
|
+
async updateEmailTemplate(type, data) {
|
|
245
|
+
await this._interface.updateEmailTemplate(type, (0, import_email_templates.adminEmailTemplateUpdateOptionsToCrud)(data));
|
|
246
|
+
await this._adminEmailTemplatesCache.refresh([]);
|
|
247
|
+
}
|
|
248
|
+
async resetEmailTemplate(type) {
|
|
249
|
+
await this._interface.resetEmailTemplate(type);
|
|
250
|
+
await this._adminEmailTemplatesCache.refresh([]);
|
|
251
|
+
}
|
|
252
|
+
async createTeamPermissionDefinition(data) {
|
|
253
|
+
const crud = await this._interface.createPermissionDefinition((0, import_permissions.adminTeamPermissionDefinitionCreateOptionsToCrud)(data));
|
|
254
|
+
await this._adminTeamPermissionDefinitionsCache.refresh([]);
|
|
255
|
+
return this._serverTeamPermissionDefinitionFromCrud(crud);
|
|
256
|
+
}
|
|
257
|
+
async updateTeamPermissionDefinition(permissionId, data) {
|
|
258
|
+
await this._interface.updatePermissionDefinition(permissionId, (0, import_permissions.adminTeamPermissionDefinitionUpdateOptionsToCrud)(data));
|
|
259
|
+
await this._adminTeamPermissionDefinitionsCache.refresh([]);
|
|
260
|
+
}
|
|
261
|
+
async deleteTeamPermissionDefinition(permissionId) {
|
|
262
|
+
await this._interface.deletePermissionDefinition(permissionId);
|
|
263
|
+
await this._adminTeamPermissionDefinitionsCache.refresh([]);
|
|
264
|
+
}
|
|
265
|
+
async listTeamPermissionDefinitions() {
|
|
266
|
+
const crud = import_results.Result.orThrow(await this._adminTeamPermissionDefinitionsCache.getOrWait([], "write-only"));
|
|
267
|
+
return crud.map((p) => this._serverTeamPermissionDefinitionFromCrud(p));
|
|
268
|
+
}
|
|
269
|
+
useTeamPermissionDefinitions() {
|
|
270
|
+
const crud = (0, import_common3.useAsyncCache)(this._adminTeamPermissionDefinitionsCache, [], "usePermissions()");
|
|
271
|
+
return (0, import_react.useMemo)(() => {
|
|
272
|
+
return crud.map((p) => this._serverTeamPermissionDefinitionFromCrud(p));
|
|
273
|
+
}, [crud]);
|
|
274
|
+
}
|
|
275
|
+
useSvixToken() {
|
|
276
|
+
const crud = (0, import_common3.useAsyncCache)(this._svixTokenCache, [], "useSvixToken()");
|
|
277
|
+
return crud.token;
|
|
278
|
+
}
|
|
279
|
+
async _refreshProject() {
|
|
280
|
+
await Promise.all([
|
|
281
|
+
super._refreshProject(),
|
|
282
|
+
this._adminProjectCache.refresh([])
|
|
283
|
+
]);
|
|
284
|
+
}
|
|
285
|
+
async _refreshApiKeys() {
|
|
286
|
+
await this._apiKeysCache.refresh([]);
|
|
287
|
+
}
|
|
288
|
+
get [import_common.stackAppInternalsSymbol]() {
|
|
289
|
+
return {
|
|
290
|
+
...super[import_common.stackAppInternalsSymbol],
|
|
291
|
+
useMetrics: () => {
|
|
292
|
+
return (0, import_common3.useAsyncCache)(this._metricsCache, [], "useMetrics()");
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
async sendTestEmail(options) {
|
|
297
|
+
const response = await this._interface.sendTestEmail({
|
|
298
|
+
recipient_email: options.recipientEmail,
|
|
299
|
+
email_config: {
|
|
300
|
+
...(0, import_objects.pick)(options.emailConfig, ["host", "port", "username", "password"]),
|
|
301
|
+
sender_email: options.emailConfig.senderEmail,
|
|
302
|
+
sender_name: options.emailConfig.senderName
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
if (response.success) {
|
|
306
|
+
return import_results.Result.ok(void 0);
|
|
307
|
+
} else {
|
|
308
|
+
return import_results.Result.error({ errorMessage: response.error_message ?? (0, import_errors.throwErr)("Email test error not specified") });
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
313
|
+
0 && (module.exports = {
|
|
314
|
+
_StackAdminAppImplIncomplete
|
|
315
|
+
});
|
|
316
|
+
//# sourceMappingURL=admin-app-impl.js.map
|