@stackframe/stack-shared 2.5.3 → 2.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/crud.d.ts +10 -3
  3. package/dist/helpers/production-mode.d.ts +6 -0
  4. package/dist/helpers/production-mode.js +43 -0
  5. package/dist/index.d.ts +4 -4
  6. package/dist/index.js +4 -4
  7. package/dist/interface/adminInterface.d.ts +28 -67
  8. package/dist/interface/adminInterface.js +63 -21
  9. package/dist/interface/clientInterface.d.ts +21 -133
  10. package/dist/interface/clientInterface.js +92 -118
  11. package/dist/interface/crud/api-keys.d.ts +134 -0
  12. package/dist/interface/crud/api-keys.js +61 -0
  13. package/dist/interface/crud/current-user.d.ts +47 -11
  14. package/dist/interface/crud/current-user.js +7 -3
  15. package/dist/interface/crud/email-templates.d.ts +53 -34
  16. package/dist/interface/crud/email-templates.js +37 -24
  17. package/dist/interface/crud/oauth.d.ts +8 -9
  18. package/dist/interface/crud/oauth.js +5 -5
  19. package/dist/interface/crud/projects.d.ts +446 -0
  20. package/dist/interface/crud/projects.js +110 -0
  21. package/dist/interface/crud/team-memberships.d.ts +22 -0
  22. package/dist/interface/crud/team-memberships.js +22 -0
  23. package/dist/interface/crud/team-permissions.d.ts +129 -0
  24. package/dist/interface/crud/team-permissions.js +83 -0
  25. package/dist/interface/crud/teams.d.ts +148 -0
  26. package/dist/interface/crud/teams.js +80 -0
  27. package/dist/interface/crud/users.d.ts +88 -33
  28. package/dist/interface/crud/users.js +22 -14
  29. package/dist/interface/crud-deprecated/api-keys.d.ts +134 -0
  30. package/dist/interface/crud-deprecated/api-keys.js +61 -0
  31. package/dist/interface/crud-deprecated/current-user.d.ts +127 -0
  32. package/dist/interface/crud-deprecated/current-user.js +49 -0
  33. package/dist/interface/crud-deprecated/email-templates.d.ts +75 -0
  34. package/dist/interface/crud-deprecated/email-templates.js +41 -0
  35. package/dist/interface/crud-deprecated/oauth.d.ts +24 -0
  36. package/dist/interface/crud-deprecated/oauth.js +12 -0
  37. package/dist/interface/crud-deprecated/projects.d.ts +440 -0
  38. package/dist/interface/crud-deprecated/projects.js +109 -0
  39. package/dist/interface/crud-deprecated/team-memberships.d.ts +22 -0
  40. package/dist/interface/crud-deprecated/team-memberships.js +22 -0
  41. package/dist/interface/crud-deprecated/team-permissions.d.ts +129 -0
  42. package/dist/interface/crud-deprecated/team-permissions.js +83 -0
  43. package/dist/interface/crud-deprecated/teams.d.ts +126 -0
  44. package/dist/interface/crud-deprecated/teams.js +78 -0
  45. package/dist/interface/crud-deprecated/users.d.ts +201 -0
  46. package/dist/interface/crud-deprecated/users.js +75 -0
  47. package/dist/interface/serverInterface.d.ts +33 -60
  48. package/dist/interface/serverInterface.js +74 -101
  49. package/dist/known-errors.d.ts +43 -26
  50. package/dist/known-errors.js +132 -85
  51. package/dist/schema-fields.d.ts +53 -4
  52. package/dist/schema-fields.js +156 -25
  53. package/dist/sessions.d.ts +1 -0
  54. package/dist/sessions.js +13 -3
  55. package/dist/utils/compile-time.d.ts +3 -1
  56. package/dist/utils/compile-time.js +3 -1
  57. package/dist/utils/errors.d.ts +8 -1
  58. package/dist/utils/errors.js +17 -4
  59. package/dist/utils/objects.d.ts +4 -1
  60. package/dist/utils/objects.js +16 -8
  61. package/dist/utils/promises.js +6 -1
  62. package/dist/utils/proxies.d.ts +1 -0
  63. package/dist/utils/proxies.js +65 -0
  64. package/dist/utils/react.d.ts +1 -1
  65. package/dist/utils/react.js +2 -2
  66. package/dist/utils/strings.js +3 -3
  67. package/dist/utils/urls.d.ts +1 -0
  68. package/dist/utils/urls.js +8 -0
  69. package/package.json +2 -2
  70. package/dist/utils/yup.d.ts +0 -3
  71. package/dist/utils/yup.js +0 -13
@@ -1,37 +1,45 @@
1
1
  import { createCrud } from "../../crud";
2
- import * as yup from "yup";
3
2
  import * as fieldSchema from "../../schema-fields";
4
- export const usersCrudServerUpdateSchema = yup.object({
3
+ import { teamsCrudServerReadSchema } from "./teams";
4
+ export const usersCrudServerUpdateSchema = fieldSchema.yupObject({
5
5
  display_name: fieldSchema.userDisplayNameSchema.optional(),
6
+ profile_image_url: fieldSchema.profileImageUrlSchema.optional(),
6
7
  client_metadata: fieldSchema.userClientMetadataSchema.optional(),
7
8
  server_metadata: fieldSchema.userServerMetadataSchema.optional(),
8
9
  primary_email: fieldSchema.primaryEmailSchema.nullable().optional(),
9
10
  primary_email_verified: fieldSchema.primaryEmailVerifiedSchema.optional(),
11
+ primary_email_auth_enabled: fieldSchema.yupBoolean().optional().meta({ openapiField: { description: "Whether the primary email can be used to sign into this user's account", exampleValue: true } }),
12
+ password: fieldSchema.yupString().nullable().meta({ openapiField: { description: 'A new password for the user, overwriting the old one (if it exists).', exampleValue: 'password' } }),
10
13
  selected_team_id: fieldSchema.selectedTeamIdSchema.nullable().optional(),
11
14
  }).required();
12
- export const usersCrudServerReadSchema = yup.object({
15
+ export const usersCrudServerReadSchema = fieldSchema.yupObject({
13
16
  project_id: fieldSchema.projectIdSchema.required(),
14
- id: fieldSchema.userIdResponseSchema.required(),
17
+ id: fieldSchema.userIdSchema.required(),
15
18
  primary_email: fieldSchema.primaryEmailSchema.nullable().defined(),
16
19
  primary_email_verified: fieldSchema.primaryEmailVerifiedSchema.required(),
17
20
  display_name: fieldSchema.userDisplayNameSchema.nullable().defined(),
18
- // TODO give this one the type of an actual team
19
- selected_team: yup.mixed().nullable().defined(),
21
+ selected_team: teamsCrudServerReadSchema.nullable().defined(),
20
22
  selected_team_id: fieldSchema.selectedTeamIdSchema.nullable().defined(),
21
23
  profile_image_url: fieldSchema.profileImageUrlSchema.nullable().defined(),
22
24
  signed_up_at_millis: fieldSchema.signedUpAtMillisSchema.required(),
23
- has_password: yup.boolean().required().meta({ openapiField: { description: 'Whether the user has a password associated with their account', exampleValue: true } }),
24
- auth_with_email: yup.boolean().required().meta({ openapiField: { description: 'Whether the user can authenticate with their primary e-mail. If set to true, the user can log-in with credentials and/or magic link, if enabled in the project settings.', exampleValue: true } }),
25
- oauth_providers: yup.array(yup.string().required()).required().meta({ openapiField: { description: 'All the OAuth providers connected to this account', exampleValue: ['google', 'github'] } }),
25
+ has_password: fieldSchema.yupBoolean().required().meta({ openapiField: { description: 'Whether the user has a password associated with their account', exampleValue: true } }),
26
+ auth_with_email: fieldSchema.yupBoolean().required().meta({ openapiField: { description: 'Whether the user can authenticate with their primary e-mail. If set to true, the user can log-in with credentials and/or magic link, if enabled in the project settings.', exampleValue: true } }),
27
+ oauth_providers: fieldSchema.yupArray(fieldSchema.yupObject({
28
+ id: fieldSchema.yupString().required(),
29
+ account_id: fieldSchema.yupString().required(),
30
+ email: fieldSchema.yupString().nullable(),
31
+ }).required()).required().meta({ openapiField: { description: 'A list of OAuth providers connected to this account', exampleValue: ['google', 'github'] } }),
26
32
  client_metadata: fieldSchema.userClientMetadataSchema,
27
33
  server_metadata: fieldSchema.userServerMetadataSchema,
28
34
  }).required();
29
- export const usersCrudServerCreateSchema = usersCrudServerUpdateSchema.concat(yup.object({
30
- primary_email: fieldSchema.primaryEmailSchema.required(),
31
- primary_email_verified: fieldSchema.primaryEmailVerifiedSchema.required(),
32
- auth_with_email: yup.boolean().oneOf([true]).required().meta({ openapiField: { description: 'Must always be set to true.', exampleValue: true } }),
35
+ export const usersCrudServerCreateSchema = usersCrudServerUpdateSchema.concat(fieldSchema.yupObject({
36
+ oauth_providers: fieldSchema.yupArray(fieldSchema.yupObject({
37
+ id: fieldSchema.yupString().required(),
38
+ account_id: fieldSchema.yupString().required(),
39
+ email: fieldSchema.yupString().nullable().defined().default(null),
40
+ }).required()).optional(),
33
41
  }).required());
34
- export const usersCrudServerDeleteSchema = yup.mixed();
42
+ export const usersCrudServerDeleteSchema = fieldSchema.yupMixed();
35
43
  export const usersCrud = createCrud({
36
44
  serverReadSchema: usersCrudServerReadSchema,
37
45
  serverUpdateSchema: usersCrudServerUpdateSchema,
@@ -0,0 +1,134 @@
1
+ import { CrudTypeOf } from "../../crud";
2
+ export declare const apiKeysCreateInputSchema: import("yup").ObjectSchema<{
3
+ description: string;
4
+ expires_at_millis: number;
5
+ has_publishable_client_key: NonNullable<boolean | undefined>;
6
+ has_secret_server_key: NonNullable<boolean | undefined>;
7
+ has_super_secret_admin_key: NonNullable<boolean | undefined>;
8
+ }, import("yup").AnyObject, {
9
+ description: undefined;
10
+ expires_at_millis: undefined;
11
+ has_publishable_client_key: undefined;
12
+ has_secret_server_key: undefined;
13
+ has_super_secret_admin_key: undefined;
14
+ }, "">;
15
+ export declare const apiKeysCreateOutputSchema: import("yup").ObjectSchema<{
16
+ id: string;
17
+ description: string;
18
+ expires_at_millis: number;
19
+ manually_revoked_at_millis: number | undefined;
20
+ created_at_millis: number;
21
+ } & {
22
+ publishable_client_key: string | undefined;
23
+ secret_server_key: string | undefined;
24
+ super_secret_admin_key: string | undefined;
25
+ }, import("yup").AnyObject, {
26
+ id: undefined;
27
+ description: undefined;
28
+ expires_at_millis: undefined;
29
+ manually_revoked_at_millis: undefined;
30
+ created_at_millis: undefined;
31
+ publishable_client_key: undefined;
32
+ secret_server_key: undefined;
33
+ super_secret_admin_key: undefined;
34
+ }, "">;
35
+ export declare const apiKeysCrudAdminObfuscatedReadSchema: import("yup").ObjectSchema<{
36
+ id: string;
37
+ description: string;
38
+ expires_at_millis: number;
39
+ manually_revoked_at_millis: number | undefined;
40
+ created_at_millis: number;
41
+ } & {
42
+ publishable_client_key: {
43
+ last_four: string;
44
+ } | undefined;
45
+ secret_server_key: {
46
+ last_four: string;
47
+ } | undefined;
48
+ super_secret_admin_key: {
49
+ last_four: string;
50
+ } | undefined;
51
+ }, import("yup").AnyObject, {
52
+ id: undefined;
53
+ description: undefined;
54
+ expires_at_millis: undefined;
55
+ manually_revoked_at_millis: undefined;
56
+ created_at_millis: undefined;
57
+ publishable_client_key: {
58
+ last_four: undefined;
59
+ };
60
+ secret_server_key: {
61
+ last_four: undefined;
62
+ };
63
+ super_secret_admin_key: {
64
+ last_four: undefined;
65
+ };
66
+ }, "">;
67
+ export declare const apiKeysCrudAdminUpdateSchema: import("yup").ObjectSchema<{
68
+ description: string | undefined;
69
+ revoked: boolean | undefined;
70
+ }, import("yup").AnyObject, {
71
+ description: undefined;
72
+ revoked: undefined;
73
+ }, "">;
74
+ export declare const apiKeysCrudAdminDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
75
+ export declare const apiKeysCrud: import("../../crud").CrudSchemaFromOptions<{
76
+ adminReadSchema: import("yup").ObjectSchema<{
77
+ id: string;
78
+ description: string;
79
+ expires_at_millis: number;
80
+ manually_revoked_at_millis: number | undefined;
81
+ created_at_millis: number;
82
+ } & {
83
+ publishable_client_key: {
84
+ last_four: string;
85
+ } | undefined;
86
+ secret_server_key: {
87
+ last_four: string;
88
+ } | undefined;
89
+ super_secret_admin_key: {
90
+ last_four: string;
91
+ } | undefined;
92
+ }, import("yup").AnyObject, {
93
+ id: undefined;
94
+ description: undefined;
95
+ expires_at_millis: undefined;
96
+ manually_revoked_at_millis: undefined;
97
+ created_at_millis: undefined;
98
+ publishable_client_key: {
99
+ last_four: undefined;
100
+ };
101
+ secret_server_key: {
102
+ last_four: undefined;
103
+ };
104
+ super_secret_admin_key: {
105
+ last_four: undefined;
106
+ };
107
+ }, "">;
108
+ adminUpdateSchema: import("yup").ObjectSchema<{
109
+ description: string | undefined;
110
+ revoked: boolean | undefined;
111
+ }, import("yup").AnyObject, {
112
+ description: undefined;
113
+ revoked: undefined;
114
+ }, "">;
115
+ adminDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
116
+ docs: {
117
+ adminList: {
118
+ hidden: true;
119
+ };
120
+ adminRead: {
121
+ hidden: true;
122
+ };
123
+ adminCreate: {
124
+ hidden: true;
125
+ };
126
+ adminUpdate: {
127
+ hidden: true;
128
+ };
129
+ adminDelete: {
130
+ hidden: true;
131
+ };
132
+ };
133
+ }>;
134
+ export type ApiKeysCrud = CrudTypeOf<typeof apiKeysCrud>;
@@ -0,0 +1,61 @@
1
+ import { createCrud } from "../../crud";
2
+ import { yupBoolean, yupMixed, yupNumber, yupObject, yupString } from "../../schema-fields";
3
+ const baseApiKeysReadSchema = yupObject({
4
+ id: yupString().required(),
5
+ description: yupString().required(),
6
+ expires_at_millis: yupNumber().required(),
7
+ manually_revoked_at_millis: yupNumber().optional(),
8
+ created_at_millis: yupNumber().required(),
9
+ });
10
+ // Used for the result of the create endpoint
11
+ export const apiKeysCreateInputSchema = yupObject({
12
+ description: yupString().required(),
13
+ expires_at_millis: yupNumber().required(),
14
+ has_publishable_client_key: yupBoolean().required(),
15
+ has_secret_server_key: yupBoolean().required(),
16
+ has_super_secret_admin_key: yupBoolean().required(),
17
+ });
18
+ export const apiKeysCreateOutputSchema = baseApiKeysReadSchema.concat(yupObject({
19
+ publishable_client_key: yupString().optional(),
20
+ secret_server_key: yupString().optional(),
21
+ super_secret_admin_key: yupString().optional(),
22
+ }).required());
23
+ // Used for list, read and update endpoints after the initial creation
24
+ export const apiKeysCrudAdminObfuscatedReadSchema = baseApiKeysReadSchema.concat(yupObject({
25
+ publishable_client_key: yupObject({
26
+ last_four: yupString().required(),
27
+ }).optional(),
28
+ secret_server_key: yupObject({
29
+ last_four: yupString().required(),
30
+ }).optional(),
31
+ super_secret_admin_key: yupObject({
32
+ last_four: yupString().required(),
33
+ }).optional(),
34
+ }));
35
+ export const apiKeysCrudAdminUpdateSchema = yupObject({
36
+ description: yupString().optional(),
37
+ revoked: yupBoolean().oneOf([true]).optional(),
38
+ }).required();
39
+ export const apiKeysCrudAdminDeleteSchema = yupMixed();
40
+ export const apiKeysCrud = createCrud({
41
+ adminReadSchema: apiKeysCrudAdminObfuscatedReadSchema,
42
+ adminUpdateSchema: apiKeysCrudAdminUpdateSchema,
43
+ adminDeleteSchema: apiKeysCrudAdminDeleteSchema,
44
+ docs: {
45
+ adminList: {
46
+ hidden: true,
47
+ },
48
+ adminRead: {
49
+ hidden: true,
50
+ },
51
+ adminCreate: {
52
+ hidden: true,
53
+ },
54
+ adminUpdate: {
55
+ hidden: true,
56
+ },
57
+ adminDelete: {
58
+ hidden: true,
59
+ },
60
+ },
61
+ });
@@ -0,0 +1,127 @@
1
+ import { CrudTypeOf } from "../../crud";
2
+ export declare const currentUserCrud: import("../../crud").CrudSchemaFromOptions<{
3
+ clientReadSchema: import("yup").ObjectSchema<{
4
+ id: string;
5
+ display_name: string | null;
6
+ oauth_providers: {
7
+ email?: string | null | undefined;
8
+ account_id: string;
9
+ provider_id: string;
10
+ }[];
11
+ project_id: string;
12
+ primary_email: string | null;
13
+ profile_image_url: string | null;
14
+ client_metadata: {} | null;
15
+ primary_email_verified: NonNullable<boolean | undefined>;
16
+ selected_team_id: string | null;
17
+ selected_team: {} | null;
18
+ signed_up_at_millis: number;
19
+ has_password: NonNullable<boolean | undefined>;
20
+ auth_with_email: NonNullable<boolean | undefined>;
21
+ } | null, import("yup").AnyObject, {
22
+ project_id: undefined;
23
+ id: undefined;
24
+ primary_email: undefined;
25
+ primary_email_verified: undefined;
26
+ display_name: undefined;
27
+ selected_team: undefined;
28
+ selected_team_id: undefined;
29
+ profile_image_url: undefined;
30
+ signed_up_at_millis: undefined;
31
+ has_password: undefined;
32
+ auth_with_email: undefined;
33
+ oauth_providers: undefined;
34
+ client_metadata: undefined;
35
+ server_metadata: undefined;
36
+ }, "">;
37
+ serverReadSchema: import("yup").ObjectSchema<{
38
+ project_id: string;
39
+ id: string;
40
+ primary_email: string | null;
41
+ primary_email_verified: NonNullable<boolean | undefined>;
42
+ display_name: string | null;
43
+ selected_team: {} | null;
44
+ selected_team_id: string | null;
45
+ profile_image_url: string | null;
46
+ signed_up_at_millis: number;
47
+ has_password: NonNullable<boolean | undefined>;
48
+ auth_with_email: NonNullable<boolean | undefined>;
49
+ oauth_providers: {
50
+ email?: string | null | undefined;
51
+ account_id: string;
52
+ provider_id: string;
53
+ }[];
54
+ client_metadata: {} | null;
55
+ server_metadata: {} | null;
56
+ } | null, import("yup").AnyObject, {
57
+ project_id: undefined;
58
+ id: undefined;
59
+ primary_email: undefined;
60
+ primary_email_verified: undefined;
61
+ display_name: undefined;
62
+ selected_team: undefined;
63
+ selected_team_id: undefined;
64
+ profile_image_url: undefined;
65
+ signed_up_at_millis: undefined;
66
+ has_password: undefined;
67
+ auth_with_email: undefined;
68
+ oauth_providers: undefined;
69
+ client_metadata: undefined;
70
+ server_metadata: undefined;
71
+ }, "">;
72
+ clientUpdateSchema: import("yup").ObjectSchema<{
73
+ display_name: string | null | undefined;
74
+ client_metadata: {} | null | undefined;
75
+ selected_team_id: string | null | undefined;
76
+ }, import("yup").AnyObject, {
77
+ display_name: undefined;
78
+ profile_image_url: undefined;
79
+ client_metadata: undefined;
80
+ server_metadata: undefined;
81
+ primary_email: undefined;
82
+ primary_email_verified: undefined;
83
+ primary_email_auth_enabled: undefined;
84
+ password: undefined;
85
+ selected_team_id: undefined;
86
+ }, "">;
87
+ serverUpdateSchema: import("yup").ObjectSchema<{
88
+ display_name: string | null | undefined;
89
+ profile_image_url: string | undefined;
90
+ client_metadata: {} | null | undefined;
91
+ server_metadata: {} | null | undefined;
92
+ primary_email: string | null | undefined;
93
+ primary_email_verified: boolean | undefined;
94
+ primary_email_auth_enabled: boolean | undefined;
95
+ password: string | null | undefined;
96
+ selected_team_id: string | null | undefined;
97
+ }, import("yup").AnyObject, {
98
+ display_name: undefined;
99
+ profile_image_url: undefined;
100
+ client_metadata: undefined;
101
+ server_metadata: undefined;
102
+ primary_email: undefined;
103
+ primary_email_verified: undefined;
104
+ primary_email_auth_enabled: undefined;
105
+ password: undefined;
106
+ selected_team_id: undefined;
107
+ }, "">;
108
+ serverDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
109
+ docs: {
110
+ clientRead: {
111
+ summary: string;
112
+ description: string;
113
+ tags: string[];
114
+ };
115
+ clientUpdate: {
116
+ summary: string;
117
+ description: string;
118
+ tags: string[];
119
+ };
120
+ clientDelete: {
121
+ summary: string;
122
+ description: string;
123
+ tags: string[];
124
+ };
125
+ };
126
+ }>;
127
+ export type CurrentUserCrud = CrudTypeOf<typeof currentUserCrud>;
@@ -0,0 +1,49 @@
1
+ import { createCrud } from "../../crud";
2
+ import { usersCrudServerReadSchema, usersCrudServerUpdateSchema, usersCrudServerDeleteSchema } from "./users";
3
+ const clientUpdateSchema = usersCrudServerUpdateSchema.pick([
4
+ "display_name",
5
+ "client_metadata",
6
+ "selected_team_id",
7
+ ]).required();
8
+ const serverUpdateSchema = usersCrudServerUpdateSchema;
9
+ const clientReadSchema = usersCrudServerReadSchema.pick([
10
+ "project_id",
11
+ "id",
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",
23
+ ]).nullable().defined();
24
+ const serverReadSchema = usersCrudServerReadSchema.nullable().defined();
25
+ const serverDeleteSchema = usersCrudServerDeleteSchema;
26
+ export const currentUserCrud = createCrud({
27
+ clientReadSchema,
28
+ serverReadSchema,
29
+ clientUpdateSchema,
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
+ },
49
+ });
@@ -0,0 +1,75 @@
1
+ import { CrudTypeOf } from "../../crud";
2
+ export type EmailTemplateType = typeof emailTemplateTypes[number];
3
+ export declare const emailTemplateTypes: readonly ["EMAIL_VERIFICATION", "PASSWORD_RESET", "MAGIC_LINK"];
4
+ export declare const emailTemplateServerReadSchema: import("yup").ObjectSchema<{
5
+ type: NonNullable<"EMAIL_VERIFICATION" | "PASSWORD_RESET" | "MAGIC_LINK" | undefined>;
6
+ subject: string;
7
+ content: {};
8
+ }, import("yup").AnyObject, {
9
+ type: undefined;
10
+ subject: undefined;
11
+ content: undefined;
12
+ }, "">;
13
+ export declare const emailTemplateCrudServerUpdateSchema: import("yup").ObjectSchema<{
14
+ content: {};
15
+ subject: string;
16
+ }, import("yup").AnyObject, {
17
+ content: undefined;
18
+ subject: undefined;
19
+ }, "">;
20
+ export declare const emailTemplateCrudServerDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
21
+ export declare const emailTemplateCrudServerCreateSchema: import("yup").ObjectSchema<{
22
+ type: NonNullable<"EMAIL_VERIFICATION" | "PASSWORD_RESET" | "MAGIC_LINK" | undefined>;
23
+ content: {};
24
+ subject: string;
25
+ }, import("yup").AnyObject, {
26
+ type: undefined;
27
+ content: undefined;
28
+ subject: undefined;
29
+ }, "">;
30
+ export declare const emailTemplateCrud: import("../../crud").CrudSchemaFromOptions<{
31
+ serverReadSchema: import("yup").ObjectSchema<{
32
+ type: NonNullable<"EMAIL_VERIFICATION" | "PASSWORD_RESET" | "MAGIC_LINK" | undefined>;
33
+ subject: string;
34
+ content: {};
35
+ }, import("yup").AnyObject, {
36
+ type: undefined;
37
+ subject: undefined;
38
+ content: undefined;
39
+ }, "">;
40
+ serverUpdateSchema: import("yup").ObjectSchema<{
41
+ content: {};
42
+ subject: string;
43
+ }, import("yup").AnyObject, {
44
+ content: undefined;
45
+ subject: undefined;
46
+ }, "">;
47
+ serverCreateSchema: import("yup").ObjectSchema<{
48
+ type: NonNullable<"EMAIL_VERIFICATION" | "PASSWORD_RESET" | "MAGIC_LINK" | undefined>;
49
+ content: {};
50
+ subject: string;
51
+ }, import("yup").AnyObject, {
52
+ type: undefined;
53
+ content: undefined;
54
+ subject: undefined;
55
+ }, "">;
56
+ serverDeleteSchema: import("yup").MixedSchema<{} | undefined, import("yup").AnyObject, undefined, "">;
57
+ docs: {
58
+ serverRead: {
59
+ hidden: true;
60
+ };
61
+ serverCreate: {
62
+ hidden: true;
63
+ };
64
+ serverUpdate: {
65
+ hidden: true;
66
+ };
67
+ serverDelete: {
68
+ hidden: true;
69
+ };
70
+ serverList: {
71
+ hidden: true;
72
+ };
73
+ };
74
+ }>;
75
+ export type EmailTemplateCrud = CrudTypeOf<typeof emailTemplateCrud>;
@@ -0,0 +1,41 @@
1
+ import { createCrud } from "../../crud";
2
+ import { jsonSchema, yupMixed, yupObject, yupString } from "../../schema-fields";
3
+ export const emailTemplateTypes = ['EMAIL_VERIFICATION', 'PASSWORD_RESET', 'MAGIC_LINK'];
4
+ export const emailTemplateServerReadSchema = yupObject({
5
+ type: yupString().oneOf(emailTemplateTypes).required(),
6
+ subject: yupString().required(),
7
+ content: jsonSchema.required(),
8
+ }).required();
9
+ export const emailTemplateCrudServerUpdateSchema = yupObject({
10
+ content: jsonSchema.required(),
11
+ subject: yupString().required(),
12
+ }).required();
13
+ export const emailTemplateCrudServerDeleteSchema = yupMixed();
14
+ export const emailTemplateCrudServerCreateSchema = yupObject({
15
+ type: yupString().oneOf(emailTemplateTypes).required(),
16
+ content: jsonSchema.required(),
17
+ subject: yupString().required(),
18
+ }).required();
19
+ export const emailTemplateCrud = createCrud({
20
+ serverReadSchema: emailTemplateServerReadSchema,
21
+ serverUpdateSchema: emailTemplateCrudServerUpdateSchema,
22
+ serverCreateSchema: emailTemplateCrudServerCreateSchema,
23
+ serverDeleteSchema: emailTemplateCrudServerDeleteSchema,
24
+ docs: {
25
+ serverRead: {
26
+ hidden: true,
27
+ },
28
+ serverCreate: {
29
+ hidden: true,
30
+ },
31
+ serverUpdate: {
32
+ hidden: true,
33
+ },
34
+ serverDelete: {
35
+ hidden: true,
36
+ },
37
+ serverList: {
38
+ hidden: true,
39
+ }
40
+ }
41
+ });
@@ -0,0 +1,24 @@
1
+ import { CrudTypeOf } from "../../crud";
2
+ export declare const accessTokenReadSchema: import("yup").ObjectSchema<{
3
+ access_token: string;
4
+ }, import("yup").AnyObject, {
5
+ access_token: undefined;
6
+ }, "">;
7
+ export declare const accessTokenCreateSchema: import("yup").ObjectSchema<{
8
+ scope: string | undefined;
9
+ }, import("yup").AnyObject, {
10
+ scope: undefined;
11
+ }, "">;
12
+ export declare const accessTokenCrud: import("../../crud").CrudSchemaFromOptions<{
13
+ clientReadSchema: import("yup").ObjectSchema<{
14
+ access_token: string;
15
+ }, import("yup").AnyObject, {
16
+ access_token: undefined;
17
+ }, "">;
18
+ clientCreateSchema: import("yup").ObjectSchema<{
19
+ scope: string | undefined;
20
+ }, import("yup").AnyObject, {
21
+ scope: undefined;
22
+ }, "">;
23
+ }>;
24
+ export type AccessTokenCrud = CrudTypeOf<typeof accessTokenCrud>;
@@ -0,0 +1,12 @@
1
+ import { createCrud } from "../../crud";
2
+ import { yupObject, yupString } from "../../schema-fields";
3
+ export const accessTokenReadSchema = yupObject({
4
+ access_token: yupString().required(),
5
+ }).required();
6
+ export const accessTokenCreateSchema = yupObject({
7
+ scope: yupString().optional(),
8
+ }).required();
9
+ export const accessTokenCrud = createCrud({
10
+ clientReadSchema: accessTokenReadSchema,
11
+ clientCreateSchema: accessTokenCreateSchema,
12
+ });