@camstack/addon-provider-hikvision 1.2.184 → 1.2.185
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 +6 -0
- package/dist/addon.js +751 -870
- package/dist/addon.mjs +751 -870
- package/package.json +2 -2
package/dist/addon.js
CHANGED
|
@@ -6014,7 +6014,7 @@ var ZodIssueCode = {
|
|
|
6014
6014
|
var ZodFirstPartyTypeKind;
|
|
6015
6015
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6016
6016
|
//#endregion
|
|
6017
|
-
//#region ../types/dist/sleep-
|
|
6017
|
+
//#region ../types/dist/sleep-D7ZKm4nb.mjs
|
|
6018
6018
|
/**
|
|
6019
6019
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6020
6020
|
* window to float samples (D455).
|
|
@@ -6809,10 +6809,33 @@ function defaultIntegrationDepsOver(api) {
|
|
|
6809
6809
|
};
|
|
6810
6810
|
}
|
|
6811
6811
|
var PREFIX = "records/";
|
|
6812
|
+
/**
|
|
6813
|
+
* Cross-realm brand. An addon bundles its own copy of this module (D15) while
|
|
6814
|
+
* `ctx.records` is the HOST's door, so an error thrown by the host is an
|
|
6815
|
+
* instance of the host's classes, not of the addon's. The brand plus the code
|
|
6816
|
+
* make `instanceof` answer by identity of the failure, not of the copy.
|
|
6817
|
+
*/
|
|
6818
|
+
var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
|
|
6819
|
+
function carriesBrand(value) {
|
|
6820
|
+
return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
|
|
6821
|
+
}
|
|
6812
6822
|
/** The base of every records failure. `detail` is the human part of the message. */
|
|
6813
6823
|
var RecordsError = class extends Error {
|
|
6824
|
+
/** The code a subclass stands for; the base stands for every code. */
|
|
6825
|
+
static code = void 0;
|
|
6826
|
+
/**
|
|
6827
|
+
* `instanceof` across copies of this module: any branded error is a
|
|
6828
|
+
* `RecordsError`, and is an instance of a subclass only when its code is the
|
|
6829
|
+
* subclass's code. Same-copy answers are unchanged.
|
|
6830
|
+
*/
|
|
6831
|
+
static [Symbol.hasInstance](value) {
|
|
6832
|
+
if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
|
|
6833
|
+
if (!carriesBrand(value)) return false;
|
|
6834
|
+
return this.code === void 0 || value.code === this.code;
|
|
6835
|
+
}
|
|
6814
6836
|
code;
|
|
6815
6837
|
detail;
|
|
6838
|
+
[RECORDS_ERROR_BRAND] = true;
|
|
6816
6839
|
constructor(code, detail) {
|
|
6817
6840
|
super(`${PREFIX}${code}: ${detail}`);
|
|
6818
6841
|
this.name = "RecordsError";
|
|
@@ -6821,29 +6844,33 @@ var RecordsError = class extends Error {
|
|
|
6821
6844
|
}
|
|
6822
6845
|
};
|
|
6823
6846
|
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
6824
|
-
var RevConflictError = class extends RecordsError {
|
|
6847
|
+
var RevConflictError = class RevConflictError extends RecordsError {
|
|
6848
|
+
static code = "rev-conflict";
|
|
6825
6849
|
constructor(detail) {
|
|
6826
|
-
super(
|
|
6850
|
+
super(RevConflictError.code, detail);
|
|
6827
6851
|
this.name = "RevConflictError";
|
|
6828
6852
|
}
|
|
6829
6853
|
};
|
|
6830
6854
|
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
6831
|
-
var RecordSecretUnavailableError = class extends RecordsError {
|
|
6855
|
+
var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
|
|
6856
|
+
static code = "secret-unavailable";
|
|
6832
6857
|
constructor(detail) {
|
|
6833
|
-
super(
|
|
6858
|
+
super(RecordSecretUnavailableError.code, detail);
|
|
6834
6859
|
this.name = "RecordSecretUnavailableError";
|
|
6835
6860
|
}
|
|
6836
6861
|
};
|
|
6837
|
-
var InvalidRecordError = class extends RecordsError {
|
|
6862
|
+
var InvalidRecordError = class InvalidRecordError extends RecordsError {
|
|
6863
|
+
static code = "invalid-record";
|
|
6838
6864
|
constructor(detail) {
|
|
6839
|
-
super(
|
|
6865
|
+
super(InvalidRecordError.code, detail);
|
|
6840
6866
|
this.name = "InvalidRecordError";
|
|
6841
6867
|
}
|
|
6842
6868
|
};
|
|
6843
6869
|
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
6844
|
-
var DeclarationRefusedError = class extends RecordsError {
|
|
6870
|
+
var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
|
|
6871
|
+
static code = "declaration-refused";
|
|
6845
6872
|
constructor(detail) {
|
|
6846
|
-
super(
|
|
6873
|
+
super(DeclarationRefusedError.code, detail);
|
|
6847
6874
|
this.name = "DeclarationRefusedError";
|
|
6848
6875
|
}
|
|
6849
6876
|
};
|
|
@@ -9647,286 +9674,6 @@ function normalizeAddonInitResult(result) {
|
|
|
9647
9674
|
if (Array.isArray(result)) return { providers: result };
|
|
9648
9675
|
return result;
|
|
9649
9676
|
}
|
|
9650
|
-
/**
|
|
9651
|
-
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
9652
|
-
* and validates them (`ShareViewGrantSchema` builds its
|
|
9653
|
-
* enum from this list); a data plane names the kinds it ACCEPTS in `share`.
|
|
9654
|
-
*/
|
|
9655
|
-
var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
|
|
9656
|
-
/** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
|
|
9657
|
-
var PeerBytesTicketSchema = object({
|
|
9658
|
-
/** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
|
|
9659
|
-
url: string().min(1),
|
|
9660
|
-
/**
|
|
9661
|
-
* The HOST node this URL means something on — the hub or a named agent,
|
|
9662
|
-
* never a runner. {@link AddonPeerBytes.open} compares it to its own and
|
|
9663
|
-
* refuses `cross-node` by name when they differ, without dialling.
|
|
9664
|
-
*/
|
|
9665
|
-
hostNodeId: string().min(1),
|
|
9666
|
-
expiresAtMs: number().int().nonnegative(),
|
|
9667
|
-
/**
|
|
9668
|
-
* What the producer DECLARED the body to be, when it knows — `null` when it
|
|
9669
|
-
* does not. Never `0` for unknown (D393): a consumer sizing a bound off this
|
|
9670
|
-
* must be able to tell "the producer did not say" from "the body is empty".
|
|
9671
|
-
*/
|
|
9672
|
-
declaredBytes: number().int().nonnegative().nullable()
|
|
9673
|
-
});
|
|
9674
|
-
function defOf(schema) {
|
|
9675
|
-
const zodBag = Reflect.get(schema, "_zod");
|
|
9676
|
-
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
9677
|
-
const def = Reflect.get(zodBag, "def");
|
|
9678
|
-
if (typeof def !== "object" || def === null) return {};
|
|
9679
|
-
return def;
|
|
9680
|
-
}
|
|
9681
|
-
function declaredHere(schema) {
|
|
9682
|
-
return globalRegistry.get(schema)?.secret === true;
|
|
9683
|
-
}
|
|
9684
|
-
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
9685
|
-
var WRAPPERS = new Set([
|
|
9686
|
-
"optional",
|
|
9687
|
-
"nullable",
|
|
9688
|
-
"default",
|
|
9689
|
-
"prefault",
|
|
9690
|
-
"catch",
|
|
9691
|
-
"readonly",
|
|
9692
|
-
"nonoptional"
|
|
9693
|
-
]);
|
|
9694
|
-
/**
|
|
9695
|
-
* The schema layers that make up ONE field: the schema itself and every
|
|
9696
|
-
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
9697
|
-
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
9698
|
-
* `.transform` on `in`).
|
|
9699
|
-
*/
|
|
9700
|
-
function layersOf(schema) {
|
|
9701
|
-
const out = [];
|
|
9702
|
-
const queue = [schema];
|
|
9703
|
-
while (queue.length > 0) {
|
|
9704
|
-
const s = queue.shift();
|
|
9705
|
-
if (!s || out.includes(s)) continue;
|
|
9706
|
-
out.push(s);
|
|
9707
|
-
const def = defOf(s);
|
|
9708
|
-
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
9709
|
-
if (def.type === "pipe") {
|
|
9710
|
-
if (def.in) queue.push(def.in);
|
|
9711
|
-
if (def.out) queue.push(def.out);
|
|
9712
|
-
}
|
|
9713
|
-
}
|
|
9714
|
-
return out;
|
|
9715
|
-
}
|
|
9716
|
-
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
9717
|
-
function isZodSecret(schema) {
|
|
9718
|
-
return layersOf(schema).some(declaredHere);
|
|
9719
|
-
}
|
|
9720
|
-
/**
|
|
9721
|
-
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
9722
|
-
* element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
|
|
9723
|
-
* map" (`applianceSecrets{}`). A declared
|
|
9724
|
-
* object or array is reported as one path and not descended into — everything
|
|
9725
|
-
* under it is secret.
|
|
9726
|
-
*/
|
|
9727
|
-
function collectZodSecretPaths(schema, prefix = "") {
|
|
9728
|
-
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
9729
|
-
const paths = [];
|
|
9730
|
-
for (const layer of layersOf(schema)) {
|
|
9731
|
-
const def = defOf(layer);
|
|
9732
|
-
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
9733
|
-
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
9734
|
-
else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
|
|
9735
|
-
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
9736
|
-
else if (def.type === "intersection") {
|
|
9737
|
-
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
9738
|
-
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
9739
|
-
}
|
|
9740
|
-
}
|
|
9741
|
-
return [...new Set(paths)];
|
|
9742
|
-
}
|
|
9743
|
-
/**
|
|
9744
|
-
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
9745
|
-
* Zod row schema that describes it, and the helper that turns the two into the
|
|
9746
|
-
* JSON the engine stores.
|
|
9747
|
-
*
|
|
9748
|
-
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
9749
|
-
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
9750
|
-
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
9751
|
-
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
9752
|
-
* never a field name (D879).
|
|
9753
|
-
*/
|
|
9754
|
-
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
9755
|
-
var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
9756
|
-
var RecordIndexSchema = object({
|
|
9757
|
-
name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
9758
|
-
fields: array(RecordFieldPathSchema).min(1).max(4),
|
|
9759
|
-
unique: boolean().optional()
|
|
9760
|
-
}).strict();
|
|
9761
|
-
var RecordRetentionSchema = union([
|
|
9762
|
-
object({
|
|
9763
|
-
ttlMs: number().int().positive(),
|
|
9764
|
-
from: _enum(["at", "write"])
|
|
9765
|
-
}).strict(),
|
|
9766
|
-
object({
|
|
9767
|
-
maxRows: number().int().positive().optional(),
|
|
9768
|
-
maxRowsPerDevice: number().int().positive().optional()
|
|
9769
|
-
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
9770
|
-
object({
|
|
9771
|
-
owner: string().min(1),
|
|
9772
|
-
reason: string().min(1)
|
|
9773
|
-
}).strict(),
|
|
9774
|
-
object({ none: string().min(1) }).strict()
|
|
9775
|
-
]);
|
|
9776
|
-
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
9777
|
-
var EntryDescriptorSchema = object({
|
|
9778
|
-
title: string().min(1),
|
|
9779
|
-
/** The record body field shown as the entry's name. */
|
|
9780
|
-
nameField: string().min(1),
|
|
9781
|
-
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
9782
|
-
fields: record(string(), unknown())
|
|
9783
|
-
}).strict();
|
|
9784
|
-
/** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
|
|
9785
|
-
var RecordKindDeclarationSchema = object({
|
|
9786
|
-
database: _enum(RECORD_DATABASES).default("settings"),
|
|
9787
|
-
class: _enum(RECORD_CLASSES),
|
|
9788
|
-
writeTrigger: string().min(1),
|
|
9789
|
-
device: _enum([
|
|
9790
|
-
"required",
|
|
9791
|
-
"optional",
|
|
9792
|
-
"none"
|
|
9793
|
-
]).default("none"),
|
|
9794
|
-
at: _enum(["required", "none"]).default("none"),
|
|
9795
|
-
indexes: array(RecordIndexSchema).max(8).default([]),
|
|
9796
|
-
retention: RecordRetentionSchema,
|
|
9797
|
-
deviceRemoval: _enum(["delete", "none"]).default("none"),
|
|
9798
|
-
maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
9799
|
-
/** Derived from the Zod schema; never written by hand. */
|
|
9800
|
-
secretPaths: array(string().min(1)).default([]),
|
|
9801
|
-
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
9802
|
-
secretArrayKeys: record(string(), string()).default({}),
|
|
9803
|
-
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
9804
|
-
transactFamily: string().min(1).optional(),
|
|
9805
|
-
entry: EntryDescriptorSchema.optional()
|
|
9806
|
-
}).strict();
|
|
9807
|
-
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
9808
|
-
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
9809
|
-
/** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
|
|
9810
|
-
function assertValidDeclaration(name, decl) {
|
|
9811
|
-
const refuse = (why) => {
|
|
9812
|
-
throw new DeclarationRefusedError(`kind "${name}": ${why}`);
|
|
9813
|
-
};
|
|
9814
|
-
if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
|
|
9815
|
-
const seen = /* @__PURE__ */ new Set();
|
|
9816
|
-
for (const index of decl.indexes) {
|
|
9817
|
-
if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
|
|
9818
|
-
seen.add(index.name);
|
|
9819
|
-
}
|
|
9820
|
-
const { retention } = decl;
|
|
9821
|
-
const hasSecrets = decl.secretPaths.length > 0;
|
|
9822
|
-
if ("ttlMs" in retention) {
|
|
9823
|
-
if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
|
|
9824
|
-
if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
|
|
9825
|
-
}
|
|
9826
|
-
if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
|
|
9827
|
-
if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
|
|
9828
|
-
if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
|
|
9829
|
-
if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
|
|
9830
|
-
const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
|
|
9831
|
-
if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
|
|
9832
|
-
}
|
|
9833
|
-
if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
|
|
9834
|
-
for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
|
|
9835
|
-
}
|
|
9836
|
-
function bodyFieldsOf(schema) {
|
|
9837
|
-
return { ...toJSONSchema(schema, {
|
|
9838
|
-
unrepresentable: "any",
|
|
9839
|
-
io: "input"
|
|
9840
|
-
}) };
|
|
9841
|
-
}
|
|
9842
|
-
function isRecordLike(value) {
|
|
9843
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9844
|
-
}
|
|
9845
|
-
/** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
|
|
9846
|
-
function hasNameField(json, field) {
|
|
9847
|
-
const branches = json["oneOf"] ?? json["anyOf"];
|
|
9848
|
-
if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
|
|
9849
|
-
const properties = json["properties"];
|
|
9850
|
-
return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
|
|
9851
|
-
}
|
|
9852
|
-
/**
|
|
9853
|
-
* Declare the kinds of a package. The keys are the kind names. The result is
|
|
9854
|
-
* what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
|
|
9855
|
-
* types its handle from.
|
|
9856
|
-
*/
|
|
9857
|
-
function defineRecordKinds(specs) {
|
|
9858
|
-
const out = {};
|
|
9859
|
-
for (const [name, spec] of Object.entries(specs)) {
|
|
9860
|
-
const secretPaths = collectZodSecretPaths(spec.schema);
|
|
9861
|
-
const nameField = spec.entry?.nameField ?? "name";
|
|
9862
|
-
const fields = bodyFieldsOf(spec.schema);
|
|
9863
|
-
if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
|
|
9864
|
-
const parsed = RecordKindDeclarationSchema.parse({
|
|
9865
|
-
database: spec.database,
|
|
9866
|
-
class: spec.class,
|
|
9867
|
-
writeTrigger: spec.writeTrigger,
|
|
9868
|
-
device: spec.device,
|
|
9869
|
-
at: spec.at,
|
|
9870
|
-
indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
|
|
9871
|
-
retention: spec.retention,
|
|
9872
|
-
deviceRemoval: spec.deviceRemoval,
|
|
9873
|
-
maxDataBytes: spec.maxDataBytes,
|
|
9874
|
-
secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
|
|
9875
|
-
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
9876
|
-
transactFamily: spec.transactFamily,
|
|
9877
|
-
entry: spec.entry === void 0 ? void 0 : {
|
|
9878
|
-
title: spec.entry.title,
|
|
9879
|
-
nameField,
|
|
9880
|
-
fields
|
|
9881
|
-
}
|
|
9882
|
-
});
|
|
9883
|
-
assertValidDeclaration(name, parsed);
|
|
9884
|
-
out[name] = {
|
|
9885
|
-
name,
|
|
9886
|
-
schema: spec.schema,
|
|
9887
|
-
declaration: parsed
|
|
9888
|
-
};
|
|
9889
|
-
}
|
|
9890
|
-
return out;
|
|
9891
|
-
}
|
|
9892
|
-
/**
|
|
9893
|
-
* Entry kinds (D881): every list of user-created entries (notification
|
|
9894
|
-
* targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
|
|
9895
|
-
* kind-specific body, and the admin UI lists/adds/edits/deletes all of them
|
|
9896
|
-
* through the `record-entries` capability with password fields derived from
|
|
9897
|
-
* the schema (`.meta({ secret: true })`).
|
|
9898
|
-
*/
|
|
9899
|
-
/** The body of a plain entry: a name and the fields the kind adds. */
|
|
9900
|
-
function entryBody(shape) {
|
|
9901
|
-
return object({
|
|
9902
|
-
name: string().min(1),
|
|
9903
|
-
enabled: boolean().optional(),
|
|
9904
|
-
...shape
|
|
9905
|
-
});
|
|
9906
|
-
}
|
|
9907
|
-
/**
|
|
9908
|
-
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
9909
|
-
* engine, never aged, belonging to no device.
|
|
9910
|
-
*/
|
|
9911
|
-
function defineEntryKind(name, spec) {
|
|
9912
|
-
const defined = defineRecordKinds({ [name]: {
|
|
9913
|
-
schema: spec.schema,
|
|
9914
|
-
class: "config",
|
|
9915
|
-
writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
|
|
9916
|
-
retention: { none: "an entry goes only when the operator deletes it" },
|
|
9917
|
-
...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
|
|
9918
|
-
...spec.database === void 0 ? {} : { database: spec.database },
|
|
9919
|
-
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
9920
|
-
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
9921
|
-
...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
|
|
9922
|
-
entry: {
|
|
9923
|
-
title: spec.title,
|
|
9924
|
-
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
9925
|
-
}
|
|
9926
|
-
} })[name];
|
|
9927
|
-
if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
|
|
9928
|
-
return defined;
|
|
9929
|
-
}
|
|
9930
9677
|
object({
|
|
9931
9678
|
field: string().min(1),
|
|
9932
9679
|
on: literal("advance")
|
|
@@ -10019,6 +9766,286 @@ function optionalMethod(input, output, options) {
|
|
|
10019
9766
|
function event(data) {
|
|
10020
9767
|
return { data };
|
|
10021
9768
|
}
|
|
9769
|
+
function defOf(schema) {
|
|
9770
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
9771
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
9772
|
+
const def = Reflect.get(zodBag, "def");
|
|
9773
|
+
if (typeof def !== "object" || def === null) return {};
|
|
9774
|
+
return def;
|
|
9775
|
+
}
|
|
9776
|
+
function declaredHere(schema) {
|
|
9777
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
9778
|
+
}
|
|
9779
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
9780
|
+
var WRAPPERS = new Set([
|
|
9781
|
+
"optional",
|
|
9782
|
+
"nullable",
|
|
9783
|
+
"default",
|
|
9784
|
+
"prefault",
|
|
9785
|
+
"catch",
|
|
9786
|
+
"readonly",
|
|
9787
|
+
"nonoptional"
|
|
9788
|
+
]);
|
|
9789
|
+
/**
|
|
9790
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
9791
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
9792
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
9793
|
+
* `.transform` on `in`).
|
|
9794
|
+
*/
|
|
9795
|
+
function layersOf(schema) {
|
|
9796
|
+
const out = [];
|
|
9797
|
+
const queue = [schema];
|
|
9798
|
+
while (queue.length > 0) {
|
|
9799
|
+
const s = queue.shift();
|
|
9800
|
+
if (!s || out.includes(s)) continue;
|
|
9801
|
+
out.push(s);
|
|
9802
|
+
const def = defOf(s);
|
|
9803
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
9804
|
+
if (def.type === "pipe") {
|
|
9805
|
+
if (def.in) queue.push(def.in);
|
|
9806
|
+
if (def.out) queue.push(def.out);
|
|
9807
|
+
}
|
|
9808
|
+
}
|
|
9809
|
+
return out;
|
|
9810
|
+
}
|
|
9811
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
9812
|
+
function isZodSecret(schema) {
|
|
9813
|
+
return layersOf(schema).some(declaredHere);
|
|
9814
|
+
}
|
|
9815
|
+
/**
|
|
9816
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
9817
|
+
* element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
|
|
9818
|
+
* map" (`applianceSecrets{}`). A declared
|
|
9819
|
+
* object or array is reported as one path and not descended into — everything
|
|
9820
|
+
* under it is secret.
|
|
9821
|
+
*/
|
|
9822
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
9823
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
9824
|
+
const paths = [];
|
|
9825
|
+
for (const layer of layersOf(schema)) {
|
|
9826
|
+
const def = defOf(layer);
|
|
9827
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
9828
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
9829
|
+
else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
|
|
9830
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
9831
|
+
else if (def.type === "intersection") {
|
|
9832
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
9833
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
9834
|
+
}
|
|
9835
|
+
}
|
|
9836
|
+
return [...new Set(paths)];
|
|
9837
|
+
}
|
|
9838
|
+
/**
|
|
9839
|
+
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
9840
|
+
* Zod row schema that describes it, and the helper that turns the two into the
|
|
9841
|
+
* JSON the engine stores.
|
|
9842
|
+
*
|
|
9843
|
+
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
9844
|
+
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
9845
|
+
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
9846
|
+
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
9847
|
+
* never a field name (D879).
|
|
9848
|
+
*/
|
|
9849
|
+
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
9850
|
+
var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
9851
|
+
var RecordIndexSchema = object({
|
|
9852
|
+
name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
9853
|
+
fields: array(RecordFieldPathSchema).min(1).max(4),
|
|
9854
|
+
unique: boolean().optional()
|
|
9855
|
+
}).strict();
|
|
9856
|
+
var RecordRetentionSchema = union([
|
|
9857
|
+
object({
|
|
9858
|
+
ttlMs: number().int().positive(),
|
|
9859
|
+
from: _enum(["at", "write"])
|
|
9860
|
+
}).strict(),
|
|
9861
|
+
object({
|
|
9862
|
+
maxRows: number().int().positive().optional(),
|
|
9863
|
+
maxRowsPerDevice: number().int().positive().optional()
|
|
9864
|
+
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
9865
|
+
object({
|
|
9866
|
+
owner: string().min(1),
|
|
9867
|
+
reason: string().min(1)
|
|
9868
|
+
}).strict(),
|
|
9869
|
+
object({ none: string().min(1) }).strict()
|
|
9870
|
+
]);
|
|
9871
|
+
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
9872
|
+
var EntryDescriptorSchema = object({
|
|
9873
|
+
title: string().min(1),
|
|
9874
|
+
/** The record body field shown as the entry's name. */
|
|
9875
|
+
nameField: string().min(1),
|
|
9876
|
+
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
9877
|
+
fields: record(string(), unknown())
|
|
9878
|
+
}).strict();
|
|
9879
|
+
/** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
|
|
9880
|
+
var RecordKindDeclarationSchema = object({
|
|
9881
|
+
database: _enum(RECORD_DATABASES).default("settings"),
|
|
9882
|
+
class: _enum(RECORD_CLASSES),
|
|
9883
|
+
writeTrigger: string().min(1),
|
|
9884
|
+
device: _enum([
|
|
9885
|
+
"required",
|
|
9886
|
+
"optional",
|
|
9887
|
+
"none"
|
|
9888
|
+
]).default("none"),
|
|
9889
|
+
at: _enum(["required", "none"]).default("none"),
|
|
9890
|
+
indexes: array(RecordIndexSchema).max(8).default([]),
|
|
9891
|
+
retention: RecordRetentionSchema,
|
|
9892
|
+
deviceRemoval: _enum(["delete", "none"]).default("none"),
|
|
9893
|
+
maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
9894
|
+
/** Derived from the Zod schema; never written by hand. */
|
|
9895
|
+
secretPaths: array(string().min(1)).default([]),
|
|
9896
|
+
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
9897
|
+
secretArrayKeys: record(string(), string()).default({}),
|
|
9898
|
+
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
9899
|
+
transactFamily: string().min(1).optional(),
|
|
9900
|
+
entry: EntryDescriptorSchema.optional()
|
|
9901
|
+
}).strict();
|
|
9902
|
+
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
9903
|
+
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
9904
|
+
/** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
|
|
9905
|
+
function assertValidDeclaration(name, decl) {
|
|
9906
|
+
const refuse = (why) => {
|
|
9907
|
+
throw new DeclarationRefusedError(`kind "${name}": ${why}`);
|
|
9908
|
+
};
|
|
9909
|
+
if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
|
|
9910
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9911
|
+
for (const index of decl.indexes) {
|
|
9912
|
+
if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
|
|
9913
|
+
seen.add(index.name);
|
|
9914
|
+
}
|
|
9915
|
+
const { retention } = decl;
|
|
9916
|
+
const hasSecrets = decl.secretPaths.length > 0;
|
|
9917
|
+
if ("ttlMs" in retention) {
|
|
9918
|
+
if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
|
|
9919
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
|
|
9920
|
+
}
|
|
9921
|
+
if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
|
|
9922
|
+
if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
|
|
9923
|
+
if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
|
|
9924
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
|
|
9925
|
+
const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
|
|
9926
|
+
if (decl.database === "settings" && bound > 5e4) refuse(`a row bound above ${RECORD_SETTINGS_MAX_ROWS} belongs in database: "events" (a big delete on the settings thread stalls every configuration read)`);
|
|
9927
|
+
}
|
|
9928
|
+
if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
|
|
9929
|
+
for (const path of decl.secretPaths) for (const prefix of secretArrayPrefixes(path)) if (decl.secretArrayKeys[prefix] === void 0) refuse(`secret path "${path}" crosses the array "${prefix}": declare its id key in secretArrayKeys`);
|
|
9930
|
+
}
|
|
9931
|
+
function bodyFieldsOf(schema) {
|
|
9932
|
+
return { ...toJSONSchema(schema, {
|
|
9933
|
+
unrepresentable: "any",
|
|
9934
|
+
io: "input"
|
|
9935
|
+
}) };
|
|
9936
|
+
}
|
|
9937
|
+
function isRecordLike(value) {
|
|
9938
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9939
|
+
}
|
|
9940
|
+
/** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
|
|
9941
|
+
function hasNameField(json, field) {
|
|
9942
|
+
const branches = json["oneOf"] ?? json["anyOf"];
|
|
9943
|
+
if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
|
|
9944
|
+
const properties = json["properties"];
|
|
9945
|
+
return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
|
|
9946
|
+
}
|
|
9947
|
+
/**
|
|
9948
|
+
* Declare the kinds of a package. The keys are the kind names. The result is
|
|
9949
|
+
* what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
|
|
9950
|
+
* types its handle from.
|
|
9951
|
+
*/
|
|
9952
|
+
function defineRecordKinds(specs) {
|
|
9953
|
+
const out = {};
|
|
9954
|
+
for (const [name, spec] of Object.entries(specs)) {
|
|
9955
|
+
const secretPaths = collectZodSecretPaths(spec.schema);
|
|
9956
|
+
const nameField = spec.entry?.nameField ?? "name";
|
|
9957
|
+
const fields = bodyFieldsOf(spec.schema);
|
|
9958
|
+
if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
|
|
9959
|
+
const parsed = RecordKindDeclarationSchema.parse({
|
|
9960
|
+
database: spec.database,
|
|
9961
|
+
class: spec.class,
|
|
9962
|
+
writeTrigger: spec.writeTrigger,
|
|
9963
|
+
device: spec.device,
|
|
9964
|
+
at: spec.at,
|
|
9965
|
+
indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
|
|
9966
|
+
retention: spec.retention,
|
|
9967
|
+
deviceRemoval: spec.deviceRemoval,
|
|
9968
|
+
maxDataBytes: spec.maxDataBytes,
|
|
9969
|
+
secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
|
|
9970
|
+
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
9971
|
+
transactFamily: spec.transactFamily,
|
|
9972
|
+
entry: spec.entry === void 0 ? void 0 : {
|
|
9973
|
+
title: spec.entry.title,
|
|
9974
|
+
nameField,
|
|
9975
|
+
fields
|
|
9976
|
+
}
|
|
9977
|
+
});
|
|
9978
|
+
assertValidDeclaration(name, parsed);
|
|
9979
|
+
out[name] = {
|
|
9980
|
+
name,
|
|
9981
|
+
schema: spec.schema,
|
|
9982
|
+
declaration: parsed
|
|
9983
|
+
};
|
|
9984
|
+
}
|
|
9985
|
+
return out;
|
|
9986
|
+
}
|
|
9987
|
+
/**
|
|
9988
|
+
* Entry kinds (D881): every list of user-created entries (notification
|
|
9989
|
+
* targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
|
|
9990
|
+
* kind-specific body, and the admin UI lists/adds/edits/deletes all of them
|
|
9991
|
+
* through the `record-entries` capability with password fields derived from
|
|
9992
|
+
* the schema (`.meta({ secret: true })`).
|
|
9993
|
+
*/
|
|
9994
|
+
/** The body of a plain entry: a name and the fields the kind adds. */
|
|
9995
|
+
function entryBody(shape) {
|
|
9996
|
+
return object({
|
|
9997
|
+
name: string().min(1),
|
|
9998
|
+
enabled: boolean().optional(),
|
|
9999
|
+
...shape
|
|
10000
|
+
});
|
|
10001
|
+
}
|
|
10002
|
+
/**
|
|
10003
|
+
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
10004
|
+
* engine, never aged, belonging to no device.
|
|
10005
|
+
*/
|
|
10006
|
+
function defineEntryKind(name, spec) {
|
|
10007
|
+
const defined = defineRecordKinds({ [name]: {
|
|
10008
|
+
schema: spec.schema,
|
|
10009
|
+
class: "config",
|
|
10010
|
+
writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
|
|
10011
|
+
retention: { none: "an entry goes only when the operator deletes it" },
|
|
10012
|
+
...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
|
|
10013
|
+
...spec.database === void 0 ? {} : { database: spec.database },
|
|
10014
|
+
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
10015
|
+
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
10016
|
+
...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
|
|
10017
|
+
entry: {
|
|
10018
|
+
title: spec.title,
|
|
10019
|
+
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
10020
|
+
}
|
|
10021
|
+
} })[name];
|
|
10022
|
+
if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
|
|
10023
|
+
return defined;
|
|
10024
|
+
}
|
|
10025
|
+
/**
|
|
10026
|
+
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
10027
|
+
* and validates them (`ShareViewGrantSchema` builds its
|
|
10028
|
+
* enum from this list); a data plane names the kinds it ACCEPTS in `share`.
|
|
10029
|
+
*/
|
|
10030
|
+
var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
|
|
10031
|
+
/** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
|
|
10032
|
+
var PeerBytesTicketSchema = object({
|
|
10033
|
+
/** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
|
|
10034
|
+
url: string().min(1),
|
|
10035
|
+
/**
|
|
10036
|
+
* The HOST node this URL means something on — the hub or a named agent,
|
|
10037
|
+
* never a runner. {@link AddonPeerBytes.open} compares it to its own and
|
|
10038
|
+
* refuses `cross-node` by name when they differ, without dialling.
|
|
10039
|
+
*/
|
|
10040
|
+
hostNodeId: string().min(1),
|
|
10041
|
+
expiresAtMs: number().int().nonnegative(),
|
|
10042
|
+
/**
|
|
10043
|
+
* What the producer DECLARED the body to be, when it knows — `null` when it
|
|
10044
|
+
* does not. Never `0` for unknown (D393): a consumer sizing a bound off this
|
|
10045
|
+
* must be able to tell "the producer did not say" from "the body is empty".
|
|
10046
|
+
*/
|
|
10047
|
+
declaredBytes: number().int().nonnegative().nullable()
|
|
10048
|
+
});
|
|
10022
10049
|
var READING_QUANTITIES = [
|
|
10023
10050
|
"temperature",
|
|
10024
10051
|
"pressure",
|
|
@@ -10609,7 +10636,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
10609
10636
|
"climate-control",
|
|
10610
10637
|
"color",
|
|
10611
10638
|
"composer",
|
|
10612
|
-
"connection-test",
|
|
10613
10639
|
"connectivity",
|
|
10614
10640
|
"consumables",
|
|
10615
10641
|
"contact",
|
|
@@ -12629,8 +12655,7 @@ Object.freeze({
|
|
|
12629
12655
|
"offerArtifact": 3e5,
|
|
12630
12656
|
"readResult": 3e5,
|
|
12631
12657
|
"submitJob": 18e5,
|
|
12632
|
-
"uploadDataset": 72e5
|
|
12633
|
-
"validateCredentials": 3e4
|
|
12658
|
+
"uploadDataset": 72e5
|
|
12634
12659
|
}
|
|
12635
12660
|
});
|
|
12636
12661
|
object({
|
|
@@ -13999,6 +14024,432 @@ var IntegrationInstanceRefSchema = object({
|
|
|
13999
14024
|
]),
|
|
14000
14025
|
candidateStableId: string().optional()
|
|
14001
14026
|
});
|
|
14027
|
+
/**
|
|
14028
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
14029
|
+
*
|
|
14030
|
+
* Apprise-derived model (see
|
|
14031
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14032
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
14033
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
14034
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
14035
|
+
* message to what the kind supports — callers never special-case a service.
|
|
14036
|
+
*
|
|
14037
|
+
* DESIGN DECISIONS (locked):
|
|
14038
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
14039
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
14040
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
14041
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
14042
|
+
* alternative would fork the UI per addon and cannot host the
|
|
14043
|
+
* discovery→adopt flow.
|
|
14044
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
14045
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
14046
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
14047
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
14048
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
14049
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14050
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14051
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
14052
|
+
* base64 fallback needed.
|
|
14053
|
+
*
|
|
14054
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
14055
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
14056
|
+
* admin "Integrations" page.
|
|
14057
|
+
*/
|
|
14058
|
+
/**
|
|
14059
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
14060
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
14061
|
+
*/
|
|
14062
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
14063
|
+
"image",
|
|
14064
|
+
"video",
|
|
14065
|
+
"gif",
|
|
14066
|
+
"audio",
|
|
14067
|
+
"icon"
|
|
14068
|
+
]);
|
|
14069
|
+
/**
|
|
14070
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14071
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14072
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14073
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14074
|
+
*/
|
|
14075
|
+
var AttachmentSchema = object({
|
|
14076
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
14077
|
+
url: string().optional(),
|
|
14078
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
14079
|
+
mime: string().optional(),
|
|
14080
|
+
name: string().optional()
|
|
14081
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14082
|
+
var NotificationFormatSchema = _enum([
|
|
14083
|
+
"text",
|
|
14084
|
+
"markdown",
|
|
14085
|
+
"html"
|
|
14086
|
+
]);
|
|
14087
|
+
/**
|
|
14088
|
+
* The CLOSED icon vocabulary an action button may use.
|
|
14089
|
+
*
|
|
14090
|
+
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
14091
|
+
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
14092
|
+
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
14093
|
+
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
14094
|
+
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
14095
|
+
*
|
|
14096
|
+
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
14097
|
+
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
14098
|
+
* differently.
|
|
14099
|
+
*
|
|
14100
|
+
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
14101
|
+
*
|
|
14102
|
+
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
14103
|
+
* the whole set onto its own renderer's vocabulary through a
|
|
14104
|
+
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
14105
|
+
* fallback, so adding a member here fails every adapter's build until someone
|
|
14106
|
+
* decides its glyph, which is the only place that decision can be made
|
|
14107
|
+
* honestly.
|
|
14108
|
+
*
|
|
14109
|
+
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
14110
|
+
* `disarm` straight through; iOS feeds that string to
|
|
14111
|
+
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
14112
|
+
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
14113
|
+
* mapping, and "the field is documented" is not "the value renders".
|
|
14114
|
+
*
|
|
14115
|
+
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
14116
|
+
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
14117
|
+
* so an addon that emits a token the running hub does not know does not lose an
|
|
14118
|
+
* icon — its whole `send` fails Zod validation and the notification never
|
|
14119
|
+
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
14120
|
+
*/
|
|
14121
|
+
var NotificationActionIconSchema = _enum([
|
|
14122
|
+
"acknowledge",
|
|
14123
|
+
"dismiss",
|
|
14124
|
+
"silence",
|
|
14125
|
+
"snooze",
|
|
14126
|
+
"view",
|
|
14127
|
+
"play",
|
|
14128
|
+
"open",
|
|
14129
|
+
"close",
|
|
14130
|
+
"lock",
|
|
14131
|
+
"unlock",
|
|
14132
|
+
"arm",
|
|
14133
|
+
"arm-home",
|
|
14134
|
+
"arm-away",
|
|
14135
|
+
"arm-night",
|
|
14136
|
+
"disarm",
|
|
14137
|
+
"light",
|
|
14138
|
+
"alert",
|
|
14139
|
+
"camera"
|
|
14140
|
+
]);
|
|
14141
|
+
/** A single tap-through action button. */
|
|
14142
|
+
var NotificationActionSchema = object({
|
|
14143
|
+
id: string(),
|
|
14144
|
+
label: string(),
|
|
14145
|
+
url: string().optional(),
|
|
14146
|
+
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
14147
|
+
icon: NotificationActionIconSchema.optional(),
|
|
14148
|
+
/**
|
|
14149
|
+
* Renders in a warning style where the notifier supports it.
|
|
14150
|
+
*
|
|
14151
|
+
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
14152
|
+
* else — see `notification-center/action-token.ts` for what that does and
|
|
14153
|
+
* does not buy.
|
|
14154
|
+
*/
|
|
14155
|
+
destructive: boolean().optional(),
|
|
14156
|
+
/**
|
|
14157
|
+
* How the tap should REACH the url.
|
|
14158
|
+
*
|
|
14159
|
+
* `navigate` (absent, and every button authored before this field) opens it:
|
|
14160
|
+
* the phone leaves the notification and shows whatever the callback returns.
|
|
14161
|
+
* That is right for a button whose answer the operator wants to read.
|
|
14162
|
+
*
|
|
14163
|
+
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
14164
|
+
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
14165
|
+
* an answer to the notification, and being thrown into a browser tab to
|
|
14166
|
+
* confirm it costs more attention than the notification did. A backend that
|
|
14167
|
+
* cannot do a background call renders it as an ordinary link (the adapters
|
|
14168
|
+
* fall back rather than dropping the button), so this is a preference, never
|
|
14169
|
+
* a requirement.
|
|
14170
|
+
*/
|
|
14171
|
+
mode: _enum(["navigate", "background"]).optional()
|
|
14172
|
+
});
|
|
14173
|
+
/** A delivery parameter value: what a notifier declared it takes. */
|
|
14174
|
+
var DeliveryParamValueSchema = union([
|
|
14175
|
+
string(),
|
|
14176
|
+
number(),
|
|
14177
|
+
boolean()
|
|
14178
|
+
]);
|
|
14179
|
+
/**
|
|
14180
|
+
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
14181
|
+
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
14182
|
+
* never handed one. The admin UI derives its control from this descriptor —
|
|
14183
|
+
* no editor knows a service by name.
|
|
14184
|
+
*
|
|
14185
|
+
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
14186
|
+
* run on the addon cap path).
|
|
14187
|
+
*/
|
|
14188
|
+
var DeliveryParamSchema = object({
|
|
14189
|
+
key: string().min(1),
|
|
14190
|
+
label: string(),
|
|
14191
|
+
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
14192
|
+
labelKey: string().optional(),
|
|
14193
|
+
type: _enum([
|
|
14194
|
+
"enum",
|
|
14195
|
+
"number",
|
|
14196
|
+
"boolean",
|
|
14197
|
+
"string"
|
|
14198
|
+
]),
|
|
14199
|
+
/** `enum` only: the closed set of accepted values. */
|
|
14200
|
+
options: array(object({
|
|
14201
|
+
value: string(),
|
|
14202
|
+
label: string()
|
|
14203
|
+
})).optional(),
|
|
14204
|
+
/** `number` only. */
|
|
14205
|
+
min: number().optional(),
|
|
14206
|
+
max: number().optional(),
|
|
14207
|
+
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
14208
|
+
default: DeliveryParamValueSchema.optional()
|
|
14209
|
+
});
|
|
14210
|
+
/**
|
|
14211
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
14212
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
14213
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
14214
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14215
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14216
|
+
* `priority` for that one target.
|
|
14217
|
+
*/
|
|
14218
|
+
var NotificationSchema = object({
|
|
14219
|
+
body: string(),
|
|
14220
|
+
title: string().optional(),
|
|
14221
|
+
format: NotificationFormatSchema.default("text"),
|
|
14222
|
+
priority: number().int().min(1).max(5).default(3),
|
|
14223
|
+
level: string().optional(),
|
|
14224
|
+
attachments: array(AttachmentSchema).optional(),
|
|
14225
|
+
clickUrl: string().optional(),
|
|
14226
|
+
actions: array(NotificationActionSchema).optional(),
|
|
14227
|
+
sound: string().optional(),
|
|
14228
|
+
ttl: number().optional(),
|
|
14229
|
+
tag: string().optional(),
|
|
14230
|
+
deviceId: number().optional(),
|
|
14231
|
+
eventId: string().optional(),
|
|
14232
|
+
metadata: record(string(), unknown()).optional(),
|
|
14233
|
+
/**
|
|
14234
|
+
* Values for the parameters the target's kind DECLARES in
|
|
14235
|
+
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
14236
|
+
* declaration by the sender; a notifier reads only the keys it declared.
|
|
14237
|
+
*/
|
|
14238
|
+
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
14239
|
+
});
|
|
14240
|
+
/** One declared native severity/priority level for a kind. */
|
|
14241
|
+
var TargetKindLevelSchema = object({
|
|
14242
|
+
id: string(),
|
|
14243
|
+
label: string(),
|
|
14244
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14245
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
14246
|
+
flags: object({
|
|
14247
|
+
critical: boolean().optional(),
|
|
14248
|
+
silent: boolean().optional(),
|
|
14249
|
+
noPush: boolean().optional()
|
|
14250
|
+
}).optional(),
|
|
14251
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14252
|
+
requires: array(string()).optional(),
|
|
14253
|
+
description: string().optional()
|
|
14254
|
+
});
|
|
14255
|
+
/** The full capability block consulted before dispatch. */
|
|
14256
|
+
var TargetKindCapsSchema = object({
|
|
14257
|
+
attachments: object({
|
|
14258
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14259
|
+
mode: _enum([
|
|
14260
|
+
"url",
|
|
14261
|
+
"bytes",
|
|
14262
|
+
"both"
|
|
14263
|
+
]),
|
|
14264
|
+
max: number().int().nonnegative(),
|
|
14265
|
+
maxBytes: number().int().positive().optional()
|
|
14266
|
+
}),
|
|
14267
|
+
/** Max action buttons (0 = none). */
|
|
14268
|
+
actions: number().int().nonnegative(),
|
|
14269
|
+
/**
|
|
14270
|
+
* Whether this kind renders a per-action ICON.
|
|
14271
|
+
*
|
|
14272
|
+
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
14273
|
+
* run on the addon cap path — three production failures in one day taught
|
|
14274
|
+
* this repo that once. Absent is read as false by the degrade engine, which
|
|
14275
|
+
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
14276
|
+
* assumed and dropped costs the operator's trust in the field.
|
|
14277
|
+
*/
|
|
14278
|
+
actionIcons: boolean().optional(),
|
|
14279
|
+
levels: array(TargetKindLevelSchema),
|
|
14280
|
+
format: array(NotificationFormatSchema),
|
|
14281
|
+
clickUrl: boolean(),
|
|
14282
|
+
sound: boolean(),
|
|
14283
|
+
ttl: boolean(),
|
|
14284
|
+
bodyMaxLen: number().int().positive()
|
|
14285
|
+
});
|
|
14286
|
+
/**
|
|
14287
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
14288
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
14289
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
14290
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
14291
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14292
|
+
*/
|
|
14293
|
+
var ConfigSchemaPassthrough$4 = unknown();
|
|
14294
|
+
var TargetKindSchema = object({
|
|
14295
|
+
kind: string(),
|
|
14296
|
+
label: string(),
|
|
14297
|
+
icon: string(),
|
|
14298
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
14299
|
+
addonId: string(),
|
|
14300
|
+
/**
|
|
14301
|
+
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
14302
|
+
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
14303
|
+
* when the addon bundles no icon for that kind — the client then falls back
|
|
14304
|
+
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
14305
|
+
*
|
|
14306
|
+
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
14307
|
+
* client, and a native client joins it onto its own hub base.
|
|
14308
|
+
*
|
|
14309
|
+
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
14310
|
+
* field that survived only because the runtime cap-router forwards provider
|
|
14311
|
+
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
14312
|
+
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
14313
|
+
* broken silently the moment output validation was tightened anywhere.
|
|
14314
|
+
*/
|
|
14315
|
+
iconUrl: string().optional(),
|
|
14316
|
+
/**
|
|
14317
|
+
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
14318
|
+
*
|
|
14319
|
+
* The server knows this and therefore says it, because the client cannot
|
|
14320
|
+
* safely guess: a React-Native client renders SVG and raster through two
|
|
14321
|
+
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
14322
|
+
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
14323
|
+
* placeholder glyph for every vector icon while the web build looked fine.
|
|
14324
|
+
*
|
|
14325
|
+
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
14326
|
+
* not been updated — a client that cannot determine the type should prefer
|
|
14327
|
+
* its raster path, which is the safe default for an unknown image.
|
|
14328
|
+
*/
|
|
14329
|
+
iconMediaType: string().optional(),
|
|
14330
|
+
configSchema: ConfigSchemaPassthrough$4,
|
|
14331
|
+
/**
|
|
14332
|
+
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
14333
|
+
* base URL, instance, chat, recipient). A save that changes any of them
|
|
14334
|
+
* while leaving a secret redacted is refused by the provider (D634), so an
|
|
14335
|
+
* editor uses this to ask for the secret on exactly those edits instead of
|
|
14336
|
+
* on every edit.
|
|
14337
|
+
*
|
|
14338
|
+
* Optional: absent from a provider that holds no secret (the Home Assistant
|
|
14339
|
+
* kinds) and from a provider older than this field — an editor that finds
|
|
14340
|
+
* it absent must assume ANY edit may need the secret.
|
|
14341
|
+
*/
|
|
14342
|
+
destinationKeys: array(string()).optional(),
|
|
14343
|
+
supportsDiscovery: boolean(),
|
|
14344
|
+
/**
|
|
14345
|
+
* Extra delivery parameters a rule may set for a target of this kind (D938).
|
|
14346
|
+
* Absent = none; the rule editor then offers nothing.
|
|
14347
|
+
*/
|
|
14348
|
+
deliveryParams: array(DeliveryParamSchema).optional(),
|
|
14349
|
+
caps: TargetKindCapsSchema
|
|
14350
|
+
});
|
|
14351
|
+
/**
|
|
14352
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
14353
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
14354
|
+
* round-trip a stored secret to the UI.
|
|
14355
|
+
*/
|
|
14356
|
+
var TargetSchema = object({
|
|
14357
|
+
id: string(),
|
|
14358
|
+
name: string(),
|
|
14359
|
+
kind: string(),
|
|
14360
|
+
addonId: string(),
|
|
14361
|
+
enabled: boolean(),
|
|
14362
|
+
config: record(string(), unknown())
|
|
14363
|
+
});
|
|
14364
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
14365
|
+
var DiscoveredTargetSchema = object({
|
|
14366
|
+
kind: string(),
|
|
14367
|
+
suggestedName: string(),
|
|
14368
|
+
config: record(string(), unknown())
|
|
14369
|
+
});
|
|
14370
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
14371
|
+
var RenderedAsSchema = object({
|
|
14372
|
+
level: string(),
|
|
14373
|
+
format: NotificationFormatSchema,
|
|
14374
|
+
attachmentsSent: number().int().nonnegative(),
|
|
14375
|
+
actionsSent: number().int().nonnegative(),
|
|
14376
|
+
truncated: boolean(),
|
|
14377
|
+
dropped: array(string())
|
|
14378
|
+
});
|
|
14379
|
+
var SendResultSchema = object({
|
|
14380
|
+
success: boolean(),
|
|
14381
|
+
error: string().optional(),
|
|
14382
|
+
renderedAs: RenderedAsSchema.optional()
|
|
14383
|
+
});
|
|
14384
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
14385
|
+
var TestResultSchema = SendResultSchema;
|
|
14386
|
+
/**
|
|
14387
|
+
* Pre-save credential probe against a partial (unsaved) target config.
|
|
14388
|
+
* `resolvedUrl` never includes secrets (token stripped from path).
|
|
14389
|
+
*/
|
|
14390
|
+
var ProbeTargetConfigResultSchema = object({
|
|
14391
|
+
ok: boolean(),
|
|
14392
|
+
resolvedUrl: string(),
|
|
14393
|
+
httpStatus: number().int().optional(),
|
|
14394
|
+
stateInstance: string().optional(),
|
|
14395
|
+
error: string().optional()
|
|
14396
|
+
});
|
|
14397
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
|
|
14398
|
+
kind: string(),
|
|
14399
|
+
config: record(string(), unknown()).optional(),
|
|
14400
|
+
/**
|
|
14401
|
+
* When editing / duplicating, the blank password field never round-trips
|
|
14402
|
+
* the stored token. Pass the source target id so the provider can restore
|
|
14403
|
+
* secrets server-side before dialling (same merge as upsert).
|
|
14404
|
+
*/
|
|
14405
|
+
targetId: string().optional()
|
|
14406
|
+
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
14407
|
+
kind: string(),
|
|
14408
|
+
config: record(string(), unknown()),
|
|
14409
|
+
/** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
|
|
14410
|
+
targetId: string().optional()
|
|
14411
|
+
}), ProbeTargetConfigResultSchema, {
|
|
14412
|
+
kind: "mutation",
|
|
14413
|
+
auth: "admin"
|
|
14414
|
+
}), method(object({
|
|
14415
|
+
targetId: string(),
|
|
14416
|
+
notification: NotificationSchema
|
|
14417
|
+
}), SendResultSchema, {
|
|
14418
|
+
kind: "mutation",
|
|
14419
|
+
auth: "admin"
|
|
14420
|
+
}), method(object({
|
|
14421
|
+
targetId: string(),
|
|
14422
|
+
sample: NotificationSchema.optional()
|
|
14423
|
+
}), TestResultSchema, {
|
|
14424
|
+
kind: "mutation",
|
|
14425
|
+
auth: "admin"
|
|
14426
|
+
}), method(object({
|
|
14427
|
+
target: TargetSchema,
|
|
14428
|
+
/**
|
|
14429
|
+
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
14430
|
+
* existing row. The UI never holds the stored token; blank / redacted
|
|
14431
|
+
* password fields are restored from this source (D634 still applies if
|
|
14432
|
+
* destinations diverge without a re-typed secret).
|
|
14433
|
+
*/
|
|
14434
|
+
cloneSecretsFrom: string().optional()
|
|
14435
|
+
}), TargetSchema, {
|
|
14436
|
+
kind: "mutation",
|
|
14437
|
+
auth: "admin"
|
|
14438
|
+
}), method(object({ targetId: string() }), _void(), {
|
|
14439
|
+
kind: "mutation",
|
|
14440
|
+
auth: "admin"
|
|
14441
|
+
}), method(object({
|
|
14442
|
+
targetId: string(),
|
|
14443
|
+
enabled: boolean()
|
|
14444
|
+
}), _void(), {
|
|
14445
|
+
kind: "mutation",
|
|
14446
|
+
auth: "admin"
|
|
14447
|
+
});
|
|
14448
|
+
looseObject({
|
|
14449
|
+
name: string().min(1),
|
|
14450
|
+
enabled: boolean().optional()
|
|
14451
|
+
});
|
|
14452
|
+
TargetSchema.omit({ id: true });
|
|
14002
14453
|
var EncodeProfileSchema = object({
|
|
14003
14454
|
video: object({
|
|
14004
14455
|
codec: _enum([
|
|
@@ -22849,7 +23300,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
22849
23300
|
"calendar-source": system(INTERNAL),
|
|
22850
23301
|
calendars: system("calendars feed schedules and conditions, not device actions"),
|
|
22851
23302
|
composer: system("device composition — an authoring tool, not an action"),
|
|
22852
|
-
"connection-test": system(INTERNAL),
|
|
22853
23303
|
"core-blocks": system(INTERNAL),
|
|
22854
23304
|
"custom-model-registry": system(ML),
|
|
22855
23305
|
"data-store-provider": system(INTERNAL),
|
|
@@ -44826,427 +45276,6 @@ var UnitWarningSchema = object({
|
|
|
44826
45276
|
assumedUnit: string(),
|
|
44827
45277
|
message: string()
|
|
44828
45278
|
});
|
|
44829
|
-
/**
|
|
44830
|
-
* notification-output — canonical, capability-gated notification delivery.
|
|
44831
|
-
*
|
|
44832
|
-
* Apprise-derived model (see
|
|
44833
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
44834
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
44835
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
44836
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
44837
|
-
* message to what the kind supports — callers never special-case a service.
|
|
44838
|
-
*
|
|
44839
|
-
* DESIGN DECISIONS (locked):
|
|
44840
|
-
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
44841
|
-
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
44842
|
-
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
44843
|
-
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
44844
|
-
* alternative would fork the UI per addon and cannot host the
|
|
44845
|
-
* discovery→adopt flow.
|
|
44846
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
44847
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
44848
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
44849
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
44850
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
44851
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
44852
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
44853
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
44854
|
-
* base64 fallback needed.
|
|
44855
|
-
*
|
|
44856
|
-
* TODO (deferred, closed-set change — separate decision): add
|
|
44857
|
-
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
44858
|
-
* admin "Integrations" page.
|
|
44859
|
-
*/
|
|
44860
|
-
/**
|
|
44861
|
-
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
44862
|
-
* adapter picks what it supports and the degrade engine filters the rest.
|
|
44863
|
-
*/
|
|
44864
|
-
var AttachmentMediaTypeSchema = _enum([
|
|
44865
|
-
"image",
|
|
44866
|
-
"video",
|
|
44867
|
-
"gif",
|
|
44868
|
-
"audio",
|
|
44869
|
-
"icon"
|
|
44870
|
-
]);
|
|
44871
|
-
/**
|
|
44872
|
-
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
44873
|
-
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
44874
|
-
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
44875
|
-
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
44876
|
-
*/
|
|
44877
|
-
var AttachmentSchema = object({
|
|
44878
|
-
mediaType: AttachmentMediaTypeSchema,
|
|
44879
|
-
url: string().optional(),
|
|
44880
|
-
bytes: _instanceof(Uint8Array).optional(),
|
|
44881
|
-
mime: string().optional(),
|
|
44882
|
-
name: string().optional()
|
|
44883
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
44884
|
-
var NotificationFormatSchema = _enum([
|
|
44885
|
-
"text",
|
|
44886
|
-
"markdown",
|
|
44887
|
-
"html"
|
|
44888
|
-
]);
|
|
44889
|
-
/**
|
|
44890
|
-
* The CLOSED icon vocabulary an action button may use.
|
|
44891
|
-
*
|
|
44892
|
-
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
44893
|
-
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
44894
|
-
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
44895
|
-
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
44896
|
-
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
44897
|
-
*
|
|
44898
|
-
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
44899
|
-
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
44900
|
-
* differently.
|
|
44901
|
-
*
|
|
44902
|
-
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
44903
|
-
*
|
|
44904
|
-
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
44905
|
-
* the whole set onto its own renderer's vocabulary through a
|
|
44906
|
-
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
44907
|
-
* fallback, so adding a member here fails every adapter's build until someone
|
|
44908
|
-
* decides its glyph, which is the only place that decision can be made
|
|
44909
|
-
* honestly.
|
|
44910
|
-
*
|
|
44911
|
-
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
44912
|
-
* `disarm` straight through; iOS feeds that string to
|
|
44913
|
-
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
44914
|
-
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
44915
|
-
* mapping, and "the field is documented" is not "the value renders".
|
|
44916
|
-
*
|
|
44917
|
-
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
44918
|
-
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
44919
|
-
* so an addon that emits a token the running hub does not know does not lose an
|
|
44920
|
-
* icon — its whole `send` fails Zod validation and the notification never
|
|
44921
|
-
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
44922
|
-
*/
|
|
44923
|
-
var NotificationActionIconSchema = _enum([
|
|
44924
|
-
"acknowledge",
|
|
44925
|
-
"dismiss",
|
|
44926
|
-
"silence",
|
|
44927
|
-
"snooze",
|
|
44928
|
-
"view",
|
|
44929
|
-
"play",
|
|
44930
|
-
"open",
|
|
44931
|
-
"close",
|
|
44932
|
-
"lock",
|
|
44933
|
-
"unlock",
|
|
44934
|
-
"arm",
|
|
44935
|
-
"arm-home",
|
|
44936
|
-
"arm-away",
|
|
44937
|
-
"arm-night",
|
|
44938
|
-
"disarm",
|
|
44939
|
-
"light",
|
|
44940
|
-
"alert",
|
|
44941
|
-
"camera"
|
|
44942
|
-
]);
|
|
44943
|
-
/** A single tap-through action button. */
|
|
44944
|
-
var NotificationActionSchema = object({
|
|
44945
|
-
id: string(),
|
|
44946
|
-
label: string(),
|
|
44947
|
-
url: string().optional(),
|
|
44948
|
-
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
44949
|
-
icon: NotificationActionIconSchema.optional(),
|
|
44950
|
-
/**
|
|
44951
|
-
* Renders in a warning style where the notifier supports it.
|
|
44952
|
-
*
|
|
44953
|
-
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
44954
|
-
* else — see `notification-center/action-token.ts` for what that does and
|
|
44955
|
-
* does not buy.
|
|
44956
|
-
*/
|
|
44957
|
-
destructive: boolean().optional(),
|
|
44958
|
-
/**
|
|
44959
|
-
* How the tap should REACH the url.
|
|
44960
|
-
*
|
|
44961
|
-
* `navigate` (absent, and every button authored before this field) opens it:
|
|
44962
|
-
* the phone leaves the notification and shows whatever the callback returns.
|
|
44963
|
-
* That is right for a button whose answer the operator wants to read.
|
|
44964
|
-
*
|
|
44965
|
-
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
44966
|
-
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
44967
|
-
* an answer to the notification, and being thrown into a browser tab to
|
|
44968
|
-
* confirm it costs more attention than the notification did. A backend that
|
|
44969
|
-
* cannot do a background call renders it as an ordinary link (the adapters
|
|
44970
|
-
* fall back rather than dropping the button), so this is a preference, never
|
|
44971
|
-
* a requirement.
|
|
44972
|
-
*/
|
|
44973
|
-
mode: _enum(["navigate", "background"]).optional()
|
|
44974
|
-
});
|
|
44975
|
-
/** A delivery parameter value: what a notifier declared it takes. */
|
|
44976
|
-
var DeliveryParamValueSchema = union([
|
|
44977
|
-
string(),
|
|
44978
|
-
number(),
|
|
44979
|
-
boolean()
|
|
44980
|
-
]);
|
|
44981
|
-
/**
|
|
44982
|
-
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
44983
|
-
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
44984
|
-
* never handed one. The admin UI derives its control from this descriptor —
|
|
44985
|
-
* no editor knows a service by name.
|
|
44986
|
-
*
|
|
44987
|
-
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
44988
|
-
* run on the addon cap path).
|
|
44989
|
-
*/
|
|
44990
|
-
var DeliveryParamSchema = object({
|
|
44991
|
-
key: string().min(1),
|
|
44992
|
-
label: string(),
|
|
44993
|
-
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
44994
|
-
labelKey: string().optional(),
|
|
44995
|
-
type: _enum([
|
|
44996
|
-
"enum",
|
|
44997
|
-
"number",
|
|
44998
|
-
"boolean",
|
|
44999
|
-
"string"
|
|
45000
|
-
]),
|
|
45001
|
-
/** `enum` only: the closed set of accepted values. */
|
|
45002
|
-
options: array(object({
|
|
45003
|
-
value: string(),
|
|
45004
|
-
label: string()
|
|
45005
|
-
})).optional(),
|
|
45006
|
-
/** `number` only. */
|
|
45007
|
-
min: number().optional(),
|
|
45008
|
-
max: number().optional(),
|
|
45009
|
-
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
45010
|
-
default: DeliveryParamValueSchema.optional()
|
|
45011
|
-
});
|
|
45012
|
-
/**
|
|
45013
|
-
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
45014
|
-
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
45015
|
-
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
45016
|
-
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
45017
|
-
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
45018
|
-
* `priority` for that one target.
|
|
45019
|
-
*/
|
|
45020
|
-
var NotificationSchema = object({
|
|
45021
|
-
body: string(),
|
|
45022
|
-
title: string().optional(),
|
|
45023
|
-
format: NotificationFormatSchema.default("text"),
|
|
45024
|
-
priority: number().int().min(1).max(5).default(3),
|
|
45025
|
-
level: string().optional(),
|
|
45026
|
-
attachments: array(AttachmentSchema).optional(),
|
|
45027
|
-
clickUrl: string().optional(),
|
|
45028
|
-
actions: array(NotificationActionSchema).optional(),
|
|
45029
|
-
sound: string().optional(),
|
|
45030
|
-
ttl: number().optional(),
|
|
45031
|
-
tag: string().optional(),
|
|
45032
|
-
deviceId: number().optional(),
|
|
45033
|
-
eventId: string().optional(),
|
|
45034
|
-
metadata: record(string(), unknown()).optional(),
|
|
45035
|
-
/**
|
|
45036
|
-
* Values for the parameters the target's kind DECLARES in
|
|
45037
|
-
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
45038
|
-
* declaration by the sender; a notifier reads only the keys it declared.
|
|
45039
|
-
*/
|
|
45040
|
-
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
45041
|
-
});
|
|
45042
|
-
/** One declared native severity/priority level for a kind. */
|
|
45043
|
-
var TargetKindLevelSchema = object({
|
|
45044
|
-
id: string(),
|
|
45045
|
-
label: string(),
|
|
45046
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
45047
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
45048
|
-
flags: object({
|
|
45049
|
-
critical: boolean().optional(),
|
|
45050
|
-
silent: boolean().optional(),
|
|
45051
|
-
noPush: boolean().optional()
|
|
45052
|
-
}).optional(),
|
|
45053
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
45054
|
-
requires: array(string()).optional(),
|
|
45055
|
-
description: string().optional()
|
|
45056
|
-
});
|
|
45057
|
-
/** The full capability block consulted before dispatch. */
|
|
45058
|
-
var TargetKindCapsSchema = object({
|
|
45059
|
-
attachments: object({
|
|
45060
|
-
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
45061
|
-
mode: _enum([
|
|
45062
|
-
"url",
|
|
45063
|
-
"bytes",
|
|
45064
|
-
"both"
|
|
45065
|
-
]),
|
|
45066
|
-
max: number().int().nonnegative(),
|
|
45067
|
-
maxBytes: number().int().positive().optional()
|
|
45068
|
-
}),
|
|
45069
|
-
/** Max action buttons (0 = none). */
|
|
45070
|
-
actions: number().int().nonnegative(),
|
|
45071
|
-
/**
|
|
45072
|
-
* Whether this kind renders a per-action ICON.
|
|
45073
|
-
*
|
|
45074
|
-
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
45075
|
-
* run on the addon cap path — three production failures in one day taught
|
|
45076
|
-
* this repo that once. Absent is read as false by the degrade engine, which
|
|
45077
|
-
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
45078
|
-
* assumed and dropped costs the operator's trust in the field.
|
|
45079
|
-
*/
|
|
45080
|
-
actionIcons: boolean().optional(),
|
|
45081
|
-
levels: array(TargetKindLevelSchema),
|
|
45082
|
-
format: array(NotificationFormatSchema),
|
|
45083
|
-
clickUrl: boolean(),
|
|
45084
|
-
sound: boolean(),
|
|
45085
|
-
ttl: boolean(),
|
|
45086
|
-
bodyMaxLen: number().int().positive()
|
|
45087
|
-
});
|
|
45088
|
-
/**
|
|
45089
|
-
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
45090
|
-
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
45091
|
-
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
45092
|
-
* the union is large and not meant for runtime validation here; the exported
|
|
45093
|
-
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
45094
|
-
*/
|
|
45095
|
-
var ConfigSchemaPassthrough$4 = unknown();
|
|
45096
|
-
var TargetKindSchema = object({
|
|
45097
|
-
kind: string(),
|
|
45098
|
-
label: string(),
|
|
45099
|
-
icon: string(),
|
|
45100
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
45101
|
-
addonId: string(),
|
|
45102
|
-
/**
|
|
45103
|
-
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
45104
|
-
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
45105
|
-
* when the addon bundles no icon for that kind — the client then falls back
|
|
45106
|
-
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
45107
|
-
*
|
|
45108
|
-
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
45109
|
-
* client, and a native client joins it onto its own hub base.
|
|
45110
|
-
*
|
|
45111
|
-
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
45112
|
-
* field that survived only because the runtime cap-router forwards provider
|
|
45113
|
-
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
45114
|
-
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
45115
|
-
* broken silently the moment output validation was tightened anywhere.
|
|
45116
|
-
*/
|
|
45117
|
-
iconUrl: string().optional(),
|
|
45118
|
-
/**
|
|
45119
|
-
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
45120
|
-
*
|
|
45121
|
-
* The server knows this and therefore says it, because the client cannot
|
|
45122
|
-
* safely guess: a React-Native client renders SVG and raster through two
|
|
45123
|
-
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
45124
|
-
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
45125
|
-
* placeholder glyph for every vector icon while the web build looked fine.
|
|
45126
|
-
*
|
|
45127
|
-
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
45128
|
-
* not been updated — a client that cannot determine the type should prefer
|
|
45129
|
-
* its raster path, which is the safe default for an unknown image.
|
|
45130
|
-
*/
|
|
45131
|
-
iconMediaType: string().optional(),
|
|
45132
|
-
configSchema: ConfigSchemaPassthrough$4,
|
|
45133
|
-
/**
|
|
45134
|
-
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
45135
|
-
* base URL, instance, chat, recipient). A save that changes any of them
|
|
45136
|
-
* while leaving a secret redacted is refused by the provider (D634), so an
|
|
45137
|
-
* editor uses this to ask for the secret on exactly those edits instead of
|
|
45138
|
-
* on every edit.
|
|
45139
|
-
*
|
|
45140
|
-
* Optional: absent from a provider that holds no secret (the Home Assistant
|
|
45141
|
-
* kinds) and from a provider older than this field — an editor that finds
|
|
45142
|
-
* it absent must assume ANY edit may need the secret.
|
|
45143
|
-
*/
|
|
45144
|
-
destinationKeys: array(string()).optional(),
|
|
45145
|
-
supportsDiscovery: boolean(),
|
|
45146
|
-
/**
|
|
45147
|
-
* Extra delivery parameters a rule may set for a target of this kind (D938).
|
|
45148
|
-
* Absent = none; the rule editor then offers nothing.
|
|
45149
|
-
*/
|
|
45150
|
-
deliveryParams: array(DeliveryParamSchema).optional(),
|
|
45151
|
-
caps: TargetKindCapsSchema
|
|
45152
|
-
});
|
|
45153
|
-
/**
|
|
45154
|
-
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
45155
|
-
* (return a presence marker only) when serving `listTargets` — never
|
|
45156
|
-
* round-trip a stored secret to the UI.
|
|
45157
|
-
*/
|
|
45158
|
-
var TargetSchema = object({
|
|
45159
|
-
id: string(),
|
|
45160
|
-
name: string(),
|
|
45161
|
-
kind: string(),
|
|
45162
|
-
addonId: string(),
|
|
45163
|
-
enabled: boolean(),
|
|
45164
|
-
config: record(string(), unknown())
|
|
45165
|
-
});
|
|
45166
|
-
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
45167
|
-
var DiscoveredTargetSchema = object({
|
|
45168
|
-
kind: string(),
|
|
45169
|
-
suggestedName: string(),
|
|
45170
|
-
config: record(string(), unknown())
|
|
45171
|
-
});
|
|
45172
|
-
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
45173
|
-
var RenderedAsSchema = object({
|
|
45174
|
-
level: string(),
|
|
45175
|
-
format: NotificationFormatSchema,
|
|
45176
|
-
attachmentsSent: number().int().nonnegative(),
|
|
45177
|
-
actionsSent: number().int().nonnegative(),
|
|
45178
|
-
truncated: boolean(),
|
|
45179
|
-
dropped: array(string())
|
|
45180
|
-
});
|
|
45181
|
-
var SendResultSchema = object({
|
|
45182
|
-
success: boolean(),
|
|
45183
|
-
error: string().optional(),
|
|
45184
|
-
renderedAs: RenderedAsSchema.optional()
|
|
45185
|
-
});
|
|
45186
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
45187
|
-
var TestResultSchema = SendResultSchema;
|
|
45188
|
-
/**
|
|
45189
|
-
* Pre-save credential probe against a partial (unsaved) target config.
|
|
45190
|
-
* `resolvedUrl` never includes secrets (token stripped from path).
|
|
45191
|
-
*/
|
|
45192
|
-
var ProbeTargetConfigResultSchema = object({
|
|
45193
|
-
ok: boolean(),
|
|
45194
|
-
resolvedUrl: string(),
|
|
45195
|
-
httpStatus: number().int().optional(),
|
|
45196
|
-
stateInstance: string().optional(),
|
|
45197
|
-
error: string().optional()
|
|
45198
|
-
});
|
|
45199
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
|
|
45200
|
-
kind: string(),
|
|
45201
|
-
config: record(string(), unknown()).optional(),
|
|
45202
|
-
/**
|
|
45203
|
-
* When editing / duplicating, the blank password field never round-trips
|
|
45204
|
-
* the stored token. Pass the source target id so the provider can restore
|
|
45205
|
-
* secrets server-side before dialling (same merge as upsert).
|
|
45206
|
-
*/
|
|
45207
|
-
targetId: string().optional()
|
|
45208
|
-
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
45209
|
-
kind: string(),
|
|
45210
|
-
config: record(string(), unknown()),
|
|
45211
|
-
/** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
|
|
45212
|
-
targetId: string().optional()
|
|
45213
|
-
}), ProbeTargetConfigResultSchema, {
|
|
45214
|
-
kind: "mutation",
|
|
45215
|
-
auth: "admin"
|
|
45216
|
-
}), method(object({
|
|
45217
|
-
targetId: string(),
|
|
45218
|
-
notification: NotificationSchema
|
|
45219
|
-
}), SendResultSchema, {
|
|
45220
|
-
kind: "mutation",
|
|
45221
|
-
auth: "admin"
|
|
45222
|
-
}), method(object({
|
|
45223
|
-
targetId: string(),
|
|
45224
|
-
sample: NotificationSchema.optional()
|
|
45225
|
-
}), TestResultSchema, {
|
|
45226
|
-
kind: "mutation",
|
|
45227
|
-
auth: "admin"
|
|
45228
|
-
}), method(object({
|
|
45229
|
-
target: TargetSchema,
|
|
45230
|
-
/**
|
|
45231
|
-
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
45232
|
-
* existing row. The UI never holds the stored token; blank / redacted
|
|
45233
|
-
* password fields are restored from this source (D634 still applies if
|
|
45234
|
-
* destinations diverge without a re-typed secret).
|
|
45235
|
-
*/
|
|
45236
|
-
cloneSecretsFrom: string().optional()
|
|
45237
|
-
}), TargetSchema, {
|
|
45238
|
-
kind: "mutation",
|
|
45239
|
-
auth: "admin"
|
|
45240
|
-
}), method(object({ targetId: string() }), _void(), {
|
|
45241
|
-
kind: "mutation",
|
|
45242
|
-
auth: "admin"
|
|
45243
|
-
}), method(object({
|
|
45244
|
-
targetId: string(),
|
|
45245
|
-
enabled: boolean()
|
|
45246
|
-
}), _void(), {
|
|
45247
|
-
kind: "mutation",
|
|
45248
|
-
auth: "admin"
|
|
45249
|
-
});
|
|
45250
45279
|
_enum([
|
|
45251
45280
|
"automation",
|
|
45252
45281
|
"action",
|
|
@@ -49786,37 +49815,6 @@ method(object({
|
|
|
49786
49815
|
kind: "mutation",
|
|
49787
49816
|
auth: "admin"
|
|
49788
49817
|
}), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
|
|
49789
|
-
var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
|
|
49790
|
-
object({
|
|
49791
|
-
outcome: literal("validated"),
|
|
49792
|
-
/** Round-trip of the sign-in, when the provider measured it. */
|
|
49793
|
-
latencyMs: number().nonnegative().optional(),
|
|
49794
|
-
/** Optional human detail worth showing next to the tick
|
|
49795
|
-
* ("3 devices visible on this account"). */
|
|
49796
|
-
detail: string().optional()
|
|
49797
|
-
}).strict(),
|
|
49798
|
-
object({
|
|
49799
|
-
outcome: literal("rejected"),
|
|
49800
|
-
error: string()
|
|
49801
|
-
}).strict(),
|
|
49802
|
-
object({
|
|
49803
|
-
outcome: literal("inconclusive"),
|
|
49804
|
-
error: string()
|
|
49805
|
-
}).strict()
|
|
49806
|
-
]);
|
|
49807
|
-
var ConnectionTestInputSchema = object({
|
|
49808
|
-
/** Candidate integration settings, exactly as the create form collected them. */
|
|
49809
|
-
settings: record(string(), unknown()) });
|
|
49810
|
-
/**
|
|
49811
|
-
* What the provider's test actually DOES, so the UI can say it in words before
|
|
49812
|
-
* the operator presses the button ("Signs in to the Dreo cloud"). Purely
|
|
49813
|
-
* descriptive — it never changes routing.
|
|
49814
|
-
*/
|
|
49815
|
-
var ConnectionTestDescriptorSchema = object({ label: string() });
|
|
49816
|
-
method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
|
|
49817
|
-
kind: "mutation",
|
|
49818
|
-
auth: "admin"
|
|
49819
|
-
}), method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" });
|
|
49820
49818
|
/**
|
|
49821
49819
|
* Upstream-system connectivity sensor — distinct from `device-status`,
|
|
49822
49820
|
* which is the kernel-managed online/offline flag for the device's
|
|
@@ -56993,10 +56991,9 @@ var AvailableIntegrationTypeSchema = object({
|
|
|
56993
56991
|
* locations" checkbox. Provider-declared in the addon manifest. */
|
|
56994
56992
|
supportsLocationImport: boolean(),
|
|
56995
56993
|
/**
|
|
56996
|
-
* True when this integration
|
|
56997
|
-
*
|
|
56998
|
-
*
|
|
56999
|
-
* rather than offering a button that always answers the same nonsense.
|
|
56994
|
+
* True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
|
|
56995
|
+
* D1016). An integration that cannot be tested must say so up front rather than offering a
|
|
56996
|
+
* button that always answers the same nonsense.
|
|
57000
56997
|
*/
|
|
57001
56998
|
canTest: boolean(),
|
|
57002
56999
|
existingInstances: array(object({
|
|
@@ -57050,7 +57047,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
57050
57047
|
info: record(string(), unknown()).optional(),
|
|
57051
57048
|
/** `stableId` of the discovery candidate the form was seeded from (D984). */
|
|
57052
57049
|
originStableId: string().optional(),
|
|
57053
|
-
settings: record(string(), unknown()).optional()
|
|
57050
|
+
settings: record(string(), unknown()).optional(),
|
|
57051
|
+
/** The instance kind being created, for a provider with several; omitted = its only testable kind. */
|
|
57052
|
+
kind: string().min(1).optional()
|
|
57054
57053
|
});
|
|
57055
57054
|
var UpdateIntegrationInputSchema = object({
|
|
57056
57055
|
id: string(),
|
|
@@ -57076,13 +57075,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
57076
57075
|
}), method(object({ id: string() }), DeleteIntegrationResultSchema, {
|
|
57077
57076
|
kind: "mutation",
|
|
57078
57077
|
auth: "admin"
|
|
57079
|
-
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" })
|
|
57080
|
-
addonId: string(),
|
|
57081
|
-
settings: record(string(), unknown())
|
|
57082
|
-
}), TestConnectionResultSchema, {
|
|
57083
|
-
kind: "mutation",
|
|
57084
|
-
auth: "admin"
|
|
57085
|
-
});
|
|
57078
|
+
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
|
|
57086
57079
|
/**
|
|
57087
57080
|
* `integration-instances` - the connection of an addon that holds ONE or SEVERAL
|
|
57088
57081
|
* (an account, a relay, a destination) as typed records (D985, D986). The addon's
|
|
@@ -65825,13 +65818,6 @@ var AddBrokerInputSchema = object({
|
|
|
65825
65818
|
});
|
|
65826
65819
|
var AddBrokerResultSchema = object({ id: string() });
|
|
65827
65820
|
var IdInputSchema = object({ id: string() });
|
|
65828
|
-
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
65829
|
-
ok: literal(true),
|
|
65830
|
-
latencyMs: number()
|
|
65831
|
-
}), object({
|
|
65832
|
-
ok: literal(false),
|
|
65833
|
-
error: string()
|
|
65834
|
-
})]);
|
|
65835
65821
|
var StartEmbeddedInputSchema = object({
|
|
65836
65822
|
port: number().int().min(1).max(65535).default(1883),
|
|
65837
65823
|
/** Allow anonymous connect (no username/password). Default: false. */
|
|
@@ -65854,9 +65840,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
|
|
|
65854
65840
|
}), method(IdInputSchema, _void(), {
|
|
65855
65841
|
kind: "mutation",
|
|
65856
65842
|
auth: "admin"
|
|
65857
|
-
}), method(IdInputSchema, TestResultSchema$1, {
|
|
65858
|
-
kind: "mutation",
|
|
65859
|
-
auth: "admin"
|
|
65860
65843
|
}), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
|
|
65861
65844
|
kind: "mutation",
|
|
65862
65845
|
auth: "admin"
|
|
@@ -79673,7 +79656,7 @@ var TrainingProviderTypeSchema = object({
|
|
|
79673
79656
|
label: string(),
|
|
79674
79657
|
/** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
|
|
79675
79658
|
iconAsset: string(),
|
|
79676
|
-
/** Owning `training-provider` addon
|
|
79659
|
+
/** Owning `training-provider` addon. */
|
|
79677
79660
|
addonId: string(),
|
|
79678
79661
|
/**
|
|
79679
79662
|
* Fields for one entry of this type (credentials + defaults). Absent on a
|
|
@@ -79718,36 +79701,6 @@ var TrainingProviderDescriptorSchema = object({
|
|
|
79718
79701
|
*/
|
|
79719
79702
|
formValues: record(string(), unknown()).optional()
|
|
79720
79703
|
});
|
|
79721
|
-
/**
|
|
79722
|
-
* Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
|
|
79723
|
-
* An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
|
|
79724
|
-
* `{ $secretClear: true }` clears it.
|
|
79725
|
-
*/
|
|
79726
|
-
var TrainingProviderUpdateEntryInputSchema = object({
|
|
79727
|
-
entryId: string().min(1),
|
|
79728
|
-
name: string().min(1),
|
|
79729
|
-
tokenId: string().optional(),
|
|
79730
|
-
tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
|
|
79731
|
-
environment: string().optional(),
|
|
79732
|
-
gpuType: string().optional(),
|
|
79733
|
-
region: string().optional(),
|
|
79734
|
-
costCapUsd: number().nonnegative().optional(),
|
|
79735
|
-
maxRuntimeSec: number().int().positive().optional(),
|
|
79736
|
-
failedDatasetGraceHours: number().nonnegative().optional()
|
|
79737
|
-
});
|
|
79738
|
-
var TrainingCredentialCheckSchema = object({
|
|
79739
|
-
ok: boolean(),
|
|
79740
|
-
/** Workspace / account name, when the provider says. */
|
|
79741
|
-
account: string().optional(),
|
|
79742
|
-
reason: _enum([
|
|
79743
|
-
"missing",
|
|
79744
|
-
"invalid",
|
|
79745
|
-
"forbidden",
|
|
79746
|
-
"network",
|
|
79747
|
-
"quota"
|
|
79748
|
-
]).optional(),
|
|
79749
|
-
detail: string().optional()
|
|
79750
|
-
});
|
|
79751
79704
|
var ProviderJobStateSchema = _enum([
|
|
79752
79705
|
"pending",
|
|
79753
79706
|
"starting",
|
|
@@ -79795,22 +79748,6 @@ var TrainingLogLineSchema = object({
|
|
|
79795
79748
|
text: string()
|
|
79796
79749
|
});
|
|
79797
79750
|
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
|
|
79798
|
-
typeId: string().min(1),
|
|
79799
|
-
name: string().min(1)
|
|
79800
|
-
}), object({ entryId: string() }), {
|
|
79801
|
-
kind: "mutation",
|
|
79802
|
-
auth: "admin"
|
|
79803
|
-
}), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
|
|
79804
|
-
kind: "mutation",
|
|
79805
|
-
auth: "admin"
|
|
79806
|
-
}), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
|
|
79807
|
-
kind: "mutation",
|
|
79808
|
-
auth: "admin"
|
|
79809
|
-
}), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
|
|
79810
|
-
kind: "mutation",
|
|
79811
|
-
auth: "admin",
|
|
79812
|
-
timeoutMs: 3e4
|
|
79813
|
-
}), method(object({
|
|
79814
79751
|
entryId: string().min(1),
|
|
79815
79752
|
gpuType: string(),
|
|
79816
79753
|
region: string(),
|
|
@@ -85789,20 +85726,6 @@ Object.freeze({
|
|
|
85789
85726
|
access: "view",
|
|
85790
85727
|
role: "admin"
|
|
85791
85728
|
},
|
|
85792
|
-
"connectionTest.describeTest": {
|
|
85793
|
-
capName: "connection-test",
|
|
85794
|
-
capScope: "system",
|
|
85795
|
-
addonId: null,
|
|
85796
|
-
access: "view",
|
|
85797
|
-
role: "admin"
|
|
85798
|
-
},
|
|
85799
|
-
"connectionTest.testSettings": {
|
|
85800
|
-
capName: "connection-test",
|
|
85801
|
-
capScope: "system",
|
|
85802
|
-
addonId: null,
|
|
85803
|
-
access: "create",
|
|
85804
|
-
role: "admin"
|
|
85805
|
-
},
|
|
85806
85729
|
"connectivity.getStatus": {
|
|
85807
85730
|
capName: "connectivity",
|
|
85808
85731
|
capScope: "device",
|
|
@@ -88169,13 +88092,6 @@ Object.freeze({
|
|
|
88169
88092
|
access: "view",
|
|
88170
88093
|
role: "admin"
|
|
88171
88094
|
},
|
|
88172
|
-
"integrations.testConnection": {
|
|
88173
|
-
capName: "integrations",
|
|
88174
|
-
capScope: "system",
|
|
88175
|
-
addonId: null,
|
|
88176
|
-
access: "create",
|
|
88177
|
-
role: "admin"
|
|
88178
|
-
},
|
|
88179
88095
|
"integrations.update": {
|
|
88180
88096
|
capName: "integrations",
|
|
88181
88097
|
capScope: "system",
|
|
@@ -89408,13 +89324,6 @@ Object.freeze({
|
|
|
89408
89324
|
access: "create",
|
|
89409
89325
|
role: "admin"
|
|
89410
89326
|
},
|
|
89411
|
-
"mqttBroker.testConnection": {
|
|
89412
|
-
capName: "mqtt-broker",
|
|
89413
|
-
capScope: "system",
|
|
89414
|
-
addonId: null,
|
|
89415
|
-
access: "create",
|
|
89416
|
-
role: "admin"
|
|
89417
|
-
},
|
|
89418
89327
|
"nativeObjectDetection.getOptions": {
|
|
89419
89328
|
capName: "native-object-detection",
|
|
89420
89329
|
capScope: "device",
|
|
@@ -94245,20 +94154,6 @@ Object.freeze({
|
|
|
94245
94154
|
access: "create",
|
|
94246
94155
|
role: "admin"
|
|
94247
94156
|
},
|
|
94248
|
-
"trainingProvider.createEntry": {
|
|
94249
|
-
capName: "training-provider",
|
|
94250
|
-
capScope: "system",
|
|
94251
|
-
addonId: null,
|
|
94252
|
-
access: "create",
|
|
94253
|
-
role: "admin"
|
|
94254
|
-
},
|
|
94255
|
-
"trainingProvider.deleteEntry": {
|
|
94256
|
-
capName: "training-provider",
|
|
94257
|
-
capScope: "system",
|
|
94258
|
-
addonId: null,
|
|
94259
|
-
access: "delete",
|
|
94260
|
-
role: "admin"
|
|
94261
|
-
},
|
|
94262
94157
|
"trainingProvider.describe": {
|
|
94263
94158
|
capName: "training-provider",
|
|
94264
94159
|
capScope: "system",
|
|
@@ -94329,13 +94224,6 @@ Object.freeze({
|
|
|
94329
94224
|
access: "create",
|
|
94330
94225
|
role: "admin"
|
|
94331
94226
|
},
|
|
94332
|
-
"trainingProvider.updateEntry": {
|
|
94333
|
-
capName: "training-provider",
|
|
94334
|
-
capScope: "system",
|
|
94335
|
-
addonId: null,
|
|
94336
|
-
access: "create",
|
|
94337
|
-
role: "admin"
|
|
94338
|
-
},
|
|
94339
94227
|
"trainingProvider.uploadDataset": {
|
|
94340
94228
|
capName: "training-provider",
|
|
94341
94229
|
capScope: "system",
|
|
@@ -94343,13 +94231,6 @@ Object.freeze({
|
|
|
94343
94231
|
access: "create",
|
|
94344
94232
|
role: "admin"
|
|
94345
94233
|
},
|
|
94346
|
-
"trainingProvider.validateCredentials": {
|
|
94347
|
-
capName: "training-provider",
|
|
94348
|
-
capScope: "system",
|
|
94349
|
-
addonId: null,
|
|
94350
|
-
access: "create",
|
|
94351
|
-
role: "admin"
|
|
94352
|
-
},
|
|
94353
94234
|
"turnProvider.getTurnServers": {
|
|
94354
94235
|
capName: "turn-provider",
|
|
94355
94236
|
capScope: "system",
|