@logto/schemas 1.1.0 → 1.2.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.0.0-1677765137-seed-for-admin-tenant.ts +1 -1
- package/alterations/1.0.0-1677907982-allow-admin-create-multiple-tenants.ts +1 -1
- package/alterations/1.0.0-1678425761-m2m-app-for-tenants.ts +1 -1
- package/alterations/1.0.0_rc.1-1675788753-multi-tenancy-rls.ts +1 -1
- package/alterations/1.0.0_rc.1-1676115897-add-admin-tenant.ts +1 -1
- package/alterations/1.0.0_rc.1-1676190092-migrate-admin-data.ts +3 -3
- package/alterations/1.0.0_rc.1-1676906977-remove-demo-app.ts +1 -1
- package/alterations/1.0.0_rc.1-1677059985-move-console-application-to-database.ts +1 -1
- package/alterations/1.2.0-1681267285-fix-get-started-passwordless-status.ts +32 -0
- package/alterations-js/1.0.0-1677765137-seed-for-admin-tenant.js +1 -1
- package/alterations-js/1.0.0-1677907982-allow-admin-create-multiple-tenants.js +1 -1
- package/alterations-js/1.0.0-1678425761-m2m-app-for-tenants.js +1 -1
- package/alterations-js/1.0.0_rc.1-1675788753-multi-tenancy-rls.js +1 -1
- package/alterations-js/1.0.0_rc.1-1676115897-add-admin-tenant.js +1 -1
- package/alterations-js/1.0.0_rc.1-1676190092-migrate-admin-data.js +3 -3
- package/alterations-js/1.0.0_rc.1-1676906977-remove-demo-app.js +1 -1
- package/alterations-js/1.0.0_rc.1-1677059985-move-console-application-to-database.js +1 -1
- package/alterations-js/1.2.0-1681267285-fix-get-started-passwordless-status.d.ts +3 -0
- package/alterations-js/1.2.0-1681267285-fix-get-started-passwordless-status.js +23 -0
- package/lib/consts/cookie.d.ts +1 -0
- package/lib/consts/cookie.js +1 -0
- package/lib/consts/index.d.ts +1 -0
- package/lib/consts/index.js +1 -0
- package/lib/foundations/schemas.d.ts +2 -6
- package/lib/seeds/application.js +1 -1
- package/lib/seeds/cloud-api.js +1 -1
- package/lib/seeds/management-api.js +1 -1
- package/lib/types/cookie.d.ts +9 -0
- package/lib/types/cookie.js +2 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/package.json +9 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { generateKeyPair } from 'crypto';
|
|
2
|
-
import { promisify } from 'util';
|
|
1
|
+
import { generateKeyPair } from 'node:crypto';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
3
|
|
|
4
|
-
import { generateStandardId } from '@logto/
|
|
4
|
+
import { generateStandardId } from '@logto/shared/universal';
|
|
5
5
|
import inquirer from 'inquirer';
|
|
6
6
|
import type { CommonQueryMethods, SerializableValue } from 'slonik';
|
|
7
7
|
import { sql } from 'slonik';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
|
|
3
|
+
import type { AlterationScript } from '../lib/types/alteration.js';
|
|
4
|
+
|
|
5
|
+
const adminConsoleConfigKey = 'adminConsole';
|
|
6
|
+
|
|
7
|
+
const alteration: AlterationScript = {
|
|
8
|
+
up: async (pool) => {
|
|
9
|
+
const tenantIds = await pool.many<{ id: string }>(sql`select id from tenants`);
|
|
10
|
+
|
|
11
|
+
await Promise.all(
|
|
12
|
+
tenantIds.map(async ({ id }) => {
|
|
13
|
+
const { count } = await pool.one<{ count: number }>(sql`
|
|
14
|
+
select count(*) from connectors
|
|
15
|
+
where tenant_id = ${id} and connector_id <> 'logto-sms' and connector_id <> 'logto-email' and connector_id <> 'logto-social-demo';
|
|
16
|
+
`);
|
|
17
|
+
|
|
18
|
+
if (count > 0) {
|
|
19
|
+
await pool.query(sql`
|
|
20
|
+
update logto_configs set value = jsonb_set(value, '{passwordlessConfigured}', 'true')
|
|
21
|
+
where tenant_id = ${id} and key = ${adminConsoleConfigKey};
|
|
22
|
+
`);
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
down: async () => {
|
|
28
|
+
// Do nothing as there is no alteration made to the DB schemas, only fixing data.
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default alteration;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { generateKeyPair } from 'crypto';
|
|
2
|
-
import { promisify } from 'util';
|
|
3
|
-
import { generateStandardId } from '@logto/
|
|
1
|
+
import { generateKeyPair } from 'node:crypto';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
import { generateStandardId } from '@logto/shared/universal';
|
|
4
4
|
import inquirer from 'inquirer';
|
|
5
5
|
import { sql } from 'slonik';
|
|
6
6
|
// Copied from CLI with default execution path
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { sql } from 'slonik';
|
|
2
|
+
const adminConsoleConfigKey = 'adminConsole';
|
|
3
|
+
const alteration = {
|
|
4
|
+
up: async (pool) => {
|
|
5
|
+
const tenantIds = await pool.many(sql `select id from tenants`);
|
|
6
|
+
await Promise.all(tenantIds.map(async ({ id }) => {
|
|
7
|
+
const { count } = await pool.one(sql `
|
|
8
|
+
select count(*) from connectors
|
|
9
|
+
where tenant_id = ${id} and connector_id <> 'logto-sms' and connector_id <> 'logto-email' and connector_id <> 'logto-social-demo';
|
|
10
|
+
`);
|
|
11
|
+
if (count > 0) {
|
|
12
|
+
await pool.query(sql `
|
|
13
|
+
update logto_configs set value = jsonb_set(value, '{passwordlessConfigured}', 'true')
|
|
14
|
+
where tenant_id = ${id} and key = ${adminConsoleConfigKey};
|
|
15
|
+
`);
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
|
+
},
|
|
19
|
+
down: async () => {
|
|
20
|
+
// Do nothing as there is no alteration made to the DB schemas, only fixing data.
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export default alteration;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const logtoCookieKey = "_logto";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const logtoCookieKey = '_logto';
|
package/lib/consts/index.d.ts
CHANGED
package/lib/consts/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type SchemaLike } from '@logto/shared/universal';
|
|
1
2
|
import type { ZodObject, ZodType, ZodOptional } from 'zod';
|
|
3
|
+
export type { SchemaLike, SchemaValue, SchemaValuePrimitive } from '@logto/shared/universal';
|
|
2
4
|
type ParseOptional<K> = undefined extends K ? ZodOptional<ZodType<Exclude<K, undefined>>> : ZodType<K>;
|
|
3
5
|
export type CreateGuard<T extends Record<string, unknown>> = ZodObject<{
|
|
4
6
|
[key in keyof T]-?: ParseOptional<T[key]>;
|
|
@@ -6,11 +8,6 @@ export type CreateGuard<T extends Record<string, unknown>> = ZodObject<{
|
|
|
6
8
|
export type Guard<T extends Record<string, unknown>> = ZodObject<{
|
|
7
9
|
[key in keyof T]: ZodType<T[key]>;
|
|
8
10
|
}>;
|
|
9
|
-
export type SchemaValuePrimitive = string | number | boolean | undefined;
|
|
10
|
-
export type SchemaValue = SchemaValuePrimitive | Record<string, unknown> | unknown[] | null;
|
|
11
|
-
export type SchemaLike<Key extends string = string> = {
|
|
12
|
-
[key in Key]: SchemaValue;
|
|
13
|
-
};
|
|
14
11
|
export type GeneratedSchema<CreateSchema extends SchemaLike, Schema extends CreateSchema> = keyof Schema extends string ? Readonly<{
|
|
15
12
|
table: string;
|
|
16
13
|
tableSingular: string;
|
|
@@ -21,4 +18,3 @@ export type GeneratedSchema<CreateSchema extends SchemaLike, Schema extends Crea
|
|
|
21
18
|
createGuard: CreateGuard<CreateSchema>;
|
|
22
19
|
guard: Guard<Schema>;
|
|
23
20
|
}> : never;
|
|
24
|
-
export {};
|
package/lib/seeds/application.js
CHANGED
package/lib/seeds/cloud-api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generateStandardId } from '@logto/
|
|
1
|
+
import { generateStandardId } from '@logto/shared/universal';
|
|
2
2
|
import { AdminTenantRole } from '../types/index.js';
|
|
3
3
|
import { adminTenantId } from './tenant.js';
|
|
4
4
|
/** The API Resource Indicator for Logto Cloud. It's only useful when domain-based multi-tenancy is enabled. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { generateStandardId } from '@logto/
|
|
1
|
+
import { generateStandardId } from '@logto/shared/universal';
|
|
2
2
|
import { PredefinedScope, InternalRole, AdminTenantRole } from '../types/index.js';
|
|
3
3
|
import { adminTenantId, defaultTenantId } from './tenant.js';
|
|
4
4
|
// Consider remove the dependency of IDs
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const logtoUiCookieGuard: z.ZodObject<{
|
|
3
|
+
appId: z.ZodOptional<z.ZodString>;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
appId?: string | undefined;
|
|
6
|
+
}, {
|
|
7
|
+
appId?: string | undefined;
|
|
8
|
+
}>;
|
|
9
|
+
export type LogtoUiCookie = z.infer<typeof logtoUiCookieGuard>;
|
package/lib/types/index.d.ts
CHANGED
package/lib/types/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/schemas",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"author": "Silverhand Inc. <contact@silverhand.io>",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"node": "^18.12.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@silverhand/eslint-config": "3.0.
|
|
27
|
+
"@silverhand/eslint-config": "3.0.1",
|
|
28
28
|
"@silverhand/essentials": "^2.5.0",
|
|
29
29
|
"@silverhand/ts-config": "3.0.0",
|
|
30
30
|
"@types/inquirer": "^9.0.0",
|
|
@@ -64,13 +64,14 @@
|
|
|
64
64
|
},
|
|
65
65
|
"prettier": "@silverhand/eslint-config/.prettierrc",
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@
|
|
68
|
-
"
|
|
69
|
-
"@logto/connector-kit": "^1.1.0",
|
|
70
|
-
"@logto/core-kit": "^1.1.0",
|
|
67
|
+
"@logto/connector-kit": "^1.1.1",
|
|
68
|
+
"@logto/core-kit": "^2.0.0",
|
|
71
69
|
"@logto/language-kit": "^1.0.0",
|
|
72
|
-
"@logto/phrases": "^1.
|
|
73
|
-
"@logto/phrases-ui": "^1.
|
|
70
|
+
"@logto/phrases": "^1.2.0",
|
|
71
|
+
"@logto/phrases-ui": "^1.2.0",
|
|
72
|
+
"@logto/shared": "^2.0.0",
|
|
73
|
+
"@withtyped/server": "^0.9.0",
|
|
74
|
+
"zod": "^3.20.2"
|
|
74
75
|
},
|
|
75
76
|
"scripts": {
|
|
76
77
|
"precommit": "lint-staged",
|