@logto/schemas 1.25.0 → 1.27.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.26.0-1740982044-add-one-time-tokens-table.ts +36 -0
- package/alterations/1.26.0-1741240284-add-captcha-policy.ts +20 -0
- package/alterations/1.26.0-1741318144-add-one-time-token-unique-index.ts +18 -0
- package/alterations/1.26.0-1741572426-add-captcha-providers.ts +34 -0
- package/alterations/1.27.0-1744013256-add-sentinel-policy-column-to-sie-table.ts +20 -0
- package/alterations/1.27.0-1744357867-add-sentinel-activities-hash-index.ts +19 -0
- package/alterations-js/1.26.0-1740982044-add-one-time-tokens-table.js +30 -0
- package/alterations-js/1.26.0-1741240284-add-captcha-policy.js +16 -0
- package/alterations-js/1.26.0-1741318144-add-one-time-token-unique-index.js +14 -0
- package/alterations-js/1.26.0-1741572426-add-captcha-providers.js +29 -0
- package/alterations-js/1.27.0-1744013256-add-sentinel-policy-column-to-sie-table.js +16 -0
- package/alterations-js/1.27.0-1744357867-add-sentinel-activities-hash-index.js +15 -0
- package/lib/consts/experience.d.ts +2 -0
- package/lib/consts/experience.js +2 -0
- package/lib/consts/index.d.ts +1 -0
- package/lib/consts/index.js +1 -0
- package/lib/consts/oidc.d.ts +9 -1
- package/lib/consts/oidc.js +5 -0
- package/lib/consts/sentinel.d.ts +10 -0
- package/lib/consts/sentinel.js +10 -0
- package/lib/db-entries/captcha-provider.d.ts +22 -0
- package/lib/db-entries/captcha-provider.js +38 -0
- package/lib/db-entries/index.d.ts +2 -0
- package/lib/db-entries/index.js +2 -0
- package/lib/db-entries/one-time-token.d.ts +28 -0
- package/lib/db-entries/one-time-token.js +50 -0
- package/lib/db-entries/sign-in-experience.d.ts +6 -2
- package/lib/db-entries/sign-in-experience.js +9 -1
- package/lib/foundations/jsonb-types/applications.d.ts +14 -14
- package/lib/foundations/jsonb-types/captcha.d.ts +65 -0
- package/lib/foundations/jsonb-types/captcha.js +21 -0
- package/lib/foundations/jsonb-types/custom-domain.d.ts +4 -4
- package/lib/foundations/jsonb-types/index.d.ts +2 -0
- package/lib/foundations/jsonb-types/index.js +2 -0
- package/lib/foundations/jsonb-types/one-time-tokens.d.ts +18 -0
- package/lib/foundations/jsonb-types/one-time-tokens.js +14 -0
- package/lib/foundations/jsonb-types/saml-application-configs.d.ts +1 -1
- package/lib/foundations/jsonb-types/sentinel.d.ts +8 -1
- package/lib/foundations/jsonb-types/sentinel.js +7 -0
- package/lib/foundations/jsonb-types/sign-in-experience.d.ts +142 -5
- package/lib/foundations/jsonb-types/sign-in-experience.js +26 -0
- package/lib/foundations/jsonb-types/verification-records.d.ts +2 -1
- package/lib/foundations/jsonb-types/verification-records.js +1 -0
- package/lib/types/application.d.ts +8 -8
- package/lib/types/connector.d.ts +35 -3
- package/lib/types/consent.d.ts +4 -4
- package/lib/types/domain.d.ts +2 -2
- package/lib/types/interactions.d.ts +70 -17
- package/lib/types/interactions.js +10 -0
- package/lib/types/log/interaction.d.ts +3 -2
- package/lib/types/log/interaction.js +1 -0
- package/lib/types/logto-config/jwt-customizer.d.ts +23 -23
- package/lib/types/saml-application.d.ts +17 -17
- package/lib/types/sign-in-experience.d.ts +78 -43
- package/lib/types/sign-in-experience.js +7 -0
- package/lib/types/sso-connector.d.ts +2 -2
- package/lib/types/system.d.ts +5 -22
- package/lib/types/system.js +0 -13
- package/package.json +13 -13
- package/tables/captcha_providers.sql +13 -0
- package/tables/one_time_tokens.sql +18 -0
- package/tables/sentinel_activities.sql +3 -0
- package/tables/sign_in_experiences.sql +2 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { connectorMetadataGuard, googleOneTapConfigGuard, } from '@logto/connector-kit';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { SignInExperiences } from '../db-entries/index.js';
|
|
4
|
+
import { CaptchaType } from '../foundations/jsonb-types/index.js';
|
|
4
5
|
import { ssoConnectorMetadataGuard } from './sso-connector.js';
|
|
5
6
|
export const fullSignInExperienceGuard = SignInExperiences.guard.extend({
|
|
6
7
|
socialConnectors: connectorMetadataGuard
|
|
@@ -18,4 +19,10 @@ export const fullSignInExperienceGuard = SignInExperiences.guard.extend({
|
|
|
18
19
|
googleOneTap: googleOneTapConfigGuard
|
|
19
20
|
.extend({ clientId: z.string(), connectorId: z.string() })
|
|
20
21
|
.optional(),
|
|
22
|
+
captchaConfig: z
|
|
23
|
+
.object({
|
|
24
|
+
type: z.nativeEnum(CaptchaType),
|
|
25
|
+
siteKey: z.string(),
|
|
26
|
+
})
|
|
27
|
+
.optional(),
|
|
21
28
|
});
|
|
@@ -114,8 +114,8 @@ export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<z.objectUt
|
|
|
114
114
|
tenantId: string;
|
|
115
115
|
createdAt: number;
|
|
116
116
|
branding: import("../index.js").SsoBranding;
|
|
117
|
-
syncProfile: boolean;
|
|
118
117
|
config: import("@withtyped/server").JsonObject;
|
|
118
|
+
syncProfile: boolean;
|
|
119
119
|
domains: import("../index.js").SsoDomains;
|
|
120
120
|
providerName: SsoProviderName;
|
|
121
121
|
connectorName: string;
|
|
@@ -129,8 +129,8 @@ export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<z.objectUt
|
|
|
129
129
|
tenantId: string;
|
|
130
130
|
createdAt: number;
|
|
131
131
|
branding: import("../index.js").SsoBranding;
|
|
132
|
-
syncProfile: boolean;
|
|
133
132
|
config: import("@withtyped/server").JsonObject;
|
|
133
|
+
syncProfile: boolean;
|
|
134
134
|
domains: import("../index.js").SsoDomains;
|
|
135
135
|
providerName: SsoProviderName;
|
|
136
136
|
connectorName: string;
|
package/lib/types/system.d.ts
CHANGED
|
@@ -67,14 +67,14 @@ export declare const storageProviderDataGuard: z.ZodDiscriminatedUnion<"provider
|
|
|
67
67
|
keyFilename: z.ZodString;
|
|
68
68
|
bucketName: z.ZodString;
|
|
69
69
|
}, "strip", z.ZodTypeAny, {
|
|
70
|
-
provider: StorageProvider.GoogleStorage;
|
|
71
70
|
projectId: string;
|
|
71
|
+
provider: StorageProvider.GoogleStorage;
|
|
72
72
|
keyFilename: string;
|
|
73
73
|
bucketName: string;
|
|
74
74
|
publicUrl?: string | undefined;
|
|
75
75
|
}, {
|
|
76
|
-
provider: StorageProvider.GoogleStorage;
|
|
77
76
|
projectId: string;
|
|
77
|
+
provider: StorageProvider.GoogleStorage;
|
|
78
78
|
keyFilename: string;
|
|
79
79
|
bucketName: string;
|
|
80
80
|
publicUrl?: string | undefined;
|
|
@@ -253,25 +253,8 @@ export type CloudflareType = {
|
|
|
253
253
|
export declare const cloudflareGuard: Readonly<{
|
|
254
254
|
[key in CloudflareKey]: ZodType<CloudflareType[key]>;
|
|
255
255
|
}>;
|
|
256
|
-
export
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
export declare const featureFlagConfigGuard: z.ZodObject<{
|
|
260
|
-
percentage: z.ZodNumber;
|
|
261
|
-
}, "strip", z.ZodTypeAny, {
|
|
262
|
-
percentage: number;
|
|
263
|
-
}, {
|
|
264
|
-
percentage: number;
|
|
265
|
-
}>;
|
|
266
|
-
export type FeatureFlagConfig = z.infer<typeof featureFlagConfigGuard>;
|
|
267
|
-
export type FeatureFlagConfigType = {
|
|
268
|
-
[FeatureFlagConfigKey.NewExperienceFeatureFlag]: FeatureFlagConfig;
|
|
269
|
-
};
|
|
270
|
-
export declare const featureFlagConfigsGuard: Readonly<{
|
|
271
|
-
[key in FeatureFlagConfigKey]: ZodType<FeatureFlagConfigType[key]>;
|
|
272
|
-
}>;
|
|
273
|
-
export type SystemKey = AlterationStateKey | StorageProviderKey | DemoSocialKey | CloudflareKey | EmailServiceProviderKey | FeatureFlagConfigKey;
|
|
274
|
-
export type SystemType = AlterationStateType | StorageProviderType | DemoSocialType | CloudflareType | EmailServiceProviderType | FeatureFlagConfigType;
|
|
275
|
-
export type SystemGuard = typeof alterationStateGuard & typeof storageProviderGuard & typeof demoSocialGuard & typeof cloudflareGuard & typeof emailServiceProviderGuard & typeof featureFlagConfigsGuard;
|
|
256
|
+
export type SystemKey = AlterationStateKey | StorageProviderKey | DemoSocialKey | CloudflareKey | EmailServiceProviderKey;
|
|
257
|
+
export type SystemType = AlterationStateType | StorageProviderType | DemoSocialType | CloudflareType | EmailServiceProviderType;
|
|
258
|
+
export type SystemGuard = typeof alterationStateGuard & typeof storageProviderGuard & typeof demoSocialGuard & typeof cloudflareGuard & typeof emailServiceProviderGuard;
|
|
276
259
|
export declare const systemKeys: readonly SystemKey[];
|
|
277
260
|
export declare const systemGuards: SystemGuard;
|
package/lib/types/system.js
CHANGED
|
@@ -146,24 +146,12 @@ export const cloudflareGuard = Object.freeze({
|
|
|
146
146
|
[CloudflareKey.ProtectedAppHostnameProvider]: hostnameProviderDataGuard,
|
|
147
147
|
[CloudflareKey.CustomJwtWorkerConfig]: customJwtWorkerConfigGuard,
|
|
148
148
|
});
|
|
149
|
-
// A/B Test settings
|
|
150
|
-
export var FeatureFlagConfigKey;
|
|
151
|
-
(function (FeatureFlagConfigKey) {
|
|
152
|
-
FeatureFlagConfigKey["NewExperienceFeatureFlag"] = "newExperienceFeatureFlag";
|
|
153
|
-
})(FeatureFlagConfigKey || (FeatureFlagConfigKey = {}));
|
|
154
|
-
export const featureFlagConfigGuard = z.object({
|
|
155
|
-
percentage: z.number().min(0).max(1),
|
|
156
|
-
});
|
|
157
|
-
export const featureFlagConfigsGuard = Object.freeze({
|
|
158
|
-
[FeatureFlagConfigKey.NewExperienceFeatureFlag]: featureFlagConfigGuard,
|
|
159
|
-
});
|
|
160
149
|
export const systemKeys = Object.freeze([
|
|
161
150
|
...Object.values(AlterationStateKey),
|
|
162
151
|
...Object.values(StorageProviderKey),
|
|
163
152
|
...Object.values(DemoSocialKey),
|
|
164
153
|
...Object.values(CloudflareKey),
|
|
165
154
|
...Object.values(EmailServiceProviderKey),
|
|
166
|
-
...Object.values(FeatureFlagConfigKey),
|
|
167
155
|
]);
|
|
168
156
|
export const systemGuards = Object.freeze({
|
|
169
157
|
...alterationStateGuard,
|
|
@@ -171,5 +159,4 @@ export const systemGuards = Object.freeze({
|
|
|
171
159
|
...demoSocialGuard,
|
|
172
160
|
...cloudflareGuard,
|
|
173
161
|
...emailServiceProviderGuard,
|
|
174
|
-
...featureFlagConfigsGuard,
|
|
175
162
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/schemas",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.0",
|
|
4
4
|
"author": "Silverhand Inc. <contact@silverhand.io>",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"engines": {
|
|
24
|
-
"node": "^
|
|
24
|
+
"node": "^22.14.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@silverhand/eslint-config": "6.0.1",
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"@silverhand/slonik": "31.0.0-beta.2",
|
|
30
30
|
"@silverhand/ts-config": "6.0.0",
|
|
31
31
|
"@types/inquirer": "^9.0.0",
|
|
32
|
-
"@types/node": "^
|
|
32
|
+
"@types/node": "^22.14.0",
|
|
33
33
|
"@types/pluralize": "^0.0.33",
|
|
34
|
-
"@vitest/coverage-v8": "^
|
|
34
|
+
"@vitest/coverage-v8": "^3.1.1",
|
|
35
35
|
"camelcase": "^8.0.0",
|
|
36
36
|
"chalk": "^5.3.0",
|
|
37
37
|
"eslint": "^8.56.0",
|
|
38
38
|
"lint-staged": "^15.0.0",
|
|
39
39
|
"pluralize": "^8.0.0",
|
|
40
|
-
"prettier": "^3.
|
|
40
|
+
"prettier": "^3.5.3",
|
|
41
41
|
"roarr": "^7.11.0",
|
|
42
42
|
"typescript": "^5.5.3",
|
|
43
|
-
"vitest": "^
|
|
43
|
+
"vitest": "^3.1.1"
|
|
44
44
|
},
|
|
45
45
|
"eslintConfig": {
|
|
46
46
|
"extends": "@silverhand",
|
|
@@ -63,17 +63,17 @@
|
|
|
63
63
|
},
|
|
64
64
|
"prettier": "@silverhand/eslint-config/.prettierrc",
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@logto/connector-kit": "^4.
|
|
67
|
-
"@logto/core-kit": "^2.
|
|
68
|
-
"@logto/language-kit": "^1.
|
|
69
|
-
"@logto/phrases": "^1.
|
|
70
|
-
"@logto/phrases-experience": "^1.
|
|
71
|
-
"@logto/shared": "^3.
|
|
66
|
+
"@logto/connector-kit": "^4.3.0",
|
|
67
|
+
"@logto/core-kit": "^2.6.0",
|
|
68
|
+
"@logto/language-kit": "^1.2.0",
|
|
69
|
+
"@logto/phrases": "^1.19.0",
|
|
70
|
+
"@logto/phrases-experience": "^1.10.0",
|
|
71
|
+
"@logto/shared": "^3.2.0",
|
|
72
72
|
"@withtyped/server": "^0.14.0",
|
|
73
73
|
"nanoid": "^5.0.9"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"zod": "^3.
|
|
76
|
+
"zod": "^3.24.2"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
79
|
"precommit": "lint-staged",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
create table captcha_providers (
|
|
2
|
+
tenant_id varchar(21) not null
|
|
3
|
+
references tenants (id) on update cascade on delete cascade,
|
|
4
|
+
id varchar(128) not null,
|
|
5
|
+
config jsonb /* @use CaptchaConfig */ not null default '{}'::jsonb,
|
|
6
|
+
created_at timestamptz not null default(now()),
|
|
7
|
+
updated_at timestamptz not null default(now()),
|
|
8
|
+
primary key (id),
|
|
9
|
+
unique (tenant_id)
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
create index captcha_providers__id
|
|
13
|
+
on captcha_providers (tenant_id, id);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* init_order = 2 */
|
|
2
|
+
|
|
3
|
+
create table one_time_tokens (
|
|
4
|
+
tenant_id varchar(21) not null
|
|
5
|
+
references tenants (id) on update cascade on delete cascade,
|
|
6
|
+
id varchar(21) not null,
|
|
7
|
+
email varchar(128) not null,
|
|
8
|
+
token varchar(256) not null,
|
|
9
|
+
context jsonb /* @use OneTimeTokenContext */ not null default '{}'::jsonb,
|
|
10
|
+
status varchar(64) /* @use OneTimeTokenStatus */ not null default 'active',
|
|
11
|
+
created_at timestamptz not null default(now()),
|
|
12
|
+
expires_at timestamptz not null,
|
|
13
|
+
primary key (id)
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
create index one_time_token__email_status on one_time_tokens (tenant_id, email, status);
|
|
17
|
+
|
|
18
|
+
create unique index one_time_token__token on one_time_tokens (tenant_id, token);
|
|
@@ -28,5 +28,8 @@ create table sentinel_activities (
|
|
|
28
28
|
create index sentinel_activities__id
|
|
29
29
|
on sentinel_activities (tenant_id, id);
|
|
30
30
|
|
|
31
|
+
create index sentinel_activities__target_type_target_hash
|
|
32
|
+
on sentinel_activities (tenant_id, target_type, target_hash);
|
|
33
|
+
|
|
31
34
|
create index sentinel_activities__target_type_target_hash_action_action_result_decision
|
|
32
35
|
on sentinel_activities (tenant_id, target_type, target_hash, action, action_result, decision);
|
|
@@ -26,5 +26,7 @@ create table sign_in_experiences (
|
|
|
26
26
|
support_email text,
|
|
27
27
|
support_website_url text,
|
|
28
28
|
unknown_session_redirect_url text,
|
|
29
|
+
captcha_policy jsonb /* @use CaptchaPolicy */ not null default '{}'::jsonb,
|
|
30
|
+
sentinel_policy jsonb /* @use SentinelPolicy */ not null default '{}'::jsonb,
|
|
29
31
|
primary key (tenant_id, id)
|
|
30
32
|
);
|