@logto/schemas 1.10.1 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/alterations/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.ts +18 -0
- package/alterations/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.ts +18 -0
- package/alterations-js/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.d.ts +3 -0
- package/alterations-js/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.js +14 -0
- package/alterations-js/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.d.ts +3 -0
- package/alterations-js/1.11.0-1699598903-remove-sso-only-column-in-sso-connectors-table.js +14 -0
- package/lib/db-entries/sso-connector.d.ts +1 -5
- package/lib/db-entries/sso-connector.js +0 -4
- package/lib/db-entries/user-sso-identity.d.ts +3 -1
- package/lib/db-entries/user-sso-identity.js +4 -0
- package/lib/foundations/jsonb-types/users.d.ts +6 -6
- package/lib/foundations/jsonb-types/users.js +1 -1
- package/lib/models/tenants.d.ts +1 -5
- package/lib/models/tenants.js +1 -6
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/logto-config.d.ts +24 -0
- package/lib/types/logto-config.js +8 -0
- package/lib/types/organization.d.ts +11 -7
- package/lib/types/organization.js +3 -2
- package/lib/types/sso-connector.d.ts +116 -0
- package/lib/types/sso-connector.js +14 -0
- package/lib/types/tenant.d.ts +5 -0
- package/lib/types/tenant.js +6 -0
- package/lib/types/user.d.ts +10 -10
- package/package.json +4 -4
- package/tables/sso_connectors.sql +1 -2
- package/tables/user_sso_identities.sql +3 -0
package/alterations/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
const alteration: AlterationScript = {
|
|
6
|
+
up: async (pool) => {
|
|
7
|
+
await pool.query(sql`
|
|
8
|
+
alter table user_sso_identities add column sso_connector_id varchar(128) not null references sso_connectors (id) on update cascade on delete cascade;
|
|
9
|
+
`);
|
|
10
|
+
},
|
|
11
|
+
down: async (pool) => {
|
|
12
|
+
await pool.query(sql`
|
|
13
|
+
alter table user_sso_identities drop column sso_connector_id;
|
|
14
|
+
`);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default alteration;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
const alteration: AlterationScript = {
|
|
6
|
+
up: async (pool) => {
|
|
7
|
+
await pool.query(sql`
|
|
8
|
+
alter table sso_connectors drop column sso_only;
|
|
9
|
+
`);
|
|
10
|
+
},
|
|
11
|
+
down: async (pool) => {
|
|
12
|
+
await pool.query(sql`
|
|
13
|
+
alter table sso_connectors add column sso_only boolean not null default FALSE;
|
|
14
|
+
`);
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default alteration;
|
package/alterations-js/1.11.0-1699422979-add-sso-connector-id-col-to-user-sso-identities-table.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
const alteration = {
|
|
3
|
+
up: async (pool) => {
|
|
4
|
+
await pool.query(sql `
|
|
5
|
+
alter table user_sso_identities add column sso_connector_id varchar(128) not null references sso_connectors (id) on update cascade on delete cascade;
|
|
6
|
+
`);
|
|
7
|
+
},
|
|
8
|
+
down: async (pool) => {
|
|
9
|
+
await pool.query(sql `
|
|
10
|
+
alter table user_sso_identities drop column sso_connector_id;
|
|
11
|
+
`);
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export default alteration;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
const alteration = {
|
|
3
|
+
up: async (pool) => {
|
|
4
|
+
await pool.query(sql `
|
|
5
|
+
alter table sso_connectors drop column sso_only;
|
|
6
|
+
`);
|
|
7
|
+
},
|
|
8
|
+
down: async (pool) => {
|
|
9
|
+
await pool.query(sql `
|
|
10
|
+
alter table sso_connectors add column sso_only boolean not null default FALSE;
|
|
11
|
+
`);
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export default alteration;
|
|
@@ -20,8 +20,6 @@ export type CreateSsoConnector = {
|
|
|
20
20
|
branding?: SsoBranding;
|
|
21
21
|
/** Determines whether to synchronize the user's profile on each login. */
|
|
22
22
|
syncProfile?: boolean;
|
|
23
|
-
/** Determines whether SSO is the restricted sign-in method for users with the SSO registered email domains */
|
|
24
|
-
ssoOnly?: boolean;
|
|
25
23
|
/** When the SSO connector was created. */
|
|
26
24
|
createdAt?: number;
|
|
27
25
|
};
|
|
@@ -41,10 +39,8 @@ export type SsoConnector = {
|
|
|
41
39
|
branding: SsoBranding;
|
|
42
40
|
/** Determines whether to synchronize the user's profile on each login. */
|
|
43
41
|
syncProfile: boolean;
|
|
44
|
-
/** Determines whether SSO is the restricted sign-in method for users with the SSO registered email domains */
|
|
45
|
-
ssoOnly: boolean;
|
|
46
42
|
/** When the SSO connector was created. */
|
|
47
43
|
createdAt: number;
|
|
48
44
|
};
|
|
49
|
-
export type SsoConnectorKeys = 'tenantId' | 'id' | 'providerName' | 'connectorName' | 'config' | 'domains' | 'branding' | 'syncProfile' | '
|
|
45
|
+
export type SsoConnectorKeys = 'tenantId' | 'id' | 'providerName' | 'connectorName' | 'config' | 'domains' | 'branding' | 'syncProfile' | 'createdAt';
|
|
50
46
|
export declare const SsoConnectors: GeneratedSchema<SsoConnectorKeys, CreateSsoConnector, SsoConnector, 'sso_connectors', 'sso_connector'>;
|
|
@@ -10,7 +10,6 @@ const createGuard = z.object({
|
|
|
10
10
|
domains: ssoDomainsGuard.optional(),
|
|
11
11
|
branding: ssoBrandingGuard.optional(),
|
|
12
12
|
syncProfile: z.boolean().optional(),
|
|
13
|
-
ssoOnly: z.boolean().optional(),
|
|
14
13
|
createdAt: z.number().optional(),
|
|
15
14
|
});
|
|
16
15
|
const guard = z.object({
|
|
@@ -22,7 +21,6 @@ const guard = z.object({
|
|
|
22
21
|
domains: ssoDomainsGuard,
|
|
23
22
|
branding: ssoBrandingGuard,
|
|
24
23
|
syncProfile: z.boolean(),
|
|
25
|
-
ssoOnly: z.boolean(),
|
|
26
24
|
createdAt: z.number(),
|
|
27
25
|
});
|
|
28
26
|
export const SsoConnectors = Object.freeze({
|
|
@@ -37,7 +35,6 @@ export const SsoConnectors = Object.freeze({
|
|
|
37
35
|
domains: 'domains',
|
|
38
36
|
branding: 'branding',
|
|
39
37
|
syncProfile: 'sync_profile',
|
|
40
|
-
ssoOnly: 'sso_only',
|
|
41
38
|
createdAt: 'created_at',
|
|
42
39
|
},
|
|
43
40
|
fieldKeys: [
|
|
@@ -49,7 +46,6 @@ export const SsoConnectors = Object.freeze({
|
|
|
49
46
|
'domains',
|
|
50
47
|
'branding',
|
|
51
48
|
'syncProfile',
|
|
52
|
-
'ssoOnly',
|
|
53
49
|
'createdAt',
|
|
54
50
|
],
|
|
55
51
|
createGuard,
|
|
@@ -14,6 +14,7 @@ export type CreateUserSsoIdentity = {
|
|
|
14
14
|
identityId: string;
|
|
15
15
|
detail?: JsonObject;
|
|
16
16
|
createdAt?: number;
|
|
17
|
+
ssoConnectorId: string;
|
|
17
18
|
};
|
|
18
19
|
export type UserSsoIdentity = {
|
|
19
20
|
tenantId: string;
|
|
@@ -25,6 +26,7 @@ export type UserSsoIdentity = {
|
|
|
25
26
|
identityId: string;
|
|
26
27
|
detail: JsonObject;
|
|
27
28
|
createdAt: number;
|
|
29
|
+
ssoConnectorId: string;
|
|
28
30
|
};
|
|
29
|
-
export type UserSsoIdentityKeys = 'tenantId' | 'id' | 'userId' | 'issuer' | 'identityId' | 'detail' | 'createdAt';
|
|
31
|
+
export type UserSsoIdentityKeys = 'tenantId' | 'id' | 'userId' | 'issuer' | 'identityId' | 'detail' | 'createdAt' | 'ssoConnectorId';
|
|
30
32
|
export declare const UserSsoIdentities: GeneratedSchema<UserSsoIdentityKeys, CreateUserSsoIdentity, UserSsoIdentity, 'user_sso_identities', 'user_sso_identity'>;
|
|
@@ -9,6 +9,7 @@ const createGuard = z.object({
|
|
|
9
9
|
identityId: z.string().min(1).max(128),
|
|
10
10
|
detail: jsonObjectGuard.optional(),
|
|
11
11
|
createdAt: z.number().optional(),
|
|
12
|
+
ssoConnectorId: z.string().min(1).max(128),
|
|
12
13
|
});
|
|
13
14
|
const guard = z.object({
|
|
14
15
|
tenantId: z.string().max(21),
|
|
@@ -18,6 +19,7 @@ const guard = z.object({
|
|
|
18
19
|
identityId: z.string().min(1).max(128),
|
|
19
20
|
detail: jsonObjectGuard,
|
|
20
21
|
createdAt: z.number(),
|
|
22
|
+
ssoConnectorId: z.string().min(1).max(128),
|
|
21
23
|
});
|
|
22
24
|
export const UserSsoIdentities = Object.freeze({
|
|
23
25
|
table: 'user_sso_identities',
|
|
@@ -30,6 +32,7 @@ export const UserSsoIdentities = Object.freeze({
|
|
|
30
32
|
identityId: 'identity_id',
|
|
31
33
|
detail: 'detail',
|
|
32
34
|
createdAt: 'created_at',
|
|
35
|
+
ssoConnectorId: 'sso_connector_id',
|
|
33
36
|
},
|
|
34
37
|
fieldKeys: [
|
|
35
38
|
'tenantId',
|
|
@@ -39,6 +42,7 @@ export const UserSsoIdentities = Object.freeze({
|
|
|
39
42
|
'identityId',
|
|
40
43
|
'detail',
|
|
41
44
|
'createdAt',
|
|
45
|
+
'ssoConnectorId',
|
|
42
46
|
],
|
|
43
47
|
createGuard,
|
|
44
48
|
guard,
|
|
@@ -3,23 +3,23 @@ import { MfaFactor } from './sign-in-experience.js';
|
|
|
3
3
|
export declare const roleNamesGuard: z.ZodArray<z.ZodString, "many">;
|
|
4
4
|
declare const identityGuard: z.ZodObject<{
|
|
5
5
|
userId: z.ZodString;
|
|
6
|
-
details: z.ZodOptional<z.
|
|
6
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
8
|
userId: string;
|
|
9
|
-
details?:
|
|
9
|
+
details?: Record<string, unknown> | undefined;
|
|
10
10
|
}, {
|
|
11
11
|
userId: string;
|
|
12
|
-
details?:
|
|
12
|
+
details?: Record<string, unknown> | undefined;
|
|
13
13
|
}>;
|
|
14
14
|
export declare const identitiesGuard: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
15
15
|
userId: z.ZodString;
|
|
16
|
-
details: z.ZodOptional<z.
|
|
16
|
+
details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
18
|
userId: string;
|
|
19
|
-
details?:
|
|
19
|
+
details?: Record<string, unknown> | undefined;
|
|
20
20
|
}, {
|
|
21
21
|
userId: string;
|
|
22
|
-
details?:
|
|
22
|
+
details?: Record<string, unknown> | undefined;
|
|
23
23
|
}>>;
|
|
24
24
|
export type Identity = z.infer<typeof identityGuard>;
|
|
25
25
|
export type Identities = z.infer<typeof identitiesGuard>;
|
|
@@ -3,7 +3,7 @@ import { MfaFactor } from './sign-in-experience.js';
|
|
|
3
3
|
export const roleNamesGuard = z.string().array();
|
|
4
4
|
const identityGuard = z.object({
|
|
5
5
|
userId: z.string(),
|
|
6
|
-
details: z.
|
|
6
|
+
details: z.record(z.unknown()).optional(), // Connector's userinfo details, schemaless
|
|
7
7
|
});
|
|
8
8
|
export const identitiesGuard = z.record(identityGuard);
|
|
9
9
|
export const baseMfaVerification = {
|
package/lib/models/tenants.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import type { InferModelType } from '@withtyped/server/model';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
Development = "development",
|
|
5
|
-
Staging = "staging",
|
|
6
|
-
Production = "production"
|
|
7
|
-
}
|
|
3
|
+
import { TenantTag } from '../types/tenant.js';
|
|
8
4
|
export declare const Tenants: import("@withtyped/server/model").default<"tenants", {
|
|
9
5
|
id: string;
|
|
10
6
|
dbUser: string | null;
|
package/lib/models/tenants.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { createModel } from '@withtyped/server/model';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
(function (TenantTag) {
|
|
5
|
-
TenantTag["Development"] = "development";
|
|
6
|
-
TenantTag["Staging"] = "staging";
|
|
7
|
-
TenantTag["Production"] = "production";
|
|
8
|
-
})(TenantTag || (TenantTag = {}));
|
|
3
|
+
import { TenantTag } from '../types/tenant.js';
|
|
9
4
|
export const Tenants = createModel(
|
|
10
5
|
/* Sql */ `
|
|
11
6
|
/* init_order = 0 */
|
package/lib/types/index.d.ts
CHANGED
package/lib/types/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ZodType } from 'zod';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { TenantTag } from './tenant.js';
|
|
3
4
|
/**
|
|
4
5
|
* Logto OIDC signing key types, used mainly in REST API routes.
|
|
5
6
|
*/
|
|
@@ -45,12 +46,35 @@ export declare const logtoOidcConfigGuard: Readonly<{
|
|
|
45
46
|
export declare const adminConsoleDataGuard: z.ZodObject<{
|
|
46
47
|
signInExperienceCustomized: z.ZodBoolean;
|
|
47
48
|
organizationCreated: z.ZodBoolean;
|
|
49
|
+
developmentTenantMigrationNotification: z.ZodOptional<z.ZodObject<{
|
|
50
|
+
isPaidTenant: z.ZodBoolean;
|
|
51
|
+
tag: z.ZodNativeEnum<typeof TenantTag>;
|
|
52
|
+
readAt: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
isPaidTenant: boolean;
|
|
55
|
+
tag: TenantTag;
|
|
56
|
+
readAt?: number | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
isPaidTenant: boolean;
|
|
59
|
+
tag: TenantTag;
|
|
60
|
+
readAt?: number | undefined;
|
|
61
|
+
}>>;
|
|
48
62
|
}, "strip", z.ZodTypeAny, {
|
|
49
63
|
signInExperienceCustomized: boolean;
|
|
50
64
|
organizationCreated: boolean;
|
|
65
|
+
developmentTenantMigrationNotification?: {
|
|
66
|
+
isPaidTenant: boolean;
|
|
67
|
+
tag: TenantTag;
|
|
68
|
+
readAt?: number | undefined;
|
|
69
|
+
} | undefined;
|
|
51
70
|
}, {
|
|
52
71
|
signInExperienceCustomized: boolean;
|
|
53
72
|
organizationCreated: boolean;
|
|
73
|
+
developmentTenantMigrationNotification?: {
|
|
74
|
+
isPaidTenant: boolean;
|
|
75
|
+
tag: TenantTag;
|
|
76
|
+
readAt?: number | undefined;
|
|
77
|
+
} | undefined;
|
|
54
78
|
}>;
|
|
55
79
|
export type AdminConsoleData = z.infer<typeof adminConsoleDataGuard>;
|
|
56
80
|
export declare const cloudConnectionDataGuard: z.ZodObject<{
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { TenantTag } from './tenant.js';
|
|
2
3
|
/**
|
|
3
4
|
* Logto OIDC signing key types, used mainly in REST API routes.
|
|
4
5
|
*/
|
|
@@ -36,6 +37,13 @@ export const logtoOidcConfigGuard = Object.freeze({
|
|
|
36
37
|
export const adminConsoleDataGuard = z.object({
|
|
37
38
|
signInExperienceCustomized: z.boolean(),
|
|
38
39
|
organizationCreated: z.boolean(),
|
|
40
|
+
developmentTenantMigrationNotification: z
|
|
41
|
+
.object({
|
|
42
|
+
isPaidTenant: z.boolean(),
|
|
43
|
+
tag: z.nativeEnum(TenantTag),
|
|
44
|
+
readAt: z.number().optional(),
|
|
45
|
+
})
|
|
46
|
+
.optional(),
|
|
39
47
|
});
|
|
40
48
|
/* --- Logto tenant cloud connection config --- */
|
|
41
49
|
export const cloudConnectionDataGuard = z.object({
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { type OrganizationRole, type Organization
|
|
3
|
-
import { type FeaturedUser } from './user.js';
|
|
2
|
+
import { type OrganizationRole, type Organization } from '../db-entries/index.js';
|
|
3
|
+
import { type UserInfo, type FeaturedUser } from './user.js';
|
|
4
|
+
/**
|
|
5
|
+
* The simplified organization scope entity that is returned for some endpoints.
|
|
6
|
+
*/
|
|
7
|
+
export type OrganizationScopeEntity = {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
4
11
|
export type OrganizationRoleWithScopes = OrganizationRole & {
|
|
5
|
-
scopes:
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
}>;
|
|
12
|
+
scopes: OrganizationScopeEntity[];
|
|
9
13
|
};
|
|
10
14
|
export declare const organizationRoleWithScopesGuard: z.ZodType<OrganizationRoleWithScopes>;
|
|
11
15
|
/**
|
|
@@ -29,7 +33,7 @@ export declare const organizationWithOrganizationRolesGuard: z.ZodType<Organizat
|
|
|
29
33
|
* The user entity with the `organizationRoles` field that contains the roles of
|
|
30
34
|
* the user in a specific organization.
|
|
31
35
|
*/
|
|
32
|
-
export type UserWithOrganizationRoles =
|
|
36
|
+
export type UserWithOrganizationRoles = UserInfo & {
|
|
33
37
|
/** The roles of the user in a specific organization. */
|
|
34
38
|
organizationRoles: OrganizationRoleEntity[];
|
|
35
39
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { OrganizationRoles, Organizations,
|
|
2
|
+
import { OrganizationRoles, Organizations, } from '../db-entries/index.js';
|
|
3
|
+
import { userInfoGuard } from './user.js';
|
|
3
4
|
export const organizationRoleWithScopesGuard = OrganizationRoles.guard.extend({
|
|
4
5
|
scopes: z
|
|
5
6
|
.object({
|
|
@@ -15,6 +16,6 @@ const organizationRoleEntityGuard = z.object({
|
|
|
15
16
|
export const organizationWithOrganizationRolesGuard = Organizations.guard.extend({
|
|
16
17
|
organizationRoles: organizationRoleEntityGuard.array(),
|
|
17
18
|
});
|
|
18
|
-
export const userWithOrganizationRolesGuard =
|
|
19
|
+
export const userWithOrganizationRolesGuard = userInfoGuard.extend({
|
|
19
20
|
organizationRoles: organizationRoleEntityGuard.array(),
|
|
20
21
|
});
|
|
@@ -19,3 +19,119 @@ export declare const ssoConnectorMetadataGuard: z.ZodObject<{
|
|
|
19
19
|
darkLogo?: string | undefined;
|
|
20
20
|
}>;
|
|
21
21
|
export type SsoConnectorMetadata = z.infer<typeof ssoConnectorMetadataGuard>;
|
|
22
|
+
declare const ssoConnectorFactoryDetailGuard: z.ZodObject<{
|
|
23
|
+
providerName: z.ZodString;
|
|
24
|
+
logo: z.ZodString;
|
|
25
|
+
description: z.ZodString;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
logo: string;
|
|
28
|
+
description: string;
|
|
29
|
+
providerName: string;
|
|
30
|
+
}, {
|
|
31
|
+
logo: string;
|
|
32
|
+
description: string;
|
|
33
|
+
providerName: string;
|
|
34
|
+
}>;
|
|
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">;
|
|
63
|
+
}, "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
|
+
}[];
|
|
74
|
+
}, {
|
|
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>;
|
|
87
|
+
export declare const ssoConnectorWithProviderConfigGuard: z.ZodObject<{
|
|
88
|
+
id: z.ZodType<string, z.ZodTypeDef, string>;
|
|
89
|
+
tenantId: z.ZodType<string, z.ZodTypeDef, string>;
|
|
90
|
+
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
|
+
branding: z.ZodType<{
|
|
95
|
+
logo?: string | undefined;
|
|
96
|
+
darkLogo?: string | undefined;
|
|
97
|
+
}, z.ZodTypeDef, {
|
|
98
|
+
logo?: string | undefined;
|
|
99
|
+
darkLogo?: string | undefined;
|
|
100
|
+
}>;
|
|
101
|
+
providerName: z.ZodType<string, z.ZodTypeDef, string>;
|
|
102
|
+
connectorName: z.ZodType<string, z.ZodTypeDef, string>;
|
|
103
|
+
providerLogo: z.ZodString;
|
|
104
|
+
providerConfig: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
id: string;
|
|
107
|
+
tenantId: string;
|
|
108
|
+
createdAt: number;
|
|
109
|
+
syncProfile: boolean;
|
|
110
|
+
config: import("@withtyped/server").JsonObject;
|
|
111
|
+
domains: string[];
|
|
112
|
+
branding: {
|
|
113
|
+
logo?: string | undefined;
|
|
114
|
+
darkLogo?: string | undefined;
|
|
115
|
+
};
|
|
116
|
+
providerName: string;
|
|
117
|
+
connectorName: string;
|
|
118
|
+
providerLogo: string;
|
|
119
|
+
providerConfig?: Record<string, unknown> | undefined;
|
|
120
|
+
}, {
|
|
121
|
+
id: string;
|
|
122
|
+
tenantId: string;
|
|
123
|
+
createdAt: number;
|
|
124
|
+
syncProfile: boolean;
|
|
125
|
+
config: import("@withtyped/server").JsonObject;
|
|
126
|
+
domains: string[];
|
|
127
|
+
branding: {
|
|
128
|
+
logo?: string | undefined;
|
|
129
|
+
darkLogo?: string | undefined;
|
|
130
|
+
};
|
|
131
|
+
providerName: string;
|
|
132
|
+
connectorName: string;
|
|
133
|
+
providerLogo: string;
|
|
134
|
+
providerConfig?: Record<string, unknown> | undefined;
|
|
135
|
+
}>;
|
|
136
|
+
export type SsoConnectorWithProviderConfig = z.infer<typeof ssoConnectorWithProviderConfigGuard>;
|
|
137
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { SsoConnectors } 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
|
*/
|
|
@@ -8,3 +9,16 @@ export const ssoConnectorMetadataGuard = z.object({
|
|
|
8
9
|
logo: z.string(),
|
|
9
10
|
darkLogo: z.string().optional(),
|
|
10
11
|
});
|
|
12
|
+
const ssoConnectorFactoryDetailGuard = z.object({
|
|
13
|
+
providerName: z.string(),
|
|
14
|
+
logo: z.string(),
|
|
15
|
+
description: z.string(),
|
|
16
|
+
});
|
|
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({
|
|
22
|
+
providerLogo: z.string(),
|
|
23
|
+
providerConfig: z.record(z.unknown()).optional(),
|
|
24
|
+
}));
|
package/lib/types/user.d.ts
CHANGED
|
@@ -15,10 +15,10 @@ export declare const userInfoGuard: z.ZodObject<Pick<{
|
|
|
15
15
|
applicationId: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
16
16
|
identities: z.ZodType<Record<string, {
|
|
17
17
|
userId: string;
|
|
18
|
-
details?:
|
|
18
|
+
details?: Record<string, unknown> | undefined;
|
|
19
19
|
}>, z.ZodTypeDef, Record<string, {
|
|
20
20
|
userId: string;
|
|
21
|
-
details?:
|
|
21
|
+
details?: Record<string, unknown> | undefined;
|
|
22
22
|
}>>;
|
|
23
23
|
customData: z.ZodType<import("../foundations/index.js").JsonObject, z.ZodTypeDef, import("../foundations/index.js").JsonObject>;
|
|
24
24
|
logtoConfig: z.ZodType<import("../foundations/index.js").JsonObject, z.ZodTypeDef, import("../foundations/index.js").JsonObject>;
|
|
@@ -90,7 +90,7 @@ export declare const userInfoGuard: z.ZodObject<Pick<{
|
|
|
90
90
|
avatar: string | null;
|
|
91
91
|
identities: Record<string, {
|
|
92
92
|
userId: string;
|
|
93
|
-
details?:
|
|
93
|
+
details?: Record<string, unknown> | undefined;
|
|
94
94
|
}>;
|
|
95
95
|
customData: import("../foundations/index.js").JsonObject;
|
|
96
96
|
logtoConfig: import("../foundations/index.js").JsonObject;
|
|
@@ -136,7 +136,7 @@ export declare const userInfoGuard: z.ZodObject<Pick<{
|
|
|
136
136
|
avatar: string | null;
|
|
137
137
|
identities: Record<string, {
|
|
138
138
|
userId: string;
|
|
139
|
-
details?:
|
|
139
|
+
details?: Record<string, unknown> | undefined;
|
|
140
140
|
}>;
|
|
141
141
|
customData: import("../foundations/index.js").JsonObject;
|
|
142
142
|
logtoConfig: import("../foundations/index.js").JsonObject;
|
|
@@ -184,10 +184,10 @@ export declare const userProfileResponseGuard: z.ZodObject<{
|
|
|
184
184
|
avatar: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
185
185
|
identities: z.ZodType<Record<string, {
|
|
186
186
|
userId: string;
|
|
187
|
-
details?:
|
|
187
|
+
details?: Record<string, unknown> | undefined;
|
|
188
188
|
}>, z.ZodTypeDef, Record<string, {
|
|
189
189
|
userId: string;
|
|
190
|
-
details?:
|
|
190
|
+
details?: Record<string, unknown> | undefined;
|
|
191
191
|
}>>;
|
|
192
192
|
customData: z.ZodType<import("../foundations/index.js").JsonObject, z.ZodTypeDef, import("../foundations/index.js").JsonObject>;
|
|
193
193
|
logtoConfig: z.ZodType<import("../foundations/index.js").JsonObject, z.ZodTypeDef, import("../foundations/index.js").JsonObject>;
|
|
@@ -259,7 +259,7 @@ export declare const userProfileResponseGuard: z.ZodObject<{
|
|
|
259
259
|
avatar: string | null;
|
|
260
260
|
identities: Record<string, {
|
|
261
261
|
userId: string;
|
|
262
|
-
details?:
|
|
262
|
+
details?: Record<string, unknown> | undefined;
|
|
263
263
|
}>;
|
|
264
264
|
customData: import("../foundations/index.js").JsonObject;
|
|
265
265
|
logtoConfig: import("../foundations/index.js").JsonObject;
|
|
@@ -306,7 +306,7 @@ export declare const userProfileResponseGuard: z.ZodObject<{
|
|
|
306
306
|
avatar: string | null;
|
|
307
307
|
identities: Record<string, {
|
|
308
308
|
userId: string;
|
|
309
|
-
details?:
|
|
309
|
+
details?: Record<string, unknown> | undefined;
|
|
310
310
|
}>;
|
|
311
311
|
customData: import("../foundations/index.js").JsonObject;
|
|
312
312
|
logtoConfig: import("../foundations/index.js").JsonObject;
|
|
@@ -399,10 +399,10 @@ export declare const featuredUserGuard: z.ZodObject<Pick<{
|
|
|
399
399
|
applicationId: z.ZodType<string | null, z.ZodTypeDef, string | null>;
|
|
400
400
|
identities: z.ZodType<Record<string, {
|
|
401
401
|
userId: string;
|
|
402
|
-
details?:
|
|
402
|
+
details?: Record<string, unknown> | undefined;
|
|
403
403
|
}>, z.ZodTypeDef, Record<string, {
|
|
404
404
|
userId: string;
|
|
405
|
-
details?:
|
|
405
|
+
details?: Record<string, unknown> | undefined;
|
|
406
406
|
}>>;
|
|
407
407
|
customData: z.ZodType<import("../foundations/index.js").JsonObject, z.ZodTypeDef, import("../foundations/index.js").JsonObject>;
|
|
408
408
|
logtoConfig: z.ZodType<import("../foundations/index.js").JsonObject, z.ZodTypeDef, import("../foundations/index.js").JsonObject>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/schemas",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"author": "Silverhand Inc. <contact@silverhand.io>",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
"@logto/connector-kit": "^2.0.0",
|
|
68
68
|
"@logto/core-kit": "^2.2.0",
|
|
69
69
|
"@logto/language-kit": "^1.0.0",
|
|
70
|
-
"@logto/phrases": "^1.
|
|
71
|
-
"@logto/phrases-experience": "^1.
|
|
70
|
+
"@logto/phrases": "^1.7.0",
|
|
71
|
+
"@logto/phrases-experience": "^1.4.0",
|
|
72
72
|
"@logto/shared": "^3.0.0",
|
|
73
73
|
"@withtyped/server": "^0.12.9"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"zod": "^3.22.
|
|
76
|
+
"zod": "^3.22.4"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
79
|
"precommit": "lint-staged",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* init_order = 1 */
|
|
1
2
|
create table sso_connectors (
|
|
2
3
|
tenant_id varchar(21) not null
|
|
3
4
|
references tenants (id) on update cascade on delete cascade,
|
|
@@ -15,8 +16,6 @@ create table sso_connectors (
|
|
|
15
16
|
branding jsonb /* @use SsoBranding */ not null default '{}'::jsonb,
|
|
16
17
|
/** Determines whether to synchronize the user's profile on each login. */
|
|
17
18
|
sync_profile boolean not null default FALSE,
|
|
18
|
-
/** Determines whether SSO is the restricted sign-in method for users with the SSO registered email domains */
|
|
19
|
-
sso_only boolean not null default FALSE,
|
|
20
19
|
/** When the SSO connector was created. */
|
|
21
20
|
created_at timestamptz not null default(now()),
|
|
22
21
|
primary key (id)
|
|
@@ -11,6 +11,9 @@ create table user_sso_identities (
|
|
|
11
11
|
identity_id varchar(128) not null,
|
|
12
12
|
detail jsonb /* @use JsonObject */ not null default '{}'::jsonb,
|
|
13
13
|
created_at timestamp not null default(now()),
|
|
14
|
+
sso_connector_id
|
|
15
|
+
varchar(128) not null
|
|
16
|
+
references sso_connectors (id) on update cascade on delete cascade,
|
|
14
17
|
primary key (id),
|
|
15
18
|
constraint user_sso_identities__issuer__identity_id
|
|
16
19
|
unique (tenant_id, issuer, identity_id)
|