@logto/cli 1.35.0 → 1.36.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.
|
@@ -2,7 +2,7 @@ import { readdir, readFile } from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { createDefaultAdminConsoleConfig, defaultTenantId, adminTenantId, defaultManagementApi, createAdminDataInAdminTenant, createMeApiInAdminTenant, createDefaultSignInExperience, createAdminTenantSignInExperience, createDefaultAdminConsoleApplication, createCloudApi, createTenantApplicationRole, CloudScope, Roles, UsersRoles, LogtoConfigs, SignInExperiences, Applications, OrganizationUserRelations, getTenantOrganizationId, Users, OrganizationRoleUserRelations, TenantRole, AccountCenters, } from '@logto/schemas';
|
|
4
4
|
import { getTenantRole } from '@logto/schemas';
|
|
5
|
-
import { createDefaultAccountCenter } from '@logto/schemas/lib/seeds/account-center.js';
|
|
5
|
+
import { createDefaultAccountCenter, createAdminTenantAccountCenter, } from '@logto/schemas/lib/seeds/account-center.js';
|
|
6
6
|
import { Tenants } from '@logto/schemas/models';
|
|
7
7
|
import { generateStandardId } from '@logto/shared';
|
|
8
8
|
import { sql } from '@silverhand/slonik';
|
|
@@ -116,7 +116,7 @@ export const seedTables = async (connection, latestTimestamp, isCloud) => {
|
|
|
116
116
|
connection.query(insertInto(createAdminTenantSignInExperience(), SignInExperiences.table)),
|
|
117
117
|
connection.query(insertInto(createDefaultAdminConsoleApplication(), Applications.table)),
|
|
118
118
|
connection.query(insertInto(createDefaultAccountCenter(defaultTenantId), AccountCenters.table)),
|
|
119
|
-
connection.query(insertInto(
|
|
119
|
+
connection.query(insertInto(createAdminTenantAccountCenter(), AccountCenters.table)),
|
|
120
120
|
]);
|
|
121
121
|
// The below seed data is for the Logto Cloud only. We put it here for the sake of simplicity.
|
|
122
122
|
// The data is not harmful for OSS, since they are all admin tenant data. OSS will not use them
|
package/lib/database.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseTimeoutEnv } from '@logto/shared';
|
|
2
|
+
import { assert, conditional } from '@silverhand/essentials';
|
|
2
3
|
import { createPool, parseDsn, sql, stringifyDsn, createInterceptorsPreset, } from '@silverhand/slonik';
|
|
3
4
|
import decamelize from 'decamelize';
|
|
4
5
|
import { DatabaseError } from 'pg-protocol';
|
|
5
6
|
import { convertToPrimitiveOrSql } from './sql.js';
|
|
6
7
|
import { ConfigKey, consoleLog, getCliConfigWithPrompt } from './utils.js';
|
|
8
|
+
const databaseStatementTimeout = parseTimeoutEnv(process.env.DATABASE_STATEMENT_TIMEOUT);
|
|
7
9
|
export const defaultDatabaseUrl = 'postgresql://localhost:5432/logto';
|
|
8
10
|
export const getDatabaseUrlFromConfig = async () => (await getCliConfigWithPrompt({
|
|
9
11
|
key: ConfigKey.DatabaseUrl,
|
|
@@ -15,6 +17,7 @@ export const createPoolFromConfig = async () => {
|
|
|
15
17
|
assert(parseDsn(databaseUrl).databaseName, new Error('Database name is required in URL'));
|
|
16
18
|
return createPool(databaseUrl, {
|
|
17
19
|
interceptors: createInterceptorsPreset(),
|
|
20
|
+
...conditional(databaseStatementTimeout !== undefined && { statementTimeout: databaseStatementTimeout }),
|
|
18
21
|
});
|
|
19
22
|
};
|
|
20
23
|
/**
|
|
@@ -41,6 +44,9 @@ export const createPoolAndDatabaseIfNeeded = async () => {
|
|
|
41
44
|
const databaseName = dsn.databaseName ?? '?';
|
|
42
45
|
const maintenancePool = await createPool(stringifyDsn({ ...dsn, databaseName: 'postgres' }), {
|
|
43
46
|
interceptors: createInterceptorsPreset(),
|
|
47
|
+
...(databaseStatementTimeout === undefined
|
|
48
|
+
? {}
|
|
49
|
+
: { statementTimeout: databaseStatementTimeout }),
|
|
44
50
|
});
|
|
45
51
|
await maintenancePool.query(sql `
|
|
46
52
|
create database ${sql.identifier([databaseName])}
|
package/lib/package-json.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const packageJson = {
|
|
2
2
|
"name": "@logto/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.36.0",
|
|
4
4
|
"description": "Logto CLI.",
|
|
5
5
|
"author": "Silverhand Inc. <contact@silverhand.io>",
|
|
6
6
|
"homepage": "https://github.com/logto-io/logto#readme",
|
|
@@ -60,7 +60,7 @@ export const packageJson = {
|
|
|
60
60
|
"p-retry": "^6.0.0",
|
|
61
61
|
"pg-protocol": "^1.6.0",
|
|
62
62
|
"semver": "^7.3.8",
|
|
63
|
-
"tar": "^7.
|
|
63
|
+
"tar": "^7.5.4",
|
|
64
64
|
"yargs": "^17.6.0",
|
|
65
65
|
"zod": "3.24.3"
|
|
66
66
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.36.0",
|
|
4
4
|
"description": "Logto CLI.",
|
|
5
5
|
"author": "Silverhand Inc. <contact@silverhand.io>",
|
|
6
6
|
"homepage": "https://github.com/logto-io/logto#readme",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"p-retry": "^6.0.0",
|
|
43
43
|
"pg-protocol": "^1.6.0",
|
|
44
44
|
"semver": "^7.3.8",
|
|
45
|
-
"tar": "^7.
|
|
45
|
+
"tar": "^7.5.4",
|
|
46
46
|
"yargs": "^17.6.0",
|
|
47
47
|
"zod": "3.24.3",
|
|
48
|
-
"@logto/
|
|
49
|
-
"@logto/schemas": "1.
|
|
50
|
-
"@logto/shared": "^3.3.
|
|
51
|
-
"@logto/
|
|
48
|
+
"@logto/core-kit": "^2.7.0",
|
|
49
|
+
"@logto/schemas": "1.36.0",
|
|
50
|
+
"@logto/shared": "^3.3.1",
|
|
51
|
+
"@logto/connector-kit": "^4.7.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@silverhand/eslint-config": "6.0.1",
|