@logto/cli 1.37.1 → 1.38.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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { LogtoOidcConfigType } from '@logto/schemas';
|
|
2
2
|
import { LogtoOidcConfigKey } from '@logto/schemas';
|
|
3
3
|
import type { DatabaseTransactionConnection } from '@silverhand/slonik';
|
|
4
|
+
type OidcConfigKeyToSeed = Exclude<LogtoOidcConfigKey, LogtoOidcConfigKey.Session>;
|
|
4
5
|
export declare const seedOidcConfigs: (pool: DatabaseTransactionConnection, tenantId: string) => Promise<void>;
|
|
5
6
|
/**
|
|
6
7
|
* Each config reader will do the following things in order:
|
|
@@ -8,8 +9,9 @@ export declare const seedOidcConfigs: (pool: DatabaseTransactionConnection, tena
|
|
|
8
9
|
* 2. Generate value if #1 doesn't work
|
|
9
10
|
*/
|
|
10
11
|
export declare const oidcConfigReaders: {
|
|
11
|
-
[key in
|
|
12
|
+
[key in OidcConfigKeyToSeed]: () => Promise<{
|
|
12
13
|
value: LogtoOidcConfigType[key];
|
|
13
14
|
fromEnv: boolean;
|
|
14
15
|
}>;
|
|
15
16
|
};
|
|
17
|
+
export {};
|
|
@@ -8,13 +8,14 @@ import { getRowsByKeys, updateValueByKey } from '../../../queries/logto-config.j
|
|
|
8
8
|
import { consoleLog } from '../../../utils.js';
|
|
9
9
|
import { buildOidcKeyFromRawString, generateOidcCookieKey, generateOidcPrivateKey, } from '../utils.js';
|
|
10
10
|
const isBase64FormatPrivateKey = (key) => !key.includes('-');
|
|
11
|
+
const oidcConfigKeysToSeed = Object.values(LogtoOidcConfigKey).filter((key) => key !== LogtoOidcConfigKey.Session);
|
|
11
12
|
export const seedOidcConfigs = async (pool, tenantId) => {
|
|
12
13
|
const tenantPrefix = `[${tenantId}]`;
|
|
13
14
|
const configGuard = z.object({
|
|
14
15
|
key: z.nativeEnum(LogtoOidcConfigKey),
|
|
15
16
|
value: z.unknown(),
|
|
16
17
|
});
|
|
17
|
-
const { rows } = await getRowsByKeys(pool, tenantId,
|
|
18
|
+
const { rows } = await getRowsByKeys(pool, tenantId, oidcConfigKeysToSeed);
|
|
18
19
|
// Filter out valid keys that hold a valid value
|
|
19
20
|
const result = await Promise.all(rows.map(async (row) => {
|
|
20
21
|
try {
|
|
@@ -25,7 +26,7 @@ export const seedOidcConfigs = async (pool, tenantId) => {
|
|
|
25
26
|
catch { }
|
|
26
27
|
}));
|
|
27
28
|
const existingKeys = new Set(result.filter(Boolean));
|
|
28
|
-
const validOptions =
|
|
29
|
+
const validOptions = oidcConfigKeysToSeed.filter((key) => {
|
|
29
30
|
const included = existingKeys.has(key);
|
|
30
31
|
if (included) {
|
|
31
32
|
consoleLog.info(tenantPrefix, `Key ${chalk.green(key)} exists, skipping`);
|
package/lib/package-json.d.ts
CHANGED
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.38.0",
|
|
4
4
|
"description": "Logto CLI.",
|
|
5
5
|
"author": "Silverhand Inc. <contact@silverhand.io>",
|
|
6
6
|
"homepage": "https://github.com/logto-io/logto#readme",
|
|
@@ -31,7 +31,8 @@ export const packageJson = {
|
|
|
31
31
|
"start:dev": "pnpm build && node .",
|
|
32
32
|
"lint": "eslint --ext .ts src",
|
|
33
33
|
"lint:report": "pnpm lint --format json --output-file report.json",
|
|
34
|
-
"test": "vitest src",
|
|
34
|
+
"test": "vitest run src",
|
|
35
|
+
"test:watch": "vitest src --watch",
|
|
35
36
|
"test:ci": "pnpm run test --silent --coverage",
|
|
36
37
|
"prepack": "pnpm build"
|
|
37
38
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.38.0",
|
|
4
4
|
"description": "Logto CLI.",
|
|
5
5
|
"author": "Silverhand Inc. <contact@silverhand.io>",
|
|
6
6
|
"homepage": "https://github.com/logto-io/logto#readme",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"tar": "^7.5.7",
|
|
46
46
|
"yargs": "^17.6.0",
|
|
47
47
|
"zod": "3.24.3",
|
|
48
|
-
"@logto/
|
|
49
|
-
"@logto/
|
|
50
|
-
"@logto/
|
|
51
|
-
"@logto/
|
|
48
|
+
"@logto/connector-kit": "^5.0.0",
|
|
49
|
+
"@logto/core-kit": "^2.8.0",
|
|
50
|
+
"@logto/schemas": "1.38.0",
|
|
51
|
+
"@logto/shared": "^3.3.1"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@silverhand/eslint-config": "6.0.1",
|
|
@@ -88,7 +88,8 @@
|
|
|
88
88
|
"start:dev": "pnpm build && node .",
|
|
89
89
|
"lint": "eslint --ext .ts src",
|
|
90
90
|
"lint:report": "pnpm lint --format json --output-file report.json",
|
|
91
|
-
"test": "vitest src",
|
|
91
|
+
"test": "vitest run src",
|
|
92
|
+
"test:watch": "vitest src --watch",
|
|
92
93
|
"test:ci": "pnpm run test --silent --coverage"
|
|
93
94
|
}
|
|
94
95
|
}
|