@stackframe/js 2.8.59 → 2.8.61

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.
Files changed (30) hide show
  1. package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js +49 -1
  2. package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -1
  3. package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.js +44 -2
  4. package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
  5. package/dist/esm/lib/stack-app/apps/implementations/common.js +1 -1
  6. package/dist/esm/lib/stack-app/apps/implementations/common.js.map +1 -1
  7. package/dist/esm/lib/stack-app/apps/implementations/server-app-impl.js +17 -6
  8. package/dist/esm/lib/stack-app/apps/implementations/server-app-impl.js.map +1 -1
  9. package/dist/esm/lib/stack-app/apps/interfaces/admin-app.js.map +1 -1
  10. package/dist/esm/lib/stack-app/apps/interfaces/client-app.js.map +1 -1
  11. package/dist/esm/lib/stack-app/apps/interfaces/server-app.js.map +1 -1
  12. package/dist/esm/lib/stack-app/index.js.map +1 -1
  13. package/dist/esm/lib/stack-app/projects/index.js.map +1 -1
  14. package/dist/index.d.mts +106 -3
  15. package/dist/index.d.ts +106 -3
  16. package/dist/lib/stack-app/apps/implementations/admin-app-impl.js +49 -1
  17. package/dist/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -1
  18. package/dist/lib/stack-app/apps/implementations/client-app-impl.js +44 -2
  19. package/dist/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
  20. package/dist/lib/stack-app/apps/implementations/common.js +1 -1
  21. package/dist/lib/stack-app/apps/implementations/common.js.map +1 -1
  22. package/dist/lib/stack-app/apps/implementations/server-app-impl.js +17 -6
  23. package/dist/lib/stack-app/apps/implementations/server-app-impl.js.map +1 -1
  24. package/dist/lib/stack-app/apps/interfaces/admin-app.js.map +1 -1
  25. package/dist/lib/stack-app/apps/interfaces/client-app.js.map +1 -1
  26. package/dist/lib/stack-app/apps/interfaces/server-app.js.map +1 -1
  27. package/dist/lib/stack-app/customers/index.js.map +1 -1
  28. package/dist/lib/stack-app/index.js.map +1 -1
  29. package/dist/lib/stack-app/projects/index.js.map +1 -1
  30. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/lib/stack-app/apps/interfaces/client-app.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { KnownErrors } from \"@stackframe/stack-shared\";\nimport { CurrentUserCrud } from \"@stackframe/stack-shared/dist/interface/crud/current-user\";\nimport { Result } from \"@stackframe/stack-shared/dist/utils/results\";\nimport { AsyncStoreProperty, AuthLike, GetCurrentPartialUserOptions, GetCurrentUserOptions, HandlerUrls, OAuthScopesOnSignIn, RedirectMethod, RedirectToOptions, TokenStoreInit, stackAppInternalsSymbol } from \"../../common\";\nimport { CustomerProductsList, CustomerProductsRequestOptions, Item } from \"../../customers\";\nimport { Project } from \"../../projects\";\nimport { ProjectCurrentUser, SyncedPartialUser, TokenPartialUser } from \"../../users\";\nimport { _StackClientAppImpl } from \"../implementations\";\n\nexport type StackClientAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = {\n baseUrl?: string | { browser: string, server: string },\n extraRequestHeaders?: Record<string, string>,\n projectId?: ProjectId,\n publishableClientKey?: string,\n urls?: Partial<HandlerUrls>,\n oauthScopesOnSignIn?: Partial<OAuthScopesOnSignIn>,\n tokenStore?: TokenStoreInit<HasTokenStore>,\n redirectMethod?: RedirectMethod,\n inheritsFrom?: StackClientApp<any, any>,\n\n /**\n * By default, the Stack app will automatically prefetch some data from Stack's server when this app is first\n * constructed. This improves the performance of your app, but will create network requests that are unnecessary if\n * the app is never used or disposed of immediately. To disable this behavior, set this option to true.\n */\n noAutomaticPrefetch?: boolean,\n} & (\n { tokenStore: TokenStoreInit<HasTokenStore> } | { tokenStore?: undefined, inheritsFrom: StackClientApp<HasTokenStore, any> }\n) & (\n string extends ProjectId ? unknown : ({ projectId: ProjectId } | { inheritsFrom: StackClientApp<any, ProjectId> })\n);\n\n\nexport type StackClientAppJson<HasTokenStore extends boolean, ProjectId extends string> = StackClientAppConstructorOptions<HasTokenStore, ProjectId> & { inheritsFrom?: undefined } & {\n uniqueIdentifier: string,\n // note: if you add more fields here, make sure to ensure the checkString in the constructor has/doesn't have them\n};\n\nexport type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (\n & {\n readonly projectId: ProjectId,\n\n readonly urls: Readonly<HandlerUrls>,\n\n signInWithOAuth(provider: string, options?: { returnTo?: string }): Promise<void>,\n signInWithCredential(options: { email: string, password: string, noRedirect?: boolean }): Promise<Result<undefined, KnownErrors[\"EmailPasswordMismatch\"] | KnownErrors[\"InvalidTotpCode\"]>>,\n signUpWithCredential(options: { email: string, password: string, noRedirect?: boolean } & ({ noVerificationCallback: true } | { noVerificationCallback?: false, verificationCallbackUrl?: string })): Promise<Result<undefined, KnownErrors[\"UserWithEmailAlreadyExists\"] | KnownErrors[\"PasswordRequirementsNotMet\"]>>,\n signInWithPasskey(): Promise<Result<undefined, KnownErrors[\"PasskeyAuthenticationFailed\"] | KnownErrors[\"InvalidTotpCode\"] | KnownErrors[\"PasskeyWebAuthnError\"]>>,\n callOAuthCallback(): Promise<boolean>,\n promptCliLogin(options: { appUrl: string, expiresInMillis?: number }): Promise<Result<string, KnownErrors[\"CliAuthError\"] | KnownErrors[\"CliAuthExpiredError\"] | KnownErrors[\"CliAuthUsedError\"]>>,\n sendForgotPasswordEmail(email: string, options?: { callbackUrl?: string }): Promise<Result<undefined, KnownErrors[\"UserNotFound\"]>>,\n sendMagicLinkEmail(email: string, options?: { callbackUrl?: string }): Promise<Result<{ nonce: string }, KnownErrors[\"RedirectUrlNotWhitelisted\"]>>,\n resetPassword(options: { code: string, password: string }): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"]>>,\n verifyPasswordResetCode(code: string): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"]>>,\n verifyTeamInvitationCode(code: string): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"]>>,\n acceptTeamInvitation(code: string): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"]>>,\n getTeamInvitationDetails(code: string): Promise<Result<{ teamDisplayName: string }, KnownErrors[\"VerificationCodeError\"]>>,\n verifyEmail(code: string): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"]>>,\n signInWithMagicLink(code: string, options?: { noRedirect?: boolean }): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"] | KnownErrors[\"InvalidTotpCode\"]>>,\n signInWithMfa(otp: string, code: string, options?: { noRedirect?: boolean }): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"] | KnownErrors[\"InvalidTotpCode\"]>>,\n\n redirectToOAuthCallback(): Promise<void>,\n\n getConvexClientAuth(options: HasTokenStore extends false ? { tokenStore: TokenStoreInit } : { tokenStore?: TokenStoreInit }): (args: { forceRefreshToken: boolean }) => Promise<string | null>,\n getConvexHttpClientAuth(options: { tokenStore: TokenStoreInit }): Promise<string>,\n\n\n getUser(options: GetCurrentUserOptions<HasTokenStore> & { or: 'redirect' }): Promise<ProjectCurrentUser<ProjectId>>,\n getUser(options: GetCurrentUserOptions<HasTokenStore> & { or: 'throw' }): Promise<ProjectCurrentUser<ProjectId>>,\n getUser(options: GetCurrentUserOptions<HasTokenStore> & { or: 'anonymous' }): Promise<ProjectCurrentUser<ProjectId>>,\n getUser(options?: GetCurrentUserOptions<HasTokenStore>): Promise<ProjectCurrentUser<ProjectId> | null>,\n\n cancelSubscription(options: { productId: string } | { productId: string, teamId: string }): Promise<void>,\n\n // note: we don't special-case 'anonymous' here to return non-null, see GetPartialUserOptions for more details\n getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore> & { from: 'token' }): Promise<TokenPartialUser | null>,\n getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore> & { from: 'convex' }): Promise<TokenPartialUser | null>,\n getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore>): Promise<SyncedPartialUser | TokenPartialUser | null>,\n\n [stackAppInternalsSymbol]: {\n toClientJson(): StackClientAppJson<HasTokenStore, ProjectId>,\n setCurrentUser(userJsonPromise: Promise<CurrentUserCrud['Client']['Read'] | null>): void,\n getConstructorOptions(): StackClientAppConstructorOptions<HasTokenStore, ProjectId> & { inheritsFrom?: undefined },\n },\n }\n & AsyncStoreProperty<\"project\", [], Project, false>\n & AsyncStoreProperty<\n \"item\",\n [{ itemId: string, userId: string } | { itemId: string, teamId: string } | { itemId: string, customCustomerId: string }],\n Item,\n false\n >\n & AsyncStoreProperty<\n \"products\",\n [options: CustomerProductsRequestOptions],\n CustomerProductsList,\n true\n >\n & { [K in `redirectTo${Capitalize<keyof Omit<HandlerUrls, 'handler' | 'oauthCallback'>>}`]: (options?: RedirectToOptions) => Promise<void> }\n & AuthLike<HasTokenStore extends false ? { tokenStore: TokenStoreInit } : { tokenStore?: TokenStoreInit }>\n);\nexport type StackClientAppConstructor = {\n new <\n TokenStoreType extends string,\n HasTokenStore extends (TokenStoreType extends {} ? true : boolean),\n ProjectId extends string\n >(options: StackClientAppConstructorOptions<HasTokenStore, ProjectId>): StackClientApp<HasTokenStore, ProjectId>,\n new(options: StackClientAppConstructorOptions<boolean, string>): StackClientApp<boolean, string>,\n\n [stackAppInternalsSymbol]: {\n fromClientJson<HasTokenStore extends boolean, ProjectId extends string>(\n json: StackClientAppJson<HasTokenStore, ProjectId>\n ): StackClientApp<HasTokenStore, ProjectId>,\n },\n};\nexport const StackClientApp: StackClientAppConstructor = _StackClientAppImpl;\n"],"mappings":";AAWA,SAAS,2BAA2B;AA4G7B,IAAM,iBAA4C;","names":[]}
1
+ {"version":3,"sources":["../../../../../../src/lib/stack-app/apps/interfaces/client-app.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { KnownErrors } from \"@stackframe/stack-shared\";\nimport { CurrentUserCrud } from \"@stackframe/stack-shared/dist/interface/crud/current-user\";\nimport { Result } from \"@stackframe/stack-shared/dist/utils/results\";\nimport { AsyncStoreProperty, AuthLike, GetCurrentPartialUserOptions, GetCurrentUserOptions, HandlerUrls, OAuthScopesOnSignIn, RedirectMethod, RedirectToOptions, TokenStoreInit, stackAppInternalsSymbol } from \"../../common\";\nimport { CustomerInvoicesList, CustomerInvoicesRequestOptions, CustomerProductsList, CustomerProductsRequestOptions, Item } from \"../../customers\";\nimport { Project } from \"../../projects\";\nimport { ProjectCurrentUser, SyncedPartialUser, TokenPartialUser } from \"../../users\";\nimport { _StackClientAppImpl } from \"../implementations\";\n\nexport type StackClientAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = {\n baseUrl?: string | { browser: string, server: string },\n extraRequestHeaders?: Record<string, string>,\n projectId?: ProjectId,\n publishableClientKey?: string,\n urls?: Partial<HandlerUrls>,\n oauthScopesOnSignIn?: Partial<OAuthScopesOnSignIn>,\n tokenStore?: TokenStoreInit<HasTokenStore>,\n redirectMethod?: RedirectMethod,\n inheritsFrom?: StackClientApp<any, any>,\n\n /**\n * By default, the Stack app will automatically prefetch some data from Stack's server when this app is first\n * constructed. This improves the performance of your app, but will create network requests that are unnecessary if\n * the app is never used or disposed of immediately. To disable this behavior, set this option to true.\n */\n noAutomaticPrefetch?: boolean,\n} & (\n { tokenStore: TokenStoreInit<HasTokenStore> } | { tokenStore?: undefined, inheritsFrom: StackClientApp<HasTokenStore, any> }\n) & (\n string extends ProjectId ? unknown : ({ projectId: ProjectId } | { inheritsFrom: StackClientApp<any, ProjectId> })\n);\n\n\nexport type StackClientAppJson<HasTokenStore extends boolean, ProjectId extends string> = StackClientAppConstructorOptions<HasTokenStore, ProjectId> & { inheritsFrom?: undefined } & {\n uniqueIdentifier: string,\n // note: if you add more fields here, make sure to ensure the checkString in the constructor has/doesn't have them\n};\n\nexport type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (\n & {\n readonly projectId: ProjectId,\n\n readonly urls: Readonly<HandlerUrls>,\n\n signInWithOAuth(provider: string, options?: { returnTo?: string }): Promise<void>,\n signInWithCredential(options: { email: string, password: string, noRedirect?: boolean }): Promise<Result<undefined, KnownErrors[\"EmailPasswordMismatch\"] | KnownErrors[\"InvalidTotpCode\"]>>,\n signUpWithCredential(options: { email: string, password: string, noRedirect?: boolean } & ({ noVerificationCallback: true } | { noVerificationCallback?: false, verificationCallbackUrl?: string })): Promise<Result<undefined, KnownErrors[\"UserWithEmailAlreadyExists\"] | KnownErrors[\"PasswordRequirementsNotMet\"]>>,\n signInWithPasskey(): Promise<Result<undefined, KnownErrors[\"PasskeyAuthenticationFailed\"] | KnownErrors[\"InvalidTotpCode\"] | KnownErrors[\"PasskeyWebAuthnError\"]>>,\n callOAuthCallback(): Promise<boolean>,\n promptCliLogin(options: { appUrl: string, expiresInMillis?: number }): Promise<Result<string, KnownErrors[\"CliAuthError\"] | KnownErrors[\"CliAuthExpiredError\"] | KnownErrors[\"CliAuthUsedError\"]>>,\n sendForgotPasswordEmail(email: string, options?: { callbackUrl?: string }): Promise<Result<undefined, KnownErrors[\"UserNotFound\"]>>,\n sendMagicLinkEmail(email: string, options?: { callbackUrl?: string }): Promise<Result<{ nonce: string }, KnownErrors[\"RedirectUrlNotWhitelisted\"]>>,\n resetPassword(options: { code: string, password: string }): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"]>>,\n verifyPasswordResetCode(code: string): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"]>>,\n verifyTeamInvitationCode(code: string): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"]>>,\n acceptTeamInvitation(code: string): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"]>>,\n getTeamInvitationDetails(code: string): Promise<Result<{ teamDisplayName: string }, KnownErrors[\"VerificationCodeError\"]>>,\n verifyEmail(code: string): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"]>>,\n signInWithMagicLink(code: string, options?: { noRedirect?: boolean }): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"] | KnownErrors[\"InvalidTotpCode\"]>>,\n signInWithMfa(otp: string, code: string, options?: { noRedirect?: boolean }): Promise<Result<undefined, KnownErrors[\"VerificationCodeError\"] | KnownErrors[\"InvalidTotpCode\"]>>,\n\n redirectToOAuthCallback(): Promise<void>,\n\n getConvexClientAuth(options: HasTokenStore extends false ? { tokenStore: TokenStoreInit } : { tokenStore?: TokenStoreInit }): (args: { forceRefreshToken: boolean }) => Promise<string | null>,\n getConvexHttpClientAuth(options: { tokenStore: TokenStoreInit }): Promise<string>,\n\n\n getUser(options: GetCurrentUserOptions<HasTokenStore> & { or: 'redirect' }): Promise<ProjectCurrentUser<ProjectId>>,\n getUser(options: GetCurrentUserOptions<HasTokenStore> & { or: 'throw' }): Promise<ProjectCurrentUser<ProjectId>>,\n getUser(options: GetCurrentUserOptions<HasTokenStore> & { or: 'anonymous' }): Promise<ProjectCurrentUser<ProjectId>>,\n getUser(options?: GetCurrentUserOptions<HasTokenStore>): Promise<ProjectCurrentUser<ProjectId> | null>,\n\n cancelSubscription(options: { productId: string } | { productId: string, teamId: string }): Promise<void>,\n\n // note: we don't special-case 'anonymous' here to return non-null, see GetPartialUserOptions for more details\n getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore> & { from: 'token' }): Promise<TokenPartialUser | null>,\n getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore> & { from: 'convex' }): Promise<TokenPartialUser | null>,\n getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore>): Promise<SyncedPartialUser | TokenPartialUser | null>,\n\n [stackAppInternalsSymbol]: {\n toClientJson(): StackClientAppJson<HasTokenStore, ProjectId>,\n setCurrentUser(userJsonPromise: Promise<CurrentUserCrud['Client']['Read'] | null>): void,\n getConstructorOptions(): StackClientAppConstructorOptions<HasTokenStore, ProjectId> & { inheritsFrom?: undefined },\n },\n }\n & AsyncStoreProperty<\"project\", [], Project, false>\n & AsyncStoreProperty<\n \"item\",\n [{ itemId: string, userId: string } | { itemId: string, teamId: string } | { itemId: string, customCustomerId: string }],\n Item,\n false\n >\n & AsyncStoreProperty<\n \"products\",\n [options: CustomerProductsRequestOptions],\n CustomerProductsList,\n true\n >\n & AsyncStoreProperty<\n \"invoices\",\n [options: CustomerInvoicesRequestOptions],\n CustomerInvoicesList,\n true\n >\n & { [K in `redirectTo${Capitalize<keyof Omit<HandlerUrls, 'handler' | 'oauthCallback'>>}`]: (options?: RedirectToOptions) => Promise<void> }\n & AuthLike<HasTokenStore extends false ? { tokenStore: TokenStoreInit } : { tokenStore?: TokenStoreInit }>\n);\nexport type StackClientAppConstructor = {\n new <\n TokenStoreType extends string,\n HasTokenStore extends (TokenStoreType extends {} ? true : boolean),\n ProjectId extends string\n >(options: StackClientAppConstructorOptions<HasTokenStore, ProjectId>): StackClientApp<HasTokenStore, ProjectId>,\n new(options: StackClientAppConstructorOptions<boolean, string>): StackClientApp<boolean, string>,\n\n [stackAppInternalsSymbol]: {\n fromClientJson<HasTokenStore extends boolean, ProjectId extends string>(\n json: StackClientAppJson<HasTokenStore, ProjectId>\n ): StackClientApp<HasTokenStore, ProjectId>,\n },\n};\nexport const StackClientApp: StackClientAppConstructor = _StackClientAppImpl;\n"],"mappings":";AAWA,SAAS,2BAA2B;AAkH7B,IAAM,iBAA4C;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/lib/stack-app/apps/interfaces/server-app.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { KnownErrors } from \"@stackframe/stack-shared\";\nimport { Result } from \"@stackframe/stack-shared/dist/utils/results\";\nimport type { GenericQueryCtx } from \"convex/server\";\nimport { AsyncStoreProperty, GetCurrentPartialUserOptions, GetCurrentUserOptions } from \"../../common\";\nimport { CustomerProductsList, CustomerProductsRequestOptions, InlineProduct, ServerItem } from \"../../customers\";\nimport { DataVaultStore } from \"../../data-vault\";\nimport { EmailDeliveryInfo, SendEmailOptions } from \"../../email\";\nimport { ServerListUsersOptions, ServerTeam, ServerTeamCreateOptions } from \"../../teams\";\nimport { ProjectCurrentServerUser, ServerOAuthProvider, ServerUser, ServerUserCreateOptions, SyncedPartialServerUser, TokenPartialUser } from \"../../users\";\nimport { _StackServerAppImpl } from \"../implementations\";\nimport { StackClientApp, StackClientAppConstructorOptions } from \"./client-app\";\n\n\nexport type StackServerAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = StackClientAppConstructorOptions<HasTokenStore, ProjectId> & {\n secretServerKey?: string,\n};\n\nexport type StackServerApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (\n & {\n createTeam(data: ServerTeamCreateOptions): Promise<ServerTeam>,\n /**\n * @deprecated use `getUser()` instead\n */\n getServerUser(): Promise<ProjectCurrentServerUser<ProjectId> | null>,\n\n createUser(options: ServerUserCreateOptions): Promise<ServerUser>,\n grantProduct(options: (\n ({ userId: string } | { teamId: string } | { customCustomerId: string }) &\n ({ productId: string } | { product: InlineProduct }) &\n { quantity?: number }\n )): Promise<void>,\n\n\n getUser(options: GetCurrentUserOptions<HasTokenStore> & { or: 'redirect' }): Promise<ProjectCurrentServerUser<ProjectId>>,\n getUser(options: GetCurrentUserOptions<HasTokenStore> & { or: 'throw' }): Promise<ProjectCurrentServerUser<ProjectId>>,\n getUser(options: GetCurrentUserOptions<HasTokenStore> & { or: 'anonymous' }): Promise<ProjectCurrentServerUser<ProjectId>>,\n getUser(options?: GetCurrentUserOptions<HasTokenStore>): Promise<ProjectCurrentServerUser<ProjectId> | null>,\n getUser(id: string): Promise<ServerUser | null>,\n getUser(options: { apiKey: string, or?: \"return-null\" | \"anonymous\" }): Promise<ServerUser | null>,\n getUser(options: { from: \"convex\", ctx: GenericQueryCtx<any>, or?: \"return-null\" | \"anonymous\" }): Promise<ServerUser | null>,\n\n // note: we don't special-case 'anonymous' here to return non-null, see GetPartialUserOptions for more details\n getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore> & { from: 'token' }): Promise<TokenPartialUser | null>,\n getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore> & { from: 'convex' }): Promise<TokenPartialUser | null>,\n getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore>): Promise<SyncedPartialServerUser | TokenPartialUser | null>,\n getTeam(id: string): Promise<ServerTeam | null>,\n getTeam(options: { apiKey: string }): Promise<ServerTeam | null>,\n\n\n listUsers(options?: ServerListUsersOptions): Promise<ServerUser[] & { nextCursor: string | null }>,\n\n createOAuthProvider(options: {\n userId: string,\n accountId: string,\n providerConfigId: string,\n email: string,\n allowSignIn: boolean,\n allowConnectedAccounts: boolean,\n }): Promise<Result<ServerOAuthProvider, InstanceType<typeof KnownErrors.OAuthProviderAccountIdAlreadyUsedForSignIn>>>,\n\n sendEmail(options: SendEmailOptions): Promise<void>,\n\n getEmailDeliveryStats(): Promise<EmailDeliveryInfo>,\n }\n & AsyncStoreProperty<\"user\", [id: string], ServerUser | null, false>\n & Omit<AsyncStoreProperty<\"users\", [], ServerUser[], true>, \"listUsers\" | \"useUsers\">\n & AsyncStoreProperty<\"teams\", [], ServerTeam[], true>\n & AsyncStoreProperty<\"dataVaultStore\", [id: string], DataVaultStore, false>\n & AsyncStoreProperty<\n \"item\",\n [{ itemId: string, userId: string } | { itemId: string, teamId: string } | { itemId: string, customCustomerId: string }],\n ServerItem,\n false\n >\n & AsyncStoreProperty<\n \"products\",\n [options: CustomerProductsRequestOptions],\n CustomerProductsList,\n true\n >\n & StackClientApp<HasTokenStore, ProjectId>\n);\nexport type StackServerAppConstructor = {\n new <\n TokenStoreType extends string,\n HasTokenStore extends (TokenStoreType extends {} ? true : boolean),\n ProjectId extends string\n >(options: StackServerAppConstructorOptions<HasTokenStore, ProjectId>): StackServerApp<HasTokenStore, ProjectId>,\n new (options: StackServerAppConstructorOptions<boolean, string>): StackServerApp<boolean, string>,\n};\nexport const StackServerApp: StackServerAppConstructor = _StackServerAppImpl;\n"],"mappings":";AAaA,SAAS,2BAA2B;AAiF7B,IAAM,iBAA4C;","names":[]}
1
+ {"version":3,"sources":["../../../../../../src/lib/stack-app/apps/interfaces/server-app.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { KnownErrors } from \"@stackframe/stack-shared\";\nimport { Result } from \"@stackframe/stack-shared/dist/utils/results\";\nimport type { GenericQueryCtx } from \"convex/server\";\nimport { AsyncStoreProperty, GetCurrentPartialUserOptions, GetCurrentUserOptions } from \"../../common\";\nimport { CustomerProductsList, CustomerProductsRequestOptions, InlineProduct, ServerItem } from \"../../customers\";\nimport { DataVaultStore } from \"../../data-vault\";\nimport { EmailDeliveryInfo, SendEmailOptions } from \"../../email\";\nimport { ServerListUsersOptions, ServerTeam, ServerTeamCreateOptions } from \"../../teams\";\nimport { ProjectCurrentServerUser, ServerOAuthProvider, ServerUser, ServerUserCreateOptions, SyncedPartialServerUser, TokenPartialUser } from \"../../users\";\nimport { _StackServerAppImpl } from \"../implementations\";\nimport { StackClientApp, StackClientAppConstructorOptions } from \"./client-app\";\n\n\nexport type StackServerAppConstructorOptions<HasTokenStore extends boolean, ProjectId extends string> = StackClientAppConstructorOptions<HasTokenStore, ProjectId> & {\n secretServerKey?: string,\n};\n\nexport type StackServerApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (\n & {\n createTeam(data: ServerTeamCreateOptions): Promise<ServerTeam>,\n /**\n * @deprecated use `getUser()` instead\n */\n getServerUser(): Promise<ProjectCurrentServerUser<ProjectId> | null>,\n\n createUser(options: ServerUserCreateOptions): Promise<ServerUser>,\n grantProduct(options: (\n ({ userId: string } | { teamId: string } | { customCustomerId: string }) &\n ({ productId: string } | { product: InlineProduct }) &\n { quantity?: number }\n )): Promise<void>,\n\n\n getUser(options: GetCurrentUserOptions<HasTokenStore> & { or: 'redirect' }): Promise<ProjectCurrentServerUser<ProjectId>>,\n getUser(options: GetCurrentUserOptions<HasTokenStore> & { or: 'throw' }): Promise<ProjectCurrentServerUser<ProjectId>>,\n getUser(options: GetCurrentUserOptions<HasTokenStore> & { or: 'anonymous' }): Promise<ProjectCurrentServerUser<ProjectId>>,\n getUser(options?: GetCurrentUserOptions<HasTokenStore>): Promise<ProjectCurrentServerUser<ProjectId> | null>,\n getUser(id: string): Promise<ServerUser | null>,\n getUser(options: { apiKey: string, or?: \"return-null\" | \"anonymous\" }): Promise<ServerUser | null>,\n getUser(options: { from: \"convex\", ctx: GenericQueryCtx<any>, or?: \"return-null\" | \"anonymous\" }): Promise<ServerUser | null>,\n\n // note: we don't special-case 'anonymous' here to return non-null, see GetPartialUserOptions for more details\n getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore> & { from: 'token' }): Promise<TokenPartialUser | null>,\n getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore> & { from: 'convex' }): Promise<TokenPartialUser | null>,\n getPartialUser(options: GetCurrentPartialUserOptions<HasTokenStore>): Promise<SyncedPartialServerUser | TokenPartialUser | null>,\n getTeam(id: string): Promise<ServerTeam | null>,\n getTeam(options: { apiKey: string }): Promise<ServerTeam | null>,\n\n\n listUsers(options?: ServerListUsersOptions): Promise<ServerUser[] & { nextCursor: string | null }>,\n\n // TODO this should actually be on ServerUser\n createOAuthProvider(options: {\n userId: string,\n accountId: string,\n providerConfigId: string,\n email: string,\n allowSignIn: boolean,\n allowConnectedAccounts: boolean,\n }): Promise<Result<ServerOAuthProvider, InstanceType<typeof KnownErrors.OAuthProviderAccountIdAlreadyUsedForSignIn>>>,\n\n sendEmail(options: SendEmailOptions): Promise<void>,\n\n getEmailDeliveryStats(): Promise<EmailDeliveryInfo>,\n }\n & AsyncStoreProperty<\"user\", [id: string], ServerUser | null, false>\n & Omit<AsyncStoreProperty<\"users\", [], ServerUser[], true>, \"listUsers\" | \"useUsers\">\n & AsyncStoreProperty<\"teams\", [], ServerTeam[], true>\n & AsyncStoreProperty<\"dataVaultStore\", [id: string], DataVaultStore, false>\n & AsyncStoreProperty<\n \"item\",\n [{ itemId: string, userId: string } | { itemId: string, teamId: string } | { itemId: string, customCustomerId: string }],\n ServerItem,\n false\n >\n & AsyncStoreProperty<\n \"products\",\n [options: CustomerProductsRequestOptions],\n CustomerProductsList,\n true\n >\n & StackClientApp<HasTokenStore, ProjectId>\n);\nexport type StackServerAppConstructor = {\n new <\n TokenStoreType extends string,\n HasTokenStore extends (TokenStoreType extends {} ? true : boolean),\n ProjectId extends string\n >(options: StackServerAppConstructorOptions<HasTokenStore, ProjectId>): StackServerApp<HasTokenStore, ProjectId>,\n new (options: StackServerAppConstructorOptions<boolean, string>): StackServerApp<boolean, string>,\n};\nexport const StackServerApp: StackServerAppConstructor = _StackServerAppImpl;\n"],"mappings":";AAaA,SAAS,2BAA2B;AAkF7B,IAAM,iBAA4C;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/stack-app/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nexport {\n StackAdminApp, StackClientApp,\n StackServerApp\n} from \"./apps\";\nexport type {\n StackAdminAppConstructor,\n StackAdminAppConstructorOptions,\n StackClientAppConstructor,\n StackClientAppConstructorOptions,\n StackClientAppJson,\n StackServerAppConstructor,\n StackServerAppConstructorOptions\n} from \"./apps\";\n\nexport type {\n EmailOutboxListOptions,\n EmailOutboxListResult,\n EmailOutboxUpdateOptions\n} from \"./apps/interfaces/admin-app\";\n\nexport type {\n ProjectConfig\n} from \"./project-configs\";\n\nexport type {\n InternalApiKey,\n InternalApiKeyBase,\n InternalApiKeyBaseCrudRead,\n InternalApiKeyCreateOptions,\n InternalApiKeyFirstView\n} from \"./internal-api-keys\";\n\nexport {\n stackAppInternalsSymbol\n} from \"./common\";\nexport type {\n GetCurrentUserOptions,\n /** @deprecated Use GetCurrentUserOptions instead */\n GetCurrentUserOptions as GetUserOptions,\n HandlerUrls,\n OAuthScopesOnSignIn\n} from \"./common\";\n\nexport type {\n Connection,\n OAuthConnection\n} from \"./connected-accounts\";\n\nexport type {\n ContactChannel,\n ServerContactChannel\n} from \"./contact-channels\";\n\nexport type {\n AdminEmailOutbox,\n AdminEmailOutboxRecipient,\n AdminEmailOutboxSimpleStatus,\n AdminEmailOutboxStatus,\n AdminSentEmail\n} from \"./email\";\n\nexport type {\n AdminProjectPermission,\n AdminProjectPermissionDefinition,\n AdminProjectPermissionDefinitionCreateOptions,\n AdminProjectPermissionDefinitionUpdateOptions, AdminTeamPermission,\n AdminTeamPermissionDefinition,\n AdminTeamPermissionDefinitionCreateOptions,\n AdminTeamPermissionDefinitionUpdateOptions\n} from \"./permissions\";\n\nexport type {\n AdminDomainConfig,\n AdminEmailConfig,\n AdminOAuthProviderConfig,\n AdminProjectConfig,\n AdminProjectConfigUpdateOptions,\n OAuthProviderConfig\n} from \"./project-configs\";\n\nexport type {\n AdminOwnedProject,\n AdminProject,\n AdminProjectCreateOptions,\n AdminProjectUpdateOptions,\n Project\n} from \"./projects\";\n\nexport type {\n EditableTeamMemberProfile,\n ServerListUsersOptions,\n ServerTeam,\n ServerTeamCreateOptions,\n ServerTeamMemberProfile,\n ServerTeamUpdateOptions,\n ServerTeamUser,\n Team,\n TeamCreateOptions,\n TeamInvitation,\n TeamMemberProfile,\n TeamUpdateOptions,\n TeamUser\n} from \"./teams\";\n\nexport type {\n Auth,\n CurrentInternalServerUser,\n CurrentInternalUser,\n CurrentServerUser,\n CurrentUser,\n OAuthProvider,\n ServerOAuthProvider,\n ServerUser,\n User\n} from \"./users\";\n\n"],"mappings":";AAIA;AAAA,EACE;AAAA,EAAe;AAAA,EACf;AAAA,OACK;AA6BP;AAAA,EACE;AAAA,OACK;","names":[]}
1
+ {"version":3,"sources":["../../../../src/lib/stack-app/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nexport {\n StackAdminApp, StackClientApp,\n StackServerApp\n} from \"./apps\";\nexport type {\n StackAdminAppConstructor,\n StackAdminAppConstructorOptions,\n StackClientAppConstructor,\n StackClientAppConstructorOptions,\n StackClientAppJson,\n StackServerAppConstructor,\n StackServerAppConstructorOptions\n} from \"./apps\";\n\nexport type {\n EmailOutboxListOptions,\n EmailOutboxListResult,\n EmailOutboxUpdateOptions\n} from \"./apps/interfaces/admin-app\";\n\nexport type {\n ProjectConfig\n} from \"./project-configs\";\n\nexport type {\n InternalApiKey,\n InternalApiKeyBase,\n InternalApiKeyBaseCrudRead,\n InternalApiKeyCreateOptions,\n InternalApiKeyFirstView\n} from \"./internal-api-keys\";\n\nexport {\n stackAppInternalsSymbol\n} from \"./common\";\nexport type {\n GetCurrentUserOptions,\n /** @deprecated Use GetCurrentUserOptions instead */\n GetCurrentUserOptions as GetUserOptions,\n HandlerUrls,\n OAuthScopesOnSignIn\n} from \"./common\";\n\nexport type {\n Connection,\n OAuthConnection\n} from \"./connected-accounts\";\n\nexport type {\n ContactChannel,\n ServerContactChannel\n} from \"./contact-channels\";\n\nexport type {\n AdminEmailOutbox,\n AdminEmailOutboxRecipient,\n AdminEmailOutboxSimpleStatus,\n AdminEmailOutboxStatus,\n AdminSentEmail\n} from \"./email\";\n\nexport type {\n AdminProjectPermission,\n AdminProjectPermissionDefinition,\n AdminProjectPermissionDefinitionCreateOptions,\n AdminProjectPermissionDefinitionUpdateOptions, AdminTeamPermission,\n AdminTeamPermissionDefinition,\n AdminTeamPermissionDefinitionCreateOptions,\n AdminTeamPermissionDefinitionUpdateOptions\n} from \"./permissions\";\n\nexport type {\n AdminDomainConfig,\n AdminEmailConfig,\n AdminOAuthProviderConfig,\n AdminProjectConfig,\n AdminProjectConfigUpdateOptions,\n OAuthProviderConfig\n} from \"./project-configs\";\n\nexport type {\n AdminOwnedProject,\n AdminProject,\n AdminProjectCreateOptions,\n AdminProjectUpdateOptions,\n Project,\n PushedConfigSource\n} from \"./projects\";\n\nexport type {\n EditableTeamMemberProfile,\n ServerListUsersOptions,\n ServerTeam,\n ServerTeamCreateOptions,\n ServerTeamMemberProfile,\n ServerTeamUpdateOptions,\n ServerTeamUser,\n Team,\n TeamCreateOptions,\n TeamInvitation,\n TeamMemberProfile,\n TeamUpdateOptions,\n TeamUser\n} from \"./teams\";\n\nexport type {\n Auth,\n CurrentInternalServerUser,\n CurrentInternalUser,\n CurrentServerUser,\n CurrentUser,\n OAuthProvider,\n ServerOAuthProvider,\n ServerUser,\n User\n} from \"./users\";\n\n"],"mappings":";AAIA;AAAA,EACE;AAAA,EAAe;AAAA,EACf;AAAA,OACK;AA6BP;AAAA,EACE;AAAA,OACK;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/lib/stack-app/projects/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { ProductionModeError } from \"@stackframe/stack-shared/dist/helpers/production-mode\";\nimport { AdminUserProjectsCrud, ProjectsCrud } from \"@stackframe/stack-shared/dist/interface/crud/projects\";\n\nimport { CompleteConfig, EnvironmentConfigNormalizedOverride, EnvironmentConfigOverrideOverride } from \"@stackframe/stack-shared/dist/config/schema\";\nimport { StackAdminApp } from \"../apps/interfaces/admin-app\";\nimport { AdminProjectConfig, AdminProjectConfigUpdateOptions, ProjectConfig } from \"../project-configs\";\n\n\nexport type Project = {\n readonly id: string,\n readonly displayName: string,\n readonly config: ProjectConfig,\n};\n\nexport type AdminProject = {\n readonly id: string,\n readonly displayName: string,\n readonly description: string | null,\n readonly createdAt: Date,\n readonly isProductionMode: boolean,\n readonly ownerTeamId: string | null,\n readonly logoUrl: string | null | undefined,\n readonly logoFullUrl: string | null | undefined,\n readonly logoDarkModeUrl: string | null | undefined,\n readonly logoFullDarkModeUrl: string | null | undefined,\n\n readonly config: AdminProjectConfig,\n\n update(this: AdminProject, update: AdminProjectUpdateOptions): Promise<void>,\n delete(this: AdminProject): Promise<void>,\n\n getConfig(this: AdminProject): Promise<CompleteConfig>,\n\n // We have some strict types here in order to prevent accidental overwriting of a top-level property of a config object\n updateConfig(\n this: AdminProject,\n config: EnvironmentConfigOverrideOverride & {\n [K in keyof EnvironmentConfigNormalizedOverride]: \"............................ERROR MESSAGE AFTER THIS LINE............................ You have attempted to update a config object with a top-level property in it (for example `emails`). This is very likely a mistake, and you probably meant to update a nested property instead (for example `emails.server`). If you really meant to update a top-level property (resetting all nested properties to their defaults), cast as any (the code will work at runtime) ............................ERROR MESSAGE BEFORE THIS LINE............................\";\n }\n ): Promise<void>,\n\n getProductionModeErrors(this: AdminProject): Promise<ProductionModeError[]>,\n} & Project;\n\nexport type AdminOwnedProject = {\n readonly app: StackAdminApp<false>,\n} & AdminProject;\n\nexport type AdminProjectUpdateOptions = {\n displayName?: string,\n description?: string,\n isProductionMode?: boolean,\n logoUrl?: string | null,\n logoFullUrl?: string | null,\n logoDarkModeUrl?: string | null,\n logoFullDarkModeUrl?: string | null,\n config?: AdminProjectConfigUpdateOptions,\n};\nexport function adminProjectUpdateOptionsToCrud(options: AdminProjectUpdateOptions): ProjectsCrud[\"Admin\"][\"Update\"] {\n return {\n display_name: options.displayName,\n description: options.description,\n is_production_mode: options.isProductionMode,\n logo_url: options.logoUrl,\n logo_full_url: options.logoFullUrl,\n logo_dark_mode_url: options.logoDarkModeUrl,\n logo_full_dark_mode_url: options.logoFullDarkModeUrl,\n /**\n * NOTE: Do not update this config anymore. It's been superseded by the new config in schema.ts.\n * @deprecated\n */\n config: {\n domains: options.config?.domains?.map((d) => ({\n domain: d.domain,\n handler_path: d.handlerPath\n })),\n oauth_providers: options.config?.oauthProviders?.map((p) => ({\n id: p.id as any,\n type: p.type,\n ...(p.type === 'standard' && {\n client_id: p.clientId,\n client_secret: p.clientSecret,\n facebook_config_id: p.facebookConfigId,\n microsoft_tenant_id: p.microsoftTenantId,\n }),\n })),\n email_config: options.config?.emailConfig && (\n options.config.emailConfig.type === 'shared' ? {\n type: 'shared',\n } : {\n type: 'standard',\n host: options.config.emailConfig.host,\n port: options.config.emailConfig.port,\n username: options.config.emailConfig.username,\n password: options.config.emailConfig.password,\n sender_name: options.config.emailConfig.senderName,\n sender_email: options.config.emailConfig.senderEmail,\n }\n ),\n email_theme: options.config?.emailTheme,\n sign_up_enabled: options.config?.signUpEnabled,\n credential_enabled: options.config?.credentialEnabled,\n magic_link_enabled: options.config?.magicLinkEnabled,\n passkey_enabled: options.config?.passkeyEnabled,\n allow_localhost: options.config?.allowLocalhost,\n create_team_on_sign_up: options.config?.createTeamOnSignUp,\n client_team_creation_enabled: options.config?.clientTeamCreationEnabled,\n client_user_deletion_enabled: options.config?.clientUserDeletionEnabled,\n team_creator_default_permissions: options.config?.teamCreatorDefaultPermissions,\n team_member_default_permissions: options.config?.teamMemberDefaultPermissions,\n user_default_permissions: options.config?.userDefaultPermissions,\n oauth_account_merge_strategy: options.config?.oauthAccountMergeStrategy,\n allow_user_api_keys: options.config?.allowUserApiKeys,\n allow_team_api_keys: options.config?.allowTeamApiKeys,\n },\n };\n}\n\nexport type AdminProjectCreateOptions = Omit<AdminProjectUpdateOptions, 'displayName'> & {\n displayName: string,\n teamId: string,\n};\nexport function adminProjectCreateOptionsToCrud(options: AdminProjectCreateOptions): AdminUserProjectsCrud[\"Server\"][\"Create\"] {\n return {\n ...adminProjectUpdateOptionsToCrud(options),\n display_name: options.displayName,\n owner_team_id: options.teamId,\n };\n}\n"],"mappings":";AA8DO,SAAS,gCAAgC,SAAqE;AACnH,SAAO;AAAA,IACL,cAAc,QAAQ;AAAA,IACtB,aAAa,QAAQ;AAAA,IACrB,oBAAoB,QAAQ;AAAA,IAC5B,UAAU,QAAQ;AAAA,IAClB,eAAe,QAAQ;AAAA,IACvB,oBAAoB,QAAQ;AAAA,IAC5B,yBAAyB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,IAKjC,QAAQ;AAAA,MACN,SAAS,QAAQ,QAAQ,SAAS,IAAI,CAAC,OAAO;AAAA,QAC5C,QAAQ,EAAE;AAAA,QACV,cAAc,EAAE;AAAA,MAClB,EAAE;AAAA,MACF,iBAAiB,QAAQ,QAAQ,gBAAgB,IAAI,CAAC,OAAO;AAAA,QAC3D,IAAI,EAAE;AAAA,QACN,MAAM,EAAE;AAAA,QACR,GAAI,EAAE,SAAS,cAAc;AAAA,UAC3B,WAAW,EAAE;AAAA,UACb,eAAe,EAAE;AAAA,UACjB,oBAAoB,EAAE;AAAA,UACtB,qBAAqB,EAAE;AAAA,QACzB;AAAA,MACF,EAAE;AAAA,MACF,cAAc,QAAQ,QAAQ,gBAC5B,QAAQ,OAAO,YAAY,SAAS,WAAW;AAAA,QAC7C,MAAM;AAAA,MACR,IAAI;AAAA,QACF,MAAM;AAAA,QACN,MAAM,QAAQ,OAAO,YAAY;AAAA,QACjC,MAAM,QAAQ,OAAO,YAAY;AAAA,QACjC,UAAU,QAAQ,OAAO,YAAY;AAAA,QACrC,UAAU,QAAQ,OAAO,YAAY;AAAA,QACrC,aAAa,QAAQ,OAAO,YAAY;AAAA,QACxC,cAAc,QAAQ,OAAO,YAAY;AAAA,MAC3C;AAAA,MAEF,aAAa,QAAQ,QAAQ;AAAA,MAC7B,iBAAiB,QAAQ,QAAQ;AAAA,MACjC,oBAAoB,QAAQ,QAAQ;AAAA,MACpC,oBAAoB,QAAQ,QAAQ;AAAA,MACpC,iBAAiB,QAAQ,QAAQ;AAAA,MACjC,iBAAiB,QAAQ,QAAQ;AAAA,MACjC,wBAAwB,QAAQ,QAAQ;AAAA,MACxC,8BAA8B,QAAQ,QAAQ;AAAA,MAC9C,8BAA8B,QAAQ,QAAQ;AAAA,MAC9C,kCAAkC,QAAQ,QAAQ;AAAA,MAClD,iCAAiC,QAAQ,QAAQ;AAAA,MACjD,0BAA0B,QAAQ,QAAQ;AAAA,MAC1C,8BAA8B,QAAQ,QAAQ;AAAA,MAC9C,qBAAqB,QAAQ,QAAQ;AAAA,MACrC,qBAAqB,QAAQ,QAAQ;AAAA,IACvC;AAAA,EACF;AACF;AAMO,SAAS,gCAAgC,SAA+E;AAC7H,SAAO;AAAA,IACL,GAAG,gCAAgC,OAAO;AAAA,IAC1C,cAAc,QAAQ;AAAA,IACtB,eAAe,QAAQ;AAAA,EACzB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../../src/lib/stack-app/projects/index.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY, INSTEAD EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\nimport { ProductionModeError } from \"@stackframe/stack-shared/dist/helpers/production-mode\";\nimport { AdminUserProjectsCrud, ProjectsCrud } from \"@stackframe/stack-shared/dist/interface/crud/projects\";\n\nimport { CompleteConfig, EnvironmentConfigNormalizedOverride, EnvironmentConfigOverrideOverride } from \"@stackframe/stack-shared/dist/config/schema\";\nimport { StackAdminApp } from \"../apps/interfaces/admin-app\";\nimport { AdminProjectConfig, AdminProjectConfigUpdateOptions, ProjectConfig } from \"../project-configs\";\n\n/**\n * SDK type for pushed config source (camelCase for SDK).\n * Represents where the branch config was pushed from.\n */\nexport type PushedConfigSource =\n | { type: \"pushed-from-github\", owner: string, repo: string, branch: string, commitHash: string, configFilePath: string }\n | { type: \"pushed-from-unknown\" }\n | { type: \"unlinked\" };\n\nexport type PushConfigOptions = {\n /**\n * The source of this config push.\n */\n source: PushedConfigSource,\n};\n\n\nexport type Project = {\n readonly id: string,\n readonly displayName: string,\n readonly config: ProjectConfig,\n};\n\nexport type AdminProject = {\n readonly id: string,\n readonly displayName: string,\n readonly description: string | null,\n readonly createdAt: Date,\n readonly isProductionMode: boolean,\n readonly ownerTeamId: string | null,\n readonly logoUrl: string | null | undefined,\n readonly logoFullUrl: string | null | undefined,\n readonly logoDarkModeUrl: string | null | undefined,\n readonly logoFullDarkModeUrl: string | null | undefined,\n\n readonly config: AdminProjectConfig,\n\n update(this: AdminProject, update: AdminProjectUpdateOptions): Promise<void>,\n delete(this: AdminProject): Promise<void>,\n\n getConfig(this: AdminProject): Promise<CompleteConfig>,\n\n /**\n * Updates the environment's config by merging the provided config into the existing config.\n *\n * Changes made with `updateConfig` always take precedence over those made with `pushConfig`, even if the `pushConfig`\n * config was pushed after the changes were made with `updateConfig`. This is best for environment-specific\n * configuration like secrets, API keys, and other values that you wouldn't push into a source repository.\n */\n // We have some strict types here in order to prevent accidental overwriting of a top-level property of a config object\n updateConfig(\n this: AdminProject,\n config: EnvironmentConfigOverrideOverride & {\n [K in keyof EnvironmentConfigNormalizedOverride]: \"............................ERROR MESSAGE AFTER THIS LINE............................ You have attempted to update a config object with a top-level property in it (for example `emails`). This is very likely a mistake, and you probably meant to update a nested property instead (for example `emails.server`). If you really meant to update a top-level property (resetting all nested properties to their defaults), cast as any (the code will work at runtime) ............................ERROR MESSAGE BEFORE THIS LINE............................\";\n }\n ): Promise<void>,\n\n /**\n * Pushes a config, replacing any previous config pushed with `pushConfig`.\n *\n * **Note:** This function does **not** replace any changes made with `updateConfig`. Changes made with\n * `updateConfig` always take precedence over those made with `pushConfig`, even if the `pushConfig`\n * config was pushed after the changes were made with `updateConfig`.\n *\n * This is useful for programmatically deploying configuration. More often than not, you'll want to use\n * `updateConfig` instead.\n */\n pushConfig(\n this: AdminProject,\n config: EnvironmentConfigOverrideOverride & {\n [K in keyof EnvironmentConfigNormalizedOverride]: \"............................ERROR MESSAGE AFTER THIS LINE............................ You have attempted to update a config object with a top-level property in it (for example `emails`). This is very likely a mistake, and you probably meant to update a nested property instead (for example `emails.server`). If you really meant to update a top-level property (resetting all nested properties to their defaults), cast as any (the code will work at runtime) ............................ERROR MESSAGE BEFORE THIS LINE............................\";\n },\n options: PushConfigOptions,\n ): Promise<void>,\n\n /**\n * Updates the pushed config by merging the provided config into the existing pushed config.\n *\n * **Warning:** This is almost always **not** the function you want to call. Changes made with\n * `updatePushedConfig` will be replaced entirely the next time `pushConfig` is called. Consider using\n * `pushConfig` to set the full pushed config, or `updateConfig` for environment-specific values that\n * should persist across pushes.\n *\n * This function is useful for making temporary modifications to the pushed config before the next push.\n */\n updatePushedConfig(\n this: AdminProject,\n config: EnvironmentConfigOverrideOverride & {\n [K in keyof EnvironmentConfigNormalizedOverride]: \"............................ERROR MESSAGE AFTER THIS LINE............................ You have attempted to update a config object with a top-level property in it (for example `emails`). This is very likely a mistake, and you probably meant to update a nested property instead (for example `emails.server`). If you really meant to update a top-level property (resetting all nested properties to their defaults), cast as any (the code will work at runtime) ............................ERROR MESSAGE BEFORE THIS LINE............................\";\n }\n ): Promise<void>,\n\n /**\n * Gets the source metadata for the pushed config, indicating where it was pushed from.\n *\n * The source can be:\n * - `pushed-from-github`: Config was pushed from a GitHub repository\n * - `pushed-from-unknown`: Config was pushed via CLI but source details unknown\n * - `unlinked`: Config can be edited directly on the dashboard\n */\n getPushedConfigSource(this: AdminProject): Promise<PushedConfigSource>,\n\n /**\n * Unlinks the pushed config source, setting it to \"unlinked\".\n * This allows the config to be edited directly on the dashboard without external push restrictions.\n */\n unlinkPushedConfigSource(this: AdminProject): Promise<void>,\n\n getProductionModeErrors(this: AdminProject): Promise<ProductionModeError[]>,\n} & Project;\n\nexport type AdminOwnedProject = {\n readonly app: StackAdminApp<false>,\n} & AdminProject;\n\nexport type AdminProjectUpdateOptions = {\n displayName?: string,\n description?: string,\n isProductionMode?: boolean,\n logoUrl?: string | null,\n logoFullUrl?: string | null,\n logoDarkModeUrl?: string | null,\n logoFullDarkModeUrl?: string | null,\n config?: AdminProjectConfigUpdateOptions,\n};\nexport function adminProjectUpdateOptionsToCrud(options: AdminProjectUpdateOptions): ProjectsCrud[\"Admin\"][\"Update\"] {\n return {\n display_name: options.displayName,\n description: options.description,\n is_production_mode: options.isProductionMode,\n logo_url: options.logoUrl,\n logo_full_url: options.logoFullUrl,\n logo_dark_mode_url: options.logoDarkModeUrl,\n logo_full_dark_mode_url: options.logoFullDarkModeUrl,\n /**\n * NOTE: Do not update this config anymore. It's been superseded by the new config in schema.ts.\n * @deprecated\n */\n config: {\n domains: options.config?.domains?.map((d) => ({\n domain: d.domain,\n handler_path: d.handlerPath\n })),\n oauth_providers: options.config?.oauthProviders?.map((p) => ({\n id: p.id as any,\n type: p.type,\n ...(p.type === 'standard' && {\n client_id: p.clientId,\n client_secret: p.clientSecret,\n facebook_config_id: p.facebookConfigId,\n microsoft_tenant_id: p.microsoftTenantId,\n }),\n })),\n email_config: options.config?.emailConfig && (\n options.config.emailConfig.type === 'shared' ? {\n type: 'shared',\n } : {\n type: 'standard',\n host: options.config.emailConfig.host,\n port: options.config.emailConfig.port,\n username: options.config.emailConfig.username,\n password: options.config.emailConfig.password,\n sender_name: options.config.emailConfig.senderName,\n sender_email: options.config.emailConfig.senderEmail,\n }\n ),\n email_theme: options.config?.emailTheme,\n sign_up_enabled: options.config?.signUpEnabled,\n credential_enabled: options.config?.credentialEnabled,\n magic_link_enabled: options.config?.magicLinkEnabled,\n passkey_enabled: options.config?.passkeyEnabled,\n allow_localhost: options.config?.allowLocalhost,\n create_team_on_sign_up: options.config?.createTeamOnSignUp,\n client_team_creation_enabled: options.config?.clientTeamCreationEnabled,\n client_user_deletion_enabled: options.config?.clientUserDeletionEnabled,\n team_creator_default_permissions: options.config?.teamCreatorDefaultPermissions,\n team_member_default_permissions: options.config?.teamMemberDefaultPermissions,\n user_default_permissions: options.config?.userDefaultPermissions,\n oauth_account_merge_strategy: options.config?.oauthAccountMergeStrategy,\n allow_user_api_keys: options.config?.allowUserApiKeys,\n allow_team_api_keys: options.config?.allowTeamApiKeys,\n },\n };\n}\n\nexport type AdminProjectCreateOptions = Omit<AdminProjectUpdateOptions, 'displayName'> & {\n displayName: string,\n teamId: string,\n};\nexport function adminProjectCreateOptionsToCrud(options: AdminProjectCreateOptions): AdminUserProjectsCrud[\"Server\"][\"Create\"] {\n return {\n ...adminProjectUpdateOptionsToCrud(options),\n display_name: options.displayName,\n owner_team_id: options.teamId,\n };\n}\n"],"mappings":";AAwIO,SAAS,gCAAgC,SAAqE;AACnH,SAAO;AAAA,IACL,cAAc,QAAQ;AAAA,IACtB,aAAa,QAAQ;AAAA,IACrB,oBAAoB,QAAQ;AAAA,IAC5B,UAAU,QAAQ;AAAA,IAClB,eAAe,QAAQ;AAAA,IACvB,oBAAoB,QAAQ;AAAA,IAC5B,yBAAyB,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,IAKjC,QAAQ;AAAA,MACN,SAAS,QAAQ,QAAQ,SAAS,IAAI,CAAC,OAAO;AAAA,QAC5C,QAAQ,EAAE;AAAA,QACV,cAAc,EAAE;AAAA,MAClB,EAAE;AAAA,MACF,iBAAiB,QAAQ,QAAQ,gBAAgB,IAAI,CAAC,OAAO;AAAA,QAC3D,IAAI,EAAE;AAAA,QACN,MAAM,EAAE;AAAA,QACR,GAAI,EAAE,SAAS,cAAc;AAAA,UAC3B,WAAW,EAAE;AAAA,UACb,eAAe,EAAE;AAAA,UACjB,oBAAoB,EAAE;AAAA,UACtB,qBAAqB,EAAE;AAAA,QACzB;AAAA,MACF,EAAE;AAAA,MACF,cAAc,QAAQ,QAAQ,gBAC5B,QAAQ,OAAO,YAAY,SAAS,WAAW;AAAA,QAC7C,MAAM;AAAA,MACR,IAAI;AAAA,QACF,MAAM;AAAA,QACN,MAAM,QAAQ,OAAO,YAAY;AAAA,QACjC,MAAM,QAAQ,OAAO,YAAY;AAAA,QACjC,UAAU,QAAQ,OAAO,YAAY;AAAA,QACrC,UAAU,QAAQ,OAAO,YAAY;AAAA,QACrC,aAAa,QAAQ,OAAO,YAAY;AAAA,QACxC,cAAc,QAAQ,OAAO,YAAY;AAAA,MAC3C;AAAA,MAEF,aAAa,QAAQ,QAAQ;AAAA,MAC7B,iBAAiB,QAAQ,QAAQ;AAAA,MACjC,oBAAoB,QAAQ,QAAQ;AAAA,MACpC,oBAAoB,QAAQ,QAAQ;AAAA,MACpC,iBAAiB,QAAQ,QAAQ;AAAA,MACjC,iBAAiB,QAAQ,QAAQ;AAAA,MACjC,wBAAwB,QAAQ,QAAQ;AAAA,MACxC,8BAA8B,QAAQ,QAAQ;AAAA,MAC9C,8BAA8B,QAAQ,QAAQ;AAAA,MAC9C,kCAAkC,QAAQ,QAAQ;AAAA,MAClD,iCAAiC,QAAQ,QAAQ;AAAA,MACjD,0BAA0B,QAAQ,QAAQ;AAAA,MAC1C,8BAA8B,QAAQ,QAAQ;AAAA,MAC9C,qBAAqB,QAAQ,QAAQ;AAAA,MACrC,qBAAqB,QAAQ,QAAQ;AAAA,IACvC;AAAA,EACF;AACF;AAMO,SAAS,gCAAgC,SAA+E;AAC7H,SAAO;AAAA,IACL,GAAG,gCAAgC,OAAO;AAAA,IAC1C,cAAc,QAAQ;AAAA,IACtB,eAAe,QAAQ;AAAA,EACzB;AACF;","names":[]}
package/dist/index.d.mts CHANGED
@@ -260,6 +260,25 @@ type CustomerProductsRequestOptions = ({
260
260
  } & CustomerProductsListOptions) | ({
261
261
  customCustomerId: string;
262
262
  } & CustomerProductsListOptions);
263
+ type CustomerInvoiceStatus = "draft" | "open" | "paid" | "uncollectible" | "void" | null;
264
+ type CustomerInvoice = {
265
+ createdAt: Date;
266
+ status: CustomerInvoiceStatus;
267
+ amountTotal: number;
268
+ hostedInvoiceUrl: string | null;
269
+ };
270
+ type CustomerInvoicesList = CustomerInvoice[] & {
271
+ nextCursor: string | null;
272
+ };
273
+ type CustomerInvoicesListOptions = {
274
+ cursor?: string;
275
+ limit?: number;
276
+ };
277
+ type CustomerInvoicesRequestOptions = ({
278
+ userId: string;
279
+ } & CustomerInvoicesListOptions) | ({
280
+ teamId: string;
281
+ } & CustomerInvoicesListOptions);
263
282
  type CustomerDefaultPaymentMethod = {
264
283
  id: string;
265
284
  brand: string | null;
@@ -297,7 +316,9 @@ type Customer<IsServer extends boolean = false> = {
297
316
  itemId: string
298
317
  ], IsServer extends true ? ServerItem : Item, false> & AsyncStoreProperty<"products", [
299
318
  options?: CustomerProductsListOptions
300
- ], CustomerProductsList, true> & (IsServer extends true ? {
319
+ ], CustomerProductsList, true> & AsyncStoreProperty<"invoices", [
320
+ options?: CustomerInvoicesListOptions
321
+ ], CustomerInvoicesList, true> & (IsServer extends true ? {
301
322
  grantProduct(product: {
302
323
  productId: string;
303
324
  quantity?: number;
@@ -1206,6 +1227,17 @@ type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends st
1206
1227
  createStripeWidgetAccountSession(): Promise<{
1207
1228
  client_secret: string;
1208
1229
  }>;
1230
+ getPaymentMethodConfigs(): Promise<{
1231
+ configId: string;
1232
+ methods: Array<{
1233
+ id: string;
1234
+ name: string;
1235
+ enabled: boolean;
1236
+ available: boolean;
1237
+ overridable: boolean;
1238
+ }>;
1239
+ } | null>;
1240
+ updatePaymentMethodConfigs(configId: string, updates: Record<string, 'on' | 'off'>): Promise<void>;
1209
1241
  createEmailDraft(options: {
1210
1242
  displayName: string;
1211
1243
  themeId?: string | undefined | false;
@@ -1343,6 +1375,28 @@ type AdminProjectConfigUpdateOptions = {
1343
1375
  allowTeamApiKeys?: boolean;
1344
1376
  };
1345
1377
 
1378
+ /**
1379
+ * SDK type for pushed config source (camelCase for SDK).
1380
+ * Represents where the branch config was pushed from.
1381
+ */
1382
+ type PushedConfigSource = {
1383
+ type: "pushed-from-github";
1384
+ owner: string;
1385
+ repo: string;
1386
+ branch: string;
1387
+ commitHash: string;
1388
+ configFilePath: string;
1389
+ } | {
1390
+ type: "pushed-from-unknown";
1391
+ } | {
1392
+ type: "unlinked";
1393
+ };
1394
+ type PushConfigOptions = {
1395
+ /**
1396
+ * The source of this config push.
1397
+ */
1398
+ source: PushedConfigSource;
1399
+ };
1346
1400
  type Project = {
1347
1401
  readonly id: string;
1348
1402
  readonly displayName: string;
@@ -1363,9 +1417,56 @@ type AdminProject = {
1363
1417
  update(this: AdminProject, update: AdminProjectUpdateOptions): Promise<void>;
1364
1418
  delete(this: AdminProject): Promise<void>;
1365
1419
  getConfig(this: AdminProject): Promise<CompleteConfig>;
1420
+ /**
1421
+ * Updates the environment's config by merging the provided config into the existing config.
1422
+ *
1423
+ * Changes made with `updateConfig` always take precedence over those made with `pushConfig`, even if the `pushConfig`
1424
+ * config was pushed after the changes were made with `updateConfig`. This is best for environment-specific
1425
+ * configuration like secrets, API keys, and other values that you wouldn't push into a source repository.
1426
+ */
1366
1427
  updateConfig(this: AdminProject, config: EnvironmentConfigOverrideOverride & {
1367
1428
  [K in keyof EnvironmentConfigNormalizedOverride]: "............................ERROR MESSAGE AFTER THIS LINE............................ You have attempted to update a config object with a top-level property in it (for example `emails`). This is very likely a mistake, and you probably meant to update a nested property instead (for example `emails.server`). If you really meant to update a top-level property (resetting all nested properties to their defaults), cast as any (the code will work at runtime) ............................ERROR MESSAGE BEFORE THIS LINE............................";
1368
1429
  }): Promise<void>;
1430
+ /**
1431
+ * Pushes a config, replacing any previous config pushed with `pushConfig`.
1432
+ *
1433
+ * **Note:** This function does **not** replace any changes made with `updateConfig`. Changes made with
1434
+ * `updateConfig` always take precedence over those made with `pushConfig`, even if the `pushConfig`
1435
+ * config was pushed after the changes were made with `updateConfig`.
1436
+ *
1437
+ * This is useful for programmatically deploying configuration. More often than not, you'll want to use
1438
+ * `updateConfig` instead.
1439
+ */
1440
+ pushConfig(this: AdminProject, config: EnvironmentConfigOverrideOverride & {
1441
+ [K in keyof EnvironmentConfigNormalizedOverride]: "............................ERROR MESSAGE AFTER THIS LINE............................ You have attempted to update a config object with a top-level property in it (for example `emails`). This is very likely a mistake, and you probably meant to update a nested property instead (for example `emails.server`). If you really meant to update a top-level property (resetting all nested properties to their defaults), cast as any (the code will work at runtime) ............................ERROR MESSAGE BEFORE THIS LINE............................";
1442
+ }, options: PushConfigOptions): Promise<void>;
1443
+ /**
1444
+ * Updates the pushed config by merging the provided config into the existing pushed config.
1445
+ *
1446
+ * **Warning:** This is almost always **not** the function you want to call. Changes made with
1447
+ * `updatePushedConfig` will be replaced entirely the next time `pushConfig` is called. Consider using
1448
+ * `pushConfig` to set the full pushed config, or `updateConfig` for environment-specific values that
1449
+ * should persist across pushes.
1450
+ *
1451
+ * This function is useful for making temporary modifications to the pushed config before the next push.
1452
+ */
1453
+ updatePushedConfig(this: AdminProject, config: EnvironmentConfigOverrideOverride & {
1454
+ [K in keyof EnvironmentConfigNormalizedOverride]: "............................ERROR MESSAGE AFTER THIS LINE............................ You have attempted to update a config object with a top-level property in it (for example `emails`). This is very likely a mistake, and you probably meant to update a nested property instead (for example `emails.server`). If you really meant to update a top-level property (resetting all nested properties to their defaults), cast as any (the code will work at runtime) ............................ERROR MESSAGE BEFORE THIS LINE............................";
1455
+ }): Promise<void>;
1456
+ /**
1457
+ * Gets the source metadata for the pushed config, indicating where it was pushed from.
1458
+ *
1459
+ * The source can be:
1460
+ * - `pushed-from-github`: Config was pushed from a GitHub repository
1461
+ * - `pushed-from-unknown`: Config was pushed via CLI but source details unknown
1462
+ * - `unlinked`: Config can be edited directly on the dashboard
1463
+ */
1464
+ getPushedConfigSource(this: AdminProject): Promise<PushedConfigSource>;
1465
+ /**
1466
+ * Unlinks the pushed config source, setting it to "unlinked".
1467
+ * This allows the config to be edited directly on the dashboard without external push restrictions.
1468
+ */
1469
+ unlinkPushedConfigSource(this: AdminProject): Promise<void>;
1369
1470
  getProductionModeErrors(this: AdminProject): Promise<ProductionModeError[]>;
1370
1471
  } & Project;
1371
1472
  type AdminOwnedProject = {
@@ -1533,7 +1634,9 @@ type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId extends s
1533
1634
  }
1534
1635
  ], Item, false> & AsyncStoreProperty<"products", [
1535
1636
  options: CustomerProductsRequestOptions
1536
- ], CustomerProductsList, true> & {
1637
+ ], CustomerProductsList, true> & AsyncStoreProperty<"invoices", [
1638
+ options: CustomerInvoicesRequestOptions
1639
+ ], CustomerInvoicesList, true> & {
1537
1640
  [K in `redirectTo${Capitalize<keyof Omit<HandlerUrls, 'handler' | 'oauthCallback'>>}`]: (options?: RedirectToOptions) => Promise<void>;
1538
1641
  } & AuthLike<HasTokenStore extends false ? {
1539
1642
  tokenStore: TokenStoreInit;
@@ -1542,4 +1645,4 @@ type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId extends s
1542
1645
  }>);
1543
1646
  declare const StackClientApp: StackClientAppConstructor;
1544
1647
 
1545
- export { type AdminDomainConfig, type AdminEmailConfig, type AdminEmailOutbox, type AdminEmailOutboxRecipient, type AdminEmailOutboxSimpleStatus, type AdminEmailOutboxStatus, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectPermission, type AdminProjectPermissionDefinition, type AdminProjectPermissionDefinitionCreateOptions, type AdminProjectPermissionDefinitionUpdateOptions, type AdminProjectUpdateOptions, type AdminSentEmail, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type Auth, type Connection, type ContactChannel, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, type EmailOutboxListOptions, type EmailOutboxListResult, type EmailOutboxUpdateOptions, type GetCurrentUserOptions, type GetCurrentUserOptions as GetUserOptions, type HandlerUrls, type InternalApiKey, type InternalApiKeyBase, type InternalApiKeyBaseCrudRead, type InternalApiKeyCreateOptions, type InternalApiKeyFirstView, type OAuthConnection, type OAuthProvider, type OAuthProviderConfig, type OAuthScopesOnSignIn, type Project, type ProjectConfig, type ServerContactChannel, type ServerListUsersOptions, type ServerOAuthProvider, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, StackServerApp, type StackServerAppConstructor, type StackServerAppConstructorOptions, type Team, type TeamCreateOptions, type TeamInvitation, type TeamMemberProfile, type TeamUpdateOptions, type TeamUser, type User, stackAppInternalsSymbol };
1648
+ export { type AdminDomainConfig, type AdminEmailConfig, type AdminEmailOutbox, type AdminEmailOutboxRecipient, type AdminEmailOutboxSimpleStatus, type AdminEmailOutboxStatus, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectPermission, type AdminProjectPermissionDefinition, type AdminProjectPermissionDefinitionCreateOptions, type AdminProjectPermissionDefinitionUpdateOptions, type AdminProjectUpdateOptions, type AdminSentEmail, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type Auth, type Connection, type ContactChannel, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, type EmailOutboxListOptions, type EmailOutboxListResult, type EmailOutboxUpdateOptions, type GetCurrentUserOptions, type GetCurrentUserOptions as GetUserOptions, type HandlerUrls, type InternalApiKey, type InternalApiKeyBase, type InternalApiKeyBaseCrudRead, type InternalApiKeyCreateOptions, type InternalApiKeyFirstView, type OAuthConnection, type OAuthProvider, type OAuthProviderConfig, type OAuthScopesOnSignIn, type Project, type ProjectConfig, type PushedConfigSource, type ServerContactChannel, type ServerListUsersOptions, type ServerOAuthProvider, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, StackServerApp, type StackServerAppConstructor, type StackServerAppConstructorOptions, type Team, type TeamCreateOptions, type TeamInvitation, type TeamMemberProfile, type TeamUpdateOptions, type TeamUser, type User, stackAppInternalsSymbol };
package/dist/index.d.ts CHANGED
@@ -260,6 +260,25 @@ type CustomerProductsRequestOptions = ({
260
260
  } & CustomerProductsListOptions) | ({
261
261
  customCustomerId: string;
262
262
  } & CustomerProductsListOptions);
263
+ type CustomerInvoiceStatus = "draft" | "open" | "paid" | "uncollectible" | "void" | null;
264
+ type CustomerInvoice = {
265
+ createdAt: Date;
266
+ status: CustomerInvoiceStatus;
267
+ amountTotal: number;
268
+ hostedInvoiceUrl: string | null;
269
+ };
270
+ type CustomerInvoicesList = CustomerInvoice[] & {
271
+ nextCursor: string | null;
272
+ };
273
+ type CustomerInvoicesListOptions = {
274
+ cursor?: string;
275
+ limit?: number;
276
+ };
277
+ type CustomerInvoicesRequestOptions = ({
278
+ userId: string;
279
+ } & CustomerInvoicesListOptions) | ({
280
+ teamId: string;
281
+ } & CustomerInvoicesListOptions);
263
282
  type CustomerDefaultPaymentMethod = {
264
283
  id: string;
265
284
  brand: string | null;
@@ -297,7 +316,9 @@ type Customer<IsServer extends boolean = false> = {
297
316
  itemId: string
298
317
  ], IsServer extends true ? ServerItem : Item, false> & AsyncStoreProperty<"products", [
299
318
  options?: CustomerProductsListOptions
300
- ], CustomerProductsList, true> & (IsServer extends true ? {
319
+ ], CustomerProductsList, true> & AsyncStoreProperty<"invoices", [
320
+ options?: CustomerInvoicesListOptions
321
+ ], CustomerInvoicesList, true> & (IsServer extends true ? {
301
322
  grantProduct(product: {
302
323
  productId: string;
303
324
  quantity?: number;
@@ -1206,6 +1227,17 @@ type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends st
1206
1227
  createStripeWidgetAccountSession(): Promise<{
1207
1228
  client_secret: string;
1208
1229
  }>;
1230
+ getPaymentMethodConfigs(): Promise<{
1231
+ configId: string;
1232
+ methods: Array<{
1233
+ id: string;
1234
+ name: string;
1235
+ enabled: boolean;
1236
+ available: boolean;
1237
+ overridable: boolean;
1238
+ }>;
1239
+ } | null>;
1240
+ updatePaymentMethodConfigs(configId: string, updates: Record<string, 'on' | 'off'>): Promise<void>;
1209
1241
  createEmailDraft(options: {
1210
1242
  displayName: string;
1211
1243
  themeId?: string | undefined | false;
@@ -1343,6 +1375,28 @@ type AdminProjectConfigUpdateOptions = {
1343
1375
  allowTeamApiKeys?: boolean;
1344
1376
  };
1345
1377
 
1378
+ /**
1379
+ * SDK type for pushed config source (camelCase for SDK).
1380
+ * Represents where the branch config was pushed from.
1381
+ */
1382
+ type PushedConfigSource = {
1383
+ type: "pushed-from-github";
1384
+ owner: string;
1385
+ repo: string;
1386
+ branch: string;
1387
+ commitHash: string;
1388
+ configFilePath: string;
1389
+ } | {
1390
+ type: "pushed-from-unknown";
1391
+ } | {
1392
+ type: "unlinked";
1393
+ };
1394
+ type PushConfigOptions = {
1395
+ /**
1396
+ * The source of this config push.
1397
+ */
1398
+ source: PushedConfigSource;
1399
+ };
1346
1400
  type Project = {
1347
1401
  readonly id: string;
1348
1402
  readonly displayName: string;
@@ -1363,9 +1417,56 @@ type AdminProject = {
1363
1417
  update(this: AdminProject, update: AdminProjectUpdateOptions): Promise<void>;
1364
1418
  delete(this: AdminProject): Promise<void>;
1365
1419
  getConfig(this: AdminProject): Promise<CompleteConfig>;
1420
+ /**
1421
+ * Updates the environment's config by merging the provided config into the existing config.
1422
+ *
1423
+ * Changes made with `updateConfig` always take precedence over those made with `pushConfig`, even if the `pushConfig`
1424
+ * config was pushed after the changes were made with `updateConfig`. This is best for environment-specific
1425
+ * configuration like secrets, API keys, and other values that you wouldn't push into a source repository.
1426
+ */
1366
1427
  updateConfig(this: AdminProject, config: EnvironmentConfigOverrideOverride & {
1367
1428
  [K in keyof EnvironmentConfigNormalizedOverride]: "............................ERROR MESSAGE AFTER THIS LINE............................ You have attempted to update a config object with a top-level property in it (for example `emails`). This is very likely a mistake, and you probably meant to update a nested property instead (for example `emails.server`). If you really meant to update a top-level property (resetting all nested properties to their defaults), cast as any (the code will work at runtime) ............................ERROR MESSAGE BEFORE THIS LINE............................";
1368
1429
  }): Promise<void>;
1430
+ /**
1431
+ * Pushes a config, replacing any previous config pushed with `pushConfig`.
1432
+ *
1433
+ * **Note:** This function does **not** replace any changes made with `updateConfig`. Changes made with
1434
+ * `updateConfig` always take precedence over those made with `pushConfig`, even if the `pushConfig`
1435
+ * config was pushed after the changes were made with `updateConfig`.
1436
+ *
1437
+ * This is useful for programmatically deploying configuration. More often than not, you'll want to use
1438
+ * `updateConfig` instead.
1439
+ */
1440
+ pushConfig(this: AdminProject, config: EnvironmentConfigOverrideOverride & {
1441
+ [K in keyof EnvironmentConfigNormalizedOverride]: "............................ERROR MESSAGE AFTER THIS LINE............................ You have attempted to update a config object with a top-level property in it (for example `emails`). This is very likely a mistake, and you probably meant to update a nested property instead (for example `emails.server`). If you really meant to update a top-level property (resetting all nested properties to their defaults), cast as any (the code will work at runtime) ............................ERROR MESSAGE BEFORE THIS LINE............................";
1442
+ }, options: PushConfigOptions): Promise<void>;
1443
+ /**
1444
+ * Updates the pushed config by merging the provided config into the existing pushed config.
1445
+ *
1446
+ * **Warning:** This is almost always **not** the function you want to call. Changes made with
1447
+ * `updatePushedConfig` will be replaced entirely the next time `pushConfig` is called. Consider using
1448
+ * `pushConfig` to set the full pushed config, or `updateConfig` for environment-specific values that
1449
+ * should persist across pushes.
1450
+ *
1451
+ * This function is useful for making temporary modifications to the pushed config before the next push.
1452
+ */
1453
+ updatePushedConfig(this: AdminProject, config: EnvironmentConfigOverrideOverride & {
1454
+ [K in keyof EnvironmentConfigNormalizedOverride]: "............................ERROR MESSAGE AFTER THIS LINE............................ You have attempted to update a config object with a top-level property in it (for example `emails`). This is very likely a mistake, and you probably meant to update a nested property instead (for example `emails.server`). If you really meant to update a top-level property (resetting all nested properties to their defaults), cast as any (the code will work at runtime) ............................ERROR MESSAGE BEFORE THIS LINE............................";
1455
+ }): Promise<void>;
1456
+ /**
1457
+ * Gets the source metadata for the pushed config, indicating where it was pushed from.
1458
+ *
1459
+ * The source can be:
1460
+ * - `pushed-from-github`: Config was pushed from a GitHub repository
1461
+ * - `pushed-from-unknown`: Config was pushed via CLI but source details unknown
1462
+ * - `unlinked`: Config can be edited directly on the dashboard
1463
+ */
1464
+ getPushedConfigSource(this: AdminProject): Promise<PushedConfigSource>;
1465
+ /**
1466
+ * Unlinks the pushed config source, setting it to "unlinked".
1467
+ * This allows the config to be edited directly on the dashboard without external push restrictions.
1468
+ */
1469
+ unlinkPushedConfigSource(this: AdminProject): Promise<void>;
1369
1470
  getProductionModeErrors(this: AdminProject): Promise<ProductionModeError[]>;
1370
1471
  } & Project;
1371
1472
  type AdminOwnedProject = {
@@ -1533,7 +1634,9 @@ type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId extends s
1533
1634
  }
1534
1635
  ], Item, false> & AsyncStoreProperty<"products", [
1535
1636
  options: CustomerProductsRequestOptions
1536
- ], CustomerProductsList, true> & {
1637
+ ], CustomerProductsList, true> & AsyncStoreProperty<"invoices", [
1638
+ options: CustomerInvoicesRequestOptions
1639
+ ], CustomerInvoicesList, true> & {
1537
1640
  [K in `redirectTo${Capitalize<keyof Omit<HandlerUrls, 'handler' | 'oauthCallback'>>}`]: (options?: RedirectToOptions) => Promise<void>;
1538
1641
  } & AuthLike<HasTokenStore extends false ? {
1539
1642
  tokenStore: TokenStoreInit;
@@ -1542,4 +1645,4 @@ type StackClientApp<HasTokenStore extends boolean = boolean, ProjectId extends s
1542
1645
  }>);
1543
1646
  declare const StackClientApp: StackClientAppConstructor;
1544
1647
 
1545
- export { type AdminDomainConfig, type AdminEmailConfig, type AdminEmailOutbox, type AdminEmailOutboxRecipient, type AdminEmailOutboxSimpleStatus, type AdminEmailOutboxStatus, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectPermission, type AdminProjectPermissionDefinition, type AdminProjectPermissionDefinitionCreateOptions, type AdminProjectPermissionDefinitionUpdateOptions, type AdminProjectUpdateOptions, type AdminSentEmail, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type Auth, type Connection, type ContactChannel, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, type EmailOutboxListOptions, type EmailOutboxListResult, type EmailOutboxUpdateOptions, type GetCurrentUserOptions, type GetCurrentUserOptions as GetUserOptions, type HandlerUrls, type InternalApiKey, type InternalApiKeyBase, type InternalApiKeyBaseCrudRead, type InternalApiKeyCreateOptions, type InternalApiKeyFirstView, type OAuthConnection, type OAuthProvider, type OAuthProviderConfig, type OAuthScopesOnSignIn, type Project, type ProjectConfig, type ServerContactChannel, type ServerListUsersOptions, type ServerOAuthProvider, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, StackServerApp, type StackServerAppConstructor, type StackServerAppConstructorOptions, type Team, type TeamCreateOptions, type TeamInvitation, type TeamMemberProfile, type TeamUpdateOptions, type TeamUser, type User, stackAppInternalsSymbol };
1648
+ export { type AdminDomainConfig, type AdminEmailConfig, type AdminEmailOutbox, type AdminEmailOutboxRecipient, type AdminEmailOutboxSimpleStatus, type AdminEmailOutboxStatus, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectPermission, type AdminProjectPermissionDefinition, type AdminProjectPermissionDefinitionCreateOptions, type AdminProjectPermissionDefinitionUpdateOptions, type AdminProjectUpdateOptions, type AdminSentEmail, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type Auth, type Connection, type ContactChannel, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, type EmailOutboxListOptions, type EmailOutboxListResult, type EmailOutboxUpdateOptions, type GetCurrentUserOptions, type GetCurrentUserOptions as GetUserOptions, type HandlerUrls, type InternalApiKey, type InternalApiKeyBase, type InternalApiKeyBaseCrudRead, type InternalApiKeyCreateOptions, type InternalApiKeyFirstView, type OAuthConnection, type OAuthProvider, type OAuthProviderConfig, type OAuthScopesOnSignIn, type Project, type ProjectConfig, type PushedConfigSource, type ServerContactChannel, type ServerListUsersOptions, type ServerOAuthProvider, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, StackServerApp, type StackServerAppConstructor, type StackServerAppConstructorOptions, type Team, type TeamCreateOptions, type TeamInvitation, type TeamMemberProfile, type TeamUpdateOptions, type TeamUser, type User, stackAppInternalsSymbol };
@@ -34,6 +34,32 @@ var import_permissions = require("../../permissions/index.js");
34
34
  var import_projects = require("../../projects/index.js");
35
35
  var import_common2 = require("./common.js");
36
36
  var import_server_app_impl = require("./server-app-impl.js");
37
+ function pushedConfigSourceToApi(source) {
38
+ if (source.type === "pushed-from-github") {
39
+ return {
40
+ type: "pushed-from-github",
41
+ owner: source.owner,
42
+ repo: source.repo,
43
+ branch: source.branch,
44
+ commit_hash: source.commitHash,
45
+ config_file_path: source.configFilePath
46
+ };
47
+ }
48
+ return source;
49
+ }
50
+ function apiToPushedConfigSource(source) {
51
+ if (source.type === "pushed-from-github") {
52
+ return {
53
+ type: "pushed-from-github",
54
+ owner: source.owner,
55
+ repo: source.repo,
56
+ branch: source.branch,
57
+ commitHash: source.commit_hash,
58
+ configFilePath: source.config_file_path
59
+ };
60
+ }
61
+ return source;
62
+ }
37
63
  var _StackAdminAppImplIncomplete = class extends import_server_app_impl._StackServerAppImplIncomplete {
38
64
  constructor(options, extraOptions) {
39
65
  const resolvedOptions = (0, import_common2.resolveConstructorOptions)(options);
@@ -179,7 +205,23 @@ var _StackAdminAppImplIncomplete = class extends import_server_app_impl._StackSe
179
205
  return app._adminConfigFromCrud(await app._interface.getConfig());
180
206
  },
181
207
  async updateConfig(configOverride) {
182
- await app._interface.updateConfig({ configOverride });
208
+ await app._interface.updateConfigOverride("environment", configOverride);
209
+ await app._configOverridesCache.refresh([]);
210
+ },
211
+ async pushConfig(config, options) {
212
+ await app._interface.setConfigOverride("branch", config, pushedConfigSourceToApi(options.source));
213
+ await app._configOverridesCache.refresh([]);
214
+ },
215
+ async updatePushedConfig(config) {
216
+ await app._interface.updateConfigOverride("branch", config);
217
+ await app._configOverridesCache.refresh([]);
218
+ },
219
+ async getPushedConfigSource() {
220
+ const apiSource = await app._interface.getPushedConfigSource();
221
+ return apiToPushedConfigSource(apiSource);
222
+ },
223
+ async unlinkPushedConfigSource() {
224
+ await app._interface.unlinkPushedConfigSource();
183
225
  await app._configOverridesCache.refresh([]);
184
226
  },
185
227
  async update(update) {
@@ -430,6 +472,12 @@ var _StackAdminAppImplIncomplete = class extends import_server_app_impl._StackSe
430
472
  async createStripeWidgetAccountSession() {
431
473
  return await this._interface.createStripeWidgetAccountSession();
432
474
  }
475
+ async getPaymentMethodConfigs() {
476
+ return await this._interface.getPaymentMethodConfigs();
477
+ }
478
+ async updatePaymentMethodConfigs(configId, updates) {
479
+ await this._interface.updatePaymentMethodConfigs(configId, updates);
480
+ }
433
481
  async createItemQuantityChange(options) {
434
482
  await this._interface.updateItemQuantity(
435
483
  { itemId: options.itemId, ..."userId" in options ? { userId: options.userId } : "teamId" in options ? { teamId: options.teamId } : { customCustomerId: options.customCustomerId } },