@lunora/cli 1.0.0-alpha.91 → 1.0.0-alpha.92
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/dist/bin.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/packem_chunks/handler15.mjs +85 -45
- package/dist/packem_chunks/handler16.mjs +37 -93
- package/dist/packem_chunks/handler17.mjs +99 -38
- package/dist/packem_chunks/handler18.mjs +151 -86
- package/dist/packem_chunks/handler19.mjs +73 -147
- package/dist/packem_chunks/handler20.mjs +74 -76
- package/dist/packem_chunks/handler21.mjs +182 -74
- package/dist/packem_shared/{COMMANDS-DZ0NnuqI.mjs → COMMANDS-CstRNuDU.mjs} +24 -9
- package/package.json +5 -3
|
@@ -1,105 +1,170 @@
|
|
|
1
|
-
import { existsSync
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { mkdtemp, writeFile, rm } from 'node:fs/promises';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { discoverSchema, schemaFromIr } from '@lunora/codegen';
|
|
5
|
+
import { seedPlan } from '@lunora/seed';
|
|
6
|
+
import { join } from '@visulima/path';
|
|
7
|
+
import { Project } from 'ts-morph';
|
|
5
8
|
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
9
|
+
import { a as resolveProductionWorkerUrl } from '../packem_shared/resolve-target-qbsJ_5sF.mjs';
|
|
10
|
+
import { b as tuiConfirm } from '../packem_shared/tui-prompts-BjEN8XgP.mjs';
|
|
11
|
+
import { runImportCommand } from '../packem_shared/DEFAULT_IMPORT_BATCH_SIZE-D0VOTerB.mjs';
|
|
12
|
+
import { runResetCommand } from './runResetCommand.mjs';
|
|
6
13
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
const isLocalUrl = (url) => {
|
|
15
|
+
if (url === void 0) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const { hostname } = new URL(url);
|
|
20
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]" || hostname === "::1";
|
|
21
|
+
} catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const ndjsonReplacer = (_key, value) => {
|
|
26
|
+
if (typeof value === "bigint") {
|
|
27
|
+
return Number(value);
|
|
28
|
+
}
|
|
29
|
+
if (value instanceof ArrayBuffer) {
|
|
30
|
+
return [...new Uint8Array(value)];
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
};
|
|
34
|
+
const seedFailure = (code) => {
|
|
35
|
+
return { code, conflicts: 0, generated: 0, inserted: 0, ndjson: "" };
|
|
36
|
+
};
|
|
37
|
+
const guardSeedTargets = (options, schemaPath) => {
|
|
38
|
+
if (!existsSync(schemaPath)) {
|
|
39
|
+
options.logger.error(`schema not found: ${schemaPath} — run \`vis generate lunora-table --name=<name>\` to create one`);
|
|
40
|
+
return seedFailure(1);
|
|
41
|
+
}
|
|
42
|
+
if (options.reset === true && (options.prod === true || !isLocalUrl(options.url))) {
|
|
43
|
+
options.logger.error("--reset only clears local .wrangler/state and cannot be combined with --prod or a remote --url");
|
|
44
|
+
return seedFailure(1);
|
|
26
45
|
}
|
|
27
46
|
return void 0;
|
|
28
47
|
};
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
const insertSeedRows = async (ndjson, generated, cwd, options) => {
|
|
49
|
+
const scratchDirectory = await mkdtemp(join(tmpdir(), "lunora-seed-"));
|
|
50
|
+
const temporaryFile = join(scratchDirectory, "rows.ndjson");
|
|
51
|
+
await writeFile(temporaryFile, ndjson, "utf8");
|
|
52
|
+
try {
|
|
53
|
+
const result = await runImportCommand({
|
|
54
|
+
batchSize: options.batchSize,
|
|
55
|
+
fetchImpl: options.fetchImpl,
|
|
56
|
+
file: temporaryFile,
|
|
57
|
+
logger: options.logger,
|
|
58
|
+
prod: options.prod,
|
|
59
|
+
token: options.token,
|
|
60
|
+
url: options.url
|
|
61
|
+
});
|
|
62
|
+
const conflicts = result.body?.conflicts ?? 0;
|
|
63
|
+
if (conflicts > 0) {
|
|
64
|
+
options.logger.warn(
|
|
65
|
+
`${String(conflicts)} row(s) skipped — their _id already exists. Seeding is deterministic; re-run with --reset to wipe local state first, or a different --seed for fresh ids.`
|
|
66
|
+
);
|
|
45
67
|
}
|
|
46
|
-
|
|
47
|
-
|
|
68
|
+
return { code: result.code, conflicts, generated, inserted: result.inserted, ndjson };
|
|
69
|
+
} finally {
|
|
70
|
+
await rm(scratchDirectory, { force: true, recursive: true }).catch(() => {
|
|
71
|
+
});
|
|
48
72
|
}
|
|
49
|
-
return wrote;
|
|
50
73
|
};
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const wrote = copySkill(join(skillsDirectory, name), destination, overwrite);
|
|
64
|
-
if (wrote) {
|
|
65
|
-
installed.push(name);
|
|
66
|
-
} else {
|
|
67
|
-
skipped.push(name);
|
|
68
|
-
}
|
|
74
|
+
const validateSeedTable = (options, ir) => {
|
|
75
|
+
if (options.table === void 0 || ir.tables.some((table) => table.name === options.table)) {
|
|
76
|
+
return void 0;
|
|
77
|
+
}
|
|
78
|
+
const available = ir.tables.map((table) => table.name).join(", ");
|
|
79
|
+
options.logger.error(`unknown table "${options.table}" — schema defines: ${available || "(no tables)"}`);
|
|
80
|
+
return seedFailure(1);
|
|
81
|
+
};
|
|
82
|
+
const confirmRemoteSeedTarget = async (options, generated) => {
|
|
83
|
+
const targetsRemote = options.prod === true || !isLocalUrl(options.url);
|
|
84
|
+
if (!targetsRemote || options.yes === true) {
|
|
85
|
+
return void 0;
|
|
69
86
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
87
|
+
if (!process.stdin.isTTY && options.confirm === void 0) {
|
|
88
|
+
options.logger.error("seed: refusing to insert into a non-local target without confirmation — re-run with --yes");
|
|
89
|
+
return seedFailure(1);
|
|
73
90
|
}
|
|
74
|
-
|
|
75
|
-
|
|
91
|
+
const confirmer = options.confirm ?? tuiConfirm;
|
|
92
|
+
const confirmed = await confirmer(`This will insert ${String(generated)} generated row(s) into ${options.url ?? "the production worker"}. Continue?`);
|
|
93
|
+
if (!confirmed) {
|
|
94
|
+
options.logger.info("seed: aborted");
|
|
95
|
+
return seedFailure(1);
|
|
76
96
|
}
|
|
77
|
-
|
|
78
|
-
return { code: 0, installed, skipped };
|
|
97
|
+
return void 0;
|
|
79
98
|
};
|
|
80
|
-
const
|
|
99
|
+
const runSeedCommand = async (options) => {
|
|
81
100
|
const cwd = options.cwd ?? process.cwd();
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
101
|
+
const schemaPath = join(cwd, "lunora", "schema.ts");
|
|
102
|
+
const guard = guardSeedTargets(options, schemaPath);
|
|
103
|
+
if (guard !== void 0) {
|
|
104
|
+
return guard;
|
|
105
|
+
}
|
|
106
|
+
const project = new Project({ skipAddingFilesFromTsConfig: true });
|
|
107
|
+
const ir = discoverSchema(project, schemaPath);
|
|
108
|
+
const unknownTable = validateSeedTable(options, ir);
|
|
109
|
+
if (unknownTable !== void 0) {
|
|
110
|
+
return unknownTable;
|
|
111
|
+
}
|
|
112
|
+
const schema = schemaFromIr(ir);
|
|
113
|
+
const plan = seedPlan(schema, {
|
|
114
|
+
defaultCount: options.count ?? 10,
|
|
115
|
+
only: options.table === void 0 ? void 0 : [options.table],
|
|
116
|
+
seed: options.seed ?? 0
|
|
117
|
+
});
|
|
118
|
+
const lines = [];
|
|
119
|
+
for (const { rows, table } of plan) {
|
|
120
|
+
for (const row of rows) {
|
|
121
|
+
lines.push(JSON.stringify({ doc: row, table }, ndjsonReplacer));
|
|
87
122
|
}
|
|
88
|
-
return { code: 0, installed: status.present, skipped: [] };
|
|
89
123
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
124
|
+
const ndjson = lines.length > 0 ? `${lines.join("\n")}
|
|
125
|
+
` : "";
|
|
126
|
+
const generated = lines.length;
|
|
127
|
+
if (options.dryRun === true) {
|
|
128
|
+
if (ndjson.length > 0) {
|
|
129
|
+
process.stdout.write(ndjson);
|
|
130
|
+
}
|
|
131
|
+
options.logger.info(`generated ${String(generated)} row(s) across ${String(plan.length)} table(s) — dry run, nothing inserted`);
|
|
132
|
+
return { code: 0, conflicts: 0, generated, inserted: 0, ndjson };
|
|
133
|
+
}
|
|
134
|
+
if (options.reset === true) {
|
|
135
|
+
const reset = await runResetCommand({ cwd, logger: options.logger, yes: true });
|
|
136
|
+
if (reset.code !== 0) {
|
|
137
|
+
return { code: reset.code, conflicts: 0, generated, inserted: 0, ndjson };
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if (generated === 0) {
|
|
141
|
+
options.logger.warn("no rows generated — nothing to insert");
|
|
142
|
+
return { code: 0, conflicts: 0, generated: 0, inserted: 0, ndjson };
|
|
97
143
|
}
|
|
98
|
-
|
|
99
|
-
|
|
144
|
+
const aborted = await confirmRemoteSeedTarget(options, generated);
|
|
145
|
+
if (aborted !== void 0) {
|
|
146
|
+
return aborted;
|
|
100
147
|
}
|
|
101
|
-
|
|
102
|
-
|
|
148
|
+
return insertSeedRows(ndjson, generated, cwd, options);
|
|
149
|
+
};
|
|
150
|
+
const execute = defineHandler(async ({ cwd, logger, options }) => {
|
|
151
|
+
const result = await runSeedCommand({
|
|
152
|
+
batchSize: options.batchSize,
|
|
153
|
+
count: options.count,
|
|
154
|
+
cwd,
|
|
155
|
+
dryRun: options.dryRun === true,
|
|
156
|
+
logger,
|
|
157
|
+
prod: options.prod === true,
|
|
158
|
+
reset: options.reset === true,
|
|
159
|
+
seed: options.seed,
|
|
160
|
+
table: options.table,
|
|
161
|
+
token: options.token,
|
|
162
|
+
// Resolve the link here (only under --prod) so seed's own remote/confirm
|
|
163
|
+
// logic and the downstream import both see the same effective target.
|
|
164
|
+
url: resolveProductionWorkerUrl({ cwd, prod: options.prod === true, url: options.url }),
|
|
165
|
+
yes: options.yes === true
|
|
166
|
+
});
|
|
167
|
+
return { code: result.code };
|
|
103
168
|
});
|
|
104
169
|
|
|
105
|
-
export { execute,
|
|
170
|
+
export { execute, runSeedCommand };
|
|
@@ -1,170 +1,96 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { join } from '@visulima/path';
|
|
7
|
-
import { Project } from 'ts-morph';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { runCodegen } from '@lunora/codegen';
|
|
4
|
+
import { p as parseApiSpec } from '../packem_shared/api-spec-Bx0iKbxA.mjs';
|
|
5
|
+
import { a as renderCodegenHint } from '../packem_shared/codegen-error-DJG-ghs_.mjs';
|
|
8
6
|
import { d as defineHandler } from '../packem_shared/command-lYnl4QyF.mjs';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
7
|
+
import { e as execArgsFor, d as detectPackageManager } from '../packem_shared/detect-package-manager-v4hHpQd0.mjs';
|
|
8
|
+
import { v as validateOutputFormat, i as isJsonFormat, p as printJson, l as loggerForFormat } from '../packem_shared/output-format-B4642rjE.mjs';
|
|
9
|
+
import { r as runSchemaDriftGate } from '../packem_shared/schema-drift-gate-BtBt0as0.mjs';
|
|
10
|
+
import { defaultSpawner } from '../packem_shared/createRecordingSpawner-WuSn20kb.mjs';
|
|
11
|
+
import { validateWranglerProject } from '@lunora/config';
|
|
13
12
|
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
return
|
|
13
|
+
const runTypecheckStep = async (cwd, spawner) => {
|
|
14
|
+
if (!existsSync(join(cwd, "tsconfig.json"))) {
|
|
15
|
+
return { warning: "no tsconfig.json found — skipping TypeScript type-check" };
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} catch {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
const ndjsonReplacer = (_key, value) => {
|
|
26
|
-
if (typeof value === "bigint") {
|
|
27
|
-
return Number(value);
|
|
28
|
-
}
|
|
29
|
-
if (value instanceof ArrayBuffer) {
|
|
30
|
-
return [...new Uint8Array(value)];
|
|
31
|
-
}
|
|
32
|
-
return value;
|
|
33
|
-
};
|
|
34
|
-
const seedFailure = (code) => {
|
|
35
|
-
return { code, conflicts: 0, generated: 0, inserted: 0, ndjson: "" };
|
|
17
|
+
const exec = execArgsFor(detectPackageManager(cwd), "tsc", ["--noEmit", "-p", "tsconfig.json"]);
|
|
18
|
+
const result = await spawner({ args: exec.args, command: exec.command, cwd });
|
|
19
|
+
return result.code === 0 ? {} : { error: `type errors: tsc --noEmit exited ${String(result.code)}` };
|
|
36
20
|
};
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
return void 0;
|
|
47
|
-
};
|
|
48
|
-
const insertSeedRows = async (ndjson, generated, cwd, options) => {
|
|
49
|
-
const scratchDirectory = await mkdtemp(join(tmpdir(), "lunora-seed-"));
|
|
50
|
-
const temporaryFile = join(scratchDirectory, "rows.ndjson");
|
|
51
|
-
await writeFile(temporaryFile, ndjson, "utf8");
|
|
52
|
-
try {
|
|
53
|
-
const result = await runImportCommand({
|
|
54
|
-
batchSize: options.batchSize,
|
|
55
|
-
fetchImpl: options.fetchImpl,
|
|
56
|
-
file: temporaryFile,
|
|
57
|
-
logger: options.logger,
|
|
58
|
-
prod: options.prod,
|
|
59
|
-
token: options.token,
|
|
60
|
-
url: options.url
|
|
61
|
-
});
|
|
62
|
-
const conflicts = result.body?.conflicts ?? 0;
|
|
63
|
-
if (conflicts > 0) {
|
|
64
|
-
options.logger.warn(
|
|
65
|
-
`${String(conflicts)} row(s) skipped — their _id already exists. Seeding is deterministic; re-run with --reset to wipe local state first, or a different --seed for fresh ids.`
|
|
66
|
-
);
|
|
21
|
+
const reportVerifyResult = (logger, errors, warnings, wranglerPath) => {
|
|
22
|
+
if (errors.length === 0 && warnings.length === 0) {
|
|
23
|
+
logger.success("verify: project is valid");
|
|
24
|
+
return { code: 0, errors: [], warnings: [], wranglerPath };
|
|
25
|
+
}
|
|
26
|
+
if (warnings.length > 0) {
|
|
27
|
+
logger.warn("verify: warnings:");
|
|
28
|
+
for (const warning of warnings) {
|
|
29
|
+
logger.warn(` - ${warning}`);
|
|
67
30
|
}
|
|
68
|
-
return { code: result.code, conflicts, generated, inserted: result.inserted, ndjson };
|
|
69
|
-
} finally {
|
|
70
|
-
await rm(scratchDirectory, { force: true, recursive: true }).catch(() => {
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
const validateSeedTable = (options, ir) => {
|
|
75
|
-
if (options.table === void 0 || ir.tables.some((table) => table.name === options.table)) {
|
|
76
|
-
return void 0;
|
|
77
31
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
};
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
options.logger.error("seed: refusing to insert into a non-local target without confirmation — re-run with --yes");
|
|
89
|
-
return seedFailure(1);
|
|
90
|
-
}
|
|
91
|
-
const confirmer = options.confirm ?? tuiConfirm;
|
|
92
|
-
const confirmed = await confirmer(`This will insert ${String(generated)} generated row(s) into ${options.url ?? "the production worker"}. Continue?`);
|
|
93
|
-
if (!confirmed) {
|
|
94
|
-
options.logger.info("seed: aborted");
|
|
95
|
-
return seedFailure(1);
|
|
32
|
+
if (errors.length > 0) {
|
|
33
|
+
logger.error("verify: errors:");
|
|
34
|
+
for (const error of errors) {
|
|
35
|
+
logger.error(` - ${error}`);
|
|
36
|
+
const hint = renderCodegenHint(error);
|
|
37
|
+
if (hint !== void 0) {
|
|
38
|
+
logger.error(hint);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return { code: 1, errors, warnings, wranglerPath };
|
|
96
42
|
}
|
|
97
|
-
|
|
43
|
+
logger.success("verify: project is valid (with warnings)");
|
|
44
|
+
return { code: 0, errors: [], warnings, wranglerPath };
|
|
98
45
|
};
|
|
99
|
-
const
|
|
46
|
+
const runVerifyCommand = async (options) => {
|
|
100
47
|
const cwd = options.cwd ?? process.cwd();
|
|
101
|
-
const
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
only: options.table === void 0 ? void 0 : [options.table],
|
|
116
|
-
seed: options.seed ?? 0
|
|
117
|
-
});
|
|
118
|
-
const lines = [];
|
|
119
|
-
for (const { rows, table } of plan) {
|
|
120
|
-
for (const row of rows) {
|
|
121
|
-
lines.push(JSON.stringify({ doc: row, table }, ndjsonReplacer));
|
|
48
|
+
const logger = loggerForFormat(options.format, options.logger);
|
|
49
|
+
const formatError = validateOutputFormat("verify", options.format);
|
|
50
|
+
if (formatError !== void 0) {
|
|
51
|
+
options.logger.error(formatError);
|
|
52
|
+
return { code: 1, error: formatError, errors: [], warnings: [], wranglerPath: void 0 };
|
|
53
|
+
}
|
|
54
|
+
const validation = validateWranglerProject({ projectRoot: cwd });
|
|
55
|
+
const errors = [...validation.report.errors];
|
|
56
|
+
const warnings = [...validation.report.warnings];
|
|
57
|
+
try {
|
|
58
|
+
const codegen = runCodegen({ apiSpec: options.apiSpec, dryRun: true, projectRoot: cwd });
|
|
59
|
+
const gate = runSchemaDriftGate({ allowDrift: options.allowSchemaDrift === true, codegen, logger, readOnly: true });
|
|
60
|
+
if (gate.blocked) {
|
|
61
|
+
errors.push(gate.reason);
|
|
122
62
|
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
` :
|
|
126
|
-
|
|
127
|
-
if (options.
|
|
128
|
-
|
|
129
|
-
|
|
63
|
+
} catch (error) {
|
|
64
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
65
|
+
errors.push(`codegen failed: ${message}`);
|
|
66
|
+
}
|
|
67
|
+
if (options.typecheck !== false) {
|
|
68
|
+
const typecheck = await runTypecheckStep(cwd, options.spawner ?? defaultSpawner);
|
|
69
|
+
if (typecheck.error !== void 0) {
|
|
70
|
+
errors.push(typecheck.error);
|
|
130
71
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
if (options.reset === true) {
|
|
135
|
-
const reset = await runResetCommand({ cwd, logger: options.logger, yes: true });
|
|
136
|
-
if (reset.code !== 0) {
|
|
137
|
-
return { code: reset.code, conflicts: 0, generated, inserted: 0, ndjson };
|
|
72
|
+
if (typecheck.warning !== void 0) {
|
|
73
|
+
warnings.push(typecheck.warning);
|
|
138
74
|
}
|
|
139
75
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
const aborted = await confirmRemoteSeedTarget(options, generated);
|
|
145
|
-
if (aborted !== void 0) {
|
|
146
|
-
return aborted;
|
|
76
|
+
const result = reportVerifyResult(logger, errors, warnings, validation.wranglerPath);
|
|
77
|
+
if (isJsonFormat(options.format)) {
|
|
78
|
+
printJson(result);
|
|
147
79
|
}
|
|
148
|
-
return
|
|
80
|
+
return result;
|
|
149
81
|
};
|
|
150
82
|
const execute = defineHandler(async ({ cwd, logger, options }) => {
|
|
151
|
-
const result = await
|
|
152
|
-
|
|
153
|
-
|
|
83
|
+
const result = await runVerifyCommand({
|
|
84
|
+
allowSchemaDrift: options.allowSchemaDrift === true,
|
|
85
|
+
apiSpec: parseApiSpec(options.apiSpec),
|
|
154
86
|
cwd,
|
|
155
|
-
|
|
87
|
+
format: options.format,
|
|
156
88
|
logger,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
table: options.table,
|
|
161
|
-
token: options.token,
|
|
162
|
-
// Resolve the link here (only under --prod) so seed's own remote/confirm
|
|
163
|
-
// logic and the downstream import both see the same effective target.
|
|
164
|
-
url: resolveProductionWorkerUrl({ cwd, prod: options.prod === true, url: options.url }),
|
|
165
|
-
yes: options.yes === true
|
|
89
|
+
// `--no-typecheck` is declared as a `no-*` option but cerebro exposes it
|
|
90
|
+
// under the negated `typecheck` key (false when passed, true when absent).
|
|
91
|
+
typecheck: options.typecheck === false ? false : void 0
|
|
166
92
|
});
|
|
167
93
|
return { code: result.code };
|
|
168
94
|
});
|
|
169
95
|
|
|
170
|
-
export { execute,
|
|
96
|
+
export { execute, runVerifyCommand };
|