@stackframe/stack-shared 2.5.3 → 2.5.5

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 (71) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/crud.d.ts +10 -3
  3. package/dist/helpers/production-mode.d.ts +6 -0
  4. package/dist/helpers/production-mode.js +43 -0
  5. package/dist/index.d.ts +4 -4
  6. package/dist/index.js +4 -4
  7. package/dist/interface/adminInterface.d.ts +28 -67
  8. package/dist/interface/adminInterface.js +63 -21
  9. package/dist/interface/clientInterface.d.ts +21 -133
  10. package/dist/interface/clientInterface.js +92 -118
  11. package/dist/interface/crud/api-keys.d.ts +134 -0
  12. package/dist/interface/crud/api-keys.js +61 -0
  13. package/dist/interface/crud/current-user.d.ts +47 -11
  14. package/dist/interface/crud/current-user.js +7 -3
  15. package/dist/interface/crud/email-templates.d.ts +53 -34
  16. package/dist/interface/crud/email-templates.js +37 -24
  17. package/dist/interface/crud/oauth.d.ts +8 -9
  18. package/dist/interface/crud/oauth.js +5 -5
  19. package/dist/interface/crud/projects.d.ts +458 -0
  20. package/dist/interface/crud/projects.js +112 -0
  21. package/dist/interface/crud/team-memberships.d.ts +22 -0
  22. package/dist/interface/crud/team-memberships.js +22 -0
  23. package/dist/interface/crud/team-permissions.d.ts +129 -0
  24. package/dist/interface/crud/team-permissions.js +83 -0
  25. package/dist/interface/crud/teams.d.ts +148 -0
  26. package/dist/interface/crud/teams.js +80 -0
  27. package/dist/interface/crud/users.d.ts +88 -33
  28. package/dist/interface/crud/users.js +22 -14
  29. package/dist/interface/crud-deprecated/api-keys.d.ts +134 -0
  30. package/dist/interface/crud-deprecated/api-keys.js +61 -0
  31. package/dist/interface/crud-deprecated/current-user.d.ts +127 -0
  32. package/dist/interface/crud-deprecated/current-user.js +49 -0
  33. package/dist/interface/crud-deprecated/email-templates.d.ts +75 -0
  34. package/dist/interface/crud-deprecated/email-templates.js +41 -0
  35. package/dist/interface/crud-deprecated/oauth.d.ts +24 -0
  36. package/dist/interface/crud-deprecated/oauth.js +12 -0
  37. package/dist/interface/crud-deprecated/projects.d.ts +440 -0
  38. package/dist/interface/crud-deprecated/projects.js +109 -0
  39. package/dist/interface/crud-deprecated/team-memberships.d.ts +22 -0
  40. package/dist/interface/crud-deprecated/team-memberships.js +22 -0
  41. package/dist/interface/crud-deprecated/team-permissions.d.ts +129 -0
  42. package/dist/interface/crud-deprecated/team-permissions.js +83 -0
  43. package/dist/interface/crud-deprecated/teams.d.ts +126 -0
  44. package/dist/interface/crud-deprecated/teams.js +78 -0
  45. package/dist/interface/crud-deprecated/users.d.ts +201 -0
  46. package/dist/interface/crud-deprecated/users.js +75 -0
  47. package/dist/interface/serverInterface.d.ts +33 -60
  48. package/dist/interface/serverInterface.js +74 -101
  49. package/dist/known-errors.d.ts +43 -26
  50. package/dist/known-errors.js +132 -85
  51. package/dist/schema-fields.d.ts +53 -4
  52. package/dist/schema-fields.js +156 -25
  53. package/dist/sessions.d.ts +1 -0
  54. package/dist/sessions.js +13 -3
  55. package/dist/utils/compile-time.d.ts +3 -1
  56. package/dist/utils/compile-time.js +3 -1
  57. package/dist/utils/errors.d.ts +8 -1
  58. package/dist/utils/errors.js +17 -4
  59. package/dist/utils/objects.d.ts +4 -1
  60. package/dist/utils/objects.js +16 -8
  61. package/dist/utils/promises.js +6 -1
  62. package/dist/utils/proxies.d.ts +1 -0
  63. package/dist/utils/proxies.js +65 -0
  64. package/dist/utils/react.d.ts +1 -1
  65. package/dist/utils/react.js +2 -2
  66. package/dist/utils/strings.js +3 -3
  67. package/dist/utils/urls.d.ts +1 -0
  68. package/dist/utils/urls.js +8 -0
  69. package/package.json +2 -2
  70. package/dist/utils/yup.d.ts +0 -3
  71. package/dist/utils/yup.js +0 -13
@@ -0,0 +1,458 @@
1
+ import { CrudTypeOf } from "../../crud";
2
+ export declare const projectsCrudServerReadSchema: import("yup").ObjectSchema<{
3
+ id: string;
4
+ display_name: string;
5
+ description: string;
6
+ created_at_millis: number;
7
+ user_count: number;
8
+ is_production_mode: NonNullable<boolean | undefined>;
9
+ config: {
10
+ id: string;
11
+ allow_localhost: NonNullable<boolean | undefined>;
12
+ credential_enabled: NonNullable<boolean | undefined>;
13
+ magic_link_enabled: NonNullable<boolean | undefined>;
14
+ oauth_providers: {
15
+ client_id?: string | undefined;
16
+ client_secret?: string | undefined;
17
+ type: NonNullable<"shared" | "standard" | undefined>;
18
+ id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
19
+ enabled: NonNullable<boolean | undefined>;
20
+ }[];
21
+ enabled_oauth_providers: {
22
+ id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
23
+ }[];
24
+ domains: {
25
+ domain: string;
26
+ handler_path: string;
27
+ }[];
28
+ email_config: {
29
+ host?: string | undefined;
30
+ port?: number | undefined;
31
+ username?: string | undefined;
32
+ password?: string | undefined;
33
+ sender_name?: string | undefined;
34
+ sender_email?: string | undefined;
35
+ type: NonNullable<"shared" | "standard" | undefined>;
36
+ };
37
+ create_team_on_sign_up: NonNullable<boolean | undefined>;
38
+ team_creator_default_permissions: {
39
+ id: string;
40
+ }[];
41
+ team_member_default_permissions: {
42
+ id: string;
43
+ }[];
44
+ };
45
+ }, import("yup").AnyObject, {
46
+ id: undefined;
47
+ display_name: undefined;
48
+ description: undefined;
49
+ created_at_millis: undefined;
50
+ user_count: undefined;
51
+ is_production_mode: undefined;
52
+ config: {
53
+ id: undefined;
54
+ allow_localhost: undefined;
55
+ credential_enabled: undefined;
56
+ magic_link_enabled: undefined;
57
+ oauth_providers: undefined;
58
+ enabled_oauth_providers: undefined;
59
+ domains: undefined;
60
+ email_config: {
61
+ type: undefined;
62
+ host: undefined;
63
+ port: undefined;
64
+ username: undefined;
65
+ password: undefined;
66
+ sender_name: undefined;
67
+ sender_email: undefined;
68
+ };
69
+ create_team_on_sign_up: undefined;
70
+ team_creator_default_permissions: undefined;
71
+ team_member_default_permissions: undefined;
72
+ };
73
+ }, "">;
74
+ export declare const projectsCrudClientReadSchema: import("yup").ObjectSchema<{
75
+ id: string;
76
+ display_name: string;
77
+ config: {
78
+ credential_enabled: NonNullable<boolean | undefined>;
79
+ magic_link_enabled: NonNullable<boolean | undefined>;
80
+ enabled_oauth_providers: {
81
+ id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
82
+ }[];
83
+ };
84
+ }, import("yup").AnyObject, {
85
+ id: undefined;
86
+ display_name: undefined;
87
+ config: {
88
+ credential_enabled: undefined;
89
+ magic_link_enabled: undefined;
90
+ enabled_oauth_providers: undefined;
91
+ };
92
+ }, "">;
93
+ export declare const projectsCrudServerUpdateSchema: import("yup").ObjectSchema<{
94
+ display_name: string | undefined;
95
+ description: string | null | undefined;
96
+ is_production_mode: boolean | undefined;
97
+ config: {
98
+ allow_localhost?: boolean | undefined;
99
+ credential_enabled?: boolean | undefined;
100
+ magic_link_enabled?: boolean | undefined;
101
+ oauth_providers?: {
102
+ client_id?: string | undefined;
103
+ client_secret?: string | undefined;
104
+ type: NonNullable<"shared" | "standard" | undefined>;
105
+ id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
106
+ enabled: NonNullable<boolean | undefined>;
107
+ }[] | undefined;
108
+ domains?: {
109
+ domain: string;
110
+ handler_path: string;
111
+ }[] | undefined;
112
+ email_config?: {
113
+ host?: string | undefined;
114
+ port?: number | undefined;
115
+ username?: string | undefined;
116
+ password?: string | undefined;
117
+ sender_name?: string | undefined;
118
+ sender_email?: string | undefined;
119
+ type: NonNullable<"shared" | "standard" | undefined>;
120
+ } | undefined;
121
+ create_team_on_sign_up?: boolean | undefined;
122
+ team_creator_default_permissions?: {
123
+ id: string;
124
+ }[] | undefined;
125
+ team_member_default_permissions?: {
126
+ id: string;
127
+ }[] | undefined;
128
+ } | undefined;
129
+ }, import("yup").AnyObject, {
130
+ display_name: undefined;
131
+ description: undefined;
132
+ is_production_mode: undefined;
133
+ config: undefined;
134
+ }, "">;
135
+ export declare const projectsCrudServerCreateSchema: import("yup").ObjectSchema<{
136
+ display_name: string;
137
+ description: string | null | undefined;
138
+ is_production_mode: boolean | undefined;
139
+ config: {
140
+ allow_localhost?: boolean | undefined;
141
+ credential_enabled?: boolean | undefined;
142
+ magic_link_enabled?: boolean | undefined;
143
+ oauth_providers?: {
144
+ client_id?: string | undefined;
145
+ client_secret?: string | undefined;
146
+ type: NonNullable<"shared" | "standard" | undefined>;
147
+ id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
148
+ enabled: NonNullable<boolean | undefined>;
149
+ }[] | undefined;
150
+ domains?: {
151
+ domain: string;
152
+ handler_path: string;
153
+ }[] | undefined;
154
+ email_config?: {
155
+ host?: string | undefined;
156
+ port?: number | undefined;
157
+ username?: string | undefined;
158
+ password?: string | undefined;
159
+ sender_name?: string | undefined;
160
+ sender_email?: string | undefined;
161
+ type: NonNullable<"shared" | "standard" | undefined>;
162
+ } | undefined;
163
+ create_team_on_sign_up?: boolean | undefined;
164
+ team_creator_default_permissions?: {
165
+ id: string;
166
+ }[] | undefined;
167
+ team_member_default_permissions?: {
168
+ id: string;
169
+ }[] | undefined;
170
+ } | undefined;
171
+ } & {
172
+ display_name: string;
173
+ }, import("yup").AnyObject, {
174
+ display_name: undefined;
175
+ description: undefined;
176
+ is_production_mode: undefined;
177
+ config: undefined;
178
+ }, "">;
179
+ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
180
+ clientReadSchema: import("yup").ObjectSchema<{
181
+ id: string;
182
+ display_name: string;
183
+ config: {
184
+ credential_enabled: NonNullable<boolean | undefined>;
185
+ magic_link_enabled: NonNullable<boolean | undefined>;
186
+ enabled_oauth_providers: {
187
+ id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
188
+ }[];
189
+ };
190
+ }, import("yup").AnyObject, {
191
+ id: undefined;
192
+ display_name: undefined;
193
+ config: {
194
+ credential_enabled: undefined;
195
+ magic_link_enabled: undefined;
196
+ enabled_oauth_providers: undefined;
197
+ };
198
+ }, "">;
199
+ serverReadSchema: import("yup").ObjectSchema<{
200
+ id: string;
201
+ display_name: string;
202
+ description: string;
203
+ created_at_millis: number;
204
+ user_count: number;
205
+ is_production_mode: NonNullable<boolean | undefined>;
206
+ config: {
207
+ id: string;
208
+ allow_localhost: NonNullable<boolean | undefined>;
209
+ credential_enabled: NonNullable<boolean | undefined>;
210
+ magic_link_enabled: NonNullable<boolean | undefined>;
211
+ oauth_providers: {
212
+ client_id?: string | undefined;
213
+ client_secret?: string | undefined;
214
+ type: NonNullable<"shared" | "standard" | undefined>;
215
+ id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
216
+ enabled: NonNullable<boolean | undefined>;
217
+ }[];
218
+ enabled_oauth_providers: {
219
+ id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
220
+ }[];
221
+ domains: {
222
+ domain: string;
223
+ handler_path: string;
224
+ }[];
225
+ email_config: {
226
+ host?: string | undefined;
227
+ port?: number | undefined;
228
+ username?: string | undefined;
229
+ password?: string | undefined;
230
+ sender_name?: string | undefined;
231
+ sender_email?: string | undefined;
232
+ type: NonNullable<"shared" | "standard" | undefined>;
233
+ };
234
+ create_team_on_sign_up: NonNullable<boolean | undefined>;
235
+ team_creator_default_permissions: {
236
+ id: string;
237
+ }[];
238
+ team_member_default_permissions: {
239
+ id: string;
240
+ }[];
241
+ };
242
+ }, import("yup").AnyObject, {
243
+ id: undefined;
244
+ display_name: undefined;
245
+ description: undefined;
246
+ created_at_millis: undefined;
247
+ user_count: undefined;
248
+ is_production_mode: undefined;
249
+ config: {
250
+ id: undefined;
251
+ allow_localhost: undefined;
252
+ credential_enabled: undefined;
253
+ magic_link_enabled: undefined;
254
+ oauth_providers: undefined;
255
+ enabled_oauth_providers: undefined;
256
+ domains: undefined;
257
+ email_config: {
258
+ type: undefined;
259
+ host: undefined;
260
+ port: undefined;
261
+ username: undefined;
262
+ password: undefined;
263
+ sender_name: undefined;
264
+ sender_email: undefined;
265
+ };
266
+ create_team_on_sign_up: undefined;
267
+ team_creator_default_permissions: undefined;
268
+ team_member_default_permissions: undefined;
269
+ };
270
+ }, "">;
271
+ serverUpdateSchema: import("yup").ObjectSchema<{
272
+ display_name: string | undefined;
273
+ description: string | null | undefined;
274
+ is_production_mode: boolean | undefined;
275
+ config: {
276
+ allow_localhost?: boolean | undefined;
277
+ credential_enabled?: boolean | undefined;
278
+ magic_link_enabled?: boolean | undefined;
279
+ oauth_providers?: {
280
+ client_id?: string | undefined;
281
+ client_secret?: string | undefined;
282
+ type: NonNullable<"shared" | "standard" | undefined>;
283
+ id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
284
+ enabled: NonNullable<boolean | undefined>;
285
+ }[] | undefined;
286
+ domains?: {
287
+ domain: string;
288
+ handler_path: string;
289
+ }[] | undefined;
290
+ email_config?: {
291
+ host?: string | undefined;
292
+ port?: number | undefined;
293
+ username?: string | undefined;
294
+ password?: string | undefined;
295
+ sender_name?: string | undefined;
296
+ sender_email?: string | undefined;
297
+ type: NonNullable<"shared" | "standard" | undefined>;
298
+ } | undefined;
299
+ create_team_on_sign_up?: boolean | undefined;
300
+ team_creator_default_permissions?: {
301
+ id: string;
302
+ }[] | undefined;
303
+ team_member_default_permissions?: {
304
+ id: string;
305
+ }[] | undefined;
306
+ } | undefined;
307
+ }, import("yup").AnyObject, {
308
+ display_name: undefined;
309
+ description: undefined;
310
+ is_production_mode: undefined;
311
+ config: undefined;
312
+ }, "">;
313
+ docs: {
314
+ clientRead: {
315
+ summary: string;
316
+ description: string;
317
+ tags: string[];
318
+ };
319
+ serverRead: {
320
+ summary: string;
321
+ description: string;
322
+ tags: string[];
323
+ };
324
+ serverUpdate: {
325
+ summary: string;
326
+ description: string;
327
+ tags: string[];
328
+ };
329
+ };
330
+ }>;
331
+ export type ProjectsCrud = CrudTypeOf<typeof projectsCrud>;
332
+ export declare const internalProjectsCrud: import("../../crud").CrudSchemaFromOptions<{
333
+ clientReadSchema: import("yup").ObjectSchema<{
334
+ id: string;
335
+ display_name: string;
336
+ description: string;
337
+ created_at_millis: number;
338
+ user_count: number;
339
+ is_production_mode: NonNullable<boolean | undefined>;
340
+ config: {
341
+ id: string;
342
+ allow_localhost: NonNullable<boolean | undefined>;
343
+ credential_enabled: NonNullable<boolean | undefined>;
344
+ magic_link_enabled: NonNullable<boolean | undefined>;
345
+ oauth_providers: {
346
+ client_id?: string | undefined;
347
+ client_secret?: string | undefined;
348
+ type: NonNullable<"shared" | "standard" | undefined>;
349
+ id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
350
+ enabled: NonNullable<boolean | undefined>;
351
+ }[];
352
+ enabled_oauth_providers: {
353
+ id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
354
+ }[];
355
+ domains: {
356
+ domain: string;
357
+ handler_path: string;
358
+ }[];
359
+ email_config: {
360
+ host?: string | undefined;
361
+ port?: number | undefined;
362
+ username?: string | undefined;
363
+ password?: string | undefined;
364
+ sender_name?: string | undefined;
365
+ sender_email?: string | undefined;
366
+ type: NonNullable<"shared" | "standard" | undefined>;
367
+ };
368
+ create_team_on_sign_up: NonNullable<boolean | undefined>;
369
+ team_creator_default_permissions: {
370
+ id: string;
371
+ }[];
372
+ team_member_default_permissions: {
373
+ id: string;
374
+ }[];
375
+ };
376
+ }, import("yup").AnyObject, {
377
+ id: undefined;
378
+ display_name: undefined;
379
+ description: undefined;
380
+ created_at_millis: undefined;
381
+ user_count: undefined;
382
+ is_production_mode: undefined;
383
+ config: {
384
+ id: undefined;
385
+ allow_localhost: undefined;
386
+ credential_enabled: undefined;
387
+ magic_link_enabled: undefined;
388
+ oauth_providers: undefined;
389
+ enabled_oauth_providers: undefined;
390
+ domains: undefined;
391
+ email_config: {
392
+ type: undefined;
393
+ host: undefined;
394
+ port: undefined;
395
+ username: undefined;
396
+ password: undefined;
397
+ sender_name: undefined;
398
+ sender_email: undefined;
399
+ };
400
+ create_team_on_sign_up: undefined;
401
+ team_creator_default_permissions: undefined;
402
+ team_member_default_permissions: undefined;
403
+ };
404
+ }, "">;
405
+ clientCreateSchema: import("yup").ObjectSchema<{
406
+ display_name: string;
407
+ description: string | null | undefined;
408
+ is_production_mode: boolean | undefined;
409
+ config: {
410
+ allow_localhost?: boolean | undefined;
411
+ credential_enabled?: boolean | undefined;
412
+ magic_link_enabled?: boolean | undefined;
413
+ oauth_providers?: {
414
+ client_id?: string | undefined;
415
+ client_secret?: string | undefined;
416
+ type: NonNullable<"shared" | "standard" | undefined>;
417
+ id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
418
+ enabled: NonNullable<boolean | undefined>;
419
+ }[] | undefined;
420
+ domains?: {
421
+ domain: string;
422
+ handler_path: string;
423
+ }[] | undefined;
424
+ email_config?: {
425
+ host?: string | undefined;
426
+ port?: number | undefined;
427
+ username?: string | undefined;
428
+ password?: string | undefined;
429
+ sender_name?: string | undefined;
430
+ sender_email?: string | undefined;
431
+ type: NonNullable<"shared" | "standard" | undefined>;
432
+ } | undefined;
433
+ create_team_on_sign_up?: boolean | undefined;
434
+ team_creator_default_permissions?: {
435
+ id: string;
436
+ }[] | undefined;
437
+ team_member_default_permissions?: {
438
+ id: string;
439
+ }[] | undefined;
440
+ } | undefined;
441
+ } & {
442
+ display_name: string;
443
+ }, import("yup").AnyObject, {
444
+ display_name: undefined;
445
+ description: undefined;
446
+ is_production_mode: undefined;
447
+ config: undefined;
448
+ }, "">;
449
+ docs: {
450
+ clientList: {
451
+ hidden: true;
452
+ };
453
+ clientCreate: {
454
+ hidden: true;
455
+ };
456
+ };
457
+ }>;
458
+ export type InternalProjectsCrud = CrudTypeOf<typeof internalProjectsCrud>;
@@ -0,0 +1,112 @@
1
+ import { createCrud } from "../../crud";
2
+ import * as schemaFields from "../../schema-fields";
3
+ import { yupArray, yupObject, yupRequiredWhen, yupString } from "../../schema-fields";
4
+ const teamPermissionSchema = yupObject({
5
+ id: yupString().required(),
6
+ }).required();
7
+ const oauthProviderSchema = yupObject({
8
+ id: schemaFields.oauthIdSchema.required(),
9
+ enabled: schemaFields.oauthEnabledSchema.required(),
10
+ type: schemaFields.oauthTypeSchema.required(),
11
+ client_id: yupRequiredWhen(schemaFields.oauthClientIdSchema, 'type', 'standard'),
12
+ client_secret: yupRequiredWhen(schemaFields.oauthClientSecretSchema, 'type', 'standard'),
13
+ });
14
+ const enabledOAuthProviderSchema = yupObject({
15
+ id: schemaFields.oauthIdSchema.required(),
16
+ });
17
+ const emailConfigSchema = yupObject({
18
+ type: schemaFields.emailTypeSchema.required(),
19
+ host: yupRequiredWhen(schemaFields.emailHostSchema, 'type', 'standard'),
20
+ port: yupRequiredWhen(schemaFields.emailPortSchema, 'type', 'standard'),
21
+ username: yupRequiredWhen(schemaFields.emailUsernameSchema, 'type', 'standard'),
22
+ password: yupRequiredWhen(schemaFields.emailPasswordSchema, 'type', 'standard'),
23
+ sender_name: yupRequiredWhen(schemaFields.emailSenderNameSchema, 'type', 'standard'),
24
+ sender_email: yupRequiredWhen(schemaFields.emailSenderEmailSchema, 'type', 'standard'),
25
+ });
26
+ const domainSchema = yupObject({
27
+ domain: schemaFields.domainSchema.required(),
28
+ handler_path: schemaFields.handlerPathSchema.required(),
29
+ });
30
+ export const projectsCrudServerReadSchema = yupObject({
31
+ id: schemaFields.projectIdSchema.required(),
32
+ display_name: schemaFields.projectDisplayNameSchema.required(),
33
+ description: schemaFields.projectDescriptionSchema.nonNullable().defined(),
34
+ created_at_millis: schemaFields.projectCreatedAtMillisSchema.required(),
35
+ user_count: schemaFields.projectUserCountSchema.required(),
36
+ is_production_mode: schemaFields.projectIsProductionModeSchema.required(),
37
+ config: yupObject({
38
+ id: schemaFields.projectConfigIdSchema.required(),
39
+ allow_localhost: schemaFields.projectAllowLocalhostSchema.required(),
40
+ credential_enabled: schemaFields.projectCredentialEnabledSchema.required(),
41
+ magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.required(),
42
+ oauth_providers: yupArray(oauthProviderSchema.required()).required(),
43
+ enabled_oauth_providers: yupArray(enabledOAuthProviderSchema.required()).required(),
44
+ domains: yupArray(domainSchema.required()).required(),
45
+ email_config: emailConfigSchema.required(),
46
+ create_team_on_sign_up: schemaFields.projectCreateTeamOnSignUpSchema.required(),
47
+ team_creator_default_permissions: yupArray(teamPermissionSchema.required()).required(),
48
+ team_member_default_permissions: yupArray(teamPermissionSchema.required()).required(),
49
+ }).required(),
50
+ }).required();
51
+ export const projectsCrudClientReadSchema = yupObject({
52
+ id: schemaFields.projectIdSchema.required(),
53
+ display_name: schemaFields.projectDisplayNameSchema.required(),
54
+ config: yupObject({
55
+ credential_enabled: schemaFields.projectCredentialEnabledSchema.required(),
56
+ magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.required(),
57
+ enabled_oauth_providers: yupArray(enabledOAuthProviderSchema.required()).required(),
58
+ }).required(),
59
+ }).required();
60
+ export const projectsCrudServerUpdateSchema = yupObject({
61
+ display_name: schemaFields.projectDisplayNameSchema.optional(),
62
+ description: schemaFields.projectDescriptionSchema.optional(),
63
+ is_production_mode: schemaFields.projectIsProductionModeSchema.optional(),
64
+ config: yupObject({
65
+ credential_enabled: schemaFields.projectCredentialEnabledSchema.optional(),
66
+ magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.optional(),
67
+ allow_localhost: schemaFields.projectAllowLocalhostSchema.optional(),
68
+ email_config: emailConfigSchema.optional().default(undefined),
69
+ domains: yupArray(domainSchema.required()).optional().default(undefined),
70
+ oauth_providers: yupArray(oauthProviderSchema.required()).optional().default(undefined),
71
+ create_team_on_sign_up: schemaFields.projectCreateTeamOnSignUpSchema.optional(),
72
+ team_creator_default_permissions: yupArray(teamPermissionSchema.required()).optional(),
73
+ team_member_default_permissions: yupArray(teamPermissionSchema.required()).optional(),
74
+ }).optional().default(undefined),
75
+ }).required();
76
+ export const projectsCrudServerCreateSchema = projectsCrudServerUpdateSchema.concat(yupObject({
77
+ display_name: schemaFields.projectDisplayNameSchema.required(),
78
+ }).required());
79
+ export const projectsCrud = createCrud({
80
+ clientReadSchema: projectsCrudClientReadSchema,
81
+ serverReadSchema: projectsCrudServerReadSchema,
82
+ serverUpdateSchema: projectsCrudServerUpdateSchema,
83
+ docs: {
84
+ clientRead: {
85
+ summary: 'Get the current project',
86
+ description: 'Get the current project information including display name, oauth providers and authentication methods. Useful for display the available login options to the user.',
87
+ tags: ['Projects'],
88
+ },
89
+ serverRead: {
90
+ summary: 'Get the current project',
91
+ description: 'Get the current project information and configuration including display name, oauth providers, email configuration, etc.',
92
+ tags: ['Projects'],
93
+ },
94
+ serverUpdate: {
95
+ summary: 'Update the current project',
96
+ description: 'Update the current project information and configuration including display name, oauth providers, email configuration, etc.',
97
+ tags: ['Projects'],
98
+ },
99
+ },
100
+ });
101
+ export const internalProjectsCrud = createCrud({
102
+ clientReadSchema: projectsCrudServerReadSchema,
103
+ clientCreateSchema: projectsCrudServerCreateSchema,
104
+ docs: {
105
+ clientList: {
106
+ hidden: true,
107
+ },
108
+ clientCreate: {
109
+ hidden: true,
110
+ },
111
+ },
112
+ });
@@ -0,0 +1,22 @@
1
+ import { CrudTypeOf } from "../../crud";
2
+ export declare const teamMembershipsCrudServerReadSchema: import("yup").ObjectSchema<{}, import("yup").AnyObject, {}, "">;
3
+ export declare const teamMembershipsCrudServerCreateSchema: import("yup").ObjectSchema<{}, import("yup").AnyObject, {}, "">;
4
+ export declare const teamMembershipsCrudServerDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
5
+ export declare const teamMembershipsCrud: import("../../crud").CrudSchemaFromOptions<{
6
+ serverReadSchema: import("yup").ObjectSchema<{}, import("yup").AnyObject, {}, "">;
7
+ serverCreateSchema: import("yup").ObjectSchema<{}, import("yup").AnyObject, {}, "">;
8
+ serverDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
9
+ docs: {
10
+ serverCreate: {
11
+ summary: string;
12
+ description: string;
13
+ tags: string[];
14
+ };
15
+ serverDelete: {
16
+ summary: string;
17
+ description: string;
18
+ tags: string[];
19
+ };
20
+ };
21
+ }>;
22
+ export type TeamMembershipsCrud = CrudTypeOf<typeof teamMembershipsCrud>;
@@ -0,0 +1,22 @@
1
+ import { createCrud } from "../../crud";
2
+ import { yupMixed, yupObject } from "../../schema-fields";
3
+ export const teamMembershipsCrudServerReadSchema = yupObject({}).required();
4
+ export const teamMembershipsCrudServerCreateSchema = yupObject({}).required();
5
+ export const teamMembershipsCrudServerDeleteSchema = yupMixed();
6
+ export const teamMembershipsCrud = createCrud({
7
+ serverReadSchema: teamMembershipsCrudServerReadSchema,
8
+ serverCreateSchema: teamMembershipsCrudServerCreateSchema,
9
+ serverDeleteSchema: teamMembershipsCrudServerDeleteSchema,
10
+ docs: {
11
+ serverCreate: {
12
+ summary: "Add a user to a team",
13
+ description: "",
14
+ tags: ["Teams"],
15
+ },
16
+ serverDelete: {
17
+ summary: "Remove a user from a team",
18
+ description: "",
19
+ tags: ["Teams"],
20
+ },
21
+ },
22
+ });