@camstack/addon-smtp-nodemailer 1.1.13 → 1.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/smtp.addon.js +1361 -45
- package/dist/smtp.addon.mjs +1361 -45
- package/package.json +1 -1
package/dist/smtp.addon.mjs
CHANGED
|
@@ -4663,7 +4663,7 @@ function _instanceof(cls, params = {}) {
|
|
|
4663
4663
|
return inst;
|
|
4664
4664
|
}
|
|
4665
4665
|
//#endregion
|
|
4666
|
-
//#region ../types/dist/sleep-
|
|
4666
|
+
//#region ../types/dist/sleep-BiDFW0E7.mjs
|
|
4667
4667
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
4668
4668
|
EventCategory["SystemBoot"] = "system.boot";
|
|
4669
4669
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -5476,6 +5476,100 @@ function createDurableState(deps) {
|
|
|
5476
5476
|
};
|
|
5477
5477
|
}
|
|
5478
5478
|
/**
|
|
5479
|
+
* Per-node scoping for the shared addon-settings blob.
|
|
5480
|
+
*
|
|
5481
|
+
* An addon's settings store is hub-central (the `addon-settings` cap is
|
|
5482
|
+
* hub-routed — the hub instance answers for every node), so fields whose
|
|
5483
|
+
* value is a NODE fact (decoder backend, engine pick, probed hardware
|
|
5484
|
+
* capabilities) persist under the node-scoped key `<key>@<nodeId>` inside
|
|
5485
|
+
* the single shared blob. The SCHEMA field key stays bare: the write path
|
|
5486
|
+
* ({@link scopePatch}) maps the bare field onto the target node's scoped
|
|
5487
|
+
* key; the read/hydrate path ({@link projectStore}) maps THIS node's value
|
|
5488
|
+
* back, so UI forms and `resolveConfig` only ever see the bare key.
|
|
5489
|
+
*
|
|
5490
|
+
* Fields opt in via the `perNode: true` schema marker on `ConfigFieldBase`
|
|
5491
|
+
* (`interfaces/config-ui.ts`); `BaseAddon` derives the key set from the
|
|
5492
|
+
* schema and routes reads/writes through these helpers.
|
|
5493
|
+
*
|
|
5494
|
+
* ## No bare-key fallback — deliberate
|
|
5495
|
+
*
|
|
5496
|
+
* {@link readNodeValue} reads the node-scoped key ONLY. A node with no
|
|
5497
|
+
* scoped key resolves to `undefined` so the field's schema `default` wins —
|
|
5498
|
+
* NEVER `store[base]` and never another node's value. A bare legacy key in
|
|
5499
|
+
* the store is invisible to every node, hub included, so one node's
|
|
5500
|
+
* selection can never leak onto another. (This generalizes the
|
|
5501
|
+
* `decoder-backend-keys.ts` semantics — the no-fallback variant — over an
|
|
5502
|
+
* arbitrary set of per-node field keys.)
|
|
5503
|
+
*
|
|
5504
|
+
* Pure functions only — no I/O, no imports beyond the language. This is a
|
|
5505
|
+
* LEAF module: import it via its deep path, never from the root barrel.
|
|
5506
|
+
*/
|
|
5507
|
+
/**
|
|
5508
|
+
* Normalize a raw kernel node id to the bare node id used for scoping.
|
|
5509
|
+
* `localNodeId` can carry a `<node>/<addon>` suffix on forked child
|
|
5510
|
+
* processes; per-node settings are per-NODE, so strip the addon segment.
|
|
5511
|
+
* `undefined` / `null` / empty falls back to `'hub'`.
|
|
5512
|
+
*/
|
|
5513
|
+
function normalizeNodeId(raw) {
|
|
5514
|
+
if (raw === void 0 || raw === null || raw === "") return "hub";
|
|
5515
|
+
const slashIdx = raw.indexOf("/");
|
|
5516
|
+
if (slashIdx < 0) return raw;
|
|
5517
|
+
const bare = raw.slice(0, slashIdx);
|
|
5518
|
+
return bare === "" ? "hub" : bare;
|
|
5519
|
+
}
|
|
5520
|
+
/** The node-scoped store key for a per-node field: `<base>@<nodeId>`. */
|
|
5521
|
+
function nodeScopedKey(base, nodeId) {
|
|
5522
|
+
return `${base}@${normalizeNodeId(nodeId)}`;
|
|
5523
|
+
}
|
|
5524
|
+
/**
|
|
5525
|
+
* Read a node's value for a per-node field from the raw shared store:
|
|
5526
|
+
* the node-scoped key when present, otherwise `undefined`.
|
|
5527
|
+
* Deliberately NO bare-key fallback (see module doc) — the caller lets the
|
|
5528
|
+
* schema `default` win on `undefined`.
|
|
5529
|
+
*/
|
|
5530
|
+
function readNodeValue(store, base, nodeId) {
|
|
5531
|
+
return store[nodeScopedKey(base, nodeId)];
|
|
5532
|
+
}
|
|
5533
|
+
/**
|
|
5534
|
+
* Re-map a UI/settings patch so every bare perNode field persists under the
|
|
5535
|
+
* TARGET node's scoped key; all other keys pass through unchanged. Used on
|
|
5536
|
+
* the write path so a save for one node never clobbers another node's value
|
|
5537
|
+
* (and the bare key is never written). Returns a new object — the input
|
|
5538
|
+
* patch is not mutated.
|
|
5539
|
+
*/
|
|
5540
|
+
function scopePatch(patch, perNodeKeys, nodeId) {
|
|
5541
|
+
const out = {};
|
|
5542
|
+
for (const [key, value] of Object.entries(patch)) out[perNodeKeys.has(key) ? nodeScopedKey(key, nodeId) : key] = value;
|
|
5543
|
+
return out;
|
|
5544
|
+
}
|
|
5545
|
+
/**
|
|
5546
|
+
* Project the raw shared store onto the bare schema keys for ONE node so a
|
|
5547
|
+
* UI schema (whose field keys are bare) hydrates from that node's own
|
|
5548
|
+
* values:
|
|
5549
|
+
*
|
|
5550
|
+
* - EVERY `@`-scoped key (any node's) is dropped from the pass-through.
|
|
5551
|
+
* - Every bare perNode key is dropped from the pass-through (a stray bare
|
|
5552
|
+
* legacy key must never hydrate any node — no bare fallback).
|
|
5553
|
+
* - THIS node's effective value ({@link readNodeValue}) is then laid onto
|
|
5554
|
+
* each bare perNode key; when the node has no scoped key the bare key is
|
|
5555
|
+
* left ABSENT so the field's schema `default` wins.
|
|
5556
|
+
*
|
|
5557
|
+
* Returns a new object — the input store is not mutated.
|
|
5558
|
+
*/
|
|
5559
|
+
function projectStore(store, perNodeKeys, nodeId) {
|
|
5560
|
+
const out = {};
|
|
5561
|
+
for (const [key, value] of Object.entries(store)) {
|
|
5562
|
+
if (key.includes("@")) continue;
|
|
5563
|
+
if (perNodeKeys.has(key)) continue;
|
|
5564
|
+
out[key] = value;
|
|
5565
|
+
}
|
|
5566
|
+
for (const base of perNodeKeys) {
|
|
5567
|
+
const value = readNodeValue(store, base, nodeId);
|
|
5568
|
+
if (value !== void 0) out[base] = value;
|
|
5569
|
+
}
|
|
5570
|
+
return out;
|
|
5571
|
+
}
|
|
5572
|
+
/**
|
|
5479
5573
|
* Base class for CamStack addons. Eliminates settings boilerplate:
|
|
5480
5574
|
*
|
|
5481
5575
|
* - Typed `config` property with automatic resolution from store + defaults
|
|
@@ -5643,23 +5737,63 @@ var BaseAddon = class {
|
|
|
5643
5737
|
deviceSettingsSchema() {
|
|
5644
5738
|
return null;
|
|
5645
5739
|
}
|
|
5646
|
-
async getGlobalSettings(overlay, cap,
|
|
5740
|
+
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5647
5741
|
const schema = this.globalSettingsSchema(cap);
|
|
5648
5742
|
if (!schema) return { sections: [] };
|
|
5649
|
-
const
|
|
5743
|
+
const projected = await this.resolveGlobalStore(nodeId, cap);
|
|
5650
5744
|
return hydrateSchema(schema, overlay ? {
|
|
5651
|
-
...
|
|
5745
|
+
...projected,
|
|
5652
5746
|
...overlay
|
|
5653
|
-
} :
|
|
5747
|
+
} : projected);
|
|
5654
5748
|
}
|
|
5655
|
-
|
|
5656
|
-
|
|
5749
|
+
/**
|
|
5750
|
+
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5751
|
+
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5752
|
+
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
5753
|
+
* bare fallback), all `@`-scoped and stray bare per-node keys are dropped.
|
|
5754
|
+
* A no-op passthrough when the schema declares no `perNode` field.
|
|
5755
|
+
*
|
|
5756
|
+
* This is the sanctioned way for a `getGlobalSettings` OVERRIDE that needs
|
|
5757
|
+
* the store for custom option logic (option narrowing, value snapping) to
|
|
5758
|
+
* read it per-node — never `ctx.settings.readAddonStore()` directly.
|
|
5759
|
+
* `nodeId` omitted ⇒ the local node (node-blind injection from ctx).
|
|
5760
|
+
*/
|
|
5761
|
+
async resolveGlobalStore(nodeId, cap) {
|
|
5762
|
+
const raw = await this._ctx?.settings?.readAddonStore() ?? {};
|
|
5763
|
+
const keys = this.perNodeKeys(cap);
|
|
5764
|
+
const node = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
5765
|
+
return keys.size > 0 ? projectStore(raw, keys, node) : raw;
|
|
5766
|
+
}
|
|
5767
|
+
async updateGlobalSettings(patch, nodeId) {
|
|
5768
|
+
const keys = this.perNodeKeys();
|
|
5769
|
+
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
5770
|
+
const target = normalizeNodeId(nodeId ?? this._ctx?.kernel?.localNodeId);
|
|
5771
|
+
const barePatch = patch;
|
|
5772
|
+
const scoped = keys.size > 0 ? scopePatch(barePatch, keys, target) : barePatch;
|
|
5773
|
+
await this._ctx?.settings?.writeAddonStore(scoped);
|
|
5774
|
+
if (target !== localNode) return;
|
|
5657
5775
|
await this.resolveConfig();
|
|
5658
5776
|
await this.onConfigChanged();
|
|
5659
5777
|
this.emitLifecycle(EventCategory.AddonUpdated, { level: "global" });
|
|
5660
5778
|
this.maybeAutoRestart(patch, this.globalSettingsSchema());
|
|
5661
5779
|
}
|
|
5662
5780
|
/**
|
|
5781
|
+
* The set of field keys the global settings schema declares `perNode: true`
|
|
5782
|
+
* — derived once per `cap` argument and memoized (schemas are static
|
|
5783
|
+
* declarations). Empty set ⇒ every per-node code path is bypassed and the
|
|
5784
|
+
* settings API behaves exactly like the legacy node-agnostic one.
|
|
5785
|
+
*/
|
|
5786
|
+
_perNodeKeysCache = /* @__PURE__ */ new Map();
|
|
5787
|
+
perNodeKeys(cap) {
|
|
5788
|
+
const cacheKey = cap ?? "";
|
|
5789
|
+
const cached = this._perNodeKeysCache.get(cacheKey);
|
|
5790
|
+
if (cached) return cached;
|
|
5791
|
+
const schema = this.globalSettingsSchema(cap);
|
|
5792
|
+
const keys = new Set(schema ? schema.sections.flatMap((section) => collectPerNodeFieldKeys(section.fields)) : []);
|
|
5793
|
+
this._perNodeKeysCache.set(cacheKey, keys);
|
|
5794
|
+
return keys;
|
|
5795
|
+
}
|
|
5796
|
+
/**
|
|
5663
5797
|
* If any field in `patch` is marked `requiresRestart` in `schema`,
|
|
5664
5798
|
* schedule an addon restart for the next tick. Deferred via
|
|
5665
5799
|
* `setImmediate` so the tRPC mutation that triggered the write has
|
|
@@ -5812,12 +5946,19 @@ var BaseAddon = class {
|
|
|
5812
5946
|
* The merge is shallow: each key in `defaults` is checked against the store.
|
|
5813
5947
|
* Only keys present in defaults are read — the store can contain extra keys
|
|
5814
5948
|
* (e.g. from older versions) without polluting the typed config.
|
|
5949
|
+
*
|
|
5950
|
+
* Keys the global settings schema declares `perNode: true` resolve from
|
|
5951
|
+
* THIS node's scoped key (`<key>@<localNode>`) via `readNodeValue` — never
|
|
5952
|
+
* from the bare key — so a per-node field resolves to this node's own
|
|
5953
|
+
* selection at boot (absent scoped key ⇒ the constructor default wins).
|
|
5815
5954
|
*/
|
|
5816
5955
|
async resolveConfig() {
|
|
5817
5956
|
const stored = await this.readAddonStoreWithRetry();
|
|
5957
|
+
const perNode = this.perNodeKeys();
|
|
5958
|
+
const localNode = normalizeNodeId(this._ctx?.kernel?.localNodeId);
|
|
5818
5959
|
const resolved = { ...this.defaults };
|
|
5819
5960
|
for (const key of Object.keys(this.defaults)) {
|
|
5820
|
-
const storedValue = stored[key];
|
|
5961
|
+
const storedValue = perNode.has(key) ? readNodeValue(stored, key, localNode) : stored[key];
|
|
5821
5962
|
if (storedValue !== void 0 && storedValue !== null) {
|
|
5822
5963
|
const defaultType = typeof this.defaults[key];
|
|
5823
5964
|
if (typeof storedValue === defaultType) resolved[key] = storedValue;
|
|
@@ -5901,6 +6042,27 @@ var BaseAddon = class {
|
|
|
5901
6042
|
}
|
|
5902
6043
|
};
|
|
5903
6044
|
/**
|
|
6045
|
+
* Collect the keys of every field marked `perNode: true`, recursing into
|
|
6046
|
+
* layout containers (`group` fields and `sub-tabs` tabs) the same way
|
|
6047
|
+
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6048
|
+
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6049
|
+
*/
|
|
6050
|
+
function collectPerNodeFieldKeys(fields) {
|
|
6051
|
+
const collected = [];
|
|
6052
|
+
for (const field of fields) {
|
|
6053
|
+
if (field.type === "group") {
|
|
6054
|
+
collected.push(...collectPerNodeFieldKeys(field.fields));
|
|
6055
|
+
continue;
|
|
6056
|
+
}
|
|
6057
|
+
if (field.type === "sub-tabs") {
|
|
6058
|
+
for (const tab of field.tabs) collected.push(...collectPerNodeFieldKeys(tab.fields));
|
|
6059
|
+
continue;
|
|
6060
|
+
}
|
|
6061
|
+
if ("perNode" in field && field.perNode === true) collected.push(field.key);
|
|
6062
|
+
}
|
|
6063
|
+
return collected;
|
|
6064
|
+
}
|
|
6065
|
+
/**
|
|
5904
6066
|
* Normalize an `ICamstackAddon.initialize()` return value into the
|
|
5905
6067
|
* `AddonInitResult` envelope. Arrays are wrapped into `{ providers }`;
|
|
5906
6068
|
* envelopes pass through; void stays void.
|
|
@@ -5925,6 +6087,7 @@ var CamStreamKindSchema = _enum([
|
|
|
5925
6087
|
"pull-rtsp",
|
|
5926
6088
|
"pull-rtmp",
|
|
5927
6089
|
"pull-http",
|
|
6090
|
+
"pull-flv",
|
|
5928
6091
|
"pull-rfc4571",
|
|
5929
6092
|
"push-annexb",
|
|
5930
6093
|
"derived"
|
|
@@ -6307,6 +6470,13 @@ var DeviceType = /* @__PURE__ */ function(DeviceType) {
|
|
|
6307
6470
|
/** Single still-image entity (HA `image.*`). Read-only display of an
|
|
6308
6471
|
* `entity_picture` signed URL the browser loads directly. `image` cap. */
|
|
6309
6472
|
DeviceType["Image"] = "image";
|
|
6473
|
+
/** Smart pet feeder — cloud-connected food dispenser with a bowl food
|
|
6474
|
+
* level, battery, desiccant life, feeding state and manual-feed /
|
|
6475
|
+
* call-pet / maintenance actions. Installed with the `pet-feeder` cap;
|
|
6476
|
+
* dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
|
|
6477
|
+
* native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
|
|
6478
|
+
* integrations sharing the same food/desiccant/hopper surface. */
|
|
6479
|
+
DeviceType["PetFeeder"] = "pet-feeder";
|
|
6310
6480
|
return DeviceType;
|
|
6311
6481
|
}({});
|
|
6312
6482
|
var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
|
|
@@ -7455,6 +7625,601 @@ var _macroLookup = /* @__PURE__ */ new Map();
|
|
|
7455
7625
|
for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7456
7626
|
for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
|
|
7457
7627
|
/**
|
|
7628
|
+
* Error types for the safe expression engine. Two distinct classes so callers
|
|
7629
|
+
* can tell a compile-time (grammar) failure from a runtime (evaluation)
|
|
7630
|
+
* failure — both are non-fatal to the host: read paths degrade to "skip link".
|
|
7631
|
+
*/
|
|
7632
|
+
/** Thrown by the tokenizer / parser. Carries a 0-based source `position` when
|
|
7633
|
+
* the failure is anchored to a character (author-facing inline feedback). */
|
|
7634
|
+
var ExpressionParseError = class extends Error {
|
|
7635
|
+
position;
|
|
7636
|
+
constructor(message, position) {
|
|
7637
|
+
super(message);
|
|
7638
|
+
this.name = "ExpressionParseError";
|
|
7639
|
+
this.position = position;
|
|
7640
|
+
}
|
|
7641
|
+
};
|
|
7642
|
+
/** Thrown by the evaluator (unknown identifier, type mismatch, non-finite
|
|
7643
|
+
* result, unknown builtin, step-budget exceeded). */
|
|
7644
|
+
var ExpressionEvalError = class extends Error {
|
|
7645
|
+
constructor(message) {
|
|
7646
|
+
super(message);
|
|
7647
|
+
this.name = "ExpressionEvalError";
|
|
7648
|
+
}
|
|
7649
|
+
};
|
|
7650
|
+
/**
|
|
7651
|
+
* Resource-bound constants for the safe expression engine.
|
|
7652
|
+
*
|
|
7653
|
+
* Every bound is defense-in-depth: the grammar is non-Turing-complete (no
|
|
7654
|
+
* loops, recursion, lambdas or member access — see `ast.ts`), so evaluation is
|
|
7655
|
+
* O(nodeCount) by construction. These caps merely put a hard ceiling on the
|
|
7656
|
+
* work a single author-supplied expression can request, so a hostile or
|
|
7657
|
+
* accidental pathological string can never spend unbounded CPU/memory.
|
|
7658
|
+
*/
|
|
7659
|
+
/** Max source length (chars) — checked BEFORE tokenizing so a huge string is
|
|
7660
|
+
* rejected without allocation. */
|
|
7661
|
+
var MAX_EXPRESSION_SOURCE_LENGTH = 2048;
|
|
7662
|
+
/** A legal binding / identifier name. */
|
|
7663
|
+
var EXPRESSION_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
7664
|
+
/** Binding names an author may NOT use: `now` is auto-injected; the literal
|
|
7665
|
+
* keywords lex as values, not identifiers, so binding to them is meaningless. */
|
|
7666
|
+
var RESERVED_BINDING_NAMES = new Set([
|
|
7667
|
+
"now",
|
|
7668
|
+
"true",
|
|
7669
|
+
"false",
|
|
7670
|
+
"null"
|
|
7671
|
+
]);
|
|
7672
|
+
/**
|
|
7673
|
+
* Tokenizer for the safe expression mini-language. Hand-rolled, single-pass,
|
|
7674
|
+
* zero-dependency. The grammar is deliberately boring: decimal numbers,
|
|
7675
|
+
* single/double-quoted strings with a tiny escape set, identifiers, the three
|
|
7676
|
+
* value keywords (`true`/`false`/`null`) and a fixed punctuator set. Anything
|
|
7677
|
+
* outside that — a bare `.`, `=`, `[`, `]`, `{`, `}`, `;`, backtick, `&`, `|` —
|
|
7678
|
+
* is a parse error with a source position, so member access / assignment /
|
|
7679
|
+
* template literals are lexically impossible.
|
|
7680
|
+
*/
|
|
7681
|
+
var KEYWORDS = new Set([
|
|
7682
|
+
"true",
|
|
7683
|
+
"false",
|
|
7684
|
+
"null"
|
|
7685
|
+
]);
|
|
7686
|
+
function isDigit(ch) {
|
|
7687
|
+
return ch >= "0" && ch <= "9";
|
|
7688
|
+
}
|
|
7689
|
+
function isIdentStart(ch) {
|
|
7690
|
+
return ch >= "A" && ch <= "Z" || ch >= "a" && ch <= "z" || ch === "_";
|
|
7691
|
+
}
|
|
7692
|
+
function isIdentPart(ch) {
|
|
7693
|
+
return isIdentStart(ch) || isDigit(ch);
|
|
7694
|
+
}
|
|
7695
|
+
function isWhitespace(ch) {
|
|
7696
|
+
return ch === " " || ch === " " || ch === "\n" || ch === "\r" || ch === "\f" || ch === "\v";
|
|
7697
|
+
}
|
|
7698
|
+
/** Tokenize `source` into a flat token list ending with a single `eof` token.
|
|
7699
|
+
* Throws `ExpressionParseError` on any illegal character or unterminated
|
|
7700
|
+
* string. */
|
|
7701
|
+
function tokenize(source) {
|
|
7702
|
+
if (source.length > 2048) throw new ExpressionParseError(`expression too long (${source.length} > ${MAX_EXPRESSION_SOURCE_LENGTH} chars)`, 0);
|
|
7703
|
+
const tokens = [];
|
|
7704
|
+
let i = 0;
|
|
7705
|
+
const n = source.length;
|
|
7706
|
+
while (i < n) {
|
|
7707
|
+
const ch = source[i];
|
|
7708
|
+
if (isWhitespace(ch)) {
|
|
7709
|
+
i += 1;
|
|
7710
|
+
continue;
|
|
7711
|
+
}
|
|
7712
|
+
if (isDigit(ch)) {
|
|
7713
|
+
const start = i;
|
|
7714
|
+
while (i < n && isDigit(source[i])) i += 1;
|
|
7715
|
+
if (i < n && source[i] === ".") {
|
|
7716
|
+
if (i + 1 >= n || !isDigit(source[i + 1])) throw new ExpressionParseError("malformed number: decimal point needs a digit", i);
|
|
7717
|
+
i += 1;
|
|
7718
|
+
while (i < n && isDigit(source[i])) i += 1;
|
|
7719
|
+
}
|
|
7720
|
+
const text = source.slice(start, i);
|
|
7721
|
+
const value = Number(text);
|
|
7722
|
+
if (!Number.isFinite(value)) throw new ExpressionParseError(`malformed number: '${text}'`, start);
|
|
7723
|
+
tokens.push({
|
|
7724
|
+
type: "number",
|
|
7725
|
+
value,
|
|
7726
|
+
pos: start
|
|
7727
|
+
});
|
|
7728
|
+
continue;
|
|
7729
|
+
}
|
|
7730
|
+
if (ch === "'" || ch === "\"") {
|
|
7731
|
+
const quote = ch;
|
|
7732
|
+
const start = i;
|
|
7733
|
+
i += 1;
|
|
7734
|
+
let out = "";
|
|
7735
|
+
let closed = false;
|
|
7736
|
+
while (i < n) {
|
|
7737
|
+
const c = source[i];
|
|
7738
|
+
if (c === "\\") {
|
|
7739
|
+
const next = i + 1 < n ? source[i + 1] : "";
|
|
7740
|
+
if (next === "\\" || next === "'" || next === "\"") {
|
|
7741
|
+
out += next;
|
|
7742
|
+
i += 2;
|
|
7743
|
+
continue;
|
|
7744
|
+
}
|
|
7745
|
+
throw new ExpressionParseError(`invalid string escape: '\\${next}'`, i);
|
|
7746
|
+
}
|
|
7747
|
+
if (c === quote) {
|
|
7748
|
+
closed = true;
|
|
7749
|
+
i += 1;
|
|
7750
|
+
break;
|
|
7751
|
+
}
|
|
7752
|
+
out += c;
|
|
7753
|
+
i += 1;
|
|
7754
|
+
}
|
|
7755
|
+
if (!closed) throw new ExpressionParseError("unterminated string literal", start);
|
|
7756
|
+
tokens.push({
|
|
7757
|
+
type: "string",
|
|
7758
|
+
value: out,
|
|
7759
|
+
pos: start
|
|
7760
|
+
});
|
|
7761
|
+
continue;
|
|
7762
|
+
}
|
|
7763
|
+
if (isIdentStart(ch)) {
|
|
7764
|
+
const start = i;
|
|
7765
|
+
while (i < n && isIdentPart(source[i])) i += 1;
|
|
7766
|
+
const text = source.slice(start, i);
|
|
7767
|
+
if (KEYWORDS.has(text)) tokens.push({
|
|
7768
|
+
type: "keyword",
|
|
7769
|
+
keyword: keywordOf(text),
|
|
7770
|
+
pos: start
|
|
7771
|
+
});
|
|
7772
|
+
else tokens.push({
|
|
7773
|
+
type: "identifier",
|
|
7774
|
+
name: text,
|
|
7775
|
+
pos: start
|
|
7776
|
+
});
|
|
7777
|
+
continue;
|
|
7778
|
+
}
|
|
7779
|
+
const two = i + 1 < n ? source.slice(i, i + 2) : "";
|
|
7780
|
+
if (two === "<=" || two === ">=" || two === "==" || two === "!=" || two === "&&" || two === "||") {
|
|
7781
|
+
tokens.push({
|
|
7782
|
+
type: "punct",
|
|
7783
|
+
punct: two,
|
|
7784
|
+
pos: i
|
|
7785
|
+
});
|
|
7786
|
+
i += 2;
|
|
7787
|
+
continue;
|
|
7788
|
+
}
|
|
7789
|
+
if (isSinglePunct(ch)) {
|
|
7790
|
+
tokens.push({
|
|
7791
|
+
type: "punct",
|
|
7792
|
+
punct: ch,
|
|
7793
|
+
pos: i
|
|
7794
|
+
});
|
|
7795
|
+
i += 1;
|
|
7796
|
+
continue;
|
|
7797
|
+
}
|
|
7798
|
+
throw new ExpressionParseError(`unexpected character '${ch}'`, i);
|
|
7799
|
+
}
|
|
7800
|
+
tokens.push({
|
|
7801
|
+
type: "eof",
|
|
7802
|
+
pos: n
|
|
7803
|
+
});
|
|
7804
|
+
return tokens;
|
|
7805
|
+
}
|
|
7806
|
+
function keywordOf(text) {
|
|
7807
|
+
if (text === "true") return "true";
|
|
7808
|
+
if (text === "false") return "false";
|
|
7809
|
+
return "null";
|
|
7810
|
+
}
|
|
7811
|
+
function isSinglePunct(ch) {
|
|
7812
|
+
return ch === "(" || ch === ")" || ch === "," || ch === "?" || ch === ":" || ch === "+" || ch === "-" || ch === "*" || ch === "/" || ch === "%" || ch === "!" || ch === "<" || ch === ">";
|
|
7813
|
+
}
|
|
7814
|
+
/**
|
|
7815
|
+
* Frozen, null-prototype builtin function table for the expression engine
|
|
7816
|
+
* (spec §4 rule 4). The table is the SOLE surface of callable functions: the
|
|
7817
|
+
* parser rejects any callee not in it, and the evaluator gates each call on an
|
|
7818
|
+
* own-property check against it.
|
|
7819
|
+
*
|
|
7820
|
+
* Because the object has a NULL prototype AND is `Object.freeze`d:
|
|
7821
|
+
* - it cannot be polluted (no `__proto__` / `constructor` write reaches it);
|
|
7822
|
+
* - a lookup for `toString` / `hasOwnProperty` / `constructor` finds NOTHING
|
|
7823
|
+
* (there is no `Object.prototype` in the chain), so those names are not
|
|
7824
|
+
* callable — they are simply "unknown function" at parse time.
|
|
7825
|
+
*
|
|
7826
|
+
* Every numeric argument is validated as a finite number and every numeric
|
|
7827
|
+
* RESULT is re-checked finite, so `/0`, `sqrt(-1)` (→ NaN) and overflow
|
|
7828
|
+
* (`pow(10,400)` → Infinity) all raise `ExpressionEvalError` and fail the link
|
|
7829
|
+
* closed rather than emitting a garbage value.
|
|
7830
|
+
*/
|
|
7831
|
+
function asFiniteNumber(value, name, index) {
|
|
7832
|
+
if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
|
|
7833
|
+
return value;
|
|
7834
|
+
}
|
|
7835
|
+
function asString$1(value, name, index) {
|
|
7836
|
+
if (typeof value !== "string") throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a string`);
|
|
7837
|
+
return value;
|
|
7838
|
+
}
|
|
7839
|
+
function finiteResult(value, name) {
|
|
7840
|
+
if (!Number.isFinite(value)) throw new ExpressionEvalError(`${name}: produced a non-finite result`);
|
|
7841
|
+
return value;
|
|
7842
|
+
}
|
|
7843
|
+
function allFiniteNumbers(args, name) {
|
|
7844
|
+
return args.map((a, idx) => asFiniteNumber(a, name, idx));
|
|
7845
|
+
}
|
|
7846
|
+
var INF = Number.POSITIVE_INFINITY;
|
|
7847
|
+
var table = {
|
|
7848
|
+
min: {
|
|
7849
|
+
minArgs: 1,
|
|
7850
|
+
maxArgs: INF,
|
|
7851
|
+
apply: (args) => finiteResult(Math.min(...allFiniteNumbers(args, "min")), "min")
|
|
7852
|
+
},
|
|
7853
|
+
max: {
|
|
7854
|
+
minArgs: 1,
|
|
7855
|
+
maxArgs: INF,
|
|
7856
|
+
apply: (args) => finiteResult(Math.max(...allFiniteNumbers(args, "max")), "max")
|
|
7857
|
+
},
|
|
7858
|
+
abs: {
|
|
7859
|
+
minArgs: 1,
|
|
7860
|
+
maxArgs: 1,
|
|
7861
|
+
apply: (args) => finiteResult(Math.abs(asFiniteNumber(args[0], "abs", 0)), "abs")
|
|
7862
|
+
},
|
|
7863
|
+
floor: {
|
|
7864
|
+
minArgs: 1,
|
|
7865
|
+
maxArgs: 1,
|
|
7866
|
+
apply: (args) => finiteResult(Math.floor(asFiniteNumber(args[0], "floor", 0)), "floor")
|
|
7867
|
+
},
|
|
7868
|
+
ceil: {
|
|
7869
|
+
minArgs: 1,
|
|
7870
|
+
maxArgs: 1,
|
|
7871
|
+
apply: (args) => finiteResult(Math.ceil(asFiniteNumber(args[0], "ceil", 0)), "ceil")
|
|
7872
|
+
},
|
|
7873
|
+
sqrt: {
|
|
7874
|
+
minArgs: 1,
|
|
7875
|
+
maxArgs: 1,
|
|
7876
|
+
apply: (args) => finiteResult(Math.sqrt(asFiniteNumber(args[0], "sqrt", 0)), "sqrt")
|
|
7877
|
+
},
|
|
7878
|
+
round: {
|
|
7879
|
+
minArgs: 1,
|
|
7880
|
+
maxArgs: 2,
|
|
7881
|
+
apply: (args) => {
|
|
7882
|
+
const x = asFiniteNumber(args[0], "round", 0);
|
|
7883
|
+
const digits = args.length > 1 ? Math.trunc(asFiniteNumber(args[1], "round", 1)) : 0;
|
|
7884
|
+
if (digits < 0 || digits > 100) throw new ExpressionEvalError("round: digits must be between 0 and 100");
|
|
7885
|
+
const factor = 10 ** digits;
|
|
7886
|
+
return finiteResult(Math.round(x * factor) / factor, "round");
|
|
7887
|
+
}
|
|
7888
|
+
},
|
|
7889
|
+
pow: {
|
|
7890
|
+
minArgs: 2,
|
|
7891
|
+
maxArgs: 2,
|
|
7892
|
+
apply: (args) => finiteResult(asFiniteNumber(args[0], "pow", 0) ** asFiniteNumber(args[1], "pow", 1), "pow")
|
|
7893
|
+
},
|
|
7894
|
+
clamp: {
|
|
7895
|
+
minArgs: 3,
|
|
7896
|
+
maxArgs: 3,
|
|
7897
|
+
apply: (args) => {
|
|
7898
|
+
const x = asFiniteNumber(args[0], "clamp", 0);
|
|
7899
|
+
const lo = asFiniteNumber(args[1], "clamp", 1);
|
|
7900
|
+
const hi = asFiniteNumber(args[2], "clamp", 2);
|
|
7901
|
+
if (lo > hi) throw new ExpressionEvalError("clamp: lower bound is greater than upper bound");
|
|
7902
|
+
return finiteResult(Math.min(hi, Math.max(lo, x)), "clamp");
|
|
7903
|
+
}
|
|
7904
|
+
},
|
|
7905
|
+
avg: {
|
|
7906
|
+
minArgs: 1,
|
|
7907
|
+
maxArgs: INF,
|
|
7908
|
+
apply: (args) => {
|
|
7909
|
+
const nums = allFiniteNumbers(args, "avg");
|
|
7910
|
+
return finiteResult(nums.reduce((acc, v) => acc + v, 0) / nums.length, "avg");
|
|
7911
|
+
}
|
|
7912
|
+
},
|
|
7913
|
+
sum: {
|
|
7914
|
+
minArgs: 1,
|
|
7915
|
+
maxArgs: INF,
|
|
7916
|
+
apply: (args) => finiteResult(allFiniteNumbers(args, "sum").reduce((acc, v) => acc + v, 0), "sum")
|
|
7917
|
+
},
|
|
7918
|
+
coalesce: {
|
|
7919
|
+
minArgs: 1,
|
|
7920
|
+
maxArgs: INF,
|
|
7921
|
+
apply: (args) => {
|
|
7922
|
+
for (const a of args) if (a !== null) return a;
|
|
7923
|
+
return null;
|
|
7924
|
+
}
|
|
7925
|
+
},
|
|
7926
|
+
age: {
|
|
7927
|
+
minArgs: 2,
|
|
7928
|
+
maxArgs: 2,
|
|
7929
|
+
apply: (args) => finiteResult(asFiniteNumber(args[0], "age", 0) - asFiniteNumber(args[1], "age", 1), "age")
|
|
7930
|
+
},
|
|
7931
|
+
convert: {
|
|
7932
|
+
minArgs: 3,
|
|
7933
|
+
maxArgs: 3,
|
|
7934
|
+
apply: (args, hooks) => {
|
|
7935
|
+
const x = asFiniteNumber(args[0], "convert", 0);
|
|
7936
|
+
const from = asString$1(args[1], "convert", 1).trim();
|
|
7937
|
+
const to = asString$1(args[2], "convert", 2).trim();
|
|
7938
|
+
if (hooks.convert) {
|
|
7939
|
+
const out = hooks.convert(x, from, to);
|
|
7940
|
+
if (out === null) throw new ExpressionEvalError(`convert: cannot convert '${from}' to '${to}'`);
|
|
7941
|
+
return finiteResult(out, "convert");
|
|
7942
|
+
}
|
|
7943
|
+
if (from === to) return x;
|
|
7944
|
+
throw new ExpressionEvalError("convert: unit conversion table not installed");
|
|
7945
|
+
}
|
|
7946
|
+
}
|
|
7947
|
+
};
|
|
7948
|
+
Object.freeze(Object.assign(Object.create(null), table));
|
|
7949
|
+
/** The set of valid builtin names — used by the parser to reject unknown
|
|
7950
|
+
* callees at parse time (immediate author feedback). */
|
|
7951
|
+
var EXPRESSION_BUILTIN_NAMES = new Set(Object.keys(table));
|
|
7952
|
+
/**
|
|
7953
|
+
* Pratt (precedence-climbing) parser for the safe expression mini-language.
|
|
7954
|
+
*
|
|
7955
|
+
* Precedence (low → high): ternary `?:` (right-assoc) → `||` → `&&` → equality
|
|
7956
|
+
* → relational → additive → multiplicative → unary `! -` → call / primary.
|
|
7957
|
+
* Calls are ONLY `IDENT '(' args? ')'` at primary position — the callee is a
|
|
7958
|
+
* string validated against the builtin table at parse time, so an unknown
|
|
7959
|
+
* function is rejected immediately (author feedback) and a persisted expression
|
|
7960
|
+
* that references a since-removed builtin degrades at read.
|
|
7961
|
+
*
|
|
7962
|
+
* A node counter caps total AST size (`MAX_EXPRESSION_AST_NODES`) and call
|
|
7963
|
+
* arity is capped (`MAX_EXPRESSION_CALL_ARGS`) — both raise `ExpressionParseError`.
|
|
7964
|
+
*/
|
|
7965
|
+
/** Binary/logical operator precedence (higher binds tighter). */
|
|
7966
|
+
var BINARY_PRECEDENCE = {
|
|
7967
|
+
"||": 1,
|
|
7968
|
+
"&&": 2,
|
|
7969
|
+
"==": 3,
|
|
7970
|
+
"!=": 3,
|
|
7971
|
+
"<": 4,
|
|
7972
|
+
"<=": 4,
|
|
7973
|
+
">": 4,
|
|
7974
|
+
">=": 4,
|
|
7975
|
+
"+": 5,
|
|
7976
|
+
"-": 5,
|
|
7977
|
+
"*": 6,
|
|
7978
|
+
"/": 6,
|
|
7979
|
+
"%": 6
|
|
7980
|
+
};
|
|
7981
|
+
function isLogicalOp(op) {
|
|
7982
|
+
return op === "&&" || op === "||";
|
|
7983
|
+
}
|
|
7984
|
+
function isBinaryOp(op) {
|
|
7985
|
+
return op === "+" || op === "-" || op === "*" || op === "/" || op === "%" || op === "==" || op === "!=" || op === "<" || op === "<=" || op === ">" || op === ">=";
|
|
7986
|
+
}
|
|
7987
|
+
var Parser = class {
|
|
7988
|
+
tokens;
|
|
7989
|
+
pos = 0;
|
|
7990
|
+
nodeCount = 0;
|
|
7991
|
+
identifiers = /* @__PURE__ */ new Set();
|
|
7992
|
+
callees = /* @__PURE__ */ new Set();
|
|
7993
|
+
constructor(tokens) {
|
|
7994
|
+
this.tokens = tokens;
|
|
7995
|
+
}
|
|
7996
|
+
parse() {
|
|
7997
|
+
const ast = this.parseTernary();
|
|
7998
|
+
const tok = this.peek();
|
|
7999
|
+
if (tok.type !== "eof") throw new ExpressionParseError("unexpected trailing input", tok.pos);
|
|
8000
|
+
return {
|
|
8001
|
+
ast,
|
|
8002
|
+
identifiers: this.identifiers,
|
|
8003
|
+
callees: this.callees,
|
|
8004
|
+
nodeCount: this.nodeCount
|
|
8005
|
+
};
|
|
8006
|
+
}
|
|
8007
|
+
peek() {
|
|
8008
|
+
return this.tokens[this.pos];
|
|
8009
|
+
}
|
|
8010
|
+
next() {
|
|
8011
|
+
return this.tokens[this.pos++];
|
|
8012
|
+
}
|
|
8013
|
+
/** Consume a punctuator token, erroring if the next token isn't it. */
|
|
8014
|
+
expectPunct(punct) {
|
|
8015
|
+
const tok = this.peek();
|
|
8016
|
+
if (tok.type !== "punct" || tok.punct !== punct) throw new ExpressionParseError(`expected '${punct}'`, tok.pos);
|
|
8017
|
+
this.pos += 1;
|
|
8018
|
+
}
|
|
8019
|
+
matchPunct(punct) {
|
|
8020
|
+
const tok = this.peek();
|
|
8021
|
+
if (tok.type === "punct" && tok.punct === punct) {
|
|
8022
|
+
this.pos += 1;
|
|
8023
|
+
return true;
|
|
8024
|
+
}
|
|
8025
|
+
return false;
|
|
8026
|
+
}
|
|
8027
|
+
countNode() {
|
|
8028
|
+
this.nodeCount += 1;
|
|
8029
|
+
if (this.nodeCount > 256) throw new ExpressionParseError("expression too complex", this.peek().pos);
|
|
8030
|
+
}
|
|
8031
|
+
parseTernary() {
|
|
8032
|
+
const test = this.parseBinary(1);
|
|
8033
|
+
if (this.matchPunct("?")) {
|
|
8034
|
+
const consequent = this.parseTernary();
|
|
8035
|
+
this.expectPunct(":");
|
|
8036
|
+
const alternate = this.parseTernary();
|
|
8037
|
+
this.countNode();
|
|
8038
|
+
return {
|
|
8039
|
+
kind: "conditional",
|
|
8040
|
+
test,
|
|
8041
|
+
consequent,
|
|
8042
|
+
alternate
|
|
8043
|
+
};
|
|
8044
|
+
}
|
|
8045
|
+
return test;
|
|
8046
|
+
}
|
|
8047
|
+
parseBinary(minPrec) {
|
|
8048
|
+
let left = this.parseUnary();
|
|
8049
|
+
for (;;) {
|
|
8050
|
+
const tok = this.peek();
|
|
8051
|
+
if (tok.type !== "punct") break;
|
|
8052
|
+
const prec = BINARY_PRECEDENCE[tok.punct];
|
|
8053
|
+
if (prec === void 0 || prec < minPrec) break;
|
|
8054
|
+
const op = tok.punct;
|
|
8055
|
+
this.pos += 1;
|
|
8056
|
+
const right = this.parseBinary(prec + 1);
|
|
8057
|
+
this.countNode();
|
|
8058
|
+
if (isLogicalOp(op)) left = {
|
|
8059
|
+
kind: "logical",
|
|
8060
|
+
op,
|
|
8061
|
+
left,
|
|
8062
|
+
right
|
|
8063
|
+
};
|
|
8064
|
+
else if (isBinaryOp(op)) left = {
|
|
8065
|
+
kind: "binary",
|
|
8066
|
+
op,
|
|
8067
|
+
left,
|
|
8068
|
+
right
|
|
8069
|
+
};
|
|
8070
|
+
else throw new ExpressionParseError(`unexpected operator '${op}'`, tok.pos);
|
|
8071
|
+
}
|
|
8072
|
+
return left;
|
|
8073
|
+
}
|
|
8074
|
+
parseUnary() {
|
|
8075
|
+
const tok = this.peek();
|
|
8076
|
+
if (tok.type === "punct" && (tok.punct === "!" || tok.punct === "-")) {
|
|
8077
|
+
const op = tok.punct;
|
|
8078
|
+
this.pos += 1;
|
|
8079
|
+
const operand = this.parseUnary();
|
|
8080
|
+
this.countNode();
|
|
8081
|
+
return {
|
|
8082
|
+
kind: "unary",
|
|
8083
|
+
op,
|
|
8084
|
+
operand
|
|
8085
|
+
};
|
|
8086
|
+
}
|
|
8087
|
+
return this.parsePrimary();
|
|
8088
|
+
}
|
|
8089
|
+
parsePrimary() {
|
|
8090
|
+
const tok = this.next();
|
|
8091
|
+
switch (tok.type) {
|
|
8092
|
+
case "number":
|
|
8093
|
+
this.countNode();
|
|
8094
|
+
return {
|
|
8095
|
+
kind: "literal",
|
|
8096
|
+
value: tok.value
|
|
8097
|
+
};
|
|
8098
|
+
case "string":
|
|
8099
|
+
this.countNode();
|
|
8100
|
+
return {
|
|
8101
|
+
kind: "literal",
|
|
8102
|
+
value: tok.value
|
|
8103
|
+
};
|
|
8104
|
+
case "keyword":
|
|
8105
|
+
this.countNode();
|
|
8106
|
+
return {
|
|
8107
|
+
kind: "literal",
|
|
8108
|
+
value: tok.keyword === "null" ? null : tok.keyword === "true"
|
|
8109
|
+
};
|
|
8110
|
+
case "identifier": {
|
|
8111
|
+
const nextTok = this.peek();
|
|
8112
|
+
if (nextTok.type === "punct" && nextTok.punct === "(") return this.parseCall(tok.name, tok.pos);
|
|
8113
|
+
this.identifiers.add(tok.name);
|
|
8114
|
+
this.countNode();
|
|
8115
|
+
return {
|
|
8116
|
+
kind: "identifier",
|
|
8117
|
+
name: tok.name
|
|
8118
|
+
};
|
|
8119
|
+
}
|
|
8120
|
+
case "punct":
|
|
8121
|
+
if (tok.punct === "(") {
|
|
8122
|
+
const inner = this.parseTernary();
|
|
8123
|
+
this.expectPunct(")");
|
|
8124
|
+
return inner;
|
|
8125
|
+
}
|
|
8126
|
+
throw new ExpressionParseError(`unexpected token '${tok.punct}'`, tok.pos);
|
|
8127
|
+
case "eof": throw new ExpressionParseError("unexpected end of expression", tok.pos);
|
|
8128
|
+
}
|
|
8129
|
+
}
|
|
8130
|
+
parseCall(callee, pos) {
|
|
8131
|
+
if (!EXPRESSION_BUILTIN_NAMES.has(callee)) throw new ExpressionParseError(`unknown function '${callee}'`, pos);
|
|
8132
|
+
this.expectPunct("(");
|
|
8133
|
+
const args = [];
|
|
8134
|
+
if (!this.matchPunct(")")) for (;;) {
|
|
8135
|
+
args.push(this.parseTernary());
|
|
8136
|
+
if (args.length > 16) throw new ExpressionParseError(`too many arguments to '${callee}'`, pos);
|
|
8137
|
+
if (this.matchPunct(",")) continue;
|
|
8138
|
+
this.expectPunct(")");
|
|
8139
|
+
break;
|
|
8140
|
+
}
|
|
8141
|
+
this.callees.add(callee);
|
|
8142
|
+
this.countNode();
|
|
8143
|
+
return {
|
|
8144
|
+
kind: "call",
|
|
8145
|
+
callee,
|
|
8146
|
+
args
|
|
8147
|
+
};
|
|
8148
|
+
}
|
|
8149
|
+
};
|
|
8150
|
+
/** Tokenize + parse `source` into a validated `ParsedExpression`. Throws
|
|
8151
|
+
* `ExpressionParseError` on any lexical or grammatical failure. */
|
|
8152
|
+
function parseExpression(source) {
|
|
8153
|
+
return new Parser(tokenize(source)).parse();
|
|
8154
|
+
}
|
|
8155
|
+
Object.freeze({});
|
|
8156
|
+
/**
|
|
8157
|
+
* LRU compile cache for parsed expressions (spec §2.4 "parse once … LRU keyed
|
|
8158
|
+
* by expr"). The cache stores BOTH successes and failures (negative caching),
|
|
8159
|
+
* so a corrupt persisted string costs exactly one tokenize+parse total — not
|
|
8160
|
+
* one per read on a hot resolve path.
|
|
8161
|
+
*
|
|
8162
|
+
* The cache is a module-level singleton: entries are pure, content-addressed
|
|
8163
|
+
* ASTs keyed by the raw source string, so sharing one instance across all
|
|
8164
|
+
* callers is safe and maximises hit rate.
|
|
8165
|
+
*/
|
|
8166
|
+
var cache = /* @__PURE__ */ new Map();
|
|
8167
|
+
function getCached(source) {
|
|
8168
|
+
const hit = cache.get(source);
|
|
8169
|
+
if (hit !== void 0) {
|
|
8170
|
+
cache.delete(source);
|
|
8171
|
+
cache.set(source, hit);
|
|
8172
|
+
return hit;
|
|
8173
|
+
}
|
|
8174
|
+
let result;
|
|
8175
|
+
try {
|
|
8176
|
+
result = {
|
|
8177
|
+
ok: true,
|
|
8178
|
+
parsed: parseExpression(source)
|
|
8179
|
+
};
|
|
8180
|
+
} catch (err) {
|
|
8181
|
+
result = {
|
|
8182
|
+
ok: false,
|
|
8183
|
+
error: err instanceof ExpressionParseError ? err.message : String(err)
|
|
8184
|
+
};
|
|
8185
|
+
}
|
|
8186
|
+
cache.set(source, result);
|
|
8187
|
+
if (cache.size > 256) {
|
|
8188
|
+
const oldest = cache.keys().next().value;
|
|
8189
|
+
if (oldest !== void 0) cache.delete(oldest);
|
|
8190
|
+
}
|
|
8191
|
+
return result;
|
|
8192
|
+
}
|
|
8193
|
+
/** Compile `source`, returning a discriminated result instead of throwing.
|
|
8194
|
+
* Used by read paths that must degrade rather than raise. LRU/negative-cached. */
|
|
8195
|
+
function compileExpressionSafe(source) {
|
|
8196
|
+
return getCached(source);
|
|
8197
|
+
}
|
|
8198
|
+
/**
|
|
8199
|
+
* Author-time validation. Returns `null` when the source is valid, else a
|
|
8200
|
+
* human-readable error message. Checks: the expression compiles; binding count
|
|
8201
|
+
* is within `MAX_EXPRESSION_BINDINGS`; every binding name is a legal identifier,
|
|
8202
|
+
* is not reserved (`now`/keywords) and does not shadow a builtin; and every
|
|
8203
|
+
* FREE identifier of the AST is covered by a binding or the injected `now`.
|
|
8204
|
+
*/
|
|
8205
|
+
function validateExpressionSource(src) {
|
|
8206
|
+
const names = Object.keys(src.bindings);
|
|
8207
|
+
if (names.length > 32) return `too many bindings (${names.length} > 32)`;
|
|
8208
|
+
for (const name of names) {
|
|
8209
|
+
if (!EXPRESSION_IDENTIFIER_RE.test(name)) return `invalid binding name '${name}'`;
|
|
8210
|
+
if (RESERVED_BINDING_NAMES.has(name)) return `binding name '${name}' is reserved`;
|
|
8211
|
+
if (EXPRESSION_BUILTIN_NAMES.has(name)) return `binding name '${name}' shadows a builtin function`;
|
|
8212
|
+
}
|
|
8213
|
+
const compiled = compileExpressionSafe(src.expr);
|
|
8214
|
+
if (!compiled.ok) return compiled.error;
|
|
8215
|
+
const bound = new Set(names);
|
|
8216
|
+
for (const id of compiled.parsed.identifiers) {
|
|
8217
|
+
if (id === "now") continue;
|
|
8218
|
+
if (!bound.has(id)) return `expression references unbound identifier '${id}'`;
|
|
8219
|
+
}
|
|
8220
|
+
return null;
|
|
8221
|
+
}
|
|
8222
|
+
/**
|
|
7458
8223
|
* Accessory device helpers — shared across drivers.
|
|
7459
8224
|
*
|
|
7460
8225
|
* Many vendor-specific drivers register accessory child devices on
|
|
@@ -9357,7 +10122,8 @@ var MotionAnalysisResultSchema = object({
|
|
|
9357
10122
|
});
|
|
9358
10123
|
method(object({
|
|
9359
10124
|
deviceId: number(),
|
|
9360
|
-
frame: FrameInputSchema
|
|
10125
|
+
frame: FrameInputSchema.optional(),
|
|
10126
|
+
frameHandle: FrameHandleSchema.optional()
|
|
9361
10127
|
}), MotionAnalysisResultSchema, { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), object({
|
|
9362
10128
|
deviceId: number(),
|
|
9363
10129
|
detected: boolean(),
|
|
@@ -9604,6 +10370,12 @@ method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngi
|
|
|
9604
10370
|
engine: PipelineEngineChoiceSchema.optional(),
|
|
9605
10371
|
steps: array(PipelineStepInputSchema).min(1),
|
|
9606
10372
|
frame: FrameInputSchema.optional(),
|
|
10373
|
+
/**
|
|
10374
|
+
* CB5 shm passthrough — a `FrameHandle` naming the same ring slot
|
|
10375
|
+
* the decoded pixels live in. One more member of the one-of
|
|
10376
|
+
* frame/frameHandle/image/imageBase64/referenceImage group.
|
|
10377
|
+
*/
|
|
10378
|
+
frameHandle: FrameHandleSchema.optional(),
|
|
9607
10379
|
imageBase64: string().optional(),
|
|
9608
10380
|
/**
|
|
9609
10381
|
* Binary JPEG bytes — preferred over `imageBase64` on internal
|
|
@@ -9813,6 +10585,31 @@ var ReportMotionInputSchema = object({
|
|
|
9813
10585
|
regions: array(MotionRegionSchema).readonly().optional()
|
|
9814
10586
|
});
|
|
9815
10587
|
/**
|
|
10588
|
+
* Where a runner gets a camera's decoded frames (cross-node Phase 2,
|
|
10589
|
+
* restream-owner model — P2c).
|
|
10590
|
+
*
|
|
10591
|
+
* - `local-broker` (DEFAULT): today's path — subscribe to the co-located
|
|
10592
|
+
* stream-broker's shm frame plane. Every pre-P2c attach payload (no
|
|
10593
|
+
* `frameSource` key) parses to this, so the field is additive with zero
|
|
10594
|
+
* behavior change.
|
|
10595
|
+
* - `remote-restream`: the detect node is NOT the camera's source-owner.
|
|
10596
|
+
* The runner acquires the owner's COMPRESSED passthrough restream
|
|
10597
|
+
* (`streamBroker.getStreamWithCodec({video:'copy'})` — refcounted, the
|
|
10598
|
+
* double-pull guard) and decodes LOCALLY via a satellite frame plane +
|
|
10599
|
+
* pull-mode decoder session pinned to its own node. The shm ring stays
|
|
10600
|
+
* node-local; only H.264/H.265 packets cross the wire.
|
|
10601
|
+
* `hubHostnameOverride` mirrors the recorder's `recordingHubHostname`:
|
|
10602
|
+
* when set it overrides the `CAMSTACK_HUB_URL`-derived host the runner
|
|
10603
|
+
* dials for the owner's restream.
|
|
10604
|
+
*/
|
|
10605
|
+
var RunnerFrameSourceSchema = discriminatedUnion("kind", [object({ kind: literal("local-broker") }), object({
|
|
10606
|
+
kind: literal("remote-restream"),
|
|
10607
|
+
/** The camera's source-owner node (slice 1: always the hub). */
|
|
10608
|
+
ownerNodeId: string(),
|
|
10609
|
+
/** Operator override for the owner host the runner dials. */
|
|
10610
|
+
hubHostnameOverride: string().optional()
|
|
10611
|
+
})]).describe("Per-camera frame-source mode for the runner (P2c)");
|
|
10612
|
+
/**
|
|
9816
10613
|
* Camera assignment payload sent by `addon-pipeline-orchestrator` to a
|
|
9817
10614
|
* specific runner instance via `attachCamera`. Carries everything the
|
|
9818
10615
|
* runner needs to subscribe to the local broker and execute inference.
|
|
@@ -9910,7 +10707,15 @@ var RunnerCameraConfigSchema = object({
|
|
|
9910
10707
|
*/
|
|
9911
10708
|
onboardMotionDrivesAnalyzer: boolean().default(true),
|
|
9912
10709
|
occupancyRecheckSec: number().min(occupancyRecheckSecField.min).max(occupancyRecheckSecField.max).default(occupancyRecheckSecField.default),
|
|
9913
|
-
occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default)
|
|
10710
|
+
occupancyRecheckFrames: number().min(occupancyRecheckFramesField.min).max(occupancyRecheckFramesField.max).default(occupancyRecheckFramesField.default),
|
|
10711
|
+
/**
|
|
10712
|
+
* Where this runner gets the camera's decoded frames (P2c). Defaulted so
|
|
10713
|
+
* every existing payload behaves as `local-broker` — the pre-Phase-2 path.
|
|
10714
|
+
* Populated with `remote-restream` by the orchestrator ONLY when the
|
|
10715
|
+
* camera's detect node differs from its source-owner (P2d, gated by the
|
|
10716
|
+
* `remoteSourcingNodes` rollout setting).
|
|
10717
|
+
*/
|
|
10718
|
+
frameSource: RunnerFrameSourceSchema.default({ kind: "local-broker" })
|
|
9914
10719
|
});
|
|
9915
10720
|
motionFpsField.min, motionFpsField.max, motionFpsField.step, motionFpsField.default, detectionFpsField.min, detectionFpsField.max, detectionFpsField.step, detectionFpsField.default, motionCooldownMsField.min, motionCooldownMsField.max, motionCooldownMsField.step, motionCooldownMsField.default, occupancyRecheckSecField.min, occupancyRecheckSecField.max, occupancyRecheckSecField.step, occupancyRecheckSecField.default, occupancyRecheckFramesField.min, occupancyRecheckFramesField.max, occupancyRecheckFramesField.step, occupancyRecheckFramesField.default;
|
|
9916
10721
|
/**
|
|
@@ -10275,6 +11080,113 @@ object({
|
|
|
10275
11080
|
lastFetchedAt: number()
|
|
10276
11081
|
});
|
|
10277
11082
|
DeviceType.Sensor;
|
|
11083
|
+
/**
|
|
11084
|
+
* Feeder connectivity / power status — mirrors the HA petkit device-status
|
|
11085
|
+
* enum: `normal` (online, mains), `offline` (not reaching PetKit cloud),
|
|
11086
|
+
* `on_batteries` (running on battery backup). `null` until first reported.
|
|
11087
|
+
*/
|
|
11088
|
+
var PetFeederDeviceStatusSchema = _enum([
|
|
11089
|
+
"normal",
|
|
11090
|
+
"offline",
|
|
11091
|
+
"on_batteries"
|
|
11092
|
+
]);
|
|
11093
|
+
var gramsPortion = number().int().min(4).max(200);
|
|
11094
|
+
object({
|
|
11095
|
+
/** Food currently in the bowl (grams). Null when the device has not
|
|
11096
|
+
* reported a reading yet. On dual-hopper models this is the combined
|
|
11097
|
+
* bowl reading; per-hopper levels live in `food1`/`food2`. */
|
|
11098
|
+
foodLevel: number().nullable(),
|
|
11099
|
+
/** Hopper-1 food level (grams) on dual-hopper feeders; null on
|
|
11100
|
+
* single-hopper models. */
|
|
11101
|
+
food1: number().nullable(),
|
|
11102
|
+
/** Hopper-2 food level (grams) on dual-hopper feeders; null on
|
|
11103
|
+
* single-hopper models. */
|
|
11104
|
+
food2: number().nullable(),
|
|
11105
|
+
/** Derived low-food flag — mirrors the HA `food_level` binary_sensor
|
|
11106
|
+
* (`device_class: problem`, on = low). True when the bowl is empty /
|
|
11107
|
+
* below the feeder's low threshold. */
|
|
11108
|
+
lowFood: boolean(),
|
|
11109
|
+
/** Battery charge 0..100 (%). Null on mains-powered models or when the
|
|
11110
|
+
* device has no battery reading. */
|
|
11111
|
+
batteryPower: number().min(0).max(100).nullable(),
|
|
11112
|
+
/** Days of desiccant life remaining. Null when the model has no
|
|
11113
|
+
* desiccant sensor. */
|
|
11114
|
+
desiccantLeftDays: number().nullable(),
|
|
11115
|
+
/** True while a feed is in progress. */
|
|
11116
|
+
feeding: boolean(),
|
|
11117
|
+
/** Decoded connectivity / power status (HA petkit device-status enum).
|
|
11118
|
+
* Null until the device has reported a status. */
|
|
11119
|
+
status: PetFeederDeviceStatusSchema.nullable(),
|
|
11120
|
+
/** Decoded human-readable fault message. Null (or the device's `no_error`
|
|
11121
|
+
* sentinel) means healthy; a non-null string is an active fault. Pairs
|
|
11122
|
+
* with `errorCode` for consumers that want the raw integer. */
|
|
11123
|
+
error: string().nullable(),
|
|
11124
|
+
/** Raw device error code (0 / null = no error). */
|
|
11125
|
+
errorCode: number().nullable(),
|
|
11126
|
+
/** True for D4S/D4SH dual-hopper hardware — gates the per-hopper UI. */
|
|
11127
|
+
isDualHopper: boolean(),
|
|
11128
|
+
/** Child-lock (manual-lock) setting — buttons on the unit are disabled. */
|
|
11129
|
+
childLock: boolean(),
|
|
11130
|
+
/** Front indicator-light setting. */
|
|
11131
|
+
indicatorLight: boolean(),
|
|
11132
|
+
/** Play a chime when dispensing. */
|
|
11133
|
+
feedSound: boolean(),
|
|
11134
|
+
/** Speaker / prompt volume level (device-scaled integer). */
|
|
11135
|
+
volume: number(),
|
|
11136
|
+
/** Ms epoch when the slice was last refreshed from the cloud. */
|
|
11137
|
+
lastFetchedAt: number()
|
|
11138
|
+
});
|
|
11139
|
+
DeviceType.PetFeeder, method(object({
|
|
11140
|
+
deviceId: number().int().nonnegative(),
|
|
11141
|
+
grams: gramsPortion.optional(),
|
|
11142
|
+
hopper1: gramsPortion.optional(),
|
|
11143
|
+
hopper2: gramsPortion.optional()
|
|
11144
|
+
}), _void(), {
|
|
11145
|
+
kind: "mutation",
|
|
11146
|
+
auth: "admin"
|
|
11147
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11148
|
+
kind: "mutation",
|
|
11149
|
+
auth: "admin"
|
|
11150
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11151
|
+
kind: "mutation",
|
|
11152
|
+
auth: "admin"
|
|
11153
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11154
|
+
kind: "mutation",
|
|
11155
|
+
auth: "admin"
|
|
11156
|
+
}), method(object({ deviceId: number().int().nonnegative() }), _void(), {
|
|
11157
|
+
kind: "mutation",
|
|
11158
|
+
auth: "admin"
|
|
11159
|
+
}), method(object({
|
|
11160
|
+
deviceId: number().int().nonnegative(),
|
|
11161
|
+
soundId: number().int().nonnegative()
|
|
11162
|
+
}), _void(), {
|
|
11163
|
+
kind: "mutation",
|
|
11164
|
+
auth: "admin"
|
|
11165
|
+
}), method(object({
|
|
11166
|
+
deviceId: number().int().nonnegative(),
|
|
11167
|
+
on: boolean()
|
|
11168
|
+
}), _void(), {
|
|
11169
|
+
kind: "mutation",
|
|
11170
|
+
auth: "admin"
|
|
11171
|
+
}), method(object({
|
|
11172
|
+
deviceId: number().int().nonnegative(),
|
|
11173
|
+
on: boolean()
|
|
11174
|
+
}), _void(), {
|
|
11175
|
+
kind: "mutation",
|
|
11176
|
+
auth: "admin"
|
|
11177
|
+
}), method(object({
|
|
11178
|
+
deviceId: number().int().nonnegative(),
|
|
11179
|
+
on: boolean()
|
|
11180
|
+
}), _void(), {
|
|
11181
|
+
kind: "mutation",
|
|
11182
|
+
auth: "admin"
|
|
11183
|
+
}), method(object({
|
|
11184
|
+
deviceId: number().int().nonnegative(),
|
|
11185
|
+
level: number().int().nonnegative()
|
|
11186
|
+
}), _void(), {
|
|
11187
|
+
kind: "mutation",
|
|
11188
|
+
auth: "admin"
|
|
11189
|
+
});
|
|
10278
11190
|
object({
|
|
10279
11191
|
/** Instantaneous power draw in watts. */
|
|
10280
11192
|
watts: number().optional(),
|
|
@@ -12102,10 +13014,12 @@ method(object({ codec: string() }), boolean()), method(_void(), object({
|
|
|
12102
13014
|
url: string()
|
|
12103
13015
|
}), _void()), method(object({
|
|
12104
13016
|
sessionId: string(),
|
|
12105
|
-
maxCount: number().default(1)
|
|
13017
|
+
maxCount: number().default(1),
|
|
13018
|
+
waitMs: number().optional()
|
|
12106
13019
|
}), array(DecodedFrameSchema)), method(object({
|
|
12107
13020
|
sessionId: string(),
|
|
12108
|
-
maxCount: number().default(1)
|
|
13021
|
+
maxCount: number().default(1),
|
|
13022
|
+
waitMs: number().optional()
|
|
12109
13023
|
}), array(FrameHandleSchema)), method(object({ handle: FrameHandleSchema }), DecodedFrameSchema.nullable()), method(object({ sessionId: string() }), ShmRingStatsSchema.nullable()), method(object({
|
|
12110
13024
|
sessionId: string(),
|
|
12111
13025
|
config: DecoderSessionConfigSchema.partial()
|
|
@@ -12392,14 +13306,63 @@ var ChildLayoutEntrySchema = object({
|
|
|
12392
13306
|
collapsed: boolean().optional()
|
|
12393
13307
|
});
|
|
12394
13308
|
/** Cap-wire shape of a DeviceLink — structurally mirrors `DeviceLink` in
|
|
12395
|
-
* `device-management.ts`.
|
|
13309
|
+
* `device-management.ts`. Source is a union: a FIELD source copies a sibling
|
|
13310
|
+
* accessory's status field (`kind` optional/absent for wire compat); a
|
|
13311
|
+
* LITERAL source carries a per-device constant (no sibling is read); a
|
|
13312
|
+
* GLOBAL source (P2e) copies ANY device's status field, addressed by the
|
|
13313
|
+
* source device's full re-sync-stable `stableId`. */
|
|
13314
|
+
var DeviceLinkFieldSourceSchema = object({
|
|
13315
|
+
kind: literal("field").optional(),
|
|
13316
|
+
sourceKey: string(),
|
|
13317
|
+
cap: string(),
|
|
13318
|
+
fieldPath: string()
|
|
13319
|
+
});
|
|
13320
|
+
var DeviceLinkLiteralSourceSchema = object({
|
|
13321
|
+
kind: literal("literal"),
|
|
13322
|
+
value: union([
|
|
13323
|
+
string(),
|
|
13324
|
+
number(),
|
|
13325
|
+
boolean(),
|
|
13326
|
+
_null()
|
|
13327
|
+
])
|
|
13328
|
+
});
|
|
13329
|
+
var DeviceLinkGlobalSourceSchema = object({
|
|
13330
|
+
kind: literal("global"),
|
|
13331
|
+
sourceStableId: string(),
|
|
13332
|
+
cap: string(),
|
|
13333
|
+
fieldPath: string()
|
|
13334
|
+
});
|
|
13335
|
+
/** Expression source (Stage X): compute the target field from N named bindings
|
|
13336
|
+
* via the safe expression engine. Bindings are field | literal | global — never
|
|
13337
|
+
* another expression (no nesting). The `superRefine` runs the SAME author-time
|
|
13338
|
+
* validation as `validateExpressionSource` (compiles the expr, checks binding
|
|
13339
|
+
* names + identifier coverage) so every wire boundary that parses a DeviceLink
|
|
13340
|
+
* (tRPC mount, kernel create pre-seed, projection output) validates-at-write.
|
|
13341
|
+
* Compiles are LRU-cached, so repeated validation of the same expr is a hit. */
|
|
13342
|
+
var DeviceLinkExpressionSourceSchema = object({
|
|
13343
|
+
kind: literal("expression"),
|
|
13344
|
+
expr: string().min(1).max(MAX_EXPRESSION_SOURCE_LENGTH),
|
|
13345
|
+
bindings: record(string().regex(EXPRESSION_IDENTIFIER_RE), union([
|
|
13346
|
+
DeviceLinkFieldSourceSchema,
|
|
13347
|
+
DeviceLinkLiteralSourceSchema,
|
|
13348
|
+
DeviceLinkGlobalSourceSchema
|
|
13349
|
+
]))
|
|
13350
|
+
}).superRefine((src, ctx) => {
|
|
13351
|
+
const err = validateExpressionSource(src);
|
|
13352
|
+
if (err !== null) ctx.addIssue({
|
|
13353
|
+
code: "custom",
|
|
13354
|
+
message: err,
|
|
13355
|
+
path: ["expr"]
|
|
13356
|
+
});
|
|
13357
|
+
});
|
|
12396
13358
|
var DeviceLinkSchema = object({
|
|
12397
13359
|
id: string(),
|
|
12398
|
-
source:
|
|
12399
|
-
|
|
12400
|
-
|
|
12401
|
-
|
|
12402
|
-
|
|
13360
|
+
source: union([
|
|
13361
|
+
DeviceLinkFieldSourceSchema,
|
|
13362
|
+
DeviceLinkLiteralSourceSchema,
|
|
13363
|
+
DeviceLinkGlobalSourceSchema,
|
|
13364
|
+
DeviceLinkExpressionSourceSchema
|
|
13365
|
+
]),
|
|
12403
13366
|
target: object({
|
|
12404
13367
|
cap: string(),
|
|
12405
13368
|
fieldPath: string(),
|
|
@@ -12428,6 +13391,31 @@ var DeviceLinkSchema = object({
|
|
|
12428
13391
|
})
|
|
12429
13392
|
]).optional()
|
|
12430
13393
|
});
|
|
13394
|
+
/** Cap-wire shape of a per-cap display refinement — mirrors
|
|
13395
|
+
* `DeviceCapDisplayOverride` in `device-management.ts`. */
|
|
13396
|
+
var DeviceCapDisplayOverrideSchema = object({
|
|
13397
|
+
unit: string().min(1).optional(),
|
|
13398
|
+
precision: number().int().min(0).max(10).optional()
|
|
13399
|
+
});
|
|
13400
|
+
/** Cap-wire shape of an operator-authored per-device display override —
|
|
13401
|
+
* mirrors `DeviceDisplayOverride` in `device-management.ts`. `precision`
|
|
13402
|
+
* bounds mirror `numeric-sensor.cap.ts` (`int 0-10`). */
|
|
13403
|
+
var DeviceDisplayOverrideSchema = object({
|
|
13404
|
+
icon: string().min(1).optional(),
|
|
13405
|
+
label: string().min(1).optional(),
|
|
13406
|
+
unit: string().min(1).optional(),
|
|
13407
|
+
precision: number().int().min(0).max(10).optional(),
|
|
13408
|
+
hidden: boolean().optional(),
|
|
13409
|
+
perCap: record(string(), DeviceCapDisplayOverrideSchema).optional()
|
|
13410
|
+
});
|
|
13411
|
+
/** Cap-wire shape of a per-role display default — mirrors `RoleDisplayDefault`
|
|
13412
|
+
* in `device-management.ts`. Keyed by `DeviceRole` string (role strings cross
|
|
13413
|
+
* the wire as plain strings everywhere else — cf. `DeviceInfoSchema.role`). */
|
|
13414
|
+
var RoleDisplayDefaultSchema = object({
|
|
13415
|
+
unit: string().min(1).optional(),
|
|
13416
|
+
precision: number().int().min(0).max(10).optional(),
|
|
13417
|
+
icon: string().min(1).optional()
|
|
13418
|
+
});
|
|
12431
13419
|
/**
|
|
12432
13420
|
* Serializable projection of a live IDevice.
|
|
12433
13421
|
* Returned by listAll, getDevice, getChildren.
|
|
@@ -12483,7 +13471,9 @@ var DeviceInfoSchema = object({
|
|
|
12483
13471
|
* `DeviceMeta.childLayout`. Absent ⇒ no layout declared. */
|
|
12484
13472
|
childLayout: array(ChildLayoutEntrySchema).readonly().optional(),
|
|
12485
13473
|
/** Operator-authored cross-device field wirings. See `DeviceMeta.deviceLinks`. */
|
|
12486
|
-
deviceLinks: array(DeviceLinkSchema).readonly().optional()
|
|
13474
|
+
deviceLinks: array(DeviceLinkSchema).readonly().optional(),
|
|
13475
|
+
/** Operator-authored per-device display override. See `DeviceMeta.display`. */
|
|
13476
|
+
display: DeviceDisplayOverrideSchema.optional()
|
|
12487
13477
|
});
|
|
12488
13478
|
var ConfigEntrySchema = object({
|
|
12489
13479
|
key: string(),
|
|
@@ -12548,7 +13538,9 @@ var DeviceMetaSchema = object({
|
|
|
12548
13538
|
deviceLinks: array(DeviceLinkSchema).readonly().optional(),
|
|
12549
13539
|
/** Semantic role string (`DeviceRole`) — propagated from the spawn pre-seed.
|
|
12550
13540
|
* Optional: only present for accessory children that carry a known role. */
|
|
12551
|
-
role: string().nullable().optional()
|
|
13541
|
+
role: string().nullable().optional(),
|
|
13542
|
+
/** Operator-authored per-device display override. See `DeviceMeta.display`. */
|
|
13543
|
+
display: DeviceDisplayOverrideSchema.optional()
|
|
12552
13544
|
});
|
|
12553
13545
|
/** ConfigUISchema passed through as unknown — mirrors device-provider's CreationSchemaOutputSchema */
|
|
12554
13546
|
var ConfigUISchemaOutput = unknown().nullable();
|
|
@@ -12642,7 +13634,19 @@ method(object({
|
|
|
12642
13634
|
}), _void(), {
|
|
12643
13635
|
kind: "mutation",
|
|
12644
13636
|
auth: "admin"
|
|
12645
|
-
}), method(object({
|
|
13637
|
+
}), method(object({
|
|
13638
|
+
deviceId: number(),
|
|
13639
|
+
display: DeviceDisplayOverrideSchema.nullable()
|
|
13640
|
+
}), _void(), {
|
|
13641
|
+
kind: "mutation",
|
|
13642
|
+
auth: "admin"
|
|
13643
|
+
}), method(object({}), object({ defaults: record(string(), RoleDisplayDefaultSchema) }), { kind: "query" }), method(object({ defaults: record(string(), RoleDisplayDefaultSchema) }), _void(), {
|
|
13644
|
+
kind: "mutation",
|
|
13645
|
+
auth: "admin"
|
|
13646
|
+
}), method(object({
|
|
13647
|
+
deviceId: number(),
|
|
13648
|
+
includeSynthesizable: boolean().optional()
|
|
13649
|
+
}), object({ caps: array(object({
|
|
12646
13650
|
cap: string(),
|
|
12647
13651
|
fields: array(object({
|
|
12648
13652
|
path: string(),
|
|
@@ -12652,8 +13656,13 @@ method(object({
|
|
|
12652
13656
|
"boolean",
|
|
12653
13657
|
"enum"
|
|
12654
13658
|
]),
|
|
12655
|
-
enumValues: array(string()).optional()
|
|
12656
|
-
|
|
13659
|
+
enumValues: array(string()).optional(),
|
|
13660
|
+
item: boolean().optional()
|
|
13661
|
+
})).readonly(),
|
|
13662
|
+
itemArray: object({
|
|
13663
|
+
path: string(),
|
|
13664
|
+
keyField: string()
|
|
13665
|
+
}).optional()
|
|
12657
13666
|
})).readonly() }), { kind: "query" }), method(object({
|
|
12658
13667
|
deviceId: number(),
|
|
12659
13668
|
role: string().nullable()
|
|
@@ -12723,7 +13732,11 @@ method(object({
|
|
|
12723
13732
|
deviceId: number(),
|
|
12724
13733
|
entries: array(object({
|
|
12725
13734
|
capName: string(),
|
|
12726
|
-
kind: _enum([
|
|
13735
|
+
kind: _enum([
|
|
13736
|
+
"native",
|
|
13737
|
+
"wrapped",
|
|
13738
|
+
"linked"
|
|
13739
|
+
]),
|
|
12727
13740
|
providerAddonId: string(),
|
|
12728
13741
|
providerNodeId: string(),
|
|
12729
13742
|
nativeAddonId: string()
|
|
@@ -12732,7 +13745,11 @@ method(object({
|
|
|
12732
13745
|
deviceId: number(),
|
|
12733
13746
|
entries: array(object({
|
|
12734
13747
|
capName: string(),
|
|
12735
|
-
kind: _enum([
|
|
13748
|
+
kind: _enum([
|
|
13749
|
+
"native",
|
|
13750
|
+
"wrapped",
|
|
13751
|
+
"linked"
|
|
13752
|
+
]),
|
|
12736
13753
|
providerAddonId: string(),
|
|
12737
13754
|
providerNodeId: string(),
|
|
12738
13755
|
nativeAddonId: string()
|
|
@@ -13222,7 +14239,7 @@ var AddBrokerInputSchema = object({
|
|
|
13222
14239
|
});
|
|
13223
14240
|
var AddBrokerResultSchema = object({ id: string() });
|
|
13224
14241
|
var IdInputSchema = object({ id: string() });
|
|
13225
|
-
var TestResultSchema = discriminatedUnion("ok", [object({
|
|
14242
|
+
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
13226
14243
|
ok: literal(true),
|
|
13227
14244
|
latencyMs: number()
|
|
13228
14245
|
}), object({
|
|
@@ -13245,7 +14262,7 @@ var StatusSchema = object({
|
|
|
13245
14262
|
brokerCount: number(),
|
|
13246
14263
|
embeddedRunning: boolean()
|
|
13247
14264
|
});
|
|
13248
|
-
method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
|
|
14265
|
+
method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnectionDetailsSchema), method(AddBrokerInputSchema, AddBrokerResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(IdInputSchema, TestResultSchema$1, { kind: "mutation" }), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, { kind: "mutation" }), method(IdInputSchema, _void(), { kind: "mutation" }), method(_void(), StatusSchema);
|
|
13249
14266
|
var NetworkEndpointSchema = object({
|
|
13250
14267
|
url: string(),
|
|
13251
14268
|
hostname: string(),
|
|
@@ -13279,23 +14296,198 @@ var NetworkEndpointEntrySchema = NetworkEndpointSchema.extend({
|
|
|
13279
14296
|
sourcePort: number().optional()
|
|
13280
14297
|
});
|
|
13281
14298
|
method(_void(), NetworkEndpointSchema, { kind: "mutation" }), method(_void(), _void(), { kind: "mutation" }), method(_void(), NetworkEndpointSchema.nullable()), method(_void(), NetworkAccessStatusSchema), method(_void(), array(NetworkEndpointEntrySchema).readonly());
|
|
13282
|
-
|
|
13283
|
-
|
|
14299
|
+
/**
|
|
14300
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
14301
|
+
*
|
|
14302
|
+
* Apprise-derived model (see
|
|
14303
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14304
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
14305
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
14306
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
14307
|
+
* message to what the kind supports — callers never special-case a service.
|
|
14308
|
+
*
|
|
14309
|
+
* DESIGN DECISIONS (locked):
|
|
14310
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
14311
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
14312
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
14313
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
14314
|
+
* alternative would fork the UI per addon and cannot host the
|
|
14315
|
+
* discovery→adopt flow.
|
|
14316
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
14317
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
14318
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
14319
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
14320
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
14321
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14322
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14323
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
14324
|
+
* base64 fallback needed.
|
|
14325
|
+
*
|
|
14326
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
14327
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
14328
|
+
* admin "Integrations" page.
|
|
14329
|
+
*/
|
|
14330
|
+
/**
|
|
14331
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
14332
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
14333
|
+
*/
|
|
14334
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
14335
|
+
"image",
|
|
14336
|
+
"video",
|
|
14337
|
+
"gif",
|
|
14338
|
+
"audio",
|
|
14339
|
+
"icon"
|
|
14340
|
+
]);
|
|
14341
|
+
/**
|
|
14342
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14343
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14344
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14345
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14346
|
+
*/
|
|
14347
|
+
var AttachmentSchema = object({
|
|
14348
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
14349
|
+
url: string().optional(),
|
|
14350
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
14351
|
+
mime: string().optional(),
|
|
14352
|
+
name: string().optional()
|
|
14353
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14354
|
+
var NotificationFormatSchema = _enum([
|
|
14355
|
+
"text",
|
|
14356
|
+
"markdown",
|
|
14357
|
+
"html"
|
|
14358
|
+
]);
|
|
14359
|
+
/** A single tap-through action button. */
|
|
14360
|
+
var NotificationActionSchema = object({
|
|
14361
|
+
id: string(),
|
|
14362
|
+
label: string(),
|
|
14363
|
+
url: string().optional()
|
|
14364
|
+
});
|
|
14365
|
+
/**
|
|
14366
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
14367
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
14368
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
14369
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14370
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14371
|
+
* `priority` for that one target.
|
|
14372
|
+
*/
|
|
14373
|
+
var NotificationSchema = object({
|
|
13284
14374
|
body: string(),
|
|
13285
|
-
|
|
14375
|
+
title: string().optional(),
|
|
14376
|
+
format: NotificationFormatSchema.default("text"),
|
|
14377
|
+
priority: number().int().min(1).max(5).default(3),
|
|
14378
|
+
level: string().optional(),
|
|
14379
|
+
attachments: array(AttachmentSchema).optional(),
|
|
14380
|
+
clickUrl: string().optional(),
|
|
14381
|
+
actions: array(NotificationActionSchema).optional(),
|
|
14382
|
+
sound: string().optional(),
|
|
14383
|
+
ttl: number().optional(),
|
|
14384
|
+
tag: string().optional(),
|
|
13286
14385
|
deviceId: number().optional(),
|
|
13287
14386
|
eventId: string().optional(),
|
|
13288
|
-
priority: _enum([
|
|
13289
|
-
"low",
|
|
13290
|
-
"normal",
|
|
13291
|
-
"high",
|
|
13292
|
-
"critical"
|
|
13293
|
-
]).default("normal"),
|
|
13294
14387
|
metadata: record(string(), unknown()).optional()
|
|
13295
|
-
})
|
|
14388
|
+
});
|
|
14389
|
+
/** One declared native severity/priority level for a kind. */
|
|
14390
|
+
var TargetKindLevelSchema = object({
|
|
14391
|
+
id: string(),
|
|
14392
|
+
label: string(),
|
|
14393
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14394
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
14395
|
+
flags: object({
|
|
14396
|
+
critical: boolean().optional(),
|
|
14397
|
+
silent: boolean().optional(),
|
|
14398
|
+
noPush: boolean().optional()
|
|
14399
|
+
}).optional(),
|
|
14400
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14401
|
+
requires: array(string()).optional(),
|
|
14402
|
+
description: string().optional()
|
|
14403
|
+
});
|
|
14404
|
+
/** The full capability block consulted before dispatch. */
|
|
14405
|
+
var TargetKindCapsSchema = object({
|
|
14406
|
+
attachments: object({
|
|
14407
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14408
|
+
mode: _enum([
|
|
14409
|
+
"url",
|
|
14410
|
+
"bytes",
|
|
14411
|
+
"both"
|
|
14412
|
+
]),
|
|
14413
|
+
max: number().int().nonnegative(),
|
|
14414
|
+
maxBytes: number().int().positive().optional()
|
|
14415
|
+
}),
|
|
14416
|
+
/** Max action buttons (0 = none). */
|
|
14417
|
+
actions: number().int().nonnegative(),
|
|
14418
|
+
levels: array(TargetKindLevelSchema),
|
|
14419
|
+
format: array(NotificationFormatSchema),
|
|
14420
|
+
clickUrl: boolean(),
|
|
14421
|
+
sound: boolean(),
|
|
14422
|
+
ttl: boolean(),
|
|
14423
|
+
bodyMaxLen: number().int().positive()
|
|
14424
|
+
});
|
|
14425
|
+
/**
|
|
14426
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
14427
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
14428
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
14429
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
14430
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14431
|
+
*/
|
|
14432
|
+
var ConfigSchemaPassthrough = unknown();
|
|
14433
|
+
var TargetKindSchema = object({
|
|
14434
|
+
kind: string(),
|
|
14435
|
+
label: string(),
|
|
14436
|
+
icon: string(),
|
|
14437
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
14438
|
+
addonId: string(),
|
|
14439
|
+
configSchema: ConfigSchemaPassthrough,
|
|
14440
|
+
supportsDiscovery: boolean(),
|
|
14441
|
+
caps: TargetKindCapsSchema
|
|
14442
|
+
});
|
|
14443
|
+
/**
|
|
14444
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
14445
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
14446
|
+
* round-trip a stored secret to the UI.
|
|
14447
|
+
*/
|
|
14448
|
+
var TargetSchema = object({
|
|
14449
|
+
id: string(),
|
|
14450
|
+
name: string(),
|
|
14451
|
+
kind: string(),
|
|
14452
|
+
addonId: string(),
|
|
14453
|
+
enabled: boolean(),
|
|
14454
|
+
config: record(string(), unknown())
|
|
14455
|
+
});
|
|
14456
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
14457
|
+
var DiscoveredTargetSchema = object({
|
|
14458
|
+
kind: string(),
|
|
14459
|
+
suggestedName: string(),
|
|
14460
|
+
config: record(string(), unknown())
|
|
14461
|
+
});
|
|
14462
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
14463
|
+
var RenderedAsSchema = object({
|
|
14464
|
+
level: string(),
|
|
14465
|
+
format: NotificationFormatSchema,
|
|
14466
|
+
attachmentsSent: number().int().nonnegative(),
|
|
14467
|
+
actionsSent: number().int().nonnegative(),
|
|
14468
|
+
truncated: boolean(),
|
|
14469
|
+
dropped: array(string())
|
|
14470
|
+
});
|
|
14471
|
+
var SendResultSchema = object({
|
|
13296
14472
|
success: boolean(),
|
|
13297
|
-
error: string().optional()
|
|
13298
|
-
|
|
14473
|
+
error: string().optional(),
|
|
14474
|
+
renderedAs: RenderedAsSchema.optional()
|
|
14475
|
+
});
|
|
14476
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
14477
|
+
var TestResultSchema = SendResultSchema;
|
|
14478
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema)), method(object({
|
|
14479
|
+
kind: string(),
|
|
14480
|
+
config: record(string(), unknown()).optional()
|
|
14481
|
+
}), array(DiscoveredTargetSchema)), method(object({
|
|
14482
|
+
targetId: string(),
|
|
14483
|
+
notification: NotificationSchema
|
|
14484
|
+
}), SendResultSchema, { kind: "mutation" }), method(object({
|
|
14485
|
+
targetId: string(),
|
|
14486
|
+
sample: NotificationSchema.optional()
|
|
14487
|
+
}), TestResultSchema, { kind: "mutation" }), method(object({ target: TargetSchema }), TargetSchema, { kind: "mutation" }), method(object({ targetId: string() }), _void(), { kind: "mutation" }), method(object({
|
|
14488
|
+
targetId: string(),
|
|
14489
|
+
enabled: boolean()
|
|
14490
|
+
}), _void(), { kind: "mutation" });
|
|
13299
14491
|
/**
|
|
13300
14492
|
* Zod schemas for persisted record types.
|
|
13301
14493
|
*
|
|
@@ -16330,7 +17522,10 @@ var HwAccelBackendInputSchema = _enum([
|
|
|
16330
17522
|
"webgpu",
|
|
16331
17523
|
"none"
|
|
16332
17524
|
]).nullable().optional();
|
|
16333
|
-
var HwAccelResolutionSchema = object({
|
|
17525
|
+
var HwAccelResolutionSchema = object({
|
|
17526
|
+
preferred: array(string()).readonly(),
|
|
17527
|
+
rationale: string()
|
|
17528
|
+
});
|
|
16334
17529
|
var HardwareEncoderIdSchema = _enum([
|
|
16335
17530
|
"h264_videotoolbox",
|
|
16336
17531
|
"hevc_videotoolbox",
|
|
@@ -16435,10 +17630,7 @@ var ResolvedInferenceConfigSchema = object({
|
|
|
16435
17630
|
format: ModelFormatSchema,
|
|
16436
17631
|
reason: string()
|
|
16437
17632
|
});
|
|
16438
|
-
method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({
|
|
16439
|
-
prefer: HwAccelBackendInputSchema,
|
|
16440
|
-
nodeId: string().optional()
|
|
16441
|
-
}), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
|
|
17633
|
+
method(_void(), PlatformCapabilitiesSchema), method(_void(), HardwareInfoSchema), method(object({ requirements: array(ModelRequirementSchema).readonly() }), ResolvedInferenceConfigSchema), method(object({ prefer: HwAccelBackendInputSchema }), HwAccelResolutionSchema), method(_void(), HardwareEncodersSchema), method(_void(), HardwareEncodersSchema, {
|
|
16442
17634
|
kind: "mutation",
|
|
16443
17635
|
auth: "admin"
|
|
16444
17636
|
}), method(_void(), HardwareDecodeAccelsSchema), method(_void(), HardwareDecodeAccelsSchema, {
|
|
@@ -16497,6 +17689,16 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceI
|
|
|
16497
17689
|
kind: "mutation",
|
|
16498
17690
|
auth: "admin"
|
|
16499
17691
|
});
|
|
17692
|
+
/**
|
|
17693
|
+
* `recording` cap — footage availability + HLS playback manifests + per-device
|
|
17694
|
+
* recording config. NOTE on events (source of truth, R5/C3): this cap carries
|
|
17695
|
+
* NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
|
|
17696
|
+
* events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
|
|
17697
|
+
* rows); the recorder's internal EventMap markers are ephemeral in-RAM
|
|
17698
|
+
* annotations that are not exposed here and must not be treated as an event
|
|
17699
|
+
* feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
|
|
17700
|
+
* (`interfaces/recording-config.ts`).
|
|
17701
|
+
*/
|
|
16500
17702
|
var RecordingStatusSchema = object({
|
|
16501
17703
|
deviceId: number(),
|
|
16502
17704
|
enabled: boolean(),
|
|
@@ -18133,6 +19335,12 @@ Object.freeze({
|
|
|
18133
19335
|
addonId: null,
|
|
18134
19336
|
access: "view"
|
|
18135
19337
|
},
|
|
19338
|
+
"deviceManager.getRoleDisplayDefaults": {
|
|
19339
|
+
capName: "device-manager",
|
|
19340
|
+
capScope: "system",
|
|
19341
|
+
addonId: null,
|
|
19342
|
+
access: "view"
|
|
19343
|
+
},
|
|
18136
19344
|
"deviceManager.getSettingsSchema": {
|
|
18137
19345
|
capName: "device-manager",
|
|
18138
19346
|
capScope: "system",
|
|
@@ -18283,6 +19491,12 @@ Object.freeze({
|
|
|
18283
19491
|
addonId: null,
|
|
18284
19492
|
access: "create"
|
|
18285
19493
|
},
|
|
19494
|
+
"deviceManager.setDisplay": {
|
|
19495
|
+
capName: "device-manager",
|
|
19496
|
+
capScope: "system",
|
|
19497
|
+
addonId: null,
|
|
19498
|
+
access: "create"
|
|
19499
|
+
},
|
|
18286
19500
|
"deviceManager.setIntegrationId": {
|
|
18287
19501
|
capName: "device-manager",
|
|
18288
19502
|
capScope: "system",
|
|
@@ -18325,6 +19539,12 @@ Object.freeze({
|
|
|
18325
19539
|
addonId: null,
|
|
18326
19540
|
access: "create"
|
|
18327
19541
|
},
|
|
19542
|
+
"deviceManager.setRoleDisplayDefaults": {
|
|
19543
|
+
capName: "device-manager",
|
|
19544
|
+
capScope: "system",
|
|
19545
|
+
addonId: null,
|
|
19546
|
+
access: "create"
|
|
19547
|
+
},
|
|
18328
19548
|
"deviceManager.setStreamProfileMap": {
|
|
18329
19549
|
capName: "device-manager",
|
|
18330
19550
|
capScope: "system",
|
|
@@ -19303,13 +20523,49 @@ Object.freeze({
|
|
|
19303
20523
|
addonId: null,
|
|
19304
20524
|
access: "create"
|
|
19305
20525
|
},
|
|
20526
|
+
"notificationOutput.deleteTarget": {
|
|
20527
|
+
capName: "notification-output",
|
|
20528
|
+
capScope: "system",
|
|
20529
|
+
addonId: null,
|
|
20530
|
+
access: "delete"
|
|
20531
|
+
},
|
|
20532
|
+
"notificationOutput.discoverTargets": {
|
|
20533
|
+
capName: "notification-output",
|
|
20534
|
+
capScope: "system",
|
|
20535
|
+
addonId: null,
|
|
20536
|
+
access: "view"
|
|
20537
|
+
},
|
|
20538
|
+
"notificationOutput.listTargetKinds": {
|
|
20539
|
+
capName: "notification-output",
|
|
20540
|
+
capScope: "system",
|
|
20541
|
+
addonId: null,
|
|
20542
|
+
access: "view"
|
|
20543
|
+
},
|
|
20544
|
+
"notificationOutput.listTargets": {
|
|
20545
|
+
capName: "notification-output",
|
|
20546
|
+
capScope: "system",
|
|
20547
|
+
addonId: null,
|
|
20548
|
+
access: "view"
|
|
20549
|
+
},
|
|
19306
20550
|
"notificationOutput.send": {
|
|
19307
20551
|
capName: "notification-output",
|
|
19308
20552
|
capScope: "system",
|
|
19309
20553
|
addonId: null,
|
|
19310
20554
|
access: "create"
|
|
19311
20555
|
},
|
|
19312
|
-
"notificationOutput.
|
|
20556
|
+
"notificationOutput.setTargetEnabled": {
|
|
20557
|
+
capName: "notification-output",
|
|
20558
|
+
capScope: "system",
|
|
20559
|
+
addonId: null,
|
|
20560
|
+
access: "create"
|
|
20561
|
+
},
|
|
20562
|
+
"notificationOutput.testTarget": {
|
|
20563
|
+
capName: "notification-output",
|
|
20564
|
+
capScope: "system",
|
|
20565
|
+
addonId: null,
|
|
20566
|
+
access: "create"
|
|
20567
|
+
},
|
|
20568
|
+
"notificationOutput.upsertTarget": {
|
|
19313
20569
|
capName: "notification-output",
|
|
19314
20570
|
capScope: "system",
|
|
19315
20571
|
addonId: null,
|
|
@@ -19339,6 +20595,66 @@ Object.freeze({
|
|
|
19339
20595
|
addonId: null,
|
|
19340
20596
|
access: "create"
|
|
19341
20597
|
},
|
|
20598
|
+
"petFeeder.callPet": {
|
|
20599
|
+
capName: "pet-feeder",
|
|
20600
|
+
capScope: "device",
|
|
20601
|
+
addonId: null,
|
|
20602
|
+
access: "create"
|
|
20603
|
+
},
|
|
20604
|
+
"petFeeder.cancelFeed": {
|
|
20605
|
+
capName: "pet-feeder",
|
|
20606
|
+
capScope: "device",
|
|
20607
|
+
addonId: null,
|
|
20608
|
+
access: "create"
|
|
20609
|
+
},
|
|
20610
|
+
"petFeeder.feed": {
|
|
20611
|
+
capName: "pet-feeder",
|
|
20612
|
+
capScope: "device",
|
|
20613
|
+
addonId: null,
|
|
20614
|
+
access: "create"
|
|
20615
|
+
},
|
|
20616
|
+
"petFeeder.markFoodReplenished": {
|
|
20617
|
+
capName: "pet-feeder",
|
|
20618
|
+
capScope: "device",
|
|
20619
|
+
addonId: null,
|
|
20620
|
+
access: "create"
|
|
20621
|
+
},
|
|
20622
|
+
"petFeeder.playSound": {
|
|
20623
|
+
capName: "pet-feeder",
|
|
20624
|
+
capScope: "device",
|
|
20625
|
+
addonId: null,
|
|
20626
|
+
access: "create"
|
|
20627
|
+
},
|
|
20628
|
+
"petFeeder.resetDesiccant": {
|
|
20629
|
+
capName: "pet-feeder",
|
|
20630
|
+
capScope: "device",
|
|
20631
|
+
addonId: null,
|
|
20632
|
+
access: "delete"
|
|
20633
|
+
},
|
|
20634
|
+
"petFeeder.setChildLock": {
|
|
20635
|
+
capName: "pet-feeder",
|
|
20636
|
+
capScope: "device",
|
|
20637
|
+
addonId: null,
|
|
20638
|
+
access: "create"
|
|
20639
|
+
},
|
|
20640
|
+
"petFeeder.setFeedSound": {
|
|
20641
|
+
capName: "pet-feeder",
|
|
20642
|
+
capScope: "device",
|
|
20643
|
+
addonId: null,
|
|
20644
|
+
access: "create"
|
|
20645
|
+
},
|
|
20646
|
+
"petFeeder.setIndicatorLight": {
|
|
20647
|
+
capName: "pet-feeder",
|
|
20648
|
+
capScope: "device",
|
|
20649
|
+
addonId: null,
|
|
20650
|
+
access: "create"
|
|
20651
|
+
},
|
|
20652
|
+
"petFeeder.setVolume": {
|
|
20653
|
+
capName: "pet-feeder",
|
|
20654
|
+
capScope: "device",
|
|
20655
|
+
addonId: null,
|
|
20656
|
+
access: "create"
|
|
20657
|
+
},
|
|
19342
20658
|
"pipelineAnalytics.clearTracks": {
|
|
19343
20659
|
capName: "pipeline-analytics",
|
|
19344
20660
|
capScope: "device",
|