@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/types/connector.js
CHANGED
|
@@ -1 +1,23 @@
|
|
|
1
|
+
import { ConnectorType, connectorMetadataGuard } from '@logto/connector-kit';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { Connectors } from '../db-entries/index.js';
|
|
1
4
|
export { ConnectorType, ConnectorPlatform } from '@logto/connector-kit';
|
|
5
|
+
export const connectorResponseGuard = Connectors.guard
|
|
6
|
+
.pick({
|
|
7
|
+
id: true,
|
|
8
|
+
syncProfile: true,
|
|
9
|
+
config: true,
|
|
10
|
+
metadata: true,
|
|
11
|
+
connectorId: true,
|
|
12
|
+
})
|
|
13
|
+
.merge(connectorMetadataGuard)
|
|
14
|
+
.merge(z.object({
|
|
15
|
+
type: z.nativeEnum(ConnectorType),
|
|
16
|
+
isDemo: z.boolean().optional(),
|
|
17
|
+
}));
|
|
18
|
+
export const connectorFactoryResponseGuard = z
|
|
19
|
+
.object({
|
|
20
|
+
type: z.nativeEnum(ConnectorType),
|
|
21
|
+
isDemo: z.boolean().optional(),
|
|
22
|
+
})
|
|
23
|
+
.merge(connectorMetadataGuard);
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export declare const getNewUsersResponseGuard: import("zod").ZodObject<{
|
|
2
|
+
today: import("zod").ZodObject<{
|
|
3
|
+
count: import("zod").ZodNumber;
|
|
4
|
+
delta: import("zod").ZodNumber;
|
|
5
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
6
|
+
count: number;
|
|
7
|
+
delta: number;
|
|
8
|
+
}, {
|
|
9
|
+
count: number;
|
|
10
|
+
delta: number;
|
|
11
|
+
}>;
|
|
12
|
+
last7Days: import("zod").ZodObject<{
|
|
13
|
+
count: import("zod").ZodNumber;
|
|
14
|
+
delta: import("zod").ZodNumber;
|
|
15
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
16
|
+
count: number;
|
|
17
|
+
delta: number;
|
|
18
|
+
}, {
|
|
19
|
+
count: number;
|
|
20
|
+
delta: number;
|
|
21
|
+
}>;
|
|
22
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
23
|
+
today: {
|
|
24
|
+
count: number;
|
|
25
|
+
delta: number;
|
|
26
|
+
};
|
|
27
|
+
last7Days: {
|
|
28
|
+
count: number;
|
|
29
|
+
delta: number;
|
|
30
|
+
};
|
|
31
|
+
}, {
|
|
32
|
+
today: {
|
|
33
|
+
count: number;
|
|
34
|
+
delta: number;
|
|
35
|
+
};
|
|
36
|
+
last7Days: {
|
|
37
|
+
count: number;
|
|
38
|
+
delta: number;
|
|
39
|
+
};
|
|
40
|
+
}>;
|
|
41
|
+
export declare const getActiveUsersResponseGuard: import("zod").ZodObject<{
|
|
42
|
+
dauCurve: import("zod").ZodArray<import("zod").ZodObject<{
|
|
43
|
+
date: import("zod").ZodString;
|
|
44
|
+
count: import("zod").ZodNumber;
|
|
45
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
46
|
+
date: string;
|
|
47
|
+
count: number;
|
|
48
|
+
}, {
|
|
49
|
+
date: string;
|
|
50
|
+
count: number;
|
|
51
|
+
}>, "many">;
|
|
52
|
+
dau: import("zod").ZodObject<{
|
|
53
|
+
count: import("zod").ZodNumber;
|
|
54
|
+
delta: import("zod").ZodNumber;
|
|
55
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
56
|
+
count: number;
|
|
57
|
+
delta: number;
|
|
58
|
+
}, {
|
|
59
|
+
count: number;
|
|
60
|
+
delta: number;
|
|
61
|
+
}>;
|
|
62
|
+
wau: import("zod").ZodObject<{
|
|
63
|
+
count: import("zod").ZodNumber;
|
|
64
|
+
delta: import("zod").ZodNumber;
|
|
65
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
66
|
+
count: number;
|
|
67
|
+
delta: number;
|
|
68
|
+
}, {
|
|
69
|
+
count: number;
|
|
70
|
+
delta: number;
|
|
71
|
+
}>;
|
|
72
|
+
mau: import("zod").ZodObject<{
|
|
73
|
+
count: import("zod").ZodNumber;
|
|
74
|
+
delta: import("zod").ZodNumber;
|
|
75
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
76
|
+
count: number;
|
|
77
|
+
delta: number;
|
|
78
|
+
}, {
|
|
79
|
+
count: number;
|
|
80
|
+
delta: number;
|
|
81
|
+
}>;
|
|
82
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
83
|
+
dauCurve: {
|
|
84
|
+
date: string;
|
|
85
|
+
count: number;
|
|
86
|
+
}[];
|
|
87
|
+
dau: {
|
|
88
|
+
count: number;
|
|
89
|
+
delta: number;
|
|
90
|
+
};
|
|
91
|
+
wau: {
|
|
92
|
+
count: number;
|
|
93
|
+
delta: number;
|
|
94
|
+
};
|
|
95
|
+
mau: {
|
|
96
|
+
count: number;
|
|
97
|
+
delta: number;
|
|
98
|
+
};
|
|
99
|
+
}, {
|
|
100
|
+
dauCurve: {
|
|
101
|
+
date: string;
|
|
102
|
+
count: number;
|
|
103
|
+
}[];
|
|
104
|
+
dau: {
|
|
105
|
+
count: number;
|
|
106
|
+
delta: number;
|
|
107
|
+
};
|
|
108
|
+
wau: {
|
|
109
|
+
count: number;
|
|
110
|
+
delta: number;
|
|
111
|
+
};
|
|
112
|
+
mau: {
|
|
113
|
+
count: number;
|
|
114
|
+
delta: number;
|
|
115
|
+
};
|
|
116
|
+
}>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { number, object, array, string } from 'zod';
|
|
2
|
+
const dashboardUsersDataGuard = object({
|
|
3
|
+
count: number(),
|
|
4
|
+
delta: number(),
|
|
5
|
+
});
|
|
6
|
+
export const getNewUsersResponseGuard = object({
|
|
7
|
+
today: dashboardUsersDataGuard,
|
|
8
|
+
last7Days: dashboardUsersDataGuard,
|
|
9
|
+
});
|
|
10
|
+
export const getActiveUsersResponseGuard = object({
|
|
11
|
+
dauCurve: array(object({
|
|
12
|
+
date: string(),
|
|
13
|
+
count: number(),
|
|
14
|
+
})),
|
|
15
|
+
dau: dashboardUsersDataGuard,
|
|
16
|
+
wau: dashboardUsersDataGuard,
|
|
17
|
+
mau: dashboardUsersDataGuard,
|
|
18
|
+
});
|
package/lib/types/index.d.ts
CHANGED
package/lib/types/index.js
CHANGED
|
@@ -38,13 +38,13 @@ export declare const phonePasswordPayloadGuard: z.ZodObject<{
|
|
|
38
38
|
export type PhonePasswordPayload = z.infer<typeof phonePasswordPayloadGuard>;
|
|
39
39
|
export declare const socialConnectorPayloadGuard: z.ZodObject<{
|
|
40
40
|
connectorId: z.ZodString;
|
|
41
|
-
connectorData: z.ZodRecord<z.ZodString, z.
|
|
41
|
+
connectorData: z.ZodRecord<z.ZodString, z.ZodType<import("@withtyped/server").Json, z.ZodTypeDef, import("@withtyped/server").Json>>;
|
|
42
42
|
}, "strip", z.ZodTypeAny, {
|
|
43
43
|
connectorId: string;
|
|
44
|
-
connectorData: Record<string,
|
|
44
|
+
connectorData: Record<string, import("@withtyped/server").Json>;
|
|
45
45
|
}, {
|
|
46
46
|
connectorId: string;
|
|
47
|
-
connectorData: Record<string,
|
|
47
|
+
connectorData: Record<string, import("@withtyped/server").Json>;
|
|
48
48
|
}>;
|
|
49
49
|
export type SocialConnectorPayload = z.infer<typeof socialConnectorPayloadGuard>;
|
|
50
50
|
export declare const socialEmailPayloadGuard: z.ZodObject<{
|
|
@@ -123,13 +123,13 @@ export declare const identifierPayloadGuard: z.ZodUnion<[z.ZodObject<{
|
|
|
123
123
|
verificationCode: string;
|
|
124
124
|
}>, z.ZodObject<{
|
|
125
125
|
connectorId: z.ZodString;
|
|
126
|
-
connectorData: z.ZodRecord<z.ZodString, z.
|
|
126
|
+
connectorData: z.ZodRecord<z.ZodString, z.ZodType<import("@withtyped/server").Json, z.ZodTypeDef, import("@withtyped/server").Json>>;
|
|
127
127
|
}, "strip", z.ZodTypeAny, {
|
|
128
128
|
connectorId: string;
|
|
129
|
-
connectorData: Record<string,
|
|
129
|
+
connectorData: Record<string, import("@withtyped/server").Json>;
|
|
130
130
|
}, {
|
|
131
131
|
connectorId: string;
|
|
132
|
-
connectorData: Record<string,
|
|
132
|
+
connectorData: Record<string, import("@withtyped/server").Json>;
|
|
133
133
|
}>, z.ZodObject<{
|
|
134
134
|
connectorId: z.ZodString;
|
|
135
135
|
email: z.ZodString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { emailRegEx, phoneRegEx, usernameRegEx, passwordRegEx } from '@logto/core-kit';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
3
|
+
import { jsonObjectGuard } from '../foundations/index.js';
|
|
4
4
|
import { emailVerificationCodePayloadGuard, phoneVerificationCodePayloadGuard, } from './verification-code.js';
|
|
5
5
|
/**
|
|
6
6
|
* Detailed Identifier Methods guard
|
|
@@ -19,7 +19,7 @@ export const phonePasswordPayloadGuard = z.object({
|
|
|
19
19
|
});
|
|
20
20
|
export const socialConnectorPayloadGuard = z.object({
|
|
21
21
|
connectorId: z.string(),
|
|
22
|
-
connectorData:
|
|
22
|
+
connectorData: jsonObjectGuard,
|
|
23
23
|
});
|
|
24
24
|
export const socialEmailPayloadGuard = z.object({
|
|
25
25
|
connectorId: z.string(),
|
package/lib/types/scope.d.ts
CHANGED
|
@@ -1,4 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { type z } from 'zod';
|
|
2
|
+
export declare const scopeResponseGuard: z.ZodObject<z.extendShape<{
|
|
3
|
+
tenantId: z.ZodType<string, z.ZodTypeDef, string>;
|
|
4
|
+
id: z.ZodType<string, z.ZodTypeDef, string>;
|
|
5
|
+
resourceId: z.ZodType<string, z.ZodTypeDef, string>;
|
|
6
|
+
name: z.ZodType<string, z.ZodTypeDef, string>;
|
|
7
|
+
description: z.ZodType<string, z.ZodTypeDef, string>;
|
|
8
|
+
createdAt: z.ZodType<number, z.ZodTypeDef, number>;
|
|
9
|
+
}, {
|
|
10
|
+
resource: import("../index.js").Guard<import("../db-entries/resource.js").Resource>;
|
|
11
|
+
}>, "strip", z.ZodTypeAny, {
|
|
12
|
+
tenantId: string;
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
createdAt: number;
|
|
17
|
+
resource: {
|
|
18
|
+
tenantId: string;
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
indicator: string;
|
|
22
|
+
accessTokenTtl: number;
|
|
23
|
+
};
|
|
24
|
+
resourceId: string;
|
|
25
|
+
}, {
|
|
26
|
+
tenantId: string;
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
createdAt: number;
|
|
31
|
+
resource: {
|
|
32
|
+
tenantId: string;
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
indicator: string;
|
|
36
|
+
accessTokenTtl: number;
|
|
37
|
+
};
|
|
38
|
+
resourceId: string;
|
|
39
|
+
}>;
|
|
40
|
+
export type ScopeResponse = z.infer<typeof scopeResponseGuard>;
|
package/lib/types/scope.js
CHANGED
package/lib/types/user.d.ts
CHANGED
|
@@ -1,9 +1,133 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
export declare const userInfoSelectFields: readonly ["id", "username", "primaryEmail", "primaryPhone", "name", "avatar", "customData", "identities", "lastSignInAt", "createdAt", "applicationId", "isSuspended"];
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export declare const userInfoGuard: z.ZodObject<Pick<{
|
|
4
|
+
tenantId: z.ZodType<string, z.ZodTypeDef, string>;
|
|
5
|
+
id: z.ZodType<string, z.ZodTypeDef, string>;
|
|
6
|
+
username: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
7
|
+
primaryEmail: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
8
|
+
primaryPhone: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
9
|
+
passwordEncrypted: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
10
|
+
passwordEncryptionMethod: z.ZodType<import("../db-entries/custom-types.js").UsersPasswordEncryptionMethod | null, z.ZodTypeDef, import("../db-entries/custom-types.js").UsersPasswordEncryptionMethod | null>;
|
|
11
|
+
name: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
12
|
+
avatar: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
13
|
+
applicationId: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
14
|
+
identities: z.ZodType<Record<string, {
|
|
15
|
+
details?: {} | undefined;
|
|
16
|
+
userId: string;
|
|
17
|
+
}>, z.ZodTypeDef, Record<string, {
|
|
18
|
+
details?: {} | undefined;
|
|
19
|
+
userId: string;
|
|
20
|
+
}>>;
|
|
21
|
+
customData: z.ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
|
|
22
|
+
isSuspended: z.ZodType<boolean, z.ZodTypeDef, boolean>;
|
|
23
|
+
lastSignInAt: z.ZodType<number | null, z.ZodTypeDef, number | null>;
|
|
24
|
+
createdAt: z.ZodType<number, z.ZodTypeDef, number>;
|
|
25
|
+
}, "tenantId" | "username" | "applicationId" | "id" | "name" | "createdAt" | "primaryEmail" | "primaryPhone" | "passwordEncrypted" | "passwordEncryptionMethod" | "avatar" | "identities" | "customData" | "isSuspended" | "lastSignInAt">, "strip", z.ZodTypeAny, {
|
|
26
|
+
tenantId: string;
|
|
27
|
+
username: string | null;
|
|
28
|
+
applicationId: string | null;
|
|
29
|
+
id: string;
|
|
30
|
+
name: string | null;
|
|
31
|
+
createdAt: number;
|
|
32
|
+
primaryEmail: string | null;
|
|
33
|
+
primaryPhone: string | null;
|
|
34
|
+
passwordEncrypted: string | null;
|
|
35
|
+
passwordEncryptionMethod: import("../db-entries/custom-types.js").UsersPasswordEncryptionMethod | null;
|
|
36
|
+
avatar: string | null;
|
|
37
|
+
identities: Record<string, {
|
|
38
|
+
details?: {} | undefined;
|
|
39
|
+
userId: string;
|
|
40
|
+
}>;
|
|
41
|
+
customData: import("@withtyped/server").JsonObject;
|
|
42
|
+
isSuspended: boolean;
|
|
43
|
+
lastSignInAt: number | null;
|
|
44
|
+
}, {
|
|
45
|
+
tenantId: string;
|
|
46
|
+
username: string | null;
|
|
47
|
+
applicationId: string | null;
|
|
48
|
+
id: string;
|
|
49
|
+
name: string | null;
|
|
50
|
+
createdAt: number;
|
|
51
|
+
primaryEmail: string | null;
|
|
52
|
+
primaryPhone: string | null;
|
|
53
|
+
passwordEncrypted: string | null;
|
|
54
|
+
passwordEncryptionMethod: import("../db-entries/custom-types.js").UsersPasswordEncryptionMethod | null;
|
|
55
|
+
avatar: string | null;
|
|
56
|
+
identities: Record<string, {
|
|
57
|
+
details?: {} | undefined;
|
|
58
|
+
userId: string;
|
|
59
|
+
}>;
|
|
60
|
+
customData: import("@withtyped/server").JsonObject;
|
|
61
|
+
isSuspended: boolean;
|
|
62
|
+
lastSignInAt: number | null;
|
|
63
|
+
}>;
|
|
64
|
+
export type UserInfo = z.infer<typeof userInfoGuard>;
|
|
65
|
+
export declare const userProfileResponseGuard: z.ZodObject<z.extendShape<Pick<{
|
|
66
|
+
tenantId: z.ZodType<string, z.ZodTypeDef, string>;
|
|
67
|
+
id: z.ZodType<string, z.ZodTypeDef, string>;
|
|
68
|
+
username: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
69
|
+
primaryEmail: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
70
|
+
primaryPhone: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
71
|
+
passwordEncrypted: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
72
|
+
passwordEncryptionMethod: z.ZodType<import("../db-entries/custom-types.js").UsersPasswordEncryptionMethod | null, z.ZodTypeDef, import("../db-entries/custom-types.js").UsersPasswordEncryptionMethod | null>;
|
|
73
|
+
name: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
74
|
+
avatar: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
75
|
+
applicationId: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
76
|
+
identities: z.ZodType<Record<string, {
|
|
77
|
+
details?: {} | undefined;
|
|
78
|
+
userId: string;
|
|
79
|
+
}>, z.ZodTypeDef, Record<string, {
|
|
80
|
+
details?: {} | undefined;
|
|
81
|
+
userId: string;
|
|
82
|
+
}>>;
|
|
83
|
+
customData: z.ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
|
|
84
|
+
isSuspended: z.ZodType<boolean, z.ZodTypeDef, boolean>;
|
|
85
|
+
lastSignInAt: z.ZodType<number | null, z.ZodTypeDef, number | null>;
|
|
86
|
+
createdAt: z.ZodType<number, z.ZodTypeDef, number>;
|
|
87
|
+
}, "tenantId" | "username" | "applicationId" | "id" | "name" | "createdAt" | "primaryEmail" | "primaryPhone" | "passwordEncrypted" | "passwordEncryptionMethod" | "avatar" | "identities" | "customData" | "isSuspended" | "lastSignInAt">, {
|
|
88
|
+
hasPassword: z.ZodOptional<z.ZodBoolean>;
|
|
89
|
+
}>, "strip", z.ZodTypeAny, {
|
|
90
|
+
hasPassword?: boolean | undefined;
|
|
91
|
+
tenantId: string;
|
|
92
|
+
username: string | null;
|
|
93
|
+
applicationId: string | null;
|
|
94
|
+
id: string;
|
|
95
|
+
name: string | null;
|
|
96
|
+
createdAt: number;
|
|
97
|
+
primaryEmail: string | null;
|
|
98
|
+
primaryPhone: string | null;
|
|
99
|
+
passwordEncrypted: string | null;
|
|
100
|
+
passwordEncryptionMethod: import("../db-entries/custom-types.js").UsersPasswordEncryptionMethod | null;
|
|
101
|
+
avatar: string | null;
|
|
102
|
+
identities: Record<string, {
|
|
103
|
+
details?: {} | undefined;
|
|
104
|
+
userId: string;
|
|
105
|
+
}>;
|
|
106
|
+
customData: import("@withtyped/server").JsonObject;
|
|
107
|
+
isSuspended: boolean;
|
|
108
|
+
lastSignInAt: number | null;
|
|
109
|
+
}, {
|
|
110
|
+
hasPassword?: boolean | undefined;
|
|
111
|
+
tenantId: string;
|
|
112
|
+
username: string | null;
|
|
113
|
+
applicationId: string | null;
|
|
114
|
+
id: string;
|
|
115
|
+
name: string | null;
|
|
116
|
+
createdAt: number;
|
|
117
|
+
primaryEmail: string | null;
|
|
118
|
+
primaryPhone: string | null;
|
|
119
|
+
passwordEncrypted: string | null;
|
|
120
|
+
passwordEncryptionMethod: import("../db-entries/custom-types.js").UsersPasswordEncryptionMethod | null;
|
|
121
|
+
avatar: string | null;
|
|
122
|
+
identities: Record<string, {
|
|
123
|
+
details?: {} | undefined;
|
|
124
|
+
userId: string;
|
|
125
|
+
}>;
|
|
126
|
+
customData: import("@withtyped/server").JsonObject;
|
|
127
|
+
isSuspended: boolean;
|
|
128
|
+
lastSignInAt: number | null;
|
|
129
|
+
}>;
|
|
130
|
+
export type UserProfileResponse = z.infer<typeof userProfileResponseGuard>;
|
|
7
131
|
/** Internal read-only roles for user tenants. */
|
|
8
132
|
export declare enum InternalRole {
|
|
9
133
|
/**
|
package/lib/types/user.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Users } from '../db-entries/index.js';
|
|
1
3
|
export const userInfoSelectFields = Object.freeze([
|
|
2
4
|
'id',
|
|
3
5
|
'username',
|
|
@@ -12,6 +14,10 @@ export const userInfoSelectFields = Object.freeze([
|
|
|
12
14
|
'applicationId',
|
|
13
15
|
'isSuspended',
|
|
14
16
|
]);
|
|
17
|
+
export const userInfoGuard = Users.guard.pick(Object.fromEntries(userInfoSelectFields.map((key) => [key, true])));
|
|
18
|
+
export const userProfileResponseGuard = userInfoGuard.extend({
|
|
19
|
+
hasPassword: z.boolean().optional(),
|
|
20
|
+
});
|
|
15
21
|
/** Internal read-only roles for user tenants. */
|
|
16
22
|
export var InternalRole;
|
|
17
23
|
(function (InternalRole) {
|
package/package.json
CHANGED
package/tables/connectors.sql
CHANGED
|
@@ -4,7 +4,7 @@ create table connectors (
|
|
|
4
4
|
id varchar(128) not null,
|
|
5
5
|
sync_profile boolean not null default FALSE,
|
|
6
6
|
connector_id varchar(128) not null,
|
|
7
|
-
config jsonb /* @use
|
|
7
|
+
config jsonb /* @use JsonObject */ not null default '{}'::jsonb,
|
|
8
8
|
metadata jsonb /* @use ConfigurableConnectorMetadata */ not null default '{}'::jsonb,
|
|
9
9
|
created_at timestamptz not null default(now()),
|
|
10
10
|
primary key (id)
|
package/tables/hooks.sql
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
create table hooks (
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
)
|
|
2
|
+
tenant_id varchar(21) not null
|
|
3
|
+
references tenants (id) on update cascade on delete cascade,
|
|
4
|
+
id varchar(21) not null,
|
|
5
|
+
name varchar(256) not null default '',
|
|
6
|
+
event varchar(128) /* @use HookEvent */,
|
|
7
|
+
events jsonb /* @use HookEvents */ not null default '[]'::jsonb,
|
|
8
|
+
config jsonb /* @use HookConfig */ not null,
|
|
9
|
+
signing_key varchar(64) not null default '',
|
|
10
|
+
enabled boolean not null default true,
|
|
11
|
+
created_at timestamptz not null default(now()),
|
|
12
|
+
primary key (id)
|
|
13
|
+
);
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
create index hooks__event on hooks (tenant_id, event);
|
|
15
|
+
create index hooks__id on hooks (tenant_id, id);
|
package/tables/logto_configs.sql
CHANGED
|
@@ -2,6 +2,6 @@ create table logto_configs (
|
|
|
2
2
|
tenant_id varchar(21) not null
|
|
3
3
|
references tenants (id) on update cascade on delete cascade,
|
|
4
4
|
key varchar(256) not null,
|
|
5
|
-
value jsonb /* @use
|
|
5
|
+
value jsonb /* @use JsonObject */ not null default '{}'::jsonb,
|
|
6
6
|
primary key (tenant_id, key)
|
|
7
7
|
);
|
package/tables/service_logs.sql
CHANGED
|
@@ -3,7 +3,7 @@ create table service_logs (
|
|
|
3
3
|
tenant_id varchar(21) not null
|
|
4
4
|
references tenants (id) on update cascade on delete cascade,
|
|
5
5
|
type varchar(64) not null,
|
|
6
|
-
payload jsonb /* @use
|
|
6
|
+
payload jsonb /* @use JsonObject */ not null default '{}'::jsonb,
|
|
7
7
|
created_at timestamptz not null default(now()),
|
|
8
8
|
primary key (id)
|
|
9
9
|
);
|
package/tables/systems.sql
CHANGED
package/tables/users.sql
CHANGED
|
@@ -15,7 +15,7 @@ create table users (
|
|
|
15
15
|
avatar varchar(2048),
|
|
16
16
|
application_id varchar(21),
|
|
17
17
|
identities jsonb /* @use Identities */ not null default '{}'::jsonb,
|
|
18
|
-
custom_data jsonb /* @use
|
|
18
|
+
custom_data jsonb /* @use JsonObject */ not null default '{}'::jsonb,
|
|
19
19
|
is_suspended boolean not null default false,
|
|
20
20
|
last_sign_in_at timestamptz,
|
|
21
21
|
created_at timestamptz not null default (now()),
|