@logto/schemas 1.12.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alterations/1.13.0-1702274830-add-new-third-party-column-to-applications-table.ts +20 -0
- package/alterations/1.13.0-1702372401-add-application-permissions-tables.ts +93 -0
- package/alterations/1.13.0-1702544178-sync-tenant-orgs.ts +296 -0
- package/alterations/1.13.0-1702871078-protected-application-type.ts +24 -0
- package/alterations/1.13.0-1702877515-protected-app-configs.ts +18 -0
- package/alterations/1.13.0-1702978120-application-sign-in-experience-table.ts +61 -0
- package/alterations/1.13.0-1703229996-daily-token-usage.ts +62 -0
- package/alterations/1.13.0-1703230000-update-tenant-roles.ts +94 -0
- package/alterations/1.13.0-1704692973-remove-legacy-resources.ts +147 -0
- package/alterations/1.13.0-1704934999-add-magic-links-table.ts +37 -0
- package/alterations/1.13.0-1704935001-add-organization-invitation-tables.ts +78 -0
- package/alterations/1.13.0-1705288654-add-application-user-consent-organizations-table.ts +62 -0
- package/alterations/1.13.0-1705991158-update-invitation-indices.ts +32 -0
- package/alterations/1.13.0-1706449174-update-organization-invitation-column.ts +24 -0
- package/alterations/1.13.0-1706510290-protected-app-host-index.ts +21 -0
- package/alterations/1.13.0-1706512952-restore-get-started-page.ts +17 -0
- package/alterations/1.13.0-1706528755-remove-magic-links.ts +46 -0
- package/alterations/1.13.0-1706585206-protected-app-custom-domain-unique.ts +21 -0
- package/alterations/1.13.1-1707360939-grant-is-suspended-read-permission.ts +39 -0
- package/alterations/utils/1704934999-tables.ts +49 -0
- package/alterations/utils/README.md +9 -0
- package/alterations-js/1.13.0-1702274830-add-new-third-party-column-to-applications-table.d.ts +3 -0
- package/alterations-js/1.13.0-1702274830-add-new-third-party-column-to-applications-table.js +16 -0
- package/alterations-js/1.13.0-1702372401-add-application-permissions-tables.d.ts +3 -0
- package/alterations-js/1.13.0-1702372401-add-application-permissions-tables.js +79 -0
- package/alterations-js/1.13.0-1702544178-sync-tenant-orgs.d.ts +18 -0
- package/alterations-js/1.13.0-1702544178-sync-tenant-orgs.js +225 -0
- package/alterations-js/1.13.0-1702871078-protected-application-type.d.ts +3 -0
- package/alterations-js/1.13.0-1702871078-protected-application-type.js +20 -0
- package/alterations-js/1.13.0-1702877515-protected-app-configs.d.ts +3 -0
- package/alterations-js/1.13.0-1702877515-protected-app-configs.js +14 -0
- package/alterations-js/1.13.0-1702978120-application-sign-in-experience-table.d.ts +3 -0
- package/alterations-js/1.13.0-1702978120-application-sign-in-experience-table.js +51 -0
- package/alterations-js/1.13.0-1703229996-daily-token-usage.d.ts +3 -0
- package/alterations-js/1.13.0-1703229996-daily-token-usage.js +51 -0
- package/alterations-js/1.13.0-1703230000-update-tenant-roles.d.ts +11 -0
- package/alterations-js/1.13.0-1703230000-update-tenant-roles.js +87 -0
- package/alterations-js/1.13.0-1704692973-remove-legacy-resources.d.ts +3 -0
- package/alterations-js/1.13.0-1704692973-remove-legacy-resources.js +124 -0
- package/alterations-js/1.13.0-1704934999-add-magic-links-table.d.ts +3 -0
- package/alterations-js/1.13.0-1704934999-add-magic-links-table.js +32 -0
- package/alterations-js/1.13.0-1704935001-add-organization-invitation-tables.d.ts +3 -0
- package/alterations-js/1.13.0-1704935001-add-organization-invitation-tables.js +72 -0
- package/alterations-js/1.13.0-1705288654-add-application-user-consent-organizations-table.d.ts +3 -0
- package/alterations-js/1.13.0-1705288654-add-application-user-consent-organizations-table.js +52 -0
- package/alterations-js/1.13.0-1705991158-update-invitation-indices.d.ts +7 -0
- package/alterations-js/1.13.0-1705991158-update-invitation-indices.js +27 -0
- package/alterations-js/1.13.0-1706449174-update-organization-invitation-column.d.ts +3 -0
- package/alterations-js/1.13.0-1706449174-update-organization-invitation-column.js +20 -0
- package/alterations-js/1.13.0-1706510290-protected-app-host-index.d.ts +3 -0
- package/alterations-js/1.13.0-1706510290-protected-app-host-index.js +17 -0
- package/alterations-js/1.13.0-1706512952-restore-get-started-page.d.ts +3 -0
- package/alterations-js/1.13.0-1706512952-restore-get-started-page.js +13 -0
- package/alterations-js/1.13.0-1706528755-remove-magic-links.d.ts +3 -0
- package/alterations-js/1.13.0-1706528755-remove-magic-links.js +41 -0
- package/alterations-js/1.13.0-1706585206-protected-app-custom-domain-unique.d.ts +3 -0
- package/alterations-js/1.13.0-1706585206-protected-app-custom-domain-unique.js +17 -0
- package/alterations-js/1.13.1-1707360939-grant-is-suspended-read-permission.d.ts +6 -0
- package/alterations-js/1.13.1-1707360939-grant-is-suspended-read-permission.js +31 -0
- package/alterations-js/utils/1704934999-tables.d.ts +11 -0
- package/alterations-js/utils/1704934999-tables.js +43 -0
- package/lib/db-entries/application-sign-in-experience.d.ts +26 -0
- package/lib/db-entries/application-sign-in-experience.js +42 -0
- package/lib/db-entries/application-user-consent-organization-scope.d.ts +24 -0
- package/lib/db-entries/application-user-consent-organization-scope.js +29 -0
- package/lib/db-entries/application-user-consent-organization.d.ts +22 -0
- package/lib/db-entries/application-user-consent-organization.js +33 -0
- package/lib/db-entries/application-user-consent-resource-scope.d.ts +24 -0
- package/lib/db-entries/application-user-consent-resource-scope.js +29 -0
- package/lib/db-entries/application-user-consent-user-scope.d.ts +24 -0
- package/lib/db-entries/application-user-consent-user-scope.js +29 -0
- package/lib/db-entries/application.d.ts +6 -2
- package/lib/db-entries/application.js +9 -1
- package/lib/db-entries/custom-types.d.ts +8 -1
- package/lib/db-entries/custom-types.js +8 -0
- package/lib/db-entries/daily-token-usage.d.ts +20 -0
- package/lib/db-entries/daily-token-usage.js +33 -0
- package/lib/db-entries/index.d.ts +8 -0
- package/lib/db-entries/index.js +8 -0
- package/lib/db-entries/organization-invitation-role-relation.d.ts +24 -0
- package/lib/db-entries/organization-invitation-role-relation.js +29 -0
- package/lib/db-entries/organization-invitation.d.ts +53 -0
- package/lib/db-entries/organization-invitation.js +58 -0
- package/lib/foundations/jsonb-types/applications.d.ts +380 -0
- package/lib/foundations/jsonb-types/applications.js +29 -0
- package/lib/foundations/jsonb-types/custom-domain.d.ts +37 -89
- package/lib/foundations/jsonb-types/custom-domain.js +4 -9
- package/lib/foundations/jsonb-types/index.d.ts +1 -0
- package/lib/foundations/jsonb-types/index.js +1 -0
- package/lib/foundations/jsonb-types/users.d.ts +1 -2
- package/lib/foundations/jsonb-types/users.js +1 -1
- package/lib/models/tenants.d.ts +1 -1
- package/lib/seeds/application.d.ts +1 -1
- package/lib/seeds/application.js +3 -1
- package/lib/seeds/cloud-api.d.ts +3 -3
- package/lib/seeds/cloud-api.js +2 -3
- package/lib/seeds/management-api.d.ts +77 -6
- package/lib/seeds/management-api.js +14 -10
- package/lib/types/application.d.ts +576 -1
- package/lib/types/application.js +42 -1
- package/lib/types/connector.js +1 -1
- package/lib/types/consent.d.ts +568 -0
- package/lib/types/consent.js +47 -0
- package/lib/types/domain.d.ts +21 -65
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.js +3 -0
- package/lib/types/interactions.d.ts +6 -6
- package/lib/types/logto-config.d.ts +32 -6
- package/lib/types/logto-config.js +12 -2
- package/lib/types/mapi-proxy.d.ts +30 -0
- package/lib/types/mapi-proxy.js +49 -0
- package/lib/types/organization.d.ts +10 -1
- package/lib/types/organization.js +4 -1
- package/lib/types/sso-connector.d.ts +9 -9
- package/lib/types/sso-connector.js +1 -1
- package/lib/types/system.d.ts +28 -1
- package/lib/types/system.js +17 -0
- package/lib/types/tenant-organization.d.ts +107 -0
- package/lib/types/tenant-organization.js +145 -0
- package/lib/types/tenant.d.ts +0 -1
- package/lib/types/tenant.js +2 -4
- package/lib/types/user-assets.d.ts +5 -5
- package/lib/types/user-assets.js +1 -0
- package/lib/types/user.d.ts +14 -15
- package/lib/types/user.js +0 -1
- package/package.json +14 -14
- package/tables/_after_all.sql +1 -1
- package/tables/application_sign_in_experiences.sql +15 -0
- package/tables/application_user_consent_organization_scopes.sql +14 -0
- package/tables/application_user_consent_organizations.sql +16 -0
- package/tables/application_user_consent_resource_scopes.sql +14 -0
- package/tables/application_user_consent_user_scopes.sql +13 -0
- package/tables/applications.sql +16 -1
- package/tables/daily_token_usage.sql +11 -0
- package/tables/organization_invitation_role_relations.sql +14 -0
- package/tables/organization_invitations.sql +36 -0
package/lib/types/domain.d.ts
CHANGED
|
@@ -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<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
ssl:
|
|
22
|
-
status:
|
|
23
|
-
validation_errors
|
|
24
|
-
message:
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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, {
|
package/lib/types/index.d.ts
CHANGED
package/lib/types/index.js
CHANGED
|
@@ -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("
|
|
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("
|
|
45
|
+
connectorData: Record<string, import("@withtyped/server/lib/types.js").Json>;
|
|
46
46
|
}, {
|
|
47
47
|
connectorId: string;
|
|
48
|
-
connectorData: Record<string, import("
|
|
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("
|
|
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("
|
|
129
|
+
connectorData: Record<string, import("@withtyped/server/lib/types.js").Json>;
|
|
130
130
|
}, {
|
|
131
131
|
connectorId: string;
|
|
132
|
-
connectorData: Record<string, import("
|
|
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
|
-
|
|
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:
|
|
58
|
+
tag: string;
|
|
56
59
|
readAt?: number | undefined;
|
|
57
60
|
}, {
|
|
58
61
|
isPaidTenant: boolean;
|
|
59
|
-
tag:
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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
|
+
});
|
|
@@ -75,9 +75,6 @@ export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<{
|
|
|
75
75
|
id: z.ZodType<string, z.ZodTypeDef, string>;
|
|
76
76
|
tenantId: z.ZodType<string, z.ZodTypeDef, string>;
|
|
77
77
|
createdAt: z.ZodType<number, z.ZodTypeDef, number>;
|
|
78
|
-
syncProfile: z.ZodType<boolean, z.ZodTypeDef, boolean>;
|
|
79
|
-
config: z.ZodType<import("@withtyped/server").JsonObject, z.ZodTypeDef, import("@withtyped/server").JsonObject>;
|
|
80
|
-
domains: z.ZodType<string[], z.ZodTypeDef, string[]>;
|
|
81
78
|
branding: z.ZodType<{
|
|
82
79
|
displayName?: string | undefined;
|
|
83
80
|
logo?: string | undefined;
|
|
@@ -87,6 +84,9 @@ export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<{
|
|
|
87
84
|
logo?: string | undefined;
|
|
88
85
|
darkLogo?: string | undefined;
|
|
89
86
|
}>;
|
|
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[]>;
|
|
90
90
|
connectorName: z.ZodType<string, z.ZodTypeDef, string>;
|
|
91
91
|
name: z.ZodString;
|
|
92
92
|
providerName: z.ZodNativeEnum<typeof SsoProviderName>;
|
|
@@ -98,14 +98,14 @@ export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<{
|
|
|
98
98
|
id: string;
|
|
99
99
|
tenantId: string;
|
|
100
100
|
createdAt: number;
|
|
101
|
-
syncProfile: boolean;
|
|
102
|
-
config: import("@withtyped/server").JsonObject;
|
|
103
|
-
domains: string[];
|
|
104
101
|
branding: {
|
|
105
102
|
displayName?: string | undefined;
|
|
106
103
|
logo?: string | undefined;
|
|
107
104
|
darkLogo?: string | undefined;
|
|
108
105
|
};
|
|
106
|
+
syncProfile: boolean;
|
|
107
|
+
config: import("@withtyped/server").JsonObject;
|
|
108
|
+
domains: string[];
|
|
109
109
|
providerName: SsoProviderName;
|
|
110
110
|
connectorName: string;
|
|
111
111
|
providerLogo: string;
|
|
@@ -116,14 +116,14 @@ export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<{
|
|
|
116
116
|
id: string;
|
|
117
117
|
tenantId: string;
|
|
118
118
|
createdAt: number;
|
|
119
|
-
syncProfile: boolean;
|
|
120
|
-
config: import("@withtyped/server").JsonObject;
|
|
121
|
-
domains: string[];
|
|
122
119
|
branding: {
|
|
123
120
|
displayName?: string | undefined;
|
|
124
121
|
logo?: string | undefined;
|
|
125
122
|
darkLogo?: string | undefined;
|
|
126
123
|
};
|
|
124
|
+
syncProfile: boolean;
|
|
125
|
+
config: import("@withtyped/server").JsonObject;
|
|
126
|
+
domains: string[];
|
|
127
127
|
providerName: SsoProviderName;
|
|
128
128
|
connectorName: string;
|
|
129
129
|
providerLogo: string;
|
|
@@ -50,7 +50,7 @@ export const ssoConnectorProvidersResponseGuard = z.array(ssoConnectorProviderDe
|
|
|
50
50
|
export const ssoConnectorWithProviderConfigGuard = SsoConnectors.guard
|
|
51
51
|
.omit({ providerName: true })
|
|
52
52
|
.merge(z.object({
|
|
53
|
-
name: z.string(),
|
|
53
|
+
name: z.string(), // For display purpose, generate from i18n key name defined by SSO factory.
|
|
54
54
|
providerName: z.nativeEnum(SsoProviderName),
|
|
55
55
|
providerLogo: z.string(),
|
|
56
56
|
providerLogoDark: z.string(),
|
package/lib/types/system.d.ts
CHANGED
|
@@ -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]>;
|
package/lib/types/system.js
CHANGED
|
@@ -100,13 +100,30 @@ export const demoSocialGuard = Object.freeze({
|
|
|
100
100
|
export const hostnameProviderDataGuard = z.object({
|
|
101
101
|
zoneId: z.string(),
|
|
102
102
|
apiToken: z.string(), // Requires zone permission for "SSL and Certificates Edit"
|
|
103
|
+
blockedDomains: z.string().array().optional(), // Optional list of blocked domains
|
|
104
|
+
});
|
|
105
|
+
// Cloudflare KV for protected app config
|
|
106
|
+
export const protectedAppConfigProviderDataGuard = z.object({
|
|
107
|
+
/* Cloudflare Workers & Pages account ID */
|
|
108
|
+
accountIdentifier: z.string(),
|
|
109
|
+
/* KV namespace ID */
|
|
110
|
+
namespaceIdentifier: z.string(),
|
|
111
|
+
/* Key prefix for protected app config */
|
|
112
|
+
keyName: z.string(),
|
|
113
|
+
/* The default domain (e.g protected.app) for the protected app */
|
|
114
|
+
domain: z.string(),
|
|
115
|
+
apiToken: z.string(), // Requires account permission for "KV Storage Edit"
|
|
103
116
|
});
|
|
104
117
|
export var CloudflareKey;
|
|
105
118
|
(function (CloudflareKey) {
|
|
106
119
|
CloudflareKey["HostnameProvider"] = "cloudflareHostnameProvider";
|
|
120
|
+
CloudflareKey["ProtectedAppConfigProvider"] = "cloudflareProtectedAppConfigProvider";
|
|
121
|
+
CloudflareKey["ProtectedAppHostnameProvider"] = "cloudflareProtectedAppHostnameProvider";
|
|
107
122
|
})(CloudflareKey || (CloudflareKey = {}));
|
|
108
123
|
export const cloudflareGuard = Object.freeze({
|
|
109
124
|
[CloudflareKey.HostnameProvider]: hostnameProviderDataGuard,
|
|
125
|
+
[CloudflareKey.ProtectedAppConfigProvider]: protectedAppConfigProviderDataGuard,
|
|
126
|
+
[CloudflareKey.ProtectedAppHostnameProvider]: hostnameProviderDataGuard,
|
|
110
127
|
});
|
|
111
128
|
export const systemKeys = Object.freeze([
|
|
112
129
|
...Object.values(AlterationStateKey),
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview
|
|
3
|
+
* Tenant organizations are organizations in the admin tenant that represent tenants. They are
|
|
4
|
+
* created when a tenant is created, and are used to define the roles and scopes for the users in
|
|
5
|
+
* the tenant.
|
|
6
|
+
*
|
|
7
|
+
* This module provides utilities to manage tenant organizations.
|
|
8
|
+
*/
|
|
9
|
+
import { type CreateOrganization, type OrganizationRole, type OrganizationScope } from '../db-entries/index.js';
|
|
10
|
+
/** Given a tenant ID, return the corresponding organization ID in the admin tenant. */
|
|
11
|
+
export declare const getTenantOrganizationId: (tenantId: string) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Given a tenant ID, return the organization create data for the admin tenant. It follows a
|
|
14
|
+
* convention to generate the organization ID and name which can be used across the system.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const tenantId = 'test-tenant';
|
|
19
|
+
* const createData = getCreateData(tenantId);
|
|
20
|
+
*
|
|
21
|
+
* expect(createData).toEqual({
|
|
22
|
+
* tenantId: 'admin',
|
|
23
|
+
* id: 't-test-tenant',
|
|
24
|
+
* name: 'Tenant test-tenant',
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @see {@link getId} for the convention of generating the organization ID.
|
|
29
|
+
*/
|
|
30
|
+
export declare const getTenantOrganizationCreateData: (tenantId: string) => Readonly<CreateOrganization>;
|
|
31
|
+
/**
|
|
32
|
+
* Scope names in organization template for managing tenants.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Should sync JSDoc descriptions with {@link tenantScopeDescriptions}.
|
|
36
|
+
*/
|
|
37
|
+
export declare enum TenantScope {
|
|
38
|
+
/** Read the tenant data. */
|
|
39
|
+
ReadData = "read:data",
|
|
40
|
+
/** Write the tenant data, including creating and updating the tenant. */
|
|
41
|
+
WriteData = "write:data",
|
|
42
|
+
/** Delete data of the tenant. */
|
|
43
|
+
DeleteData = "delete:data",
|
|
44
|
+
/** Invite members to the tenant. */
|
|
45
|
+
InviteMember = "invite:member",
|
|
46
|
+
/** Remove members from the tenant. */
|
|
47
|
+
RemoveMember = "remove:member",
|
|
48
|
+
/** Update the role of a member in the tenant. */
|
|
49
|
+
UpdateMemberRole = "update:member:role",
|
|
50
|
+
/** Manage the tenant settings, including name, billing, etc. */
|
|
51
|
+
ManageTenant = "manage:tenant"
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Given a tenant scope, return the corresponding organization scope data in the admin tenant.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const scope = TenantScope.ReadData; // 'read:data'
|
|
59
|
+
* const scopeData = getTenantScope(scope);
|
|
60
|
+
*
|
|
61
|
+
* expect(scopeData).toEqual({
|
|
62
|
+
* tenantId: 'admin',
|
|
63
|
+
* id: 'read-data',
|
|
64
|
+
* name: 'read:data',
|
|
65
|
+
* description: 'Read the tenant data.',
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @see {@link tenantScopeDescriptions} for scope descriptions of each scope.
|
|
70
|
+
*/
|
|
71
|
+
export declare const getTenantScope: (scope: TenantScope) => Readonly<OrganizationScope>;
|
|
72
|
+
/**
|
|
73
|
+
* Role names in organization template for managing tenants.
|
|
74
|
+
*
|
|
75
|
+
* @remarks
|
|
76
|
+
* Should sync JSDoc descriptions with {@link tenantRoleDescriptions}.
|
|
77
|
+
*/
|
|
78
|
+
export declare enum TenantRole {
|
|
79
|
+
/** Admin of the tenant, who has all permissions. */
|
|
80
|
+
Admin = "admin",
|
|
81
|
+
/** Member of the tenant, who has permissions to operate the tenant data, but not the tenant settings. */
|
|
82
|
+
Member = "member"
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Given a tenant role, return the corresponding organization role data in the admin tenant.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const role = TenantRole.Member; // 'member'
|
|
90
|
+
* const roleData = getTenantRole(role);
|
|
91
|
+
*
|
|
92
|
+
* expect(roleData).toEqual({
|
|
93
|
+
* tenantId: 'admin',
|
|
94
|
+
* id: 'member',
|
|
95
|
+
* name: 'member',
|
|
96
|
+
* description: 'Member of the tenant, who has permissions to operate the tenant data, but not the tenant settings.',
|
|
97
|
+
* });
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @see {@link tenantRoleDescriptions} for scope descriptions of each role.
|
|
101
|
+
*/
|
|
102
|
+
export declare const getTenantRole: (role: TenantRole) => Readonly<OrganizationRole>;
|
|
103
|
+
/**
|
|
104
|
+
* The dictionary of tenant roles and their corresponding scopes.
|
|
105
|
+
* @see {TenantRole} for scope descriptions of each role.
|
|
106
|
+
*/
|
|
107
|
+
export declare const tenantRoleScopes: Readonly<Record<TenantRole, Readonly<TenantScope[]>>>;
|