@stackframe/stack-shared 2.4.24 → 2.4.25
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 +7 -0
- package/dist/crud.d.ts +2 -2
- package/dist/interface/crud/current-user.d.ts +94 -158
- package/dist/interface/crud/email-templates.d.ts +27 -86
- package/dist/interface/crud/fields.d.ts +11 -0
- package/dist/interface/crud/fields.js +12 -0
- package/dist/interface/crud/oauth.d.ts +12 -48
- package/dist/interface/crud/users.d.ts +60 -125
- package/dist/interface/crud/users.js +22 -25
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/crud.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type CrudSchema<ClientSchema extends InnerCrudSchema = InnerCrudSchema, S
|
|
|
16
16
|
hasUpdate: boolean;
|
|
17
17
|
hasDelete: boolean;
|
|
18
18
|
};
|
|
19
|
-
type CrudSchemaCreationOptions = {
|
|
19
|
+
export type CrudSchemaCreationOptions = {
|
|
20
20
|
clientCreateSchema?: yup.Schema<any>;
|
|
21
21
|
clientReadSchema?: yup.Schema<any>;
|
|
22
22
|
clientUpdateSchema?: yup.Schema<any>;
|
|
@@ -49,7 +49,7 @@ type FillInOptionalsStep<O extends FillInOptionalsPrepareStep<CrudSchemaCreation
|
|
|
49
49
|
};
|
|
50
50
|
type FillInOptionals<O extends CrudSchemaCreationOptions> = FillInOptionalsStep<FillInOptionalsStep<FillInOptionalsStep<FillInOptionalsPrepareStep<O>>>>;
|
|
51
51
|
type CrudSchemaFromOptionsInner<O extends FillInOptionals<any>> = CrudSchema<InnerCrudSchema<O['clientCreateSchema'], O['clientReadSchema'], O['clientUpdateSchema'], O['clientDeleteSchema']>, InnerCrudSchema<O['serverCreateSchema'], O['serverReadSchema'], O['serverUpdateSchema'], O['serverDeleteSchema']>, InnerCrudSchema<O['adminCreateSchema'], O['adminReadSchema'], O['adminUpdateSchema'], O['adminDeleteSchema']>>;
|
|
52
|
-
type CrudSchemaFromOptions<O extends CrudSchemaCreationOptions> = CrudSchemaFromOptionsInner<FillInOptionals<O>>;
|
|
52
|
+
export type CrudSchemaFromOptions<O extends CrudSchemaCreationOptions> = CrudSchemaFromOptionsInner<FillInOptionals<O>>;
|
|
53
53
|
type InnerCrudTypeOf<S extends InnerCrudSchema> = (S['createSchema'] extends {} ? {
|
|
54
54
|
Create: yup.InferType<S['createSchema']>;
|
|
55
55
|
} : {}) & (S['readSchema'] extends {} ? {
|
|
@@ -1,161 +1,97 @@
|
|
|
1
1
|
import { CrudTypeOf } from "../../crud";
|
|
2
2
|
import * as yup from "yup";
|
|
3
|
-
export declare const currentUserCrud: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
serverMetadata: {};
|
|
98
|
-
primaryEmail: undefined;
|
|
99
|
-
primaryEmailVerified: undefined;
|
|
100
|
-
selectedTeamId: undefined;
|
|
101
|
-
}, "">;
|
|
102
|
-
deleteSchema: undefined;
|
|
103
|
-
};
|
|
104
|
-
admin: {
|
|
105
|
-
createSchema: undefined;
|
|
106
|
-
readSchema: yup.ObjectSchema<{
|
|
107
|
-
projectId: string;
|
|
108
|
-
id: string;
|
|
109
|
-
primaryEmail: string | null;
|
|
110
|
-
primaryEmailVerified: NonNullable<boolean | undefined>;
|
|
111
|
-
displayName: string | null;
|
|
112
|
-
clientMetadata: {} | null;
|
|
113
|
-
selectedTeamId: string | null;
|
|
114
|
-
selectedTeam: {} | null;
|
|
115
|
-
profileImageUrl: string | null;
|
|
116
|
-
signedUpAtMillis: number;
|
|
117
|
-
authMethod: NonNullable<"credential" | "oauth" | undefined>;
|
|
118
|
-
hasPassword: NonNullable<boolean | undefined>;
|
|
119
|
-
authWithEmail: NonNullable<boolean | undefined>;
|
|
120
|
-
oauthProviders: string[];
|
|
121
|
-
serverMetadata: {} | null;
|
|
122
|
-
} | null, yup.AnyObject, {
|
|
123
|
-
projectId: undefined;
|
|
124
|
-
id: undefined;
|
|
125
|
-
primaryEmail: undefined;
|
|
126
|
-
primaryEmailVerified: undefined;
|
|
127
|
-
displayName: undefined;
|
|
128
|
-
clientMetadata: undefined;
|
|
129
|
-
selectedTeamId: undefined;
|
|
130
|
-
selectedTeam: undefined;
|
|
131
|
-
profileImageUrl: undefined;
|
|
132
|
-
signedUpAtMillis: undefined;
|
|
133
|
-
authMethod: undefined;
|
|
134
|
-
hasPassword: undefined;
|
|
135
|
-
authWithEmail: undefined;
|
|
136
|
-
oauthProviders: undefined;
|
|
137
|
-
serverMetadata: undefined;
|
|
138
|
-
}, "">;
|
|
139
|
-
updateSchema: yup.ObjectSchema<{
|
|
140
|
-
displayName: string | undefined;
|
|
141
|
-
clientMetadata: {} | undefined;
|
|
142
|
-
serverMetadata: {} | undefined;
|
|
143
|
-
primaryEmail: string | undefined;
|
|
144
|
-
primaryEmailVerified: boolean | undefined;
|
|
145
|
-
selectedTeamId: string | null | undefined;
|
|
146
|
-
}, yup.AnyObject, {
|
|
147
|
-
displayName: undefined;
|
|
148
|
-
clientMetadata: {};
|
|
149
|
-
serverMetadata: {};
|
|
150
|
-
primaryEmail: undefined;
|
|
151
|
-
primaryEmailVerified: undefined;
|
|
152
|
-
selectedTeamId: undefined;
|
|
153
|
-
}, "">;
|
|
154
|
-
deleteSchema: undefined;
|
|
155
|
-
};
|
|
156
|
-
hasCreate: boolean;
|
|
157
|
-
hasRead: boolean;
|
|
158
|
-
hasUpdate: boolean;
|
|
159
|
-
hasDelete: boolean;
|
|
160
|
-
};
|
|
3
|
+
export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
4
|
+
clientReadSchema: yup.ObjectSchema<{
|
|
5
|
+
displayName: string | null;
|
|
6
|
+
id: string;
|
|
7
|
+
projectId: string;
|
|
8
|
+
clientMetadata: {} | null;
|
|
9
|
+
primaryEmail: string | null;
|
|
10
|
+
primaryEmailVerified: NonNullable<boolean | undefined>;
|
|
11
|
+
selectedTeamId: string | null;
|
|
12
|
+
selectedTeam: {} | null;
|
|
13
|
+
profileImageUrl: string | null;
|
|
14
|
+
signedUpAtMillis: number;
|
|
15
|
+
authMethod: NonNullable<"credential" | "oauth" | undefined>;
|
|
16
|
+
hasPassword: NonNullable<boolean | undefined>;
|
|
17
|
+
authWithEmail: NonNullable<boolean | undefined>;
|
|
18
|
+
oauthProviders: string[];
|
|
19
|
+
} | null, yup.AnyObject, {
|
|
20
|
+
projectId: undefined;
|
|
21
|
+
id: undefined;
|
|
22
|
+
primaryEmail: undefined;
|
|
23
|
+
primaryEmailVerified: undefined;
|
|
24
|
+
displayName: undefined;
|
|
25
|
+
selectedTeam: undefined;
|
|
26
|
+
selectedTeamId: undefined;
|
|
27
|
+
profileImageUrl: undefined;
|
|
28
|
+
signedUpAtMillis: undefined;
|
|
29
|
+
authMethod: undefined;
|
|
30
|
+
hasPassword: undefined;
|
|
31
|
+
authWithEmail: undefined;
|
|
32
|
+
oauthProviders: undefined;
|
|
33
|
+
clientMetadata: undefined;
|
|
34
|
+
serverMetadata: undefined;
|
|
35
|
+
}, "">;
|
|
36
|
+
serverReadSchema: yup.ObjectSchema<{
|
|
37
|
+
projectId: string;
|
|
38
|
+
id: string;
|
|
39
|
+
primaryEmail: string | null;
|
|
40
|
+
primaryEmailVerified: NonNullable<boolean | undefined>;
|
|
41
|
+
displayName: string | null;
|
|
42
|
+
selectedTeam: {} | null;
|
|
43
|
+
selectedTeamId: string | null;
|
|
44
|
+
profileImageUrl: string | null;
|
|
45
|
+
signedUpAtMillis: number;
|
|
46
|
+
authMethod: NonNullable<"credential" | "oauth" | undefined>;
|
|
47
|
+
hasPassword: NonNullable<boolean | undefined>;
|
|
48
|
+
authWithEmail: NonNullable<boolean | undefined>;
|
|
49
|
+
oauthProviders: string[];
|
|
50
|
+
clientMetadata: {} | null;
|
|
51
|
+
serverMetadata: {} | null;
|
|
52
|
+
} | null, yup.AnyObject, {
|
|
53
|
+
projectId: undefined;
|
|
54
|
+
id: undefined;
|
|
55
|
+
primaryEmail: undefined;
|
|
56
|
+
primaryEmailVerified: undefined;
|
|
57
|
+
displayName: undefined;
|
|
58
|
+
selectedTeam: undefined;
|
|
59
|
+
selectedTeamId: undefined;
|
|
60
|
+
profileImageUrl: undefined;
|
|
61
|
+
signedUpAtMillis: undefined;
|
|
62
|
+
authMethod: undefined;
|
|
63
|
+
hasPassword: undefined;
|
|
64
|
+
authWithEmail: undefined;
|
|
65
|
+
oauthProviders: undefined;
|
|
66
|
+
clientMetadata: undefined;
|
|
67
|
+
serverMetadata: undefined;
|
|
68
|
+
}, "">;
|
|
69
|
+
clientUpdateSchema: yup.ObjectSchema<{
|
|
70
|
+
displayName: string | undefined;
|
|
71
|
+
clientMetadata: {} | null | undefined;
|
|
72
|
+
selectedTeamId: string | null | undefined;
|
|
73
|
+
}, yup.AnyObject, {
|
|
74
|
+
displayName: undefined;
|
|
75
|
+
clientMetadata: undefined;
|
|
76
|
+
serverMetadata: undefined;
|
|
77
|
+
primaryEmail: undefined;
|
|
78
|
+
primaryEmailVerified: undefined;
|
|
79
|
+
selectedTeamId: undefined;
|
|
80
|
+
}, "">;
|
|
81
|
+
serverUpdateSchema: yup.ObjectSchema<{
|
|
82
|
+
displayName: string | undefined;
|
|
83
|
+
clientMetadata: {} | null | undefined;
|
|
84
|
+
serverMetadata: {} | null | undefined;
|
|
85
|
+
primaryEmail: string | null | undefined;
|
|
86
|
+
primaryEmailVerified: boolean | undefined;
|
|
87
|
+
selectedTeamId: string | null | undefined;
|
|
88
|
+
}, yup.AnyObject, {
|
|
89
|
+
displayName: undefined;
|
|
90
|
+
clientMetadata: undefined;
|
|
91
|
+
serverMetadata: undefined;
|
|
92
|
+
primaryEmail: undefined;
|
|
93
|
+
primaryEmailVerified: undefined;
|
|
94
|
+
selectedTeamId: undefined;
|
|
95
|
+
}, "">;
|
|
96
|
+
}>;
|
|
161
97
|
export type CurrentUserCrud = CrudTypeOf<typeof currentUserCrud>;
|
|
@@ -16,58 +16,25 @@ export declare const emailTemplateCrudServerUpdateSchema: yup.ObjectSchema<{
|
|
|
16
16
|
content: undefined;
|
|
17
17
|
subject: undefined;
|
|
18
18
|
}, "">;
|
|
19
|
-
export declare const emailTemplateCrud: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
content: {};
|
|
39
|
-
subject: string;
|
|
40
|
-
}, yup.AnyObject, {
|
|
41
|
-
content: undefined;
|
|
42
|
-
subject: undefined;
|
|
43
|
-
}, "">;
|
|
44
|
-
deleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
|
|
45
|
-
};
|
|
46
|
-
admin: {
|
|
47
|
-
createSchema: undefined;
|
|
48
|
-
readSchema: yup.ObjectSchema<{
|
|
49
|
-
type: NonNullable<"EMAIL_VERIFICATION" | "PASSWORD_RESET" | "MAGIC_LINK" | undefined>;
|
|
50
|
-
subject: string;
|
|
51
|
-
content: {};
|
|
52
|
-
}, yup.AnyObject, {
|
|
53
|
-
type: undefined;
|
|
54
|
-
subject: undefined;
|
|
55
|
-
content: undefined;
|
|
56
|
-
}, "">;
|
|
57
|
-
updateSchema: yup.ObjectSchema<{
|
|
58
|
-
content: {};
|
|
59
|
-
subject: string;
|
|
60
|
-
}, yup.AnyObject, {
|
|
61
|
-
content: undefined;
|
|
62
|
-
subject: undefined;
|
|
63
|
-
}, "">;
|
|
64
|
-
deleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
|
|
65
|
-
};
|
|
66
|
-
hasCreate: boolean;
|
|
67
|
-
hasRead: boolean;
|
|
68
|
-
hasUpdate: boolean;
|
|
69
|
-
hasDelete: boolean;
|
|
70
|
-
};
|
|
19
|
+
export declare const emailTemplateCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
20
|
+
serverReadSchema: yup.ObjectSchema<{
|
|
21
|
+
type: NonNullable<"EMAIL_VERIFICATION" | "PASSWORD_RESET" | "MAGIC_LINK" | undefined>;
|
|
22
|
+
subject: string;
|
|
23
|
+
content: {};
|
|
24
|
+
}, yup.AnyObject, {
|
|
25
|
+
type: undefined;
|
|
26
|
+
subject: undefined;
|
|
27
|
+
content: undefined;
|
|
28
|
+
}, "">;
|
|
29
|
+
serverUpdateSchema: yup.ObjectSchema<{
|
|
30
|
+
content: {};
|
|
31
|
+
subject: string;
|
|
32
|
+
}, yup.AnyObject, {
|
|
33
|
+
content: undefined;
|
|
34
|
+
subject: undefined;
|
|
35
|
+
}, "">;
|
|
36
|
+
serverDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
|
|
37
|
+
}>;
|
|
71
38
|
export type EmailTemplateCrud = CrudTypeOf<typeof emailTemplateCrud>;
|
|
72
39
|
export declare const listEmailTemplatesReadSchema: yup.ArraySchema<{
|
|
73
40
|
type: NonNullable<"EMAIL_VERIFICATION" | "PASSWORD_RESET" | "MAGIC_LINK" | undefined>;
|
|
@@ -82,38 +49,12 @@ export declare const emailTemplateCrudServerCreateSchema: yup.ObjectSchema<{
|
|
|
82
49
|
type: undefined;
|
|
83
50
|
content: undefined;
|
|
84
51
|
}, "">;
|
|
85
|
-
export declare const listEmailTemplatesCrud: {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
createSchema: undefined;
|
|
94
|
-
readSchema: yup.ArraySchema<{
|
|
95
|
-
type: NonNullable<"EMAIL_VERIFICATION" | "PASSWORD_RESET" | "MAGIC_LINK" | undefined>;
|
|
96
|
-
default: NonNullable<boolean | undefined>;
|
|
97
|
-
subject: string;
|
|
98
|
-
content: {};
|
|
99
|
-
}[], yup.AnyObject, "", "">;
|
|
100
|
-
updateSchema: undefined;
|
|
101
|
-
deleteSchema: undefined;
|
|
102
|
-
};
|
|
103
|
-
admin: {
|
|
104
|
-
createSchema: undefined;
|
|
105
|
-
readSchema: yup.ArraySchema<{
|
|
106
|
-
type: NonNullable<"EMAIL_VERIFICATION" | "PASSWORD_RESET" | "MAGIC_LINK" | undefined>;
|
|
107
|
-
default: NonNullable<boolean | undefined>;
|
|
108
|
-
subject: string;
|
|
109
|
-
content: {};
|
|
110
|
-
}[], yup.AnyObject, "", "">;
|
|
111
|
-
updateSchema: undefined;
|
|
112
|
-
deleteSchema: undefined;
|
|
113
|
-
};
|
|
114
|
-
hasCreate: boolean;
|
|
115
|
-
hasRead: boolean;
|
|
116
|
-
hasUpdate: boolean;
|
|
117
|
-
hasDelete: boolean;
|
|
118
|
-
};
|
|
52
|
+
export declare const listEmailTemplatesCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
53
|
+
serverReadSchema: yup.ArraySchema<{
|
|
54
|
+
type: NonNullable<"EMAIL_VERIFICATION" | "PASSWORD_RESET" | "MAGIC_LINK" | undefined>;
|
|
55
|
+
default: NonNullable<boolean | undefined>;
|
|
56
|
+
subject: string;
|
|
57
|
+
content: {};
|
|
58
|
+
}[], yup.AnyObject, "", "">;
|
|
59
|
+
}>;
|
|
119
60
|
export type ListEmailTemplatesCrud = CrudTypeOf<typeof listEmailTemplatesCrud>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as yup from "yup";
|
|
2
|
+
export declare const projectIdSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
3
|
+
export declare const userIdSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
4
|
+
export declare const primaryEmailSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
5
|
+
export declare const primaryEmailVerifiedSchema: yup.BooleanSchema<boolean | undefined, yup.AnyObject, undefined, "">;
|
|
6
|
+
export declare const userDisplayNameSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
7
|
+
export declare const selectedTeamIdSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
8
|
+
export declare const profileImageUrlSchema: yup.StringSchema<string | undefined, yup.AnyObject, undefined, "">;
|
|
9
|
+
export declare const signedUpAtMillisSchema: yup.NumberSchema<number | undefined, yup.AnyObject, undefined, "">;
|
|
10
|
+
export declare const userClientMetadataSchema: yup.MixedSchema<{} | null, yup.AnyObject, undefined, "">;
|
|
11
|
+
export declare const userServerMetadataSchema: yup.MixedSchema<{} | null, yup.AnyObject, undefined, "">;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as yup from "yup";
|
|
2
|
+
import { yupJson } from "../../utils/yup";
|
|
3
|
+
export const projectIdSchema = yup.string().meta({ description: 'Stack dashboard project ID', example: 'project-id' });
|
|
4
|
+
export const userIdSchema = yup.string().meta({ description: 'Unique user identifier', example: 'user-id' });
|
|
5
|
+
export const primaryEmailSchema = yup.string().meta({ description: 'Primary email', example: 'johndoe@email.com' });
|
|
6
|
+
export const primaryEmailVerifiedSchema = yup.boolean().meta({ description: 'Primary email verified', example: true });
|
|
7
|
+
export const userDisplayNameSchema = yup.string().meta({ description: 'User display name', example: 'John Doe' });
|
|
8
|
+
export const selectedTeamIdSchema = yup.string().meta({ description: 'Selected team ID', example: 'team-id' });
|
|
9
|
+
export const profileImageUrlSchema = yup.string().meta({ description: 'Profile image URL', example: 'https://example.com/image.jpg' });
|
|
10
|
+
export const signedUpAtMillisSchema = yup.number().meta({ description: 'Signed up at milliseconds', example: 1630000000000 });
|
|
11
|
+
export const userClientMetadataSchema = yupJson.meta({ description: 'Client metadata. Used as a data store, accessible from the client side', example: { key: 'value' } });
|
|
12
|
+
export const userServerMetadataSchema = yupJson.meta({ description: 'Server metadata. Used as a data store, only accessible from the server side', example: { key: 'value' } });
|
|
@@ -10,52 +10,16 @@ export declare const accessTokenCreateSchema: yup.ObjectSchema<{
|
|
|
10
10
|
}, yup.AnyObject, {
|
|
11
11
|
scope: undefined;
|
|
12
12
|
}, "">;
|
|
13
|
-
export declare const accessTokenCrud: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
updateSchema: undefined;
|
|
26
|
-
deleteSchema: undefined;
|
|
27
|
-
};
|
|
28
|
-
server: {
|
|
29
|
-
createSchema: yup.ObjectSchema<{
|
|
30
|
-
scope: string | undefined;
|
|
31
|
-
}, yup.AnyObject, {
|
|
32
|
-
scope: undefined;
|
|
33
|
-
}, "">;
|
|
34
|
-
readSchema: yup.ObjectSchema<{
|
|
35
|
-
accessToken: string;
|
|
36
|
-
}, yup.AnyObject, {
|
|
37
|
-
accessToken: undefined;
|
|
38
|
-
}, "">;
|
|
39
|
-
updateSchema: undefined;
|
|
40
|
-
deleteSchema: undefined;
|
|
41
|
-
};
|
|
42
|
-
admin: {
|
|
43
|
-
createSchema: yup.ObjectSchema<{
|
|
44
|
-
scope: string | undefined;
|
|
45
|
-
}, yup.AnyObject, {
|
|
46
|
-
scope: undefined;
|
|
47
|
-
}, "">;
|
|
48
|
-
readSchema: yup.ObjectSchema<{
|
|
49
|
-
accessToken: string;
|
|
50
|
-
}, yup.AnyObject, {
|
|
51
|
-
accessToken: undefined;
|
|
52
|
-
}, "">;
|
|
53
|
-
updateSchema: undefined;
|
|
54
|
-
deleteSchema: undefined;
|
|
55
|
-
};
|
|
56
|
-
hasCreate: boolean;
|
|
57
|
-
hasRead: boolean;
|
|
58
|
-
hasUpdate: boolean;
|
|
59
|
-
hasDelete: boolean;
|
|
60
|
-
};
|
|
13
|
+
export declare const accessTokenCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
14
|
+
clientReadSchema: yup.ObjectSchema<{
|
|
15
|
+
accessToken: string;
|
|
16
|
+
}, yup.AnyObject, {
|
|
17
|
+
accessToken: undefined;
|
|
18
|
+
}, "">;
|
|
19
|
+
clientCreateSchema: yup.ObjectSchema<{
|
|
20
|
+
scope: string | undefined;
|
|
21
|
+
}, yup.AnyObject, {
|
|
22
|
+
scope: undefined;
|
|
23
|
+
}, "">;
|
|
24
|
+
}>;
|
|
61
25
|
export type AccessTokenCrud = CrudTypeOf<typeof accessTokenCrud>;
|
|
@@ -2,15 +2,15 @@ import { CrudTypeOf } from "../../crud";
|
|
|
2
2
|
import * as yup from "yup";
|
|
3
3
|
export declare const usersCrudServerUpdateSchema: yup.ObjectSchema<{
|
|
4
4
|
displayName: string | undefined;
|
|
5
|
-
clientMetadata: {} | undefined;
|
|
6
|
-
serverMetadata: {} | undefined;
|
|
7
|
-
primaryEmail: string | undefined;
|
|
5
|
+
clientMetadata: {} | null | undefined;
|
|
6
|
+
serverMetadata: {} | null | undefined;
|
|
7
|
+
primaryEmail: string | null | undefined;
|
|
8
8
|
primaryEmailVerified: boolean | undefined;
|
|
9
9
|
selectedTeamId: string | null | undefined;
|
|
10
10
|
}, yup.AnyObject, {
|
|
11
11
|
displayName: undefined;
|
|
12
|
-
clientMetadata:
|
|
13
|
-
serverMetadata:
|
|
12
|
+
clientMetadata: undefined;
|
|
13
|
+
serverMetadata: undefined;
|
|
14
14
|
primaryEmail: undefined;
|
|
15
15
|
primaryEmailVerified: undefined;
|
|
16
16
|
selectedTeamId: undefined;
|
|
@@ -21,15 +21,15 @@ export declare const usersCrudServerReadSchema: yup.ObjectSchema<{
|
|
|
21
21
|
primaryEmail: string | null;
|
|
22
22
|
primaryEmailVerified: NonNullable<boolean | undefined>;
|
|
23
23
|
displayName: string | null;
|
|
24
|
-
clientMetadata: {} | null;
|
|
25
|
-
selectedTeamId: string | null;
|
|
26
24
|
selectedTeam: {} | null;
|
|
25
|
+
selectedTeamId: string | null;
|
|
27
26
|
profileImageUrl: string | null;
|
|
28
27
|
signedUpAtMillis: number;
|
|
29
28
|
authMethod: NonNullable<"credential" | "oauth" | undefined>;
|
|
30
29
|
hasPassword: NonNullable<boolean | undefined>;
|
|
31
30
|
authWithEmail: NonNullable<boolean | undefined>;
|
|
32
31
|
oauthProviders: string[];
|
|
32
|
+
clientMetadata: {} | null;
|
|
33
33
|
serverMetadata: {} | null;
|
|
34
34
|
}, yup.AnyObject, {
|
|
35
35
|
projectId: undefined;
|
|
@@ -37,131 +37,66 @@ export declare const usersCrudServerReadSchema: yup.ObjectSchema<{
|
|
|
37
37
|
primaryEmail: undefined;
|
|
38
38
|
primaryEmailVerified: undefined;
|
|
39
39
|
displayName: undefined;
|
|
40
|
-
clientMetadata: undefined;
|
|
41
|
-
selectedTeamId: undefined;
|
|
42
40
|
selectedTeam: undefined;
|
|
41
|
+
selectedTeamId: undefined;
|
|
43
42
|
profileImageUrl: undefined;
|
|
44
43
|
signedUpAtMillis: undefined;
|
|
45
44
|
authMethod: undefined;
|
|
46
45
|
hasPassword: undefined;
|
|
47
46
|
authWithEmail: undefined;
|
|
48
47
|
oauthProviders: undefined;
|
|
48
|
+
clientMetadata: undefined;
|
|
49
49
|
serverMetadata: undefined;
|
|
50
50
|
}, "">;
|
|
51
|
-
export declare const usersCrud: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
clientMetadata: {};
|
|
103
|
-
serverMetadata: {};
|
|
104
|
-
primaryEmail: undefined;
|
|
105
|
-
primaryEmailVerified: undefined;
|
|
106
|
-
selectedTeamId: undefined;
|
|
107
|
-
}, "">;
|
|
108
|
-
deleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
|
|
109
|
-
};
|
|
110
|
-
admin: {
|
|
111
|
-
createSchema: undefined;
|
|
112
|
-
readSchema: yup.ObjectSchema<{
|
|
113
|
-
projectId: string;
|
|
114
|
-
id: string;
|
|
115
|
-
primaryEmail: string | null;
|
|
116
|
-
primaryEmailVerified: NonNullable<boolean | undefined>;
|
|
117
|
-
displayName: string | null;
|
|
118
|
-
clientMetadata: {} | null;
|
|
119
|
-
selectedTeamId: string | null;
|
|
120
|
-
selectedTeam: {} | null;
|
|
121
|
-
profileImageUrl: string | null;
|
|
122
|
-
signedUpAtMillis: number;
|
|
123
|
-
authMethod: NonNullable<"credential" | "oauth" | undefined>;
|
|
124
|
-
hasPassword: NonNullable<boolean | undefined>;
|
|
125
|
-
authWithEmail: NonNullable<boolean | undefined>;
|
|
126
|
-
oauthProviders: string[];
|
|
127
|
-
serverMetadata: {} | null;
|
|
128
|
-
}, yup.AnyObject, {
|
|
129
|
-
projectId: undefined;
|
|
130
|
-
id: undefined;
|
|
131
|
-
primaryEmail: undefined;
|
|
132
|
-
primaryEmailVerified: undefined;
|
|
133
|
-
displayName: undefined;
|
|
134
|
-
clientMetadata: undefined;
|
|
135
|
-
selectedTeamId: undefined;
|
|
136
|
-
selectedTeam: undefined;
|
|
137
|
-
profileImageUrl: undefined;
|
|
138
|
-
signedUpAtMillis: undefined;
|
|
139
|
-
authMethod: undefined;
|
|
140
|
-
hasPassword: undefined;
|
|
141
|
-
authWithEmail: undefined;
|
|
142
|
-
oauthProviders: undefined;
|
|
143
|
-
serverMetadata: undefined;
|
|
144
|
-
}, "">;
|
|
145
|
-
updateSchema: yup.ObjectSchema<{
|
|
146
|
-
displayName: string | undefined;
|
|
147
|
-
clientMetadata: {} | undefined;
|
|
148
|
-
serverMetadata: {} | undefined;
|
|
149
|
-
primaryEmail: string | undefined;
|
|
150
|
-
primaryEmailVerified: boolean | undefined;
|
|
151
|
-
selectedTeamId: string | null | undefined;
|
|
152
|
-
}, yup.AnyObject, {
|
|
153
|
-
displayName: undefined;
|
|
154
|
-
clientMetadata: {};
|
|
155
|
-
serverMetadata: {};
|
|
156
|
-
primaryEmail: undefined;
|
|
157
|
-
primaryEmailVerified: undefined;
|
|
158
|
-
selectedTeamId: undefined;
|
|
159
|
-
}, "">;
|
|
160
|
-
deleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
|
|
161
|
-
};
|
|
162
|
-
hasCreate: boolean;
|
|
163
|
-
hasRead: boolean;
|
|
164
|
-
hasUpdate: boolean;
|
|
165
|
-
hasDelete: boolean;
|
|
166
|
-
};
|
|
51
|
+
export declare const usersCrud: import("../../crud").CrudSchemaFromOptions<{
|
|
52
|
+
serverReadSchema: yup.ObjectSchema<{
|
|
53
|
+
projectId: string;
|
|
54
|
+
id: string;
|
|
55
|
+
primaryEmail: string | null;
|
|
56
|
+
primaryEmailVerified: NonNullable<boolean | undefined>;
|
|
57
|
+
displayName: string | null;
|
|
58
|
+
selectedTeam: {} | null;
|
|
59
|
+
selectedTeamId: string | null;
|
|
60
|
+
profileImageUrl: string | null;
|
|
61
|
+
signedUpAtMillis: number;
|
|
62
|
+
authMethod: NonNullable<"credential" | "oauth" | undefined>;
|
|
63
|
+
hasPassword: NonNullable<boolean | undefined>;
|
|
64
|
+
authWithEmail: NonNullable<boolean | undefined>;
|
|
65
|
+
oauthProviders: string[];
|
|
66
|
+
clientMetadata: {} | null;
|
|
67
|
+
serverMetadata: {} | null;
|
|
68
|
+
}, yup.AnyObject, {
|
|
69
|
+
projectId: undefined;
|
|
70
|
+
id: undefined;
|
|
71
|
+
primaryEmail: undefined;
|
|
72
|
+
primaryEmailVerified: undefined;
|
|
73
|
+
displayName: undefined;
|
|
74
|
+
selectedTeam: undefined;
|
|
75
|
+
selectedTeamId: undefined;
|
|
76
|
+
profileImageUrl: undefined;
|
|
77
|
+
signedUpAtMillis: undefined;
|
|
78
|
+
authMethod: undefined;
|
|
79
|
+
hasPassword: undefined;
|
|
80
|
+
authWithEmail: undefined;
|
|
81
|
+
oauthProviders: undefined;
|
|
82
|
+
clientMetadata: undefined;
|
|
83
|
+
serverMetadata: undefined;
|
|
84
|
+
}, "">;
|
|
85
|
+
serverUpdateSchema: yup.ObjectSchema<{
|
|
86
|
+
displayName: string | undefined;
|
|
87
|
+
clientMetadata: {} | null | undefined;
|
|
88
|
+
serverMetadata: {} | null | undefined;
|
|
89
|
+
primaryEmail: string | null | undefined;
|
|
90
|
+
primaryEmailVerified: boolean | undefined;
|
|
91
|
+
selectedTeamId: string | null | undefined;
|
|
92
|
+
}, yup.AnyObject, {
|
|
93
|
+
displayName: undefined;
|
|
94
|
+
clientMetadata: undefined;
|
|
95
|
+
serverMetadata: undefined;
|
|
96
|
+
primaryEmail: undefined;
|
|
97
|
+
primaryEmailVerified: undefined;
|
|
98
|
+
selectedTeamId: undefined;
|
|
99
|
+
}, "">;
|
|
100
|
+
serverDeleteSchema: yup.MixedSchema<{} | undefined, yup.AnyObject, undefined, "">;
|
|
101
|
+
}>;
|
|
167
102
|
export type UsersCrud = CrudTypeOf<typeof usersCrud>;
|
|
@@ -1,38 +1,35 @@
|
|
|
1
1
|
import { createCrud } from "../../crud";
|
|
2
2
|
import * as yup from "yup";
|
|
3
|
-
import
|
|
3
|
+
import * as fieldSchema from "./fields";
|
|
4
4
|
export const usersCrudServerUpdateSchema = yup.object({
|
|
5
|
-
displayName:
|
|
6
|
-
clientMetadata:
|
|
7
|
-
serverMetadata:
|
|
8
|
-
primaryEmail:
|
|
9
|
-
primaryEmailVerified:
|
|
10
|
-
selectedTeamId:
|
|
5
|
+
displayName: fieldSchema.userDisplayNameSchema.optional(),
|
|
6
|
+
clientMetadata: fieldSchema.userClientMetadataSchema.optional(),
|
|
7
|
+
serverMetadata: fieldSchema.userServerMetadataSchema.optional(),
|
|
8
|
+
primaryEmail: fieldSchema.primaryEmailSchema.nullable().optional(),
|
|
9
|
+
primaryEmailVerified: fieldSchema.primaryEmailVerifiedSchema.optional(),
|
|
10
|
+
selectedTeamId: fieldSchema.selectedTeamIdSchema.nullable().optional(),
|
|
11
11
|
}).required();
|
|
12
12
|
export const usersCrudServerReadSchema = yup.object({
|
|
13
|
-
projectId:
|
|
14
|
-
id:
|
|
15
|
-
primaryEmail:
|
|
16
|
-
primaryEmailVerified:
|
|
17
|
-
displayName:
|
|
18
|
-
clientMetadata: yupJson,
|
|
19
|
-
selectedTeamId: yup.string().nullable().defined(),
|
|
13
|
+
projectId: fieldSchema.projectIdSchema.required(),
|
|
14
|
+
id: fieldSchema.userIdSchema.required(),
|
|
15
|
+
primaryEmail: fieldSchema.primaryEmailSchema.nullable().defined(),
|
|
16
|
+
primaryEmailVerified: fieldSchema.primaryEmailVerifiedSchema.required(),
|
|
17
|
+
displayName: fieldSchema.userDisplayNameSchema.nullable().defined(),
|
|
20
18
|
// TODO give this one the type of an actual team
|
|
21
19
|
selectedTeam: yup.mixed().nullable().defined(),
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
serverMetadata: yupJson,
|
|
20
|
+
selectedTeamId: fieldSchema.selectedTeamIdSchema.nullable().defined(),
|
|
21
|
+
profileImageUrl: fieldSchema.profileImageUrlSchema.nullable().defined(),
|
|
22
|
+
signedUpAtMillis: fieldSchema.signedUpAtMillisSchema.required(),
|
|
23
|
+
authMethod: yup.string().oneOf(["credential", "oauth"]).required().meta({ hide: true }), // not used anymore, for backwards compatibility
|
|
24
|
+
hasPassword: yup.boolean().required().meta({ description: 'Whether the user has a password', example: true }),
|
|
25
|
+
authWithEmail: yup.boolean().required().meta({ description: 'Whether the user can authenticate with email (email/password and magic link, depending on the project setting on the dashboard)', example: true }),
|
|
26
|
+
oauthProviders: yup.array(yup.string().required()).required().meta({ description: 'All the OAuth providers connected to this account', example: ['google', 'github'] }),
|
|
27
|
+
clientMetadata: fieldSchema.userClientMetadataSchema,
|
|
28
|
+
serverMetadata: fieldSchema.userServerMetadataSchema,
|
|
32
29
|
}).required();
|
|
33
30
|
const serverDeleteSchema = yup.mixed();
|
|
34
31
|
export const usersCrud = createCrud({
|
|
35
32
|
serverReadSchema: usersCrudServerReadSchema,
|
|
36
33
|
serverUpdateSchema: usersCrudServerUpdateSchema,
|
|
37
|
-
serverDeleteSchema,
|
|
34
|
+
serverDeleteSchema: serverDeleteSchema,
|
|
38
35
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackframe/stack-shared",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.25",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"jose": "^5.2.2",
|
|
37
37
|
"oauth4webapi": "^2.10.3",
|
|
38
38
|
"uuid": "^9.0.1",
|
|
39
|
-
"@stackframe/stack-sc": "2.4.
|
|
39
|
+
"@stackframe/stack-sc": "2.4.25"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"rimraf": "^5.0.5",
|