@niscorp/nova 0.2.1 → 0.2.2

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/adapters/dom/components/index.cjs +4 -51
  3. package/dist/adapters/dom/components/index.cjs.map +1 -1
  4. package/dist/adapters/dom/index.cjs +22 -686
  5. package/dist/adapters/dom/index.cjs.map +1 -1
  6. package/dist/adapters/dom/server.cjs +14 -411
  7. package/dist/adapters/dom/server.cjs.map +1 -1
  8. package/dist/adapters/react/components/index.cjs +87 -562
  9. package/dist/adapters/react/components/index.cjs.map +1 -1
  10. package/dist/adapters/react/components/index.d.cts +2 -2
  11. package/dist/adapters/react/components/index.d.ts +2 -2
  12. package/dist/adapters/react/index.cjs +97 -1815
  13. package/dist/adapters/react/index.cjs.map +1 -1
  14. package/dist/adapters/tty/components/index.cjs +3 -44
  15. package/dist/adapters/tty/components/index.cjs.map +1 -1
  16. package/dist/adapters/tty/index.cjs +13 -5
  17. package/dist/adapters/tty/index.cjs.map +1 -1
  18. package/dist/adapters/vue/components/index.cjs +88 -639
  19. package/dist/adapters/vue/components/index.cjs.map +1 -1
  20. package/dist/adapters/vue/components/index.d.cts +10 -10
  21. package/dist/adapters/vue/components/index.d.ts +10 -10
  22. package/dist/adapters/vue/index.cjs +96 -962
  23. package/dist/adapters/vue/index.cjs.map +1 -1
  24. package/dist/agent/index.cjs +13 -151
  25. package/dist/agent/index.cjs.map +1 -1
  26. package/dist/chunk-3IPM5QBT.cjs +436 -0
  27. package/dist/chunk-3IPM5QBT.cjs.map +1 -0
  28. package/dist/chunk-5AF72LOE.cjs +97 -0
  29. package/dist/chunk-5AF72LOE.cjs.map +1 -0
  30. package/dist/chunk-5YQIAS4V.cjs +184 -0
  31. package/dist/chunk-5YQIAS4V.cjs.map +1 -0
  32. package/dist/chunk-D4PUWBN6.cjs +72 -0
  33. package/dist/chunk-D4PUWBN6.cjs.map +1 -0
  34. package/dist/chunk-FSUMCJAR.cjs +646 -0
  35. package/dist/chunk-FSUMCJAR.cjs.map +1 -0
  36. package/dist/chunk-GV7UC3SS.cjs +33 -0
  37. package/dist/chunk-GV7UC3SS.cjs.map +1 -0
  38. package/dist/chunk-IZ2UU5UL.cjs +808 -0
  39. package/dist/chunk-IZ2UU5UL.cjs.map +1 -0
  40. package/dist/chunk-KOYRJXTI.cjs +123 -0
  41. package/dist/chunk-KOYRJXTI.cjs.map +1 -0
  42. package/dist/chunk-KW34ZKF5.cjs +12 -0
  43. package/dist/chunk-KW34ZKF5.cjs.map +1 -0
  44. package/dist/chunk-OE527MXF.cjs +49 -0
  45. package/dist/chunk-OE527MXF.cjs.map +1 -0
  46. package/dist/chunk-OO247V4J.cjs +2117 -0
  47. package/dist/chunk-OO247V4J.cjs.map +1 -0
  48. package/dist/chunk-PMKWYOOX.cjs +64 -0
  49. package/dist/chunk-PMKWYOOX.cjs.map +1 -0
  50. package/dist/chunk-PNQY6OFB.cjs +132 -0
  51. package/dist/chunk-PNQY6OFB.cjs.map +1 -0
  52. package/dist/chunk-Q7SFCCGT.cjs +11 -0
  53. package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
  54. package/dist/chunk-TMLNVU5W.cjs +318 -0
  55. package/dist/chunk-TMLNVU5W.cjs.map +1 -0
  56. package/dist/chunk-TRJYDVWK.cjs +623 -0
  57. package/dist/chunk-TRJYDVWK.cjs.map +1 -0
  58. package/dist/chunk-UGG7MCX4.cjs +34 -0
  59. package/dist/chunk-UGG7MCX4.cjs.map +1 -0
  60. package/dist/chunk-WGPFR7MN.cjs +808 -0
  61. package/dist/chunk-WGPFR7MN.cjs.map +1 -0
  62. package/dist/chunk-WGZZKCJQ.cjs +157 -0
  63. package/dist/chunk-WGZZKCJQ.cjs.map +1 -0
  64. package/dist/devtools/index.cjs +13 -697
  65. package/dist/devtools/index.cjs.map +1 -1
  66. package/dist/document/index.cjs +56 -301
  67. package/dist/document/index.cjs.map +1 -1
  68. package/dist/examples/index.cjs +6 -31
  69. package/dist/examples/index.cjs.map +1 -1
  70. package/dist/i18n/index.cjs +44 -292
  71. package/dist/i18n/index.cjs.map +1 -1
  72. package/dist/index.cjs +335 -3954
  73. package/dist/index.cjs.map +1 -1
  74. package/dist/migrations/index.cjs +7 -590
  75. package/dist/migrations/index.cjs.map +1 -1
  76. package/dist/reflect/index.cjs +85 -994
  77. package/dist/reflect/index.cjs.map +1 -1
  78. package/package.json +5 -5
  79. package/dist/{primitive-props-CGoJvmcH.d.cts → primitive-props-Cl5jiC8g.d.cts} +5 -5
  80. package/dist/{primitive-props-CGoJvmcH.d.ts → primitive-props-Cl5jiC8g.d.ts} +5 -5
@@ -1,592 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var zod = require('zod');
4
-
5
- // src/action/schemas/index.ts
6
- zod.z.object({
7
- $if: zod.z.unknown().describe("Condition \u2014 resolved recursively, then checked for truthiness."),
8
- $then: zod.z.unknown().describe("Value when condition is truthy \u2014 resolved recursively."),
9
- $else: zod.z.unknown().optional().describe("Value when condition is falsy \u2014 resolved recursively.")
10
- }).strict().describe("Conditional value directive. Resolved at bind time.");
11
- var ResolvableSchema = zod.z.unknown().describe(
12
- 'Any value. Strings support {{}} templates and bare $-paths. The data ROOT is "$." \u2014 a data key is ALWAYS "$.key" ("{{$.rows.length}} found", "$.loading"); "$key" without the dot is INVALID. Loop variables (a `for` directive\'s `as`) are "$<name>.field" ("{{$row.title}}"). Objects may be directives like {$if,$then,$else}. Arrays and nested objects are walked recursively. Everything else is literal.'
13
- );
14
-
15
- // src/layout/schemas.ts
16
- var LayoutPrimitiveSchema = zod.z.union([zod.z.string(), zod.z.number(), zod.z.boolean(), zod.z.null()]).describe("A primitive layout value rendered as text.");
17
- var ComponentNodeSchema = zod.z.lazy(
18
- () => zod.z.object({
19
- component: zod.z.string().describe("The registry name of the component to render."),
20
- props: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe("Component props; values may be bindings to be resolved at render time."),
21
- children: zod.z.union([LayoutNodeSchema, zod.z.array(LayoutNodeSchema)]).optional().describe("Child layout content (a single node or an array of nodes)."),
22
- ref: zod.z.string().optional().describe("A stable identifier used to target this component from event handlers."),
23
- model: zod.z.string().optional().describe('A two-way binding path, e.g. "$.name".'),
24
- events: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe("Map of event name to event configuration handled by the action runtime.")
25
- }).strict().describe("A node that instantiates a component from the registry.")
26
- );
27
- var ConditionalNodeSchema = zod.z.lazy(
28
- () => zod.z.object({
29
- if: ResolvableSchema.describe("Resolvable value evaluated for truthiness."),
30
- then: LayoutNodeSchema.describe("Layout to render when condition is truthy."),
31
- else: LayoutNodeSchema.optional().describe("Layout to render when condition is falsy.")
32
- }).strict().describe("A node that conditionally renders one of two branches.")
33
- );
34
- var LoopNodeSchema = zod.z.lazy(
35
- () => zod.z.object({
36
- for: ResolvableSchema.describe("Resolvable value that resolves to an iterable array."),
37
- as: zod.z.string().describe("Name to bind each iterated item under in the inner scope."),
38
- key: zod.z.string().optional().describe("Optional key path on each item used for stable identity."),
39
- do: LayoutNodeSchema.describe("Layout rendered once per iterated item.")
40
- }).strict().describe("A node that iterates an array binding and renders a layout for each item.")
41
- );
42
- var LayoutRefNodeSchema = zod.z.object({
43
- ref: zod.z.string().describe("Identifier of a layout stored in the layout store to inline at this position.")
44
- }).strict().describe("A reference to a stored layout, inlined during render.");
45
- var SlotNodeSchema = zod.z.object({
46
- slot: zod.z.string().describe(
47
- "Name of a slot placeholder. When an ActionFragment is composed with an action (a push/replace `with`), the fragment's `{ slot: \"body\" }` node is replaced by the composing action's own layout. An unfilled slot renders nothing."
48
- )
49
- }).strict().describe(
50
- "A placeholder that a fragment-merge fills with a composing action's layout. Only meaningful inside an ActionFragment's layout."
51
- );
52
- var LayoutNodeSchema = zod.z.lazy(
53
- () => zod.z.union([
54
- ComponentNodeSchema,
55
- ConditionalNodeSchema,
56
- LoopNodeSchema,
57
- LayoutRefNodeSchema,
58
- SlotNodeSchema,
59
- zod.z.array(LayoutNodeSchema),
60
- LayoutPrimitiveSchema
61
- ]).describe("Any layout node: component, conditional, loop, layout ref, slot, array of nodes, or a primitive text value.")
62
- );
63
-
64
- // src/shared/common.ts
65
- var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
66
- var isArray = (value) => Array.isArray(value);
67
- var hasKey = (obj, key) => isObject(obj) && key in obj;
68
-
69
- // src/shared/bindings/paths.ts
70
- var splitPath = (path) => {
71
- if (path.length === 0) return [];
72
- return path.split(".");
73
- };
74
- var isIndex = (segment) => /^\d+$/.test(segment);
75
- var cloneContainer = (value, nextSegment) => {
76
- if (isArray(value)) return value.slice();
77
- if (isObject(value)) return { ...value };
78
- if (nextSegment !== void 0 && isIndex(nextSegment)) return [];
79
- return {};
80
- };
81
- var writeSegment = (container, segment, value) => {
82
- if (isArray(container)) {
83
- if (isIndex(segment)) {
84
- const index = Number.parseInt(segment, 10);
85
- container[index] = value;
86
- }
87
- return;
88
- }
89
- container[segment] = value;
90
- };
91
- var readSegment = (container, segment) => {
92
- if (isArray(container)) {
93
- if (!isIndex(segment)) return void 0;
94
- const index = Number.parseInt(segment, 10);
95
- return container[index];
96
- }
97
- return container[segment];
98
- };
99
- var getPath = (data, path) => {
100
- const segments = splitPath(path);
101
- let current = data;
102
- for (const segment of segments) {
103
- if (current === void 0 || current === null) return void 0;
104
- if (isArray(current)) {
105
- if (isIndex(segment)) {
106
- const index = Number.parseInt(segment, 10);
107
- current = current[index];
108
- continue;
109
- }
110
- if (segment === "length") {
111
- current = current.length;
112
- continue;
113
- }
114
- return void 0;
115
- }
116
- if (isObject(current)) {
117
- if (segment in current) {
118
- current = current[segment];
119
- continue;
120
- }
121
- return void 0;
122
- }
123
- return void 0;
124
- }
125
- return current;
126
- };
127
- var setPath = (data, path, value) => {
128
- const segments = splitPath(path);
129
- if (segments.length === 0) return value;
130
- const root = cloneContainer(data, segments[0]);
131
- let parent = root;
132
- for (let i = 0; i < segments.length - 1; i += 1) {
133
- const segment = segments[i];
134
- const nextSegment = segments[i + 1];
135
- if (segment === void 0) continue;
136
- const existing = readSegment(parent, segment);
137
- const cloned = cloneContainer(existing, nextSegment);
138
- writeSegment(parent, segment, cloned);
139
- parent = cloned;
140
- }
141
- const last = segments[segments.length - 1];
142
- if (last !== void 0) writeSegment(parent, last, value);
143
- return root;
144
- };
145
- var deletePath = (data, path) => {
146
- const segments = splitPath(path);
147
- if (segments.length === 0) return void 0;
148
- const root = cloneContainer(data, segments[0]);
149
- let parent = root;
150
- for (let i = 0; i < segments.length - 1; i += 1) {
151
- const segment = segments[i];
152
- const nextSegment = segments[i + 1];
153
- if (segment === void 0) continue;
154
- const existing = readSegment(parent, segment);
155
- if (existing === void 0 || existing === null) return root;
156
- const cloned = cloneContainer(existing, nextSegment);
157
- writeSegment(parent, segment, cloned);
158
- parent = cloned;
159
- }
160
- const last = segments[segments.length - 1];
161
- if (last === void 0) return root;
162
- if (isArray(parent)) {
163
- if (isIndex(last)) {
164
- const index = Number.parseInt(last, 10);
165
- parent.splice(index, 1);
166
- }
167
- } else {
168
- delete parent[last];
169
- }
170
- return root;
171
- };
172
-
173
- // src/action/mutations/ops/set.ts
174
- var SetByValueSchema = zod.z.object({
175
- set: zod.z.string().describe('Data path to write to, e.g. "user.name" or "items.0.title".'),
176
- value: zod.z.unknown().describe("Literal value to write at the path.")
177
- }).strict().describe("Set a field at a path to a literal value.");
178
- var SetByFromSchema = zod.z.object({
179
- set: zod.z.string().describe("Data path to write to."),
180
- from: zod.z.string().describe("Data path (or template path) to read the value from.")
181
- }).strict().describe("Set a field at a path by copying from another path.");
182
- var setValueOp = {
183
- key: "set",
184
- schema: SetByValueSchema,
185
- match: (mutation) => hasKey(mutation, "set") && hasKey(mutation, "value"),
186
- apply: (data, mutation) => {
187
- const next = setPath(data, mutation.set, mutation.value);
188
- return isObject(next) ? next : data;
189
- }
190
- };
191
- var setFromOp = {
192
- key: "set",
193
- schema: SetByFromSchema,
194
- match: (mutation) => hasKey(mutation, "set") && hasKey(mutation, "from"),
195
- apply: (data, mutation) => {
196
- const value = getPath(data, mutation.from);
197
- const next = setPath(data, mutation.set, value);
198
- return isObject(next) ? next : data;
199
- }
200
- };
201
- var ToggleSchema = zod.z.object({
202
- toggle: zod.z.string().describe("Boolean data path to flip.")
203
- }).strict().describe("Flip a boolean at the given path.");
204
- var toggleOp = {
205
- key: "toggle",
206
- schema: ToggleSchema,
207
- apply: (data, mutation) => {
208
- const current = getPath(data, mutation.toggle);
209
- const flipped = !(current === true);
210
- const next = setPath(data, mutation.toggle, flipped);
211
- return isObject(next) ? next : data;
212
- }
213
- };
214
- var IncrementSchema = zod.z.object({
215
- increment: zod.z.string().describe("Numeric data path to increment."),
216
- by: zod.z.number().optional().describe("Amount to increment by; defaults to 1.")
217
- }).strict().describe("Increment a numeric field.");
218
- var incrementOp = {
219
- key: "increment",
220
- schema: IncrementSchema,
221
- apply: (data, mutation) => {
222
- const current = getPath(data, mutation.increment);
223
- const base = typeof current === "number" ? current : 0;
224
- const by = mutation.by ?? 1;
225
- const next = setPath(data, mutation.increment, base + by);
226
- return isObject(next) ? next : data;
227
- }
228
- };
229
- var DecrementSchema = zod.z.object({
230
- decrement: zod.z.string().describe("Numeric data path to decrement."),
231
- by: zod.z.number().optional().describe("Amount to decrement by; defaults to 1.")
232
- }).strict().describe("Decrement a numeric field.");
233
- var decrementOp = {
234
- key: "decrement",
235
- schema: DecrementSchema,
236
- apply: (data, mutation) => {
237
- const current = getPath(data, mutation.decrement);
238
- const base = typeof current === "number" ? current : 0;
239
- const by = mutation.by ?? 1;
240
- const next = setPath(data, mutation.decrement, base - by);
241
- return isObject(next) ? next : data;
242
- }
243
- };
244
-
245
- // src/shared/errors.ts
246
- var ErrorCodes = {
247
- mutation: "MUTATION_ERROR"};
248
- var NovaError = class extends Error {
249
- code;
250
- context;
251
- constructor(code, message, context, options) {
252
- super(message, options);
253
- this.name = "NovaError";
254
- this.code = code;
255
- this.context = context;
256
- }
257
- };
258
- var MutationError = class extends NovaError {
259
- constructor(message, context, options) {
260
- super(ErrorCodes.mutation, message, context, options);
261
- this.name = "MutationError";
262
- }
263
- };
264
-
265
- // src/action/mutations/ops/push.ts
266
- var PushSchema = zod.z.object({
267
- push: zod.z.string().describe("Array data path to append to."),
268
- value: zod.z.unknown().optional().describe("Value to append.")
269
- }).strict().describe("Append a value to an array field.");
270
- var pushOp = {
271
- key: "push",
272
- schema: PushSchema,
273
- // Guard against the PushEffect navigation effect whose `push` is an object.
274
- match: (mutation) => typeof mutation.push === "string",
275
- apply: (data, mutation, ctx) => {
276
- const current = getPath(data, mutation.push);
277
- if (current !== void 0 && !isArray(current)) {
278
- if (ctx.strict) {
279
- throw new MutationError(
280
- `push: path "${mutation.push}" is not an array`,
281
- { op: "push", path: mutation.push, reason: "wrong-type" }
282
- );
283
- }
284
- return data;
285
- }
286
- if (current === void 0 && ctx.strict) {
287
- throw new MutationError(
288
- `push: path "${mutation.push}" does not exist`,
289
- { op: "push", path: mutation.push, reason: "missing" }
290
- );
291
- }
292
- const arr = isArray(current) ? current.slice() : [];
293
- arr.push(mutation.value);
294
- const next = setPath(data, mutation.push, arr);
295
- return isObject(next) ? next : data;
296
- }
297
- };
298
- var PopSchema = zod.z.object({
299
- pop: zod.z.string().describe("Array data path to remove the last element from.")
300
- }).strict().describe("Remove the last element from an array field.");
301
- var popOp = {
302
- key: "pop",
303
- schema: PopSchema,
304
- // Guard against the PopEffect whose `pop` is the literal `true`.
305
- match: (mutation) => typeof mutation.pop === "string",
306
- apply: (data, mutation, ctx) => {
307
- const current = getPath(data, mutation.pop);
308
- if (!isArray(current)) {
309
- if (ctx.strict) {
310
- throw new MutationError(
311
- `pop: path "${mutation.pop}" ${current === void 0 ? "does not exist" : "is not an array"}`,
312
- { op: "pop", path: mutation.pop, reason: current === void 0 ? "missing" : "wrong-type" }
313
- );
314
- }
315
- return data;
316
- }
317
- const arr = current.slice();
318
- arr.pop();
319
- const next = setPath(data, mutation.pop, arr);
320
- return isObject(next) ? next : data;
321
- }
322
- };
323
- var RemoveAtSchema = zod.z.object({
324
- removeAt: zod.z.string().describe("Array data path to remove an element from."),
325
- index: zod.z.union([zod.z.number().int(), zod.z.string()]).describe('Index to remove. A string is a template (e.g. "{{@event.payload}}") resolved before applying.')
326
- }).strict().describe("Remove an element at a specific index of an array field.");
327
- var removeAtOp = {
328
- key: "removeAt",
329
- schema: RemoveAtSchema,
330
- apply: (data, mutation, ctx) => {
331
- const current = getPath(data, mutation.removeAt);
332
- if (!isArray(current)) {
333
- if (ctx.strict) {
334
- throw new MutationError(
335
- `removeAt: path "${mutation.removeAt}" ${current === void 0 ? "does not exist" : "is not an array"}`,
336
- {
337
- op: "removeAt",
338
- path: mutation.removeAt,
339
- reason: current === void 0 ? "missing" : "wrong-type"
340
- }
341
- );
342
- }
343
- return data;
344
- }
345
- const index = Number(mutation.index);
346
- if (!Number.isInteger(index)) return data;
347
- const arr = current.slice();
348
- arr.splice(index, 1);
349
- const next = setPath(data, mutation.removeAt, arr);
350
- return isObject(next) ? next : data;
351
- }
352
- };
353
- var MoveSchema = zod.z.object({
354
- move: zod.z.string().describe("Array data path to reorder within."),
355
- from: zod.z.union([zod.z.number().int(), zod.z.string()]).describe('Index to move. A string is a template (e.g. "{{@event.payload}}") resolved before applying.'),
356
- to: zod.z.union([zod.z.number().int(), zod.z.string()]).describe("Destination index. A string is a template resolved before applying.")
357
- }).strict().describe("Move an array element from one index to another.");
358
- var moveOp = {
359
- key: "move",
360
- schema: MoveSchema,
361
- apply: (data, mutation, ctx) => {
362
- const current = getPath(data, mutation.move);
363
- if (!isArray(current)) {
364
- if (ctx.strict) {
365
- throw new MutationError(
366
- `move: path "${mutation.move}" ${current === void 0 ? "does not exist" : "is not an array"}`,
367
- {
368
- op: "move",
369
- path: mutation.move,
370
- reason: current === void 0 ? "missing" : "wrong-type"
371
- }
372
- );
373
- }
374
- return data;
375
- }
376
- const from = Number(mutation.from);
377
- const to = Number(mutation.to);
378
- if (!Number.isInteger(from) || !Number.isInteger(to)) return data;
379
- if (from < 0 || from >= current.length) return data;
380
- const arr = current.slice();
381
- const [item] = arr.splice(from, 1);
382
- arr.splice(Math.max(0, Math.min(to, arr.length)), 0, item);
383
- const next = setPath(data, mutation.move, arr);
384
- return isObject(next) ? next : data;
385
- }
386
- };
387
- var ClearSchema = zod.z.object({
388
- clear: zod.z.string().describe("Array or object data path to clear.")
389
- }).strict().describe("Clear an array or object field.");
390
- var clearOp = {
391
- key: "clear",
392
- schema: ClearSchema,
393
- apply: (data, mutation, ctx) => {
394
- const current = getPath(data, mutation.clear);
395
- if (isArray(current)) {
396
- const next2 = setPath(data, mutation.clear, []);
397
- return isObject(next2) ? next2 : data;
398
- }
399
- if (isObject(current)) {
400
- const next2 = setPath(data, mutation.clear, {});
401
- return isObject(next2) ? next2 : data;
402
- }
403
- if (ctx.strict) {
404
- throw new MutationError(
405
- `clear: path "${mutation.clear}" ${current === void 0 ? "does not exist" : "is not an array or object"}`,
406
- {
407
- op: "clear",
408
- path: mutation.clear,
409
- reason: current === void 0 ? "missing" : "wrong-type"
410
- }
411
- );
412
- }
413
- const next = deletePath(data, mutation.clear);
414
- return isObject(next) ? next : data;
415
- }
416
- };
417
- var ResetSchema = zod.z.object({
418
- reset: zod.z.string().describe("Data path to reset to its initial (definition.data) value.")
419
- }).strict().describe("Reset a field to its initial value from the action definition.");
420
- var resetOp = {
421
- key: "reset",
422
- schema: ResetSchema,
423
- apply: (data, mutation, ctx) => {
424
- const initialValue = getPath(ctx.initial, mutation.reset);
425
- const next = setPath(data, mutation.reset, initialValue);
426
- return isObject(next) ? next : data;
427
- }
428
- };
429
-
430
- // src/action/mutations/ops/index.ts
431
- var OPS = [
432
- setValueOp,
433
- setFromOp,
434
- toggleOp,
435
- incrementOp,
436
- decrementOp,
437
- pushOp,
438
- popOp,
439
- removeAtOp,
440
- moveOp,
441
- clearOp,
442
- resetOp
443
- ];
444
- var MutationSchema = zod.z.union(
445
- OPS.map((op) => op.schema)
446
- ).describe("A single immutable mutation applied to the action data.");
447
- var HttpEndpointSchema = zod.z.object({
448
- url: zod.z.string().describe('Template URL, e.g. "/api/users/{{$.userId}}".'),
449
- method: zod.z.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]).describe("HTTP method."),
450
- headers: zod.z.record(zod.z.string(), zod.z.string()).optional().describe("Static request headers."),
451
- request: zod.z.unknown().optional().describe(
452
- 'Transform config run by the injected evaluator over the ACTION DATA to build the request body \u2014 EVALUATED ON EVERY CALL, so body values can follow screen state. Static parts are literal JSON; a dynamic part is an evaluator op over the data root, e.g. { "q": { "$ref": "$.search" } } makes body field q carry the current $.search each call. Requires an injected transform.'
453
- ),
454
- response: zod.z.unknown().optional().describe(
455
- "Transform config run by the injected evaluator over the reply as received (`$` is the reply \u2014 object, array, or scalar) to produce the value stored at `target`. Requires an injected transform."
456
- ),
457
- target: zod.z.string().optional().describe("Data path to store the result at on success."),
458
- errorTarget: zod.z.string().optional().describe("Data path to store the error at on failure."),
459
- timeoutMs: zod.z.number().int().positive().optional().describe("How long to wait for the reply, in ms, before the call fails to onError. Defaults to the shell default (30000). Set it on an endpoint that is slow by nature \u2014 a model call that may take minutes.")
460
- }).strict().describe("A named HTTP call. `request`/`response` shape the body/reply via the injected transform.");
461
- var FunctionEndpointSchema = zod.z.object({
462
- fn: zod.z.string().describe(
463
- "Key of a function registered in `ShellConfig.functions`. The host must register the name before the action runs."
464
- ),
465
- target: zod.z.string().optional().describe("Data path to store the return value at on success."),
466
- errorTarget: zod.z.string().optional().describe("Data path to store the error at on failure."),
467
- timeoutMs: zod.z.number().int().positive().optional().describe("How long to wait for the reply, in ms, before the call fails to onError. Defaults to the shell default (30000). Set it on an endpoint that is slow by nature \u2014 a model call that may take minutes.")
468
- }).strict().describe("A named local function call. Handler is provided via `ShellConfig.functions`.");
469
- var EndpointConfigSchema = zod.z.union([HttpEndpointSchema, FunctionEndpointSchema]).describe("An endpoint \u2014 either an HTTP call or a local function.");
470
- var StepSchema = zod.z.lazy(
471
- () => zod.z.union([MutationSchema, EffectSchema]).describe("A step is either a mutation or an effect.")
472
- );
473
- var CallEffectSchema = zod.z.lazy(
474
- () => zod.z.object({
475
- call: zod.z.string().describe("Name of the endpoint to invoke."),
476
- onSuccess: zod.z.array(StepSchema).optional().describe("Steps to run after a successful response."),
477
- onError: zod.z.array(StepSchema).optional().describe("Steps to run after an error response (with @error scope available).")
478
- }).strict().describe("Invoke a named endpoint with optional success/error step branches.")
479
- );
480
- var EmitEffectSchema = zod.z.object({
481
- emit: zod.z.object({
482
- channel: zod.z.string().describe("Channel name to publish on."),
483
- payload: zod.z.unknown().optional().describe("Payload to publish; templates are resolved against the current data.")
484
- }).strict().describe("Channel + payload to publish.")
485
- }).strict().describe("Publish a payload to a message channel.");
486
- var PushEffectSchema = zod.z.object({
487
- push: zod.z.object({
488
- action: zod.z.string().describe("Definition id of the action to push onto a canvas \u2014 MUST be an id that actually exists (an unknown id fails at click time, invisible to a mount check)."),
489
- canvas: zod.z.string().optional().describe("Canvas id to push onto; defaults to the current canvas."),
490
- input: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe("Initial input merged into the new action data. Keys must belong to the target action's declared input contract \u2014 invented keys are silently useless."),
491
- with: zod.z.array(zod.z.string()).optional().describe("Fragment ids to compose the action with before it is instantiated. Each wraps the action (the action fills its `{ slot }`) and contributes its triggers/data; the action wins on conflict. See ActionFragment.")
492
- }).strict().describe("Push parameters.")
493
- }).strict().describe("Push a new action onto a canvas (escapes via onNavigate callback).");
494
- var PopEffectSchema = zod.z.object({
495
- pop: zod.z.literal(true).describe("Sentinel literal \u2014 must be true.")
496
- }).strict().describe("Pop the current action (escapes via onNavigate callback).");
497
- var ReplaceEffectSchema = zod.z.object({
498
- replace: zod.z.object({
499
- action: zod.z.string().describe("Definition id of the replacement action."),
500
- canvas: zod.z.string().optional().describe("Canvas id to replace on; defaults to the current canvas."),
501
- input: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe("Initial input merged into the new action data."),
502
- with: zod.z.array(zod.z.string()).optional().describe("Fragment ids to compose the action with before it is instantiated. Each wraps the action (the action fills its `{ slot }`) and contributes its triggers/data; the action wins on conflict. See ActionFragment.")
503
- }).strict().describe("Replace parameters.")
504
- }).strict().describe("Replace the current action (escapes via onNavigate callback).");
505
- var PopToEffectSchema = zod.z.object({
506
- popTo: zod.z.object({
507
- canvas: zod.z.string().optional().describe("Canvas id to pop on; defaults to the current canvas."),
508
- instance: zod.z.string().describe("Pop the canvas until this instance id is on top (no-op if absent).")
509
- }).strict().describe("Pop-to-instance parameters.")
510
- }).strict().describe("Pop a canvas down to a given instance (escapes via onNavigate callback).");
511
- var ResetToEffectSchema = zod.z.object({
512
- resetTo: zod.z.object({
513
- action: zod.z.string().describe("Definition id of the new root action."),
514
- canvas: zod.z.string().optional().describe("Canvas id to reset; defaults to the current canvas."),
515
- input: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe("Initial input merged into the new root action."),
516
- with: zod.z.array(zod.z.string()).optional().describe("Fragment ids to compose the action with. See ActionFragment.")
517
- }).strict().describe("Reset parameters.")
518
- }).strict().describe("Clear a canvas and push a single new root action (escapes via onNavigate callback).");
519
- var RemoveInstanceEffectSchema = zod.z.object({
520
- removeInstance: zod.z.object({
521
- canvas: zod.z.string().optional().describe("Canvas id to remove from; defaults to the current canvas."),
522
- instance: zod.z.string().describe("Instance id to unmount and drop from the stack (no-op if absent).")
523
- }).strict().describe("Remove-instance parameters.")
524
- }).strict().describe("Remove one instance anywhere in a canvas stack (escapes via onNavigate callback).");
525
- var RemoveSelfEffectSchema = zod.z.object({
526
- removeSelf: zod.z.literal(true).describe("Sentinel literal \u2014 must be true. Removes the firing instance (desugars to removeInstance).")
527
- }).strict().describe("Close the firing instance \u2014 the list-card X (escapes via onNavigate callback).");
528
- var ReconcileEffectSchema = zod.z.object({
529
- reconcile: zod.z.object({
530
- to: zod.z.string().describe('Binding to the desired list, e.g. "$.tools" \u2014 an array of rows; anything else is an empty list.'),
531
- action: zod.z.string().describe('The row field naming the action to place, e.g. "tool_id". Rows without it are skipped.'),
532
- input: zod.z.string().optional().describe("The row field holding that action's input (an object), if any."),
533
- canvas: zod.z.string().optional().describe("Canvas id to reconcile; defaults to the current canvas."),
534
- own: zod.z.enum(["pushed", "canvas"]).optional().describe('What this step may remove: "pushed" (default) only what this action placed there; "canvas" everything on it \u2014 for an action that owns the canvas outright.'),
535
- with: zod.z.array(zod.z.string()).optional().describe("Fragment ids to compose each placed action with. See ActionFragment.")
536
- }).strict().describe("Reconcile parameters.")
537
- }).strict().describe("Make a canvas hold exactly the actions a list names: push the missing, remove the unlisted, keep the rest mounted (escapes via onNavigate callback).");
538
- var ReloadEffectSchema = zod.z.object({
539
- reload: zod.z.literal(true).describe("Sentinel literal \u2014 must be true. Re-runs this instance's mount hook.")
540
- }).strict().describe("Re-read the firing instance in place \u2014 the list-card open.");
541
- var EffectSchema = zod.z.lazy(
542
- () => zod.z.union([CallEffectSchema, EmitEffectSchema, PushEffectSchema, PopEffectSchema, ReplaceEffectSchema, PopToEffectSchema, ResetToEffectSchema, RemoveInstanceEffectSchema, RemoveSelfEffectSchema, ReconcileEffectSchema, ReloadEffectSchema]).describe("An effect that touches the outside world.")
543
- );
544
-
545
- // src/action/schemas/lifecycle.ts
546
- var LifecycleConfigSchema = zod.z.object({
547
- mount: zod.z.array(StepSchema).optional().describe("Steps to run when the action mounts."),
548
- unmount: zod.z.array(StepSchema).optional().describe("Steps to run when the action unmounts."),
549
- suspend: zod.z.array(StepSchema).optional().describe("Steps to run when the action is suspended."),
550
- resume: zod.z.array(StepSchema).optional().describe("Steps to run when the action resumes.")
551
- }).strict().describe("Lifecycle hooks for the action runtime state machine.");
552
- var TriggerConfigSchema = zod.z.object({
553
- event: zod.z.string().optional().describe(`UI event type to listen for: "ui:click" (activations, incl. table rows), "ui:model" (an input's value changed), "ui:key".`),
554
- message: zod.z.string().optional().describe("Message bus channel name to listen on (fired by an `emit` step, possibly from another action)."),
555
- ref: zod.z.string().optional().describe("Component ref to filter events by \u2014 MUST match a `ref` carried by a node in this action's layout; a trigger on a ref no layout node carries never fires."),
556
- key: zod.z.string().optional().describe('Key to filter "ui:key" events by, e.g. "ArrowDown".'),
557
- do: zod.z.array(StepSchema).describe(`Ordered steps to execute when the trigger fires. Steps may reference the firing event as "@event" \u2014 "@event.payload" is the fired value (a table row click: the row's clickKey/rowKey field; an input's ui:model: the typed text).`)
558
- }).strict().refine((trigger) => trigger.event !== void 0 || trigger.message !== void 0, {
559
- message: 'A trigger must specify either "event" or "message".'
560
- }).describe("Binds an event or message source to an ordered sequence of steps.");
561
-
562
- // src/action/schemas/index.ts
563
- var ActionDefinitionSchema = zod.z.object({
564
- id: zod.z.string().describe("Stable definition id."),
565
- name: zod.z.string().optional().describe("Human-readable name."),
566
- description: zod.z.string().optional().describe("Free-form description."),
567
- title: zod.z.string().optional().describe(
568
- "A resolvable label for this instance, evaluated against its own data (e.g. '{{$.view.record.name}}'). Exposed as `instance.title` on a canvas's actionLayout scope so stack-nav chrome can label crumbs/tabs; falls back to `name` then the action id."
569
- ),
570
- layout: zod.z.union([zod.z.string(), LayoutNodeSchema]).optional().describe("Either a layout id stored in the layout store, or an inline LayoutNode."),
571
- data: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe("Static default data merged with input on mount."),
572
- input: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe(
573
- "JSON Schema of the data keys an opener may seed when loading this action \u2014 its public, openable-input contract (author in Zod, convert with z.toJSONSchema). Fields must be a subset of `data`. Descriptive only: the runtime does not validate loads against it."
574
- ),
575
- triggers: zod.z.array(TriggerConfigSchema).optional().describe("Event/message triggers."),
576
- endpoints: zod.z.record(zod.z.string(), EndpointConfigSchema).optional().describe("Named endpoints \u2014 HTTP calls or local functions."),
577
- lifecycle: LifecycleConfigSchema.optional().describe("Lifecycle hooks.")
578
- }).strict().describe("Definition of an action: layout + data + behavior.");
579
- var ActionFragmentSchema = zod.z.object({
580
- kind: zod.z.literal("fragment").describe("Discriminator \u2014 marks this as an abstract, merge-only fragment."),
581
- id: zod.z.string().describe("Stable fragment id, referenced from a push/replace `with: [...]`."),
582
- name: zod.z.string().optional().describe("Human-readable name."),
583
- description: zod.z.string().optional().describe("Free-form description."),
584
- layout: zod.z.union([zod.z.string(), LayoutNodeSchema]).optional().describe('The wrapping (chrome) layout, or a layout id. Put a `{ slot: "body" }` node where the composing action\'s own layout is dropped in.'),
585
- data: zod.z.record(zod.z.string(), zod.z.unknown()).optional().describe("Partial default data; deep-merged under the action (the action wins on conflict)."),
586
- triggers: zod.z.array(TriggerConfigSchema).optional().describe("Pre-wired triggers (e.g. a modal's close/cancel). Concatenated before the action's triggers."),
587
- endpoints: zod.z.record(zod.z.string(), EndpointConfigSchema).optional().describe("Named endpoints, merged under the action (the action wins on a name clash)."),
588
- lifecycle: LifecycleConfigSchema.optional().describe("Lifecycle hooks; per-hook steps run before the action's.")
589
- }).strict().describe("A reusable partial action \u2014 layout + wired behavior \u2014 merged into a concrete action at a push `with`. Abstract: only exists merged, never instantiated alone.");
3
+ var chunkFSUMCJAR_cjs = require('../chunk-FSUMCJAR.cjs');
4
+ var chunkD4PUWBN6_cjs = require('../chunk-D4PUWBN6.cjs');
5
+ require('../chunk-KW34ZKF5.cjs');
6
+ require('../chunk-Q7SFCCGT.cjs');
590
7
 
591
8
  // src/migrations/index.ts
592
9
  var actionEmbeds = {
@@ -624,9 +41,9 @@ var NOVA_SEQUENCE = {
624
41
  ]
625
42
  };
626
43
  var NOVA_SCHEMAS = {
627
- "nisc.nova/action": ActionDefinitionSchema,
628
- "nisc.nova/fragment": ActionFragmentSchema,
629
- "nisc.nova/layout": LayoutNodeSchema
44
+ "nisc.nova/action": chunkFSUMCJAR_cjs.ActionDefinitionSchema,
45
+ "nisc.nova/fragment": chunkFSUMCJAR_cjs.ActionFragmentSchema,
46
+ "nisc.nova/layout": chunkD4PUWBN6_cjs.LayoutNodeSchema
630
47
  };
631
48
 
632
49
  exports.NOVA_SCHEMAS = NOVA_SCHEMAS;