sysprom 1.25.1 → 1.27.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/src/cli/commands/query.js +22 -1
- package/dist/src/cli/commands/update.js +82 -2
- package/dist/src/endpoint-types.js +3 -0
- package/dist/src/operations/add-external-reference.d.ts +534 -0
- package/dist/src/operations/add-external-reference.js +45 -0
- package/dist/src/operations/index.d.ts +3 -0
- package/dist/src/operations/index.js +3 -0
- package/dist/src/operations/query-relationship-types.d.ts +145 -0
- package/dist/src/operations/query-relationship-types.js +29 -0
- package/dist/src/operations/remove-external-reference.d.ts +519 -0
- package/dist/src/operations/remove-external-reference.js +37 -0
- package/package.json +1 -1
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Remove an external reference from a node by its identifier.
|
|
4
|
+
*/
|
|
5
|
+
export declare const removeExternalReferenceOp: import("./define-operation.js").DefinedOperation<z.ZodObject<{
|
|
6
|
+
doc: z.ZodObject<{
|
|
7
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
8
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
9
|
+
title: z.ZodOptional<z.ZodString>;
|
|
10
|
+
doc_type: z.ZodOptional<z.ZodString>;
|
|
11
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
12
|
+
status: z.ZodOptional<z.ZodString>;
|
|
13
|
+
version: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>>;
|
|
14
|
+
}, z.core.$loose> & {
|
|
15
|
+
is(value: unknown): value is {
|
|
16
|
+
[x: string]: unknown;
|
|
17
|
+
title?: string | undefined;
|
|
18
|
+
doc_type?: string | undefined;
|
|
19
|
+
scope?: string | undefined;
|
|
20
|
+
status?: string | undefined;
|
|
21
|
+
version?: string | number | undefined;
|
|
22
|
+
};
|
|
23
|
+
}>;
|
|
24
|
+
nodes: z.ZodArray<z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
type: z.ZodEnum<{
|
|
27
|
+
intent: "intent";
|
|
28
|
+
concept: "concept";
|
|
29
|
+
capability: "capability";
|
|
30
|
+
element: "element";
|
|
31
|
+
realisation: "realisation";
|
|
32
|
+
invariant: "invariant";
|
|
33
|
+
principle: "principle";
|
|
34
|
+
policy: "policy";
|
|
35
|
+
protocol: "protocol";
|
|
36
|
+
stage: "stage";
|
|
37
|
+
role: "role";
|
|
38
|
+
gate: "gate";
|
|
39
|
+
mode: "mode";
|
|
40
|
+
artefact: "artefact";
|
|
41
|
+
decision: "decision";
|
|
42
|
+
change: "change";
|
|
43
|
+
view: "view";
|
|
44
|
+
milestone: "milestone";
|
|
45
|
+
}> & {
|
|
46
|
+
is(value: unknown): value is "intent" | "concept" | "capability" | "element" | "realisation" | "invariant" | "principle" | "policy" | "protocol" | "stage" | "role" | "gate" | "mode" | "artefact" | "decision" | "change" | "view" | "milestone";
|
|
47
|
+
};
|
|
48
|
+
name: z.ZodString;
|
|
49
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
50
|
+
is(value: unknown): value is string | string[];
|
|
51
|
+
}>;
|
|
52
|
+
status: z.ZodOptional<z.ZodNever>;
|
|
53
|
+
lifecycle: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
|
|
54
|
+
context: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
55
|
+
is(value: unknown): value is string | string[];
|
|
56
|
+
}>;
|
|
57
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
description: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
60
|
+
is(value: unknown): value is string | string[];
|
|
61
|
+
};
|
|
62
|
+
}, z.core.$loose> & {
|
|
63
|
+
is(value: unknown): value is {
|
|
64
|
+
[x: string]: unknown;
|
|
65
|
+
id: string;
|
|
66
|
+
description: string | string[];
|
|
67
|
+
};
|
|
68
|
+
}>>;
|
|
69
|
+
selected: z.ZodOptional<z.ZodString>;
|
|
70
|
+
rationale: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
71
|
+
is(value: unknown): value is string | string[];
|
|
72
|
+
}>;
|
|
73
|
+
scope: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
74
|
+
operations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
75
|
+
type: z.ZodEnum<{
|
|
76
|
+
link: "link";
|
|
77
|
+
add: "add";
|
|
78
|
+
update: "update";
|
|
79
|
+
remove: "remove";
|
|
80
|
+
}>;
|
|
81
|
+
target: z.ZodOptional<z.ZodString>;
|
|
82
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
83
|
+
is(value: unknown): value is string | string[];
|
|
84
|
+
}>;
|
|
85
|
+
}, z.core.$loose> & {
|
|
86
|
+
is(value: unknown): value is {
|
|
87
|
+
[x: string]: unknown;
|
|
88
|
+
type: "link" | "add" | "update" | "remove";
|
|
89
|
+
target?: string | undefined;
|
|
90
|
+
description?: string | string[] | undefined;
|
|
91
|
+
};
|
|
92
|
+
}>>;
|
|
93
|
+
propagation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
94
|
+
includes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
95
|
+
external_references: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
96
|
+
role: z.ZodEnum<{
|
|
97
|
+
output: "output";
|
|
98
|
+
input: "input";
|
|
99
|
+
context: "context";
|
|
100
|
+
evidence: "evidence";
|
|
101
|
+
source: "source";
|
|
102
|
+
standard: "standard";
|
|
103
|
+
prior_art: "prior_art";
|
|
104
|
+
}> & {
|
|
105
|
+
is(value: unknown): value is "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
|
|
106
|
+
};
|
|
107
|
+
identifier: z.ZodString;
|
|
108
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
109
|
+
is(value: unknown): value is string | string[];
|
|
110
|
+
}>;
|
|
111
|
+
node_id: z.ZodOptional<z.ZodString>;
|
|
112
|
+
internalised: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
113
|
+
is(value: unknown): value is string | string[];
|
|
114
|
+
}>;
|
|
115
|
+
}, z.core.$strip> & {
|
|
116
|
+
is(value: unknown): value is {
|
|
117
|
+
role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
|
|
118
|
+
identifier: string;
|
|
119
|
+
description?: string | string[] | undefined;
|
|
120
|
+
node_id?: string | undefined;
|
|
121
|
+
internalised?: string | string[] | undefined;
|
|
122
|
+
};
|
|
123
|
+
}>>;
|
|
124
|
+
readonly subsystem: z.ZodOptional<z.ZodObject</*elided*/ any, z.core.$strip>>;
|
|
125
|
+
}, z.core.$loose>>;
|
|
126
|
+
relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
127
|
+
from: z.ZodString;
|
|
128
|
+
to: z.ZodString;
|
|
129
|
+
type: z.ZodEnum<{
|
|
130
|
+
refines: "refines";
|
|
131
|
+
realises: "realises";
|
|
132
|
+
implements: "implements";
|
|
133
|
+
depends_on: "depends_on";
|
|
134
|
+
constrained_by: "constrained_by";
|
|
135
|
+
affects: "affects";
|
|
136
|
+
supersedes: "supersedes";
|
|
137
|
+
must_preserve: "must_preserve";
|
|
138
|
+
part_of: "part_of";
|
|
139
|
+
precedes: "precedes";
|
|
140
|
+
must_follow: "must_follow";
|
|
141
|
+
governed_by: "governed_by";
|
|
142
|
+
modifies: "modifies";
|
|
143
|
+
produces: "produces";
|
|
144
|
+
}> & {
|
|
145
|
+
is(value: unknown): value is "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "part_of" | "precedes" | "must_follow" | "governed_by" | "modifies" | "produces";
|
|
146
|
+
};
|
|
147
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
148
|
+
is(value: unknown): value is string | string[];
|
|
149
|
+
}>;
|
|
150
|
+
polarity: z.ZodOptional<z.ZodEnum<{
|
|
151
|
+
positive: "positive";
|
|
152
|
+
negative: "negative";
|
|
153
|
+
neutral: "neutral";
|
|
154
|
+
uncertain: "uncertain";
|
|
155
|
+
}> & {
|
|
156
|
+
is(value: unknown): value is "positive" | "negative" | "neutral" | "uncertain";
|
|
157
|
+
}>;
|
|
158
|
+
strength: z.ZodOptional<z.ZodNumber>;
|
|
159
|
+
}, z.core.$loose> & {
|
|
160
|
+
is(value: unknown): value is {
|
|
161
|
+
[x: string]: unknown;
|
|
162
|
+
from: string;
|
|
163
|
+
to: string;
|
|
164
|
+
type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "part_of" | "precedes" | "must_follow" | "governed_by" | "modifies" | "produces";
|
|
165
|
+
description?: string | string[] | undefined;
|
|
166
|
+
polarity?: "positive" | "negative" | "neutral" | "uncertain" | undefined;
|
|
167
|
+
strength?: number | undefined;
|
|
168
|
+
};
|
|
169
|
+
}>>;
|
|
170
|
+
external_references: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
171
|
+
role: z.ZodEnum<{
|
|
172
|
+
output: "output";
|
|
173
|
+
input: "input";
|
|
174
|
+
context: "context";
|
|
175
|
+
evidence: "evidence";
|
|
176
|
+
source: "source";
|
|
177
|
+
standard: "standard";
|
|
178
|
+
prior_art: "prior_art";
|
|
179
|
+
}> & {
|
|
180
|
+
is(value: unknown): value is "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
|
|
181
|
+
};
|
|
182
|
+
identifier: z.ZodString;
|
|
183
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
184
|
+
is(value: unknown): value is string | string[];
|
|
185
|
+
}>;
|
|
186
|
+
node_id: z.ZodOptional<z.ZodString>;
|
|
187
|
+
internalised: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
188
|
+
is(value: unknown): value is string | string[];
|
|
189
|
+
}>;
|
|
190
|
+
}, z.core.$strip> & {
|
|
191
|
+
is(value: unknown): value is {
|
|
192
|
+
role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
|
|
193
|
+
identifier: string;
|
|
194
|
+
description?: string | string[] | undefined;
|
|
195
|
+
node_id?: string | undefined;
|
|
196
|
+
internalised?: string | string[] | undefined;
|
|
197
|
+
};
|
|
198
|
+
}>>;
|
|
199
|
+
}, z.core.$strip> & {
|
|
200
|
+
is(value: unknown): value is {
|
|
201
|
+
nodes: {
|
|
202
|
+
[x: string]: unknown;
|
|
203
|
+
id: string;
|
|
204
|
+
type: "intent" | "concept" | "capability" | "element" | "realisation" | "invariant" | "principle" | "policy" | "protocol" | "stage" | "role" | "gate" | "mode" | "artefact" | "decision" | "change" | "view" | "milestone";
|
|
205
|
+
name: string;
|
|
206
|
+
description?: string | string[] | undefined;
|
|
207
|
+
status?: undefined;
|
|
208
|
+
lifecycle?: Record<string, string | boolean> | undefined;
|
|
209
|
+
context?: string | string[] | undefined;
|
|
210
|
+
options?: {
|
|
211
|
+
[x: string]: unknown;
|
|
212
|
+
id: string;
|
|
213
|
+
description: string | string[];
|
|
214
|
+
}[] | undefined;
|
|
215
|
+
selected?: string | undefined;
|
|
216
|
+
rationale?: string | string[] | undefined;
|
|
217
|
+
scope?: string[] | undefined;
|
|
218
|
+
operations?: {
|
|
219
|
+
[x: string]: unknown;
|
|
220
|
+
type: "link" | "add" | "update" | "remove";
|
|
221
|
+
target?: string | undefined;
|
|
222
|
+
description?: string | string[] | undefined;
|
|
223
|
+
}[] | undefined;
|
|
224
|
+
propagation?: Record<string, boolean> | undefined;
|
|
225
|
+
includes?: string[] | undefined;
|
|
226
|
+
external_references?: {
|
|
227
|
+
role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
|
|
228
|
+
identifier: string;
|
|
229
|
+
description?: string | string[] | undefined;
|
|
230
|
+
node_id?: string | undefined;
|
|
231
|
+
internalised?: string | string[] | undefined;
|
|
232
|
+
}[] | undefined;
|
|
233
|
+
subsystem?: /*elided*/ any | undefined;
|
|
234
|
+
}[];
|
|
235
|
+
$schema?: string | undefined;
|
|
236
|
+
metadata?: {
|
|
237
|
+
[x: string]: unknown;
|
|
238
|
+
title?: string | undefined;
|
|
239
|
+
doc_type?: string | undefined;
|
|
240
|
+
scope?: string | undefined;
|
|
241
|
+
status?: string | undefined;
|
|
242
|
+
version?: string | number | undefined;
|
|
243
|
+
} | undefined;
|
|
244
|
+
relationships?: {
|
|
245
|
+
[x: string]: unknown;
|
|
246
|
+
from: string;
|
|
247
|
+
to: string;
|
|
248
|
+
type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "part_of" | "precedes" | "must_follow" | "governed_by" | "modifies" | "produces";
|
|
249
|
+
description?: string | string[] | undefined;
|
|
250
|
+
polarity?: "positive" | "negative" | "neutral" | "uncertain" | undefined;
|
|
251
|
+
strength?: number | undefined;
|
|
252
|
+
}[] | undefined;
|
|
253
|
+
external_references?: {
|
|
254
|
+
role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
|
|
255
|
+
identifier: string;
|
|
256
|
+
description?: string | string[] | undefined;
|
|
257
|
+
node_id?: string | undefined;
|
|
258
|
+
internalised?: string | string[] | undefined;
|
|
259
|
+
}[] | undefined;
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
nodeId: z.ZodString;
|
|
263
|
+
identifier: z.ZodString;
|
|
264
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
265
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
266
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
267
|
+
title: z.ZodOptional<z.ZodString>;
|
|
268
|
+
doc_type: z.ZodOptional<z.ZodString>;
|
|
269
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
270
|
+
status: z.ZodOptional<z.ZodString>;
|
|
271
|
+
version: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>>;
|
|
272
|
+
}, z.core.$loose> & {
|
|
273
|
+
is(value: unknown): value is {
|
|
274
|
+
[x: string]: unknown;
|
|
275
|
+
title?: string | undefined;
|
|
276
|
+
doc_type?: string | undefined;
|
|
277
|
+
scope?: string | undefined;
|
|
278
|
+
status?: string | undefined;
|
|
279
|
+
version?: string | number | undefined;
|
|
280
|
+
};
|
|
281
|
+
}>;
|
|
282
|
+
nodes: z.ZodArray<z.ZodObject<{
|
|
283
|
+
id: z.ZodString;
|
|
284
|
+
type: z.ZodEnum<{
|
|
285
|
+
intent: "intent";
|
|
286
|
+
concept: "concept";
|
|
287
|
+
capability: "capability";
|
|
288
|
+
element: "element";
|
|
289
|
+
realisation: "realisation";
|
|
290
|
+
invariant: "invariant";
|
|
291
|
+
principle: "principle";
|
|
292
|
+
policy: "policy";
|
|
293
|
+
protocol: "protocol";
|
|
294
|
+
stage: "stage";
|
|
295
|
+
role: "role";
|
|
296
|
+
gate: "gate";
|
|
297
|
+
mode: "mode";
|
|
298
|
+
artefact: "artefact";
|
|
299
|
+
decision: "decision";
|
|
300
|
+
change: "change";
|
|
301
|
+
view: "view";
|
|
302
|
+
milestone: "milestone";
|
|
303
|
+
}> & {
|
|
304
|
+
is(value: unknown): value is "intent" | "concept" | "capability" | "element" | "realisation" | "invariant" | "principle" | "policy" | "protocol" | "stage" | "role" | "gate" | "mode" | "artefact" | "decision" | "change" | "view" | "milestone";
|
|
305
|
+
};
|
|
306
|
+
name: z.ZodString;
|
|
307
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
308
|
+
is(value: unknown): value is string | string[];
|
|
309
|
+
}>;
|
|
310
|
+
status: z.ZodOptional<z.ZodNever>;
|
|
311
|
+
lifecycle: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
|
|
312
|
+
context: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
313
|
+
is(value: unknown): value is string | string[];
|
|
314
|
+
}>;
|
|
315
|
+
options: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
316
|
+
id: z.ZodString;
|
|
317
|
+
description: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
318
|
+
is(value: unknown): value is string | string[];
|
|
319
|
+
};
|
|
320
|
+
}, z.core.$loose> & {
|
|
321
|
+
is(value: unknown): value is {
|
|
322
|
+
[x: string]: unknown;
|
|
323
|
+
id: string;
|
|
324
|
+
description: string | string[];
|
|
325
|
+
};
|
|
326
|
+
}>>;
|
|
327
|
+
selected: z.ZodOptional<z.ZodString>;
|
|
328
|
+
rationale: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
329
|
+
is(value: unknown): value is string | string[];
|
|
330
|
+
}>;
|
|
331
|
+
scope: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
332
|
+
operations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
333
|
+
type: z.ZodEnum<{
|
|
334
|
+
link: "link";
|
|
335
|
+
add: "add";
|
|
336
|
+
update: "update";
|
|
337
|
+
remove: "remove";
|
|
338
|
+
}>;
|
|
339
|
+
target: z.ZodOptional<z.ZodString>;
|
|
340
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
341
|
+
is(value: unknown): value is string | string[];
|
|
342
|
+
}>;
|
|
343
|
+
}, z.core.$loose> & {
|
|
344
|
+
is(value: unknown): value is {
|
|
345
|
+
[x: string]: unknown;
|
|
346
|
+
type: "link" | "add" | "update" | "remove";
|
|
347
|
+
target?: string | undefined;
|
|
348
|
+
description?: string | string[] | undefined;
|
|
349
|
+
};
|
|
350
|
+
}>>;
|
|
351
|
+
propagation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
352
|
+
includes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
353
|
+
external_references: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
354
|
+
role: z.ZodEnum<{
|
|
355
|
+
output: "output";
|
|
356
|
+
input: "input";
|
|
357
|
+
context: "context";
|
|
358
|
+
evidence: "evidence";
|
|
359
|
+
source: "source";
|
|
360
|
+
standard: "standard";
|
|
361
|
+
prior_art: "prior_art";
|
|
362
|
+
}> & {
|
|
363
|
+
is(value: unknown): value is "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
|
|
364
|
+
};
|
|
365
|
+
identifier: z.ZodString;
|
|
366
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
367
|
+
is(value: unknown): value is string | string[];
|
|
368
|
+
}>;
|
|
369
|
+
node_id: z.ZodOptional<z.ZodString>;
|
|
370
|
+
internalised: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
371
|
+
is(value: unknown): value is string | string[];
|
|
372
|
+
}>;
|
|
373
|
+
}, z.core.$strip> & {
|
|
374
|
+
is(value: unknown): value is {
|
|
375
|
+
role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
|
|
376
|
+
identifier: string;
|
|
377
|
+
description?: string | string[] | undefined;
|
|
378
|
+
node_id?: string | undefined;
|
|
379
|
+
internalised?: string | string[] | undefined;
|
|
380
|
+
};
|
|
381
|
+
}>>;
|
|
382
|
+
readonly subsystem: z.ZodOptional<z.ZodObject</*elided*/ any, z.core.$strip>>;
|
|
383
|
+
}, z.core.$loose>>;
|
|
384
|
+
relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
385
|
+
from: z.ZodString;
|
|
386
|
+
to: z.ZodString;
|
|
387
|
+
type: z.ZodEnum<{
|
|
388
|
+
refines: "refines";
|
|
389
|
+
realises: "realises";
|
|
390
|
+
implements: "implements";
|
|
391
|
+
depends_on: "depends_on";
|
|
392
|
+
constrained_by: "constrained_by";
|
|
393
|
+
affects: "affects";
|
|
394
|
+
supersedes: "supersedes";
|
|
395
|
+
must_preserve: "must_preserve";
|
|
396
|
+
part_of: "part_of";
|
|
397
|
+
precedes: "precedes";
|
|
398
|
+
must_follow: "must_follow";
|
|
399
|
+
governed_by: "governed_by";
|
|
400
|
+
modifies: "modifies";
|
|
401
|
+
produces: "produces";
|
|
402
|
+
}> & {
|
|
403
|
+
is(value: unknown): value is "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "part_of" | "precedes" | "must_follow" | "governed_by" | "modifies" | "produces";
|
|
404
|
+
};
|
|
405
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
406
|
+
is(value: unknown): value is string | string[];
|
|
407
|
+
}>;
|
|
408
|
+
polarity: z.ZodOptional<z.ZodEnum<{
|
|
409
|
+
positive: "positive";
|
|
410
|
+
negative: "negative";
|
|
411
|
+
neutral: "neutral";
|
|
412
|
+
uncertain: "uncertain";
|
|
413
|
+
}> & {
|
|
414
|
+
is(value: unknown): value is "positive" | "negative" | "neutral" | "uncertain";
|
|
415
|
+
}>;
|
|
416
|
+
strength: z.ZodOptional<z.ZodNumber>;
|
|
417
|
+
}, z.core.$loose> & {
|
|
418
|
+
is(value: unknown): value is {
|
|
419
|
+
[x: string]: unknown;
|
|
420
|
+
from: string;
|
|
421
|
+
to: string;
|
|
422
|
+
type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "part_of" | "precedes" | "must_follow" | "governed_by" | "modifies" | "produces";
|
|
423
|
+
description?: string | string[] | undefined;
|
|
424
|
+
polarity?: "positive" | "negative" | "neutral" | "uncertain" | undefined;
|
|
425
|
+
strength?: number | undefined;
|
|
426
|
+
};
|
|
427
|
+
}>>;
|
|
428
|
+
external_references: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
429
|
+
role: z.ZodEnum<{
|
|
430
|
+
output: "output";
|
|
431
|
+
input: "input";
|
|
432
|
+
context: "context";
|
|
433
|
+
evidence: "evidence";
|
|
434
|
+
source: "source";
|
|
435
|
+
standard: "standard";
|
|
436
|
+
prior_art: "prior_art";
|
|
437
|
+
}> & {
|
|
438
|
+
is(value: unknown): value is "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
|
|
439
|
+
};
|
|
440
|
+
identifier: z.ZodString;
|
|
441
|
+
description: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
442
|
+
is(value: unknown): value is string | string[];
|
|
443
|
+
}>;
|
|
444
|
+
node_id: z.ZodOptional<z.ZodString>;
|
|
445
|
+
internalised: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]> & {
|
|
446
|
+
is(value: unknown): value is string | string[];
|
|
447
|
+
}>;
|
|
448
|
+
}, z.core.$strip> & {
|
|
449
|
+
is(value: unknown): value is {
|
|
450
|
+
role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
|
|
451
|
+
identifier: string;
|
|
452
|
+
description?: string | string[] | undefined;
|
|
453
|
+
node_id?: string | undefined;
|
|
454
|
+
internalised?: string | string[] | undefined;
|
|
455
|
+
};
|
|
456
|
+
}>>;
|
|
457
|
+
}, z.core.$strip> & {
|
|
458
|
+
is(value: unknown): value is {
|
|
459
|
+
nodes: {
|
|
460
|
+
[x: string]: unknown;
|
|
461
|
+
id: string;
|
|
462
|
+
type: "intent" | "concept" | "capability" | "element" | "realisation" | "invariant" | "principle" | "policy" | "protocol" | "stage" | "role" | "gate" | "mode" | "artefact" | "decision" | "change" | "view" | "milestone";
|
|
463
|
+
name: string;
|
|
464
|
+
description?: string | string[] | undefined;
|
|
465
|
+
status?: undefined;
|
|
466
|
+
lifecycle?: Record<string, string | boolean> | undefined;
|
|
467
|
+
context?: string | string[] | undefined;
|
|
468
|
+
options?: {
|
|
469
|
+
[x: string]: unknown;
|
|
470
|
+
id: string;
|
|
471
|
+
description: string | string[];
|
|
472
|
+
}[] | undefined;
|
|
473
|
+
selected?: string | undefined;
|
|
474
|
+
rationale?: string | string[] | undefined;
|
|
475
|
+
scope?: string[] | undefined;
|
|
476
|
+
operations?: {
|
|
477
|
+
[x: string]: unknown;
|
|
478
|
+
type: "link" | "add" | "update" | "remove";
|
|
479
|
+
target?: string | undefined;
|
|
480
|
+
description?: string | string[] | undefined;
|
|
481
|
+
}[] | undefined;
|
|
482
|
+
propagation?: Record<string, boolean> | undefined;
|
|
483
|
+
includes?: string[] | undefined;
|
|
484
|
+
external_references?: {
|
|
485
|
+
role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
|
|
486
|
+
identifier: string;
|
|
487
|
+
description?: string | string[] | undefined;
|
|
488
|
+
node_id?: string | undefined;
|
|
489
|
+
internalised?: string | string[] | undefined;
|
|
490
|
+
}[] | undefined;
|
|
491
|
+
subsystem?: /*elided*/ any | undefined;
|
|
492
|
+
}[];
|
|
493
|
+
$schema?: string | undefined;
|
|
494
|
+
metadata?: {
|
|
495
|
+
[x: string]: unknown;
|
|
496
|
+
title?: string | undefined;
|
|
497
|
+
doc_type?: string | undefined;
|
|
498
|
+
scope?: string | undefined;
|
|
499
|
+
status?: string | undefined;
|
|
500
|
+
version?: string | number | undefined;
|
|
501
|
+
} | undefined;
|
|
502
|
+
relationships?: {
|
|
503
|
+
[x: string]: unknown;
|
|
504
|
+
from: string;
|
|
505
|
+
to: string;
|
|
506
|
+
type: "refines" | "realises" | "implements" | "depends_on" | "constrained_by" | "affects" | "supersedes" | "must_preserve" | "part_of" | "precedes" | "must_follow" | "governed_by" | "modifies" | "produces";
|
|
507
|
+
description?: string | string[] | undefined;
|
|
508
|
+
polarity?: "positive" | "negative" | "neutral" | "uncertain" | undefined;
|
|
509
|
+
strength?: number | undefined;
|
|
510
|
+
}[] | undefined;
|
|
511
|
+
external_references?: {
|
|
512
|
+
role: "output" | "input" | "context" | "evidence" | "source" | "standard" | "prior_art";
|
|
513
|
+
identifier: string;
|
|
514
|
+
description?: string | string[] | undefined;
|
|
515
|
+
node_id?: string | undefined;
|
|
516
|
+
internalised?: string | string[] | undefined;
|
|
517
|
+
}[] | undefined;
|
|
518
|
+
};
|
|
519
|
+
}>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { defineOperation } from "./define-operation.js";
|
|
3
|
+
import { SysProMDocument } from "../schema.js";
|
|
4
|
+
/**
|
|
5
|
+
* Remove an external reference from a node by its identifier.
|
|
6
|
+
*/
|
|
7
|
+
export const removeExternalReferenceOp = defineOperation({
|
|
8
|
+
name: "remove-external-reference",
|
|
9
|
+
description: "Remove an external reference from a node",
|
|
10
|
+
input: z.object({
|
|
11
|
+
doc: SysProMDocument,
|
|
12
|
+
nodeId: z.string().describe("The node to remove the reference from"),
|
|
13
|
+
identifier: z
|
|
14
|
+
.string()
|
|
15
|
+
.describe("The identifier of the reference to remove"),
|
|
16
|
+
}),
|
|
17
|
+
output: SysProMDocument,
|
|
18
|
+
fn: (input) => {
|
|
19
|
+
const node = input.doc.nodes.find((n) => n.id === input.nodeId);
|
|
20
|
+
if (!node) {
|
|
21
|
+
throw new Error(`Node not found: ${input.nodeId}`);
|
|
22
|
+
}
|
|
23
|
+
const refs = node.external_references ?? [];
|
|
24
|
+
const found = refs.some((r) => r.identifier === input.identifier);
|
|
25
|
+
if (!found) {
|
|
26
|
+
throw new Error(`Reference not found: ${input.identifier} on node ${input.nodeId}`);
|
|
27
|
+
}
|
|
28
|
+
const updatedNode = {
|
|
29
|
+
...node,
|
|
30
|
+
external_references: refs.filter((r) => r.identifier !== input.identifier),
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
...input.doc,
|
|
34
|
+
nodes: input.doc.nodes.map((n) => n.id === input.nodeId ? updatedNode : n),
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
});
|