@logto/schemas 1.43.0 → 1.44.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.44.0-1788946735-add-saml-authn-request-config.ts +18 -0
- package/alterations/1.44.0-1789000000-extend-user-id-length.ts +61 -0
- package/alterations-js/1.44.0-1788946735-add-saml-authn-request-config.js +14 -0
- package/alterations-js/1.44.0-1789000000-extend-user-id-length.js +47 -0
- package/lib/consts/experience.d.ts +3 -0
- package/lib/consts/experience.js +3 -0
- package/lib/consts/index.d.ts +1 -0
- package/lib/consts/index.js +1 -0
- package/lib/consts/license.d.ts +222 -0
- package/lib/consts/license.js +81 -0
- package/lib/consts/license.test.d.ts +1 -0
- package/lib/consts/license.test.js +96 -0
- package/lib/consts/oidc.d.ts +15 -1
- package/lib/consts/oidc.js +11 -0
- package/lib/consts/oidc.test.d.ts +1 -0
- package/lib/consts/oidc.test.js +15 -0
- package/lib/consts/subscriptions.d.ts +13 -1
- package/lib/consts/subscriptions.js +12 -0
- package/lib/db-entries/aggregated-daily-active-user.js +2 -2
- package/lib/db-entries/application-access-control-user-relation.js +2 -2
- package/lib/db-entries/application-user-consent-organization.js +2 -2
- package/lib/db-entries/cimd-grant-organization.js +2 -2
- package/lib/db-entries/daily-active-user.js +2 -2
- package/lib/db-entries/oidc-session-extension.js +2 -2
- package/lib/db-entries/organization-invitation.js +4 -4
- package/lib/db-entries/organization-role-user-relation.js +2 -2
- package/lib/db-entries/organization-user-relation.js +2 -2
- package/lib/db-entries/personal-access-token.js +2 -2
- package/lib/db-entries/saml-application-config.d.ts +4 -2
- package/lib/db-entries/saml-application-config.js +5 -1
- package/lib/db-entries/secret.js +2 -2
- package/lib/db-entries/subject-token.js +2 -2
- package/lib/db-entries/trusted-device.js +2 -2
- package/lib/db-entries/user-geo-location.js +2 -2
- package/lib/db-entries/user-sign-in-country.js +2 -2
- package/lib/db-entries/user-sso-identity.js +2 -2
- package/lib/db-entries/user.js +2 -2
- package/lib/db-entries/users-role.js +2 -2
- package/lib/db-entries/verification-record.js +2 -2
- package/lib/db-entries/verification-status.js +2 -2
- package/lib/foundations/jsonb-types/captcha.d.ts +47 -1
- package/lib/foundations/jsonb-types/captcha.js +20 -0
- package/lib/foundations/jsonb-types/hooks.d.ts +0 -3
- package/lib/foundations/jsonb-types/hooks.js +2 -6
- package/lib/foundations/jsonb-types/saml-application-configs.d.ts +23 -0
- package/lib/foundations/jsonb-types/saml-application-configs.js +16 -0
- package/lib/foundations/jsonb-types/saml-application-configs.test.js +24 -1
- package/lib/types/authentication-context.d.ts +224 -0
- package/lib/types/authentication-context.js +238 -0
- package/lib/types/authentication-context.test.d.ts +1 -0
- package/lib/types/authentication-context.test.js +186 -0
- package/lib/types/cookie.d.ts +4 -0
- package/lib/types/cookie.js +6 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/interactions.d.ts +161 -0
- package/lib/types/interactions.js +23 -0
- package/lib/types/log/interaction.d.ts +15 -2
- package/lib/types/log/interaction.js +5 -0
- package/lib/types/logto-config/index.d.ts +47 -0
- package/lib/types/logto-config/index.js +1 -0
- package/lib/types/logto-config/jwt-customizer.d.ts +92 -0
- package/lib/types/saml-application.d.ts +55 -1
- package/lib/types/saml-application.js +7 -1
- package/lib/types/sign-in-experience.d.ts +11 -7
- package/lib/types/sign-in-experience.js +2 -2
- package/lib/types/ssr.d.ts +2 -0
- package/lib/types/system.d.ts +57 -5
- package/lib/types/system.js +36 -0
- package/lib/types/system.test.d.ts +1 -0
- package/lib/types/system.test.js +26 -0
- package/lib/types/user-sessions.d.ts +156 -0
- package/lib/types/verification-records/code-verification.d.ts +17 -0
- package/lib/types/verification-records/code-verification.js +1 -0
- package/lib/utils/oidc-private-key.test.js +44 -0
- package/package.json +7 -7
- package/tables/aggregated_daily_active_users.sql +1 -1
- package/tables/application_access_control_user_relations.sql +1 -1
- package/tables/application_user_consent_organizations.sql +1 -1
- package/tables/cimd_grant_organizations.sql +1 -1
- package/tables/daily_active_users.sql +1 -1
- package/tables/oidc_session_extensions.sql +1 -1
- package/tables/organization_invitations.sql +2 -2
- package/tables/organization_role_user_relations.sql +1 -1
- package/tables/organization_user_relations.sql +1 -1
- package/tables/personal_access_tokens.sql +1 -1
- package/tables/saml_application_configs.sql +1 -0
- package/tables/secrets.sql +1 -1
- package/tables/subject_tokens.sql +1 -1
- package/tables/trusted_devices.sql +1 -1
- package/tables/user_geo_locations.sql +1 -1
- package/tables/user_sign_in_countries.sql +1 -1
- package/tables/user_sso_identities.sql +1 -1
- package/tables/users.sql +1 -1
- package/tables/users_roles.sql +1 -1
- package/tables/verification_records.sql +1 -1
- package/tables/verification_statuses.sql +1 -1
- package/LICENSE +0 -373
|
@@ -27,7 +27,19 @@ export declare enum ReservedPlanId {
|
|
|
27
27
|
/**
|
|
28
28
|
* Latest Pro plan ID applied from 2025-09.
|
|
29
29
|
*/
|
|
30
|
-
Pro202509 = "pro-202509"
|
|
30
|
+
Pro202509 = "pro-202509",
|
|
31
|
+
/**
|
|
32
|
+
* Self-hosted Pro plan, unlocked by installing a license key on a self-hosted instance.
|
|
33
|
+
*
|
|
34
|
+
* Unlike the plans above, this one is never returned by the Cloud subscription API: it is carried
|
|
35
|
+
* in the signed license payload and resolved locally. See `licensePayloadGuard`.
|
|
36
|
+
*/
|
|
37
|
+
SelfHostedPro = "self-hosted-pro",
|
|
38
|
+
/**
|
|
39
|
+
* Self-hosted Enterprise plan, unlocked by installing a license key on a self-hosted instance.
|
|
40
|
+
* See {@link SelfHostedPro}.
|
|
41
|
+
*/
|
|
42
|
+
SelfHostedEnterprise = "self-hosted-enterprise"
|
|
31
43
|
}
|
|
32
44
|
/**
|
|
33
45
|
* Tenant subscription related Redis cache keys.
|
|
@@ -29,6 +29,18 @@ export var ReservedPlanId;
|
|
|
29
29
|
* Latest Pro plan ID applied from 2025-09.
|
|
30
30
|
*/
|
|
31
31
|
ReservedPlanId["Pro202509"] = "pro-202509";
|
|
32
|
+
/**
|
|
33
|
+
* Self-hosted Pro plan, unlocked by installing a license key on a self-hosted instance.
|
|
34
|
+
*
|
|
35
|
+
* Unlike the plans above, this one is never returned by the Cloud subscription API: it is carried
|
|
36
|
+
* in the signed license payload and resolved locally. See `licensePayloadGuard`.
|
|
37
|
+
*/
|
|
38
|
+
ReservedPlanId["SelfHostedPro"] = "self-hosted-pro";
|
|
39
|
+
/**
|
|
40
|
+
* Self-hosted Enterprise plan, unlocked by installing a license key on a self-hosted instance.
|
|
41
|
+
* See {@link SelfHostedPro}.
|
|
42
|
+
*/
|
|
43
|
+
ReservedPlanId["SelfHostedEnterprise"] = "self-hosted-enterprise";
|
|
32
44
|
})(ReservedPlanId || (ReservedPlanId = {}));
|
|
33
45
|
/**
|
|
34
46
|
* Tenant subscription related Redis cache keys.
|
|
@@ -3,13 +3,13 @@ import { z } from 'zod';
|
|
|
3
3
|
const createGuard = z.object({
|
|
4
4
|
tenantId: z.string().max(21).optional(),
|
|
5
5
|
activityDate: z.number(),
|
|
6
|
-
userId: z.string().min(1).max(
|
|
6
|
+
userId: z.string().min(1).max(128),
|
|
7
7
|
activityCount: z.number(),
|
|
8
8
|
});
|
|
9
9
|
const guard = z.object({
|
|
10
10
|
tenantId: z.string().max(21),
|
|
11
11
|
activityDate: z.number(),
|
|
12
|
-
userId: z.string().min(1).max(
|
|
12
|
+
userId: z.string().min(1).max(128),
|
|
13
13
|
activityCount: z.number(),
|
|
14
14
|
});
|
|
15
15
|
export const AggregatedDailyActiveUsers = Object.freeze({
|
|
@@ -3,12 +3,12 @@ import { z } from 'zod';
|
|
|
3
3
|
const createGuard = z.object({
|
|
4
4
|
tenantId: z.string().max(21).optional(),
|
|
5
5
|
applicationId: z.string().min(1).max(21),
|
|
6
|
-
userId: z.string().min(1).max(
|
|
6
|
+
userId: z.string().min(1).max(128),
|
|
7
7
|
});
|
|
8
8
|
const guard = z.object({
|
|
9
9
|
tenantId: z.string().max(21),
|
|
10
10
|
applicationId: z.string().min(1).max(21),
|
|
11
|
-
userId: z.string().min(1).max(
|
|
11
|
+
userId: z.string().min(1).max(128),
|
|
12
12
|
});
|
|
13
13
|
export const ApplicationAccessControlUserRelations = Object.freeze({
|
|
14
14
|
table: 'application_access_control_user_relations',
|
|
@@ -4,13 +4,13 @@ const createGuard = z.object({
|
|
|
4
4
|
tenantId: z.string().max(21).optional(),
|
|
5
5
|
applicationId: z.string().min(1).max(21),
|
|
6
6
|
organizationId: z.string().min(1).max(21),
|
|
7
|
-
userId: z.string().min(1).max(
|
|
7
|
+
userId: z.string().min(1).max(128),
|
|
8
8
|
});
|
|
9
9
|
const guard = z.object({
|
|
10
10
|
tenantId: z.string().max(21),
|
|
11
11
|
applicationId: z.string().min(1).max(21),
|
|
12
12
|
organizationId: z.string().min(1).max(21),
|
|
13
|
-
userId: z.string().min(1).max(
|
|
13
|
+
userId: z.string().min(1).max(128),
|
|
14
14
|
});
|
|
15
15
|
export const ApplicationUserConsentOrganizations = Object.freeze({
|
|
16
16
|
table: 'application_user_consent_organizations',
|
|
@@ -5,14 +5,14 @@ const createGuard = z.object({
|
|
|
5
5
|
grantId: z.string().min(1).max(128),
|
|
6
6
|
grantModelName: z.string().min(1).max(64).optional(),
|
|
7
7
|
organizationId: z.string().min(1).max(21),
|
|
8
|
-
userId: z.string().min(1).max(
|
|
8
|
+
userId: z.string().min(1).max(128),
|
|
9
9
|
});
|
|
10
10
|
const guard = z.object({
|
|
11
11
|
tenantId: z.string().max(21),
|
|
12
12
|
grantId: z.string().min(1).max(128),
|
|
13
13
|
grantModelName: z.string().max(64),
|
|
14
14
|
organizationId: z.string().min(1).max(21),
|
|
15
|
-
userId: z.string().min(1).max(
|
|
15
|
+
userId: z.string().min(1).max(128),
|
|
16
16
|
});
|
|
17
17
|
export const CimdGrantOrganizations = Object.freeze({
|
|
18
18
|
table: 'cimd_grant_organizations',
|
|
@@ -3,13 +3,13 @@ import { z } from 'zod';
|
|
|
3
3
|
const createGuard = z.object({
|
|
4
4
|
id: z.string().min(1).max(21),
|
|
5
5
|
tenantId: z.string().max(21).optional(),
|
|
6
|
-
userId: z.string().min(1).max(
|
|
6
|
+
userId: z.string().min(1).max(128),
|
|
7
7
|
date: z.number().optional(),
|
|
8
8
|
});
|
|
9
9
|
const guard = z.object({
|
|
10
10
|
id: z.string().min(1).max(21),
|
|
11
11
|
tenantId: z.string().max(21),
|
|
12
|
-
userId: z.string().min(1).max(
|
|
12
|
+
userId: z.string().min(1).max(128),
|
|
13
13
|
date: z.number(),
|
|
14
14
|
});
|
|
15
15
|
export const DailyActiveUsers = Object.freeze({
|
|
@@ -4,7 +4,7 @@ import { jsonObjectGuard } from './../foundations/index.js';
|
|
|
4
4
|
const createGuard = z.object({
|
|
5
5
|
tenantId: z.string().max(21).optional(),
|
|
6
6
|
sessionUid: z.string().min(1).max(128),
|
|
7
|
-
accountId: z.string().min(1).max(
|
|
7
|
+
accountId: z.string().min(1).max(128),
|
|
8
8
|
lastSubmission: jsonObjectGuard.optional(),
|
|
9
9
|
clientId: z.string().max(21).nullable().optional(),
|
|
10
10
|
cimdClientId: z.string().max(2048).nullable().optional(),
|
|
@@ -14,7 +14,7 @@ const createGuard = z.object({
|
|
|
14
14
|
const guard = z.object({
|
|
15
15
|
tenantId: z.string().max(21),
|
|
16
16
|
sessionUid: z.string().min(1).max(128),
|
|
17
|
-
accountId: z.string().min(1).max(
|
|
17
|
+
accountId: z.string().min(1).max(128),
|
|
18
18
|
lastSubmission: jsonObjectGuard,
|
|
19
19
|
clientId: z.string().max(21).nullable(),
|
|
20
20
|
cimdClientId: z.string().max(2048).nullable(),
|
|
@@ -4,9 +4,9 @@ import { OrganizationInvitationStatus } from './custom-types.js';
|
|
|
4
4
|
const createGuard = z.object({
|
|
5
5
|
tenantId: z.string().max(21).optional(),
|
|
6
6
|
id: z.string().min(1).max(21),
|
|
7
|
-
inviterId: z.string().max(
|
|
7
|
+
inviterId: z.string().max(128).nullable().optional(),
|
|
8
8
|
invitee: z.string().min(1).max(256),
|
|
9
|
-
acceptedUserId: z.string().max(
|
|
9
|
+
acceptedUserId: z.string().max(128).nullable().optional(),
|
|
10
10
|
organizationId: z.string().min(1).max(21),
|
|
11
11
|
status: z.nativeEnum(OrganizationInvitationStatus),
|
|
12
12
|
createdAt: z.number().optional(),
|
|
@@ -16,9 +16,9 @@ const createGuard = z.object({
|
|
|
16
16
|
const guard = z.object({
|
|
17
17
|
tenantId: z.string().max(21),
|
|
18
18
|
id: z.string().min(1).max(21),
|
|
19
|
-
inviterId: z.string().max(
|
|
19
|
+
inviterId: z.string().max(128).nullable(),
|
|
20
20
|
invitee: z.string().min(1).max(256),
|
|
21
|
-
acceptedUserId: z.string().max(
|
|
21
|
+
acceptedUserId: z.string().max(128).nullable(),
|
|
22
22
|
organizationId: z.string().min(1).max(21),
|
|
23
23
|
status: z.nativeEnum(OrganizationInvitationStatus),
|
|
24
24
|
createdAt: z.number(),
|
|
@@ -4,13 +4,13 @@ const createGuard = z.object({
|
|
|
4
4
|
tenantId: z.string().max(21).optional(),
|
|
5
5
|
organizationId: z.string().min(1).max(21),
|
|
6
6
|
organizationRoleId: z.string().min(1).max(21),
|
|
7
|
-
userId: z.string().min(1).max(
|
|
7
|
+
userId: z.string().min(1).max(128),
|
|
8
8
|
});
|
|
9
9
|
const guard = z.object({
|
|
10
10
|
tenantId: z.string().max(21),
|
|
11
11
|
organizationId: z.string().min(1).max(21),
|
|
12
12
|
organizationRoleId: z.string().min(1).max(21),
|
|
13
|
-
userId: z.string().min(1).max(
|
|
13
|
+
userId: z.string().min(1).max(128),
|
|
14
14
|
});
|
|
15
15
|
export const OrganizationRoleUserRelations = Object.freeze({
|
|
16
16
|
table: 'organization_role_user_relations',
|
|
@@ -3,12 +3,12 @@ import { z } from 'zod';
|
|
|
3
3
|
const createGuard = z.object({
|
|
4
4
|
tenantId: z.string().max(21).optional(),
|
|
5
5
|
organizationId: z.string().min(1).max(21),
|
|
6
|
-
userId: z.string().min(1).max(
|
|
6
|
+
userId: z.string().min(1).max(128),
|
|
7
7
|
});
|
|
8
8
|
const guard = z.object({
|
|
9
9
|
tenantId: z.string().max(21),
|
|
10
10
|
organizationId: z.string().min(1).max(21),
|
|
11
|
-
userId: z.string().min(1).max(
|
|
11
|
+
userId: z.string().min(1).max(128),
|
|
12
12
|
});
|
|
13
13
|
export const OrganizationUserRelations = Object.freeze({
|
|
14
14
|
table: 'organization_user_relations',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
const createGuard = z.object({
|
|
4
4
|
tenantId: z.string().max(21).optional(),
|
|
5
|
-
userId: z.string().min(1).max(
|
|
5
|
+
userId: z.string().min(1).max(128),
|
|
6
6
|
name: z.string().min(1).max(256),
|
|
7
7
|
value: z.string().min(1).max(64),
|
|
8
8
|
createdAt: z.number().optional(),
|
|
@@ -10,7 +10,7 @@ const createGuard = z.object({
|
|
|
10
10
|
});
|
|
11
11
|
const guard = z.object({
|
|
12
12
|
tenantId: z.string().max(21),
|
|
13
|
-
userId: z.string().min(1).max(
|
|
13
|
+
userId: z.string().min(1).max(128),
|
|
14
14
|
name: z.string().min(1).max(256),
|
|
15
15
|
value: z.string().min(1).max(64),
|
|
16
16
|
createdAt: z.number(),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SamlAttributeMapping, SamlAcsUrl, SamlEncryption, NameIdFormat, GeneratedSchema } from './../foundations/index.js';
|
|
1
|
+
import { SamlAttributeMapping, SamlAcsUrl, SamlEncryption, SamlAuthnRequestConfig, NameIdFormat, GeneratedSchema } from './../foundations/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* The SAML application config and SAML-type application have a one-to-one correspondence: 1. a SAML-type application can only have one SAML application config. (CANNOT use "semicolon" in comments, since it indicates the end of query.) 2. a SAML application config can only configure one SAML-type application.
|
|
4
4
|
*
|
|
@@ -12,6 +12,7 @@ export type CreateSamlApplicationConfig = {
|
|
|
12
12
|
entityId?: string | null;
|
|
13
13
|
acsUrl?: SamlAcsUrl | null;
|
|
14
14
|
encryption?: SamlEncryption | null;
|
|
15
|
+
authnRequestConfig?: SamlAuthnRequestConfig | null;
|
|
15
16
|
nameIdFormat: NameIdFormat;
|
|
16
17
|
};
|
|
17
18
|
/** The SAML application config and SAML-type application have a one-to-one correspondence: 1. a SAML-type application can only have one SAML application config. (CANNOT use "semicolon" in comments, since it indicates the end of query.) 2. a SAML application config can only configure one SAML-type application. */
|
|
@@ -22,7 +23,8 @@ export type SamlApplicationConfig = {
|
|
|
22
23
|
entityId: string | null;
|
|
23
24
|
acsUrl: SamlAcsUrl | null;
|
|
24
25
|
encryption: SamlEncryption | null;
|
|
26
|
+
authnRequestConfig: SamlAuthnRequestConfig | null;
|
|
25
27
|
nameIdFormat: NameIdFormat;
|
|
26
28
|
};
|
|
27
|
-
export type SamlApplicationConfigKeys = 'applicationId' | 'tenantId' | 'attributeMapping' | 'entityId' | 'acsUrl' | 'encryption' | 'nameIdFormat';
|
|
29
|
+
export type SamlApplicationConfigKeys = 'applicationId' | 'tenantId' | 'attributeMapping' | 'entityId' | 'acsUrl' | 'encryption' | 'authnRequestConfig' | 'nameIdFormat';
|
|
28
30
|
export declare const SamlApplicationConfigs: GeneratedSchema<SamlApplicationConfigKeys, CreateSamlApplicationConfig, SamlApplicationConfig, 'saml_application_configs', 'saml_application_config'>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { samlAttributeMappingGuard, samlAcsUrlGuard, samlEncryptionGuard, nameIdFormatGuard } from './../foundations/index.js';
|
|
3
|
+
import { samlAttributeMappingGuard, samlAcsUrlGuard, samlEncryptionGuard, samlAuthnRequestConfigGuard, nameIdFormatGuard } from './../foundations/index.js';
|
|
4
4
|
const createGuard = z.object({
|
|
5
5
|
applicationId: z.string().min(1).max(21),
|
|
6
6
|
tenantId: z.string().max(21).optional(),
|
|
@@ -8,6 +8,7 @@ const createGuard = z.object({
|
|
|
8
8
|
entityId: z.string().max(128).nullable().optional(),
|
|
9
9
|
acsUrl: samlAcsUrlGuard.nullable().optional(),
|
|
10
10
|
encryption: samlEncryptionGuard.nullable().optional(),
|
|
11
|
+
authnRequestConfig: samlAuthnRequestConfigGuard.nullable().optional(),
|
|
11
12
|
nameIdFormat: nameIdFormatGuard,
|
|
12
13
|
});
|
|
13
14
|
const guard = z.object({
|
|
@@ -17,6 +18,7 @@ const guard = z.object({
|
|
|
17
18
|
entityId: z.string().max(128).nullable(),
|
|
18
19
|
acsUrl: samlAcsUrlGuard.nullable(),
|
|
19
20
|
encryption: samlEncryptionGuard.nullable(),
|
|
21
|
+
authnRequestConfig: samlAuthnRequestConfigGuard.nullable(),
|
|
20
22
|
nameIdFormat: nameIdFormatGuard,
|
|
21
23
|
});
|
|
22
24
|
export const SamlApplicationConfigs = Object.freeze({
|
|
@@ -29,6 +31,7 @@ export const SamlApplicationConfigs = Object.freeze({
|
|
|
29
31
|
entityId: 'entity_id',
|
|
30
32
|
acsUrl: 'acs_url',
|
|
31
33
|
encryption: 'encryption',
|
|
34
|
+
authnRequestConfig: 'authn_request_config',
|
|
32
35
|
nameIdFormat: 'name_id_format',
|
|
33
36
|
},
|
|
34
37
|
fieldKeys: [
|
|
@@ -38,6 +41,7 @@ export const SamlApplicationConfigs = Object.freeze({
|
|
|
38
41
|
'entityId',
|
|
39
42
|
'acsUrl',
|
|
40
43
|
'encryption',
|
|
44
|
+
'authnRequestConfig',
|
|
41
45
|
'nameIdFormat',
|
|
42
46
|
],
|
|
43
47
|
createGuard,
|
package/lib/db-entries/secret.js
CHANGED
|
@@ -4,7 +4,7 @@ import { secretTypeGuard, bufferLikeGuard, jsonObjectGuard } from './../foundati
|
|
|
4
4
|
const createGuard = z.object({
|
|
5
5
|
tenantId: z.string().max(21).optional(),
|
|
6
6
|
id: z.string().min(1).max(21),
|
|
7
|
-
userId: z.string().min(1).max(
|
|
7
|
+
userId: z.string().min(1).max(128),
|
|
8
8
|
type: secretTypeGuard,
|
|
9
9
|
encryptedDek: bufferLikeGuard,
|
|
10
10
|
iv: bufferLikeGuard,
|
|
@@ -17,7 +17,7 @@ const createGuard = z.object({
|
|
|
17
17
|
const guard = z.object({
|
|
18
18
|
tenantId: z.string().max(21),
|
|
19
19
|
id: z.string().min(1).max(21),
|
|
20
|
-
userId: z.string().min(1).max(
|
|
20
|
+
userId: z.string().min(1).max(128),
|
|
21
21
|
type: secretTypeGuard,
|
|
22
22
|
encryptedDek: bufferLikeGuard,
|
|
23
23
|
iv: bufferLikeGuard,
|
|
@@ -7,7 +7,7 @@ const createGuard = z.object({
|
|
|
7
7
|
context: jsonObjectGuard.optional(),
|
|
8
8
|
expiresAt: z.number(),
|
|
9
9
|
consumedAt: z.number().nullable().optional(),
|
|
10
|
-
userId: z.string().min(1).max(
|
|
10
|
+
userId: z.string().min(1).max(128),
|
|
11
11
|
createdAt: z.number().optional(),
|
|
12
12
|
creatorId: z.string().min(1).max(32),
|
|
13
13
|
});
|
|
@@ -17,7 +17,7 @@ const guard = z.object({
|
|
|
17
17
|
context: jsonObjectGuard,
|
|
18
18
|
expiresAt: z.number(),
|
|
19
19
|
consumedAt: z.number().nullable(),
|
|
20
|
-
userId: z.string().min(1).max(
|
|
20
|
+
userId: z.string().min(1).max(128),
|
|
21
21
|
createdAt: z.number(),
|
|
22
22
|
creatorId: z.string().min(1).max(32),
|
|
23
23
|
});
|
|
@@ -4,7 +4,7 @@ import { bufferLikeGuard } from './../foundations/index.js';
|
|
|
4
4
|
const createGuard = z.object({
|
|
5
5
|
tenantId: z.string().max(21).optional(),
|
|
6
6
|
id: z.string().min(1).max(21),
|
|
7
|
-
userId: z.string().min(1).max(
|
|
7
|
+
userId: z.string().min(1).max(128),
|
|
8
8
|
secretHash: bufferLikeGuard,
|
|
9
9
|
userAgent: z.string().nullable().optional(),
|
|
10
10
|
ip: z.string().nullable().optional(),
|
|
@@ -17,7 +17,7 @@ const createGuard = z.object({
|
|
|
17
17
|
const guard = z.object({
|
|
18
18
|
tenantId: z.string().max(21),
|
|
19
19
|
id: z.string().min(1).max(21),
|
|
20
|
-
userId: z.string().min(1).max(
|
|
20
|
+
userId: z.string().min(1).max(128),
|
|
21
21
|
secretHash: bufferLikeGuard,
|
|
22
22
|
userAgent: z.string().nullable(),
|
|
23
23
|
ip: z.string().nullable(),
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
const createGuard = z.object({
|
|
4
4
|
tenantId: z.string().max(21).optional(),
|
|
5
|
-
userId: z.string().min(1).max(
|
|
5
|
+
userId: z.string().min(1).max(128),
|
|
6
6
|
latitude: z.number().nullable().optional(),
|
|
7
7
|
longitude: z.number().nullable().optional(),
|
|
8
8
|
updatedAt: z.number().optional(),
|
|
9
9
|
});
|
|
10
10
|
const guard = z.object({
|
|
11
11
|
tenantId: z.string().max(21),
|
|
12
|
-
userId: z.string().min(1).max(
|
|
12
|
+
userId: z.string().min(1).max(128),
|
|
13
13
|
latitude: z.number().nullable(),
|
|
14
14
|
longitude: z.number().nullable(),
|
|
15
15
|
updatedAt: z.number(),
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
const createGuard = z.object({
|
|
4
4
|
tenantId: z.string().max(21).optional(),
|
|
5
|
-
userId: z.string().min(1).max(
|
|
5
|
+
userId: z.string().min(1).max(128),
|
|
6
6
|
country: z.string().min(1).max(16),
|
|
7
7
|
lastSignInAt: z.number().optional(),
|
|
8
8
|
});
|
|
9
9
|
const guard = z.object({
|
|
10
10
|
tenantId: z.string().max(21),
|
|
11
|
-
userId: z.string().min(1).max(
|
|
11
|
+
userId: z.string().min(1).max(128),
|
|
12
12
|
country: z.string().min(1).max(16),
|
|
13
13
|
lastSignInAt: z.number(),
|
|
14
14
|
});
|
|
@@ -4,7 +4,7 @@ import { jsonObjectGuard } from './../foundations/index.js';
|
|
|
4
4
|
const createGuard = z.object({
|
|
5
5
|
tenantId: z.string().max(21).optional(),
|
|
6
6
|
id: z.string().min(1).max(21),
|
|
7
|
-
userId: z.string().min(1).max(
|
|
7
|
+
userId: z.string().min(1).max(128),
|
|
8
8
|
issuer: z.string().min(1).max(256),
|
|
9
9
|
identityId: z.string().min(1).max(128),
|
|
10
10
|
detail: jsonObjectGuard.optional(),
|
|
@@ -15,7 +15,7 @@ const createGuard = z.object({
|
|
|
15
15
|
const guard = z.object({
|
|
16
16
|
tenantId: z.string().max(21),
|
|
17
17
|
id: z.string().min(1).max(21),
|
|
18
|
-
userId: z.string().min(1).max(
|
|
18
|
+
userId: z.string().min(1).max(128),
|
|
19
19
|
issuer: z.string().min(1).max(256),
|
|
20
20
|
identityId: z.string().min(1).max(128),
|
|
21
21
|
detail: jsonObjectGuard,
|
package/lib/db-entries/user.js
CHANGED
|
@@ -4,7 +4,7 @@ import { userProfileGuard, identitiesGuard, jsonObjectGuard, mfaVerificationsGua
|
|
|
4
4
|
import { UsersPasswordEncryptionMethod } from './custom-types.js';
|
|
5
5
|
const createGuard = z.object({
|
|
6
6
|
tenantId: z.string().max(21).optional(),
|
|
7
|
-
id: z.string().min(1).max(
|
|
7
|
+
id: z.string().min(1).max(128),
|
|
8
8
|
username: z.string().max(128).nullable().optional(),
|
|
9
9
|
primaryEmail: z.string().max(128).nullable().optional(),
|
|
10
10
|
primaryPhone: z.string().max(128).nullable().optional(),
|
|
@@ -28,7 +28,7 @@ const createGuard = z.object({
|
|
|
28
28
|
});
|
|
29
29
|
const guard = z.object({
|
|
30
30
|
tenantId: z.string().max(21),
|
|
31
|
-
id: z.string().min(1).max(
|
|
31
|
+
id: z.string().min(1).max(128),
|
|
32
32
|
username: z.string().max(128).nullable(),
|
|
33
33
|
primaryEmail: z.string().max(128).nullable(),
|
|
34
34
|
primaryPhone: z.string().max(128).nullable(),
|
|
@@ -3,13 +3,13 @@ import { z } from 'zod';
|
|
|
3
3
|
const createGuard = z.object({
|
|
4
4
|
tenantId: z.string().max(21).optional(),
|
|
5
5
|
id: z.string().min(1).max(21),
|
|
6
|
-
userId: z.string().min(1).max(
|
|
6
|
+
userId: z.string().min(1).max(128),
|
|
7
7
|
roleId: z.string().min(1).max(21),
|
|
8
8
|
});
|
|
9
9
|
const guard = z.object({
|
|
10
10
|
tenantId: z.string().max(21),
|
|
11
11
|
id: z.string().min(1).max(21),
|
|
12
|
-
userId: z.string().min(1).max(
|
|
12
|
+
userId: z.string().min(1).max(128),
|
|
13
13
|
roleId: z.string().min(1).max(21),
|
|
14
14
|
});
|
|
15
15
|
export const UsersRoles = Object.freeze({
|
|
@@ -4,7 +4,7 @@ import { jsonObjectGuard } from './../foundations/index.js';
|
|
|
4
4
|
const createGuard = z.object({
|
|
5
5
|
tenantId: z.string().max(21).optional(),
|
|
6
6
|
id: z.string().min(1).max(21),
|
|
7
|
-
userId: z.string().max(
|
|
7
|
+
userId: z.string().max(128).nullable().optional(),
|
|
8
8
|
createdAt: z.number().optional(),
|
|
9
9
|
expiresAt: z.number(),
|
|
10
10
|
data: jsonObjectGuard.optional(),
|
|
@@ -12,7 +12,7 @@ const createGuard = z.object({
|
|
|
12
12
|
const guard = z.object({
|
|
13
13
|
tenantId: z.string().max(21),
|
|
14
14
|
id: z.string().min(1).max(21),
|
|
15
|
-
userId: z.string().max(
|
|
15
|
+
userId: z.string().max(128).nullable(),
|
|
16
16
|
createdAt: z.number(),
|
|
17
17
|
expiresAt: z.number(),
|
|
18
18
|
data: jsonObjectGuard,
|
|
@@ -3,14 +3,14 @@ import { z } from 'zod';
|
|
|
3
3
|
const createGuard = z.object({
|
|
4
4
|
tenantId: z.string().max(21).optional(),
|
|
5
5
|
id: z.string().min(1).max(21),
|
|
6
|
-
userId: z.string().min(1).max(
|
|
6
|
+
userId: z.string().min(1).max(128),
|
|
7
7
|
createdAt: z.number().optional(),
|
|
8
8
|
verifiedIdentifier: z.string().max(255).nullable().optional(),
|
|
9
9
|
});
|
|
10
10
|
const guard = z.object({
|
|
11
11
|
tenantId: z.string().max(21),
|
|
12
12
|
id: z.string().min(1).max(21),
|
|
13
|
-
userId: z.string().min(1).max(
|
|
13
|
+
userId: z.string().min(1).max(128),
|
|
14
14
|
createdAt: z.number(),
|
|
15
15
|
verifiedIdentifier: z.string().max(255).nullable(),
|
|
16
16
|
});
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare enum CaptchaType {
|
|
3
3
|
RecaptchaEnterprise = "RecaptchaEnterprise",
|
|
4
|
-
Turnstile = "Turnstile"
|
|
4
|
+
Turnstile = "Turnstile",
|
|
5
|
+
Cap = "Cap"
|
|
5
6
|
}
|
|
6
7
|
export declare enum RecaptchaEnterpriseMode {
|
|
7
8
|
Invisible = "invisible",
|
|
@@ -28,6 +29,7 @@ export declare const recaptchaEnterpriseConfigGuard: z.ZodObject<{
|
|
|
28
29
|
projectId: z.ZodString;
|
|
29
30
|
domain: z.ZodOptional<z.ZodString>;
|
|
30
31
|
mode: z.ZodOptional<z.ZodNativeEnum<typeof RecaptchaEnterpriseMode>>;
|
|
32
|
+
scoreThreshold: z.ZodOptional<z.ZodNumber>;
|
|
31
33
|
}, "strip", z.ZodTypeAny, {
|
|
32
34
|
type: CaptchaType.RecaptchaEnterprise;
|
|
33
35
|
siteKey: string;
|
|
@@ -35,6 +37,7 @@ export declare const recaptchaEnterpriseConfigGuard: z.ZodObject<{
|
|
|
35
37
|
projectId: string;
|
|
36
38
|
domain?: string | undefined;
|
|
37
39
|
mode?: RecaptchaEnterpriseMode | undefined;
|
|
40
|
+
scoreThreshold?: number | undefined;
|
|
38
41
|
}, {
|
|
39
42
|
type: CaptchaType.RecaptchaEnterprise;
|
|
40
43
|
siteKey: string;
|
|
@@ -42,8 +45,32 @@ export declare const recaptchaEnterpriseConfigGuard: z.ZodObject<{
|
|
|
42
45
|
projectId: string;
|
|
43
46
|
domain?: string | undefined;
|
|
44
47
|
mode?: RecaptchaEnterpriseMode | undefined;
|
|
48
|
+
scoreThreshold?: number | undefined;
|
|
45
49
|
}>;
|
|
46
50
|
export type RecaptchaEnterpriseConfig = z.infer<typeof recaptchaEnterpriseConfigGuard>;
|
|
51
|
+
/**
|
|
52
|
+
* Config of a self-hosted Cap Standalone instance.
|
|
53
|
+
*
|
|
54
|
+
* @see https://capjs.js.org/guide/standalone/
|
|
55
|
+
*/
|
|
56
|
+
export declare const capConfigGuard: z.ZodObject<{
|
|
57
|
+
type: z.ZodLiteral<CaptchaType.Cap>;
|
|
58
|
+
/** The public base URL of the Cap Standalone instance, e.g. `https://cap.example.com`. */
|
|
59
|
+
endpoint: z.ZodEffects<z.ZodString, string, string>;
|
|
60
|
+
siteKey: z.ZodString;
|
|
61
|
+
secretKey: z.ZodString;
|
|
62
|
+
}, "strip", z.ZodTypeAny, {
|
|
63
|
+
type: CaptchaType.Cap;
|
|
64
|
+
siteKey: string;
|
|
65
|
+
secretKey: string;
|
|
66
|
+
endpoint: string;
|
|
67
|
+
}, {
|
|
68
|
+
type: CaptchaType.Cap;
|
|
69
|
+
siteKey: string;
|
|
70
|
+
secretKey: string;
|
|
71
|
+
endpoint: string;
|
|
72
|
+
}>;
|
|
73
|
+
export type CapConfig = z.infer<typeof capConfigGuard>;
|
|
47
74
|
export declare const captchaConfigGuard: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
48
75
|
type: z.ZodLiteral<CaptchaType.Turnstile>;
|
|
49
76
|
siteKey: z.ZodString;
|
|
@@ -63,6 +90,7 @@ export declare const captchaConfigGuard: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
63
90
|
projectId: z.ZodString;
|
|
64
91
|
domain: z.ZodOptional<z.ZodString>;
|
|
65
92
|
mode: z.ZodOptional<z.ZodNativeEnum<typeof RecaptchaEnterpriseMode>>;
|
|
93
|
+
scoreThreshold: z.ZodOptional<z.ZodNumber>;
|
|
66
94
|
}, "strip", z.ZodTypeAny, {
|
|
67
95
|
type: CaptchaType.RecaptchaEnterprise;
|
|
68
96
|
siteKey: string;
|
|
@@ -70,6 +98,7 @@ export declare const captchaConfigGuard: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
70
98
|
projectId: string;
|
|
71
99
|
domain?: string | undefined;
|
|
72
100
|
mode?: RecaptchaEnterpriseMode | undefined;
|
|
101
|
+
scoreThreshold?: number | undefined;
|
|
73
102
|
}, {
|
|
74
103
|
type: CaptchaType.RecaptchaEnterprise;
|
|
75
104
|
siteKey: string;
|
|
@@ -77,5 +106,22 @@ export declare const captchaConfigGuard: z.ZodDiscriminatedUnion<"type", [z.ZodO
|
|
|
77
106
|
projectId: string;
|
|
78
107
|
domain?: string | undefined;
|
|
79
108
|
mode?: RecaptchaEnterpriseMode | undefined;
|
|
109
|
+
scoreThreshold?: number | undefined;
|
|
110
|
+
}>, z.ZodObject<{
|
|
111
|
+
type: z.ZodLiteral<CaptchaType.Cap>;
|
|
112
|
+
/** The public base URL of the Cap Standalone instance, e.g. `https://cap.example.com`. */
|
|
113
|
+
endpoint: z.ZodEffects<z.ZodString, string, string>;
|
|
114
|
+
siteKey: z.ZodString;
|
|
115
|
+
secretKey: z.ZodString;
|
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
|
117
|
+
type: CaptchaType.Cap;
|
|
118
|
+
siteKey: string;
|
|
119
|
+
secretKey: string;
|
|
120
|
+
endpoint: string;
|
|
121
|
+
}, {
|
|
122
|
+
type: CaptchaType.Cap;
|
|
123
|
+
siteKey: string;
|
|
124
|
+
secretKey: string;
|
|
125
|
+
endpoint: string;
|
|
80
126
|
}>]>;
|
|
81
127
|
export type CaptchaConfig = z.infer<typeof captchaConfigGuard>;
|
|
@@ -3,6 +3,7 @@ export var CaptchaType;
|
|
|
3
3
|
(function (CaptchaType) {
|
|
4
4
|
CaptchaType["RecaptchaEnterprise"] = "RecaptchaEnterprise";
|
|
5
5
|
CaptchaType["Turnstile"] = "Turnstile";
|
|
6
|
+
CaptchaType["Cap"] = "Cap";
|
|
6
7
|
})(CaptchaType || (CaptchaType = {}));
|
|
7
8
|
export var RecaptchaEnterpriseMode;
|
|
8
9
|
(function (RecaptchaEnterpriseMode) {
|
|
@@ -21,8 +22,27 @@ export const recaptchaEnterpriseConfigGuard = z.object({
|
|
|
21
22
|
projectId: z.string(),
|
|
22
23
|
domain: z.string().optional(),
|
|
23
24
|
mode: z.nativeEnum(RecaptchaEnterpriseMode).optional(),
|
|
25
|
+
scoreThreshold: z.number().min(0).max(1).optional(),
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Config of a self-hosted Cap Standalone instance.
|
|
29
|
+
*
|
|
30
|
+
* @see https://capjs.js.org/guide/standalone/
|
|
31
|
+
*/
|
|
32
|
+
export const capConfigGuard = z.object({
|
|
33
|
+
type: z.literal(CaptchaType.Cap),
|
|
34
|
+
/** The public base URL of the Cap Standalone instance, e.g. `https://cap.example.com`. */
|
|
35
|
+
endpoint: z
|
|
36
|
+
.string()
|
|
37
|
+
.url()
|
|
38
|
+
.refine((value) => ['http:', 'https:'].includes(new URL(value).protocol), {
|
|
39
|
+
message: 'The endpoint must be an HTTP(S) URL.',
|
|
40
|
+
}),
|
|
41
|
+
siteKey: z.string(),
|
|
42
|
+
secretKey: z.string(),
|
|
24
43
|
});
|
|
25
44
|
export const captchaConfigGuard = z.discriminatedUnion('type', [
|
|
26
45
|
turnstileConfigGuard,
|
|
27
46
|
recaptchaEnterpriseConfigGuard,
|
|
47
|
+
capConfigGuard,
|
|
28
48
|
]);
|
|
@@ -33,9 +33,6 @@ type CustomDataHookMutableSchema = `${Exclude<DataHookSchema, DataHookSchema.Tru
|
|
|
33
33
|
type DataHookPropertyUpdateEvent = `${CustomDataHookMutableSchema}.${DataHookDetailMutationType.Updated}`;
|
|
34
34
|
export type ExceptionHookEvent = 'Identifier.Lockout' | 'Message.RateLimited' | 'Grant.LimitExceeded';
|
|
35
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];
|
|
39
36
|
/** The hook event values that can be registered. */
|
|
40
37
|
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"];
|
|
41
38
|
/** The type of hook event values that can be registered. */
|
|
@@ -34,11 +34,6 @@ var DataHookDetailMutationType;
|
|
|
34
34
|
(function (DataHookDetailMutationType) {
|
|
35
35
|
DataHookDetailMutationType["Updated"] = "Updated";
|
|
36
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
|
-
]);
|
|
42
37
|
/** The hook event values that can be registered. */
|
|
43
38
|
export const hookEvents = Object.freeze([
|
|
44
39
|
InteractionHookEvent.PostRegister,
|
|
@@ -49,7 +44,8 @@ export const hookEvents = Object.freeze([
|
|
|
49
44
|
'User.Deleted',
|
|
50
45
|
'User.Data.Updated',
|
|
51
46
|
'User.SuspensionStatus.Updated',
|
|
52
|
-
|
|
47
|
+
'TrustedDevice.Created',
|
|
48
|
+
'TrustedDevice.Deleted',
|
|
53
49
|
'Role.Created',
|
|
54
50
|
'Role.Deleted',
|
|
55
51
|
'Role.Data.Updated',
|