@objectstack/cli 3.0.5 → 3.0.7
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/.turbo/turbo-build.log +2 -26
- package/CHANGELOG.md +27 -0
- package/README.md +98 -54
- package/bin/run-dev.js +5 -0
- package/bin/run.js +5 -0
- package/dist/bin.d.ts +11 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +12 -3759
- package/dist/bin.js.map +1 -0
- package/dist/commands/codemod/v2-to-v3.d.ts +10 -0
- package/dist/commands/codemod/v2-to-v3.d.ts.map +1 -0
- package/dist/commands/codemod/v2-to-v3.js +145 -0
- package/dist/commands/codemod/v2-to-v3.js.map +1 -0
- package/dist/commands/compile.d.ts +13 -0
- package/dist/commands/compile.d.ts.map +1 -0
- package/dist/commands/compile.js +91 -0
- package/dist/commands/compile.js.map +1 -0
- package/dist/commands/create.d.ts +91 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +259 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/dev.d.ts +14 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +67 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/diff.d.ts +16 -0
- package/dist/commands/diff.d.ts.map +1 -0
- package/dist/commands/diff.js +239 -0
- package/dist/commands/diff.js.map +1 -0
- package/dist/commands/doctor.d.ts +10 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +532 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/explain.d.ts +12 -0
- package/dist/commands/explain.d.ts.map +1 -0
- package/dist/commands/explain.js +368 -0
- package/dist/commands/explain.js.map +1 -0
- package/dist/commands/generate.d.ts +17 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +833 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/info.d.ts +12 -0
- package/dist/commands/info.d.ts.map +1 -0
- package/dist/commands/info.js +100 -0
- package/dist/commands/info.js.map +1 -0
- package/dist/commands/init.d.ts +22 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +295 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/lint.d.ts +13 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +255 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/plugin/add.d.ts +22 -0
- package/dist/commands/plugin/add.d.ts.map +1 -0
- package/dist/commands/plugin/add.js +93 -0
- package/dist/commands/plugin/add.js.map +1 -0
- package/dist/commands/plugin/info.d.ts +10 -0
- package/dist/commands/plugin/info.d.ts.map +1 -0
- package/dist/commands/plugin/info.js +65 -0
- package/dist/commands/plugin/info.js.map +1 -0
- package/dist/commands/plugin/list.d.ts +13 -0
- package/dist/commands/plugin/list.d.ts.map +1 -0
- package/dist/commands/plugin/list.js +78 -0
- package/dist/commands/plugin/list.js.map +1 -0
- package/dist/commands/plugin/remove.d.ts +20 -0
- package/dist/commands/plugin/remove.d.ts.map +1 -0
- package/dist/commands/plugin/remove.js +79 -0
- package/dist/commands/plugin/remove.js.map +1 -0
- package/dist/commands/serve.d.ts +15 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +286 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/studio.d.ts +19 -0
- package/dist/commands/studio.d.ts.map +1 -0
- package/dist/commands/studio.js +43 -0
- package/dist/commands/studio.js.map +1 -0
- package/dist/commands/test.d.ts +13 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +120 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/validate.d.ts +13 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +115 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +15 -114
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -2799
- package/dist/index.js.map +1 -0
- package/dist/utils/config.d.ts +21 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +66 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/format.d.ts +52 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +202 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/plugin-helpers.d.ts +14 -0
- package/dist/utils/plugin-helpers.d.ts.map +1 -0
- package/dist/utils/plugin-helpers.js +40 -0
- package/dist/utils/plugin-helpers.js.map +1 -0
- package/dist/utils/studio.d.ts +58 -0
- package/dist/utils/studio.d.ts.map +1 -0
- package/dist/utils/studio.js +288 -0
- package/dist/utils/studio.js.map +1 -0
- package/package.json +33 -15
- package/src/bin.ts +11 -104
- package/src/commands/{codemod.ts → codemod/v2-to-v3.ts} +21 -28
- package/src/commands/compile.ts +35 -25
- package/src/commands/create.ts +29 -19
- package/src/commands/dev.ts +21 -10
- package/src/commands/diff.ts +28 -19
- package/src/commands/doctor.ts +20 -11
- package/src/commands/explain.ts +20 -10
- package/src/commands/generate.ts +81 -90
- package/src/commands/info.ts +22 -11
- package/src/commands/init.ts +32 -20
- package/src/commands/lint.ts +27 -15
- package/src/commands/plugin/add.ts +112 -0
- package/src/commands/plugin/info.ts +79 -0
- package/src/commands/plugin/list.ts +93 -0
- package/src/commands/plugin/remove.ts +97 -0
- package/src/commands/serve.ts +30 -20
- package/src/commands/studio.ts +21 -11
- package/src/commands/test.ts +21 -10
- package/src/commands/validate.ts +36 -25
- package/src/index.ts +20 -12
- package/src/utils/format.ts +10 -6
- package/src/utils/plugin-helpers.ts +37 -0
- package/src/utils/studio.ts +0 -1
- package/test/commands.test.ts +76 -37
- package/test/plugin-commands.test.ts +42 -160
- package/test/plugin.test.ts +19 -23
- package/tsconfig.build.json +18 -0
- package/bin/objectstack.js +0 -2
- package/dist/chunk-CSHQEILI.js +0 -246
- package/dist/chunk-Q74JNWKD.js +0 -248
- package/dist/config-A7BN6UIT.js +0 -11
- package/dist/config-UN34WBHT.js +0 -10
- package/src/commands/plugin.ts +0 -372
- package/src/utils/plugin-commands.ts +0 -163
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,uEAAuE;AACvE,iEAAiE;AACjE,4EAA4E;AAE5E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEhE,uEAAuE;AACvE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface LoadedConfig {
|
|
2
|
+
config: any;
|
|
3
|
+
absolutePath: string;
|
|
4
|
+
duration: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the config file path. Supports:
|
|
8
|
+
* - explicit path (objectstack.config.ts)
|
|
9
|
+
* - auto-detection (searches for objectstack.config.{ts,js,mjs})
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolveConfigPath(source?: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Load and bundle a config file using bundle-require.
|
|
14
|
+
* Returns the resolved config object and load time.
|
|
15
|
+
*/
|
|
16
|
+
export declare function loadConfig(source?: string): Promise<LoadedConfig>;
|
|
17
|
+
/**
|
|
18
|
+
* Check whether a file exists at the given path (relative to cwd).
|
|
19
|
+
*/
|
|
20
|
+
export declare function configExists(name?: string): boolean;
|
|
21
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,GAAG,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CA6BzD;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAkBvE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,GAAE,MAAgC,GAAG,OAAO,CAE5E"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { bundleRequire } from 'bundle-require';
|
|
6
|
+
import { printError } from './format.js';
|
|
7
|
+
/**
|
|
8
|
+
* Resolve the config file path. Supports:
|
|
9
|
+
* - explicit path (objectstack.config.ts)
|
|
10
|
+
* - auto-detection (searches for objectstack.config.{ts,js,mjs})
|
|
11
|
+
*/
|
|
12
|
+
export function resolveConfigPath(source) {
|
|
13
|
+
if (source) {
|
|
14
|
+
const abs = path.resolve(process.cwd(), source);
|
|
15
|
+
if (!fs.existsSync(abs)) {
|
|
16
|
+
printError(`Config file not found: ${chalk.white(abs)}`);
|
|
17
|
+
console.log('');
|
|
18
|
+
console.log(chalk.dim(' Hint: Run this command from a directory with objectstack.config.ts'));
|
|
19
|
+
console.log(chalk.dim(' Or specify the path: objectstack <command> path/to/config.ts'));
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
return abs;
|
|
23
|
+
}
|
|
24
|
+
// Auto-detect
|
|
25
|
+
const candidates = [
|
|
26
|
+
'objectstack.config.ts',
|
|
27
|
+
'objectstack.config.js',
|
|
28
|
+
'objectstack.config.mjs',
|
|
29
|
+
];
|
|
30
|
+
for (const candidate of candidates) {
|
|
31
|
+
const abs = path.resolve(process.cwd(), candidate);
|
|
32
|
+
if (fs.existsSync(abs))
|
|
33
|
+
return abs;
|
|
34
|
+
}
|
|
35
|
+
printError('No objectstack.config.{ts,js,mjs} found in current directory');
|
|
36
|
+
console.log('');
|
|
37
|
+
console.log(chalk.dim(' Hint: Run `objectstack init` to create a new project'));
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Load and bundle a config file using bundle-require.
|
|
42
|
+
* Returns the resolved config object and load time.
|
|
43
|
+
*/
|
|
44
|
+
export async function loadConfig(source) {
|
|
45
|
+
const absolutePath = resolveConfigPath(source);
|
|
46
|
+
const start = Date.now();
|
|
47
|
+
const { mod } = await bundleRequire({
|
|
48
|
+
filepath: absolutePath,
|
|
49
|
+
});
|
|
50
|
+
const config = mod.default || mod;
|
|
51
|
+
if (!config) {
|
|
52
|
+
throw new Error(`No default export found in ${path.basename(absolutePath)}`);
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
config,
|
|
56
|
+
absolutePath,
|
|
57
|
+
duration: Date.now() - start,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Check whether a file exists at the given path (relative to cwd).
|
|
62
|
+
*/
|
|
63
|
+
export function configExists(name = 'objectstack.config.ts') {
|
|
64
|
+
return fs.existsSync(path.resolve(process.cwd(), name));
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAQzC;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAe;IAC/C,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;QAChD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,UAAU,CAAC,0BAA0B,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACzD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,sEAAsE,CAAC,CAAC,CAAC;YAC/F,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,gEAAgE,CAAC,CAAC,CAAC;YACzF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QACD,OAAO,GAAG,C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U,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ZodError } from 'zod';
|
|
2
|
+
export declare const CLI_NAME = "objectstack";
|
|
3
|
+
export declare const CLI_ALIAS = "os";
|
|
4
|
+
export declare function printBanner(version: string): void;
|
|
5
|
+
export declare function printHeader(title: string): void;
|
|
6
|
+
export declare function printKV(key: string, value: string | number, icon?: string): void;
|
|
7
|
+
export declare function printSuccess(msg: string): void;
|
|
8
|
+
export declare function printWarning(msg: string): void;
|
|
9
|
+
export declare function printError(msg: string): void;
|
|
10
|
+
export declare function printInfo(msg: string): void;
|
|
11
|
+
export declare function printStep(msg: string): void;
|
|
12
|
+
export declare function createTimer(): {
|
|
13
|
+
elapsed: () => number;
|
|
14
|
+
display: () => string;
|
|
15
|
+
};
|
|
16
|
+
export declare function formatZodErrors(error: ZodError): void;
|
|
17
|
+
export interface MetadataStats {
|
|
18
|
+
objects: number;
|
|
19
|
+
objectExtensions: number;
|
|
20
|
+
fields: number;
|
|
21
|
+
views: number;
|
|
22
|
+
pages: number;
|
|
23
|
+
apps: number;
|
|
24
|
+
dashboards: number;
|
|
25
|
+
reports: number;
|
|
26
|
+
actions: number;
|
|
27
|
+
flows: number;
|
|
28
|
+
workflows: number;
|
|
29
|
+
approvals: number;
|
|
30
|
+
agents: number;
|
|
31
|
+
apis: number;
|
|
32
|
+
roles: number;
|
|
33
|
+
permissions: number;
|
|
34
|
+
themes: number;
|
|
35
|
+
datasources: number;
|
|
36
|
+
translations: number;
|
|
37
|
+
plugins: number;
|
|
38
|
+
devPlugins: number;
|
|
39
|
+
}
|
|
40
|
+
export declare function collectMetadataStats(config: any): MetadataStats;
|
|
41
|
+
export interface ServerReadyOptions {
|
|
42
|
+
port: number;
|
|
43
|
+
configFile: string;
|
|
44
|
+
isDev: boolean;
|
|
45
|
+
pluginCount: number;
|
|
46
|
+
pluginNames?: string[];
|
|
47
|
+
uiEnabled?: boolean;
|
|
48
|
+
studioPath?: string;
|
|
49
|
+
}
|
|
50
|
+
export declare function printServerReady(opts: ServerReadyOptions): void;
|
|
51
|
+
export declare function printMetadataStats(stats: MetadataStats): void;
|
|
52
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAGpC,eAAO,MAAM,QAAQ,gBAAgB,CAAC;AACtC,eAAO,MAAM,SAAS,OAAO,CAAC;AAI9B,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,QAM1C;AAID,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,QAGxC;AAID,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,QAGzE;AAID,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,QAEvC;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,QAEvC;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,QAErC;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,QAEpC;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,QAEpC;AAID,wBAAgB,WAAW;;;EAM1B;AAID,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,QAwC9C;AAID,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,GAAG,GAAG,aAAa,CAwC/D;AAID,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,kBAAkB,QAmBxD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa,QAwDtD"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
// ─── Constants ──────────────────────────────────────────────────────
|
|
4
|
+
export const CLI_NAME = 'objectstack';
|
|
5
|
+
export const CLI_ALIAS = 'os';
|
|
6
|
+
// ─── Banner ─────────────────────────────────────────────────────────
|
|
7
|
+
export function printBanner(version) {
|
|
8
|
+
console.log('');
|
|
9
|
+
console.log(chalk.bold.cyan(' ╔═══════════════════════════════════╗'));
|
|
10
|
+
console.log(chalk.bold.cyan(' ║') + chalk.bold(' ◆ ObjectStack CLI ') + chalk.dim(`v${version}`) + chalk.bold.cyan(' ║'));
|
|
11
|
+
console.log(chalk.bold.cyan(' ╚═══════════════════════════════════╝'));
|
|
12
|
+
console.log('');
|
|
13
|
+
}
|
|
14
|
+
// ─── Section Header ─────────────────────────────────────────────────
|
|
15
|
+
export function printHeader(title) {
|
|
16
|
+
console.log(chalk.bold(`\n◆ ${title}`));
|
|
17
|
+
console.log(chalk.dim('─'.repeat(40)));
|
|
18
|
+
}
|
|
19
|
+
// ─── Key-Value Line ─────────────────────────────────────────────────
|
|
20
|
+
export function printKV(key, value, icon) {
|
|
21
|
+
const prefix = icon ? `${icon} ` : ' ';
|
|
22
|
+
console.log(`${prefix}${chalk.dim(key + ':')} ${chalk.white(String(value))}`);
|
|
23
|
+
}
|
|
24
|
+
// ─── Status Line ────────────────────────────────────────────────────
|
|
25
|
+
export function printSuccess(msg) {
|
|
26
|
+
console.log(chalk.green(` ✓ ${msg}`));
|
|
27
|
+
}
|
|
28
|
+
export function printWarning(msg) {
|
|
29
|
+
console.log(chalk.yellow(` ⚠ ${msg}`));
|
|
30
|
+
}
|
|
31
|
+
export function printError(msg) {
|
|
32
|
+
console.log(chalk.red(` ✗ ${msg}`));
|
|
33
|
+
}
|
|
34
|
+
export function printInfo(msg) {
|
|
35
|
+
console.log(chalk.blue(` ℹ ${msg}`));
|
|
36
|
+
}
|
|
37
|
+
export function printStep(msg) {
|
|
38
|
+
console.log(chalk.yellow(` → ${msg}`));
|
|
39
|
+
}
|
|
40
|
+
// ─── Timer ──────────────────────────────────────────────────────────
|
|
41
|
+
export function createTimer() {
|
|
42
|
+
const start = Date.now();
|
|
43
|
+
return {
|
|
44
|
+
elapsed: () => Date.now() - start,
|
|
45
|
+
display: () => `${Date.now() - start}ms`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// ─── Zod Error Formatting ───────────────────────────────────────────
|
|
49
|
+
export function formatZodErrors(error) {
|
|
50
|
+
const issues = error.issues || error.errors || [];
|
|
51
|
+
if (issues.length === 0) {
|
|
52
|
+
console.log(chalk.red(' Unknown validation error'));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
// Group by top-level path
|
|
56
|
+
const grouped = new Map();
|
|
57
|
+
for (const issue of issues) {
|
|
58
|
+
const topPath = issue.path?.[0] || '_root';
|
|
59
|
+
if (!grouped.has(String(topPath))) {
|
|
60
|
+
grouped.set(String(topPath), []);
|
|
61
|
+
}
|
|
62
|
+
grouped.get(String(topPath)).push(issue);
|
|
63
|
+
}
|
|
64
|
+
for (const [section, sectionIssues] of grouped) {
|
|
65
|
+
console.log(chalk.bold.red(`\n ${section}:`));
|
|
66
|
+
for (const issue of sectionIssues) {
|
|
67
|
+
const path = issue.path?.join('.') || '';
|
|
68
|
+
const code = issue.code || '';
|
|
69
|
+
const msg = issue.message || '';
|
|
70
|
+
console.log(chalk.red(` ✗ ${path}`));
|
|
71
|
+
console.log(chalk.dim(` ${code}: ${msg}`));
|
|
72
|
+
// Show expected/received for type errors
|
|
73
|
+
if (issue.expected) {
|
|
74
|
+
console.log(chalk.dim(` expected: ${chalk.green(issue.expected)}`));
|
|
75
|
+
}
|
|
76
|
+
if (issue.received) {
|
|
77
|
+
console.log(chalk.dim(` received: ${chalk.red(issue.received)}`));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
console.log('');
|
|
82
|
+
console.log(chalk.dim(` ${issues.length} validation error(s) total`));
|
|
83
|
+
}
|
|
84
|
+
export function collectMetadataStats(config) {
|
|
85
|
+
const count = (val) => {
|
|
86
|
+
if (Array.isArray(val))
|
|
87
|
+
return val.length;
|
|
88
|
+
if (val && typeof val === 'object')
|
|
89
|
+
return Object.keys(val).length;
|
|
90
|
+
return 0;
|
|
91
|
+
};
|
|
92
|
+
// Count total fields across all objects
|
|
93
|
+
let fields = 0;
|
|
94
|
+
const objects = Array.isArray(config.objects) ? config.objects :
|
|
95
|
+
(config.objects && typeof config.objects === 'object' ? Object.values(config.objects) : []);
|
|
96
|
+
for (const obj of objects) {
|
|
97
|
+
if (obj.fields && typeof obj.fields === 'object') {
|
|
98
|
+
fields += Object.keys(obj.fields).length;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
objects: count(config.objects),
|
|
103
|
+
objectExtensions: count(config.objectExtensions),
|
|
104
|
+
fields,
|
|
105
|
+
views: count(config.views),
|
|
106
|
+
pages: count(config.pages),
|
|
107
|
+
apps: count(config.apps),
|
|
108
|
+
dashboards: count(config.dashboards),
|
|
109
|
+
reports: count(config.reports),
|
|
110
|
+
actions: count(config.actions),
|
|
111
|
+
flows: count(config.flows),
|
|
112
|
+
workflows: count(config.workflows),
|
|
113
|
+
approvals: count(config.approvals),
|
|
114
|
+
agents: count(config.agents),
|
|
115
|
+
apis: count(config.apis),
|
|
116
|
+
roles: count(config.roles),
|
|
117
|
+
permissions: count(config.permissions),
|
|
118
|
+
themes: count(config.themes),
|
|
119
|
+
datasources: count(config.datasources),
|
|
120
|
+
translations: count(config.translations),
|
|
121
|
+
plugins: count(config.plugins),
|
|
122
|
+
devPlugins: count(config.devPlugins),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export function printServerReady(opts) {
|
|
126
|
+
const base = `http://localhost:${opts.port}`;
|
|
127
|
+
console.log('');
|
|
128
|
+
console.log(chalk.bold.green(' ✓ Server is ready'));
|
|
129
|
+
console.log('');
|
|
130
|
+
console.log(chalk.cyan(' ➜') + chalk.bold(' API: ') + chalk.cyan(base + '/'));
|
|
131
|
+
if (opts.uiEnabled && opts.studioPath) {
|
|
132
|
+
console.log(chalk.cyan(' ➜') + chalk.bold(' Studio: ') + chalk.cyan(base + opts.studioPath + '/'));
|
|
133
|
+
}
|
|
134
|
+
console.log('');
|
|
135
|
+
console.log(chalk.dim(` Config: ${opts.configFile}`));
|
|
136
|
+
console.log(chalk.dim(` Mode: ${opts.isDev ? 'development' : 'production'}`));
|
|
137
|
+
console.log(chalk.dim(` Plugins: ${opts.pluginCount} loaded`));
|
|
138
|
+
if (opts.pluginNames && opts.pluginNames.length > 0) {
|
|
139
|
+
console.log(chalk.dim(` ${opts.pluginNames.join(', ')}`));
|
|
140
|
+
}
|
|
141
|
+
console.log('');
|
|
142
|
+
console.log(chalk.dim(' Press Ctrl+C to stop'));
|
|
143
|
+
console.log('');
|
|
144
|
+
}
|
|
145
|
+
export function printMetadataStats(stats) {
|
|
146
|
+
const sections = [
|
|
147
|
+
{
|
|
148
|
+
label: 'Data',
|
|
149
|
+
items: [
|
|
150
|
+
['Objects', stats.objects],
|
|
151
|
+
['Fields', stats.fields],
|
|
152
|
+
['Extensions', stats.objectExtensions],
|
|
153
|
+
['Datasources', stats.datasources],
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
label: 'UI',
|
|
158
|
+
items: [
|
|
159
|
+
['Apps', stats.apps],
|
|
160
|
+
['Views', stats.views],
|
|
161
|
+
['Pages', stats.pages],
|
|
162
|
+
['Dashboards', stats.dashboards],
|
|
163
|
+
['Reports', stats.reports],
|
|
164
|
+
['Actions', stats.actions],
|
|
165
|
+
['Themes', stats.themes],
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
label: 'Logic',
|
|
170
|
+
items: [
|
|
171
|
+
['Flows', stats.flows],
|
|
172
|
+
['Workflows', stats.workflows],
|
|
173
|
+
['Approvals', stats.approvals],
|
|
174
|
+
['Agents', stats.agents],
|
|
175
|
+
['APIs', stats.apis],
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
label: 'Security',
|
|
180
|
+
items: [
|
|
181
|
+
['Roles', stats.roles],
|
|
182
|
+
['Permissions', stats.permissions],
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
];
|
|
186
|
+
for (const section of sections) {
|
|
187
|
+
const nonZero = section.items.filter(([, v]) => v > 0);
|
|
188
|
+
if (nonZero.length === 0)
|
|
189
|
+
continue;
|
|
190
|
+
const line = nonZero.map(([k, v]) => `${chalk.white(v)} ${chalk.dim(k)}`).join(' ');
|
|
191
|
+
console.log(` ${chalk.bold(section.label + ':')} ${line}`);
|
|
192
|
+
}
|
|
193
|
+
if (stats.plugins > 0 || stats.devPlugins > 0) {
|
|
194
|
+
const parts = [];
|
|
195
|
+
if (stats.plugins > 0)
|
|
196
|
+
parts.push(`${stats.plugins} plugins`);
|
|
197
|
+
if (stats.devPlugins > 0)
|
|
198
|
+
parts.push(`${stats.devPlugins} devPlugins`);
|
|
199
|
+
console.log(` ${chalk.bold('Runtime:')} ${chalk.dim(parts.join(', '))}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,uEAAuE;AACvE,MAAM,CAAC,MAAM,QAAQ,GAAG,aAAa,CAAC;AACtC,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;AAE9B,uEAAuE;AAEvE,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC,CAAC;IACxE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IACpI,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,C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AAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACvD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QAEnC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrF,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,KAAK,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC;QAC9C,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,OAAO,GAAG,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;QAC9D,IAAI,KAAK,CAAC,UAAU,GAAG,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,UAAU,aAAa,CAAC,CAAC;QACvE,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve plugin display name from a plugin entry.
|
|
3
|
+
* Plugins can be string package names, objects with `.name`, or class instances.
|
|
4
|
+
*/
|
|
5
|
+
export declare function resolvePluginName(plugin: unknown): string;
|
|
6
|
+
/**
|
|
7
|
+
* Resolve plugin version from a plugin entry.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolvePluginVersion(plugin: unknown): string;
|
|
10
|
+
/**
|
|
11
|
+
* Resolve plugin type from a plugin entry.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolvePluginType(plugin: unknown): string;
|
|
14
|
+
//# sourceMappingURL=plugin-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-helpers.d.ts","sourceRoot":"","sources":["../../src/utils/plugin-helpers.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAQzD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAM5D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAMzD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
|
|
2
|
+
/**
|
|
3
|
+
* Resolve plugin display name from a plugin entry.
|
|
4
|
+
* Plugins can be string package names, objects with `.name`, or class instances.
|
|
5
|
+
*/
|
|
6
|
+
export function resolvePluginName(plugin) {
|
|
7
|
+
if (typeof plugin === 'string')
|
|
8
|
+
return plugin;
|
|
9
|
+
if (plugin && typeof plugin === 'object') {
|
|
10
|
+
const p = plugin;
|
|
11
|
+
if (typeof p.name === 'string')
|
|
12
|
+
return p.name;
|
|
13
|
+
if (p.constructor && p.constructor.name !== 'Object')
|
|
14
|
+
return p.constructor.name;
|
|
15
|
+
}
|
|
16
|
+
return 'unknown';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolve plugin version from a plugin entry.
|
|
20
|
+
*/
|
|
21
|
+
export function resolvePluginVersion(plugin) {
|
|
22
|
+
if (plugin && typeof plugin === 'object') {
|
|
23
|
+
const p = plugin;
|
|
24
|
+
if (typeof p.version === 'string')
|
|
25
|
+
return p.version;
|
|
26
|
+
}
|
|
27
|
+
return '-';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolve plugin type from a plugin entry.
|
|
31
|
+
*/
|
|
32
|
+
export function resolvePluginType(plugin) {
|
|
33
|
+
if (plugin && typeof plugin === 'object') {
|
|
34
|
+
const p = plugin;
|
|
35
|
+
if (typeof p.type === 'string')
|
|
36
|
+
return p.type;
|
|
37
|
+
}
|
|
38
|
+
return 'standard';
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=plugin-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-helpers.js","sourceRoot":"","sources":["../../src/utils/plugin-helpers.ts"],"names":[],"mappings":"AAAA,yEAAyE;AAEzE;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAe;IAC/C,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAC9C,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACzC,MAAM,CAAC,GAAG,MAAiC,CAAC;QAC5C,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,CAAC,CAAC,IAAI,CAAC;QAC9C,IAAI,CAAC,CAAC,WAAW,IAAI,CAAC,CAAC,WAAW,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC;IAClF,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAe;IAClD,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACzC,MAAM,CAAC,GAAG,MAAiC,CAAC;QAC5C,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ;YAAE,OAAO,CAAC,CAAC,OAAO,CAAC;IACtD,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAe;IAC/C,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QACzC,MAAM,CAAC,GAAG,MAAiC,CAAC;QAC5C,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,CAAC,CAAC,IAAI,CAAC;IAChD,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type ChildProcess } from 'child_process';
|
|
2
|
+
/** URL mount path for the Console UI inside the ObjectStack server */
|
|
3
|
+
export declare const STUDIO_PATH = "/_studio";
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the filesystem path to the @objectstack/studio package.
|
|
6
|
+
* Searches workspace locations first, then falls back to node_modules.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveStudioPath(): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Check whether the Studio has a pre-built `dist/` directory.
|
|
11
|
+
*/
|
|
12
|
+
export declare function hasStudioDist(studioPath: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Find the next available TCP port starting from `start`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function findAvailablePort(start?: number): Promise<number>;
|
|
17
|
+
export interface ViteDevResult {
|
|
18
|
+
/** Port the Vite dev server is listening on */
|
|
19
|
+
port: number;
|
|
20
|
+
/** Child process handle */
|
|
21
|
+
process: ChildProcess;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Spawn a Vite dev server for the Console application.
|
|
25
|
+
*
|
|
26
|
+
* Sets environment variables so the Console runs in server mode and
|
|
27
|
+
* connects to the ObjectStack API on the same origin.
|
|
28
|
+
*
|
|
29
|
+
* @param studioPath - Absolute path to the @objectstack/studio package
|
|
30
|
+
* @param options.serverPort - The main ObjectStack server port (for display only)
|
|
31
|
+
*/
|
|
32
|
+
export declare function spawnViteDevServer(studioPath: string, options?: {
|
|
33
|
+
serverPort?: number;
|
|
34
|
+
}): Promise<ViteDevResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Create a lightweight kernel plugin that proxies `/_studio/*` requests
|
|
37
|
+
* to the Vite dev server. Used in development mode.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createStudioProxyPlugin(vitePort: number): {
|
|
40
|
+
name: string;
|
|
41
|
+
init: () => Promise<void>;
|
|
42
|
+
start: (ctx: any) => Promise<void>;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Create a lightweight kernel plugin that serves the pre-built Studio
|
|
46
|
+
* static files at `/_studio/*`. Used in production mode.
|
|
47
|
+
*
|
|
48
|
+
* Uses Node.js built-in fs for static file serving to avoid external
|
|
49
|
+
* bundling dependencies.
|
|
50
|
+
*/
|
|
51
|
+
export declare function createStudioStaticPlugin(distPath: string, options?: {
|
|
52
|
+
isDev?: boolean;
|
|
53
|
+
}): {
|
|
54
|
+
name: string;
|
|
55
|
+
init: () => Promise<void>;
|
|
56
|
+
start: (ctx: any) => Promise<void>;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=studio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../src/utils/studio.ts"],"names":[],"mappings":"AAaA,OAAO,EAAS,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAKzD,sEAAsE;AACtE,eAAO,MAAM,WAAW,aAAa,CAAC;AAOtC;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CA+CjD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAEzD;AAID;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,GAAE,MAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,CAYlF;AAID,MAAM,WAAW,aAAa;IAC5B,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GACpC,OAAO,CAAC,aAAa,CAAC,CAwExB;AAID;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM;;;iBAMjC,GAAG;EAwCzB;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE;;;iBAMjE,GAAG;EAyDzB"}
|