@camstack/server 1.2.760 → 1.2.762
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/CHANGELOG.md +17 -2
- package/dist/agent/main.js +1 -0
- package/dist/api/core/cap-providers.js +39 -8
- package/dist/api/core/integration-role.js +6 -3
- package/dist/api/trpc/generated-cap-mounts.js +1 -0
- package/dist/api/trpc/generated-cap-routers.js +27 -12
- package/dist/core/addon/addon-registry.service.js +1 -0
- package/package.json +19 -8
- package/system/dist/addon-runner.js +1 -0
- package/system/dist/addon-runner.mjs +1 -0
- package/system/dist/{agent-https-DXDFMq90.js → agent-https-BHpDnJr0.js} +1 -1
- package/system/dist/{agent-https-Bafgj4ni.mjs → agent-https-UksJdbes.mjs} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.js +7 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +7 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +3 -3
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +3 -3
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +3 -3
- package/system/dist/builtins/keychain/index.mjs +3 -3
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +2 -1
- package/system/dist/builtins/loki-logging/index.mjs +2 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/integration-registry.d.ts +6 -0
- package/system/dist/builtins/sqlite-storage/integration-rows-ports.d.ts +16 -0
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
- package/system/dist/builtins/storage-orchestrator/location-store.d.ts +8 -0
- package/system/dist/builtins/storage-orchestrator/migrations/index.d.ts +10 -0
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +22 -0
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +260 -19
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +260 -19
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +54 -21
- package/system/dist/builtins/storage-orchestrator/storage-writability-monitor.d.ts +36 -0
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-WttiBMdu.mjs → capture-engine-Btq9LseJ.mjs} +1 -1
- package/system/dist/{capture-engine-CInzGJAh.js → capture-engine-DgcmHuIi.js} +1 -1
- package/system/dist/{composition-sources-DQHH_g-A.js → composition-sources-DrGLoV8D.js} +1 -1
- package/system/dist/{composition-sources-A4LM38lT.mjs → composition-sources-xyPI-9ja.mjs} +1 -1
- package/system/dist/{constants-BAG_5cF6.mjs → constants-B8q9KsGq.mjs} +1 -1
- package/system/dist/{constants-hAbcGGDs.js → constants-BiE3GU1C.js} +1 -1
- package/system/dist/{device-ca-lLGjDsFP.js → device-ca-Bel2vDyJ.js} +1 -1
- package/system/dist/{device-ca-CCIaKs70.mjs → device-ca-D5U9i2AO.mjs} +1 -1
- package/system/dist/{dist-CiwLP3-C.js → dist-B6-AUY2T.js} +166 -24
- package/system/dist/{dist-BIJD_nvZ.mjs → dist-Dd_vXorK.mjs} +166 -24
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-CLlDILdC.js → hub-mdns-ciao-DV7bwoub.js} +2 -2
- package/system/dist/{hub-mdns-ciao-CXsUIWw_.mjs → hub-mdns-ciao-Dz9w_pd0.mjs} +2 -2
- package/system/dist/index.js +54 -7
- package/system/dist/index.mjs +54 -7
- package/system/dist/kernel/addon-loader.d.ts +13 -1
- package/system/dist/kernel/moleculer/addon-context-factory.d.ts +3 -1
- package/system/dist/{restore-archive-Dx9r-ndj.mjs → restore-archive-BcdcInFR.mjs} +1 -1
- package/system/dist/{restore-archive-CN1BA_o6.js → restore-archive-BcstsRhG.js} +1 -1
- package/system/dist/{wal-maintenance-B7wMSexc.mjs → wal-maintenance-Ctp8Q-y7.mjs} +0 -0
- package/system/dist/{wal-maintenance-CecPWej8.js → wal-maintenance-CzjpuF7n.js} +0 -0
- package/system/package.json +1 -1
|
@@ -1171,7 +1171,7 @@ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
|
|
|
1171
1171
|
return DeviceRole;
|
|
1172
1172
|
}({});
|
|
1173
1173
|
//#endregion
|
|
1174
|
-
//#region ../types/dist/sleep-
|
|
1174
|
+
//#region ../types/dist/sleep-BaWhXZFm.mjs
|
|
1175
1175
|
/**
|
|
1176
1176
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
1177
1177
|
* window to float samples (D455).
|
|
@@ -4185,6 +4185,10 @@ var RECORD_SECRET_COLLECTION_PREFIX = "records:";
|
|
|
4185
4185
|
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
4186
4186
|
* (`auth.accessToken`, `headers[].value`).
|
|
4187
4187
|
*
|
|
4188
|
+
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
4189
|
+
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
4190
|
+
* key releases exactly that key's secret.
|
|
4191
|
+
*
|
|
4188
4192
|
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
4189
4193
|
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
4190
4194
|
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
@@ -4197,11 +4201,13 @@ function parseSecretPath(path) {
|
|
|
4197
4201
|
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
4198
4202
|
return path.split(".").map((raw) => {
|
|
4199
4203
|
const each = raw.endsWith("[]");
|
|
4200
|
-
const
|
|
4204
|
+
const map = raw.endsWith("{}");
|
|
4205
|
+
const key = each || map ? raw.slice(0, -2) : raw;
|
|
4201
4206
|
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
4202
4207
|
return {
|
|
4203
4208
|
key,
|
|
4204
|
-
each
|
|
4209
|
+
each,
|
|
4210
|
+
map
|
|
4205
4211
|
};
|
|
4206
4212
|
});
|
|
4207
4213
|
}
|
|
@@ -4253,6 +4259,22 @@ function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arra
|
|
|
4253
4259
|
[segment.key]: mapped
|
|
4254
4260
|
};
|
|
4255
4261
|
}
|
|
4262
|
+
if (segment.map) {
|
|
4263
|
+
if (!isRecord$4(child)) return node;
|
|
4264
|
+
const kept = Object.entries(child).map(([mapKey, value]) => {
|
|
4265
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}{${encodeURIComponent(mapKey)}}`;
|
|
4266
|
+
if (!last) return [mapKey, mapAt(value, segments, index + 1, keys, concrete, declared, arrayKeys, visit)];
|
|
4267
|
+
return [mapKey, visit({
|
|
4268
|
+
declared,
|
|
4269
|
+
concrete,
|
|
4270
|
+
value
|
|
4271
|
+
})];
|
|
4272
|
+
}).filter(([, value]) => value !== REMOVE_LEAF);
|
|
4273
|
+
return {
|
|
4274
|
+
...node,
|
|
4275
|
+
[segment.key]: Object.fromEntries(kept)
|
|
4276
|
+
};
|
|
4277
|
+
}
|
|
4256
4278
|
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
|
|
4257
4279
|
if (last) {
|
|
4258
4280
|
const replacement = visit({
|
|
@@ -4410,7 +4432,8 @@ function isZodSecret(schema) {
|
|
|
4410
4432
|
}
|
|
4411
4433
|
/**
|
|
4412
4434
|
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
4413
|
-
* element of this array" (`connection.password`, `rows[].token`)
|
|
4435
|
+
* element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
|
|
4436
|
+
* map" (`applianceSecrets{}`). A declared
|
|
4414
4437
|
* object or array is reported as one path and not descended into — everything
|
|
4415
4438
|
* under it is secret.
|
|
4416
4439
|
*/
|
|
@@ -4421,6 +4444,7 @@ function collectZodSecretPaths(schema, prefix = "") {
|
|
|
4421
4444
|
const def = defOf(layer);
|
|
4422
4445
|
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
4423
4446
|
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
4447
|
+
else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
|
|
4424
4448
|
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
4425
4449
|
else if (def.type === "intersection") {
|
|
4426
4450
|
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
@@ -4567,7 +4591,7 @@ function defineRecordKinds(specs) {
|
|
|
4567
4591
|
retention: spec.retention,
|
|
4568
4592
|
deviceRemoval: spec.deviceRemoval,
|
|
4569
4593
|
maxDataBytes: spec.maxDataBytes,
|
|
4570
|
-
secretPaths: [...secretPaths],
|
|
4594
|
+
secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
|
|
4571
4595
|
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
4572
4596
|
transactFamily: spec.transactFamily,
|
|
4573
4597
|
entry: spec.entry === void 0 ? void 0 : {
|
|
@@ -4615,6 +4639,7 @@ function defineEntryKind(name, spec) {
|
|
|
4615
4639
|
...spec.database === void 0 ? {} : { database: spec.database },
|
|
4616
4640
|
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
4617
4641
|
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
4642
|
+
...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
|
|
4618
4643
|
entry: {
|
|
4619
4644
|
title: spec.title,
|
|
4620
4645
|
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
@@ -11032,11 +11057,49 @@ var IntegrationInstanceRefSchema = zod.z.object({
|
|
|
11032
11057
|
]),
|
|
11033
11058
|
candidateStableId: zod.z.string().optional()
|
|
11034
11059
|
});
|
|
11060
|
+
/**
|
|
11061
|
+
* `RecordIntegrationInstances` - the `integration-instances` provider over ONE
|
|
11062
|
+
* entry kind, so an addon that holds a connection serves it in ~30 lines.
|
|
11063
|
+
*
|
|
11064
|
+
* Every instance is one record of the addon's own kind, keyed by the
|
|
11065
|
+
* `integrations` registry id. The records door does the secret work: a field the
|
|
11066
|
+
* kind marks `.meta({ secret: true })` is a keychain marker bound to the row, so
|
|
11067
|
+
* deleting the row deletes the secret, and one row's value is never another's.
|
|
11068
|
+
*
|
|
11069
|
+
* Patch rules for a secret (`updateInstance`): omitted, `''`, the redaction
|
|
11070
|
+
* token or the view the form was given KEEP the stored secret;
|
|
11071
|
+
* `{ $secretClear: true }` clears it; any other string replaces it.
|
|
11072
|
+
*/
|
|
11035
11073
|
/** The most instances one addon lists (an integrations page, not a table). */
|
|
11036
11074
|
var INSTANCES_LIST_MAX = 1e3;
|
|
11037
11075
|
/** The keys of the kind's secret fields that sit at the top level of the body. */
|
|
11038
11076
|
function topLevelSecretKeys(paths) {
|
|
11039
|
-
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[")));
|
|
11077
|
+
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[") && !p.includes("{")));
|
|
11078
|
+
}
|
|
11079
|
+
/** The keys of the kind's top-level MAPS whose values are secrets (`applianceSecrets{}`). */
|
|
11080
|
+
function secretMapKeys(paths) {
|
|
11081
|
+
return new Set(paths.filter((p) => p.endsWith("{}") && !p.slice(0, -2).match(/[.[{]/)).map((p) => p.slice(0, -2)));
|
|
11082
|
+
}
|
|
11083
|
+
/**
|
|
11084
|
+
* A patch value for a map of secrets: an entry that is omitted, `''`, the redaction token or the
|
|
11085
|
+
* view the form was given KEEPS its stored secret (it is left out of the merge); `{ $secretClear }`
|
|
11086
|
+
* or `null` removes the entry; any other string replaces it. Null when nothing is left to merge.
|
|
11087
|
+
*/
|
|
11088
|
+
function secretMapPatch(value) {
|
|
11089
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
11090
|
+
const out = {};
|
|
11091
|
+
for (const [key, entry] of Object.entries(value)) if (entry === null || isSecretClear(entry)) out[key] = null;
|
|
11092
|
+
else if (typeof entry === "string" && entry !== "" && entry !== "__camstack_redacted__" && !isSecretFieldView(entry)) out[key] = entry;
|
|
11093
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
11094
|
+
}
|
|
11095
|
+
/** Does the kind's body schema carry an `enabled` field? */
|
|
11096
|
+
function declaresEnabled(kind) {
|
|
11097
|
+
const json = zod.z.toJSONSchema(kind.schema, {
|
|
11098
|
+
unrepresentable: "any",
|
|
11099
|
+
io: "input"
|
|
11100
|
+
});
|
|
11101
|
+
const properties = Reflect.get(json, "properties");
|
|
11102
|
+
return typeof properties === "object" && properties !== null && "enabled" in properties;
|
|
11040
11103
|
}
|
|
11041
11104
|
var RecordIntegrationInstances = class {
|
|
11042
11105
|
records;
|
|
@@ -11044,14 +11107,20 @@ var RecordIntegrationInstances = class {
|
|
|
11044
11107
|
hooks;
|
|
11045
11108
|
handle;
|
|
11046
11109
|
secretKeys;
|
|
11110
|
+
secretMaps;
|
|
11047
11111
|
nameField;
|
|
11112
|
+
/** The `integrations` registry owns the on/off switch (`role: devices`); the body has none. */
|
|
11113
|
+
registryOwnsEnabled;
|
|
11048
11114
|
constructor(records, kind, hooks) {
|
|
11049
11115
|
this.records = records;
|
|
11050
11116
|
this.kind = kind;
|
|
11051
11117
|
this.hooks = hooks;
|
|
11052
11118
|
this.handle = records.kind(kind);
|
|
11053
11119
|
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
11120
|
+
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
11054
11121
|
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
11122
|
+
this.registryOwnsEnabled = hooks.description.role === "devices";
|
|
11123
|
+
if (this.registryOwnsEnabled && declaresEnabled(kind)) throw new Error(`kind "${kind.name}": the integrations registry owns the on/off switch of a role "devices" addon, so the body must not declare "enabled"`);
|
|
11055
11124
|
}
|
|
11056
11125
|
/**
|
|
11057
11126
|
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
@@ -11097,12 +11166,12 @@ var RecordIntegrationInstances = class {
|
|
|
11097
11166
|
const shown = secretViewsOf(this.records.owner, this.kind.name, record.id, this.kind.declaration, record.data);
|
|
11098
11167
|
const rawName = record.data[this.nameField];
|
|
11099
11168
|
const kind = this.hooks.kindOf?.(record.data);
|
|
11100
|
-
const health = this.hooks.health?.(record.data);
|
|
11169
|
+
const health = this.hooks.health?.(record.data, record.id);
|
|
11101
11170
|
return {
|
|
11102
11171
|
id: record.id,
|
|
11103
11172
|
name: typeof rawName === "string" ? rawName : record.id,
|
|
11104
11173
|
configured: this.hooks.configured(record.data),
|
|
11105
|
-
enabled: record.data.enabled !== false,
|
|
11174
|
+
...this.registryOwnsEnabled ? {} : { enabled: record.data.enabled !== false },
|
|
11106
11175
|
formValues: shown,
|
|
11107
11176
|
...kind !== void 0 ? { kind } : {},
|
|
11108
11177
|
...health?.status !== void 0 ? { status: health.status } : {},
|
|
@@ -11132,32 +11201,36 @@ var RecordIntegrationInstances = class {
|
|
|
11132
11201
|
id: minted,
|
|
11133
11202
|
data: this.hooks.initialBody(name, kind)
|
|
11134
11203
|
}, { ifRev: 0 });
|
|
11135
|
-
await this.hooks.onChanged?.(minted);
|
|
11204
|
+
await this.hooks.onChanged?.(minted, "created");
|
|
11136
11205
|
return { id: minted };
|
|
11137
11206
|
};
|
|
11138
11207
|
updateInstance = async ({ id, name, values }) => {
|
|
11139
11208
|
const patch = {};
|
|
11140
11209
|
for (const [key, value] of Object.entries(values)) {
|
|
11141
11210
|
if (value === void 0) continue;
|
|
11142
|
-
if (
|
|
11211
|
+
if (this.secretMaps.has(key)) {
|
|
11212
|
+
const entries = secretMapPatch(value);
|
|
11213
|
+
if (entries !== null) patch[key] = entries;
|
|
11214
|
+
} else if (!this.secretKeys.has(key)) patch[key] = value;
|
|
11143
11215
|
else if (isSecretClear(value)) patch[key] = null;
|
|
11144
11216
|
else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
|
|
11145
11217
|
}
|
|
11146
11218
|
if (name !== void 0) patch[this.nameField] = name;
|
|
11147
11219
|
await this.handle.patch(id, patch);
|
|
11148
|
-
await this.hooks.onChanged?.(id);
|
|
11220
|
+
await this.hooks.onChanged?.(id, "updated");
|
|
11149
11221
|
return { ok: true };
|
|
11150
11222
|
};
|
|
11151
11223
|
/** The switch lives in the record body; the addon is told so it applies it (D996). */
|
|
11152
11224
|
setInstanceEnabled = async ({ id, enabled }) => {
|
|
11225
|
+
if (this.registryOwnsEnabled) throw new Error(`instance "${id}": the integrations registry owns the on/off switch of this addon; set it with integrations.update`);
|
|
11153
11226
|
await this.handle.patch(id, { enabled });
|
|
11154
|
-
await this.hooks.onChanged?.(id);
|
|
11227
|
+
await this.hooks.onChanged?.(id, "enabled");
|
|
11155
11228
|
return { ok: true };
|
|
11156
11229
|
};
|
|
11157
11230
|
/** The row and its keychain refs go together (the records door). */
|
|
11158
11231
|
deleteInstance = async ({ id }) => {
|
|
11159
11232
|
await this.handle.delete(id);
|
|
11160
|
-
await this.hooks.onChanged?.(id);
|
|
11233
|
+
await this.hooks.onChanged?.(id, "deleted");
|
|
11161
11234
|
return { ok: true };
|
|
11162
11235
|
};
|
|
11163
11236
|
testInstance = async (input) => {
|
|
@@ -56335,7 +56408,27 @@ var deviceCredentialsCapability = {
|
|
|
56335
56408
|
* exposes only the COMMON surface: link state, supported device
|
|
56336
56409
|
* kinds (so the UI can filter the device picker), and per-device
|
|
56337
56410
|
* expose/unexpose.
|
|
56338
|
-
|
|
56411
|
+
*
|
|
56412
|
+
* INSTANCES. One export addon can serve several independent targets (a
|
|
56413
|
+
* HomeKit bridge, a Home Assistant broker). `listInstances` names them.
|
|
56414
|
+
* `instanceId` on a READ is optional: absent = the whole addon (linked if any
|
|
56415
|
+
* enabled instance is, `exposedDeviceCount` = distinct devices, `setup` = the
|
|
56416
|
+
* default instance's); present = that instance; an id the provider does not
|
|
56417
|
+
* serve is refused with `ExportInstanceUnknownError` (`export-instance-unknown`),
|
|
56418
|
+
* never answered empty. `instanceId` on a WRITE is REQUIRED: a membership
|
|
56419
|
+
* change always names the target it changes. A single-instance provider
|
|
56420
|
+
* accepts an absent id on a read or its own id, and refuses any other.
|
|
56421
|
+
*/
|
|
56422
|
+
/** Which instance of an export addon a call addresses. Absent on a read = the whole addon. */
|
|
56423
|
+
var InstanceIdSchema$1 = zod.z.string().min(1);
|
|
56424
|
+
var InstancePinSchema = zod.z.object({ instanceId: InstanceIdSchema$1.optional() });
|
|
56425
|
+
/** One independent export target of an addon. */
|
|
56426
|
+
var ExportInstanceSchema = zod.z.object({
|
|
56427
|
+
instanceId: InstanceIdSchema$1,
|
|
56428
|
+
name: zod.z.string(),
|
|
56429
|
+
enabled: zod.z.boolean(),
|
|
56430
|
+
kind: zod.z.string().optional()
|
|
56431
|
+
});
|
|
56339
56432
|
var LinkStateSchema = zod.z.enum([
|
|
56340
56433
|
"unlinked",
|
|
56341
56434
|
"linked",
|
|
@@ -56386,10 +56479,14 @@ var ExposedDeviceSchema = zod.z.object({
|
|
|
56386
56479
|
capabilities: zod.z.array(zod.z.string()).optional()
|
|
56387
56480
|
});
|
|
56388
56481
|
var ExposeInputSchema = zod.z.object({
|
|
56482
|
+
instanceId: InstanceIdSchema$1,
|
|
56389
56483
|
deviceId: zod.z.string(),
|
|
56390
56484
|
capabilities: zod.z.array(zod.z.string()).optional()
|
|
56391
56485
|
});
|
|
56392
|
-
var UnexposeInputSchema = zod.z.object({
|
|
56486
|
+
var UnexposeInputSchema = zod.z.object({
|
|
56487
|
+
instanceId: InstanceIdSchema$1,
|
|
56488
|
+
deviceId: zod.z.string()
|
|
56489
|
+
});
|
|
56393
56490
|
/**
|
|
56394
56491
|
* What an exporter may expose besides devices (D968). An action and a
|
|
56395
56492
|
* notification target are LIST ENTRIES, never devices (D954): they enter an
|
|
@@ -56418,8 +56515,14 @@ var ExposedEntitySchema = zod.z.object({
|
|
|
56418
56515
|
entity: ExportEntityRefSchema,
|
|
56419
56516
|
exposedAs: zod.z.string().optional()
|
|
56420
56517
|
});
|
|
56421
|
-
var ExposeEntityInputSchema = zod.z.object({
|
|
56422
|
-
|
|
56518
|
+
var ExposeEntityInputSchema = zod.z.object({
|
|
56519
|
+
instanceId: InstanceIdSchema$1,
|
|
56520
|
+
entity: ExportEntityRefSchema
|
|
56521
|
+
});
|
|
56522
|
+
var UnexposeEntityInputSchema = zod.z.object({
|
|
56523
|
+
instanceId: InstanceIdSchema$1,
|
|
56524
|
+
entity: ExportEntityRefSchema
|
|
56525
|
+
});
|
|
56423
56526
|
var deviceExportCapability = {
|
|
56424
56527
|
name: "device-export",
|
|
56425
56528
|
scope: "system",
|
|
@@ -56439,9 +56542,10 @@ var deviceExportCapability = {
|
|
|
56439
56542
|
*/
|
|
56440
56543
|
exposesDeviceSettings: true,
|
|
56441
56544
|
methods: {
|
|
56442
|
-
getStatus: method(
|
|
56443
|
-
|
|
56444
|
-
|
|
56545
|
+
getStatus: method(InstancePinSchema, DeviceExportStatusSchema),
|
|
56546
|
+
listInstances: method(zod.z.void(), zod.z.array(ExportInstanceSchema)),
|
|
56547
|
+
listSupportedDeviceKinds: method(InstancePinSchema, zod.z.array(DeviceKindSchema)),
|
|
56548
|
+
listExposedDevices: method(InstancePinSchema, zod.z.array(ExposedDeviceSchema)),
|
|
56445
56549
|
exposeDevice: method(ExposeInputSchema, zod.z.void(), {
|
|
56446
56550
|
kind: "mutation",
|
|
56447
56551
|
auth: "admin"
|
|
@@ -56451,7 +56555,7 @@ var deviceExportCapability = {
|
|
|
56451
56555
|
auth: "admin"
|
|
56452
56556
|
}),
|
|
56453
56557
|
listSupportedEntityKinds: optionalMethod(zod.z.void(), zod.z.array(ExportEntityKindSchema)),
|
|
56454
|
-
listExposedEntities: optionalMethod(
|
|
56558
|
+
listExposedEntities: optionalMethod(InstancePinSchema, zod.z.array(ExposedEntitySchema)),
|
|
56455
56559
|
exposeEntity: optionalMethod(ExposeEntityInputSchema, zod.z.void(), {
|
|
56456
56560
|
kind: "mutation",
|
|
56457
56561
|
auth: "admin"
|
|
@@ -62101,7 +62205,37 @@ var IntegrationInstanceKindSchema = zod.z.object({
|
|
|
62101
62205
|
/** Relative hub path to disconnect that account. */
|
|
62102
62206
|
disconnectPath: zod.z.string().min(1).optional()
|
|
62103
62207
|
});
|
|
62208
|
+
/**
|
|
62209
|
+
* What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
|
|
62210
|
+
* instance is an integration that brings devices (the registry owns its on/off switch);
|
|
62211
|
+
* `services`: a connection configured from the addon's own function page, never listed on
|
|
62212
|
+
* Integrations; `both`: a dual entry listed for its devices that also keeps service connections.
|
|
62213
|
+
* It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
|
|
62214
|
+
*/
|
|
62215
|
+
var IntegrationInstanceRoleSchema = zod.z.enum([
|
|
62216
|
+
"devices",
|
|
62217
|
+
"services",
|
|
62218
|
+
"both"
|
|
62219
|
+
]);
|
|
62220
|
+
/**
|
|
62221
|
+
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
62222
|
+
* scans the network before any instance exists (the wizard offers the candidates); `account`: the
|
|
62223
|
+
* devices appear after the instance signs in. `scopedToInstance`: a discovery run belongs to ONE
|
|
62224
|
+
* instance and its candidates are claimed by it.
|
|
62225
|
+
*/
|
|
62226
|
+
var IntegrationInstanceDiscoverySchema = zod.z.object({
|
|
62227
|
+
mode: zod.z.enum([
|
|
62228
|
+
"none",
|
|
62229
|
+
"lan",
|
|
62230
|
+
"account"
|
|
62231
|
+
]),
|
|
62232
|
+
scopedToInstance: zod.z.boolean()
|
|
62233
|
+
});
|
|
62104
62234
|
var IntegrationInstanceDescriptionSchema = zod.z.object({
|
|
62235
|
+
/** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
|
|
62236
|
+
role: IntegrationInstanceRoleSchema,
|
|
62237
|
+
/** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
|
|
62238
|
+
discovery: IntegrationInstanceDiscoverySchema.optional(),
|
|
62105
62239
|
/** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
|
|
62106
62240
|
instanceMode: IntegrationInstanceModeSchema,
|
|
62107
62241
|
/** What the instance is, for the UI (`destination`, `relay`, `account`). */
|
|
@@ -62141,10 +62275,11 @@ var IntegrationInstanceSchema = zod.z.object({
|
|
|
62141
62275
|
/** The addon's own rule (an URL is present, a client id is present...). */
|
|
62142
62276
|
configured: zod.z.boolean(),
|
|
62143
62277
|
/**
|
|
62144
|
-
* The instance's own on/off switch (D996)
|
|
62145
|
-
*
|
|
62278
|
+
* The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
|
|
62279
|
+
* so a row written before the field existed is on). Absent when the `integrations` registry
|
|
62280
|
+
* owns the switch (`describe().role` is `devices`): read it from the registry row.
|
|
62146
62281
|
*/
|
|
62147
|
-
enabled: zod.z.boolean(),
|
|
62282
|
+
enabled: zod.z.boolean().optional(),
|
|
62148
62283
|
/** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
|
|
62149
62284
|
kind: zod.z.string().optional(),
|
|
62150
62285
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
@@ -97035,6 +97170,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
97035
97170
|
access: "view",
|
|
97036
97171
|
role: "admin"
|
|
97037
97172
|
},
|
|
97173
|
+
"deviceExport.listInstances": {
|
|
97174
|
+
capName: "device-export",
|
|
97175
|
+
capScope: "system",
|
|
97176
|
+
addonId: null,
|
|
97177
|
+
access: "view",
|
|
97178
|
+
role: "admin"
|
|
97179
|
+
},
|
|
97038
97180
|
"deviceExport.listSupportedDeviceKinds": {
|
|
97039
97181
|
capName: "device-export",
|
|
97040
97182
|
capScope: "system",
|