@camstack/types 1.2.380 → 1.2.382
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/addon.d.ts +2 -0
- package/dist/addon.js +88 -2
- package/dist/addon.mjs +79 -3
- package/dist/capabilities/alerts.cap.d.ts +25 -0
- package/dist/capabilities/battery.cap.d.ts +1 -1
- package/dist/capabilities/caller-stamp.d.ts +4 -3
- package/dist/capabilities/dishwasher.cap.d.ts +178 -0
- package/dist/capabilities/heating-valve.cap.d.ts +39 -0
- package/dist/capabilities/index.d.ts +5 -1
- package/dist/capabilities/storage-admin.cap.d.ts +22 -0
- package/dist/client.js +71 -32
- package/dist/client.mjs +71 -32
- package/dist/{composition-DOwQB_Ua.mjs → composition-CB6PMT9p.mjs} +1 -1
- package/dist/{composition-CUAOHZ38.js → composition-eoYYVfOp.js} +1 -1
- package/dist/device/base-device-provider.d.ts +4 -2
- package/dist/device/device-context.d.ts +2 -0
- package/dist/device/device-control-resolution.d.ts +1 -1
- package/dist/device/device-type.d.ts +5 -1
- package/dist/{err-msg--2RrYiLO.mjs → err-msg-BXKzRBwg.mjs} +4 -0
- package/dist/{err-msg-Bb-s4Xuj.js → err-msg-BhVbr0NX.js} +4 -0
- package/dist/ffmpeg/fmp4-fragment-child.d.ts +2 -2
- package/dist/ffmpeg/process.d.ts +21 -0
- package/dist/generated/addon-api.d.ts +329 -230
- package/dist/generated/addon-cap-facts.d.ts +1 -1
- package/dist/generated/cap-status-types.d.ts +5 -1
- package/dist/generated/capability-router-map.d.ts +8 -2
- package/dist/generated/device-local-state.d.ts +6 -0
- package/dist/generated/device-proxy.d.ts +6 -0
- package/dist/generated/device-scoped-caps.d.ts +1 -1
- package/dist/generated/history-catalog.d.ts +1 -1
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/method-device-selectors.d.ts +1 -1
- package/dist/generated/runtime-state-durability.d.ts +1 -1
- package/dist/helpers/addon-slice-handle.d.ts +4 -0
- package/dist/helpers/trpc-leaf.d.ts +17 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +431 -68
- package/dist/index.mjs +413 -67
- package/dist/interfaces/addon-peer-bytes.d.ts +19 -2
- package/dist/interfaces/config-ui-secrets.d.ts +2 -0
- package/dist/interfaces/config-ui.d.ts +14 -0
- package/dist/node.d.ts +2 -2
- package/dist/node.js +6 -2
- package/dist/node.mjs +6 -3
- package/dist/records/in-memory-records.d.ts +21 -0
- package/dist/records/index.d.ts +3 -0
- package/dist/records/settings-array-adopts-from.d.ts +12 -0
- package/dist/records/settings-brokers-adopts-from.d.ts +10 -0
- package/dist/{sleep-CIGOw58l.js → sleep--L6qY125.js} +572 -47
- package/dist/{sleep-WsrozGDL.mjs → sleep-BOjuyoPC.mjs} +489 -48
- package/package.json +1 -1
|
@@ -156,13 +156,37 @@ function collectSecretConfigKeys(schema) {
|
|
|
156
156
|
* blobs (see {@link isKeychainStoredField}). What a form sends as
|
|
157
157
|
* `secretKeys` so the owner's door knows which values to keep out of the blob.
|
|
158
158
|
*/
|
|
159
|
+
/** Drop fields marked `omitFromSettings` before an integration settings write. */
|
|
160
|
+
function omitTransientConfig(schema, config) {
|
|
161
|
+
const omit = /* @__PURE__ */ new Set();
|
|
162
|
+
for (const section of sectionsOf(schema)) for (const field of fieldsOf(section)) collectOmitted(field, omit);
|
|
163
|
+
if (omit.size === 0) return config;
|
|
164
|
+
const next = { ...config };
|
|
165
|
+
for (const key of omit) delete next[key];
|
|
166
|
+
return next;
|
|
167
|
+
}
|
|
168
|
+
function collectOmitted(field, out) {
|
|
169
|
+
if (!isRecord$6(field)) return;
|
|
170
|
+
const type = field["type"];
|
|
171
|
+
const key = field["key"];
|
|
172
|
+
if (field["omitFromSettings"] === true && typeof key === "string" && key.length > 0) out.add(key);
|
|
173
|
+
if (type === "group") {
|
|
174
|
+
for (const child of fieldsOf(field)) collectOmitted(child, out);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (type === "sub-tabs") {
|
|
178
|
+
const tabs = field["tabs"];
|
|
179
|
+
if (!Array.isArray(tabs)) return;
|
|
180
|
+
for (const tab of tabs) for (const child of fieldsOf(tab)) collectOmitted(child, out);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
159
183
|
function collectKeychainStoredKeys(schema) {
|
|
160
184
|
const keys = /* @__PURE__ */ new Set();
|
|
161
185
|
for (const section of sectionsOf(schema)) for (const field of fieldsOf(section)) walkKeychainField(field, keys);
|
|
162
186
|
return keys;
|
|
163
187
|
}
|
|
164
188
|
function walkKeychainField(field, out) {
|
|
165
|
-
if (!isRecord$
|
|
189
|
+
if (!isRecord$6(field)) return;
|
|
166
190
|
const type = field["type"];
|
|
167
191
|
const key = field["key"];
|
|
168
192
|
const isSecret = type === "password" || field["secret"] === true;
|
|
@@ -187,21 +211,21 @@ function schemaDeclaresAnyField(schema) {
|
|
|
187
211
|
for (const section of sectionsOf(schema)) if (fieldsOf(section).length > 0) return true;
|
|
188
212
|
return false;
|
|
189
213
|
}
|
|
190
|
-
function isRecord$
|
|
214
|
+
function isRecord$6(value) {
|
|
191
215
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
192
216
|
}
|
|
193
217
|
function sectionsOf(schema) {
|
|
194
|
-
if (!isRecord$
|
|
218
|
+
if (!isRecord$6(schema)) return [];
|
|
195
219
|
const sections = schema["sections"];
|
|
196
220
|
return Array.isArray(sections) ? sections : [];
|
|
197
221
|
}
|
|
198
222
|
function fieldsOf(node) {
|
|
199
|
-
if (!isRecord$
|
|
223
|
+
if (!isRecord$6(node)) return [];
|
|
200
224
|
const fields = node["fields"];
|
|
201
225
|
return Array.isArray(fields) ? fields : [];
|
|
202
226
|
}
|
|
203
227
|
function walkField(field, out) {
|
|
204
|
-
if (!isRecord$
|
|
228
|
+
if (!isRecord$6(field)) return;
|
|
205
229
|
const type = field["type"];
|
|
206
230
|
const key = field["key"];
|
|
207
231
|
if ((type === "password" || field["secret"] === true) && typeof key === "string" && key.length > 0) out.add(key);
|
|
@@ -241,7 +265,7 @@ function walkField(field, out) {
|
|
|
241
265
|
var SECRET_CLEAR = { $secretClear: true };
|
|
242
266
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
243
267
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
244
|
-
function isRecord$
|
|
268
|
+
function isRecord$5(value) {
|
|
245
269
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
246
270
|
}
|
|
247
271
|
function makeSecretMarker(ref) {
|
|
@@ -252,19 +276,19 @@ function makeSecretMarker(ref) {
|
|
|
252
276
|
}
|
|
253
277
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
254
278
|
function isSecretMarker(value) {
|
|
255
|
-
if (!isRecord$
|
|
279
|
+
if (!isRecord$5(value)) return false;
|
|
256
280
|
const ref = value["$secret"];
|
|
257
281
|
return typeof ref === "string" && ref.length > 0;
|
|
258
282
|
}
|
|
259
283
|
/** Anything carrying a `$secret` key — a stored marker or a UI view of one. */
|
|
260
284
|
function isSecretMarkerLike(value) {
|
|
261
|
-
return isRecord$
|
|
285
|
+
return isRecord$5(value) && Object.prototype.hasOwnProperty.call(value, "$secret");
|
|
262
286
|
}
|
|
263
287
|
function isSecretClear(value) {
|
|
264
|
-
return isRecord$
|
|
288
|
+
return isRecord$5(value) && value["$secretClear"] === true;
|
|
265
289
|
}
|
|
266
290
|
function isSecretFieldView(value) {
|
|
267
|
-
return isRecord$
|
|
291
|
+
return isRecord$5(value) && value["set"] === true && isSecretMarkerLike(value);
|
|
268
292
|
}
|
|
269
293
|
/**
|
|
270
294
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -677,6 +701,33 @@ function typeOf(field) {
|
|
|
677
701
|
default: return "other";
|
|
678
702
|
}
|
|
679
703
|
}
|
|
704
|
+
/** Strip inline `value` from a hydrated field for schema-only round-trips. */
|
|
705
|
+
function dehydrateConfigField(field) {
|
|
706
|
+
if (field.type === "group") return {
|
|
707
|
+
...field,
|
|
708
|
+
fields: field.fields.map(dehydrateConfigField)
|
|
709
|
+
};
|
|
710
|
+
if (field.type === "sub-tabs") return {
|
|
711
|
+
...field,
|
|
712
|
+
tabs: field.tabs.map((tab) => ({
|
|
713
|
+
...tab,
|
|
714
|
+
fields: tab.fields.map(dehydrateConfigField)
|
|
715
|
+
}))
|
|
716
|
+
};
|
|
717
|
+
if (isValuelessField(field)) return field;
|
|
718
|
+
const { value: _drop, ...rest } = field;
|
|
719
|
+
return rest;
|
|
720
|
+
}
|
|
721
|
+
/** Inverse of {@link hydrateSchema} — drops resolved values from every leaf field. */
|
|
722
|
+
function dehydrateSchema(schema) {
|
|
723
|
+
return {
|
|
724
|
+
...schema.tabs ? { tabs: [...schema.tabs] } : {},
|
|
725
|
+
sections: schema.sections.map((section) => ({
|
|
726
|
+
...section,
|
|
727
|
+
fields: section.fields.map(dehydrateConfigField)
|
|
728
|
+
}))
|
|
729
|
+
};
|
|
730
|
+
}
|
|
680
731
|
//#endregion
|
|
681
732
|
//#region src/interfaces/event-bus.ts
|
|
682
733
|
/**
|
|
@@ -1018,7 +1069,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
1018
1069
|
}
|
|
1019
1070
|
};
|
|
1020
1071
|
var KEEP = { kind: "keep" };
|
|
1021
|
-
function isRecord$
|
|
1072
|
+
function isRecord$4(value) {
|
|
1022
1073
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1023
1074
|
}
|
|
1024
1075
|
function defaultMintId() {
|
|
@@ -1031,7 +1082,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
1031
1082
|
return out;
|
|
1032
1083
|
}
|
|
1033
1084
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
1034
|
-
else if (isRecord$
|
|
1085
|
+
else if (isRecord$4(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
1035
1086
|
return out;
|
|
1036
1087
|
}
|
|
1037
1088
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -1086,7 +1137,7 @@ function rowId(row, idKey) {
|
|
|
1086
1137
|
return null;
|
|
1087
1138
|
}
|
|
1088
1139
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
1089
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
1140
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$4) : [];
|
|
1090
1141
|
if (!Array.isArray(incoming)) {
|
|
1091
1142
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
1092
1143
|
return {
|
|
@@ -1102,7 +1153,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
1102
1153
|
const kept = /* @__PURE__ */ new Set();
|
|
1103
1154
|
const rows = [];
|
|
1104
1155
|
for (const row of incoming) {
|
|
1105
|
-
if (!isRecord$
|
|
1156
|
+
if (!isRecord$4(row)) {
|
|
1106
1157
|
rows.push(row);
|
|
1107
1158
|
continue;
|
|
1108
1159
|
}
|
|
@@ -1127,7 +1178,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
1127
1178
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
1128
1179
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
1129
1180
|
case "object": {
|
|
1130
|
-
if (!isRecord$
|
|
1181
|
+
if (!isRecord$4(incoming)) {
|
|
1131
1182
|
if (incoming === void 0) return KEEP;
|
|
1132
1183
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
1133
1184
|
return {
|
|
@@ -1135,7 +1186,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
1135
1186
|
value: incoming
|
|
1136
1187
|
};
|
|
1137
1188
|
}
|
|
1138
|
-
const storedObj = isRecord$
|
|
1189
|
+
const storedObj = isRecord$4(stored) ? stored : {};
|
|
1139
1190
|
return {
|
|
1140
1191
|
kind: "value",
|
|
1141
1192
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -1258,7 +1309,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
1258
1309
|
value: items
|
|
1259
1310
|
};
|
|
1260
1311
|
}
|
|
1261
|
-
if (isRecord$
|
|
1312
|
+
if (isRecord$4(v)) {
|
|
1262
1313
|
const out = {};
|
|
1263
1314
|
for (const [k, child] of Object.entries(v)) {
|
|
1264
1315
|
const s = substitute(child);
|
|
@@ -1292,7 +1343,7 @@ var SecretOverwriteRefusedError = class extends Error {
|
|
|
1292
1343
|
this.name = "SecretOverwriteRefusedError";
|
|
1293
1344
|
}
|
|
1294
1345
|
};
|
|
1295
|
-
function isRecord$
|
|
1346
|
+
function isRecord$3(value) {
|
|
1296
1347
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1297
1348
|
}
|
|
1298
1349
|
function resolvedValue(pass, marker) {
|
|
@@ -1321,7 +1372,7 @@ function inArray(pass, incoming, stored) {
|
|
|
1321
1372
|
return incoming.map((item, index) => {
|
|
1322
1373
|
const twin = stored[index];
|
|
1323
1374
|
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
1324
|
-
if (isRecord$
|
|
1375
|
+
if (isRecord$3(item) && isRecord$3(twin)) return inArrayRow(pass, item, twin);
|
|
1325
1376
|
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
1326
1377
|
return item;
|
|
1327
1378
|
});
|
|
@@ -1332,7 +1383,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
1332
1383
|
const twin = stored[key];
|
|
1333
1384
|
if (isSecretMarker(twin)) {
|
|
1334
1385
|
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
1335
|
-
} else if (isRecord$
|
|
1386
|
+
} else if (isRecord$3(value) && isRecord$3(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
1336
1387
|
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
1337
1388
|
}
|
|
1338
1389
|
return out;
|
|
@@ -1340,7 +1391,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
1340
1391
|
async function walk(pass, incoming, stored) {
|
|
1341
1392
|
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
1342
1393
|
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
1343
|
-
if (!isRecord$
|
|
1394
|
+
if (!isRecord$3(incoming) || !isRecord$3(stored)) return incoming;
|
|
1344
1395
|
const out = { ...incoming };
|
|
1345
1396
|
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
1346
1397
|
return out;
|
|
@@ -1371,7 +1422,7 @@ async function restoreUnchangedSecrets(input) {
|
|
|
1371
1422
|
function isJsonEqual(a, b) {
|
|
1372
1423
|
if (Object.is(a, b)) return true;
|
|
1373
1424
|
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
1374
|
-
if (isRecord$
|
|
1425
|
+
if (isRecord$3(a) && isRecord$3(b)) {
|
|
1375
1426
|
const keys = Object.keys(a);
|
|
1376
1427
|
if (keys.length !== Object.keys(b).length) return false;
|
|
1377
1428
|
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
@@ -1395,7 +1446,7 @@ function markerKeysOf(blob, owner) {
|
|
|
1395
1446
|
}
|
|
1396
1447
|
function nodeFromStored(value, owner) {
|
|
1397
1448
|
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
1398
|
-
if (!isRecord$
|
|
1449
|
+
if (!isRecord$3(value)) return null;
|
|
1399
1450
|
const children = /* @__PURE__ */ new Map();
|
|
1400
1451
|
for (const [key, child] of Object.entries(value)) {
|
|
1401
1452
|
const node = nodeFromStored(child, owner);
|
|
@@ -2202,7 +2253,7 @@ var BaseAddon = class {
|
|
|
2202
2253
|
if (!ctx) return;
|
|
2203
2254
|
const addonId = ctx.id;
|
|
2204
2255
|
setImmediate(() => {
|
|
2205
|
-
ctx.api.addons
|
|
2256
|
+
ctx.api.addons.restartAddon.mutate({ addonId }).then(() => {
|
|
2206
2257
|
ctx.logger.info("addon auto-restart triggered by restart-required setting change", { meta: { changedFields: patchKeys.filter((k) => restartKeys.has(k)) } });
|
|
2207
2258
|
}).catch((err) => {
|
|
2208
2259
|
ctx.logger.error("addon auto-restart failed", { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
@@ -3359,7 +3410,11 @@ function asRecordsError(err) {
|
|
|
3359
3410
|
*/
|
|
3360
3411
|
var SECRET_META = { secret: true };
|
|
3361
3412
|
function defOf(schema) {
|
|
3362
|
-
|
|
3413
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
3414
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
3415
|
+
const def = Reflect.get(zodBag, "def");
|
|
3416
|
+
if (typeof def !== "object" || def === null) return {};
|
|
3417
|
+
return def;
|
|
3363
3418
|
}
|
|
3364
3419
|
function declaredHere(schema) {
|
|
3365
3420
|
return z.globalRegistry.get(schema)?.secret === true;
|
|
@@ -3459,11 +3514,11 @@ function secretArrayPrefixes(path) {
|
|
|
3459
3514
|
}
|
|
3460
3515
|
return prefixes;
|
|
3461
3516
|
}
|
|
3462
|
-
function isRecord$
|
|
3517
|
+
function isRecord$2(value) {
|
|
3463
3518
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3464
3519
|
}
|
|
3465
3520
|
function elementId(element, idKey, declared, prefix) {
|
|
3466
|
-
const id = isRecord$
|
|
3521
|
+
const id = isRecord$2(element) ? element[idKey] : void 0;
|
|
3467
3522
|
if (typeof id !== "string" || id.length === 0) throw new InvalidRecordError(`"${declared}": every element of "${prefix}" needs a non-empty string "${idKey}" to carry a secret`);
|
|
3468
3523
|
return id;
|
|
3469
3524
|
}
|
|
@@ -3474,7 +3529,7 @@ function elementId(element, idKey, declared, prefix) {
|
|
|
3474
3529
|
*/
|
|
3475
3530
|
var REMOVE_LEAF = Symbol("remove-leaf");
|
|
3476
3531
|
function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arrayKeys, visit) {
|
|
3477
|
-
if (!isRecord$
|
|
3532
|
+
if (!isRecord$2(node)) return node;
|
|
3478
3533
|
const segment = segments[index];
|
|
3479
3534
|
if (segment === void 0) return node;
|
|
3480
3535
|
if (!Object.prototype.hasOwnProperty.call(node, segment.key)) return node;
|
|
@@ -3711,7 +3766,7 @@ function declarationsOf(kinds) {
|
|
|
3711
3766
|
}
|
|
3712
3767
|
//#endregion
|
|
3713
3768
|
//#region src/records/records-access.ts
|
|
3714
|
-
function isRecord(value) {
|
|
3769
|
+
function isRecord$1(value) {
|
|
3715
3770
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3716
3771
|
}
|
|
3717
3772
|
/** Run a transport call and give a wire failure its typed class back. */
|
|
@@ -3836,7 +3891,7 @@ var KindHandle = class {
|
|
|
3836
3891
|
}) : data;
|
|
3837
3892
|
const parsed = this.def.schema.safeParse(shaped);
|
|
3838
3893
|
if (!parsed.success) throw new InvalidRecordError(`${this.name}/${id}: ${zodSummary(parsed.error)}`);
|
|
3839
|
-
if (!isRecord(parsed.data)) throw new InvalidRecordError(`${this.name}/${id}: the body must be an object`);
|
|
3894
|
+
if (!isRecord$1(parsed.data)) throw new InvalidRecordError(`${this.name}/${id}: the body must be an object`);
|
|
3840
3895
|
return parsed.data;
|
|
3841
3896
|
}
|
|
3842
3897
|
async get(id) {
|
|
@@ -4005,7 +4060,7 @@ var KindHandle = class {
|
|
|
4005
4060
|
}
|
|
4006
4061
|
};
|
|
4007
4062
|
function toBody(value) {
|
|
4008
|
-
if (!isRecord(value)) throw new InvalidRecordError("the record body must be an object");
|
|
4063
|
+
if (!isRecord$1(value)) throw new InvalidRecordError("the record body must be an object");
|
|
4009
4064
|
return value;
|
|
4010
4065
|
}
|
|
4011
4066
|
/** Build the owner's records handle. */
|
|
@@ -4097,6 +4152,318 @@ function defineEntryKind(name, spec) {
|
|
|
4097
4152
|
return defined;
|
|
4098
4153
|
}
|
|
4099
4154
|
//#endregion
|
|
4155
|
+
//#region src/records/settings-brokers-adopts-from.ts
|
|
4156
|
+
/**
|
|
4157
|
+
* Legacy source for broker entry adoption (B2): brokers live in addon-settings
|
|
4158
|
+
* as one row `<addonId>.brokers` whose value is an array until records-adopt
|
|
4159
|
+
* copies them into the entry kind.
|
|
4160
|
+
*/
|
|
4161
|
+
var SETTINGS_BROKERS_ADOPTS_PREFIX = "@settings-brokers/";
|
|
4162
|
+
/** The `adoptsFrom` value for an addon's broker entry kind. */
|
|
4163
|
+
function settingsBrokersAdoptsFrom(addonId) {
|
|
4164
|
+
return `${SETTINGS_BROKERS_ADOPTS_PREFIX}${addonId}`;
|
|
4165
|
+
}
|
|
4166
|
+
/** When non-null, `from` names an addon-settings brokers blob, not a SQL table. */
|
|
4167
|
+
function parseSettingsBrokersAdoptsFrom(from) {
|
|
4168
|
+
if (!from.startsWith("@settings-brokers/")) return null;
|
|
4169
|
+
const addonId = from.slice(18);
|
|
4170
|
+
return addonId.length > 0 ? addonId : null;
|
|
4171
|
+
}
|
|
4172
|
+
//#endregion
|
|
4173
|
+
//#region src/records/settings-array-adopts-from.ts
|
|
4174
|
+
/**
|
|
4175
|
+
* Legacy source for entry adoption (B3): a list stored under addon-settings
|
|
4176
|
+
* `<addonId>.<key>` until records-adopt copies rows into the entry kind.
|
|
4177
|
+
*/
|
|
4178
|
+
var SETTINGS_ARRAY_ADOPTS_PREFIX = "@settings-array/";
|
|
4179
|
+
/** The `adoptsFrom` value for an addon-settings array field. */
|
|
4180
|
+
function settingsArrayAdoptsFrom(addonId, settingsKey) {
|
|
4181
|
+
return `${SETTINGS_ARRAY_ADOPTS_PREFIX}${addonId}/${settingsKey}`;
|
|
4182
|
+
}
|
|
4183
|
+
/** When non-null, `from` names an addon-settings array blob, not a SQL table. */
|
|
4184
|
+
function parseSettingsArrayAdoptsFrom(from) {
|
|
4185
|
+
if (!from.startsWith("@settings-array/")) return null;
|
|
4186
|
+
const rest = from.slice(16);
|
|
4187
|
+
const slash = rest.indexOf("/");
|
|
4188
|
+
if (slash <= 0 || slash >= rest.length - 1) return null;
|
|
4189
|
+
const addonId = rest.slice(0, slash);
|
|
4190
|
+
const settingsKey = rest.slice(slash + 1);
|
|
4191
|
+
if (addonId.length === 0 || settingsKey.length === 0) return null;
|
|
4192
|
+
return {
|
|
4193
|
+
addonId,
|
|
4194
|
+
settingsKey
|
|
4195
|
+
};
|
|
4196
|
+
}
|
|
4197
|
+
//#endregion
|
|
4198
|
+
//#region src/records/in-memory-records.ts
|
|
4199
|
+
/**
|
|
4200
|
+
* In-memory `RecordsAccess` for specs. Kinds are declared by the caller.
|
|
4201
|
+
* Lives in `@camstack/types` so a spec does not import another package's source.
|
|
4202
|
+
*/
|
|
4203
|
+
function isRecord(value) {
|
|
4204
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4205
|
+
}
|
|
4206
|
+
function markersOf(decl, body) {
|
|
4207
|
+
const out = /* @__PURE__ */ new Map();
|
|
4208
|
+
mapSecretLeaves(body, decl.secretPaths, decl.secretArrayKeys, (leaf) => {
|
|
4209
|
+
if (isSecretMarker(leaf.value)) out.set(leaf.concrete, leaf.value.$secret);
|
|
4210
|
+
return leaf.value;
|
|
4211
|
+
});
|
|
4212
|
+
return out;
|
|
4213
|
+
}
|
|
4214
|
+
function makeSpecKeychain(owner) {
|
|
4215
|
+
const values = /* @__PURE__ */ new Map();
|
|
4216
|
+
return { access: {
|
|
4217
|
+
owner,
|
|
4218
|
+
ref: (scope, fieldPath) => buildSecretRef({
|
|
4219
|
+
owner,
|
|
4220
|
+
scope,
|
|
4221
|
+
fieldPath
|
|
4222
|
+
}),
|
|
4223
|
+
resolve: async (refs) => {
|
|
4224
|
+
const out = {};
|
|
4225
|
+
for (const ref of refs) {
|
|
4226
|
+
const value = values.get(ref);
|
|
4227
|
+
out[ref] = value === void 0 ? { kind: "missing" } : {
|
|
4228
|
+
kind: "value",
|
|
4229
|
+
value,
|
|
4230
|
+
version: 1
|
|
4231
|
+
};
|
|
4232
|
+
}
|
|
4233
|
+
return out;
|
|
4234
|
+
},
|
|
4235
|
+
put: async (ref, value) => {
|
|
4236
|
+
values.set(ref, value);
|
|
4237
|
+
return 1;
|
|
4238
|
+
},
|
|
4239
|
+
delete: async (refs) => {
|
|
4240
|
+
let deleted = 0;
|
|
4241
|
+
for (const ref of refs) if (values.delete(ref)) deleted += 1;
|
|
4242
|
+
return deleted;
|
|
4243
|
+
},
|
|
4244
|
+
state: async () => ({ state: "ready" }),
|
|
4245
|
+
onChange: () => () => void 0,
|
|
4246
|
+
forOwner: null
|
|
4247
|
+
} };
|
|
4248
|
+
}
|
|
4249
|
+
function makeInMemoryRecords(owner = "spec") {
|
|
4250
|
+
const decls = /* @__PURE__ */ new Map();
|
|
4251
|
+
const tables = /* @__PURE__ */ new Map();
|
|
4252
|
+
let clock = 1;
|
|
4253
|
+
let writesFail = false;
|
|
4254
|
+
let readsFail = false;
|
|
4255
|
+
const table = (kind) => {
|
|
4256
|
+
let t = tables.get(kind);
|
|
4257
|
+
if (t === void 0) {
|
|
4258
|
+
t = /* @__PURE__ */ new Map();
|
|
4259
|
+
tables.set(kind, t);
|
|
4260
|
+
}
|
|
4261
|
+
return t;
|
|
4262
|
+
};
|
|
4263
|
+
const declOf = (kind) => {
|
|
4264
|
+
const decl = decls.get(kind);
|
|
4265
|
+
if (decl === void 0) throw new Error(`kind "${kind}" is not declared`);
|
|
4266
|
+
return decl;
|
|
4267
|
+
};
|
|
4268
|
+
const redact = (decl, body) => {
|
|
4269
|
+
if (decl.secretPaths.length === 0) return body;
|
|
4270
|
+
const out = mapSecretLeaves(body, decl.secretPaths, decl.secretArrayKeys, (leaf) => leaf.value === null ? null : REDACTED_SECRET);
|
|
4271
|
+
return isRecord(out) ? out : body;
|
|
4272
|
+
};
|
|
4273
|
+
const view = (kind, row) => ({
|
|
4274
|
+
id: row.id,
|
|
4275
|
+
deviceId: null,
|
|
4276
|
+
at: row.at,
|
|
4277
|
+
expiresAt: null,
|
|
4278
|
+
rev: row.rev,
|
|
4279
|
+
updatedAt: row.updatedAt,
|
|
4280
|
+
data: redact(declOf(kind), row.data)
|
|
4281
|
+
});
|
|
4282
|
+
const enforce = (kind, id, body, stored) => {
|
|
4283
|
+
const decl = declOf(kind);
|
|
4284
|
+
if (decl.secretPaths.length === 0) return {
|
|
4285
|
+
body,
|
|
4286
|
+
released: []
|
|
4287
|
+
};
|
|
4288
|
+
const before = stored === null ? /* @__PURE__ */ new Map() : markersOf(decl, stored);
|
|
4289
|
+
const next = mapSecretLeaves(body, decl.secretPaths, decl.secretArrayKeys, (leaf) => {
|
|
4290
|
+
const expected = recordSecretRef(owner, kind, id, leaf.concrete);
|
|
4291
|
+
if (isSecretMarker(leaf.value)) {
|
|
4292
|
+
if (leaf.value.$secret !== expected) throw new Error("foreign secret marker");
|
|
4293
|
+
return leaf.value;
|
|
4294
|
+
}
|
|
4295
|
+
if (leaf.value === "__camstack_redacted__") {
|
|
4296
|
+
const keep = before.get(leaf.concrete);
|
|
4297
|
+
return keep === void 0 ? REMOVE_LEAF : {
|
|
4298
|
+
$secret: keep,
|
|
4299
|
+
v: 1
|
|
4300
|
+
};
|
|
4301
|
+
}
|
|
4302
|
+
if (leaf.value === null || leaf.value === void 0) return REMOVE_LEAF;
|
|
4303
|
+
throw new Error(`${kind}/${id}: a secret field takes a keychain marker, never a value`);
|
|
4304
|
+
});
|
|
4305
|
+
if (!isRecord(next)) throw new Error("the body must be an object");
|
|
4306
|
+
const after = markersOf(decl, next);
|
|
4307
|
+
return {
|
|
4308
|
+
body: next,
|
|
4309
|
+
released: [...before.entries()].filter(([p, ref]) => after.get(p) !== ref).map(([, r]) => r)
|
|
4310
|
+
};
|
|
4311
|
+
};
|
|
4312
|
+
const write = (kind, input) => {
|
|
4313
|
+
if (writesFail) throw new Error("records engine unreachable");
|
|
4314
|
+
if (declOf(kind).at === "required" && input.at === void 0) throw new Error(`${kind}/${input.id}: the kind needs "at" on every write`);
|
|
4315
|
+
const prev = table(kind).get(input.id);
|
|
4316
|
+
const { body, released } = enforce(kind, input.id, input.data, prev?.data ?? null);
|
|
4317
|
+
const rev = (prev?.rev ?? 0) + 1;
|
|
4318
|
+
clock += 1;
|
|
4319
|
+
table(kind).set(input.id, {
|
|
4320
|
+
id: input.id,
|
|
4321
|
+
at: input.at ?? null,
|
|
4322
|
+
rev,
|
|
4323
|
+
updatedAt: clock,
|
|
4324
|
+
data: body
|
|
4325
|
+
});
|
|
4326
|
+
return {
|
|
4327
|
+
rev,
|
|
4328
|
+
released
|
|
4329
|
+
};
|
|
4330
|
+
};
|
|
4331
|
+
const unimplemented = (op) => {
|
|
4332
|
+
throw new Error(`the fake records transport does not implement ${op}`);
|
|
4333
|
+
};
|
|
4334
|
+
return {
|
|
4335
|
+
records: createRecordsAccess({
|
|
4336
|
+
owner,
|
|
4337
|
+
transport: {
|
|
4338
|
+
declareKinds: async ({ kinds }) => {
|
|
4339
|
+
const out = {};
|
|
4340
|
+
let n = 0;
|
|
4341
|
+
for (const [name, decl] of Object.entries(kinds)) {
|
|
4342
|
+
decls.set(name, decl);
|
|
4343
|
+
n += 1;
|
|
4344
|
+
out[name] = {
|
|
4345
|
+
kindId: n,
|
|
4346
|
+
state: "created",
|
|
4347
|
+
createdIndexes: decl.indexes.map((i) => i.name),
|
|
4348
|
+
adoptionPending: null
|
|
4349
|
+
};
|
|
4350
|
+
}
|
|
4351
|
+
return { kinds: out };
|
|
4352
|
+
},
|
|
4353
|
+
get: async ({ kind, id }) => {
|
|
4354
|
+
if (readsFail) throw new Error("records engine unreachable");
|
|
4355
|
+
const row = table(kind).get(id);
|
|
4356
|
+
return row === void 0 ? null : view(kind, row);
|
|
4357
|
+
},
|
|
4358
|
+
getMany: async ({ kind, ids }) => ids.flatMap((id) => {
|
|
4359
|
+
const row = table(kind).get(id);
|
|
4360
|
+
return row === void 0 ? [] : [view(kind, row)];
|
|
4361
|
+
}),
|
|
4362
|
+
secretRefs: async ({ kind, ids }) => {
|
|
4363
|
+
const decl = declOf(kind);
|
|
4364
|
+
const out = {};
|
|
4365
|
+
for (const id of ids) {
|
|
4366
|
+
const row = table(kind).get(id);
|
|
4367
|
+
if (row !== void 0) out[id] = Object.fromEntries(markersOf(decl, row.data));
|
|
4368
|
+
}
|
|
4369
|
+
return out;
|
|
4370
|
+
},
|
|
4371
|
+
put: async ({ kind, record, ifRev }) => {
|
|
4372
|
+
if (ifRev !== void 0 && (table(kind).get(record.id)?.rev ?? 0) !== ifRev) throw new Error("stale ifRev");
|
|
4373
|
+
const { rev, released } = write(kind, record);
|
|
4374
|
+
return {
|
|
4375
|
+
rev,
|
|
4376
|
+
releasedRefs: released
|
|
4377
|
+
};
|
|
4378
|
+
},
|
|
4379
|
+
putMany: async ({ kind, records }) => {
|
|
4380
|
+
const released = [];
|
|
4381
|
+
for (const record of records) released.push(...write(kind, record).released);
|
|
4382
|
+
return {
|
|
4383
|
+
count: records.length,
|
|
4384
|
+
releasedRefs: released
|
|
4385
|
+
};
|
|
4386
|
+
},
|
|
4387
|
+
patch: async () => unimplemented("patch"),
|
|
4388
|
+
delete: async ({ kind, id }) => {
|
|
4389
|
+
if (writesFail) throw new Error("records engine unreachable");
|
|
4390
|
+
const row = table(kind).get(id);
|
|
4391
|
+
if (row === void 0) return {
|
|
4392
|
+
deleted: false,
|
|
4393
|
+
secretRefs: []
|
|
4394
|
+
};
|
|
4395
|
+
table(kind).delete(id);
|
|
4396
|
+
return {
|
|
4397
|
+
deleted: true,
|
|
4398
|
+
secretRefs: [...markersOf(declOf(kind), row.data).values()]
|
|
4399
|
+
};
|
|
4400
|
+
},
|
|
4401
|
+
deleteMany: async ({ kind, ids }) => {
|
|
4402
|
+
let deleted = 0;
|
|
4403
|
+
const refs = [];
|
|
4404
|
+
for (const id of ids) {
|
|
4405
|
+
const row = table(kind).get(id);
|
|
4406
|
+
if (row === void 0) continue;
|
|
4407
|
+
table(kind).delete(id);
|
|
4408
|
+
deleted += 1;
|
|
4409
|
+
refs.push(...markersOf(declOf(kind), row.data).values());
|
|
4410
|
+
}
|
|
4411
|
+
return {
|
|
4412
|
+
deleted,
|
|
4413
|
+
secretRefs: refs
|
|
4414
|
+
};
|
|
4415
|
+
},
|
|
4416
|
+
query: async (q) => {
|
|
4417
|
+
if (readsFail) throw new Error("records engine unreachable");
|
|
4418
|
+
const decl = declOf(q.kind);
|
|
4419
|
+
const asked = Object.keys(q.where ?? {});
|
|
4420
|
+
if (asked.length > 0) {
|
|
4421
|
+
if (!decl.indexes.some((index) => {
|
|
4422
|
+
const leading = new Set(index.fields.slice(0, asked.length));
|
|
4423
|
+
return asked.length <= index.fields.length && asked.every((f) => leading.has(f));
|
|
4424
|
+
})) throw new Error(`${q.kind}: no declared index serves [${asked.join(", ")}]`);
|
|
4425
|
+
}
|
|
4426
|
+
let rows = [...table(q.kind).values()];
|
|
4427
|
+
for (const [field, wanted] of Object.entries(q.where ?? {})) rows = rows.filter((r) => r.data[field] === wanted);
|
|
4428
|
+
const byAt = q.order === "at" || q.order === void 0 && decl.at === "required";
|
|
4429
|
+
rows.sort((a, b) => byAt ? (a.at ?? 0) - (b.at ?? 0) : a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
|
|
4430
|
+
if (q.desc === true) rows.reverse();
|
|
4431
|
+
const start = q.cursor === void 0 ? 0 : Number(q.cursor);
|
|
4432
|
+
const page = rows.slice(start, start + q.limit);
|
|
4433
|
+
const more = start + q.limit < rows.length;
|
|
4434
|
+
return {
|
|
4435
|
+
records: page.map((r) => view(q.kind, r)),
|
|
4436
|
+
nextCursor: more ? String(start + q.limit) : null
|
|
4437
|
+
};
|
|
4438
|
+
},
|
|
4439
|
+
count: async ({ kind }) => ({ count: table(kind).size }),
|
|
4440
|
+
histogram: async () => unimplemented("histogram"),
|
|
4441
|
+
aggregate: async () => unimplemented("aggregate"),
|
|
4442
|
+
deleteWhere: async () => unimplemented("deleteWhere"),
|
|
4443
|
+
deleteDevice: async () => unimplemented("deleteDevice"),
|
|
4444
|
+
allocateId: async () => unimplemented("allocateId")
|
|
4445
|
+
},
|
|
4446
|
+
secrets: makeSpecKeychain(owner).access
|
|
4447
|
+
}),
|
|
4448
|
+
tables,
|
|
4449
|
+
failWrites: (on) => {
|
|
4450
|
+
writesFail = on;
|
|
4451
|
+
},
|
|
4452
|
+
failReads: (on) => {
|
|
4453
|
+
readsFail = on;
|
|
4454
|
+
},
|
|
4455
|
+
seed: (kind, row) => {
|
|
4456
|
+
table(kind).set(row.id, {
|
|
4457
|
+
id: row.id,
|
|
4458
|
+
at: row.at ?? null,
|
|
4459
|
+
rev: 1,
|
|
4460
|
+
updatedAt: 1,
|
|
4461
|
+
data: row.data
|
|
4462
|
+
});
|
|
4463
|
+
}
|
|
4464
|
+
};
|
|
4465
|
+
}
|
|
4466
|
+
//#endregion
|
|
4100
4467
|
//#region src/capabilities/schemas/streaming-shared.ts
|
|
4101
4468
|
/** Shared Zod schemas used across streaming capabilities. */
|
|
4102
4469
|
var CamProfileSchema = z.enum([
|
|
@@ -5256,6 +5623,31 @@ function describeCustomActions(catalog) {
|
|
|
5256
5623
|
return out;
|
|
5257
5624
|
}
|
|
5258
5625
|
//#endregion
|
|
5626
|
+
//#region src/capabilities/caller-stamp.ts
|
|
5627
|
+
/**
|
|
5628
|
+
* Every cap whose provider reads a `callerAddonId` in its input (the keychain's
|
|
5629
|
+
* owner check, device-history's `not-owner`, records' owner).
|
|
5630
|
+
*
|
|
5631
|
+
* The stamp is set ONLY by the transport (`stampCallerAddonId`, or stated by a
|
|
5632
|
+
* hub in-process caller). HTTP/WS mounts parse input with `.loose()`, so a
|
|
5633
|
+
* session could add the key itself and act as another addon — those procedures
|
|
5634
|
+
* strip it when `ctx.req` is present. Mesh / `$core-caps` calls have no request;
|
|
5635
|
+
* the transport stamp must survive to the provider.
|
|
5636
|
+
*/
|
|
5637
|
+
var CALLER_STAMPED_CAPABILITIES = [
|
|
5638
|
+
"keychain",
|
|
5639
|
+
"device-history",
|
|
5640
|
+
"records",
|
|
5641
|
+
"integrations",
|
|
5642
|
+
"device-manager"
|
|
5643
|
+
];
|
|
5644
|
+
/** A copy of `input` without the caller stamp. Anything that is not a plain object passes through. */
|
|
5645
|
+
function withoutCallerStamp(input) {
|
|
5646
|
+
if (input === null || typeof input !== "object" || Array.isArray(input)) return input;
|
|
5647
|
+
if (!Object.prototype.hasOwnProperty.call(input, "callerAddonId")) return input;
|
|
5648
|
+
return Object.fromEntries(Object.entries(input).filter(([key]) => key !== "callerAddonId"));
|
|
5649
|
+
}
|
|
5650
|
+
//#endregion
|
|
5259
5651
|
//#region src/device/children-batch-max.ts
|
|
5260
5652
|
/**
|
|
5261
5653
|
* Most parents one `getChildrenBatch` may name.
|
|
@@ -5758,6 +6150,50 @@ function isSource(x) {
|
|
|
5758
6150
|
return typeof x.read === "function" && typeof x.watch === "function";
|
|
5759
6151
|
}
|
|
5760
6152
|
//#endregion
|
|
6153
|
+
//#region src/helpers/addon-slice-handle.ts
|
|
6154
|
+
/** Structural bridge: every `AddonApi` client carries `deviceState` (+ optional `live`). */
|
|
6155
|
+
function addonSliceHandleApi(api) {
|
|
6156
|
+
return api;
|
|
6157
|
+
}
|
|
6158
|
+
//#endregion
|
|
6159
|
+
//#region src/helpers/trpc-leaf.ts
|
|
6160
|
+
function isTrpcProcedureLeaf(value) {
|
|
6161
|
+
if (typeof value !== "object" || value === null) return false;
|
|
6162
|
+
const record = value;
|
|
6163
|
+
return (typeof record.query === "function" || typeof record.mutate === "function" || typeof record.subscribe === "function") && !Array.isArray(value);
|
|
6164
|
+
}
|
|
6165
|
+
function readCapRecord(api, capProp) {
|
|
6166
|
+
const cap = Reflect.get(api, capProp);
|
|
6167
|
+
if (typeof cap !== "object" || cap === null || Array.isArray(cap)) return void 0;
|
|
6168
|
+
return cap;
|
|
6169
|
+
}
|
|
6170
|
+
function readTrpcLeaf(api, capProp, method) {
|
|
6171
|
+
const capRecord = readCapRecord(api, capProp);
|
|
6172
|
+
if (!capRecord) throw new Error(`tRPC client has no router '${capProp}'`);
|
|
6173
|
+
const leaf = capRecord[method];
|
|
6174
|
+
if (!isTrpcProcedureLeaf(leaf)) throw new Error(`tRPC client has no '${capProp}.${method}'`);
|
|
6175
|
+
return leaf;
|
|
6176
|
+
}
|
|
6177
|
+
/**
|
|
6178
|
+
* Invoke `api.<capProp>.<method>.{query|mutate|subscribe}(input)`.
|
|
6179
|
+
* `Result` is the generated proxy method's return. The leaf itself is only
|
|
6180
|
+
* `unknown` (the client is a structural bag), so the assertion is the one
|
|
6181
|
+
* boundary between that bag and the typed proxy.
|
|
6182
|
+
*/
|
|
6183
|
+
function invokeTrpcLeaf(api, capProp, method, kind, input, push) {
|
|
6184
|
+
const fn = readTrpcLeaf(api, capProp, method);
|
|
6185
|
+
if (kind === "mutation") {
|
|
6186
|
+
if (typeof fn.mutate !== "function") throw new Error(`tRPC '${capProp}.${method}' has no mutate()`);
|
|
6187
|
+
return fn.mutate(input);
|
|
6188
|
+
}
|
|
6189
|
+
if (kind === "subscription") {
|
|
6190
|
+
if (typeof fn.subscribe !== "function") throw new Error(`tRPC '${capProp}.${method}' has no subscribe()`);
|
|
6191
|
+
return fn.subscribe(input, push);
|
|
6192
|
+
}
|
|
6193
|
+
if (typeof fn.query !== "function") throw new Error(`tRPC '${capProp}.${method}' has no query()`);
|
|
6194
|
+
return fn.query(input);
|
|
6195
|
+
}
|
|
6196
|
+
//#endregion
|
|
5761
6197
|
//#region src/generated/device-proxy.ts
|
|
5762
6198
|
/**
|
|
5763
6199
|
* Build a DeviceProxy that pre-binds deviceId + nodeId on every method call
|
|
@@ -5775,8 +6211,7 @@ function isSource(x) {
|
|
|
5775
6211
|
* field on the returned object.
|
|
5776
6212
|
*/
|
|
5777
6213
|
function createDeviceProxy(api, binding, opts) {
|
|
5778
|
-
const
|
|
5779
|
-
const stateSource = opts?.stateSource ?? createLazyTrpcSource(api);
|
|
6214
|
+
const stateSource = opts?.stateSource ?? createLazyTrpcSource(addonSliceHandleApi(api));
|
|
5780
6215
|
/** Merge `{deviceId, nodeId?}` into the caller-supplied input. */
|
|
5781
6216
|
function mergeInput(input, nodeId) {
|
|
5782
6217
|
const base = typeof input === "object" && input !== null ? input : {};
|
|
@@ -5789,20 +6224,8 @@ function createDeviceProxy(api, binding, opts) {
|
|
|
5789
6224
|
deviceId: binding.deviceId
|
|
5790
6225
|
};
|
|
5791
6226
|
}
|
|
5792
|
-
/**
|
|
5793
|
-
* Invoke `api.<capProp>.<method>.{query|mutate|subscribe}(merged)`.
|
|
5794
|
-
* Returns `any` so the caller-side per-method declaration assigns
|
|
5795
|
-
* cleanly into the strongly-typed `InferDeviceProxyCap<...>` shape on
|
|
5796
|
-
* the `DeviceProxy` interface — the proxy's contract is enforced by
|
|
5797
|
-
* the interface, not the dispatch helper.
|
|
5798
|
-
*/
|
|
5799
6227
|
function callLeaf(capProp, method, kind, merged, push) {
|
|
5800
|
-
|
|
5801
|
-
if (!leaf) throw new Error(`DeviceProxy: api has no '${capProp}.${method}'`);
|
|
5802
|
-
const fn = leaf;
|
|
5803
|
-
if (kind === "mutation") return fn.mutate(merged);
|
|
5804
|
-
if (kind === "subscription") return fn.subscribe(merged, push);
|
|
5805
|
-
return fn.query(merged);
|
|
6228
|
+
return invokeTrpcLeaf(api, capProp, method, kind, merged, push);
|
|
5806
6229
|
}
|
|
5807
6230
|
/**
|
|
5808
6231
|
* Device-scoped cap dispatch. Looks up the binding entry for `capName`
|
|
@@ -5957,6 +6380,17 @@ function createDeviceProxy(api, binding, opts) {
|
|
|
5957
6380
|
getRawState: (input) => dispatch("device-ops", "deviceOps", "getRawState", "query", input)
|
|
5958
6381
|
};
|
|
5959
6382
|
const deviceStatusInterface = { getStatus: (input) => dispatch("device-status", "deviceStatus", "getStatus", "query", input) };
|
|
6383
|
+
const dishwasherInterface = {
|
|
6384
|
+
start: (input) => dispatch("dishwasher", "dishwasher", "start", "mutation", input),
|
|
6385
|
+
pause: (input) => dispatch("dishwasher", "dishwasher", "pause", "mutation", input),
|
|
6386
|
+
stop: (input) => dispatch("dishwasher", "dishwasher", "stop", "mutation", input),
|
|
6387
|
+
setProgram: (input) => dispatch("dishwasher", "dishwasher", "setProgram", "mutation", input),
|
|
6388
|
+
setPower: (input) => dispatch("dishwasher", "dishwasher", "setPower", "mutation", input),
|
|
6389
|
+
setHalfLoad: (input) => dispatch("dishwasher", "dishwasher", "setHalfLoad", "mutation", input),
|
|
6390
|
+
setHygienePlus: (input) => dispatch("dishwasher", "dishwasher", "setHygienePlus", "mutation", input),
|
|
6391
|
+
setOption: (input) => dispatch("dishwasher", "dishwasher", "setOption", "mutation", input),
|
|
6392
|
+
getStatus: (input) => dispatch("dishwasher", "dishwasher", "getStatus", "query", input)
|
|
6393
|
+
};
|
|
5960
6394
|
const doorbellInterface = { getStatus: (input) => dispatch("doorbell", "doorbell", "getStatus", "query", input) };
|
|
5961
6395
|
const enumSensorInterface = { getStatus: (input) => dispatch("enum-sensor", "enumSensor", "getStatus", "query", input) };
|
|
5962
6396
|
const eventEmitterInterface = { getStatus: (input) => dispatch("event-emitter", "eventEmitter", "getStatus", "query", input) };
|
|
@@ -5970,6 +6404,7 @@ function createDeviceProxy(api, binding, opts) {
|
|
|
5970
6404
|
const featureProbeInterface = { getStatus: (input) => dispatch("feature-probe", "featureProbe", "getStatus", "query", input) };
|
|
5971
6405
|
const floodInterface = { getStatus: (input) => dispatch("flood", "flood", "getStatus", "query", input) };
|
|
5972
6406
|
const gasInterface = { getStatus: (input) => dispatch("gas", "gas", "getStatus", "query", input) };
|
|
6407
|
+
const heatingValveInterface = { getStatus: (input) => dispatch("heating-valve", "heatingValve", "getStatus", "query", input) };
|
|
5973
6408
|
const humidifierInterface = {
|
|
5974
6409
|
setOn: (input) => dispatch("humidifier", "humidifier", "setOn", "mutation", input),
|
|
5975
6410
|
setTargetHumidity: (input) => dispatch("humidifier", "humidifier", "setTargetHumidity", "mutation", input),
|
|
@@ -6517,6 +6952,7 @@ function createDeviceProxy(api, binding, opts) {
|
|
|
6517
6952
|
dayNight: createSliceHandle(stateSource, binding.deviceId, "day-night"),
|
|
6518
6953
|
deviceDiscovery: createSliceHandle(stateSource, binding.deviceId, "device-discovery"),
|
|
6519
6954
|
deviceStatus: createSliceHandle(stateSource, binding.deviceId, "device-status"),
|
|
6955
|
+
dishwasher: createSliceHandle(stateSource, binding.deviceId, "dishwasher"),
|
|
6520
6956
|
doorbell: createSliceHandle(stateSource, binding.deviceId, "doorbell"),
|
|
6521
6957
|
enumSensor: createSliceHandle(stateSource, binding.deviceId, "enum-sensor"),
|
|
6522
6958
|
eventEmitter: createSliceHandle(stateSource, binding.deviceId, "event-emitter"),
|
|
@@ -6524,6 +6960,7 @@ function createDeviceProxy(api, binding, opts) {
|
|
|
6524
6960
|
featureProbe: createSliceHandle(stateSource, binding.deviceId, "feature-probe"),
|
|
6525
6961
|
flood: createSliceHandle(stateSource, binding.deviceId, "flood"),
|
|
6526
6962
|
gas: createSliceHandle(stateSource, binding.deviceId, "gas"),
|
|
6963
|
+
heatingValve: createSliceHandle(stateSource, binding.deviceId, "heating-valve"),
|
|
6527
6964
|
humidifier: createSliceHandle(stateSource, binding.deviceId, "humidifier"),
|
|
6528
6965
|
humiditySensor: createSliceHandle(stateSource, binding.deviceId, "humidity-sensor"),
|
|
6529
6966
|
image: createSliceHandle(stateSource, binding.deviceId, "image"),
|
|
@@ -6597,6 +7034,7 @@ function createDeviceProxy(api, binding, opts) {
|
|
|
6597
7034
|
...bound("device-extension") ? { deviceExtension: deviceExtensionInterface } : {},
|
|
6598
7035
|
...bound("device-ops") ? { deviceOps: deviceOpsInterface } : {},
|
|
6599
7036
|
...bound("device-status") ? { deviceStatus: deviceStatusInterface } : {},
|
|
7037
|
+
...bound("dishwasher") ? { dishwasher: dishwasherInterface } : {},
|
|
6600
7038
|
...bound("doorbell") ? { doorbell: doorbellInterface } : {},
|
|
6601
7039
|
...bound("enum-sensor") ? { enumSensor: enumSensorInterface } : {},
|
|
6602
7040
|
...bound("event-emitter") ? { eventEmitter: eventEmitterInterface } : {},
|
|
@@ -6604,6 +7042,7 @@ function createDeviceProxy(api, binding, opts) {
|
|
|
6604
7042
|
...bound("feature-probe") ? { featureProbe: featureProbeInterface } : {},
|
|
6605
7043
|
...bound("flood") ? { flood: floodInterface } : {},
|
|
6606
7044
|
...bound("gas") ? { gas: gasInterface } : {},
|
|
7045
|
+
...bound("heating-valve") ? { heatingValve: heatingValveInterface } : {},
|
|
6607
7046
|
...bound("humidifier") ? { humidifier: humidifierInterface } : {},
|
|
6608
7047
|
...bound("humidity-sensor") ? { humiditySensor: humiditySensorInterface } : {},
|
|
6609
7048
|
...bound("image") ? { image: imageInterface } : {},
|
|
@@ -6684,7 +7123,7 @@ function createDeviceProxy(api, binding, opts) {
|
|
|
6684
7123
|
* can answer "may a rule actuate this?" without importing the schema barrel
|
|
6685
7124
|
* (~144MB RSS per runner, D28).
|
|
6686
7125
|
*
|
|
6687
|
-
* Coverage:
|
|
7126
|
+
* Coverage: 90 device-scoped capabilities.
|
|
6688
7127
|
*/
|
|
6689
7128
|
var DEVICE_SCOPED_CAPS = new Set([
|
|
6690
7129
|
"accessories",
|
|
@@ -6717,6 +7156,7 @@ var DEVICE_SCOPED_CAPS = new Set([
|
|
|
6717
7156
|
"device-extension",
|
|
6718
7157
|
"device-ops",
|
|
6719
7158
|
"device-status",
|
|
7159
|
+
"dishwasher",
|
|
6720
7160
|
"doorbell",
|
|
6721
7161
|
"enum-sensor",
|
|
6722
7162
|
"event-emitter",
|
|
@@ -6724,6 +7164,7 @@ var DEVICE_SCOPED_CAPS = new Set([
|
|
|
6724
7164
|
"feature-probe",
|
|
6725
7165
|
"flood",
|
|
6726
7166
|
"gas",
|
|
7167
|
+
"heating-valve",
|
|
6727
7168
|
"humidifier",
|
|
6728
7169
|
"humidity-sensor",
|
|
6729
7170
|
"image",
|
|
@@ -7074,4 +7515,4 @@ function sleepCancellable(ms, signal) {
|
|
|
7074
7515
|
});
|
|
7075
7516
|
}
|
|
7076
7517
|
//#endregion
|
|
7077
|
-
export {
|
|
7518
|
+
export { optionalMethod as $, PEER_BYTES_CHUNK_BYTES as $n, omitTransientConfig as $r, REMOVE_LEAF as $t, HF_REPO as A, RECORD_BATCH_MAX_BYTES as An, emitReadiness as Ar, makeProfileBrokerId as At, describeCustomActions as B, RECORD_SECRET_COLLECTION_PREFIX as Bn, SECRET_CLEAR as Br, settingsBrokersAdoptsFrom as Bt, addonSliceHandleApi as C, RecordsError as Cn, globalSecretScope as Cr, ProfileRtspEntrySchema as Ct, createSliceHandle as D, asRecordsError as Dn, normalizeNodeId as Dr, StreamSourceSchema as Dt, createMirrorSource as E, UnknownRecordKindError as En, parseSecretRef as Er, StreamSourceEntrySchema$1 as Et, DEVICE_CHILDREN_BATCH_MAX as F, RECORD_ID_MAX_LENGTH as Fn, collectHydratedFieldValues as Fr, SETTINGS_ARRAY_ADOPTS_PREFIX as Ft, DEVICE_STATUS_METHOD as G, createSecretsAccess as Gn, isSecretMarkerLike as Gr, RecordFieldPathSchema as Gt, adminUiCapability as H, RECORD_SWEEP_INTERVAL_MS as Hn, isSecretClear as Hr, entryBody as Ht, CALLER_STAMPED_CAPABILITIES as I, RECORD_MAX_DATA_BYTES as In, dehydrateConfigField as Ir, parseSettingsArrayAdoptsFrom as It, PROVIDER_PIN_FIELD as J, forgetKnownSecret as Jn, REDACTED_SECRET as Jr, RecordKindNameSchema as Jt, HISTORY_DEFAULT_MIN_INTERVAL_MS as K, MIN_SCRUBBED_LENGTH as Kn, makeSecretMarker as Kr, RecordIndexSchema as Kt, withoutCallerStamp as L, RECORD_MAX_INDEXES as Ln, dehydrateSchema as Lr, settingsArrayAdoptsFrom as Lt, RawStateResultSchema as M, RECORD_DATABASES as Mn, WELL_KNOWN_TABS as Mr, parseProfileBrokerId as Mt, deviceOpsCapability as N, RECORD_DEFAULT_MAX_DATA_BYTES as Nn, WELL_KNOWN_TAB_MAP as Nr, selectAssignedProfileSlots as Nt, DEFAULT_TOKEN_EXPIRY as O, recordsErrorFromMessage as On, createDurableState as Or, SubscribeAudioChunksInputSchema as Ot, viewerUiCapability as P, RECORD_DELETE_BATCH as Pn, collectHydratedFieldEntries as Pr, makeInMemoryRecords as Pt, method as Q, shortSecretRefHash as Qn, isSecretConfigField as Qr, defineRecordKinds as Qt, customAction as R, RECORD_MAX_INDEX_FIELDS as Rn, hydrateSchema as Rr, SETTINGS_BROKERS_ADOPTS_PREFIX as Rt, invokeTrpcLeaf as S, RecordUniqueViolationError as Sn, formatSecretScope as Sr, FrameHandleSchema as St, createLazyTrpcSource as T, UnindexedFilterError as Tn, normalizeSecretOwner as Tr, ProfileSlotStatusSchema as Tt, DEFAULT_RUNTIME_STATE_DURABILITY as U, resolveSecretViewsIn as Un, isSecretFieldView as Ur, createRecordsAccess as Ut, deviceCustomAction as V, RECORD_SETTINGS_MAX_ROWS as Vn, classifySecretWrite as Vr, defineEntryKind as Vt, DEVICE_SETTINGS_CONTRIBUTION_METHODS as W, REVALIDATE_AFTER_MS as Wn, isSecretMarker as Wr, EntryDescriptorSchema as Wt, expandCapMethods as X, registerKnownSecret as Xn, collectSecretConfigKeys as Xr, assertValidDeclaration as Xt, event as Y, knownSecretCount as Yn, collectKeychainStoredKeys as Yr, RecordRetentionSchema as Yt, isDeviceConfigCap as Z, scrubKnownSecrets as Zn, isKeychainStoredField as Zr, declarationsOf as Zt, readErrorI18n as _, PlaintextSecretError as _n, resolveSecretMarkers as _r, CamProfileSchema as _t, asJsonArray as a, recordSecretRef as an, SHARE_VIEW_KINDS as ar, toNodeId as at, isDeviceScopedCap as b, RecordSecretUnavailableError as bn, arrayItemFieldPath as br, CameraStreamSchema as bt, asString as c, collectZodSecretPaths as cn, classifyStoreError as cr, ReadinessTimeoutError as ct, parseJsonUnknown as d, BatchTooLargeError as dn, parseSecretStatePath as dr, scopeKey as dt, schemaDeclaresAnyField as ei, collectSecretLeaves as en, PEER_BYTES_MAX_OUTSTANDING as er, resolveCapMount as et, hfModelUrl as f, DeclarationRefusedError as fn, secretTreeFromPaths as fr, AudioChunkFormatSchema as ft, ErrorI18nPayloadSchema as g, NoCallerError as gn, isSecretRefOwnedBy as gr, CAM_PROFILE_ORDER as gt, ErrorCodeSchema as h, InvalidRecordError as hn, collectSecretMarkerRefs as hr, BrokerStatusSchema as ht, asBoolean as i, isAudioChunkFormat as ii, recordSecretCollection as in, DATAPLANE_SECRET_HEADER as ir, readNodePin as it, RUNTIME_DEFAULTS as j, RECORD_CLASSES as jn, isEvent as jr, makeSourceBrokerId as jt, HF_BASE_URL as k, RECORD_BATCH_MAX as kn, createEvent as kr, SubscribeAudioChunksResultSchema as kt, parseJsonArray as l, isZodSecret as ln, normalizeAddonInitResult as lr, emitDownForOwnedCaps as lt, CamstackError as m, ForeignSecretMarkerError as mn, KeychainWriteRefusedError as mr, BrokerStatsSchema as mt, sleepCancellable as n, audioChunkBytesPerSample as ni, parseSecretPath as nn, PEER_BYTES_TICKET_TTL_MS as nr, CAP_NODE_PIN_CONTEXT_KEY as nt, asJsonObject as o, secretArrayPrefixes as on, DisposerChain as or, MODEL_FORMATS as ot, BOOT_RECOVERY_BACKOFF_MS as p, FilterRequiredError as pn, secretTreeFromSchema as pr, AudioStreamPickSchema as pt, HISTORY_UNIT_LABELS as q, clearKnownSecrets as qn, toSecretFieldView as qr, RecordKindDeclarationSchema as qt, maskUrlCredentials as r, expandAudioChunkToF32le as ri, recordArrayItemPath as rn, PeerBytesTicketSchema as rr, nodePin as rt, asNumber as s, SECRET_META as sn, BaseAddon as sr, ReadinessRegistry as st, sleep as t, AUDIO_CHUNK_FORMATS as ti, mapSecretLeaves as tn, PEER_BYTES_STALL_MS as tr, systemMethod as tt, parseJsonObject as u, AdoptionPendingError as un, mergeSecretStatePaths as ur, readinessKey as ut, userError as v, RECORDS_ERROR_CODES as vn, transformSecretWrite as vr, CamStreamKindSchema as vt, createEventBusSliceSource as w, RevConflictError as wn, isSecretRef as wr, ProfileSlotSchema as wt, createDeviceProxy as x, RecordTooLargeError as xn, buildSecretRef as xr, DecodedAudioChunkSchema as xt, DEVICE_SCOPED_CAPS as y, RecordNotFoundError as yn, SECRET_REF_SCHEME as yr, CamStreamResolutionSchema as yt, defineCustomActions as z, RECORD_QUERY_MAX as zn, resolveHydratedFieldValue as zr, parseSettingsBrokersAdoptsFrom as zt };
|