@stackframe/stack 2.3.4 → 2.3.7
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/README.md +2 -2
- package/dist/components/card-frame.d.mts +9 -0
- package/dist/components/card-frame.d.ts +8 -5
- package/dist/components/card-frame.js +58 -23
- package/dist/components/credential-sign-in.d.mts +5 -0
- package/dist/components/credential-sign-in.d.ts +5 -1
- package/dist/components/credential-sign-in.js +109 -41
- package/dist/components/credential-sign-up.d.mts +5 -0
- package/dist/components/credential-sign-up.d.ts +5 -1
- package/dist/components/credential-sign-up.js +140 -62
- package/dist/components/forgot-password.d.mts +7 -0
- package/dist/components/forgot-password.d.ts +6 -2
- package/dist/components/forgot-password.js +83 -26
- package/dist/components/form-warning.d.mts +7 -0
- package/dist/components/form-warning.d.ts +6 -2
- package/dist/components/form-warning.js +34 -8
- package/dist/components/magic-link-sign-in.d.mts +5 -0
- package/dist/components/magic-link-sign-in.d.ts +5 -1
- package/dist/components/magic-link-sign-in.js +89 -31
- package/dist/components/message-card.d.mts +10 -0
- package/dist/components/message-card.d.ts +8 -4
- package/dist/components/message-card.js +45 -6
- package/dist/components/oauth-button.d.mts +8 -0
- package/dist/components/oauth-button.d.ts +6 -2
- package/dist/components/oauth-button.js +142 -63
- package/dist/components/oauth-group.d.mts +7 -0
- package/dist/components/oauth-group.d.ts +6 -2
- package/dist/components/oauth-group.js +46 -8
- package/dist/components/password-field.d.mts +5 -0
- package/dist/components/password-field.d.ts +5 -3
- package/dist/components/password-field.js +111 -41
- package/dist/components/password-reset-inner.d.mts +8 -0
- package/dist/components/password-reset-inner.d.ts +6 -2
- package/dist/components/password-reset-inner.js +120 -58
- package/dist/components/redirect-message-card.d.mts +8 -0
- package/dist/components/redirect-message-card.d.ts +6 -2
- package/dist/components/redirect-message-card.js +110 -58
- package/dist/components/separator-with-text.d.mts +7 -0
- package/dist/components/separator-with-text.d.ts +6 -2
- package/dist/components/separator-with-text.js +35 -5
- package/dist/components/user-avatar.d.mts +13 -0
- package/dist/components/user-avatar.d.ts +12 -2
- package/dist/components/user-avatar.js +34 -8
- package/dist/components/user-button.d.mts +15 -0
- package/dist/components/user-button.d.ts +14 -3
- package/dist/components/user-button.js +160 -24
- package/dist/components-core/avatar.d.mts +8 -0
- package/dist/components-core/avatar.d.ts +7 -5
- package/dist/components-core/avatar.js +73 -18
- package/dist/components-core/button.d.mts +12 -0
- package/dist/components-core/button.d.ts +8 -6
- package/dist/components-core/button.js +177 -113
- package/dist/components-core/card.d.mts +8 -0
- package/dist/components-core/card.d.ts +4 -2
- package/dist/components-core/card.js +73 -22
- package/dist/components-core/collapsible.d.mts +8 -0
- package/dist/components-core/collapsible.d.ts +8 -6
- package/dist/components-core/collapsible.js +48 -5
- package/dist/components-core/container.d.mts +8 -0
- package/dist/components-core/container.d.ts +5 -3
- package/dist/components-core/container.js +61 -11
- package/dist/components-core/dropdown.d.mts +15 -0
- package/dist/components-core/dropdown.d.ts +10 -8
- package/dist/components-core/dropdown.js +108 -36
- package/dist/components-core/index.d.mts +59 -0
- package/dist/components-core/index.d.ts +52 -38
- package/dist/components-core/index.js +144 -45
- package/dist/components-core/input.d.mts +6 -0
- package/dist/components-core/input.d.ts +5 -3
- package/dist/components-core/input.js +97 -28
- package/dist/components-core/label.d.mts +6 -0
- package/dist/components-core/label.d.ts +5 -3
- package/dist/components-core/label.js +65 -15
- package/dist/components-core/link.d.mts +10 -0
- package/dist/components-core/link.d.ts +7 -6
- package/dist/components-core/link.js +72 -18
- package/dist/components-core/loading-indicator.d.mts +13 -0
- package/dist/components-core/loading-indicator.d.ts +11 -4
- package/dist/components-core/loading-indicator.js +46 -6
- package/dist/components-core/popover.d.mts +8 -0
- package/dist/components-core/popover.d.ts +8 -6
- package/dist/components-core/popover.js +72 -16
- package/dist/components-core/separator.d.mts +6 -0
- package/dist/components-core/separator.d.ts +5 -3
- package/dist/components-core/separator.js +66 -16
- package/dist/components-core/skeleton.d.mts +7 -0
- package/dist/components-core/skeleton.d.ts +7 -0
- package/dist/components-core/skeleton.js +86 -0
- package/dist/components-core/tabs.d.mts +9 -0
- package/dist/components-core/tabs.d.ts +8 -6
- package/dist/components-core/tabs.js +87 -20
- package/dist/components-core/text.d.mts +10 -0
- package/dist/components-core/text.d.ts +5 -3
- package/dist/components-core/text.js +95 -40
- package/dist/components-core-joy/button.d.mts +6 -0
- package/dist/components-core-joy/button.d.ts +6 -2
- package/dist/components-core-joy/button.js +86 -28
- package/dist/components-core-joy/input.d.mts +5 -0
- package/dist/components-core-joy/input.d.ts +5 -2
- package/dist/components-core-joy/input.js +51 -6
- package/dist/components-core-joy/separator.d.mts +6 -0
- package/dist/components-core-joy/separator.d.ts +6 -2
- package/dist/components-core-joy/separator.js +50 -6
- package/dist/components-core-joy/tabs.d.mts +9 -0
- package/dist/components-core-joy/tabs.d.ts +9 -5
- package/dist/components-core-joy/tabs.js +62 -16
- package/dist/components-core-joy/text.d.mts +9 -0
- package/dist/components-core-joy/text.d.ts +6 -3
- package/dist/components-core-joy/text.js +68 -28
- package/dist/components-page/account-settings.d.mts +7 -0
- package/dist/components-page/account-settings.d.ts +6 -2
- package/dist/components-page/account-settings.js +213 -81
- package/dist/components-page/auth-page.d.mts +8 -0
- package/dist/components-page/auth-page.d.ts +6 -2
- package/dist/components-page/auth-page.js +79 -19
- package/dist/components-page/email-verification.d.mts +8 -0
- package/dist/components-page/email-verification.d.ts +6 -2
- package/dist/components-page/email-verification.js +65 -28
- package/dist/components-page/forgot-password.d.mts +7 -0
- package/dist/components-page/forgot-password.d.ts +6 -2
- package/dist/components-page/forgot-password.js +64 -20
- package/dist/components-page/magic-link-callback.d.mts +8 -0
- package/dist/components-page/magic-link-callback.d.ts +6 -2
- package/dist/components-page/magic-link-callback.js +72 -34
- package/dist/components-page/oauth-callback.d.mts +5 -0
- package/dist/components-page/oauth-callback.d.ts +5 -1
- package/dist/components-page/oauth-callback.js +52 -16
- package/dist/components-page/password-reset.d.mts +8 -0
- package/dist/components-page/password-reset.d.ts +6 -2
- package/dist/components-page/password-reset.js +70 -34
- package/dist/components-page/sign-in.d.mts +7 -0
- package/dist/components-page/sign-in.d.ts +6 -2
- package/dist/components-page/sign-in.js +41 -5
- package/dist/components-page/sign-out.d.mts +5 -0
- package/dist/components-page/sign-out.d.ts +5 -1
- package/dist/components-page/sign-out.js +47 -11
- package/dist/components-page/sign-up.d.mts +7 -0
- package/dist/components-page/sign-up.d.ts +6 -2
- package/dist/components-page/sign-up.js +41 -5
- package/dist/components-page/stack-handler.d.mts +16 -0
- package/dist/components-page/stack-handler.d.ts +11 -3
- package/dist/components-page/stack-handler.js +102 -64
- package/dist/esm/components/card-frame.js +39 -0
- package/dist/esm/components/credential-sign-in.js +82 -0
- package/dist/esm/components/credential-sign-up.js +114 -0
- package/dist/esm/components/forgot-password.js +55 -0
- package/dist/esm/components/form-warning.js +15 -0
- package/dist/esm/components/magic-link-sign-in.js +61 -0
- package/dist/esm/components/message-card.js +16 -0
- package/dist/esm/components/oauth-button.js +124 -0
- package/dist/esm/components/oauth-group.js +17 -0
- package/dist/esm/components/password-field.js +82 -0
- package/dist/esm/components/password-reset-inner.js +93 -0
- package/dist/esm/components/redirect-message-card.js +83 -0
- package/dist/esm/components/separator-with-text.js +16 -0
- package/dist/esm/components/user-avatar.js +14 -0
- package/dist/esm/components/user-button.js +133 -0
- package/dist/esm/components-core/avatar.js +56 -0
- package/dist/esm/components-core/button.js +165 -0
- package/dist/esm/components-core/card.js +51 -0
- package/dist/esm/components-core/collapsible.js +13 -0
- package/dist/esm/components-core/container.js +35 -0
- package/dist/esm/components-core/dropdown.js +106 -0
- package/dist/esm/components-core/index.js +93 -0
- package/dist/esm/components-core/input.js +80 -0
- package/dist/esm/components-core/label.js +38 -0
- package/dist/esm/components-core/link.js +38 -0
- package/dist/esm/components-core/loading-indicator.js +27 -0
- package/dist/esm/components-core/popover.js +43 -0
- package/dist/esm/components-core/separator.js +36 -0
- package/dist/esm/components-core/skeleton.js +52 -0
- package/dist/esm/components-core/tabs.js +79 -0
- package/dist/esm/components-core/text.js +63 -0
- package/dist/esm/components-core-joy/button.js +53 -0
- package/dist/esm/components-core-joy/input.js +18 -0
- package/dist/esm/components-core-joy/separator.js +17 -0
- package/dist/esm/components-core-joy/tabs.js +29 -0
- package/dist/esm/components-core-joy/text.js +35 -0
- package/dist/esm/components-page/account-settings.js +197 -0
- package/dist/esm/components-page/auth-page.js +50 -0
- package/dist/esm/components-page/email-verification.js +36 -0
- package/dist/esm/components-page/forgot-password.js +35 -0
- package/dist/esm/components-page/magic-link-callback.js +43 -0
- package/dist/esm/components-page/oauth-callback.js +23 -0
- package/dist/esm/components-page/password-reset.js +42 -0
- package/dist/esm/components-page/sign-in.js +12 -0
- package/dist/esm/components-page/sign-out.js +18 -0
- package/dist/esm/components-page/sign-up.js +12 -0
- package/dist/esm/components-page/stack-handler.js +75 -0
- package/dist/esm/index.js +47 -0
- package/dist/esm/joy.js +5 -0
- package/dist/esm/lib/auth.js +62 -0
- package/dist/esm/lib/cookie.js +185 -0
- package/dist/esm/lib/hooks.js +29 -0
- package/dist/esm/lib/stack-app.js +940 -0
- package/dist/esm/providers/component-provider.js +76 -0
- package/dist/esm/providers/design-provider.js +36 -0
- package/dist/esm/providers/joy-provider.js +35 -0
- package/dist/esm/providers/stack-provider-client.js +31 -0
- package/dist/esm/providers/stack-provider.js +21 -0
- package/dist/esm/providers/styled-components-registry.js +24 -0
- package/dist/esm/providers/theme-provider.js +22 -0
- package/dist/esm/utils/browser-script.js +25 -0
- package/dist/esm/utils/constants.js +34 -0
- package/dist/esm/utils/email.js +10 -0
- package/dist/esm/utils/next.js +7 -0
- package/dist/esm/utils/url.js +21 -0
- package/dist/index.d.mts +37 -0
- package/dist/index.d.ts +37 -22
- package/dist/index.js +106 -21
- package/dist/joy.d.mts +16 -0
- package/dist/joy.d.ts +16 -1
- package/dist/joy.js +30 -1
- package/dist/lib/auth.d.mts +11 -0
- package/dist/lib/auth.d.ts +8 -4
- package/dist/lib/auth.js +83 -57
- package/dist/lib/cookie.d.mts +14 -0
- package/dist/lib/cookie.d.ts +8 -6
- package/dist/lib/cookie.js +217 -45
- package/dist/lib/hooks.d.mts +35 -0
- package/dist/lib/hooks.d.ts +14 -8
- package/dist/lib/hooks.js +53 -28
- package/dist/lib/stack-app.d.mts +227 -0
- package/dist/lib/stack-app.d.ts +45 -44
- package/dist/lib/stack-app.js +937 -861
- package/dist/providers/component-provider.d.mts +113 -0
- package/dist/providers/component-provider.d.ts +97 -73
- package/dist/providers/component-provider.js +92 -56
- package/dist/providers/design-provider.d.mts +34 -0
- package/dist/providers/design-provider.d.ts +16 -21
- package/dist/providers/design-provider.js +57 -64
- package/dist/providers/joy-provider.d.mts +36 -0
- package/dist/providers/joy-provider.d.ts +30 -14
- package/dist/providers/joy-provider.js +58 -30
- package/dist/providers/stack-provider-client.d.mts +20 -0
- package/dist/providers/stack-provider-client.d.ts +18 -7
- package/dist/providers/stack-provider-client.js +65 -12
- package/dist/providers/stack-provider.d.mts +14 -0
- package/dist/providers/stack-provider.d.ts +13 -5
- package/dist/providers/stack-provider.js +41 -5
- package/dist/providers/styled-components-registry.d.mts +8 -0
- package/dist/providers/styled-components-registry.d.ts +8 -4
- package/dist/providers/styled-components-registry.js +43 -17
- package/dist/providers/theme-provider.d.mts +22 -0
- package/dist/providers/theme-provider.d.ts +21 -9
- package/dist/providers/theme-provider.js +55 -19
- package/dist/utils/browser-script.d.mts +5 -0
- package/dist/utils/browser-script.d.ts +5 -0
- package/dist/utils/browser-script.js +50 -0
- package/dist/utils/constants.d.mts +48 -0
- package/dist/utils/constants.d.ts +11 -9
- package/dist/utils/constants.js +66 -21
- package/dist/utils/email.d.mts +3 -0
- package/dist/utils/email.d.ts +3 -1
- package/dist/utils/email.js +44 -6
- package/dist/utils/next.d.mts +3 -0
- package/dist/utils/next.d.ts +3 -1
- package/dist/utils/next.js +31 -3
- package/dist/utils/url.d.mts +4 -0
- package/dist/utils/url.d.ts +4 -2
- package/dist/utils/url.js +44 -13
- package/package.json +20 -11
package/dist/lib/hooks.js
CHANGED
|
@@ -1,30 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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/hooks.ts
|
|
21
|
+
var hooks_exports = {};
|
|
22
|
+
__export(hooks_exports, {
|
|
23
|
+
useStackApp: () => useStackApp,
|
|
24
|
+
useUser: () => useUser
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(hooks_exports);
|
|
27
|
+
var import_stack_provider_client = require("../providers/stack-provider-client");
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
function useUser(options = {}) {
|
|
30
|
+
const stackApp = useStackApp(options);
|
|
31
|
+
if (options.projectIdMustMatch && stackApp.projectId !== options.projectIdMustMatch) {
|
|
32
|
+
throw new Error("Unexpected project ID in useStackApp: " + stackApp.projectId);
|
|
33
|
+
}
|
|
34
|
+
if (options.projectIdMustMatch === "internal") {
|
|
35
|
+
return stackApp.useUser(options);
|
|
36
|
+
} else {
|
|
37
|
+
return stackApp.useUser(options);
|
|
38
|
+
}
|
|
14
39
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const stackApp = context.app;
|
|
26
|
-
if (options.projectIdMustMatch && stackApp.projectId !== options.projectIdMustMatch) {
|
|
27
|
-
throw new Error("Unexpected project ID in useStackApp: " + stackApp.projectId);
|
|
28
|
-
}
|
|
29
|
-
return stackApp;
|
|
40
|
+
function useStackApp(options = {}) {
|
|
41
|
+
const context = (0, import_react.useContext)(import_stack_provider_client.StackContext);
|
|
42
|
+
if (context === null) {
|
|
43
|
+
throw new Error("useStackApp must be used within a StackProvider");
|
|
44
|
+
}
|
|
45
|
+
const stackApp = context.app;
|
|
46
|
+
if (options.projectIdMustMatch && stackApp.projectId !== options.projectIdMustMatch) {
|
|
47
|
+
throw new Error("Unexpected project ID in useStackApp: " + stackApp.projectId);
|
|
48
|
+
}
|
|
49
|
+
return stackApp;
|
|
30
50
|
}
|
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
+
0 && (module.exports = {
|
|
53
|
+
useStackApp,
|
|
54
|
+
useUser
|
|
55
|
+
});
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { ServerUserJson, ServerUserCustomizableJson, OAuthProviderConfigJson, KnownErrors } from '@stackframe/stack-shared';
|
|
2
|
+
import { ReadonlyTokenStore, UserJson, UserCustomizableJson, ProjectJson, ProductionModeError, EmailConfigJson, DomainConfigJson, ClientProjectJson } from '@stackframe/stack-shared/dist/interface/clientInterface';
|
|
3
|
+
import { ReadonlyJson } from '@stackframe/stack-shared/dist/utils/json';
|
|
4
|
+
import { ProjectUpdateOptions, ApiKeySetCreateOptions } from '@stackframe/stack-shared/dist/interface/adminInterface';
|
|
5
|
+
|
|
6
|
+
type TokenStoreOptions<HasTokenStore extends boolean = boolean> = HasTokenStore extends true ? "cookie" | "nextjs-cookie" | "memory" : HasTokenStore extends false ? null : TokenStoreOptions<true> | TokenStoreOptions<false>;
|
|
7
|
+
type HandlerUrls = {
|
|
8
|
+
handler: string;
|
|
9
|
+
signIn: string;
|
|
10
|
+
afterSignIn: string;
|
|
11
|
+
signUp: string;
|
|
12
|
+
afterSignUp: string;
|
|
13
|
+
signOut: string;
|
|
14
|
+
afterSignOut: string;
|
|
15
|
+
emailVerification: string;
|
|
16
|
+
passwordReset: string;
|
|
17
|
+
forgotPassword: string;
|
|
18
|
+
home: string;
|
|
19
|
+
oauthCallback: string;
|
|
20
|
+
magicLinkCallback: string;
|
|
21
|
+
accountSettings: string;
|
|
22
|
+
};
|
|
23
|
+
type ProjectCurrentUser<ProjectId> = ProjectId extends "internal" ? CurrentInternalUser : CurrentUser;
|
|
24
|
+
type StackClientAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = {
|
|
25
|
+
baseUrl?: string;
|
|
26
|
+
projectId?: ProjectId;
|
|
27
|
+
publishableClientKey?: string;
|
|
28
|
+
urls?: Partial<HandlerUrls>;
|
|
29
|
+
tokenStore: TokenStoreOptions<HasTokenStore>;
|
|
30
|
+
};
|
|
31
|
+
type StackServerAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = StackClientAppConstructorOptions<HasTokenStore, ProjectId> & {
|
|
32
|
+
secretServerKey?: string;
|
|
33
|
+
};
|
|
34
|
+
type StackAdminAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = ((StackServerAppConstructorOptions<HasTokenStore, ProjectId> & {
|
|
35
|
+
superSecretAdminKey?: string;
|
|
36
|
+
}) | (Omit<StackServerAppConstructorOptions<HasTokenStore, ProjectId>, "publishableClientKey" | "secretServerKey"> & {
|
|
37
|
+
projectOwnerTokens: ReadonlyTokenStore;
|
|
38
|
+
}));
|
|
39
|
+
type StackClientAppJson<HasTokenStore extends boolean, ProjectId extends string> = StackClientAppConstructorOptions<HasTokenStore, ProjectId> & {
|
|
40
|
+
uniqueIdentifier: string;
|
|
41
|
+
};
|
|
42
|
+
declare const stackAppInternalsSymbol: unique symbol;
|
|
43
|
+
type Auth<T, C> = {
|
|
44
|
+
readonly tokenStore: ReadonlyTokenStore;
|
|
45
|
+
update(this: T, user: Partial<C>): Promise<void>;
|
|
46
|
+
signOut(this: T): Promise<void>;
|
|
47
|
+
sendVerificationEmail(this: T): Promise<KnownErrors["EmailAlreadyVerified"] | undefined>;
|
|
48
|
+
updatePassword(this: T, options: {
|
|
49
|
+
oldPassword: string;
|
|
50
|
+
newPassword: string;
|
|
51
|
+
}): Promise<KnownErrors["PasswordMismatch"] | KnownErrors["PasswordRequirementsNotMet"] | undefined>;
|
|
52
|
+
};
|
|
53
|
+
type InternalAuth<T> = {
|
|
54
|
+
createProject(this: T, newProject: Pick<Project, "displayName" | "description">): Promise<Project>;
|
|
55
|
+
listOwnedProjects(this: T): Promise<Project[]>;
|
|
56
|
+
useOwnedProjects(this: T): Project[];
|
|
57
|
+
onOwnedProjectsChange(this: T, callback: (projects: Project[]) => void): void;
|
|
58
|
+
};
|
|
59
|
+
type User = {
|
|
60
|
+
readonly projectId: string;
|
|
61
|
+
readonly id: string;
|
|
62
|
+
readonly displayName: string | null;
|
|
63
|
+
/**
|
|
64
|
+
* The user's email address.
|
|
65
|
+
*
|
|
66
|
+
* Note: This might NOT be unique across multiple users, so always use `id` for unique identification.
|
|
67
|
+
*/
|
|
68
|
+
readonly primaryEmail: string | null;
|
|
69
|
+
readonly primaryEmailVerified: boolean;
|
|
70
|
+
readonly profileImageUrl: string | null;
|
|
71
|
+
readonly signedUpAt: Date;
|
|
72
|
+
readonly clientMetadata: ReadonlyJson;
|
|
73
|
+
readonly authMethod: 'credential' | 'oauth';
|
|
74
|
+
readonly hasPassword: boolean;
|
|
75
|
+
readonly authWithEmail: boolean;
|
|
76
|
+
readonly oauthProviders: readonly string[];
|
|
77
|
+
toJson(this: CurrentUser): UserJson;
|
|
78
|
+
};
|
|
79
|
+
type CurrentUser = Auth<User, UserCustomizableJson> & User;
|
|
80
|
+
type CurrentInternalUser = CurrentUser & InternalAuth<CurrentUser>;
|
|
81
|
+
/**
|
|
82
|
+
* A user including sensitive fields that should only be used on the server, never sent to the client
|
|
83
|
+
* (such as sensitive information and serverMetadata).
|
|
84
|
+
*/
|
|
85
|
+
type ServerUser = Omit<User, "toJson"> & {
|
|
86
|
+
readonly serverMetadata: ReadonlyJson;
|
|
87
|
+
/**
|
|
88
|
+
* Returns a new user object with the sensitive fields removed.
|
|
89
|
+
*/
|
|
90
|
+
getClientUser(this: ServerUser): User;
|
|
91
|
+
toJson(this: ServerUser): ServerUserJson;
|
|
92
|
+
update(this: ServerUser, user: Partial<ServerUserCustomizableJson>): Promise<void>;
|
|
93
|
+
delete(this: ServerUser): Promise<void>;
|
|
94
|
+
};
|
|
95
|
+
type CurrentServerUser = Auth<ServerUser, ServerUserCustomizableJson> & Omit<ServerUser, "getClientUser"> & {
|
|
96
|
+
getClientUser(this: CurrentServerUser): CurrentUser;
|
|
97
|
+
};
|
|
98
|
+
type CurrentInternalServerUser = CurrentServerUser & InternalAuth<CurrentServerUser>;
|
|
99
|
+
type Project = {
|
|
100
|
+
readonly id: string;
|
|
101
|
+
readonly displayName: string;
|
|
102
|
+
readonly description?: string;
|
|
103
|
+
readonly createdAt: Date;
|
|
104
|
+
readonly userCount: number;
|
|
105
|
+
readonly isProductionMode: boolean;
|
|
106
|
+
readonly evaluatedConfig: {
|
|
107
|
+
readonly id: string;
|
|
108
|
+
readonly allowLocalhost: boolean;
|
|
109
|
+
readonly credentialEnabled: boolean;
|
|
110
|
+
readonly magicLinkEnabled: boolean;
|
|
111
|
+
readonly oauthProviders: OAuthProviderConfig[];
|
|
112
|
+
readonly emailConfig?: EmailConfig;
|
|
113
|
+
readonly domains: DomainConfig[];
|
|
114
|
+
};
|
|
115
|
+
update(this: Project, update: ProjectUpdateOptions): Promise<void>;
|
|
116
|
+
toJson(this: Project): ProjectJson;
|
|
117
|
+
getProductionModeErrors(this: Project): ProductionModeError[];
|
|
118
|
+
};
|
|
119
|
+
type ApiKeySetBase = {
|
|
120
|
+
id: string;
|
|
121
|
+
description: string;
|
|
122
|
+
expiresAt: Date;
|
|
123
|
+
manuallyRevokedAt: Date | null;
|
|
124
|
+
createdAt: Date;
|
|
125
|
+
isValid(): boolean;
|
|
126
|
+
whyInvalid(): "expired" | "manually-revoked" | null;
|
|
127
|
+
revoke(): Promise<void>;
|
|
128
|
+
};
|
|
129
|
+
type ApiKeySetFirstView = ApiKeySetBase & {
|
|
130
|
+
publishableClientKey?: string;
|
|
131
|
+
secretServerKey?: string;
|
|
132
|
+
superSecretAdminKey?: string;
|
|
133
|
+
};
|
|
134
|
+
type ApiKeySet = ApiKeySetBase & {
|
|
135
|
+
publishableClientKey: null | {
|
|
136
|
+
lastFour: string;
|
|
137
|
+
};
|
|
138
|
+
secretServerKey: null | {
|
|
139
|
+
lastFour: string;
|
|
140
|
+
};
|
|
141
|
+
superSecretAdminKey: null | {
|
|
142
|
+
lastFour: string;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
type EmailConfig = EmailConfigJson;
|
|
146
|
+
type DomainConfig = DomainConfigJson;
|
|
147
|
+
type OAuthProviderConfig = OAuthProviderConfigJson;
|
|
148
|
+
type GetUserOptions = {
|
|
149
|
+
or?: 'redirect' | 'throw' | 'return-null';
|
|
150
|
+
};
|
|
151
|
+
type AsyncStoreProperty<Name extends string, Value, IsMultiple extends boolean> = {
|
|
152
|
+
[key in `${IsMultiple extends true ? "list" : "get"}${Capitalize<Name>}`]: () => Promise<Value>;
|
|
153
|
+
} & {
|
|
154
|
+
[key in `on${Capitalize<Name>}Change`]: (callback: (value: Value) => void) => void;
|
|
155
|
+
} & {
|
|
156
|
+
[key in `use${Capitalize<Name>}`]: () => Value;
|
|
157
|
+
};
|
|
158
|
+
type StackClientAppConstructor = {
|
|
159
|
+
new <TokenStoreType extends string, HasTokenStore extends (TokenStoreType extends {} ? true : boolean), ProjectId extends string>(options: StackClientAppConstructorOptions<HasTokenStore, ProjectId>): StackClientApp<HasTokenStore, ProjectId>;
|
|
160
|
+
new (options: StackClientAppConstructorOptions<boolean, string>): StackClientApp<boolean, string>;
|
|
161
|
+
[stackAppInternalsSymbol]: {
|
|
162
|
+
fromClientJson<HasTokenStore extends boolean, ProjectId extends string>(json: StackClientAppJson<HasTokenStore, ProjectId>): StackClientApp<HasTokenStore, ProjectId>;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = ({
|
|
166
|
+
readonly projectId: ProjectId;
|
|
167
|
+
readonly urls: Readonly<HandlerUrls>;
|
|
168
|
+
signInWithOAuth(provider: string): Promise<void>;
|
|
169
|
+
signInWithCredential(options: {
|
|
170
|
+
email: string;
|
|
171
|
+
password: string;
|
|
172
|
+
}): Promise<KnownErrors["EmailPasswordMismatch"] | undefined>;
|
|
173
|
+
signUpWithCredential(options: {
|
|
174
|
+
email: string;
|
|
175
|
+
password: string;
|
|
176
|
+
}): Promise<KnownErrors["UserEmailAlreadyExists"] | undefined>;
|
|
177
|
+
callOAuthCallback(): Promise<void>;
|
|
178
|
+
sendForgotPasswordEmail(email: string): Promise<KnownErrors["UserNotFound"] | undefined>;
|
|
179
|
+
sendMagicLinkEmail(email: string): Promise<KnownErrors["RedirectUrlNotWhitelisted"] | undefined>;
|
|
180
|
+
resetPassword(options: {
|
|
181
|
+
code: string;
|
|
182
|
+
password: string;
|
|
183
|
+
}): Promise<KnownErrors["PasswordResetError"] | undefined>;
|
|
184
|
+
verifyPasswordResetCode(code: string): Promise<KnownErrors["PasswordResetCodeError"] | undefined>;
|
|
185
|
+
verifyEmail(code: string): Promise<KnownErrors["EmailVerificationError"] | undefined>;
|
|
186
|
+
signInWithMagicLink(code: string): Promise<KnownErrors["MagicLinkError"] | undefined>;
|
|
187
|
+
[stackAppInternalsSymbol]: {
|
|
188
|
+
toClientJson(): StackClientAppJson<HasTokenStore, ProjectId>;
|
|
189
|
+
setCurrentUser(userJsonPromise: Promise<UserJson | null>): void;
|
|
190
|
+
};
|
|
191
|
+
} & AsyncStoreProperty<"project", ClientProjectJson, false> & {
|
|
192
|
+
[K in `redirectTo${Capitalize<keyof Omit<HandlerUrls, 'handler' | 'oauthCallback'>>}`]: () => Promise<never>;
|
|
193
|
+
} & (HasTokenStore extends false ? {} : {
|
|
194
|
+
redirectToOAuthCallback(): Promise<never>;
|
|
195
|
+
useUser(options: GetUserOptions & {
|
|
196
|
+
or: 'redirect';
|
|
197
|
+
}): ProjectCurrentUser<ProjectId>;
|
|
198
|
+
useUser(options: GetUserOptions & {
|
|
199
|
+
or: 'throw';
|
|
200
|
+
}): ProjectCurrentUser<ProjectId>;
|
|
201
|
+
useUser(options?: GetUserOptions): ProjectCurrentUser<ProjectId> | null;
|
|
202
|
+
getUser(options: GetUserOptions & {
|
|
203
|
+
or: 'redirect';
|
|
204
|
+
}): Promise<ProjectCurrentUser<ProjectId>>;
|
|
205
|
+
getUser(options: GetUserOptions & {
|
|
206
|
+
or: 'throw';
|
|
207
|
+
}): Promise<ProjectCurrentUser<ProjectId>>;
|
|
208
|
+
getUser(options?: GetUserOptions): Promise<ProjectCurrentUser<ProjectId> | null>;
|
|
209
|
+
onUserChange: AsyncStoreProperty<"user", CurrentUser | null, false>["onUserChange"];
|
|
210
|
+
}));
|
|
211
|
+
declare const StackClientApp: StackClientAppConstructor;
|
|
212
|
+
type StackServerAppConstructor = {
|
|
213
|
+
new <TokenStoreType extends string, HasTokenStore extends (TokenStoreType extends {} ? true : boolean), ProjectId extends string>(options: StackServerAppConstructorOptions<HasTokenStore, ProjectId>): StackServerApp<HasTokenStore, ProjectId>;
|
|
214
|
+
new (options: StackServerAppConstructorOptions<boolean, string>): StackServerApp<boolean, string>;
|
|
215
|
+
};
|
|
216
|
+
type StackServerApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (StackClientApp<HasTokenStore, ProjectId> & AsyncStoreProperty<"serverUser", CurrentServerUser | null, false> & AsyncStoreProperty<"serverUsers", ServerUser[], true> & {});
|
|
217
|
+
declare const StackServerApp: StackServerAppConstructor;
|
|
218
|
+
type StackAdminAppConstructor = {
|
|
219
|
+
new <HasTokenStore extends boolean, ProjectId extends string>(options: StackAdminAppConstructorOptions<HasTokenStore, ProjectId>): StackAdminApp<HasTokenStore, ProjectId>;
|
|
220
|
+
new (options: StackAdminAppConstructorOptions<boolean, string>): StackAdminApp<boolean, string>;
|
|
221
|
+
};
|
|
222
|
+
type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (StackServerApp<HasTokenStore, ProjectId> & AsyncStoreProperty<"projectAdmin", Project, false> & AsyncStoreProperty<"apiKeySets", ApiKeySet[], true> & {
|
|
223
|
+
createApiKeySet(options: ApiKeySetCreateOptions): Promise<ApiKeySetFirstView>;
|
|
224
|
+
});
|
|
225
|
+
declare const StackAdminApp: StackAdminAppConstructor;
|
|
226
|
+
|
|
227
|
+
export { type ApiKeySet, type ApiKeySetBase, type ApiKeySetFirstView, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type DomainConfig, type EmailConfig, type GetUserOptions, type HandlerUrls, type OAuthProviderConfig, type Project, type ServerUser, StackAdminApp, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructorOptions, type StackClientAppJson, StackServerApp, type StackServerAppConstructorOptions, type TokenStoreOptions, type User, stackAppInternalsSymbol };
|
package/dist/lib/stack-app.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ReadonlyJson } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ServerUserJson, ServerUserCustomizableJson, OAuthProviderConfigJson, KnownErrors } from '@stackframe/stack-shared';
|
|
2
|
+
import { ReadonlyTokenStore, UserJson, UserCustomizableJson, ProjectJson, ProductionModeError, EmailConfigJson, DomainConfigJson, ClientProjectJson } from '@stackframe/stack-shared/dist/interface/clientInterface';
|
|
3
|
+
import { ReadonlyJson } from '@stackframe/stack-shared/dist/utils/json';
|
|
4
|
+
import { ProjectUpdateOptions, ApiKeySetCreateOptions } from '@stackframe/stack-shared/dist/interface/adminInterface';
|
|
5
|
+
|
|
6
|
+
type TokenStoreOptions<HasTokenStore extends boolean = boolean> = HasTokenStore extends true ? "cookie" | "nextjs-cookie" | "memory" : HasTokenStore extends false ? null : TokenStoreOptions<true> | TokenStoreOptions<false>;
|
|
7
|
+
type HandlerUrls = {
|
|
7
8
|
handler: string;
|
|
8
9
|
signIn: string;
|
|
9
10
|
afterSignIn: string;
|
|
@@ -20,27 +21,25 @@ export type HandlerUrls = {
|
|
|
20
21
|
accountSettings: string;
|
|
21
22
|
};
|
|
22
23
|
type ProjectCurrentUser<ProjectId> = ProjectId extends "internal" ? CurrentInternalUser : CurrentUser;
|
|
23
|
-
|
|
24
|
+
type StackClientAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = {
|
|
24
25
|
baseUrl?: string;
|
|
25
26
|
projectId?: ProjectId;
|
|
26
27
|
publishableClientKey?: string;
|
|
27
28
|
urls?: Partial<HandlerUrls>;
|
|
28
29
|
tokenStore: TokenStoreOptions<HasTokenStore>;
|
|
29
30
|
};
|
|
30
|
-
|
|
31
|
+
type StackServerAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = StackClientAppConstructorOptions<HasTokenStore, ProjectId> & {
|
|
31
32
|
secretServerKey?: string;
|
|
32
33
|
};
|
|
33
|
-
|
|
34
|
+
type StackAdminAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = ((StackServerAppConstructorOptions<HasTokenStore, ProjectId> & {
|
|
34
35
|
superSecretAdminKey?: string;
|
|
35
36
|
}) | (Omit<StackServerAppConstructorOptions<HasTokenStore, ProjectId>, "publishableClientKey" | "secretServerKey"> & {
|
|
36
37
|
projectOwnerTokens: ReadonlyTokenStore;
|
|
37
38
|
}));
|
|
38
|
-
|
|
39
|
+
type StackClientAppJson<HasTokenStore extends boolean, ProjectId extends string> = StackClientAppConstructorOptions<HasTokenStore, ProjectId> & {
|
|
39
40
|
uniqueIdentifier: string;
|
|
40
|
-
currentClientUserJson: UserJson | null;
|
|
41
|
-
currentProjectJson: ClientProjectJson;
|
|
42
41
|
};
|
|
43
|
-
|
|
42
|
+
declare const stackAppInternalsSymbol: unique symbol;
|
|
44
43
|
type Auth<T, C> = {
|
|
45
44
|
readonly tokenStore: ReadonlyTokenStore;
|
|
46
45
|
update(this: T, user: Partial<C>): Promise<void>;
|
|
@@ -57,7 +56,7 @@ type InternalAuth<T> = {
|
|
|
57
56
|
useOwnedProjects(this: T): Project[];
|
|
58
57
|
onOwnedProjectsChange(this: T, callback: (projects: Project[]) => void): void;
|
|
59
58
|
};
|
|
60
|
-
|
|
59
|
+
type User = {
|
|
61
60
|
readonly projectId: string;
|
|
62
61
|
readonly id: string;
|
|
63
62
|
readonly displayName: string | null;
|
|
@@ -77,13 +76,13 @@ export type User = {
|
|
|
77
76
|
readonly oauthProviders: readonly string[];
|
|
78
77
|
toJson(this: CurrentUser): UserJson;
|
|
79
78
|
};
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
type CurrentUser = Auth<User, UserCustomizableJson> & User;
|
|
80
|
+
type CurrentInternalUser = CurrentUser & InternalAuth<CurrentUser>;
|
|
82
81
|
/**
|
|
83
82
|
* A user including sensitive fields that should only be used on the server, never sent to the client
|
|
84
83
|
* (such as sensitive information and serverMetadata).
|
|
85
84
|
*/
|
|
86
|
-
|
|
85
|
+
type ServerUser = Omit<User, "toJson"> & {
|
|
87
86
|
readonly serverMetadata: ReadonlyJson;
|
|
88
87
|
/**
|
|
89
88
|
* Returns a new user object with the sensitive fields removed.
|
|
@@ -93,11 +92,11 @@ export type ServerUser = Omit<User, "toJson"> & {
|
|
|
93
92
|
update(this: ServerUser, user: Partial<ServerUserCustomizableJson>): Promise<void>;
|
|
94
93
|
delete(this: ServerUser): Promise<void>;
|
|
95
94
|
};
|
|
96
|
-
|
|
95
|
+
type CurrentServerUser = Auth<ServerUser, ServerUserCustomizableJson> & Omit<ServerUser, "getClientUser"> & {
|
|
97
96
|
getClientUser(this: CurrentServerUser): CurrentUser;
|
|
98
97
|
};
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
type CurrentInternalServerUser = CurrentServerUser & InternalAuth<CurrentServerUser>;
|
|
99
|
+
type Project = {
|
|
101
100
|
readonly id: string;
|
|
102
101
|
readonly displayName: string;
|
|
103
102
|
readonly description?: string;
|
|
@@ -117,7 +116,7 @@ export type Project = {
|
|
|
117
116
|
toJson(this: Project): ProjectJson;
|
|
118
117
|
getProductionModeErrors(this: Project): ProductionModeError[];
|
|
119
118
|
};
|
|
120
|
-
|
|
119
|
+
type ApiKeySetBase = {
|
|
121
120
|
id: string;
|
|
122
121
|
description: string;
|
|
123
122
|
expiresAt: Date;
|
|
@@ -127,12 +126,12 @@ export type ApiKeySetBase = {
|
|
|
127
126
|
whyInvalid(): "expired" | "manually-revoked" | null;
|
|
128
127
|
revoke(): Promise<void>;
|
|
129
128
|
};
|
|
130
|
-
|
|
129
|
+
type ApiKeySetFirstView = ApiKeySetBase & {
|
|
131
130
|
publishableClientKey?: string;
|
|
132
131
|
secretServerKey?: string;
|
|
133
132
|
superSecretAdminKey?: string;
|
|
134
133
|
};
|
|
135
|
-
|
|
134
|
+
type ApiKeySet = ApiKeySetBase & {
|
|
136
135
|
publishableClientKey: null | {
|
|
137
136
|
lastFour: string;
|
|
138
137
|
};
|
|
@@ -143,10 +142,10 @@ export type ApiKeySet = ApiKeySetBase & {
|
|
|
143
142
|
lastFour: string;
|
|
144
143
|
};
|
|
145
144
|
};
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
type EmailConfig = EmailConfigJson;
|
|
146
|
+
type DomainConfig = DomainConfigJson;
|
|
147
|
+
type OAuthProviderConfig = OAuthProviderConfigJson;
|
|
148
|
+
type GetUserOptions = {
|
|
150
149
|
or?: 'redirect' | 'throw' | 'return-null';
|
|
151
150
|
};
|
|
152
151
|
type AsyncStoreProperty<Name extends string, Value, IsMultiple extends boolean> = {
|
|
@@ -156,7 +155,14 @@ type AsyncStoreProperty<Name extends string, Value, IsMultiple extends boolean>
|
|
|
156
155
|
} & {
|
|
157
156
|
[key in `use${Capitalize<Name>}`]: () => Value;
|
|
158
157
|
};
|
|
159
|
-
|
|
158
|
+
type StackClientAppConstructor = {
|
|
159
|
+
new <TokenStoreType extends string, HasTokenStore extends (TokenStoreType extends {} ? true : boolean), ProjectId extends string>(options: StackClientAppConstructorOptions<HasTokenStore, ProjectId>): StackClientApp<HasTokenStore, ProjectId>;
|
|
160
|
+
new (options: StackClientAppConstructorOptions<boolean, string>): StackClientApp<boolean, string>;
|
|
161
|
+
[stackAppInternalsSymbol]: {
|
|
162
|
+
fromClientJson<HasTokenStore extends boolean, ProjectId extends string>(json: StackClientAppJson<HasTokenStore, ProjectId>): StackClientApp<HasTokenStore, ProjectId>;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = ({
|
|
160
166
|
readonly projectId: ProjectId;
|
|
161
167
|
readonly urls: Readonly<HandlerUrls>;
|
|
162
168
|
signInWithOAuth(provider: string): Promise<void>;
|
|
@@ -179,7 +185,8 @@ export type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId ex
|
|
|
179
185
|
verifyEmail(code: string): Promise<KnownErrors["EmailVerificationError"] | undefined>;
|
|
180
186
|
signInWithMagicLink(code: string): Promise<KnownErrors["MagicLinkError"] | undefined>;
|
|
181
187
|
[stackAppInternalsSymbol]: {
|
|
182
|
-
toClientJson():
|
|
188
|
+
toClientJson(): StackClientAppJson<HasTokenStore, ProjectId>;
|
|
189
|
+
setCurrentUser(userJsonPromise: Promise<UserJson | null>): void;
|
|
183
190
|
};
|
|
184
191
|
} & AsyncStoreProperty<"project", ClientProjectJson, false> & {
|
|
185
192
|
[K in `redirectTo${Capitalize<keyof Omit<HandlerUrls, 'handler' | 'oauthCallback'>>}`]: () => Promise<never>;
|
|
@@ -201,26 +208,20 @@ export type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId ex
|
|
|
201
208
|
getUser(options?: GetUserOptions): Promise<ProjectCurrentUser<ProjectId> | null>;
|
|
202
209
|
onUserChange: AsyncStoreProperty<"user", CurrentUser | null, false>["onUserChange"];
|
|
203
210
|
}));
|
|
204
|
-
|
|
205
|
-
new <TokenStoreType extends string, HasTokenStore extends (TokenStoreType extends {} ? true : boolean), ProjectId extends string>(options: StackClientAppConstructorOptions<HasTokenStore, ProjectId>): StackClientApp<HasTokenStore, ProjectId>;
|
|
206
|
-
new (options: StackClientAppConstructorOptions<boolean, string>): StackClientApp<boolean, string>;
|
|
207
|
-
[stackAppInternalsSymbol]: {
|
|
208
|
-
fromClientJson<HasTokenStore extends boolean, ProjectId extends string>(json: StackClientAppJson<HasTokenStore, ProjectId>): StackClientApp<HasTokenStore, ProjectId>;
|
|
209
|
-
};
|
|
210
|
-
};
|
|
211
|
-
export declare const StackClientApp: StackClientAppConstructor;
|
|
212
|
-
export type StackServerApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (StackClientApp<HasTokenStore, ProjectId> & AsyncStoreProperty<"serverUser", CurrentServerUser | null, false> & AsyncStoreProperty<"serverUsers", ServerUser[], true> & {});
|
|
211
|
+
declare const StackClientApp: StackClientAppConstructor;
|
|
213
212
|
type StackServerAppConstructor = {
|
|
214
213
|
new <TokenStoreType extends string, HasTokenStore extends (TokenStoreType extends {} ? true : boolean), ProjectId extends string>(options: StackServerAppConstructorOptions<HasTokenStore, ProjectId>): StackServerApp<HasTokenStore, ProjectId>;
|
|
215
214
|
new (options: StackServerAppConstructorOptions<boolean, string>): StackServerApp<boolean, string>;
|
|
216
215
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
createApiKeySet(options: ApiKeySetCreateOptions): Promise<ApiKeySetFirstView>;
|
|
220
|
-
});
|
|
216
|
+
type StackServerApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (StackClientApp<HasTokenStore, ProjectId> & AsyncStoreProperty<"serverUser", CurrentServerUser | null, false> & AsyncStoreProperty<"serverUsers", ServerUser[], true> & {});
|
|
217
|
+
declare const StackServerApp: StackServerAppConstructor;
|
|
221
218
|
type StackAdminAppConstructor = {
|
|
222
219
|
new <HasTokenStore extends boolean, ProjectId extends string>(options: StackAdminAppConstructorOptions<HasTokenStore, ProjectId>): StackAdminApp<HasTokenStore, ProjectId>;
|
|
223
220
|
new (options: StackAdminAppConstructorOptions<boolean, string>): StackAdminApp<boolean, string>;
|
|
224
221
|
};
|
|
225
|
-
|
|
226
|
-
|
|
222
|
+
type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (StackServerApp<HasTokenStore, ProjectId> & AsyncStoreProperty<"projectAdmin", Project, false> & AsyncStoreProperty<"apiKeySets", ApiKeySet[], true> & {
|
|
223
|
+
createApiKeySet(options: ApiKeySetCreateOptions): Promise<ApiKeySetFirstView>;
|
|
224
|
+
});
|
|
225
|
+
declare const StackAdminApp: StackAdminAppConstructor;
|
|
226
|
+
|
|
227
|
+
export { type ApiKeySet, type ApiKeySetBase, type ApiKeySetFirstView, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type DomainConfig, type EmailConfig, type GetUserOptions, type HandlerUrls, type OAuthProviderConfig, type Project, type ServerUser, StackAdminApp, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructorOptions, type StackClientAppJson, StackServerApp, type StackServerAppConstructorOptions, type TokenStoreOptions, type User, stackAppInternalsSymbol };
|