@camstack/types 1.2.264 → 1.2.265

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.
@@ -207,10 +207,10 @@ export declare const OsdSlotBindingSchema: z.ZodObject<{
207
207
  zoneId: z.ZodOptional<z.ZodString>;
208
208
  className: z.ZodOptional<z.ZodString>;
209
209
  op: z.ZodDefault<z.ZodEnum<{
210
+ "<=": "<=";
211
+ ">=": ">=";
210
212
  "became-occupied": "became-occupied";
211
213
  "became-free": "became-free";
212
- ">=": ">=";
213
- "<=": "<=";
214
214
  }>>;
215
215
  count: z.ZodDefault<z.ZodNumber>;
216
216
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -392,10 +392,10 @@ export declare const OsdSlotViewSchema: z.ZodObject<{
392
392
  zoneId: z.ZodOptional<z.ZodString>;
393
393
  className: z.ZodOptional<z.ZodString>;
394
394
  op: z.ZodDefault<z.ZodEnum<{
395
+ "<=": "<=";
396
+ ">=": ">=";
395
397
  "became-occupied": "became-occupied";
396
398
  "became-free": "became-free";
397
- ">=": ">=";
398
- "<=": "<=";
399
399
  }>>;
400
400
  count: z.ZodDefault<z.ZodNumber>;
401
401
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -649,10 +649,10 @@ export declare const osdManagerCapability: {
649
649
  zoneId: z.ZodOptional<z.ZodString>;
650
650
  className: z.ZodOptional<z.ZodString>;
651
651
  op: z.ZodDefault<z.ZodEnum<{
652
+ "<=": "<=";
653
+ ">=": ">=";
652
654
  "became-occupied": "became-occupied";
653
655
  "became-free": "became-free";
654
- ">=": ">=";
655
- "<=": "<=";
656
656
  }>>;
657
657
  count: z.ZodDefault<z.ZodNumber>;
658
658
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -740,10 +740,10 @@ export declare const osdManagerCapability: {
740
740
  }>;
741
741
  operator: z.ZodEnum<{
742
742
  in: "in";
743
+ gte: "gte";
743
744
  notIn: "notIn";
744
745
  anyOf: "anyOf";
745
746
  allOf: "allOf";
746
- gte: "gte";
747
747
  fuzzyIn: "fuzzyIn";
748
748
  withinSchedule: "withinSchedule";
749
749
  }>;
@@ -925,10 +925,10 @@ export declare const osdManagerCapability: {
925
925
  zoneId: z.ZodOptional<z.ZodString>;
926
926
  className: z.ZodOptional<z.ZodString>;
927
927
  op: z.ZodDefault<z.ZodEnum<{
928
+ "<=": "<=";
929
+ ">=": ">=";
928
930
  "became-occupied": "became-occupied";
929
931
  "became-free": "became-free";
930
- ">=": ">=";
931
- "<=": "<=";
932
932
  }>>;
933
933
  count: z.ZodDefault<z.ZodNumber>;
934
934
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -1109,10 +1109,10 @@ export declare const osdManagerCapability: {
1109
1109
  zoneId: z.ZodOptional<z.ZodString>;
1110
1110
  className: z.ZodOptional<z.ZodString>;
1111
1111
  op: z.ZodDefault<z.ZodEnum<{
1112
+ "<=": "<=";
1113
+ ">=": ">=";
1112
1114
  "became-occupied": "became-occupied";
1113
1115
  "became-free": "became-free";
1114
- ">=": ">=";
1115
- "<=": "<=";
1116
1116
  }>>;
1117
1117
  count: z.ZodDefault<z.ZodNumber>;
1118
1118
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -1325,10 +1325,10 @@ export declare const osdManagerCapability: {
1325
1325
  zoneId: z.ZodOptional<z.ZodString>;
1326
1326
  className: z.ZodOptional<z.ZodString>;
1327
1327
  op: z.ZodDefault<z.ZodEnum<{
1328
+ "<=": "<=";
1329
+ ">=": ">=";
1328
1330
  "became-occupied": "became-occupied";
1329
1331
  "became-free": "became-free";
1330
- ">=": ">=";
1331
- "<=": "<=";
1332
1332
  }>>;
1333
1333
  count: z.ZodDefault<z.ZodNumber>;
1334
1334
  sustainSeconds: z.ZodDefault<z.ZodNumber>;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The field graph across every composition, and the cycles in it (D659).
3
+ *
4
+ * A node is ONE field of ONE device (`<addon>/<stableId>#<cap>.<field>`); an
5
+ * edge points from a composed field to each field it reads. A cycle, direct or
6
+ * through another composition, is refused at save by name (spec §2).
7
+ *
8
+ * The graph is built for ONE save: the CANDIDATE composition (the one being
9
+ * validated) plus every STORED composition. The candidate ALWAYS replaces any
10
+ * stored peer that targets the same device, regardless of where that stored
11
+ * peer sits in `stored` — whether a save introduces or removes a cycle must
12
+ * never depend on array order. Two DIFFERENT stored peers that (wrongly)
13
+ * target the same device are corrupted state, not a cycle to resolve by
14
+ * picking one silently; that is refused by name (D391).
15
+ *
16
+ * `findCompositionCycles` reports at least one cycle per cycle-SET (the DFS
17
+ * marks a node `done` after its first expansion) — enough to refuse a save,
18
+ * not to enumerate every elementary cycle through a shared node. A dotted
19
+ * `fieldPath` is matched only as an exact string: a write to `state.value` and
20
+ * a read of `state` would not connect (no nested field writes exist yet).
21
+ */
22
+ import { type Composition, type CompositionSourceRef } from './composition.js';
23
+ export interface CompositionPeer {
24
+ /** The device this composition writes: `composedDeviceRef(blockId)` for a new target. */
25
+ readonly target: CompositionSourceRef;
26
+ readonly composition: Composition;
27
+ }
28
+ export interface CompositionCycle {
29
+ /** Node keys, first and last equal. */
30
+ readonly path: readonly string[];
31
+ }
32
+ /** Two stored compositions both target the same device — refused by name, never silently resolved. */
33
+ export declare class CompositionGraphError extends Error {
34
+ }
35
+ export declare function compositionEdges(candidate: CompositionPeer, stored: readonly CompositionPeer[]): ReadonlyMap<string, readonly string[]>;
36
+ export declare function findCompositionCycles(candidate: CompositionPeer, stored: readonly CompositionPeer[]): readonly CompositionCycle[];
@@ -0,0 +1,264 @@
1
+ /**
2
+ * What the validator says about a composition and what the composer says about
3
+ * a running one: the wire shapes the API returns (D659).
4
+ */
5
+ import { z } from 'zod';
6
+ export declare const CompositionProblemCodeSchema: z.ZodEnum<{
7
+ "source-missing": "source-missing";
8
+ "reserved-variant": "reserved-variant";
9
+ "unknown-capability": "unknown-capability";
10
+ "not-composable": "not-composable";
11
+ "wrong-device-type": "wrong-device-type";
12
+ "has-commands": "has-commands";
13
+ "unknown-field": "unknown-field";
14
+ "nested-field": "nested-field";
15
+ "missing-field": "missing-field";
16
+ "kind-mismatch": "kind-mismatch";
17
+ "may-be-null": "may-be-null";
18
+ "source-unreadable": "source-unreadable";
19
+ "source-capability-missing": "source-capability-missing";
20
+ "source-field-unknown": "source-field-unknown";
21
+ "expression-invalid": "expression-invalid";
22
+ cycle: "cycle";
23
+ "duplicate-target": "duplicate-target";
24
+ }>;
25
+ export type CompositionProblemCode = z.infer<typeof CompositionProblemCodeSchema>;
26
+ /** One refusal, named (D391). `path` points into the composition, e.g. `features[0].fields.celsius`. */
27
+ export declare const CompositionProblemSchema: z.ZodObject<{
28
+ code: z.ZodEnum<{
29
+ "source-missing": "source-missing";
30
+ "reserved-variant": "reserved-variant";
31
+ "unknown-capability": "unknown-capability";
32
+ "not-composable": "not-composable";
33
+ "wrong-device-type": "wrong-device-type";
34
+ "has-commands": "has-commands";
35
+ "unknown-field": "unknown-field";
36
+ "nested-field": "nested-field";
37
+ "missing-field": "missing-field";
38
+ "kind-mismatch": "kind-mismatch";
39
+ "may-be-null": "may-be-null";
40
+ "source-unreadable": "source-unreadable";
41
+ "source-capability-missing": "source-capability-missing";
42
+ "source-field-unknown": "source-field-unknown";
43
+ "expression-invalid": "expression-invalid";
44
+ cycle: "cycle";
45
+ "duplicate-target": "duplicate-target";
46
+ }>;
47
+ path: z.ZodString;
48
+ message: z.ZodString;
49
+ }, z.core.$strip>;
50
+ export type CompositionProblem = z.infer<typeof CompositionProblemSchema>;
51
+ export declare const CompositionFieldKindSchema: z.ZodEnum<{
52
+ string: "string";
53
+ number: "number";
54
+ boolean: "boolean";
55
+ enum: "enum";
56
+ }>;
57
+ export type CompositionFieldKind = z.infer<typeof CompositionFieldKindSchema>;
58
+ /** How a field says "unavailable": `null` when its schema allows it, else the device goes offline (D393). */
59
+ export declare const CompositionUnavailableModeSchema: z.ZodEnum<{
60
+ null: "null";
61
+ offline: "offline";
62
+ }>;
63
+ export type CompositionUnavailableMode = z.infer<typeof CompositionUnavailableModeSchema>;
64
+ /**
65
+ * `derived` reads a source · `clock` reads only `now`, recomputed when a sibling
66
+ * field of its cap changes value · `constant` reads nothing, computed once.
67
+ */
68
+ export declare const CompositionFieldRoleSchema: z.ZodEnum<{
69
+ derived: "derived";
70
+ clock: "clock";
71
+ constant: "constant";
72
+ }>;
73
+ export type CompositionFieldRole = z.infer<typeof CompositionFieldRoleSchema>;
74
+ export declare const CompositionFieldPlanSchema: z.ZodObject<{
75
+ cap: z.ZodString;
76
+ path: z.ZodString;
77
+ featureIndex: z.ZodNumber;
78
+ kind: z.ZodEnum<{
79
+ string: "string";
80
+ number: "number";
81
+ boolean: "boolean";
82
+ enum: "enum";
83
+ }>;
84
+ nullable: z.ZodBoolean;
85
+ required: z.ZodBoolean;
86
+ unavailable: z.ZodEnum<{
87
+ null: "null";
88
+ offline: "offline";
89
+ }>;
90
+ role: z.ZodEnum<{
91
+ derived: "derived";
92
+ clock: "clock";
93
+ constant: "constant";
94
+ }>;
95
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
96
+ source: z.ZodObject<{
97
+ addonId: z.ZodString;
98
+ stableId: z.ZodString;
99
+ }, z.core.$strip>;
100
+ cap: z.ZodString;
101
+ fieldPath: z.ZodString;
102
+ kind: z.ZodLiteral<"from">;
103
+ }, z.core.$strip>, z.ZodObject<{
104
+ kind: z.ZodLiteral<"expression">;
105
+ expr: z.ZodString;
106
+ bindings: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
107
+ source: z.ZodObject<{
108
+ addonId: z.ZodString;
109
+ stableId: z.ZodString;
110
+ }, z.core.$strip>;
111
+ cap: z.ZodString;
112
+ fieldPath: z.ZodString;
113
+ kind: z.ZodLiteral<"from">;
114
+ }, z.core.$strip>, z.ZodObject<{
115
+ kind: z.ZodLiteral<"literal">;
116
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
117
+ }, z.core.$strip>], "kind">>;
118
+ }, z.core.$strip>, z.ZodObject<{
119
+ kind: z.ZodLiteral<"code">;
120
+ code: z.ZodString;
121
+ }, z.core.$strip>], "kind">;
122
+ reads: z.ZodArray<z.ZodObject<{
123
+ source: z.ZodObject<{
124
+ addonId: z.ZodString;
125
+ stableId: z.ZodString;
126
+ }, z.core.$strip>;
127
+ cap: z.ZodString;
128
+ fieldPath: z.ZodString;
129
+ }, z.core.$strip>>;
130
+ }, z.core.$strip>;
131
+ export type CompositionFieldPlan = z.infer<typeof CompositionFieldPlanSchema>;
132
+ export declare const CompositionValidationSchema: z.ZodObject<{
133
+ ok: z.ZodBoolean;
134
+ problems: z.ZodArray<z.ZodObject<{
135
+ code: z.ZodEnum<{
136
+ "source-missing": "source-missing";
137
+ "reserved-variant": "reserved-variant";
138
+ "unknown-capability": "unknown-capability";
139
+ "not-composable": "not-composable";
140
+ "wrong-device-type": "wrong-device-type";
141
+ "has-commands": "has-commands";
142
+ "unknown-field": "unknown-field";
143
+ "nested-field": "nested-field";
144
+ "missing-field": "missing-field";
145
+ "kind-mismatch": "kind-mismatch";
146
+ "may-be-null": "may-be-null";
147
+ "source-unreadable": "source-unreadable";
148
+ "source-capability-missing": "source-capability-missing";
149
+ "source-field-unknown": "source-field-unknown";
150
+ "expression-invalid": "expression-invalid";
151
+ cycle: "cycle";
152
+ "duplicate-target": "duplicate-target";
153
+ }>;
154
+ path: z.ZodString;
155
+ message: z.ZodString;
156
+ }, z.core.$strip>>;
157
+ fields: z.ZodArray<z.ZodObject<{
158
+ cap: z.ZodString;
159
+ path: z.ZodString;
160
+ featureIndex: z.ZodNumber;
161
+ kind: z.ZodEnum<{
162
+ string: "string";
163
+ number: "number";
164
+ boolean: "boolean";
165
+ enum: "enum";
166
+ }>;
167
+ nullable: z.ZodBoolean;
168
+ required: z.ZodBoolean;
169
+ unavailable: z.ZodEnum<{
170
+ null: "null";
171
+ offline: "offline";
172
+ }>;
173
+ role: z.ZodEnum<{
174
+ derived: "derived";
175
+ clock: "clock";
176
+ constant: "constant";
177
+ }>;
178
+ source: z.ZodDiscriminatedUnion<[z.ZodObject<{
179
+ source: z.ZodObject<{
180
+ addonId: z.ZodString;
181
+ stableId: z.ZodString;
182
+ }, z.core.$strip>;
183
+ cap: z.ZodString;
184
+ fieldPath: z.ZodString;
185
+ kind: z.ZodLiteral<"from">;
186
+ }, z.core.$strip>, z.ZodObject<{
187
+ kind: z.ZodLiteral<"expression">;
188
+ expr: z.ZodString;
189
+ bindings: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
190
+ source: z.ZodObject<{
191
+ addonId: z.ZodString;
192
+ stableId: z.ZodString;
193
+ }, z.core.$strip>;
194
+ cap: z.ZodString;
195
+ fieldPath: z.ZodString;
196
+ kind: z.ZodLiteral<"from">;
197
+ }, z.core.$strip>, z.ZodObject<{
198
+ kind: z.ZodLiteral<"literal">;
199
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
200
+ }, z.core.$strip>], "kind">>;
201
+ }, z.core.$strip>, z.ZodObject<{
202
+ kind: z.ZodLiteral<"code">;
203
+ code: z.ZodString;
204
+ }, z.core.$strip>], "kind">;
205
+ reads: z.ZodArray<z.ZodObject<{
206
+ source: z.ZodObject<{
207
+ addonId: z.ZodString;
208
+ stableId: z.ZodString;
209
+ }, z.core.$strip>;
210
+ cap: z.ZodString;
211
+ fieldPath: z.ZodString;
212
+ }, z.core.$strip>>;
213
+ }, z.core.$strip>>;
214
+ }, z.core.$strip>;
215
+ export type CompositionValidation = z.infer<typeof CompositionValidationSchema>;
216
+ /** Mirrors `CoreBlockStatus`, pinned by `core-blocks-source.spec.ts` (Task 11). */
217
+ export declare const CompositionRunStatusSchema: z.ZodEnum<{
218
+ running: "running";
219
+ failed: "failed";
220
+ stopped: "stopped";
221
+ starting: "starting";
222
+ }>;
223
+ export type CompositionRunStatus = z.infer<typeof CompositionRunStatusSchema>;
224
+ export declare const CompositionFieldStateKindSchema: z.ZodEnum<{
225
+ unavailable: "unavailable";
226
+ fresh: "fresh";
227
+ stale: "stale";
228
+ }>;
229
+ export type CompositionFieldStateKind = z.infer<typeof CompositionFieldStateKindSchema>;
230
+ export declare const CompositionFieldStateSchema: z.ZodObject<{
231
+ cap: z.ZodString;
232
+ path: z.ZodString;
233
+ state: z.ZodEnum<{
234
+ unavailable: "unavailable";
235
+ fresh: "fresh";
236
+ stale: "stale";
237
+ }>;
238
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
239
+ reason: z.ZodOptional<z.ZodString>;
240
+ }, z.core.$strip>;
241
+ export type CompositionFieldState = z.infer<typeof CompositionFieldStateSchema>;
242
+ export declare const CompositionBlockStateSchema: z.ZodObject<{
243
+ blockId: z.ZodString;
244
+ deviceId: z.ZodNullable<z.ZodNumber>;
245
+ status: z.ZodEnum<{
246
+ running: "running";
247
+ failed: "failed";
248
+ stopped: "stopped";
249
+ starting: "starting";
250
+ }>;
251
+ reason: z.ZodOptional<z.ZodString>;
252
+ fields: z.ZodArray<z.ZodObject<{
253
+ cap: z.ZodString;
254
+ path: z.ZodString;
255
+ state: z.ZodEnum<{
256
+ unavailable: "unavailable";
257
+ fresh: "fresh";
258
+ stale: "stale";
259
+ }>;
260
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
261
+ reason: z.ZodOptional<z.ZodString>;
262
+ }, z.core.$strip>>;
263
+ }, z.core.$strip>;
264
+ export type CompositionBlockState = z.infer<typeof CompositionBlockStateSchema>;