@logto/schemas 1.2.2 → 1.3.0
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/alterations/1.0.0-1678716747-service-logs.ts +1 -1
- package/alterations/1.0.0_beta.10-1-logto-config.ts +1 -1
- package/alterations/1.3.0-1683292832-update-hooks.ts +105 -0
- package/alterations-js/1.0.0-1678716747-service-logs.js +1 -1
- package/alterations-js/1.0.0_beta.10-1-logto-config.js +1 -1
- package/alterations-js/1.3.0-1683292832-update-hooks.d.ts +3 -0
- package/alterations-js/1.3.0-1683292832-update-hooks.js +73 -0
- package/lib/db-entries/application.js +3 -3
- package/lib/db-entries/applications-role.js +3 -3
- package/lib/db-entries/connector.d.ts +3 -3
- package/lib/db-entries/connector.js +5 -5
- package/lib/db-entries/custom-phrase.js +2 -2
- package/lib/db-entries/hook.d.ts +11 -3
- package/lib/db-entries/hook.js +20 -4
- package/lib/db-entries/log.js +2 -2
- package/lib/db-entries/logto-config.d.ts +3 -3
- package/lib/db-entries/logto-config.js +4 -4
- package/lib/db-entries/oidc-model-instance.js +2 -2
- package/lib/db-entries/passcode.js +3 -3
- package/lib/db-entries/resource.js +3 -3
- package/lib/db-entries/role.js +3 -3
- package/lib/db-entries/roles-scope.js +3 -3
- package/lib/db-entries/scope.js +4 -4
- package/lib/db-entries/service-log.d.ts +3 -3
- package/lib/db-entries/service-log.js +5 -5
- package/lib/db-entries/sign-in-experience.js +1 -1
- package/lib/db-entries/system.d.ts +3 -3
- package/lib/db-entries/system.js +4 -4
- package/lib/db-entries/user.d.ts +3 -3
- package/lib/db-entries/user.js +4 -4
- package/lib/db-entries/users-role.js +3 -3
- package/lib/db-entries/verification-status.js +2 -2
- package/lib/foundations/jsonb-types.d.ts +22 -10
- package/lib/foundations/jsonb-types.js +15 -1
- package/lib/types/connector.d.ts +2984 -8
- package/lib/types/connector.js +22 -0
- package/lib/types/dashboard.d.ts +116 -0
- package/lib/types/dashboard.js +18 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/interactions.d.ts +6 -6
- package/lib/types/interactions.js +2 -2
- package/lib/types/scope.d.ts +40 -4
- package/lib/types/scope.js +4 -1
- package/lib/types/user.d.ts +129 -5
- package/lib/types/user.js +6 -0
- package/package.json +1 -1
- package/tables/connectors.sql +1 -1
- package/tables/hooks.sql +13 -11
- package/tables/logto_configs.sql +1 -1
- package/tables/service_logs.sql +1 -1
- package/tables/systems.sql +1 -1
- package/tables/users.sql +1 -1
package/lib/db-entries/user.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { identitiesGuard,
|
|
3
|
+
import { identitiesGuard, jsonObjectGuard } from './../foundations/index.js';
|
|
4
4
|
import { UsersPasswordEncryptionMethod } from './custom-types.js';
|
|
5
5
|
const createGuard = z.object({
|
|
6
6
|
tenantId: z.string().max(21).optional(),
|
|
7
|
-
id: z.string().max(12),
|
|
7
|
+
id: z.string().min(1).max(12),
|
|
8
8
|
username: z.string().max(128).nullable().optional(),
|
|
9
9
|
primaryEmail: z.string().max(128).nullable().optional(),
|
|
10
10
|
primaryPhone: z.string().max(128).nullable().optional(),
|
|
@@ -14,7 +14,7 @@ const createGuard = z.object({
|
|
|
14
14
|
avatar: z.string().max(2048).nullable().optional(),
|
|
15
15
|
applicationId: z.string().max(21).nullable().optional(),
|
|
16
16
|
identities: identitiesGuard.optional(),
|
|
17
|
-
customData:
|
|
17
|
+
customData: jsonObjectGuard.optional(),
|
|
18
18
|
isSuspended: z.boolean().optional(),
|
|
19
19
|
lastSignInAt: z.number().nullable().optional(),
|
|
20
20
|
createdAt: z.number().optional(),
|
|
@@ -31,7 +31,7 @@ const guard = z.object({
|
|
|
31
31
|
avatar: z.string().max(2048).nullable(),
|
|
32
32
|
applicationId: z.string().max(21).nullable(),
|
|
33
33
|
identities: identitiesGuard,
|
|
34
|
-
customData:
|
|
34
|
+
customData: jsonObjectGuard,
|
|
35
35
|
isSuspended: z.boolean(),
|
|
36
36
|
lastSignInAt: z.number().nullable(),
|
|
37
37
|
createdAt: z.number(),
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
const createGuard = z.object({
|
|
4
4
|
tenantId: z.string().max(21).optional(),
|
|
5
|
-
id: z.string().max(21),
|
|
6
|
-
userId: z.string().max(21),
|
|
7
|
-
roleId: z.string().max(21),
|
|
5
|
+
id: z.string().min(1).max(21),
|
|
6
|
+
userId: z.string().min(1).max(21),
|
|
7
|
+
roleId: z.string().min(1).max(21),
|
|
8
8
|
});
|
|
9
9
|
const guard = z.object({
|
|
10
10
|
tenantId: z.string().max(21),
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
const createGuard = z.object({
|
|
4
4
|
tenantId: z.string().max(21).optional(),
|
|
5
|
-
id: z.string().max(21),
|
|
6
|
-
userId: z.string().max(21),
|
|
5
|
+
id: z.string().min(1).max(21),
|
|
6
|
+
userId: z.string().min(1).max(21),
|
|
7
7
|
createdAt: z.number().optional(),
|
|
8
8
|
});
|
|
9
9
|
const guard = z.object({
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { Json } from '@withtyped/server';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
export { configurableConnectorMetadataGuard, type ConfigurableConnectorMetadata, } from '@logto/connector-kit';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
4
|
+
export type { JsonObject } from '@withtyped/server';
|
|
5
|
+
export declare const jsonObjectGuard: z.ZodRecord<z.ZodString, z.ZodType<Json, z.ZodTypeDef, Json>>;
|
|
5
6
|
export declare const oidcModelInstancePayloadGuard: z.ZodObject<{
|
|
6
7
|
userCode: z.ZodOptional<z.ZodString>;
|
|
7
8
|
uid: z.ZodOptional<z.ZodString>;
|
|
@@ -227,17 +228,28 @@ export declare enum HookEvent {
|
|
|
227
228
|
PostResetPassword = "PostResetPassword"
|
|
228
229
|
}
|
|
229
230
|
export declare const hookEventGuard: z.ZodType<HookEvent>;
|
|
230
|
-
export
|
|
231
|
+
export declare const hookEventsGuard: z.ZodArray<z.ZodType<HookEvent, z.ZodTypeDef, HookEvent>, "many">;
|
|
232
|
+
export type HookEvents = z.infer<typeof hookEventsGuard>;
|
|
233
|
+
export declare const hookConfigGuard: z.ZodObject<{
|
|
231
234
|
/** We don't need `type` since v1 only has web hook */
|
|
232
235
|
/** Method fixed to `POST` */
|
|
233
|
-
url:
|
|
236
|
+
url: z.ZodString;
|
|
234
237
|
/** Additional headers that attach to the request */
|
|
235
|
-
headers
|
|
238
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
236
239
|
/**
|
|
240
|
+
* @deprecated
|
|
237
241
|
* Retry times when hook response status >= 500.
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
|
|
242
|
+
* Now the retry times is fixed to 3.
|
|
243
|
+
* Keep for backward compatibility.
|
|
244
|
+
*/
|
|
245
|
+
retries: z.ZodNumber;
|
|
246
|
+
}, "strip", z.ZodTypeAny, {
|
|
247
|
+
headers?: Record<string, string> | undefined;
|
|
248
|
+
url: string;
|
|
241
249
|
retries: number;
|
|
242
|
-
}
|
|
243
|
-
|
|
250
|
+
}, {
|
|
251
|
+
headers?: Record<string, string> | undefined;
|
|
252
|
+
url: string;
|
|
253
|
+
retries: number;
|
|
254
|
+
}>;
|
|
255
|
+
export type HookConfig = z.infer<typeof hookConfigGuard>;
|
|
@@ -3,7 +3,10 @@ import { languageTagGuard } from '@logto/language-kit';
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
export { configurableConnectorMetadataGuard, } from '@logto/connector-kit';
|
|
5
5
|
/* === Commonly Used === */
|
|
6
|
-
|
|
6
|
+
// Copied from https://github.com/colinhacks/zod#json-type
|
|
7
|
+
const literalSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
|
8
|
+
const jsonGuard = z.lazy(() => z.union([literalSchema, z.array(jsonGuard), z.record(jsonGuard)]));
|
|
9
|
+
export const jsonObjectGuard = z.record(jsonGuard);
|
|
7
10
|
/* === OIDC Model Instances === */
|
|
8
11
|
export const oidcModelInstancePayloadGuard = z
|
|
9
12
|
.object({
|
|
@@ -123,8 +126,19 @@ export var HookEvent;
|
|
|
123
126
|
HookEvent["PostResetPassword"] = "PostResetPassword";
|
|
124
127
|
})(HookEvent || (HookEvent = {}));
|
|
125
128
|
export const hookEventGuard = z.nativeEnum(HookEvent);
|
|
129
|
+
export const hookEventsGuard = hookEventGuard.array();
|
|
126
130
|
export const hookConfigGuard = z.object({
|
|
131
|
+
/** We don't need `type` since v1 only has web hook */
|
|
132
|
+
// type: 'web';
|
|
133
|
+
/** Method fixed to `POST` */
|
|
127
134
|
url: z.string(),
|
|
135
|
+
/** Additional headers that attach to the request */
|
|
128
136
|
headers: z.record(z.string()).optional(),
|
|
137
|
+
/**
|
|
138
|
+
* @deprecated
|
|
139
|
+
* Retry times when hook response status >= 500.
|
|
140
|
+
* Now the retry times is fixed to 3.
|
|
141
|
+
* Keep for backward compatibility.
|
|
142
|
+
*/
|
|
129
143
|
retries: z.number().gte(0).lte(3),
|
|
130
144
|
});
|