@camstack/types 1.2.601 → 1.2.603
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 +13 -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/capabilities/integrations.cap.d.ts +43 -6
- package/dist/client.js +2 -0
- package/dist/client.mjs +2 -0
- package/dist/enums/event-category-catalog.d.ts +37 -0
- package/dist/enums/index.d.ts +1 -0
- package/dist/enums.js +260 -0
- package/dist/enums.mjs +256 -2
- 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 +7 -1
- package/dist/index.js +102 -186
- package/dist/index.mjs +75 -182
- 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.d.ts
CHANGED
|
@@ -20,9 +20,11 @@ export { buildSessionLostAlert, DEFAULT_SESSION_LOST_DEBOUNCE_MS, IntegrationSes
|
|
|
20
20
|
export type { InstanceChange, RecordIntegrationInstancesHooks, ResolvedInstance, ResolvedSecretsState, } from './addon/record-integration-instances.js';
|
|
21
21
|
export { CONNECTION_TEST_TIMEOUT_MS } from './addon/connection-probe.js';
|
|
22
22
|
export type { ConnectionTestOutcome, IConnectionProbe } from './addon/connection-probe.js';
|
|
23
|
-
export { RecordIntegrationInstances, defaultAddDeviceMode,
|
|
23
|
+
export { RecordIntegrationInstances, defaultAddDeviceMode, } from './addon/record-integration-instances.js';
|
|
24
|
+
export { beginHydration, claimInstance, isHydrationPending, pendingHydrationOwners, clearInstanceSwitches, forgetInstanceSwitch, hydrateInstanceSwitches, isInstanceOn, recordInstanceSwitch, recordRegistrySwitch, settleHydration, } from './addon/instance-switches.js';
|
|
24
25
|
export { composeInstanceKinds, UnknownInstanceError, UnknownInstanceKindError, } from './addon/compose-instance-kinds.js';
|
|
25
26
|
export type { InstanceKindPart } from './addon/compose-instance-kinds.js';
|
|
27
|
+
export { InstanceSwitchesUnreadError, isInstanceSwitchesUnreadError, } from './addon/instance-switches-unread-error.js';
|
|
26
28
|
export * from './addon/notification-targets.js';
|
|
27
29
|
export * from './addon/instances-of-cap.js';
|
|
28
30
|
export type { DurableState, DurableStateDeps } from './addon/durable-state.js';
|
|
@@ -81,6 +83,7 @@ export * from './migrations/integration-rows-api-ports.js';
|
|
|
81
83
|
export * from './migrations/claim-devices-to-default-integration.js';
|
|
82
84
|
export * from './migrations/default-integration-migrations.js';
|
|
83
85
|
export * from './migrations/registry-switch-to-body.js';
|
|
86
|
+
export * from './migrations/body-switch-to-registry.js';
|
|
84
87
|
export * from './training/index.js';
|
|
85
88
|
export * from './retrain-review.js';
|
|
86
89
|
export { mergeSecretStatePaths, parseSecretStatePath, type SecretNode, type SecretTree, secretTreeFromPaths, secretTreeFromSchema, } from './addon/secret-paths.js';
|
|
@@ -104,6 +107,7 @@ export type * from './interfaces/frame-handle.js';
|
|
|
104
107
|
export type * from './interfaces/inference-capabilities.js';
|
|
105
108
|
export type * from './interfaces/inference-engine.js';
|
|
106
109
|
export type { CreateIntegrationInput, IIntegrationRegistry, Integration, } from './interfaces/integration-registry.js';
|
|
110
|
+
export { SERVICE_INSTANCE_INFO_KEY } from './interfaces/integration-registry.js';
|
|
107
111
|
export type * from './interfaces/kernel-abstractions.js';
|
|
108
112
|
export type * from './interfaces/lifecycle.js';
|
|
109
113
|
export type * from './interfaces/logging.js';
|
|
@@ -324,6 +328,8 @@ export type { DeviceConfigEntry } from './device/zod-to-config-ui.js';
|
|
|
324
328
|
export { zodEntriesToConfigUI } from './device/zod-to-config-ui.js';
|
|
325
329
|
export { collectZodSecretPaths, isZodSecret, SECRET_META } from './device/zod-secret.js';
|
|
326
330
|
export { EventCategory, isOwnerOnlyEventCategory, OWNER_ONLY_EVENT_CATEGORIES, publicEventCategories, } from './enums/event-category.js';
|
|
331
|
+
export { catalogedEventCategories, EVENT_CATEGORY_CATALOG, EVENT_CATEGORY_GROUPS, noiseEventCategories, offerableEventCategories, } from './enums/event-category-catalog.js';
|
|
332
|
+
export type { EventCategoryEntry, EventCategoryGroup, EventCategoryLabel, } from './enums/event-category-catalog.js';
|
|
327
333
|
export * from './enums/index.js';
|
|
328
334
|
export type { CompileResult, EvaluateExpressionSourceResult, ExpressionBinaryOperator, ExpressionBindingSource, ExpressionBuiltin, ExpressionEvalHooks, ExpressionEvalOptions, ExpressionFieldBinding, ExpressionGlobalBinding, ExpressionLiteralBinding, ExpressionLogicalOperator, ExpressionNode, ExpressionNodePath, ExpressionSource, ExpressionSourceInput, ExpressionUnaryOperator, ExpressionValue, CountCallState, RoseCallState, StatefulCallState, StatefulCallInvocation, StatefulExpressionEnvironment, StatefulExpressionMemory, StatefulExpressionBuiltin, Keyword, ParsedExpression, Punctuator, Token, } from './expression/index.js';
|
|
329
335
|
export { DEVICE_TEMPLATE_BUDGET_MS, DEVICE_TEMPLATE_FILTERS, DEVICE_TEMPLATE_MAX_LENGTH, DEVICE_TEMPLATE_MAX_OUTPUT, DEVICE_TEMPLATE_NOW_ALIAS, DEVICE_TEMPLATE_THIS_ALIAS, DEVICE_TEMPLATE_VALUES_CAP, DEVICE_TEMPLATE_UNAVAILABLE, DEVICE_TEMPLATE_REFUSAL_REASONS, DEVICE_TEMPLATE_TRACE_REASONS, DeviceTemplateRefusalSchema, DeviceTemplateRenderSchema, DeviceTemplateSchema, DeviceTemplateThisDeviceSchema, DeviceTemplateTraceEntrySchema, DeviceTemplateValueSchema, resolveTemplateRef, templateCapKey, } from './expression/device-template.js';
|
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
|
|
@@ -39030,6 +39023,10 @@ function normalizeConditionUnits(condition, resolver, path = "when") {
|
|
|
39030
39023
|
}
|
|
39031
39024
|
}
|
|
39032
39025
|
function normalizeCommandStepUnits(step, resolver, path) {
|
|
39026
|
+
if (require_runtime_capabilities.findVocabAction(step.actionId) === void 0) return {
|
|
39027
|
+
value: step,
|
|
39028
|
+
warnings: []
|
|
39029
|
+
};
|
|
39033
39030
|
const deviceId = step.target.kind === "devices" && step.target.ids.length === 1 ? step.target.ids[0] : void 0;
|
|
39034
39031
|
const { cap, method } = require_runtime_capabilities.vocabCall(step.actionId, void 0);
|
|
39035
39032
|
const args = { ...step.args };
|
|
@@ -39146,6 +39143,7 @@ function stampCondition(condition, resolver) {
|
|
|
39146
39143
|
}
|
|
39147
39144
|
function stampAction(action, resolver) {
|
|
39148
39145
|
if (action.kind !== "command" || action.args === void 0) return action;
|
|
39146
|
+
if (require_runtime_capabilities.findVocabAction(action.actionId) === void 0) return action;
|
|
39149
39147
|
const { cap, method } = require_runtime_capabilities.vocabCall(action.actionId, void 0);
|
|
39150
39148
|
const argUnits = { ...action.argUnits };
|
|
39151
39149
|
for (const [arg, value] of Object.entries(action.args)) {
|
|
@@ -66975,14 +66973,8 @@ var IntegrationWithStateSchema = zod.z.object({
|
|
|
66975
66973
|
id: zod.z.string(),
|
|
66976
66974
|
addonId: zod.z.string(),
|
|
66977
66975
|
name: zod.z.string(),
|
|
66978
|
-
/**
|
|
66976
|
+
/** THE switch of the instance: the hub registry row is its only stored copy (D1066). */
|
|
66979
66977
|
enabled: zod.z.boolean(),
|
|
66980
|
-
/**
|
|
66981
|
-
* True when the addon that holds the switch did not answer (down, failed, or keeps no record for
|
|
66982
|
-
* this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
|
|
66983
|
-
* must not draw it as on or off (D315).
|
|
66984
|
-
*/
|
|
66985
|
-
switchUnknown: zod.z.literal(true).optional(),
|
|
66986
66978
|
info: zod.z.record(zod.z.string(), zod.z.unknown()).readonly(),
|
|
66987
66979
|
/** The discovery candidate this integration was set up from (D984). */
|
|
66988
66980
|
originStableId: zod.z.string().optional(),
|
|
@@ -66994,14 +66986,8 @@ var IntegrationLiteSchema = zod.z.object({
|
|
|
66994
66986
|
id: zod.z.string(),
|
|
66995
66987
|
addonId: zod.z.string(),
|
|
66996
66988
|
name: zod.z.string(),
|
|
66997
|
-
/**
|
|
66989
|
+
/** THE switch of the instance: the hub registry row is its only stored copy (D1066). */
|
|
66998
66990
|
enabled: zod.z.boolean(),
|
|
66999
|
-
/**
|
|
67000
|
-
* True when the addon that holds the switch did not answer (down, failed, or keeps no record for
|
|
67001
|
-
* this row): `enabled` is then the stored registry flag, a stale value, not the state. A reader
|
|
67002
|
-
* must not draw it as on or off (D315).
|
|
67003
|
-
*/
|
|
67004
|
-
switchUnknown: zod.z.literal(true).optional(),
|
|
67005
66991
|
info: zod.z.record(zod.z.string(), zod.z.unknown()).readonly(),
|
|
67006
66992
|
/** The discovery candidate this integration was set up from (D984). */
|
|
67007
66993
|
originStableId: zod.z.string().optional(),
|
|
@@ -67124,7 +67110,44 @@ var integrationsCapability = {
|
|
|
67124
67110
|
methods: {
|
|
67125
67111
|
list: require_runtime_capabilities.method(zod.z.void(), zod.z.array(IntegrationWithStateSchema)),
|
|
67126
67112
|
get: require_runtime_capabilities.method(zod.z.object({ id: zod.z.string() }), IntegrationWithStateSchema),
|
|
67113
|
+
/** The devices-role row of an addon; a services instance row never answers for its addon. */
|
|
67127
67114
|
getByAddonId: require_runtime_capabilities.method(zod.z.object({ addonId: zod.z.string() }), IntegrationLiteSchema.nullable()),
|
|
67115
|
+
/**
|
|
67116
|
+
* Every registry row of one addon, services instances included: the addon reads its own switches
|
|
67117
|
+
* with it at boot (D1066). A pure registry read; the Integrations list (`list`) hides the rows of
|
|
67118
|
+
* a services instance, this does not.
|
|
67119
|
+
*/
|
|
67120
|
+
listByAddon: require_runtime_capabilities.method(zod.z.object({ addonId: zod.z.string() }), zod.z.array(IntegrationLiteSchema)),
|
|
67121
|
+
/**
|
|
67122
|
+
* The one-time move of an addon's switches into the registry (D1066): for each instance record
|
|
67123
|
+
* the addon holds, an absent row is created as a services row under the addon-minted id, and a
|
|
67124
|
+
* row that disagrees with a STATED body switch is corrected (a body that states nothing never
|
|
67125
|
+
* moves an existing row). A row
|
|
67126
|
+
* that belongs to another addon is left alone and returned in `conflicts` (the caller keeps its
|
|
67127
|
+
* own copy of that state), and an addon naming another addon's id is refused FORBIDDEN.
|
|
67128
|
+
* Idempotent: a rerun changes nothing. It never notifies the addon.
|
|
67129
|
+
*/
|
|
67130
|
+
adoptInstanceRows: require_runtime_capabilities.method(zod.z.object({
|
|
67131
|
+
addonId: zod.z.string(),
|
|
67132
|
+
rows: zod.z.array(zod.z.object({
|
|
67133
|
+
id: zod.z.string().min(1),
|
|
67134
|
+
name: zod.z.string(),
|
|
67135
|
+
enabled: zod.z.boolean(),
|
|
67136
|
+
/** True when the record body STATED the switch: only then does it override an existing row. */
|
|
67137
|
+
stated: zod.z.boolean()
|
|
67138
|
+
}))
|
|
67139
|
+
}), zod.z.object({
|
|
67140
|
+
created: zod.z.number().int(),
|
|
67141
|
+
updated: zod.z.number().int(),
|
|
67142
|
+
/** Rows whose id belongs to ANOTHER addon: left untouched, so the caller keeps its own copy. */
|
|
67143
|
+
conflicts: zod.z.array(zod.z.object({
|
|
67144
|
+
id: zod.z.string(),
|
|
67145
|
+
ownerAddonId: zod.z.string()
|
|
67146
|
+
}))
|
|
67147
|
+
}), {
|
|
67148
|
+
kind: "mutation",
|
|
67149
|
+
auth: "admin"
|
|
67150
|
+
}),
|
|
67128
67151
|
update: require_runtime_capabilities.method(UpdateIntegrationInputSchema, IntegrationLiteSchema, {
|
|
67129
67152
|
kind: "mutation",
|
|
67130
67153
|
auth: "admin"
|
|
@@ -115281,152 +115304,6 @@ function accessoryChildrenComplete(children) {
|
|
|
115281
115304
|
};
|
|
115282
115305
|
}
|
|
115283
115306
|
//#endregion
|
|
115284
|
-
//#region src/device/device-restore-retry.ts
|
|
115285
|
-
/**
|
|
115286
|
-
* Delays before retry rounds 1..N — the round count IS the bound.
|
|
115287
|
-
* 10 s catches "the hub was busy for a moment"; the full schedule
|
|
115288
|
-
* (10 + 30 + 90 s of waiting, plus up to one 60 s transport timeout
|
|
115289
|
-
* per attempt) covers a device-manager lock held for minutes — the
|
|
115290
|
-
* 2026-09-04 outage's migration hold was ~3.5 min.
|
|
115291
|
-
*/
|
|
115292
|
-
var DEVICE_RESTORE_RETRY_DELAYS_MS = [
|
|
115293
|
-
1e4,
|
|
115294
|
-
3e4,
|
|
115295
|
-
9e4
|
|
115296
|
-
];
|
|
115297
|
-
/** Lane width for retry rounds. See module docblock — retries are
|
|
115298
|
-
* evidence of congestion, so they never re-stampede full-width. */
|
|
115299
|
-
var DEVICE_RESTORE_RETRY_CONCURRENCY = 4;
|
|
115300
|
-
/** Abortable sleep — resolves early (never rejects) on abort. */
|
|
115301
|
-
function sleep$1(ms, signal) {
|
|
115302
|
-
return new Promise((resolve) => {
|
|
115303
|
-
if (signal.aborted) {
|
|
115304
|
-
resolve();
|
|
115305
|
-
return;
|
|
115306
|
-
}
|
|
115307
|
-
const onAbort = () => {
|
|
115308
|
-
clearTimeout(timer);
|
|
115309
|
-
resolve();
|
|
115310
|
-
};
|
|
115311
|
-
const timer = setTimeout(() => {
|
|
115312
|
-
signal.removeEventListener("abort", onAbort);
|
|
115313
|
-
resolve();
|
|
115314
|
-
}, ms);
|
|
115315
|
-
timer.unref?.();
|
|
115316
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
115317
|
-
});
|
|
115318
|
-
}
|
|
115319
|
-
/** Drain `items` through at most `width` concurrent lanes. `fn` must
|
|
115320
|
-
* not reject (callers wrap their own try/catch). */
|
|
115321
|
-
async function runWithConcurrency(items, width, fn) {
|
|
115322
|
-
const queue = [...items];
|
|
115323
|
-
const laneCount = Math.max(1, Math.min(width, queue.length));
|
|
115324
|
-
const lane = async () => {
|
|
115325
|
-
for (;;) {
|
|
115326
|
-
const item = queue.shift();
|
|
115327
|
-
if (item === void 0) return;
|
|
115328
|
-
await fn(item);
|
|
115329
|
-
}
|
|
115330
|
-
};
|
|
115331
|
-
await Promise.all(Array.from({ length: laneCount }, lane));
|
|
115332
|
-
}
|
|
115333
|
-
var DeviceRestoreRetryScheduler = class {
|
|
115334
|
-
#logger;
|
|
115335
|
-
#attempt;
|
|
115336
|
-
#onPermanentFailure;
|
|
115337
|
-
#delaysMs;
|
|
115338
|
-
#concurrency;
|
|
115339
|
-
#now;
|
|
115340
|
-
#abort = new AbortController();
|
|
115341
|
-
constructor(options) {
|
|
115342
|
-
this.#logger = options.logger;
|
|
115343
|
-
this.#attempt = options.attempt;
|
|
115344
|
-
this.#onPermanentFailure = options.onPermanentFailure;
|
|
115345
|
-
this.#delaysMs = options.delaysMs ?? DEVICE_RESTORE_RETRY_DELAYS_MS;
|
|
115346
|
-
this.#concurrency = options.concurrency ?? 4;
|
|
115347
|
-
this.#now = options.now ?? Date.now;
|
|
115348
|
-
}
|
|
115349
|
-
/** Stop retrying (shutdown). Pending entries are NOT marked
|
|
115350
|
-
* permanently failed — the next boot restores them from disk. */
|
|
115351
|
-
cancel() {
|
|
115352
|
-
this.#abort.abort();
|
|
115353
|
-
}
|
|
115354
|
-
/**
|
|
115355
|
-
* Run the bounded retry rounds. Resolves when every entry has either
|
|
115356
|
-
* restored, been marked permanently failed, or the scheduler was
|
|
115357
|
-
* cancelled. Never rejects.
|
|
115358
|
-
*/
|
|
115359
|
-
async run(initialFailures) {
|
|
115360
|
-
let pending = initialFailures.map((failure) => ({
|
|
115361
|
-
saved: failure.saved,
|
|
115362
|
-
lastError: failure.error,
|
|
115363
|
-
attempts: 1
|
|
115364
|
-
}));
|
|
115365
|
-
for (let round = 0; round < this.#delaysMs.length; round += 1) {
|
|
115366
|
-
if (pending.length === 0 || this.#abort.signal.aborted) break;
|
|
115367
|
-
await sleep$1(this.#delaysMs[round] ?? 0, this.#abort.signal);
|
|
115368
|
-
if (this.#abort.signal.aborted) break;
|
|
115369
|
-
pending = await this.#runRound(pending, round);
|
|
115370
|
-
}
|
|
115371
|
-
if (this.#abort.signal.aborted) return [];
|
|
115372
|
-
const terminal = pending.map((entry) => ({
|
|
115373
|
-
deviceId: entry.saved.id,
|
|
115374
|
-
stableId: entry.saved.stableId,
|
|
115375
|
-
type: String(entry.saved.type),
|
|
115376
|
-
attempts: entry.attempts,
|
|
115377
|
-
lastError: entry.lastError,
|
|
115378
|
-
failedAt: this.#now()
|
|
115379
|
-
}));
|
|
115380
|
-
for (const failure of terminal) this.#onPermanentFailure(failure);
|
|
115381
|
-
return terminal;
|
|
115382
|
-
}
|
|
115383
|
-
/** One retry round: parents first (phase 0), then hub-adopted
|
|
115384
|
-
* children (phase 1) — a child's attempt depends on its parent
|
|
115385
|
-
* having landed, exactly like the initial two-pass restore. */
|
|
115386
|
-
async #runRound(pending, round) {
|
|
115387
|
-
const next = [];
|
|
115388
|
-
const parents = pending.filter((entry) => entry.saved.parentDeviceId === null);
|
|
115389
|
-
const children = pending.filter((entry) => entry.saved.parentDeviceId !== null);
|
|
115390
|
-
for (const phase of [parents, children]) await runWithConcurrency(phase, this.#concurrency, async (entry) => {
|
|
115391
|
-
if (this.#abort.signal.aborted) {
|
|
115392
|
-
next.push(entry);
|
|
115393
|
-
return;
|
|
115394
|
-
}
|
|
115395
|
-
const attemptNo = entry.attempts + 1;
|
|
115396
|
-
try {
|
|
115397
|
-
await this.#attempt(entry.saved);
|
|
115398
|
-
this.#logger.info("Device restored on retry", {
|
|
115399
|
-
tags: {
|
|
115400
|
-
deviceId: entry.saved.id,
|
|
115401
|
-
stableId: entry.saved.stableId
|
|
115402
|
-
},
|
|
115403
|
-
meta: { attempt: attemptNo }
|
|
115404
|
-
});
|
|
115405
|
-
} catch (err) {
|
|
115406
|
-
const lastError = err instanceof Error ? err.message : String(err);
|
|
115407
|
-
const remainingRetries = this.#delaysMs.length - (round + 1);
|
|
115408
|
-
this.#logger.warn("Device restore retry failed", {
|
|
115409
|
-
tags: {
|
|
115410
|
-
deviceId: entry.saved.id,
|
|
115411
|
-
stableId: entry.saved.stableId
|
|
115412
|
-
},
|
|
115413
|
-
meta: {
|
|
115414
|
-
attempt: attemptNo,
|
|
115415
|
-
remainingRetries,
|
|
115416
|
-
error: lastError
|
|
115417
|
-
}
|
|
115418
|
-
});
|
|
115419
|
-
next.push({
|
|
115420
|
-
saved: entry.saved,
|
|
115421
|
-
lastError,
|
|
115422
|
-
attempts: attemptNo
|
|
115423
|
-
});
|
|
115424
|
-
}
|
|
115425
|
-
});
|
|
115426
|
-
return next;
|
|
115427
|
-
}
|
|
115428
|
-
};
|
|
115429
|
-
//#endregion
|
|
115430
115307
|
//#region src/device/base-device-provider.ts
|
|
115431
115308
|
/**
|
|
115432
115309
|
* Convert an IDevice to the flat DeviceSummary shape expected by the
|
|
@@ -115624,7 +115501,7 @@ var BaseDeviceProvider = class extends require_runtime_capabilities.BaseAddon {
|
|
|
115624
115501
|
this.ctx.logger.info(`Restored ${restoredCount} ${this.providerName} device(s)`);
|
|
115625
115502
|
}
|
|
115626
115503
|
/** Retry schedule. Overridable (tests use millisecond delays). */
|
|
115627
|
-
restoreRetryDelaysMs = DEVICE_RESTORE_RETRY_DELAYS_MS;
|
|
115504
|
+
restoreRetryDelaysMs = require_runtime_capabilities.DEVICE_RESTORE_RETRY_DELAYS_MS;
|
|
115628
115505
|
/** Retry lane width. See `device-restore-retry.ts` for why retries
|
|
115629
115506
|
* never re-stampede full-width while the initial pass does (D167). */
|
|
115630
115507
|
restoreRetryConcurrency = 4;
|
|
@@ -115728,7 +115605,7 @@ var BaseDeviceProvider = class extends require_runtime_capabilities.BaseAddon {
|
|
|
115728
115605
|
} });
|
|
115729
115606
|
return;
|
|
115730
115607
|
}
|
|
115731
|
-
const scheduler = new DeviceRestoreRetryScheduler({
|
|
115608
|
+
const scheduler = new require_runtime_capabilities.DeviceRestoreRetryScheduler({
|
|
115732
115609
|
logger: this.ctx.logger,
|
|
115733
115610
|
delaysMs: this.restoreRetryDelaysMs,
|
|
115734
115611
|
concurrency: this.restoreRetryConcurrency,
|
|
@@ -124853,6 +124730,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
124853
124730
|
access: "create",
|
|
124854
124731
|
role: "admin"
|
|
124855
124732
|
},
|
|
124733
|
+
"integrations.adoptInstanceRows": {
|
|
124734
|
+
capName: "integrations",
|
|
124735
|
+
capScope: "system",
|
|
124736
|
+
addonId: null,
|
|
124737
|
+
access: "create",
|
|
124738
|
+
role: "admin"
|
|
124739
|
+
},
|
|
124856
124740
|
"integrations.delete": {
|
|
124857
124741
|
capName: "integrations",
|
|
124858
124742
|
capScope: "system",
|
|
@@ -124888,6 +124772,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
|
|
|
124888
124772
|
access: "view",
|
|
124889
124773
|
role: "admin"
|
|
124890
124774
|
},
|
|
124775
|
+
"integrations.listByAddon": {
|
|
124776
|
+
capName: "integrations",
|
|
124777
|
+
capScope: "system",
|
|
124778
|
+
addonId: null,
|
|
124779
|
+
access: "view",
|
|
124780
|
+
role: "admin"
|
|
124781
|
+
},
|
|
124891
124782
|
"integrations.update": {
|
|
124892
124783
|
capName: "integrations",
|
|
124893
124784
|
capScope: "system",
|
|
@@ -139042,6 +138933,8 @@ function createSystemProxy(api) {
|
|
|
139042
138933
|
list: (input) => dispatch("integrations", "list", "query", input),
|
|
139043
138934
|
get: (input) => dispatch("integrations", "get", "query", input),
|
|
139044
138935
|
getByAddonId: (input) => dispatch("integrations", "getByAddonId", "query", input),
|
|
138936
|
+
listByAddon: (input) => dispatch("integrations", "listByAddon", "query", input),
|
|
138937
|
+
adoptInstanceRows: (input) => dispatch("integrations", "adoptInstanceRows", "mutation", input),
|
|
139045
138938
|
update: (input) => dispatch("integrations", "update", "mutation", input),
|
|
139046
138939
|
delete: (input) => dispatch("integrations", "delete", "mutation", input),
|
|
139047
138940
|
getAvailableTypes: (input) => dispatch("integrations", "getAvailableTypes", "query", input)
|
|
@@ -152094,8 +151987,8 @@ exports.DEVICE_NONCE_TTL_MS = DEVICE_NONCE_TTL_MS;
|
|
|
152094
151987
|
exports.DEVICE_PROFILES = DEVICE_PROFILES;
|
|
152095
151988
|
exports.DEVICE_RAMP = DEVICE_RAMP;
|
|
152096
151989
|
exports.DEVICE_REFRESH_REFUSAL_PREFIX = DEVICE_REFRESH_REFUSAL_PREFIX;
|
|
152097
|
-
exports.DEVICE_RESTORE_RETRY_CONCURRENCY = DEVICE_RESTORE_RETRY_CONCURRENCY;
|
|
152098
|
-
exports.DEVICE_RESTORE_RETRY_DELAYS_MS = DEVICE_RESTORE_RETRY_DELAYS_MS;
|
|
151990
|
+
exports.DEVICE_RESTORE_RETRY_CONCURRENCY = require_runtime_capabilities.DEVICE_RESTORE_RETRY_CONCURRENCY;
|
|
151991
|
+
exports.DEVICE_RESTORE_RETRY_DELAYS_MS = require_runtime_capabilities.DEVICE_RESTORE_RETRY_DELAYS_MS;
|
|
152099
151992
|
exports.DEVICE_ROLE_ICON = DEVICE_ROLE_ICON;
|
|
152100
151993
|
exports.DEVICE_RUNS_MAX_PAGE = DEVICE_RUNS_MAX_PAGE;
|
|
152101
151994
|
exports.DEVICE_SAN_CREDENTIAL_PREFIX = DEVICE_SAN_CREDENTIAL_PREFIX;
|
|
@@ -152212,7 +152105,7 @@ exports.DeviceRefusalReasonSchema = DeviceRefusalReasonSchema;
|
|
|
152212
152105
|
exports.DeviceRefusalSchema = DeviceRefusalSchema;
|
|
152213
152106
|
exports.DeviceRemovedInputSchema = DeviceRemovedInputSchema;
|
|
152214
152107
|
exports.DeviceRemovedResultSchema = DeviceRemovedResultSchema;
|
|
152215
|
-
exports.DeviceRestoreRetryScheduler = DeviceRestoreRetryScheduler;
|
|
152108
|
+
exports.DeviceRestoreRetryScheduler = require_runtime_capabilities.DeviceRestoreRetryScheduler;
|
|
152216
152109
|
exports.DeviceRole = require_composed_stable_id.DeviceRole;
|
|
152217
152110
|
exports.DeviceRunDetailSchema = DeviceRunDetailSchema;
|
|
152218
152111
|
exports.DeviceRunEnergyMethodSchema = DeviceRunEnergyMethodSchema;
|
|
@@ -152290,6 +152183,8 @@ exports.ERROR_STATUS_COLD = ERROR_STATUS_COLD;
|
|
|
152290
152183
|
exports.ESTIMATE_COMPUTE_RATIO_MAX = ESTIMATE_COMPUTE_RATIO_MAX;
|
|
152291
152184
|
exports.ESTIMATE_COMPUTE_RATIO_MIN = ESTIMATE_COMPUTE_RATIO_MIN;
|
|
152292
152185
|
exports.EVENTFUL_CAP_NAMES = EVENTFUL_CAP_NAMES;
|
|
152186
|
+
exports.EVENT_CATEGORY_CATALOG = require_enums.EVENT_CATEGORY_CATALOG;
|
|
152187
|
+
exports.EVENT_CATEGORY_GROUPS = require_enums.EVENT_CATEGORY_GROUPS;
|
|
152293
152188
|
exports.EVENT_DENSITY_BATCH_MAX = EVENT_DENSITY_BATCH_MAX;
|
|
152294
152189
|
exports.EVENT_KIND_BY_CAP = EVENT_KIND_BY_CAP;
|
|
152295
152190
|
exports.EVENT_KIND_LABELS = EVENT_KIND_LABELS;
|
|
@@ -152632,6 +152527,7 @@ exports.InstallDesktopUpdateReasonSchema = InstallDesktopUpdateReasonSchema;
|
|
|
152632
152527
|
exports.InstallDesktopUpdateResultSchema = InstallDesktopUpdateResultSchema;
|
|
152633
152528
|
exports.InstalledPackageSchema = InstalledPackageSchema;
|
|
152634
152529
|
exports.InstanceInUseError = InstanceInUseError;
|
|
152530
|
+
exports.InstanceSwitchesUnreadError = require_runtime_capabilities.InstanceSwitchesUnreadError;
|
|
152635
152531
|
exports.IntegralHelperSpecSchema = require_implemented_methods.IntegralHelperSpecSchema;
|
|
152636
152532
|
exports.IntegrationInstanceAddDeviceSchema = IntegrationInstanceAddDeviceSchema;
|
|
152637
152533
|
exports.IntegrationInstanceDescriptionSchema = IntegrationInstanceDescriptionSchema;
|
|
@@ -153736,6 +153632,7 @@ exports.SERIAL_CAPACITY_CAMERA_FPS = SERIAL_CAPACITY_CAMERA_FPS;
|
|
|
153736
153632
|
exports.SERIES_KINDS = require_implemented_methods.SERIES_KINDS;
|
|
153737
153633
|
exports.SERVER_NAME_MAX_LENGTH = SERVER_NAME_MAX_LENGTH;
|
|
153738
153634
|
exports.SERVER_NAME_SETTING_KEY = SERVER_NAME_SETTING_KEY;
|
|
153635
|
+
exports.SERVICE_INSTANCE_INFO_KEY = SERVICE_INSTANCE_INFO_KEY;
|
|
153739
153636
|
exports.SESSION_LOST_ALERT_CATEGORY = SESSION_LOST_ALERT_CATEGORY;
|
|
153740
153637
|
exports.SESSION_PLACEMENT_SETTING_KEY = SESSION_PLACEMENT_SETTING_KEY;
|
|
153741
153638
|
exports.SET_VARS_MAX = SET_VARS_MAX;
|
|
@@ -154338,10 +154235,15 @@ exports.bareAddonId = bareAddonId;
|
|
|
154338
154235
|
exports.baseUnitForQuantity = baseUnitForQuantity;
|
|
154339
154236
|
exports.baseUnitOf = require_runtime_capabilities.baseUnitOf;
|
|
154340
154237
|
exports.batteryCapability = batteryCapability;
|
|
154238
|
+
exports.beginHydration = require_runtime_capabilities.beginHydration;
|
|
154341
154239
|
exports.bestLocationMatch = bestLocationMatch;
|
|
154342
154240
|
exports.binaryCapability = binaryCapability;
|
|
154343
154241
|
exports.bindAddonActions = bindAddonActions;
|
|
154344
154242
|
exports.boardKeySourceCapability = boardKeySourceCapability;
|
|
154243
|
+
exports.bodySwitchPortsOver = require_runtime_capabilities.bodySwitchPortsOver;
|
|
154244
|
+
exports.bodySwitchRecordsOverMigrationApi = require_runtime_capabilities.bodySwitchRecordsOverMigrationApi;
|
|
154245
|
+
exports.bodySwitchToRegistryId = require_runtime_capabilities.bodySwitchToRegistryId;
|
|
154246
|
+
exports.bodySwitchToRegistryMigration = require_runtime_capabilities.bodySwitchToRegistryMigration;
|
|
154345
154247
|
exports.brightnessCapability = brightnessCapability;
|
|
154346
154248
|
exports.brokerCapability = brokerCapability;
|
|
154347
154249
|
exports.brokerLinkPortsOver = brokerLinkPortsOver;
|
|
@@ -154412,6 +154314,7 @@ exports.capacityForModel = capacityForModel;
|
|
|
154412
154314
|
exports.capacitySessionsOf = capacitySessionsOf;
|
|
154413
154315
|
exports.carbonMonoxideCapability = carbonMonoxideCapability;
|
|
154414
154316
|
exports.carriesDeviceTemplate = carriesDeviceTemplate;
|
|
154317
|
+
exports.catalogedEventCategories = require_enums.catalogedEventCategories;
|
|
154415
154318
|
exports.catalogueIssues = catalogueIssues;
|
|
154416
154319
|
exports.cellsToRects = cellsToRects;
|
|
154417
154320
|
exports.checkDeviceAlias = checkDeviceAlias;
|
|
@@ -154421,6 +154324,7 @@ exports.checkTemplatePayload = checkTemplatePayload;
|
|
|
154421
154324
|
exports.claimDevicesMigration = claimDevicesMigration;
|
|
154422
154325
|
exports.claimDevicesPortsOver = claimDevicesPortsOver;
|
|
154423
154326
|
exports.claimDevicesToDefaultIntegration = claimDevicesToDefaultIntegration;
|
|
154327
|
+
exports.claimInstance = require_runtime_capabilities.claimInstance;
|
|
154424
154328
|
exports.claimedRequestOrigins = claimedRequestOrigins;
|
|
154425
154329
|
exports.classifyBearerPrincipal = classifyBearerPrincipal;
|
|
154426
154330
|
exports.classifyCamerasForBenchmark = classifyCamerasForBenchmark;
|
|
@@ -154431,6 +154335,7 @@ exports.classifySecretWrite = require_runtime_capabilities.classifySecretWrite;
|
|
|
154431
154335
|
exports.classifyStoreError = require_runtime_capabilities.classifyStoreError;
|
|
154432
154336
|
exports.classifyStream = classifyStream;
|
|
154433
154337
|
exports.classifyStreams = classifyStreams;
|
|
154338
|
+
exports.clearInstanceSwitches = require_runtime_capabilities.clearInstanceSwitches;
|
|
154434
154339
|
exports.clearKnownSecrets = require_runtime_capabilities.clearKnownSecrets;
|
|
154435
154340
|
exports.clearModelBoundOverrides = clearModelBoundOverrides;
|
|
154436
154341
|
exports.clearModelBoundSetting = clearModelBoundSetting;
|
|
@@ -154795,6 +154700,7 @@ exports.followSwitchRunningFeature = followSwitchRunningFeature;
|
|
|
154795
154700
|
exports.forEachLeaf = forEachLeaf;
|
|
154796
154701
|
exports.forbiddenError = require_runtime_capabilities.forbiddenError;
|
|
154797
154702
|
exports.foreignCapacityCells = foreignCapacityCells;
|
|
154703
|
+
exports.forgetInstanceSwitch = require_runtime_capabilities.forgetInstanceSwitch;
|
|
154798
154704
|
exports.forgetKnownSecret = require_runtime_capabilities.forgetKnownSecret;
|
|
154799
154705
|
exports.formatDeviceRevoker = formatDeviceRevoker;
|
|
154800
154706
|
exports.formatForRuntime = require_runtime_capabilities.formatForRuntime;
|
|
@@ -154867,6 +154773,7 @@ exports.hubMotionNativeProvider = hubMotionNativeProvider;
|
|
|
154867
154773
|
exports.humidifierCapability = humidifierCapability;
|
|
154868
154774
|
exports.humidityMeasurement = humidityMeasurement;
|
|
154869
154775
|
exports.humiditySensorCapability = humiditySensorCapability;
|
|
154776
|
+
exports.hydrateInstanceSwitches = require_runtime_capabilities.hydrateInstanceSwitches;
|
|
154870
154777
|
exports.hydrateSchema = require_runtime_capabilities.hydrateSchema;
|
|
154871
154778
|
exports.iconCategoryLabel = iconCategoryLabel;
|
|
154872
154779
|
exports.iconEntry = iconEntry;
|
|
@@ -154958,8 +154865,10 @@ exports.isForwardInputRef = require_implemented_methods.isForwardInputRef;
|
|
|
154958
154865
|
exports.isHeldBackTemplateVar = isHeldBackTemplateVar;
|
|
154959
154866
|
exports.isHistoryHelper = require_implemented_methods.isHistoryHelper;
|
|
154960
154867
|
exports.isHubId = isHubId;
|
|
154868
|
+
exports.isHydrationPending = require_runtime_capabilities.isHydrationPending;
|
|
154961
154869
|
exports.isIconKey = isIconKey;
|
|
154962
|
-
exports.
|
|
154870
|
+
exports.isInstanceOn = require_runtime_capabilities.isInstanceOn;
|
|
154871
|
+
exports.isInstanceSwitchesUnreadError = require_runtime_capabilities.isInstanceSwitchesUnreadError;
|
|
154963
154872
|
exports.isInternalActionId = isInternalActionId;
|
|
154964
154873
|
exports.isIsolatedBuiltin = isIsolatedBuiltin;
|
|
154965
154874
|
exports.isKernelDerivedFeature = isKernelDerivedFeature;
|
|
@@ -155131,6 +155040,7 @@ exports.motionDetectionCapability = motionDetectionCapability;
|
|
|
155131
155040
|
exports.motionSourceLabel = motionSourceLabel;
|
|
155132
155041
|
exports.motionTriggerCapability = motionTriggerCapability;
|
|
155133
155042
|
exports.motionZonesCapability = motionZonesCapability;
|
|
155043
|
+
exports.moveBodySwitchToRegistry = require_runtime_capabilities.moveBodySwitchToRegistry;
|
|
155134
155044
|
exports.moveBrokerLinksToConnections = moveBrokerLinksToConnections;
|
|
155135
155045
|
exports.moveCalendarIdsToRecords = moveCalendarIdsToRecords;
|
|
155136
155046
|
exports.moveGroup = moveGroup;
|
|
@@ -155159,6 +155069,7 @@ exports.nodePickerItems = nodePickerItems;
|
|
|
155159
155069
|
exports.nodePin = require_runtime_capabilities.nodePin;
|
|
155160
155070
|
exports.nodeRemovalHookCapability = nodeRemovalHookCapability;
|
|
155161
155071
|
exports.nodesCapability = nodesCapability;
|
|
155072
|
+
exports.noiseEventCategories = require_enums.noiseEventCategories$1;
|
|
155162
155073
|
exports.normaliseIdentifiers = normaliseIdentifiers;
|
|
155163
155074
|
exports.normaliseMac = normaliseMac;
|
|
155164
155075
|
exports.normalizeActionUnits = normalizeActionUnits;
|
|
@@ -155194,6 +155105,7 @@ exports.objectInputDeclaresRequiredDeviceId = objectInputDeclaresRequiredDeviceI
|
|
|
155194
155105
|
exports.observeHoldLeaves = observeHoldLeaves;
|
|
155195
155106
|
exports.occupancyScope = occupancyScope;
|
|
155196
155107
|
exports.occurrenceOn = occurrenceOn;
|
|
155108
|
+
exports.offerableEventCategories = require_enums.offerableEventCategories;
|
|
155197
155109
|
exports.offeredActionsWith = offeredActionsWith;
|
|
155198
155110
|
exports.omitTransientConfig = require_runtime_capabilities.omitTransientConfig;
|
|
155199
155111
|
exports.openReset = require_implemented_methods.openReset;
|
|
@@ -155248,6 +155160,7 @@ exports.parseSmtpSinceKey = parseSmtpSinceKey;
|
|
|
155248
155160
|
exports.parseStreamParamsFormPatch = parseStreamParamsFormPatch;
|
|
155249
155161
|
exports.parseTrainingEventLine = parseTrainingEventLine;
|
|
155250
155162
|
exports.patchAudio = patchAudio;
|
|
155163
|
+
exports.pendingHydrationOwners = require_runtime_capabilities.pendingHydrationOwners;
|
|
155251
155164
|
exports.petFeederCapability = petFeederCapability;
|
|
155252
155165
|
exports.petFountainCapability = petFountainCapability;
|
|
155253
155166
|
exports.petFountainFromEntitiesComposition = petFountainFromEntitiesComposition;
|
|
@@ -155362,6 +155275,8 @@ exports.reconcileRemovedDevices = reconcileRemovedDevices;
|
|
|
155362
155275
|
exports.reconcileReportedFeatures = reconcileReportedFeatures;
|
|
155363
155276
|
exports.recordArrayItemPath = require_runtime_capabilities.recordArrayItemPath;
|
|
155364
155277
|
exports.recordEntriesCapability = recordEntriesCapability;
|
|
155278
|
+
exports.recordInstanceSwitch = require_runtime_capabilities.recordInstanceSwitch;
|
|
155279
|
+
exports.recordRegistrySwitch = require_runtime_capabilities.recordRegistrySwitch;
|
|
155365
155280
|
exports.recordSecretCollection = require_runtime_capabilities.recordSecretCollection;
|
|
155366
155281
|
exports.recordSecretRef = require_runtime_capabilities.recordSecretRef;
|
|
155367
155282
|
exports.recordingArchiveCapability = recordingArchiveCapability;
|
|
@@ -155575,6 +155490,7 @@ exports.settingValuesEqual = settingValuesEqual;
|
|
|
155575
155490
|
exports.settingsBelow = settingsBelow;
|
|
155576
155491
|
exports.settingsStoreCapability = settingsStoreCapability;
|
|
155577
155492
|
exports.settleDeviceFeatures = settleDeviceFeatures;
|
|
155493
|
+
exports.settleHydration = require_runtime_capabilities.settleHydration;
|
|
155578
155494
|
exports.shareViewGrantOf = shareViewGrantOf;
|
|
155579
155495
|
exports.sharedActuatorFeatures = sharedActuatorFeatures;
|
|
155580
155496
|
exports.sharedActuatorMethods = sharedActuatorMethods;
|