@stackframe/stack-shared 2.5.16 → 2.5.18
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 +14 -0
- package/dist/interface/clientInterface.d.ts +19 -0
- package/dist/interface/clientInterface.js +89 -26
- package/dist/interface/crud/current-user.d.ts +58 -0
- package/dist/interface/crud/current-user.js +4 -0
- package/dist/interface/crud/email-templates.d.ts +5 -5
- package/dist/interface/crud/email-templates.js +1 -1
- package/dist/interface/crud/projects.d.ts +14 -0
- package/dist/interface/crud/projects.js +3 -0
- package/dist/interface/crud/team-invitation-details.d.ts +25 -0
- package/dist/interface/crud/team-invitation-details.js +17 -0
- package/dist/interface/crud/users.d.ts +116 -0
- package/dist/interface/crud/users.js +30 -2
- package/dist/interface/crud-deprecated/email-templates.d.ts +5 -5
- package/dist/interface/crud-deprecated/email-templates.js +1 -1
- package/dist/interface/serverInterface.d.ts +2 -6
- package/dist/interface/serverInterface.js +10 -5
- package/dist/interface/webhooks.d.ts +54 -0
- package/dist/known-errors.d.ts +15 -0
- package/dist/known-errors.js +33 -0
- package/dist/schema-fields.d.ts +12 -0
- package/dist/schema-fields.js +39 -1
- package/dist/utils/arrays.d.ts +1 -0
- package/dist/utils/arrays.js +3 -0
- package/dist/utils/bytes.d.ts +4 -0
- package/dist/utils/bytes.js +36 -0
- package/dist/utils/crypto.d.ts +1 -0
- package/dist/utils/crypto.js +11 -1
- package/dist/utils/results.d.ts +2 -0
- package/dist/utils/results.js +9 -0
- package/dist/utils/strings.js +14 -2
- package/dist/utils/uuids.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @stackframe/stack-shared
|
|
2
2
|
|
|
3
|
+
## 2.5.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Multi-factor authentication
|
|
8
|
+
- @stackframe/stack-sc@2.5.18
|
|
9
|
+
|
|
10
|
+
## 2.5.17
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Bugfixes
|
|
15
|
+
- @stackframe/stack-sc@2.5.17
|
|
16
|
+
|
|
3
17
|
## 2.5.16
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -28,6 +28,8 @@ export declare class StackClientInterface {
|
|
|
28
28
|
prodDashboard: string;
|
|
29
29
|
prodBackend: string;
|
|
30
30
|
}>;
|
|
31
|
+
protected _networkRetry<T>(cb: () => Promise<Result<T, any>>, session?: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<T>;
|
|
32
|
+
protected _networkRetryException<T>(cb: () => Promise<T>, session?: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<T>;
|
|
31
33
|
fetchNewAccessToken(refreshToken: RefreshToken): Promise<AccessToken | null>;
|
|
32
34
|
protected sendClientRequest(path: string, requestOptions: RequestInit, session: InternalSession | null, requestType?: "client" | "server" | "admin"): Promise<Response & {
|
|
33
35
|
usedTokens: {
|
|
@@ -63,6 +65,23 @@ export declare class StackClientInterface {
|
|
|
63
65
|
}, session: InternalSession): Promise<KnownErrors["PasswordConfirmationMismatch"] | KnownErrors["PasswordRequirementsNotMet"] | undefined>;
|
|
64
66
|
verifyPasswordResetCode(code: string): Promise<KnownErrors["VerificationCodeError"] | undefined>;
|
|
65
67
|
verifyEmail(code: string): Promise<KnownErrors["VerificationCodeError"] | undefined>;
|
|
68
|
+
sendTeamInvitation(options: {
|
|
69
|
+
email: string;
|
|
70
|
+
teamId: string;
|
|
71
|
+
callbackUrl: string;
|
|
72
|
+
session: InternalSession | null;
|
|
73
|
+
}): Promise<Result<undefined, KnownErrors["TeamPermissionRequired"]>>;
|
|
74
|
+
acceptTeamInvitation<T extends 'use' | 'details' | 'check'>(options: {
|
|
75
|
+
code: string;
|
|
76
|
+
session: InternalSession;
|
|
77
|
+
type: T;
|
|
78
|
+
}): Promise<Result<T extends 'details' ? {
|
|
79
|
+
team_display_name: string;
|
|
80
|
+
} : undefined, KnownErrors["VerificationCodeError"]>>;
|
|
81
|
+
totpMfa(attemptCode: string, totp: string, session: InternalSession): Promise<{
|
|
82
|
+
accessToken: any;
|
|
83
|
+
refreshToken: any;
|
|
84
|
+
}>;
|
|
66
85
|
signInWithCredential(email: string, password: string, session: InternalSession): Promise<KnownErrors["EmailPasswordMismatch"] | {
|
|
67
86
|
accessToken: string;
|
|
68
87
|
refreshToken: string;
|
|
@@ -47,13 +47,13 @@ export class StackClientInterface {
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
const prodDashboard = await tryRequest(async () => {
|
|
50
|
-
const res = await fetch("https://app.
|
|
50
|
+
const res = await fetch("https://app.stack-auth.com/health");
|
|
51
51
|
if (!res.ok) {
|
|
52
52
|
throw new Error(`${res.status} ${res.statusText}: ${await res.text()}`);
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
const prodBackend = await tryRequest(async () => {
|
|
56
|
-
const res = await fetch("https://api.
|
|
56
|
+
const res = await fetch("https://api.stack-auth.com/health");
|
|
57
57
|
if (!res.ok) {
|
|
58
58
|
throw new Error(`${res.status} ${res.statusText}: ${await res.text()}`);
|
|
59
59
|
}
|
|
@@ -66,6 +66,28 @@ export class StackClientInterface {
|
|
|
66
66
|
prodBackend,
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
+
async _networkRetry(cb, session, requestType) {
|
|
70
|
+
const retriedResult = await Result.retry(cb, 5, { exponentialDelayBase: 1000 });
|
|
71
|
+
// try to diagnose the error for the user
|
|
72
|
+
if (retriedResult.status === "error") {
|
|
73
|
+
if (!navigator.onLine) {
|
|
74
|
+
throw new Error("Failed to send Stack network request. It seems like you are offline. (window.navigator.onLine is falsy)", { cause: retriedResult.error });
|
|
75
|
+
}
|
|
76
|
+
throw new Error(deindent `
|
|
77
|
+
Stack is unable to connect to the server. Please check your internet connection and try again.
|
|
78
|
+
|
|
79
|
+
If the problem persists, please contact Stack support and provide a screenshot of your entire browser console.
|
|
80
|
+
|
|
81
|
+
${retriedResult.error}
|
|
82
|
+
|
|
83
|
+
${JSON.stringify(await this.runNetworkDiagnostics(session, requestType), null, 2)}
|
|
84
|
+
`, { cause: retriedResult.error });
|
|
85
|
+
}
|
|
86
|
+
return retriedResult.data;
|
|
87
|
+
}
|
|
88
|
+
async _networkRetryException(cb, session, requestType) {
|
|
89
|
+
return await this._networkRetry(async () => await Result.fromThrowingAsync(cb), session, requestType);
|
|
90
|
+
}
|
|
69
91
|
async fetchNewAccessToken(refreshToken) {
|
|
70
92
|
if (!('publishableClientKey' in this.options)) {
|
|
71
93
|
// TODO support it
|
|
@@ -81,7 +103,7 @@ export class StackClientInterface {
|
|
|
81
103
|
client_secret: this.options.publishableClientKey,
|
|
82
104
|
token_endpoint_auth_method: 'client_secret_post',
|
|
83
105
|
};
|
|
84
|
-
const rawResponse = await oauth.refreshTokenGrantRequest(as, client, refreshToken.token);
|
|
106
|
+
const rawResponse = await this._networkRetryException(async () => await oauth.refreshTokenGrantRequest(as, client, refreshToken.token));
|
|
85
107
|
const response = await this._processResponse(rawResponse);
|
|
86
108
|
if (response.status === "error") {
|
|
87
109
|
const error = response.error;
|
|
@@ -108,23 +130,7 @@ export class StackClientInterface {
|
|
|
108
130
|
session ??= this.createSession({
|
|
109
131
|
refreshToken: null,
|
|
110
132
|
});
|
|
111
|
-
|
|
112
|
-
// try to diagnose the error for the user
|
|
113
|
-
if (retriedResult.status === "error") {
|
|
114
|
-
if (!navigator.onLine) {
|
|
115
|
-
throw new Error("Failed to send Stack request. It seems like you are offline. (window.navigator.onLine is falsy)", { cause: retriedResult.error });
|
|
116
|
-
}
|
|
117
|
-
throw new Error(deindent `
|
|
118
|
-
Stack is unable to connect to the server. Please check your internet connection and try again.
|
|
119
|
-
|
|
120
|
-
If the problem persists, please contact Stack support and provide a screenshot of your entire browser console.
|
|
121
|
-
|
|
122
|
-
${retriedResult.error}
|
|
123
|
-
|
|
124
|
-
${JSON.stringify(await this.runNetworkDiagnostics(session, requestType), null, 2)}
|
|
125
|
-
`, { cause: retriedResult.error });
|
|
126
|
-
}
|
|
127
|
-
return retriedResult.data;
|
|
133
|
+
return await this._networkRetry(() => this.sendClientRequestInner(path, requestOptions, session, requestType), session, requestType);
|
|
128
134
|
}
|
|
129
135
|
createSession(options) {
|
|
130
136
|
const session = new InternalSession({
|
|
@@ -213,7 +219,6 @@ export class StackClientInterface {
|
|
|
213
219
|
catch (e) {
|
|
214
220
|
if (e instanceof TypeError) {
|
|
215
221
|
// Network error, retry
|
|
216
|
-
console.log("Stack detected a network error, retrying.", e);
|
|
217
222
|
return Result.error(e);
|
|
218
223
|
}
|
|
219
224
|
throw e;
|
|
@@ -380,6 +385,64 @@ export class StackClientInterface {
|
|
|
380
385
|
return res.error;
|
|
381
386
|
}
|
|
382
387
|
}
|
|
388
|
+
async sendTeamInvitation(options) {
|
|
389
|
+
const res = await this.sendClientRequestAndCatchKnownError("/team-invitations/send-code", {
|
|
390
|
+
method: "POST",
|
|
391
|
+
headers: {
|
|
392
|
+
"Content-Type": "application/json"
|
|
393
|
+
},
|
|
394
|
+
body: JSON.stringify({
|
|
395
|
+
email: options.email,
|
|
396
|
+
team_id: options.teamId,
|
|
397
|
+
callback_url: options.callbackUrl,
|
|
398
|
+
}),
|
|
399
|
+
}, options.session, [KnownErrors.TeamPermissionRequired]);
|
|
400
|
+
if (res.status === "error") {
|
|
401
|
+
return Result.error(res.error);
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
return Result.ok(undefined);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
async acceptTeamInvitation(options) {
|
|
408
|
+
const res = await this.sendClientRequestAndCatchKnownError(options.type === 'check' ?
|
|
409
|
+
"/team-invitations/accept/check-code" :
|
|
410
|
+
options.type === 'details' ?
|
|
411
|
+
"/team-invitations/accept/details" :
|
|
412
|
+
"/team-invitations/accept", {
|
|
413
|
+
method: "POST",
|
|
414
|
+
headers: {
|
|
415
|
+
"Content-Type": "application/json"
|
|
416
|
+
},
|
|
417
|
+
body: JSON.stringify({
|
|
418
|
+
code: options.code,
|
|
419
|
+
}),
|
|
420
|
+
}, options.session, [KnownErrors.VerificationCodeError]);
|
|
421
|
+
if (res.status === "error") {
|
|
422
|
+
return Result.error(res.error);
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
return Result.ok(await res.data.json());
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
async totpMfa(attemptCode, totp, session) {
|
|
429
|
+
const res = await this.sendClientRequest("/auth/mfa/sign-in", {
|
|
430
|
+
method: "POST",
|
|
431
|
+
headers: {
|
|
432
|
+
"Content-Type": "application/json"
|
|
433
|
+
},
|
|
434
|
+
body: JSON.stringify({
|
|
435
|
+
code: attemptCode,
|
|
436
|
+
type: "totp",
|
|
437
|
+
totp: totp,
|
|
438
|
+
}),
|
|
439
|
+
}, session);
|
|
440
|
+
const result = await res.json();
|
|
441
|
+
return {
|
|
442
|
+
accessToken: result.access_token,
|
|
443
|
+
refreshToken: result.refresh_token,
|
|
444
|
+
};
|
|
445
|
+
}
|
|
383
446
|
async signInWithCredential(email, password, session) {
|
|
384
447
|
const res = await this.sendClientRequestAndCatchKnownError("/auth/password/sign-in", {
|
|
385
448
|
method: "POST",
|
|
@@ -438,7 +501,7 @@ export class StackClientInterface {
|
|
|
438
501
|
return {
|
|
439
502
|
accessToken: result.access_token,
|
|
440
503
|
refreshToken: result.refresh_token,
|
|
441
|
-
newUser: result.
|
|
504
|
+
newUser: result.is_new_user,
|
|
442
505
|
};
|
|
443
506
|
}
|
|
444
507
|
async getOAuthUrl(options) {
|
|
@@ -492,7 +555,7 @@ export class StackClientInterface {
|
|
|
492
555
|
client_secret: this.options.publishableClientKey,
|
|
493
556
|
token_endpoint_auth_method: 'client_secret_post',
|
|
494
557
|
};
|
|
495
|
-
const params = oauth.validateAuthResponse(as, client, options.oauthParams, options.state);
|
|
558
|
+
const params = await this._networkRetryException(async () => oauth.validateAuthResponse(as, client, options.oauthParams, options.state));
|
|
496
559
|
if (oauth.isOAuth2Error(params)) {
|
|
497
560
|
throw new StackAssertionError("Error validating outer OAuth response", { params }); // Handle OAuth 2.0 redirect error
|
|
498
561
|
}
|
|
@@ -503,8 +566,8 @@ export class StackClientInterface {
|
|
|
503
566
|
throw new StackAssertionError("Outer OAuth error during authorization code response", { result });
|
|
504
567
|
}
|
|
505
568
|
return {
|
|
506
|
-
newUser: result.
|
|
507
|
-
afterCallbackRedirectUrl: result.
|
|
569
|
+
newUser: result.is_new_user,
|
|
570
|
+
afterCallbackRedirectUrl: result.after_callback_redirect_url,
|
|
508
571
|
accessToken: result.access_token,
|
|
509
572
|
refreshToken: result.refresh_token ?? throwErr("Refresh token not found in outer OAuth response"),
|
|
510
573
|
};
|
|
@@ -551,7 +614,7 @@ export class StackClientInterface {
|
|
|
551
614
|
return user;
|
|
552
615
|
}
|
|
553
616
|
async listCurrentUserTeamPermissions(options, session) {
|
|
554
|
-
const response = await this.sendClientRequest(`/team-permissions?team_id=${options.teamId}
|
|
617
|
+
const response = await this.sendClientRequest(`/team-permissions?team_id=${options.teamId}&user_id=me&recursive=${options.recursive}`, {}, session);
|
|
555
618
|
const result = await response.json();
|
|
556
619
|
return result.items;
|
|
557
620
|
}
|
|
@@ -16,6 +16,30 @@ 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>;
|
|
20
|
+
auth_methods: ({
|
|
21
|
+
type: "password";
|
|
22
|
+
identifier: string;
|
|
23
|
+
} | {
|
|
24
|
+
type: "otp";
|
|
25
|
+
contact_channel: {
|
|
26
|
+
type: "email";
|
|
27
|
+
email: string;
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
type: "oauth";
|
|
31
|
+
provider: {
|
|
32
|
+
type: string;
|
|
33
|
+
provider_user_id: string;
|
|
34
|
+
};
|
|
35
|
+
})[];
|
|
36
|
+
connected_accounts: {
|
|
37
|
+
type: "oauth";
|
|
38
|
+
provider: {
|
|
39
|
+
type: string;
|
|
40
|
+
provider_user_id: string;
|
|
41
|
+
};
|
|
42
|
+
}[];
|
|
19
43
|
} & {
|
|
20
44
|
selected_team: {
|
|
21
45
|
id: string;
|
|
@@ -37,7 +61,10 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
37
61
|
signed_up_at_millis: undefined;
|
|
38
62
|
has_password: undefined;
|
|
39
63
|
auth_with_email: undefined;
|
|
64
|
+
requires_totp_mfa: undefined;
|
|
40
65
|
oauth_providers: undefined;
|
|
66
|
+
auth_methods: undefined;
|
|
67
|
+
connected_accounts: undefined;
|
|
41
68
|
client_metadata: undefined;
|
|
42
69
|
server_metadata: undefined;
|
|
43
70
|
}, "">;
|
|
@@ -57,11 +84,35 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
57
84
|
signed_up_at_millis: number;
|
|
58
85
|
has_password: NonNullable<boolean | undefined>;
|
|
59
86
|
auth_with_email: NonNullable<boolean | undefined>;
|
|
87
|
+
requires_totp_mfa: NonNullable<boolean | undefined>;
|
|
60
88
|
oauth_providers: {
|
|
61
89
|
email?: string | null | undefined;
|
|
62
90
|
id: string;
|
|
63
91
|
account_id: string;
|
|
64
92
|
}[];
|
|
93
|
+
auth_methods: ({
|
|
94
|
+
type: "password";
|
|
95
|
+
identifier: string;
|
|
96
|
+
} | {
|
|
97
|
+
type: "otp";
|
|
98
|
+
contact_channel: {
|
|
99
|
+
type: "email";
|
|
100
|
+
email: string;
|
|
101
|
+
};
|
|
102
|
+
} | {
|
|
103
|
+
type: "oauth";
|
|
104
|
+
provider: {
|
|
105
|
+
type: string;
|
|
106
|
+
provider_user_id: string;
|
|
107
|
+
};
|
|
108
|
+
})[];
|
|
109
|
+
connected_accounts: {
|
|
110
|
+
type: "oauth";
|
|
111
|
+
provider: {
|
|
112
|
+
type: string;
|
|
113
|
+
provider_user_id: string;
|
|
114
|
+
};
|
|
115
|
+
}[];
|
|
65
116
|
client_metadata: {} | null;
|
|
66
117
|
server_metadata: {} | null;
|
|
67
118
|
} | null, import("yup").AnyObject, {
|
|
@@ -80,13 +131,17 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
80
131
|
signed_up_at_millis: undefined;
|
|
81
132
|
has_password: undefined;
|
|
82
133
|
auth_with_email: undefined;
|
|
134
|
+
requires_totp_mfa: undefined;
|
|
83
135
|
oauth_providers: undefined;
|
|
136
|
+
auth_methods: undefined;
|
|
137
|
+
connected_accounts: undefined;
|
|
84
138
|
client_metadata: undefined;
|
|
85
139
|
server_metadata: undefined;
|
|
86
140
|
}, "">;
|
|
87
141
|
clientUpdateSchema: import("yup").ObjectSchema<{
|
|
88
142
|
display_name: string | null | undefined;
|
|
89
143
|
client_metadata: {} | null | undefined;
|
|
144
|
+
totp_secret_base64: string | null | undefined;
|
|
90
145
|
selected_team_id: string | null | undefined;
|
|
91
146
|
}, import("yup").AnyObject, {
|
|
92
147
|
display_name: undefined;
|
|
@@ -97,6 +152,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
97
152
|
primary_email_verified: undefined;
|
|
98
153
|
primary_email_auth_enabled: undefined;
|
|
99
154
|
password: undefined;
|
|
155
|
+
totp_secret_base64: undefined;
|
|
100
156
|
selected_team_id: undefined;
|
|
101
157
|
}, "">;
|
|
102
158
|
serverUpdateSchema: import("yup").ObjectSchema<{
|
|
@@ -108,6 +164,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
108
164
|
primary_email_verified: boolean | undefined;
|
|
109
165
|
primary_email_auth_enabled: boolean | undefined;
|
|
110
166
|
password: string | null | undefined;
|
|
167
|
+
totp_secret_base64: string | null | undefined;
|
|
111
168
|
selected_team_id: string | null | undefined;
|
|
112
169
|
}, import("yup").AnyObject, {
|
|
113
170
|
display_name: undefined;
|
|
@@ -118,6 +175,7 @@ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions
|
|
|
118
175
|
primary_email_verified: undefined;
|
|
119
176
|
primary_email_auth_enabled: undefined;
|
|
120
177
|
password: undefined;
|
|
178
|
+
totp_secret_base64: undefined;
|
|
121
179
|
selected_team_id: undefined;
|
|
122
180
|
}, "">;
|
|
123
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([
|
|
@@ -20,6 +21,9 @@ const clientReadSchema = usersCrudServerReadSchema.pick([
|
|
|
20
21
|
"auth_with_email",
|
|
21
22
|
"oauth_providers",
|
|
22
23
|
"selected_team_id",
|
|
24
|
+
"auth_methods",
|
|
25
|
+
"connected_accounts",
|
|
26
|
+
"requires_totp_mfa",
|
|
23
27
|
]).concat(yupObject({
|
|
24
28
|
selected_team: teamsCrudClientReadSchema.nullable().defined(),
|
|
25
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(),
|
|
@@ -9,6 +9,7 @@ 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>;
|
|
14
15
|
oauth_providers: {
|
|
@@ -53,6 +54,7 @@ export declare const projectsCrudServerReadSchema: import("yup").ObjectSchema<{
|
|
|
53
54
|
config: {
|
|
54
55
|
id: undefined;
|
|
55
56
|
allow_localhost: undefined;
|
|
57
|
+
sign_up_enabled: undefined;
|
|
56
58
|
credential_enabled: undefined;
|
|
57
59
|
magic_link_enabled: undefined;
|
|
58
60
|
oauth_providers: undefined;
|
|
@@ -76,6 +78,7 @@ export declare const projectsCrudClientReadSchema: import("yup").ObjectSchema<{
|
|
|
76
78
|
id: string;
|
|
77
79
|
display_name: string;
|
|
78
80
|
config: {
|
|
81
|
+
sign_up_enabled: NonNullable<boolean | undefined>;
|
|
79
82
|
credential_enabled: NonNullable<boolean | undefined>;
|
|
80
83
|
magic_link_enabled: NonNullable<boolean | undefined>;
|
|
81
84
|
enabled_oauth_providers: {
|
|
@@ -86,6 +89,7 @@ export declare const projectsCrudClientReadSchema: import("yup").ObjectSchema<{
|
|
|
86
89
|
id: undefined;
|
|
87
90
|
display_name: undefined;
|
|
88
91
|
config: {
|
|
92
|
+
sign_up_enabled: undefined;
|
|
89
93
|
credential_enabled: undefined;
|
|
90
94
|
magic_link_enabled: undefined;
|
|
91
95
|
enabled_oauth_providers: undefined;
|
|
@@ -97,6 +101,7 @@ export declare const projectsCrudServerUpdateSchema: import("yup").ObjectSchema<
|
|
|
97
101
|
is_production_mode: boolean | undefined;
|
|
98
102
|
config: {
|
|
99
103
|
allow_localhost?: boolean | undefined;
|
|
104
|
+
sign_up_enabled?: boolean | undefined;
|
|
100
105
|
credential_enabled?: boolean | undefined;
|
|
101
106
|
magic_link_enabled?: boolean | undefined;
|
|
102
107
|
oauth_providers?: {
|
|
@@ -140,6 +145,7 @@ export declare const projectsCrudServerCreateSchema: import("yup").ObjectSchema<
|
|
|
140
145
|
is_production_mode: boolean | undefined;
|
|
141
146
|
config: {
|
|
142
147
|
allow_localhost?: boolean | undefined;
|
|
148
|
+
sign_up_enabled?: boolean | undefined;
|
|
143
149
|
credential_enabled?: boolean | undefined;
|
|
144
150
|
magic_link_enabled?: boolean | undefined;
|
|
145
151
|
oauth_providers?: {
|
|
@@ -184,6 +190,7 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
184
190
|
id: string;
|
|
185
191
|
display_name: string;
|
|
186
192
|
config: {
|
|
193
|
+
sign_up_enabled: NonNullable<boolean | undefined>;
|
|
187
194
|
credential_enabled: NonNullable<boolean | undefined>;
|
|
188
195
|
magic_link_enabled: NonNullable<boolean | undefined>;
|
|
189
196
|
enabled_oauth_providers: {
|
|
@@ -194,6 +201,7 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
194
201
|
id: undefined;
|
|
195
202
|
display_name: undefined;
|
|
196
203
|
config: {
|
|
204
|
+
sign_up_enabled: undefined;
|
|
197
205
|
credential_enabled: undefined;
|
|
198
206
|
magic_link_enabled: undefined;
|
|
199
207
|
enabled_oauth_providers: undefined;
|
|
@@ -209,6 +217,7 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
209
217
|
config: {
|
|
210
218
|
id: string;
|
|
211
219
|
allow_localhost: NonNullable<boolean | undefined>;
|
|
220
|
+
sign_up_enabled: NonNullable<boolean | undefined>;
|
|
212
221
|
credential_enabled: NonNullable<boolean | undefined>;
|
|
213
222
|
magic_link_enabled: NonNullable<boolean | undefined>;
|
|
214
223
|
oauth_providers: {
|
|
@@ -253,6 +262,7 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
253
262
|
config: {
|
|
254
263
|
id: undefined;
|
|
255
264
|
allow_localhost: undefined;
|
|
265
|
+
sign_up_enabled: undefined;
|
|
256
266
|
credential_enabled: undefined;
|
|
257
267
|
magic_link_enabled: undefined;
|
|
258
268
|
oauth_providers: undefined;
|
|
@@ -278,6 +288,7 @@ export declare const projectsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
|
278
288
|
is_production_mode: boolean | undefined;
|
|
279
289
|
config: {
|
|
280
290
|
allow_localhost?: boolean | undefined;
|
|
291
|
+
sign_up_enabled?: boolean | undefined;
|
|
281
292
|
credential_enabled?: boolean | undefined;
|
|
282
293
|
magic_link_enabled?: boolean | undefined;
|
|
283
294
|
oauth_providers?: {
|
|
@@ -345,6 +356,7 @@ export declare const internalProjectsCrud: import("../../crud").CrudSchemaFromOp
|
|
|
345
356
|
config: {
|
|
346
357
|
id: string;
|
|
347
358
|
allow_localhost: NonNullable<boolean | undefined>;
|
|
359
|
+
sign_up_enabled: NonNullable<boolean | undefined>;
|
|
348
360
|
credential_enabled: NonNullable<boolean | undefined>;
|
|
349
361
|
magic_link_enabled: NonNullable<boolean | undefined>;
|
|
350
362
|
oauth_providers: {
|
|
@@ -389,6 +401,7 @@ export declare const internalProjectsCrud: import("../../crud").CrudSchemaFromOp
|
|
|
389
401
|
config: {
|
|
390
402
|
id: undefined;
|
|
391
403
|
allow_localhost: undefined;
|
|
404
|
+
sign_up_enabled: undefined;
|
|
392
405
|
credential_enabled: undefined;
|
|
393
406
|
magic_link_enabled: undefined;
|
|
394
407
|
oauth_providers: undefined;
|
|
@@ -414,6 +427,7 @@ export declare const internalProjectsCrud: import("../../crud").CrudSchemaFromOp
|
|
|
414
427
|
is_production_mode: boolean | undefined;
|
|
415
428
|
config: {
|
|
416
429
|
allow_localhost?: boolean | undefined;
|
|
430
|
+
sign_up_enabled?: boolean | undefined;
|
|
417
431
|
credential_enabled?: boolean | undefined;
|
|
418
432
|
magic_link_enabled?: boolean | undefined;
|
|
419
433
|
oauth_providers?: {
|
|
@@ -39,6 +39,7 @@ 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(),
|
|
44
45
|
oauth_providers: yupArray(oauthProviderSchema.required()).required(),
|
|
@@ -54,6 +55,7 @@ export const projectsCrudClientReadSchema = yupObject({
|
|
|
54
55
|
id: schemaFields.projectIdSchema.required(),
|
|
55
56
|
display_name: schemaFields.projectDisplayNameSchema.required(),
|
|
56
57
|
config: yupObject({
|
|
58
|
+
sign_up_enabled: schemaFields.projectSignUpEnabledSchema.required(),
|
|
57
59
|
credential_enabled: schemaFields.projectCredentialEnabledSchema.required(),
|
|
58
60
|
magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.required(),
|
|
59
61
|
enabled_oauth_providers: yupArray(enabledOAuthProviderSchema.required()).required(),
|
|
@@ -64,6 +66,7 @@ export const projectsCrudServerUpdateSchema = yupObject({
|
|
|
64
66
|
description: schemaFields.projectDescriptionSchema.optional(),
|
|
65
67
|
is_production_mode: schemaFields.projectIsProductionModeSchema.optional(),
|
|
66
68
|
config: yupObject({
|
|
69
|
+
sign_up_enabled: schemaFields.projectSignUpEnabledSchema.optional(),
|
|
67
70
|
credential_enabled: schemaFields.projectCredentialEnabledSchema.optional(),
|
|
68
71
|
magic_link_enabled: schemaFields.projectMagicLinkEnabledSchema.optional(),
|
|
69
72
|
allow_localhost: schemaFields.projectAllowLocalhostSchema.optional(),
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CrudTypeOf } from "../../crud";
|
|
2
|
+
export declare const teamInvitationDetailsClientReadSchema: import("yup").ObjectSchema<{
|
|
3
|
+
team_id: string;
|
|
4
|
+
team_display_name: string;
|
|
5
|
+
}, import("yup").AnyObject, {
|
|
6
|
+
team_id: undefined;
|
|
7
|
+
team_display_name: undefined;
|
|
8
|
+
}, "">;
|
|
9
|
+
export declare const teamInvitationDetailsCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
10
|
+
clientReadSchema: import("yup").ObjectSchema<{
|
|
11
|
+
team_id: string;
|
|
12
|
+
team_display_name: string;
|
|
13
|
+
}, import("yup").AnyObject, {
|
|
14
|
+
team_id: undefined;
|
|
15
|
+
team_display_name: undefined;
|
|
16
|
+
}, "">;
|
|
17
|
+
docs: {
|
|
18
|
+
clientRead: {
|
|
19
|
+
summary: string;
|
|
20
|
+
description: string;
|
|
21
|
+
tags: string[];
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}>;
|
|
25
|
+
export type TeamInvitationDetailsCrud = CrudTypeOf<typeof teamInvitationDetailsCrud>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createCrud } from "../../crud";
|
|
2
|
+
import * as schemaFields from "../../schema-fields";
|
|
3
|
+
import { yupObject } from "../../schema-fields";
|
|
4
|
+
export const teamInvitationDetailsClientReadSchema = yupObject({
|
|
5
|
+
team_id: schemaFields.teamIdSchema.required(),
|
|
6
|
+
team_display_name: schemaFields.teamDisplayNameSchema.required(),
|
|
7
|
+
}).required();
|
|
8
|
+
export const teamInvitationDetailsCrud = createCrud({
|
|
9
|
+
clientReadSchema: teamInvitationDetailsClientReadSchema,
|
|
10
|
+
docs: {
|
|
11
|
+
clientRead: {
|
|
12
|
+
summary: "Get the team details with invitation code",
|
|
13
|
+
description: "",
|
|
14
|
+
tags: ["Teams"],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
});
|