@stackframe/stack-shared 2.5.0 → 2.5.2
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/crud.d.ts +26 -15
- package/dist/crud.js +16 -0
- package/dist/interface/clientInterface.d.ts +6 -5
- package/dist/interface/clientInterface.js +4 -4
- package/dist/interface/crud/current-user.d.ts +98 -85
- package/dist/interface/crud/current-user.js +35 -17
- package/dist/interface/crud/oauth.d.ts +4 -4
- package/dist/interface/crud/oauth.js +1 -1
- package/dist/interface/crud/users.d.ts +144 -80
- package/dist/interface/crud/users.js +56 -24
- package/dist/interface/serverInterface.d.ts +1 -1
- package/dist/known-errors.d.ts +139 -74
- package/dist/known-errors.js +121 -80
- package/dist/schema-fields.d.ts +43 -0
- package/dist/schema-fields.js +68 -0
- package/dist/utils/env.d.ts +3 -2
- package/dist/utils/env.js +6 -3
- package/dist/utils/errors.js +1 -1
- package/dist/utils/objects.d.ts +4 -1
- package/dist/utils/objects.js +32 -1
- package/dist/utils/strings.d.ts +4 -1
- package/dist/utils/strings.js +26 -17
- package/package.json +2 -2
- package/dist/interface/crud/fields.d.ts +0 -11
- package/dist/interface/crud/fields.js +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @stackframe/stack-shared
|
|
2
2
|
|
|
3
|
+
## 2.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Team profile pictures
|
|
8
|
+
- @stackframe/stack-sc@2.5.2
|
|
9
|
+
|
|
10
|
+
## 2.5.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- New backend endpoints
|
|
15
|
+
- @stackframe/stack-sc@2.5.1
|
|
16
|
+
|
|
3
17
|
## 2.5.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/dist/crud.d.ts
CHANGED
|
@@ -1,20 +1,37 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import { NullishCoalesce } from './utils/types';
|
|
3
|
+
export type AccessType = "client" | "server" | "admin";
|
|
3
4
|
export type CrudOperation = "create" | "read" | "update" | "delete";
|
|
5
|
+
export type AccessTypeXCrudOperation = `${AccessType}${Capitalize<CrudOperation>}`;
|
|
4
6
|
declare module 'yup' {
|
|
5
7
|
interface CustomSchemaMetadata {
|
|
6
|
-
|
|
8
|
+
openapiField?: {
|
|
7
9
|
description?: string;
|
|
8
10
|
exampleValue?: any;
|
|
9
|
-
|
|
11
|
+
hidden?: boolean;
|
|
10
12
|
};
|
|
11
13
|
}
|
|
12
14
|
}
|
|
15
|
+
type ShownEndpointDocumentation = {
|
|
16
|
+
summary: string;
|
|
17
|
+
description: string;
|
|
18
|
+
tags?: string[];
|
|
19
|
+
};
|
|
20
|
+
export type EndpointDocumentation = ({
|
|
21
|
+
hidden: true;
|
|
22
|
+
} & Partial<ShownEndpointDocumentation>) | ({
|
|
23
|
+
hidden?: boolean;
|
|
24
|
+
} & ShownEndpointDocumentation);
|
|
13
25
|
type InnerCrudSchema<CreateSchema extends yup.Schema<any> | undefined = yup.Schema<any> | undefined, ReadSchema extends yup.Schema<any> | undefined = yup.Schema<any> | undefined, UpdateSchema extends yup.Schema<any> | undefined = yup.Schema<any> | undefined, DeleteSchema extends yup.Schema<any> | undefined = yup.Schema<any> | undefined> = {
|
|
14
26
|
createSchema: CreateSchema;
|
|
27
|
+
createDocs: EndpointDocumentation | undefined;
|
|
15
28
|
readSchema: ReadSchema;
|
|
29
|
+
readDocs: EndpointDocumentation | undefined;
|
|
30
|
+
listDocs: EndpointDocumentation | undefined;
|
|
16
31
|
updateSchema: UpdateSchema;
|
|
32
|
+
updateDocs: EndpointDocumentation | undefined;
|
|
17
33
|
deleteSchema: DeleteSchema;
|
|
34
|
+
deleteDocs: EndpointDocumentation | undefined;
|
|
18
35
|
};
|
|
19
36
|
export type CrudSchema<ClientSchema extends InnerCrudSchema = InnerCrudSchema, ServerSchema extends InnerCrudSchema = InnerCrudSchema, AdminSchema extends InnerCrudSchema = InnerCrudSchema> = {
|
|
20
37
|
client: ClientSchema;
|
|
@@ -26,18 +43,7 @@ export type CrudSchema<ClientSchema extends InnerCrudSchema = InnerCrudSchema, S
|
|
|
26
43
|
hasDelete: boolean;
|
|
27
44
|
};
|
|
28
45
|
export type CrudSchemaCreationOptions = {
|
|
29
|
-
|
|
30
|
-
clientReadSchema?: yup.Schema<any>;
|
|
31
|
-
clientUpdateSchema?: yup.Schema<any>;
|
|
32
|
-
clientDeleteSchema?: yup.Schema<any>;
|
|
33
|
-
serverCreateSchema?: yup.Schema<any>;
|
|
34
|
-
serverReadSchema?: yup.Schema<any>;
|
|
35
|
-
serverUpdateSchema?: yup.Schema<any>;
|
|
36
|
-
serverDeleteSchema?: yup.Schema<any>;
|
|
37
|
-
adminCreateSchema?: yup.Schema<any>;
|
|
38
|
-
adminReadSchema?: yup.Schema<any>;
|
|
39
|
-
adminUpdateSchema?: yup.Schema<any>;
|
|
40
|
-
adminDeleteSchema?: yup.Schema<any>;
|
|
46
|
+
[K in AccessTypeXCrudOperation as `${K}Schema`]?: yup.Schema<any>;
|
|
41
47
|
};
|
|
42
48
|
type FillInOptionalsPrepareStep<O extends CrudSchemaCreationOptions> = {
|
|
43
49
|
[K in keyof Required<CrudSchemaCreationOptions>]: K extends keyof O ? O[K] : undefined;
|
|
@@ -73,5 +79,10 @@ export type CrudTypeOf<S extends CrudSchema> = {
|
|
|
73
79
|
Server: InnerCrudTypeOf<S['server']>;
|
|
74
80
|
Admin: InnerCrudTypeOf<S['admin']>;
|
|
75
81
|
};
|
|
76
|
-
|
|
82
|
+
type CrudDocsCreationOptions<SO extends CrudSchemaCreationOptions> = {
|
|
83
|
+
[X in AccessTypeXCrudOperation as (X extends `${infer A}Read` ? X | `${A}List` : X)]?: EndpointDocumentation;
|
|
84
|
+
};
|
|
85
|
+
export declare function createCrud<SO extends CrudSchemaCreationOptions>(options: SO & {
|
|
86
|
+
docs?: CrudDocsCreationOptions<SO>;
|
|
87
|
+
}): CrudSchemaFromOptions<SO>;
|
|
77
88
|
export {};
|
package/dist/crud.js
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import { filterUndefined } from './utils/objects';
|
|
2
2
|
export function createCrud(options) {
|
|
3
|
+
const docs = options.docs ?? {};
|
|
3
4
|
const client = {
|
|
4
5
|
createSchema: options.clientCreateSchema,
|
|
6
|
+
createDocs: docs.clientCreate,
|
|
5
7
|
readSchema: options.clientReadSchema,
|
|
8
|
+
readDocs: docs.clientRead,
|
|
9
|
+
listDocs: docs.clientList,
|
|
6
10
|
updateSchema: options.clientUpdateSchema,
|
|
11
|
+
updateDocs: docs.clientUpdate,
|
|
7
12
|
deleteSchema: options.clientDeleteSchema,
|
|
13
|
+
deleteDocs: docs.clientDelete,
|
|
8
14
|
};
|
|
9
15
|
const serverOverrides = filterUndefined({
|
|
10
16
|
createSchema: options.serverCreateSchema,
|
|
17
|
+
createDocs: docs.serverCreate,
|
|
11
18
|
readSchema: options.serverReadSchema,
|
|
19
|
+
readDocs: docs.serverRead,
|
|
20
|
+
listDocs: docs.serverList,
|
|
12
21
|
updateSchema: options.serverUpdateSchema,
|
|
22
|
+
updateDocs: docs.serverUpdate,
|
|
13
23
|
deleteSchema: options.serverDeleteSchema,
|
|
24
|
+
deleteDocs: docs.serverDelete,
|
|
14
25
|
});
|
|
15
26
|
const server = {
|
|
16
27
|
...client,
|
|
@@ -18,9 +29,14 @@ export function createCrud(options) {
|
|
|
18
29
|
};
|
|
19
30
|
const adminOverrides = filterUndefined({
|
|
20
31
|
createSchema: options.adminCreateSchema,
|
|
32
|
+
createDocs: docs.adminCreate,
|
|
21
33
|
readSchema: options.adminReadSchema,
|
|
34
|
+
readDocs: docs.adminRead,
|
|
35
|
+
listDocs: docs.adminList,
|
|
22
36
|
updateSchema: options.adminUpdateSchema,
|
|
37
|
+
updateDocs: docs.adminUpdate,
|
|
23
38
|
deleteSchema: options.adminDeleteSchema,
|
|
39
|
+
deleteDocs: docs.adminDelete,
|
|
24
40
|
});
|
|
25
41
|
const admin = {
|
|
26
42
|
...server,
|
|
@@ -104,11 +104,12 @@ export type ProductionModeError = {
|
|
|
104
104
|
export type OrglikeJson = {
|
|
105
105
|
id: string;
|
|
106
106
|
displayName: string;
|
|
107
|
+
profileImageUrl?: string;
|
|
107
108
|
createdAtMillis: number;
|
|
108
109
|
};
|
|
109
110
|
export type TeamJson = OrglikeJson;
|
|
110
111
|
export type OrganizationJson = OrglikeJson;
|
|
111
|
-
export type OrglikeCustomizableJson = Pick<OrglikeJson, "displayName">;
|
|
112
|
+
export type OrglikeCustomizableJson = Pick<OrglikeJson, "displayName" | "profileImageUrl">;
|
|
112
113
|
export type TeamCustomizableJson = OrglikeCustomizableJson;
|
|
113
114
|
export type TeamMemberJson = {
|
|
114
115
|
userId: string;
|
|
@@ -160,13 +161,13 @@ export declare class StackClientInterface {
|
|
|
160
161
|
password: string;
|
|
161
162
|
} | {
|
|
162
163
|
onlyVerifyCode: boolean;
|
|
163
|
-
})): Promise<KnownErrors["
|
|
164
|
+
})): Promise<KnownErrors["VerificationCodeError"] | undefined>;
|
|
164
165
|
updatePassword(options: {
|
|
165
166
|
oldPassword: string;
|
|
166
167
|
newPassword: string;
|
|
167
168
|
}, session: InternalSession): Promise<KnownErrors["PasswordMismatch"] | KnownErrors["PasswordRequirementsNotMet"] | undefined>;
|
|
168
|
-
verifyPasswordResetCode(code: string): Promise<KnownErrors["
|
|
169
|
-
verifyEmail(code: string): Promise<KnownErrors["
|
|
169
|
+
verifyPasswordResetCode(code: string): Promise<KnownErrors["VerificationCodeError"] | undefined>;
|
|
170
|
+
verifyEmail(code: string): Promise<KnownErrors["VerificationCodeError"] | undefined>;
|
|
170
171
|
signInWithCredential(email: string, password: string, session: InternalSession): Promise<KnownErrors["EmailPasswordMismatch"] | {
|
|
171
172
|
accessToken: string;
|
|
172
173
|
refreshToken: string;
|
|
@@ -175,7 +176,7 @@ export declare class StackClientInterface {
|
|
|
175
176
|
accessToken: string;
|
|
176
177
|
refreshToken: string;
|
|
177
178
|
}>;
|
|
178
|
-
signInWithMagicLink(code: string, session: InternalSession): Promise<KnownErrors["
|
|
179
|
+
signInWithMagicLink(code: string, session: InternalSession): Promise<KnownErrors["VerificationCodeError"] | {
|
|
179
180
|
newUser: boolean;
|
|
180
181
|
accessToken: string;
|
|
181
182
|
refreshToken: string;
|
|
@@ -292,7 +292,7 @@ export class StackClientInterface {
|
|
|
292
292
|
"Content-Type": "application/json"
|
|
293
293
|
},
|
|
294
294
|
body: JSON.stringify(options),
|
|
295
|
-
}, null, [KnownErrors.
|
|
295
|
+
}, null, [KnownErrors.VerificationCodeError]);
|
|
296
296
|
if (res.status === "error") {
|
|
297
297
|
return res.error;
|
|
298
298
|
}
|
|
@@ -311,7 +311,7 @@ export class StackClientInterface {
|
|
|
311
311
|
}
|
|
312
312
|
async verifyPasswordResetCode(code) {
|
|
313
313
|
const res = await this.resetPassword({ code, onlyVerifyCode: true });
|
|
314
|
-
if (res && !(res instanceof KnownErrors.
|
|
314
|
+
if (res && !(res instanceof KnownErrors.VerificationCodeError)) {
|
|
315
315
|
throw res;
|
|
316
316
|
}
|
|
317
317
|
return res;
|
|
@@ -325,7 +325,7 @@ export class StackClientInterface {
|
|
|
325
325
|
body: JSON.stringify({
|
|
326
326
|
code,
|
|
327
327
|
}),
|
|
328
|
-
}, null, [KnownErrors.
|
|
328
|
+
}, null, [KnownErrors.VerificationCodeError]);
|
|
329
329
|
if (res.status === "error") {
|
|
330
330
|
return res.error;
|
|
331
331
|
}
|
|
@@ -380,7 +380,7 @@ export class StackClientInterface {
|
|
|
380
380
|
body: JSON.stringify({
|
|
381
381
|
code,
|
|
382
382
|
}),
|
|
383
|
-
}, null, [KnownErrors.
|
|
383
|
+
}, null, [KnownErrors.VerificationCodeError]);
|
|
384
384
|
if (res.status === "error") {
|
|
385
385
|
return res.error;
|
|
386
386
|
}
|
|
@@ -1,97 +1,110 @@
|
|
|
1
1
|
import { CrudTypeOf } from "../../crud";
|
|
2
|
-
import * as yup from "yup";
|
|
3
2
|
export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
4
|
-
clientReadSchema: yup.ObjectSchema<{
|
|
5
|
-
|
|
6
|
-
displayName: string | null;
|
|
3
|
+
clientReadSchema: import("yup").ObjectSchema<{
|
|
4
|
+
project_id: string;
|
|
7
5
|
id: string;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} | null, yup.AnyObject, {
|
|
20
|
-
|
|
6
|
+
display_name: string | null;
|
|
7
|
+
client_metadata: {} | null;
|
|
8
|
+
primary_email: string | null;
|
|
9
|
+
primary_email_verified: NonNullable<boolean | undefined>;
|
|
10
|
+
selected_team_id: string | null;
|
|
11
|
+
selected_team: {} | null;
|
|
12
|
+
profile_image_url: string | null;
|
|
13
|
+
signed_up_at_millis: number;
|
|
14
|
+
has_password: NonNullable<boolean | undefined>;
|
|
15
|
+
auth_with_email: NonNullable<boolean | undefined>;
|
|
16
|
+
oauth_providers: string[];
|
|
17
|
+
} | null, import("yup").AnyObject, {
|
|
18
|
+
project_id: undefined;
|
|
21
19
|
id: undefined;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
serverMetadata: undefined;
|
|
20
|
+
primary_email: undefined;
|
|
21
|
+
primary_email_verified: undefined;
|
|
22
|
+
display_name: undefined;
|
|
23
|
+
selected_team: undefined;
|
|
24
|
+
selected_team_id: undefined;
|
|
25
|
+
profile_image_url: undefined;
|
|
26
|
+
signed_up_at_millis: undefined;
|
|
27
|
+
has_password: undefined;
|
|
28
|
+
auth_with_email: undefined;
|
|
29
|
+
oauth_providers: undefined;
|
|
30
|
+
client_metadata: undefined;
|
|
31
|
+
server_metadata: undefined;
|
|
35
32
|
}, "">;
|
|
36
|
-
serverReadSchema: yup.ObjectSchema<{
|
|
37
|
-
|
|
33
|
+
serverReadSchema: import("yup").ObjectSchema<{
|
|
34
|
+
project_id: string;
|
|
38
35
|
id: string;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
projectId: undefined;
|
|
36
|
+
primary_email: string | null;
|
|
37
|
+
primary_email_verified: NonNullable<boolean | undefined>;
|
|
38
|
+
display_name: string | null;
|
|
39
|
+
selected_team: {} | null;
|
|
40
|
+
selected_team_id: string | null;
|
|
41
|
+
profile_image_url: string | null;
|
|
42
|
+
signed_up_at_millis: number;
|
|
43
|
+
has_password: NonNullable<boolean | undefined>;
|
|
44
|
+
auth_with_email: NonNullable<boolean | undefined>;
|
|
45
|
+
oauth_providers: string[];
|
|
46
|
+
client_metadata: {} | null;
|
|
47
|
+
server_metadata: {} | null;
|
|
48
|
+
} | null, import("yup").AnyObject, {
|
|
49
|
+
project_id: undefined;
|
|
54
50
|
id: undefined;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
serverMetadata: undefined;
|
|
51
|
+
primary_email: undefined;
|
|
52
|
+
primary_email_verified: undefined;
|
|
53
|
+
display_name: undefined;
|
|
54
|
+
selected_team: undefined;
|
|
55
|
+
selected_team_id: undefined;
|
|
56
|
+
profile_image_url: undefined;
|
|
57
|
+
signed_up_at_millis: undefined;
|
|
58
|
+
has_password: undefined;
|
|
59
|
+
auth_with_email: undefined;
|
|
60
|
+
oauth_providers: undefined;
|
|
61
|
+
client_metadata: undefined;
|
|
62
|
+
server_metadata: undefined;
|
|
68
63
|
}, "">;
|
|
69
|
-
clientUpdateSchema: yup.ObjectSchema<{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}, yup.AnyObject, {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
64
|
+
clientUpdateSchema: import("yup").ObjectSchema<{
|
|
65
|
+
display_name: string | null | undefined;
|
|
66
|
+
client_metadata: {} | null | undefined;
|
|
67
|
+
selected_team_id: string | null | undefined;
|
|
68
|
+
}, import("yup").AnyObject, {
|
|
69
|
+
display_name: undefined;
|
|
70
|
+
client_metadata: undefined;
|
|
71
|
+
server_metadata: undefined;
|
|
72
|
+
primary_email: undefined;
|
|
73
|
+
primary_email_verified: undefined;
|
|
74
|
+
selected_team_id: undefined;
|
|
80
75
|
}, "">;
|
|
81
|
-
serverUpdateSchema: yup.ObjectSchema<{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}, yup.AnyObject, {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
76
|
+
serverUpdateSchema: import("yup").ObjectSchema<{
|
|
77
|
+
display_name: string | null | undefined;
|
|
78
|
+
client_metadata: {} | null | undefined;
|
|
79
|
+
server_metadata: {} | null | undefined;
|
|
80
|
+
primary_email: string | null | undefined;
|
|
81
|
+
primary_email_verified: boolean | undefined;
|
|
82
|
+
selected_team_id: string | null | undefined;
|
|
83
|
+
}, import("yup").AnyObject, {
|
|
84
|
+
display_name: undefined;
|
|
85
|
+
client_metadata: undefined;
|
|
86
|
+
server_metadata: undefined;
|
|
87
|
+
primary_email: undefined;
|
|
88
|
+
primary_email_verified: undefined;
|
|
89
|
+
selected_team_id: undefined;
|
|
95
90
|
}, "">;
|
|
91
|
+
serverDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
|
|
92
|
+
docs: {
|
|
93
|
+
clientRead: {
|
|
94
|
+
summary: string;
|
|
95
|
+
description: string;
|
|
96
|
+
tags: string[];
|
|
97
|
+
};
|
|
98
|
+
clientUpdate: {
|
|
99
|
+
summary: string;
|
|
100
|
+
description: string;
|
|
101
|
+
tags: string[];
|
|
102
|
+
};
|
|
103
|
+
clientDelete: {
|
|
104
|
+
summary: string;
|
|
105
|
+
description: string;
|
|
106
|
+
tags: string[];
|
|
107
|
+
};
|
|
108
|
+
};
|
|
96
109
|
}>;
|
|
97
110
|
export type CurrentUserCrud = CrudTypeOf<typeof currentUserCrud>;
|
|
@@ -1,31 +1,49 @@
|
|
|
1
1
|
import { createCrud } from "../../crud";
|
|
2
|
-
import { usersCrudServerReadSchema, usersCrudServerUpdateSchema } from "./users";
|
|
2
|
+
import { usersCrudServerReadSchema, usersCrudServerUpdateSchema, usersCrudServerDeleteSchema } from "./users";
|
|
3
3
|
const clientUpdateSchema = usersCrudServerUpdateSchema.pick([
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
4
|
+
"display_name",
|
|
5
|
+
"client_metadata",
|
|
6
|
+
"selected_team_id",
|
|
7
7
|
]).required();
|
|
8
8
|
const serverUpdateSchema = usersCrudServerUpdateSchema;
|
|
9
9
|
const clientReadSchema = usersCrudServerReadSchema.pick([
|
|
10
|
-
"
|
|
10
|
+
"project_id",
|
|
11
11
|
"id",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"selectedTeam",
|
|
12
|
+
"primary_email",
|
|
13
|
+
"primary_email_verified",
|
|
14
|
+
"display_name",
|
|
15
|
+
"client_metadata",
|
|
16
|
+
"profile_image_url",
|
|
17
|
+
"signed_up_at_millis",
|
|
18
|
+
"has_password",
|
|
19
|
+
"auth_with_email",
|
|
20
|
+
"oauth_providers",
|
|
21
|
+
"selected_team_id",
|
|
22
|
+
"selected_team",
|
|
24
23
|
]).nullable().defined();
|
|
25
24
|
const serverReadSchema = usersCrudServerReadSchema.nullable().defined();
|
|
25
|
+
const serverDeleteSchema = usersCrudServerDeleteSchema;
|
|
26
26
|
export const currentUserCrud = createCrud({
|
|
27
27
|
clientReadSchema,
|
|
28
28
|
serverReadSchema,
|
|
29
29
|
clientUpdateSchema,
|
|
30
30
|
serverUpdateSchema,
|
|
31
|
+
serverDeleteSchema,
|
|
32
|
+
docs: {
|
|
33
|
+
clientRead: {
|
|
34
|
+
summary: 'Get current user',
|
|
35
|
+
description: 'Gets the currently authenticated user.',
|
|
36
|
+
tags: ['Users'],
|
|
37
|
+
},
|
|
38
|
+
clientUpdate: {
|
|
39
|
+
summary: 'Update current user',
|
|
40
|
+
description: 'Updates the currently authenticated user. Only the values provided will be updated.',
|
|
41
|
+
tags: ['Users'],
|
|
42
|
+
},
|
|
43
|
+
clientDelete: {
|
|
44
|
+
summary: 'Delete current user',
|
|
45
|
+
description: 'Deletes the currently authenticated user. Use this with caution.',
|
|
46
|
+
tags: ['Users'],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
31
49
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CrudTypeOf } from "../../crud";
|
|
2
2
|
import * as yup from "yup";
|
|
3
3
|
export declare const accessTokenReadSchema: yup.ObjectSchema<{
|
|
4
|
-
|
|
4
|
+
access_token: string;
|
|
5
5
|
}, yup.AnyObject, {
|
|
6
|
-
|
|
6
|
+
access_token: undefined;
|
|
7
7
|
}, "">;
|
|
8
8
|
export declare const accessTokenCreateSchema: yup.ObjectSchema<{
|
|
9
9
|
scope: string | undefined;
|
|
@@ -12,9 +12,9 @@ export declare const accessTokenCreateSchema: yup.ObjectSchema<{
|
|
|
12
12
|
}, "">;
|
|
13
13
|
export declare const accessTokenCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
14
14
|
clientReadSchema: yup.ObjectSchema<{
|
|
15
|
-
|
|
15
|
+
access_token: string;
|
|
16
16
|
}, yup.AnyObject, {
|
|
17
|
-
|
|
17
|
+
access_token: undefined;
|
|
18
18
|
}, "">;
|
|
19
19
|
clientCreateSchema: yup.ObjectSchema<{
|
|
20
20
|
scope: string | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createCrud } from "../../crud";
|
|
2
2
|
import * as yup from "yup";
|
|
3
3
|
export const accessTokenReadSchema = yup.object({
|
|
4
|
-
|
|
4
|
+
access_token: yup.string().required(),
|
|
5
5
|
}).required();
|
|
6
6
|
export const accessTokenCreateSchema = yup.object({
|
|
7
7
|
scope: yup.string().optional(),
|