@stackframe/stack-shared 2.5.17 → 2.5.19

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 (32) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/interface/adminInterface.d.ts +1 -0
  3. package/dist/interface/adminInterface.js +5 -0
  4. package/dist/interface/clientInterface.d.ts +33 -0
  5. package/dist/interface/clientInterface.js +96 -4
  6. package/dist/interface/crud/current-user.d.ts +8 -0
  7. package/dist/interface/crud/current-user.js +2 -0
  8. package/dist/interface/crud/email-templates.d.ts +5 -5
  9. package/dist/interface/crud/email-templates.js +1 -1
  10. package/dist/interface/crud/projects.d.ts +42 -7
  11. package/dist/interface/crud/projects.js +22 -9
  12. package/dist/interface/crud/team-invitation-details.d.ts +25 -0
  13. package/dist/interface/crud/team-invitation-details.js +17 -0
  14. package/dist/interface/crud/team-member-profiles.d.ts +166 -0
  15. package/dist/interface/crud/team-member-profiles.js +5 -0
  16. package/dist/interface/crud/users.d.ts +16 -0
  17. package/dist/interface/crud/users.js +7 -2
  18. package/dist/interface/crud-deprecated/email-templates.d.ts +5 -5
  19. package/dist/interface/crud-deprecated/email-templates.js +1 -1
  20. package/dist/interface/serverInterface.d.ts +12 -4
  21. package/dist/interface/serverInterface.js +27 -4
  22. package/dist/interface/webhooks.d.ts +4 -0
  23. package/dist/known-errors.d.ts +12 -0
  24. package/dist/known-errors.js +29 -1
  25. package/dist/schema-fields.d.ts +5 -0
  26. package/dist/schema-fields.js +22 -10
  27. package/dist/utils/bytes.d.ts +4 -0
  28. package/dist/utils/bytes.js +36 -0
  29. package/dist/utils/crypto.d.ts +1 -1
  30. package/dist/utils/errors.d.ts +7 -1
  31. package/dist/utils/errors.js +7 -1
  32. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @stackframe/stack-shared
2
2
 
3
+ ## 2.5.19
4
+
5
+ ### Patch Changes
6
+
7
+ - Team frontend components
8
+ - Updated dependencies
9
+ - @stackframe/stack-sc@2.5.19
10
+
11
+ ## 2.5.18
12
+
13
+ ### Patch Changes
14
+
15
+ - Multi-factor authentication
16
+ - @stackframe/stack-sc@2.5.18
17
+
3
18
  ## 2.5.17
4
19
 
5
20
  ### Patch Changes
@@ -45,4 +45,5 @@ export declare class StackAdminInterface extends StackServerInterface {
45
45
  updatePermissionDefinition(permissionId: string, data: TeamPermissionDefinitionsCrud['Admin']['Update']): Promise<TeamPermissionDefinitionsCrud['Admin']['Read']>;
46
46
  deletePermissionDefinition(permissionId: string): Promise<void>;
47
47
  getSvixToken(): Promise<SvixTokenCrud["Admin"]["Read"]>;
48
+ deleteProject(): Promise<void>;
48
49
  }
@@ -115,4 +115,9 @@ export class StackAdminInterface extends StackServerInterface {
115
115
  }, null);
116
116
  return await response.json();
117
117
  }
118
+ async deleteProject() {
119
+ await this.sendAdminRequest("/projects/current", {
120
+ method: "DELETE",
121
+ }, null);
122
+ }
118
123
  }
@@ -5,6 +5,7 @@ import { Result } from "../utils/results";
5
5
  import { CurrentUserCrud } from './crud/current-user';
6
6
  import { ConnectedAccountAccessTokenCrud } from './crud/oauth';
7
7
  import { InternalProjectsCrud, ProjectsCrud } from './crud/projects';
8
+ import { TeamMemberProfilesCrud } from './crud/team-member-profiles';
8
9
  import { TeamPermissionsCrud } from './crud/team-permissions';
9
10
  import { TeamsCrud } from './crud/teams';
10
11
  export type ClientInterfaceOptions = {
@@ -65,6 +66,24 @@ export declare class StackClientInterface {
65
66
  }, session: InternalSession): Promise<KnownErrors["PasswordConfirmationMismatch"] | KnownErrors["PasswordRequirementsNotMet"] | undefined>;
66
67
  verifyPasswordResetCode(code: string): Promise<KnownErrors["VerificationCodeError"] | undefined>;
67
68
  verifyEmail(code: string): Promise<KnownErrors["VerificationCodeError"] | undefined>;
69
+ sendTeamInvitation(options: {
70
+ email: string;
71
+ teamId: string;
72
+ callbackUrl: string;
73
+ session: InternalSession | null;
74
+ }): Promise<Result<undefined, KnownErrors["TeamPermissionRequired"]>>;
75
+ acceptTeamInvitation<T extends 'use' | 'details' | 'check'>(options: {
76
+ code: string;
77
+ session: InternalSession;
78
+ type: T;
79
+ }): Promise<Result<T extends 'details' ? {
80
+ team_display_name: string;
81
+ } : undefined, KnownErrors["VerificationCodeError"]>>;
82
+ totpMfa(attemptCode: string, totp: string, session: InternalSession): Promise<{
83
+ accessToken: any;
84
+ refreshToken: any;
85
+ newUser: any;
86
+ }>;
68
87
  signInWithCredential(email: string, password: string, session: InternalSession): Promise<KnownErrors["EmailPasswordMismatch"] | {
69
88
  accessToken: string;
70
89
  refreshToken: string;
@@ -106,6 +125,20 @@ export declare class StackClientInterface {
106
125
  }>;
107
126
  signOut(session: InternalSession): Promise<void>;
108
127
  getClientUserByToken(session: InternalSession): Promise<CurrentUserCrud["Client"]["Read"] | null>;
128
+ listTeamMemberProfiles(options: {
129
+ teamId?: string;
130
+ userId?: string;
131
+ }, session: InternalSession): Promise<TeamMemberProfilesCrud['Client']['Read'][]>;
132
+ getTeamMemberProfile(options: {
133
+ teamId: string;
134
+ userId: string;
135
+ }, session: InternalSession): Promise<TeamMemberProfilesCrud['Client']['Read']>;
136
+ leaveTeam(teamId: string, session: InternalSession): Promise<void>;
137
+ updateTeamMemberProfile(options: {
138
+ teamId: string;
139
+ userId: string;
140
+ profile: TeamMemberProfilesCrud['Client']['Update'];
141
+ }, session: InternalSession): Promise<void>;
109
142
  listCurrentUserTeamPermissions(options: {
110
143
  teamId: string;
111
144
  recursive: boolean;
@@ -5,6 +5,7 @@ import { AccessToken, InternalSession } from '../sessions';
5
5
  import { generateSecureRandomString } from '../utils/crypto';
6
6
  import { StackAssertionError, throwErr } from '../utils/errors';
7
7
  import { globalVar } from '../utils/globals';
8
+ import { filterUndefined } from '../utils/objects';
8
9
  import { Result } from "../utils/results";
9
10
  import { deindent } from '../utils/strings';
10
11
  export class StackClientInterface {
@@ -219,7 +220,6 @@ export class StackClientInterface {
219
220
  catch (e) {
220
221
  if (e instanceof TypeError) {
221
222
  // Network error, retry
222
- console.warn(`Stack detected a network error while fetching ${url}, retrying.`, e, { url });
223
223
  return Result.error(e);
224
224
  }
225
225
  throw e;
@@ -386,6 +386,65 @@ export class StackClientInterface {
386
386
  return res.error;
387
387
  }
388
388
  }
389
+ async sendTeamInvitation(options) {
390
+ const res = await this.sendClientRequestAndCatchKnownError("/team-invitations/send-code", {
391
+ method: "POST",
392
+ headers: {
393
+ "Content-Type": "application/json"
394
+ },
395
+ body: JSON.stringify({
396
+ email: options.email,
397
+ team_id: options.teamId,
398
+ callback_url: options.callbackUrl,
399
+ }),
400
+ }, options.session, [KnownErrors.TeamPermissionRequired]);
401
+ if (res.status === "error") {
402
+ return Result.error(res.error);
403
+ }
404
+ else {
405
+ return Result.ok(undefined);
406
+ }
407
+ }
408
+ async acceptTeamInvitation(options) {
409
+ const res = await this.sendClientRequestAndCatchKnownError(options.type === 'check' ?
410
+ "/team-invitations/accept/check-code" :
411
+ options.type === 'details' ?
412
+ "/team-invitations/accept/details" :
413
+ "/team-invitations/accept", {
414
+ method: "POST",
415
+ headers: {
416
+ "Content-Type": "application/json"
417
+ },
418
+ body: JSON.stringify({
419
+ code: options.code,
420
+ }),
421
+ }, options.session, [KnownErrors.VerificationCodeError]);
422
+ if (res.status === "error") {
423
+ return Result.error(res.error);
424
+ }
425
+ else {
426
+ return Result.ok(await res.data.json());
427
+ }
428
+ }
429
+ async totpMfa(attemptCode, totp, session) {
430
+ const res = await this.sendClientRequest("/auth/mfa/sign-in", {
431
+ method: "POST",
432
+ headers: {
433
+ "Content-Type": "application/json"
434
+ },
435
+ body: JSON.stringify({
436
+ code: attemptCode,
437
+ type: "totp",
438
+ totp: totp,
439
+ }),
440
+ }, session);
441
+ const result = await res.json();
442
+ return {
443
+ accessToken: result.access_token,
444
+ refreshToken: result.refresh_token,
445
+ newUser: result.is_new_user,
446
+ };
447
+ }
389
448
  async signInWithCredential(email, password, session) {
390
449
  const res = await this.sendClientRequestAndCatchKnownError("/auth/password/sign-in", {
391
450
  method: "POST",
@@ -444,7 +503,7 @@ export class StackClientInterface {
444
503
  return {
445
504
  accessToken: result.access_token,
446
505
  refreshToken: result.refresh_token,
447
- newUser: result.new_user,
506
+ newUser: result.is_new_user,
448
507
  };
449
508
  }
450
509
  async getOAuthUrl(options) {
@@ -505,12 +564,15 @@ export class StackClientInterface {
505
564
  const response = await oauth.authorizationCodeGrantRequest(as, client, params, options.redirectUri, options.codeVerifier);
506
565
  const result = await oauth.processAuthorizationCodeOAuth2Response(as, client, response);
507
566
  if (oauth.isOAuth2Error(result)) {
567
+ if ("code" in result && result.code === "MULTI_FACTOR_AUTHENTICATION_REQUIRED") {
568
+ throw new KnownErrors.MultiFactorAuthenticationRequired(result.details.attempt_code);
569
+ }
508
570
  // TODO Handle OAuth 2.0 response body error
509
571
  throw new StackAssertionError("Outer OAuth error during authorization code response", { result });
510
572
  }
511
573
  return {
512
- newUser: result.newUser,
513
- afterCallbackRedirectUrl: result.afterCallbackRedirectUrl,
574
+ newUser: result.is_new_user,
575
+ afterCallbackRedirectUrl: result.after_callback_redirect_url,
514
576
  accessToken: result.access_token,
515
577
  refreshToken: result.refresh_token ?? throwErr("Refresh token not found in outer OAuth response"),
516
578
  };
@@ -556,6 +618,36 @@ export class StackClientInterface {
556
618
  throw new StackAssertionError("User endpoint returned null; this should never happen");
557
619
  return user;
558
620
  }
621
+ async listTeamMemberProfiles(options, session) {
622
+ const response = await this.sendClientRequest("/team-member-profiles?" + new URLSearchParams(filterUndefined({
623
+ team_id: options.teamId,
624
+ user_id: options.userId,
625
+ })), {}, session);
626
+ const result = await response.json();
627
+ return result.items;
628
+ }
629
+ async getTeamMemberProfile(options, session) {
630
+ const response = await this.sendClientRequest(`/team-member-profiles/${options.teamId}/${options.userId}`, {}, session);
631
+ return await response.json();
632
+ }
633
+ async leaveTeam(teamId, session) {
634
+ await this.sendClientRequest(`/team-memberships/${teamId}/me`, {
635
+ method: "DELETE",
636
+ headers: {
637
+ "content-type": "application/json",
638
+ },
639
+ body: JSON.stringify({}),
640
+ }, session);
641
+ }
642
+ async updateTeamMemberProfile(options, session) {
643
+ await this.sendClientRequest(`/team-member-profiles/${options.teamId}/${options.userId}`, {
644
+ method: "PATCH",
645
+ headers: {
646
+ "content-type": "application/json",
647
+ },
648
+ body: JSON.stringify(options.profile),
649
+ }, session);
650
+ }
559
651
  async listCurrentUserTeamPermissions(options, session) {
560
652
  const response = await this.sendClientRequest(`/team-permissions?team_id=${options.teamId}&user_id=me&recursive=${options.recursive}`, {}, session);
561
653
  const result = await response.json();
@@ -16,6 +16,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
16
16
  signed_up_at_millis: number;
17
17
  has_password: NonNullable<boolean | undefined>;
18
18
  auth_with_email: NonNullable<boolean | undefined>;
19
+ requires_totp_mfa: NonNullable<boolean | undefined>;
19
20
  auth_methods: ({
20
21
  type: "password";
21
22
  identifier: string;
@@ -60,6 +61,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
60
61
  signed_up_at_millis: undefined;
61
62
  has_password: undefined;
62
63
  auth_with_email: undefined;
64
+ requires_totp_mfa: undefined;
63
65
  oauth_providers: undefined;
64
66
  auth_methods: undefined;
65
67
  connected_accounts: undefined;
@@ -82,6 +84,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
82
84
  signed_up_at_millis: number;
83
85
  has_password: NonNullable<boolean | undefined>;
84
86
  auth_with_email: NonNullable<boolean | undefined>;
87
+ requires_totp_mfa: NonNullable<boolean | undefined>;
85
88
  oauth_providers: {
86
89
  email?: string | null | undefined;
87
90
  id: string;
@@ -128,6 +131,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
128
131
  signed_up_at_millis: undefined;
129
132
  has_password: undefined;
130
133
  auth_with_email: undefined;
134
+ requires_totp_mfa: undefined;
131
135
  oauth_providers: undefined;
132
136
  auth_methods: undefined;
133
137
  connected_accounts: undefined;
@@ -137,6 +141,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
137
141
  clientUpdateSchema: import("yup").ObjectSchema<{
138
142
  display_name: string | null | undefined;
139
143
  client_metadata: {} | null | undefined;
144
+ totp_secret_base64: string | null | undefined;
140
145
  selected_team_id: string | null | undefined;
141
146
  }, import("yup").AnyObject, {
142
147
  display_name: undefined;
@@ -147,6 +152,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
147
152
  primary_email_verified: undefined;
148
153
  primary_email_auth_enabled: undefined;
149
154
  password: undefined;
155
+ totp_secret_base64: undefined;
150
156
  selected_team_id: undefined;
151
157
  }, "">;
152
158
  serverUpdateSchema: import("yup").ObjectSchema<{
@@ -158,6 +164,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
158
164
  primary_email_verified: boolean | undefined;
159
165
  primary_email_auth_enabled: boolean | undefined;
160
166
  password: string | null | undefined;
167
+ totp_secret_base64: string | null | undefined;
161
168
  selected_team_id: string | null | undefined;
162
169
  }, import("yup").AnyObject, {
163
170
  display_name: undefined;
@@ -168,6 +175,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
168
175
  primary_email_verified: undefined;
169
176
  primary_email_auth_enabled: undefined;
170
177
  password: undefined;
178
+ totp_secret_base64: undefined;
171
179
  selected_team_id: undefined;
172
180
  }, "">;
173
181
  serverDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
@@ -6,6 +6,7 @@ const clientUpdateSchema = usersCrudServerUpdateSchema.pick([
6
6
  "display_name",
7
7
  "client_metadata",
8
8
  "selected_team_id",
9
+ "totp_secret_base64",
9
10
  ]).required();
10
11
  const serverUpdateSchema = usersCrudServerUpdateSchema;
11
12
  const clientReadSchema = usersCrudServerReadSchema.pick([
@@ -22,6 +23,7 @@ const clientReadSchema = usersCrudServerReadSchema.pick([
22
23
  "selected_team_id",
23
24
  "auth_methods",
24
25
  "connected_accounts",
26
+ "requires_totp_mfa",
25
27
  ]).concat(yupObject({
26
28
  selected_team: teamsCrudClientReadSchema.nullable().defined(),
27
29
  })).nullable().defined(); // TODO: next-release: make required
@@ -1,8 +1,8 @@
1
1
  import { CrudTypeOf } from "../../crud";
2
2
  export type EmailTemplateType = typeof emailTemplateTypes[number];
3
- export declare const emailTemplateTypes: readonly ["email_verification", "password_reset", "magic_link"];
3
+ export declare const emailTemplateTypes: readonly ["email_verification", "password_reset", "magic_link", "team_invitation"];
4
4
  export declare const emailTemplateAdminReadSchema: import("yup").ObjectSchema<{
5
- type: NonNullable<"email_verification" | "password_reset" | "magic_link" | undefined>;
5
+ type: NonNullable<"email_verification" | "password_reset" | "magic_link" | "team_invitation" | undefined>;
6
6
  subject: string;
7
7
  content: {};
8
8
  is_default: NonNullable<boolean | undefined>;
@@ -21,7 +21,7 @@ export declare const emailTemplateCrudAdminUpdateSchema: import("yup").ObjectSch
21
21
  }, "">;
22
22
  export declare const emailTemplateCrudAdminDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
23
23
  export declare const emailTemplateCrudAdminCreateSchema: import("yup").ObjectSchema<{
24
- type: NonNullable<"email_verification" | "password_reset" | "magic_link" | undefined>;
24
+ type: NonNullable<"email_verification" | "password_reset" | "magic_link" | "team_invitation" | undefined>;
25
25
  content: {};
26
26
  subject: string;
27
27
  }, import("yup").AnyObject, {
@@ -31,7 +31,7 @@ export declare const emailTemplateCrudAdminCreateSchema: import("yup").ObjectSch
31
31
  }, "">;
32
32
  export declare const emailTemplateCrud: import("../../crud").CrudSchemaFromOptions<{
33
33
  adminReadSchema: import("yup").ObjectSchema<{
34
- type: NonNullable<"email_verification" | "password_reset" | "magic_link" | undefined>;
34
+ type: NonNullable<"email_verification" | "password_reset" | "magic_link" | "team_invitation" | undefined>;
35
35
  subject: string;
36
36
  content: {};
37
37
  is_default: NonNullable<boolean | undefined>;
@@ -49,7 +49,7 @@ export declare const emailTemplateCrud: import("../../crud").CrudSchemaFromOptio
49
49
  subject: undefined;
50
50
  }, "">;
51
51
  adminCreateSchema: import("yup").ObjectSchema<{
52
- type: NonNullable<"email_verification" | "password_reset" | "magic_link" | undefined>;
52
+ type: NonNullable<"email_verification" | "password_reset" | "magic_link" | "team_invitation" | undefined>;
53
53
  content: {};
54
54
  subject: string;
55
55
  }, import("yup").AnyObject, {
@@ -1,6 +1,6 @@
1
1
  import { createCrud } from "../../crud";
2
2
  import { jsonSchema, yupBoolean, yupMixed, yupObject, yupString } from "../../schema-fields";
3
- export const emailTemplateTypes = ['email_verification', 'password_reset', 'magic_link'];
3
+ export const emailTemplateTypes = ['email_verification', 'password_reset', 'magic_link', 'team_invitation'];
4
4
  export const emailTemplateAdminReadSchema = yupObject({
5
5
  type: yupString().oneOf(emailTemplateTypes).required(),
6
6
  subject: yupString().required(),
@@ -1,5 +1,5 @@
1
1
  import { CrudTypeOf } from "../../crud";
2
- export declare const projectsCrudServerReadSchema: import("yup").ObjectSchema<{
2
+ export declare const projectsCrudAdminReadSchema: import("yup").ObjectSchema<{
3
3
  id: string;
4
4
  display_name: string;
5
5
  description: string;
@@ -9,8 +9,10 @@ export declare const projectsCrudServerReadSchema: import("yup").ObjectSchema<{
9
9
  config: {
10
10
  id: string;
11
11
  allow_localhost: NonNullable<boolean | undefined>;
12
+ sign_up_enabled: NonNullable<boolean | undefined>;
12
13
  credential_enabled: NonNullable<boolean | undefined>;
13
14
  magic_link_enabled: NonNullable<boolean | undefined>;
15
+ client_team_creation_enabled: NonNullable<boolean | undefined>;
14
16
  oauth_providers: {
15
17
  client_id?: string | undefined;
16
18
  client_secret?: string | undefined;
@@ -53,8 +55,10 @@ export declare const projectsCrudServerReadSchema: import("yup").ObjectSchema<{
53
55
  config: {
54
56
  id: undefined;
55
57
  allow_localhost: undefined;
58
+ sign_up_enabled: undefined;
56
59
  credential_enabled: undefined;
57
60
  magic_link_enabled: undefined;
61
+ client_team_creation_enabled: undefined;
58
62
  oauth_providers: undefined;
59
63
  enabled_oauth_providers: undefined;
60
64
  domains: undefined;
@@ -76,8 +80,10 @@ export declare const projectsCrudClientReadSchema: import("yup").ObjectSchema<{
76
80
  id: string;
77
81
  display_name: string;
78
82
  config: {
83
+ sign_up_enabled: NonNullable<boolean | undefined>;
79
84
  credential_enabled: NonNullable<boolean | undefined>;
80
85
  magic_link_enabled: NonNullable<boolean | undefined>;
86
+ client_team_creation_enabled: NonNullable<boolean | undefined>;
81
87
  enabled_oauth_providers: {
82
88
  id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
83
89
  }[];
@@ -86,19 +92,23 @@ export declare const projectsCrudClientReadSchema: import("yup").ObjectSchema<{
86
92
  id: undefined;
87
93
  display_name: undefined;
88
94
  config: {
95
+ sign_up_enabled: undefined;
89
96
  credential_enabled: undefined;
90
97
  magic_link_enabled: undefined;
98
+ client_team_creation_enabled: undefined;
91
99
  enabled_oauth_providers: undefined;
92
100
  };
93
101
  }, "">;
94
- export declare const projectsCrudServerUpdateSchema: import("yup").ObjectSchema<{
102
+ export declare const projectsCrudAdminUpdateSchema: import("yup").ObjectSchema<{
95
103
  display_name: string | undefined;
96
104
  description: string | null | undefined;
97
105
  is_production_mode: boolean | undefined;
98
106
  config: {
99
107
  allow_localhost?: boolean | undefined;
108
+ sign_up_enabled?: boolean | undefined;
100
109
  credential_enabled?: boolean | undefined;
101
110
  magic_link_enabled?: boolean | undefined;
111
+ client_team_creation_enabled?: boolean | undefined;
102
112
  oauth_providers?: {
103
113
  client_id?: string | undefined;
104
114
  client_secret?: string | undefined;
@@ -134,14 +144,16 @@ export declare const projectsCrudServerUpdateSchema: import("yup").ObjectSchema<
134
144
  is_production_mode: undefined;
135
145
  config: undefined;
136
146
  }, "">;
137
- export declare const projectsCrudServerCreateSchema: import("yup").ObjectSchema<{
147
+ export declare const projectsCrudAdminCreateSchema: import("yup").ObjectSchema<{
138
148
  display_name: string;
139
149
  description: string | null | undefined;
140
150
  is_production_mode: boolean | undefined;
141
151
  config: {
142
152
  allow_localhost?: boolean | undefined;
153
+ sign_up_enabled?: boolean | undefined;
143
154
  credential_enabled?: boolean | undefined;
144
155
  magic_link_enabled?: boolean | undefined;
156
+ client_team_creation_enabled?: boolean | undefined;
145
157
  oauth_providers?: {
146
158
  client_id?: string | undefined;
147
159
  client_secret?: string | undefined;
@@ -179,13 +191,16 @@ export declare const projectsCrudServerCreateSchema: import("yup").ObjectSchema<
179
191
  is_production_mode: undefined;
180
192
  config: undefined;
181
193
  }, "">;
194
+ export declare const projectsCrudAdminDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
182
195
  export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
183
196
  clientReadSchema: import("yup").ObjectSchema<{
184
197
  id: string;
185
198
  display_name: string;
186
199
  config: {
200
+ sign_up_enabled: NonNullable<boolean | undefined>;
187
201
  credential_enabled: NonNullable<boolean | undefined>;
188
202
  magic_link_enabled: NonNullable<boolean | undefined>;
203
+ client_team_creation_enabled: NonNullable<boolean | undefined>;
189
204
  enabled_oauth_providers: {
190
205
  id: NonNullable<"google" | "github" | "facebook" | "microsoft" | "spotify" | undefined>;
191
206
  }[];
@@ -194,12 +209,14 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
194
209
  id: undefined;
195
210
  display_name: undefined;
196
211
  config: {
212
+ sign_up_enabled: undefined;
197
213
  credential_enabled: undefined;
198
214
  magic_link_enabled: undefined;
215
+ client_team_creation_enabled: undefined;
199
216
  enabled_oauth_providers: undefined;
200
217
  };
201
218
  }, "">;
202
- serverReadSchema: import("yup").ObjectSchema<{
219
+ adminReadSchema: import("yup").ObjectSchema<{
203
220
  id: string;
204
221
  display_name: string;
205
222
  description: string;
@@ -209,8 +226,10 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
209
226
  config: {
210
227
  id: string;
211
228
  allow_localhost: NonNullable<boolean | undefined>;
229
+ sign_up_enabled: NonNullable<boolean | undefined>;
212
230
  credential_enabled: NonNullable<boolean | undefined>;
213
231
  magic_link_enabled: NonNullable<boolean | undefined>;
232
+ client_team_creation_enabled: NonNullable<boolean | undefined>;
214
233
  oauth_providers: {
215
234
  client_id?: string | undefined;
216
235
  client_secret?: string | undefined;
@@ -253,8 +272,10 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
253
272
  config: {
254
273
  id: undefined;
255
274
  allow_localhost: undefined;
275
+ sign_up_enabled: undefined;
256
276
  credential_enabled: undefined;
257
277
  magic_link_enabled: undefined;
278
+ client_team_creation_enabled: undefined;
258
279
  oauth_providers: undefined;
259
280
  enabled_oauth_providers: undefined;
260
281
  domains: undefined;
@@ -272,14 +293,16 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
272
293
  team_member_default_permissions: undefined;
273
294
  };
274
295
  }, "">;
275
- serverUpdateSchema: import("yup").ObjectSchema<{
296
+ adminUpdateSchema: import("yup").ObjectSchema<{
276
297
  display_name: string | undefined;
277
298
  description: string | null | undefined;
278
299
  is_production_mode: boolean | undefined;
279
300
  config: {
280
301
  allow_localhost?: boolean | undefined;
302
+ sign_up_enabled?: boolean | undefined;
281
303
  credential_enabled?: boolean | undefined;
282
304
  magic_link_enabled?: boolean | undefined;
305
+ client_team_creation_enabled?: boolean | undefined;
283
306
  oauth_providers?: {
284
307
  client_id?: string | undefined;
285
308
  client_secret?: string | undefined;
@@ -315,18 +338,24 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
315
338
  is_production_mode: undefined;
316
339
  config: undefined;
317
340
  }, "">;
341
+ adminDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
318
342
  docs: {
319
343
  clientRead: {
320
344
  summary: string;
321
345
  description: string;
322
346
  tags: string[];
323
347
  };
324
- serverRead: {
348
+ adminRead: {
325
349
  summary: string;
326
350
  description: string;
327
351
  tags: string[];
328
352
  };
329
- serverUpdate: {
353
+ adminUpdate: {
354
+ summary: string;
355
+ description: string;
356
+ tags: string[];
357
+ };
358
+ adminDelete: {
330
359
  summary: string;
331
360
  description: string;
332
361
  tags: string[];
@@ -345,8 +374,10 @@ export declare const internalProjectsCrud: import("../../crud").CrudSchemaFromOp
345
374
  config: {
346
375
  id: string;
347
376
  allow_localhost: NonNullable<boolean | undefined>;
377
+ sign_up_enabled: NonNullable<boolean | undefined>;
348
378
  credential_enabled: NonNullable<boolean | undefined>;
349
379
  magic_link_enabled: NonNullable<boolean | undefined>;
380
+ client_team_creation_enabled: NonNullable<boolean | undefined>;
350
381
  oauth_providers: {
351
382
  client_id?: string | undefined;
352
383
  client_secret?: string | undefined;
@@ -389,8 +420,10 @@ export declare const internalProjectsCrud: import("../../crud").CrudSchemaFromOp
389
420
  config: {
390
421
  id: undefined;
391
422
  allow_localhost: undefined;
423
+ sign_up_enabled: undefined;
392
424
  credential_enabled: undefined;
393
425
  magic_link_enabled: undefined;
426
+ client_team_creation_enabled: undefined;
394
427
  oauth_providers: undefined;
395
428
  enabled_oauth_providers: undefined;
396
429
  domains: undefined;
@@ -414,8 +447,10 @@ export declare const internalProjectsCrud: import("../../crud").CrudSchemaFromOp
414
447
  is_production_mode: boolean | undefined;
415
448
  config: {
416
449
  allow_localhost?: boolean | undefined;
450
+ sign_up_enabled?: boolean | undefined;
417
451
  credential_enabled?: boolean | undefined;
418
452
  magic_link_enabled?: boolean | undefined;
453
+ client_team_creation_enabled?: boolean | undefined;
419
454
  oauth_providers?: {
420
455
  client_id?: string | undefined;
421
456
  client_secret?: string | undefined;
@@ -29,7 +29,7 @@ const domainSchema = yupObject({
29
29
  domain: schemaFields.domainSchema.required(),
30
30
  handler_path: schemaFields.handlerPathSchema.required(),
31
31
  });
32
- export const projectsCrudServerReadSchema = yupObject({
32
+ export const projectsCrudAdminReadSchema = yupObject({
33
33
  id: schemaFields.projectIdSchema.required(),
34
34
  display_name: schemaFields.projectDisplayNameSchema.required(),
35
35
  description: schemaFields.projectDescriptionSchema.nonNullable().defined(),
@@ -39,8 +39,10 @@ export const projectsCrudServerReadSchema = yupObject({
39
39
  config: yupObject({
40
40
  id: schemaFields.projectConfigIdSchema.required(),
41
41
  allow_localhost: schemaFields.projectAllowLocalhostSchema.required(),
42
+ sign_up_enabled: schemaFields.projectSignUpEnabledSchema.required(),
42
43
  credential_enabled: schemaFields.projectCredentialEnabledSchema.required(),
43
44
  magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.required(),
45
+ client_team_creation_enabled: schemaFields.projectClientTeamCreationEnabledSchema.required(),
44
46
  oauth_providers: yupArray(oauthProviderSchema.required()).required(),
45
47
  enabled_oauth_providers: yupArray(enabledOAuthProviderSchema.required()).required(),
46
48
  domains: yupArray(domainSchema.required()).required(),
@@ -54,18 +56,22 @@ export const projectsCrudClientReadSchema = yupObject({
54
56
  id: schemaFields.projectIdSchema.required(),
55
57
  display_name: schemaFields.projectDisplayNameSchema.required(),
56
58
  config: yupObject({
59
+ sign_up_enabled: schemaFields.projectSignUpEnabledSchema.required(),
57
60
  credential_enabled: schemaFields.projectCredentialEnabledSchema.required(),
58
61
  magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.required(),
62
+ client_team_creation_enabled: schemaFields.projectClientTeamCreationEnabledSchema.required(),
59
63
  enabled_oauth_providers: yupArray(enabledOAuthProviderSchema.required()).required(),
60
64
  }).required(),
61
65
  }).required();
62
- export const projectsCrudServerUpdateSchema = yupObject({
66
+ export const projectsCrudAdminUpdateSchema = yupObject({
63
67
  display_name: schemaFields.projectDisplayNameSchema.optional(),
64
68
  description: schemaFields.projectDescriptionSchema.optional(),
65
69
  is_production_mode: schemaFields.projectIsProductionModeSchema.optional(),
66
70
  config: yupObject({
71
+ sign_up_enabled: schemaFields.projectSignUpEnabledSchema.optional(),
67
72
  credential_enabled: schemaFields.projectCredentialEnabledSchema.optional(),
68
73
  magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.optional(),
74
+ client_team_creation_enabled: schemaFields.projectClientTeamCreationEnabledSchema.optional(),
69
75
  allow_localhost: schemaFields.projectAllowLocalhostSchema.optional(),
70
76
  email_config: emailConfigSchema.optional().default(undefined),
71
77
  domains: yupArray(domainSchema.required()).optional().default(undefined),
@@ -75,34 +81,41 @@ export const projectsCrudServerUpdateSchema = yupObject({
75
81
  team_member_default_permissions: yupArray(teamPermissionSchema.required()).optional(),
76
82
  }).optional().default(undefined),
77
83
  }).required();
78
- export const projectsCrudServerCreateSchema = projectsCrudServerUpdateSchema.concat(yupObject({
84
+ export const projectsCrudAdminCreateSchema = projectsCrudAdminUpdateSchema.concat(yupObject({
79
85
  display_name: schemaFields.projectDisplayNameSchema.required(),
80
86
  }).required());
87
+ export const projectsCrudAdminDeleteSchema = schemaFields.yupMixed();
81
88
  export const projectsCrud = createCrud({
82
89
  clientReadSchema: projectsCrudClientReadSchema,
83
- serverReadSchema: projectsCrudServerReadSchema,
84
- serverUpdateSchema: projectsCrudServerUpdateSchema,
90
+ adminReadSchema: projectsCrudAdminReadSchema,
91
+ adminUpdateSchema: projectsCrudAdminUpdateSchema,
92
+ adminDeleteSchema: projectsCrudAdminDeleteSchema,
85
93
  docs: {
86
94
  clientRead: {
87
95
  summary: 'Get the current project',
88
96
  description: 'Get the current project information including display name, oauth providers and authentication methods. Useful for display the available login options to the user.',
89
97
  tags: ['Projects'],
90
98
  },
91
- serverRead: {
99
+ adminRead: {
92
100
  summary: 'Get the current project',
93
101
  description: 'Get the current project information and configuration including display name, oauth providers, email configuration, etc.',
94
102
  tags: ['Projects'],
95
103
  },
96
- serverUpdate: {
104
+ adminUpdate: {
97
105
  summary: 'Update the current project',
98
106
  description: 'Update the current project information and configuration including display name, oauth providers, email configuration, etc.',
99
107
  tags: ['Projects'],
100
108
  },
109
+ adminDelete: {
110
+ summary: 'Delete the current project',
111
+ description: 'Delete the current project and all associated data (including users, teams, API keys, project configs, etc.). Be careful, this action is irreversible.',
112
+ tags: ['Projects'],
113
+ },
101
114
  },
102
115
  });
103
116
  export const internalProjectsCrud = createCrud({
104
- clientReadSchema: projectsCrudServerReadSchema,
105
- clientCreateSchema: projectsCrudServerCreateSchema,
117
+ clientReadSchema: projectsCrudAdminReadSchema,
118
+ clientCreateSchema: projectsCrudAdminCreateSchema,
106
119
  docs: {
107
120
  clientList: {
108
121
  hidden: true,