@camstack/addon-export-google 0.1.128 → 0.1.129
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/export-google.addon.js +736 -855
- package/dist/export-google.addon.mjs +736 -855
- package/package.json +2 -2
|
@@ -6056,7 +6056,7 @@ var ZodIssueCode = {
|
|
|
6056
6056
|
var ZodFirstPartyTypeKind;
|
|
6057
6057
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
6058
6058
|
//#endregion
|
|
6059
|
-
//#region ../types/dist/sleep-
|
|
6059
|
+
//#region ../types/dist/sleep-D7ZKm4nb.mjs
|
|
6060
6060
|
/**
|
|
6061
6061
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
6062
6062
|
* window to float samples (D455).
|
|
@@ -6765,10 +6765,33 @@ function integrationRowsApiOver(api) {
|
|
|
6765
6765
|
};
|
|
6766
6766
|
}
|
|
6767
6767
|
var PREFIX$1 = "records/";
|
|
6768
|
+
/**
|
|
6769
|
+
* Cross-realm brand. An addon bundles its own copy of this module (D15) while
|
|
6770
|
+
* `ctx.records` is the HOST's door, so an error thrown by the host is an
|
|
6771
|
+
* instance of the host's classes, not of the addon's. The brand plus the code
|
|
6772
|
+
* make `instanceof` answer by identity of the failure, not of the copy.
|
|
6773
|
+
*/
|
|
6774
|
+
var RECORDS_ERROR_BRAND = Symbol.for("camstack.records-error");
|
|
6775
|
+
function carriesBrand(value) {
|
|
6776
|
+
return typeof value === "object" && value !== null && Reflect.get(value, RECORDS_ERROR_BRAND) === true;
|
|
6777
|
+
}
|
|
6768
6778
|
/** The base of every records failure. `detail` is the human part of the message. */
|
|
6769
6779
|
var RecordsError = class extends Error {
|
|
6780
|
+
/** The code a subclass stands for; the base stands for every code. */
|
|
6781
|
+
static code = void 0;
|
|
6782
|
+
/**
|
|
6783
|
+
* `instanceof` across copies of this module: any branded error is a
|
|
6784
|
+
* `RecordsError`, and is an instance of a subclass only when its code is the
|
|
6785
|
+
* subclass's code. Same-copy answers are unchanged.
|
|
6786
|
+
*/
|
|
6787
|
+
static [Symbol.hasInstance](value) {
|
|
6788
|
+
if (Function.prototype[Symbol.hasInstance].call(this, value)) return true;
|
|
6789
|
+
if (!carriesBrand(value)) return false;
|
|
6790
|
+
return this.code === void 0 || value.code === this.code;
|
|
6791
|
+
}
|
|
6770
6792
|
code;
|
|
6771
6793
|
detail;
|
|
6794
|
+
[RECORDS_ERROR_BRAND] = true;
|
|
6772
6795
|
constructor(code, detail) {
|
|
6773
6796
|
super(`${PREFIX$1}${code}: ${detail}`);
|
|
6774
6797
|
this.name = "RecordsError";
|
|
@@ -6777,29 +6800,33 @@ var RecordsError = class extends Error {
|
|
|
6777
6800
|
}
|
|
6778
6801
|
};
|
|
6779
6802
|
/** A write guarded by `ifRev` found another revision (or an existing row for `ifRev: 0`). */
|
|
6780
|
-
var RevConflictError = class extends RecordsError {
|
|
6803
|
+
var RevConflictError = class RevConflictError extends RecordsError {
|
|
6804
|
+
static code = "rev-conflict";
|
|
6781
6805
|
constructor(detail) {
|
|
6782
|
-
super(
|
|
6806
|
+
super(RevConflictError.code, detail);
|
|
6783
6807
|
this.name = "RevConflictError";
|
|
6784
6808
|
}
|
|
6785
6809
|
};
|
|
6786
6810
|
/** The keychain could not store or serve a value: explicit, never an empty string. */
|
|
6787
|
-
var RecordSecretUnavailableError = class extends RecordsError {
|
|
6811
|
+
var RecordSecretUnavailableError = class RecordSecretUnavailableError extends RecordsError {
|
|
6812
|
+
static code = "secret-unavailable";
|
|
6788
6813
|
constructor(detail) {
|
|
6789
|
-
super(
|
|
6814
|
+
super(RecordSecretUnavailableError.code, detail);
|
|
6790
6815
|
this.name = "RecordSecretUnavailableError";
|
|
6791
6816
|
}
|
|
6792
6817
|
};
|
|
6793
|
-
var InvalidRecordError = class extends RecordsError {
|
|
6818
|
+
var InvalidRecordError = class InvalidRecordError extends RecordsError {
|
|
6819
|
+
static code = "invalid-record";
|
|
6794
6820
|
constructor(detail) {
|
|
6795
|
-
super(
|
|
6821
|
+
super(InvalidRecordError.code, detail);
|
|
6796
6822
|
this.name = "InvalidRecordError";
|
|
6797
6823
|
}
|
|
6798
6824
|
};
|
|
6799
6825
|
/** A kind declaration the engine refuses (non-additive change, bad shape, wrong file). */
|
|
6800
|
-
var DeclarationRefusedError = class extends RecordsError {
|
|
6826
|
+
var DeclarationRefusedError = class DeclarationRefusedError extends RecordsError {
|
|
6827
|
+
static code = "declaration-refused";
|
|
6801
6828
|
constructor(detail) {
|
|
6802
|
-
super(
|
|
6829
|
+
super(DeclarationRefusedError.code, detail);
|
|
6803
6830
|
this.name = "DeclarationRefusedError";
|
|
6804
6831
|
}
|
|
6805
6832
|
};
|
|
@@ -9594,271 +9621,6 @@ function normalizeAddonInitResult(result) {
|
|
|
9594
9621
|
if (Array.isArray(result)) return { providers: result };
|
|
9595
9622
|
return result;
|
|
9596
9623
|
}
|
|
9597
|
-
/**
|
|
9598
|
-
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
9599
|
-
* and validates them (`ShareViewGrantSchema` builds its
|
|
9600
|
-
* enum from this list); a data plane names the kinds it ACCEPTS in `share`.
|
|
9601
|
-
*/
|
|
9602
|
-
var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
|
|
9603
|
-
/** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
|
|
9604
|
-
var PeerBytesTicketSchema = object({
|
|
9605
|
-
/** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
|
|
9606
|
-
url: string().min(1),
|
|
9607
|
-
/**
|
|
9608
|
-
* The HOST node this URL means something on — the hub or a named agent,
|
|
9609
|
-
* never a runner. {@link AddonPeerBytes.open} compares it to its own and
|
|
9610
|
-
* refuses `cross-node` by name when they differ, without dialling.
|
|
9611
|
-
*/
|
|
9612
|
-
hostNodeId: string().min(1),
|
|
9613
|
-
expiresAtMs: number().int().nonnegative(),
|
|
9614
|
-
/**
|
|
9615
|
-
* What the producer DECLARED the body to be, when it knows — `null` when it
|
|
9616
|
-
* does not. Never `0` for unknown (D393): a consumer sizing a bound off this
|
|
9617
|
-
* must be able to tell "the producer did not say" from "the body is empty".
|
|
9618
|
-
*/
|
|
9619
|
-
declaredBytes: number().int().nonnegative().nullable()
|
|
9620
|
-
});
|
|
9621
|
-
function defOf(schema) {
|
|
9622
|
-
const zodBag = Reflect.get(schema, "_zod");
|
|
9623
|
-
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
9624
|
-
const def = Reflect.get(zodBag, "def");
|
|
9625
|
-
if (typeof def !== "object" || def === null) return {};
|
|
9626
|
-
return def;
|
|
9627
|
-
}
|
|
9628
|
-
function declaredHere(schema) {
|
|
9629
|
-
return globalRegistry.get(schema)?.secret === true;
|
|
9630
|
-
}
|
|
9631
|
-
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
9632
|
-
var WRAPPERS = new Set([
|
|
9633
|
-
"optional",
|
|
9634
|
-
"nullable",
|
|
9635
|
-
"default",
|
|
9636
|
-
"prefault",
|
|
9637
|
-
"catch",
|
|
9638
|
-
"readonly",
|
|
9639
|
-
"nonoptional"
|
|
9640
|
-
]);
|
|
9641
|
-
/**
|
|
9642
|
-
* The schema layers that make up ONE field: the schema itself and every
|
|
9643
|
-
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
9644
|
-
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
9645
|
-
* `.transform` on `in`).
|
|
9646
|
-
*/
|
|
9647
|
-
function layersOf(schema) {
|
|
9648
|
-
const out = [];
|
|
9649
|
-
const queue = [schema];
|
|
9650
|
-
while (queue.length > 0) {
|
|
9651
|
-
const s = queue.shift();
|
|
9652
|
-
if (!s || out.includes(s)) continue;
|
|
9653
|
-
out.push(s);
|
|
9654
|
-
const def = defOf(s);
|
|
9655
|
-
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
9656
|
-
if (def.type === "pipe") {
|
|
9657
|
-
if (def.in) queue.push(def.in);
|
|
9658
|
-
if (def.out) queue.push(def.out);
|
|
9659
|
-
}
|
|
9660
|
-
}
|
|
9661
|
-
return out;
|
|
9662
|
-
}
|
|
9663
|
-
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
9664
|
-
function isZodSecret(schema) {
|
|
9665
|
-
return layersOf(schema).some(declaredHere);
|
|
9666
|
-
}
|
|
9667
|
-
/**
|
|
9668
|
-
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
9669
|
-
* element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
|
|
9670
|
-
* map" (`applianceSecrets{}`). A declared
|
|
9671
|
-
* object or array is reported as one path and not descended into — everything
|
|
9672
|
-
* under it is secret.
|
|
9673
|
-
*/
|
|
9674
|
-
function collectZodSecretPaths(schema, prefix = "") {
|
|
9675
|
-
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
9676
|
-
const paths = [];
|
|
9677
|
-
for (const layer of layersOf(schema)) {
|
|
9678
|
-
const def = defOf(layer);
|
|
9679
|
-
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
9680
|
-
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
9681
|
-
else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
|
|
9682
|
-
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
9683
|
-
else if (def.type === "intersection") {
|
|
9684
|
-
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
9685
|
-
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
9686
|
-
}
|
|
9687
|
-
}
|
|
9688
|
-
return [...new Set(paths)];
|
|
9689
|
-
}
|
|
9690
|
-
/**
|
|
9691
|
-
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
9692
|
-
* Zod row schema that describes it, and the helper that turns the two into the
|
|
9693
|
-
* JSON the engine stores.
|
|
9694
|
-
*
|
|
9695
|
-
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
9696
|
-
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
9697
|
-
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
9698
|
-
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
9699
|
-
* never a field name (D879).
|
|
9700
|
-
*/
|
|
9701
|
-
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
9702
|
-
var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
9703
|
-
var RecordIndexSchema = object({
|
|
9704
|
-
name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
9705
|
-
fields: array(RecordFieldPathSchema).min(1).max(4),
|
|
9706
|
-
unique: boolean().optional()
|
|
9707
|
-
}).strict();
|
|
9708
|
-
var RecordRetentionSchema = union([
|
|
9709
|
-
object({
|
|
9710
|
-
ttlMs: number().int().positive(),
|
|
9711
|
-
from: _enum(["at", "write"])
|
|
9712
|
-
}).strict(),
|
|
9713
|
-
object({
|
|
9714
|
-
maxRows: number().int().positive().optional(),
|
|
9715
|
-
maxRowsPerDevice: number().int().positive().optional()
|
|
9716
|
-
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
9717
|
-
object({
|
|
9718
|
-
owner: string().min(1),
|
|
9719
|
-
reason: string().min(1)
|
|
9720
|
-
}).strict(),
|
|
9721
|
-
object({ none: string().min(1) }).strict()
|
|
9722
|
-
]);
|
|
9723
|
-
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
9724
|
-
var EntryDescriptorSchema = object({
|
|
9725
|
-
title: string().min(1),
|
|
9726
|
-
/** The record body field shown as the entry's name. */
|
|
9727
|
-
nameField: string().min(1),
|
|
9728
|
-
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
9729
|
-
fields: record(string(), unknown())
|
|
9730
|
-
}).strict();
|
|
9731
|
-
/** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
|
|
9732
|
-
var RecordKindDeclarationSchema = object({
|
|
9733
|
-
database: _enum(RECORD_DATABASES).default("settings"),
|
|
9734
|
-
class: _enum(RECORD_CLASSES),
|
|
9735
|
-
writeTrigger: string().min(1),
|
|
9736
|
-
device: _enum([
|
|
9737
|
-
"required",
|
|
9738
|
-
"optional",
|
|
9739
|
-
"none"
|
|
9740
|
-
]).default("none"),
|
|
9741
|
-
at: _enum(["required", "none"]).default("none"),
|
|
9742
|
-
indexes: array(RecordIndexSchema).max(8).default([]),
|
|
9743
|
-
retention: RecordRetentionSchema,
|
|
9744
|
-
deviceRemoval: _enum(["delete", "none"]).default("none"),
|
|
9745
|
-
maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
9746
|
-
/** Derived from the Zod schema; never written by hand. */
|
|
9747
|
-
secretPaths: array(string().min(1)).default([]),
|
|
9748
|
-
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
9749
|
-
secretArrayKeys: record(string(), string()).default({}),
|
|
9750
|
-
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
9751
|
-
transactFamily: string().min(1).optional(),
|
|
9752
|
-
entry: EntryDescriptorSchema.optional()
|
|
9753
|
-
}).strict();
|
|
9754
|
-
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
9755
|
-
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
9756
|
-
/** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
|
|
9757
|
-
function assertValidDeclaration(name, decl) {
|
|
9758
|
-
const refuse = (why) => {
|
|
9759
|
-
throw new DeclarationRefusedError(`kind "${name}": ${why}`);
|
|
9760
|
-
};
|
|
9761
|
-
if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
|
|
9762
|
-
const seen = /* @__PURE__ */ new Set();
|
|
9763
|
-
for (const index of decl.indexes) {
|
|
9764
|
-
if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
|
|
9765
|
-
seen.add(index.name);
|
|
9766
|
-
}
|
|
9767
|
-
const { retention } = decl;
|
|
9768
|
-
const hasSecrets = decl.secretPaths.length > 0;
|
|
9769
|
-
if ("ttlMs" in retention) {
|
|
9770
|
-
if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
|
|
9771
|
-
if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
|
|
9772
|
-
}
|
|
9773
|
-
if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
|
|
9774
|
-
if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
|
|
9775
|
-
if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
|
|
9776
|
-
if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
|
|
9777
|
-
const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
|
|
9778
|
-
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)`);
|
|
9779
|
-
}
|
|
9780
|
-
if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
|
|
9781
|
-
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`);
|
|
9782
|
-
}
|
|
9783
|
-
function bodyFieldsOf(schema) {
|
|
9784
|
-
return { ...toJSONSchema(schema, {
|
|
9785
|
-
unrepresentable: "any",
|
|
9786
|
-
io: "input"
|
|
9787
|
-
}) };
|
|
9788
|
-
}
|
|
9789
|
-
function isRecordLike(value) {
|
|
9790
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9791
|
-
}
|
|
9792
|
-
/** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
|
|
9793
|
-
function hasNameField(json, field) {
|
|
9794
|
-
const branches = json["oneOf"] ?? json["anyOf"];
|
|
9795
|
-
if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
|
|
9796
|
-
const properties = json["properties"];
|
|
9797
|
-
return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
|
|
9798
|
-
}
|
|
9799
|
-
/**
|
|
9800
|
-
* Declare the kinds of a package. The keys are the kind names. The result is
|
|
9801
|
-
* what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
|
|
9802
|
-
* types its handle from.
|
|
9803
|
-
*/
|
|
9804
|
-
function defineRecordKinds(specs) {
|
|
9805
|
-
const out = {};
|
|
9806
|
-
for (const [name, spec] of Object.entries(specs)) {
|
|
9807
|
-
const secretPaths = collectZodSecretPaths(spec.schema);
|
|
9808
|
-
const nameField = spec.entry?.nameField ?? "name";
|
|
9809
|
-
const fields = bodyFieldsOf(spec.schema);
|
|
9810
|
-
if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
|
|
9811
|
-
const parsed = RecordKindDeclarationSchema.parse({
|
|
9812
|
-
database: spec.database,
|
|
9813
|
-
class: spec.class,
|
|
9814
|
-
writeTrigger: spec.writeTrigger,
|
|
9815
|
-
device: spec.device,
|
|
9816
|
-
at: spec.at,
|
|
9817
|
-
indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
|
|
9818
|
-
retention: spec.retention,
|
|
9819
|
-
deviceRemoval: spec.deviceRemoval,
|
|
9820
|
-
maxDataBytes: spec.maxDataBytes,
|
|
9821
|
-
secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
|
|
9822
|
-
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
9823
|
-
transactFamily: spec.transactFamily,
|
|
9824
|
-
entry: spec.entry === void 0 ? void 0 : {
|
|
9825
|
-
title: spec.entry.title,
|
|
9826
|
-
nameField,
|
|
9827
|
-
fields
|
|
9828
|
-
}
|
|
9829
|
-
});
|
|
9830
|
-
assertValidDeclaration(name, parsed);
|
|
9831
|
-
out[name] = {
|
|
9832
|
-
name,
|
|
9833
|
-
schema: spec.schema,
|
|
9834
|
-
declaration: parsed
|
|
9835
|
-
};
|
|
9836
|
-
}
|
|
9837
|
-
return out;
|
|
9838
|
-
}
|
|
9839
|
-
/**
|
|
9840
|
-
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
9841
|
-
* engine, never aged, belonging to no device.
|
|
9842
|
-
*/
|
|
9843
|
-
function defineEntryKind(name, spec) {
|
|
9844
|
-
const defined = defineRecordKinds({ [name]: {
|
|
9845
|
-
schema: spec.schema,
|
|
9846
|
-
class: "config",
|
|
9847
|
-
writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
|
|
9848
|
-
retention: { none: "an entry goes only when the operator deletes it" },
|
|
9849
|
-
...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
|
|
9850
|
-
...spec.database === void 0 ? {} : { database: spec.database },
|
|
9851
|
-
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
9852
|
-
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
9853
|
-
...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
|
|
9854
|
-
entry: {
|
|
9855
|
-
title: spec.title,
|
|
9856
|
-
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
9857
|
-
}
|
|
9858
|
-
} })[name];
|
|
9859
|
-
if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
|
|
9860
|
-
return defined;
|
|
9861
|
-
}
|
|
9862
9624
|
object({
|
|
9863
9625
|
field: string().min(1),
|
|
9864
9626
|
on: literal("advance")
|
|
@@ -9947,6 +9709,271 @@ function optionalMethod(input, output, options) {
|
|
|
9947
9709
|
providerOptional: true
|
|
9948
9710
|
};
|
|
9949
9711
|
}
|
|
9712
|
+
function defOf(schema) {
|
|
9713
|
+
const zodBag = Reflect.get(schema, "_zod");
|
|
9714
|
+
if (typeof zodBag !== "object" || zodBag === null) return {};
|
|
9715
|
+
const def = Reflect.get(zodBag, "def");
|
|
9716
|
+
if (typeof def !== "object" || def === null) return {};
|
|
9717
|
+
return def;
|
|
9718
|
+
}
|
|
9719
|
+
function declaredHere(schema) {
|
|
9720
|
+
return globalRegistry.get(schema)?.secret === true;
|
|
9721
|
+
}
|
|
9722
|
+
/** Wrapper kinds whose `innerType` is the field itself. */
|
|
9723
|
+
var WRAPPERS = new Set([
|
|
9724
|
+
"optional",
|
|
9725
|
+
"nullable",
|
|
9726
|
+
"default",
|
|
9727
|
+
"prefault",
|
|
9728
|
+
"catch",
|
|
9729
|
+
"readonly",
|
|
9730
|
+
"nonoptional"
|
|
9731
|
+
]);
|
|
9732
|
+
/**
|
|
9733
|
+
* The schema layers that make up ONE field: the schema itself and every
|
|
9734
|
+
* wrapper below it (optional / default / nullable / readonly / catch), plus
|
|
9735
|
+
* both sides of a pipe (`z.preprocess` puts the real schema on `out`,
|
|
9736
|
+
* `.transform` on `in`).
|
|
9737
|
+
*/
|
|
9738
|
+
function layersOf(schema) {
|
|
9739
|
+
const out = [];
|
|
9740
|
+
const queue = [schema];
|
|
9741
|
+
while (queue.length > 0) {
|
|
9742
|
+
const s = queue.shift();
|
|
9743
|
+
if (!s || out.includes(s)) continue;
|
|
9744
|
+
out.push(s);
|
|
9745
|
+
const def = defOf(s);
|
|
9746
|
+
if (def.type !== void 0 && WRAPPERS.has(def.type) && def.innerType) queue.push(def.innerType);
|
|
9747
|
+
if (def.type === "pipe") {
|
|
9748
|
+
if (def.in) queue.push(def.in);
|
|
9749
|
+
if (def.out) queue.push(def.out);
|
|
9750
|
+
}
|
|
9751
|
+
}
|
|
9752
|
+
return out;
|
|
9753
|
+
}
|
|
9754
|
+
/** True when any layer of this field declares `.meta({ secret: true })`. */
|
|
9755
|
+
function isZodSecret(schema) {
|
|
9756
|
+
return layersOf(schema).some(declaredHere);
|
|
9757
|
+
}
|
|
9758
|
+
/**
|
|
9759
|
+
* Every declared secret path in a config schema: dotted keys, `[]` for "each
|
|
9760
|
+
* element of this array" (`connection.password`, `rows[].token`), `{}` for "each value of this
|
|
9761
|
+
* map" (`applianceSecrets{}`). A declared
|
|
9762
|
+
* object or array is reported as one path and not descended into — everything
|
|
9763
|
+
* under it is secret.
|
|
9764
|
+
*/
|
|
9765
|
+
function collectZodSecretPaths(schema, prefix = "") {
|
|
9766
|
+
if (isZodSecret(schema)) return prefix.length > 0 ? [prefix] : [];
|
|
9767
|
+
const paths = [];
|
|
9768
|
+
for (const layer of layersOf(schema)) {
|
|
9769
|
+
const def = defOf(layer);
|
|
9770
|
+
if (def.type === "object" && def.shape) for (const [key, child] of Object.entries(def.shape)) paths.push(...collectZodSecretPaths(child, prefix ? `${prefix}.${key}` : key));
|
|
9771
|
+
else if (def.type === "array" && def.element) paths.push(...collectZodSecretPaths(def.element, `${prefix}[]`));
|
|
9772
|
+
else if (def.type === "record" && def.valueType) paths.push(...collectZodSecretPaths(def.valueType, `${prefix}{}`));
|
|
9773
|
+
else if (def.type === "union" && def.options) for (const option of def.options) paths.push(...collectZodSecretPaths(option, prefix));
|
|
9774
|
+
else if (def.type === "intersection") {
|
|
9775
|
+
if (def.left) paths.push(...collectZodSecretPaths(def.left, prefix));
|
|
9776
|
+
if (def.right) paths.push(...collectZodSecretPaths(def.right, prefix));
|
|
9777
|
+
}
|
|
9778
|
+
}
|
|
9779
|
+
return [...new Set(paths)];
|
|
9780
|
+
}
|
|
9781
|
+
/**
|
|
9782
|
+
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
9783
|
+
* Zod row schema that describes it, and the helper that turns the two into the
|
|
9784
|
+
* JSON the engine stores.
|
|
9785
|
+
*
|
|
9786
|
+
* A kind is declared ONCE, next to the code that owns it, and the engine's
|
|
9787
|
+
* reconciler creates its indexes - nothing creates DDL at runtime from a write.
|
|
9788
|
+
* Everything the generic machinery needs (secret fields, the entry descriptor)
|
|
9789
|
+
* is DERIVED from the Zod schema: `.meta({ secret: true })` marks a credential,
|
|
9790
|
+
* never a field name (D879).
|
|
9791
|
+
*/
|
|
9792
|
+
/** A JSON field path: `trackId`, `auth.accessToken`. Charset-restricted: it is rendered into DDL. */
|
|
9793
|
+
var RecordFieldPathSchema = string().regex(/^[A-Za-z_][A-Za-z0-9_]{0,63}(\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/);
|
|
9794
|
+
var RecordIndexSchema = object({
|
|
9795
|
+
name: string().regex(/^[a-z][a-z0-9_]{0,31}$/),
|
|
9796
|
+
fields: array(RecordFieldPathSchema).min(1).max(4),
|
|
9797
|
+
unique: boolean().optional()
|
|
9798
|
+
}).strict();
|
|
9799
|
+
var RecordRetentionSchema = union([
|
|
9800
|
+
object({
|
|
9801
|
+
ttlMs: number().int().positive(),
|
|
9802
|
+
from: _enum(["at", "write"])
|
|
9803
|
+
}).strict(),
|
|
9804
|
+
object({
|
|
9805
|
+
maxRows: number().int().positive().optional(),
|
|
9806
|
+
maxRowsPerDevice: number().int().positive().optional()
|
|
9807
|
+
}).strict().refine((r) => r.maxRows !== void 0 || r.maxRowsPerDevice !== void 0, { message: "name maxRows, maxRowsPerDevice or both" }),
|
|
9808
|
+
object({
|
|
9809
|
+
owner: string().min(1),
|
|
9810
|
+
reason: string().min(1)
|
|
9811
|
+
}).strict(),
|
|
9812
|
+
object({ none: string().min(1) }).strict()
|
|
9813
|
+
]);
|
|
9814
|
+
/** The descriptor a generic entries UI reads (D881 "generic entries"). */
|
|
9815
|
+
var EntryDescriptorSchema = object({
|
|
9816
|
+
title: string().min(1),
|
|
9817
|
+
/** The record body field shown as the entry's name. */
|
|
9818
|
+
nameField: string().min(1),
|
|
9819
|
+
/** JSON Schema of the entry body; `secret: true` marks a password field. */
|
|
9820
|
+
fields: record(string(), unknown())
|
|
9821
|
+
}).strict();
|
|
9822
|
+
/** What crosses the wire from an addon: JSON only, no Zod. An unknown key is refused. */
|
|
9823
|
+
var RecordKindDeclarationSchema = object({
|
|
9824
|
+
database: _enum(RECORD_DATABASES).default("settings"),
|
|
9825
|
+
class: _enum(RECORD_CLASSES),
|
|
9826
|
+
writeTrigger: string().min(1),
|
|
9827
|
+
device: _enum([
|
|
9828
|
+
"required",
|
|
9829
|
+
"optional",
|
|
9830
|
+
"none"
|
|
9831
|
+
]).default("none"),
|
|
9832
|
+
at: _enum(["required", "none"]).default("none"),
|
|
9833
|
+
indexes: array(RecordIndexSchema).max(8).default([]),
|
|
9834
|
+
retention: RecordRetentionSchema,
|
|
9835
|
+
deviceRemoval: _enum(["delete", "none"]).default("none"),
|
|
9836
|
+
maxDataBytes: number().int().positive().max(RECORD_MAX_DATA_BYTES).default(RECORD_DEFAULT_MAX_DATA_BYTES),
|
|
9837
|
+
/** Derived from the Zod schema; never written by hand. */
|
|
9838
|
+
secretPaths: array(string().min(1)).default([]),
|
|
9839
|
+
/** The id key of each array that carries a secret (`{ headers: 'name' }`). */
|
|
9840
|
+
secretArrayKeys: record(string(), string()).default({}),
|
|
9841
|
+
/** Kinds that must agree through `transact` sit in one file under one family name. */
|
|
9842
|
+
transactFamily: string().min(1).optional(),
|
|
9843
|
+
entry: EntryDescriptorSchema.optional()
|
|
9844
|
+
}).strict();
|
|
9845
|
+
/** The kind names: lower-case, dash separated, short enough for an index name. */
|
|
9846
|
+
var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
|
|
9847
|
+
/** Cross-field rules a declaration must satisfy. Throws {@link DeclarationRefusedError}. */
|
|
9848
|
+
function assertValidDeclaration(name, decl) {
|
|
9849
|
+
const refuse = (why) => {
|
|
9850
|
+
throw new DeclarationRefusedError(`kind "${name}": ${why}`);
|
|
9851
|
+
};
|
|
9852
|
+
if (!RecordKindNameSchema.safeParse(name).success) refuse("the name must be lower-case-dashed");
|
|
9853
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9854
|
+
for (const index of decl.indexes) {
|
|
9855
|
+
if (seen.has(index.name)) refuse(`index name "${index.name}" is declared twice`);
|
|
9856
|
+
seen.add(index.name);
|
|
9857
|
+
}
|
|
9858
|
+
const { retention } = decl;
|
|
9859
|
+
const hasSecrets = decl.secretPaths.length > 0;
|
|
9860
|
+
if ("ttlMs" in retention) {
|
|
9861
|
+
if (retention.from === "at" && decl.at !== "required") refuse("a ttl from \"at\" needs at: \"required\"");
|
|
9862
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use engine TTL (its keychain values would be orphaned)");
|
|
9863
|
+
}
|
|
9864
|
+
if ("maxRows" in retention || "maxRowsPerDevice" in retention) {
|
|
9865
|
+
if (retention.maxRowsPerDevice !== void 0 && decl.device !== "required") refuse("maxRowsPerDevice needs device: \"required\"");
|
|
9866
|
+
if (decl.at !== "required") refuse("a row bound trims the oldest \"at\": it needs at: \"required\"");
|
|
9867
|
+
if (hasSecrets) refuse("a kind with secret fields cannot use an engine row bound");
|
|
9868
|
+
const bound = Math.max(retention.maxRows ?? 0, retention.maxRowsPerDevice ?? 0);
|
|
9869
|
+
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)`);
|
|
9870
|
+
}
|
|
9871
|
+
if (decl.deviceRemoval === "delete" && decl.device === "none") refuse("deviceRemoval: \"delete\" needs a device: \"required\" or \"optional\"");
|
|
9872
|
+
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`);
|
|
9873
|
+
}
|
|
9874
|
+
function bodyFieldsOf(schema) {
|
|
9875
|
+
return { ...toJSONSchema(schema, {
|
|
9876
|
+
unrepresentable: "any",
|
|
9877
|
+
io: "input"
|
|
9878
|
+
}) };
|
|
9879
|
+
}
|
|
9880
|
+
function isRecordLike(value) {
|
|
9881
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
9882
|
+
}
|
|
9883
|
+
/** Does every branch of the body schema carry `field`? (A discriminated union has several.) */
|
|
9884
|
+
function hasNameField(json, field) {
|
|
9885
|
+
const branches = json["oneOf"] ?? json["anyOf"];
|
|
9886
|
+
if (Array.isArray(branches)) return branches.length > 0 && branches.every((b) => isRecordLike(b) && hasNameField(b, field));
|
|
9887
|
+
const properties = json["properties"];
|
|
9888
|
+
return isRecordLike(properties) && Object.prototype.hasOwnProperty.call(properties, field);
|
|
9889
|
+
}
|
|
9890
|
+
/**
|
|
9891
|
+
* Declare the kinds of a package. The keys are the kind names. The result is
|
|
9892
|
+
* what `ctx.records.declare` sends to the engine and what `ctx.records.kind`
|
|
9893
|
+
* types its handle from.
|
|
9894
|
+
*/
|
|
9895
|
+
function defineRecordKinds(specs) {
|
|
9896
|
+
const out = {};
|
|
9897
|
+
for (const [name, spec] of Object.entries(specs)) {
|
|
9898
|
+
const secretPaths = collectZodSecretPaths(spec.schema);
|
|
9899
|
+
const nameField = spec.entry?.nameField ?? "name";
|
|
9900
|
+
const fields = bodyFieldsOf(spec.schema);
|
|
9901
|
+
if (spec.entry !== void 0 && !hasNameField(fields, nameField)) throw new DeclarationRefusedError(`kind "${name}": an entry kind's schema needs a "${nameField}" field`);
|
|
9902
|
+
const parsed = RecordKindDeclarationSchema.parse({
|
|
9903
|
+
database: spec.database,
|
|
9904
|
+
class: spec.class,
|
|
9905
|
+
writeTrigger: spec.writeTrigger,
|
|
9906
|
+
device: spec.device,
|
|
9907
|
+
at: spec.at,
|
|
9908
|
+
indexes: spec.indexes === void 0 ? void 0 : [...spec.indexes],
|
|
9909
|
+
retention: spec.retention,
|
|
9910
|
+
deviceRemoval: spec.deviceRemoval,
|
|
9911
|
+
maxDataBytes: spec.maxDataBytes,
|
|
9912
|
+
secretPaths: [...new Set([...secretPaths, ...spec.retiredSecretPaths ?? []])],
|
|
9913
|
+
secretArrayKeys: spec.secretArrayKeys === void 0 ? void 0 : { ...spec.secretArrayKeys },
|
|
9914
|
+
transactFamily: spec.transactFamily,
|
|
9915
|
+
entry: spec.entry === void 0 ? void 0 : {
|
|
9916
|
+
title: spec.entry.title,
|
|
9917
|
+
nameField,
|
|
9918
|
+
fields
|
|
9919
|
+
}
|
|
9920
|
+
});
|
|
9921
|
+
assertValidDeclaration(name, parsed);
|
|
9922
|
+
out[name] = {
|
|
9923
|
+
name,
|
|
9924
|
+
schema: spec.schema,
|
|
9925
|
+
declaration: parsed
|
|
9926
|
+
};
|
|
9927
|
+
}
|
|
9928
|
+
return out;
|
|
9929
|
+
}
|
|
9930
|
+
/**
|
|
9931
|
+
* Declare one entry kind. An entry is configuration: never trimmed by the
|
|
9932
|
+
* engine, never aged, belonging to no device.
|
|
9933
|
+
*/
|
|
9934
|
+
function defineEntryKind(name, spec) {
|
|
9935
|
+
const defined = defineRecordKinds({ [name]: {
|
|
9936
|
+
schema: spec.schema,
|
|
9937
|
+
class: "config",
|
|
9938
|
+
writeTrigger: spec.writeTrigger ?? "an operator adds or edits an entry in the entries UI",
|
|
9939
|
+
retention: { none: "an entry goes only when the operator deletes it" },
|
|
9940
|
+
...spec.maxDataBytes === void 0 ? {} : { maxDataBytes: spec.maxDataBytes },
|
|
9941
|
+
...spec.database === void 0 ? {} : { database: spec.database },
|
|
9942
|
+
...spec.indexes === void 0 ? {} : { indexes: spec.indexes },
|
|
9943
|
+
...spec.secretArrayKeys === void 0 ? {} : { secretArrayKeys: spec.secretArrayKeys },
|
|
9944
|
+
...spec.retiredSecretPaths === void 0 ? {} : { retiredSecretPaths: spec.retiredSecretPaths },
|
|
9945
|
+
entry: {
|
|
9946
|
+
title: spec.title,
|
|
9947
|
+
...spec.nameField === void 0 ? {} : { nameField: spec.nameField }
|
|
9948
|
+
}
|
|
9949
|
+
} })[name];
|
|
9950
|
+
if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
|
|
9951
|
+
return defined;
|
|
9952
|
+
}
|
|
9953
|
+
/**
|
|
9954
|
+
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
9955
|
+
* and validates them (`ShareViewGrantSchema` builds its
|
|
9956
|
+
* enum from this list); a data plane names the kinds it ACCEPTS in `share`.
|
|
9957
|
+
*/
|
|
9958
|
+
var SHARE_VIEW_KINDS = ["grid-view", "events-view"];
|
|
9959
|
+
/** The wire shape of {@link PeerBytesTicket} — see the type for what it is. */
|
|
9960
|
+
var PeerBytesTicketSchema = object({
|
|
9961
|
+
/** `http://127.0.0.1:<port>/<token>`. One `GET` takes it. */
|
|
9962
|
+
url: string().min(1),
|
|
9963
|
+
/**
|
|
9964
|
+
* The HOST node this URL means something on — the hub or a named agent,
|
|
9965
|
+
* never a runner. {@link AddonPeerBytes.open} compares it to its own and
|
|
9966
|
+
* refuses `cross-node` by name when they differ, without dialling.
|
|
9967
|
+
*/
|
|
9968
|
+
hostNodeId: string().min(1),
|
|
9969
|
+
expiresAtMs: number().int().nonnegative(),
|
|
9970
|
+
/**
|
|
9971
|
+
* What the producer DECLARED the body to be, when it knows — `null` when it
|
|
9972
|
+
* does not. Never `0` for unknown (D393): a consumer sizing a bound off this
|
|
9973
|
+
* must be able to tell "the producer did not say" from "the body is empty".
|
|
9974
|
+
*/
|
|
9975
|
+
declaredBytes: number().int().nonnegative().nullable()
|
|
9976
|
+
});
|
|
9950
9977
|
var READING_QUANTITIES = [
|
|
9951
9978
|
"temperature",
|
|
9952
9979
|
"pressure",
|
|
@@ -10525,7 +10552,6 @@ var CAP_NAMES = Object.freeze([
|
|
|
10525
10552
|
"climate-control",
|
|
10526
10553
|
"color",
|
|
10527
10554
|
"composer",
|
|
10528
|
-
"connection-test",
|
|
10529
10555
|
"connectivity",
|
|
10530
10556
|
"consumables",
|
|
10531
10557
|
"contact",
|
|
@@ -12545,8 +12571,7 @@ Object.freeze({
|
|
|
12545
12571
|
"offerArtifact": 3e5,
|
|
12546
12572
|
"readResult": 3e5,
|
|
12547
12573
|
"submitJob": 18e5,
|
|
12548
|
-
"uploadDataset": 72e5
|
|
12549
|
-
"validateCredentials": 3e4
|
|
12574
|
+
"uploadDataset": 72e5
|
|
12550
12575
|
}
|
|
12551
12576
|
});
|
|
12552
12577
|
object({
|
|
@@ -14018,6 +14043,432 @@ function buildCapturingReply(envelope) {
|
|
|
14018
14043
|
};
|
|
14019
14044
|
return wrapper;
|
|
14020
14045
|
}
|
|
14046
|
+
/**
|
|
14047
|
+
* notification-output — canonical, capability-gated notification delivery.
|
|
14048
|
+
*
|
|
14049
|
+
* Apprise-derived model (see
|
|
14050
|
+
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
14051
|
+
* callers emit ONE canonical `Notification`; each provider declares a
|
|
14052
|
+
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
14053
|
+
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
14054
|
+
* message to what the kind supports — callers never special-case a service.
|
|
14055
|
+
*
|
|
14056
|
+
* DESIGN DECISIONS (locked):
|
|
14057
|
+
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
14058
|
+
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
14059
|
+
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
14060
|
+
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
14061
|
+
* alternative would fork the UI per addon and cannot host the
|
|
14062
|
+
* discovery→adopt flow.
|
|
14063
|
+
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
14064
|
+
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
14065
|
+
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
14066
|
+
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
14067
|
+
* `addonId` the generated collection router extracts from the call input.
|
|
14068
|
+
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
14069
|
+
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
14070
|
+
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
14071
|
+
* base64 fallback needed.
|
|
14072
|
+
*
|
|
14073
|
+
* TODO (deferred, closed-set change — separate decision): add
|
|
14074
|
+
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
14075
|
+
* admin "Integrations" page.
|
|
14076
|
+
*/
|
|
14077
|
+
/**
|
|
14078
|
+
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
14079
|
+
* adapter picks what it supports and the degrade engine filters the rest.
|
|
14080
|
+
*/
|
|
14081
|
+
var AttachmentMediaTypeSchema = _enum([
|
|
14082
|
+
"image",
|
|
14083
|
+
"video",
|
|
14084
|
+
"gif",
|
|
14085
|
+
"audio",
|
|
14086
|
+
"icon"
|
|
14087
|
+
]);
|
|
14088
|
+
/**
|
|
14089
|
+
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
14090
|
+
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
14091
|
+
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
14092
|
+
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
14093
|
+
*/
|
|
14094
|
+
var AttachmentSchema = object({
|
|
14095
|
+
mediaType: AttachmentMediaTypeSchema,
|
|
14096
|
+
url: string().optional(),
|
|
14097
|
+
bytes: _instanceof(Uint8Array).optional(),
|
|
14098
|
+
mime: string().optional(),
|
|
14099
|
+
name: string().optional()
|
|
14100
|
+
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
14101
|
+
var NotificationFormatSchema = _enum([
|
|
14102
|
+
"text",
|
|
14103
|
+
"markdown",
|
|
14104
|
+
"html"
|
|
14105
|
+
]);
|
|
14106
|
+
/**
|
|
14107
|
+
* The CLOSED icon vocabulary an action button may use.
|
|
14108
|
+
*
|
|
14109
|
+
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
14110
|
+
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
14111
|
+
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
14112
|
+
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
14113
|
+
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
14114
|
+
*
|
|
14115
|
+
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
14116
|
+
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
14117
|
+
* differently.
|
|
14118
|
+
*
|
|
14119
|
+
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
14120
|
+
*
|
|
14121
|
+
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
14122
|
+
* the whole set onto its own renderer's vocabulary through a
|
|
14123
|
+
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
14124
|
+
* fallback, so adding a member here fails every adapter's build until someone
|
|
14125
|
+
* decides its glyph, which is the only place that decision can be made
|
|
14126
|
+
* honestly.
|
|
14127
|
+
*
|
|
14128
|
+
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
14129
|
+
* `disarm` straight through; iOS feeds that string to
|
|
14130
|
+
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
14131
|
+
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
14132
|
+
* mapping, and "the field is documented" is not "the value renders".
|
|
14133
|
+
*
|
|
14134
|
+
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
14135
|
+
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
14136
|
+
* so an addon that emits a token the running hub does not know does not lose an
|
|
14137
|
+
* icon — its whole `send` fails Zod validation and the notification never
|
|
14138
|
+
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
14139
|
+
*/
|
|
14140
|
+
var NotificationActionIconSchema = _enum([
|
|
14141
|
+
"acknowledge",
|
|
14142
|
+
"dismiss",
|
|
14143
|
+
"silence",
|
|
14144
|
+
"snooze",
|
|
14145
|
+
"view",
|
|
14146
|
+
"play",
|
|
14147
|
+
"open",
|
|
14148
|
+
"close",
|
|
14149
|
+
"lock",
|
|
14150
|
+
"unlock",
|
|
14151
|
+
"arm",
|
|
14152
|
+
"arm-home",
|
|
14153
|
+
"arm-away",
|
|
14154
|
+
"arm-night",
|
|
14155
|
+
"disarm",
|
|
14156
|
+
"light",
|
|
14157
|
+
"alert",
|
|
14158
|
+
"camera"
|
|
14159
|
+
]);
|
|
14160
|
+
/** A single tap-through action button. */
|
|
14161
|
+
var NotificationActionSchema = object({
|
|
14162
|
+
id: string(),
|
|
14163
|
+
label: string(),
|
|
14164
|
+
url: string().optional(),
|
|
14165
|
+
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
14166
|
+
icon: NotificationActionIconSchema.optional(),
|
|
14167
|
+
/**
|
|
14168
|
+
* Renders in a warning style where the notifier supports it.
|
|
14169
|
+
*
|
|
14170
|
+
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
14171
|
+
* else — see `notification-center/action-token.ts` for what that does and
|
|
14172
|
+
* does not buy.
|
|
14173
|
+
*/
|
|
14174
|
+
destructive: boolean().optional(),
|
|
14175
|
+
/**
|
|
14176
|
+
* How the tap should REACH the url.
|
|
14177
|
+
*
|
|
14178
|
+
* `navigate` (absent, and every button authored before this field) opens it:
|
|
14179
|
+
* the phone leaves the notification and shows whatever the callback returns.
|
|
14180
|
+
* That is right for a button whose answer the operator wants to read.
|
|
14181
|
+
*
|
|
14182
|
+
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
14183
|
+
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
14184
|
+
* an answer to the notification, and being thrown into a browser tab to
|
|
14185
|
+
* confirm it costs more attention than the notification did. A backend that
|
|
14186
|
+
* cannot do a background call renders it as an ordinary link (the adapters
|
|
14187
|
+
* fall back rather than dropping the button), so this is a preference, never
|
|
14188
|
+
* a requirement.
|
|
14189
|
+
*/
|
|
14190
|
+
mode: _enum(["navigate", "background"]).optional()
|
|
14191
|
+
});
|
|
14192
|
+
/** A delivery parameter value: what a notifier declared it takes. */
|
|
14193
|
+
var DeliveryParamValueSchema = union([
|
|
14194
|
+
string(),
|
|
14195
|
+
number(),
|
|
14196
|
+
boolean()
|
|
14197
|
+
]);
|
|
14198
|
+
/**
|
|
14199
|
+
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
14200
|
+
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
14201
|
+
* never handed one. The admin UI derives its control from this descriptor —
|
|
14202
|
+
* no editor knows a service by name.
|
|
14203
|
+
*
|
|
14204
|
+
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
14205
|
+
* run on the addon cap path).
|
|
14206
|
+
*/
|
|
14207
|
+
var DeliveryParamSchema = object({
|
|
14208
|
+
key: string().min(1),
|
|
14209
|
+
label: string(),
|
|
14210
|
+
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
14211
|
+
labelKey: string().optional(),
|
|
14212
|
+
type: _enum([
|
|
14213
|
+
"enum",
|
|
14214
|
+
"number",
|
|
14215
|
+
"boolean",
|
|
14216
|
+
"string"
|
|
14217
|
+
]),
|
|
14218
|
+
/** `enum` only: the closed set of accepted values. */
|
|
14219
|
+
options: array(object({
|
|
14220
|
+
value: string(),
|
|
14221
|
+
label: string()
|
|
14222
|
+
})).optional(),
|
|
14223
|
+
/** `number` only. */
|
|
14224
|
+
min: number().optional(),
|
|
14225
|
+
max: number().optional(),
|
|
14226
|
+
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
14227
|
+
default: DeliveryParamValueSchema.optional()
|
|
14228
|
+
});
|
|
14229
|
+
/**
|
|
14230
|
+
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
14231
|
+
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
14232
|
+
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
14233
|
+
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
14234
|
+
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
14235
|
+
* `priority` for that one target.
|
|
14236
|
+
*/
|
|
14237
|
+
var NotificationSchema = object({
|
|
14238
|
+
body: string(),
|
|
14239
|
+
title: string().optional(),
|
|
14240
|
+
format: NotificationFormatSchema.default("text"),
|
|
14241
|
+
priority: number().int().min(1).max(5).default(3),
|
|
14242
|
+
level: string().optional(),
|
|
14243
|
+
attachments: array(AttachmentSchema).optional(),
|
|
14244
|
+
clickUrl: string().optional(),
|
|
14245
|
+
actions: array(NotificationActionSchema).optional(),
|
|
14246
|
+
sound: string().optional(),
|
|
14247
|
+
ttl: number().optional(),
|
|
14248
|
+
tag: string().optional(),
|
|
14249
|
+
deviceId: number().optional(),
|
|
14250
|
+
eventId: string().optional(),
|
|
14251
|
+
metadata: record(string(), unknown()).optional(),
|
|
14252
|
+
/**
|
|
14253
|
+
* Values for the parameters the target's kind DECLARES in
|
|
14254
|
+
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
14255
|
+
* declaration by the sender; a notifier reads only the keys it declared.
|
|
14256
|
+
*/
|
|
14257
|
+
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
14258
|
+
});
|
|
14259
|
+
/** One declared native severity/priority level for a kind. */
|
|
14260
|
+
var TargetKindLevelSchema = object({
|
|
14261
|
+
id: string(),
|
|
14262
|
+
label: string(),
|
|
14263
|
+
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
14264
|
+
ordinal: number().int().min(1).max(5).nullable(),
|
|
14265
|
+
flags: object({
|
|
14266
|
+
critical: boolean().optional(),
|
|
14267
|
+
silent: boolean().optional(),
|
|
14268
|
+
noPush: boolean().optional()
|
|
14269
|
+
}).optional(),
|
|
14270
|
+
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
14271
|
+
requires: array(string()).optional(),
|
|
14272
|
+
description: string().optional()
|
|
14273
|
+
});
|
|
14274
|
+
/** The full capability block consulted before dispatch. */
|
|
14275
|
+
var TargetKindCapsSchema = object({
|
|
14276
|
+
attachments: object({
|
|
14277
|
+
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
14278
|
+
mode: _enum([
|
|
14279
|
+
"url",
|
|
14280
|
+
"bytes",
|
|
14281
|
+
"both"
|
|
14282
|
+
]),
|
|
14283
|
+
max: number().int().nonnegative(),
|
|
14284
|
+
maxBytes: number().int().positive().optional()
|
|
14285
|
+
}),
|
|
14286
|
+
/** Max action buttons (0 = none). */
|
|
14287
|
+
actions: number().int().nonnegative(),
|
|
14288
|
+
/**
|
|
14289
|
+
* Whether this kind renders a per-action ICON.
|
|
14290
|
+
*
|
|
14291
|
+
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
14292
|
+
* run on the addon cap path — three production failures in one day taught
|
|
14293
|
+
* this repo that once. Absent is read as false by the degrade engine, which
|
|
14294
|
+
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
14295
|
+
* assumed and dropped costs the operator's trust in the field.
|
|
14296
|
+
*/
|
|
14297
|
+
actionIcons: boolean().optional(),
|
|
14298
|
+
levels: array(TargetKindLevelSchema),
|
|
14299
|
+
format: array(NotificationFormatSchema),
|
|
14300
|
+
clickUrl: boolean(),
|
|
14301
|
+
sound: boolean(),
|
|
14302
|
+
ttl: boolean(),
|
|
14303
|
+
bodyMaxLen: number().int().positive()
|
|
14304
|
+
});
|
|
14305
|
+
/**
|
|
14306
|
+
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
14307
|
+
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
14308
|
+
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
14309
|
+
* the union is large and not meant for runtime validation here; the exported
|
|
14310
|
+
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
14311
|
+
*/
|
|
14312
|
+
var ConfigSchemaPassthrough$4 = unknown();
|
|
14313
|
+
var TargetKindSchema = object({
|
|
14314
|
+
kind: string(),
|
|
14315
|
+
label: string(),
|
|
14316
|
+
icon: string(),
|
|
14317
|
+
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
14318
|
+
addonId: string(),
|
|
14319
|
+
/**
|
|
14320
|
+
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
14321
|
+
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
14322
|
+
* when the addon bundles no icon for that kind — the client then falls back
|
|
14323
|
+
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
14324
|
+
*
|
|
14325
|
+
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
14326
|
+
* client, and a native client joins it onto its own hub base.
|
|
14327
|
+
*
|
|
14328
|
+
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
14329
|
+
* field that survived only because the runtime cap-router forwards provider
|
|
14330
|
+
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
14331
|
+
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
14332
|
+
* broken silently the moment output validation was tightened anywhere.
|
|
14333
|
+
*/
|
|
14334
|
+
iconUrl: string().optional(),
|
|
14335
|
+
/**
|
|
14336
|
+
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
14337
|
+
*
|
|
14338
|
+
* The server knows this and therefore says it, because the client cannot
|
|
14339
|
+
* safely guess: a React-Native client renders SVG and raster through two
|
|
14340
|
+
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
14341
|
+
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
14342
|
+
* placeholder glyph for every vector icon while the web build looked fine.
|
|
14343
|
+
*
|
|
14344
|
+
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
14345
|
+
* not been updated — a client that cannot determine the type should prefer
|
|
14346
|
+
* its raster path, which is the safe default for an unknown image.
|
|
14347
|
+
*/
|
|
14348
|
+
iconMediaType: string().optional(),
|
|
14349
|
+
configSchema: ConfigSchemaPassthrough$4,
|
|
14350
|
+
/**
|
|
14351
|
+
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
14352
|
+
* base URL, instance, chat, recipient). A save that changes any of them
|
|
14353
|
+
* while leaving a secret redacted is refused by the provider (D634), so an
|
|
14354
|
+
* editor uses this to ask for the secret on exactly those edits instead of
|
|
14355
|
+
* on every edit.
|
|
14356
|
+
*
|
|
14357
|
+
* Optional: absent from a provider that holds no secret (the Home Assistant
|
|
14358
|
+
* kinds) and from a provider older than this field — an editor that finds
|
|
14359
|
+
* it absent must assume ANY edit may need the secret.
|
|
14360
|
+
*/
|
|
14361
|
+
destinationKeys: array(string()).optional(),
|
|
14362
|
+
supportsDiscovery: boolean(),
|
|
14363
|
+
/**
|
|
14364
|
+
* Extra delivery parameters a rule may set for a target of this kind (D938).
|
|
14365
|
+
* Absent = none; the rule editor then offers nothing.
|
|
14366
|
+
*/
|
|
14367
|
+
deliveryParams: array(DeliveryParamSchema).optional(),
|
|
14368
|
+
caps: TargetKindCapsSchema
|
|
14369
|
+
});
|
|
14370
|
+
/**
|
|
14371
|
+
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
14372
|
+
* (return a presence marker only) when serving `listTargets` — never
|
|
14373
|
+
* round-trip a stored secret to the UI.
|
|
14374
|
+
*/
|
|
14375
|
+
var TargetSchema = object({
|
|
14376
|
+
id: string(),
|
|
14377
|
+
name: string(),
|
|
14378
|
+
kind: string(),
|
|
14379
|
+
addonId: string(),
|
|
14380
|
+
enabled: boolean(),
|
|
14381
|
+
config: record(string(), unknown())
|
|
14382
|
+
});
|
|
14383
|
+
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
14384
|
+
var DiscoveredTargetSchema = object({
|
|
14385
|
+
kind: string(),
|
|
14386
|
+
suggestedName: string(),
|
|
14387
|
+
config: record(string(), unknown())
|
|
14388
|
+
});
|
|
14389
|
+
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
14390
|
+
var RenderedAsSchema = object({
|
|
14391
|
+
level: string(),
|
|
14392
|
+
format: NotificationFormatSchema,
|
|
14393
|
+
attachmentsSent: number().int().nonnegative(),
|
|
14394
|
+
actionsSent: number().int().nonnegative(),
|
|
14395
|
+
truncated: boolean(),
|
|
14396
|
+
dropped: array(string())
|
|
14397
|
+
});
|
|
14398
|
+
var SendResultSchema = object({
|
|
14399
|
+
success: boolean(),
|
|
14400
|
+
error: string().optional(),
|
|
14401
|
+
renderedAs: RenderedAsSchema.optional()
|
|
14402
|
+
});
|
|
14403
|
+
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
14404
|
+
var TestResultSchema = SendResultSchema;
|
|
14405
|
+
/**
|
|
14406
|
+
* Pre-save credential probe against a partial (unsaved) target config.
|
|
14407
|
+
* `resolvedUrl` never includes secrets (token stripped from path).
|
|
14408
|
+
*/
|
|
14409
|
+
var ProbeTargetConfigResultSchema = object({
|
|
14410
|
+
ok: boolean(),
|
|
14411
|
+
resolvedUrl: string(),
|
|
14412
|
+
httpStatus: number().int().optional(),
|
|
14413
|
+
stateInstance: string().optional(),
|
|
14414
|
+
error: string().optional()
|
|
14415
|
+
});
|
|
14416
|
+
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
|
|
14417
|
+
kind: string(),
|
|
14418
|
+
config: record(string(), unknown()).optional(),
|
|
14419
|
+
/**
|
|
14420
|
+
* When editing / duplicating, the blank password field never round-trips
|
|
14421
|
+
* the stored token. Pass the source target id so the provider can restore
|
|
14422
|
+
* secrets server-side before dialling (same merge as upsert).
|
|
14423
|
+
*/
|
|
14424
|
+
targetId: string().optional()
|
|
14425
|
+
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
14426
|
+
kind: string(),
|
|
14427
|
+
config: record(string(), unknown()),
|
|
14428
|
+
/** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
|
|
14429
|
+
targetId: string().optional()
|
|
14430
|
+
}), ProbeTargetConfigResultSchema, {
|
|
14431
|
+
kind: "mutation",
|
|
14432
|
+
auth: "admin"
|
|
14433
|
+
}), method(object({
|
|
14434
|
+
targetId: string(),
|
|
14435
|
+
notification: NotificationSchema
|
|
14436
|
+
}), SendResultSchema, {
|
|
14437
|
+
kind: "mutation",
|
|
14438
|
+
auth: "admin"
|
|
14439
|
+
}), method(object({
|
|
14440
|
+
targetId: string(),
|
|
14441
|
+
sample: NotificationSchema.optional()
|
|
14442
|
+
}), TestResultSchema, {
|
|
14443
|
+
kind: "mutation",
|
|
14444
|
+
auth: "admin"
|
|
14445
|
+
}), method(object({
|
|
14446
|
+
target: TargetSchema,
|
|
14447
|
+
/**
|
|
14448
|
+
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
14449
|
+
* existing row. The UI never holds the stored token; blank / redacted
|
|
14450
|
+
* password fields are restored from this source (D634 still applies if
|
|
14451
|
+
* destinations diverge without a re-typed secret).
|
|
14452
|
+
*/
|
|
14453
|
+
cloneSecretsFrom: string().optional()
|
|
14454
|
+
}), TargetSchema, {
|
|
14455
|
+
kind: "mutation",
|
|
14456
|
+
auth: "admin"
|
|
14457
|
+
}), method(object({ targetId: string() }), _void(), {
|
|
14458
|
+
kind: "mutation",
|
|
14459
|
+
auth: "admin"
|
|
14460
|
+
}), method(object({
|
|
14461
|
+
targetId: string(),
|
|
14462
|
+
enabled: boolean()
|
|
14463
|
+
}), _void(), {
|
|
14464
|
+
kind: "mutation",
|
|
14465
|
+
auth: "admin"
|
|
14466
|
+
});
|
|
14467
|
+
looseObject({
|
|
14468
|
+
name: string().min(1),
|
|
14469
|
+
enabled: boolean().optional()
|
|
14470
|
+
});
|
|
14471
|
+
TargetSchema.omit({ id: true });
|
|
14021
14472
|
var EncodeProfileSchema = object({
|
|
14022
14473
|
video: object({
|
|
14023
14474
|
codec: _enum([
|
|
@@ -22242,7 +22693,6 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
22242
22693
|
"calendar-source": system(INTERNAL),
|
|
22243
22694
|
calendars: system("calendars feed schedules and conditions, not device actions"),
|
|
22244
22695
|
composer: system("device composition — an authoring tool, not an action"),
|
|
22245
|
-
"connection-test": system(INTERNAL),
|
|
22246
22696
|
"core-blocks": system(INTERNAL),
|
|
22247
22697
|
"custom-model-registry": system(ML),
|
|
22248
22698
|
"data-store-provider": system(INTERNAL),
|
|
@@ -44159,427 +44609,6 @@ var UnitWarningSchema = object({
|
|
|
44159
44609
|
assumedUnit: string(),
|
|
44160
44610
|
message: string()
|
|
44161
44611
|
});
|
|
44162
|
-
/**
|
|
44163
|
-
* notification-output — canonical, capability-gated notification delivery.
|
|
44164
|
-
*
|
|
44165
|
-
* Apprise-derived model (see
|
|
44166
|
-
* `docs/superpowers/specs/2026-07-03-notification-output-notifier-matrix.md`):
|
|
44167
|
-
* callers emit ONE canonical `Notification`; each provider declares a
|
|
44168
|
-
* per-kind capability descriptor (`TargetKind`), and the pure degrade
|
|
44169
|
-
* engine (`@camstack/types` `prepareNotification`) transcodes / degrades the
|
|
44170
|
-
* message to what the kind supports — callers never special-case a service.
|
|
44171
|
-
*
|
|
44172
|
-
* DESIGN DECISIONS (locked):
|
|
44173
|
-
* - Target CRUD lives on THIS cap (`upsertTarget` / `deleteTarget` /
|
|
44174
|
-
* `setTargetEnabled`), each provider persisting via the `settings-store`
|
|
44175
|
-
* cap. Rationale: the admin UI needs one uniform surface across the
|
|
44176
|
-
* notifiers addon AND the HA addon; the addon-`globalSettingsSchema`-array
|
|
44177
|
-
* alternative would fork the UI per addon and cannot host the
|
|
44178
|
-
* discovery→adopt flow.
|
|
44179
|
-
* - `listTargetKinds` / `listTargets` / `discoverTargets` return arrays →
|
|
44180
|
-
* the generated cap-mount auto-`concatCollection`-fans them across every
|
|
44181
|
-
* registered provider (notifiers addon + HA addon) so one catalog is
|
|
44182
|
-
* routable. `send` / `testTarget` / CRUD route to ONE provider by the
|
|
44183
|
-
* `addonId` the generated collection router extracts from the call input.
|
|
44184
|
-
* - `Attachment.bytes` is `Uint8Array`. Transport-safe: superjson (the tRPC
|
|
44185
|
-
* transformer) + UDS MsgPack both round-trip typed arrays — already used by
|
|
44186
|
-
* `storage` / `storage-provider` / `recording` caps over the same path. No
|
|
44187
|
-
* base64 fallback needed.
|
|
44188
|
-
*
|
|
44189
|
-
* TODO (deferred, closed-set change — separate decision): add
|
|
44190
|
-
* `providerKind: 'notify'` so notification providers surface on the unified
|
|
44191
|
-
* admin "Integrations" page.
|
|
44192
|
-
*/
|
|
44193
|
-
/**
|
|
44194
|
-
* Zentik-derived typed-media enum — the superset across every kind. Each
|
|
44195
|
-
* adapter picks what it supports and the degrade engine filters the rest.
|
|
44196
|
-
*/
|
|
44197
|
-
var AttachmentMediaTypeSchema = _enum([
|
|
44198
|
-
"image",
|
|
44199
|
-
"video",
|
|
44200
|
-
"gif",
|
|
44201
|
-
"audio",
|
|
44202
|
-
"icon"
|
|
44203
|
-
]);
|
|
44204
|
-
/**
|
|
44205
|
-
* A single attachment. Exactly one of `url` (remote source, most adapters
|
|
44206
|
-
* prefer this) or `bytes` (inline source; required for Pushover-style
|
|
44207
|
-
* bytes-only kinds) MUST be present — the degrade engine expresses a
|
|
44208
|
-
* url→bytes fetch as a `needsFetch` directive the adapter executes.
|
|
44209
|
-
*/
|
|
44210
|
-
var AttachmentSchema = object({
|
|
44211
|
-
mediaType: AttachmentMediaTypeSchema,
|
|
44212
|
-
url: string().optional(),
|
|
44213
|
-
bytes: _instanceof(Uint8Array).optional(),
|
|
44214
|
-
mime: string().optional(),
|
|
44215
|
-
name: string().optional()
|
|
44216
|
-
}).refine((a) => a.url !== void 0 || a.bytes !== void 0, { message: "Attachment requires either `url` or `bytes`" });
|
|
44217
|
-
var NotificationFormatSchema = _enum([
|
|
44218
|
-
"text",
|
|
44219
|
-
"markdown",
|
|
44220
|
-
"html"
|
|
44221
|
-
]);
|
|
44222
|
-
/**
|
|
44223
|
-
* The CLOSED icon vocabulary an action button may use.
|
|
44224
|
-
*
|
|
44225
|
-
* A closed set, not a free string, and that is the whole point: an arbitrary
|
|
44226
|
-
* icon name is one that ntfy renders, zentik silently drops, and nobody
|
|
44227
|
-
* notices — the same class of gap as a zone vocabulary nothing produced
|
|
44228
|
-
* ([D35](../../../docs/decisions/adr-0035.md)). Every adapter maps this set or
|
|
44229
|
-
* declares `actionIcons: false` and the degrade engine strips the field.
|
|
44230
|
-
*
|
|
44231
|
-
* Named by INTENT, never by glyph. "check" would tie the vocabulary to one
|
|
44232
|
-
* renderer's icon set; "acknowledge" survives an adapter that draws it
|
|
44233
|
-
* differently.
|
|
44234
|
-
*
|
|
44235
|
-
* ── A TOKEN IS NOT A WIRE VALUE ─────────────────────────────────────
|
|
44236
|
-
*
|
|
44237
|
-
* These names are for US. **No adapter may forward one verbatim.** Each maps
|
|
44238
|
-
* the whole set onto its own renderer's vocabulary through a
|
|
44239
|
-
* `Record<NotificationActionIcon, string>` — a Record, never a lookup with a
|
|
44240
|
-
* fallback, so adding a member here fails every adapter's build until someone
|
|
44241
|
-
* decides its glyph, which is the only place that decision can be made
|
|
44242
|
-
* honestly.
|
|
44243
|
-
*
|
|
44244
|
-
* This paragraph is the bug. Zentik declared `actionIcons: true` and passed
|
|
44245
|
-
* `disarm` straight through; iOS feeds that string to
|
|
44246
|
-
* `UNNotificationActionIcon(systemImageName:)`, `disarm` is not an SF Symbol,
|
|
44247
|
-
* and every snooze and alarm button arrived BLANK. A pass-through is not a
|
|
44248
|
-
* mapping, and "the field is documented" is not "the value renders".
|
|
44249
|
-
*
|
|
44250
|
-
* Adding a member is TRAIN-BOUND. The enum lives in the published
|
|
44251
|
-
* `@camstack/server` closure and the cap seam validates against the HUB's copy,
|
|
44252
|
-
* so an addon that emits a token the running hub does not know does not lose an
|
|
44253
|
-
* icon — its whole `send` fails Zod validation and the notification never
|
|
44254
|
-
* arrives. Never emit a new token from an addon before the train carrying it.
|
|
44255
|
-
*/
|
|
44256
|
-
var NotificationActionIconSchema = _enum([
|
|
44257
|
-
"acknowledge",
|
|
44258
|
-
"dismiss",
|
|
44259
|
-
"silence",
|
|
44260
|
-
"snooze",
|
|
44261
|
-
"view",
|
|
44262
|
-
"play",
|
|
44263
|
-
"open",
|
|
44264
|
-
"close",
|
|
44265
|
-
"lock",
|
|
44266
|
-
"unlock",
|
|
44267
|
-
"arm",
|
|
44268
|
-
"arm-home",
|
|
44269
|
-
"arm-away",
|
|
44270
|
-
"arm-night",
|
|
44271
|
-
"disarm",
|
|
44272
|
-
"light",
|
|
44273
|
-
"alert",
|
|
44274
|
-
"camera"
|
|
44275
|
-
]);
|
|
44276
|
-
/** A single tap-through action button. */
|
|
44277
|
-
var NotificationActionSchema = object({
|
|
44278
|
-
id: string(),
|
|
44279
|
-
label: string(),
|
|
44280
|
-
url: string().optional(),
|
|
44281
|
-
/** Dropped by the degrade engine for a kind with `caps.actionIcons: false`. */
|
|
44282
|
-
icon: NotificationActionIconSchema.optional(),
|
|
44283
|
-
/**
|
|
44284
|
-
* Renders in a warning style where the notifier supports it.
|
|
44285
|
-
*
|
|
44286
|
-
* A HINT, never a gate. The callback's authority is its token and nothing
|
|
44287
|
-
* else — see `notification-center/action-token.ts` for what that does and
|
|
44288
|
-
* does not buy.
|
|
44289
|
-
*/
|
|
44290
|
-
destructive: boolean().optional(),
|
|
44291
|
-
/**
|
|
44292
|
-
* How the tap should REACH the url.
|
|
44293
|
-
*
|
|
44294
|
-
* `navigate` (absent, and every button authored before this field) opens it:
|
|
44295
|
-
* the phone leaves the notification and shows whatever the callback returns.
|
|
44296
|
-
* That is right for a button whose answer the operator wants to read.
|
|
44297
|
-
*
|
|
44298
|
-
* `background` fires it as a POST and stays put. It exists for the buttons
|
|
44299
|
-
* whose whole point is not to interrupt — "silence this for 30 minutes" is
|
|
44300
|
-
* an answer to the notification, and being thrown into a browser tab to
|
|
44301
|
-
* confirm it costs more attention than the notification did. A backend that
|
|
44302
|
-
* cannot do a background call renders it as an ordinary link (the adapters
|
|
44303
|
-
* fall back rather than dropping the button), so this is a preference, never
|
|
44304
|
-
* a requirement.
|
|
44305
|
-
*/
|
|
44306
|
-
mode: _enum(["navigate", "background"]).optional()
|
|
44307
|
-
});
|
|
44308
|
-
/** A delivery parameter value: what a notifier declared it takes. */
|
|
44309
|
-
var DeliveryParamValueSchema = union([
|
|
44310
|
-
string(),
|
|
44311
|
-
number(),
|
|
44312
|
-
boolean()
|
|
44313
|
-
]);
|
|
44314
|
-
/**
|
|
44315
|
-
* One extra delivery parameter a notifier KIND declares (D938). A rule that
|
|
44316
|
-
* addresses a target of that kind may set it; a kind that declares nothing is
|
|
44317
|
-
* never handed one. The admin UI derives its control from this descriptor —
|
|
44318
|
-
* no editor knows a service by name.
|
|
44319
|
-
*
|
|
44320
|
-
* Optional fields are `.optional()`, never `.default()` (a Zod default does not
|
|
44321
|
-
* run on the addon cap path).
|
|
44322
|
-
*/
|
|
44323
|
-
var DeliveryParamSchema = object({
|
|
44324
|
-
key: string().min(1),
|
|
44325
|
-
label: string(),
|
|
44326
|
-
/** i18n key of the label, resolved by the declaring addon's namespace. */
|
|
44327
|
-
labelKey: string().optional(),
|
|
44328
|
-
type: _enum([
|
|
44329
|
-
"enum",
|
|
44330
|
-
"number",
|
|
44331
|
-
"boolean",
|
|
44332
|
-
"string"
|
|
44333
|
-
]),
|
|
44334
|
-
/** `enum` only: the closed set of accepted values. */
|
|
44335
|
-
options: array(object({
|
|
44336
|
-
value: string(),
|
|
44337
|
-
label: string()
|
|
44338
|
-
})).optional(),
|
|
44339
|
-
/** `number` only. */
|
|
44340
|
-
min: number().optional(),
|
|
44341
|
-
max: number().optional(),
|
|
44342
|
-
/** What the notifier does when the rule sets nothing; shown as the placeholder. */
|
|
44343
|
-
default: DeliveryParamValueSchema.optional()
|
|
44344
|
-
});
|
|
44345
|
-
/**
|
|
44346
|
-
* The canonical notification. `body` is the only hard field (Apprise model).
|
|
44347
|
-
* `priority` is a 5-level ORDINAL (1=lowest … 3=normal(default) … 5=urgent),
|
|
44348
|
-
* NOT a fixed severity enum — each kind declares its own `caps.levels` and
|
|
44349
|
-
* the adapter maps this ordinal onto its native level. `level?` is an
|
|
44350
|
-
* optional kind-native level id (`emergency`, `silent`, …) that overrides
|
|
44351
|
-
* `priority` for that one target.
|
|
44352
|
-
*/
|
|
44353
|
-
var NotificationSchema = object({
|
|
44354
|
-
body: string(),
|
|
44355
|
-
title: string().optional(),
|
|
44356
|
-
format: NotificationFormatSchema.default("text"),
|
|
44357
|
-
priority: number().int().min(1).max(5).default(3),
|
|
44358
|
-
level: string().optional(),
|
|
44359
|
-
attachments: array(AttachmentSchema).optional(),
|
|
44360
|
-
clickUrl: string().optional(),
|
|
44361
|
-
actions: array(NotificationActionSchema).optional(),
|
|
44362
|
-
sound: string().optional(),
|
|
44363
|
-
ttl: number().optional(),
|
|
44364
|
-
tag: string().optional(),
|
|
44365
|
-
deviceId: number().optional(),
|
|
44366
|
-
eventId: string().optional(),
|
|
44367
|
-
metadata: record(string(), unknown()).optional(),
|
|
44368
|
-
/**
|
|
44369
|
-
* Values for the parameters the target's kind DECLARES in
|
|
44370
|
-
* {@link TargetKindSchema} `deliveryParams`. Already validated against the
|
|
44371
|
-
* declaration by the sender; a notifier reads only the keys it declared.
|
|
44372
|
-
*/
|
|
44373
|
-
delivery: record(string(), DeliveryParamValueSchema).optional()
|
|
44374
|
-
});
|
|
44375
|
-
/** One declared native severity/priority level for a kind. */
|
|
44376
|
-
var TargetKindLevelSchema = object({
|
|
44377
|
-
id: string(),
|
|
44378
|
-
label: string(),
|
|
44379
|
-
/** Which canonical priority (1..5) this level maps to. `null` = qualitative-only. */
|
|
44380
|
-
ordinal: number().int().min(1).max(5).nullable(),
|
|
44381
|
-
flags: object({
|
|
44382
|
-
critical: boolean().optional(),
|
|
44383
|
-
silent: boolean().optional(),
|
|
44384
|
-
noPush: boolean().optional()
|
|
44385
|
-
}).optional(),
|
|
44386
|
-
/** e.g. Pushover `emergency` requires `retry` / `expire`. */
|
|
44387
|
-
requires: array(string()).optional(),
|
|
44388
|
-
description: string().optional()
|
|
44389
|
-
});
|
|
44390
|
-
/** The full capability block consulted before dispatch. */
|
|
44391
|
-
var TargetKindCapsSchema = object({
|
|
44392
|
-
attachments: object({
|
|
44393
|
-
mediaTypes: array(AttachmentMediaTypeSchema),
|
|
44394
|
-
mode: _enum([
|
|
44395
|
-
"url",
|
|
44396
|
-
"bytes",
|
|
44397
|
-
"both"
|
|
44398
|
-
]),
|
|
44399
|
-
max: number().int().nonnegative(),
|
|
44400
|
-
maxBytes: number().int().positive().optional()
|
|
44401
|
-
}),
|
|
44402
|
-
/** Max action buttons (0 = none). */
|
|
44403
|
-
actions: number().int().nonnegative(),
|
|
44404
|
-
/**
|
|
44405
|
-
* Whether this kind renders a per-action ICON.
|
|
44406
|
-
*
|
|
44407
|
-
* `.optional()`, deliberately NOT `.default(false)`: a Zod default does not
|
|
44408
|
-
* run on the addon cap path — three production failures in one day taught
|
|
44409
|
-
* this repo that once. Absent is read as false by the degrade engine, which
|
|
44410
|
-
* is the safe direction: an icon that is not rendered costs nothing, an icon
|
|
44411
|
-
* assumed and dropped costs the operator's trust in the field.
|
|
44412
|
-
*/
|
|
44413
|
-
actionIcons: boolean().optional(),
|
|
44414
|
-
levels: array(TargetKindLevelSchema),
|
|
44415
|
-
format: array(NotificationFormatSchema),
|
|
44416
|
-
clickUrl: boolean(),
|
|
44417
|
-
sound: boolean(),
|
|
44418
|
-
ttl: boolean(),
|
|
44419
|
-
bodyMaxLen: number().int().positive()
|
|
44420
|
-
});
|
|
44421
|
-
/**
|
|
44422
|
-
* `configSchema` is a `ConfigUISchema` tree passed through to the admin
|
|
44423
|
-
* FormBuilder. Stored as `z.unknown()` at the cap seam (mirrors
|
|
44424
|
-
* `device-provider.getChildCreationSchema` `CreationSchemaOutputSchema`) —
|
|
44425
|
-
* the union is large and not meant for runtime validation here; the exported
|
|
44426
|
-
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
44427
|
-
*/
|
|
44428
|
-
var ConfigSchemaPassthrough$4 = unknown();
|
|
44429
|
-
var TargetKindSchema = object({
|
|
44430
|
-
kind: string(),
|
|
44431
|
-
label: string(),
|
|
44432
|
-
icon: string(),
|
|
44433
|
-
/** Stamped by each provider so the concat-fanned catalog stays routable. */
|
|
44434
|
-
addonId: string(),
|
|
44435
|
-
/**
|
|
44436
|
-
* URL of the kind's bundled BRAND icon, served by the providing addon over
|
|
44437
|
-
* its own `addon-routes` surface (`/addon/<addonId>/icons/<kind>`). Absent
|
|
44438
|
-
* when the addon bundles no icon for that kind — the client then falls back
|
|
44439
|
-
* to a neutral glyph rather than rendering the raw `icon` NAME as text.
|
|
44440
|
-
*
|
|
44441
|
-
* Root-relative on purpose: it resolves against whatever origin serves a web
|
|
44442
|
-
* client, and a native client joins it onto its own hub base.
|
|
44443
|
-
*
|
|
44444
|
-
* DECLARED here deliberately. It used to travel as an undeclared passthrough
|
|
44445
|
-
* field that survived only because the runtime cap-router forwards provider
|
|
44446
|
-
* output verbatim — so every consumer had to re-declare it by hand to stop
|
|
44447
|
-
* its own Zod parse from stripping it, and the whole arrangement would have
|
|
44448
|
-
* broken silently the moment output validation was tightened anywhere.
|
|
44449
|
-
*/
|
|
44450
|
-
iconUrl: string().optional(),
|
|
44451
|
-
/**
|
|
44452
|
-
* Media type of {@link iconUrl} (`image/svg+xml`, `image/png`, …).
|
|
44453
|
-
*
|
|
44454
|
-
* The server knows this and therefore says it, because the client cannot
|
|
44455
|
-
* safely guess: a React-Native client renders SVG and raster through two
|
|
44456
|
-
* DIFFERENT components (`react-native-svg` vs `expo-image` — expo-image does
|
|
44457
|
-
* not decode SVG on iOS/Android), so without this it silently fell back to a
|
|
44458
|
-
* placeholder glyph for every vector icon while the web build looked fine.
|
|
44459
|
-
*
|
|
44460
|
-
* Absent when {@link iconUrl} is absent, or for a legacy provider that has
|
|
44461
|
-
* not been updated — a client that cannot determine the type should prefer
|
|
44462
|
-
* its raster path, which is the safe default for an unknown image.
|
|
44463
|
-
*/
|
|
44464
|
-
iconMediaType: string().optional(),
|
|
44465
|
-
configSchema: ConfigSchemaPassthrough$4,
|
|
44466
|
-
/**
|
|
44467
|
-
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
44468
|
-
* base URL, instance, chat, recipient). A save that changes any of them
|
|
44469
|
-
* while leaving a secret redacted is refused by the provider (D634), so an
|
|
44470
|
-
* editor uses this to ask for the secret on exactly those edits instead of
|
|
44471
|
-
* on every edit.
|
|
44472
|
-
*
|
|
44473
|
-
* Optional: absent from a provider that holds no secret (the Home Assistant
|
|
44474
|
-
* kinds) and from a provider older than this field — an editor that finds
|
|
44475
|
-
* it absent must assume ANY edit may need the secret.
|
|
44476
|
-
*/
|
|
44477
|
-
destinationKeys: array(string()).optional(),
|
|
44478
|
-
supportsDiscovery: boolean(),
|
|
44479
|
-
/**
|
|
44480
|
-
* Extra delivery parameters a rule may set for a target of this kind (D938).
|
|
44481
|
-
* Absent = none; the rule editor then offers nothing.
|
|
44482
|
-
*/
|
|
44483
|
-
deliveryParams: array(DeliveryParamSchema).optional(),
|
|
44484
|
-
caps: TargetKindCapsSchema
|
|
44485
|
-
});
|
|
44486
|
-
/**
|
|
44487
|
-
* A persisted target. `config` holds secrets; providers REDACT secret fields
|
|
44488
|
-
* (return a presence marker only) when serving `listTargets` — never
|
|
44489
|
-
* round-trip a stored secret to the UI.
|
|
44490
|
-
*/
|
|
44491
|
-
var TargetSchema = object({
|
|
44492
|
-
id: string(),
|
|
44493
|
-
name: string(),
|
|
44494
|
-
kind: string(),
|
|
44495
|
-
addonId: string(),
|
|
44496
|
-
enabled: boolean(),
|
|
44497
|
-
config: record(string(), unknown())
|
|
44498
|
-
});
|
|
44499
|
-
/** A discovery-surfaced candidate (config is partial + non-secret). */
|
|
44500
|
-
var DiscoveredTargetSchema = object({
|
|
44501
|
-
kind: string(),
|
|
44502
|
-
suggestedName: string(),
|
|
44503
|
-
config: record(string(), unknown())
|
|
44504
|
-
});
|
|
44505
|
-
/** The degrade engine's report — what was resolved / dropped / degraded. */
|
|
44506
|
-
var RenderedAsSchema = object({
|
|
44507
|
-
level: string(),
|
|
44508
|
-
format: NotificationFormatSchema,
|
|
44509
|
-
attachmentsSent: number().int().nonnegative(),
|
|
44510
|
-
actionsSent: number().int().nonnegative(),
|
|
44511
|
-
truncated: boolean(),
|
|
44512
|
-
dropped: array(string())
|
|
44513
|
-
});
|
|
44514
|
-
var SendResultSchema = object({
|
|
44515
|
-
success: boolean(),
|
|
44516
|
-
error: string().optional(),
|
|
44517
|
-
renderedAs: RenderedAsSchema.optional()
|
|
44518
|
-
});
|
|
44519
|
-
/** Same shape as SendResult — kept as a distinct name for the test panel. */
|
|
44520
|
-
var TestResultSchema = SendResultSchema;
|
|
44521
|
-
/**
|
|
44522
|
-
* Pre-save credential probe against a partial (unsaved) target config.
|
|
44523
|
-
* `resolvedUrl` never includes secrets (token stripped from path).
|
|
44524
|
-
*/
|
|
44525
|
-
var ProbeTargetConfigResultSchema = object({
|
|
44526
|
-
ok: boolean(),
|
|
44527
|
-
resolvedUrl: string(),
|
|
44528
|
-
httpStatus: number().int().optional(),
|
|
44529
|
-
stateInstance: string().optional(),
|
|
44530
|
-
error: string().optional()
|
|
44531
|
-
});
|
|
44532
|
-
method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSchema), { auth: "admin" }), method(object({ targetId: string() }), TargetSchema, { auth: "admin" }), method(object({
|
|
44533
|
-
kind: string(),
|
|
44534
|
-
config: record(string(), unknown()).optional(),
|
|
44535
|
-
/**
|
|
44536
|
-
* When editing / duplicating, the blank password field never round-trips
|
|
44537
|
-
* the stored token. Pass the source target id so the provider can restore
|
|
44538
|
-
* secrets server-side before dialling (same merge as upsert).
|
|
44539
|
-
*/
|
|
44540
|
-
targetId: string().optional()
|
|
44541
|
-
}), array(DiscoveredTargetSchema), { auth: "admin" }), method(object({
|
|
44542
|
-
kind: string(),
|
|
44543
|
-
config: record(string(), unknown()),
|
|
44544
|
-
/** See `discoverTargets.targetId` — restore stored secrets for a blank password. */
|
|
44545
|
-
targetId: string().optional()
|
|
44546
|
-
}), ProbeTargetConfigResultSchema, {
|
|
44547
|
-
kind: "mutation",
|
|
44548
|
-
auth: "admin"
|
|
44549
|
-
}), method(object({
|
|
44550
|
-
targetId: string(),
|
|
44551
|
-
notification: NotificationSchema
|
|
44552
|
-
}), SendResultSchema, {
|
|
44553
|
-
kind: "mutation",
|
|
44554
|
-
auth: "admin"
|
|
44555
|
-
}), method(object({
|
|
44556
|
-
targetId: string(),
|
|
44557
|
-
sample: NotificationSchema.optional()
|
|
44558
|
-
}), TestResultSchema, {
|
|
44559
|
-
kind: "mutation",
|
|
44560
|
-
auth: "admin"
|
|
44561
|
-
}), method(object({
|
|
44562
|
-
target: TargetSchema,
|
|
44563
|
-
/**
|
|
44564
|
-
* Duplicate flow: create a NEW target id while copying secrets from an
|
|
44565
|
-
* existing row. The UI never holds the stored token; blank / redacted
|
|
44566
|
-
* password fields are restored from this source (D634 still applies if
|
|
44567
|
-
* destinations diverge without a re-typed secret).
|
|
44568
|
-
*/
|
|
44569
|
-
cloneSecretsFrom: string().optional()
|
|
44570
|
-
}), TargetSchema, {
|
|
44571
|
-
kind: "mutation",
|
|
44572
|
-
auth: "admin"
|
|
44573
|
-
}), method(object({ targetId: string() }), _void(), {
|
|
44574
|
-
kind: "mutation",
|
|
44575
|
-
auth: "admin"
|
|
44576
|
-
}), method(object({
|
|
44577
|
-
targetId: string(),
|
|
44578
|
-
enabled: boolean()
|
|
44579
|
-
}), _void(), {
|
|
44580
|
-
kind: "mutation",
|
|
44581
|
-
auth: "admin"
|
|
44582
|
-
});
|
|
44583
44612
|
function errorText(err) {
|
|
44584
44613
|
return err instanceof Error ? err.message : String(err);
|
|
44585
44614
|
}
|
|
@@ -48543,37 +48572,6 @@ method(object({
|
|
|
48543
48572
|
kind: "mutation",
|
|
48544
48573
|
auth: "admin"
|
|
48545
48574
|
}), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
|
|
48546
|
-
var ConnectionTestOutcomeSchema = discriminatedUnion("outcome", [
|
|
48547
|
-
object({
|
|
48548
|
-
outcome: literal("validated"),
|
|
48549
|
-
/** Round-trip of the sign-in, when the provider measured it. */
|
|
48550
|
-
latencyMs: number().nonnegative().optional(),
|
|
48551
|
-
/** Optional human detail worth showing next to the tick
|
|
48552
|
-
* ("3 devices visible on this account"). */
|
|
48553
|
-
detail: string().optional()
|
|
48554
|
-
}).strict(),
|
|
48555
|
-
object({
|
|
48556
|
-
outcome: literal("rejected"),
|
|
48557
|
-
error: string()
|
|
48558
|
-
}).strict(),
|
|
48559
|
-
object({
|
|
48560
|
-
outcome: literal("inconclusive"),
|
|
48561
|
-
error: string()
|
|
48562
|
-
}).strict()
|
|
48563
|
-
]);
|
|
48564
|
-
var ConnectionTestInputSchema = object({
|
|
48565
|
-
/** Candidate integration settings, exactly as the create form collected them. */
|
|
48566
|
-
settings: record(string(), unknown()) });
|
|
48567
|
-
/**
|
|
48568
|
-
* What the provider's test actually DOES, so the UI can say it in words before
|
|
48569
|
-
* the operator presses the button ("Signs in to the Dreo cloud"). Purely
|
|
48570
|
-
* descriptive — it never changes routing.
|
|
48571
|
-
*/
|
|
48572
|
-
var ConnectionTestDescriptorSchema = object({ label: string() });
|
|
48573
|
-
method(ConnectionTestInputSchema, ConnectionTestOutcomeSchema, {
|
|
48574
|
-
kind: "mutation",
|
|
48575
|
-
auth: "admin"
|
|
48576
|
-
}), method(_void(), ConnectionTestDescriptorSchema, { auth: "admin" });
|
|
48577
48575
|
object({
|
|
48578
48576
|
/** True when the upstream system considers the entity connected. */
|
|
48579
48577
|
connected: boolean(),
|
|
@@ -54476,10 +54474,9 @@ var AvailableIntegrationTypeSchema = object({
|
|
|
54476
54474
|
* locations" checkbox. Provider-declared in the addon manifest. */
|
|
54477
54475
|
supportsLocationImport: boolean(),
|
|
54478
54476
|
/**
|
|
54479
|
-
* True when this integration
|
|
54480
|
-
*
|
|
54481
|
-
*
|
|
54482
|
-
* rather than offering a button that always answers the same nonsense.
|
|
54477
|
+
* True when this integration's instances declare a Test (`integration-instances.describe().canTest`,
|
|
54478
|
+
* D1016). An integration that cannot be tested must say so up front rather than offering a
|
|
54479
|
+
* button that always answers the same nonsense.
|
|
54483
54480
|
*/
|
|
54484
54481
|
canTest: boolean(),
|
|
54485
54482
|
existingInstances: array(object({
|
|
@@ -54533,7 +54530,9 @@ var CreateIntegrationInputSchema = object({
|
|
|
54533
54530
|
info: record(string(), unknown()).optional(),
|
|
54534
54531
|
/** `stableId` of the discovery candidate the form was seeded from (D984). */
|
|
54535
54532
|
originStableId: string().optional(),
|
|
54536
|
-
settings: record(string(), unknown()).optional()
|
|
54533
|
+
settings: record(string(), unknown()).optional(),
|
|
54534
|
+
/** The instance kind being created, for a provider with several; omitted = its only testable kind. */
|
|
54535
|
+
kind: string().min(1).optional()
|
|
54537
54536
|
});
|
|
54538
54537
|
var UpdateIntegrationInputSchema = object({
|
|
54539
54538
|
id: string(),
|
|
@@ -54559,13 +54558,7 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
54559
54558
|
}), method(object({ id: string() }), DeleteIntegrationResultSchema, {
|
|
54560
54559
|
kind: "mutation",
|
|
54561
54560
|
auth: "admin"
|
|
54562
|
-
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" })
|
|
54563
|
-
addonId: string(),
|
|
54564
|
-
settings: record(string(), unknown())
|
|
54565
|
-
}), TestConnectionResultSchema, {
|
|
54566
|
-
kind: "mutation",
|
|
54567
|
-
auth: "admin"
|
|
54568
|
-
});
|
|
54561
|
+
}), method(_void(), array(AvailableIntegrationTypeSchema), { auth: "admin" });
|
|
54569
54562
|
/**
|
|
54570
54563
|
* `integration-instances` - the connection of an addon that holds ONE or SEVERAL
|
|
54571
54564
|
* (an account, a relay, a destination) as typed records (D985, D986). The addon's
|
|
@@ -62808,13 +62801,6 @@ var AddBrokerInputSchema = object({
|
|
|
62808
62801
|
});
|
|
62809
62802
|
var AddBrokerResultSchema = object({ id: string() });
|
|
62810
62803
|
var IdInputSchema = object({ id: string() });
|
|
62811
|
-
var TestResultSchema$1 = discriminatedUnion("ok", [object({
|
|
62812
|
-
ok: literal(true),
|
|
62813
|
-
latencyMs: number()
|
|
62814
|
-
}), object({
|
|
62815
|
-
ok: literal(false),
|
|
62816
|
-
error: string()
|
|
62817
|
-
})]);
|
|
62818
62804
|
var StartEmbeddedInputSchema = object({
|
|
62819
62805
|
port: number().int().min(1).max(65535).default(1883),
|
|
62820
62806
|
/** Allow anonymous connect (no username/password). Default: false. */
|
|
@@ -62837,9 +62823,6 @@ method(_void(), array(BrokerInfoSchema)), method(IdInputSchema, BrokerConnection
|
|
|
62837
62823
|
}), method(IdInputSchema, _void(), {
|
|
62838
62824
|
kind: "mutation",
|
|
62839
62825
|
auth: "admin"
|
|
62840
|
-
}), method(IdInputSchema, TestResultSchema$1, {
|
|
62841
|
-
kind: "mutation",
|
|
62842
|
-
auth: "admin"
|
|
62843
62826
|
}), method(StartEmbeddedInputSchema, StartEmbeddedResultSchema, {
|
|
62844
62827
|
kind: "mutation",
|
|
62845
62828
|
auth: "admin"
|
|
@@ -74474,7 +74457,7 @@ var TrainingProviderTypeSchema = object({
|
|
|
74474
74457
|
label: string(),
|
|
74475
74458
|
/** Path under the addon package (e.g. `assets/training-modal/icon.svg`). */
|
|
74476
74459
|
iconAsset: string(),
|
|
74477
|
-
/** Owning `training-provider` addon
|
|
74460
|
+
/** Owning `training-provider` addon. */
|
|
74478
74461
|
addonId: string(),
|
|
74479
74462
|
/**
|
|
74480
74463
|
* Fields for one entry of this type (credentials + defaults). Absent on a
|
|
@@ -74519,36 +74502,6 @@ var TrainingProviderDescriptorSchema = object({
|
|
|
74519
74502
|
*/
|
|
74520
74503
|
formValues: record(string(), unknown()).optional()
|
|
74521
74504
|
});
|
|
74522
|
-
/**
|
|
74523
|
-
* Patch one entry's name, credentials and defaults. Pin with owning `{ addonId }`.
|
|
74524
|
-
* An omitted or empty `tokenSecret` means KEEP the stored secret (D787).
|
|
74525
|
-
* `{ $secretClear: true }` clears it.
|
|
74526
|
-
*/
|
|
74527
|
-
var TrainingProviderUpdateEntryInputSchema = object({
|
|
74528
|
-
entryId: string().min(1),
|
|
74529
|
-
name: string().min(1),
|
|
74530
|
-
tokenId: string().optional(),
|
|
74531
|
-
tokenSecret: union([string(), object({ $secretClear: literal(true) })]).optional(),
|
|
74532
|
-
environment: string().optional(),
|
|
74533
|
-
gpuType: string().optional(),
|
|
74534
|
-
region: string().optional(),
|
|
74535
|
-
costCapUsd: number().nonnegative().optional(),
|
|
74536
|
-
maxRuntimeSec: number().int().positive().optional(),
|
|
74537
|
-
failedDatasetGraceHours: number().nonnegative().optional()
|
|
74538
|
-
});
|
|
74539
|
-
var TrainingCredentialCheckSchema = object({
|
|
74540
|
-
ok: boolean(),
|
|
74541
|
-
/** Workspace / account name, when the provider says. */
|
|
74542
|
-
account: string().optional(),
|
|
74543
|
-
reason: _enum([
|
|
74544
|
-
"missing",
|
|
74545
|
-
"invalid",
|
|
74546
|
-
"forbidden",
|
|
74547
|
-
"network",
|
|
74548
|
-
"quota"
|
|
74549
|
-
]).optional(),
|
|
74550
|
-
detail: string().optional()
|
|
74551
|
-
});
|
|
74552
74505
|
var ProviderJobStateSchema = _enum([
|
|
74553
74506
|
"pending",
|
|
74554
74507
|
"starting",
|
|
@@ -74596,22 +74549,6 @@ var TrainingLogLineSchema = object({
|
|
|
74596
74549
|
text: string()
|
|
74597
74550
|
});
|
|
74598
74551
|
method(object({}), array(TrainingProviderDescriptorSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderTypeSchema).readonly(), { auth: "admin" }), method(object({}), array(TrainingProviderEntrySchema).readonly(), { auth: "admin" }), method(object({
|
|
74599
|
-
typeId: string().min(1),
|
|
74600
|
-
name: string().min(1)
|
|
74601
|
-
}), object({ entryId: string() }), {
|
|
74602
|
-
kind: "mutation",
|
|
74603
|
-
auth: "admin"
|
|
74604
|
-
}), method(object({ entryId: string().min(1) }), object({ ok: literal(true) }), {
|
|
74605
|
-
kind: "mutation",
|
|
74606
|
-
auth: "admin"
|
|
74607
|
-
}), method(TrainingProviderUpdateEntryInputSchema, object({ ok: literal(true) }), {
|
|
74608
|
-
kind: "mutation",
|
|
74609
|
-
auth: "admin"
|
|
74610
|
-
}), method(object({ entryId: string().min(1) }), TrainingCredentialCheckSchema, {
|
|
74611
|
-
kind: "mutation",
|
|
74612
|
-
auth: "admin",
|
|
74613
|
-
timeoutMs: 3e4
|
|
74614
|
-
}), method(object({
|
|
74615
74552
|
entryId: string().min(1),
|
|
74616
74553
|
gpuType: string(),
|
|
74617
74554
|
region: string(),
|
|
@@ -77997,20 +77934,6 @@ Object.freeze({
|
|
|
77997
77934
|
access: "view",
|
|
77998
77935
|
role: "admin"
|
|
77999
77936
|
},
|
|
78000
|
-
"connectionTest.describeTest": {
|
|
78001
|
-
capName: "connection-test",
|
|
78002
|
-
capScope: "system",
|
|
78003
|
-
addonId: null,
|
|
78004
|
-
access: "view",
|
|
78005
|
-
role: "admin"
|
|
78006
|
-
},
|
|
78007
|
-
"connectionTest.testSettings": {
|
|
78008
|
-
capName: "connection-test",
|
|
78009
|
-
capScope: "system",
|
|
78010
|
-
addonId: null,
|
|
78011
|
-
access: "create",
|
|
78012
|
-
role: "admin"
|
|
78013
|
-
},
|
|
78014
77937
|
"connectivity.getStatus": {
|
|
78015
77938
|
capName: "connectivity",
|
|
78016
77939
|
capScope: "device",
|
|
@@ -80377,13 +80300,6 @@ Object.freeze({
|
|
|
80377
80300
|
access: "view",
|
|
80378
80301
|
role: "admin"
|
|
80379
80302
|
},
|
|
80380
|
-
"integrations.testConnection": {
|
|
80381
|
-
capName: "integrations",
|
|
80382
|
-
capScope: "system",
|
|
80383
|
-
addonId: null,
|
|
80384
|
-
access: "create",
|
|
80385
|
-
role: "admin"
|
|
80386
|
-
},
|
|
80387
80303
|
"integrations.update": {
|
|
80388
80304
|
capName: "integrations",
|
|
80389
80305
|
capScope: "system",
|
|
@@ -81616,13 +81532,6 @@ Object.freeze({
|
|
|
81616
81532
|
access: "create",
|
|
81617
81533
|
role: "admin"
|
|
81618
81534
|
},
|
|
81619
|
-
"mqttBroker.testConnection": {
|
|
81620
|
-
capName: "mqtt-broker",
|
|
81621
|
-
capScope: "system",
|
|
81622
|
-
addonId: null,
|
|
81623
|
-
access: "create",
|
|
81624
|
-
role: "admin"
|
|
81625
|
-
},
|
|
81626
81535
|
"nativeObjectDetection.getOptions": {
|
|
81627
81536
|
capName: "native-object-detection",
|
|
81628
81537
|
capScope: "device",
|
|
@@ -86453,20 +86362,6 @@ Object.freeze({
|
|
|
86453
86362
|
access: "create",
|
|
86454
86363
|
role: "admin"
|
|
86455
86364
|
},
|
|
86456
|
-
"trainingProvider.createEntry": {
|
|
86457
|
-
capName: "training-provider",
|
|
86458
|
-
capScope: "system",
|
|
86459
|
-
addonId: null,
|
|
86460
|
-
access: "create",
|
|
86461
|
-
role: "admin"
|
|
86462
|
-
},
|
|
86463
|
-
"trainingProvider.deleteEntry": {
|
|
86464
|
-
capName: "training-provider",
|
|
86465
|
-
capScope: "system",
|
|
86466
|
-
addonId: null,
|
|
86467
|
-
access: "delete",
|
|
86468
|
-
role: "admin"
|
|
86469
|
-
},
|
|
86470
86365
|
"trainingProvider.describe": {
|
|
86471
86366
|
capName: "training-provider",
|
|
86472
86367
|
capScope: "system",
|
|
@@ -86537,13 +86432,6 @@ Object.freeze({
|
|
|
86537
86432
|
access: "create",
|
|
86538
86433
|
role: "admin"
|
|
86539
86434
|
},
|
|
86540
|
-
"trainingProvider.updateEntry": {
|
|
86541
|
-
capName: "training-provider",
|
|
86542
|
-
capScope: "system",
|
|
86543
|
-
addonId: null,
|
|
86544
|
-
access: "create",
|
|
86545
|
-
role: "admin"
|
|
86546
|
-
},
|
|
86547
86435
|
"trainingProvider.uploadDataset": {
|
|
86548
86436
|
capName: "training-provider",
|
|
86549
86437
|
capScope: "system",
|
|
@@ -86551,13 +86439,6 @@ Object.freeze({
|
|
|
86551
86439
|
access: "create",
|
|
86552
86440
|
role: "admin"
|
|
86553
86441
|
},
|
|
86554
|
-
"trainingProvider.validateCredentials": {
|
|
86555
|
-
capName: "training-provider",
|
|
86556
|
-
capScope: "system",
|
|
86557
|
-
addonId: null,
|
|
86558
|
-
access: "create",
|
|
86559
|
-
role: "admin"
|
|
86560
|
-
},
|
|
86561
86442
|
"turnProvider.getTurnServers": {
|
|
86562
86443
|
capName: "turn-provider",
|
|
86563
86444
|
capScope: "system",
|