@logto/schemas 1.41.0 → 1.43.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.42.0-1783916980-add-domain-verification-files.ts +20 -0
- package/alterations/1.42.0-1784619793-add-service-logs-created-at-index.ts +33 -0
- package/alterations/1.42.0-1784620000-add-saml-sso-connector-signing-keys-table.ts +38 -0
- package/alterations/1.43.0-1785393731-add-oidc-model-instances-account-id-partial-index.ts +33 -0
- package/alterations/1.43.0-1785481546-add-tenant-aware-scope-indexes.ts +33 -0
- package/alterations/1.43.0-1785488115-add-cimd-permission-ceiling-tables.ts +77 -0
- package/alterations/1.43.0-1785722831-add-oidc-session-extensions-account-id-index.ts +27 -0
- package/alterations/1.43.0-1785835991-add-cimd-client-identifier-columns.ts +31 -0
- package/alterations/1.43.0-1786325989-add-cimd-grant-organizations-table.ts +54 -0
- package/alterations/1.43.0-1786333495-add-trusted-devices.ts +57 -0
- package/alterations/1.43.0-1786373004-tighten-cimd-grant-organizations-pkey.ts +28 -0
- package/alterations/1.43.0-1786414712-add-service-logs-email-indexes.ts +34 -0
- package/alterations/1.43.0-1786431364-add-cimd-grant-client-snapshots-table.ts +43 -0
- package/alterations/utils/1704934999-tables.ts +22 -1
- package/alterations-js/1.42.0-1783916980-add-domain-verification-files.js +16 -0
- package/alterations-js/1.42.0-1784619793-add-service-logs-created-at-index.js +29 -0
- package/alterations-js/1.42.0-1784620000-add-saml-sso-connector-signing-keys-table.js +33 -0
- package/alterations-js/1.43.0-1785393731-add-oidc-model-instances-account-id-partial-index.js +28 -0
- package/alterations-js/1.43.0-1785481546-add-tenant-aware-scope-indexes.js +28 -0
- package/alterations-js/1.43.0-1785488115-add-cimd-permission-ceiling-tables.js +69 -0
- package/alterations-js/1.43.0-1785722831-add-oidc-session-extensions-account-id-index.js +23 -0
- package/alterations-js/1.43.0-1785835991-add-cimd-client-identifier-columns.js +27 -0
- package/alterations-js/1.43.0-1786325989-add-cimd-grant-organizations-table.js +49 -0
- package/alterations-js/1.43.0-1786333495-add-trusted-devices.js +50 -0
- package/alterations-js/1.43.0-1786373004-tighten-cimd-grant-organizations-pkey.js +24 -0
- package/alterations-js/1.43.0-1786414712-add-service-logs-email-indexes.js +30 -0
- package/alterations-js/1.43.0-1786431364-add-cimd-grant-client-snapshots-table.js +38 -0
- package/alterations-js/utils/1704934999-tables.js +19 -1
- package/lib/consts/experience.d.ts +1 -0
- package/lib/consts/experience.js +1 -0
- package/lib/consts/index.d.ts +1 -0
- package/lib/consts/index.js +1 -0
- package/lib/consts/product-event.d.ts +5 -1
- package/lib/consts/product-event.js +4 -0
- package/lib/consts/social-state.d.ts +12 -0
- package/lib/consts/social-state.js +12 -0
- package/lib/db-entries/cimd-grant-client-snapshot.d.ts +32 -0
- package/lib/db-entries/cimd-grant-client-snapshot.js +45 -0
- package/lib/db-entries/cimd-grant-organization.d.ts +30 -0
- package/lib/db-entries/cimd-grant-organization.js +37 -0
- package/lib/db-entries/cimd-organization-resource-scope.d.ts +20 -0
- package/lib/db-entries/cimd-organization-resource-scope.js +25 -0
- package/lib/db-entries/cimd-organization-scope.d.ts +20 -0
- package/lib/db-entries/cimd-organization-scope.js +25 -0
- package/lib/db-entries/cimd-resource-scope.d.ts +20 -0
- package/lib/db-entries/cimd-resource-scope.js +25 -0
- package/lib/db-entries/cimd-user-scope.d.ts +20 -0
- package/lib/db-entries/cimd-user-scope.js +25 -0
- package/lib/db-entries/domain.d.ts +4 -2
- package/lib/db-entries/domain.js +5 -1
- package/lib/db-entries/index.d.ts +8 -0
- package/lib/db-entries/index.js +8 -0
- package/lib/db-entries/oidc-session-extension.d.ts +3 -1
- package/lib/db-entries/oidc-session-extension.js +4 -0
- package/lib/db-entries/organization.d.ts +5 -1
- package/lib/db-entries/organization.js +4 -0
- package/lib/db-entries/saml-sso-connector-signing-key.d.ts +32 -0
- package/lib/db-entries/saml-sso-connector-signing-key.js +49 -0
- package/lib/db-entries/sign-in-experience.d.ts +4 -2
- package/lib/db-entries/sign-in-experience.js +5 -1
- package/lib/db-entries/trusted-device.d.ts +36 -0
- package/lib/db-entries/trusted-device.js +62 -0
- package/lib/db-entries/user.d.ts +3 -1
- package/lib/db-entries/user.js +4 -0
- package/lib/foundations/jsonb-types/account-centers.d.ts +3 -0
- package/lib/foundations/jsonb-types/account-centers.js +1 -0
- package/lib/foundations/jsonb-types/account-centers.test.d.ts +1 -0
- package/lib/foundations/jsonb-types/account-centers.test.js +13 -0
- package/lib/foundations/jsonb-types/custom-domain.d.ts +57 -0
- package/lib/foundations/jsonb-types/custom-domain.js +51 -0
- package/lib/foundations/jsonb-types/custom-domain.test.d.ts +1 -0
- package/lib/foundations/jsonb-types/custom-domain.test.js +38 -0
- package/lib/foundations/jsonb-types/hooks.d.ts +9 -5
- package/lib/foundations/jsonb-types/hooks.js +8 -0
- package/lib/foundations/jsonb-types/logs.d.ts +18 -0
- package/lib/foundations/jsonb-types/logs.js +6 -0
- package/lib/foundations/jsonb-types/one-time-tokens.d.ts +5 -0
- package/lib/foundations/jsonb-types/one-time-tokens.js +2 -0
- package/lib/foundations/jsonb-types/sign-in-experience.d.ts +39 -4
- package/lib/foundations/jsonb-types/sign-in-experience.js +10 -0
- package/lib/foundations/jsonb-types/sign-in-experience.test.js +17 -1
- package/lib/types/application.d.ts +131 -1
- package/lib/types/application.js +8 -0
- package/lib/types/connector.d.ts +8 -0
- package/lib/types/consent.d.ts +16 -190
- package/lib/types/consent.js +10 -1
- package/lib/types/custom-profile-fields.d.ts +2 -1
- package/lib/types/domain.d.ts +9 -0
- package/lib/types/hook.d.ts +37 -5
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/interaction-event.d.ts +11 -0
- package/lib/types/interaction-event.js +12 -0
- package/lib/types/interactions.d.ts +2 -11
- package/lib/types/interactions.js +2 -11
- package/lib/types/log/action.d.ts +7 -0
- package/lib/types/log/action.js +6 -0
- package/lib/types/log/index.d.ts +8 -2
- package/lib/types/log/index.js +2 -0
- package/lib/types/log/trusted-device.d.ts +7 -0
- package/lib/types/log/trusted-device.js +6 -0
- package/lib/types/logto-config/action.d.ts +963 -0
- package/lib/types/logto-config/action.js +77 -0
- package/lib/types/logto-config/index.d.ts +68 -26
- package/lib/types/logto-config/index.js +20 -7
- package/lib/types/logto-config/index.test.js +32 -9
- package/lib/types/logto-config/jwt-customizer.d.ts +60 -10
- package/lib/types/logto-config/jwt-customizer.js +1 -1
- package/lib/types/logto-config/oidc-provider.d.ts +2 -2
- package/lib/types/organization.d.ts +136 -1
- package/lib/types/organization.js +3 -2
- package/lib/types/service-log.d.ts +14 -1
- package/lib/types/service-log.js +13 -0
- package/lib/types/sign-in-experience.d.ts +18 -10
- package/lib/types/sign-in-experience.js +2 -1
- package/lib/types/sso-connector.d.ts +58 -0
- package/lib/types/sso-connector.js +12 -0
- package/lib/types/system.d.ts +2 -2
- package/lib/types/trusted-device.d.ts +67 -0
- package/lib/types/trusted-device.js +16 -0
- package/lib/types/user-sessions.d.ts +117 -238
- package/lib/types/user-sessions.js +9 -4
- package/lib/types/user.d.ts +10 -3
- package/lib/types/user.js +1 -0
- package/lib/types/verification-records/one-time-token-verification.d.ts +5 -0
- package/lib/utils/cimd.d.ts +14 -0
- package/lib/utils/cimd.js +14 -0
- package/lib/utils/cimd.test.d.ts +1 -0
- package/lib/utils/cimd.test.js +9 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.js +1 -0
- package/package.json +7 -7
- package/tables/cimd_grant_client_snapshots.sql +27 -0
- package/tables/cimd_grant_organizations.sql +38 -0
- package/tables/cimd_organization_resource_scopes.sql +16 -0
- package/tables/cimd_organization_scopes.sql +15 -0
- package/tables/cimd_resource_scopes.sql +15 -0
- package/tables/cimd_user_scopes.sql +13 -0
- package/tables/domains.sql +1 -0
- package/tables/oidc_model_instances.sql +5 -0
- package/tables/oidc_session_extensions.sql +5 -0
- package/tables/organization_scopes.sql +4 -0
- package/tables/organizations.sql +2 -0
- package/tables/saml_sso_connector_signing_keys.sql +21 -0
- package/tables/scopes.sql +4 -0
- package/tables/service_logs.sql +19 -0
- package/tables/sign_in_experiences.sql +1 -0
- package/tables/trusted_devices.sql +25 -0
- package/tables/users.sql +1 -0
- package/lib/types/logto-config/inline-hook.d.ts +0 -76
- package/lib/types/logto-config/inline-hook.js +0 -25
package/lib/db-entries/user.js
CHANGED
|
@@ -14,6 +14,7 @@ const createGuard = z.object({
|
|
|
14
14
|
avatar: z.string().max(2048).nullable().optional(),
|
|
15
15
|
profile: userProfileGuard.optional(),
|
|
16
16
|
applicationId: z.string().max(21).nullable().optional(),
|
|
17
|
+
cimdClientId: z.string().max(2048).nullable().optional(),
|
|
17
18
|
identities: identitiesGuard.optional(),
|
|
18
19
|
customData: jsonObjectGuard.optional(),
|
|
19
20
|
logtoConfig: jsonObjectGuard.optional(),
|
|
@@ -37,6 +38,7 @@ const guard = z.object({
|
|
|
37
38
|
avatar: z.string().max(2048).nullable(),
|
|
38
39
|
profile: userProfileGuard,
|
|
39
40
|
applicationId: z.string().max(21).nullable(),
|
|
41
|
+
cimdClientId: z.string().max(2048).nullable(),
|
|
40
42
|
identities: identitiesGuard,
|
|
41
43
|
customData: jsonObjectGuard,
|
|
42
44
|
logtoConfig: jsonObjectGuard,
|
|
@@ -63,6 +65,7 @@ export const Users = Object.freeze({
|
|
|
63
65
|
avatar: 'avatar',
|
|
64
66
|
profile: 'profile',
|
|
65
67
|
applicationId: 'application_id',
|
|
68
|
+
cimdClientId: 'cimd_client_id',
|
|
66
69
|
identities: 'identities',
|
|
67
70
|
customData: 'custom_data',
|
|
68
71
|
logtoConfig: 'logto_config',
|
|
@@ -86,6 +89,7 @@ export const Users = Object.freeze({
|
|
|
86
89
|
'avatar',
|
|
87
90
|
'profile',
|
|
88
91
|
'applicationId',
|
|
92
|
+
'cimdClientId',
|
|
89
93
|
'identities',
|
|
90
94
|
'customData',
|
|
91
95
|
'logtoConfig',
|
|
@@ -22,6 +22,7 @@ export declare const accountCenterFieldControlGuard: z.ZodObject<{
|
|
|
22
22
|
mfa: z.ZodOptional<z.ZodNativeEnum<typeof AccountCenterControlValue>>;
|
|
23
23
|
passkey: z.ZodOptional<z.ZodNativeEnum<typeof AccountCenterControlValue>>;
|
|
24
24
|
session: z.ZodOptional<z.ZodNativeEnum<typeof AccountCenterControlValue>>;
|
|
25
|
+
trustedDevice: z.ZodOptional<z.ZodNativeEnum<typeof AccountCenterControlValue>>;
|
|
25
26
|
}, "strip", z.ZodTypeAny, {
|
|
26
27
|
name?: AccountCenterControlValue | undefined;
|
|
27
28
|
username?: AccountCenterControlValue | undefined;
|
|
@@ -35,6 +36,7 @@ export declare const accountCenterFieldControlGuard: z.ZodObject<{
|
|
|
35
36
|
mfa?: AccountCenterControlValue | undefined;
|
|
36
37
|
passkey?: AccountCenterControlValue | undefined;
|
|
37
38
|
session?: AccountCenterControlValue | undefined;
|
|
39
|
+
trustedDevice?: AccountCenterControlValue | undefined;
|
|
38
40
|
}, {
|
|
39
41
|
name?: AccountCenterControlValue | undefined;
|
|
40
42
|
username?: AccountCenterControlValue | undefined;
|
|
@@ -48,6 +50,7 @@ export declare const accountCenterFieldControlGuard: z.ZodObject<{
|
|
|
48
50
|
mfa?: AccountCenterControlValue | undefined;
|
|
49
51
|
passkey?: AccountCenterControlValue | undefined;
|
|
50
52
|
session?: AccountCenterControlValue | undefined;
|
|
53
|
+
trustedDevice?: AccountCenterControlValue | undefined;
|
|
51
54
|
}>;
|
|
52
55
|
export type AccountCenterFieldControl = z.infer<typeof accountCenterFieldControlGuard>;
|
|
53
56
|
export declare const webauthnRelatedOriginsGuard: z.ZodArray<z.ZodString, "many">;
|
|
@@ -24,6 +24,7 @@ export const accountCenterFieldControlGuard = z
|
|
|
24
24
|
mfa: z.nativeEnum(AccountCenterControlValue),
|
|
25
25
|
passkey: z.nativeEnum(AccountCenterControlValue),
|
|
26
26
|
session: z.nativeEnum(AccountCenterControlValue),
|
|
27
|
+
trustedDevice: z.nativeEnum(AccountCenterControlValue),
|
|
27
28
|
})
|
|
28
29
|
.partial();
|
|
29
30
|
export const webauthnRelatedOriginsGuard = z.array(z.string());
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { AccountCenterControlValue, accountCenterFieldControlGuard } from './account-centers.js';
|
|
3
|
+
describe('accountCenterFieldControlGuard', () => {
|
|
4
|
+
it('allows trusted device control to be omitted', () => {
|
|
5
|
+
expect(accountCenterFieldControlGuard.parse({})).toEqual({});
|
|
6
|
+
});
|
|
7
|
+
it.each(Object.values(AccountCenterControlValue))('accepts trusted device control value %s', (trustedDevice) => {
|
|
8
|
+
expect(accountCenterFieldControlGuard.parse({ trustedDevice })).toEqual({ trustedDevice });
|
|
9
|
+
});
|
|
10
|
+
it('rejects an invalid trusted device control value', () => {
|
|
11
|
+
expect(accountCenterFieldControlGuard.safeParse({ trustedDevice: 'Invalid' }).success).toBe(false);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -1,4 +1,61 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export declare enum DomainVerificationFileContentType {
|
|
3
|
+
Text = "text/plain",
|
|
4
|
+
Json = "application/json"
|
|
5
|
+
}
|
|
6
|
+
export declare const domainVerificationFilePathGuard: z.ZodEffects<z.ZodString, string, string>;
|
|
7
|
+
export declare const domainVerificationFileGuard: z.ZodEffects<z.ZodObject<{
|
|
8
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
9
|
+
content: z.ZodString;
|
|
10
|
+
contentType: z.ZodNativeEnum<typeof DomainVerificationFileContentType>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
path: string;
|
|
13
|
+
content: string;
|
|
14
|
+
contentType: DomainVerificationFileContentType;
|
|
15
|
+
}, {
|
|
16
|
+
path: string;
|
|
17
|
+
content: string;
|
|
18
|
+
contentType: DomainVerificationFileContentType;
|
|
19
|
+
}>, {
|
|
20
|
+
path: string;
|
|
21
|
+
content: string;
|
|
22
|
+
contentType: DomainVerificationFileContentType;
|
|
23
|
+
}, {
|
|
24
|
+
path: string;
|
|
25
|
+
content: string;
|
|
26
|
+
contentType: DomainVerificationFileContentType;
|
|
27
|
+
}>;
|
|
28
|
+
export type DomainVerificationFile = z.infer<typeof domainVerificationFileGuard>;
|
|
29
|
+
export declare const domainVerificationFilesGuard: z.ZodEffects<z.ZodArray<z.ZodEffects<z.ZodObject<{
|
|
30
|
+
path: z.ZodEffects<z.ZodString, string, string>;
|
|
31
|
+
content: z.ZodString;
|
|
32
|
+
contentType: z.ZodNativeEnum<typeof DomainVerificationFileContentType>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
path: string;
|
|
35
|
+
content: string;
|
|
36
|
+
contentType: DomainVerificationFileContentType;
|
|
37
|
+
}, {
|
|
38
|
+
path: string;
|
|
39
|
+
content: string;
|
|
40
|
+
contentType: DomainVerificationFileContentType;
|
|
41
|
+
}>, {
|
|
42
|
+
path: string;
|
|
43
|
+
content: string;
|
|
44
|
+
contentType: DomainVerificationFileContentType;
|
|
45
|
+
}, {
|
|
46
|
+
path: string;
|
|
47
|
+
content: string;
|
|
48
|
+
contentType: DomainVerificationFileContentType;
|
|
49
|
+
}>, "many">, {
|
|
50
|
+
path: string;
|
|
51
|
+
content: string;
|
|
52
|
+
contentType: DomainVerificationFileContentType;
|
|
53
|
+
}[], {
|
|
54
|
+
path: string;
|
|
55
|
+
content: string;
|
|
56
|
+
contentType: DomainVerificationFileContentType;
|
|
57
|
+
}[]>;
|
|
58
|
+
export type DomainVerificationFiles = z.infer<typeof domainVerificationFilesGuard>;
|
|
2
59
|
export declare const domainDnsRecordGuard: z.ZodObject<{
|
|
3
60
|
name: z.ZodString;
|
|
4
61
|
type: z.ZodString;
|
|
@@ -1,4 +1,55 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
export var DomainVerificationFileContentType;
|
|
3
|
+
(function (DomainVerificationFileContentType) {
|
|
4
|
+
DomainVerificationFileContentType["Text"] = "text/plain";
|
|
5
|
+
DomainVerificationFileContentType["Json"] = "application/json";
|
|
6
|
+
})(DomainVerificationFileContentType || (DomainVerificationFileContentType = {}));
|
|
7
|
+
export const domainVerificationFilePathGuard = z
|
|
8
|
+
.string()
|
|
9
|
+
.min(1)
|
|
10
|
+
.max(256)
|
|
11
|
+
.refine((value) => /^\/[\w-][\w.-]*\.[\w-][\w.-]*$/.test(value) ||
|
|
12
|
+
/^\/\.well-known(?:\/[\w-][\w.-]*)+$/.test(value), 'The path must point to a file with an extension at the domain root or to a path under /.well-known/.');
|
|
13
|
+
export const domainVerificationFileGuard = z
|
|
14
|
+
.object({
|
|
15
|
+
path: domainVerificationFilePathGuard,
|
|
16
|
+
content: z
|
|
17
|
+
.string()
|
|
18
|
+
.min(1)
|
|
19
|
+
.max(16 * 1024),
|
|
20
|
+
contentType: z.nativeEnum(DomainVerificationFileContentType),
|
|
21
|
+
})
|
|
22
|
+
.superRefine(({ content, contentType }, context) => {
|
|
23
|
+
if (contentType !== DomainVerificationFileContentType.Json) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
JSON.parse(content);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
context.addIssue({
|
|
31
|
+
code: z.ZodIssueCode.custom,
|
|
32
|
+
message: 'The content must be valid JSON for the application/json content type.',
|
|
33
|
+
path: ['content'],
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export const domainVerificationFilesGuard = domainVerificationFileGuard
|
|
38
|
+
.array()
|
|
39
|
+
.max(10)
|
|
40
|
+
.superRefine((files, context) => {
|
|
41
|
+
const paths = new Set();
|
|
42
|
+
for (const [index, file] of files.entries()) {
|
|
43
|
+
if (paths.has(file.path)) {
|
|
44
|
+
context.addIssue({
|
|
45
|
+
code: z.ZodIssueCode.custom,
|
|
46
|
+
message: 'Verification file paths must be unique.',
|
|
47
|
+
path: [index, 'path'],
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
paths.add(file.path);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
2
53
|
export const domainDnsRecordGuard = z.object({
|
|
3
54
|
name: z.string(),
|
|
4
55
|
type: z.string(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { DomainVerificationFileContentType, domainVerificationFilesGuard, } from './custom-domain.js';
|
|
3
|
+
describe('domainVerificationFilesGuard', () => {
|
|
4
|
+
it.each([
|
|
5
|
+
'/MP_verify_abc123.txt',
|
|
6
|
+
'/_domainconnect.txt',
|
|
7
|
+
'/-verification.txt',
|
|
8
|
+
'/google-site-verification.html',
|
|
9
|
+
'/.well-known/apple-developer-merchantid-domain-association',
|
|
10
|
+
'/.well-known/acme-challenge/token_123',
|
|
11
|
+
'/.well-known/acme-challenge/-token_123',
|
|
12
|
+
'/.well-known/acme-challenge/_token_123',
|
|
13
|
+
])('accepts verification file path %s', (path) => {
|
|
14
|
+
expect(domainVerificationFilesGuard.safeParse([
|
|
15
|
+
{ path, content: 'verification-content', contentType: 'text/plain' },
|
|
16
|
+
]).success).toBe(true);
|
|
17
|
+
});
|
|
18
|
+
it.each(['/api/file.txt', '/../secret.txt', '/nested/file.txt', '/file', '/file%2Etxt'])('rejects verification file path %s', (path) => {
|
|
19
|
+
expect(domainVerificationFilesGuard.safeParse([
|
|
20
|
+
{ path, content: 'verification-content', contentType: 'text/plain' },
|
|
21
|
+
]).success).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
it('requires valid JSON for JSON responses', () => {
|
|
24
|
+
expect(domainVerificationFilesGuard.safeParse([
|
|
25
|
+
{
|
|
26
|
+
path: '/.well-known/verification.json',
|
|
27
|
+
content: '{invalid-json}',
|
|
28
|
+
contentType: DomainVerificationFileContentType.Json,
|
|
29
|
+
},
|
|
30
|
+
]).success).toBe(false);
|
|
31
|
+
});
|
|
32
|
+
it('rejects duplicate paths', () => {
|
|
33
|
+
expect(domainVerificationFilesGuard.safeParse([
|
|
34
|
+
{ path: '/verify.txt', content: 'one', contentType: 'text/plain' },
|
|
35
|
+
{ path: '/verify.txt', content: 'two', contentType: 'text/plain' },
|
|
36
|
+
]).success).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -14,6 +14,7 @@ export declare enum InteractionHookEvent {
|
|
|
14
14
|
}
|
|
15
15
|
export declare enum DataHookSchema {
|
|
16
16
|
User = "User",
|
|
17
|
+
TrustedDevice = "TrustedDevice",
|
|
17
18
|
Role = "Role",
|
|
18
19
|
Scope = "Scope",
|
|
19
20
|
Organization = "Organization",
|
|
@@ -28,16 +29,19 @@ declare enum DataHookDetailMutationType {
|
|
|
28
29
|
Updated = "Updated"
|
|
29
30
|
}
|
|
30
31
|
type BasicDataHookEvent = `${DataHookSchema}.${DataHookBasicMutationType}`;
|
|
31
|
-
type CustomDataHookMutableSchema = `${DataHookSchema}.Data` | `${DataHookSchema.User}.SuspensionStatus` | `${DataHookSchema.Role}.Scopes` | `${DataHookSchema.Organization}.Membership` | `${DataHookSchema.OrganizationRole}.Scopes`;
|
|
32
|
+
type CustomDataHookMutableSchema = `${Exclude<DataHookSchema, DataHookSchema.TrustedDevice>}.Data` | `${DataHookSchema.User}.SuspensionStatus` | `${DataHookSchema.Role}.Scopes` | `${DataHookSchema.Organization}.Membership` | `${DataHookSchema.OrganizationRole}.Scopes`;
|
|
32
33
|
type DataHookPropertyUpdateEvent = `${CustomDataHookMutableSchema}.${DataHookDetailMutationType.Updated}`;
|
|
33
|
-
export type ExceptionHookEvent = 'Identifier.Lockout' | 'Message.RateLimited';
|
|
34
|
+
export type ExceptionHookEvent = 'Identifier.Lockout' | 'Message.RateLimited' | 'Grant.LimitExceeded';
|
|
34
35
|
export type DataHookEvent = BasicDataHookEvent | DataHookPropertyUpdateEvent;
|
|
36
|
+
/** Data hook events that are available only while their feature is under development. */
|
|
37
|
+
export declare const devFeatureHookEvents: readonly ["TrustedDevice.Created", "TrustedDevice.Deleted"];
|
|
38
|
+
export type DevFeatureHookEvent = (typeof devFeatureHookEvents)[number];
|
|
35
39
|
/** The hook event values that can be registered. */
|
|
36
|
-
export declare const hookEvents: readonly [InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostSignInAdaptiveMfaTriggered, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout", "Message.RateLimited"];
|
|
40
|
+
export declare const hookEvents: readonly [InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostSignInAdaptiveMfaTriggered, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "TrustedDevice.Created", "TrustedDevice.Deleted", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout", "Message.RateLimited", "Grant.LimitExceeded"];
|
|
37
41
|
/** The type of hook event values that can be registered. */
|
|
38
42
|
export type HookEvent = (typeof hookEvents)[number];
|
|
39
|
-
export declare const hookEventGuard: z.ZodEnum<[InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostSignInAdaptiveMfaTriggered, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout", "Message.RateLimited"]>;
|
|
40
|
-
export declare const hookEventsGuard: z.ZodArray<z.ZodEnum<[InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostSignInAdaptiveMfaTriggered, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout", "Message.RateLimited"]>, "many">;
|
|
43
|
+
export declare const hookEventGuard: z.ZodEnum<[InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostSignInAdaptiveMfaTriggered, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "TrustedDevice.Created", "TrustedDevice.Deleted", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout", "Message.RateLimited", "Grant.LimitExceeded"]>;
|
|
44
|
+
export declare const hookEventsGuard: z.ZodArray<z.ZodEnum<[InteractionHookEvent.PostRegister, InteractionHookEvent.PostSignIn, InteractionHookEvent.PostSignInAdaptiveMfaTriggered, InteractionHookEvent.PostResetPassword, "User.Created", "User.Deleted", "User.Data.Updated", "User.SuspensionStatus.Updated", "TrustedDevice.Created", "TrustedDevice.Deleted", "Role.Created", "Role.Deleted", "Role.Data.Updated", "Role.Scopes.Updated", "Scope.Created", "Scope.Deleted", "Scope.Data.Updated", "Organization.Created", "Organization.Deleted", "Organization.Data.Updated", "Organization.Membership.Updated", "OrganizationRole.Created", "OrganizationRole.Deleted", "OrganizationRole.Data.Updated", "OrganizationRole.Scopes.Updated", "OrganizationScope.Created", "OrganizationScope.Deleted", "OrganizationScope.Data.Updated", "Identifier.Lockout", "Message.RateLimited", "Grant.LimitExceeded"]>, "many">;
|
|
41
45
|
export type HookEvents = z.infer<typeof hookEventsGuard>;
|
|
42
46
|
export declare const interactionHookEventGuard: z.ZodNativeEnum<typeof InteractionHookEvent>;
|
|
43
47
|
/**
|
|
@@ -18,6 +18,7 @@ export var InteractionHookEvent;
|
|
|
18
18
|
export var DataHookSchema;
|
|
19
19
|
(function (DataHookSchema) {
|
|
20
20
|
DataHookSchema["User"] = "User";
|
|
21
|
+
DataHookSchema["TrustedDevice"] = "TrustedDevice";
|
|
21
22
|
DataHookSchema["Role"] = "Role";
|
|
22
23
|
DataHookSchema["Scope"] = "Scope";
|
|
23
24
|
DataHookSchema["Organization"] = "Organization";
|
|
@@ -33,6 +34,11 @@ var DataHookDetailMutationType;
|
|
|
33
34
|
(function (DataHookDetailMutationType) {
|
|
34
35
|
DataHookDetailMutationType["Updated"] = "Updated";
|
|
35
36
|
})(DataHookDetailMutationType || (DataHookDetailMutationType = {}));
|
|
37
|
+
/** Data hook events that are available only while their feature is under development. */
|
|
38
|
+
export const devFeatureHookEvents = Object.freeze([
|
|
39
|
+
'TrustedDevice.Created',
|
|
40
|
+
'TrustedDevice.Deleted',
|
|
41
|
+
]);
|
|
36
42
|
/** The hook event values that can be registered. */
|
|
37
43
|
export const hookEvents = Object.freeze([
|
|
38
44
|
InteractionHookEvent.PostRegister,
|
|
@@ -43,6 +49,7 @@ export const hookEvents = Object.freeze([
|
|
|
43
49
|
'User.Deleted',
|
|
44
50
|
'User.Data.Updated',
|
|
45
51
|
'User.SuspensionStatus.Updated',
|
|
52
|
+
...devFeatureHookEvents,
|
|
46
53
|
'Role.Created',
|
|
47
54
|
'Role.Deleted',
|
|
48
55
|
'Role.Data.Updated',
|
|
@@ -63,6 +70,7 @@ export const hookEvents = Object.freeze([
|
|
|
63
70
|
'OrganizationScope.Data.Updated',
|
|
64
71
|
'Identifier.Lockout',
|
|
65
72
|
'Message.RateLimited',
|
|
73
|
+
'Grant.LimitExceeded',
|
|
66
74
|
]);
|
|
67
75
|
export const hookEventGuard = z.enum(hookEvents);
|
|
68
76
|
export const hookEventsGuard = hookEventGuard.array();
|
|
@@ -362,7 +362,13 @@ export declare const logContextPayloadGuard: z.ZodObject<{
|
|
|
362
362
|
}, z.ZodUnknown, "strip">>>;
|
|
363
363
|
}, z.ZodUnknown, "strip">>>;
|
|
364
364
|
userId: z.ZodOptional<z.ZodString>;
|
|
365
|
+
/** Registered application ids only; a CIMD client identifier goes under {@link cimdClientId}. */
|
|
365
366
|
applicationId: z.ZodOptional<z.ZodString>;
|
|
367
|
+
/**
|
|
368
|
+
* The CIMD client identifier URL, kept apart from `applicationId` so payload consumers
|
|
369
|
+
* branch on key presence instead of URL shape.
|
|
370
|
+
*/
|
|
371
|
+
cimdClientId: z.ZodOptional<z.ZodString>;
|
|
366
372
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
367
373
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
368
374
|
}, "strip", z.ZodUnknown, z.objectOutputType<{
|
|
@@ -547,7 +553,13 @@ export declare const logContextPayloadGuard: z.ZodObject<{
|
|
|
547
553
|
}, z.ZodUnknown, "strip">>>;
|
|
548
554
|
}, z.ZodUnknown, "strip">>>;
|
|
549
555
|
userId: z.ZodOptional<z.ZodString>;
|
|
556
|
+
/** Registered application ids only; a CIMD client identifier goes under {@link cimdClientId}. */
|
|
550
557
|
applicationId: z.ZodOptional<z.ZodString>;
|
|
558
|
+
/**
|
|
559
|
+
* The CIMD client identifier URL, kept apart from `applicationId` so payload consumers
|
|
560
|
+
* branch on key presence instead of URL shape.
|
|
561
|
+
*/
|
|
562
|
+
cimdClientId: z.ZodOptional<z.ZodString>;
|
|
551
563
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
552
564
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
553
565
|
}, z.ZodUnknown, "strip">, z.objectInputType<{
|
|
@@ -732,7 +744,13 @@ export declare const logContextPayloadGuard: z.ZodObject<{
|
|
|
732
744
|
}, z.ZodUnknown, "strip">>>;
|
|
733
745
|
}, z.ZodUnknown, "strip">>>;
|
|
734
746
|
userId: z.ZodOptional<z.ZodString>;
|
|
747
|
+
/** Registered application ids only; a CIMD client identifier goes under {@link cimdClientId}. */
|
|
735
748
|
applicationId: z.ZodOptional<z.ZodString>;
|
|
749
|
+
/**
|
|
750
|
+
* The CIMD client identifier URL, kept apart from `applicationId` so payload consumers
|
|
751
|
+
* branch on key presence instead of URL shape.
|
|
752
|
+
*/
|
|
753
|
+
cimdClientId: z.ZodOptional<z.ZodString>;
|
|
736
754
|
sessionId: z.ZodOptional<z.ZodString>;
|
|
737
755
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
738
756
|
}, z.ZodUnknown, "strip">>;
|
|
@@ -64,7 +64,13 @@ export const logContextPayloadGuard = z
|
|
|
64
64
|
userAgent: z.string().optional(),
|
|
65
65
|
userAgentParsed: userAgentParsedGuard.optional(),
|
|
66
66
|
userId: z.string().optional(),
|
|
67
|
+
/** Registered application ids only; a CIMD client identifier goes under {@link cimdClientId}. */
|
|
67
68
|
applicationId: z.string().optional(),
|
|
69
|
+
/**
|
|
70
|
+
* The CIMD client identifier URL, kept apart from `applicationId` so payload consumers
|
|
71
|
+
* branch on key presence instead of URL shape.
|
|
72
|
+
*/
|
|
73
|
+
cimdClientId: z.string().optional(),
|
|
68
74
|
sessionId: z.string().optional(),
|
|
69
75
|
params: z.record(z.string(), z.unknown()).optional(),
|
|
70
76
|
})
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { type InteractionEvent } from '../../types/interaction-event.js';
|
|
2
3
|
export type OneTimeTokenContext = {
|
|
3
4
|
jitOrganizationIds?: string[];
|
|
5
|
+
interactionEvent?: InteractionEvent;
|
|
4
6
|
};
|
|
5
7
|
export declare const oneTimeTokenContextGuard: z.ZodObject<{
|
|
6
8
|
jitOrganizationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9
|
+
interactionEvent: z.ZodOptional<z.ZodNativeEnum<typeof InteractionEvent>>;
|
|
7
10
|
}, "strip", z.ZodTypeAny, {
|
|
8
11
|
jitOrganizationIds?: string[] | undefined;
|
|
12
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
9
13
|
}, {
|
|
10
14
|
jitOrganizationIds?: string[] | undefined;
|
|
15
|
+
interactionEvent?: InteractionEvent | undefined;
|
|
11
16
|
}>;
|
|
12
17
|
export declare enum OneTimeTokenStatus {
|
|
13
18
|
Active = "active",
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { eventGuard } from '../../types/interaction-event.js';
|
|
2
3
|
export const oneTimeTokenContextGuard = z
|
|
3
4
|
.object({
|
|
4
5
|
jitOrganizationIds: z.string().array(),
|
|
6
|
+
interactionEvent: eventGuard,
|
|
5
7
|
})
|
|
6
8
|
.partial();
|
|
7
9
|
export var OneTimeTokenStatus;
|
|
@@ -51,13 +51,13 @@ export declare const brandingGuard: z.ZodObject<{
|
|
|
51
51
|
export type Branding = z.infer<typeof brandingGuard>;
|
|
52
52
|
export declare const languageInfoGuard: z.ZodObject<{
|
|
53
53
|
autoDetect: z.ZodBoolean;
|
|
54
|
-
fallbackLanguage: z.ZodType<"af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR", z.ZodTypeDef, "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR">;
|
|
54
|
+
fallbackLanguage: z.ZodType<"af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "es-MX" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR", z.ZodTypeDef, "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "es-MX" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR">;
|
|
55
55
|
}, "strip", z.ZodTypeAny, {
|
|
56
56
|
autoDetect: boolean;
|
|
57
|
-
fallbackLanguage: "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR";
|
|
57
|
+
fallbackLanguage: "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "es-MX" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR";
|
|
58
58
|
}, {
|
|
59
59
|
autoDetect: boolean;
|
|
60
|
-
fallbackLanguage: "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR";
|
|
60
|
+
fallbackLanguage: "af-ZA" | "am-ET" | "ar" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "cs" | "cs-CZ" | "cx-PH" | "cy-GB" | "da-DK" | "de" | "de-DE" | "el-GR" | "en" | "en-GB" | "en-US" | "eo-EO" | "es" | "es-ES" | "es-419" | "es-MX" | "et-EE" | "eu-ES" | "fa-IR" | "ff-NG" | "fi" | "fi-FI" | "fo-FO" | "fr" | "fr-CA" | "fr-FR" | "fy-NL" | "ga-IE" | "gl-ES" | "gn-PY" | "gu-IN" | "ha-NG" | "he-IL" | "hi-IN" | "hr-HR" | "ht-HT" | "hu-HU" | "hy-AM" | "id-ID" | "ik-US" | "is-IS" | "it" | "it-IT" | "iu-CA" | "ja" | "ja-JP" | "ja-KS" | "jv-ID" | "ka-GE" | "kk-KZ" | "km-KH" | "kn-IN" | "ko" | "ko-KR" | "ku-TR" | "ky-KG" | "lo-LA" | "lt-LT" | "lv-LV" | "mg-MG" | "mk-MK" | "ml-IN" | "mn-MN" | "mr-IN" | "ms-MY" | "mt-MT" | "my-MM" | "nb-NO" | "ne-NP" | "nl" | "nl-BE" | "nl-NL" | "nn-NO" | "or-IN" | "pa-IN" | "pl-PL" | "ps-AF" | "pt" | "pt-BR" | "pt-PT" | "ro-RO" | "ru" | "ru-RU" | "rw-RW" | "sc-IT" | "si-LK" | "sk-SK" | "sl-SI" | "sn-ZW" | "sq-AL" | "sr-RS" | "sv" | "sv-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "th" | "th-TH" | "tl-PH" | "tr" | "tr-TR" | "tt-RU" | "tz-MA" | "uk-UA" | "ur-PK" | "uz-UZ" | "vi-VN" | "zh" | "zh-CN" | "zh-HK" | "zh-MO" | "zh-TW" | "zz-TR";
|
|
61
61
|
}>;
|
|
62
62
|
export type LanguageInfo = z.infer<typeof languageInfoGuard>;
|
|
63
63
|
export declare enum SignInIdentifier {
|
|
@@ -320,6 +320,26 @@ export declare const adaptiveMfaGuard: z.ZodObject<{
|
|
|
320
320
|
}, {
|
|
321
321
|
enabled?: boolean | undefined;
|
|
322
322
|
}>;
|
|
323
|
+
/** Stored tenant-level overrides for MFA trusted-device credentials. */
|
|
324
|
+
export type TrustedDevicePolicy = {
|
|
325
|
+
enabled?: boolean;
|
|
326
|
+
durationDays?: number;
|
|
327
|
+
};
|
|
328
|
+
/** Default trusted-device policy for newly created sign-in experiences. */
|
|
329
|
+
export declare const defaultTrustedDevicePolicy: Readonly<{
|
|
330
|
+
enabled: false;
|
|
331
|
+
durationDays: 30;
|
|
332
|
+
}>;
|
|
333
|
+
export declare const trustedDevicePolicyGuard: z.ZodObject<{
|
|
334
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
335
|
+
durationDays: z.ZodOptional<z.ZodNumber>;
|
|
336
|
+
}, "strip", z.ZodTypeAny, {
|
|
337
|
+
enabled?: boolean | undefined;
|
|
338
|
+
durationDays?: number | undefined;
|
|
339
|
+
}, {
|
|
340
|
+
enabled?: boolean | undefined;
|
|
341
|
+
durationDays?: number | undefined;
|
|
342
|
+
}>;
|
|
323
343
|
export declare const customUiAssetsGuard: z.ZodObject<{
|
|
324
344
|
id: z.ZodString;
|
|
325
345
|
createdAt: z.ZodNumber;
|
|
@@ -391,27 +411,42 @@ export type EmailBlocklistPolicy = {
|
|
|
391
411
|
blockDisposableAddresses?: boolean;
|
|
392
412
|
blockSubaddressing?: boolean;
|
|
393
413
|
/**
|
|
394
|
-
* Custom
|
|
414
|
+
* Custom allowlist of email addresses, domains, or wildcard email address patterns.
|
|
415
|
+
*
|
|
416
|
+
* The matching semantics are the same as {@link customBlocklist}.
|
|
417
|
+
*/
|
|
418
|
+
customAllowlist?: string[];
|
|
419
|
+
/**
|
|
420
|
+
* Custom blocklist of email addresses, domains, or wildcard email address patterns.
|
|
395
421
|
*
|
|
396
422
|
* @example
|
|
397
423
|
* Email address: abc@xyx.com
|
|
398
424
|
*
|
|
399
425
|
* @example
|
|
400
426
|
* Domain name: @xyz.com
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* Wildcard email address pattern: foo*@example.com
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* Wildcard domain pattern: @*.example.com
|
|
401
433
|
*/
|
|
402
434
|
customBlocklist?: string[];
|
|
403
435
|
};
|
|
404
436
|
export declare const emailBlocklistPolicyGuard: z.ZodObject<{
|
|
405
437
|
blockDisposableAddresses: z.ZodOptional<z.ZodBoolean>;
|
|
406
438
|
blockSubaddressing: z.ZodOptional<z.ZodBoolean>;
|
|
439
|
+
customAllowlist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
407
440
|
customBlocklist: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
408
441
|
}, "strip", z.ZodTypeAny, {
|
|
409
442
|
blockDisposableAddresses?: boolean | undefined;
|
|
410
443
|
blockSubaddressing?: boolean | undefined;
|
|
444
|
+
customAllowlist?: string[] | undefined;
|
|
411
445
|
customBlocklist?: string[] | undefined;
|
|
412
446
|
}, {
|
|
413
447
|
blockDisposableAddresses?: boolean | undefined;
|
|
414
448
|
blockSubaddressing?: boolean | undefined;
|
|
449
|
+
customAllowlist?: string[] | undefined;
|
|
415
450
|
customBlocklist?: string[] | undefined;
|
|
416
451
|
}>;
|
|
417
452
|
export declare enum ForgotPasswordMethod {
|
|
@@ -112,6 +112,15 @@ export const mfaGuard = z.object({
|
|
|
112
112
|
export const adaptiveMfaGuard = z.object({
|
|
113
113
|
enabled: z.boolean().optional(),
|
|
114
114
|
});
|
|
115
|
+
/** Default trusted-device policy for newly created sign-in experiences. */
|
|
116
|
+
export const defaultTrustedDevicePolicy = Object.freeze({
|
|
117
|
+
enabled: false,
|
|
118
|
+
durationDays: 30,
|
|
119
|
+
});
|
|
120
|
+
export const trustedDevicePolicyGuard = z.object({
|
|
121
|
+
enabled: z.boolean().optional(),
|
|
122
|
+
durationDays: z.number().int().min(1).max(365).optional(),
|
|
123
|
+
});
|
|
115
124
|
export const customUiAssetsGuard = z.object({
|
|
116
125
|
id: z.string(),
|
|
117
126
|
createdAt: z.number(),
|
|
@@ -130,6 +139,7 @@ export const verificationCodePolicyGuard = z.object({
|
|
|
130
139
|
export const emailBlocklistPolicyGuard = z.object({
|
|
131
140
|
blockDisposableAddresses: z.boolean().optional(),
|
|
132
141
|
blockSubaddressing: z.boolean().optional(),
|
|
142
|
+
customAllowlist: z.string().array().optional(),
|
|
133
143
|
customBlocklist: z.string().array().optional(),
|
|
134
144
|
});
|
|
135
145
|
export var ForgotPasswordMethod;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { customUiCspGuard, passwordExpirationPolicyGuard } from './sign-in-experience.js';
|
|
2
|
+
import { customUiCspGuard, defaultTrustedDevicePolicy, passwordExpirationPolicyGuard, trustedDevicePolicyGuard, } from './sign-in-experience.js';
|
|
3
3
|
describe('customUiCspGuard', () => {
|
|
4
4
|
it.each([
|
|
5
5
|
{},
|
|
@@ -64,3 +64,19 @@ describe('passwordExpirationPolicyGuard', () => {
|
|
|
64
64
|
expect(passwordExpirationPolicyGuard.safeParse(value).success).toBe(false);
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
|
+
describe('trustedDevicePolicyGuard', () => {
|
|
68
|
+
it.each([{}, { enabled: false }, { durationDays: 1 }, { enabled: true, durationDays: 365 }])('accepts valid policy %p', (value) => {
|
|
69
|
+
expect(trustedDevicePolicyGuard.parse(value)).toEqual(value);
|
|
70
|
+
});
|
|
71
|
+
it.each([{ durationDays: 0 }, { durationDays: 366 }, { durationDays: 1.5 }])('rejects invalid policy %p', (value) => {
|
|
72
|
+
expect(trustedDevicePolicyGuard.safeParse(value).success).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
it('provides the complete effective default', () => {
|
|
75
|
+
expect(defaultTrustedDevicePolicy).toEqual({ enabled: false, durationDays: 30 });
|
|
76
|
+
expect(trustedDevicePolicyGuard.safeParse(defaultTrustedDevicePolicy).success).toBe(true);
|
|
77
|
+
});
|
|
78
|
+
it('rejects invalid enabled values', () => {
|
|
79
|
+
const value = { enabled: 'true' };
|
|
80
|
+
expect(trustedDevicePolicyGuard.safeParse(value).success).toBe(false);
|
|
81
|
+
});
|
|
82
|
+
});
|