@celsian/vura-cli 0.5.5 → 0.5.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/dist/commands/deploy.js +1 -1
- package/dist/commands/dev.js +41 -6
- package/dist/commands/tasks.js +22 -1
- package/package.json +4 -4
package/dist/commands/deploy.js
CHANGED
|
@@ -100,7 +100,7 @@ export async function deployCommand(args) {
|
|
|
100
100
|
});
|
|
101
101
|
console.log('');
|
|
102
102
|
console.log(` ${flags.production ? 'Production' : 'Preview'} deployment ready.`);
|
|
103
|
-
console.log(` URL:
|
|
103
|
+
console.log(` URL: ${result.url}`);
|
|
104
104
|
}
|
|
105
105
|
catch (err) {
|
|
106
106
|
const message = err instanceof Error ? err.message : String(err);
|
package/dist/commands/dev.js
CHANGED
|
@@ -382,14 +382,43 @@ export async function startStandaloneServer(manifest, opts) {
|
|
|
382
382
|
}
|
|
383
383
|
const body = await parseNodeBody(req);
|
|
384
384
|
// Accept both `{ input: ... }` (legacy admin convention + the platform's
|
|
385
|
-
// `{ taskId, input, attempt }` wrapper) and a raw payload
|
|
386
|
-
// as the body (enqueue()'s local fallback).
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
: body;
|
|
385
|
+
// `{ taskId, input, attempt, runId?, steps? }` wrapper) and a raw payload
|
|
386
|
+
// posted directly as the body (enqueue()'s local fallback).
|
|
387
|
+
const isWrapper = body && typeof body === 'object' && 'input' in body;
|
|
388
|
+
const input = isWrapper ? body.input : body;
|
|
390
389
|
// Platform cron/synthetic dispatches (X-Vura-Cron: true) skip input
|
|
391
390
|
// validation, mirroring the standalone server + in-process cron.
|
|
392
391
|
const isCronDispatch = String(req.headers['x-vura-cron'] ?? '').toLowerCase() === 'true';
|
|
392
|
+
const isPlatformDispatch = String(req.headers['x-vura-task-id'] ?? '') !== '';
|
|
393
|
+
// Dispatch body v2 (Phase 2): tolerate-absent runId + steps.
|
|
394
|
+
const runId = isWrapper && typeof body.runId === 'string'
|
|
395
|
+
? body.runId
|
|
396
|
+
: undefined;
|
|
397
|
+
const dispatchSteps = isWrapper && body.steps && typeof body.steps === 'object'
|
|
398
|
+
? body.steps
|
|
399
|
+
: {};
|
|
400
|
+
// Off-platform child dispatcher so `step.waitForTask` resolves the child
|
|
401
|
+
// in-process during `vura dev` (no durable platform → waits run locally).
|
|
402
|
+
const localChildDispatch = async (childName, childPayload) => {
|
|
403
|
+
const childRoute = manifest.api.find((r) => r.kind === 'task' &&
|
|
404
|
+
r.urlPattern.replace(/^\/api\//, '').replace(/\//g, '.') === childName);
|
|
405
|
+
if (!childRoute)
|
|
406
|
+
return { ok: false, error: `Task not found: ${childName}` };
|
|
407
|
+
const childMod = await loadHandlerCached(childRoute.filePath);
|
|
408
|
+
if (typeof childMod.POST !== 'function')
|
|
409
|
+
return { ok: false, error: 'Task must export POST handler' };
|
|
410
|
+
const childRes = await runTaskOnce({
|
|
411
|
+
name: childName,
|
|
412
|
+
config: {
|
|
413
|
+
retries: typeof childRoute.config.retries === 'number' ? childRoute.config.retries : 0,
|
|
414
|
+
timeout: typeof childRoute.config.timeout === 'number' ? childRoute.config.timeout : 30_000,
|
|
415
|
+
},
|
|
416
|
+
handler: childMod.POST,
|
|
417
|
+
}, { input: childPayload, hasPlatform: false, localChildDispatch });
|
|
418
|
+
return childRes.status === 'completed'
|
|
419
|
+
? { ok: true, result: childRes.result }
|
|
420
|
+
: { ok: false, error: childRes.error };
|
|
421
|
+
};
|
|
393
422
|
const runResult = await runTaskOnce({
|
|
394
423
|
name: taskName,
|
|
395
424
|
config: {
|
|
@@ -398,7 +427,13 @@ export async function startStandaloneServer(manifest, opts) {
|
|
|
398
427
|
},
|
|
399
428
|
handler: mod.POST,
|
|
400
429
|
inputSchema: isCronDispatch ? undefined : mod.input,
|
|
401
|
-
}, {
|
|
430
|
+
}, {
|
|
431
|
+
input,
|
|
432
|
+
runId,
|
|
433
|
+
steps: dispatchSteps,
|
|
434
|
+
hasPlatform: isPlatformDispatch ? true : undefined,
|
|
435
|
+
localChildDispatch,
|
|
436
|
+
});
|
|
402
437
|
if (runResult.validationError) {
|
|
403
438
|
res.writeHead(runResult.validationError.statusCode, { 'Content-Type': 'application/json' });
|
|
404
439
|
res.end(JSON.stringify(runResult.validationError.body));
|
package/dist/commands/tasks.js
CHANGED
|
@@ -75,6 +75,27 @@ async function runTask(projectRoot, taskName, rawInput) {
|
|
|
75
75
|
process.exitCode = 1;
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
+
// Off-platform child dispatcher so `step.waitForTask` resolves the child
|
|
79
|
+
// in-process when running a task from the CLI (no durable platform).
|
|
80
|
+
const localChildDispatch = async (childName, childPayload) => {
|
|
81
|
+
const childRoute = taskRoutes.find((r) => taskNameFromPattern(r.urlPattern) === childName);
|
|
82
|
+
if (!childRoute)
|
|
83
|
+
return { ok: false, error: `Task not found: ${childName}` };
|
|
84
|
+
const childMod = await importRouteModule(projectRoot, childRoute.filePath);
|
|
85
|
+
if (typeof childMod.POST !== 'function')
|
|
86
|
+
return { ok: false, error: 'Task must export POST handler' };
|
|
87
|
+
const childRes = await runTaskOnce({
|
|
88
|
+
name: childName,
|
|
89
|
+
config: {
|
|
90
|
+
retries: typeof childRoute.config.retries === 'number' ? childRoute.config.retries : 0,
|
|
91
|
+
timeout: typeof childRoute.config.timeout === 'number' ? childRoute.config.timeout : 30_000,
|
|
92
|
+
},
|
|
93
|
+
handler: childMod.POST,
|
|
94
|
+
}, { input: childPayload, hasPlatform: false, localChildDispatch });
|
|
95
|
+
return childRes.status === 'completed'
|
|
96
|
+
? { ok: true, result: childRes.result }
|
|
97
|
+
: { ok: false, error: childRes.error };
|
|
98
|
+
};
|
|
78
99
|
const result = await runTaskOnce({
|
|
79
100
|
name: taskName,
|
|
80
101
|
config: {
|
|
@@ -84,7 +105,7 @@ async function runTask(projectRoot, taskName, rawInput) {
|
|
|
84
105
|
handler: mod.POST,
|
|
85
106
|
// Phase 1: validate --input against the task's optional `input` schema.
|
|
86
107
|
inputSchema: mod.input,
|
|
87
|
-
}, { input });
|
|
108
|
+
}, { input, hasPlatform: false, localChildDispatch });
|
|
88
109
|
// A schema validation failure never ran the handler — print the standard
|
|
89
110
|
// validation error body and exit 1.
|
|
90
111
|
if (result.validationError) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celsian/vura-cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
4
4
|
"description": "Vura CLI — build and deploy full-stack apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"!dist/**/*.map"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@celsian/vura-core": "0.5.
|
|
18
|
+
"@celsian/vura-core": "0.5.7",
|
|
19
19
|
"esbuild": "^0.28.1",
|
|
20
20
|
"what-framework": "^0.11.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@celsian/vura-adapter-vura": "0.5.
|
|
23
|
+
"@celsian/vura-adapter-vura": "0.5.7",
|
|
24
24
|
"ws": "^8.0.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependenciesMeta": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@celsian/vura-adapter-vura": "0.5.
|
|
35
|
+
"@celsian/vura-adapter-vura": "0.5.7",
|
|
36
36
|
"@types/ws": "^8.18.1",
|
|
37
37
|
"ws": "^8.21.0"
|
|
38
38
|
},
|