@nurix/nustack 0.22.1 → 0.23.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/dist/commands/records.js +32 -7
- package/package.json +5 -5
package/dist/commands/records.js
CHANGED
|
@@ -19,9 +19,29 @@ function parseRows(raw) {
|
|
|
19
19
|
catch {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
let list;
|
|
23
|
+
let kind;
|
|
24
|
+
if (Array.isArray(parsed))
|
|
25
|
+
list = parsed;
|
|
26
|
+
else if (isEnvelope(parsed)) {
|
|
27
|
+
list = parsed.rows;
|
|
28
|
+
kind = parsed.kind;
|
|
29
|
+
}
|
|
30
|
+
else
|
|
31
|
+
list = [parsed];
|
|
32
|
+
const rows = list.filter((row) => !!row &&
|
|
33
|
+
typeof row === "object" &&
|
|
34
|
+
!Array.isArray(row) &&
|
|
35
|
+
typeof row.anchor === "string" &&
|
|
36
|
+
row.anchor.trim() !== "");
|
|
37
|
+
return rows.length === list.length ? { rows, kind } : null;
|
|
38
|
+
}
|
|
39
|
+
function isEnvelope(value) {
|
|
40
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
41
|
+
return false;
|
|
42
|
+
const candidate = value;
|
|
43
|
+
const hasPayload = !!candidate.payload && typeof candidate.payload === "object" && !Array.isArray(candidate.payload);
|
|
44
|
+
return Array.isArray(candidate.rows) && typeof candidate.anchor !== "string" && !hasPayload;
|
|
25
45
|
}
|
|
26
46
|
function emitLine(outcome) {
|
|
27
47
|
if (outcome.rung === 1)
|
|
@@ -42,9 +62,14 @@ export async function runRecordsEmit(options, globals) {
|
|
|
42
62
|
};
|
|
43
63
|
if (!isRecordKind(options.kind))
|
|
44
64
|
return refuse("--kind must be backlog, backlog.remove, bookkeeping or gate_event");
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
return refuse("the rows must be JSON — one
|
|
65
|
+
const parsed = parseRows(options.row ?? (await readStdin()));
|
|
66
|
+
if (!parsed || parsed.rows.length === 0) {
|
|
67
|
+
return refuse("the rows must be JSON — one row, an array of rows, or {kind, rows} — each an object with an anchor");
|
|
68
|
+
}
|
|
69
|
+
if (parsed.kind !== undefined && parsed.kind !== options.kind) {
|
|
70
|
+
return refuse(`the envelope's kind ${JSON.stringify(parsed.kind)} differs from --kind ${options.kind}`);
|
|
71
|
+
}
|
|
72
|
+
const rows = parsed.rows;
|
|
48
73
|
const root = options.root ?? process.cwd();
|
|
49
74
|
const resolution = await resolveDoor(root, globals, options.project);
|
|
50
75
|
const store = await openLocalStore();
|
|
@@ -131,7 +156,7 @@ export function registerRecordsCommands(recordsCommand, getGlobalOptions) {
|
|
|
131
156
|
.command("emit")
|
|
132
157
|
.description("Land records on NuStack, else park them in the outbox, else keep them locally")
|
|
133
158
|
.option("--kind <kind>", "backlog, backlog.remove, bookkeeping or gate_event")
|
|
134
|
-
.option("--row <json>", "
|
|
159
|
+
.option("--row <json>", "one row, an array of rows, or {kind, rows}, as JSON (default: read from stdin)")
|
|
135
160
|
.option("--root <dir>", "the folder the records are about (default: the current directory)")
|
|
136
161
|
.option("--project <id>", "the Project, when the folder carries no binding marker")
|
|
137
162
|
.option("--json", "emit the versioned machine envelope")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nurix/nustack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "The nustack CLI — bootstrap NuStack services into a repo via the NuStack discovery plane.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"commander": "^14.0.0"
|
|
28
28
|
},
|
|
29
29
|
"optionalDependencies": {
|
|
30
|
-
"@nurix/
|
|
31
|
-
"@nurix/
|
|
30
|
+
"@nurix/codegraph": "0.2.1",
|
|
31
|
+
"@nurix/logscope": "0.1.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@ngneat/falso": "^8.0.2",
|
|
35
35
|
"@types/node": "^22.19.20",
|
|
36
36
|
"typescript": "^5.7.2",
|
|
37
37
|
"vitest": "^4.1.11",
|
|
38
|
-
"@nurix/nustack.
|
|
39
|
-
"@nurix/nustack.
|
|
38
|
+
"@nurix/nustack.ui": "0.0.0",
|
|
39
|
+
"@nurix/nustack.studio": "0.0.0"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|