@camstack/addon-provider-reolink 1.2.231 → 1.2.232
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/i18n/en.json +4 -12
- package/i18n/it.json +4 -12
- package/package.json +2 -2
package/dist/addon.mjs
CHANGED
|
@@ -106669,7 +106669,7 @@ var ZodIssueCode = {
|
|
|
106669
106669
|
var ZodFirstPartyTypeKind;
|
|
106670
106670
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
106671
106671
|
//#endregion
|
|
106672
|
-
//#region ../types/dist/sleep-
|
|
106672
|
+
//#region ../types/dist/sleep-D7ZKm4nb.mjs
|
|
106673
106673
|
/**
|
|
106674
106674
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
106675
106675
|
* window to float samples (D455).
|
|
@@ -107378,10 +107378,33 @@ function integrationRowsApiOver(api) {
|
|
|
107378
107378
|
};
|
|
107379
107379
|
}
|
|
107380
107380
|
var PREFIX = "records/";
|
|
107381
|
+
/**
|
|
107382
|
+
* Cross-realm brand. An addon bundles its own copy of this module (D15) while
|
|
107383
|
+
* `ctx.records` is the HOST's door, so an error thrown by the host is an
|
|
107384
|
+
* instance of the host's classes, not of the addon's. The brand plus the code
|
|
107385
|
+
* make `instanceof` answer by identity of the failure, not of the copy.
|
|
107386
|
+
*/
|
|
107387
|
+
var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
|
|
107388
|
+
function carriesBrand(value) {
|
|
107389
|
+
return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
|
|
107390
|
+
}
|
|
107381
107391
|
/** The base of every records failure. `detail` is the human part of the message. */
|
|
107382
107392
|
var RecordsError = class extends Error {
|
|
107393
|
+
/** The code a subclass stands for; the base stands for every code. */
|
|
107394
|
+
static code = void 0;
|
|
107395
|
+
/**
|
|
107396
|
+
* `instanceof` across copies of this module: any branded error is a
|
|
107397
|
+
* `RecordsError`, and is an instance of a subclass only when its code is the
|
|
107398
|
+
* subclass's code. Same-copy answers are unchanged.
|
|
107399
|
+
*/
|
|
107400
|
+
static [Symbol.hasInstance](value) {
|
|
107401
|
+
if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
|
|
107402
|
+
if (!carriesBrand(value)) return false;
|
|
107403
|
+
return this.code === void 0 || value.code === this.code;
|
|
107404
|
+
}
|
|
107383
107405
|
code;
|
|
107384
107406
|
detail;
|
|
107407
|
+
[RECORDS_ERROR_BRAND] = true;
|
|
107385
107408
|
constructor(code, detail) {
|
|
107386
107409
|
super(`${PREFIX}${code}: ${detail}`);
|
|
107387
107410
|
this.name = "RecordsError";
|
|
@@ -107390,29 +107413,33 @@ var RecordsError = class extends Error {
|
|
|
107390
107413
|
}
|
|
107391
107414
|
};
|
|
107392
107415
|
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
107393
|
-
var RevConflictError = class extends RecordsError {
|
|
107416
|
+
var RevConflictError = class RevConflictError extends RecordsError {
|
|
107417
|
+
static code = "rev-conflict";
|
|
107394
107418
|
constructor(detail) {
|
|
107395
|
-
super(
|
|
107419
|
+
super(RevConflictError.code, detail);
|
|
107396
107420
|
this.name = "RevConflictError";
|
|
107397
107421
|
}
|
|
107398
107422
|
};
|
|
107399
107423
|
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
107400
|
-
var RecordSecretUnavailableError = class extends RecordsError {
|
|
107424
|
+
var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
|
|
107425
|
+
static code = "secret-unavailable";
|
|
107401
107426
|
constructor(detail) {
|
|
107402
|
-
super(
|
|
107427
|
+
super(RecordSecretUnavailableError.code, detail);
|
|
107403
107428
|
this.name = "RecordSecretUnavailableError";
|
|
107404
107429
|
}
|
|
107405
107430
|
};
|
|
107406
|
-
var InvalidRecordError = class extends RecordsError {
|
|
107431
|
+
var InvalidRecordError = class InvalidRecordError extends RecordsError {
|
|
107432
|
+
static code = "invalid-record";
|
|
107407
107433
|
constructor(detail) {
|
|
107408
|
-
super(
|
|
107434
|
+
super(InvalidRecordError.code, detail);
|
|
107409
107435
|
this.name = "InvalidRecordError";
|
|
107410
107436
|
}
|
|
107411
107437
|
};
|
|
107412
107438
|
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
107413
|
-
var DeclarationRefusedError = class extends RecordsError {
|
|
107439
|
+
var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
|
|
107440
|
+
static code = "declaration-refused";
|
|
107414
107441
|
constructor(detail) {
|
|
107415
|
-
super(
|
|
107442
|
+
super(DeclarationRefusedError.code, detail);
|
|
107416
107443
|
this.name = "DeclarationRefusedError";
|
|
107417
107444
|
}
|
|
107418
107445
|
};
|
|
@@ -110223,286 +110250,6 @@ function normalizeAddonInitResult(result) {
|
|
|
110223
110250
|
if (Array.isArray(result)) return { providers: result };
|
|
110224
110251
|
return result;
|
|
110225
110252
|
}
|
|
110226
|
-
/**
|
|
110227
|
-
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
110228
|
-
* and validates them (`ShareViewGrantSchema` builds its
|
|
110229
|
-
* enum from this list); a data plane names the kinds it ACCEPTS in `share`.
|
|
110230
|
-
*/
|
|
110231
|
-
var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
|
|
110232
|
-
/** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
|
|
110233
|
-
var PeerBytesTicketSchema = object({
|
|
110234
|
-
/** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
|
|
110235
|
-
url: string().min(1),
|
|
110236
|
-
/**
|
|
110237
|
-
* The HOST node this URL means something on — the hub or a named agent,
|
|
110238
|
-
* never a runner. {@link AddonPeerBytes.open} compares it to its own and
|
|
110239
|
-
* refuses `cross-node` by name when they differ, without dialling.
|
|
110240
|
-
*/
|
|
110241
|
-
hostNodeId: string().min(1),
|
|
110242
|
-
expiresAtMs: number().int().nonnegative(),
|
|
110243
|
-
/**
|
|
110244
|
-
* What the producer DECLARED the body to be, when it knows — `null` when it
|
|
110245
|
-
* does not. Never `0` for unknown (D393): a consumer sizing a bound off this
|
|
110246
|
-
* must be able to tell "the producer did not say" from "the body is empty".
|
|
110247
|
-
*/
|
|
110248
|
-
declaredBytes: number().int().nonnegative().nullable()
|
|
110249
|
-
});
|
|
110250
|
-
function defOf(schema) {
|
|
110251
|
-
const zodBag = Reflect.get(schema, "_zod");
|
|
110252
|
-
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
110253
|
-
const def = Reflect.get(zodBag, "def");
|
|
110254
|
-
if (typeof def !== "object" || def === null) return {};
|
|
110255
|
-
return def;
|
|
110256
|
-
}
|
|
110257
|
-
function declaredHere(schema) {
|
|
110258
|
-
return globalRegistry.get(schema)?.secret === true;
|
|
110259
|
-
}
|
|
110260
|
-
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
110261
|
-
var WRAPPERS = new Set([
|
|
110262
|
-
"optional",
|
|
110263
|
-
"nullable",
|
|
110264
|
-
"default",
|
|
110265
|
-
"prefault",
|
|
110266
|
-
"catch",
|
|
110267
|
-
"readonly",
|
|
110268
|
-
"nonoptional"
|
|
110269
|
-
]);
|
|
110270
|
-
/**
|
|
110271
|
-
* The schema layers that make up ONE field: the schema itself and every
|
|
110272
|
-
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
110273
|
-
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
110274
|
-
* `.transform` on `in`).
|
|
110275
|
-
*/
|
|
110276
|
-
function layersOf(schema) {
|
|
110277
|
-
const out = [];
|
|
110278
|
-
const queue = [schema];
|
|
110279
|
-
while (queue.length > 0) {
|
|
110280
|
-
const s = queue.shift();
|
|
110281
|
-
if (!s || out.includes(s)) continue;
|
|
110282
|
-
out.push(s);
|
|
110283
|
-
const def = defOf(s);
|
|
110284
|
-
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
110285
|
-
if (def.type === "pipe") {
|
|
110286
|
-
if (def.in) queue.push(def.in);
|
|
110287
|
-
if (def.out) queue.push(def.out);
|
|
110288
|
-
}
|
|
110289
|
-
}
|
|
110290
|
-
return out;
|
|
110291
|
-
}
|
|
110292
|
-
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
110293
|
-
function isZodSecret(schema) {
|
|
110294
|
-
return layersOf(schema).some(declaredHere);
|
|
110295
|
-
}
|
|
110296
|
-
/**
|
|
110297
|
-
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
110298
|
-
* element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
|
|
110299
|
-
* map" (`applianceSecrets{}`). A declared
|
|
110300
|
-
* object or array is reported as one path and not descended into — everything
|
|
110301
|
-
* under it is secret.
|
|
110302
|
-
*/
|
|
110303
|
-
function collectZodSecretPaths(schema, prefix = "") {
|
|
110304
|
-
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
110305
|
-
const paths = [];
|
|
110306
|
-
for (const layer of layersOf(schema)) {
|
|
110307
|
-
const def = defOf(layer);
|
|
110308
|
-
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
110309
|
-
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
110310
|
-
else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
|
|
110311
|
-
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
110312
|
-
else if (def.type === "intersection") {
|
|
110313
|
-
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
110314
|
-
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
110315
|
-
}
|
|
110316
|
-
}
|
|
110317
|
-
return [...new Set(paths)];
|
|
110318
|
-
}
|
|
110319
|
-
/**
|
|
110320
|
-
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
110321
|
-
* Zod row schema that describes it, and the helper that turns the two into the
|
|
110322
|
-
* JSON the engine stores.
|
|
110323
|
-
*
|
|
110324
|
-
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
110325
|
-
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
110326
|
-
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
110327
|
-
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
110328
|
-
* never a field name (D879).
|
|
110329
|
-
*/
|
|
110330
|
-
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
110331
|
-
var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
110332
|
-
var RecordIndexSchema = object({
|
|
110333
|
-
name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
110334
|
-
fields: array(RecordFieldPathSchema).min(1).max(4),
|
|
110335
|
-
unique: boolean().optional()
|
|
110336
|
-
}).strict();
|
|
110337
|
-
var RecordRetentionSchema = union([
|
|
110338
|
-
object({
|
|
110339
|
-
ttlMs: number().int().positive(),
|
|
110340
|
-
from: _enum(["at", "write"])
|
|
110341
|
-
}).strict(),
|
|
110342
|
-
object({
|
|
110343
|
-
maxRows: number().int().positive().optional(),
|
|
110344
|
-
maxRowsPerDevice: number().int().positive().optional()
|
|
110345
|
-
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
110346
|
-
object({
|
|
110347
|
-
owner: string().min(1),
|
|
110348
|
-
reason: string().min(1)
|
|
110349
|
-
}).strict(),
|
|
110350
|
-
object({ none: string().min(1) }).strict()
|
|
110351
|
-
]);
|
|
110352
|
-
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
110353
|
-
var EntryDescriptorSchema = object({
|
|
110354
|
-
title: string().min(1),
|
|
110355
|
-
/** The record body field shown as the entry's name. */
|
|
110356
|
-
nameField: string().min(1),
|
|
110357
|
-
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
110358
|
-
fields: record(string(), unknown())
|
|
110359
|
-
}).strict();
|
|
110360
|
-
/** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
|
|
110361
|
-
var RecordKindDeclarationSchema = object({
|
|
110362
|
-
database: _enum(RECORD_DATABASES).default("settings"),
|
|
110363
|
-
class: _enum(RECORD_CLASSES),
|
|
110364
|
-
writeTrigger: string().min(1),
|
|
110365
|
-
device: _enum([
|
|
110366
|
-
"required",
|
|
110367
|
-
"optional",
|
|
110368
|
-
"none"
|
|
110369
|
-
]).default("none"),
|
|
110370
|
-
at: _enum(["required", "none"]).default("none"),
|
|
110371
|
-
indexes: array(RecordIndexSchema).max(8).default([]),
|
|
110372
|
-
retention: RecordRetentionSchema,
|
|
110373
|
-
deviceRemoval: _enum(["delete", "none"]).default("none"),
|
|
110374
|
-
maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
110375
|
-
/** Derived from the Zod schema; never written by hand. */
|
|
110376
|
-
secretPaths: array(string().min(1)).default([]),
|
|
110377
|
-
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
110378
|
-
secretArrayKeys: record(string(), string()).default({}),
|
|
110379
|
-
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
110380
|
-
transactFamily: string().min(1).optional(),
|
|
110381
|
-
entry: EntryDescriptorSchema.optional()
|
|
110382
|
-
}).strict();
|
|
110383
|
-
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
110384
|
-
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
110385
|
-
/** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
|
|
110386
|
-
function assertValidDeclaration(name, decl) {
|
|
110387
|
-
const refuse = (why) => {
|
|
110388
|
-
throw new DeclarationRefusedError(`kind "${name}": ${why}`);
|
|
110389
|
-
};
|
|
110390
|
-
if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
|
|
110391
|
-
const seen = /* @__PURE__ */ new Set();
|
|
110392
|
-
for (const index of decl.indexes) {
|
|
110393
|
-
if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
|
|
110394
|
-
seen.add(index.name);
|
|
110395
|
-
}
|
|
110396
|
-
const { retention } = decl;
|
|
110397
|
-
const hasSecrets = decl.secretPaths.length > 0;
|
|
110398
|
-
if ("ttlMs" in retention) {
|
|
110399
|
-
if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
|
|
110400
|
-
if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
|
|
110401
|
-
}
|
|
110402
|
-
if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
|
|
110403
|
-
if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
|
|
110404
|
-
if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
|
|
110405
|
-
if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
|
|
110406
|
-
const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
|
|
110407
|
-
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)`);
|
|
110408
|
-
}
|
|
110409
|
-
if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
|
|
110410
|
-
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`);
|
|
110411
|
-
}
|
|
110412
|
-
function bodyFieldsOf(schema) {
|
|
110413
|
-
return { ...toJSONSchema(schema, {
|
|
110414
|
-
unrepresentable: "any",
|
|
110415
|
-
io: "input"
|
|
110416
|
-
}) };
|
|
110417
|
-
}
|
|
110418
|
-
function isRecordLike(value) {
|
|
110419
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
110420
|
-
}
|
|
110421
|
-
/** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
|
|
110422
|
-
function hasNameField(json, field) {
|
|
110423
|
-
const branches = json["oneOf"] ?? json["anyOf"];
|
|
110424
|
-
if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
|
|
110425
|
-
const properties = json["properties"];
|
|
110426
|
-
return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
|
|
110427
|
-
}
|
|
110428
|
-
/**
|
|
110429
|
-
* Declare the kinds of a package. The keys are the kind names. The result is
|
|
110430
|
-
* what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
|
|
110431
|
-
* types its handle from.
|
|
110432
|
-
*/
|
|
110433
|
-
function defineRecordKinds(specs) {
|
|
110434
|
-
const out = {};
|
|
110435
|
-
for (const [name, spec] of Object.entries(specs)) {
|
|
110436
|
-
const secretPaths = collectZodSecretPaths(spec.schema);
|
|
110437
|
-
const nameField = spec.entry?.nameField ?? "name";
|
|
110438
|
-
const fields = bodyFieldsOf(spec.schema);
|
|
110439
|
-
if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
|
|
110440
|
-
const parsed = RecordKindDeclarationSchema.parse({
|
|
110441
|
-
database: spec.database,
|
|
110442
|
-
class: spec.class,
|
|
110443
|
-
writeTrigger: spec.writeTrigger,
|
|
110444
|
-
device: spec.device,
|
|
110445
|
-
at: spec.at,
|
|
110446
|
-
indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
|
|
110447
|
-
retention: spec.retention,
|
|
110448
|
-
deviceRemoval: spec.deviceRemoval,
|
|
110449
|
-
maxDataBytes: spec.maxDataBytes,
|
|
110450
|
-
secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
|
|
110451
|
-
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
110452
|
-
transactFamily: spec.transactFamily,
|
|
110453
|
-
entry: spec.entry === void 0 ? void 0 : {
|
|
110454
|
-
title: spec.entry.title,
|
|
110455
|
-
nameField,
|
|
110456
|
-
fields
|
|
110457
|
-
}
|
|
110458
|
-
});
|
|
110459
|
-
assertValidDeclaration(name, parsed);
|
|
110460
|
-
out[name] = {
|
|
110461
|
-
name,
|
|
110462
|
-
schema: spec.schema,
|
|
110463
|
-
declaration: parsed
|
|
110464
|
-
};
|
|
110465
|
-
}
|
|
110466
|
-
return out;
|
|
110467
|
-
}
|
|
110468
|
-
/**
|
|
110469
|
-
* Entry kinds (D881): every list of user-created entries (notification
|
|
110470
|
-
* targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
|
|
110471
|
-
* kind-specific body, and the admin UI lists/adds/edits/deletes all of them
|
|
110472
|
-
* through the `record-entries` capability with password fields derived from
|
|
110473
|
-
* the schema (`.meta({ secret: true })`).
|
|
110474
|
-
*/
|
|
110475
|
-
/** The body of a plain entry: a name and the fields the kind adds. */
|
|
110476
|
-
function entryBody(shape) {
|
|
110477
|
-
return object({
|
|
110478
|
-
name: string().min(1),
|
|
110479
|
-
enabled: boolean().optional(),
|
|
110480
|
-
...shape
|
|
110481
|
-
});
|
|
110482
|
-
}
|
|
110483
|
-
/**
|
|
110484
|
-
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
110485
|
-
* engine, never aged, belonging to no device.
|
|
110486
|
-
*/
|
|
110487
|
-
function defineEntryKind(name, spec) {
|
|
110488
|
-
const defined = defineRecordKinds({ [name]: {
|
|
110489
|
-
schema: spec.schema,
|
|
110490
|
-
class: "config",
|
|
110491
|
-
writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
|
|
110492
|
-
retention: { none: "an entry goes only when the operator deletes it" },
|
|
110493
|
-
...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
|
|
110494
|
-
...spec.database === void 0 ? {} : { database: spec.database },
|
|
110495
|
-
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
110496
|
-
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
110497
|
-
...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
|
|
110498
|
-
entry: {
|
|
110499
|
-
title: spec.title,
|
|
110500
|
-
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
110501
|
-
}
|
|
110502
|
-
} })[name];
|
|
110503
|
-
if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
|
|
110504
|
-
return defined;
|
|
110505
|
-
}
|
|
110506
110253
|
object({
|
|
110507
110254
|
field: string().min(1),
|
|
110508
110255
|
on: literal("advance")
|
|
@@ -110595,6 +110342,286 @@ function optionalMethod(input, output, options) {
|
|
|
110595
110342
|
function event(data) {
|
|
110596
110343
|
return { data };
|
|
110597
110344
|
}
|
|
110345
|
+
function defOf(schema) {
|
|
110346
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
110347
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
110348
|
+
const def = Reflect.get(zodBag, "def");
|
|
110349
|
+
if (typeof def !== "object" || def === null) return {};
|
|
110350
|
+
return def;
|
|
110351
|
+
}
|
|
110352
|
+
function declaredHere(schema) {
|
|
110353
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
110354
|
+
}
|
|
110355
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
110356
|
+
var WRAPPERS = new Set([
|
|
110357
|
+
"optional",
|
|
110358
|
+
"nullable",
|
|
110359
|
+
"default",
|
|
110360
|
+
"prefault",
|
|
110361
|
+
"catch",
|
|
110362
|
+
"readonly",
|
|
110363
|
+
"nonoptional"
|
|
110364
|
+
]);
|
|
110365
|
+
/**
|
|
110366
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
110367
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
110368
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
110369
|
+
* `.transform` on `in`).
|
|
110370
|
+
*/
|
|
110371
|
+
function layersOf(schema) {
|
|
110372
|
+
const out = [];
|
|
110373
|
+
const queue = [schema];
|
|
110374
|
+
while (queue.length > 0) {
|
|
110375
|
+
const s = queue.shift();
|
|
110376
|
+
if (!s || out.includes(s)) continue;
|
|
110377
|
+
out.push(s);
|
|
110378
|
+
const def = defOf(s);
|
|
110379
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
110380
|
+
if (def.type === "pipe") {
|
|
110381
|
+
if (def.in) queue.push(def.in);
|
|
110382
|
+
if (def.out) queue.push(def.out);
|
|
110383
|
+
}
|
|
110384
|
+
}
|
|
110385
|
+
return out;
|
|
110386
|
+
}
|
|
110387
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
110388
|
+
function isZodSecret(schema) {
|
|
110389
|
+
return layersOf(schema).some(declaredHere);
|
|
110390
|
+
}
|
|
110391
|
+
/**
|
|
110392
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
110393
|
+
* element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
|
|
110394
|
+
* map" (`applianceSecrets{}`). A declared
|
|
110395
|
+
* object or array is reported as one path and not descended into — everything
|
|
110396
|
+
* under it is secret.
|
|
110397
|
+
*/
|
|
110398
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
110399
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
110400
|
+
const paths = [];
|
|
110401
|
+
for (const layer of layersOf(schema)) {
|
|
110402
|
+
const def = defOf(layer);
|
|
110403
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
110404
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
110405
|
+
else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
|
|
110406
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
110407
|
+
else if (def.type === "intersection") {
|
|
110408
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
110409
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
110410
|
+
}
|
|
110411
|
+
}
|
|
110412
|
+
return [...new Set(paths)];
|
|
110413
|
+
}
|
|
110414
|
+
/**
|
|
110415
|
+
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
110416
|
+
* Zod row schema that describes it, and the helper that turns the two into the
|
|
110417
|
+
* JSON the engine stores.
|
|
110418
|
+
*
|
|
110419
|
+
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
110420
|
+
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
110421
|
+
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
110422
|
+
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
110423
|
+
* never a field name (D879).
|
|
110424
|
+
*/
|
|
110425
|
+
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
110426
|
+
var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
110427
|
+
var RecordIndexSchema = object({
|
|
110428
|
+
name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
110429
|
+
fields: array(RecordFieldPathSchema).min(1).max(4),
|
|
110430
|
+
unique: boolean().optional()
|
|
110431
|
+
}).strict();
|
|
110432
|
+
var RecordRetentionSchema = union([
|
|
110433
|
+
object({
|
|
110434
|
+
ttlMs: number().int().positive(),
|
|
110435
|
+
from: _enum(["at", "write"])
|
|
110436
|
+
}).strict(),
|
|
110437
|
+
object({
|
|
110438
|
+
maxRows: number().int().positive().optional(),
|
|
110439
|
+
maxRowsPerDevice: number().int().positive().optional()
|
|
110440
|
+
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
110441
|
+
object({
|
|
110442
|
+
owner: string().min(1),
|
|
110443
|
+
reason: string().min(1)
|
|
110444
|
+
}).strict(),
|
|
110445
|
+
object({ none: string().min(1) }).strict()
|
|
110446
|
+
]);
|
|
110447
|
+
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
110448
|
+
var EntryDescriptorSchema = object({
|
|
110449
|
+
title: string().min(1),
|
|
110450
|
+
/** The record body field shown as the entry's name. */
|
|
110451
|
+
nameField: string().min(1),
|
|
110452
|
+
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
110453
|
+
fields: record(string(), unknown())
|
|
110454
|
+
}).strict();
|
|
110455
|
+
/** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
|
|
110456
|
+
var RecordKindDeclarationSchema = object({
|
|
110457
|
+
database: _enum(RECORD_DATABASES).default("settings"),
|
|
110458
|
+
class: _enum(RECORD_CLASSES),
|
|
110459
|
+
writeTrigger: string().min(1),
|
|
110460
|
+
device: _enum([
|
|
110461
|
+
"required",
|
|
110462
|
+
"optional",
|
|
110463
|
+
"none"
|
|
110464
|
+
]).default("none"),
|
|
110465
|
+
at: _enum(["required", "none"]).default("none"),
|
|
110466
|
+
indexes: array(RecordIndexSchema).max(8).default([]),
|
|
110467
|
+
retention: RecordRetentionSchema,
|
|
110468
|
+
deviceRemoval: _enum(["delete", "none"]).default("none"),
|
|
110469
|
+
maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
110470
|
+
/** Derived from the Zod schema; never written by hand. */
|
|
110471
|
+
secretPaths: array(string().min(1)).default([]),
|
|
110472
|
+
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
110473
|
+
secretArrayKeys: record(string(), string()).default({}),
|
|
110474
|
+
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
110475
|
+
transactFamily: string().min(1).optional(),
|
|
110476
|
+
entry: EntryDescriptorSchema.optional()
|
|
110477
|
+
}).strict();
|
|
110478
|
+
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
110479
|
+
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
110480
|
+
/** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
|
|
110481
|
+
function assertValidDeclaration(name, decl) {
|
|
110482
|
+
const refuse = (why) => {
|
|
110483
|
+
throw new DeclarationRefusedError(`kind "${name}": ${why}`);
|
|
110484
|
+
};
|
|
110485
|
+
if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
|
|
110486
|
+
const seen = /* @__PURE__ */ new Set();
|
|
110487
|
+
for (const index of decl.indexes) {
|
|
110488
|
+
if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
|
|
110489
|
+
seen.add(index.name);
|
|
110490
|
+
}
|
|
110491
|
+
const { retention } = decl;
|
|
110492
|
+
const hasSecrets = decl.secretPaths.length > 0;
|
|
110493
|
+
if ("ttlMs" in retention) {
|
|
110494
|
+
if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
|
|
110495
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
|
|
110496
|
+
}
|
|
110497
|
+
if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
|
|
110498
|
+
if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
|
|
110499
|
+
if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
|
|
110500
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
|
|
110501
|
+
const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
|
|
110502
|
+
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)`);
|
|
110503
|
+
}
|
|
110504
|
+
if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
|
|
110505
|
+
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`);
|
|
110506
|
+
}
|
|
110507
|
+
function bodyFieldsOf(schema) {
|
|
110508
|
+
return { ...toJSONSchema(schema, {
|
|
110509
|
+
unrepresentable: "any",
|
|
110510
|
+
io: "input"
|
|
110511
|
+
}) };
|
|
110512
|
+
}
|
|
110513
|
+
function isRecordLike(value) {
|
|
110514
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
110515
|
+
}
|
|
110516
|
+
/** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
|
|
110517
|
+
function hasNameField(json, field) {
|
|
110518
|
+
const branches = json["oneOf"] ?? json["anyOf"];
|
|
110519
|
+
if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
|
|
110520
|
+
const properties = json["properties"];
|
|
110521
|
+
return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
|
|
110522
|
+
}
|
|
110523
|
+
/**
|
|
110524
|
+
* Declare the kinds of a package. The keys are the kind names. The result is
|
|
110525
|
+
* what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
|
|
110526
|
+
* types its handle from.
|
|
110527
|
+
*/
|
|
110528
|
+
function defineRecordKinds(specs) {
|
|
110529
|
+
const out = {};
|
|
110530
|
+
for (const [name, spec] of Object.entries(specs)) {
|
|
110531
|
+
const secretPaths = collectZodSecretPaths(spec.schema);
|
|
110532
|
+
const nameField = spec.entry?.nameField ?? "name";
|
|
110533
|
+
const fields = bodyFieldsOf(spec.schema);
|
|
110534
|
+
if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
|
|
110535
|
+
const parsed = RecordKindDeclarationSchema.parse({
|
|
110536
|
+
database: spec.database,
|
|
110537
|
+
class: spec.class,
|
|
110538
|
+
writeTrigger: spec.writeTrigger,
|
|
110539
|
+
device: spec.device,
|
|
110540
|
+
at: spec.at,
|
|
110541
|
+
indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
|
|
110542
|
+
retention: spec.retention,
|
|
110543
|
+
deviceRemoval: spec.deviceRemoval,
|
|
110544
|
+
maxDataBytes: spec.maxDataBytes,
|
|
110545
|
+
secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
|
|
110546
|
+
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
110547
|
+
transactFamily: spec.transactFamily,
|
|
110548
|
+
entry: spec.entry === void 0 ? void 0 : {
|
|
110549
|
+
title: spec.entry.title,
|
|
110550
|
+
nameField,
|
|
110551
|
+
fields
|
|
110552
|
+
}
|
|
110553
|
+
});
|
|
110554
|
+
assertValidDeclaration(name, parsed);
|
|
110555
|
+
out[name] = {
|
|
110556
|
+
name,
|
|
110557
|
+
schema: spec.schema,
|
|
110558
|
+
declaration: parsed
|
|
110559
|
+
};
|
|
110560
|
+
}
|
|
110561
|
+
return out;
|
|
110562
|
+
}
|
|
110563
|
+
/**
|
|
110564
|
+
* Entry kinds (D881): every list of user-created entries (notification
|
|
110565
|
+
* targets, brokers, LLM profiles) is ONE record kind with an id, a name and a
|
|
110566
|
+
* kind-specific body, and the admin UI lists/adds/edits/deletes all of them
|
|
110567
|
+
* through the `record-entries` capability with password fields derived from
|
|
110568
|
+
* the schema (`.meta({ secret: true })`).
|
|
110569
|
+
*/
|
|
110570
|
+
/** The body of a plain entry: a name and the fields the kind adds. */
|
|
110571
|
+
function entryBody(shape) {
|
|
110572
|
+
return object({
|
|
110573
|
+
name: string().min(1),
|
|
110574
|
+
enabled: boolean().optional(),
|
|
110575
|
+
...shape
|
|
110576
|
+
});
|
|
110577
|
+
}
|
|
110578
|
+
/**
|
|
110579
|
+
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
110580
|
+
* engine, never aged, belonging to no device.
|
|
110581
|
+
*/
|
|
110582
|
+
function defineEntryKind(name, spec) {
|
|
110583
|
+
const defined = defineRecordKinds({ [name]: {
|
|
110584
|
+
schema: spec.schema,
|
|
110585
|
+
class: "config",
|
|
110586
|
+
writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
|
|
110587
|
+
retention: { none: "an entry goes only when the operator deletes it" },
|
|
110588
|
+
...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
|
|
110589
|
+
...spec.database === void 0 ? {} : { database: spec.database },
|
|
110590
|
+
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
110591
|
+
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
110592
|
+
...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
|
|
110593
|
+
entry: {
|
|
110594
|
+
title: spec.title,
|
|
110595
|
+
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
110596
|
+
}
|
|
110597
|
+
} })[name];
|
|
110598
|
+
if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
|
|
110599
|
+
return defined;
|
|
110600
|
+
}
|
|
110601
|
+
/**
|
|
110602
|
+
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
110603
|
+
* and validates them (`ShareViewGrantSchema` builds its
|
|
110604
|
+
* enum from this list); a data plane names the kinds it ACCEPTS in `share`.
|
|
110605
|
+
*/
|
|
110606
|
+
var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
|
|
110607
|
+
/** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
|
|
110608
|
+
var PeerBytesTicketSchema = object({
|
|
110609
|
+
/** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
|
|
110610
|
+
url: string().min(1),
|
|
110611
|
+
/**
|
|
110612
|
+
* The HOST node this URL means something on — the hub or a named agent,
|
|
110613
|
+
* never a runner. {@link AddonPeerBytes.open} compares it to its own and
|
|
110614
|
+
* refuses `cross-node` by name when they differ, without dialling.
|
|
110615
|
+
*/
|
|
110616
|
+
hostNodeId: string().min(1),
|
|
110617
|
+
expiresAtMs: number().int().nonnegative(),
|
|
110618
|
+
/**
|
|
110619
|
+
* What the producer DECLARED the body to be, when it knows — `null` when it
|
|
110620
|
+
* does not. Never `0` for unknown (D393): a consumer sizing a bound off this
|
|
110621
|
+
* must be able to tell "the producer did not say" from "the body is empty".
|
|
110622
|
+
*/
|
|
110623
|
+
declaredBytes: number().int().nonnegative().nullable()
|
|
110624
|
+
});
|
|
110598
110625
|
var READING_QUANTITIES = [
|
|
110599
110626
|
"temperature",
|
|
110600
110627
|
"pressure",
|
|
@@ -111282,7 +111309,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
111282
111309
|
"climate-control",
|
|
111283
111310
|
"color",
|
|
111284
111311
|
"composer",
|
|
111285
|
-
"connection-test",
|
|
111286
111312
|
"connectivity",
|
|
111287
111313
|
"consumables",
|
|
111288
111314
|
"contact",
|
|
@@ -113302,8 +113328,7 @@ Object.freeze({
|
|
|
113302
113328
|
"offerArtifact": 3e5,
|
|
113303
113329
|
"readResult": 3e5,
|
|
113304
113330
|
"submitJob": 18e5,
|
|
113305
|
-
"uploadDataset": 72e5
|
|
113306
|
-
"validateCredentials": 3e4
|
|
113331
|
+
"uploadDataset": 72e5
|
|
113307
113332
|
}
|
|
113308
113333
|
});
|
|
113309
113334
|
object({
|
|
@@ -114717,6 +114742,432 @@ var IntegrationInstanceRefSchema = object({
|
|
|
114717
114742
|
]),
|
|
114718
114743
|
candidateStableId: string().optional()
|
|
114719
114744
|
});
|
|
114745
|
+
/**
|
|
114746
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
114747
|
+
*
|
|
114748
|
+
* Apprise-derived model (see
|
|
114749
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
114750
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
114751
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
114752
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
114753
|
+
* message to what the kind supports — callers never special-case a service.
|
|
114754
|
+
*
|
|
114755
|
+
* DESIGN DECISIONS (locked):
|
|
114756
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
114757
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
114758
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
114759
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
114760
|
+
* alternative would fork the UI per addon and cannot host the
|
|
114761
|
+
* discovery→adopt flow.
|
|
114762
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
114763
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
114764
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
114765
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
114766
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
114767
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
114768
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
114769
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
114770
|
+
* base64 fallback needed.
|
|
114771
|
+
*
|
|
114772
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
114773
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
114774
|
+
* admin "Integrations" page.
|
|
114775
|
+
*/
|
|
114776
|
+
/**
|
|
114777
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
114778
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
114779
|
+
*/
|
|
114780
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
114781
|
+
"image",
|
|
114782
|
+
"video",
|
|
114783
|
+
"gif",
|
|
114784
|
+
"audio",
|
|
114785
|
+
"icon"
|
|
114786
|
+
]);
|
|
114787
|
+
/**
|
|
114788
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
114789
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
114790
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
114791
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
114792
|
+
*/
|
|
114793
|
+
var AttachmentSchema = object({
|
|
114794
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
114795
|
+
url: string().optional(),
|
|
114796
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
114797
|
+
mime: string().optional(),
|
|
114798
|
+
name: string().optional()
|
|
114799
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
114800
|
+
var NotificationFormatSchema = _enum([
|
|
114801
|
+
"text",
|
|
114802
|
+
"markdown",
|
|
114803
|
+
"html"
|
|
114804
|
+
]);
|
|
114805
|
+
/**
|
|
114806
|
+
* The CLOSED icon vocabulary an action button may use.
|
|
114807
|
+
*
|
|
114808
|
+
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
114809
|
+
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
114810
|
+
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
114811
|
+
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
114812
|
+
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
114813
|
+
*
|
|
114814
|
+
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
114815
|
+
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
114816
|
+
* differently.
|
|
114817
|
+
*
|
|
114818
|
+
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
114819
|
+
*
|
|
114820
|
+
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
114821
|
+
* the whole set onto its own renderer's vocabulary through a
|
|
114822
|
+
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
114823
|
+
* fallback, so adding a member here fails every adapter's build until someone
|
|
114824
|
+
* decides its glyph, which is the only place that decision can be made
|
|
114825
|
+
* honestly.
|
|
114826
|
+
*
|
|
114827
|
+
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
114828
|
+
* `disarm` straight through; iOS feeds that string to
|
|
114829
|
+
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
114830
|
+
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
114831
|
+
* mapping, and "the field is documented" is not "the value renders".
|
|
114832
|
+
*
|
|
114833
|
+
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
114834
|
+
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
114835
|
+
* so an addon that emits a token the running hub does not know does not lose an
|
|
114836
|
+
* icon — its whole `send` fails Zod validation and the notification never
|
|
114837
|
+
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
114838
|
+
*/
|
|
114839
|
+
var NotificationActionIconSchema = _enum([
|
|
114840
|
+
"acknowledge",
|
|
114841
|
+
"dismiss",
|
|
114842
|
+
"silence",
|
|
114843
|
+
"snooze",
|
|
114844
|
+
"view",
|
|
114845
|
+
"play",
|
|
114846
|
+
"open",
|
|
114847
|
+
"close",
|
|
114848
|
+
"lock",
|
|
114849
|
+
"unlock",
|
|
114850
|
+
"arm",
|
|
114851
|
+
"arm-home",
|
|
114852
|
+
"arm-away",
|
|
114853
|
+
"arm-night",
|
|
114854
|
+
"disarm",
|
|
114855
|
+
"light",
|
|
114856
|
+
"alert",
|
|
114857
|
+
"camera"
|
|
114858
|
+
]);
|
|
114859
|
+
/** A single tap-through action button. */
|
|
114860
|
+
var NotificationActionSchema = object({
|
|
114861
|
+
id: string(),
|
|
114862
|
+
label: string(),
|
|
114863
|
+
url: string().optional(),
|
|
114864
|
+
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
114865
|
+
icon: NotificationActionIconSchema.optional(),
|
|
114866
|
+
/**
|
|
114867
|
+
* Renders in a warning style where the notifier supports it.
|
|
114868
|
+
*
|
|
114869
|
+
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
114870
|
+
* else — see `notification-center/action-token.ts` for what that does and
|
|
114871
|
+
* does not buy.
|
|
114872
|
+
*/
|
|
114873
|
+
destructive: boolean().optional(),
|
|
114874
|
+
/**
|
|
114875
|
+
* How the tap should REACH the url.
|
|
114876
|
+
*
|
|
114877
|
+
* `navigate` (absent, and every button authored before this field) opens it:
|
|
114878
|
+
* the phone leaves the notification and shows whatever the callback returns.
|
|
114879
|
+
* That is right for a button whose answer the operator wants to read.
|
|
114880
|
+
*
|
|
114881
|
+
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
114882
|
+
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
114883
|
+
* an answer to the notification, and being thrown into a browser tab to
|
|
114884
|
+
* confirm it costs more attention than the notification did. A backend that
|
|
114885
|
+
* cannot do a background call renders it as an ordinary link (the adapters
|
|
114886
|
+
* fall back rather than dropping the button), so this is a preference, never
|
|
114887
|
+
* a requirement.
|
|
114888
|
+
*/
|
|
114889
|
+
mode: _enum(["navigate", "background"]).optional()
|
|
114890
|
+
});
|
|
114891
|
+
/** A delivery parameter value: what a notifier declared it takes. */
|
|
114892
|
+
var DeliveryParamValueSchema = union([
|
|
114893
|
+
string(),
|
|
114894
|
+
number(),
|
|
114895
|
+
boolean()
|
|
114896
|
+
]);
|
|
114897
|
+
/**
|
|
114898
|
+
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
114899
|
+
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
114900
|
+
* never handed one. The admin UI derives its control from this descriptor —
|
|
114901
|
+
* no editor knows a service by name.
|
|
114902
|
+
*
|
|
114903
|
+
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
114904
|
+
* run on the addon cap path).
|
|
114905
|
+
*/
|
|
114906
|
+
var DeliveryParamSchema = object({
|
|
114907
|
+
key: string().min(1),
|
|
114908
|
+
label: string(),
|
|
114909
|
+
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
114910
|
+
labelKey: string().optional(),
|
|
114911
|
+
type: _enum([
|
|
114912
|
+
"enum",
|
|
114913
|
+
"number",
|
|
114914
|
+
"boolean",
|
|
114915
|
+
"string"
|
|
114916
|
+
]),
|
|
114917
|
+
/** `enum` only: the closed set of accepted values. */
|
|
114918
|
+
options: array(object({
|
|
114919
|
+
value: string(),
|
|
114920
|
+
label: string()
|
|
114921
|
+
})).optional(),
|
|
114922
|
+
/** `number` only. */
|
|
114923
|
+
min: number().optional(),
|
|
114924
|
+
max: number().optional(),
|
|
114925
|
+
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
114926
|
+
default: DeliveryParamValueSchema.optional()
|
|
114927
|
+
});
|
|
114928
|
+
/**
|
|
114929
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
114930
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
114931
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
114932
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
114933
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
114934
|
+
* `priority` for that one target.
|
|
114935
|
+
*/
|
|
114936
|
+
var NotificationSchema = object({
|
|
114937
|
+
body: string(),
|
|
114938
|
+
title: string().optional(),
|
|
114939
|
+
format: NotificationFormatSchema.default("text"),
|
|
114940
|
+
priority: number().int().min(1).max(5).default(3),
|
|
114941
|
+
level: string().optional(),
|
|
114942
|
+
attachments: array(AttachmentSchema).optional(),
|
|
114943
|
+
clickUrl: string().optional(),
|
|
114944
|
+
actions: array(NotificationActionSchema).optional(),
|
|
114945
|
+
sound: string().optional(),
|
|
114946
|
+
ttl: number().optional(),
|
|
114947
|
+
tag: string().optional(),
|
|
114948
|
+
deviceId: number().optional(),
|
|
114949
|
+
eventId: string().optional(),
|
|
114950
|
+
metadata: record(string(), unknown()).optional(),
|
|
114951
|
+
/**
|
|
114952
|
+
* Values for the parameters the target's kind DECLARES in
|
|
114953
|
+
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
114954
|
+
* declaration by the sender; a notifier reads only the keys it declared.
|
|
114955
|
+
*/
|
|
114956
|
+
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
114957
|
+
});
|
|
114958
|
+
/** One declared native severity/priority level for a kind. */
|
|
114959
|
+
var TargetKindLevelSchema = object({
|
|
114960
|
+
id: string(),
|
|
114961
|
+
label: string(),
|
|
114962
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
114963
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
114964
|
+
flags: object({
|
|
114965
|
+
critical: boolean().optional(),
|
|
114966
|
+
silent: boolean().optional(),
|
|
114967
|
+
noPush: boolean().optional()
|
|
114968
|
+
}).optional(),
|
|
114969
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
114970
|
+
requires: array(string()).optional(),
|
|
114971
|
+
description: string().optional()
|
|
114972
|
+
});
|
|
114973
|
+
/** The full capability block consulted before dispatch. */
|
|
114974
|
+
var TargetKindCapsSchema = object({
|
|
114975
|
+
attachments: object({
|
|
114976
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
114977
|
+
mode: _enum([
|
|
114978
|
+
"url",
|
|
114979
|
+
"bytes",
|
|
114980
|
+
"both"
|
|
114981
|
+
]),
|
|
114982
|
+
max: number().int().nonnegative(),
|
|
114983
|
+
maxBytes: number().int().positive().optional()
|
|
114984
|
+
}),
|
|
114985
|
+
/** Max action buttons (0 = none). */
|
|
114986
|
+
actions: number().int().nonnegative(),
|
|
114987
|
+
/**
|
|
114988
|
+
* Whether this kind renders a per-action ICON.
|
|
114989
|
+
*
|
|
114990
|
+
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
114991
|
+
* run on the addon cap path — three production failures in one day taught
|
|
114992
|
+
* this repo that once. Absent is read as false by the degrade engine, which
|
|
114993
|
+
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
114994
|
+
* assumed and dropped costs the operator's trust in the field.
|
|
114995
|
+
*/
|
|
114996
|
+
actionIcons: boolean().optional(),
|
|
114997
|
+
levels: array(TargetKindLevelSchema),
|
|
114998
|
+
format: array(NotificationFormatSchema),
|
|
114999
|
+
clickUrl: boolean(),
|
|
115000
|
+
sound: boolean(),
|
|
115001
|
+
ttl: boolean(),
|
|
115002
|
+
bodyMaxLen: number().int().positive()
|
|
115003
|
+
});
|
|
115004
|
+
/**
|
|
115005
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
115006
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
115007
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
115008
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
115009
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
115010
|
+
*/
|
|
115011
|
+
var ConfigSchemaPassthrough$4 = unknown();
|
|
115012
|
+
var TargetKindSchema = object({
|
|
115013
|
+
kind: string(),
|
|
115014
|
+
label: string(),
|
|
115015
|
+
icon: string(),
|
|
115016
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
115017
|
+
addonId: string(),
|
|
115018
|
+
/**
|
|
115019
|
+
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
115020
|
+
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
115021
|
+
* when the addon bundles no icon for that kind — the client then falls back
|
|
115022
|
+
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
115023
|
+
*
|
|
115024
|
+
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
115025
|
+
* client, and a native client joins it onto its own hub base.
|
|
115026
|
+
*
|
|
115027
|
+
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
115028
|
+
* field that survived only because the runtime cap-router forwards provider
|
|
115029
|
+
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
115030
|
+
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
115031
|
+
* broken silently the moment output validation was tightened anywhere.
|
|
115032
|
+
*/
|
|
115033
|
+
iconUrl: string().optional(),
|
|
115034
|
+
/**
|
|
115035
|
+
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
115036
|
+
*
|
|
115037
|
+
* The server knows this and therefore says it, because the client cannot
|
|
115038
|
+
* safely guess: a React-Native client renders SVG and raster through two
|
|
115039
|
+
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
115040
|
+
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
115041
|
+
* placeholder glyph for every vector icon while the web build looked fine.
|
|
115042
|
+
*
|
|
115043
|
+
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
115044
|
+
* not been updated — a client that cannot determine the type should prefer
|
|
115045
|
+
* its raster path, which is the safe default for an unknown image.
|
|
115046
|
+
*/
|
|
115047
|
+
iconMediaType: string().optional(),
|
|
115048
|
+
configSchema: ConfigSchemaPassthrough$4,
|
|
115049
|
+
/**
|
|
115050
|
+
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
115051
|
+
* base URL, instance, chat, recipient). A save that changes any of them
|
|
115052
|
+
* while leaving a secret redacted is refused by the provider (D634), so an
|
|
115053
|
+
* editor uses this to ask for the secret on exactly those edits instead of
|
|
115054
|
+
* on every edit.
|
|
115055
|
+
*
|
|
115056
|
+
* Optional: absent from a provider that holds no secret (the Home Assistant
|
|
115057
|
+
* kinds) and from a provider older than this field — an editor that finds
|
|
115058
|
+
* it absent must assume ANY edit may need the secret.
|
|
115059
|
+
*/
|
|
115060
|
+
destinationKeys: array(string()).optional(),
|
|
115061
|
+
supportsDiscovery: boolean(),
|
|
115062
|
+
/**
|
|
115063
|
+
* Extra delivery parameters a rule may set for a target of this kind (D938).
|
|
115064
|
+
* Absent = none; the rule editor then offers nothing.
|
|
115065
|
+
*/
|
|
115066
|
+
deliveryParams: array(DeliveryParamSchema).optional(),
|
|
115067
|
+
caps: TargetKindCapsSchema
|
|
115068
|
+
});
|
|
115069
|
+
/**
|
|
115070
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
115071
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
115072
|
+
* round-trip a stored secret to the UI.
|
|
115073
|
+
*/
|
|
115074
|
+
var TargetSchema = object({
|
|
115075
|
+
id: string(),
|
|
115076
|
+
name: string(),
|
|
115077
|
+
kind: string(),
|
|
115078
|
+
addonId: string(),
|
|
115079
|
+
enabled: boolean(),
|
|
115080
|
+
config: record(string(), unknown())
|
|
115081
|
+
});
|
|
115082
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
115083
|
+
var DiscoveredTargetSchema = object({
|
|
115084
|
+
kind: string(),
|
|
115085
|
+
suggestedName: string(),
|
|
115086
|
+
config: record(string(), unknown())
|
|
115087
|
+
});
|
|
115088
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
115089
|
+
var RenderedAsSchema = object({
|
|
115090
|
+
level: string(),
|
|
115091
|
+
format: NotificationFormatSchema,
|
|
115092
|
+
attachmentsSent: number().int().nonnegative(),
|
|
115093
|
+
actionsSent: number().int().nonnegative(),
|
|
115094
|
+
truncated: boolean(),
|
|
115095
|
+
dropped: array(string())
|
|
115096
|
+
});
|
|
115097
|
+
var SendResultSchema = object({
|
|
115098
|
+
success: boolean(),
|
|
115099
|
+
error: string().optional(),
|
|
115100
|
+
renderedAs: RenderedAsSchema.optional()
|
|
115101
|
+
});
|
|
115102
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
115103
|
+
var TestResultSchema = SendResultSchema;
|
|
115104
|
+
/**
|
|
115105
|
+
* Pre-save credential probe against a partial (unsaved) target config.
|
|
115106
|
+
* `resolvedUrl` never includes secrets (token stripped from path).
|
|
115107
|
+
*/
|
|
115108
|
+
var ProbeTargetConfigResultSchema = object({
|
|
115109
|
+
ok: boolean(),
|
|
115110
|
+
resolvedUrl: string(),
|
|
115111
|
+
httpStatus: number().int().optional(),
|
|
115112
|
+
stateInstance: string().optional(),
|
|
115113
|
+
error: string().optional()
|
|
115114
|
+
});
|
|
115115
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
|
|
115116
|
+
kind: string(),
|
|
115117
|
+
config: record(string(), unknown()).optional(),
|
|
115118
|
+
/**
|
|
115119
|
+
* When editing / duplicating, the blank password field never round-trips
|
|
115120
|
+
* the stored token. Pass the source target id so the provider can restore
|
|
115121
|
+
* secrets server-side before dialling (same merge as upsert).
|
|
115122
|
+
*/
|
|
115123
|
+
targetId: string().optional()
|
|
115124
|
+
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
115125
|
+
kind: string(),
|
|
115126
|
+
config: record(string(), unknown()),
|
|
115127
|
+
/** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
|
|
115128
|
+
targetId: string().optional()
|
|
115129
|
+
}), ProbeTargetConfigResultSchema, {
|
|
115130
|
+
kind: "mutation",
|
|
115131
|
+
auth: "admin"
|
|
115132
|
+
}), method(object({
|
|
115133
|
+
targetId: string(),
|
|
115134
|
+
notification: NotificationSchema
|
|
115135
|
+
}), SendResultSchema, {
|
|
115136
|
+
kind: "mutation",
|
|
115137
|
+
auth: "admin"
|
|
115138
|
+
}), method(object({
|
|
115139
|
+
targetId: string(),
|
|
115140
|
+
sample: NotificationSchema.optional()
|
|
115141
|
+
}), TestResultSchema, {
|
|
115142
|
+
kind: "mutation",
|
|
115143
|
+
auth: "admin"
|
|
115144
|
+
}), method(object({
|
|
115145
|
+
target: TargetSchema,
|
|
115146
|
+
/**
|
|
115147
|
+
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
115148
|
+
* existing row. The UI never holds the stored token; blank / redacted
|
|
115149
|
+
* password fields are restored from this source (D634 still applies if
|
|
115150
|
+
* destinations diverge without a re-typed secret).
|
|
115151
|
+
*/
|
|
115152
|
+
cloneSecretsFrom: string().optional()
|
|
115153
|
+
}), TargetSchema, {
|
|
115154
|
+
kind: "mutation",
|
|
115155
|
+
auth: "admin"
|
|
115156
|
+
}), method(object({ targetId: string() }), _void(), {
|
|
115157
|
+
kind: "mutation",
|
|
115158
|
+
auth: "admin"
|
|
115159
|
+
}), method(object({
|
|
115160
|
+
targetId: string(),
|
|
115161
|
+
enabled: boolean()
|
|
115162
|
+
}), _void(), {
|
|
115163
|
+
kind: "mutation",
|
|
115164
|
+
auth: "admin"
|
|
115165
|
+
});
|
|
115166
|
+
looseObject({
|
|
115167
|
+
name: string().min(1),
|
|
115168
|
+
enabled: boolean().optional()
|
|
115169
|
+
});
|
|
115170
|
+
TargetSchema.omit({ id: true });
|
|
114720
115171
|
var EncodeProfileSchema = object({
|
|
114721
115172
|
video: object({
|
|
114722
115173
|
codec: _enum([
|
|
@@ -123814,7 +124265,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
123814
124265
|
"calendar-source": system(INTERNAL),
|
|
123815
124266
|
calendars: system("calendars feed schedules and conditions, not device actions"),
|
|
123816
124267
|
composer: system("device composition — an authoring tool, not an action"),
|
|
123817
|
-
"connection-test": system(INTERNAL),
|
|
123818
124268
|
"core-blocks": system(INTERNAL),
|
|
123819
124269
|
"custom-model-registry": system(ML),
|
|
123820
124270
|
"data-store-provider": system(INTERNAL),
|
|
@@ -145791,427 +146241,6 @@ var UnitWarningSchema = object({
|
|
|
145791
146241
|
assumedUnit: string(),
|
|
145792
146242
|
message: string()
|
|
145793
146243
|
});
|
|
145794
|
-
/**
|
|
145795
|
-
* notification-output — canonical, capability-gated notification delivery.
|
|
145796
|
-
*
|
|
145797
|
-
* Apprise-derived model (see
|
|
145798
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
145799
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
145800
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
145801
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
145802
|
-
* message to what the kind supports — callers never special-case a service.
|
|
145803
|
-
*
|
|
145804
|
-
* DESIGN DECISIONS (locked):
|
|
145805
|
-
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
145806
|
-
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
145807
|
-
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
145808
|
-
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
145809
|
-
* alternative would fork the UI per addon and cannot host the
|
|
145810
|
-
* discovery→adopt flow.
|
|
145811
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
145812
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
145813
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
145814
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
145815
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
145816
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
145817
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
145818
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
145819
|
-
* base64 fallback needed.
|
|
145820
|
-
*
|
|
145821
|
-
* TODO (deferred, closed-set change — separate decision): add
|
|
145822
|
-
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
145823
|
-
* admin "Integrations" page.
|
|
145824
|
-
*/
|
|
145825
|
-
/**
|
|
145826
|
-
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
145827
|
-
* adapter picks what it supports and the degrade engine filters the rest.
|
|
145828
|
-
*/
|
|
145829
|
-
var AttachmentMediaTypeSchema = _enum([
|
|
145830
|
-
"image",
|
|
145831
|
-
"video",
|
|
145832
|
-
"gif",
|
|
145833
|
-
"audio",
|
|
145834
|
-
"icon"
|
|
145835
|
-
]);
|
|
145836
|
-
/**
|
|
145837
|
-
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
145838
|
-
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
145839
|
-
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
145840
|
-
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
145841
|
-
*/
|
|
145842
|
-
var AttachmentSchema = object({
|
|
145843
|
-
mediaType: AttachmentMediaTypeSchema,
|
|
145844
|
-
url: string().optional(),
|
|
145845
|
-
bytes: _instanceof(Uint8Array).optional(),
|
|
145846
|
-
mime: string().optional(),
|
|
145847
|
-
name: string().optional()
|
|
145848
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
145849
|
-
var NotificationFormatSchema = _enum([
|
|
145850
|
-
"text",
|
|
145851
|
-
"markdown",
|
|
145852
|
-
"html"
|
|
145853
|
-
]);
|
|
145854
|
-
/**
|
|
145855
|
-
* The CLOSED icon vocabulary an action button may use.
|
|
145856
|
-
*
|
|
145857
|
-
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
145858
|
-
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
145859
|
-
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
145860
|
-
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
145861
|
-
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
145862
|
-
*
|
|
145863
|
-
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
145864
|
-
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
145865
|
-
* differently.
|
|
145866
|
-
*
|
|
145867
|
-
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
145868
|
-
*
|
|
145869
|
-
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
145870
|
-
* the whole set onto its own renderer's vocabulary through a
|
|
145871
|
-
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
145872
|
-
* fallback, so adding a member here fails every adapter's build until someone
|
|
145873
|
-
* decides its glyph, which is the only place that decision can be made
|
|
145874
|
-
* honestly.
|
|
145875
|
-
*
|
|
145876
|
-
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
145877
|
-
* `disarm` straight through; iOS feeds that string to
|
|
145878
|
-
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
145879
|
-
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
145880
|
-
* mapping, and "the field is documented" is not "the value renders".
|
|
145881
|
-
*
|
|
145882
|
-
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
145883
|
-
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
145884
|
-
* so an addon that emits a token the running hub does not know does not lose an
|
|
145885
|
-
* icon — its whole `send` fails Zod validation and the notification never
|
|
145886
|
-
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
145887
|
-
*/
|
|
145888
|
-
var NotificationActionIconSchema = _enum([
|
|
145889
|
-
"acknowledge",
|
|
145890
|
-
"dismiss",
|
|
145891
|
-
"silence",
|
|
145892
|
-
"snooze",
|
|
145893
|
-
"view",
|
|
145894
|
-
"play",
|
|
145895
|
-
"open",
|
|
145896
|
-
"close",
|
|
145897
|
-
"lock",
|
|
145898
|
-
"unlock",
|
|
145899
|
-
"arm",
|
|
145900
|
-
"arm-home",
|
|
145901
|
-
"arm-away",
|
|
145902
|
-
"arm-night",
|
|
145903
|
-
"disarm",
|
|
145904
|
-
"light",
|
|
145905
|
-
"alert",
|
|
145906
|
-
"camera"
|
|
145907
|
-
]);
|
|
145908
|
-
/** A single tap-through action button. */
|
|
145909
|
-
var NotificationActionSchema = object({
|
|
145910
|
-
id: string(),
|
|
145911
|
-
label: string(),
|
|
145912
|
-
url: string().optional(),
|
|
145913
|
-
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
145914
|
-
icon: NotificationActionIconSchema.optional(),
|
|
145915
|
-
/**
|
|
145916
|
-
* Renders in a warning style where the notifier supports it.
|
|
145917
|
-
*
|
|
145918
|
-
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
145919
|
-
* else — see `notification-center/action-token.ts` for what that does and
|
|
145920
|
-
* does not buy.
|
|
145921
|
-
*/
|
|
145922
|
-
destructive: boolean().optional(),
|
|
145923
|
-
/**
|
|
145924
|
-
* How the tap should REACH the url.
|
|
145925
|
-
*
|
|
145926
|
-
* `navigate` (absent, and every button authored before this field) opens it:
|
|
145927
|
-
* the phone leaves the notification and shows whatever the callback returns.
|
|
145928
|
-
* That is right for a button whose answer the operator wants to read.
|
|
145929
|
-
*
|
|
145930
|
-
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
145931
|
-
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
145932
|
-
* an answer to the notification, and being thrown into a browser tab to
|
|
145933
|
-
* confirm it costs more attention than the notification did. A backend that
|
|
145934
|
-
* cannot do a background call renders it as an ordinary link (the adapters
|
|
145935
|
-
* fall back rather than dropping the button), so this is a preference, never
|
|
145936
|
-
* a requirement.
|
|
145937
|
-
*/
|
|
145938
|
-
mode: _enum(["navigate", "background"]).optional()
|
|
145939
|
-
});
|
|
145940
|
-
/** A delivery parameter value: what a notifier declared it takes. */
|
|
145941
|
-
var DeliveryParamValueSchema = union([
|
|
145942
|
-
string(),
|
|
145943
|
-
number(),
|
|
145944
|
-
boolean()
|
|
145945
|
-
]);
|
|
145946
|
-
/**
|
|
145947
|
-
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
145948
|
-
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
145949
|
-
* never handed one. The admin UI derives its control from this descriptor —
|
|
145950
|
-
* no editor knows a service by name.
|
|
145951
|
-
*
|
|
145952
|
-
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
145953
|
-
* run on the addon cap path).
|
|
145954
|
-
*/
|
|
145955
|
-
var DeliveryParamSchema = object({
|
|
145956
|
-
key: string().min(1),
|
|
145957
|
-
label: string(),
|
|
145958
|
-
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
145959
|
-
labelKey: string().optional(),
|
|
145960
|
-
type: _enum([
|
|
145961
|
-
"enum",
|
|
145962
|
-
"number",
|
|
145963
|
-
"boolean",
|
|
145964
|
-
"string"
|
|
145965
|
-
]),
|
|
145966
|
-
/** `enum` only: the closed set of accepted values. */
|
|
145967
|
-
options: array(object({
|
|
145968
|
-
value: string(),
|
|
145969
|
-
label: string()
|
|
145970
|
-
})).optional(),
|
|
145971
|
-
/** `number` only. */
|
|
145972
|
-
min: number().optional(),
|
|
145973
|
-
max: number().optional(),
|
|
145974
|
-
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
145975
|
-
default: DeliveryParamValueSchema.optional()
|
|
145976
|
-
});
|
|
145977
|
-
/**
|
|
145978
|
-
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
145979
|
-
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
145980
|
-
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
145981
|
-
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
145982
|
-
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
145983
|
-
* `priority` for that one target.
|
|
145984
|
-
*/
|
|
145985
|
-
var NotificationSchema = object({
|
|
145986
|
-
body: string(),
|
|
145987
|
-
title: string().optional(),
|
|
145988
|
-
format: NotificationFormatSchema.default("text"),
|
|
145989
|
-
priority: number().int().min(1).max(5).default(3),
|
|
145990
|
-
level: string().optional(),
|
|
145991
|
-
attachments: array(AttachmentSchema).optional(),
|
|
145992
|
-
clickUrl: string().optional(),
|
|
145993
|
-
actions: array(NotificationActionSchema).optional(),
|
|
145994
|
-
sound: string().optional(),
|
|
145995
|
-
ttl: number().optional(),
|
|
145996
|
-
tag: string().optional(),
|
|
145997
|
-
deviceId: number().optional(),
|
|
145998
|
-
eventId: string().optional(),
|
|
145999
|
-
metadata: record(string(), unknown()).optional(),
|
|
146000
|
-
/**
|
|
146001
|
-
* Values for the parameters the target's kind DECLARES in
|
|
146002
|
-
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
146003
|
-
* declaration by the sender; a notifier reads only the keys it declared.
|
|
146004
|
-
*/
|
|
146005
|
-
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
146006
|
-
});
|
|
146007
|
-
/** One declared native severity/priority level for a kind. */
|
|
146008
|
-
var TargetKindLevelSchema = object({
|
|
146009
|
-
id: string(),
|
|
146010
|
-
label: string(),
|
|
146011
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
146012
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
146013
|
-
flags: object({
|
|
146014
|
-
critical: boolean().optional(),
|
|
146015
|
-
silent: boolean().optional(),
|
|
146016
|
-
noPush: boolean().optional()
|
|
146017
|
-
}).optional(),
|
|
146018
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
146019
|
-
requires: array(string()).optional(),
|
|
146020
|
-
description: string().optional()
|
|
146021
|
-
});
|
|
146022
|
-
/** The full capability block consulted before dispatch. */
|
|
146023
|
-
var TargetKindCapsSchema = object({
|
|
146024
|
-
attachments: object({
|
|
146025
|
-
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
146026
|
-
mode: _enum([
|
|
146027
|
-
"url",
|
|
146028
|
-
"bytes",
|
|
146029
|
-
"both"
|
|
146030
|
-
]),
|
|
146031
|
-
max: number().int().nonnegative(),
|
|
146032
|
-
maxBytes: number().int().positive().optional()
|
|
146033
|
-
}),
|
|
146034
|
-
/** Max action buttons (0 = none). */
|
|
146035
|
-
actions: number().int().nonnegative(),
|
|
146036
|
-
/**
|
|
146037
|
-
* Whether this kind renders a per-action ICON.
|
|
146038
|
-
*
|
|
146039
|
-
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
146040
|
-
* run on the addon cap path — three production failures in one day taught
|
|
146041
|
-
* this repo that once. Absent is read as false by the degrade engine, which
|
|
146042
|
-
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
146043
|
-
* assumed and dropped costs the operator's trust in the field.
|
|
146044
|
-
*/
|
|
146045
|
-
actionIcons: boolean().optional(),
|
|
146046
|
-
levels: array(TargetKindLevelSchema),
|
|
146047
|
-
format: array(NotificationFormatSchema),
|
|
146048
|
-
clickUrl: boolean(),
|
|
146049
|
-
sound: boolean(),
|
|
146050
|
-
ttl: boolean(),
|
|
146051
|
-
bodyMaxLen: number().int().positive()
|
|
146052
|
-
});
|
|
146053
|
-
/**
|
|
146054
|
-
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
146055
|
-
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
146056
|
-
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
146057
|
-
* the union is large and not meant for runtime validation here; the exported
|
|
146058
|
-
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
146059
|
-
*/
|
|
146060
|
-
var ConfigSchemaPassthrough$4 = unknown();
|
|
146061
|
-
var TargetKindSchema = object({
|
|
146062
|
-
kind: string(),
|
|
146063
|
-
label: string(),
|
|
146064
|
-
icon: string(),
|
|
146065
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
146066
|
-
addonId: string(),
|
|
146067
|
-
/**
|
|
146068
|
-
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
146069
|
-
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
146070
|
-
* when the addon bundles no icon for that kind — the client then falls back
|
|
146071
|
-
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
146072
|
-
*
|
|
146073
|
-
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
146074
|
-
* client, and a native client joins it onto its own hub base.
|
|
146075
|
-
*
|
|
146076
|
-
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
146077
|
-
* field that survived only because the runtime cap-router forwards provider
|
|
146078
|
-
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
146079
|
-
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
146080
|
-
* broken silently the moment output validation was tightened anywhere.
|
|
146081
|
-
*/
|
|
146082
|
-
iconUrl: string().optional(),
|
|
146083
|
-
/**
|
|
146084
|
-
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
146085
|
-
*
|
|
146086
|
-
* The server knows this and therefore says it, because the client cannot
|
|
146087
|
-
* safely guess: a React-Native client renders SVG and raster through two
|
|
146088
|
-
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
146089
|
-
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
146090
|
-
* placeholder glyph for every vector icon while the web build looked fine.
|
|
146091
|
-
*
|
|
146092
|
-
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
146093
|
-
* not been updated — a client that cannot determine the type should prefer
|
|
146094
|
-
* its raster path, which is the safe default for an unknown image.
|
|
146095
|
-
*/
|
|
146096
|
-
iconMediaType: string().optional(),
|
|
146097
|
-
configSchema: ConfigSchemaPassthrough$4,
|
|
146098
|
-
/**
|
|
146099
|
-
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
146100
|
-
* base URL, instance, chat, recipient). A save that changes any of them
|
|
146101
|
-
* while leaving a secret redacted is refused by the provider (D634), so an
|
|
146102
|
-
* editor uses this to ask for the secret on exactly those edits instead of
|
|
146103
|
-
* on every edit.
|
|
146104
|
-
*
|
|
146105
|
-
* Optional: absent from a provider that holds no secret (the Home Assistant
|
|
146106
|
-
* kinds) and from a provider older than this field — an editor that finds
|
|
146107
|
-
* it absent must assume ANY edit may need the secret.
|
|
146108
|
-
*/
|
|
146109
|
-
destinationKeys: array(string()).optional(),
|
|
146110
|
-
supportsDiscovery: boolean(),
|
|
146111
|
-
/**
|
|
146112
|
-
* Extra delivery parameters a rule may set for a target of this kind (D938).
|
|
146113
|
-
* Absent = none; the rule editor then offers nothing.
|
|
146114
|
-
*/
|
|
146115
|
-
deliveryParams: array(DeliveryParamSchema).optional(),
|
|
146116
|
-
caps: TargetKindCapsSchema
|
|
146117
|
-
});
|
|
146118
|
-
/**
|
|
146119
|
-
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
146120
|
-
* (return a presence marker only) when serving `listTargets` — never
|
|
146121
|
-
* round-trip a stored secret to the UI.
|
|
146122
|
-
*/
|
|
146123
|
-
var TargetSchema = object({
|
|
146124
|
-
id: string(),
|
|
146125
|
-
name: string(),
|
|
146126
|
-
kind: string(),
|
|
146127
|
-
addonId: string(),
|
|
146128
|
-
enabled: boolean(),
|
|
146129
|
-
config: record(string(), unknown())
|
|
146130
|
-
});
|
|
146131
|
-
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
146132
|
-
var DiscoveredTargetSchema = object({
|
|
146133
|
-
kind: string(),
|
|
146134
|
-
suggestedName: string(),
|
|
146135
|
-
config: record(string(), unknown())
|
|
146136
|
-
});
|
|
146137
|
-
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
146138
|
-
var RenderedAsSchema = object({
|
|
146139
|
-
level: string(),
|
|
146140
|
-
format: NotificationFormatSchema,
|
|
146141
|
-
attachmentsSent: number().int().nonnegative(),
|
|
146142
|
-
actionsSent: number().int().nonnegative(),
|
|
146143
|
-
truncated: boolean(),
|
|
146144
|
-
dropped: array(string())
|
|
146145
|
-
});
|
|
146146
|
-
var SendResultSchema = object({
|
|
146147
|
-
success: boolean(),
|
|
146148
|
-
error: string().optional(),
|
|
146149
|
-
renderedAs: RenderedAsSchema.optional()
|
|
146150
|
-
});
|
|
146151
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
146152
|
-
var TestResultSchema = SendResultSchema;
|
|
146153
|
-
/**
|
|
146154
|
-
* Pre-save credential probe against a partial (unsaved) target config.
|
|
146155
|
-
* `resolvedUrl` never includes secrets (token stripped from path).
|
|
146156
|
-
*/
|
|
146157
|
-
var ProbeTargetConfigResultSchema = object({
|
|
146158
|
-
ok: boolean(),
|
|
146159
|
-
resolvedUrl: string(),
|
|
146160
|
-
httpStatus: number().int().optional(),
|
|
146161
|
-
stateInstance: string().optional(),
|
|
146162
|
-
error: string().optional()
|
|
146163
|
-
});
|
|
146164
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
|
|
146165
|
-
kind: string(),
|
|
146166
|
-
config: record(string(), unknown()).optional(),
|
|
146167
|
-
/**
|
|
146168
|
-
* When editing / duplicating, the blank password field never round-trips
|
|
146169
|
-
* the stored token. Pass the source target id so the provider can restore
|
|
146170
|
-
* secrets server-side before dialling (same merge as upsert).
|
|
146171
|
-
*/
|
|
146172
|
-
targetId: string().optional()
|
|
146173
|
-
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
146174
|
-
kind: string(),
|
|
146175
|
-
config: record(string(), unknown()),
|
|
146176
|
-
/** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
|
|
146177
|
-
targetId: string().optional()
|
|
146178
|
-
}), ProbeTargetConfigResultSchema, {
|
|
146179
|
-
kind: "mutation",
|
|
146180
|
-
auth: "admin"
|
|
146181
|
-
}), method(object({
|
|
146182
|
-
targetId: string(),
|
|
146183
|
-
notification: NotificationSchema
|
|
146184
|
-
}), SendResultSchema, {
|
|
146185
|
-
kind: "mutation",
|
|
146186
|
-
auth: "admin"
|
|
146187
|
-
}), method(object({
|
|
146188
|
-
targetId: string(),
|
|
146189
|
-
sample: NotificationSchema.optional()
|
|
146190
|
-
}), TestResultSchema, {
|
|
146191
|
-
kind: "mutation",
|
|
146192
|
-
auth: "admin"
|
|
146193
|
-
}), method(object({
|
|
146194
|
-
target: TargetSchema,
|
|
146195
|
-
/**
|
|
146196
|
-
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
146197
|
-
* existing row. The UI never holds the stored token; blank / redacted
|
|
146198
|
-
* password fields are restored from this source (D634 still applies if
|
|
146199
|
-
* destinations diverge without a re-typed secret).
|
|
146200
|
-
*/
|
|
146201
|
-
cloneSecretsFrom: string().optional()
|
|
146202
|
-
}), TargetSchema, {
|
|
146203
|
-
kind: "mutation",
|
|
146204
|
-
auth: "admin"
|
|
146205
|
-
}), method(object({ targetId: string() }), _void(), {
|
|
146206
|
-
kind: "mutation",
|
|
146207
|
-
auth: "admin"
|
|
146208
|
-
}), method(object({
|
|
146209
|
-
targetId: string(),
|
|
146210
|
-
enabled: boolean()
|
|
146211
|
-
}), _void(), {
|
|
146212
|
-
kind: "mutation",
|
|
146213
|
-
auth: "admin"
|
|
146214
|
-
});
|
|
146215
146244
|
_enum([
|
|
146216
146245
|
"automation",
|
|
146217
146246
|
"action",
|
|
@@ -150751,37 +150780,6 @@ method(object({
|
|
|
150751
150780
|
kind: "mutation",
|
|
150752
150781
|
auth: "admin"
|
|
150753
150782
|
}), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
|
|
150754
|
-
var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
|
|
150755
|
-
object({
|
|
150756
|
-
outcome: literal("validated"),
|
|
150757
|
-
/** Round-trip of the sign-in, when the provider measured it. */
|
|
150758
|
-
latencyMs: number().nonnegative().optional(),
|
|
150759
|
-
/** Optional human detail worth showing next to the tick
|
|
150760
|
-
* ("3 devices visible on this account"). */
|
|
150761
|
-
detail: string().optional()
|
|
150762
|
-
}).strict(),
|
|
150763
|
-
object({
|
|
150764
|
-
outcome: literal("rejected"),
|
|
150765
|
-
error: string()
|
|
150766
|
-
}).strict(),
|
|
150767
|
-
object({
|
|
150768
|
-
outcome: literal("inconclusive"),
|
|
150769
|
-
error: string()
|
|
150770
|
-
}).strict()
|
|
150771
|
-
]);
|
|
150772
|
-
var ConnectionTestInputSchema = object({
|
|
150773
|
-
/** Candidate integration settings, exactly as the create form collected them. */
|
|
150774
|
-
settings: record(string(), unknown()) });
|
|
150775
|
-
/**
|
|
150776
|
-
* What the provider's test actually DOES, so the UI can say it in words before
|
|
150777
|
-
* the operator presses the button ("Signs in to the Dreo cloud"). Purely
|
|
150778
|
-
* descriptive — it never changes routing.
|
|
150779
|
-
*/
|
|
150780
|
-
var ConnectionTestDescriptorSchema = object({ label: string() });
|
|
150781
|
-
method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
|
|
150782
|
-
kind: "mutation",
|
|
150783
|
-
auth: "admin"
|
|
150784
|
-
}), method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" });
|
|
150785
150783
|
/**
|
|
150786
150784
|
* Upstream-system connectivity sensor — distinct from `device-status`,
|
|
150787
150785
|
* which is the kernel-managed online/offline flag for the device's
|
|
@@ -157988,10 +157986,9 @@ var AvailableIntegrationTypeSchema = object({
|
|
|
157988
157986
|
* locations" checkbox. Provider-declared in the addon manifest. */
|
|
157989
157987
|
supportsLocationImport: boolean(),
|
|
157990
157988
|
/**
|
|
157991
|
-
* True when this integration
|
|
157992
|
-
*
|
|
157993
|
-
*
|
|
157994
|
-
* rather than offering a button that always answers the same nonsense.
|
|
157989
|
+
* True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
|
|
157990
|
+
* D1016). An integration that cannot be tested must say so up front rather than offering a
|
|
157991
|
+
* button that always answers the same nonsense.
|
|
157995
157992
|
*/
|
|
157996
157993
|
canTest: boolean(),
|
|
157997
157994
|
existingInstances: array(object({
|
|
@@ -158045,7 +158042,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
158045
158042
|
info: record(string(), unknown()).optional(),
|
|
158046
158043
|
/** `stableId` of the discovery candidate the form was seeded from (D984). */
|
|
158047
158044
|
originStableId: string().optional(),
|
|
158048
|
-
settings: record(string(), unknown()).optional()
|
|
158045
|
+
settings: record(string(), unknown()).optional(),
|
|
158046
|
+
/** The instance kind being created, for a provider with several; omitted = its only testable kind. */
|
|
158047
|
+
kind: string().min(1).optional()
|
|
158049
158048
|
});
|
|
158050
158049
|
var UpdateIntegrationInputSchema = object({
|
|
158051
158050
|
id: string(),
|
|
@@ -158071,13 +158070,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
158071
158070
|
}), method(object({ id: string() }), DeleteIntegrationResultSchema, {
|
|
158072
158071
|
kind: "mutation",
|
|
158073
158072
|
auth: "admin"
|
|
158074
|
-
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" })
|
|
158075
|
-
addonId: string(),
|
|
158076
|
-
settings: record(string(), unknown())
|
|
158077
|
-
}), TestConnectionResultSchema, {
|
|
158078
|
-
kind: "mutation",
|
|
158079
|
-
auth: "admin"
|
|
158080
|
-
});
|
|
158073
|
+
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
|
|
158081
158074
|
/**
|
|
158082
158075
|
* `integration-instances` - the connection of an addon that holds ONE or SEVERAL
|
|
158083
158076
|
* (an account, a relay, a destination) as typed records (D985, D986). The addon's
|
|
@@ -166841,13 +166834,6 @@ var AddBrokerInputSchema = object({
|
|
|
166841
166834
|
});
|
|
166842
166835
|
var AddBrokerResultSchema = object({ id: string() });
|
|
166843
166836
|
var IdInputSchema = object({ id: string() });
|
|
166844
|
-
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
166845
|
-
ok: literal(true),
|
|
166846
|
-
latencyMs: number()
|
|
166847
|
-
}), object({
|
|
166848
|
-
ok: literal(false),
|
|
166849
|
-
error: string()
|
|
166850
|
-
})]);
|
|
166851
166837
|
var StartEmbeddedInputSchema = object({
|
|
166852
166838
|
port: number().int().min(1).max(65535).default(1883),
|
|
166853
166839
|
/** Allow anonymous connect (no username/password). Default: false. */
|
|
@@ -166870,9 +166856,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
|
|
|
166870
166856
|
}), method(IdInputSchema, _void(), {
|
|
166871
166857
|
kind: "mutation",
|
|
166872
166858
|
auth: "admin"
|
|
166873
|
-
}), method(IdInputSchema, TestResultSchema$1, {
|
|
166874
|
-
kind: "mutation",
|
|
166875
|
-
auth: "admin"
|
|
166876
166859
|
}), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
|
|
166877
166860
|
kind: "mutation",
|
|
166878
166861
|
auth: "admin"
|
|
@@ -180709,7 +180692,7 @@ var TrainingProviderTypeSchema = object({
|
|
|
180709
180692
|
label: string(),
|
|
180710
180693
|
/** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
|
|
180711
180694
|
iconAsset: string(),
|
|
180712
|
-
/** Owning `training-provider` addon
|
|
180695
|
+
/** Owning `training-provider` addon. */
|
|
180713
180696
|
addonId: string(),
|
|
180714
180697
|
/**
|
|
180715
180698
|
* Fields for one entry of this type (credentials + defaults). Absent on a
|
|
@@ -180754,36 +180737,6 @@ var TrainingProviderDescriptorSchema = object({
|
|
|
180754
180737
|
*/
|
|
180755
180738
|
formValues: record(string(), unknown()).optional()
|
|
180756
180739
|
});
|
|
180757
|
-
/**
|
|
180758
|
-
* Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
|
|
180759
|
-
* An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
|
|
180760
|
-
* `{ $secretClear: true }` clears it.
|
|
180761
|
-
*/
|
|
180762
|
-
var TrainingProviderUpdateEntryInputSchema = object({
|
|
180763
|
-
entryId: string().min(1),
|
|
180764
|
-
name: string().min(1),
|
|
180765
|
-
tokenId: string().optional(),
|
|
180766
|
-
tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
|
|
180767
|
-
environment: string().optional(),
|
|
180768
|
-
gpuType: string().optional(),
|
|
180769
|
-
region: string().optional(),
|
|
180770
|
-
costCapUsd: number().nonnegative().optional(),
|
|
180771
|
-
maxRuntimeSec: number().int().positive().optional(),
|
|
180772
|
-
failedDatasetGraceHours: number().nonnegative().optional()
|
|
180773
|
-
});
|
|
180774
|
-
var TrainingCredentialCheckSchema = object({
|
|
180775
|
-
ok: boolean(),
|
|
180776
|
-
/** Workspace / account name, when the provider says. */
|
|
180777
|
-
account: string().optional(),
|
|
180778
|
-
reason: _enum([
|
|
180779
|
-
"missing",
|
|
180780
|
-
"invalid",
|
|
180781
|
-
"forbidden",
|
|
180782
|
-
"network",
|
|
180783
|
-
"quota"
|
|
180784
|
-
]).optional(),
|
|
180785
|
-
detail: string().optional()
|
|
180786
|
-
});
|
|
180787
180740
|
var ProviderJobStateSchema = _enum([
|
|
180788
180741
|
"pending",
|
|
180789
180742
|
"starting",
|
|
@@ -180831,22 +180784,6 @@ var TrainingLogLineSchema = object({
|
|
|
180831
180784
|
text: string()
|
|
180832
180785
|
});
|
|
180833
180786
|
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
|
|
180834
|
-
typeId: string().min(1),
|
|
180835
|
-
name: string().min(1)
|
|
180836
|
-
}), object({ entryId: string() }), {
|
|
180837
|
-
kind: "mutation",
|
|
180838
|
-
auth: "admin"
|
|
180839
|
-
}), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
|
|
180840
|
-
kind: "mutation",
|
|
180841
|
-
auth: "admin"
|
|
180842
|
-
}), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
|
|
180843
|
-
kind: "mutation",
|
|
180844
|
-
auth: "admin"
|
|
180845
|
-
}), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
|
|
180846
|
-
kind: "mutation",
|
|
180847
|
-
auth: "admin",
|
|
180848
|
-
timeoutMs: 3e4
|
|
180849
|
-
}), method(object({
|
|
180850
180787
|
entryId: string().min(1),
|
|
180851
180788
|
gpuType: string(),
|
|
180852
180789
|
region: string(),
|
|
@@ -186810,20 +186747,6 @@ Object.freeze({
|
|
|
186810
186747
|
access: "view",
|
|
186811
186748
|
role: "admin"
|
|
186812
186749
|
},
|
|
186813
|
-
"connectionTest.describeTest": {
|
|
186814
|
-
capName: "connection-test",
|
|
186815
|
-
capScope: "system",
|
|
186816
|
-
addonId: null,
|
|
186817
|
-
access: "view",
|
|
186818
|
-
role: "admin"
|
|
186819
|
-
},
|
|
186820
|
-
"connectionTest.testSettings": {
|
|
186821
|
-
capName: "connection-test",
|
|
186822
|
-
capScope: "system",
|
|
186823
|
-
addonId: null,
|
|
186824
|
-
access: "create",
|
|
186825
|
-
role: "admin"
|
|
186826
|
-
},
|
|
186827
186750
|
"connectivity.getStatus": {
|
|
186828
186751
|
capName: "connectivity",
|
|
186829
186752
|
capScope: "device",
|
|
@@ -189190,13 +189113,6 @@ Object.freeze({
|
|
|
189190
189113
|
access: "view",
|
|
189191
189114
|
role: "admin"
|
|
189192
189115
|
},
|
|
189193
|
-
"integrations.testConnection": {
|
|
189194
|
-
capName: "integrations",
|
|
189195
|
-
capScope: "system",
|
|
189196
|
-
addonId: null,
|
|
189197
|
-
access: "create",
|
|
189198
|
-
role: "admin"
|
|
189199
|
-
},
|
|
189200
189116
|
"integrations.update": {
|
|
189201
189117
|
capName: "integrations",
|
|
189202
189118
|
capScope: "system",
|
|
@@ -190429,13 +190345,6 @@ Object.freeze({
|
|
|
190429
190345
|
access: "create",
|
|
190430
190346
|
role: "admin"
|
|
190431
190347
|
},
|
|
190432
|
-
"mqttBroker.testConnection": {
|
|
190433
|
-
capName: "mqtt-broker",
|
|
190434
|
-
capScope: "system",
|
|
190435
|
-
addonId: null,
|
|
190436
|
-
access: "create",
|
|
190437
|
-
role: "admin"
|
|
190438
|
-
},
|
|
190439
190348
|
"nativeObjectDetection.getOptions": {
|
|
190440
190349
|
capName: "native-object-detection",
|
|
190441
190350
|
capScope: "device",
|
|
@@ -195266,20 +195175,6 @@ Object.freeze({
|
|
|
195266
195175
|
access: "create",
|
|
195267
195176
|
role: "admin"
|
|
195268
195177
|
},
|
|
195269
|
-
"trainingProvider.createEntry": {
|
|
195270
|
-
capName: "training-provider",
|
|
195271
|
-
capScope: "system",
|
|
195272
|
-
addonId: null,
|
|
195273
|
-
access: "create",
|
|
195274
|
-
role: "admin"
|
|
195275
|
-
},
|
|
195276
|
-
"trainingProvider.deleteEntry": {
|
|
195277
|
-
capName: "training-provider",
|
|
195278
|
-
capScope: "system",
|
|
195279
|
-
addonId: null,
|
|
195280
|
-
access: "delete",
|
|
195281
|
-
role: "admin"
|
|
195282
|
-
},
|
|
195283
195178
|
"trainingProvider.describe": {
|
|
195284
195179
|
capName: "training-provider",
|
|
195285
195180
|
capScope: "system",
|
|
@@ -195350,13 +195245,6 @@ Object.freeze({
|
|
|
195350
195245
|
access: "create",
|
|
195351
195246
|
role: "admin"
|
|
195352
195247
|
},
|
|
195353
|
-
"trainingProvider.updateEntry": {
|
|
195354
|
-
capName: "training-provider",
|
|
195355
|
-
capScope: "system",
|
|
195356
|
-
addonId: null,
|
|
195357
|
-
access: "create",
|
|
195358
|
-
role: "admin"
|
|
195359
|
-
},
|
|
195360
195248
|
"trainingProvider.uploadDataset": {
|
|
195361
195249
|
capName: "training-provider",
|
|
195362
195250
|
capScope: "system",
|
|
@@ -195364,13 +195252,6 @@ Object.freeze({
|
|
|
195364
195252
|
access: "create",
|
|
195365
195253
|
role: "admin"
|
|
195366
195254
|
},
|
|
195367
|
-
"trainingProvider.validateCredentials": {
|
|
195368
|
-
capName: "training-provider",
|
|
195369
|
-
capScope: "system",
|
|
195370
|
-
addonId: null,
|
|
195371
|
-
access: "create",
|
|
195372
|
-
role: "admin"
|
|
195373
|
-
},
|
|
195374
195255
|
"turnProvider.getTurnServers": {
|
|
195375
195256
|
capName: "turn-provider",
|
|
195376
195257
|
capScope: "system",
|