@logto/schemas 1.10.0 → 1.10.1

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 (144) hide show
  1. package/alterations/1.10.1-1695647183-update-private-key-type.ts +108 -0
  2. package/alterations/1.10.1-1696657546-organization-tables.ts +150 -0
  3. package/alterations/1.10.1-1697683802-add-sso-connectors-table.ts +66 -0
  4. package/alterations/1.10.1-1698646271-add-organization-created-flag.ts +75 -0
  5. package/alterations/1.10.1-1698820410-add-user-sso-identities-table.ts +61 -0
  6. package/alterations/1.10.1-1698910485-user-logto-data.ts +20 -0
  7. package/alterations-js/1.10.1-1695647183-update-private-key-type.d.ts +3 -0
  8. package/alterations-js/1.10.1-1695647183-update-private-key-type.js +50 -0
  9. package/alterations-js/1.10.1-1696657546-organization-tables.d.ts +3 -0
  10. package/alterations-js/1.10.1-1696657546-organization-tables.js +136 -0
  11. package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.d.ts +3 -0
  12. package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.js +58 -0
  13. package/alterations-js/1.10.1-1698646271-add-organization-created-flag.d.ts +3 -0
  14. package/alterations-js/1.10.1-1698646271-add-organization-created-flag.js +26 -0
  15. package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.d.ts +4 -0
  16. package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.js +53 -0
  17. package/alterations-js/1.10.1-1698910485-user-logto-data.d.ts +3 -0
  18. package/alterations-js/1.10.1-1698910485-user-logto-data.js +16 -0
  19. package/lib/db-entries/application.d.ts +7 -1
  20. package/lib/db-entries/application.js +1 -0
  21. package/lib/db-entries/applications-role.d.ts +7 -1
  22. package/lib/db-entries/applications-role.js +1 -0
  23. package/lib/db-entries/connector.d.ts +7 -1
  24. package/lib/db-entries/connector.js +1 -0
  25. package/lib/db-entries/custom-phrase.d.ts +7 -1
  26. package/lib/db-entries/custom-phrase.js +1 -0
  27. package/lib/db-entries/daily-active-user.d.ts +7 -1
  28. package/lib/db-entries/daily-active-user.js +1 -0
  29. package/lib/db-entries/domain.d.ts +7 -1
  30. package/lib/db-entries/domain.js +1 -0
  31. package/lib/db-entries/hook.d.ts +7 -1
  32. package/lib/db-entries/hook.js +1 -0
  33. package/lib/db-entries/index.d.ts +8 -0
  34. package/lib/db-entries/index.js +8 -0
  35. package/lib/db-entries/log.d.ts +7 -1
  36. package/lib/db-entries/log.js +1 -0
  37. package/lib/db-entries/logto-config.d.ts +10 -4
  38. package/lib/db-entries/logto-config.js +4 -3
  39. package/lib/db-entries/oidc-model-instance.d.ts +7 -1
  40. package/lib/db-entries/oidc-model-instance.js +1 -0
  41. package/lib/db-entries/organization-role-scope-relation.d.ts +20 -0
  42. package/lib/db-entries/organization-role-scope-relation.js +29 -0
  43. package/lib/db-entries/organization-role-user-relation.d.ts +22 -0
  44. package/lib/db-entries/organization-role-user-relation.js +33 -0
  45. package/lib/db-entries/organization-role.d.ts +28 -0
  46. package/lib/db-entries/organization-role.js +33 -0
  47. package/lib/db-entries/organization-scope.d.ts +28 -0
  48. package/lib/db-entries/organization-scope.js +33 -0
  49. package/lib/db-entries/organization-user-relation.d.ts +20 -0
  50. package/lib/db-entries/organization-user-relation.js +29 -0
  51. package/lib/db-entries/organization.d.ts +32 -0
  52. package/lib/db-entries/organization.js +37 -0
  53. package/lib/db-entries/passcode.d.ts +7 -1
  54. package/lib/db-entries/passcode.js +1 -0
  55. package/lib/db-entries/resource.d.ts +7 -1
  56. package/lib/db-entries/resource.js +1 -0
  57. package/lib/db-entries/role.d.ts +7 -1
  58. package/lib/db-entries/role.js +1 -0
  59. package/lib/db-entries/roles-scope.d.ts +7 -1
  60. package/lib/db-entries/roles-scope.js +1 -0
  61. package/lib/db-entries/scope.d.ts +7 -1
  62. package/lib/db-entries/scope.js +1 -0
  63. package/lib/db-entries/sentinel-activity.d.ts +7 -1
  64. package/lib/db-entries/sentinel-activity.js +1 -0
  65. package/lib/db-entries/service-log.d.ts +7 -1
  66. package/lib/db-entries/service-log.js +1 -0
  67. package/lib/db-entries/sign-in-experience.d.ts +7 -1
  68. package/lib/db-entries/sign-in-experience.js +1 -0
  69. package/lib/db-entries/sso-connector.d.ts +50 -0
  70. package/lib/db-entries/sso-connector.js +58 -0
  71. package/lib/db-entries/system.d.ts +7 -1
  72. package/lib/db-entries/system.js +1 -0
  73. package/lib/db-entries/user-sso-identity.d.ts +30 -0
  74. package/lib/db-entries/user-sso-identity.js +46 -0
  75. package/lib/db-entries/user.d.ts +9 -1
  76. package/lib/db-entries/user.js +5 -0
  77. package/lib/db-entries/users-role.d.ts +7 -1
  78. package/lib/db-entries/users-role.js +1 -0
  79. package/lib/db-entries/verification-status.d.ts +7 -1
  80. package/lib/db-entries/verification-status.js +1 -0
  81. package/lib/foundations/index.d.ts +1 -1
  82. package/lib/foundations/index.js +1 -1
  83. package/lib/foundations/jsonb-types/custom-domain.d.ts +134 -0
  84. package/lib/foundations/jsonb-types/custom-domain.js +36 -0
  85. package/lib/foundations/jsonb-types/hooks.d.ts +32 -0
  86. package/lib/foundations/jsonb-types/hooks.js +24 -0
  87. package/lib/foundations/jsonb-types/index.d.ts +15 -0
  88. package/lib/foundations/jsonb-types/index.js +16 -0
  89. package/lib/foundations/jsonb-types/logs.d.ts +106 -0
  90. package/lib/foundations/jsonb-types/logs.js +20 -0
  91. package/lib/foundations/jsonb-types/oidc-module.d.ts +80 -0
  92. package/lib/foundations/jsonb-types/oidc-module.js +54 -0
  93. package/lib/foundations/jsonb-types/phrases.d.ts +5 -0
  94. package/lib/foundations/jsonb-types/phrases.js +2 -0
  95. package/lib/foundations/jsonb-types/sentinel.d.ts +27 -0
  96. package/lib/foundations/jsonb-types/sentinel.js +28 -0
  97. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +118 -0
  98. package/lib/foundations/jsonb-types/sign-in-experience.js +56 -0
  99. package/lib/foundations/jsonb-types/sso-connector.d.ts +14 -0
  100. package/lib/foundations/jsonb-types/sso-connector.js +6 -0
  101. package/lib/foundations/jsonb-types/users.d.ts +285 -0
  102. package/lib/foundations/jsonb-types/users.js +47 -0
  103. package/lib/foundations/schemas.d.ts +11 -13
  104. package/lib/models/tenants.d.ts +7 -11
  105. package/lib/seeds/logto-config.js +1 -0
  106. package/lib/types/application.d.ts +51 -1
  107. package/lib/types/application.js +7 -1
  108. package/lib/types/connector.d.ts +516 -2360
  109. package/lib/types/domain.d.ts +65 -27
  110. package/lib/types/hook.d.ts +15 -16
  111. package/lib/types/index.d.ts +3 -0
  112. package/lib/types/index.js +3 -0
  113. package/lib/types/interactions.d.ts +502 -10
  114. package/lib/types/interactions.js +83 -5
  115. package/lib/types/log/interaction.d.ts +4 -3
  116. package/lib/types/log/interaction.js +1 -0
  117. package/lib/types/logto-config.d.ts +50 -2
  118. package/lib/types/logto-config.js +30 -3
  119. package/lib/types/mfa.d.ts +211 -0
  120. package/lib/types/mfa.js +62 -0
  121. package/lib/types/organization.d.ts +44 -0
  122. package/lib/types/organization.js +20 -0
  123. package/lib/types/role.d.ts +5 -3
  124. package/lib/types/scope.d.ts +12 -27
  125. package/lib/types/sso-connector.d.ts +21 -0
  126. package/lib/types/sso-connector.js +10 -0
  127. package/lib/types/system.d.ts +26 -7
  128. package/lib/types/system.js +8 -0
  129. package/lib/types/user-assets.d.ts +2 -2
  130. package/lib/types/user.d.ts +209 -66
  131. package/lib/types/user.js +8 -2
  132. package/package.json +6 -6
  133. package/tables/logto_configs.sql +1 -1
  134. package/tables/organization_role_scope_relations.sql +12 -0
  135. package/tables/organization_role_user_relations.sql +14 -0
  136. package/tables/organization_roles.sql +19 -0
  137. package/tables/organization_scopes.sql +19 -0
  138. package/tables/organization_user_relations.sql +12 -0
  139. package/tables/organizations.sql +19 -0
  140. package/tables/sso_connectors.sql +29 -0
  141. package/tables/user_sso_identities.sql +17 -0
  142. package/tables/users.sql +1 -0
  143. package/lib/foundations/jsonb-types.d.ts +0 -673
  144. package/lib/foundations/jsonb-types.js +0 -260
@@ -0,0 +1,27 @@
1
+ import { z } from 'zod';
2
+ /** The action target type of a sentinel activity. */
3
+ export declare enum SentinelActivityTargetType {
4
+ User = "User",
5
+ App = "App"
6
+ }
7
+ export declare const sentinelActivityTargetTypeGuard: z.ZodNativeEnum<typeof SentinelActivityTargetType>;
8
+ /** The action type of a sentinel activity. */
9
+ export declare enum SentinelActivityAction {
10
+ /**
11
+ * The subject tries to pass a verification by inputting a password.
12
+ *
13
+ * For example, a user (subject) who inputted a password (action) to authenticate themselves
14
+ * (target).
15
+ */
16
+ Password = "Password",
17
+ /**
18
+ * The subject tries to pass a verification by inputting a verification code.
19
+ *
20
+ * For example, a user (subject) who inputted a verification code (action) to authenticate
21
+ * themselves (target).
22
+ */
23
+ VerificationCode = "VerificationCode"
24
+ }
25
+ export declare const sentinelActivityActionGuard: z.ZodNativeEnum<typeof SentinelActivityAction>;
26
+ export type SentinelActivityPayload = Record<string, unknown>;
27
+ export declare const sentinelActivityPayloadGuard: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ /** The action target type of a sentinel activity. */
3
+ export var SentinelActivityTargetType;
4
+ (function (SentinelActivityTargetType) {
5
+ SentinelActivityTargetType["User"] = "User";
6
+ SentinelActivityTargetType["App"] = "App";
7
+ })(SentinelActivityTargetType || (SentinelActivityTargetType = {}));
8
+ export const sentinelActivityTargetTypeGuard = z.nativeEnum(SentinelActivityTargetType);
9
+ /** The action type of a sentinel activity. */
10
+ export var SentinelActivityAction;
11
+ (function (SentinelActivityAction) {
12
+ /**
13
+ * The subject tries to pass a verification by inputting a password.
14
+ *
15
+ * For example, a user (subject) who inputted a password (action) to authenticate themselves
16
+ * (target).
17
+ */
18
+ SentinelActivityAction["Password"] = "Password";
19
+ /**
20
+ * The subject tries to pass a verification by inputting a verification code.
21
+ *
22
+ * For example, a user (subject) who inputted a verification code (action) to authenticate
23
+ * themselves (target).
24
+ */
25
+ SentinelActivityAction["VerificationCode"] = "VerificationCode";
26
+ })(SentinelActivityAction || (SentinelActivityAction = {}));
27
+ export const sentinelActivityActionGuard = z.nativeEnum(SentinelActivityAction);
28
+ export const sentinelActivityPayloadGuard = z.record(z.unknown());
@@ -0,0 +1,118 @@
1
+ import { z } from 'zod';
2
+ export declare const colorGuard: z.ZodObject<{
3
+ primaryColor: z.ZodString;
4
+ isDarkModeEnabled: z.ZodBoolean;
5
+ darkPrimaryColor: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ primaryColor: string;
8
+ isDarkModeEnabled: boolean;
9
+ darkPrimaryColor: string;
10
+ }, {
11
+ primaryColor: string;
12
+ isDarkModeEnabled: boolean;
13
+ darkPrimaryColor: string;
14
+ }>;
15
+ export type Color = z.infer<typeof colorGuard>;
16
+ export declare const brandingGuard: z.ZodObject<{
17
+ logoUrl: z.ZodOptional<z.ZodString>;
18
+ darkLogoUrl: z.ZodOptional<z.ZodString>;
19
+ favicon: z.ZodOptional<z.ZodString>;
20
+ }, "strip", z.ZodTypeAny, {
21
+ logoUrl?: string | undefined;
22
+ darkLogoUrl?: string | undefined;
23
+ favicon?: string | undefined;
24
+ }, {
25
+ logoUrl?: string | undefined;
26
+ darkLogoUrl?: string | undefined;
27
+ favicon?: string | undefined;
28
+ }>;
29
+ export type Branding = z.infer<typeof brandingGuard>;
30
+ export declare const languageInfoGuard: z.ZodObject<{
31
+ autoDetect: z.ZodBoolean;
32
+ fallbackLanguage: z.ZodType<"af-ZA" | "am-ET" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "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" | "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-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-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "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" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "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" | "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-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-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "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">;
33
+ }, "strip", z.ZodTypeAny, {
34
+ autoDetect: boolean;
35
+ fallbackLanguage: "af-ZA" | "am-ET" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "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" | "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-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-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "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";
36
+ }, {
37
+ autoDetect: boolean;
38
+ fallbackLanguage: "af-ZA" | "am-ET" | "ar-AR" | "as-IN" | "az-AZ" | "be-BY" | "bg-BG" | "bn-IN" | "br-FR" | "bs-BA" | "ca-ES" | "cb-IQ" | "co-FR" | "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" | "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-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-SE" | "sw-KE" | "sy-SY" | "sz-PL" | "ta-IN" | "te-IN" | "tg-TJ" | "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";
39
+ }>;
40
+ export type LanguageInfo = z.infer<typeof languageInfoGuard>;
41
+ export declare enum SignInIdentifier {
42
+ Username = "username",
43
+ Email = "email",
44
+ Phone = "phone"
45
+ }
46
+ export declare const signUpGuard: z.ZodObject<{
47
+ identifiers: z.ZodArray<z.ZodNativeEnum<typeof SignInIdentifier>, "many">;
48
+ password: z.ZodBoolean;
49
+ verify: z.ZodBoolean;
50
+ }, "strip", z.ZodTypeAny, {
51
+ identifiers: SignInIdentifier[];
52
+ password: boolean;
53
+ verify: boolean;
54
+ }, {
55
+ identifiers: SignInIdentifier[];
56
+ password: boolean;
57
+ verify: boolean;
58
+ }>;
59
+ export type SignUp = z.infer<typeof signUpGuard>;
60
+ export declare const signInGuard: z.ZodObject<{
61
+ methods: z.ZodArray<z.ZodObject<{
62
+ identifier: z.ZodNativeEnum<typeof SignInIdentifier>;
63
+ password: z.ZodBoolean;
64
+ verificationCode: z.ZodBoolean;
65
+ isPasswordPrimary: z.ZodBoolean;
66
+ }, "strip", z.ZodTypeAny, {
67
+ password: boolean;
68
+ identifier: SignInIdentifier;
69
+ verificationCode: boolean;
70
+ isPasswordPrimary: boolean;
71
+ }, {
72
+ password: boolean;
73
+ identifier: SignInIdentifier;
74
+ verificationCode: boolean;
75
+ isPasswordPrimary: boolean;
76
+ }>, "many">;
77
+ }, "strip", z.ZodTypeAny, {
78
+ methods: {
79
+ password: boolean;
80
+ identifier: SignInIdentifier;
81
+ verificationCode: boolean;
82
+ isPasswordPrimary: boolean;
83
+ }[];
84
+ }, {
85
+ methods: {
86
+ password: boolean;
87
+ identifier: SignInIdentifier;
88
+ verificationCode: boolean;
89
+ isPasswordPrimary: boolean;
90
+ }[];
91
+ }>;
92
+ export type SignIn = z.infer<typeof signInGuard>;
93
+ export declare const connectorTargetsGuard: z.ZodArray<z.ZodString, "many">;
94
+ export type ConnectorTargets = z.infer<typeof connectorTargetsGuard>;
95
+ export declare const customContentGuard: z.ZodRecord<z.ZodString, z.ZodString>;
96
+ export type CustomContent = z.infer<typeof customContentGuard>;
97
+ export declare enum MfaFactor {
98
+ TOTP = "Totp",
99
+ WebAuthn = "WebAuthn",
100
+ BackupCode = "BackupCode"
101
+ }
102
+ export declare const mfaFactorsGuard: z.ZodArray<z.ZodNativeEnum<typeof MfaFactor>, "many">;
103
+ export type MfaFactors = z.infer<typeof mfaFactorsGuard>;
104
+ export declare enum MfaPolicy {
105
+ UserControlled = "UserControlled",
106
+ Mandatory = "Mandatory"
107
+ }
108
+ export declare const mfaGuard: z.ZodObject<{
109
+ factors: z.ZodArray<z.ZodNativeEnum<typeof MfaFactor>, "many">;
110
+ policy: z.ZodNativeEnum<typeof MfaPolicy>;
111
+ }, "strip", z.ZodTypeAny, {
112
+ factors: MfaFactor[];
113
+ policy: MfaPolicy;
114
+ }, {
115
+ factors: MfaFactor[];
116
+ policy: MfaPolicy;
117
+ }>;
118
+ export type Mfa = z.infer<typeof mfaGuard>;
@@ -0,0 +1,56 @@
1
+ import { hexColorRegEx } from '@logto/core-kit';
2
+ import { languageTagGuard } from '@logto/language-kit';
3
+ import { z } from 'zod';
4
+ export const colorGuard = z.object({
5
+ primaryColor: z.string().regex(hexColorRegEx),
6
+ isDarkModeEnabled: z.boolean(),
7
+ darkPrimaryColor: z.string().regex(hexColorRegEx),
8
+ });
9
+ export const brandingGuard = z.object({
10
+ logoUrl: z.string().url().optional(),
11
+ darkLogoUrl: z.string().url().optional(),
12
+ favicon: z.string().url().optional(),
13
+ });
14
+ export const languageInfoGuard = z.object({
15
+ autoDetect: z.boolean(),
16
+ fallbackLanguage: languageTagGuard,
17
+ });
18
+ export var SignInIdentifier;
19
+ (function (SignInIdentifier) {
20
+ SignInIdentifier["Username"] = "username";
21
+ SignInIdentifier["Email"] = "email";
22
+ SignInIdentifier["Phone"] = "phone";
23
+ })(SignInIdentifier || (SignInIdentifier = {}));
24
+ export const signUpGuard = z.object({
25
+ identifiers: z.nativeEnum(SignInIdentifier).array(),
26
+ password: z.boolean(),
27
+ verify: z.boolean(),
28
+ });
29
+ export const signInGuard = z.object({
30
+ methods: z
31
+ .object({
32
+ identifier: z.nativeEnum(SignInIdentifier),
33
+ password: z.boolean(),
34
+ verificationCode: z.boolean(),
35
+ isPasswordPrimary: z.boolean(),
36
+ })
37
+ .array(),
38
+ });
39
+ export const connectorTargetsGuard = z.string().array();
40
+ export const customContentGuard = z.record(z.string());
41
+ export var MfaFactor;
42
+ (function (MfaFactor) {
43
+ MfaFactor["TOTP"] = "Totp";
44
+ MfaFactor["WebAuthn"] = "WebAuthn";
45
+ MfaFactor["BackupCode"] = "BackupCode";
46
+ })(MfaFactor || (MfaFactor = {}));
47
+ export const mfaFactorsGuard = z.nativeEnum(MfaFactor).array();
48
+ export var MfaPolicy;
49
+ (function (MfaPolicy) {
50
+ MfaPolicy["UserControlled"] = "UserControlled";
51
+ MfaPolicy["Mandatory"] = "Mandatory";
52
+ })(MfaPolicy || (MfaPolicy = {}));
53
+ export const mfaGuard = z.object({
54
+ factors: mfaFactorsGuard,
55
+ policy: z.nativeEnum(MfaPolicy),
56
+ });
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ export declare const ssoDomainsGuard: z.ZodArray<z.ZodString, "many">;
3
+ export type SsoDomains = z.infer<typeof ssoDomainsGuard>;
4
+ export declare const ssoBrandingGuard: z.ZodObject<{
5
+ logo: z.ZodOptional<z.ZodString>;
6
+ darkLogo: z.ZodOptional<z.ZodString>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ logo?: string | undefined;
9
+ darkLogo?: string | undefined;
10
+ }, {
11
+ logo?: string | undefined;
12
+ darkLogo?: string | undefined;
13
+ }>;
14
+ export type SsoBranding = z.infer<typeof ssoBrandingGuard>;
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ export const ssoDomainsGuard = z.array(z.string());
3
+ export const ssoBrandingGuard = z.object({
4
+ logo: z.string().optional(),
5
+ darkLogo: z.string().optional(),
6
+ });
@@ -0,0 +1,285 @@
1
+ import { z } from 'zod';
2
+ import { MfaFactor } from './sign-in-experience.js';
3
+ export declare const roleNamesGuard: z.ZodArray<z.ZodString, "many">;
4
+ declare const identityGuard: z.ZodObject<{
5
+ userId: z.ZodString;
6
+ details: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ userId: string;
9
+ details?: {} | undefined;
10
+ }, {
11
+ userId: string;
12
+ details?: {} | undefined;
13
+ }>;
14
+ export declare const identitiesGuard: z.ZodRecord<z.ZodString, z.ZodObject<{
15
+ userId: z.ZodString;
16
+ details: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ userId: string;
19
+ details?: {} | undefined;
20
+ }, {
21
+ userId: string;
22
+ details?: {} | undefined;
23
+ }>>;
24
+ export type Identity = z.infer<typeof identityGuard>;
25
+ export type Identities = z.infer<typeof identitiesGuard>;
26
+ export declare const baseMfaVerification: {
27
+ id: z.ZodString;
28
+ createdAt: z.ZodString;
29
+ lastUsedAt: z.ZodOptional<z.ZodString>;
30
+ };
31
+ export declare const mfaVerificationTotp: z.ZodObject<{
32
+ key: z.ZodString;
33
+ id: z.ZodString;
34
+ createdAt: z.ZodString;
35
+ lastUsedAt: z.ZodOptional<z.ZodString>;
36
+ type: z.ZodLiteral<MfaFactor.TOTP>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ type: MfaFactor.TOTP;
39
+ id: string;
40
+ key: string;
41
+ createdAt: string;
42
+ lastUsedAt?: string | undefined;
43
+ }, {
44
+ type: MfaFactor.TOTP;
45
+ id: string;
46
+ key: string;
47
+ createdAt: string;
48
+ lastUsedAt?: string | undefined;
49
+ }>;
50
+ export type MfaVerificationTotp = z.infer<typeof mfaVerificationTotp>;
51
+ export declare const webAuthnTransportGuard: z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>;
52
+ export declare const mfaVerificationWebAuthn: z.ZodObject<{
53
+ credentialId: z.ZodString;
54
+ publicKey: z.ZodString;
55
+ transports: z.ZodOptional<z.ZodArray<z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>, "many">>;
56
+ counter: z.ZodNumber;
57
+ agent: z.ZodString;
58
+ id: z.ZodString;
59
+ createdAt: z.ZodString;
60
+ lastUsedAt: z.ZodOptional<z.ZodString>;
61
+ type: z.ZodLiteral<MfaFactor.WebAuthn>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ type: MfaFactor.WebAuthn;
64
+ id: string;
65
+ createdAt: string;
66
+ credentialId: string;
67
+ publicKey: string;
68
+ counter: number;
69
+ agent: string;
70
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
71
+ lastUsedAt?: string | undefined;
72
+ }, {
73
+ type: MfaFactor.WebAuthn;
74
+ id: string;
75
+ createdAt: string;
76
+ credentialId: string;
77
+ publicKey: string;
78
+ counter: number;
79
+ agent: string;
80
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
81
+ lastUsedAt?: string | undefined;
82
+ }>;
83
+ export type MfaVerificationWebAuthn = z.infer<typeof mfaVerificationWebAuthn>;
84
+ export declare const mfaVerificationBackupCode: z.ZodObject<{
85
+ codes: z.ZodArray<z.ZodObject<{
86
+ code: z.ZodString;
87
+ usedAt: z.ZodOptional<z.ZodString>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ code: string;
90
+ usedAt?: string | undefined;
91
+ }, {
92
+ code: string;
93
+ usedAt?: string | undefined;
94
+ }>, "many">;
95
+ id: z.ZodString;
96
+ createdAt: z.ZodString;
97
+ lastUsedAt: z.ZodOptional<z.ZodString>;
98
+ type: z.ZodLiteral<MfaFactor.BackupCode>;
99
+ }, "strip", z.ZodTypeAny, {
100
+ type: MfaFactor.BackupCode;
101
+ id: string;
102
+ createdAt: string;
103
+ codes: {
104
+ code: string;
105
+ usedAt?: string | undefined;
106
+ }[];
107
+ lastUsedAt?: string | undefined;
108
+ }, {
109
+ type: MfaFactor.BackupCode;
110
+ id: string;
111
+ createdAt: string;
112
+ codes: {
113
+ code: string;
114
+ usedAt?: string | undefined;
115
+ }[];
116
+ lastUsedAt?: string | undefined;
117
+ }>;
118
+ export type MfaVerificationBackupCode = z.infer<typeof mfaVerificationBackupCode>;
119
+ export declare const mfaVerificationGuard: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
120
+ key: z.ZodString;
121
+ id: z.ZodString;
122
+ createdAt: z.ZodString;
123
+ lastUsedAt: z.ZodOptional<z.ZodString>;
124
+ type: z.ZodLiteral<MfaFactor.TOTP>;
125
+ }, "strip", z.ZodTypeAny, {
126
+ type: MfaFactor.TOTP;
127
+ id: string;
128
+ key: string;
129
+ createdAt: string;
130
+ lastUsedAt?: string | undefined;
131
+ }, {
132
+ type: MfaFactor.TOTP;
133
+ id: string;
134
+ key: string;
135
+ createdAt: string;
136
+ lastUsedAt?: string | undefined;
137
+ }>, z.ZodObject<{
138
+ credentialId: z.ZodString;
139
+ publicKey: z.ZodString;
140
+ transports: z.ZodOptional<z.ZodArray<z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>, "many">>;
141
+ counter: z.ZodNumber;
142
+ agent: z.ZodString;
143
+ id: z.ZodString;
144
+ createdAt: z.ZodString;
145
+ lastUsedAt: z.ZodOptional<z.ZodString>;
146
+ type: z.ZodLiteral<MfaFactor.WebAuthn>;
147
+ }, "strip", z.ZodTypeAny, {
148
+ type: MfaFactor.WebAuthn;
149
+ id: string;
150
+ createdAt: string;
151
+ credentialId: string;
152
+ publicKey: string;
153
+ counter: number;
154
+ agent: string;
155
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
156
+ lastUsedAt?: string | undefined;
157
+ }, {
158
+ type: MfaFactor.WebAuthn;
159
+ id: string;
160
+ createdAt: string;
161
+ credentialId: string;
162
+ publicKey: string;
163
+ counter: number;
164
+ agent: string;
165
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
166
+ lastUsedAt?: string | undefined;
167
+ }>, z.ZodObject<{
168
+ codes: z.ZodArray<z.ZodObject<{
169
+ code: z.ZodString;
170
+ usedAt: z.ZodOptional<z.ZodString>;
171
+ }, "strip", z.ZodTypeAny, {
172
+ code: string;
173
+ usedAt?: string | undefined;
174
+ }, {
175
+ code: string;
176
+ usedAt?: string | undefined;
177
+ }>, "many">;
178
+ id: z.ZodString;
179
+ createdAt: z.ZodString;
180
+ lastUsedAt: z.ZodOptional<z.ZodString>;
181
+ type: z.ZodLiteral<MfaFactor.BackupCode>;
182
+ }, "strip", z.ZodTypeAny, {
183
+ type: MfaFactor.BackupCode;
184
+ id: string;
185
+ createdAt: string;
186
+ codes: {
187
+ code: string;
188
+ usedAt?: string | undefined;
189
+ }[];
190
+ lastUsedAt?: string | undefined;
191
+ }, {
192
+ type: MfaFactor.BackupCode;
193
+ id: string;
194
+ createdAt: string;
195
+ codes: {
196
+ code: string;
197
+ usedAt?: string | undefined;
198
+ }[];
199
+ lastUsedAt?: string | undefined;
200
+ }>]>;
201
+ export type MfaVerification = z.infer<typeof mfaVerificationGuard>;
202
+ export declare const mfaVerificationsGuard: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
203
+ key: z.ZodString;
204
+ id: z.ZodString;
205
+ createdAt: z.ZodString;
206
+ lastUsedAt: z.ZodOptional<z.ZodString>;
207
+ type: z.ZodLiteral<MfaFactor.TOTP>;
208
+ }, "strip", z.ZodTypeAny, {
209
+ type: MfaFactor.TOTP;
210
+ id: string;
211
+ key: string;
212
+ createdAt: string;
213
+ lastUsedAt?: string | undefined;
214
+ }, {
215
+ type: MfaFactor.TOTP;
216
+ id: string;
217
+ key: string;
218
+ createdAt: string;
219
+ lastUsedAt?: string | undefined;
220
+ }>, z.ZodObject<{
221
+ credentialId: z.ZodString;
222
+ publicKey: z.ZodString;
223
+ transports: z.ZodOptional<z.ZodArray<z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>, "many">>;
224
+ counter: z.ZodNumber;
225
+ agent: z.ZodString;
226
+ id: z.ZodString;
227
+ createdAt: z.ZodString;
228
+ lastUsedAt: z.ZodOptional<z.ZodString>;
229
+ type: z.ZodLiteral<MfaFactor.WebAuthn>;
230
+ }, "strip", z.ZodTypeAny, {
231
+ type: MfaFactor.WebAuthn;
232
+ id: string;
233
+ createdAt: string;
234
+ credentialId: string;
235
+ publicKey: string;
236
+ counter: number;
237
+ agent: string;
238
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
239
+ lastUsedAt?: string | undefined;
240
+ }, {
241
+ type: MfaFactor.WebAuthn;
242
+ id: string;
243
+ createdAt: string;
244
+ credentialId: string;
245
+ publicKey: string;
246
+ counter: number;
247
+ agent: string;
248
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
249
+ lastUsedAt?: string | undefined;
250
+ }>, z.ZodObject<{
251
+ codes: z.ZodArray<z.ZodObject<{
252
+ code: z.ZodString;
253
+ usedAt: z.ZodOptional<z.ZodString>;
254
+ }, "strip", z.ZodTypeAny, {
255
+ code: string;
256
+ usedAt?: string | undefined;
257
+ }, {
258
+ code: string;
259
+ usedAt?: string | undefined;
260
+ }>, "many">;
261
+ id: z.ZodString;
262
+ createdAt: z.ZodString;
263
+ lastUsedAt: z.ZodOptional<z.ZodString>;
264
+ type: z.ZodLiteral<MfaFactor.BackupCode>;
265
+ }, "strip", z.ZodTypeAny, {
266
+ type: MfaFactor.BackupCode;
267
+ id: string;
268
+ createdAt: string;
269
+ codes: {
270
+ code: string;
271
+ usedAt?: string | undefined;
272
+ }[];
273
+ lastUsedAt?: string | undefined;
274
+ }, {
275
+ type: MfaFactor.BackupCode;
276
+ id: string;
277
+ createdAt: string;
278
+ codes: {
279
+ code: string;
280
+ usedAt?: string | undefined;
281
+ }[];
282
+ lastUsedAt?: string | undefined;
283
+ }>]>, "many">;
284
+ export type MfaVerifications = z.infer<typeof mfaVerificationsGuard>;
285
+ export {};
@@ -0,0 +1,47 @@
1
+ import { z } from 'zod';
2
+ import { MfaFactor } from './sign-in-experience.js';
3
+ export const roleNamesGuard = z.string().array();
4
+ const identityGuard = z.object({
5
+ userId: z.string(),
6
+ details: z.object({}).optional(), // Connector's userinfo details, schemaless
7
+ });
8
+ export const identitiesGuard = z.record(identityGuard);
9
+ export const baseMfaVerification = {
10
+ id: z.string(),
11
+ createdAt: z.string(),
12
+ lastUsedAt: z.string().optional(),
13
+ };
14
+ export const mfaVerificationTotp = z.object({
15
+ type: z.literal(MfaFactor.TOTP),
16
+ ...baseMfaVerification,
17
+ key: z.string(),
18
+ });
19
+ export const webAuthnTransportGuard = z.enum([
20
+ 'usb',
21
+ 'nfc',
22
+ 'ble',
23
+ 'internal',
24
+ 'cable',
25
+ 'hybrid',
26
+ 'smart-card',
27
+ ]);
28
+ export const mfaVerificationWebAuthn = z.object({
29
+ type: z.literal(MfaFactor.WebAuthn),
30
+ ...baseMfaVerification,
31
+ credentialId: z.string(),
32
+ publicKey: z.string(),
33
+ transports: webAuthnTransportGuard.array().optional(),
34
+ counter: z.number(),
35
+ agent: z.string(),
36
+ });
37
+ export const mfaVerificationBackupCode = z.object({
38
+ type: z.literal(MfaFactor.BackupCode),
39
+ ...baseMfaVerification,
40
+ codes: z.object({ code: z.string(), usedAt: z.string().optional() }).array(),
41
+ });
42
+ export const mfaVerificationGuard = z.discriminatedUnion('type', [
43
+ mfaVerificationTotp,
44
+ mfaVerificationWebAuthn,
45
+ mfaVerificationBackupCode,
46
+ ]);
47
+ export const mfaVerificationsGuard = mfaVerificationGuard.array();
@@ -1,20 +1,18 @@
1
1
  import { type SchemaLike } from '@logto/shared/universal';
2
- import type { ZodObject, ZodType, ZodOptional } from 'zod';
2
+ import type { ZodObject, ZodType, ZodOptional, ZodTypeAny } from 'zod';
3
3
  export type { SchemaLike, SchemaValue, SchemaValuePrimitive } from '@logto/shared/universal';
4
4
  type ParseOptional<K> = undefined extends K ? ZodOptional<ZodType<Exclude<K, undefined>>> : ZodType<K>;
5
- export type CreateGuard<T extends Record<string, unknown>> = ZodObject<{
5
+ export type Guard<T extends SchemaLike<string>> = ZodObject<{
6
6
  [key in keyof T]-?: ParseOptional<T[key]>;
7
- }>;
8
- export type Guard<T extends Record<string, unknown>> = ZodObject<{
9
- [key in keyof T]: ZodType<T[key]>;
10
- }>;
11
- export type GeneratedSchema<CreateSchema extends SchemaLike, Schema extends CreateSchema> = keyof Schema extends string ? Readonly<{
12
- table: string;
13
- tableSingular: string;
7
+ }, 'strip', ZodTypeAny, T, T>;
8
+ export type GeneratedSchema<Key extends string, CreateSchema extends Partial<SchemaLike<Key>>, Schema extends SchemaLike<Key>, Table extends string = string, TableSingular extends string = string> = Readonly<{
9
+ table: Table;
10
+ tableSingular: TableSingular;
14
11
  fields: {
15
- [key in keyof Required<Schema>]: string;
12
+ [key in Key]: string;
16
13
  };
17
- fieldKeys: ReadonlyArray<keyof Schema>;
18
- createGuard: CreateGuard<CreateSchema>;
14
+ fieldKeys: readonly Key[];
15
+ createGuard: Guard<CreateSchema>;
19
16
  guard: Guard<Schema>;
20
- }> : never;
17
+ updateGuard: Guard<Partial<Schema>>;
18
+ }>;
@@ -13,27 +13,23 @@ export declare const Tenants: import("@withtyped/server/model").default<"tenants
13
13
  tag: TenantTag;
14
14
  createdAt: Date;
15
15
  isSuspended: boolean;
16
- }, "createdAt" | "name" | "isSuspended" | "tag", "createdAt">;
16
+ }, "name" | "createdAt" | "isSuspended" | "tag", "createdAt">;
17
17
  export type TenantModel = InferModelType<typeof Tenants>;
18
- export declare const tenantInfoGuard: z.ZodObject<z.extendShape<Pick<{
19
- id: z.ZodType<string, z.ZodTypeDef, string>;
20
- dbUser: z.ZodType<string | null, z.ZodTypeDef, string | null>;
21
- dbUserPassword: z.ZodType<string | null, z.ZodTypeDef, string | null>;
18
+ export declare const tenantInfoGuard: z.ZodObject<{
22
19
  name: z.ZodType<string, z.ZodTypeDef, string>;
23
- tag: z.ZodType<TenantTag, z.ZodTypeDef, TenantTag>;
24
- createdAt: z.ZodType<Date, z.ZodTypeDef, Date>;
20
+ id: z.ZodType<string, z.ZodTypeDef, string>;
25
21
  isSuspended: z.ZodType<boolean, z.ZodTypeDef, boolean>;
26
- }, "id" | "name" | "isSuspended" | "tag">, {
22
+ tag: z.ZodType<TenantTag, z.ZodTypeDef, TenantTag>;
27
23
  indicator: z.ZodString;
28
- }>, "strip", z.ZodTypeAny, {
29
- id: string;
24
+ }, z.UnknownKeysParam, z.ZodTypeAny, {
30
25
  name: string;
26
+ id: string;
31
27
  indicator: string;
32
28
  isSuspended: boolean;
33
29
  tag: TenantTag;
34
30
  }, {
35
- id: string;
36
31
  name: string;
32
+ id: string;
37
33
  indicator: string;
38
34
  isSuspended: boolean;
39
35
  tag: TenantTag;