@camstack/server 1.2.761 → 1.2.763
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 +12 -0
- package/dist/api/core/cap-providers.js +39 -8
- package/dist/api/core/integration-role.js +6 -3
- package/package.json +8 -16
- package/system/dist/{agent-https-YFeT_9qF.js → agent-https-DJAX08DO.js} +1 -1
- package/system/dist/{agent-https-D1B_fvIx.mjs → agent-https-DvdcveCd.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.d.ts +7 -0
- package/system/dist/builtins/alerts/alerts.addon.js +50 -3
- package/system/dist/builtins/alerts/alerts.addon.mjs +50 -3
- 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 +7 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +7 -3
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- 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-C6myWpTr.mjs → capture-engine-5KqfVEyZ.mjs} +1 -1
- package/system/dist/{capture-engine-JrgzDAeI.js → capture-engine-Aq9_3cDa.js} +1 -1
- package/system/dist/{composition-sources-53ryTB8m.js → composition-sources-JszOBvBv.js} +1 -1
- package/system/dist/{composition-sources-BJleLIBr.mjs → composition-sources-bbu-Zpc3.mjs} +1 -1
- package/system/dist/{constants-DW74hDp7.mjs → constants-BNmGDQke.mjs} +1 -1
- package/system/dist/{constants-nY2QXQK5.js → constants-CHGHz6jj.js} +1 -1
- package/system/dist/{device-ca-CzGQ4dJn.js → device-ca-BEhhnh7w.js} +1 -1
- package/system/dist/{device-ca-BUTX2AaQ.mjs → device-ca-C6UYk5Rm.mjs} +1 -1
- package/system/dist/{dist-Cyida7ne.js → dist-DiyRxDa1.js} +133 -18
- package/system/dist/{dist-Cu6VwGZZ.mjs → dist-LA9NIY-I.mjs} +133 -18
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-CXAFrkV0.js → hub-mdns-ciao-CiMvKezA.js} +2 -2
- package/system/dist/{hub-mdns-ciao-scMSbV7j.mjs → hub-mdns-ciao-Dvavkx33.mjs} +2 -2
- package/system/dist/index.js +25 -7
- package/system/dist/index.mjs +25 -7
- package/system/dist/{restore-archive-pn_Y6UG7.js → restore-archive-CV8S0D4h.js} +1 -1
- package/system/dist/{restore-archive-jWL53_V-.mjs → restore-archive-oC0JX7Aj.mjs} +1 -1
- package/system/dist/{wal-maintenance-CODI9DuS.js → wal-maintenance--DYbopvj.js} +0 -0
- package/system/dist/{wal-maintenance-By_dPC7l.mjs → wal-maintenance-C28BGIti.mjs} +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-Cv4Zmie9.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).
|
|
@@ -1835,7 +1835,7 @@ var NOT_RUN = {
|
|
|
1835
1835
|
* throws: an unreachable or refusing engine is logged and reported `declared: false`,
|
|
1836
1836
|
* because the hub (and this addon's boot) must not hang on a migration.
|
|
1837
1837
|
*/
|
|
1838
|
-
async function runAddonMigrations(host, migrations, logger) {
|
|
1838
|
+
async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
1839
1839
|
const first = migrations[0];
|
|
1840
1840
|
if (first === void 0) return NOT_RUN;
|
|
1841
1841
|
const owner = first.meta.owner;
|
|
@@ -1864,7 +1864,9 @@ async function runAddonMigrations(host, migrations, logger) {
|
|
|
1864
1864
|
else if (status === "blocked") blocked.push(id);
|
|
1865
1865
|
else skipped.push(id);
|
|
1866
1866
|
};
|
|
1867
|
+
const selected = options.only === void 0 ? null : new Set(options.only);
|
|
1867
1868
|
for (const step of declaration.steps) {
|
|
1869
|
+
if (selected !== null && !selected.has(step.id)) continue;
|
|
1868
1870
|
const bound = byId.get(step.id);
|
|
1869
1871
|
if (bound === void 0 || step.action === "skip") {
|
|
1870
1872
|
skipped.push(step.id);
|
|
@@ -3037,14 +3039,18 @@ var BaseAddon = class {
|
|
|
3037
3039
|
* nothing; the boot continues. A migration that FAILED (or was blocked by one)
|
|
3038
3040
|
* and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
|
|
3039
3041
|
* serve data whose shape it cannot trust; `tolerate` migrations never do.
|
|
3042
|
+
*
|
|
3043
|
+
* ALWAYS pass the whole catalogue; a phase that must run only some of it passes
|
|
3044
|
+
* `{ only: [ids] }` — never a filtered catalogue (the engine would judge the
|
|
3045
|
+
* omitted applied ids "newer").
|
|
3040
3046
|
*/
|
|
3041
|
-
async runMigrations(migrations) {
|
|
3047
|
+
async runMigrations(migrations, options) {
|
|
3042
3048
|
const api = this.ctx.api.migrations;
|
|
3043
3049
|
const report = await runAddonMigrations({
|
|
3044
3050
|
declareOwner: (input) => api.declareOwner.mutate(input),
|
|
3045
3051
|
startMigration: (input) => api.startMigration.mutate(input),
|
|
3046
3052
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
3047
|
-
}, migrations, this.ctx.logger);
|
|
3053
|
+
}, migrations, this.ctx.logger, options);
|
|
3048
3054
|
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
3049
3055
|
return report;
|
|
3050
3056
|
}
|
|
@@ -4185,6 +4191,10 @@ var RECORD_SECRET_COLLECTION_PREFIX = "records:";
|
|
|
4185
4191
|
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
4186
4192
|
* (`auth.accessToken`, `headers[].value`).
|
|
4187
4193
|
*
|
|
4194
|
+
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
4195
|
+
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
4196
|
+
* key releases exactly that key's secret.
|
|
4197
|
+
*
|
|
4188
4198
|
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
4189
4199
|
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
4190
4200
|
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
@@ -4197,11 +4207,13 @@ function parseSecretPath(path) {
|
|
|
4197
4207
|
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
4198
4208
|
return path.split(".").map((raw) => {
|
|
4199
4209
|
const each = raw.endsWith("[]");
|
|
4200
|
-
const
|
|
4210
|
+
const map = raw.endsWith("{}");
|
|
4211
|
+
const key = each || map ? raw.slice(0, -2) : raw;
|
|
4201
4212
|
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
4202
4213
|
return {
|
|
4203
4214
|
key,
|
|
4204
|
-
each
|
|
4215
|
+
each,
|
|
4216
|
+
map
|
|
4205
4217
|
};
|
|
4206
4218
|
});
|
|
4207
4219
|
}
|
|
@@ -4253,6 +4265,22 @@ function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arra
|
|
|
4253
4265
|
[segment.key]: mapped
|
|
4254
4266
|
};
|
|
4255
4267
|
}
|
|
4268
|
+
if (segment.map) {
|
|
4269
|
+
if (!isRecord$4(child)) return node;
|
|
4270
|
+
const kept = Object.entries(child).map(([mapKey, value]) => {
|
|
4271
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}{${encodeURIComponent(mapKey)}}`;
|
|
4272
|
+
if (!last) return [mapKey, mapAt(value, segments, index + 1, keys, concrete, declared, arrayKeys, visit)];
|
|
4273
|
+
return [mapKey, visit({
|
|
4274
|
+
declared,
|
|
4275
|
+
concrete,
|
|
4276
|
+
value
|
|
4277
|
+
})];
|
|
4278
|
+
}).filter(([, value]) => value !== REMOVE_LEAF);
|
|
4279
|
+
return {
|
|
4280
|
+
...node,
|
|
4281
|
+
[segment.key]: Object.fromEntries(kept)
|
|
4282
|
+
};
|
|
4283
|
+
}
|
|
4256
4284
|
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
|
|
4257
4285
|
if (last) {
|
|
4258
4286
|
const replacement = visit({
|
|
@@ -4410,7 +4438,8 @@ function isZodSecret(schema) {
|
|
|
4410
4438
|
}
|
|
4411
4439
|
/**
|
|
4412
4440
|
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
4413
|
-
* element of this array" (`connection.password`, `rows[].token`)
|
|
4441
|
+
* element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
|
|
4442
|
+
* map" (`applianceSecrets{}`). A declared
|
|
4414
4443
|
* object or array is reported as one path and not descended into — everything
|
|
4415
4444
|
* under it is secret.
|
|
4416
4445
|
*/
|
|
@@ -4421,6 +4450,7 @@ function collectZodSecretPaths(schema, prefix = "") {
|
|
|
4421
4450
|
const def = defOf(layer);
|
|
4422
4451
|
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
4423
4452
|
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
4453
|
+
else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
|
|
4424
4454
|
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
4425
4455
|
else if (def.type === "intersection") {
|
|
4426
4456
|
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
@@ -11033,11 +11063,49 @@ var IntegrationInstanceRefSchema = zod.z.object({
|
|
|
11033
11063
|
]),
|
|
11034
11064
|
candidateStableId: zod.z.string().optional()
|
|
11035
11065
|
});
|
|
11066
|
+
/**
|
|
11067
|
+
* `RecordIntegrationInstances` - the `integration-instances` provider over ONE
|
|
11068
|
+
* entry kind, so an addon that holds a connection serves it in ~30 lines.
|
|
11069
|
+
*
|
|
11070
|
+
* Every instance is one record of the addon's own kind, keyed by the
|
|
11071
|
+
* `integrations` registry id. The records door does the secret work: a field the
|
|
11072
|
+
* kind marks `.meta({ secret: true })` is a keychain marker bound to the row, so
|
|
11073
|
+
* deleting the row deletes the secret, and one row's value is never another's.
|
|
11074
|
+
*
|
|
11075
|
+
* Patch rules for a secret (`updateInstance`): omitted, `''`, the redaction
|
|
11076
|
+
* token or the view the form was given KEEP the stored secret;
|
|
11077
|
+
* `{ $secretClear: true }` clears it; any other string replaces it.
|
|
11078
|
+
*/
|
|
11036
11079
|
/** The most instances one addon lists (an integrations page, not a table). */
|
|
11037
11080
|
var INSTANCES_LIST_MAX = 1e3;
|
|
11038
11081
|
/** The keys of the kind's secret fields that sit at the top level of the body. */
|
|
11039
11082
|
function topLevelSecretKeys(paths) {
|
|
11040
|
-
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[")));
|
|
11083
|
+
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[") && !p.includes("{")));
|
|
11084
|
+
}
|
|
11085
|
+
/** The keys of the kind's top-level MAPS whose values are secrets (`applianceSecrets{}`). */
|
|
11086
|
+
function secretMapKeys(paths) {
|
|
11087
|
+
return new Set(paths.filter((p) => p.endsWith("{}") && !p.slice(0, -2).match(/[.[{]/)).map((p) => p.slice(0, -2)));
|
|
11088
|
+
}
|
|
11089
|
+
/**
|
|
11090
|
+
* A patch value for a map of secrets: an entry that is omitted, `''`, the redaction token or the
|
|
11091
|
+
* view the form was given KEEPS its stored secret (it is left out of the merge); `{ $secretClear }`
|
|
11092
|
+
* or `null` removes the entry; any other string replaces it. Null when nothing is left to merge.
|
|
11093
|
+
*/
|
|
11094
|
+
function secretMapPatch(value) {
|
|
11095
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
11096
|
+
const out = {};
|
|
11097
|
+
for (const [key, entry] of Object.entries(value)) if (entry === null || isSecretClear(entry)) out[key] = null;
|
|
11098
|
+
else if (typeof entry === "string" && entry !== "" && entry !== "__camstack_redacted__" && !isSecretFieldView(entry)) out[key] = entry;
|
|
11099
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
11100
|
+
}
|
|
11101
|
+
/** Does the kind's body schema carry an `enabled` field? */
|
|
11102
|
+
function declaresEnabled(kind) {
|
|
11103
|
+
const json = zod.z.toJSONSchema(kind.schema, {
|
|
11104
|
+
unrepresentable: "any",
|
|
11105
|
+
io: "input"
|
|
11106
|
+
});
|
|
11107
|
+
const properties = Reflect.get(json, "properties");
|
|
11108
|
+
return typeof properties === "object" && properties !== null && "enabled" in properties;
|
|
11041
11109
|
}
|
|
11042
11110
|
var RecordIntegrationInstances = class {
|
|
11043
11111
|
records;
|
|
@@ -11045,14 +11113,20 @@ var RecordIntegrationInstances = class {
|
|
|
11045
11113
|
hooks;
|
|
11046
11114
|
handle;
|
|
11047
11115
|
secretKeys;
|
|
11116
|
+
secretMaps;
|
|
11048
11117
|
nameField;
|
|
11118
|
+
/** The `integrations` registry owns the on/off switch (`role: devices`); the body has none. */
|
|
11119
|
+
registryOwnsEnabled;
|
|
11049
11120
|
constructor(records, kind, hooks) {
|
|
11050
11121
|
this.records = records;
|
|
11051
11122
|
this.kind = kind;
|
|
11052
11123
|
this.hooks = hooks;
|
|
11053
11124
|
this.handle = records.kind(kind);
|
|
11054
11125
|
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
11126
|
+
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
11055
11127
|
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
11128
|
+
this.registryOwnsEnabled = hooks.description.role === "devices";
|
|
11129
|
+
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"`);
|
|
11056
11130
|
}
|
|
11057
11131
|
/**
|
|
11058
11132
|
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
@@ -11103,7 +11177,7 @@ var RecordIntegrationInstances = class {
|
|
|
11103
11177
|
id: record.id,
|
|
11104
11178
|
name: typeof rawName === "string" ? rawName : record.id,
|
|
11105
11179
|
configured: this.hooks.configured(record.data),
|
|
11106
|
-
enabled: record.data.enabled !== false,
|
|
11180
|
+
...this.registryOwnsEnabled ? {} : { enabled: record.data.enabled !== false },
|
|
11107
11181
|
formValues: shown,
|
|
11108
11182
|
...kind !== void 0 ? { kind } : {},
|
|
11109
11183
|
...health?.status !== void 0 ? { status: health.status } : {},
|
|
@@ -11133,32 +11207,36 @@ var RecordIntegrationInstances = class {
|
|
|
11133
11207
|
id: minted,
|
|
11134
11208
|
data: this.hooks.initialBody(name, kind)
|
|
11135
11209
|
}, { ifRev: 0 });
|
|
11136
|
-
await this.hooks.onChanged?.(minted);
|
|
11210
|
+
await this.hooks.onChanged?.(minted, "created");
|
|
11137
11211
|
return { id: minted };
|
|
11138
11212
|
};
|
|
11139
11213
|
updateInstance = async ({ id, name, values }) => {
|
|
11140
11214
|
const patch = {};
|
|
11141
11215
|
for (const [key, value] of Object.entries(values)) {
|
|
11142
11216
|
if (value === void 0) continue;
|
|
11143
|
-
if (
|
|
11217
|
+
if (this.secretMaps.has(key)) {
|
|
11218
|
+
const entries = secretMapPatch(value);
|
|
11219
|
+
if (entries !== null) patch[key] = entries;
|
|
11220
|
+
} else if (!this.secretKeys.has(key)) patch[key] = value;
|
|
11144
11221
|
else if (isSecretClear(value)) patch[key] = null;
|
|
11145
11222
|
else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
|
|
11146
11223
|
}
|
|
11147
11224
|
if (name !== void 0) patch[this.nameField] = name;
|
|
11148
11225
|
await this.handle.patch(id, patch);
|
|
11149
|
-
await this.hooks.onChanged?.(id);
|
|
11226
|
+
await this.hooks.onChanged?.(id, "updated");
|
|
11150
11227
|
return { ok: true };
|
|
11151
11228
|
};
|
|
11152
11229
|
/** The switch lives in the record body; the addon is told so it applies it (D996). */
|
|
11153
11230
|
setInstanceEnabled = async ({ id, enabled }) => {
|
|
11231
|
+
if (this.registryOwnsEnabled) throw new Error(`instance "${id}": the integrations registry owns the on/off switch of this addon; set it with integrations.update`);
|
|
11154
11232
|
await this.handle.patch(id, { enabled });
|
|
11155
|
-
await this.hooks.onChanged?.(id);
|
|
11233
|
+
await this.hooks.onChanged?.(id, "enabled");
|
|
11156
11234
|
return { ok: true };
|
|
11157
11235
|
};
|
|
11158
11236
|
/** The row and its keychain refs go together (the records door). */
|
|
11159
11237
|
deleteInstance = async ({ id }) => {
|
|
11160
11238
|
await this.handle.delete(id);
|
|
11161
|
-
await this.hooks.onChanged?.(id);
|
|
11239
|
+
await this.hooks.onChanged?.(id, "deleted");
|
|
11162
11240
|
return { ok: true };
|
|
11163
11241
|
};
|
|
11164
11242
|
testInstance = async (input) => {
|
|
@@ -12575,7 +12653,13 @@ var MigrationLedgerEntrySchema = zod.z.object({
|
|
|
12575
12653
|
* joined by the engine from the catalogues it knows this boot. Absent when no
|
|
12576
12654
|
* catalogue lists the id (a newer database).
|
|
12577
12655
|
*/
|
|
12578
|
-
meta: MigrationMetaSchema.optional()
|
|
12656
|
+
meta: MigrationMetaSchema.optional(),
|
|
12657
|
+
/**
|
|
12658
|
+
* Set when this is an applied row of an addon owner whose catalogue the answering
|
|
12659
|
+
* process has not loaded (the owner has not declared yet): the row is applied, the
|
|
12660
|
+
* process just cannot judge it. Never `skipped-newer` — that needs the owner loaded.
|
|
12661
|
+
*/
|
|
12662
|
+
ownerNotLoaded: zod.z.boolean().optional()
|
|
12579
12663
|
});
|
|
12580
12664
|
/** A catalogued migration that is not applied, with where it stands. */
|
|
12581
12665
|
var MigrationPendingEntrySchema = zod.z.object({
|
|
@@ -62133,7 +62217,37 @@ var IntegrationInstanceKindSchema = zod.z.object({
|
|
|
62133
62217
|
/** Relative hub path to disconnect that account. */
|
|
62134
62218
|
disconnectPath: zod.z.string().min(1).optional()
|
|
62135
62219
|
});
|
|
62220
|
+
/**
|
|
62221
|
+
* What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
|
|
62222
|
+
* instance is an integration that brings devices (the registry owns its on/off switch);
|
|
62223
|
+
* `services`: a connection configured from the addon's own function page, never listed on
|
|
62224
|
+
* Integrations; `both`: a dual entry listed for its devices that also keeps service connections.
|
|
62225
|
+
* It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
|
|
62226
|
+
*/
|
|
62227
|
+
var IntegrationInstanceRoleSchema = zod.z.enum([
|
|
62228
|
+
"devices",
|
|
62229
|
+
"services",
|
|
62230
|
+
"both"
|
|
62231
|
+
]);
|
|
62232
|
+
/**
|
|
62233
|
+
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
62234
|
+
* scans the network before any instance exists (the wizard offers the candidates); `account`: the
|
|
62235
|
+
* devices appear after the instance signs in. `scopedToInstance`: a discovery run belongs to ONE
|
|
62236
|
+
* instance and its candidates are claimed by it.
|
|
62237
|
+
*/
|
|
62238
|
+
var IntegrationInstanceDiscoverySchema = zod.z.object({
|
|
62239
|
+
mode: zod.z.enum([
|
|
62240
|
+
"none",
|
|
62241
|
+
"lan",
|
|
62242
|
+
"account"
|
|
62243
|
+
]),
|
|
62244
|
+
scopedToInstance: zod.z.boolean()
|
|
62245
|
+
});
|
|
62136
62246
|
var IntegrationInstanceDescriptionSchema = zod.z.object({
|
|
62247
|
+
/** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
|
|
62248
|
+
role: IntegrationInstanceRoleSchema,
|
|
62249
|
+
/** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
|
|
62250
|
+
discovery: IntegrationInstanceDiscoverySchema.optional(),
|
|
62137
62251
|
/** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
|
|
62138
62252
|
instanceMode: IntegrationInstanceModeSchema,
|
|
62139
62253
|
/** What the instance is, for the UI (`destination`, `relay`, `account`). */
|
|
@@ -62173,10 +62287,11 @@ var IntegrationInstanceSchema = zod.z.object({
|
|
|
62173
62287
|
/** The addon's own rule (an URL is present, a client id is present...). */
|
|
62174
62288
|
configured: zod.z.boolean(),
|
|
62175
62289
|
/**
|
|
62176
|
-
* The instance's own on/off switch (D996)
|
|
62177
|
-
*
|
|
62290
|
+
* The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
|
|
62291
|
+
* so a row written before the field existed is on). Absent when the `integrations` registry
|
|
62292
|
+
* owns the switch (`describe().role` is `devices`): read it from the registry row.
|
|
62178
62293
|
*/
|
|
62179
|
-
enabled: zod.z.boolean(),
|
|
62294
|
+
enabled: zod.z.boolean().optional(),
|
|
62180
62295
|
/** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
|
|
62181
62296
|
kind: zod.z.string().optional(),
|
|
62182
62297
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
@@ -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-Cv4Zmie9.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).
|
|
@@ -1835,7 +1835,7 @@ var NOT_RUN = {
|
|
|
1835
1835
|
* throws: an unreachable or refusing engine is logged and reported `declared: false`,
|
|
1836
1836
|
* because the hub (and this addon's boot) must not hang on a migration.
|
|
1837
1837
|
*/
|
|
1838
|
-
async function runAddonMigrations(host, migrations, logger) {
|
|
1838
|
+
async function runAddonMigrations(host, migrations, logger, options = {}) {
|
|
1839
1839
|
const first = migrations[0];
|
|
1840
1840
|
if (first === void 0) return NOT_RUN;
|
|
1841
1841
|
const owner = first.meta.owner;
|
|
@@ -1864,7 +1864,9 @@ async function runAddonMigrations(host, migrations, logger) {
|
|
|
1864
1864
|
else if (status === "blocked") blocked.push(id);
|
|
1865
1865
|
else skipped.push(id);
|
|
1866
1866
|
};
|
|
1867
|
+
const selected = options.only === void 0 ? null : new Set(options.only);
|
|
1867
1868
|
for (const step of declaration.steps) {
|
|
1869
|
+
if (selected !== null && !selected.has(step.id)) continue;
|
|
1868
1870
|
const bound = byId.get(step.id);
|
|
1869
1871
|
if (bound === void 0 || step.action === "skip") {
|
|
1870
1872
|
skipped.push(step.id);
|
|
@@ -3037,14 +3039,18 @@ var BaseAddon = class {
|
|
|
3037
3039
|
* nothing; the boot continues. A migration that FAILED (or was blocked by one)
|
|
3038
3040
|
* and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
|
|
3039
3041
|
* serve data whose shape it cannot trust; `tolerate` migrations never do.
|
|
3042
|
+
*
|
|
3043
|
+
* ALWAYS pass the whole catalogue; a phase that must run only some of it passes
|
|
3044
|
+
* `{ only: [ids] }` — never a filtered catalogue (the engine would judge the
|
|
3045
|
+
* omitted applied ids "newer").
|
|
3040
3046
|
*/
|
|
3041
|
-
async runMigrations(migrations) {
|
|
3047
|
+
async runMigrations(migrations, options) {
|
|
3042
3048
|
const api = this.ctx.api.migrations;
|
|
3043
3049
|
const report = await runAddonMigrations({
|
|
3044
3050
|
declareOwner: (input) => api.declareOwner.mutate(input),
|
|
3045
3051
|
startMigration: (input) => api.startMigration.mutate(input),
|
|
3046
3052
|
finishMigration: (input) => api.finishMigration.mutate(input)
|
|
3047
|
-
}, migrations, this.ctx.logger);
|
|
3053
|
+
}, migrations, this.ctx.logger, options);
|
|
3048
3054
|
if (report.blockOwner.length > 0) throw new AddonMigrationsBlockedError(report.blockOwner);
|
|
3049
3055
|
return report;
|
|
3050
3056
|
}
|
|
@@ -4185,6 +4191,10 @@ var RECORD_SECRET_COLLECTION_PREFIX = "records:";
|
|
|
4185
4191
|
* (`collectZodSecretPaths`): dotted keys, `[]` for "each element of this array"
|
|
4186
4192
|
* (`auth.accessToken`, `headers[].value`).
|
|
4187
4193
|
*
|
|
4194
|
+
* `{}` after a key means "each value of this map" (`applianceSecrets{}`): the map's own key
|
|
4195
|
+
* names the value (`applianceSecrets{fridge}`), so no id key is declared and a body that drops a
|
|
4196
|
+
* key releases exactly that key's secret.
|
|
4197
|
+
*
|
|
4188
4198
|
* Array elements are matched by a DECLARED id key (`secretArrayKeys`:
|
|
4189
4199
|
* `{ headers: 'name' }`), never by index, so reordering a list keeps every
|
|
4190
4200
|
* keychain ref (the same rule as `arrayItemFieldPath`). The concrete path of a
|
|
@@ -4197,11 +4207,13 @@ function parseSecretPath(path) {
|
|
|
4197
4207
|
if (path.length === 0) throw new InvalidRecordError("an empty secret path");
|
|
4198
4208
|
return path.split(".").map((raw) => {
|
|
4199
4209
|
const each = raw.endsWith("[]");
|
|
4200
|
-
const
|
|
4210
|
+
const map = raw.endsWith("{}");
|
|
4211
|
+
const key = each || map ? raw.slice(0, -2) : raw;
|
|
4201
4212
|
if (key.length === 0) throw new InvalidRecordError(`secret path "${path}" has an empty segment`);
|
|
4202
4213
|
return {
|
|
4203
4214
|
key,
|
|
4204
|
-
each
|
|
4215
|
+
each,
|
|
4216
|
+
map
|
|
4205
4217
|
};
|
|
4206
4218
|
});
|
|
4207
4219
|
}
|
|
@@ -4253,6 +4265,22 @@ function mapAt(node, segments, index, walkedKeys, concretePrefix, declared, arra
|
|
|
4253
4265
|
[segment.key]: mapped
|
|
4254
4266
|
};
|
|
4255
4267
|
}
|
|
4268
|
+
if (segment.map) {
|
|
4269
|
+
if (!isRecord$4(child)) return node;
|
|
4270
|
+
const kept = Object.entries(child).map(([mapKey, value]) => {
|
|
4271
|
+
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}{${encodeURIComponent(mapKey)}}`;
|
|
4272
|
+
if (!last) return [mapKey, mapAt(value, segments, index + 1, keys, concrete, declared, arrayKeys, visit)];
|
|
4273
|
+
return [mapKey, visit({
|
|
4274
|
+
declared,
|
|
4275
|
+
concrete,
|
|
4276
|
+
value
|
|
4277
|
+
})];
|
|
4278
|
+
}).filter(([, value]) => value !== REMOVE_LEAF);
|
|
4279
|
+
return {
|
|
4280
|
+
...node,
|
|
4281
|
+
[segment.key]: Object.fromEntries(kept)
|
|
4282
|
+
};
|
|
4283
|
+
}
|
|
4256
4284
|
const concrete = `${concretePrefix}${concretePrefix.length > 0 ? "." : ""}${segment.key}`;
|
|
4257
4285
|
if (last) {
|
|
4258
4286
|
const replacement = visit({
|
|
@@ -4410,7 +4438,8 @@ function isZodSecret(schema) {
|
|
|
4410
4438
|
}
|
|
4411
4439
|
/**
|
|
4412
4440
|
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
4413
|
-
* element of this array" (`connection.password`, `rows[].token`)
|
|
4441
|
+
* element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
|
|
4442
|
+
* map" (`applianceSecrets{}`). A declared
|
|
4414
4443
|
* object or array is reported as one path and not descended into — everything
|
|
4415
4444
|
* under it is secret.
|
|
4416
4445
|
*/
|
|
@@ -4421,6 +4450,7 @@ function collectZodSecretPaths(schema, prefix = "") {
|
|
|
4421
4450
|
const def = defOf(layer);
|
|
4422
4451
|
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
4423
4452
|
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
4453
|
+
else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
|
|
4424
4454
|
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
4425
4455
|
else if (def.type === "intersection") {
|
|
4426
4456
|
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
@@ -11033,11 +11063,49 @@ var IntegrationInstanceRefSchema = z.object({
|
|
|
11033
11063
|
]),
|
|
11034
11064
|
candidateStableId: z.string().optional()
|
|
11035
11065
|
});
|
|
11066
|
+
/**
|
|
11067
|
+
* `RecordIntegrationInstances` - the `integration-instances` provider over ONE
|
|
11068
|
+
* entry kind, so an addon that holds a connection serves it in ~30 lines.
|
|
11069
|
+
*
|
|
11070
|
+
* Every instance is one record of the addon's own kind, keyed by the
|
|
11071
|
+
* `integrations` registry id. The records door does the secret work: a field the
|
|
11072
|
+
* kind marks `.meta({ secret: true })` is a keychain marker bound to the row, so
|
|
11073
|
+
* deleting the row deletes the secret, and one row's value is never another's.
|
|
11074
|
+
*
|
|
11075
|
+
* Patch rules for a secret (`updateInstance`): omitted, `''`, the redaction
|
|
11076
|
+
* token or the view the form was given KEEP the stored secret;
|
|
11077
|
+
* `{ $secretClear: true }` clears it; any other string replaces it.
|
|
11078
|
+
*/
|
|
11036
11079
|
/** The most instances one addon lists (an integrations page, not a table). */
|
|
11037
11080
|
var INSTANCES_LIST_MAX = 1e3;
|
|
11038
11081
|
/** The keys of the kind's secret fields that sit at the top level of the body. */
|
|
11039
11082
|
function topLevelSecretKeys(paths) {
|
|
11040
|
-
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[")));
|
|
11083
|
+
return new Set(paths.filter((p) => !p.includes(".") && !p.includes("[") && !p.includes("{")));
|
|
11084
|
+
}
|
|
11085
|
+
/** The keys of the kind's top-level MAPS whose values are secrets (`applianceSecrets{}`). */
|
|
11086
|
+
function secretMapKeys(paths) {
|
|
11087
|
+
return new Set(paths.filter((p) => p.endsWith("{}") && !p.slice(0, -2).match(/[.[{]/)).map((p) => p.slice(0, -2)));
|
|
11088
|
+
}
|
|
11089
|
+
/**
|
|
11090
|
+
* A patch value for a map of secrets: an entry that is omitted, `''`, the redaction token or the
|
|
11091
|
+
* view the form was given KEEPS its stored secret (it is left out of the merge); `{ $secretClear }`
|
|
11092
|
+
* or `null` removes the entry; any other string replaces it. Null when nothing is left to merge.
|
|
11093
|
+
*/
|
|
11094
|
+
function secretMapPatch(value) {
|
|
11095
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
|
|
11096
|
+
const out = {};
|
|
11097
|
+
for (const [key, entry] of Object.entries(value)) if (entry === null || isSecretClear(entry)) out[key] = null;
|
|
11098
|
+
else if (typeof entry === "string" && entry !== "" && entry !== "__camstack_redacted__" && !isSecretFieldView(entry)) out[key] = entry;
|
|
11099
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
11100
|
+
}
|
|
11101
|
+
/** Does the kind's body schema carry an `enabled` field? */
|
|
11102
|
+
function declaresEnabled(kind) {
|
|
11103
|
+
const json = z.toJSONSchema(kind.schema, {
|
|
11104
|
+
unrepresentable: "any",
|
|
11105
|
+
io: "input"
|
|
11106
|
+
});
|
|
11107
|
+
const properties = Reflect.get(json, "properties");
|
|
11108
|
+
return typeof properties === "object" && properties !== null && "enabled" in properties;
|
|
11041
11109
|
}
|
|
11042
11110
|
var RecordIntegrationInstances = class {
|
|
11043
11111
|
records;
|
|
@@ -11045,14 +11113,20 @@ var RecordIntegrationInstances = class {
|
|
|
11045
11113
|
hooks;
|
|
11046
11114
|
handle;
|
|
11047
11115
|
secretKeys;
|
|
11116
|
+
secretMaps;
|
|
11048
11117
|
nameField;
|
|
11118
|
+
/** The `integrations` registry owns the on/off switch (`role: devices`); the body has none. */
|
|
11119
|
+
registryOwnsEnabled;
|
|
11049
11120
|
constructor(records, kind, hooks) {
|
|
11050
11121
|
this.records = records;
|
|
11051
11122
|
this.kind = kind;
|
|
11052
11123
|
this.hooks = hooks;
|
|
11053
11124
|
this.handle = records.kind(kind);
|
|
11054
11125
|
this.secretKeys = topLevelSecretKeys(kind.declaration.secretPaths);
|
|
11126
|
+
this.secretMaps = secretMapKeys(kind.declaration.secretPaths);
|
|
11055
11127
|
this.nameField = kind.declaration.entry?.nameField ?? "name";
|
|
11128
|
+
this.registryOwnsEnabled = hooks.description.role === "devices";
|
|
11129
|
+
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"`);
|
|
11056
11130
|
}
|
|
11057
11131
|
/**
|
|
11058
11132
|
* One instance read for the addon's own runtime; null when absent. When the keychain is
|
|
@@ -11103,7 +11177,7 @@ var RecordIntegrationInstances = class {
|
|
|
11103
11177
|
id: record.id,
|
|
11104
11178
|
name: typeof rawName === "string" ? rawName : record.id,
|
|
11105
11179
|
configured: this.hooks.configured(record.data),
|
|
11106
|
-
enabled: record.data.enabled !== false,
|
|
11180
|
+
...this.registryOwnsEnabled ? {} : { enabled: record.data.enabled !== false },
|
|
11107
11181
|
formValues: shown,
|
|
11108
11182
|
...kind !== void 0 ? { kind } : {},
|
|
11109
11183
|
...health?.status !== void 0 ? { status: health.status } : {},
|
|
@@ -11133,32 +11207,36 @@ var RecordIntegrationInstances = class {
|
|
|
11133
11207
|
id: minted,
|
|
11134
11208
|
data: this.hooks.initialBody(name, kind)
|
|
11135
11209
|
}, { ifRev: 0 });
|
|
11136
|
-
await this.hooks.onChanged?.(minted);
|
|
11210
|
+
await this.hooks.onChanged?.(minted, "created");
|
|
11137
11211
|
return { id: minted };
|
|
11138
11212
|
};
|
|
11139
11213
|
updateInstance = async ({ id, name, values }) => {
|
|
11140
11214
|
const patch = {};
|
|
11141
11215
|
for (const [key, value] of Object.entries(values)) {
|
|
11142
11216
|
if (value === void 0) continue;
|
|
11143
|
-
if (
|
|
11217
|
+
if (this.secretMaps.has(key)) {
|
|
11218
|
+
const entries = secretMapPatch(value);
|
|
11219
|
+
if (entries !== null) patch[key] = entries;
|
|
11220
|
+
} else if (!this.secretKeys.has(key)) patch[key] = value;
|
|
11144
11221
|
else if (isSecretClear(value)) patch[key] = null;
|
|
11145
11222
|
else if (typeof value === "string" && value !== "" && value !== "__camstack_redacted__" && !isSecretFieldView(value)) patch[key] = value;
|
|
11146
11223
|
}
|
|
11147
11224
|
if (name !== void 0) patch[this.nameField] = name;
|
|
11148
11225
|
await this.handle.patch(id, patch);
|
|
11149
|
-
await this.hooks.onChanged?.(id);
|
|
11226
|
+
await this.hooks.onChanged?.(id, "updated");
|
|
11150
11227
|
return { ok: true };
|
|
11151
11228
|
};
|
|
11152
11229
|
/** The switch lives in the record body; the addon is told so it applies it (D996). */
|
|
11153
11230
|
setInstanceEnabled = async ({ id, enabled }) => {
|
|
11231
|
+
if (this.registryOwnsEnabled) throw new Error(`instance "${id}": the integrations registry owns the on/off switch of this addon; set it with integrations.update`);
|
|
11154
11232
|
await this.handle.patch(id, { enabled });
|
|
11155
|
-
await this.hooks.onChanged?.(id);
|
|
11233
|
+
await this.hooks.onChanged?.(id, "enabled");
|
|
11156
11234
|
return { ok: true };
|
|
11157
11235
|
};
|
|
11158
11236
|
/** The row and its keychain refs go together (the records door). */
|
|
11159
11237
|
deleteInstance = async ({ id }) => {
|
|
11160
11238
|
await this.handle.delete(id);
|
|
11161
|
-
await this.hooks.onChanged?.(id);
|
|
11239
|
+
await this.hooks.onChanged?.(id, "deleted");
|
|
11162
11240
|
return { ok: true };
|
|
11163
11241
|
};
|
|
11164
11242
|
testInstance = async (input) => {
|
|
@@ -12575,7 +12653,13 @@ var MigrationLedgerEntrySchema = z.object({
|
|
|
12575
12653
|
* joined by the engine from the catalogues it knows this boot. Absent when no
|
|
12576
12654
|
* catalogue lists the id (a newer database).
|
|
12577
12655
|
*/
|
|
12578
|
-
meta: MigrationMetaSchema.optional()
|
|
12656
|
+
meta: MigrationMetaSchema.optional(),
|
|
12657
|
+
/**
|
|
12658
|
+
* Set when this is an applied row of an addon owner whose catalogue the answering
|
|
12659
|
+
* process has not loaded (the owner has not declared yet): the row is applied, the
|
|
12660
|
+
* process just cannot judge it. Never `skipped-newer` — that needs the owner loaded.
|
|
12661
|
+
*/
|
|
12662
|
+
ownerNotLoaded: z.boolean().optional()
|
|
12579
12663
|
});
|
|
12580
12664
|
/** A catalogued migration that is not applied, with where it stands. */
|
|
12581
12665
|
var MigrationPendingEntrySchema = z.object({
|
|
@@ -62133,7 +62217,37 @@ var IntegrationInstanceKindSchema = z.object({
|
|
|
62133
62217
|
/** Relative hub path to disconnect that account. */
|
|
62134
62218
|
disconnectPath: z.string().min(1).optional()
|
|
62135
62219
|
});
|
|
62220
|
+
/**
|
|
62221
|
+
* What the addon's instances ARE for the Integrations page (planning#416). `devices`: each
|
|
62222
|
+
* instance is an integration that brings devices (the registry owns its on/off switch);
|
|
62223
|
+
* `services`: a connection configured from the addon's own function page, never listed on
|
|
62224
|
+
* Integrations; `both`: a dual entry listed for its devices that also keeps service connections.
|
|
62225
|
+
* It is the same vocabulary as the manifest's `integrationRole`, which stays as an override.
|
|
62226
|
+
*/
|
|
62227
|
+
var IntegrationInstanceRoleSchema = z.enum([
|
|
62228
|
+
"devices",
|
|
62229
|
+
"services",
|
|
62230
|
+
"both"
|
|
62231
|
+
]);
|
|
62232
|
+
/**
|
|
62233
|
+
* How devices of an instance are found. `none`: the operator adds them by hand; `lan`: the addon
|
|
62234
|
+
* scans the network before any instance exists (the wizard offers the candidates); `account`: the
|
|
62235
|
+
* devices appear after the instance signs in. `scopedToInstance`: a discovery run belongs to ONE
|
|
62236
|
+
* instance and its candidates are claimed by it.
|
|
62237
|
+
*/
|
|
62238
|
+
var IntegrationInstanceDiscoverySchema = z.object({
|
|
62239
|
+
mode: z.enum([
|
|
62240
|
+
"none",
|
|
62241
|
+
"lan",
|
|
62242
|
+
"account"
|
|
62243
|
+
]),
|
|
62244
|
+
scopedToInstance: z.boolean()
|
|
62245
|
+
});
|
|
62136
62246
|
var IntegrationInstanceDescriptionSchema = z.object({
|
|
62247
|
+
/** What the instances are for the Integrations page; see {@link IntegrationInstanceRoleSchema}. */
|
|
62248
|
+
role: IntegrationInstanceRoleSchema,
|
|
62249
|
+
/** How the devices of an instance are found; absent means `{ mode: 'none' }`. */
|
|
62250
|
+
discovery: IntegrationInstanceDiscoverySchema.optional(),
|
|
62137
62251
|
/** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
|
|
62138
62252
|
instanceMode: IntegrationInstanceModeSchema,
|
|
62139
62253
|
/** What the instance is, for the UI (`destination`, `relay`, `account`). */
|
|
@@ -62173,10 +62287,11 @@ var IntegrationInstanceSchema = z.object({
|
|
|
62173
62287
|
/** The addon's own rule (an URL is present, a client id is present...). */
|
|
62174
62288
|
configured: z.boolean(),
|
|
62175
62289
|
/**
|
|
62176
|
-
* The instance's own on/off switch (D996)
|
|
62177
|
-
*
|
|
62290
|
+
* The instance's own on/off switch (D996), derived from the record body (`enabled !== false`,
|
|
62291
|
+
* so a row written before the field existed is on). Absent when the `integrations` registry
|
|
62292
|
+
* owns the switch (`describe().role` is `devices`): read it from the registry row.
|
|
62178
62293
|
*/
|
|
62179
|
-
enabled: z.boolean(),
|
|
62294
|
+
enabled: z.boolean().optional(),
|
|
62180
62295
|
/** The kind of this instance (one of `describe().kinds[].id`), when the provider has kinds. */
|
|
62181
62296
|
kind: z.string().optional(),
|
|
62182
62297
|
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_wal_maintenance = require("./wal-maintenance
|
|
2
|
+
const require_wal_maintenance = require("./wal-maintenance--DYbopvj.js");
|
|
3
3
|
let node_worker_threads = require("node:worker_threads");
|
|
4
4
|
//#region src/builtins/sqlite-storage/file-host-worker.ts
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-
|
|
1
|
+
import { A as callRecords, C as isFileHostWorkerData, D as RecordsEngine, M as controlTargetOf, O as callControl, S as isFileHostRequest, a as WalMaintenance, b as collectTransferables, d as callMigrate, f as migrateTargetOf, j as callVector, k as callData, l as SqliteSettingsBackend, o as createVectorIndex, s as vectorProviderOf, u as HUB_MIGRATIONS, v as serializeError, w as trustInput } from "./wal-maintenance-C28BGIti.mjs";
|
|
2
2
|
import { parentPort, threadId, workerData } from "node:worker_threads";
|
|
3
3
|
//#region src/builtins/sqlite-storage/file-host-worker.ts
|
|
4
4
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_dist = require("./dist-
|
|
2
|
+
const require_dist = require("./dist-DiyRxDa1.js");
|
|
3
3
|
const require_x509_es = require("./x509.es-WtnRNyYS.js");
|
|
4
|
-
const require_agent_https = require("./agent-https-
|
|
4
|
+
const require_agent_https = require("./agent-https-DJAX08DO.js");
|
|
5
5
|
let node_crypto = require("node:crypto");
|
|
6
6
|
let _camstack_types_node = require("@camstack/types/node");
|
|
7
7
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { o as __toESM } from "./chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { ac as userError } from "./dist-
|
|
2
|
+
import { ac as userError } from "./dist-LA9NIY-I.mjs";
|
|
3
3
|
import { f as X509Certificate$1 } from "./x509.es-BRiJgOvu.mjs";
|
|
4
|
-
import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-
|
|
4
|
+
import { D as reasonRequiresNewCa, E as evaluateExistingCert, F as readNameConstraints, N as permitsIdentity, _ as issueLeaf, b as collectCertIdentity, g as generateCa, j as isConstrainedCa, v as loadCa, y as localCaCommonName } from "./agent-https-DvdcveCd.mjs";
|
|
5
5
|
import { X509Certificate, createPrivateKey } from "node:crypto";
|
|
6
6
|
import { writeOwnerOnlyFileSync } from "@camstack/types/node";
|
|
7
7
|
import { mkdir, writeFile } from "node:fs/promises";
|