@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 zod.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 = zod.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",
|
|
@@ -7128,6 +7569,12 @@ Object.defineProperty(exports, "BrokerStatusSchema", {
|
|
|
7128
7569
|
return BrokerStatusSchema;
|
|
7129
7570
|
}
|
|
7130
7571
|
});
|
|
7572
|
+
Object.defineProperty(exports, "CALLER_STAMPED_CAPABILITIES", {
|
|
7573
|
+
enumerable: true,
|
|
7574
|
+
get: function() {
|
|
7575
|
+
return CALLER_STAMPED_CAPABILITIES;
|
|
7576
|
+
}
|
|
7577
|
+
});
|
|
7131
7578
|
Object.defineProperty(exports, "CAM_PROFILE_ORDER", {
|
|
7132
7579
|
enumerable: true,
|
|
7133
7580
|
get: function() {
|
|
@@ -7596,6 +8043,18 @@ Object.defineProperty(exports, "SECRET_REF_SCHEME", {
|
|
|
7596
8043
|
return SECRET_REF_SCHEME;
|
|
7597
8044
|
}
|
|
7598
8045
|
});
|
|
8046
|
+
Object.defineProperty(exports, "SETTINGS_ARRAY_ADOPTS_PREFIX", {
|
|
8047
|
+
enumerable: true,
|
|
8048
|
+
get: function() {
|
|
8049
|
+
return SETTINGS_ARRAY_ADOPTS_PREFIX;
|
|
8050
|
+
}
|
|
8051
|
+
});
|
|
8052
|
+
Object.defineProperty(exports, "SETTINGS_BROKERS_ADOPTS_PREFIX", {
|
|
8053
|
+
enumerable: true,
|
|
8054
|
+
get: function() {
|
|
8055
|
+
return SETTINGS_BROKERS_ADOPTS_PREFIX;
|
|
8056
|
+
}
|
|
8057
|
+
});
|
|
7599
8058
|
Object.defineProperty(exports, "SHARE_VIEW_KINDS", {
|
|
7600
8059
|
enumerable: true,
|
|
7601
8060
|
get: function() {
|
|
@@ -7650,6 +8109,12 @@ Object.defineProperty(exports, "WELL_KNOWN_TAB_MAP", {
|
|
|
7650
8109
|
return WELL_KNOWN_TAB_MAP;
|
|
7651
8110
|
}
|
|
7652
8111
|
});
|
|
8112
|
+
Object.defineProperty(exports, "addonSliceHandleApi", {
|
|
8113
|
+
enumerable: true,
|
|
8114
|
+
get: function() {
|
|
8115
|
+
return addonSliceHandleApi;
|
|
8116
|
+
}
|
|
8117
|
+
});
|
|
7653
8118
|
Object.defineProperty(exports, "adminUiCapability", {
|
|
7654
8119
|
enumerable: true,
|
|
7655
8120
|
get: function() {
|
|
@@ -7860,6 +8325,18 @@ Object.defineProperty(exports, "defineRecordKinds", {
|
|
|
7860
8325
|
return defineRecordKinds;
|
|
7861
8326
|
}
|
|
7862
8327
|
});
|
|
8328
|
+
Object.defineProperty(exports, "dehydrateConfigField", {
|
|
8329
|
+
enumerable: true,
|
|
8330
|
+
get: function() {
|
|
8331
|
+
return dehydrateConfigField;
|
|
8332
|
+
}
|
|
8333
|
+
});
|
|
8334
|
+
Object.defineProperty(exports, "dehydrateSchema", {
|
|
8335
|
+
enumerable: true,
|
|
8336
|
+
get: function() {
|
|
8337
|
+
return dehydrateSchema;
|
|
8338
|
+
}
|
|
8339
|
+
});
|
|
7863
8340
|
Object.defineProperty(exports, "describeCustomActions", {
|
|
7864
8341
|
enumerable: true,
|
|
7865
8342
|
get: function() {
|
|
@@ -7944,6 +8421,12 @@ Object.defineProperty(exports, "hydrateSchema", {
|
|
|
7944
8421
|
return hydrateSchema;
|
|
7945
8422
|
}
|
|
7946
8423
|
});
|
|
8424
|
+
Object.defineProperty(exports, "invokeTrpcLeaf", {
|
|
8425
|
+
enumerable: true,
|
|
8426
|
+
get: function() {
|
|
8427
|
+
return invokeTrpcLeaf;
|
|
8428
|
+
}
|
|
8429
|
+
});
|
|
7947
8430
|
Object.defineProperty(exports, "isAudioChunkFormat", {
|
|
7948
8431
|
enumerable: true,
|
|
7949
8432
|
get: function() {
|
|
@@ -8028,6 +8511,12 @@ Object.defineProperty(exports, "knownSecretCount", {
|
|
|
8028
8511
|
return knownSecretCount;
|
|
8029
8512
|
}
|
|
8030
8513
|
});
|
|
8514
|
+
Object.defineProperty(exports, "makeInMemoryRecords", {
|
|
8515
|
+
enumerable: true,
|
|
8516
|
+
get: function() {
|
|
8517
|
+
return makeInMemoryRecords;
|
|
8518
|
+
}
|
|
8519
|
+
});
|
|
8031
8520
|
Object.defineProperty(exports, "makeProfileBrokerId", {
|
|
8032
8521
|
enumerable: true,
|
|
8033
8522
|
get: function() {
|
|
@@ -8094,6 +8583,12 @@ Object.defineProperty(exports, "normalizeSecretOwner", {
|
|
|
8094
8583
|
return normalizeSecretOwner;
|
|
8095
8584
|
}
|
|
8096
8585
|
});
|
|
8586
|
+
Object.defineProperty(exports, "omitTransientConfig", {
|
|
8587
|
+
enumerable: true,
|
|
8588
|
+
get: function() {
|
|
8589
|
+
return omitTransientConfig;
|
|
8590
|
+
}
|
|
8591
|
+
});
|
|
8097
8592
|
Object.defineProperty(exports, "optionalMethod", {
|
|
8098
8593
|
enumerable: true,
|
|
8099
8594
|
get: function() {
|
|
@@ -8142,6 +8637,18 @@ Object.defineProperty(exports, "parseSecretStatePath", {
|
|
|
8142
8637
|
return parseSecretStatePath;
|
|
8143
8638
|
}
|
|
8144
8639
|
});
|
|
8640
|
+
Object.defineProperty(exports, "parseSettingsArrayAdoptsFrom", {
|
|
8641
|
+
enumerable: true,
|
|
8642
|
+
get: function() {
|
|
8643
|
+
return parseSettingsArrayAdoptsFrom;
|
|
8644
|
+
}
|
|
8645
|
+
});
|
|
8646
|
+
Object.defineProperty(exports, "parseSettingsBrokersAdoptsFrom", {
|
|
8647
|
+
enumerable: true,
|
|
8648
|
+
get: function() {
|
|
8649
|
+
return parseSettingsBrokersAdoptsFrom;
|
|
8650
|
+
}
|
|
8651
|
+
});
|
|
8145
8652
|
Object.defineProperty(exports, "readErrorI18n", {
|
|
8146
8653
|
enumerable: true,
|
|
8147
8654
|
get: function() {
|
|
@@ -8256,6 +8763,18 @@ Object.defineProperty(exports, "selectAssignedProfileSlots", {
|
|
|
8256
8763
|
return selectAssignedProfileSlots;
|
|
8257
8764
|
}
|
|
8258
8765
|
});
|
|
8766
|
+
Object.defineProperty(exports, "settingsArrayAdoptsFrom", {
|
|
8767
|
+
enumerable: true,
|
|
8768
|
+
get: function() {
|
|
8769
|
+
return settingsArrayAdoptsFrom;
|
|
8770
|
+
}
|
|
8771
|
+
});
|
|
8772
|
+
Object.defineProperty(exports, "settingsBrokersAdoptsFrom", {
|
|
8773
|
+
enumerable: true,
|
|
8774
|
+
get: function() {
|
|
8775
|
+
return settingsBrokersAdoptsFrom;
|
|
8776
|
+
}
|
|
8777
|
+
});
|
|
8259
8778
|
Object.defineProperty(exports, "shortSecretRefHash", {
|
|
8260
8779
|
enumerable: true,
|
|
8261
8780
|
get: function() {
|
|
@@ -8310,3 +8829,9 @@ Object.defineProperty(exports, "viewerUiCapability", {
|
|
|
8310
8829
|
return viewerUiCapability;
|
|
8311
8830
|
}
|
|
8312
8831
|
});
|
|
8832
|
+
Object.defineProperty(exports, "withoutCallerStamp", {
|
|
8833
|
+
enumerable: true,
|
|
8834
|
+
get: function() {
|
|
8835
|
+
return withoutCallerStamp;
|
|
8836
|
+
}
|
|
8837
|
+
});
|