@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
@@ -7,25 +7,20 @@ export const domainDnsRecordGuard = z.object({
7
7
  export const domainDnsRecordsGuard = domainDnsRecordGuard.array();
8
8
  // https://developers.cloudflare.com/api/operations/custom-hostname-for-a-zone-list-custom-hostnames#Responses
9
9
  // Predefine the "useful" fields
10
- export const cloudflareDataGuard = z
11
- .object({
10
+ export const cloudflareDataGuard = z.object({
12
11
  id: z.string(),
13
12
  status: z.string(),
14
- ssl: z
15
- .object({
13
+ ssl: z.object({
16
14
  status: z.string(),
17
15
  validation_errors: z
18
16
  .object({
19
17
  message: z.string(),
20
18
  })
21
- .catchall(z.unknown())
22
19
  .array()
23
20
  .optional(),
24
- })
25
- .catchall(z.unknown()),
21
+ }),
26
22
  verification_errors: z.string().array().optional(),
27
- })
28
- .catchall(z.unknown());
23
+ });
29
24
  export var DomainStatus;
30
25
  (function (DomainStatus) {
31
26
  DomainStatus["PendingVerification"] = "PendingVerification";
@@ -9,6 +9,7 @@ export * from './sign-in-experience.js';
9
9
  export * from './sentinel.js';
10
10
  export * from './users.js';
11
11
  export * from './sso-connector.js';
12
+ export * from './applications.js';
12
13
  export { configurableConnectorMetadataGuard, type ConfigurableConnectorMetadata, } from '@logto/connector-kit';
13
14
  export type { Json, JsonObject } from '@withtyped/server';
14
15
  export declare const jsonGuard: z.ZodType<Json>;
@@ -8,6 +8,7 @@ export * from './sign-in-experience.js';
8
8
  export * from './sentinel.js';
9
9
  export * from './users.js';
10
10
  export * from './sso-connector.js';
11
+ export * from './applications.js';
11
12
  export { configurableConnectorMetadataGuard, } from '@logto/connector-kit';
12
13
  /* === Commonly Used === */
13
14
  // Copied from https://github.com/colinhacks/zod#json-type
@@ -2,12 +2,15 @@ import { z } from 'zod';
2
2
  export declare const ssoDomainsGuard: z.ZodArray<z.ZodString, "many">;
3
3
  export type SsoDomains = z.infer<typeof ssoDomainsGuard>;
4
4
  export declare const ssoBrandingGuard: z.ZodObject<{
5
+ displayName: z.ZodOptional<z.ZodString>;
5
6
  logo: z.ZodOptional<z.ZodString>;
6
7
  darkLogo: z.ZodOptional<z.ZodString>;
7
8
  }, "strip", z.ZodTypeAny, {
9
+ displayName?: string | undefined;
8
10
  logo?: string | undefined;
9
11
  darkLogo?: string | undefined;
10
12
  }, {
13
+ displayName?: string | undefined;
11
14
  logo?: string | undefined;
12
15
  darkLogo?: string | undefined;
13
16
  }>;
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  export const ssoDomainsGuard = z.array(z.string());
3
3
  export const ssoBrandingGuard = z.object({
4
+ displayName: z.string().optional(),
4
5
  logo: z.string().optional(),
5
6
  darkLogo: z.string().optional(),
6
7
  });
@@ -1,7 +1,7 @@
1
1
  import type { InferModelType } from '@withtyped/server/model';
2
2
  import { z } from 'zod';
3
3
  import { TenantTag } from '../types/tenant.js';
4
- export declare const Tenants: import("@withtyped/server/model").default<"tenants", {
4
+ export declare const Tenants: import("@withtyped/server/lib/model/index.js").default<"tenants", {
5
5
  id: string;
6
6
  dbUser: string | null;
7
7
  dbUserPassword: string | null;
@@ -9,5 +9,5 @@ export declare const demoAppApplicationId = "demo-app";
9
9
  export declare const buildDemoAppDataForTenant: (tenantId: string) => Application;
10
10
  export declare const createDefaultAdminConsoleApplication: () => Readonly<CreateApplication>;
11
11
  export declare const createTenantMachineToMachineApplication: (tenantId: string) => Readonly<CreateApplication>;
12
- /** Create role for "tenant application (M2M)" in admin tenant */
12
+ /** Create an entry to assign a role to an application in the admin tenant. */
13
13
  export declare const createAdminTenantApplicationRole: (applicationId: string, roleId: string) => Readonly<CreateApplicationsRole>;
@@ -17,6 +17,8 @@ export const buildDemoAppDataForTenant = (tenantId) => ({
17
17
  type: ApplicationType.SPA,
18
18
  oidcClientMetadata: { redirectUris: [], postLogoutRedirectUris: [] },
19
19
  customClientMetadata: {},
20
+ protectedAppMetadata: null,
21
+ isThirdParty: false,
20
22
  createdAt: 0,
21
23
  });
22
24
  export const createDefaultAdminConsoleApplication = () => Object.freeze({
@@ -43,7 +45,7 @@ export const createTenantMachineToMachineApplication = (tenantId) => Object.free
43
45
  tenantId,
44
46
  },
45
47
  });
46
- /** Create role for "tenant application (M2M)" in admin tenant */
48
+ /** Create an entry to assign a role to an application in the admin tenant. */
47
49
  export const createAdminTenantApplicationRole = (applicationId, roleId) => Object.freeze({
48
50
  id: generateStandardId(),
49
51
  tenantId: adminTenantId,
@@ -5,8 +5,6 @@ export declare const cloudApiIndicator = "https://cloud.logto.io/api";
5
5
  export declare enum CloudScope {
6
6
  /** The user can create a user tenant. */
7
7
  CreateTenant = "create:tenant",
8
- /** The user can perform arbitrary operations on any tenant. */
9
- ManageTenant = "manage:tenant",
10
8
  /** The user can update or delete its own tenants. */
11
9
  ManageTenantSelf = "manage:tenant:self",
12
10
  SendSms = "send:sms",
@@ -8,8 +8,6 @@ export var CloudScope;
8
8
  (function (CloudScope) {
9
9
  /** The user can create a user tenant. */
10
10
  CloudScope["CreateTenant"] = "create:tenant";
11
- /** The user can perform arbitrary operations on any tenant. */
12
- CloudScope["ManageTenant"] = "manage:tenant";
13
11
  /** The user can update or delete its own tenants. */
14
12
  CloudScope["ManageTenantSelf"] = "manage:tenant:self";
15
13
  CloudScope["SendSms"] = "send:sms";
@@ -45,7 +43,6 @@ export const createCloudApi = () => {
45
43
  name: AdminTenantRole.User,
46
44
  },
47
45
  },
48
- buildScope(CloudScope.ManageTenant, 'Allow managing existing tenants, including create without limitation, update, and delete.'),
49
46
  buildScope(CloudScope.SendEmail, 'Allow sending emails. This scope is only available to M2M application.'),
50
47
  buildScope(CloudScope.SendSms, 'Allow sending SMS. This scope is only available to M2M application.'),
51
48
  buildScope(CloudScope.CreateAffiliate, 'Allow creating new affiliates and logs.'),
@@ -1,5 +1,9 @@
1
1
  import { RoleType, type CreateResource, type CreateRole, type CreateScope } from '../db-entries/index.js';
2
- import { PredefinedScope, InternalRole } from '../types/index.js';
2
+ import { PredefinedScope, InternalRole, AdminTenantRole } from '../types/index.js';
3
+ /**
4
+ * The Management API data for a tenant. Usually used for creating a new tenant in the admin
5
+ * tenant.
6
+ */
3
7
  export type AdminData = {
4
8
  resource: CreateResource;
5
9
  scopes: CreateScope[];
@@ -32,6 +36,10 @@ export declare const defaultManagementApi: Readonly<{
32
36
  /** @deprecated You should not rely on this constant. Change to something else. */
33
37
  resourceId: string;
34
38
  }[];
39
+ /**
40
+ * An internal user role for Management API of the `default` tenant.
41
+ * @deprecated This role will be removed soon.
42
+ */
35
43
  role: {
36
44
  tenantId: string;
37
45
  /** @deprecated You should not rely on this constant. Change to something else. */
@@ -43,9 +51,72 @@ export declare const defaultManagementApi: Readonly<{
43
51
  }>;
44
52
  export declare function getManagementApiResourceIndicator<TenantId extends string>(tenantId: TenantId): `https://${TenantId}.logto.app/api`;
45
53
  export declare function getManagementApiResourceIndicator<TenantId extends string, Path extends string>(tenantId: TenantId, path: Path): `https://${TenantId}.logto.app/${Path}`;
46
- export declare const getManagementApiAdminName: <TenantId extends string>(tenantId: TenantId) => `${TenantId}:admin`;
54
+ /**
55
+ * The fixed Management API user role for `default` tenant in the admin tenant. It is used for
56
+ * OSS only.
57
+ */
58
+ export declare const defaultManagementApiAdminName: "default:admin";
47
59
  /** Create a set of admin data for Management API of the given tenant ID. */
48
- export declare const createAdminData: (tenantId: string) => AdminData;
49
- /** Create a set of admin data for Management API of the given tenant ID for `admin` tenant. */
50
- export declare const createAdminDataInAdminTenant: (tenantId: string) => AdminData;
51
- export declare const createMeApiInAdminTenant: () => AdminData;
60
+ export declare const createAdminData: (tenantId: string) => Readonly<{
61
+ resource: {
62
+ tenantId: string;
63
+ id: string;
64
+ indicator: `https://${string}.logto.app/api`;
65
+ name: string;
66
+ };
67
+ scopes: {
68
+ tenantId: string;
69
+ id: string;
70
+ name: PredefinedScope;
71
+ description: string;
72
+ resourceId: string;
73
+ }[];
74
+ /** @deprecated This role will be removed soon. */
75
+ role: {
76
+ tenantId: string;
77
+ id: string;
78
+ name: InternalRole;
79
+ description: string;
80
+ type: RoleType.MachineToMachine;
81
+ };
82
+ }>;
83
+ /** Create a set of admin data for Management API of the given tenant ID for the admin tenant. */
84
+ export declare const createAdminDataInAdminTenant: (tenantId: string) => Readonly<{
85
+ resource: {
86
+ tenantId: string;
87
+ id: string;
88
+ indicator: `https://${string}.logto.app/api`;
89
+ name: string;
90
+ };
91
+ scopes: {
92
+ tenantId: string;
93
+ id: string;
94
+ name: PredefinedScope;
95
+ description: string;
96
+ resourceId: string;
97
+ }[];
98
+ /** The machine-to-machine role for the Management API proxy of the given tenant ID. */
99
+ role: Readonly<import("../db-entries/role.js").Role>;
100
+ }>;
101
+ export declare const createMeApiInAdminTenant: () => Readonly<{
102
+ resource: {
103
+ tenantId: string;
104
+ id: string;
105
+ indicator: "https://admin.logto.app/me";
106
+ name: string;
107
+ };
108
+ scopes: {
109
+ tenantId: string;
110
+ id: string;
111
+ name: PredefinedScope;
112
+ description: string;
113
+ resourceId: string;
114
+ }[];
115
+ role: {
116
+ tenantId: string;
117
+ id: string;
118
+ name: AdminTenantRole;
119
+ description: string;
120
+ type: RoleType.User;
121
+ };
122
+ }>;
@@ -1,6 +1,6 @@
1
1
  import { generateStandardId } from '@logto/shared/universal';
2
2
  import { RoleType, } from '../db-entries/index.js';
3
- import { PredefinedScope, InternalRole, AdminTenantRole } from '../types/index.js';
3
+ import { PredefinedScope, InternalRole, AdminTenantRole, getMapiProxyRole, } from '../types/index.js';
4
4
  import { adminTenantId, defaultTenantId } from './tenant.js';
5
5
  // Consider remove the dependency of IDs
6
6
  const defaultResourceId = 'management-api';
@@ -31,6 +31,10 @@ export const defaultManagementApi = Object.freeze({
31
31
  resourceId: defaultResourceId,
32
32
  },
33
33
  ],
34
+ /**
35
+ * An internal user role for Management API of the `default` tenant.
36
+ * @deprecated This role will be removed soon.
37
+ */
34
38
  role: {
35
39
  tenantId: defaultTenantId,
36
40
  /** @deprecated You should not rely on this constant. Change to something else. */
@@ -43,7 +47,11 @@ export const defaultManagementApi = Object.freeze({
43
47
  export function getManagementApiResourceIndicator(tenantId, path = 'api') {
44
48
  return `https://${tenantId}.logto.app/${path}`;
45
49
  }
46
- export const getManagementApiAdminName = (tenantId) => `${tenantId}:${AdminTenantRole.Admin}`;
50
+ /**
51
+ * The fixed Management API user role for `default` tenant in the admin tenant. It is used for
52
+ * OSS only.
53
+ */
54
+ export const defaultManagementApiAdminName = `${defaultTenantId}:admin`;
47
55
  /** Create a set of admin data for Management API of the given tenant ID. */
48
56
  export const createAdminData = (tenantId) => {
49
57
  const resourceId = generateStandardId();
@@ -63,6 +71,7 @@ export const createAdminData = (tenantId) => {
63
71
  resourceId,
64
72
  },
65
73
  ],
74
+ /** @deprecated This role will be removed soon. */
66
75
  role: {
67
76
  tenantId,
68
77
  id: generateStandardId(),
@@ -72,7 +81,7 @@ export const createAdminData = (tenantId) => {
72
81
  },
73
82
  });
74
83
  };
75
- /** Create a set of admin data for Management API of the given tenant ID for `admin` tenant. */
84
+ /** Create a set of admin data for Management API of the given tenant ID for the admin tenant. */
76
85
  export const createAdminDataInAdminTenant = (tenantId) => {
77
86
  const resourceId = generateStandardId();
78
87
  return Object.freeze({
@@ -91,13 +100,8 @@ export const createAdminDataInAdminTenant = (tenantId) => {
91
100
  resourceId,
92
101
  },
93
102
  ],
94
- role: {
95
- tenantId: adminTenantId,
96
- id: generateStandardId(),
97
- name: getManagementApiAdminName(tenantId),
98
- description: `Admin tenant admin role for Logto tenant ${tenantId}.`,
99
- type: RoleType.User,
100
- },
103
+ /** The machine-to-machine role for the Management API proxy of the given tenant ID. */
104
+ role: getMapiProxyRole(tenantId),
101
105
  });
102
106
  };
103
107
  export const createMeApiInAdminTenant = () => {