@logto/schemas 1.10.0 → 1.11.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.10.1-1695647183-update-private-key-type.ts +108 -0
- package/alterations/1.10.1-1696657546-organization-tables.ts +150 -0
- package/alterations/1.10.1-1697683802-add-sso-connectors-table.ts +66 -0
- package/alterations/1.10.1-1698646271-add-organization-created-flag.ts +75 -0
- package/alterations/1.10.1-1698820410-add-user-sso-identities-table.ts +61 -0
- package/alterations/1.10.1-1698910485-user-logto-data.ts +20 -0
- package/alterations/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.ts +18 -0
- package/alterations/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.ts +18 -0
- package/alterations-js/1.10.1-1695647183-update-private-key-type.d.ts +3 -0
- package/alterations-js/1.10.1-1695647183-update-private-key-type.js +50 -0
- package/alterations-js/1.10.1-1696657546-organization-tables.d.ts +3 -0
- package/alterations-js/1.10.1-1696657546-organization-tables.js +136 -0
- package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.d.ts +3 -0
- package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.js +58 -0
- package/alterations-js/1.10.1-1698646271-add-organization-created-flag.d.ts +3 -0
- package/alterations-js/1.10.1-1698646271-add-organization-created-flag.js +26 -0
- package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.d.ts +4 -0
- package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.js +53 -0
- package/alterations-js/1.10.1-1698910485-user-logto-data.d.ts +3 -0
- package/alterations-js/1.10.1-1698910485-user-logto-data.js +16 -0
- package/alterations-js/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.d.ts +3 -0
- package/alterations-js/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.js +14 -0
- package/alterations-js/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.d.ts +3 -0
- package/alterations-js/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.js +14 -0
- package/lib/db-entries/application.d.ts +7 -1
- package/lib/db-entries/application.js +1 -0
- package/lib/db-entries/applications-role.d.ts +7 -1
- package/lib/db-entries/applications-role.js +1 -0
- package/lib/db-entries/connector.d.ts +7 -1
- package/lib/db-entries/connector.js +1 -0
- package/lib/db-entries/custom-phrase.d.ts +7 -1
- package/lib/db-entries/custom-phrase.js +1 -0
- package/lib/db-entries/daily-active-user.d.ts +7 -1
- package/lib/db-entries/daily-active-user.js +1 -0
- package/lib/db-entries/domain.d.ts +7 -1
- package/lib/db-entries/domain.js +1 -0
- package/lib/db-entries/hook.d.ts +7 -1
- package/lib/db-entries/hook.js +1 -0
- package/lib/db-entries/index.d.ts +8 -0
- package/lib/db-entries/index.js +8 -0
- package/lib/db-entries/log.d.ts +7 -1
- package/lib/db-entries/log.js +1 -0
- package/lib/db-entries/logto-config.d.ts +10 -4
- package/lib/db-entries/logto-config.js +4 -3
- package/lib/db-entries/oidc-model-instance.d.ts +7 -1
- package/lib/db-entries/oidc-model-instance.js +1 -0
- package/lib/db-entries/organization-role-scope-relation.d.ts +20 -0
- package/lib/db-entries/organization-role-scope-relation.js +29 -0
- package/lib/db-entries/organization-role-user-relation.d.ts +22 -0
- package/lib/db-entries/organization-role-user-relation.js +33 -0
- package/lib/db-entries/organization-role.d.ts +28 -0
- package/lib/db-entries/organization-role.js +33 -0
- package/lib/db-entries/organization-scope.d.ts +28 -0
- package/lib/db-entries/organization-scope.js +33 -0
- package/lib/db-entries/organization-user-relation.d.ts +20 -0
- package/lib/db-entries/organization-user-relation.js +29 -0
- package/lib/db-entries/organization.d.ts +32 -0
- package/lib/db-entries/organization.js +37 -0
- package/lib/db-entries/passcode.d.ts +7 -1
- package/lib/db-entries/passcode.js +1 -0
- package/lib/db-entries/resource.d.ts +7 -1
- package/lib/db-entries/resource.js +1 -0
- package/lib/db-entries/role.d.ts +7 -1
- package/lib/db-entries/role.js +1 -0
- package/lib/db-entries/roles-scope.d.ts +7 -1
- package/lib/db-entries/roles-scope.js +1 -0
- package/lib/db-entries/scope.d.ts +7 -1
- package/lib/db-entries/scope.js +1 -0
- package/lib/db-entries/sentinel-activity.d.ts +7 -1
- package/lib/db-entries/sentinel-activity.js +1 -0
- package/lib/db-entries/service-log.d.ts +7 -1
- package/lib/db-entries/service-log.js +1 -0
- package/lib/db-entries/sign-in-experience.d.ts +7 -1
- package/lib/db-entries/sign-in-experience.js +1 -0
- package/lib/db-entries/sso-connector.d.ts +46 -0
- package/lib/db-entries/sso-connector.js +54 -0
- package/lib/db-entries/system.d.ts +7 -1
- package/lib/db-entries/system.js +1 -0
- package/lib/db-entries/user-sso-identity.d.ts +32 -0
- package/lib/db-entries/user-sso-identity.js +50 -0
- package/lib/db-entries/user.d.ts +9 -1
- package/lib/db-entries/user.js +5 -0
- package/lib/db-entries/users-role.d.ts +7 -1
- package/lib/db-entries/users-role.js +1 -0
- package/lib/db-entries/verification-status.d.ts +7 -1
- package/lib/db-entries/verification-status.js +1 -0
- package/lib/foundations/index.d.ts +1 -1
- package/lib/foundations/index.js +1 -1
- package/lib/foundations/jsonb-types/custom-domain.d.ts +134 -0
- package/lib/foundations/jsonb-types/custom-domain.js +36 -0
- package/lib/foundations/jsonb-types/hooks.d.ts +32 -0
- package/lib/foundations/jsonb-types/hooks.js +24 -0
- package/lib/foundations/jsonb-types/index.d.ts +15 -0
- package/lib/foundations/jsonb-types/index.js +16 -0
- package/lib/foundations/jsonb-types/logs.d.ts +106 -0
- package/lib/foundations/jsonb-types/logs.js +20 -0
- package/lib/foundations/jsonb-types/oidc-module.d.ts +80 -0
- package/lib/foundations/jsonb-types/oidc-module.js +54 -0
- package/lib/foundations/jsonb-types/phrases.d.ts +5 -0
- package/lib/foundations/jsonb-types/phrases.js +2 -0
- package/lib/foundations/jsonb-types/sentinel.d.ts +27 -0
- package/lib/foundations/jsonb-types/sentinel.js +28 -0
- package/lib/foundations/jsonb-types/sign-in-experience.d.ts +118 -0
- package/lib/foundations/jsonb-types/sign-in-experience.js +56 -0
- package/lib/foundations/jsonb-types/sso-connector.d.ts +14 -0
- package/lib/foundations/jsonb-types/sso-connector.js +6 -0
- package/lib/foundations/jsonb-types/users.d.ts +285 -0
- package/lib/foundations/jsonb-types/users.js +47 -0
- package/lib/foundations/schemas.d.ts +11 -13
- package/lib/models/tenants.d.ts +8 -16
- package/lib/models/tenants.js +1 -6
- package/lib/seeds/logto-config.js +1 -0
- package/lib/types/application.d.ts +51 -1
- package/lib/types/application.js +7 -1
- package/lib/types/connector.d.ts +516 -2360
- package/lib/types/domain.d.ts +65 -27
- package/lib/types/hook.d.ts +15 -16
- package/lib/types/index.d.ts +4 -0
- package/lib/types/index.js +4 -0
- package/lib/types/interactions.d.ts +502 -10
- package/lib/types/interactions.js +83 -5
- package/lib/types/log/interaction.d.ts +4 -3
- package/lib/types/log/interaction.js +1 -0
- package/lib/types/logto-config.d.ts +74 -2
- package/lib/types/logto-config.js +38 -3
- package/lib/types/mfa.d.ts +211 -0
- package/lib/types/mfa.js +62 -0
- package/lib/types/organization.d.ts +48 -0
- package/lib/types/organization.js +21 -0
- package/lib/types/role.d.ts +5 -3
- package/lib/types/scope.d.ts +12 -27
- package/lib/types/sso-connector.d.ts +137 -0
- package/lib/types/sso-connector.js +24 -0
- package/lib/types/system.d.ts +26 -7
- package/lib/types/system.js +8 -0
- package/lib/types/tenant.d.ts +5 -0
- package/lib/types/tenant.js +6 -0
- package/lib/types/user-assets.d.ts +2 -2
- package/lib/types/user.d.ts +209 -66
- package/lib/types/user.js +8 -2
- package/package.json +7 -7
- package/tables/logto_configs.sql +1 -1
- package/tables/organization_role_scope_relations.sql +12 -0
- package/tables/organization_role_user_relations.sql +14 -0
- package/tables/organization_roles.sql +19 -0
- package/tables/organization_scopes.sql +19 -0
- package/tables/organization_user_relations.sql +12 -0
- package/tables/organizations.sql +19 -0
- package/tables/sso_connectors.sql +28 -0
- package/tables/user_sso_identities.sql +20 -0
- package/tables/users.sql +1 -0
- package/lib/foundations/jsonb-types.d.ts +0 -673
- package/lib/foundations/jsonb-types.js +0 -260
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { jsonObjectGuard, ssoDomainsGuard, ssoBrandingGuard } from './../foundations/index.js';
|
|
4
|
+
const createGuard = z.object({
|
|
5
|
+
tenantId: z.string().max(21).optional(),
|
|
6
|
+
id: z.string().min(1).max(128),
|
|
7
|
+
providerName: z.string().min(1).max(128),
|
|
8
|
+
connectorName: z.string().min(1).max(128),
|
|
9
|
+
config: jsonObjectGuard.optional(),
|
|
10
|
+
domains: ssoDomainsGuard.optional(),
|
|
11
|
+
branding: ssoBrandingGuard.optional(),
|
|
12
|
+
syncProfile: z.boolean().optional(),
|
|
13
|
+
createdAt: z.number().optional(),
|
|
14
|
+
});
|
|
15
|
+
const guard = z.object({
|
|
16
|
+
tenantId: z.string().max(21),
|
|
17
|
+
id: z.string().min(1).max(128),
|
|
18
|
+
providerName: z.string().min(1).max(128),
|
|
19
|
+
connectorName: z.string().min(1).max(128),
|
|
20
|
+
config: jsonObjectGuard,
|
|
21
|
+
domains: ssoDomainsGuard,
|
|
22
|
+
branding: ssoBrandingGuard,
|
|
23
|
+
syncProfile: z.boolean(),
|
|
24
|
+
createdAt: z.number(),
|
|
25
|
+
});
|
|
26
|
+
export const SsoConnectors = Object.freeze({
|
|
27
|
+
table: 'sso_connectors',
|
|
28
|
+
tableSingular: 'sso_connector',
|
|
29
|
+
fields: {
|
|
30
|
+
tenantId: 'tenant_id',
|
|
31
|
+
id: 'id',
|
|
32
|
+
providerName: 'provider_name',
|
|
33
|
+
connectorName: 'connector_name',
|
|
34
|
+
config: 'config',
|
|
35
|
+
domains: 'domains',
|
|
36
|
+
branding: 'branding',
|
|
37
|
+
syncProfile: 'sync_profile',
|
|
38
|
+
createdAt: 'created_at',
|
|
39
|
+
},
|
|
40
|
+
fieldKeys: [
|
|
41
|
+
'tenantId',
|
|
42
|
+
'id',
|
|
43
|
+
'providerName',
|
|
44
|
+
'connectorName',
|
|
45
|
+
'config',
|
|
46
|
+
'domains',
|
|
47
|
+
'branding',
|
|
48
|
+
'syncProfile',
|
|
49
|
+
'createdAt',
|
|
50
|
+
],
|
|
51
|
+
createGuard,
|
|
52
|
+
guard,
|
|
53
|
+
updateGuard: guard.partial(),
|
|
54
|
+
});
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { JsonObject, GeneratedSchema } from './../foundations/index.js';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @remarks This is a type for database creation.
|
|
5
|
+
* @see {@link System} for the original type.
|
|
6
|
+
*/
|
|
2
7
|
export type CreateSystem = {
|
|
3
8
|
key: string;
|
|
4
9
|
value?: JsonObject;
|
|
@@ -7,4 +12,5 @@ export type System = {
|
|
|
7
12
|
key: string;
|
|
8
13
|
value: JsonObject;
|
|
9
14
|
};
|
|
10
|
-
export
|
|
15
|
+
export type SystemKeys = 'key' | 'value';
|
|
16
|
+
export declare const Systems: GeneratedSchema<SystemKeys, CreateSystem, System, 'systems', 'system'>;
|
package/lib/db-entries/system.js
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { JsonObject, GeneratedSchema } from './../foundations/index.js';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @remarks This is a type for database creation.
|
|
5
|
+
* @see {@link UserSsoIdentity} for the original type.
|
|
6
|
+
*/
|
|
7
|
+
export type CreateUserSsoIdentity = {
|
|
8
|
+
tenantId?: string;
|
|
9
|
+
id: string;
|
|
10
|
+
userId: string;
|
|
11
|
+
/** Unique provider identifier. Issuer of the OIDC connectors, entityId of the SAML providers */
|
|
12
|
+
issuer: string;
|
|
13
|
+
/** Provider user identity id */
|
|
14
|
+
identityId: string;
|
|
15
|
+
detail?: JsonObject;
|
|
16
|
+
createdAt?: number;
|
|
17
|
+
ssoConnectorId: string;
|
|
18
|
+
};
|
|
19
|
+
export type UserSsoIdentity = {
|
|
20
|
+
tenantId: string;
|
|
21
|
+
id: string;
|
|
22
|
+
userId: string;
|
|
23
|
+
/** Unique provider identifier. Issuer of the OIDC connectors, entityId of the SAML providers */
|
|
24
|
+
issuer: string;
|
|
25
|
+
/** Provider user identity id */
|
|
26
|
+
identityId: string;
|
|
27
|
+
detail: JsonObject;
|
|
28
|
+
createdAt: number;
|
|
29
|
+
ssoConnectorId: string;
|
|
30
|
+
};
|
|
31
|
+
export type UserSsoIdentityKeys = 'tenantId' | 'id' | 'userId' | 'issuer' | 'identityId' | 'detail' | 'createdAt' | 'ssoConnectorId';
|
|
32
|
+
export declare const UserSsoIdentities: GeneratedSchema<UserSsoIdentityKeys, CreateUserSsoIdentity, UserSsoIdentity, 'user_sso_identities', 'user_sso_identity'>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { jsonObjectGuard } from './../foundations/index.js';
|
|
4
|
+
const createGuard = z.object({
|
|
5
|
+
tenantId: z.string().max(21).optional(),
|
|
6
|
+
id: z.string().min(1).max(21),
|
|
7
|
+
userId: z.string().min(1).max(12),
|
|
8
|
+
issuer: z.string().min(1).max(256),
|
|
9
|
+
identityId: z.string().min(1).max(128),
|
|
10
|
+
detail: jsonObjectGuard.optional(),
|
|
11
|
+
createdAt: z.number().optional(),
|
|
12
|
+
ssoConnectorId: z.string().min(1).max(128),
|
|
13
|
+
});
|
|
14
|
+
const guard = z.object({
|
|
15
|
+
tenantId: z.string().max(21),
|
|
16
|
+
id: z.string().min(1).max(21),
|
|
17
|
+
userId: z.string().min(1).max(12),
|
|
18
|
+
issuer: z.string().min(1).max(256),
|
|
19
|
+
identityId: z.string().min(1).max(128),
|
|
20
|
+
detail: jsonObjectGuard,
|
|
21
|
+
createdAt: z.number(),
|
|
22
|
+
ssoConnectorId: z.string().min(1).max(128),
|
|
23
|
+
});
|
|
24
|
+
export const UserSsoIdentities = Object.freeze({
|
|
25
|
+
table: 'user_sso_identities',
|
|
26
|
+
tableSingular: 'user_sso_identity',
|
|
27
|
+
fields: {
|
|
28
|
+
tenantId: 'tenant_id',
|
|
29
|
+
id: 'id',
|
|
30
|
+
userId: 'user_id',
|
|
31
|
+
issuer: 'issuer',
|
|
32
|
+
identityId: 'identity_id',
|
|
33
|
+
detail: 'detail',
|
|
34
|
+
createdAt: 'created_at',
|
|
35
|
+
ssoConnectorId: 'sso_connector_id',
|
|
36
|
+
},
|
|
37
|
+
fieldKeys: [
|
|
38
|
+
'tenantId',
|
|
39
|
+
'id',
|
|
40
|
+
'userId',
|
|
41
|
+
'issuer',
|
|
42
|
+
'identityId',
|
|
43
|
+
'detail',
|
|
44
|
+
'createdAt',
|
|
45
|
+
'ssoConnectorId',
|
|
46
|
+
],
|
|
47
|
+
createGuard,
|
|
48
|
+
guard,
|
|
49
|
+
updateGuard: guard.partial(),
|
|
50
|
+
});
|
package/lib/db-entries/user.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Identities, JsonObject, MfaVerifications, GeneratedSchema } from './../foundations/index.js';
|
|
2
2
|
import { UsersPasswordEncryptionMethod } from './custom-types.js';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @remarks This is a type for database creation.
|
|
6
|
+
* @see {@link User} for the original type.
|
|
7
|
+
*/
|
|
3
8
|
export type CreateUser = {
|
|
4
9
|
tenantId?: string;
|
|
5
10
|
id: string;
|
|
@@ -13,6 +18,7 @@ export type CreateUser = {
|
|
|
13
18
|
applicationId?: string | null;
|
|
14
19
|
identities?: Identities;
|
|
15
20
|
customData?: JsonObject;
|
|
21
|
+
logtoConfig?: JsonObject;
|
|
16
22
|
mfaVerifications?: MfaVerifications;
|
|
17
23
|
isSuspended?: boolean;
|
|
18
24
|
lastSignInAt?: number | null;
|
|
@@ -31,9 +37,11 @@ export type User = {
|
|
|
31
37
|
applicationId: string | null;
|
|
32
38
|
identities: Identities;
|
|
33
39
|
customData: JsonObject;
|
|
40
|
+
logtoConfig: JsonObject;
|
|
34
41
|
mfaVerifications: MfaVerifications;
|
|
35
42
|
isSuspended: boolean;
|
|
36
43
|
lastSignInAt: number | null;
|
|
37
44
|
createdAt: number;
|
|
38
45
|
};
|
|
39
|
-
export
|
|
46
|
+
export type UserKeys = 'tenantId' | 'id' | 'username' | 'primaryEmail' | 'primaryPhone' | 'passwordEncrypted' | 'passwordEncryptionMethod' | 'name' | 'avatar' | 'applicationId' | 'identities' | 'customData' | 'logtoConfig' | 'mfaVerifications' | 'isSuspended' | 'lastSignInAt' | 'createdAt';
|
|
47
|
+
export declare const Users: GeneratedSchema<UserKeys, CreateUser, User, 'users', 'user'>;
|
package/lib/db-entries/user.js
CHANGED
|
@@ -15,6 +15,7 @@ const createGuard = z.object({
|
|
|
15
15
|
applicationId: z.string().max(21).nullable().optional(),
|
|
16
16
|
identities: identitiesGuard.optional(),
|
|
17
17
|
customData: jsonObjectGuard.optional(),
|
|
18
|
+
logtoConfig: jsonObjectGuard.optional(),
|
|
18
19
|
mfaVerifications: mfaVerificationsGuard.optional(),
|
|
19
20
|
isSuspended: z.boolean().optional(),
|
|
20
21
|
lastSignInAt: z.number().nullable().optional(),
|
|
@@ -33,6 +34,7 @@ const guard = z.object({
|
|
|
33
34
|
applicationId: z.string().max(21).nullable(),
|
|
34
35
|
identities: identitiesGuard,
|
|
35
36
|
customData: jsonObjectGuard,
|
|
37
|
+
logtoConfig: jsonObjectGuard,
|
|
36
38
|
mfaVerifications: mfaVerificationsGuard,
|
|
37
39
|
isSuspended: z.boolean(),
|
|
38
40
|
lastSignInAt: z.number().nullable(),
|
|
@@ -54,6 +56,7 @@ export const Users = Object.freeze({
|
|
|
54
56
|
applicationId: 'application_id',
|
|
55
57
|
identities: 'identities',
|
|
56
58
|
customData: 'custom_data',
|
|
59
|
+
logtoConfig: 'logto_config',
|
|
57
60
|
mfaVerifications: 'mfa_verifications',
|
|
58
61
|
isSuspended: 'is_suspended',
|
|
59
62
|
lastSignInAt: 'last_sign_in_at',
|
|
@@ -72,6 +75,7 @@ export const Users = Object.freeze({
|
|
|
72
75
|
'applicationId',
|
|
73
76
|
'identities',
|
|
74
77
|
'customData',
|
|
78
|
+
'logtoConfig',
|
|
75
79
|
'mfaVerifications',
|
|
76
80
|
'isSuspended',
|
|
77
81
|
'lastSignInAt',
|
|
@@ -79,4 +83,5 @@ export const Users = Object.freeze({
|
|
|
79
83
|
],
|
|
80
84
|
createGuard,
|
|
81
85
|
guard,
|
|
86
|
+
updateGuard: guard.partial(),
|
|
82
87
|
});
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { GeneratedSchema } from './../foundations/index.js';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @remarks This is a type for database creation.
|
|
5
|
+
* @see {@link UsersRole} for the original type.
|
|
6
|
+
*/
|
|
2
7
|
export type CreateUsersRole = {
|
|
3
8
|
tenantId?: string;
|
|
4
9
|
id: string;
|
|
@@ -11,4 +16,5 @@ export type UsersRole = {
|
|
|
11
16
|
userId: string;
|
|
12
17
|
roleId: string;
|
|
13
18
|
};
|
|
14
|
-
export
|
|
19
|
+
export type UsersRoleKeys = 'tenantId' | 'id' | 'userId' | 'roleId';
|
|
20
|
+
export declare const UsersRoles: GeneratedSchema<UsersRoleKeys, CreateUsersRole, UsersRole, 'users_roles', 'users_role'>;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { GeneratedSchema } from './../foundations/index.js';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @remarks This is a type for database creation.
|
|
5
|
+
* @see {@link VerificationStatus} for the original type.
|
|
6
|
+
*/
|
|
2
7
|
export type CreateVerificationStatus = {
|
|
3
8
|
tenantId?: string;
|
|
4
9
|
id: string;
|
|
@@ -11,4 +16,5 @@ export type VerificationStatus = {
|
|
|
11
16
|
userId: string;
|
|
12
17
|
createdAt: number;
|
|
13
18
|
};
|
|
14
|
-
export
|
|
19
|
+
export type VerificationStatusKeys = 'tenantId' | 'id' | 'userId' | 'createdAt';
|
|
20
|
+
export declare const VerificationStatuses: GeneratedSchema<VerificationStatusKeys, CreateVerificationStatus, VerificationStatus, 'verification_statuses', 'verification_status'>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './schemas.js';
|
|
2
|
-
export * from './jsonb-types.js';
|
|
2
|
+
export * from './jsonb-types/index.js';
|
package/lib/foundations/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './schemas.js';
|
|
2
|
-
export * from './jsonb-types.js';
|
|
2
|
+
export * from './jsonb-types/index.js';
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const domainDnsRecordGuard: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
type: z.ZodString;
|
|
5
|
+
value: z.ZodString;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
type: string;
|
|
8
|
+
value: string;
|
|
9
|
+
name: string;
|
|
10
|
+
}, {
|
|
11
|
+
type: string;
|
|
12
|
+
value: string;
|
|
13
|
+
name: string;
|
|
14
|
+
}>;
|
|
15
|
+
export type DomainDnsRecord = z.infer<typeof domainDnsRecordGuard>;
|
|
16
|
+
export declare const domainDnsRecordsGuard: z.ZodArray<z.ZodObject<{
|
|
17
|
+
name: z.ZodString;
|
|
18
|
+
type: z.ZodString;
|
|
19
|
+
value: z.ZodString;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
type: string;
|
|
22
|
+
value: string;
|
|
23
|
+
name: string;
|
|
24
|
+
}, {
|
|
25
|
+
type: string;
|
|
26
|
+
value: string;
|
|
27
|
+
name: string;
|
|
28
|
+
}>, "many">;
|
|
29
|
+
export type DomainDnsRecords = z.infer<typeof domainDnsRecordsGuard>;
|
|
30
|
+
export declare const cloudflareDataGuard: z.ZodObject<{
|
|
31
|
+
id: z.ZodString;
|
|
32
|
+
status: z.ZodString;
|
|
33
|
+
ssl: z.ZodObject<{
|
|
34
|
+
status: z.ZodString;
|
|
35
|
+
validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
36
|
+
message: z.ZodString;
|
|
37
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
38
|
+
message: z.ZodString;
|
|
39
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
40
|
+
message: z.ZodString;
|
|
41
|
+
}, z.ZodUnknown, "strip">>, "many">>;
|
|
42
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
43
|
+
status: z.ZodString;
|
|
44
|
+
validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
45
|
+
message: z.ZodString;
|
|
46
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
47
|
+
message: z.ZodString;
|
|
48
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
49
|
+
message: z.ZodString;
|
|
50
|
+
}, z.ZodUnknown, "strip">>, "many">>;
|
|
51
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
52
|
+
status: z.ZodString;
|
|
53
|
+
validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
54
|
+
message: z.ZodString;
|
|
55
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
56
|
+
message: z.ZodString;
|
|
57
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
58
|
+
message: z.ZodString;
|
|
59
|
+
}, z.ZodUnknown, "strip">>, "many">>;
|
|
60
|
+
}, z.ZodUnknown, "strip">>;
|
|
61
|
+
verification_errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
62
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
63
|
+
id: z.ZodString;
|
|
64
|
+
status: z.ZodString;
|
|
65
|
+
ssl: z.ZodObject<{
|
|
66
|
+
status: z.ZodString;
|
|
67
|
+
validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
68
|
+
message: z.ZodString;
|
|
69
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
70
|
+
message: z.ZodString;
|
|
71
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
72
|
+
message: z.ZodString;
|
|
73
|
+
}, z.ZodUnknown, "strip">>, "many">>;
|
|
74
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
75
|
+
status: z.ZodString;
|
|
76
|
+
validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
77
|
+
message: z.ZodString;
|
|
78
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
79
|
+
message: z.ZodString;
|
|
80
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
81
|
+
message: z.ZodString;
|
|
82
|
+
}, z.ZodUnknown, "strip">>, "many">>;
|
|
83
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
84
|
+
status: z.ZodString;
|
|
85
|
+
validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
86
|
+
message: z.ZodString;
|
|
87
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
88
|
+
message: z.ZodString;
|
|
89
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
90
|
+
message: z.ZodString;
|
|
91
|
+
}, z.ZodUnknown, "strip">>, "many">>;
|
|
92
|
+
}, z.ZodUnknown, "strip">>;
|
|
93
|
+
verification_errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
94
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
95
|
+
id: z.ZodString;
|
|
96
|
+
status: z.ZodString;
|
|
97
|
+
ssl: z.ZodObject<{
|
|
98
|
+
status: z.ZodString;
|
|
99
|
+
validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
100
|
+
message: z.ZodString;
|
|
101
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
102
|
+
message: z.ZodString;
|
|
103
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
104
|
+
message: z.ZodString;
|
|
105
|
+
}, z.ZodUnknown, "strip">>, "many">>;
|
|
106
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
107
|
+
status: z.ZodString;
|
|
108
|
+
validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
109
|
+
message: z.ZodString;
|
|
110
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
111
|
+
message: z.ZodString;
|
|
112
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
113
|
+
message: z.ZodString;
|
|
114
|
+
}, z.ZodUnknown, "strip">>, "many">>;
|
|
115
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
116
|
+
status: z.ZodString;
|
|
117
|
+
validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
118
|
+
message: z.ZodString;
|
|
119
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
120
|
+
message: z.ZodString;
|
|
121
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
122
|
+
message: z.ZodString;
|
|
123
|
+
}, z.ZodUnknown, "strip">>, "many">>;
|
|
124
|
+
}, z.ZodUnknown, "strip">>;
|
|
125
|
+
verification_errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
126
|
+
}, z.ZodUnknown, "strip">>;
|
|
127
|
+
export type CloudflareData = z.infer<typeof cloudflareDataGuard>;
|
|
128
|
+
export declare enum DomainStatus {
|
|
129
|
+
PendingVerification = "PendingVerification",
|
|
130
|
+
PendingSsl = "PendingSsl",
|
|
131
|
+
Active = "Active",
|
|
132
|
+
Error = "Error"
|
|
133
|
+
}
|
|
134
|
+
export declare const domainStatusGuard: z.ZodNativeEnum<typeof DomainStatus>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const domainDnsRecordGuard = z.object({
|
|
3
|
+
name: z.string(),
|
|
4
|
+
type: z.string(),
|
|
5
|
+
value: z.string(),
|
|
6
|
+
});
|
|
7
|
+
export const domainDnsRecordsGuard = domainDnsRecordGuard.array();
|
|
8
|
+
// https://developers.cloudflare.com/api/operations/custom-hostname-for-a-zone-list-custom-hostnames#Responses
|
|
9
|
+
// Predefine the "useful" fields
|
|
10
|
+
export const cloudflareDataGuard = z
|
|
11
|
+
.object({
|
|
12
|
+
id: z.string(),
|
|
13
|
+
status: z.string(),
|
|
14
|
+
ssl: z
|
|
15
|
+
.object({
|
|
16
|
+
status: z.string(),
|
|
17
|
+
validation_errors: z
|
|
18
|
+
.object({
|
|
19
|
+
message: z.string(),
|
|
20
|
+
})
|
|
21
|
+
.catchall(z.unknown())
|
|
22
|
+
.array()
|
|
23
|
+
.optional(),
|
|
24
|
+
})
|
|
25
|
+
.catchall(z.unknown()),
|
|
26
|
+
verification_errors: z.string().array().optional(),
|
|
27
|
+
})
|
|
28
|
+
.catchall(z.unknown());
|
|
29
|
+
export var DomainStatus;
|
|
30
|
+
(function (DomainStatus) {
|
|
31
|
+
DomainStatus["PendingVerification"] = "PendingVerification";
|
|
32
|
+
DomainStatus["PendingSsl"] = "PendingSsl";
|
|
33
|
+
DomainStatus["Active"] = "Active";
|
|
34
|
+
DomainStatus["Error"] = "Error";
|
|
35
|
+
})(DomainStatus || (DomainStatus = {}));
|
|
36
|
+
export const domainStatusGuard = z.nativeEnum(DomainStatus);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare enum HookEvent {
|
|
3
|
+
PostRegister = "PostRegister",
|
|
4
|
+
PostSignIn = "PostSignIn",
|
|
5
|
+
PostResetPassword = "PostResetPassword"
|
|
6
|
+
}
|
|
7
|
+
export declare const hookEventGuard: z.ZodType<HookEvent>;
|
|
8
|
+
export declare const hookEventsGuard: z.ZodArray<z.ZodType<HookEvent, z.ZodTypeDef, HookEvent>, "many">;
|
|
9
|
+
export type HookEvents = z.infer<typeof hookEventsGuard>;
|
|
10
|
+
export declare const hookConfigGuard: z.ZodObject<{
|
|
11
|
+
/** We don't need `type` since v1 only has web hook */
|
|
12
|
+
/** Method fixed to `POST` */
|
|
13
|
+
url: z.ZodString;
|
|
14
|
+
/** Additional headers that attach to the request */
|
|
15
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated
|
|
18
|
+
* Retry times when hook response status >= 500.
|
|
19
|
+
* Now the retry times is fixed to 3.
|
|
20
|
+
* Keep for backward compatibility.
|
|
21
|
+
*/
|
|
22
|
+
retries: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
url: string;
|
|
25
|
+
headers?: Record<string, string> | undefined;
|
|
26
|
+
retries?: number | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
url: string;
|
|
29
|
+
headers?: Record<string, string> | undefined;
|
|
30
|
+
retries?: number | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
export type HookConfig = z.infer<typeof hookConfigGuard>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export var HookEvent;
|
|
3
|
+
(function (HookEvent) {
|
|
4
|
+
HookEvent["PostRegister"] = "PostRegister";
|
|
5
|
+
HookEvent["PostSignIn"] = "PostSignIn";
|
|
6
|
+
HookEvent["PostResetPassword"] = "PostResetPassword";
|
|
7
|
+
})(HookEvent || (HookEvent = {}));
|
|
8
|
+
export const hookEventGuard = z.nativeEnum(HookEvent);
|
|
9
|
+
export const hookEventsGuard = hookEventGuard.array();
|
|
10
|
+
export const hookConfigGuard = z.object({
|
|
11
|
+
/** We don't need `type` since v1 only has web hook */
|
|
12
|
+
// type: 'web';
|
|
13
|
+
/** Method fixed to `POST` */
|
|
14
|
+
url: z.string(),
|
|
15
|
+
/** Additional headers that attach to the request */
|
|
16
|
+
headers: z.record(z.string()).optional(),
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
* Retry times when hook response status >= 500.
|
|
20
|
+
* Now the retry times is fixed to 3.
|
|
21
|
+
* Keep for backward compatibility.
|
|
22
|
+
*/
|
|
23
|
+
retries: z.number().gte(0).lte(3).optional(),
|
|
24
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Json } from '@withtyped/server';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export * from './custom-domain.js';
|
|
4
|
+
export * from './hooks.js';
|
|
5
|
+
export * from './logs.js';
|
|
6
|
+
export * from './oidc-module.js';
|
|
7
|
+
export * from './phrases.js';
|
|
8
|
+
export * from './sign-in-experience.js';
|
|
9
|
+
export * from './sentinel.js';
|
|
10
|
+
export * from './users.js';
|
|
11
|
+
export * from './sso-connector.js';
|
|
12
|
+
export { configurableConnectorMetadataGuard, type ConfigurableConnectorMetadata, } from '@logto/connector-kit';
|
|
13
|
+
export type { Json, JsonObject } from '@withtyped/server';
|
|
14
|
+
export declare const jsonGuard: z.ZodType<Json>;
|
|
15
|
+
export declare const jsonObjectGuard: z.ZodRecord<z.ZodString, z.ZodType<Json, z.ZodTypeDef, Json>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export * from './custom-domain.js';
|
|
3
|
+
export * from './hooks.js';
|
|
4
|
+
export * from './logs.js';
|
|
5
|
+
export * from './oidc-module.js';
|
|
6
|
+
export * from './phrases.js';
|
|
7
|
+
export * from './sign-in-experience.js';
|
|
8
|
+
export * from './sentinel.js';
|
|
9
|
+
export * from './users.js';
|
|
10
|
+
export * from './sso-connector.js';
|
|
11
|
+
export { configurableConnectorMetadataGuard, } from '@logto/connector-kit';
|
|
12
|
+
/* === Commonly Used === */
|
|
13
|
+
// Copied from https://github.com/colinhacks/zod#json-type
|
|
14
|
+
const literalSchema = z.union([z.string(), z.number(), z.boolean(), z.null()]);
|
|
15
|
+
export const jsonGuard = z.lazy(() => z.union([literalSchema, z.array(jsonGuard), z.record(jsonGuard)]));
|
|
16
|
+
export const jsonObjectGuard = z.record(jsonGuard);
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { type PasswordPolicy } from '@logto/core-kit';
|
|
2
|
+
import { type DeepPartial } from '@silverhand/essentials';
|
|
3
|
+
import { z } from 'zod';
|
|
4
|
+
export declare enum LogResult {
|
|
5
|
+
Success = "Success",
|
|
6
|
+
Error = "Error"
|
|
7
|
+
}
|
|
8
|
+
export declare const logContextPayloadGuard: z.ZodObject<{
|
|
9
|
+
key: z.ZodString;
|
|
10
|
+
result: z.ZodNativeEnum<typeof LogResult>;
|
|
11
|
+
error: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString]>>;
|
|
12
|
+
ip: z.ZodOptional<z.ZodString>;
|
|
13
|
+
userAgent: z.ZodOptional<z.ZodString>;
|
|
14
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
15
|
+
applicationId: z.ZodOptional<z.ZodString>;
|
|
16
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
18
|
+
key: z.ZodString;
|
|
19
|
+
result: z.ZodNativeEnum<typeof LogResult>;
|
|
20
|
+
error: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString]>>;
|
|
21
|
+
ip: z.ZodOptional<z.ZodString>;
|
|
22
|
+
userAgent: z.ZodOptional<z.ZodString>;
|
|
23
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
24
|
+
applicationId: z.ZodOptional<z.ZodString>;
|
|
25
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
27
|
+
key: z.ZodString;
|
|
28
|
+
result: z.ZodNativeEnum<typeof LogResult>;
|
|
29
|
+
error: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodString]>>;
|
|
30
|
+
ip: z.ZodOptional<z.ZodString>;
|
|
31
|
+
userAgent: z.ZodOptional<z.ZodString>;
|
|
32
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
33
|
+
applicationId: z.ZodOptional<z.ZodString>;
|
|
34
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.ZodUnknown, "strip">>;
|
|
36
|
+
export type PartialPasswordPolicy = DeepPartial<PasswordPolicy>;
|
|
37
|
+
export declare const partialPasswordPolicyGuard: z.ZodObject<{
|
|
38
|
+
length: z.ZodOptional<z.ZodDefault<z.ZodObject<{
|
|
39
|
+
min: z.ZodDefault<z.ZodNumber>;
|
|
40
|
+
max: z.ZodDefault<z.ZodNumber>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
min: number;
|
|
43
|
+
max: number;
|
|
44
|
+
}, {
|
|
45
|
+
min?: number | undefined;
|
|
46
|
+
max?: number | undefined;
|
|
47
|
+
}>>>;
|
|
48
|
+
characterTypes: z.ZodOptional<z.ZodDefault<z.ZodObject<{
|
|
49
|
+
min: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
min: number;
|
|
52
|
+
}, {
|
|
53
|
+
min?: number | undefined;
|
|
54
|
+
}>>>;
|
|
55
|
+
rejects: z.ZodOptional<z.ZodDefault<z.ZodObject<{
|
|
56
|
+
pwned: z.ZodDefault<z.ZodBoolean>;
|
|
57
|
+
repetitionAndSequence: z.ZodDefault<z.ZodBoolean>;
|
|
58
|
+
userInfo: z.ZodDefault<z.ZodBoolean>;
|
|
59
|
+
words: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
pwned: boolean;
|
|
62
|
+
repetitionAndSequence: boolean;
|
|
63
|
+
userInfo: boolean;
|
|
64
|
+
words: string[];
|
|
65
|
+
}, {
|
|
66
|
+
pwned?: boolean | undefined;
|
|
67
|
+
repetitionAndSequence?: boolean | undefined;
|
|
68
|
+
userInfo?: boolean | undefined;
|
|
69
|
+
words?: string[] | undefined;
|
|
70
|
+
}>>>;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
length?: {
|
|
73
|
+
min: number;
|
|
74
|
+
max: number;
|
|
75
|
+
} | undefined;
|
|
76
|
+
characterTypes?: {
|
|
77
|
+
min: number;
|
|
78
|
+
} | undefined;
|
|
79
|
+
rejects?: {
|
|
80
|
+
pwned: boolean;
|
|
81
|
+
repetitionAndSequence: boolean;
|
|
82
|
+
userInfo: boolean;
|
|
83
|
+
words: string[];
|
|
84
|
+
} | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
length?: {
|
|
87
|
+
min?: number | undefined;
|
|
88
|
+
max?: number | undefined;
|
|
89
|
+
} | undefined;
|
|
90
|
+
characterTypes?: {
|
|
91
|
+
min?: number | undefined;
|
|
92
|
+
} | undefined;
|
|
93
|
+
rejects?: {
|
|
94
|
+
pwned?: boolean | undefined;
|
|
95
|
+
repetitionAndSequence?: boolean | undefined;
|
|
96
|
+
userInfo?: boolean | undefined;
|
|
97
|
+
words?: string[] | undefined;
|
|
98
|
+
} | undefined;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* The basic log context type. It's more about a type hint instead of forcing the log shape.
|
|
102
|
+
*
|
|
103
|
+
* Note when setting up a log function, the type of log key in function arguments should be `LogKey`.
|
|
104
|
+
* Here we use `string` to make it compatible with the Zod guard.
|
|
105
|
+
**/
|
|
106
|
+
export type LogContextPayload = z.infer<typeof logContextPayloadGuard>;
|