@stackframe/stack-shared 2.5.2 → 2.5.4

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