@logto/schemas 1.26.0 → 1.28.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.
Files changed (39) hide show
  1. package/alterations/1.27.0-1744013256-add-sentinel-policy-column-to-sie-table.ts +20 -0
  2. package/alterations/1.27.0-1744357867-add-sentinel-activities-hash-index.ts +19 -0
  3. package/alterations/1.28.0-1745735646-add-email-blocklist-policy-column-to-sie-table.ts +20 -0
  4. package/alterations-js/1.27.0-1744013256-add-sentinel-policy-column-to-sie-table.js +16 -0
  5. package/alterations-js/1.27.0-1744357867-add-sentinel-activities-hash-index.js +15 -0
  6. package/alterations-js/1.28.0-1745735646-add-email-blocklist-policy-column-to-sie-table.js +16 -0
  7. package/lib/consts/experience.d.ts +1 -1
  8. package/lib/consts/experience.js +1 -1
  9. package/lib/consts/index.d.ts +1 -0
  10. package/lib/consts/index.js +1 -0
  11. package/lib/consts/sentinel.d.ts +10 -0
  12. package/lib/consts/sentinel.js +10 -0
  13. package/lib/db-entries/sign-in-experience.d.ts +6 -2
  14. package/lib/db-entries/sign-in-experience.js +9 -1
  15. package/lib/foundations/jsonb-types/applications.d.ts +14 -14
  16. package/lib/foundations/jsonb-types/captcha.d.ts +2 -0
  17. package/lib/foundations/jsonb-types/custom-domain.d.ts +4 -4
  18. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +53 -0
  19. package/lib/foundations/jsonb-types/sign-in-experience.js +9 -0
  20. package/lib/types/application.d.ts +13 -97
  21. package/lib/types/connector.d.ts +9 -13
  22. package/lib/types/consent.d.ts +25 -25
  23. package/lib/types/domain.d.ts +2 -2
  24. package/lib/types/hook.d.ts +3 -3
  25. package/lib/types/interactions.d.ts +24 -24
  26. package/lib/types/log/interaction.d.ts +3 -2
  27. package/lib/types/log/interaction.js +1 -0
  28. package/lib/types/logto-config/index.d.ts +15 -16
  29. package/lib/types/logto-config/jwt-customizer.d.ts +35 -36
  30. package/lib/types/saml-application.d.ts +19 -342
  31. package/lib/types/scope.d.ts +3 -3
  32. package/lib/types/sign-in-experience.d.ts +15 -9
  33. package/lib/types/sso-connector.d.ts +4 -5
  34. package/lib/types/system.d.ts +3 -20
  35. package/lib/types/system.js +0 -13
  36. package/lib/types/user.d.ts +3 -3
  37. package/package.json +13 -13
  38. package/tables/sentinel_activities.sql +3 -0
  39. package/tables/sign_in_experiences.sql +2 -0
@@ -1,14 +1,14 @@
1
1
  import { type z } from 'zod';
2
- export declare const scopeResponseGuard: z.ZodObject<z.objectUtil.extendShape<{
2
+ export declare const scopeResponseGuard: z.ZodObject<{
3
3
  tenantId: z.ZodType<string, z.ZodTypeDef, string>;
4
4
  id: z.ZodType<string, z.ZodTypeDef, string>;
5
5
  resourceId: z.ZodType<string, z.ZodTypeDef, string>;
6
6
  name: z.ZodType<string, z.ZodTypeDef, string>;
7
7
  description: z.ZodType<string | null, z.ZodTypeDef, string | null>;
8
8
  createdAt: z.ZodType<number, z.ZodTypeDef, number>;
9
- }, {
9
+ } & {
10
10
  resource: import("../index.js").Guard<import("../db-entries/resource.js").Resource>;
11
- }>, "strip", z.ZodTypeAny, {
11
+ }, "strip", z.ZodTypeAny, {
12
12
  name: string;
13
13
  id: string;
14
14
  tenantId: string;
@@ -34,7 +34,7 @@ export type FullSignInExperience = SignInExperience & {
34
34
  siteKey: string;
35
35
  };
36
36
  };
37
- export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendShape<{
37
+ export declare const fullSignInExperienceGuard: z.ZodObject<{
38
38
  tenantId: z.ZodType<string, z.ZodTypeDef, string>;
39
39
  id: z.ZodType<string, z.ZodTypeDef, string>;
40
40
  color: z.ZodType<{
@@ -134,8 +134,10 @@ export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendS
134
134
  }, z.ZodTypeDef, {
135
135
  enabled?: boolean | undefined;
136
136
  }>;
137
- }, {
138
- socialConnectors: z.ZodArray<z.ZodObject<Omit<z.objectUtil.extendShape<{
137
+ sentinelPolicy: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy>;
138
+ emailBlocklistPolicy: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").EmailBlocklistPolicy, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").EmailBlocklistPolicy>;
139
+ } & {
140
+ socialConnectors: z.ZodArray<z.ZodObject<Omit<{
139
141
  id: z.ZodString;
140
142
  target: z.ZodString;
141
143
  name: z.ZodType<import("@logto/connector-kit").I18nPhrases, z.ZodTypeDef, import("@logto/connector-kit").I18nPhrases>;
@@ -322,10 +324,10 @@ export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendS
322
324
  }>]>, "many">>;
323
325
  customData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
324
326
  fromEmail: z.ZodOptional<z.ZodString>;
325
- }, {
327
+ } & {
326
328
  platform: z.ZodNullable<z.ZodNativeEnum<typeof import("@logto/connector-kit").ConnectorPlatform>>;
327
329
  isStandard: z.ZodOptional<z.ZodBoolean>;
328
- }>, "customData" | "description" | "readme" | "configTemplate" | "formItems">, "strip", z.ZodTypeAny, {
330
+ }, "customData" | "description" | "readme" | "configTemplate" | "formItems">, "strip", z.ZodTypeAny, {
329
331
  name: {
330
332
  en: string;
331
333
  } & {
@@ -631,15 +633,15 @@ export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendS
631
633
  phone: boolean;
632
634
  }>;
633
635
  isDevelopmentTenant: z.ZodBoolean;
634
- googleOneTap: z.ZodOptional<z.ZodObject<z.objectUtil.extendShape<{
636
+ googleOneTap: z.ZodOptional<z.ZodObject<{
635
637
  isEnabled: z.ZodOptional<z.ZodBoolean>;
636
638
  autoSelect: z.ZodOptional<z.ZodBoolean>;
637
639
  closeOnTapOutside: z.ZodOptional<z.ZodBoolean>;
638
640
  itpSupport: z.ZodOptional<z.ZodBoolean>;
639
- }, {
641
+ } & {
640
642
  clientId: z.ZodString;
641
643
  connectorId: z.ZodString;
642
- }>, "strip", z.ZodTypeAny, {
644
+ }, "strip", z.ZodTypeAny, {
643
645
  connectorId: string;
644
646
  clientId: string;
645
647
  isEnabled?: boolean | undefined;
@@ -664,7 +666,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendS
664
666
  type: CaptchaType;
665
667
  siteKey: string;
666
668
  }>>;
667
- }>, "strip", z.ZodTypeAny, {
669
+ }, "strip", z.ZodTypeAny, {
668
670
  id: string;
669
671
  tenantId: string;
670
672
  color: import("../foundations/jsonb-types/sign-in-experience.js").Color;
@@ -688,6 +690,8 @@ export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendS
688
690
  supportWebsiteUrl: string | null;
689
691
  unknownSessionRedirectUrl: string | null;
690
692
  captchaPolicy: import("../foundations/jsonb-types/sign-in-experience.js").CaptchaPolicy;
693
+ sentinelPolicy: import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy;
694
+ emailBlocklistPolicy: import("../foundations/jsonb-types/sign-in-experience.js").EmailBlocklistPolicy;
691
695
  socialConnectors: {
692
696
  name: {
693
697
  en: string;
@@ -875,6 +879,8 @@ export declare const fullSignInExperienceGuard: z.ZodObject<z.objectUtil.extendS
875
879
  supportWebsiteUrl: string | null;
876
880
  unknownSessionRedirectUrl: string | null;
877
881
  captchaPolicy: import("../foundations/jsonb-types/sign-in-experience.js").CaptchaPolicy;
882
+ sentinelPolicy: import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy;
883
+ emailBlocklistPolicy: import("../foundations/jsonb-types/sign-in-experience.js").EmailBlocklistPolicy;
878
884
  socialConnectors: {
879
885
  name: {
880
886
  en: string;
@@ -82,10 +82,9 @@ export declare const ssoConnectorProvidersResponseGuard: z.ZodArray<z.ZodObject<
82
82
  providerType: SsoProviderType;
83
83
  }>, "many">;
84
84
  export type SsoConnectorProvidersResponse = z.infer<typeof ssoConnectorProvidersResponseGuard>;
85
- export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
85
+ export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<{
86
86
  tenantId: z.ZodType<string, z.ZodTypeDef, string>;
87
87
  id: z.ZodType<string, z.ZodTypeDef, string>;
88
- providerName: z.ZodType<string, z.ZodTypeDef, string>;
89
88
  connectorName: z.ZodType<string, z.ZodTypeDef, string>;
90
89
  config: z.ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
91
90
  domains: z.ZodType<string[], z.ZodTypeDef, string[]>;
@@ -100,15 +99,15 @@ export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<z.objectUt
100
99
  }>;
101
100
  syncProfile: z.ZodType<boolean, z.ZodTypeDef, boolean>;
102
101
  createdAt: z.ZodType<number, z.ZodTypeDef, number>;
103
- }, {
102
+ } & {
104
103
  providerName: z.ZodNativeEnum<typeof SsoProviderName>;
105
- }>, {
104
+ } & {
106
105
  name: z.ZodString;
107
106
  providerType: z.ZodNativeEnum<typeof SsoProviderType>;
108
107
  providerLogo: z.ZodString;
109
108
  providerLogoDark: z.ZodString;
110
109
  providerConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
111
- }>, "strip", z.ZodTypeAny, {
110
+ }, "strip", z.ZodTypeAny, {
112
111
  name: string;
113
112
  id: string;
114
113
  tenantId: string;
@@ -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 declare enum FeatureFlagConfigKey {
257
- NewExperienceFeatureFlag = "newExperienceFeatureFlag"
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;
@@ -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
  });
@@ -150,7 +150,7 @@ export declare const userInfoGuard: z.ZodObject<Pick<{
150
150
  lastSignInAt: number | null;
151
151
  }>;
152
152
  export type UserInfo = z.infer<typeof userInfoGuard>;
153
- export declare const userProfileResponseGuard: z.ZodObject<z.objectUtil.extendShape<Pick<{
153
+ export declare const userProfileResponseGuard: z.ZodObject<Pick<{
154
154
  tenantId: z.ZodType<string, z.ZodTypeDef, string>;
155
155
  id: z.ZodType<string, z.ZodTypeDef, string>;
156
156
  username: z.ZodType<string | null, z.ZodTypeDef, string | null>;
@@ -266,10 +266,10 @@ export declare const userProfileResponseGuard: z.ZodObject<z.objectUtil.extendSh
266
266
  lastSignInAt: z.ZodType<number | null, z.ZodTypeDef, number | null>;
267
267
  createdAt: z.ZodType<number, z.ZodTypeDef, number>;
268
268
  updatedAt: z.ZodType<number, z.ZodTypeDef, number>;
269
- }, "name" | "id" | "applicationId" | "username" | "createdAt" | "profile" | "avatar" | "customData" | "identities" | "updatedAt" | "primaryEmail" | "primaryPhone" | "isSuspended" | "lastSignInAt">, {
269
+ }, "name" | "id" | "applicationId" | "username" | "createdAt" | "profile" | "avatar" | "customData" | "identities" | "updatedAt" | "primaryEmail" | "primaryPhone" | "isSuspended" | "lastSignInAt"> & {
270
270
  hasPassword: z.ZodOptional<z.ZodBoolean>;
271
271
  ssoIdentities: z.ZodOptional<z.ZodArray<import("../foundations/schemas.js").Guard<import("../db-entries/user-sso-identity.js").UserSsoIdentity>, "many">>;
272
- }>, "strip", z.ZodTypeAny, {
272
+ }, "strip", z.ZodTypeAny, {
273
273
  name: string | null;
274
274
  id: string;
275
275
  applicationId: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/schemas",
3
- "version": "1.26.0",
3
+ "version": "1.28.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": "^20.9.0"
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": "^20.9.5",
32
+ "@types/node": "^22.14.0",
33
33
  "@types/pluralize": "^0.0.33",
34
- "@vitest/coverage-v8": "^2.1.9",
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.0.0",
40
+ "prettier": "^3.5.3",
41
41
  "roarr": "^7.11.0",
42
42
  "typescript": "^5.5.3",
43
- "vitest": "^2.1.9"
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.2.0",
67
- "@logto/core-kit": "^2.5.4",
68
- "@logto/language-kit": "^1.1.3",
69
- "@logto/phrases": "^1.18.0",
70
- "@logto/phrases-experience": "^1.9.1",
71
- "@logto/shared": "^3.1.4",
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.3.0",
72
72
  "@withtyped/server": "^0.14.0",
73
73
  "nanoid": "^5.0.9"
74
74
  },
75
75
  "peerDependencies": {
76
- "zod": "^3.23.8"
76
+ "zod": "3.24.3"
77
77
  },
78
78
  "scripts": {
79
79
  "precommit": "lint-staged",
@@ -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);
@@ -27,5 +27,7 @@ create table sign_in_experiences (
27
27
  support_website_url text,
28
28
  unknown_session_redirect_url text,
29
29
  captcha_policy jsonb /* @use CaptchaPolicy */ not null default '{}'::jsonb,
30
+ sentinel_policy jsonb /* @use SentinelPolicy */ not null default '{}'::jsonb,
31
+ email_blocklist_policy jsonb /* @use EmailBlocklistPolicy */ not null default '{}'::jsonb,
30
32
  primary key (tenant_id, id)
31
33
  );