@logto/schemas 1.10.0 → 1.11.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 (153) 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/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.ts +18 -0
  8. package/alterations/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.ts +18 -0
  9. package/alterations-js/1.10.1-1695647183-update-private-key-type.d.ts +3 -0
  10. package/alterations-js/1.10.1-1695647183-update-private-key-type.js +50 -0
  11. package/alterations-js/1.10.1-1696657546-organization-tables.d.ts +3 -0
  12. package/alterations-js/1.10.1-1696657546-organization-tables.js +136 -0
  13. package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.d.ts +3 -0
  14. package/alterations-js/1.10.1-1697683802-add-sso-connectors-table.js +58 -0
  15. package/alterations-js/1.10.1-1698646271-add-organization-created-flag.d.ts +3 -0
  16. package/alterations-js/1.10.1-1698646271-add-organization-created-flag.js +26 -0
  17. package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.d.ts +4 -0
  18. package/alterations-js/1.10.1-1698820410-add-user-sso-identities-table.js +53 -0
  19. package/alterations-js/1.10.1-1698910485-user-logto-data.d.ts +3 -0
  20. package/alterations-js/1.10.1-1698910485-user-logto-data.js +16 -0
  21. package/alterations-js/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.d.ts +3 -0
  22. package/alterations-js/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.js +14 -0
  23. package/alterations-js/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.d.ts +3 -0
  24. package/alterations-js/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.js +14 -0
  25. package/lib/db-entries/application.d.ts +7 -1
  26. package/lib/db-entries/application.js +1 -0
  27. package/lib/db-entries/applications-role.d.ts +7 -1
  28. package/lib/db-entries/applications-role.js +1 -0
  29. package/lib/db-entries/connector.d.ts +7 -1
  30. package/lib/db-entries/connector.js +1 -0
  31. package/lib/db-entries/custom-phrase.d.ts +7 -1
  32. package/lib/db-entries/custom-phrase.js +1 -0
  33. package/lib/db-entries/daily-active-user.d.ts +7 -1
  34. package/lib/db-entries/daily-active-user.js +1 -0
  35. package/lib/db-entries/domain.d.ts +7 -1
  36. package/lib/db-entries/domain.js +1 -0
  37. package/lib/db-entries/hook.d.ts +7 -1
  38. package/lib/db-entries/hook.js +1 -0
  39. package/lib/db-entries/index.d.ts +8 -0
  40. package/lib/db-entries/index.js +8 -0
  41. package/lib/db-entries/log.d.ts +7 -1
  42. package/lib/db-entries/log.js +1 -0
  43. package/lib/db-entries/logto-config.d.ts +10 -4
  44. package/lib/db-entries/logto-config.js +4 -3
  45. package/lib/db-entries/oidc-model-instance.d.ts +7 -1
  46. package/lib/db-entries/oidc-model-instance.js +1 -0
  47. package/lib/db-entries/organization-role-scope-relation.d.ts +20 -0
  48. package/lib/db-entries/organization-role-scope-relation.js +29 -0
  49. package/lib/db-entries/organization-role-user-relation.d.ts +22 -0
  50. package/lib/db-entries/organization-role-user-relation.js +33 -0
  51. package/lib/db-entries/organization-role.d.ts +28 -0
  52. package/lib/db-entries/organization-role.js +33 -0
  53. package/lib/db-entries/organization-scope.d.ts +28 -0
  54. package/lib/db-entries/organization-scope.js +33 -0
  55. package/lib/db-entries/organization-user-relation.d.ts +20 -0
  56. package/lib/db-entries/organization-user-relation.js +29 -0
  57. package/lib/db-entries/organization.d.ts +32 -0
  58. package/lib/db-entries/organization.js +37 -0
  59. package/lib/db-entries/passcode.d.ts +7 -1
  60. package/lib/db-entries/passcode.js +1 -0
  61. package/lib/db-entries/resource.d.ts +7 -1
  62. package/lib/db-entries/resource.js +1 -0
  63. package/lib/db-entries/role.d.ts +7 -1
  64. package/lib/db-entries/role.js +1 -0
  65. package/lib/db-entries/roles-scope.d.ts +7 -1
  66. package/lib/db-entries/roles-scope.js +1 -0
  67. package/lib/db-entries/scope.d.ts +7 -1
  68. package/lib/db-entries/scope.js +1 -0
  69. package/lib/db-entries/sentinel-activity.d.ts +7 -1
  70. package/lib/db-entries/sentinel-activity.js +1 -0
  71. package/lib/db-entries/service-log.d.ts +7 -1
  72. package/lib/db-entries/service-log.js +1 -0
  73. package/lib/db-entries/sign-in-experience.d.ts +7 -1
  74. package/lib/db-entries/sign-in-experience.js +1 -0
  75. package/lib/db-entries/sso-connector.d.ts +46 -0
  76. package/lib/db-entries/sso-connector.js +54 -0
  77. package/lib/db-entries/system.d.ts +7 -1
  78. package/lib/db-entries/system.js +1 -0
  79. package/lib/db-entries/user-sso-identity.d.ts +32 -0
  80. package/lib/db-entries/user-sso-identity.js +50 -0
  81. package/lib/db-entries/user.d.ts +9 -1
  82. package/lib/db-entries/user.js +5 -0
  83. package/lib/db-entries/users-role.d.ts +7 -1
  84. package/lib/db-entries/users-role.js +1 -0
  85. package/lib/db-entries/verification-status.d.ts +7 -1
  86. package/lib/db-entries/verification-status.js +1 -0
  87. package/lib/foundations/index.d.ts +1 -1
  88. package/lib/foundations/index.js +1 -1
  89. package/lib/foundations/jsonb-types/custom-domain.d.ts +134 -0
  90. package/lib/foundations/jsonb-types/custom-domain.js +36 -0
  91. package/lib/foundations/jsonb-types/hooks.d.ts +32 -0
  92. package/lib/foundations/jsonb-types/hooks.js +24 -0
  93. package/lib/foundations/jsonb-types/index.d.ts +15 -0
  94. package/lib/foundations/jsonb-types/index.js +16 -0
  95. package/lib/foundations/jsonb-types/logs.d.ts +106 -0
  96. package/lib/foundations/jsonb-types/logs.js +20 -0
  97. package/lib/foundations/jsonb-types/oidc-module.d.ts +80 -0
  98. package/lib/foundations/jsonb-types/oidc-module.js +54 -0
  99. package/lib/foundations/jsonb-types/phrases.d.ts +5 -0
  100. package/lib/foundations/jsonb-types/phrases.js +2 -0
  101. package/lib/foundations/jsonb-types/sentinel.d.ts +27 -0
  102. package/lib/foundations/jsonb-types/sentinel.js +28 -0
  103. package/lib/foundations/jsonb-types/sign-in-experience.d.ts +118 -0
  104. package/lib/foundations/jsonb-types/sign-in-experience.js +56 -0
  105. package/lib/foundations/jsonb-types/sso-connector.d.ts +14 -0
  106. package/lib/foundations/jsonb-types/sso-connector.js +6 -0
  107. package/lib/foundations/jsonb-types/users.d.ts +285 -0
  108. package/lib/foundations/jsonb-types/users.js +47 -0
  109. package/lib/foundations/schemas.d.ts +11 -13
  110. package/lib/models/tenants.d.ts +8 -16
  111. package/lib/models/tenants.js +1 -6
  112. package/lib/seeds/logto-config.js +1 -0
  113. package/lib/types/application.d.ts +51 -1
  114. package/lib/types/application.js +7 -1
  115. package/lib/types/connector.d.ts +516 -2360
  116. package/lib/types/domain.d.ts +65 -27
  117. package/lib/types/hook.d.ts +15 -16
  118. package/lib/types/index.d.ts +4 -0
  119. package/lib/types/index.js +4 -0
  120. package/lib/types/interactions.d.ts +502 -10
  121. package/lib/types/interactions.js +83 -5
  122. package/lib/types/log/interaction.d.ts +4 -3
  123. package/lib/types/log/interaction.js +1 -0
  124. package/lib/types/logto-config.d.ts +74 -2
  125. package/lib/types/logto-config.js +38 -3
  126. package/lib/types/mfa.d.ts +211 -0
  127. package/lib/types/mfa.js +62 -0
  128. package/lib/types/organization.d.ts +48 -0
  129. package/lib/types/organization.js +21 -0
  130. package/lib/types/role.d.ts +5 -3
  131. package/lib/types/scope.d.ts +12 -27
  132. package/lib/types/sso-connector.d.ts +137 -0
  133. package/lib/types/sso-connector.js +24 -0
  134. package/lib/types/system.d.ts +26 -7
  135. package/lib/types/system.js +8 -0
  136. package/lib/types/tenant.d.ts +5 -0
  137. package/lib/types/tenant.js +6 -0
  138. package/lib/types/user-assets.d.ts +2 -2
  139. package/lib/types/user.d.ts +209 -66
  140. package/lib/types/user.js +8 -2
  141. package/package.json +7 -7
  142. package/tables/logto_configs.sql +1 -1
  143. package/tables/organization_role_scope_relations.sql +12 -0
  144. package/tables/organization_role_user_relations.sql +14 -0
  145. package/tables/organization_roles.sql +19 -0
  146. package/tables/organization_scopes.sql +19 -0
  147. package/tables/organization_user_relations.sql +12 -0
  148. package/tables/organizations.sql +19 -0
  149. package/tables/sso_connectors.sql +28 -0
  150. package/tables/user_sso_identities.sql +20 -0
  151. package/tables/users.sql +1 -0
  152. package/lib/foundations/jsonb-types.d.ts +0 -673
  153. package/lib/foundations/jsonb-types.js +0 -260
@@ -1,4 +1,4 @@
1
- import { type MfaFactor } from '../../foundations/jsonb-types.js';
1
+ import { type MfaFactor } from '../../foundations/index.js';
2
2
  import type { InteractionEvent } from '../interactions.js';
3
3
  export type Prefix = 'Interaction';
4
4
  export declare const prefix: Prefix;
@@ -14,7 +14,8 @@ export declare enum Field {
14
14
  export declare enum Method {
15
15
  Password = "Password",
16
16
  VerificationCode = "VerificationCode",
17
- Social = "Social"
17
+ Social = "Social",
18
+ SingleSignOn = "SingleSignOn"
18
19
  }
19
20
  export declare enum Action {
20
21
  /** Create a new entity. (E.g. create an interaction, create a verification code) */
@@ -65,4 +66,4 @@ export declare enum Action {
65
66
  * - When {@link Method} is `VerificationCode`, {@link Action} can be `Create` (generate and send a code) or `Submit` (verify and submit to the identifiers);
66
67
  * - Otherwise, {@link Action} is fixed to `Submit` (other methods can be verified on submitting).
67
68
  */
68
- export type LogKey = `${Prefix}.${Action.Create | Action.End}` | `${Prefix}.${InteractionEvent}.${Action.Update | Action.Submit}` | `${Prefix}.${InteractionEvent}.${Field.Profile}.${Action.Update | Action.Create | Action.Delete}` | `${Prefix}.${InteractionEvent}.${Field.Identifier}.${Method.VerificationCode | Method.Social}.${Action.Create | Action.Submit}` | `${Prefix}.${InteractionEvent}.${Field.Identifier}.${Exclude<Method, Method.VerificationCode | Method.Social>}.${Action.Submit}` | `${Prefix}.${InteractionEvent}.${Field.BindMfa}.${MfaFactor}.${Action.Submit | Action.Create}` | `${Prefix}.${InteractionEvent.SignIn}.${Field.Mfa}.${MfaFactor}.${Action.Submit | Action.Create}`;
69
+ export type LogKey = `${Prefix}.${Action.Create | Action.End}` | `${Prefix}.${InteractionEvent}.${Action.Update | Action.Submit}` | `${Prefix}.${InteractionEvent}.${Field.Profile}.${Action.Update | Action.Create | Action.Delete}` | `${Prefix}.${Exclude<InteractionEvent, InteractionEvent.ForgotPassword>}.${Field.Identifier}.${Exclude<Method, Method.Password>}.${Action.Create | Action.Submit}` | `${Prefix}.${Exclude<InteractionEvent, InteractionEvent.ForgotPassword>}.${Field.Identifier}.${Method.Password}.${Action.Submit}` | `${Prefix}.${InteractionEvent.ForgotPassword}.${Field.Identifier}.${Method.VerificationCode}.${Action.Create | Action.Submit}` | `${Prefix}.${InteractionEvent}.${Field.BindMfa}.${MfaFactor}.${Action.Submit | Action.Create}` | `${Prefix}.${InteractionEvent.SignIn}.${Field.Mfa}.${MfaFactor}.${Action.Submit | Action.Create}`;
@@ -14,6 +14,7 @@ export var Method;
14
14
  Method["Password"] = "Password";
15
15
  Method["VerificationCode"] = "VerificationCode";
16
16
  Method["Social"] = "Social";
17
+ Method["SingleSignOn"] = "SingleSignOn";
17
18
  })(Method || (Method = {}));
18
19
  export var Action;
19
20
  (function (Action) {
@@ -1,22 +1,80 @@
1
1
  import type { ZodType } from 'zod';
2
2
  import { z } from 'zod';
3
+ import { TenantTag } from './tenant.js';
4
+ /**
5
+ * Logto OIDC signing key types, used mainly in REST API routes.
6
+ */
7
+ export declare enum LogtoOidcConfigKeyType {
8
+ PrivateKeys = "private-keys",
9
+ CookieKeys = "cookie-keys"
10
+ }
11
+ /**
12
+ * Value maps to config key names in `logto_configs` table. Used mainly in DB SQL related scenarios.
13
+ */
3
14
  export declare enum LogtoOidcConfigKey {
4
15
  PrivateKeys = "oidc.privateKeys",
5
16
  CookieKeys = "oidc.cookieKeys"
6
17
  }
18
+ /**
19
+ * Logto supported signing key algorithms for OIDC private keys that sign JWT tokens.
20
+ */
21
+ export declare enum SupportedSigningKeyAlgorithm {
22
+ RSA = "RSA",
23
+ EC = "EC"
24
+ }
25
+ export declare const oidcConfigKeyGuard: z.ZodObject<{
26
+ id: z.ZodString;
27
+ value: z.ZodString;
28
+ createdAt: z.ZodNumber;
29
+ }, "strip", z.ZodTypeAny, {
30
+ value: string;
31
+ id: string;
32
+ createdAt: number;
33
+ }, {
34
+ value: string;
35
+ id: string;
36
+ createdAt: number;
37
+ }>;
38
+ export type OidcConfigKey = z.infer<typeof oidcConfigKeyGuard>;
7
39
  export type LogtoOidcConfigType = {
8
- [LogtoOidcConfigKey.PrivateKeys]: string[];
9
- [LogtoOidcConfigKey.CookieKeys]: string[];
40
+ [LogtoOidcConfigKey.PrivateKeys]: OidcConfigKey[];
41
+ [LogtoOidcConfigKey.CookieKeys]: OidcConfigKey[];
10
42
  };
11
43
  export declare const logtoOidcConfigGuard: Readonly<{
12
44
  [key in LogtoOidcConfigKey]: ZodType<LogtoOidcConfigType[key]>;
13
45
  }>;
14
46
  export declare const adminConsoleDataGuard: z.ZodObject<{
15
47
  signInExperienceCustomized: z.ZodBoolean;
48
+ organizationCreated: z.ZodBoolean;
49
+ developmentTenantMigrationNotification: z.ZodOptional<z.ZodObject<{
50
+ isPaidTenant: z.ZodBoolean;
51
+ tag: z.ZodNativeEnum<typeof TenantTag>;
52
+ readAt: z.ZodOptional<z.ZodNumber>;
53
+ }, "strip", z.ZodTypeAny, {
54
+ isPaidTenant: boolean;
55
+ tag: TenantTag;
56
+ readAt?: number | undefined;
57
+ }, {
58
+ isPaidTenant: boolean;
59
+ tag: TenantTag;
60
+ readAt?: number | undefined;
61
+ }>>;
16
62
  }, "strip", z.ZodTypeAny, {
17
63
  signInExperienceCustomized: boolean;
64
+ organizationCreated: boolean;
65
+ developmentTenantMigrationNotification?: {
66
+ isPaidTenant: boolean;
67
+ tag: TenantTag;
68
+ readAt?: number | undefined;
69
+ } | undefined;
18
70
  }, {
19
71
  signInExperienceCustomized: boolean;
72
+ organizationCreated: boolean;
73
+ developmentTenantMigrationNotification?: {
74
+ isPaidTenant: boolean;
75
+ tag: TenantTag;
76
+ readAt?: number | undefined;
77
+ } | undefined;
20
78
  }>;
21
79
  export type AdminConsoleData = z.infer<typeof adminConsoleDataGuard>;
22
80
  export declare const cloudConnectionDataGuard: z.ZodObject<{
@@ -54,3 +112,17 @@ export type LogtoConfigType = LogtoOidcConfigType | LogtoTenantConfigType;
54
112
  export type LogtoConfigGuard = typeof logtoOidcConfigGuard & typeof logtoTenantConfigGuard;
55
113
  export declare const logtoConfigKeys: readonly LogtoConfigKey[];
56
114
  export declare const logtoConfigGuards: LogtoConfigGuard;
115
+ export declare const oidcConfigKeysResponseGuard: z.ZodObject<{
116
+ id: z.ZodString;
117
+ createdAt: z.ZodNumber;
118
+ signingKeyAlgorithm: z.ZodOptional<z.ZodNativeEnum<typeof SupportedSigningKeyAlgorithm>>;
119
+ }, "strip", z.ZodTypeAny, {
120
+ id: string;
121
+ createdAt: number;
122
+ signingKeyAlgorithm?: SupportedSigningKeyAlgorithm | undefined;
123
+ }, {
124
+ id: string;
125
+ createdAt: number;
126
+ signingKeyAlgorithm?: SupportedSigningKeyAlgorithm | undefined;
127
+ }>;
128
+ export type OidcConfigKeysResponse = z.infer<typeof oidcConfigKeysResponseGuard>;
@@ -1,17 +1,49 @@
1
1
  import { z } from 'zod';
2
- /* --- Logto OIDC configs --- */
2
+ import { TenantTag } from './tenant.js';
3
+ /**
4
+ * Logto OIDC signing key types, used mainly in REST API routes.
5
+ */
6
+ export var LogtoOidcConfigKeyType;
7
+ (function (LogtoOidcConfigKeyType) {
8
+ LogtoOidcConfigKeyType["PrivateKeys"] = "private-keys";
9
+ LogtoOidcConfigKeyType["CookieKeys"] = "cookie-keys";
10
+ })(LogtoOidcConfigKeyType || (LogtoOidcConfigKeyType = {}));
11
+ /**
12
+ * Value maps to config key names in `logto_configs` table. Used mainly in DB SQL related scenarios.
13
+ */
3
14
  export var LogtoOidcConfigKey;
4
15
  (function (LogtoOidcConfigKey) {
5
16
  LogtoOidcConfigKey["PrivateKeys"] = "oidc.privateKeys";
6
17
  LogtoOidcConfigKey["CookieKeys"] = "oidc.cookieKeys";
7
18
  })(LogtoOidcConfigKey || (LogtoOidcConfigKey = {}));
19
+ /**
20
+ * Logto supported signing key algorithms for OIDC private keys that sign JWT tokens.
21
+ */
22
+ export var SupportedSigningKeyAlgorithm;
23
+ (function (SupportedSigningKeyAlgorithm) {
24
+ SupportedSigningKeyAlgorithm["RSA"] = "RSA";
25
+ SupportedSigningKeyAlgorithm["EC"] = "EC";
26
+ })(SupportedSigningKeyAlgorithm || (SupportedSigningKeyAlgorithm = {}));
27
+ export const oidcConfigKeyGuard = z.object({
28
+ id: z.string(),
29
+ value: z.string(),
30
+ createdAt: z.number(),
31
+ });
8
32
  export const logtoOidcConfigGuard = Object.freeze({
9
- [LogtoOidcConfigKey.PrivateKeys]: z.string().array(),
10
- [LogtoOidcConfigKey.CookieKeys]: z.string().array(),
33
+ [LogtoOidcConfigKey.PrivateKeys]: oidcConfigKeyGuard.array(),
34
+ [LogtoOidcConfigKey.CookieKeys]: oidcConfigKeyGuard.array(),
11
35
  });
12
36
  /* --- Logto tenant configs --- */
13
37
  export const adminConsoleDataGuard = z.object({
14
38
  signInExperienceCustomized: z.boolean(),
39
+ organizationCreated: z.boolean(),
40
+ developmentTenantMigrationNotification: z
41
+ .object({
42
+ isPaidTenant: z.boolean(),
43
+ tag: z.nativeEnum(TenantTag),
44
+ readAt: z.number().optional(),
45
+ })
46
+ .optional(),
15
47
  });
16
48
  /* --- Logto tenant cloud connection config --- */
17
49
  export const cloudConnectionDataGuard = z.object({
@@ -39,3 +71,6 @@ export const logtoConfigGuards = Object.freeze({
39
71
  ...logtoOidcConfigGuard,
40
72
  ...logtoTenantConfigGuard,
41
73
  });
74
+ export const oidcConfigKeysResponseGuard = oidcConfigKeyGuard
75
+ .omit({ value: true })
76
+ .merge(z.object({ signingKeyAlgorithm: z.nativeEnum(SupportedSigningKeyAlgorithm).optional() }));
@@ -0,0 +1,211 @@
1
+ import { z } from 'zod';
2
+ export declare const webAuthnRegistrationOptionsGuard: z.ZodObject<{
3
+ rp: z.ZodObject<{
4
+ name: z.ZodString;
5
+ id: z.ZodOptional<z.ZodString>;
6
+ }, "strip", z.ZodTypeAny, {
7
+ name: string;
8
+ id?: string | undefined;
9
+ }, {
10
+ name: string;
11
+ id?: string | undefined;
12
+ }>;
13
+ user: z.ZodObject<{
14
+ id: z.ZodString;
15
+ name: z.ZodString;
16
+ displayName: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
18
+ name: string;
19
+ id: string;
20
+ displayName: string;
21
+ }, {
22
+ name: string;
23
+ id: string;
24
+ displayName: string;
25
+ }>;
26
+ challenge: z.ZodString;
27
+ pubKeyCredParams: z.ZodArray<z.ZodObject<{
28
+ type: z.ZodLiteral<"public-key">;
29
+ alg: z.ZodNumber;
30
+ }, "strip", z.ZodTypeAny, {
31
+ type: "public-key";
32
+ alg: number;
33
+ }, {
34
+ type: "public-key";
35
+ alg: number;
36
+ }>, "many">;
37
+ timeout: z.ZodOptional<z.ZodNumber>;
38
+ excludeCredentials: z.ZodOptional<z.ZodArray<z.ZodObject<{
39
+ type: z.ZodLiteral<"public-key">;
40
+ id: z.ZodString;
41
+ transports: z.ZodOptional<z.ZodArray<z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>, "many">>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ type: "public-key";
44
+ id: string;
45
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
46
+ }, {
47
+ type: "public-key";
48
+ id: string;
49
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
50
+ }>, "many">>;
51
+ authenticatorSelection: z.ZodOptional<z.ZodObject<{
52
+ authenticatorAttachment: z.ZodOptional<z.ZodEnum<["platform", "cross-platform"]>>;
53
+ requireResidentKey: z.ZodOptional<z.ZodBoolean>;
54
+ residentKey: z.ZodOptional<z.ZodEnum<["discouraged", "preferred", "required"]>>;
55
+ userVerification: z.ZodOptional<z.ZodEnum<["required", "preferred", "discouraged"]>>;
56
+ }, "strip", z.ZodTypeAny, {
57
+ authenticatorAttachment?: "platform" | "cross-platform" | undefined;
58
+ requireResidentKey?: boolean | undefined;
59
+ residentKey?: "discouraged" | "preferred" | "required" | undefined;
60
+ userVerification?: "discouraged" | "preferred" | "required" | undefined;
61
+ }, {
62
+ authenticatorAttachment?: "platform" | "cross-platform" | undefined;
63
+ requireResidentKey?: boolean | undefined;
64
+ residentKey?: "discouraged" | "preferred" | "required" | undefined;
65
+ userVerification?: "discouraged" | "preferred" | "required" | undefined;
66
+ }>>;
67
+ attestation: z.ZodOptional<z.ZodEnum<["none", "indirect", "direct", "enterprise"]>>;
68
+ extensions: z.ZodOptional<z.ZodObject<{
69
+ appid: z.ZodOptional<z.ZodString>;
70
+ credProps: z.ZodOptional<z.ZodBoolean>;
71
+ hmacCreateSecret: z.ZodOptional<z.ZodBoolean>;
72
+ }, "strip", z.ZodTypeAny, {
73
+ appid?: string | undefined;
74
+ credProps?: boolean | undefined;
75
+ hmacCreateSecret?: boolean | undefined;
76
+ }, {
77
+ appid?: string | undefined;
78
+ credProps?: boolean | undefined;
79
+ hmacCreateSecret?: boolean | undefined;
80
+ }>>;
81
+ }, "strip", z.ZodTypeAny, {
82
+ user: {
83
+ name: string;
84
+ id: string;
85
+ displayName: string;
86
+ };
87
+ challenge: string;
88
+ rp: {
89
+ name: string;
90
+ id?: string | undefined;
91
+ };
92
+ pubKeyCredParams: {
93
+ type: "public-key";
94
+ alg: number;
95
+ }[];
96
+ timeout?: number | undefined;
97
+ excludeCredentials?: {
98
+ type: "public-key";
99
+ id: string;
100
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
101
+ }[] | undefined;
102
+ authenticatorSelection?: {
103
+ authenticatorAttachment?: "platform" | "cross-platform" | undefined;
104
+ requireResidentKey?: boolean | undefined;
105
+ residentKey?: "discouraged" | "preferred" | "required" | undefined;
106
+ userVerification?: "discouraged" | "preferred" | "required" | undefined;
107
+ } | undefined;
108
+ attestation?: "none" | "indirect" | "direct" | "enterprise" | undefined;
109
+ extensions?: {
110
+ appid?: string | undefined;
111
+ credProps?: boolean | undefined;
112
+ hmacCreateSecret?: boolean | undefined;
113
+ } | undefined;
114
+ }, {
115
+ user: {
116
+ name: string;
117
+ id: string;
118
+ displayName: string;
119
+ };
120
+ challenge: string;
121
+ rp: {
122
+ name: string;
123
+ id?: string | undefined;
124
+ };
125
+ pubKeyCredParams: {
126
+ type: "public-key";
127
+ alg: number;
128
+ }[];
129
+ timeout?: number | undefined;
130
+ excludeCredentials?: {
131
+ type: "public-key";
132
+ id: string;
133
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
134
+ }[] | undefined;
135
+ authenticatorSelection?: {
136
+ authenticatorAttachment?: "platform" | "cross-platform" | undefined;
137
+ requireResidentKey?: boolean | undefined;
138
+ residentKey?: "discouraged" | "preferred" | "required" | undefined;
139
+ userVerification?: "discouraged" | "preferred" | "required" | undefined;
140
+ } | undefined;
141
+ attestation?: "none" | "indirect" | "direct" | "enterprise" | undefined;
142
+ extensions?: {
143
+ appid?: string | undefined;
144
+ credProps?: boolean | undefined;
145
+ hmacCreateSecret?: boolean | undefined;
146
+ } | undefined;
147
+ }>;
148
+ export type WebAuthnRegistrationOptions = z.infer<typeof webAuthnRegistrationOptionsGuard>;
149
+ export declare const webAuthnAuthenticationOptionsGuard: z.ZodObject<{
150
+ challenge: z.ZodString;
151
+ timeout: z.ZodOptional<z.ZodNumber>;
152
+ rpId: z.ZodOptional<z.ZodString>;
153
+ allowCredentials: z.ZodOptional<z.ZodArray<z.ZodObject<{
154
+ type: z.ZodLiteral<"public-key">;
155
+ id: z.ZodString;
156
+ transports: z.ZodOptional<z.ZodArray<z.ZodEnum<["usb", "nfc", "ble", "internal", "cable", "hybrid", "smart-card"]>, "many">>;
157
+ }, "strip", z.ZodTypeAny, {
158
+ type: "public-key";
159
+ id: string;
160
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
161
+ }, {
162
+ type: "public-key";
163
+ id: string;
164
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
165
+ }>, "many">>;
166
+ userVerification: z.ZodOptional<z.ZodEnum<["required", "preferred", "discouraged"]>>;
167
+ extensions: z.ZodOptional<z.ZodObject<{
168
+ appid: z.ZodOptional<z.ZodString>;
169
+ credProps: z.ZodOptional<z.ZodBoolean>;
170
+ hmacCreateSecret: z.ZodOptional<z.ZodBoolean>;
171
+ }, "strip", z.ZodTypeAny, {
172
+ appid?: string | undefined;
173
+ credProps?: boolean | undefined;
174
+ hmacCreateSecret?: boolean | undefined;
175
+ }, {
176
+ appid?: string | undefined;
177
+ credProps?: boolean | undefined;
178
+ hmacCreateSecret?: boolean | undefined;
179
+ }>>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ challenge: string;
182
+ timeout?: number | undefined;
183
+ rpId?: string | undefined;
184
+ allowCredentials?: {
185
+ type: "public-key";
186
+ id: string;
187
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
188
+ }[] | undefined;
189
+ userVerification?: "discouraged" | "preferred" | "required" | undefined;
190
+ extensions?: {
191
+ appid?: string | undefined;
192
+ credProps?: boolean | undefined;
193
+ hmacCreateSecret?: boolean | undefined;
194
+ } | undefined;
195
+ }, {
196
+ challenge: string;
197
+ timeout?: number | undefined;
198
+ rpId?: string | undefined;
199
+ allowCredentials?: {
200
+ type: "public-key";
201
+ id: string;
202
+ transports?: ("usb" | "nfc" | "ble" | "internal" | "cable" | "hybrid" | "smart-card")[] | undefined;
203
+ }[] | undefined;
204
+ userVerification?: "discouraged" | "preferred" | "required" | undefined;
205
+ extensions?: {
206
+ appid?: string | undefined;
207
+ credProps?: boolean | undefined;
208
+ hmacCreateSecret?: boolean | undefined;
209
+ } | undefined;
210
+ }>;
211
+ export type WebAuthnAuthenticationOptions = z.infer<typeof webAuthnAuthenticationOptionsGuard>;
@@ -0,0 +1,62 @@
1
+ import { z } from 'zod';
2
+ import { webAuthnTransportGuard } from '../foundations/jsonb-types/index.js';
3
+ export const webAuthnRegistrationOptionsGuard = z.object({
4
+ rp: z.object({
5
+ name: z.string(),
6
+ id: z.string().optional(),
7
+ }),
8
+ user: z.object({
9
+ id: z.string(),
10
+ name: z.string(),
11
+ displayName: z.string(),
12
+ }),
13
+ challenge: z.string(),
14
+ pubKeyCredParams: z.array(z.object({
15
+ type: z.literal('public-key'),
16
+ alg: z.number(),
17
+ })),
18
+ timeout: z.number().optional(),
19
+ excludeCredentials: z
20
+ .array(z.object({
21
+ type: z.literal('public-key'),
22
+ id: z.string(),
23
+ transports: webAuthnTransportGuard.array().optional(),
24
+ }))
25
+ .optional(),
26
+ authenticatorSelection: z
27
+ .object({
28
+ authenticatorAttachment: z.enum(['platform', 'cross-platform']).optional(),
29
+ requireResidentKey: z.boolean().optional(),
30
+ residentKey: z.enum(['discouraged', 'preferred', 'required']).optional(),
31
+ userVerification: z.enum(['required', 'preferred', 'discouraged']).optional(),
32
+ })
33
+ .optional(),
34
+ attestation: z.enum(['none', 'indirect', 'direct', 'enterprise']).optional(),
35
+ extensions: z
36
+ .object({
37
+ appid: z.string().optional(),
38
+ credProps: z.boolean().optional(),
39
+ hmacCreateSecret: z.boolean().optional(),
40
+ })
41
+ .optional(),
42
+ });
43
+ export const webAuthnAuthenticationOptionsGuard = z.object({
44
+ challenge: z.string(),
45
+ timeout: z.number().optional(),
46
+ rpId: z.string().optional(),
47
+ allowCredentials: z
48
+ .array(z.object({
49
+ type: z.literal('public-key'),
50
+ id: z.string(),
51
+ transports: webAuthnTransportGuard.array().optional(),
52
+ }))
53
+ .optional(),
54
+ userVerification: z.enum(['required', 'preferred', 'discouraged']).optional(),
55
+ extensions: z
56
+ .object({
57
+ appid: z.string().optional(),
58
+ credProps: z.boolean().optional(),
59
+ hmacCreateSecret: z.boolean().optional(),
60
+ })
61
+ .optional(),
62
+ });
@@ -0,0 +1,48 @@
1
+ import { z } from 'zod';
2
+ import { type OrganizationRole, type Organization } from '../db-entries/index.js';
3
+ import { type UserInfo, type FeaturedUser } from './user.js';
4
+ /**
5
+ * The simplified organization scope entity that is returned for some endpoints.
6
+ */
7
+ export type OrganizationScopeEntity = {
8
+ id: string;
9
+ name: string;
10
+ };
11
+ export type OrganizationRoleWithScopes = OrganizationRole & {
12
+ scopes: OrganizationScopeEntity[];
13
+ };
14
+ export declare const organizationRoleWithScopesGuard: z.ZodType<OrganizationRoleWithScopes>;
15
+ /**
16
+ * The simplified organization role entity that is returned in the `roles` field
17
+ * of the organization.
18
+ */
19
+ export type OrganizationRoleEntity = {
20
+ id: string;
21
+ name: string;
22
+ };
23
+ /**
24
+ * The organization entity with the `organizationRoles` field that contains the
25
+ * roles of the current member of the organization.
26
+ */
27
+ export type OrganizationWithRoles = Organization & {
28
+ /** The roles of the current member of the organization. */
29
+ organizationRoles: OrganizationRoleEntity[];
30
+ };
31
+ export declare const organizationWithOrganizationRolesGuard: z.ZodType<OrganizationWithRoles>;
32
+ /**
33
+ * The user entity with the `organizationRoles` field that contains the roles of
34
+ * the user in a specific organization.
35
+ */
36
+ export type UserWithOrganizationRoles = UserInfo & {
37
+ /** The roles of the user in a specific organization. */
38
+ organizationRoles: OrganizationRoleEntity[];
39
+ };
40
+ export declare const userWithOrganizationRolesGuard: z.ZodType<UserWithOrganizationRoles>;
41
+ /**
42
+ * The organization entity with optional `usersCount` and `featuredUsers` fields.
43
+ * They are useful for displaying the organization list in the frontend.
44
+ */
45
+ export type OrganizationWithFeatured = Organization & {
46
+ usersCount?: number;
47
+ featuredUsers?: FeaturedUser[];
48
+ };
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { OrganizationRoles, Organizations, } from '../db-entries/index.js';
3
+ import { userInfoGuard } from './user.js';
4
+ export const organizationRoleWithScopesGuard = OrganizationRoles.guard.extend({
5
+ scopes: z
6
+ .object({
7
+ id: z.string(),
8
+ name: z.string(),
9
+ })
10
+ .array(),
11
+ });
12
+ const organizationRoleEntityGuard = z.object({
13
+ id: z.string(),
14
+ name: z.string(),
15
+ });
16
+ export const organizationWithOrganizationRolesGuard = Organizations.guard.extend({
17
+ organizationRoles: organizationRoleEntityGuard.array(),
18
+ });
19
+ export const userWithOrganizationRolesGuard = userInfoGuard.extend({
20
+ organizationRoles: organizationRoleEntityGuard.array(),
21
+ });
@@ -1,7 +1,9 @@
1
- import type { Application, Role, User } from '../db-entries/index.js';
1
+ import type { Role } from '../db-entries/index.js';
2
+ import { type FeaturedApplication } from './application.js';
3
+ import { type FeaturedUser } from './user.js';
2
4
  export type RoleResponse = Role & {
3
5
  usersCount: number;
4
- featuredUsers: Array<Pick<User, 'avatar' | 'id' | 'name' | 'username' | 'primaryEmail'>>;
6
+ featuredUsers: FeaturedUser[];
5
7
  applicationsCount: number;
6
- featuredApplications: Array<Pick<Application, 'id' | 'name'>>;
8
+ featuredApplications: FeaturedApplication[];
7
9
  };
@@ -1,42 +1,27 @@
1
1
  import { type z } from 'zod';
2
- export declare const scopeResponseGuard: z.ZodObject<z.extendShape<{
3
- tenantId: z.ZodType<string, z.ZodTypeDef, string>;
4
- id: z.ZodType<string, z.ZodTypeDef, string>;
5
- resourceId: z.ZodType<string, z.ZodTypeDef, string>;
2
+ export declare const scopeResponseGuard: z.ZodObject<{
6
3
  name: z.ZodType<string, z.ZodTypeDef, string>;
7
- description: z.ZodType<string, z.ZodTypeDef, string>;
4
+ id: z.ZodType<string, z.ZodTypeDef, string>;
5
+ tenantId: z.ZodType<string, z.ZodTypeDef, string>;
8
6
  createdAt: z.ZodType<number, z.ZodTypeDef, number>;
9
- }, {
7
+ description: z.ZodType<string, z.ZodTypeDef, string>;
8
+ resourceId: z.ZodType<string, z.ZodTypeDef, string>;
10
9
  resource: import("../index.js").Guard<import("../db-entries/resource.js").Resource>;
11
- }>, "strip", z.ZodTypeAny, {
12
- tenantId: string;
10
+ }, "strip", z.ZodTypeAny, {
11
+ name: string;
13
12
  id: string;
13
+ tenantId: string;
14
14
  createdAt: number;
15
- name: string;
16
15
  description: string;
17
- resource: {
18
- tenantId: string;
19
- id: string;
20
- name: string;
21
- indicator: string;
22
- isDefault: boolean;
23
- accessTokenTtl: number;
24
- };
16
+ resource: import("../db-entries/resource.js").Resource;
25
17
  resourceId: string;
26
18
  }, {
27
- tenantId: string;
19
+ name: string;
28
20
  id: string;
21
+ tenantId: string;
29
22
  createdAt: number;
30
- name: string;
31
23
  description: string;
32
- resource: {
33
- tenantId: string;
34
- id: string;
35
- name: string;
36
- indicator: string;
37
- isDefault: boolean;
38
- accessTokenTtl: number;
39
- };
24
+ resource: import("../db-entries/resource.js").Resource;
40
25
  resourceId: string;
41
26
  }>;
42
27
  export type ScopeResponse = z.infer<typeof scopeResponseGuard>;