@logto/schemas 1.11.0 → 1.13.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 (158) hide show
  1. package/alterations/1.12.0-1700031616-update-org-role-foreign-keys.ts +35 -0
  2. package/alterations/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.ts +21 -0
  3. package/alterations/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.ts +20 -0
  4. package/alterations/1.13.0-1702274830-add-new-third-party-column-to-applications-table.ts +20 -0
  5. package/alterations/1.13.0-1702372401-add-application-permissions-tables.ts +93 -0
  6. package/alterations/1.13.0-1702544178-sync-tenant-orgs.ts +296 -0
  7. package/alterations/1.13.0-1702871078-protected-application-type.ts +24 -0
  8. package/alterations/1.13.0-1702877515-protected-app-configs.ts +18 -0
  9. package/alterations/1.13.0-1702978120-application-sign-in-experience-table.ts +61 -0
  10. package/alterations/1.13.0-1703229996-daily-token-usage.ts +62 -0
  11. package/alterations/1.13.0-1703230000-update-tenant-roles.ts +94 -0
  12. package/alterations/1.13.0-1704692973-remove-legacy-resources.ts +147 -0
  13. package/alterations/1.13.0-1704934999-add-magic-links-table.ts +37 -0
  14. package/alterations/1.13.0-1704935001-add-organization-invitation-tables.ts +78 -0
  15. package/alterations/1.13.0-1705288654-add-application-user-consent-organizations-table.ts +62 -0
  16. package/alterations/1.13.0-1705991158-update-invitation-indices.ts +32 -0
  17. package/alterations/1.13.0-1706449174-update-organization-invitation-column.ts +24 -0
  18. package/alterations/1.13.0-1706510290-protected-app-host-index.ts +21 -0
  19. package/alterations/1.13.0-1706512952-restore-get-started-page.ts +17 -0
  20. package/alterations/1.13.0-1706528755-remove-magic-links.ts +46 -0
  21. package/alterations/1.13.0-1706585206-protected-app-custom-domain-unique.ts +21 -0
  22. package/alterations/utils/1704934999-tables.ts +49 -0
  23. package/alterations/utils/README.md +9 -0
  24. package/alterations-js/1.12.0-1700031616-update-org-role-foreign-keys.d.ts +3 -0
  25. package/alterations-js/1.12.0-1700031616-update-org-role-foreign-keys.js +31 -0
  26. package/alterations-js/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.d.ts +3 -0
  27. package/alterations-js/1.12.0-1701054133-add-unique-constraint-to-the-sso-connector-name.js +17 -0
  28. package/alterations-js/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.d.ts +3 -0
  29. package/alterations-js/1.12.0-1701245520-add-single-sign-on-enabled-flag-to-sie.js +16 -0
  30. package/alterations-js/1.13.0-1702274830-add-new-third-party-column-to-applications-table.d.ts +3 -0
  31. package/alterations-js/1.13.0-1702274830-add-new-third-party-column-to-applications-table.js +16 -0
  32. package/alterations-js/1.13.0-1702372401-add-application-permissions-tables.d.ts +3 -0
  33. package/alterations-js/1.13.0-1702372401-add-application-permissions-tables.js +79 -0
  34. package/alterations-js/1.13.0-1702544178-sync-tenant-orgs.d.ts +18 -0
  35. package/alterations-js/1.13.0-1702544178-sync-tenant-orgs.js +225 -0
  36. package/alterations-js/1.13.0-1702871078-protected-application-type.d.ts +3 -0
  37. package/alterations-js/1.13.0-1702871078-protected-application-type.js +20 -0
  38. package/alterations-js/1.13.0-1702877515-protected-app-configs.d.ts +3 -0
  39. package/alterations-js/1.13.0-1702877515-protected-app-configs.js +14 -0
  40. package/alterations-js/1.13.0-1702978120-application-sign-in-experience-table.d.ts +3 -0
  41. package/alterations-js/1.13.0-1702978120-application-sign-in-experience-table.js +51 -0
  42. package/alterations-js/1.13.0-1703229996-daily-token-usage.d.ts +3 -0
  43. package/alterations-js/1.13.0-1703229996-daily-token-usage.js +51 -0
  44. package/alterations-js/1.13.0-1703230000-update-tenant-roles.d.ts +11 -0
  45. package/alterations-js/1.13.0-1703230000-update-tenant-roles.js +87 -0
  46. package/alterations-js/1.13.0-1704692973-remove-legacy-resources.d.ts +3 -0
  47. package/alterations-js/1.13.0-1704692973-remove-legacy-resources.js +124 -0
  48. package/alterations-js/1.13.0-1704934999-add-magic-links-table.d.ts +3 -0
  49. package/alterations-js/1.13.0-1704934999-add-magic-links-table.js +32 -0
  50. package/alterations-js/1.13.0-1704935001-add-organization-invitation-tables.d.ts +3 -0
  51. package/alterations-js/1.13.0-1704935001-add-organization-invitation-tables.js +72 -0
  52. package/alterations-js/1.13.0-1705288654-add-application-user-consent-organizations-table.d.ts +3 -0
  53. package/alterations-js/1.13.0-1705288654-add-application-user-consent-organizations-table.js +52 -0
  54. package/alterations-js/1.13.0-1705991158-update-invitation-indices.d.ts +7 -0
  55. package/alterations-js/1.13.0-1705991158-update-invitation-indices.js +27 -0
  56. package/alterations-js/1.13.0-1706449174-update-organization-invitation-column.d.ts +3 -0
  57. package/alterations-js/1.13.0-1706449174-update-organization-invitation-column.js +20 -0
  58. package/alterations-js/1.13.0-1706510290-protected-app-host-index.d.ts +3 -0
  59. package/alterations-js/1.13.0-1706510290-protected-app-host-index.js +17 -0
  60. package/alterations-js/1.13.0-1706512952-restore-get-started-page.d.ts +3 -0
  61. package/alterations-js/1.13.0-1706512952-restore-get-started-page.js +13 -0
  62. package/alterations-js/1.13.0-1706528755-remove-magic-links.d.ts +3 -0
  63. package/alterations-js/1.13.0-1706528755-remove-magic-links.js +41 -0
  64. package/alterations-js/1.13.0-1706585206-protected-app-custom-domain-unique.d.ts +3 -0
  65. package/alterations-js/1.13.0-1706585206-protected-app-custom-domain-unique.js +17 -0
  66. package/alterations-js/utils/1704934999-tables.d.ts +11 -0
  67. package/alterations-js/utils/1704934999-tables.js +43 -0
  68. package/lib/consts/index.d.ts +1 -0
  69. package/lib/consts/index.js +1 -0
  70. package/lib/consts/subscriptions.d.ts +6 -0
  71. package/lib/consts/subscriptions.js +7 -0
  72. package/lib/db-entries/application-sign-in-experience.d.ts +26 -0
  73. package/lib/db-entries/application-sign-in-experience.js +42 -0
  74. package/lib/db-entries/application-user-consent-organization-scope.d.ts +24 -0
  75. package/lib/db-entries/application-user-consent-organization-scope.js +29 -0
  76. package/lib/db-entries/application-user-consent-organization.d.ts +22 -0
  77. package/lib/db-entries/application-user-consent-organization.js +33 -0
  78. package/lib/db-entries/application-user-consent-resource-scope.d.ts +24 -0
  79. package/lib/db-entries/application-user-consent-resource-scope.js +29 -0
  80. package/lib/db-entries/application-user-consent-user-scope.d.ts +24 -0
  81. package/lib/db-entries/application-user-consent-user-scope.js +29 -0
  82. package/lib/db-entries/application.d.ts +6 -2
  83. package/lib/db-entries/application.js +9 -1
  84. package/lib/db-entries/custom-types.d.ts +8 -1
  85. package/lib/db-entries/custom-types.js +8 -0
  86. package/lib/db-entries/daily-token-usage.d.ts +20 -0
  87. package/lib/db-entries/daily-token-usage.js +33 -0
  88. package/lib/db-entries/index.d.ts +8 -0
  89. package/lib/db-entries/index.js +8 -0
  90. package/lib/db-entries/organization-invitation-role-relation.d.ts +24 -0
  91. package/lib/db-entries/organization-invitation-role-relation.js +29 -0
  92. package/lib/db-entries/organization-invitation.d.ts +53 -0
  93. package/lib/db-entries/organization-invitation.js +58 -0
  94. package/lib/db-entries/sign-in-experience.d.ts +3 -1
  95. package/lib/db-entries/sign-in-experience.js +4 -0
  96. package/lib/db-entries/sso-connector.d.ts +2 -2
  97. package/lib/foundations/jsonb-types/applications.d.ts +380 -0
  98. package/lib/foundations/jsonb-types/applications.js +29 -0
  99. package/lib/foundations/jsonb-types/custom-domain.d.ts +37 -89
  100. package/lib/foundations/jsonb-types/custom-domain.js +4 -9
  101. package/lib/foundations/jsonb-types/index.d.ts +1 -0
  102. package/lib/foundations/jsonb-types/index.js +1 -0
  103. package/lib/foundations/jsonb-types/sso-connector.d.ts +3 -0
  104. package/lib/foundations/jsonb-types/sso-connector.js +1 -0
  105. package/lib/models/tenants.d.ts +1 -1
  106. package/lib/seeds/application.d.ts +1 -1
  107. package/lib/seeds/application.js +3 -1
  108. package/lib/seeds/cloud-api.d.ts +0 -2
  109. package/lib/seeds/cloud-api.js +0 -3
  110. package/lib/seeds/management-api.d.ts +77 -6
  111. package/lib/seeds/management-api.js +14 -10
  112. package/lib/types/application.d.ts +576 -1
  113. package/lib/types/application.js +42 -1
  114. package/lib/types/connector.js +1 -1
  115. package/lib/types/consent.d.ts +568 -0
  116. package/lib/types/consent.js +47 -0
  117. package/lib/types/domain.d.ts +21 -65
  118. package/lib/types/hook.d.ts +1 -0
  119. package/lib/types/index.d.ts +3 -0
  120. package/lib/types/index.js +3 -0
  121. package/lib/types/interactions.d.ts +6 -6
  122. package/lib/types/logto-config.d.ts +32 -6
  123. package/lib/types/logto-config.js +12 -2
  124. package/lib/types/mapi-proxy.d.ts +30 -0
  125. package/lib/types/mapi-proxy.js +49 -0
  126. package/lib/types/organization.d.ts +10 -1
  127. package/lib/types/organization.js +4 -1
  128. package/lib/types/sso-connector.d.ts +63 -66
  129. package/lib/types/sso-connector.js +41 -7
  130. package/lib/types/system.d.ts +28 -1
  131. package/lib/types/system.js +17 -0
  132. package/lib/types/tenant-organization.d.ts +107 -0
  133. package/lib/types/tenant-organization.js +145 -0
  134. package/lib/types/tenant.d.ts +0 -1
  135. package/lib/types/tenant.js +2 -1
  136. package/lib/types/user-assets.d.ts +5 -5
  137. package/lib/types/user-assets.js +1 -0
  138. package/lib/types/user.d.ts +17 -15
  139. package/lib/types/user.js +2 -2
  140. package/lib/utils/domain.d.ts +10 -0
  141. package/lib/utils/domain.js +28 -0
  142. package/lib/utils/domain.test.d.ts +1 -0
  143. package/lib/utils/domain.test.js +34 -0
  144. package/lib/utils/index.d.ts +1 -0
  145. package/lib/utils/index.js +1 -0
  146. package/package.json +15 -15
  147. package/tables/application_sign_in_experiences.sql +15 -0
  148. package/tables/application_user_consent_organization_scopes.sql +14 -0
  149. package/tables/application_user_consent_organizations.sql +16 -0
  150. package/tables/application_user_consent_resource_scopes.sql +14 -0
  151. package/tables/application_user_consent_user_scopes.sql +13 -0
  152. package/tables/applications.sql +16 -1
  153. package/tables/daily_token_usage.sql +11 -0
  154. package/tables/organization_invitation_role_relations.sql +14 -0
  155. package/tables/organization_invitations.sql +36 -0
  156. package/tables/organization_role_user_relations.sql +8 -6
  157. package/tables/sign_in_experiences.sql +1 -0
  158. package/tables/sso_connectors.sql +4 -2
@@ -15,71 +15,27 @@ export declare const domainResponseGuard: z.ZodObject<Pick<{
15
15
  value: string;
16
16
  name: string;
17
17
  }[]>;
18
- cloudflareData: z.ZodType<z.objectOutputType<{
19
- id: z.ZodString;
20
- status: z.ZodString;
21
- ssl: z.ZodObject<{
22
- status: z.ZodString;
23
- validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
24
- message: z.ZodString;
25
- }, "strip", z.ZodUnknown, z.objectOutputType<{
26
- message: z.ZodString;
27
- }, z.ZodUnknown, "strip">, z.objectInputType<{
28
- message: z.ZodString;
29
- }, z.ZodUnknown, "strip">>, "many">>;
30
- }, "strip", z.ZodUnknown, z.objectOutputType<{
31
- status: z.ZodString;
32
- validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
33
- message: z.ZodString;
34
- }, "strip", z.ZodUnknown, z.objectOutputType<{
35
- message: z.ZodString;
36
- }, z.ZodUnknown, "strip">, z.objectInputType<{
37
- message: z.ZodString;
38
- }, z.ZodUnknown, "strip">>, "many">>;
39
- }, z.ZodUnknown, "strip">, z.objectInputType<{
40
- status: z.ZodString;
41
- validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
42
- message: z.ZodString;
43
- }, "strip", z.ZodUnknown, z.objectOutputType<{
44
- message: z.ZodString;
45
- }, z.ZodUnknown, "strip">, z.objectInputType<{
46
- message: z.ZodString;
47
- }, z.ZodUnknown, "strip">>, "many">>;
48
- }, z.ZodUnknown, "strip">>;
49
- verification_errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
50
- }, z.ZodUnknown, "strip"> | null, z.ZodTypeDef, z.objectOutputType<{
51
- id: z.ZodString;
52
- status: z.ZodString;
53
- ssl: z.ZodObject<{
54
- status: z.ZodString;
55
- validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
56
- message: z.ZodString;
57
- }, "strip", z.ZodUnknown, z.objectOutputType<{
58
- message: z.ZodString;
59
- }, z.ZodUnknown, "strip">, z.objectInputType<{
60
- message: z.ZodString;
61
- }, z.ZodUnknown, "strip">>, "many">>;
62
- }, "strip", z.ZodUnknown, z.objectOutputType<{
63
- status: z.ZodString;
64
- validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
65
- message: z.ZodString;
66
- }, "strip", z.ZodUnknown, z.objectOutputType<{
67
- message: z.ZodString;
68
- }, z.ZodUnknown, "strip">, z.objectInputType<{
69
- message: z.ZodString;
70
- }, z.ZodUnknown, "strip">>, "many">>;
71
- }, z.ZodUnknown, "strip">, z.objectInputType<{
72
- status: z.ZodString;
73
- validation_errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
74
- message: z.ZodString;
75
- }, "strip", z.ZodUnknown, z.objectOutputType<{
76
- message: z.ZodString;
77
- }, z.ZodUnknown, "strip">, z.objectInputType<{
78
- message: z.ZodString;
79
- }, z.ZodUnknown, "strip">>, "many">>;
80
- }, z.ZodUnknown, "strip">>;
81
- verification_errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
82
- }, z.ZodUnknown, "strip"> | null>;
18
+ cloudflareData: z.ZodType<{
19
+ status: string;
20
+ id: string;
21
+ ssl: {
22
+ status: string;
23
+ validation_errors?: {
24
+ message: string;
25
+ }[] | undefined;
26
+ };
27
+ verification_errors?: string[] | undefined;
28
+ } | null, z.ZodTypeDef, {
29
+ status: string;
30
+ id: string;
31
+ ssl: {
32
+ status: string;
33
+ validation_errors?: {
34
+ message: string;
35
+ }[] | undefined;
36
+ };
37
+ verification_errors?: string[] | undefined;
38
+ } | null>;
83
39
  updatedAt: z.ZodType<number, z.ZodTypeDef, number>;
84
40
  createdAt: z.ZodType<number, z.ZodTypeDef, number>;
85
41
  }, "status" | "id" | "domain" | "errorMessage" | "dnsRecords">, "strip", z.ZodTypeAny, {
@@ -9,6 +9,7 @@ export type HookEventPayload = {
9
9
  sessionId?: string;
10
10
  userAgent?: string;
11
11
  userId?: string;
12
+ userIp?: string;
12
13
  user?: Pick<User, (typeof userInfoSelectFields)[number]>;
13
14
  application?: Pick<Application, 'id' | 'type' | 'name' | 'description'>;
14
15
  } & Record<string, unknown>;
@@ -23,3 +23,6 @@ export * from './mfa.js';
23
23
  export * from './organization.js';
24
24
  export * from './sso-connector.js';
25
25
  export * from './tenant.js';
26
+ export * from './tenant-organization.js';
27
+ export * from './mapi-proxy.js';
28
+ export * from './consent.js';
@@ -23,3 +23,6 @@ export * from './mfa.js';
23
23
  export * from './organization.js';
24
24
  export * from './sso-connector.js';
25
25
  export * from './tenant.js';
26
+ export * from './tenant-organization.js';
27
+ export * from './mapi-proxy.js';
28
+ export * from './consent.js';
@@ -39,13 +39,13 @@ export declare const phonePasswordPayloadGuard: z.ZodObject<{
39
39
  export type PhonePasswordPayload = z.infer<typeof phonePasswordPayloadGuard>;
40
40
  export declare const socialConnectorPayloadGuard: z.ZodObject<{
41
41
  connectorId: z.ZodString;
42
- connectorData: z.ZodRecord<z.ZodString, z.ZodType<import("../foundations/index.js").Json, z.ZodTypeDef, import("../foundations/index.js").Json>>;
42
+ connectorData: z.ZodRecord<z.ZodString, z.ZodType<import("@withtyped/server/lib/types.js").Json, z.ZodTypeDef, import("@withtyped/server/lib/types.js").Json>>;
43
43
  }, "strip", z.ZodTypeAny, {
44
44
  connectorId: string;
45
- connectorData: Record<string, import("../foundations/index.js").Json>;
45
+ connectorData: Record<string, import("@withtyped/server/lib/types.js").Json>;
46
46
  }, {
47
47
  connectorId: string;
48
- connectorData: Record<string, import("../foundations/index.js").Json>;
48
+ connectorData: Record<string, import("@withtyped/server/lib/types.js").Json>;
49
49
  }>;
50
50
  export type SocialConnectorPayload = z.infer<typeof socialConnectorPayloadGuard>;
51
51
  export declare const socialEmailPayloadGuard: z.ZodObject<{
@@ -123,13 +123,13 @@ export declare const identifierPayloadGuard: z.ZodUnion<[z.ZodObject<{
123
123
  verificationCode: string;
124
124
  }>, z.ZodObject<{
125
125
  connectorId: z.ZodString;
126
- connectorData: z.ZodRecord<z.ZodString, z.ZodType<import("../foundations/index.js").Json, z.ZodTypeDef, import("../foundations/index.js").Json>>;
126
+ connectorData: z.ZodRecord<z.ZodString, z.ZodType<import("@withtyped/server/lib/types.js").Json, z.ZodTypeDef, import("@withtyped/server/lib/types.js").Json>>;
127
127
  }, "strip", z.ZodTypeAny, {
128
128
  connectorId: string;
129
- connectorData: Record<string, import("../foundations/index.js").Json>;
129
+ connectorData: Record<string, import("@withtyped/server/lib/types.js").Json>;
130
130
  }, {
131
131
  connectorId: string;
132
- connectorData: Record<string, import("../foundations/index.js").Json>;
132
+ connectorData: Record<string, import("@withtyped/server/lib/types.js").Json>;
133
133
  }>, z.ZodObject<{
134
134
  connectorId: z.ZodString;
135
135
  email: z.ZodString;
@@ -1,6 +1,5 @@
1
1
  import type { ZodType } from 'zod';
2
2
  import { z } from 'zod';
3
- import { TenantTag } from './tenant.js';
4
3
  /**
5
4
  * Logto OIDC signing key types, used mainly in REST API routes.
6
5
  */
@@ -48,33 +47,60 @@ export declare const adminConsoleDataGuard: z.ZodObject<{
48
47
  organizationCreated: z.ZodBoolean;
49
48
  developmentTenantMigrationNotification: z.ZodOptional<z.ZodObject<{
50
49
  isPaidTenant: z.ZodBoolean;
51
- tag: z.ZodNativeEnum<typeof TenantTag>;
50
+ /**
51
+ * Tag is used to store the original tenant tag before dev tenant migration.
52
+ * This field is only used for DB rollback and because the `TenantTag` may change, so we don't guard it as the `TenantTag` type.
53
+ */
54
+ tag: z.ZodString;
52
55
  readAt: z.ZodOptional<z.ZodNumber>;
53
56
  }, "strip", z.ZodTypeAny, {
54
57
  isPaidTenant: boolean;
55
- tag: TenantTag;
58
+ tag: string;
56
59
  readAt?: number | undefined;
57
60
  }, {
58
61
  isPaidTenant: boolean;
59
- tag: TenantTag;
62
+ tag: string;
60
63
  readAt?: number | undefined;
61
64
  }>>;
65
+ checkedChargeNotification: z.ZodOptional<z.ZodObject<{
66
+ token: z.ZodOptional<z.ZodBoolean>;
67
+ apiResource: z.ZodOptional<z.ZodBoolean>;
68
+ machineToMachineApp: z.ZodOptional<z.ZodBoolean>;
69
+ }, "strip", z.ZodTypeAny, {
70
+ token?: boolean | undefined;
71
+ apiResource?: boolean | undefined;
72
+ machineToMachineApp?: boolean | undefined;
73
+ }, {
74
+ token?: boolean | undefined;
75
+ apiResource?: boolean | undefined;
76
+ machineToMachineApp?: boolean | undefined;
77
+ }>>;
62
78
  }, "strip", z.ZodTypeAny, {
63
79
  signInExperienceCustomized: boolean;
64
80
  organizationCreated: boolean;
65
81
  developmentTenantMigrationNotification?: {
66
82
  isPaidTenant: boolean;
67
- tag: TenantTag;
83
+ tag: string;
68
84
  readAt?: number | undefined;
69
85
  } | undefined;
86
+ checkedChargeNotification?: {
87
+ token?: boolean | undefined;
88
+ apiResource?: boolean | undefined;
89
+ machineToMachineApp?: boolean | undefined;
90
+ } | undefined;
70
91
  }, {
71
92
  signInExperienceCustomized: boolean;
72
93
  organizationCreated: boolean;
73
94
  developmentTenantMigrationNotification?: {
74
95
  isPaidTenant: boolean;
75
- tag: TenantTag;
96
+ tag: string;
76
97
  readAt?: number | undefined;
77
98
  } | undefined;
99
+ checkedChargeNotification?: {
100
+ token?: boolean | undefined;
101
+ apiResource?: boolean | undefined;
102
+ machineToMachineApp?: boolean | undefined;
103
+ } | undefined;
78
104
  }>;
79
105
  export type AdminConsoleData = z.infer<typeof adminConsoleDataGuard>;
80
106
  export declare const cloudConnectionDataGuard: z.ZodObject<{
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- import { TenantTag } from './tenant.js';
3
2
  /**
4
3
  * Logto OIDC signing key types, used mainly in REST API routes.
5
4
  */
@@ -40,10 +39,21 @@ export const adminConsoleDataGuard = z.object({
40
39
  developmentTenantMigrationNotification: z
41
40
  .object({
42
41
  isPaidTenant: z.boolean(),
43
- tag: z.nativeEnum(TenantTag),
42
+ /**
43
+ * Tag is used to store the original tenant tag before dev tenant migration.
44
+ * This field is only used for DB rollback and because the `TenantTag` may change, so we don't guard it as the `TenantTag` type.
45
+ */
46
+ tag: z.string(),
44
47
  readAt: z.number().optional(),
45
48
  })
46
49
  .optional(),
50
+ checkedChargeNotification: z
51
+ .object({
52
+ token: z.boolean().optional(),
53
+ apiResource: z.boolean().optional(),
54
+ machineToMachineApp: z.boolean().optional(),
55
+ })
56
+ .optional(),
47
57
  });
48
58
  /* --- Logto tenant cloud connection config --- */
49
59
  export const cloudConnectionDataGuard = z.object({
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @fileoverview
3
+ * Mapi (Management API) proxy is an endpoint in Logto Cloud that proxies the requests to the
4
+ * corresponding Management API. It has the following benefits:
5
+ *
6
+ * - When we migrate the tenant management from API resources to tenant organizations, we can
7
+ * migrate Console to use the mapi proxy endpoint by changing only the base URL.
8
+ * - It decouples the access control of Cloud user collaboration from the machine-to-machine access
9
+ * control of the Management API.
10
+ * - The mapi proxy endpoint shares the same domain with Logto Cloud, so it can be used in the
11
+ * browser without CORS.
12
+ *
13
+ * This module provides utilities to manage mapi proxy.
14
+ */
15
+ import { type Role, type CreateApplication } from '../db-entries/index.js';
16
+ /**
17
+ * Given a tenant ID, return the role data for the mapi proxy.
18
+ *
19
+ * It follows a convention to generate all the fields which can be used across the system. See
20
+ * source code for details.
21
+ */
22
+ export declare const getMapiProxyRole: (tenantId: string) => Readonly<Role>;
23
+ /**
24
+ * Given a tenant ID, return the application create data for the mapi proxy. The proxy will use the
25
+ * application to access the Management API.
26
+ *
27
+ * It follows a convention to generate all the fields which can be used across the system. See
28
+ * source code for details.
29
+ */
30
+ export declare const getMapiProxyM2mApp: (tenantId: string) => Readonly<CreateApplication>;
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @fileoverview
3
+ * Mapi (Management API) proxy is an endpoint in Logto Cloud that proxies the requests to the
4
+ * corresponding Management API. It has the following benefits:
5
+ *
6
+ * - When we migrate the tenant management from API resources to tenant organizations, we can
7
+ * migrate Console to use the mapi proxy endpoint by changing only the base URL.
8
+ * - It decouples the access control of Cloud user collaboration from the machine-to-machine access
9
+ * control of the Management API.
10
+ * - The mapi proxy endpoint shares the same domain with Logto Cloud, so it can be used in the
11
+ * browser without CORS.
12
+ *
13
+ * This module provides utilities to manage mapi proxy.
14
+ */
15
+ import { generateStandardSecret } from '@logto/shared/universal';
16
+ import { RoleType, ApplicationType, } from '../db-entries/index.js';
17
+ import { adminTenantId } from '../seeds/tenant.js';
18
+ /**
19
+ * Given a tenant ID, return the role data for the mapi proxy.
20
+ *
21
+ * It follows a convention to generate all the fields which can be used across the system. See
22
+ * source code for details.
23
+ */
24
+ export const getMapiProxyRole = (tenantId) => Object.freeze({
25
+ tenantId: adminTenantId,
26
+ id: `m-${tenantId}`,
27
+ name: `machine:mapi:${tenantId}`,
28
+ description: `Machine-to-machine role for accessing Management API of tenant '${tenantId}'.`,
29
+ type: RoleType.MachineToMachine,
30
+ });
31
+ /**
32
+ * Given a tenant ID, return the application create data for the mapi proxy. The proxy will use the
33
+ * application to access the Management API.
34
+ *
35
+ * It follows a convention to generate all the fields which can be used across the system. See
36
+ * source code for details.
37
+ */
38
+ export const getMapiProxyM2mApp = (tenantId) => Object.freeze({
39
+ tenantId: adminTenantId,
40
+ id: `m-${tenantId}`,
41
+ secret: generateStandardSecret(32),
42
+ name: `Management API access for ${tenantId}`,
43
+ description: `Machine-to-machine app for accessing Management API of tenant '${tenantId}'.`,
44
+ type: ApplicationType.MachineToMachine,
45
+ oidcClientMetadata: {
46
+ redirectUris: [],
47
+ postLogoutRedirectUris: [],
48
+ },
49
+ });
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { type OrganizationRole, type Organization } from '../db-entries/index.js';
2
+ import { type OrganizationRole, type Organization, type OrganizationInvitation } from '../db-entries/index.js';
3
3
  import { type UserInfo, type FeaturedUser } from './user.js';
4
4
  /**
5
5
  * The simplified organization scope entity that is returned for some endpoints.
@@ -46,3 +46,12 @@ export type OrganizationWithFeatured = Organization & {
46
46
  usersCount?: number;
47
47
  featuredUsers?: FeaturedUser[];
48
48
  };
49
+ /**
50
+ * The organization invitation with additional fields:
51
+ *
52
+ * - `organizationRoles`: The roles to be assigned to the user when accepting the invitation.
53
+ */
54
+ export type OrganizationInvitationEntity = OrganizationInvitation & {
55
+ organizationRoles: OrganizationRoleEntity[];
56
+ };
57
+ export declare const organizationInvitationEntityGuard: z.ZodType<OrganizationInvitationEntity>;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { OrganizationRoles, Organizations, } from '../db-entries/index.js';
2
+ import { OrganizationRoles, Organizations, OrganizationInvitations, } from '../db-entries/index.js';
3
3
  import { userInfoGuard } from './user.js';
4
4
  export const organizationRoleWithScopesGuard = OrganizationRoles.guard.extend({
5
5
  scopes: z
@@ -19,3 +19,6 @@ export const organizationWithOrganizationRolesGuard = Organizations.guard.extend
19
19
  export const userWithOrganizationRolesGuard = userInfoGuard.extend({
20
20
  organizationRoles: organizationRoleEntityGuard.array(),
21
21
  });
22
+ export const organizationInvitationEntityGuard = OrganizationInvitations.guard.extend({
23
+ organizationRoles: organizationRoleEntityGuard.array(),
24
+ });
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { type SsoConnector } from '../db-entries/sso-connector.js';
2
3
  /**
3
4
  * SSO Connector data type that are returned to the experience client for sign-in use.
4
5
  */
@@ -19,118 +20,114 @@ export declare const ssoConnectorMetadataGuard: z.ZodObject<{
19
20
  darkLogo?: string | undefined;
20
21
  }>;
21
22
  export type SsoConnectorMetadata = z.infer<typeof ssoConnectorMetadataGuard>;
22
- declare const ssoConnectorFactoryDetailGuard: z.ZodObject<{
23
- providerName: z.ZodString;
23
+ export declare enum SsoProviderName {
24
+ OIDC = "OIDC",
25
+ SAML = "SAML",
26
+ AZURE_AD = "AzureAD",
27
+ GOOGLE_WORKSPACE = "GoogleWorkspace",
28
+ OKTA = "Okta"
29
+ }
30
+ export declare const singleSignOnDomainBlackList: readonly string[];
31
+ export type SupportedSsoConnector = Omit<SsoConnector, 'providerName'> & {
32
+ providerName: SsoProviderName;
33
+ };
34
+ declare const ssoConnectorProviderDetailGuard: z.ZodObject<{
35
+ providerName: z.ZodNativeEnum<typeof SsoProviderName>;
24
36
  logo: z.ZodString;
37
+ logoDark: z.ZodString;
25
38
  description: z.ZodString;
39
+ name: z.ZodString;
26
40
  }, "strip", z.ZodTypeAny, {
41
+ name: string;
27
42
  logo: string;
28
43
  description: string;
29
- providerName: string;
44
+ logoDark: string;
45
+ providerName: SsoProviderName;
30
46
  }, {
47
+ name: string;
31
48
  logo: string;
32
49
  description: string;
33
- providerName: string;
50
+ logoDark: string;
51
+ providerName: SsoProviderName;
34
52
  }>;
35
- export type SsoConnectorFactoryDetail = z.infer<typeof ssoConnectorFactoryDetailGuard>;
36
- export declare const ssoConnectorFactoriesResponseGuard: z.ZodObject<{
37
- standardConnectors: z.ZodArray<z.ZodObject<{
38
- providerName: z.ZodString;
39
- logo: z.ZodString;
40
- description: z.ZodString;
41
- }, "strip", z.ZodTypeAny, {
42
- logo: string;
43
- description: string;
44
- providerName: string;
45
- }, {
46
- logo: string;
47
- description: string;
48
- providerName: string;
49
- }>, "many">;
50
- providerConnectors: z.ZodArray<z.ZodObject<{
51
- providerName: z.ZodString;
52
- logo: z.ZodString;
53
- description: z.ZodString;
54
- }, "strip", z.ZodTypeAny, {
55
- logo: string;
56
- description: string;
57
- providerName: string;
58
- }, {
59
- logo: string;
60
- description: string;
61
- providerName: string;
62
- }>, "many">;
53
+ export type SsoConnectorProviderDetail = z.infer<typeof ssoConnectorProviderDetailGuard>;
54
+ export declare const ssoConnectorProvidersResponseGuard: z.ZodArray<z.ZodObject<{
55
+ providerName: z.ZodNativeEnum<typeof SsoProviderName>;
56
+ logo: z.ZodString;
57
+ logoDark: z.ZodString;
58
+ description: z.ZodString;
59
+ name: z.ZodString;
63
60
  }, "strip", z.ZodTypeAny, {
64
- standardConnectors: {
65
- logo: string;
66
- description: string;
67
- providerName: string;
68
- }[];
69
- providerConnectors: {
70
- logo: string;
71
- description: string;
72
- providerName: string;
73
- }[];
61
+ name: string;
62
+ logo: string;
63
+ description: string;
64
+ logoDark: string;
65
+ providerName: SsoProviderName;
74
66
  }, {
75
- standardConnectors: {
76
- logo: string;
77
- description: string;
78
- providerName: string;
79
- }[];
80
- providerConnectors: {
81
- logo: string;
82
- description: string;
83
- providerName: string;
84
- }[];
85
- }>;
86
- export type SsoConnectorFactoriesResponse = z.infer<typeof ssoConnectorFactoriesResponseGuard>;
67
+ name: string;
68
+ logo: string;
69
+ description: string;
70
+ logoDark: string;
71
+ providerName: SsoProviderName;
72
+ }>, "many">;
73
+ export type SsoConnectorProvidersResponse = z.infer<typeof ssoConnectorProvidersResponseGuard>;
87
74
  export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<{
88
75
  id: z.ZodType<string, z.ZodTypeDef, string>;
89
76
  tenantId: z.ZodType<string, z.ZodTypeDef, string>;
90
77
  createdAt: z.ZodType<number, z.ZodTypeDef, number>;
91
- syncProfile: z.ZodType<boolean, z.ZodTypeDef, boolean>;
92
- config: z.ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
93
- domains: z.ZodType<string[], z.ZodTypeDef, string[]>;
94
78
  branding: z.ZodType<{
79
+ displayName?: string | undefined;
95
80
  logo?: string | undefined;
96
81
  darkLogo?: string | undefined;
97
82
  }, z.ZodTypeDef, {
83
+ displayName?: string | undefined;
98
84
  logo?: string | undefined;
99
85
  darkLogo?: string | undefined;
100
86
  }>;
101
- providerName: z.ZodType<string, z.ZodTypeDef, string>;
87
+ syncProfile: z.ZodType<boolean, z.ZodTypeDef, boolean>;
88
+ config: z.ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
89
+ domains: z.ZodType<string[], z.ZodTypeDef, string[]>;
102
90
  connectorName: z.ZodType<string, z.ZodTypeDef, string>;
91
+ name: z.ZodString;
92
+ providerName: z.ZodNativeEnum<typeof SsoProviderName>;
103
93
  providerLogo: z.ZodString;
94
+ providerLogoDark: z.ZodString;
104
95
  providerConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
105
96
  }, "strip", z.ZodTypeAny, {
97
+ name: string;
106
98
  id: string;
107
99
  tenantId: string;
108
100
  createdAt: number;
109
- syncProfile: boolean;
110
- config: import("@withtyped/server").JsonObject;
111
- domains: string[];
112
101
  branding: {
102
+ displayName?: string | undefined;
113
103
  logo?: string | undefined;
114
104
  darkLogo?: string | undefined;
115
105
  };
116
- providerName: string;
106
+ syncProfile: boolean;
107
+ config: import("@withtyped/server").JsonObject;
108
+ domains: string[];
109
+ providerName: SsoProviderName;
117
110
  connectorName: string;
118
111
  providerLogo: string;
112
+ providerLogoDark: string;
119
113
  providerConfig?: Record<string, unknown> | undefined;
120
114
  }, {
115
+ name: string;
121
116
  id: string;
122
117
  tenantId: string;
123
118
  createdAt: number;
124
- syncProfile: boolean;
125
- config: import("@withtyped/server").JsonObject;
126
- domains: string[];
127
119
  branding: {
120
+ displayName?: string | undefined;
128
121
  logo?: string | undefined;
129
122
  darkLogo?: string | undefined;
130
123
  };
131
- providerName: string;
124
+ syncProfile: boolean;
125
+ config: import("@withtyped/server").JsonObject;
126
+ domains: string[];
127
+ providerName: SsoProviderName;
132
128
  connectorName: string;
133
129
  providerLogo: string;
130
+ providerLogoDark: string;
134
131
  providerConfig?: Record<string, unknown> | undefined;
135
132
  }>;
136
133
  export type SsoConnectorWithProviderConfig = z.infer<typeof ssoConnectorWithProviderConfigGuard>;
@@ -9,16 +9,50 @@ export const ssoConnectorMetadataGuard = z.object({
9
9
  logo: z.string(),
10
10
  darkLogo: z.string().optional(),
11
11
  });
12
- const ssoConnectorFactoryDetailGuard = z.object({
13
- providerName: z.string(),
12
+ export var SsoProviderName;
13
+ (function (SsoProviderName) {
14
+ SsoProviderName["OIDC"] = "OIDC";
15
+ SsoProviderName["SAML"] = "SAML";
16
+ SsoProviderName["AZURE_AD"] = "AzureAD";
17
+ SsoProviderName["GOOGLE_WORKSPACE"] = "GoogleWorkspace";
18
+ SsoProviderName["OKTA"] = "Okta";
19
+ })(SsoProviderName || (SsoProviderName = {}));
20
+ export const singleSignOnDomainBlackList = Object.freeze([
21
+ 'gmail.com',
22
+ 'yahoo.com',
23
+ 'hotmail.com',
24
+ 'outlook.com',
25
+ 'live.com',
26
+ 'icloud.com',
27
+ 'aol.com',
28
+ 'yandex.com',
29
+ 'mail.com',
30
+ 'protonmail.com',
31
+ 'yanex.com',
32
+ 'gmx.com',
33
+ 'mail.ru',
34
+ 'zoho.com',
35
+ 'qq.com',
36
+ '163.com',
37
+ '126.com',
38
+ 'sina.com',
39
+ 'sohu.com',
40
+ ]);
41
+ const ssoConnectorProviderDetailGuard = z.object({
42
+ providerName: z.nativeEnum(SsoProviderName),
14
43
  logo: z.string(),
44
+ logoDark: z.string(),
15
45
  description: z.string(),
46
+ name: z.string(),
16
47
  });
17
- export const ssoConnectorFactoriesResponseGuard = z.object({
18
- standardConnectors: z.array(ssoConnectorFactoryDetailGuard),
19
- providerConnectors: z.array(ssoConnectorFactoryDetailGuard),
20
- });
21
- export const ssoConnectorWithProviderConfigGuard = SsoConnectors.guard.merge(z.object({
48
+ export const ssoConnectorProvidersResponseGuard = z.array(ssoConnectorProviderDetailGuard);
49
+ // API response guard for all the SSO connectors CRUD APIs
50
+ export const ssoConnectorWithProviderConfigGuard = SsoConnectors.guard
51
+ .omit({ providerName: true })
52
+ .merge(z.object({
53
+ name: z.string(), // For display purpose, generate from i18n key name defined by SSO factory.
54
+ providerName: z.nativeEnum(SsoProviderName),
22
55
  providerLogo: z.string(),
56
+ providerLogoDark: z.string(),
23
57
  providerConfig: z.record(z.unknown()).optional(),
24
58
  }));
@@ -175,19 +175,46 @@ export declare const demoSocialGuard: Readonly<{
175
175
  export declare const hostnameProviderDataGuard: z.ZodObject<{
176
176
  zoneId: z.ZodString;
177
177
  apiToken: z.ZodString;
178
+ blockedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
178
179
  }, "strip", z.ZodTypeAny, {
179
180
  zoneId: string;
180
181
  apiToken: string;
182
+ blockedDomains?: string[] | undefined;
181
183
  }, {
182
184
  zoneId: string;
183
185
  apiToken: string;
186
+ blockedDomains?: string[] | undefined;
184
187
  }>;
185
188
  export type HostnameProviderData = z.infer<typeof hostnameProviderDataGuard>;
189
+ export declare const protectedAppConfigProviderDataGuard: z.ZodObject<{
190
+ accountIdentifier: z.ZodString;
191
+ namespaceIdentifier: z.ZodString;
192
+ keyName: z.ZodString;
193
+ domain: z.ZodString;
194
+ apiToken: z.ZodString;
195
+ }, "strip", z.ZodTypeAny, {
196
+ domain: string;
197
+ apiToken: string;
198
+ accountIdentifier: string;
199
+ namespaceIdentifier: string;
200
+ keyName: string;
201
+ }, {
202
+ domain: string;
203
+ apiToken: string;
204
+ accountIdentifier: string;
205
+ namespaceIdentifier: string;
206
+ keyName: string;
207
+ }>;
208
+ export type ProtectedAppConfigProviderData = z.infer<typeof protectedAppConfigProviderDataGuard>;
186
209
  export declare enum CloudflareKey {
187
- HostnameProvider = "cloudflareHostnameProvider"
210
+ HostnameProvider = "cloudflareHostnameProvider",
211
+ ProtectedAppConfigProvider = "cloudflareProtectedAppConfigProvider",
212
+ ProtectedAppHostnameProvider = "cloudflareProtectedAppHostnameProvider"
188
213
  }
189
214
  export type CloudflareType = {
190
215
  [CloudflareKey.HostnameProvider]: HostnameProviderData;
216
+ [CloudflareKey.ProtectedAppConfigProvider]: ProtectedAppConfigProviderData;
217
+ [CloudflareKey.ProtectedAppHostnameProvider]: HostnameProviderData;
191
218
  };
192
219
  export declare const cloudflareGuard: Readonly<{
193
220
  [key in CloudflareKey]: ZodType<CloudflareType[key]>;