@stackframe/stack-shared 2.8.56 → 2.8.59

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 (154) hide show
  1. package/dist/apps/apps-config.d.mts +6 -0
  2. package/dist/apps/apps-config.d.ts +6 -0
  3. package/dist/apps/apps-config.js +6 -0
  4. package/dist/apps/apps-config.js.map +1 -1
  5. package/dist/config/migrate-catalogs-to-product-lines.d.mts +12 -0
  6. package/dist/config/migrate-catalogs-to-product-lines.d.ts +12 -0
  7. package/dist/config/migrate-catalogs-to-product-lines.js +211 -0
  8. package/dist/config/migrate-catalogs-to-product-lines.js.map +1 -0
  9. package/dist/config/schema-fuzzer.test.js +20 -6
  10. package/dist/config/schema-fuzzer.test.js.map +1 -1
  11. package/dist/config/schema.d.mts +296 -224
  12. package/dist/config/schema.d.ts +296 -224
  13. package/dist/config/schema.js +46 -8
  14. package/dist/config/schema.js.map +1 -1
  15. package/dist/esm/apps/apps-config.js +6 -0
  16. package/dist/esm/apps/apps-config.js.map +1 -1
  17. package/dist/esm/config/migrate-catalogs-to-product-lines.js +186 -0
  18. package/dist/esm/config/migrate-catalogs-to-product-lines.js.map +1 -0
  19. package/dist/esm/config/schema-fuzzer.test.js +20 -6
  20. package/dist/esm/config/schema-fuzzer.test.js.map +1 -1
  21. package/dist/esm/config/schema.js +47 -9
  22. package/dist/esm/config/schema.js.map +1 -1
  23. package/dist/esm/interface/admin-interface.js +49 -1
  24. package/dist/esm/interface/admin-interface.js.map +1 -1
  25. package/dist/esm/interface/client-interface.js +124 -25
  26. package/dist/esm/interface/client-interface.js.map +1 -1
  27. package/dist/esm/interface/crud/current-user.js +5 -2
  28. package/dist/esm/interface/crud/current-user.js.map +1 -1
  29. package/dist/esm/interface/crud/email-outbox.js +204 -0
  30. package/dist/esm/interface/crud/email-outbox.js.map +1 -0
  31. package/dist/esm/interface/crud/emails.js +0 -2
  32. package/dist/esm/interface/crud/emails.js.map +1 -1
  33. package/dist/esm/interface/crud/products.js +12 -1
  34. package/dist/esm/interface/crud/products.js.map +1 -1
  35. package/dist/esm/interface/crud/projects.js +3 -1
  36. package/dist/esm/interface/crud/projects.js.map +1 -1
  37. package/dist/esm/interface/crud/users.js +9 -2
  38. package/dist/esm/interface/crud/users.js.map +1 -1
  39. package/dist/esm/interface/server-interface.js +54 -0
  40. package/dist/esm/interface/server-interface.js.map +1 -1
  41. package/dist/esm/known-errors.js +69 -1
  42. package/dist/esm/known-errors.js.map +1 -1
  43. package/dist/esm/schema-fields.js +27 -3
  44. package/dist/esm/schema-fields.js.map +1 -1
  45. package/dist/esm/sessions.js +72 -8
  46. package/dist/esm/sessions.js.map +1 -1
  47. package/dist/esm/utils/env.js +13 -2
  48. package/dist/esm/utils/env.js.map +1 -1
  49. package/dist/esm/utils/esbuild.js +50 -21
  50. package/dist/esm/utils/esbuild.js.map +1 -1
  51. package/dist/esm/utils/globals.js +12 -0
  52. package/dist/esm/utils/globals.js.map +1 -1
  53. package/dist/esm/utils/paginated-lists.js +153 -23
  54. package/dist/esm/utils/paginated-lists.js.map +1 -1
  55. package/dist/esm/utils/paginated-lists.test.js +842 -0
  56. package/dist/esm/utils/paginated-lists.test.js.map +1 -0
  57. package/dist/esm/utils/proxies.js +28 -1
  58. package/dist/esm/utils/proxies.js.map +1 -1
  59. package/dist/esm/utils/react.js +7 -3
  60. package/dist/esm/utils/react.js.map +1 -1
  61. package/dist/esm/utils/results.js.map +1 -1
  62. package/dist/index.d.mts +1 -1
  63. package/dist/index.d.ts +1 -1
  64. package/dist/interface/admin-interface.d.mts +26 -3
  65. package/dist/interface/admin-interface.d.ts +26 -3
  66. package/dist/interface/admin-interface.js +49 -1
  67. package/dist/interface/admin-interface.js.map +1 -1
  68. package/dist/interface/client-interface.d.mts +36 -0
  69. package/dist/interface/client-interface.d.ts +36 -0
  70. package/dist/interface/client-interface.js +124 -25
  71. package/dist/interface/client-interface.js.map +1 -1
  72. package/dist/interface/crud/current-user.d.mts +23 -6
  73. package/dist/interface/crud/current-user.d.ts +23 -6
  74. package/dist/interface/crud/current-user.js +5 -2
  75. package/dist/interface/crud/current-user.js.map +1 -1
  76. package/dist/interface/crud/email-outbox.d.mts +1075 -0
  77. package/dist/interface/crud/email-outbox.d.ts +1075 -0
  78. package/dist/interface/crud/email-outbox.js +241 -0
  79. package/dist/interface/crud/email-outbox.js.map +1 -0
  80. package/dist/interface/crud/emails.d.mts +0 -34
  81. package/dist/interface/crud/emails.d.ts +0 -34
  82. package/dist/interface/crud/emails.js +0 -2
  83. package/dist/interface/crud/emails.js.map +1 -1
  84. package/dist/interface/crud/products.d.mts +77 -0
  85. package/dist/interface/crud/products.d.ts +77 -0
  86. package/dist/interface/crud/products.js +12 -1
  87. package/dist/interface/crud/products.js.map +1 -1
  88. package/dist/interface/crud/project-api-keys.d.mts +1 -1
  89. package/dist/interface/crud/project-api-keys.d.ts +1 -1
  90. package/dist/interface/crud/projects.d.mts +70 -66
  91. package/dist/interface/crud/projects.d.ts +70 -66
  92. package/dist/interface/crud/projects.js +3 -1
  93. package/dist/interface/crud/projects.js.map +1 -1
  94. package/dist/interface/crud/team-member-profiles.d.mts +28 -12
  95. package/dist/interface/crud/team-member-profiles.d.ts +28 -12
  96. package/dist/interface/crud/users.d.mts +38 -6
  97. package/dist/interface/crud/users.d.ts +38 -6
  98. package/dist/interface/crud/users.js +9 -2
  99. package/dist/interface/crud/users.js.map +1 -1
  100. package/dist/interface/server-interface.d.mts +52 -0
  101. package/dist/interface/server-interface.d.ts +52 -0
  102. package/dist/interface/server-interface.js +54 -0
  103. package/dist/interface/server-interface.js.map +1 -1
  104. package/dist/interface/webhooks.d.mts +18 -2
  105. package/dist/interface/webhooks.d.ts +18 -2
  106. package/dist/known-errors.d.mts +20 -1
  107. package/dist/known-errors.d.ts +20 -1
  108. package/dist/known-errors.js +69 -1
  109. package/dist/known-errors.js.map +1 -1
  110. package/dist/schema-fields.d.mts +38 -5
  111. package/dist/schema-fields.d.ts +38 -5
  112. package/dist/schema-fields.js +33 -3
  113. package/dist/schema-fields.js.map +1 -1
  114. package/dist/sessions.d.mts +35 -4
  115. package/dist/sessions.d.ts +35 -4
  116. package/dist/sessions.js +72 -8
  117. package/dist/sessions.js.map +1 -1
  118. package/dist/utils/env.d.mts +2 -1
  119. package/dist/utils/env.d.ts +2 -1
  120. package/dist/utils/env.js +13 -1
  121. package/dist/utils/env.js.map +1 -1
  122. package/dist/utils/esbuild.js +49 -20
  123. package/dist/utils/esbuild.js.map +1 -1
  124. package/dist/utils/globals.d.mts +6 -1
  125. package/dist/utils/globals.d.ts +6 -1
  126. package/dist/utils/globals.js +13 -0
  127. package/dist/utils/globals.js.map +1 -1
  128. package/dist/utils/paginated-lists.d.mts +269 -12
  129. package/dist/utils/paginated-lists.d.ts +269 -12
  130. package/dist/utils/paginated-lists.js +153 -23
  131. package/dist/utils/paginated-lists.js.map +1 -1
  132. package/dist/utils/paginated-lists.test.d.mts +2 -0
  133. package/dist/utils/paginated-lists.test.d.ts +2 -0
  134. package/dist/utils/paginated-lists.test.js +844 -0
  135. package/dist/utils/paginated-lists.test.js.map +1 -0
  136. package/dist/utils/proxies.d.mts +8 -1
  137. package/dist/utils/proxies.d.ts +8 -1
  138. package/dist/utils/proxies.js +30 -2
  139. package/dist/utils/proxies.js.map +1 -1
  140. package/dist/utils/react.d.mts +1 -1
  141. package/dist/utils/react.d.ts +1 -1
  142. package/dist/utils/react.js +7 -3
  143. package/dist/utils/react.js.map +1 -1
  144. package/dist/utils/results.d.mts +5 -5
  145. package/dist/utils/results.d.ts +5 -5
  146. package/dist/utils/results.js.map +1 -1
  147. package/package.json +5 -4
  148. package/CHANGELOG.md +0 -1354
  149. package/dist/esm/interface/crud/config.js +0 -40
  150. package/dist/esm/interface/crud/config.js.map +0 -1
  151. package/dist/interface/crud/config.d.mts +0 -49
  152. package/dist/interface/crud/config.d.ts +0 -49
  153. package/dist/interface/crud/config.js +0 -79
  154. package/dist/interface/crud/config.js.map +0 -1
@@ -73,7 +73,28 @@ declare const dayIntervalOrNeverSchema: yup.MixedSchema<"never" | DayInterval, y
73
73
  /**
74
74
  * This schema is useful for fields where the user can specify the ID, such as price IDs. It is particularly common
75
75
  * for IDs in the config schema.
76
+ *
77
+ * Valid IDs:
78
+ * - Must contain only letters, numbers, underscores, and hyphens
79
+ * - Must not start with a hyphen
80
+ * - Maximum length of 63 characters
81
+ */
82
+ declare const USER_SPECIFIED_ID_PATTERN: RegExp;
83
+ declare const USER_SPECIFIED_ID_MAX_LENGTH = 63;
84
+ /**
85
+ * Checks if the given string is a valid user-specified ID.
86
+ */
87
+ declare function isValidUserSpecifiedId(id: string): boolean;
88
+ /**
89
+ * Gets the error message for an invalid user-specified ID.
90
+ */
91
+ declare function getUserSpecifiedIdErrorMessage(idName: `${string}Id`): string;
92
+ /**
93
+ * Sanitizes user input to create a valid user-specified ID.
94
+ * Converts to lowercase and replaces invalid characters with hyphens.
95
+ * Strips leading hyphens.
76
96
  */
97
+ declare function sanitizeUserSpecifiedId(input: string): string;
77
98
  declare const userSpecifiedIdSchema: (idName: `${string}Id`) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
78
99
  declare const moneyAmountSchema: (currency: Currency) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
79
100
  /**
@@ -172,7 +193,7 @@ declare const priceOrIncludeByDefaultSchema: yup.MixedSchema<"include-by-default
172
193
  }> | undefined, yup.AnyObject, undefined, "">;
173
194
  declare const productSchema: yup.ObjectSchema<{
174
195
  displayName: string | undefined;
175
- catalogId: string | undefined;
196
+ productLineId: string | undefined;
176
197
  isAddOnTo: false | Record<string, true> | undefined;
177
198
  customerType: "user" | "team" | "custom";
178
199
  freeTrial: DayInterval | undefined;
@@ -197,7 +218,7 @@ declare const productSchema: yup.ObjectSchema<{
197
218
  }>;
198
219
  }, yup.AnyObject, {
199
220
  displayName: undefined;
200
- catalogId: undefined;
221
+ productLineId: undefined;
201
222
  isAddOnTo: undefined;
202
223
  customerType: undefined;
203
224
  freeTrial: undefined;
@@ -211,7 +232,7 @@ declare const productClientReadOnlyMetadataSchema: yup.MixedSchema<{} | null, yu
211
232
  declare const productServerMetadataSchema: yup.MixedSchema<{} | null, yup.AnyObject, undefined, "">;
212
233
  declare const productSchemaWithMetadata: yup.ObjectSchema<{
213
234
  displayName: string | undefined;
214
- catalogId: string | undefined;
235
+ productLineId: string | undefined;
215
236
  isAddOnTo: false | Record<string, true> | undefined;
216
237
  customerType: "user" | "team" | "custom";
217
238
  freeTrial: DayInterval | undefined;
@@ -240,7 +261,7 @@ declare const productSchemaWithMetadata: yup.ObjectSchema<{
240
261
  serverMetadata: {} | null | undefined;
241
262
  }, yup.AnyObject, {
242
263
  displayName: undefined;
243
- catalogId: undefined;
264
+ productLineId: undefined;
244
265
  isAddOnTo: undefined;
245
266
  customerType: undefined;
246
267
  freeTrial: undefined;
@@ -322,9 +343,12 @@ declare const userHasPasswordSchema: yup.BooleanSchema<boolean | undefined, yup.
322
343
  declare const userPasswordMutationSchema: yup.StringSchema<string | null | undefined, yup.AnyObject, undefined, "">;
323
344
  declare const userPasswordHashMutationSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
324
345
  declare const userTotpSecretMutationSchema: yup.StringSchema<string | null | undefined, yup.AnyObject, undefined, "">;
346
+ declare const restrictedReasonTypes: readonly ["anonymous", "email_not_verified"];
347
+ type RestrictedReasonType = typeof restrictedReasonTypes[number];
325
348
  declare const accessTokenPayloadSchema: yup.ObjectSchema<{
326
349
  sub: string;
327
350
  exp: number | undefined;
351
+ iat: number;
328
352
  iss: string;
329
353
  aud: string;
330
354
  project_id: string;
@@ -336,9 +360,14 @@ declare const accessTokenPayloadSchema: yup.ObjectSchema<{
336
360
  email_verified: boolean;
337
361
  selected_team_id: string | null;
338
362
  is_anonymous: boolean;
363
+ is_restricted: boolean;
364
+ restricted_reason: {
365
+ type: "anonymous" | "email_not_verified";
366
+ } | null;
339
367
  }, yup.AnyObject, {
340
368
  sub: undefined;
341
369
  exp: undefined;
370
+ iat: undefined;
342
371
  iss: undefined;
343
372
  aud: undefined;
344
373
  project_id: undefined;
@@ -350,6 +379,10 @@ declare const accessTokenPayloadSchema: yup.ObjectSchema<{
350
379
  email_verified: undefined;
351
380
  selected_team_id: undefined;
352
381
  is_anonymous: undefined;
382
+ is_restricted: undefined;
383
+ restricted_reason: {
384
+ type: undefined;
385
+ };
353
386
  }, "">;
354
387
  declare const signInEmailSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
355
388
  declare const emailOtpSignInCallbackUrlSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
@@ -402,4 +435,4 @@ declare const neonAuthorizationHeaderSchema: yup.StringSchema<string | undefined
402
435
  declare function yupDefinedWhen<S extends yup.AnyObject>(schema: S, triggers: Record<string, any>): S;
403
436
  declare function yupDefinedAndNonEmptyWhen<S extends yup.StringSchema>(schema: S, triggers: Record<string, any>): S;
404
437
 
405
- export { ReplaceFieldWithOwnUserId, StackAdaptSentinel, accessTokenPayloadSchema, accessTokenResponseSchema, adaptSchema, adminAuthTypeSchema, base64Schema, basicAuthorizationHeaderSchema, clientOrHigherAuthTypeSchema, contactChannelIdSchema, contactChannelIsPrimarySchema, contactChannelIsVerifiedSchema, contactChannelTypeSchema, contactChannelUsedForAuthSchema, contactChannelValueSchema, containedPermissionIdsSchema, customPermissionDefinitionIdSchema, customerTypeSchema, dayIntervalOrNeverSchema, dayIntervalSchema, emailHostSchema, emailOtpSignInCallbackUrlSchema, emailPasswordSchema, emailPortSchema, emailSchema, emailSenderEmailSchema, emailSenderNameSchema, emailTemplateListSchema, emailThemeListSchema, emailThemeSchema, emailTypeSchema, emailUsernameSchema, emailVerificationCallbackUrlSchema, ensureObjectSchema, handlerPathSchema, inlineProductSchema, intervalOrNeverSchema, intervalSchema, jsonSchema, jsonStringOrEmptySchema, jsonStringSchema, moneyAmountSchema, neonAuthorizationHeaderSchema, oauthAccountMergeStrategySchema, oauthClientIdSchema, oauthClientSecretSchema, oauthEnabledSchema, oauthFacebookConfigIdSchema, oauthIdSchema, oauthMicrosoftTenantIdSchema, oauthProviderAccountIdSchema, oauthProviderAllowConnectedAccountsSchema, oauthProviderAllowSignInSchema, oauthProviderEmailSchema, oauthProviderIdSchema, oauthProviderProviderConfigIdSchema, oauthProviderTypeSchema, oauthTypeSchema, passwordSchema, permissionDefinitionIdSchema, priceOrIncludeByDefaultSchema, primaryEmailAuthEnabledSchema, primaryEmailSchema, primaryEmailVerifiedSchema, productClientMetadataSchema, productClientReadOnlyMetadataSchema, productPriceSchema, productSchema, productSchemaWithMetadata, productServerMetadataSchema, profileImageUrlSchema, projectAllowLocalhostSchema, projectBranchIdSchema, projectClientTeamCreationEnabledSchema, projectClientUserDeletionEnabledSchema, projectConfigIdSchema, projectCreateTeamOnSignUpSchema, projectCreatedAtMillisSchema, projectCredentialEnabledSchema, projectDescriptionSchema, projectDisplayNameSchema, projectIdSchema, projectIsProductionModeSchema, projectLogoDarkModeUrlSchema, projectLogoFullDarkModeUrlSchema, projectLogoFullUrlSchema, projectLogoUrlSchema, projectMagicLinkEnabledSchema, projectPasskeyEnabledSchema, projectSignUpEnabledSchema, refreshTokenResponseSchema, selectedTeamIdSchema, serverOrHigherAuthTypeSchema, signInEmailSchema, signInResponseSchema, signedUpAtMillisSchema, strictEmailSchema, teamClientMetadataSchema, teamClientReadOnlyMetadataSchema, teamCreatedAtMillisSchema, teamCreatorUserIdSchema, teamDisplayNameSchema, teamIdSchema, teamInvitationCallbackUrlSchema, teamInvitationEmailSchema, teamMemberDisplayNameSchema, teamMemberProfileImageUrlSchema, teamPermissionDescriptionSchema, teamProfileImageUrlSchema, teamServerMetadataSchema, teamSystemPermissions, templateThemeIdSchema, urlSchema, userClientMetadataSchema, userClientReadOnlyMetadataSchema, userDisplayNameSchema, userHasPasswordSchema, userIdOrMeSchema, userIdSchema, userLastActiveAtMillisSchema, userOAuthProviderSchema, userOtpAuthEnabledMutationSchema, userOtpAuthEnabledSchema, userPasskeyAuthEnabledSchema, userPasswordHashMutationSchema, userPasswordMutationSchema, userServerMetadataSchema, userSpecifiedIdSchema, userTotpSecretMutationSchema, wildcardProtocolAndDomainSchema, wildcardUrlSchema, yupArray, yupBoolean, yupDate, yupDefinedAndNonEmptyWhen, yupDefinedWhen, yupMixed, yupNever, yupNumber, yupObject, yupObjectWithAutoDefault, yupRecord, yupString, yupTuple, yupUnion, yupValidate };
438
+ export { ReplaceFieldWithOwnUserId, type RestrictedReasonType, StackAdaptSentinel, USER_SPECIFIED_ID_MAX_LENGTH, USER_SPECIFIED_ID_PATTERN, accessTokenPayloadSchema, accessTokenResponseSchema, adaptSchema, adminAuthTypeSchema, base64Schema, basicAuthorizationHeaderSchema, clientOrHigherAuthTypeSchema, contactChannelIdSchema, contactChannelIsPrimarySchema, contactChannelIsVerifiedSchema, contactChannelTypeSchema, contactChannelUsedForAuthSchema, contactChannelValueSchema, containedPermissionIdsSchema, customPermissionDefinitionIdSchema, customerTypeSchema, dayIntervalOrNeverSchema, dayIntervalSchema, emailHostSchema, emailOtpSignInCallbackUrlSchema, emailPasswordSchema, emailPortSchema, emailSchema, emailSenderEmailSchema, emailSenderNameSchema, emailTemplateListSchema, emailThemeListSchema, emailThemeSchema, emailTypeSchema, emailUsernameSchema, emailVerificationCallbackUrlSchema, ensureObjectSchema, getUserSpecifiedIdErrorMessage, handlerPathSchema, inlineProductSchema, intervalOrNeverSchema, intervalSchema, isValidUserSpecifiedId, jsonSchema, jsonStringOrEmptySchema, jsonStringSchema, moneyAmountSchema, neonAuthorizationHeaderSchema, oauthAccountMergeStrategySchema, oauthClientIdSchema, oauthClientSecretSchema, oauthEnabledSchema, oauthFacebookConfigIdSchema, oauthIdSchema, oauthMicrosoftTenantIdSchema, oauthProviderAccountIdSchema, oauthProviderAllowConnectedAccountsSchema, oauthProviderAllowSignInSchema, oauthProviderEmailSchema, oauthProviderIdSchema, oauthProviderProviderConfigIdSchema, oauthProviderTypeSchema, oauthTypeSchema, passwordSchema, permissionDefinitionIdSchema, priceOrIncludeByDefaultSchema, primaryEmailAuthEnabledSchema, primaryEmailSchema, primaryEmailVerifiedSchema, productClientMetadataSchema, productClientReadOnlyMetadataSchema, productPriceSchema, productSchema, productSchemaWithMetadata, productServerMetadataSchema, profileImageUrlSchema, projectAllowLocalhostSchema, projectBranchIdSchema, projectClientTeamCreationEnabledSchema, projectClientUserDeletionEnabledSchema, projectConfigIdSchema, projectCreateTeamOnSignUpSchema, projectCreatedAtMillisSchema, projectCredentialEnabledSchema, projectDescriptionSchema, projectDisplayNameSchema, projectIdSchema, projectIsProductionModeSchema, projectLogoDarkModeUrlSchema, projectLogoFullDarkModeUrlSchema, projectLogoFullUrlSchema, projectLogoUrlSchema, projectMagicLinkEnabledSchema, projectPasskeyEnabledSchema, projectSignUpEnabledSchema, refreshTokenResponseSchema, restrictedReasonTypes, sanitizeUserSpecifiedId, selectedTeamIdSchema, serverOrHigherAuthTypeSchema, signInEmailSchema, signInResponseSchema, signedUpAtMillisSchema, strictEmailSchema, teamClientMetadataSchema, teamClientReadOnlyMetadataSchema, teamCreatedAtMillisSchema, teamCreatorUserIdSchema, teamDisplayNameSchema, teamIdSchema, teamInvitationCallbackUrlSchema, teamInvitationEmailSchema, teamMemberDisplayNameSchema, teamMemberProfileImageUrlSchema, teamPermissionDescriptionSchema, teamProfileImageUrlSchema, teamServerMetadataSchema, teamSystemPermissions, templateThemeIdSchema, urlSchema, userClientMetadataSchema, userClientReadOnlyMetadataSchema, userDisplayNameSchema, userHasPasswordSchema, userIdOrMeSchema, userIdSchema, userLastActiveAtMillisSchema, userOAuthProviderSchema, userOtpAuthEnabledMutationSchema, userOtpAuthEnabledSchema, userPasskeyAuthEnabledSchema, userPasswordHashMutationSchema, userPasswordMutationSchema, userServerMetadataSchema, userSpecifiedIdSchema, userTotpSecretMutationSchema, wildcardProtocolAndDomainSchema, wildcardUrlSchema, yupArray, yupBoolean, yupDate, yupDefinedAndNonEmptyWhen, yupDefinedWhen, yupMixed, yupNever, yupNumber, yupObject, yupObjectWithAutoDefault, yupRecord, yupString, yupTuple, yupUnion, yupValidate };
@@ -73,7 +73,28 @@ declare const dayIntervalOrNeverSchema: yup.MixedSchema<"never" | DayInterval, y
73
73
  /**
74
74
  * This schema is useful for fields where the user can specify the ID, such as price IDs. It is particularly common
75
75
  * for IDs in the config schema.
76
+ *
77
+ * Valid IDs:
78
+ * - Must contain only letters, numbers, underscores, and hyphens
79
+ * - Must not start with a hyphen
80
+ * - Maximum length of 63 characters
81
+ */
82
+ declare const USER_SPECIFIED_ID_PATTERN: RegExp;
83
+ declare const USER_SPECIFIED_ID_MAX_LENGTH = 63;
84
+ /**
85
+ * Checks if the given string is a valid user-specified ID.
86
+ */
87
+ declare function isValidUserSpecifiedId(id: string): boolean;
88
+ /**
89
+ * Gets the error message for an invalid user-specified ID.
90
+ */
91
+ declare function getUserSpecifiedIdErrorMessage(idName: `${string}Id`): string;
92
+ /**
93
+ * Sanitizes user input to create a valid user-specified ID.
94
+ * Converts to lowercase and replaces invalid characters with hyphens.
95
+ * Strips leading hyphens.
76
96
  */
97
+ declare function sanitizeUserSpecifiedId(input: string): string;
77
98
  declare const userSpecifiedIdSchema: (idName: `${string}Id`) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
78
99
  declare const moneyAmountSchema: (currency: Currency) => yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
79
100
  /**
@@ -172,7 +193,7 @@ declare const priceOrIncludeByDefaultSchema: yup.MixedSchema<"include-by-default
172
193
  }> | undefined, yup.AnyObject, undefined, "">;
173
194
  declare const productSchema: yup.ObjectSchema<{
174
195
  displayName: string | undefined;
175
- catalogId: string | undefined;
196
+ productLineId: string | undefined;
176
197
  isAddOnTo: false | Record<string, true> | undefined;
177
198
  customerType: "user" | "team" | "custom";
178
199
  freeTrial: DayInterval | undefined;
@@ -197,7 +218,7 @@ declare const productSchema: yup.ObjectSchema<{
197
218
  }>;
198
219
  }, yup.AnyObject, {
199
220
  displayName: undefined;
200
- catalogId: undefined;
221
+ productLineId: undefined;
201
222
  isAddOnTo: undefined;
202
223
  customerType: undefined;
203
224
  freeTrial: undefined;
@@ -211,7 +232,7 @@ declare const productClientReadOnlyMetadataSchema: yup.MixedSchema<{} | null, yu
211
232
  declare const productServerMetadataSchema: yup.MixedSchema<{} | null, yup.AnyObject, undefined, "">;
212
233
  declare const productSchemaWithMetadata: yup.ObjectSchema<{
213
234
  displayName: string | undefined;
214
- catalogId: string | undefined;
235
+ productLineId: string | undefined;
215
236
  isAddOnTo: false | Record<string, true> | undefined;
216
237
  customerType: "user" | "team" | "custom";
217
238
  freeTrial: DayInterval | undefined;
@@ -240,7 +261,7 @@ declare const productSchemaWithMetadata: yup.ObjectSchema<{
240
261
  serverMetadata: {} | null | undefined;
241
262
  }, yup.AnyObject, {
242
263
  displayName: undefined;
243
- catalogId: undefined;
264
+ productLineId: undefined;
244
265
  isAddOnTo: undefined;
245
266
  customerType: undefined;
246
267
  freeTrial: undefined;
@@ -322,9 +343,12 @@ declare const userHasPasswordSchema: yup.BooleanSchema<boolean | undefined, yup.
322
343
  declare const userPasswordMutationSchema: yup.StringSchema<string | null | undefined, yup.AnyObject, undefined, "">;
323
344
  declare const userPasswordHashMutationSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
324
345
  declare const userTotpSecretMutationSchema: yup.StringSchema<string | null | undefined, yup.AnyObject, undefined, "">;
346
+ declare const restrictedReasonTypes: readonly ["anonymous", "email_not_verified"];
347
+ type RestrictedReasonType = typeof restrictedReasonTypes[number];
325
348
  declare const accessTokenPayloadSchema: yup.ObjectSchema<{
326
349
  sub: string;
327
350
  exp: number | undefined;
351
+ iat: number;
328
352
  iss: string;
329
353
  aud: string;
330
354
  project_id: string;
@@ -336,9 +360,14 @@ declare const accessTokenPayloadSchema: yup.ObjectSchema<{
336
360
  email_verified: boolean;
337
361
  selected_team_id: string | null;
338
362
  is_anonymous: boolean;
363
+ is_restricted: boolean;
364
+ restricted_reason: {
365
+ type: "anonymous" | "email_not_verified";
366
+ } | null;
339
367
  }, yup.AnyObject, {
340
368
  sub: undefined;
341
369
  exp: undefined;
370
+ iat: undefined;
342
371
  iss: undefined;
343
372
  aud: undefined;
344
373
  project_id: undefined;
@@ -350,6 +379,10 @@ declare const accessTokenPayloadSchema: yup.ObjectSchema<{
350
379
  email_verified: undefined;
351
380
  selected_team_id: undefined;
352
381
  is_anonymous: undefined;
382
+ is_restricted: undefined;
383
+ restricted_reason: {
384
+ type: undefined;
385
+ };
353
386
  }, "">;
354
387
  declare const signInEmailSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
355
388
  declare const emailOtpSignInCallbackUrlSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
@@ -402,4 +435,4 @@ declare const neonAuthorizationHeaderSchema: yup.StringSchema<string | undefined
402
435
  declare function yupDefinedWhen<S extends yup.AnyObject>(schema: S, triggers: Record<string, any>): S;
403
436
  declare function yupDefinedAndNonEmptyWhen<S extends yup.StringSchema>(schema: S, triggers: Record<string, any>): S;
404
437
 
405
- export { ReplaceFieldWithOwnUserId, StackAdaptSentinel, accessTokenPayloadSchema, accessTokenResponseSchema, adaptSchema, adminAuthTypeSchema, base64Schema, basicAuthorizationHeaderSchema, clientOrHigherAuthTypeSchema, contactChannelIdSchema, contactChannelIsPrimarySchema, contactChannelIsVerifiedSchema, contactChannelTypeSchema, contactChannelUsedForAuthSchema, contactChannelValueSchema, containedPermissionIdsSchema, customPermissionDefinitionIdSchema, customerTypeSchema, dayIntervalOrNeverSchema, dayIntervalSchema, emailHostSchema, emailOtpSignInCallbackUrlSchema, emailPasswordSchema, emailPortSchema, emailSchema, emailSenderEmailSchema, emailSenderNameSchema, emailTemplateListSchema, emailThemeListSchema, emailThemeSchema, emailTypeSchema, emailUsernameSchema, emailVerificationCallbackUrlSchema, ensureObjectSchema, handlerPathSchema, inlineProductSchema, intervalOrNeverSchema, intervalSchema, jsonSchema, jsonStringOrEmptySchema, jsonStringSchema, moneyAmountSchema, neonAuthorizationHeaderSchema, oauthAccountMergeStrategySchema, oauthClientIdSchema, oauthClientSecretSchema, oauthEnabledSchema, oauthFacebookConfigIdSchema, oauthIdSchema, oauthMicrosoftTenantIdSchema, oauthProviderAccountIdSchema, oauthProviderAllowConnectedAccountsSchema, oauthProviderAllowSignInSchema, oauthProviderEmailSchema, oauthProviderIdSchema, oauthProviderProviderConfigIdSchema, oauthProviderTypeSchema, oauthTypeSchema, passwordSchema, permissionDefinitionIdSchema, priceOrIncludeByDefaultSchema, primaryEmailAuthEnabledSchema, primaryEmailSchema, primaryEmailVerifiedSchema, productClientMetadataSchema, productClientReadOnlyMetadataSchema, productPriceSchema, productSchema, productSchemaWithMetadata, productServerMetadataSchema, profileImageUrlSchema, projectAllowLocalhostSchema, projectBranchIdSchema, projectClientTeamCreationEnabledSchema, projectClientUserDeletionEnabledSchema, projectConfigIdSchema, projectCreateTeamOnSignUpSchema, projectCreatedAtMillisSchema, projectCredentialEnabledSchema, projectDescriptionSchema, projectDisplayNameSchema, projectIdSchema, projectIsProductionModeSchema, projectLogoDarkModeUrlSchema, projectLogoFullDarkModeUrlSchema, projectLogoFullUrlSchema, projectLogoUrlSchema, projectMagicLinkEnabledSchema, projectPasskeyEnabledSchema, projectSignUpEnabledSchema, refreshTokenResponseSchema, selectedTeamIdSchema, serverOrHigherAuthTypeSchema, signInEmailSchema, signInResponseSchema, signedUpAtMillisSchema, strictEmailSchema, teamClientMetadataSchema, teamClientReadOnlyMetadataSchema, teamCreatedAtMillisSchema, teamCreatorUserIdSchema, teamDisplayNameSchema, teamIdSchema, teamInvitationCallbackUrlSchema, teamInvitationEmailSchema, teamMemberDisplayNameSchema, teamMemberProfileImageUrlSchema, teamPermissionDescriptionSchema, teamProfileImageUrlSchema, teamServerMetadataSchema, teamSystemPermissions, templateThemeIdSchema, urlSchema, userClientMetadataSchema, userClientReadOnlyMetadataSchema, userDisplayNameSchema, userHasPasswordSchema, userIdOrMeSchema, userIdSchema, userLastActiveAtMillisSchema, userOAuthProviderSchema, userOtpAuthEnabledMutationSchema, userOtpAuthEnabledSchema, userPasskeyAuthEnabledSchema, userPasswordHashMutationSchema, userPasswordMutationSchema, userServerMetadataSchema, userSpecifiedIdSchema, userTotpSecretMutationSchema, wildcardProtocolAndDomainSchema, wildcardUrlSchema, yupArray, yupBoolean, yupDate, yupDefinedAndNonEmptyWhen, yupDefinedWhen, yupMixed, yupNever, yupNumber, yupObject, yupObjectWithAutoDefault, yupRecord, yupString, yupTuple, yupUnion, yupValidate };
438
+ export { ReplaceFieldWithOwnUserId, type RestrictedReasonType, StackAdaptSentinel, USER_SPECIFIED_ID_MAX_LENGTH, USER_SPECIFIED_ID_PATTERN, accessTokenPayloadSchema, accessTokenResponseSchema, adaptSchema, adminAuthTypeSchema, base64Schema, basicAuthorizationHeaderSchema, clientOrHigherAuthTypeSchema, contactChannelIdSchema, contactChannelIsPrimarySchema, contactChannelIsVerifiedSchema, contactChannelTypeSchema, contactChannelUsedForAuthSchema, contactChannelValueSchema, containedPermissionIdsSchema, customPermissionDefinitionIdSchema, customerTypeSchema, dayIntervalOrNeverSchema, dayIntervalSchema, emailHostSchema, emailOtpSignInCallbackUrlSchema, emailPasswordSchema, emailPortSchema, emailSchema, emailSenderEmailSchema, emailSenderNameSchema, emailTemplateListSchema, emailThemeListSchema, emailThemeSchema, emailTypeSchema, emailUsernameSchema, emailVerificationCallbackUrlSchema, ensureObjectSchema, getUserSpecifiedIdErrorMessage, handlerPathSchema, inlineProductSchema, intervalOrNeverSchema, intervalSchema, isValidUserSpecifiedId, jsonSchema, jsonStringOrEmptySchema, jsonStringSchema, moneyAmountSchema, neonAuthorizationHeaderSchema, oauthAccountMergeStrategySchema, oauthClientIdSchema, oauthClientSecretSchema, oauthEnabledSchema, oauthFacebookConfigIdSchema, oauthIdSchema, oauthMicrosoftTenantIdSchema, oauthProviderAccountIdSchema, oauthProviderAllowConnectedAccountsSchema, oauthProviderAllowSignInSchema, oauthProviderEmailSchema, oauthProviderIdSchema, oauthProviderProviderConfigIdSchema, oauthProviderTypeSchema, oauthTypeSchema, passwordSchema, permissionDefinitionIdSchema, priceOrIncludeByDefaultSchema, primaryEmailAuthEnabledSchema, primaryEmailSchema, primaryEmailVerifiedSchema, productClientMetadataSchema, productClientReadOnlyMetadataSchema, productPriceSchema, productSchema, productSchemaWithMetadata, productServerMetadataSchema, profileImageUrlSchema, projectAllowLocalhostSchema, projectBranchIdSchema, projectClientTeamCreationEnabledSchema, projectClientUserDeletionEnabledSchema, projectConfigIdSchema, projectCreateTeamOnSignUpSchema, projectCreatedAtMillisSchema, projectCredentialEnabledSchema, projectDescriptionSchema, projectDisplayNameSchema, projectIdSchema, projectIsProductionModeSchema, projectLogoDarkModeUrlSchema, projectLogoFullDarkModeUrlSchema, projectLogoFullUrlSchema, projectLogoUrlSchema, projectMagicLinkEnabledSchema, projectPasskeyEnabledSchema, projectSignUpEnabledSchema, refreshTokenResponseSchema, restrictedReasonTypes, sanitizeUserSpecifiedId, selectedTeamIdSchema, serverOrHigherAuthTypeSchema, signInEmailSchema, signInResponseSchema, signedUpAtMillisSchema, strictEmailSchema, teamClientMetadataSchema, teamClientReadOnlyMetadataSchema, teamCreatedAtMillisSchema, teamCreatorUserIdSchema, teamDisplayNameSchema, teamIdSchema, teamInvitationCallbackUrlSchema, teamInvitationEmailSchema, teamMemberDisplayNameSchema, teamMemberProfileImageUrlSchema, teamPermissionDescriptionSchema, teamProfileImageUrlSchema, teamServerMetadataSchema, teamSystemPermissions, templateThemeIdSchema, urlSchema, userClientMetadataSchema, userClientReadOnlyMetadataSchema, userDisplayNameSchema, userHasPasswordSchema, userIdOrMeSchema, userIdSchema, userLastActiveAtMillisSchema, userOAuthProviderSchema, userOtpAuthEnabledMutationSchema, userOtpAuthEnabledSchema, userPasskeyAuthEnabledSchema, userPasswordHashMutationSchema, userPasswordMutationSchema, userServerMetadataSchema, userSpecifiedIdSchema, userTotpSecretMutationSchema, wildcardProtocolAndDomainSchema, wildcardUrlSchema, yupArray, yupBoolean, yupDate, yupDefinedAndNonEmptyWhen, yupDefinedWhen, yupMixed, yupNever, yupNumber, yupObject, yupObjectWithAutoDefault, yupRecord, yupString, yupTuple, yupUnion, yupValidate };
@@ -31,6 +31,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var schema_fields_exports = {};
32
32
  __export(schema_fields_exports, {
33
33
  ReplaceFieldWithOwnUserId: () => ReplaceFieldWithOwnUserId,
34
+ USER_SPECIFIED_ID_MAX_LENGTH: () => USER_SPECIFIED_ID_MAX_LENGTH,
35
+ USER_SPECIFIED_ID_PATTERN: () => USER_SPECIFIED_ID_PATTERN,
34
36
  accessTokenPayloadSchema: () => accessTokenPayloadSchema,
35
37
  accessTokenResponseSchema: () => accessTokenResponseSchema,
36
38
  adaptSchema: () => adaptSchema,
@@ -63,10 +65,12 @@ __export(schema_fields_exports, {
63
65
  emailUsernameSchema: () => emailUsernameSchema,
64
66
  emailVerificationCallbackUrlSchema: () => emailVerificationCallbackUrlSchema,
65
67
  ensureObjectSchema: () => ensureObjectSchema,
68
+ getUserSpecifiedIdErrorMessage: () => getUserSpecifiedIdErrorMessage,
66
69
  handlerPathSchema: () => handlerPathSchema,
67
70
  inlineProductSchema: () => inlineProductSchema,
68
71
  intervalOrNeverSchema: () => intervalOrNeverSchema,
69
72
  intervalSchema: () => intervalSchema,
73
+ isValidUserSpecifiedId: () => isValidUserSpecifiedId,
70
74
  jsonSchema: () => jsonSchema,
71
75
  jsonStringOrEmptySchema: () => jsonStringOrEmptySchema,
72
76
  jsonStringSchema: () => jsonStringSchema,
@@ -120,6 +124,8 @@ __export(schema_fields_exports, {
120
124
  projectPasskeyEnabledSchema: () => projectPasskeyEnabledSchema,
121
125
  projectSignUpEnabledSchema: () => projectSignUpEnabledSchema,
122
126
  refreshTokenResponseSchema: () => refreshTokenResponseSchema,
127
+ restrictedReasonTypes: () => restrictedReasonTypes,
128
+ sanitizeUserSpecifiedId: () => sanitizeUserSpecifiedId,
123
129
  selectedTeamIdSchema: () => selectedTeamIdSchema,
124
130
  serverOrHigherAuthTypeSchema: () => serverOrHigherAuthTypeSchema,
125
131
  signInEmailSchema: () => signInEmailSchema,
@@ -478,7 +484,19 @@ var intervalSchema = yupTuple([yupNumber().min(0).integer().defined(), yupString
478
484
  var dayIntervalSchema = yupTuple([yupNumber().min(0).integer().defined(), yupString().oneOf(["day", "week", "month", "year"]).defined()]);
479
485
  var intervalOrNeverSchema = yupUnion(intervalSchema.defined(), yupString().oneOf(["never"]).defined());
480
486
  var dayIntervalOrNeverSchema = yupUnion(dayIntervalSchema.defined(), yupString().oneOf(["never"]).defined());
481
- var userSpecifiedIdSchema = (idName) => yupString().max(63).matches(/^[a-zA-Z0-9_][a-zA-Z0-9_-]*$/, `${idName} must contain only letters, numbers, underscores, and hyphens, and not start with a hyphen`);
487
+ var USER_SPECIFIED_ID_PATTERN = /^[a-zA-Z0-9_][a-zA-Z0-9_-]*$/;
488
+ var USER_SPECIFIED_ID_MAX_LENGTH = 63;
489
+ function isValidUserSpecifiedId(id) {
490
+ return id.length > 0 && id.length <= USER_SPECIFIED_ID_MAX_LENGTH && USER_SPECIFIED_ID_PATTERN.test(id);
491
+ }
492
+ function getUserSpecifiedIdErrorMessage(idName) {
493
+ return `${idName} must contain only letters, numbers, underscores, and hyphens, and not start with a hyphen`;
494
+ }
495
+ function sanitizeUserSpecifiedId(input) {
496
+ const sanitized = input.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9_-]/g, "");
497
+ return sanitized.replace(/^-+/, "");
498
+ }
499
+ var userSpecifiedIdSchema = (idName) => yupString().max(USER_SPECIFIED_ID_MAX_LENGTH).matches(USER_SPECIFIED_ID_PATTERN, getUserSpecifiedIdErrorMessage(idName));
482
500
  var moneyAmountSchema = (currency) => yupString().test("money-amount", "Invalid money amount", (value, context) => {
483
501
  if (value == null) return true;
484
502
  const regex = /^([0-9]+)(\.([0-9]+))?$/;
@@ -575,7 +593,7 @@ var priceOrIncludeByDefaultSchema = yupUnion(
575
593
  );
576
594
  var productSchema = yupObject({
577
595
  displayName: yupString(),
578
- catalogId: userSpecifiedIdSchema("catalogId").optional().meta({ openapiField: { description: "The ID of the catalog this product belongs to. Within a catalog, all products are mutually exclusive unless they are an add-on to another product in the catalog.", exampleValue: "catalog-id" } }),
596
+ productLineId: userSpecifiedIdSchema("productLineId").optional().meta({ openapiField: { description: "The ID of the product line this product belongs to. Within a product line, all products are mutually exclusive unless they are an add-on to another product in the product line.", exampleValue: "product-line-id" } }),
579
597
  isAddOnTo: yupUnion(
580
598
  yupBoolean().isFalse(),
581
599
  yupRecord(
@@ -672,9 +690,11 @@ var userHasPasswordSchema = yupBoolean().meta({ openapiField: { hidden: true, de
672
690
  var userPasswordMutationSchema = passwordSchema.nullable().meta({ openapiField: { description: "Sets the user's password. Doing so revokes all current sessions.", exampleValue: "my-new-password" } }).max(70);
673
691
  var userPasswordHashMutationSchema = yupString().nonEmpty().meta({ openapiField: { description: "If `password` is not given, sets the user's password hash to the given string in Modular Crypt Format (ex.: `$2a$10$VIhIOofSMqGdGlL4wzE//e.77dAQGqNtF/1dT7bqCrVtQuInWy2qi`). Doing so revokes all current sessions." } });
674
692
  var userTotpSecretMutationSchema = base64Schema.nullable().meta({ openapiField: { description: "Enables 2FA and sets a TOTP secret for the user. Set to null to disable 2FA.", exampleValue: "dG90cC1zZWNyZXQ=" } });
693
+ var restrictedReasonTypes = ["anonymous", "email_not_verified"];
675
694
  var accessTokenPayloadSchema = yupObject({
676
695
  sub: yupString().defined(),
677
696
  exp: yupNumber().optional(),
697
+ iat: yupNumber().defined(),
678
698
  iss: yupString().defined(),
679
699
  aud: yupString().defined(),
680
700
  project_id: yupString().defined(),
@@ -685,7 +705,11 @@ var accessTokenPayloadSchema = yupObject({
685
705
  email: yupString().defined().nullable(),
686
706
  email_verified: yupBoolean().defined(),
687
707
  selected_team_id: yupString().defined().nullable(),
688
- is_anonymous: yupBoolean().defined()
708
+ is_anonymous: yupBoolean().defined(),
709
+ is_restricted: yupBoolean().defined(),
710
+ restricted_reason: yupObject({
711
+ type: yupString().oneOf(restrictedReasonTypes).defined()
712
+ }).defined().nullable()
689
713
  });
690
714
  var signInEmailSchema = strictEmailSchema(void 0).meta({ openapiField: { description: "The email to sign in with.", exampleValue: "johndoe@example.com" } });
691
715
  var emailOtpSignInCallbackUrlSchema = urlSchema.meta({ openapiField: { description: "The base callback URL to construct the magic link from. A query parameter `code` with the verification code will be appended to it. The page should then make a request to the `/auth/otp/sign-in` endpoint.", exampleValue: "https://example.com/handler/magic-link-callback" } });
@@ -775,6 +799,8 @@ function yupDefinedAndNonEmptyWhen(schema, triggers) {
775
799
  // Annotate the CommonJS export names for ESM import in node:
776
800
  0 && (module.exports = {
777
801
  ReplaceFieldWithOwnUserId,
802
+ USER_SPECIFIED_ID_MAX_LENGTH,
803
+ USER_SPECIFIED_ID_PATTERN,
778
804
  accessTokenPayloadSchema,
779
805
  accessTokenResponseSchema,
780
806
  adaptSchema,
@@ -807,10 +833,12 @@ function yupDefinedAndNonEmptyWhen(schema, triggers) {
807
833
  emailUsernameSchema,
808
834
  emailVerificationCallbackUrlSchema,
809
835
  ensureObjectSchema,
836
+ getUserSpecifiedIdErrorMessage,
810
837
  handlerPathSchema,
811
838
  inlineProductSchema,
812
839
  intervalOrNeverSchema,
813
840
  intervalSchema,
841
+ isValidUserSpecifiedId,
814
842
  jsonSchema,
815
843
  jsonStringOrEmptySchema,
816
844
  jsonStringSchema,
@@ -864,6 +892,8 @@ function yupDefinedAndNonEmptyWhen(schema, triggers) {
864
892
  projectPasskeyEnabledSchema,
865
893
  projectSignUpEnabledSchema,
866
894
  refreshTokenResponseSchema,
895
+ restrictedReasonTypes,
896
+ sanitizeUserSpecifiedId,
867
897
  selectedTeamIdSchema,
868
898
  serverOrHigherAuthTypeSchema,
869
899
  signInEmailSchema,