@fluojs/cli 1.1.0 → 3.0.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/README.ko.md +183 -22
- package/README.md +186 -22
- package/dist/cli.d.ts +5 -4
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +128 -35
- package/dist/commands/diagnostics.d.ts +35 -0
- package/dist/commands/diagnostics.d.ts.map +1 -1
- package/dist/commands/diagnostics.js +60 -0
- package/dist/commands/generate.d.ts +1 -49
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +1 -214
- package/dist/commands/inspect.d.ts +5 -7
- package/dist/commands/inspect.d.ts.map +1 -1
- package/dist/commands/inspect.js +85 -65
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +27 -15
- package/dist/commands/migration-transform-tokens.d.ts +15 -0
- package/dist/commands/migration-transform-tokens.d.ts.map +1 -0
- package/dist/commands/migration-transform-tokens.js +41 -0
- package/dist/commands/new.d.ts +0 -6
- package/dist/commands/new.d.ts.map +1 -1
- package/dist/commands/new.js +42 -96
- package/dist/commands/output-path-safety.d.ts +14 -0
- package/dist/commands/output-path-safety.d.ts.map +1 -0
- package/dist/commands/output-path-safety.js +34 -0
- package/dist/commands/scripts.d.ts +1 -1
- package/dist/commands/scripts.d.ts.map +1 -1
- package/dist/commands/scripts.js +13 -7
- package/dist/commands/typegen-artifact.d.ts +54 -0
- package/dist/commands/typegen-artifact.d.ts.map +1 -0
- package/dist/commands/typegen-artifact.js +117 -0
- package/dist/commands/typegen-generation-child.d.ts +2 -0
- package/dist/commands/typegen-generation-child.d.ts.map +1 -0
- package/dist/commands/typegen-generation-child.js +59 -0
- package/dist/commands/typegen-generation-process.d.ts +46 -0
- package/dist/commands/typegen-generation-process.d.ts.map +1 -0
- package/dist/commands/typegen-generation-process.js +131 -0
- package/dist/commands/typegen-generation-protocol.d.ts +16 -0
- package/dist/commands/typegen-generation-protocol.d.ts.map +1 -0
- package/dist/commands/typegen-generation-protocol.js +35 -0
- package/dist/commands/typegen-isolated-source.d.ts +10 -0
- package/dist/commands/typegen-isolated-source.d.ts.map +1 -0
- package/dist/commands/typegen-isolated-source.js +75 -0
- package/dist/commands/typegen-options.d.ts +20 -0
- package/dist/commands/typegen-options.d.ts.map +1 -0
- package/dist/commands/typegen-options.js +71 -0
- package/dist/commands/typegen-source.d.ts +59 -0
- package/dist/commands/typegen-source.d.ts.map +1 -0
- package/dist/commands/typegen-source.js +183 -0
- package/dist/commands/typegen-watch.d.ts +46 -0
- package/dist/commands/typegen-watch.d.ts.map +1 -0
- package/dist/commands/typegen-watch.js +212 -0
- package/dist/commands/typegen.d.ts +29 -0
- package/dist/commands/typegen.d.ts.map +1 -0
- package/dist/commands/typegen.js +119 -0
- package/dist/dev-runner/node-restart-runner.d.ts +6 -0
- package/dist/dev-runner/node-restart-runner.d.ts.map +1 -1
- package/dist/dev-runner/node-restart-runner.js +64 -13
- package/dist/fixtures/inspect-react-app.module.d.ts +4 -0
- package/dist/fixtures/inspect-react-app.module.d.ts.map +1 -0
- package/dist/fixtures/inspect-react-app.module.js +32 -0
- package/dist/fixtures/typegen-react-app.module.d.ts +4 -0
- package/dist/fixtures/typegen-react-app.module.d.ts.map +1 -0
- package/dist/fixtures/typegen-react-app.module.js +33 -0
- package/dist/generate-command.d.ts +50 -0
- package/dist/generate-command.d.ts.map +1 -0
- package/dist/generate-command.js +214 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/new/install.js +1 -1
- package/dist/new/package-spec-resolver.d.ts.map +1 -1
- package/dist/new/package-spec-resolver.js +50 -59
- package/dist/new/prompt.d.ts +1 -0
- package/dist/new/prompt.d.ts.map +1 -1
- package/dist/new/prompt.js +40 -12
- package/dist/new/published-internal-dependencies.d.ts +20 -0
- package/dist/new/published-internal-dependencies.d.ts.map +1 -0
- package/dist/new/published-internal-dependencies.js +20 -0
- package/dist/new/react-vite-ssr-scaffold.d.ts +19 -0
- package/dist/new/react-vite-ssr-scaffold.d.ts.map +1 -0
- package/dist/new/react-vite-ssr-scaffold.js +108 -0
- package/dist/new/resolver.d.ts +2 -2
- package/dist/new/resolver.d.ts.map +1 -1
- package/dist/new/resolver.js +5 -1
- package/dist/new/scaffold.d.ts.map +1 -1
- package/dist/new/scaffold.js +177 -54
- package/dist/new/starter-profiles.d.ts +8 -4
- package/dist/new/starter-profiles.d.ts.map +1 -1
- package/dist/new/starter-profiles.js +52 -18
- package/dist/new/templates/react-vite-ssr/README.md.ejs +74 -0
- package/dist/new/templates/react-vite-ssr/playwright.config.ts.ejs +26 -0
- package/dist/new/templates/react-vite-ssr/src/app.test.ts.ejs +82 -0
- package/dist/new/templates/react-vite-ssr/src/app.ts.ejs +91 -0
- package/dist/new/templates/react-vite-ssr/src/entry-client.tsx.ejs +29 -0
- package/dist/new/templates/react-vite-ssr/src/entry-server.tsx.ejs +52 -0
- package/dist/new/templates/react-vite-ssr/src/load-manifest.test.ts.ejs +55 -0
- package/dist/new/templates/react-vite-ssr/src/load-manifest.ts.ejs +53 -0
- package/dist/new/templates/react-vite-ssr/src/main.ts.ejs +18 -0
- package/dist/new/templates/react-vite-ssr/src/page.tsx.ejs +43 -0
- package/dist/new/templates/react-vite-ssr/src/react-app.test.tsx.ejs +67 -0
- package/dist/new/templates/react-vite-ssr/src/react-app.tsx.ejs +46 -0
- package/dist/new/templates/react-vite-ssr/src/styles.css.ejs +25 -0
- package/dist/new/templates/react-vite-ssr/src/styles.d.ts.ejs +1 -0
- package/dist/new/templates/react-vite-ssr/tests/production-hydration.spec.ts.ejs +54 -0
- package/dist/new/templates/react-vite-ssr/tsconfig.json.ejs +16 -0
- package/dist/new/templates/react-vite-ssr/vite.client.config.ts.ejs +24 -0
- package/dist/new/templates/react-vite-ssr/vite.server.config.ts.ejs +17 -0
- package/dist/new/templates/react-vite-ssr/vitest.config.ts.ejs +10 -0
- package/dist/new/types.d.ts +4 -2
- package/dist/new/types.d.ts.map +1 -1
- package/dist/public-generate.d.ts +2 -0
- package/dist/public-generate.d.ts.map +1 -0
- package/dist/public-generate.js +1 -0
- package/dist/public-inspect.d.ts +13 -0
- package/dist/public-inspect.d.ts.map +1 -0
- package/dist/public-inspect.js +16 -0
- package/dist/public-new.d.ts +13 -0
- package/dist/public-new.d.ts.map +1 -0
- package/dist/public-new.js +16 -0
- package/dist/public-typegen.d.ts +14 -0
- package/dist/public-typegen.d.ts.map +1 -0
- package/dist/public-typegen.js +17 -0
- package/dist/run-cli.d.ts +2 -1
- package/dist/run-cli.d.ts.map +1 -1
- package/dist/studio/sidecar.d.ts.map +1 -1
- package/dist/studio/sidecar.js +106 -14
- package/dist/transforms/nestjs-migrate.d.ts +4 -1
- package/dist/transforms/nestjs-migrate.d.ts.map +1 -1
- package/dist/transforms/nestjs-migrate.js +625 -65
- package/dist/typegen-contract.d.ts +10 -0
- package/dist/typegen-contract.d.ts.map +1 -0
- package/dist/typegen-contract.js +9 -0
- package/dist/usage.d.ts +19 -0
- package/dist/usage.d.ts.map +1 -0
- package/dist/usage.js +178 -0
- package/package.json +19 -10
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { expect, test } from '@playwright/test';
|
|
2
|
+
|
|
3
|
+
test('hydrates production HTML and preserves HTTP-first navigation', async ({ page }) => {
|
|
4
|
+
const browserDiagnostics: string[] = [];
|
|
5
|
+
const assetResponses = new Map<string, number>();
|
|
6
|
+
|
|
7
|
+
page.on('console', (message) => {
|
|
8
|
+
if (message.type() === 'error' || message.type() === 'warning') {
|
|
9
|
+
browserDiagnostics.push(`${message.type()}: ${message.text()}`);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
page.on('pageerror', (error) => browserDiagnostics.push(`pageerror: ${error.message}`));
|
|
13
|
+
page.on('response', (response) => {
|
|
14
|
+
const pathname = new URL(response.url()).pathname;
|
|
15
|
+
if (pathname.startsWith('/assets/')) {
|
|
16
|
+
assetResponses.set(pathname, response.status());
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const response = await page.goto('/products/sku-42?preview=true', { waitUntil: 'load' });
|
|
21
|
+
if (response === null) {
|
|
22
|
+
throw new TypeError('The production page did not return a navigation response.');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const bootstrapPaths = await page.locator('script[type="module"][src]').evaluateAll((scripts) =>
|
|
26
|
+
scripts.map((script) => new URL(script.getAttribute('src') ?? '', document.baseURI).pathname),
|
|
27
|
+
);
|
|
28
|
+
const stylesheetPaths = await page.locator('link[data-vite-style][href]').evaluateAll((links) =>
|
|
29
|
+
links.map((link) => new URL(link.getAttribute('href') ?? '', document.baseURI).pathname),
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
expect(response.status()).toBe(200);
|
|
33
|
+
expect(response.headers()['content-type']).toContain('text/html');
|
|
34
|
+
expect(bootstrapPaths).toContain('/assets/entry-client.js');
|
|
35
|
+
expect(stylesheetPaths).toHaveLength(1);
|
|
36
|
+
for (const pathname of [...bootstrapPaths, ...stylesheetPaths]) {
|
|
37
|
+
expect(assetResponses.get(pathname)).toBe(200);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
await expect(page.getByRole('heading', { name: 'Catalog item sku-42' })).toBeVisible();
|
|
41
|
+
await page.getByRole('button', { name: 'Count: 0' }).click();
|
|
42
|
+
await expect(page.getByRole('button', { name: 'Count: 1' })).toBeVisible();
|
|
43
|
+
|
|
44
|
+
const link = page.getByRole('link', { name: 'Open sku-84' });
|
|
45
|
+
await expect(link).toHaveAttribute('href', '/products/sku-84?preview=false');
|
|
46
|
+
await link.click();
|
|
47
|
+
await expect(page).toHaveURL(/\/products\/sku-84\?preview=false$/u);
|
|
48
|
+
await expect(page.getByRole('heading', { name: 'Catalog item sku-84' })).toBeVisible();
|
|
49
|
+
|
|
50
|
+
await page.getByRole('button', { name: 'Push sku-126' }).click();
|
|
51
|
+
await expect(page).toHaveURL(/\/products\/sku-126\?preview=true$/u);
|
|
52
|
+
await expect(page.getByRole('heading', { name: 'Catalog item sku-126' })).toBeVisible();
|
|
53
|
+
expect(browserDiagnostics).toEqual([]);
|
|
54
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"jsx": "react-jsx",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"types": ["node"]
|
|
14
|
+
},
|
|
15
|
+
"include": ["src/**/*.ts", "src/**/*.tsx", "tests/**/*.ts", "*.config.ts"]
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
|
|
3
|
+
import { defineConfig } from 'vite';
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
base: '/assets/',
|
|
7
|
+
build: {
|
|
8
|
+
emptyOutDir: true,
|
|
9
|
+
manifest: true,
|
|
10
|
+
outDir: 'dist/client',
|
|
11
|
+
rolldownOptions: {
|
|
12
|
+
input: {
|
|
13
|
+
'entry-client': fileURLToPath(new URL('./src/entry-client.tsx', import.meta.url)),
|
|
14
|
+
'entry-server': fileURLToPath(new URL('./src/entry-server.tsx', import.meta.url)),
|
|
15
|
+
},
|
|
16
|
+
output: {
|
|
17
|
+
assetFileNames: '[name]-[hash][extname]',
|
|
18
|
+
chunkFileNames: '[name]-[hash].js',
|
|
19
|
+
entryFileNames: '[name].js',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
target: 'es2022',
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { fluoDecoratorsPlugin } from '@fluojs/vite';
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
build: {
|
|
6
|
+
emptyOutDir: false,
|
|
7
|
+
outDir: 'dist/server',
|
|
8
|
+
rolldownOptions: {
|
|
9
|
+
output: {
|
|
10
|
+
entryFileNames: 'main.js',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
ssr: 'src/main.ts',
|
|
14
|
+
target: 'node24',
|
|
15
|
+
},
|
|
16
|
+
plugins: [fluoDecoratorsPlugin()],
|
|
17
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { fluoBabelDecoratorsPlugin } from '@fluojs/testing/vitest';
|
|
2
|
+
import { defineConfig } from 'vitest/config';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [fluoBabelDecoratorsPlugin()],
|
|
6
|
+
test: {
|
|
7
|
+
environment: 'node',
|
|
8
|
+
include: ['src/**/*.test.ts', 'src/**/*.test.tsx'],
|
|
9
|
+
},
|
|
10
|
+
});
|
package/dist/new/types.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn';
|
|
|
4
4
|
export type DependencySource = 'local' | 'published';
|
|
5
5
|
/** Supported starter shapes for `fluo new`. */
|
|
6
6
|
export type BootstrapShape = 'application' | 'microservice' | 'mixed';
|
|
7
|
+
/** Named starter variants exposed by `fluo new`. */
|
|
8
|
+
export type BootstrapStarter = 'react-vite-ssr' | 'standard';
|
|
7
9
|
/** Supported runtime families for the current starter matrix. */
|
|
8
10
|
export type BootstrapRuntime = 'bun' | 'cloudflare-workers' | 'deno' | 'node';
|
|
9
11
|
/** Supported platform adapters for the current starter matrix. */
|
|
@@ -36,6 +38,7 @@ export interface BootstrapOptions extends BootstrapSchema {
|
|
|
36
38
|
projectName: string;
|
|
37
39
|
repoRoot?: string;
|
|
38
40
|
skipInstall?: boolean;
|
|
41
|
+
starter?: BootstrapStarter;
|
|
39
42
|
targetDirectory: string;
|
|
40
43
|
}
|
|
41
44
|
/** Prompt descriptor for bootstrap answer collection. */
|
|
@@ -49,15 +52,14 @@ export interface BootstrapAnswers extends BootstrapSchema {
|
|
|
49
52
|
installDependencies: boolean;
|
|
50
53
|
packageManager: PackageManager;
|
|
51
54
|
projectName: string;
|
|
55
|
+
starter: BootstrapStarter;
|
|
52
56
|
targetDirectory: string;
|
|
53
57
|
}
|
|
54
58
|
/** Programmatic overrides for `runNewCommand(...)`. */
|
|
55
59
|
export interface NewCommandOptions {
|
|
56
|
-
dependencySource?: DependencySource;
|
|
57
60
|
force?: boolean;
|
|
58
61
|
initializeGit?: boolean;
|
|
59
62
|
installDependencies?: boolean;
|
|
60
|
-
repoRoot?: string;
|
|
61
63
|
skipInstall?: boolean;
|
|
62
64
|
}
|
|
63
65
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/new/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/new/types.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAC7D,yDAAyD;AACzD,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,WAAW,CAAC;AACrD,+CAA+C;AAC/C,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,cAAc,GAAG,OAAO,CAAC;AACtE,iEAAiE;AACjE,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,oBAAoB,GAAG,MAAM,GAAG,MAAM,CAAC;AAC9E,kEAAkE;AAClE,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,oBAAoB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;AAClH,mEAAmE;AACnE,MAAM,MAAM,kBAAkB,GAAG,MAAM,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C3E,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,gBAAgB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,mFAAmF;AACnF,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,uDAAuD;AACvD,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-generate.d.ts","sourceRoot":"","sources":["../src/public-generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { runGenerateCommand } from './generate-command.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { InspectCommandRuntimeOptions } from './commands/inspect.js';
|
|
2
|
+
import { inspectUsage } from './usage.js';
|
|
3
|
+
export type { InspectCommandRuntimeOptions } from './commands/inspect.js';
|
|
4
|
+
export { inspectUsage };
|
|
5
|
+
/**
|
|
6
|
+
* Runs the inspect command through a lazy implementation import.
|
|
7
|
+
*
|
|
8
|
+
* @param argv Command arguments after `inspect`.
|
|
9
|
+
* @param runtime Runtime overrides for programmatic callers.
|
|
10
|
+
* @returns Process-style exit code from the inspect command.
|
|
11
|
+
*/
|
|
12
|
+
export declare function runInspectCommand(argv: string[], runtime?: InspectCommandRuntimeOptions): Promise<number>;
|
|
13
|
+
//# sourceMappingURL=public-inspect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-inspect.d.ts","sourceRoot":"","sources":["../src/public-inspect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,YAAY,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,4BAAiC,GAAG,OAAO,CAAC,MAAM,CAAC,CAGnH"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { inspectUsage } from './usage.js';
|
|
2
|
+
export { inspectUsage };
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Runs the inspect command through a lazy implementation import.
|
|
6
|
+
*
|
|
7
|
+
* @param argv Command arguments after `inspect`.
|
|
8
|
+
* @param runtime Runtime overrides for programmatic callers.
|
|
9
|
+
* @returns Process-style exit code from the inspect command.
|
|
10
|
+
*/
|
|
11
|
+
export async function runInspectCommand(argv, runtime = {}) {
|
|
12
|
+
const {
|
|
13
|
+
runInspectCommand: runInspectCommandImplementation
|
|
14
|
+
} = await import('./commands/inspect.js');
|
|
15
|
+
return runInspectCommandImplementation(argv, runtime);
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { NewCommandRuntimeOptions } from './commands/new.js';
|
|
2
|
+
import { newUsage } from './usage.js';
|
|
3
|
+
export type { NewCommandRuntimeOptions } from './commands/new.js';
|
|
4
|
+
export { newUsage };
|
|
5
|
+
/**
|
|
6
|
+
* Runs the new command through a lazy implementation import.
|
|
7
|
+
*
|
|
8
|
+
* @param argv Command arguments after `new` or `create`.
|
|
9
|
+
* @param runtime Runtime overrides for programmatic callers.
|
|
10
|
+
* @returns Process-style exit code from the new command.
|
|
11
|
+
*/
|
|
12
|
+
export declare function runNewCommand(argv: string[], runtime?: NewCommandRuntimeOptions): Promise<number>;
|
|
13
|
+
//# sourceMappingURL=public-new.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-new.d.ts","sourceRoot":"","sources":["../src/public-new.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,YAAY,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,CAAC;AAEpB;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,GAAE,wBAA6B,GAAG,OAAO,CAAC,MAAM,CAAC,CAG3G"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { newUsage } from './usage.js';
|
|
2
|
+
export { newUsage };
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Runs the new command through a lazy implementation import.
|
|
6
|
+
*
|
|
7
|
+
* @param argv Command arguments after `new` or `create`.
|
|
8
|
+
* @param runtime Runtime overrides for programmatic callers.
|
|
9
|
+
* @returns Process-style exit code from the new command.
|
|
10
|
+
*/
|
|
11
|
+
export async function runNewCommand(argv, runtime = {}) {
|
|
12
|
+
const {
|
|
13
|
+
runNewCommand: runNewCommandImplementation
|
|
14
|
+
} = await import('./commands/new.js');
|
|
15
|
+
return runNewCommandImplementation(argv, runtime);
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TypegenCommandRuntimeOptions } from './commands/typegen.js';
|
|
2
|
+
import { TYPEGEN_EXIT_CODES } from './typegen-contract.js';
|
|
3
|
+
import { typegenUsage } from './usage.js';
|
|
4
|
+
export type { TypegenCommandRuntimeOptions } from './commands/typegen.js';
|
|
5
|
+
export { TYPEGEN_EXIT_CODES, typegenUsage };
|
|
6
|
+
/**
|
|
7
|
+
* Runs React page generation, checking, or watch mode through a lazy implementation import.
|
|
8
|
+
*
|
|
9
|
+
* @param argv Command arguments after `typegen`.
|
|
10
|
+
* @param runtime Runtime overrides for programmatic callers.
|
|
11
|
+
* @returns Process-style exit code from the typegen command.
|
|
12
|
+
*/
|
|
13
|
+
export declare function runTypegenCommand(argv: readonly string[], runtime?: TypegenCommandRuntimeOptions): Promise<number>;
|
|
14
|
+
//# sourceMappingURL=public-typegen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-typegen.d.ts","sourceRoot":"","sources":["../src/public-typegen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,YAAY,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,CAAC;AAE5C;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE,4BAAiC,GACzC,OAAO,CAAC,MAAM,CAAC,CAGjB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TYPEGEN_EXIT_CODES } from './typegen-contract.js';
|
|
2
|
+
import { typegenUsage } from './usage.js';
|
|
3
|
+
export { TYPEGEN_EXIT_CODES, typegenUsage };
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Runs React page generation, checking, or watch mode through a lazy implementation import.
|
|
7
|
+
*
|
|
8
|
+
* @param argv Command arguments after `typegen`.
|
|
9
|
+
* @param runtime Runtime overrides for programmatic callers.
|
|
10
|
+
* @returns Process-style exit code from the typegen command.
|
|
11
|
+
*/
|
|
12
|
+
export async function runTypegenCommand(argv, runtime = {}) {
|
|
13
|
+
const {
|
|
14
|
+
runTypegenCommand: runTypegenCommandImplementation
|
|
15
|
+
} = await import('./commands/typegen.js');
|
|
16
|
+
return runTypegenCommandImplementation(argv, runtime);
|
|
17
|
+
}
|
package/dist/run-cli.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CliRuntimeOptions } from './cli.js';
|
|
2
2
|
import type { InspectCommandRuntimeOptions } from './commands/inspect.js';
|
|
3
3
|
import type { NewCommandRuntimeOptions } from './commands/new.js';
|
|
4
|
+
import type { TypegenCommandRuntimeOptions } from './commands/typegen.js';
|
|
4
5
|
export type { CliRuntimeOptions } from './cli.js';
|
|
5
6
|
/**
|
|
6
7
|
* Runs the top-level CLI command dispatcher through a lazy implementation import.
|
|
@@ -12,5 +13,5 @@ export type { CliRuntimeOptions } from './cli.js';
|
|
|
12
13
|
* @param runtime Optional runtime overrides shared by the top-level dispatcher and delegated commands.
|
|
13
14
|
* @returns `0` when the command completes successfully, otherwise the delegated command exit code.
|
|
14
15
|
*/
|
|
15
|
-
export declare function runCli(argv?: string[], runtime?: CliRuntimeOptions & NewCommandRuntimeOptions & InspectCommandRuntimeOptions): Promise<number>;
|
|
16
|
+
export declare function runCli(argv?: string[], runtime?: CliRuntimeOptions & NewCommandRuntimeOptions & InspectCommandRuntimeOptions & TypegenCommandRuntimeOptions): Promise<number>;
|
|
16
17
|
//# sourceMappingURL=run-cli.d.ts.map
|
package/dist/run-cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-cli.d.ts","sourceRoot":"","sources":["../src/run-cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"run-cli.d.ts","sourceRoot":"","sources":["../src/run-cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAC1E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAE1E,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElD;;;;;;;;;GASG;AACH,wBAAsB,MAAM,CAC1B,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,OAAO,GAAE,iBAAiB,GAAG,wBAAwB,GAAG,4BAA4B,GAAG,4BAAiC,GACvH,OAAO,CAAC,MAAM,CAAC,CAGjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidecar.d.ts","sourceRoot":"","sources":["../../src/studio/sidecar.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvE;;GAE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AAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAkVD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,aAAa,CAAC,CAwMnG"}
|
package/dist/studio/sidecar.js
CHANGED
|
@@ -21,10 +21,36 @@ const DEFAULT_HOST = '127.0.0.1';
|
|
|
21
21
|
const DEFAULT_HEARTBEAT_MS = 15_000;
|
|
22
22
|
const MAX_EVENT_REPLAY = 1_000;
|
|
23
23
|
const MAX_REQUEST_BYTES = 1_048_576;
|
|
24
|
+
const BODY_LIKE_PAYLOAD_FIELDS = new Set(['body', 'headers', 'payload', 'rawBody', 'requestBody', 'responseBody']);
|
|
24
25
|
const require = createRequire(import.meta.url);
|
|
25
26
|
function isRecord(value) {
|
|
26
27
|
return typeof value === 'object' && value !== null;
|
|
27
28
|
}
|
|
29
|
+
function findBodyLikePayloadField(value, path = 'payload') {
|
|
30
|
+
if (Array.isArray(value)) {
|
|
31
|
+
for (const [index, item] of value.entries()) {
|
|
32
|
+
const match = findBodyLikePayloadField(item, `${path}[${String(index)}]`);
|
|
33
|
+
if (match) {
|
|
34
|
+
return match;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
if (!isRecord(value)) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
for (const [key, nestedValue] of Object.entries(value)) {
|
|
43
|
+
const nestedPath = `${path}.${key}`;
|
|
44
|
+
if (BODY_LIKE_PAYLOAD_FIELDS.has(key)) {
|
|
45
|
+
return nestedPath;
|
|
46
|
+
}
|
|
47
|
+
const match = findBodyLikePayloadField(nestedValue, nestedPath);
|
|
48
|
+
if (match) {
|
|
49
|
+
return match;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
28
54
|
function isRestartEpochBoundary(incoming) {
|
|
29
55
|
if (incoming.type !== 'restart' || !isRecord(incoming.payload)) {
|
|
30
56
|
return false;
|
|
@@ -60,20 +86,53 @@ function createDefaultAppId() {
|
|
|
60
86
|
}
|
|
61
87
|
function readBody(request) {
|
|
62
88
|
return new Promise((resolve, reject) => {
|
|
89
|
+
let settled = false;
|
|
63
90
|
let body = '';
|
|
64
91
|
request.setEncoding('utf8');
|
|
65
|
-
|
|
92
|
+
const settle = (action, value) => {
|
|
93
|
+
if (settled) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
settled = true;
|
|
97
|
+
request.off('data', onData);
|
|
98
|
+
request.off('end', onEnd);
|
|
99
|
+
request.off('error', onError);
|
|
100
|
+
request.off('close', onClose);
|
|
101
|
+
if (action === 'resolve') {
|
|
102
|
+
resolve(value);
|
|
103
|
+
} else {
|
|
104
|
+
reject(value);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const onData = chunk => {
|
|
66
108
|
body += chunk;
|
|
67
109
|
if (body.length > MAX_REQUEST_BYTES) {
|
|
68
|
-
reject
|
|
110
|
+
settle('reject', new Error('Studio event payload is too large.'));
|
|
69
111
|
request.destroy();
|
|
70
112
|
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
113
|
+
};
|
|
114
|
+
const onEnd = () => settle('resolve', body);
|
|
115
|
+
const onError = error => settle('reject', error);
|
|
116
|
+
// A client that closes the socket after sending only a partial request body
|
|
117
|
+
// may never emit `end` or `error`. Bind `close` to body-reader cancellation
|
|
118
|
+
// so the sidecar cannot hang on a malformed local client indefinitely.
|
|
119
|
+
const onClose = () => {
|
|
120
|
+
if (body.length === 0) {
|
|
121
|
+
settle('reject', new Error('Studio sidecar request closed before any body was received.'));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
settle('reject', new Error('Studio sidecar request closed before the full body was received.'));
|
|
125
|
+
};
|
|
126
|
+
request.on('data', onData);
|
|
127
|
+
request.on('end', onEnd);
|
|
128
|
+
request.on('error', onError);
|
|
129
|
+
request.on('close', onClose);
|
|
74
130
|
});
|
|
75
131
|
}
|
|
76
132
|
function writeJson(response, statusCode, payload) {
|
|
133
|
+
if (response.writableEnded) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
77
136
|
response.writeHead(statusCode, {
|
|
78
137
|
'cache-control': 'no-store',
|
|
79
138
|
'content-type': 'application/json; charset=utf-8'
|
|
@@ -237,6 +296,8 @@ export async function startStudioSidecar(options = {}) {
|
|
|
237
296
|
const token = createToken();
|
|
238
297
|
const events = [];
|
|
239
298
|
const clients = new Set();
|
|
299
|
+
const ingestionRequests = new Set();
|
|
300
|
+
let acceptingIngestion = true;
|
|
240
301
|
let sequence = 0;
|
|
241
302
|
const startedAt = performance.now();
|
|
242
303
|
const publish = incoming => {
|
|
@@ -326,6 +387,11 @@ export async function startStudioSidecar(options = {}) {
|
|
|
326
387
|
return;
|
|
327
388
|
}
|
|
328
389
|
if (request.method === 'POST' && requestUrl.pathname === '/api/runtime/events') {
|
|
390
|
+
if (!acceptingIngestion) {
|
|
391
|
+
request.socket.destroy();
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
ingestionRequests.add(request);
|
|
329
395
|
try {
|
|
330
396
|
const body = await readBody(request);
|
|
331
397
|
const parsed = body ? JSON.parse(body) : {};
|
|
@@ -335,6 +401,13 @@ export async function startStudioSidecar(options = {}) {
|
|
|
335
401
|
});
|
|
336
402
|
return;
|
|
337
403
|
}
|
|
404
|
+
const bodyLikeField = findBodyLikePayloadField(parsed.payload);
|
|
405
|
+
if (bodyLikeField) {
|
|
406
|
+
writeJson(response, 400, {
|
|
407
|
+
error: `Studio runtime event payload must not include body-like field ${bodyLikeField}.`
|
|
408
|
+
});
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
338
411
|
const event = publish(parsed);
|
|
339
412
|
writeJson(response, 202, {
|
|
340
413
|
accepted: true,
|
|
@@ -345,6 +418,8 @@ export async function startStudioSidecar(options = {}) {
|
|
|
345
418
|
writeJson(response, 400, {
|
|
346
419
|
error: error instanceof Error ? error.message : String(error)
|
|
347
420
|
});
|
|
421
|
+
} finally {
|
|
422
|
+
ingestionRequests.delete(request);
|
|
348
423
|
}
|
|
349
424
|
return;
|
|
350
425
|
}
|
|
@@ -361,7 +436,11 @@ export async function startStudioSidecar(options = {}) {
|
|
|
361
436
|
});
|
|
362
437
|
const address = server.address();
|
|
363
438
|
if (!address || typeof address === 'string') {
|
|
364
|
-
await closeServer(server,
|
|
439
|
+
await closeServer(server, {
|
|
440
|
+
clients,
|
|
441
|
+
heartbeat: undefined,
|
|
442
|
+
ingestionRequests
|
|
443
|
+
});
|
|
365
444
|
throw new Error('Failed to resolve Studio sidecar address.');
|
|
366
445
|
}
|
|
367
446
|
const url = `http://${host}:${String(address.port)}`;
|
|
@@ -378,6 +457,7 @@ export async function startStudioSidecar(options = {}) {
|
|
|
378
457
|
});
|
|
379
458
|
}, options.heartbeatMs ?? DEFAULT_HEARTBEAT_MS);
|
|
380
459
|
heartbeat?.unref();
|
|
460
|
+
let closePromise;
|
|
381
461
|
return {
|
|
382
462
|
appId,
|
|
383
463
|
get epoch() {
|
|
@@ -396,20 +476,28 @@ export async function startStudioSidecar(options = {}) {
|
|
|
396
476
|
port: address.port,
|
|
397
477
|
token,
|
|
398
478
|
url,
|
|
399
|
-
|
|
400
|
-
|
|
479
|
+
close() {
|
|
480
|
+
if (!closePromise) {
|
|
481
|
+
acceptingIngestion = false;
|
|
482
|
+
closePromise = closeServer(server, {
|
|
483
|
+
clients,
|
|
484
|
+
heartbeat,
|
|
485
|
+
ingestionRequests
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
return closePromise;
|
|
401
489
|
}
|
|
402
490
|
};
|
|
403
491
|
}
|
|
404
|
-
async function closeServer(server,
|
|
405
|
-
if (heartbeat) {
|
|
406
|
-
clearInterval(heartbeat);
|
|
492
|
+
async function closeServer(server, resources) {
|
|
493
|
+
if (resources.heartbeat) {
|
|
494
|
+
clearInterval(resources.heartbeat);
|
|
407
495
|
}
|
|
408
|
-
for (const client of clients) {
|
|
496
|
+
for (const client of resources.clients) {
|
|
409
497
|
client.response.end();
|
|
410
498
|
}
|
|
411
|
-
clients.clear();
|
|
412
|
-
|
|
499
|
+
resources.clients.clear();
|
|
500
|
+
const serverClosed = new Promise((resolve, reject) => {
|
|
413
501
|
server.close(error => {
|
|
414
502
|
if (error) {
|
|
415
503
|
reject(error);
|
|
@@ -418,4 +506,8 @@ async function closeServer(server, clients, heartbeat) {
|
|
|
418
506
|
resolve();
|
|
419
507
|
});
|
|
420
508
|
});
|
|
509
|
+
for (const request of resources.ingestionRequests) {
|
|
510
|
+
request.socket.destroy();
|
|
511
|
+
}
|
|
512
|
+
await serverClosed;
|
|
421
513
|
}
|
|
@@ -6,10 +6,11 @@ export declare const MIGRATION_TRANSFORMS: readonly ["imports", "injectable", "s
|
|
|
6
6
|
* Defines the migration transform kind type.
|
|
7
7
|
*/
|
|
8
8
|
export type MigrationTransformKind = typeof MIGRATION_TRANSFORMS[number];
|
|
9
|
+
type BootstrapPlatform = 'express';
|
|
9
10
|
/**
|
|
10
11
|
* Provides the warning categories value.
|
|
11
12
|
*/
|
|
12
|
-
export declare const WARNING_CATEGORIES: readonly ["inject-token", "request-dto", "pipe-converter", "bootstrap-unsupported", "testing-unsupported", "import-unsupported", "injectable-options", "tsconfig-parse", "bootstrap-port"];
|
|
13
|
+
export declare const WARNING_CATEGORIES: readonly ["inject-token", "inject-token-unsupported", "request-dto", "pipe-converter", "bootstrap-unsupported", "testing-unsupported", "import-unsupported", "injectable-options", "tsconfig-parse", "bootstrap-port"];
|
|
13
14
|
/**
|
|
14
15
|
* Defines the warning category type.
|
|
15
16
|
*/
|
|
@@ -61,6 +62,7 @@ export type MigrationReport = {
|
|
|
61
62
|
*/
|
|
62
63
|
export type RunNestJsMigrationOptions = {
|
|
63
64
|
apply: boolean;
|
|
65
|
+
bootstrapPlatform?: BootstrapPlatform;
|
|
64
66
|
enabledTransforms: ReadonlySet<MigrationTransformKind>;
|
|
65
67
|
targetPath: string;
|
|
66
68
|
};
|
|
@@ -78,4 +80,5 @@ export declare function runNestJsMigration(options: RunNestJsMigrationOptions):
|
|
|
78
80
|
* @returns The render transform list result.
|
|
79
81
|
*/
|
|
80
82
|
export declare function renderTransformList(kinds: readonly MigrationTransformKind[]): string;
|
|
83
|
+
export {};
|
|
81
84
|
//# sourceMappingURL=nestjs-migrate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nestjs-migrate.d.ts","sourceRoot":"","sources":["../../src/transforms/nestjs-migrate.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,oBAAoB,iFAAkF,CAAC;AAEpH;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"nestjs-migrate.d.ts","sourceRoot":"","sources":["../../src/transforms/nestjs-migrate.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,oBAAoB,iFAAkF,CAAC;AAEpH;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAEzE,KAAK,iBAAiB,GAAG,SAAS,CAAC;AAQnC;;GAEG;AACH,eAAO,MAAM,kBAAkB,wNAWrB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CA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