@stackframe/stack-shared 2.8.28 → 2.8.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/config/schema.d.mts +391 -15
- package/dist/config/schema.d.ts +391 -15
- package/dist/config/schema.js +70 -2
- package/dist/config/schema.js.map +1 -1
- package/dist/esm/config/schema.js +70 -3
- package/dist/esm/config/schema.js.map +1 -1
- package/dist/esm/interface/admin-interface.js +43 -0
- package/dist/esm/interface/admin-interface.js.map +1 -1
- package/dist/esm/interface/crud/projects.js +4 -0
- package/dist/esm/interface/crud/projects.js.map +1 -1
- package/dist/esm/known-errors.js +73 -1
- package/dist/esm/known-errors.js.map +1 -1
- package/dist/esm/schema-fields.js +67 -4
- package/dist/esm/schema-fields.js.map +1 -1
- package/dist/esm/utils/featurebase.js +176 -0
- package/dist/esm/utils/featurebase.js.map +1 -0
- package/dist/esm/utils/html.js +6 -1
- package/dist/esm/utils/html.js.map +1 -1
- package/dist/interface/admin-interface.d.mts +10 -0
- package/dist/interface/admin-interface.d.ts +10 -0
- package/dist/interface/admin-interface.js +43 -0
- package/dist/interface/admin-interface.js.map +1 -1
- package/dist/interface/crud/project-api-keys.d.mts +4 -4
- package/dist/interface/crud/project-api-keys.d.ts +4 -4
- package/dist/interface/crud/projects.d.mts +35 -7
- package/dist/interface/crud/projects.d.ts +35 -7
- package/dist/interface/crud/projects.js +4 -0
- package/dist/interface/crud/projects.js.map +1 -1
- package/dist/known-errors.d.mts +15 -0
- package/dist/known-errors.d.ts +15 -0
- package/dist/known-errors.js +73 -1
- package/dist/known-errors.js.map +1 -1
- package/dist/schema-fields.d.mts +88 -2
- package/dist/schema-fields.d.ts +88 -2
- package/dist/schema-fields.js +71 -3
- package/dist/schema-fields.js.map +1 -1
- package/dist/utils/featurebase.d.mts +28 -0
- package/dist/utils/featurebase.d.ts +28 -0
- package/dist/utils/featurebase.js +201 -0
- package/dist/utils/featurebase.js.map +1 -0
- package/dist/utils/html.d.mts +2 -1
- package/dist/utils/html.d.ts +2 -1
- package/dist/utils/html.js +8 -2
- package/dist/utils/html.js.map +1 -1
- package/package.json +1 -1
package/dist/schema-fields.d.mts
CHANGED
|
@@ -86,6 +86,8 @@ declare const adminAuthTypeSchema: yup.StringSchema<"admin", yup.AnyObject, unde
|
|
|
86
86
|
declare const projectIdSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
87
87
|
declare const projectBranchIdSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
88
88
|
declare const projectDisplayNameSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
89
|
+
declare const projectLogoUrlSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
90
|
+
declare const projectFullLogoUrlSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
89
91
|
declare const projectDescriptionSchema: yup.StringSchema<string | null | undefined, yup.AnyObject, undefined, "">;
|
|
90
92
|
declare const projectCreatedAtMillisSchema: yup.NumberSchema<number | undefined, yup.AnyObject, undefined, "">;
|
|
91
93
|
declare const projectIsProductionModeSchema: yup.BooleanSchema<boolean | undefined, yup.AnyObject, undefined, "">;
|
|
@@ -125,7 +127,91 @@ declare const emailTemplateListSchema: yup.MixedSchema<Record<string, {
|
|
|
125
127
|
displayName: string;
|
|
126
128
|
tsxSource: string;
|
|
127
129
|
}>, yup.AnyObject, undefined, "">;
|
|
128
|
-
declare const customerTypeSchema: yup.StringSchema<"user" | "team" |
|
|
130
|
+
declare const customerTypeSchema: yup.StringSchema<"user" | "team" | undefined, yup.AnyObject, undefined, "">;
|
|
131
|
+
declare const offerPriceSchema: yup.ObjectSchema<{
|
|
132
|
+
interval: DayInterval | undefined;
|
|
133
|
+
serverOnly: boolean | undefined;
|
|
134
|
+
freeTrial: DayInterval | undefined;
|
|
135
|
+
USD: string | undefined;
|
|
136
|
+
EUR: string | undefined;
|
|
137
|
+
GBP: string | undefined;
|
|
138
|
+
JPY: string | undefined;
|
|
139
|
+
INR: string | undefined;
|
|
140
|
+
AUD: string | undefined;
|
|
141
|
+
CAD: string | undefined;
|
|
142
|
+
}, yup.AnyObject, {
|
|
143
|
+
interval: undefined;
|
|
144
|
+
serverOnly: undefined;
|
|
145
|
+
freeTrial: undefined;
|
|
146
|
+
USD: undefined;
|
|
147
|
+
EUR: undefined;
|
|
148
|
+
GBP: undefined;
|
|
149
|
+
JPY: undefined;
|
|
150
|
+
INR: undefined;
|
|
151
|
+
AUD: undefined;
|
|
152
|
+
CAD: undefined;
|
|
153
|
+
}, "">;
|
|
154
|
+
declare const offerSchema: yup.ObjectSchema<{
|
|
155
|
+
displayName: string | undefined;
|
|
156
|
+
customerType: "user" | "team" | undefined;
|
|
157
|
+
freeTrial: DayInterval | undefined;
|
|
158
|
+
serverOnly: boolean | undefined;
|
|
159
|
+
stackable: boolean | undefined;
|
|
160
|
+
prices: Record<string, {
|
|
161
|
+
USD?: string | undefined;
|
|
162
|
+
EUR?: string | undefined;
|
|
163
|
+
GBP?: string | undefined;
|
|
164
|
+
JPY?: string | undefined;
|
|
165
|
+
INR?: string | undefined;
|
|
166
|
+
AUD?: string | undefined;
|
|
167
|
+
CAD?: string | undefined;
|
|
168
|
+
interval?: DayInterval | undefined;
|
|
169
|
+
serverOnly?: boolean | undefined;
|
|
170
|
+
freeTrial?: DayInterval | undefined;
|
|
171
|
+
}>;
|
|
172
|
+
includedItems: Record<string, {
|
|
173
|
+
repeat?: "never" | DayInterval | undefined;
|
|
174
|
+
quantity?: number | undefined;
|
|
175
|
+
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
176
|
+
}>;
|
|
177
|
+
}, yup.AnyObject, {
|
|
178
|
+
displayName: undefined;
|
|
179
|
+
customerType: undefined;
|
|
180
|
+
freeTrial: undefined;
|
|
181
|
+
serverOnly: undefined;
|
|
182
|
+
stackable: undefined;
|
|
183
|
+
prices: undefined;
|
|
184
|
+
includedItems: undefined;
|
|
185
|
+
}, "">;
|
|
186
|
+
declare const inlineOfferSchema: yup.ObjectSchema<{
|
|
187
|
+
display_name: string;
|
|
188
|
+
customer_type: "user" | "team";
|
|
189
|
+
free_trial: DayInterval | undefined;
|
|
190
|
+
server_only: boolean;
|
|
191
|
+
prices: Record<string, {
|
|
192
|
+
USD?: string | undefined;
|
|
193
|
+
EUR?: string | undefined;
|
|
194
|
+
GBP?: string | undefined;
|
|
195
|
+
JPY?: string | undefined;
|
|
196
|
+
INR?: string | undefined;
|
|
197
|
+
AUD?: string | undefined;
|
|
198
|
+
CAD?: string | undefined;
|
|
199
|
+
interval?: DayInterval | undefined;
|
|
200
|
+
free_trial?: DayInterval | undefined;
|
|
201
|
+
}>;
|
|
202
|
+
included_items: Record<string, {
|
|
203
|
+
repeat?: "never" | DayInterval | undefined;
|
|
204
|
+
quantity?: number | undefined;
|
|
205
|
+
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
206
|
+
}>;
|
|
207
|
+
}, yup.AnyObject, {
|
|
208
|
+
display_name: undefined;
|
|
209
|
+
customer_type: undefined;
|
|
210
|
+
free_trial: undefined;
|
|
211
|
+
server_only: true;
|
|
212
|
+
prices: undefined;
|
|
213
|
+
included_items: undefined;
|
|
214
|
+
}, "">;
|
|
129
215
|
declare class ReplaceFieldWithOwnUserId extends Error {
|
|
130
216
|
readonly path: string;
|
|
131
217
|
constructor(path: string);
|
|
@@ -209,4 +295,4 @@ declare const neonAuthorizationHeaderSchema: yup.StringSchema<string | undefined
|
|
|
209
295
|
declare function yupDefinedWhen<S extends yup.AnyObject>(schema: S, triggers: Record<string, any>): S;
|
|
210
296
|
declare function yupDefinedAndNonEmptyWhen<S extends yup.StringSchema>(schema: S, triggers: Record<string, any>): S;
|
|
211
297
|
|
|
212
|
-
export { ReplaceFieldWithOwnUserId, StackAdaptSentinel, 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, intervalOrNeverSchema, intervalSchema, jsonSchema, jsonStringOrEmptySchema, jsonStringSchema, moneyAmountSchema, neonAuthorizationHeaderSchema, oauthAccountMergeStrategySchema, oauthClientIdSchema, oauthClientSecretSchema, oauthEnabledSchema, oauthFacebookConfigIdSchema, oauthIdSchema, oauthMicrosoftTenantIdSchema, oauthProviderAccountIdSchema, oauthProviderAllowConnectedAccountsSchema, oauthProviderAllowSignInSchema, oauthProviderEmailSchema, oauthProviderIdSchema, oauthProviderTypeSchema, oauthTypeSchema, passwordSchema, permissionDefinitionIdSchema, primaryEmailAuthEnabledSchema, primaryEmailSchema, primaryEmailVerifiedSchema, profileImageUrlSchema, projectAllowLocalhostSchema, projectBranchIdSchema, projectClientTeamCreationEnabledSchema, projectClientUserDeletionEnabledSchema, projectConfigIdSchema, projectCreateTeamOnSignUpSchema, projectCreatedAtMillisSchema, projectCredentialEnabledSchema, projectDescriptionSchema, projectDisplayNameSchema, projectIdSchema, projectIsProductionModeSchema, 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, yupArray, yupBoolean, yupDate, yupDefinedAndNonEmptyWhen, yupDefinedWhen, yupMixed, yupNever, yupNumber, yupObject, yupObjectWithAutoDefault, yupRecord, yupString, yupTuple, yupUnion, yupValidate };
|
|
298
|
+
export { ReplaceFieldWithOwnUserId, StackAdaptSentinel, 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, inlineOfferSchema, intervalOrNeverSchema, intervalSchema, jsonSchema, jsonStringOrEmptySchema, jsonStringSchema, moneyAmountSchema, neonAuthorizationHeaderSchema, oauthAccountMergeStrategySchema, oauthClientIdSchema, oauthClientSecretSchema, oauthEnabledSchema, oauthFacebookConfigIdSchema, oauthIdSchema, oauthMicrosoftTenantIdSchema, oauthProviderAccountIdSchema, oauthProviderAllowConnectedAccountsSchema, oauthProviderAllowSignInSchema, oauthProviderEmailSchema, oauthProviderIdSchema, oauthProviderTypeSchema, oauthTypeSchema, offerPriceSchema, offerSchema, passwordSchema, permissionDefinitionIdSchema, primaryEmailAuthEnabledSchema, primaryEmailSchema, primaryEmailVerifiedSchema, profileImageUrlSchema, projectAllowLocalhostSchema, projectBranchIdSchema, projectClientTeamCreationEnabledSchema, projectClientUserDeletionEnabledSchema, projectConfigIdSchema, projectCreateTeamOnSignUpSchema, projectCreatedAtMillisSchema, projectCredentialEnabledSchema, projectDescriptionSchema, projectDisplayNameSchema, projectFullLogoUrlSchema, projectIdSchema, projectIsProductionModeSchema, 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, yupArray, yupBoolean, yupDate, yupDefinedAndNonEmptyWhen, yupDefinedWhen, yupMixed, yupNever, yupNumber, yupObject, yupObjectWithAutoDefault, yupRecord, yupString, yupTuple, yupUnion, yupValidate };
|
package/dist/schema-fields.d.ts
CHANGED
|
@@ -86,6 +86,8 @@ declare const adminAuthTypeSchema: yup.StringSchema<"admin", yup.AnyObject, unde
|
|
|
86
86
|
declare const projectIdSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
87
87
|
declare const projectBranchIdSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
88
88
|
declare const projectDisplayNameSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
89
|
+
declare const projectLogoUrlSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
90
|
+
declare const projectFullLogoUrlSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
89
91
|
declare const projectDescriptionSchema: yup.StringSchema<string | null | undefined, yup.AnyObject, undefined, "">;
|
|
90
92
|
declare const projectCreatedAtMillisSchema: yup.NumberSchema<number | undefined, yup.AnyObject, undefined, "">;
|
|
91
93
|
declare const projectIsProductionModeSchema: yup.BooleanSchema<boolean | undefined, yup.AnyObject, undefined, "">;
|
|
@@ -125,7 +127,91 @@ declare const emailTemplateListSchema: yup.MixedSchema<Record<string, {
|
|
|
125
127
|
displayName: string;
|
|
126
128
|
tsxSource: string;
|
|
127
129
|
}>, yup.AnyObject, undefined, "">;
|
|
128
|
-
declare const customerTypeSchema: yup.StringSchema<"user" | "team" |
|
|
130
|
+
declare const customerTypeSchema: yup.StringSchema<"user" | "team" | undefined, yup.AnyObject, undefined, "">;
|
|
131
|
+
declare const offerPriceSchema: yup.ObjectSchema<{
|
|
132
|
+
interval: DayInterval | undefined;
|
|
133
|
+
serverOnly: boolean | undefined;
|
|
134
|
+
freeTrial: DayInterval | undefined;
|
|
135
|
+
USD: string | undefined;
|
|
136
|
+
EUR: string | undefined;
|
|
137
|
+
GBP: string | undefined;
|
|
138
|
+
JPY: string | undefined;
|
|
139
|
+
INR: string | undefined;
|
|
140
|
+
AUD: string | undefined;
|
|
141
|
+
CAD: string | undefined;
|
|
142
|
+
}, yup.AnyObject, {
|
|
143
|
+
interval: undefined;
|
|
144
|
+
serverOnly: undefined;
|
|
145
|
+
freeTrial: undefined;
|
|
146
|
+
USD: undefined;
|
|
147
|
+
EUR: undefined;
|
|
148
|
+
GBP: undefined;
|
|
149
|
+
JPY: undefined;
|
|
150
|
+
INR: undefined;
|
|
151
|
+
AUD: undefined;
|
|
152
|
+
CAD: undefined;
|
|
153
|
+
}, "">;
|
|
154
|
+
declare const offerSchema: yup.ObjectSchema<{
|
|
155
|
+
displayName: string | undefined;
|
|
156
|
+
customerType: "user" | "team" | undefined;
|
|
157
|
+
freeTrial: DayInterval | undefined;
|
|
158
|
+
serverOnly: boolean | undefined;
|
|
159
|
+
stackable: boolean | undefined;
|
|
160
|
+
prices: Record<string, {
|
|
161
|
+
USD?: string | undefined;
|
|
162
|
+
EUR?: string | undefined;
|
|
163
|
+
GBP?: string | undefined;
|
|
164
|
+
JPY?: string | undefined;
|
|
165
|
+
INR?: string | undefined;
|
|
166
|
+
AUD?: string | undefined;
|
|
167
|
+
CAD?: string | undefined;
|
|
168
|
+
interval?: DayInterval | undefined;
|
|
169
|
+
serverOnly?: boolean | undefined;
|
|
170
|
+
freeTrial?: DayInterval | undefined;
|
|
171
|
+
}>;
|
|
172
|
+
includedItems: Record<string, {
|
|
173
|
+
repeat?: "never" | DayInterval | undefined;
|
|
174
|
+
quantity?: number | undefined;
|
|
175
|
+
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
176
|
+
}>;
|
|
177
|
+
}, yup.AnyObject, {
|
|
178
|
+
displayName: undefined;
|
|
179
|
+
customerType: undefined;
|
|
180
|
+
freeTrial: undefined;
|
|
181
|
+
serverOnly: undefined;
|
|
182
|
+
stackable: undefined;
|
|
183
|
+
prices: undefined;
|
|
184
|
+
includedItems: undefined;
|
|
185
|
+
}, "">;
|
|
186
|
+
declare const inlineOfferSchema: yup.ObjectSchema<{
|
|
187
|
+
display_name: string;
|
|
188
|
+
customer_type: "user" | "team";
|
|
189
|
+
free_trial: DayInterval | undefined;
|
|
190
|
+
server_only: boolean;
|
|
191
|
+
prices: Record<string, {
|
|
192
|
+
USD?: string | undefined;
|
|
193
|
+
EUR?: string | undefined;
|
|
194
|
+
GBP?: string | undefined;
|
|
195
|
+
JPY?: string | undefined;
|
|
196
|
+
INR?: string | undefined;
|
|
197
|
+
AUD?: string | undefined;
|
|
198
|
+
CAD?: string | undefined;
|
|
199
|
+
interval?: DayInterval | undefined;
|
|
200
|
+
free_trial?: DayInterval | undefined;
|
|
201
|
+
}>;
|
|
202
|
+
included_items: Record<string, {
|
|
203
|
+
repeat?: "never" | DayInterval | undefined;
|
|
204
|
+
quantity?: number | undefined;
|
|
205
|
+
expires?: "never" | "when-purchase-expires" | "when-repeated" | undefined;
|
|
206
|
+
}>;
|
|
207
|
+
}, yup.AnyObject, {
|
|
208
|
+
display_name: undefined;
|
|
209
|
+
customer_type: undefined;
|
|
210
|
+
free_trial: undefined;
|
|
211
|
+
server_only: true;
|
|
212
|
+
prices: undefined;
|
|
213
|
+
included_items: undefined;
|
|
214
|
+
}, "">;
|
|
129
215
|
declare class ReplaceFieldWithOwnUserId extends Error {
|
|
130
216
|
readonly path: string;
|
|
131
217
|
constructor(path: string);
|
|
@@ -209,4 +295,4 @@ declare const neonAuthorizationHeaderSchema: yup.StringSchema<string | undefined
|
|
|
209
295
|
declare function yupDefinedWhen<S extends yup.AnyObject>(schema: S, triggers: Record<string, any>): S;
|
|
210
296
|
declare function yupDefinedAndNonEmptyWhen<S extends yup.StringSchema>(schema: S, triggers: Record<string, any>): S;
|
|
211
297
|
|
|
212
|
-
export { ReplaceFieldWithOwnUserId, StackAdaptSentinel, 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, intervalOrNeverSchema, intervalSchema, jsonSchema, jsonStringOrEmptySchema, jsonStringSchema, moneyAmountSchema, neonAuthorizationHeaderSchema, oauthAccountMergeStrategySchema, oauthClientIdSchema, oauthClientSecretSchema, oauthEnabledSchema, oauthFacebookConfigIdSchema, oauthIdSchema, oauthMicrosoftTenantIdSchema, oauthProviderAccountIdSchema, oauthProviderAllowConnectedAccountsSchema, oauthProviderAllowSignInSchema, oauthProviderEmailSchema, oauthProviderIdSchema, oauthProviderTypeSchema, oauthTypeSchema, passwordSchema, permissionDefinitionIdSchema, primaryEmailAuthEnabledSchema, primaryEmailSchema, primaryEmailVerifiedSchema, profileImageUrlSchema, projectAllowLocalhostSchema, projectBranchIdSchema, projectClientTeamCreationEnabledSchema, projectClientUserDeletionEnabledSchema, projectConfigIdSchema, projectCreateTeamOnSignUpSchema, projectCreatedAtMillisSchema, projectCredentialEnabledSchema, projectDescriptionSchema, projectDisplayNameSchema, projectIdSchema, projectIsProductionModeSchema, 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, yupArray, yupBoolean, yupDate, yupDefinedAndNonEmptyWhen, yupDefinedWhen, yupMixed, yupNever, yupNumber, yupObject, yupObjectWithAutoDefault, yupRecord, yupString, yupTuple, yupUnion, yupValidate };
|
|
298
|
+
export { ReplaceFieldWithOwnUserId, StackAdaptSentinel, 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, inlineOfferSchema, intervalOrNeverSchema, intervalSchema, jsonSchema, jsonStringOrEmptySchema, jsonStringSchema, moneyAmountSchema, neonAuthorizationHeaderSchema, oauthAccountMergeStrategySchema, oauthClientIdSchema, oauthClientSecretSchema, oauthEnabledSchema, oauthFacebookConfigIdSchema, oauthIdSchema, oauthMicrosoftTenantIdSchema, oauthProviderAccountIdSchema, oauthProviderAllowConnectedAccountsSchema, oauthProviderAllowSignInSchema, oauthProviderEmailSchema, oauthProviderIdSchema, oauthProviderTypeSchema, oauthTypeSchema, offerPriceSchema, offerSchema, passwordSchema, permissionDefinitionIdSchema, primaryEmailAuthEnabledSchema, primaryEmailSchema, primaryEmailVerifiedSchema, profileImageUrlSchema, projectAllowLocalhostSchema, projectBranchIdSchema, projectClientTeamCreationEnabledSchema, projectClientUserDeletionEnabledSchema, projectConfigIdSchema, projectCreateTeamOnSignUpSchema, projectCreatedAtMillisSchema, projectCredentialEnabledSchema, projectDescriptionSchema, projectDisplayNameSchema, projectFullLogoUrlSchema, projectIdSchema, projectIsProductionModeSchema, 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, yupArray, yupBoolean, yupDate, yupDefinedAndNonEmptyWhen, yupDefinedWhen, yupMixed, yupNever, yupNumber, yupObject, yupObjectWithAutoDefault, yupRecord, yupString, yupTuple, yupUnion, yupValidate };
|
package/dist/schema-fields.js
CHANGED
|
@@ -63,6 +63,7 @@ __export(schema_fields_exports, {
|
|
|
63
63
|
emailVerificationCallbackUrlSchema: () => emailVerificationCallbackUrlSchema,
|
|
64
64
|
ensureObjectSchema: () => ensureObjectSchema,
|
|
65
65
|
handlerPathSchema: () => handlerPathSchema,
|
|
66
|
+
inlineOfferSchema: () => inlineOfferSchema,
|
|
66
67
|
intervalOrNeverSchema: () => intervalOrNeverSchema,
|
|
67
68
|
intervalSchema: () => intervalSchema,
|
|
68
69
|
jsonSchema: () => jsonSchema,
|
|
@@ -84,6 +85,8 @@ __export(schema_fields_exports, {
|
|
|
84
85
|
oauthProviderIdSchema: () => oauthProviderIdSchema,
|
|
85
86
|
oauthProviderTypeSchema: () => oauthProviderTypeSchema,
|
|
86
87
|
oauthTypeSchema: () => oauthTypeSchema,
|
|
88
|
+
offerPriceSchema: () => offerPriceSchema,
|
|
89
|
+
offerSchema: () => offerSchema,
|
|
87
90
|
passwordSchema: () => passwordSchema,
|
|
88
91
|
permissionDefinitionIdSchema: () => permissionDefinitionIdSchema,
|
|
89
92
|
primaryEmailAuthEnabledSchema: () => primaryEmailAuthEnabledSchema,
|
|
@@ -100,8 +103,10 @@ __export(schema_fields_exports, {
|
|
|
100
103
|
projectCredentialEnabledSchema: () => projectCredentialEnabledSchema,
|
|
101
104
|
projectDescriptionSchema: () => projectDescriptionSchema,
|
|
102
105
|
projectDisplayNameSchema: () => projectDisplayNameSchema,
|
|
106
|
+
projectFullLogoUrlSchema: () => projectFullLogoUrlSchema,
|
|
103
107
|
projectIdSchema: () => projectIdSchema,
|
|
104
108
|
projectIsProductionModeSchema: () => projectIsProductionModeSchema,
|
|
109
|
+
projectLogoUrlSchema: () => projectLogoUrlSchema,
|
|
105
110
|
projectMagicLinkEnabledSchema: () => projectMagicLinkEnabledSchema,
|
|
106
111
|
projectPasskeyEnabledSchema: () => projectPasskeyEnabledSchema,
|
|
107
112
|
projectSignUpEnabledSchema: () => projectSignUpEnabledSchema,
|
|
@@ -164,6 +169,7 @@ module.exports = __toCommonJS(schema_fields_exports);
|
|
|
164
169
|
var yup = __toESM(require("yup"));
|
|
165
170
|
var import__ = require("./index.js");
|
|
166
171
|
var import_bytes = require("./utils/bytes.js");
|
|
172
|
+
var import_currencies = require("./utils/currencies.js");
|
|
167
173
|
var import_errors = require("./utils/errors.js");
|
|
168
174
|
var import_http = require("./utils/http.js");
|
|
169
175
|
var import_oauth = require("./utils/oauth.js");
|
|
@@ -171,6 +177,7 @@ var import_objects = require("./utils/objects.js");
|
|
|
171
177
|
var import_strings = require("./utils/strings.js");
|
|
172
178
|
var import_urls = require("./utils/urls.js");
|
|
173
179
|
var import_uuids = require("./utils/uuids.js");
|
|
180
|
+
var MAX_IMAGE_SIZE_BASE64_BYTES = 1e6;
|
|
174
181
|
yup.addMethod(yup.string, "nonEmpty", function(message) {
|
|
175
182
|
return this.test(
|
|
176
183
|
"non-empty",
|
|
@@ -416,7 +423,7 @@ var intervalSchema = yupTuple([yupNumber().min(0).integer().defined(), yupString
|
|
|
416
423
|
var dayIntervalSchema = yupTuple([yupNumber().min(0).integer().defined(), yupString().oneOf(["day", "week", "month", "year"]).defined()]);
|
|
417
424
|
var intervalOrNeverSchema = yupUnion(intervalSchema.defined(), yupString().oneOf(["never"]).defined());
|
|
418
425
|
var dayIntervalOrNeverSchema = yupUnion(dayIntervalSchema.defined(), yupString().oneOf(["never"]).defined());
|
|
419
|
-
var userSpecifiedIdSchema = (idName) => yupString().matches(/^[a-zA-Z_][a-zA-Z0-9_-]
|
|
426
|
+
var userSpecifiedIdSchema = (idName) => yupString().matches(/^[a-zA-Z_][a-zA-Z0-9_-]*$/, `${idName} must start with a letter or underscore and contain only letters, numbers, underscores, and hyphens`);
|
|
420
427
|
var moneyAmountSchema = (currency) => yupString().test("money-amount", "Invalid money amount", (value, context) => {
|
|
421
428
|
if (value == null) return true;
|
|
422
429
|
const regex = /^([0-9]+)(\.([0-9]+))?$/;
|
|
@@ -436,6 +443,8 @@ var adminAuthTypeSchema = yupString().oneOf(["admin"]).defined();
|
|
|
436
443
|
var projectIdSchema = yupString().test((v) => v === void 0 || v === "internal" || (0, import_uuids.isUuid)(v)).meta({ openapiField: { description: _idDescription("project"), exampleValue: "e0b52f4d-dece-408c-af49-d23061bb0f8d" } });
|
|
437
444
|
var projectBranchIdSchema = yupString().nonEmpty().max(255).meta({ openapiField: { description: _idDescription("project branch"), exampleValue: "main" } });
|
|
438
445
|
var projectDisplayNameSchema = yupString().meta({ openapiField: { description: _displayNameDescription("project"), exampleValue: "MyMusic" } });
|
|
446
|
+
var projectLogoUrlSchema = urlSchema.max(MAX_IMAGE_SIZE_BASE64_BYTES).meta({ openapiField: { description: "URL of the logo for the project. This is usually a close to 1:1 image of the company logo.", exampleValue: "https://example.com/logo.png" } });
|
|
447
|
+
var projectFullLogoUrlSchema = urlSchema.max(MAX_IMAGE_SIZE_BASE64_BYTES).meta({ openapiField: { description: "URL of the full logo for the project. This is usually a vertical image with the logo and the company name.", exampleValue: "https://example.com/full-logo.png" } });
|
|
439
448
|
var projectDescriptionSchema = yupString().nullable().meta({ openapiField: { description: "A human readable description of the project", exampleValue: "A music streaming service" } });
|
|
440
449
|
var projectCreatedAtMillisSchema = yupNumber().meta({ openapiField: { description: _createdAtMillisDescription("project"), exampleValue: 163e10 } });
|
|
441
450
|
var projectIsProductionModeSchema = yupBoolean().meta({ openapiField: { description: "Whether the project is in production mode", exampleValue: true } });
|
|
@@ -485,7 +494,61 @@ var emailTemplateListSchema = yupRecord(
|
|
|
485
494
|
themeId: templateThemeIdSchema
|
|
486
495
|
})
|
|
487
496
|
).meta({ openapiField: { description: "Record of email template IDs to their display name and source code" } });
|
|
488
|
-
var customerTypeSchema = yupString().oneOf(["user", "team"
|
|
497
|
+
var customerTypeSchema = yupString().oneOf(["user", "team"]);
|
|
498
|
+
var validateHasAtLeastOneSupportedCurrency = (value, context) => {
|
|
499
|
+
const currencies = Object.keys(value).filter((key) => import_currencies.SUPPORTED_CURRENCIES.some((c) => c.code === key));
|
|
500
|
+
if (currencies.length === 0) {
|
|
501
|
+
return context.createError({ message: "At least one currency is required" });
|
|
502
|
+
}
|
|
503
|
+
return true;
|
|
504
|
+
};
|
|
505
|
+
var offerPriceSchema = yupObject({
|
|
506
|
+
...(0, import_objects.typedFromEntries)(import_currencies.SUPPORTED_CURRENCIES.map((currency) => [currency.code, moneyAmountSchema(currency).optional()])),
|
|
507
|
+
interval: dayIntervalSchema.optional(),
|
|
508
|
+
serverOnly: yupBoolean(),
|
|
509
|
+
freeTrial: dayIntervalSchema.optional()
|
|
510
|
+
}).test("at-least-one-currency", (value, context) => validateHasAtLeastOneSupportedCurrency(value, context));
|
|
511
|
+
var offerSchema = yupObject({
|
|
512
|
+
displayName: yupString(),
|
|
513
|
+
customerType: customerTypeSchema,
|
|
514
|
+
freeTrial: dayIntervalSchema.optional(),
|
|
515
|
+
serverOnly: yupBoolean(),
|
|
516
|
+
stackable: yupBoolean(),
|
|
517
|
+
prices: yupRecord(
|
|
518
|
+
userSpecifiedIdSchema("priceId"),
|
|
519
|
+
offerPriceSchema
|
|
520
|
+
),
|
|
521
|
+
includedItems: yupRecord(
|
|
522
|
+
userSpecifiedIdSchema("itemId"),
|
|
523
|
+
yupObject({
|
|
524
|
+
quantity: yupNumber(),
|
|
525
|
+
repeat: dayIntervalOrNeverSchema.optional(),
|
|
526
|
+
expires: yupString().oneOf(["never", "when-purchase-expires", "when-repeated"]).optional()
|
|
527
|
+
})
|
|
528
|
+
)
|
|
529
|
+
});
|
|
530
|
+
var inlineOfferSchema = yupObject({
|
|
531
|
+
display_name: yupString().defined(),
|
|
532
|
+
customer_type: customerTypeSchema.defined(),
|
|
533
|
+
free_trial: dayIntervalSchema.optional(),
|
|
534
|
+
server_only: yupBoolean().oneOf([true]).default(true),
|
|
535
|
+
prices: yupRecord(
|
|
536
|
+
userSpecifiedIdSchema("priceId"),
|
|
537
|
+
yupObject({
|
|
538
|
+
...(0, import_objects.typedFromEntries)(import_currencies.SUPPORTED_CURRENCIES.map((currency) => [currency.code, moneyAmountSchema(currency).optional()])),
|
|
539
|
+
interval: dayIntervalSchema.optional(),
|
|
540
|
+
free_trial: dayIntervalSchema.optional()
|
|
541
|
+
}).test("at-least-one-currency", (value, context) => validateHasAtLeastOneSupportedCurrency(value, context))
|
|
542
|
+
),
|
|
543
|
+
included_items: yupRecord(
|
|
544
|
+
userSpecifiedIdSchema("itemId"),
|
|
545
|
+
yupObject({
|
|
546
|
+
quantity: yupNumber(),
|
|
547
|
+
repeat: dayIntervalOrNeverSchema.optional(),
|
|
548
|
+
expires: yupString().oneOf(["never", "when-purchase-expires", "when-repeated"]).optional()
|
|
549
|
+
})
|
|
550
|
+
)
|
|
551
|
+
});
|
|
489
552
|
var ReplaceFieldWithOwnUserId = class extends Error {
|
|
490
553
|
constructor(path) {
|
|
491
554
|
super(`This error should be caught by whoever validated the schema, and the field in the path '${path}' should be replaced with the current user's id. This is a workaround to yup not providing access to the context inside the transform function.`);
|
|
@@ -508,7 +571,7 @@ var primaryEmailAuthEnabledSchema = yupBoolean().meta({ openapiField: { descript
|
|
|
508
571
|
var primaryEmailVerifiedSchema = yupBoolean().meta({ openapiField: { description: "Whether the primary email has been verified to belong to this user", exampleValue: true } });
|
|
509
572
|
var userDisplayNameSchema = yupString().nullable().meta({ openapiField: { description: _displayNameDescription("user"), exampleValue: "John Doe" } });
|
|
510
573
|
var selectedTeamIdSchema = yupString().uuid().meta({ openapiField: { description: "ID of the team currently selected by the user", exampleValue: "team-id" } });
|
|
511
|
-
var profileImageUrlSchema = urlSchema.max(
|
|
574
|
+
var profileImageUrlSchema = urlSchema.max(MAX_IMAGE_SIZE_BASE64_BYTES).meta({ openapiField: { description: _profileImageUrlDescription("user"), exampleValue: "https://example.com/image.jpg" } });
|
|
512
575
|
var signedUpAtMillisSchema = yupNumber().meta({ openapiField: { description: _signedUpAtMillisDescription, exampleValue: 163e10 } });
|
|
513
576
|
var userClientMetadataSchema = jsonSchema.meta({ openapiField: { description: _clientMetaDataDescription("user"), exampleValue: { key: "value" } } });
|
|
514
577
|
var userClientReadOnlyMetadataSchema = jsonSchema.meta({ openapiField: { description: _clientReadOnlyMetaDataDescription("user"), exampleValue: { key: "value" } } });
|
|
@@ -645,6 +708,7 @@ function yupDefinedAndNonEmptyWhen(schema, triggers) {
|
|
|
645
708
|
emailVerificationCallbackUrlSchema,
|
|
646
709
|
ensureObjectSchema,
|
|
647
710
|
handlerPathSchema,
|
|
711
|
+
inlineOfferSchema,
|
|
648
712
|
intervalOrNeverSchema,
|
|
649
713
|
intervalSchema,
|
|
650
714
|
jsonSchema,
|
|
@@ -666,6 +730,8 @@ function yupDefinedAndNonEmptyWhen(schema, triggers) {
|
|
|
666
730
|
oauthProviderIdSchema,
|
|
667
731
|
oauthProviderTypeSchema,
|
|
668
732
|
oauthTypeSchema,
|
|
733
|
+
offerPriceSchema,
|
|
734
|
+
offerSchema,
|
|
669
735
|
passwordSchema,
|
|
670
736
|
permissionDefinitionIdSchema,
|
|
671
737
|
primaryEmailAuthEnabledSchema,
|
|
@@ -682,8 +748,10 @@ function yupDefinedAndNonEmptyWhen(schema, triggers) {
|
|
|
682
748
|
projectCredentialEnabledSchema,
|
|
683
749
|
projectDescriptionSchema,
|
|
684
750
|
projectDisplayNameSchema,
|
|
751
|
+
projectFullLogoUrlSchema,
|
|
685
752
|
projectIdSchema,
|
|
686
753
|
projectIsProductionModeSchema,
|
|
754
|
+
projectLogoUrlSchema,
|
|
687
755
|
projectMagicLinkEnabledSchema,
|
|
688
756
|
projectPasskeyEnabledSchema,
|
|
689
757
|
projectSignUpEnabledSchema,
|