@camstack/types 1.2.600 → 1.2.602
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/addon/base-addon.d.ts +39 -0
- package/dist/addon/instance-switches-unread-error.d.ts +12 -0
- package/dist/addon/instance-switches.d.ts +75 -0
- package/dist/addon/notification-targets.d.ts +0 -2
- package/dist/addon/record-integration-instances.d.ts +29 -13
- package/dist/addon.d.ts +2 -0
- package/dist/addon.js +3 -1
- package/dist/addon.mjs +2 -2
- package/dist/automation/index.d.ts +1 -1
- package/dist/automation/trace.d.ts +10 -0
- package/dist/capabilities/integrations.cap.d.ts +43 -6
- package/dist/client.js +2 -0
- package/dist/client.mjs +2 -0
- package/dist/generated/addon-api.d.ts +14 -0
- package/dist/generated/method-access-map.d.ts +1 -1
- package/dist/generated/system-proxy.d.ts +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +129 -189
- package/dist/index.mjs +105 -184
- package/dist/interfaces/addon.d.ts +12 -0
- package/dist/interfaces/integration-registry.d.ts +12 -0
- package/dist/migrations/api/migration-api-ports.d.ts +3 -0
- package/dist/migrations/body-switch-to-registry.d.ts +102 -0
- package/dist/{runtime-capabilities-azf1ve5b.js → runtime-capabilities-D9KsXMv7.js} +726 -24
- package/dist/{runtime-capabilities-B36VcCR6.mjs → runtime-capabilities-ql3VRzQu.mjs} +605 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_runtime_capabilities = require("./runtime-capabilities-
|
|
2
|
+
const require_runtime_capabilities = require("./runtime-capabilities-D9KsXMv7.js");
|
|
3
3
|
const require_event_category = require("./event-category-CMA0-jGW.js");
|
|
4
4
|
const require_composed_stable_id = require("./composed-stable-id-DkF5-kuf.js");
|
|
5
5
|
const require_implemented_methods = require("./implemented-methods-I_l2ENnf.js");
|
|
@@ -1568,7 +1568,7 @@ function targetOfRecord(addonId, kind, id, data) {
|
|
|
1568
1568
|
name,
|
|
1569
1569
|
kind,
|
|
1570
1570
|
addonId,
|
|
1571
|
-
enabled: require_runtime_capabilities.
|
|
1571
|
+
enabled: require_runtime_capabilities.isInstanceOn(id),
|
|
1572
1572
|
config
|
|
1573
1573
|
});
|
|
1574
1574
|
return parsed.success ? parsed.data : null;
|
|
@@ -1653,10 +1653,12 @@ var NotificationTargetStore = class NotificationTargetStore {
|
|
|
1653
1653
|
async upsert(target) {
|
|
1654
1654
|
const own = this.handles.find((entry) => entry.kind === target.kind);
|
|
1655
1655
|
if (own === void 0) throw new Error(`invalid target '${target.id}': unknown kind '${target.kind}'`);
|
|
1656
|
+
const { enabled: _switch, ...data } = targetBody(target);
|
|
1656
1657
|
await own.handle.put({
|
|
1657
1658
|
id: target.id,
|
|
1658
|
-
data
|
|
1659
|
+
data
|
|
1659
1660
|
});
|
|
1661
|
+
require_runtime_capabilities.recordInstanceSwitch(target.id, target.enabled);
|
|
1660
1662
|
for (const other of this.handles) if (other !== own) await other.handle.delete(target.id);
|
|
1661
1663
|
await this.options.legacy?.delete(target.id);
|
|
1662
1664
|
}
|
|
@@ -1664,23 +1666,6 @@ var NotificationTargetStore = class NotificationTargetStore {
|
|
|
1664
1666
|
for (const { handle } of this.handles) await handle.delete(id);
|
|
1665
1667
|
await this.options.legacy?.delete(id);
|
|
1666
1668
|
}
|
|
1667
|
-
/** Flip the switch on an existing target; null when it does not exist. */
|
|
1668
|
-
async setEnabled(id, enabled) {
|
|
1669
|
-
for (const { kind, handle } of this.handles) {
|
|
1670
|
-
if (await handle.get(id) === null) continue;
|
|
1671
|
-
await handle.patch(id, { enabled });
|
|
1672
|
-
const row = await handle.get(id);
|
|
1673
|
-
return row === null ? null : targetOfRecord(this.addonId, kind, row.id, row.data);
|
|
1674
|
-
}
|
|
1675
|
-
const old = (await this.legacyRows()).find((row) => row.id === id);
|
|
1676
|
-
if (old === void 0) return null;
|
|
1677
|
-
const moved = {
|
|
1678
|
-
...targetOfOld(this.addonId, old),
|
|
1679
|
-
enabled
|
|
1680
|
-
};
|
|
1681
|
-
await this.upsert(moved);
|
|
1682
|
-
return moved;
|
|
1683
|
-
}
|
|
1684
1669
|
};
|
|
1685
1670
|
/**
|
|
1686
1671
|
* A probe's answer as the tri-state of `testInstance`: `ok` validated; a refusal that carries an HTTP
|
|
@@ -5870,6 +5855,14 @@ var DEFAULT_FEATURES = {
|
|
|
5870
5855
|
repl: true
|
|
5871
5856
|
};
|
|
5872
5857
|
//#endregion
|
|
5858
|
+
//#region src/interfaces/integration-registry.ts
|
|
5859
|
+
/**
|
|
5860
|
+
* `info` key of a registry row that stands for a SERVICES instance (D1066): every instance of every
|
|
5861
|
+
* role has a row, the one stored switch, but only a row of an instance that brings devices is an
|
|
5862
|
+
* entry of the Integrations list.
|
|
5863
|
+
*/
|
|
5864
|
+
var SERVICE_INSTANCE_INFO_KEY = "serviceInstance";
|
|
5865
|
+
//#endregion
|
|
5873
5866
|
//#region src/interfaces/logging.ts
|
|
5874
5867
|
/**
|
|
5875
5868
|
* Severity ordering. Declared once here because it had already been re-declared
|
|
@@ -34906,7 +34899,12 @@ var AutomationRunTraceSchema = zod.z.object({
|
|
|
34906
34899
|
* automation outcome so a reader that does not know schedulers still reads
|
|
34907
34900
|
* the trace; this field says exactly what happened.
|
|
34908
34901
|
*/
|
|
34909
|
-
scheduler: SchedulerOutcomeSchema.optional()
|
|
34902
|
+
scheduler: SchedulerOutcomeSchema.optional(),
|
|
34903
|
+
/**
|
|
34904
|
+
* Why the run failed when no step carries it: the run crashed outside the
|
|
34905
|
+
* steps (conditions, gate). Absent when the failure is on a step.
|
|
34906
|
+
*/
|
|
34907
|
+
error: zod.z.string().optional()
|
|
34910
34908
|
});
|
|
34911
34909
|
/**
|
|
34912
34910
|
* What the hub's `runs` ledger holds for one owner (`automation:<blockId>` or
|
|
@@ -34960,6 +34958,31 @@ function mergeSkipTraces(prev, next) {
|
|
|
34960
34958
|
};
|
|
34961
34959
|
}
|
|
34962
34960
|
/**
|
|
34961
|
+
* One hold episode is ONE run. A `for` trigger first writes a skipped
|
|
34962
|
+
* "hold pending" row when the value changes, and a run row when the hold is
|
|
34963
|
+
* met; both carry the same leaf path and the same hold start (`since`), so the
|
|
34964
|
+
* pending row is the run's own beginning and is dropped once the run exists.
|
|
34965
|
+
* Pure, so the ledger (on append) and the list (for traces written before this
|
|
34966
|
+
* rule) apply the same fold.
|
|
34967
|
+
*/
|
|
34968
|
+
function foldHoldEpisodes(traces) {
|
|
34969
|
+
const fired = /* @__PURE__ */ new Set();
|
|
34970
|
+
for (const t of traces) {
|
|
34971
|
+
const key = holdEpisodeKey(t);
|
|
34972
|
+
if (key !== null && t.trigger.hold?.phase === "fired" && !isSkippedTrace(t)) fired.add(key);
|
|
34973
|
+
}
|
|
34974
|
+
if (fired.size === 0) return [...traces];
|
|
34975
|
+
return traces.filter((t) => {
|
|
34976
|
+
const key = holdEpisodeKey(t);
|
|
34977
|
+
return !(key !== null && isSkippedTrace(t) && t.trigger.hold?.phase === "pending" && fired.has(key));
|
|
34978
|
+
});
|
|
34979
|
+
}
|
|
34980
|
+
function holdEpisodeKey(trace) {
|
|
34981
|
+
const since = trace.trigger.hold?.since;
|
|
34982
|
+
if (since === void 0 || trace.trigger.path === void 0) return null;
|
|
34983
|
+
return `${trace.trigger.path}@${String(since)}`;
|
|
34984
|
+
}
|
|
34985
|
+
/**
|
|
34963
34986
|
* Append a trace to a ring of at most `keep` entries, without mutating it.
|
|
34964
34987
|
*
|
|
34965
34988
|
* - A skip identical to the previous trace is counted on that trace
|
|
@@ -34972,7 +34995,7 @@ function appendTrace(ring, trace, keep) {
|
|
|
34972
34995
|
const last = ring[ring.length - 1];
|
|
34973
34996
|
const merged = last === void 0 ? null : mergeSkipTraces(last, trace);
|
|
34974
34997
|
if (merged !== null) return [...ring.slice(0, -1), merged];
|
|
34975
|
-
const next = [...ring, trace];
|
|
34998
|
+
const next = foldHoldEpisodes([...ring, trace]);
|
|
34976
34999
|
while (next.length > keep) {
|
|
34977
35000
|
const skipAt = next.findIndex((t, i) => i < next.length - 1 && isSkippedTrace(t));
|
|
34978
35001
|
next.splice(skipAt === -1 ? 0 : skipAt, 1);
|
|
@@ -37747,6 +37770,7 @@ ${recipe.actions.map((a, i) => emitAction(a, i)).join("\n")}
|
|
|
37747
37770
|
let outcome: AutomationRunTrace['outcome'] = 'ran'
|
|
37748
37771
|
let nodes: AutomationConditionTraceNode[] = []
|
|
37749
37772
|
let steps: AutomationStepTrace[] = []
|
|
37773
|
+
let runError: string | undefined
|
|
37750
37774
|
try {
|
|
37751
37775
|
const firedLeaf = trigger['leaf']
|
|
37752
37776
|
const evaluation = evaluateWhenTree(WHEN, mirror, Date.now(), {
|
|
@@ -37796,7 +37820,8 @@ ${recipe.actions.map((a, i) => emitAction(a, i)).join("\n")}
|
|
|
37796
37820
|
outcome = token.aborted ? 'aborted' : result.failed ? 'failed' : 'ran'
|
|
37797
37821
|
} catch (err: unknown) {
|
|
37798
37822
|
outcome = 'failed'
|
|
37799
|
-
|
|
37823
|
+
runError = err instanceof Error ? err.message : String(err)
|
|
37824
|
+
ctx.logger.warn('automation run failed', { error: runError, ...deviceTags(trigger) })
|
|
37800
37825
|
} finally {
|
|
37801
37826
|
runningTokens.delete(token)
|
|
37802
37827
|
const endedAt = Date.now()
|
|
@@ -37809,6 +37834,7 @@ ${recipe.actions.map((a, i) => emitAction(a, i)).join("\n")}
|
|
|
37809
37834
|
verdict,
|
|
37810
37835
|
steps,
|
|
37811
37836
|
outcome,
|
|
37837
|
+
...(runError === undefined ? {} : { error: runError }),
|
|
37812
37838
|
repeat: 1,
|
|
37813
37839
|
lastAt: endedAt,
|
|
37814
37840
|
})
|
|
@@ -66942,14 +66968,8 @@ var IntegrationWithStateSchema = zod.z.object({
|
|
|
66942
66968
|
id: zod.z.string(),
|
|
66943
66969
|
addonId: zod.z.string(),
|
|
66944
66970
|
name: zod.z.string(),
|
|
66945
|
-
/**
|
|
66971
|
+
/** THE switch of the instance: the hub registry row is its only stored copy (D1066). */
|
|
66946
66972
|
enabled: zod.z.boolean(),
|
|
66947
|
-
/**
|
|
66948
|
-
* True when the addon that holds the switch did not answer (down, failed, or keeps no record for
|
|
66949
|
-
* this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
|
|
66950
|
-
* must not draw it as on or off (D315).
|
|
66951
|
-
*/
|
|
66952
|
-
switchUnknown: zod.z.literal(true).optional(),
|
|
66953
66973
|
info: zod.z.record(zod.z.string(), zod.z.unknown()).readonly(),
|
|
66954
66974
|
/** The discovery candidate this integration was set up from (D984). */
|
|
66955
66975
|
originStableId: zod.z.string().optional(),
|
|
@@ -66961,14 +66981,8 @@ var IntegrationLiteSchema = zod.z.object({
|
|
|
66961
66981
|
id: zod.z.string(),
|
|
66962
66982
|
addonId: zod.z.string(),
|
|
66963
66983
|
name: zod.z.string(),
|
|
66964
|
-
/**
|
|
66984
|
+
/** THE switch of the instance: the hub registry row is its only stored copy (D1066). */
|
|
66965
66985
|
enabled: zod.z.boolean(),
|
|
66966
|
-
/**
|
|
66967
|
-
* True when the addon that holds the switch did not answer (down, failed, or keeps no record for
|
|
66968
|
-
* this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
|
|
66969
|
-
* must not draw it as on or off (D315).
|
|
66970
|
-
*/
|
|
66971
|
-
switchUnknown: zod.z.literal(true).optional(),
|
|
66972
66986
|
info: zod.z.record(zod.z.string(), zod.z.unknown()).readonly(),
|
|
66973
66987
|
/** The discovery candidate this integration was set up from (D984). */
|
|
66974
66988
|
originStableId: zod.z.string().optional(),
|
|
@@ -67091,7 +67105,44 @@ var integrationsCapability = {
|
|
|
67091
67105
|
methods: {
|
|
67092
67106
|
list: require_runtime_capabilities.method(zod.z.void(), zod.z.array(IntegrationWithStateSchema)),
|
|
67093
67107
|
get: require_runtime_capabilities.method(zod.z.object({ id: zod.z.string() }), IntegrationWithStateSchema),
|
|
67108
|
+
/** The devices-role row of an addon; a services instance row never answers for its addon. */
|
|
67094
67109
|
getByAddonId: require_runtime_capabilities.method(zod.z.object({ addonId: zod.z.string() }), IntegrationLiteSchema.nullable()),
|
|
67110
|
+
/**
|
|
67111
|
+
* Every registry row of one addon, services instances included: the addon reads its own switches
|
|
67112
|
+
* with it at boot (D1066). A pure registry read; the Integrations list (`list`) hides the rows of
|
|
67113
|
+
* a services instance, this does not.
|
|
67114
|
+
*/
|
|
67115
|
+
listByAddon: require_runtime_capabilities.method(zod.z.object({ addonId: zod.z.string() }), zod.z.array(IntegrationLiteSchema)),
|
|
67116
|
+
/**
|
|
67117
|
+
* The one-time move of an addon's switches into the registry (D1066): for each instance record
|
|
67118
|
+
* the addon holds, an absent row is created as a services row under the addon-minted id, and a
|
|
67119
|
+
* row that disagrees with a STATED body switch is corrected (a body that states nothing never
|
|
67120
|
+
* moves an existing row). A row
|
|
67121
|
+
* that belongs to another addon is left alone and returned in `conflicts` (the caller keeps its
|
|
67122
|
+
* own copy of that state), and an addon naming another addon's id is refused FORBIDDEN.
|
|
67123
|
+
* Idempotent: a rerun changes nothing. It never notifies the addon.
|
|
67124
|
+
*/
|
|
67125
|
+
adoptInstanceRows: require_runtime_capabilities.method(zod.z.object({
|
|
67126
|
+
addonId: zod.z.string(),
|
|
67127
|
+
rows: zod.z.array(zod.z.object({
|
|
67128
|
+
id: zod.z.string().min(1),
|
|
67129
|
+
name: zod.z.string(),
|
|
67130
|
+
enabled: zod.z.boolean(),
|
|
67131
|
+
/** True when the record body STATED the switch: only then does it override an existing row. */
|
|
67132
|
+
stated: zod.z.boolean()
|
|
67133
|
+
}))
|
|
67134
|
+
}), zod.z.object({
|
|
67135
|
+
created: zod.z.number().int(),
|
|
67136
|
+
updated: zod.z.number().int(),
|
|
67137
|
+
/** Rows whose id belongs to ANOTHER addon: left untouched, so the caller keeps its own copy. */
|
|
67138
|
+
conflicts: zod.z.array(zod.z.object({
|
|
67139
|
+
id: zod.z.string(),
|
|
67140
|
+
ownerAddonId: zod.z.string()
|
|
67141
|
+
}))
|
|
67142
|
+
}), {
|
|
67143
|
+
kind: "mutation",
|
|
67144
|
+
auth: "admin"
|
|
67145
|
+
}),
|
|
67095
67146
|
update: require_runtime_capabilities.method(UpdateIntegrationInputSchema, IntegrationLiteSchema, {
|
|
67096
67147
|
kind: "mutation",
|
|
67097
67148
|
auth: "admin"
|
|
@@ -115248,152 +115299,6 @@ function accessoryChildrenComplete(children) {
|
|
|
115248
115299
|
};
|
|
115249
115300
|
}
|
|
115250
115301
|
//#endregion
|
|
115251
|
-
//#region src/device/device-restore-retry.ts
|
|
115252
|
-
/**
|
|
115253
|
-
* Delays before retry rounds 1..N — the round count IS the bound.
|
|
115254
|
-
* 10 s catches "the hub was busy for a moment"; the full schedule
|
|
115255
|
-
* (10 + 30 + 90 s of waiting, plus up to one 60 s transport timeout
|
|
115256
|
-
* per attempt) covers a device-manager lock held for minutes — the
|
|
115257
|
-
* 2026-09-04 outage's migration hold was ~3.5 min.
|
|
115258
|
-
*/
|
|
115259
|
-
var DEVICE_RESTORE_RETRY_DELAYS_MS = [
|
|
115260
|
-
1e4,
|
|
115261
|
-
3e4,
|
|
115262
|
-
9e4
|
|
115263
|
-
];
|
|
115264
|
-
/** Lane width for retry rounds. See module docblock — retries are
|
|
115265
|
-
* evidence of congestion, so they never re-stampede full-width. */
|
|
115266
|
-
var DEVICE_RESTORE_RETRY_CONCURRENCY = 4;
|
|
115267
|
-
/** Abortable sleep — resolves early (never rejects) on abort. */
|
|
115268
|
-
function sleep$1(ms, signal) {
|
|
115269
|
-
return new Promise((resolve) => {
|
|
115270
|
-
if (signal.aborted) {
|
|
115271
|
-
resolve();
|
|
115272
|
-
return;
|
|
115273
|
-
}
|
|
115274
|
-
const onAbort = () => {
|
|
115275
|
-
clearTimeout(timer);
|
|
115276
|
-
resolve();
|
|
115277
|
-
};
|
|
115278
|
-
const timer = setTimeout(() => {
|
|
115279
|
-
signal.removeEventListener("abort", onAbort);
|
|
115280
|
-
resolve();
|
|
115281
|
-
}, ms);
|
|
115282
|
-
timer.unref?.();
|
|
115283
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
115284
|
-
});
|
|
115285
|
-
}
|
|
115286
|
-
/** Drain `items` through at most `width` concurrent lanes. `fn` must
|
|
115287
|
-
* not reject (callers wrap their own try/catch). */
|
|
115288
|
-
async function runWithConcurrency(items, width, fn) {
|
|
115289
|
-
const queue = [...items];
|
|
115290
|
-
const laneCount = Math.max(1, Math.min(width, queue.length));
|
|
115291
|
-
const lane = async () => {
|
|
115292
|
-
for (;;) {
|
|
115293
|
-
const item = queue.shift();
|
|
115294
|
-
if (item === void 0) return;
|
|
115295
|
-
await fn(item);
|
|
115296
|
-
}
|
|
115297
|
-
};
|
|
115298
|
-
await Promise.all(Array.from({ length: laneCount }, lane));
|
|
115299
|
-
}
|
|
115300
|
-
var DeviceRestoreRetryScheduler = class {
|
|
115301
|
-
#logger;
|
|
115302
|
-
#attempt;
|
|
115303
|
-
#onPermanentFailure;
|
|
115304
|
-
#delaysMs;
|
|
115305
|
-
#concurrency;
|
|
115306
|
-
#now;
|
|
115307
|
-
#abort = new AbortController();
|
|
115308
|
-
constructor(options) {
|
|
115309
|
-
this.#logger = options.logger;
|
|
115310
|
-
this.#attempt = options.attempt;
|
|
115311
|
-
this.#onPermanentFailure = options.onPermanentFailure;
|
|
115312
|
-
this.#delaysMs = options.delaysMs ?? DEVICE_RESTORE_RETRY_DELAYS_MS;
|
|
115313
|
-
this.#concurrency = options.concurrency ?? 4;
|
|
115314
|
-
this.#now = options.now ?? Date.now;
|
|
115315
|
-
}
|
|
115316
|
-
/** Stop retrying (shutdown). Pending entries are NOT marked
|
|
115317
|
-
* permanently failed — the next boot restores them from disk. */
|
|
115318
|
-
cancel() {
|
|
115319
|
-
this.#abort.abort();
|
|
115320
|
-
}
|
|
115321
|
-
/**
|
|
115322
|
-
* Run the bounded retry rounds. Resolves when every entry has either
|
|
115323
|
-
* restored, been marked permanently failed, or the scheduler was
|
|
115324
|
-
* cancelled. Never rejects.
|
|
115325
|
-
*/
|
|
115326
|
-
async run(initialFailures) {
|
|
115327
|
-
let pending = initialFailures.map((failure) => ({
|
|
115328
|
-
saved: failure.saved,
|
|
115329
|
-
lastError: failure.error,
|
|
115330
|
-
attempts: 1
|
|
115331
|
-
}));
|
|
115332
|
-
for (let round = 0; round < this.#delaysMs.length; round += 1) {
|
|
115333
|
-
if (pending.length === 0 || this.#abort.signal.aborted) break;
|
|
115334
|
-
await sleep$1(this.#delaysMs[round] ?? 0, this.#abort.signal);
|
|
115335
|
-
if (this.#abort.signal.aborted) break;
|
|
115336
|
-
pending = await this.#runRound(pending, round);
|
|
115337
|
-
}
|
|
115338
|
-
if (this.#abort.signal.aborted) return [];
|
|
115339
|
-
const terminal = pending.map((entry) => ({
|
|
115340
|
-
deviceId: entry.saved.id,
|
|
115341
|
-
stableId: entry.saved.stableId,
|
|
115342
|
-
type: String(entry.saved.type),
|
|
115343
|
-
attempts: entry.attempts,
|
|
115344
|
-
lastError: entry.lastError,
|
|
115345
|
-
failedAt: this.#now()
|
|
115346
|
-
}));
|
|
115347
|
-
for (const failure of terminal) this.#onPermanentFailure(failure);
|
|
115348
|
-
return terminal;
|
|
115349
|
-
}
|
|
115350
|
-
/** One retry round: parents first (phase 0), then hub-adopted
|
|
115351
|
-
* children (phase 1) — a child's attempt depends on its parent
|
|
115352
|
-
* having landed, exactly like the initial two-pass restore. */
|
|
115353
|
-
async #runRound(pending, round) {
|
|
115354
|
-
const next = [];
|
|
115355
|
-
const parents = pending.filter((entry) => entry.saved.parentDeviceId === null);
|
|
115356
|
-
const children = pending.filter((entry) => entry.saved.parentDeviceId !== null);
|
|
115357
|
-
for (const phase of [parents, children]) await runWithConcurrency(phase, this.#concurrency, async (entry) => {
|
|
115358
|
-
if (this.#abort.signal.aborted) {
|
|
115359
|
-
next.push(entry);
|
|
115360
|
-
return;
|
|
115361
|
-
}
|
|
115362
|
-
const attemptNo = entry.attempts + 1;
|
|
115363
|
-
try {
|
|
115364
|
-
await this.#attempt(entry.saved);
|
|
115365
|
-
this.#logger.info("Device restored on retry", {
|
|
115366
|
-
tags: {
|
|
115367
|
-
deviceId: entry.saved.id,
|
|
115368
|
-
stableId: entry.saved.stableId
|
|
115369
|
-
},
|
|
115370
|
-
meta: { attempt: attemptNo }
|
|
115371
|
-
});
|
|
115372
|
-
} catch (err) {
|
|
115373
|
-
const lastError = err instanceof Error ? err.message : String(err);
|
|
115374
|
-
const remainingRetries = this.#delaysMs.length - (round + 1);
|
|
115375
|
-
this.#logger.warn("Device restore retry failed", {
|
|
115376
|
-
tags: {
|
|
115377
|
-
deviceId: entry.saved.id,
|
|
115378
|
-
stableId: entry.saved.stableId
|
|
115379
|
-
},
|
|
115380
|
-
meta: {
|
|
115381
|
-
attempt: attemptNo,
|
|
115382
|
-
remainingRetries,
|
|
115383
|
-
error: lastError
|
|
115384
|
-
}
|
|
115385
|
-
});
|
|
115386
|
-
next.push({
|
|
115387
|
-
saved: entry.saved,
|
|
115388
|
-
lastError,
|
|
115389
|
-
attempts: attemptNo
|
|
115390
|
-
});
|
|
115391
|
-
}
|
|
115392
|
-
});
|
|
115393
|
-
return next;
|
|
115394
|
-
}
|
|
115395
|
-
};
|
|
115396
|
-
//#endregion
|
|
115397
115302
|
//#region src/device/base-device-provider.ts
|
|
115398
115303
|
/**
|
|
115399
115304
|
* Convert an IDevice to the flat DeviceSummary shape expected by the
|
|
@@ -115591,7 +115496,7 @@ var BaseDeviceProvider = class extends require_runtime_capabilities.BaseAddon {
|
|
|
115591
115496
|
this.ctx.logger.info(`Restored ${restoredCount} ${this.providerName} device(s)`);
|
|
115592
115497
|
}
|
|
115593
115498
|
/** Retry schedule. Overridable (tests use millisecond delays). */
|
|
115594
|
-
restoreRetryDelaysMs = DEVICE_RESTORE_RETRY_DELAYS_MS;
|
|
115499
|
+
restoreRetryDelaysMs = require_runtime_capabilities.DEVICE_RESTORE_RETRY_DELAYS_MS;
|
|
115595
115500
|
/** Retry lane width. See `device-restore-retry.ts` for why retries
|
|
115596
115501
|
* never re-stampede full-width while the initial pass does (D167). */
|
|
115597
115502
|
restoreRetryConcurrency = 4;
|
|
@@ -115695,7 +115600,7 @@ var BaseDeviceProvider = class extends require_runtime_capabilities.BaseAddon {
|
|
|
115695
115600
|
} });
|
|
115696
115601
|
return;
|
|
115697
115602
|
}
|
|
115698
|
-
const scheduler = new DeviceRestoreRetryScheduler({
|
|
115603
|
+
const scheduler = new require_runtime_capabilities.DeviceRestoreRetryScheduler({
|
|
115699
115604
|
logger: this.ctx.logger,
|
|
115700
115605
|
delaysMs: this.restoreRetryDelaysMs,
|
|
115701
115606
|
concurrency: this.restoreRetryConcurrency,
|
|
@@ -124820,6 +124725,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
124820
124725
|
access: "create",
|
|
124821
124726
|
role: "admin"
|
|
124822
124727
|
},
|
|
124728
|
+
"integrations.adoptInstanceRows": {
|
|
124729
|
+
capName: "integrations",
|
|
124730
|
+
capScope: "system",
|
|
124731
|
+
addonId: null,
|
|
124732
|
+
access: "create",
|
|
124733
|
+
role: "admin"
|
|
124734
|
+
},
|
|
124823
124735
|
"integrations.delete": {
|
|
124824
124736
|
capName: "integrations",
|
|
124825
124737
|
capScope: "system",
|
|
@@ -124855,6 +124767,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
124855
124767
|
access: "view",
|
|
124856
124768
|
role: "admin"
|
|
124857
124769
|
},
|
|
124770
|
+
"integrations.listByAddon": {
|
|
124771
|
+
capName: "integrations",
|
|
124772
|
+
capScope: "system",
|
|
124773
|
+
addonId: null,
|
|
124774
|
+
access: "view",
|
|
124775
|
+
role: "admin"
|
|
124776
|
+
},
|
|
124858
124777
|
"integrations.update": {
|
|
124859
124778
|
capName: "integrations",
|
|
124860
124779
|
capScope: "system",
|
|
@@ -139009,6 +138928,8 @@ function createSystemProxy(api) {
|
|
|
139009
138928
|
list: (input) => dispatch("integrations", "list", "query", input),
|
|
139010
138929
|
get: (input) => dispatch("integrations", "get", "query", input),
|
|
139011
138930
|
getByAddonId: (input) => dispatch("integrations", "getByAddonId", "query", input),
|
|
138931
|
+
listByAddon: (input) => dispatch("integrations", "listByAddon", "query", input),
|
|
138932
|
+
adoptInstanceRows: (input) => dispatch("integrations", "adoptInstanceRows", "mutation", input),
|
|
139012
138933
|
update: (input) => dispatch("integrations", "update", "mutation", input),
|
|
139013
138934
|
delete: (input) => dispatch("integrations", "delete", "mutation", input),
|
|
139014
138935
|
getAvailableTypes: (input) => dispatch("integrations", "getAvailableTypes", "query", input)
|
|
@@ -152061,8 +151982,8 @@ exports.DEVICE_NONCE_TTL_MS = DEVICE_NONCE_TTL_MS;
|
|
|
152061
151982
|
exports.DEVICE_PROFILES = DEVICE_PROFILES;
|
|
152062
151983
|
exports.DEVICE_RAMP = DEVICE_RAMP;
|
|
152063
151984
|
exports.DEVICE_REFRESH_REFUSAL_PREFIX = DEVICE_REFRESH_REFUSAL_PREFIX;
|
|
152064
|
-
exports.DEVICE_RESTORE_RETRY_CONCURRENCY = DEVICE_RESTORE_RETRY_CONCURRENCY;
|
|
152065
|
-
exports.DEVICE_RESTORE_RETRY_DELAYS_MS = DEVICE_RESTORE_RETRY_DELAYS_MS;
|
|
151985
|
+
exports.DEVICE_RESTORE_RETRY_CONCURRENCY = require_runtime_capabilities.DEVICE_RESTORE_RETRY_CONCURRENCY;
|
|
151986
|
+
exports.DEVICE_RESTORE_RETRY_DELAYS_MS = require_runtime_capabilities.DEVICE_RESTORE_RETRY_DELAYS_MS;
|
|
152066
151987
|
exports.DEVICE_ROLE_ICON = DEVICE_ROLE_ICON;
|
|
152067
151988
|
exports.DEVICE_RUNS_MAX_PAGE = DEVICE_RUNS_MAX_PAGE;
|
|
152068
151989
|
exports.DEVICE_SAN_CREDENTIAL_PREFIX = DEVICE_SAN_CREDENTIAL_PREFIX;
|
|
@@ -152179,7 +152100,7 @@ exports.DeviceRefusalReasonSchema = DeviceRefusalReasonSchema;
|
|
|
152179
152100
|
exports.DeviceRefusalSchema = DeviceRefusalSchema;
|
|
152180
152101
|
exports.DeviceRemovedInputSchema = DeviceRemovedInputSchema;
|
|
152181
152102
|
exports.DeviceRemovedResultSchema = DeviceRemovedResultSchema;
|
|
152182
|
-
exports.DeviceRestoreRetryScheduler = DeviceRestoreRetryScheduler;
|
|
152103
|
+
exports.DeviceRestoreRetryScheduler = require_runtime_capabilities.DeviceRestoreRetryScheduler;
|
|
152183
152104
|
exports.DeviceRole = require_composed_stable_id.DeviceRole;
|
|
152184
152105
|
exports.DeviceRunDetailSchema = DeviceRunDetailSchema;
|
|
152185
152106
|
exports.DeviceRunEnergyMethodSchema = DeviceRunEnergyMethodSchema;
|
|
@@ -152599,6 +152520,7 @@ exports.InstallDesktopUpdateReasonSchema = InstallDesktopUpdateReasonSchema;
|
|
|
152599
152520
|
exports.InstallDesktopUpdateResultSchema = InstallDesktopUpdateResultSchema;
|
|
152600
152521
|
exports.InstalledPackageSchema = InstalledPackageSchema;
|
|
152601
152522
|
exports.InstanceInUseError = InstanceInUseError;
|
|
152523
|
+
exports.InstanceSwitchesUnreadError = require_runtime_capabilities.InstanceSwitchesUnreadError;
|
|
152602
152524
|
exports.IntegralHelperSpecSchema = require_implemented_methods.IntegralHelperSpecSchema;
|
|
152603
152525
|
exports.IntegrationInstanceAddDeviceSchema = IntegrationInstanceAddDeviceSchema;
|
|
152604
152526
|
exports.IntegrationInstanceDescriptionSchema = IntegrationInstanceDescriptionSchema;
|
|
@@ -153703,6 +153625,7 @@ exports.SERIAL_CAPACITY_CAMERA_FPS = SERIAL_CAPACITY_CAMERA_FPS;
|
|
|
153703
153625
|
exports.SERIES_KINDS = require_implemented_methods.SERIES_KINDS;
|
|
153704
153626
|
exports.SERVER_NAME_MAX_LENGTH = SERVER_NAME_MAX_LENGTH;
|
|
153705
153627
|
exports.SERVER_NAME_SETTING_KEY = SERVER_NAME_SETTING_KEY;
|
|
153628
|
+
exports.SERVICE_INSTANCE_INFO_KEY = SERVICE_INSTANCE_INFO_KEY;
|
|
153706
153629
|
exports.SESSION_LOST_ALERT_CATEGORY = SESSION_LOST_ALERT_CATEGORY;
|
|
153707
153630
|
exports.SESSION_PLACEMENT_SETTING_KEY = SESSION_PLACEMENT_SETTING_KEY;
|
|
153708
153631
|
exports.SET_VARS_MAX = SET_VARS_MAX;
|
|
@@ -154305,10 +154228,15 @@ exports.bareAddonId = bareAddonId;
|
|
|
154305
154228
|
exports.baseUnitForQuantity = baseUnitForQuantity;
|
|
154306
154229
|
exports.baseUnitOf = require_runtime_capabilities.baseUnitOf;
|
|
154307
154230
|
exports.batteryCapability = batteryCapability;
|
|
154231
|
+
exports.beginHydration = require_runtime_capabilities.beginHydration;
|
|
154308
154232
|
exports.bestLocationMatch = bestLocationMatch;
|
|
154309
154233
|
exports.binaryCapability = binaryCapability;
|
|
154310
154234
|
exports.bindAddonActions = bindAddonActions;
|
|
154311
154235
|
exports.boardKeySourceCapability = boardKeySourceCapability;
|
|
154236
|
+
exports.bodySwitchPortsOver = require_runtime_capabilities.bodySwitchPortsOver;
|
|
154237
|
+
exports.bodySwitchRecordsOverMigrationApi = require_runtime_capabilities.bodySwitchRecordsOverMigrationApi;
|
|
154238
|
+
exports.bodySwitchToRegistryId = require_runtime_capabilities.bodySwitchToRegistryId;
|
|
154239
|
+
exports.bodySwitchToRegistryMigration = require_runtime_capabilities.bodySwitchToRegistryMigration;
|
|
154312
154240
|
exports.brightnessCapability = brightnessCapability;
|
|
154313
154241
|
exports.brokerCapability = brokerCapability;
|
|
154314
154242
|
exports.brokerLinkPortsOver = brokerLinkPortsOver;
|
|
@@ -154388,6 +154316,7 @@ exports.checkTemplatePayload = checkTemplatePayload;
|
|
|
154388
154316
|
exports.claimDevicesMigration = claimDevicesMigration;
|
|
154389
154317
|
exports.claimDevicesPortsOver = claimDevicesPortsOver;
|
|
154390
154318
|
exports.claimDevicesToDefaultIntegration = claimDevicesToDefaultIntegration;
|
|
154319
|
+
exports.claimInstance = require_runtime_capabilities.claimInstance;
|
|
154391
154320
|
exports.claimedRequestOrigins = claimedRequestOrigins;
|
|
154392
154321
|
exports.classifyBearerPrincipal = classifyBearerPrincipal;
|
|
154393
154322
|
exports.classifyCamerasForBenchmark = classifyCamerasForBenchmark;
|
|
@@ -154398,6 +154327,7 @@ exports.classifySecretWrite = require_runtime_capabilities.classifySecretWrite;
|
|
|
154398
154327
|
exports.classifyStoreError = require_runtime_capabilities.classifyStoreError;
|
|
154399
154328
|
exports.classifyStream = classifyStream;
|
|
154400
154329
|
exports.classifyStreams = classifyStreams;
|
|
154330
|
+
exports.clearInstanceSwitches = require_runtime_capabilities.clearInstanceSwitches;
|
|
154401
154331
|
exports.clearKnownSecrets = require_runtime_capabilities.clearKnownSecrets;
|
|
154402
154332
|
exports.clearModelBoundOverrides = clearModelBoundOverrides;
|
|
154403
154333
|
exports.clearModelBoundSetting = clearModelBoundSetting;
|
|
@@ -154756,11 +154686,13 @@ exports.flipperIrDraft = flipperIrDraft;
|
|
|
154756
154686
|
exports.flipperIrTable = flipperIrTable;
|
|
154757
154687
|
exports.flipperRole = flipperRole;
|
|
154758
154688
|
exports.floodCapability = floodCapability;
|
|
154689
|
+
exports.foldHoldEpisodes = foldHoldEpisodes;
|
|
154759
154690
|
exports.foldSnapshotByFunction = foldSnapshotByFunction;
|
|
154760
154691
|
exports.followSwitchRunningFeature = followSwitchRunningFeature;
|
|
154761
154692
|
exports.forEachLeaf = forEachLeaf;
|
|
154762
154693
|
exports.forbiddenError = require_runtime_capabilities.forbiddenError;
|
|
154763
154694
|
exports.foreignCapacityCells = foreignCapacityCells;
|
|
154695
|
+
exports.forgetInstanceSwitch = require_runtime_capabilities.forgetInstanceSwitch;
|
|
154764
154696
|
exports.forgetKnownSecret = require_runtime_capabilities.forgetKnownSecret;
|
|
154765
154697
|
exports.formatDeviceRevoker = formatDeviceRevoker;
|
|
154766
154698
|
exports.formatForRuntime = require_runtime_capabilities.formatForRuntime;
|
|
@@ -154833,6 +154765,7 @@ exports.hubMotionNativeProvider = hubMotionNativeProvider;
|
|
|
154833
154765
|
exports.humidifierCapability = humidifierCapability;
|
|
154834
154766
|
exports.humidityMeasurement = humidityMeasurement;
|
|
154835
154767
|
exports.humiditySensorCapability = humiditySensorCapability;
|
|
154768
|
+
exports.hydrateInstanceSwitches = require_runtime_capabilities.hydrateInstanceSwitches;
|
|
154836
154769
|
exports.hydrateSchema = require_runtime_capabilities.hydrateSchema;
|
|
154837
154770
|
exports.iconCategoryLabel = iconCategoryLabel;
|
|
154838
154771
|
exports.iconEntry = iconEntry;
|
|
@@ -154924,8 +154857,10 @@ exports.isForwardInputRef = require_implemented_methods.isForwardInputRef;
|
|
|
154924
154857
|
exports.isHeldBackTemplateVar = isHeldBackTemplateVar;
|
|
154925
154858
|
exports.isHistoryHelper = require_implemented_methods.isHistoryHelper;
|
|
154926
154859
|
exports.isHubId = isHubId;
|
|
154860
|
+
exports.isHydrationPending = require_runtime_capabilities.isHydrationPending;
|
|
154927
154861
|
exports.isIconKey = isIconKey;
|
|
154928
|
-
exports.
|
|
154862
|
+
exports.isInstanceOn = require_runtime_capabilities.isInstanceOn;
|
|
154863
|
+
exports.isInstanceSwitchesUnreadError = require_runtime_capabilities.isInstanceSwitchesUnreadError;
|
|
154929
154864
|
exports.isInternalActionId = isInternalActionId;
|
|
154930
154865
|
exports.isIsolatedBuiltin = isIsolatedBuiltin;
|
|
154931
154866
|
exports.isKernelDerivedFeature = isKernelDerivedFeature;
|
|
@@ -155097,6 +155032,7 @@ exports.motionDetectionCapability = motionDetectionCapability;
|
|
|
155097
155032
|
exports.motionSourceLabel = motionSourceLabel;
|
|
155098
155033
|
exports.motionTriggerCapability = motionTriggerCapability;
|
|
155099
155034
|
exports.motionZonesCapability = motionZonesCapability;
|
|
155035
|
+
exports.moveBodySwitchToRegistry = require_runtime_capabilities.moveBodySwitchToRegistry;
|
|
155100
155036
|
exports.moveBrokerLinksToConnections = moveBrokerLinksToConnections;
|
|
155101
155037
|
exports.moveCalendarIdsToRecords = moveCalendarIdsToRecords;
|
|
155102
155038
|
exports.moveGroup = moveGroup;
|
|
@@ -155214,6 +155150,7 @@ exports.parseSmtpSinceKey = parseSmtpSinceKey;
|
|
|
155214
155150
|
exports.parseStreamParamsFormPatch = parseStreamParamsFormPatch;
|
|
155215
155151
|
exports.parseTrainingEventLine = parseTrainingEventLine;
|
|
155216
155152
|
exports.patchAudio = patchAudio;
|
|
155153
|
+
exports.pendingHydrationOwners = require_runtime_capabilities.pendingHydrationOwners;
|
|
155217
155154
|
exports.petFeederCapability = petFeederCapability;
|
|
155218
155155
|
exports.petFountainCapability = petFountainCapability;
|
|
155219
155156
|
exports.petFountainFromEntitiesComposition = petFountainFromEntitiesComposition;
|
|
@@ -155328,6 +155265,8 @@ exports.reconcileRemovedDevices = reconcileRemovedDevices;
|
|
|
155328
155265
|
exports.reconcileReportedFeatures = reconcileReportedFeatures;
|
|
155329
155266
|
exports.recordArrayItemPath = require_runtime_capabilities.recordArrayItemPath;
|
|
155330
155267
|
exports.recordEntriesCapability = recordEntriesCapability;
|
|
155268
|
+
exports.recordInstanceSwitch = require_runtime_capabilities.recordInstanceSwitch;
|
|
155269
|
+
exports.recordRegistrySwitch = require_runtime_capabilities.recordRegistrySwitch;
|
|
155331
155270
|
exports.recordSecretCollection = require_runtime_capabilities.recordSecretCollection;
|
|
155332
155271
|
exports.recordSecretRef = require_runtime_capabilities.recordSecretRef;
|
|
155333
155272
|
exports.recordingArchiveCapability = recordingArchiveCapability;
|
|
@@ -155541,6 +155480,7 @@ exports.settingValuesEqual = settingValuesEqual;
|
|
|
155541
155480
|
exports.settingsBelow = settingsBelow;
|
|
155542
155481
|
exports.settingsStoreCapability = settingsStoreCapability;
|
|
155543
155482
|
exports.settleDeviceFeatures = settleDeviceFeatures;
|
|
155483
|
+
exports.settleHydration = require_runtime_capabilities.settleHydration;
|
|
155544
155484
|
exports.shareViewGrantOf = shareViewGrantOf;
|
|
155545
155485
|
exports.sharedActuatorFeatures = sharedActuatorFeatures;
|
|
155546
155486
|
exports.sharedActuatorMethods = sharedActuatorMethods;
|