@camstack/addon-export-google 0.1.121 → 0.1.123
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 +12 -0
- package/dist/export-google.addon.js +506 -443
- package/dist/export-google.addon.mjs +506 -443
- package/package.json +2 -2
|
@@ -5917,7 +5917,7 @@ var ZodIssueCode = {
|
|
|
5917
5917
|
var ZodFirstPartyTypeKind;
|
|
5918
5918
|
ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
|
|
5919
5919
|
//#endregion
|
|
5920
|
-
//#region ../types/dist/sleep-
|
|
5920
|
+
//#region ../types/dist/sleep-CdJHPm-k.mjs
|
|
5921
5921
|
/**
|
|
5922
5922
|
* The audio chunk plane's byte format, and the ONE expansion from a coded
|
|
5923
5923
|
* window to float samples (D455).
|
|
@@ -6034,7 +6034,7 @@ function isKeychainStoredField(field) {
|
|
|
6034
6034
|
var SECRET_CLEAR = { $secretClear: true };
|
|
6035
6035
|
/** The `'***'` token D634 redaction writes for non-admins. */
|
|
6036
6036
|
var LEGACY_DEVICE_REDACTION = "***";
|
|
6037
|
-
function isRecord$
|
|
6037
|
+
function isRecord$7(value) {
|
|
6038
6038
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6039
6039
|
}
|
|
6040
6040
|
function makeSecretMarker(ref) {
|
|
@@ -6045,12 +6045,12 @@ function makeSecretMarker(ref) {
|
|
|
6045
6045
|
}
|
|
6046
6046
|
/** A stored marker: an object whose `$secret` is a non-empty string. */
|
|
6047
6047
|
function isSecretMarker(value) {
|
|
6048
|
-
if (!isRecord$
|
|
6048
|
+
if (!isRecord$7(value)) return false;
|
|
6049
6049
|
const ref = value["$secret"];
|
|
6050
6050
|
return typeof ref === "string" && ref.length > 0;
|
|
6051
6051
|
}
|
|
6052
6052
|
function isSecretClear(value) {
|
|
6053
|
-
return isRecord$
|
|
6053
|
+
return isRecord$7(value) && value["$secretClear"] === true;
|
|
6054
6054
|
}
|
|
6055
6055
|
/**
|
|
6056
6056
|
* The UI view of a stored secret field value: a marker becomes "set", inline
|
|
@@ -6433,6 +6433,53 @@ function emitReadiness(bus, params) {
|
|
|
6433
6433
|
ts
|
|
6434
6434
|
}));
|
|
6435
6435
|
}
|
|
6436
|
+
/** Why a catalogue entry is not a runnable body of its declared kind. */
|
|
6437
|
+
var AddonMigrationDefinitionError = class extends Error {
|
|
6438
|
+
id;
|
|
6439
|
+
constructor(id, message) {
|
|
6440
|
+
super(`${id}: ${message}`);
|
|
6441
|
+
this.id = id;
|
|
6442
|
+
this.name = "AddonMigrationDefinitionError";
|
|
6443
|
+
}
|
|
6444
|
+
};
|
|
6445
|
+
/**
|
|
6446
|
+
* Bind a catalogue to the addon's ports. Throws {@link AddonMigrationDefinitionError} when
|
|
6447
|
+
* an entry's `bodyKind` does not match the body it carries, or is `sql` (a hub-only
|
|
6448
|
+
* body). A throwing body never escapes `execute`: it is reported as a failed result.
|
|
6449
|
+
*/
|
|
6450
|
+
function defineAddonMigrations(catalogue, ports) {
|
|
6451
|
+
return catalogue.map((entry) => {
|
|
6452
|
+
const { meta } = entry;
|
|
6453
|
+
if ("plan" in entry) {
|
|
6454
|
+
if (meta.bodyKind !== "plan") throw new AddonMigrationDefinitionError(meta.id, `carries a plan body but declares "${meta.bodyKind}"`);
|
|
6455
|
+
return {
|
|
6456
|
+
meta,
|
|
6457
|
+
execute: () => guarded(async () => ({
|
|
6458
|
+
kind: "plan",
|
|
6459
|
+
plan: await entry.plan(ports)
|
|
6460
|
+
}))
|
|
6461
|
+
};
|
|
6462
|
+
}
|
|
6463
|
+
if (meta.bodyKind !== "procedure") throw new AddonMigrationDefinitionError(meta.id, `carries a procedure body but declares "${meta.bodyKind}"`);
|
|
6464
|
+
return {
|
|
6465
|
+
meta,
|
|
6466
|
+
execute: () => guarded(async () => ({
|
|
6467
|
+
kind: "procedure",
|
|
6468
|
+
result: await entry.procedure(ports)
|
|
6469
|
+
}))
|
|
6470
|
+
};
|
|
6471
|
+
});
|
|
6472
|
+
}
|
|
6473
|
+
async function guarded(work) {
|
|
6474
|
+
try {
|
|
6475
|
+
return await work();
|
|
6476
|
+
} catch (err) {
|
|
6477
|
+
return {
|
|
6478
|
+
kind: "failed",
|
|
6479
|
+
error: errMsg$1(err)
|
|
6480
|
+
};
|
|
6481
|
+
}
|
|
6482
|
+
}
|
|
6436
6483
|
var NOT_RUN = {
|
|
6437
6484
|
declared: false,
|
|
6438
6485
|
snapshot: null,
|
|
@@ -6756,7 +6803,7 @@ var KeychainWriteRefusedError = class extends Error {
|
|
|
6756
6803
|
}
|
|
6757
6804
|
};
|
|
6758
6805
|
var KEEP = { kind: "keep" };
|
|
6759
|
-
function isRecord$
|
|
6806
|
+
function isRecord$6(value) {
|
|
6760
6807
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6761
6808
|
}
|
|
6762
6809
|
function defaultMintId() {
|
|
@@ -6769,7 +6816,7 @@ function collectSecretMarkerRefs(value, out = []) {
|
|
|
6769
6816
|
return out;
|
|
6770
6817
|
}
|
|
6771
6818
|
if (Array.isArray(value)) for (const item of value) collectSecretMarkerRefs(item, out);
|
|
6772
|
-
else if (isRecord$
|
|
6819
|
+
else if (isRecord$6(value)) for (const child of Object.values(value)) collectSecretMarkerRefs(child, out);
|
|
6773
6820
|
return out;
|
|
6774
6821
|
}
|
|
6775
6822
|
async function storedValueEquals(secrets, marker, candidate) {
|
|
@@ -6824,7 +6871,7 @@ function rowId(row, idKey) {
|
|
|
6824
6871
|
return null;
|
|
6825
6872
|
}
|
|
6826
6873
|
async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
6827
|
-
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$
|
|
6874
|
+
const storedRows = Array.isArray(stored) ? stored.filter(isRecord$6) : [];
|
|
6828
6875
|
if (!Array.isArray(incoming)) {
|
|
6829
6876
|
ctx.deletes.push(...collectSecretMarkerRefs(storedRows));
|
|
6830
6877
|
return {
|
|
@@ -6840,7 +6887,7 @@ async function writeArray(ctx, node, incoming, stored, fieldPath) {
|
|
|
6840
6887
|
const kept = /* @__PURE__ */ new Set();
|
|
6841
6888
|
const rows = [];
|
|
6842
6889
|
for (const row of incoming) {
|
|
6843
|
-
if (!isRecord$
|
|
6890
|
+
if (!isRecord$6(row)) {
|
|
6844
6891
|
rows.push(row);
|
|
6845
6892
|
continue;
|
|
6846
6893
|
}
|
|
@@ -6865,7 +6912,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6865
6912
|
case "leaf": return writeLeaf(ctx, incoming, stored, fieldPath);
|
|
6866
6913
|
case "array": return writeArray(ctx, node, incoming, stored, fieldPath);
|
|
6867
6914
|
case "object": {
|
|
6868
|
-
if (!isRecord$
|
|
6915
|
+
if (!isRecord$6(incoming)) {
|
|
6869
6916
|
if (incoming === void 0) return KEEP;
|
|
6870
6917
|
ctx.deletes.push(...collectSecretMarkerRefs(stored));
|
|
6871
6918
|
return {
|
|
@@ -6873,7 +6920,7 @@ async function writeNode(ctx, node, incoming, stored, fieldPath) {
|
|
|
6873
6920
|
value: incoming
|
|
6874
6921
|
};
|
|
6875
6922
|
}
|
|
6876
|
-
const storedObj = isRecord$
|
|
6923
|
+
const storedObj = isRecord$6(stored) ? stored : {};
|
|
6877
6924
|
return {
|
|
6878
6925
|
kind: "value",
|
|
6879
6926
|
value: await writeMembers(ctx, node.children, incoming, storedObj, (m) => `${fieldPath}.${m}`)
|
|
@@ -6996,7 +7043,7 @@ async function resolveSecretMarkers(value, secrets, options = {}) {
|
|
|
6996
7043
|
value: items
|
|
6997
7044
|
};
|
|
6998
7045
|
}
|
|
6999
|
-
if (isRecord$
|
|
7046
|
+
if (isRecord$6(v)) {
|
|
7000
7047
|
const out = {};
|
|
7001
7048
|
for (const [k, child] of Object.entries(v)) {
|
|
7002
7049
|
const s = substitute(child);
|
|
@@ -7028,7 +7075,7 @@ var SecretOverwriteRefusedError = class extends Error {
|
|
|
7028
7075
|
this.name = "SecretOverwriteRefusedError";
|
|
7029
7076
|
}
|
|
7030
7077
|
};
|
|
7031
|
-
function isRecord$
|
|
7078
|
+
function isRecord$5(value) {
|
|
7032
7079
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7033
7080
|
}
|
|
7034
7081
|
function resolvedValue(pass, marker) {
|
|
@@ -7057,7 +7104,7 @@ function inArray(pass, incoming, stored) {
|
|
|
7057
7104
|
return incoming.map((item, index) => {
|
|
7058
7105
|
const twin = stored[index];
|
|
7059
7106
|
if (isSecretMarker(twin)) return typeof item === "string" && item === resolvedValue(pass, twin) ? twin : item;
|
|
7060
|
-
if (isRecord$
|
|
7107
|
+
if (isRecord$5(item) && isRecord$5(twin)) return inArrayRow(pass, item, twin);
|
|
7061
7108
|
if (Array.isArray(item) && Array.isArray(twin)) return inArray(pass, item, twin);
|
|
7062
7109
|
return item;
|
|
7063
7110
|
});
|
|
@@ -7068,7 +7115,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
7068
7115
|
const twin = stored[key];
|
|
7069
7116
|
if (isSecretMarker(twin)) {
|
|
7070
7117
|
if (typeof value === "string" && value === resolvedValue(pass, twin)) out[key] = twin;
|
|
7071
|
-
} else if (isRecord$
|
|
7118
|
+
} else if (isRecord$5(value) && isRecord$5(twin)) out[key] = inArrayRow(pass, value, twin);
|
|
7072
7119
|
else if (Array.isArray(value) && Array.isArray(twin)) out[key] = inArray(pass, value, twin);
|
|
7073
7120
|
}
|
|
7074
7121
|
return out;
|
|
@@ -7076,7 +7123,7 @@ function inArrayRow(pass, incoming, stored) {
|
|
|
7076
7123
|
async function walk(pass, incoming, stored) {
|
|
7077
7124
|
if (isSecretMarker(stored)) return atMarker(pass, incoming, stored);
|
|
7078
7125
|
if (Array.isArray(incoming) && Array.isArray(stored)) return inArray(pass, incoming, stored);
|
|
7079
|
-
if (!isRecord$
|
|
7126
|
+
if (!isRecord$5(incoming) || !isRecord$5(stored)) return incoming;
|
|
7080
7127
|
const out = { ...incoming };
|
|
7081
7128
|
for (const [key, value] of Object.entries(incoming)) out[key] = await walk(pass, value, stored[key]);
|
|
7082
7129
|
return out;
|
|
@@ -7107,7 +7154,7 @@ async function restoreUnchangedSecrets(input) {
|
|
|
7107
7154
|
function isJsonEqual(a, b) {
|
|
7108
7155
|
if (Object.is(a, b)) return true;
|
|
7109
7156
|
if (Array.isArray(a)) return Array.isArray(b) && a.length === b.length && a.every((v, i) => isJsonEqual(v, b[i]));
|
|
7110
|
-
if (isRecord$
|
|
7157
|
+
if (isRecord$5(a) && isRecord$5(b)) {
|
|
7111
7158
|
const keys = Object.keys(a);
|
|
7112
7159
|
if (keys.length !== Object.keys(b).length) return false;
|
|
7113
7160
|
return keys.every((k) => Object.prototype.hasOwnProperty.call(b, k) && isJsonEqual(a[k], b[k]));
|
|
@@ -7131,7 +7178,7 @@ function markerKeysOf(blob, owner) {
|
|
|
7131
7178
|
}
|
|
7132
7179
|
function nodeFromStored(value, owner) {
|
|
7133
7180
|
if (isSecretMarker(value)) return isSecretRefOwnedBy(value.$secret, owner) ? { kind: "leaf" } : null;
|
|
7134
|
-
if (!isRecord$
|
|
7181
|
+
if (!isRecord$5(value)) return null;
|
|
7135
7182
|
const children = /* @__PURE__ */ new Map();
|
|
7136
7183
|
for (const [key, child] of Object.entries(value)) {
|
|
7137
7184
|
const node = nodeFromStored(child, owner);
|
|
@@ -7750,6 +7797,44 @@ var BaseAddon = class {
|
|
|
7750
7797
|
return null;
|
|
7751
7798
|
}
|
|
7752
7799
|
/**
|
|
7800
|
+
* D986 scoped settings: the form shape of the CLUSTER-wide settings one capability this addon
|
|
7801
|
+
* provides owns, or `null` when it has none. `cap` is a capability name the addon's manifest
|
|
7802
|
+
* declares. Stored as `addon-settings` rows `<addonId>.<field>`. The keys of this schema, of
|
|
7803
|
+
* {@link nodeSettingsSchema} and of {@link deviceDefaultsSchema} are disjoint, and a key never
|
|
7804
|
+
* contains `@` (guard `check-scoped-settings-declared`). SHAPE only: values are read by scope.
|
|
7805
|
+
*/
|
|
7806
|
+
async clusterSettingsSchema(_cap) {
|
|
7807
|
+
return null;
|
|
7808
|
+
}
|
|
7809
|
+
/**
|
|
7810
|
+
* D986: the form shape of the settings one capability owns PER NODE, or `null`. Stored as
|
|
7811
|
+
* `addon-settings` rows `<addonId>.<field>@<nodeId>` carrying `nodeId` in the row data, so a
|
|
7812
|
+
* forgotten node's rows go in one central delete.
|
|
7813
|
+
*/
|
|
7814
|
+
async nodeSettingsSchema(_cap) {
|
|
7815
|
+
return null;
|
|
7816
|
+
}
|
|
7817
|
+
/**
|
|
7818
|
+
* D986: the form shape of the FLEET DEFAULTS of the per-device settings one capability owns,
|
|
7819
|
+
* or `null`. Stored as `addon-settings` rows `<addonId>.<field>`; a device resolves its value
|
|
7820
|
+
* as device row, then this default, then the schema default (`resolveDeviceSettings`).
|
|
7821
|
+
*/
|
|
7822
|
+
async deviceDefaultsSchema(_cap) {
|
|
7823
|
+
return null;
|
|
7824
|
+
}
|
|
7825
|
+
/**
|
|
7826
|
+
* The host's read of the scoped declarations: the schema one capability declares for `scope`,
|
|
7827
|
+
* or `null`. Beside {@link getIntegrationFormSchema}, the same shape: the hook is protected, the
|
|
7828
|
+
* host asks this method.
|
|
7829
|
+
*/
|
|
7830
|
+
async getScopedSettingsSchema(scope, cap) {
|
|
7831
|
+
switch (scope) {
|
|
7832
|
+
case "cluster": return this.clusterSettingsSchema(cap);
|
|
7833
|
+
case "node": return this.nodeSettingsSchema(cap);
|
|
7834
|
+
case "device-defaults": return this.deviceDefaultsSchema(cap);
|
|
7835
|
+
}
|
|
7836
|
+
}
|
|
7837
|
+
/**
|
|
7753
7838
|
* What the create wizard and the integration edit page render for one instance: the addon's
|
|
7754
7839
|
* per-instance schema when it declares one, else its global schema (what they always showed).
|
|
7755
7840
|
*/
|
|
@@ -8543,6 +8628,21 @@ function normalizeAddonInitResult(result) {
|
|
|
8543
8628
|
if (Array.isArray(result)) return { providers: result };
|
|
8544
8629
|
return result;
|
|
8545
8630
|
}
|
|
8631
|
+
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
8632
|
+
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
8633
|
+
var RECORD_DATABASES = ["settings", "events"];
|
|
8634
|
+
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
8635
|
+
var RECORD_CLASSES = [
|
|
8636
|
+
"config",
|
|
8637
|
+
"ledger",
|
|
8638
|
+
"audit",
|
|
8639
|
+
"mirror",
|
|
8640
|
+
"ephemeral"
|
|
8641
|
+
];
|
|
8642
|
+
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
8643
|
+
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
8644
|
+
var RECORD_BATCH_MAX = 1e3;
|
|
8645
|
+
var RECORD_QUERY_MAX = 1e3;
|
|
8546
8646
|
/**
|
|
8547
8647
|
* The share-view scope kinds a share-link token can carry. The hub mints
|
|
8548
8648
|
* and validates them (`ShareViewGrantSchema` builds its
|
|
@@ -8567,21 +8667,6 @@ var PeerBytesTicketSchema = object({
|
|
|
8567
8667
|
*/
|
|
8568
8668
|
declaredBytes: number().int().nonnegative().nullable()
|
|
8569
8669
|
});
|
|
8570
|
-
/** Limits and names of `ctx.records` (D881). One authority; the engine and the facade read it. */
|
|
8571
|
-
/** The files a kind may live in. `history` is device-history's (D850), never records. */
|
|
8572
|
-
var RECORD_DATABASES = ["settings", "events"];
|
|
8573
|
-
/** The classes of a kind: the `@durable` vocabulary, one authority (replaces the annotation). */
|
|
8574
|
-
var RECORD_CLASSES = [
|
|
8575
|
-
"config",
|
|
8576
|
-
"ledger",
|
|
8577
|
-
"audit",
|
|
8578
|
-
"mirror",
|
|
8579
|
-
"ephemeral"
|
|
8580
|
-
];
|
|
8581
|
-
var RECORD_DEFAULT_MAX_DATA_BYTES = 64 * 1024;
|
|
8582
|
-
var RECORD_MAX_DATA_BYTES = 1024 * 1024;
|
|
8583
|
-
var RECORD_BATCH_MAX = 1e3;
|
|
8584
|
-
var RECORD_QUERY_MAX = 1e3;
|
|
8585
8670
|
/**
|
|
8586
8671
|
* Record kinds (D881): the declaration an addon makes of one kind of fact, the
|
|
8587
8672
|
* Zod row schema that describes it, and the helper that turns the two into the
|
|
@@ -9273,28 +9358,6 @@ var PipelineRunResultBridge = custom();
|
|
|
9273
9358
|
var StaticDirOutputSchema = object({ staticDir: string() });
|
|
9274
9359
|
var VersionOutputSchema = object({ version: string() });
|
|
9275
9360
|
method(_void(), StaticDirOutputSchema, { auth: "admin" }), method(_void(), VersionOutputSchema, { auth: "admin" });
|
|
9276
|
-
/**
|
|
9277
|
-
* Identity — preserves literal types for downstream inference.
|
|
9278
|
-
*
|
|
9279
|
-
* The constraint is `Record<string, unknown>` (not `CustomActionsSpec`) so
|
|
9280
|
-
* TypeScript does not widen each entry's literal `kind`/`auth` fields to
|
|
9281
|
-
* the broader unions declared on `CustomActionSpec`'s default generics.
|
|
9282
|
-
* Shape validity is enforced separately by the `customAction(...)` helper
|
|
9283
|
-
* whose return type is already a `CustomActionSpec<...>`.
|
|
9284
|
-
*/
|
|
9285
|
-
function defineCustomActions(spec) {
|
|
9286
|
-
return spec;
|
|
9287
|
-
}
|
|
9288
|
-
function customAction(input, output, options) {
|
|
9289
|
-
return {
|
|
9290
|
-
input,
|
|
9291
|
-
output,
|
|
9292
|
-
kind: options?.kind ?? "query",
|
|
9293
|
-
auth: options?.auth ?? "protected",
|
|
9294
|
-
scope: options?.scope ?? { kind: "system" },
|
|
9295
|
-
...options?.caller ? { caller: "required" } : {}
|
|
9296
|
-
};
|
|
9297
|
-
}
|
|
9298
9361
|
Object.freeze({ "doorbell": "lastPressedAt" });
|
|
9299
9362
|
/** Every capability name, so addon code can check a name without the schema graph. */
|
|
9300
9363
|
var CAP_NAMES = Object.freeze([
|
|
@@ -9385,6 +9448,7 @@ var CAP_NAMES = Object.freeze([
|
|
|
9385
9448
|
"humidity-sensor",
|
|
9386
9449
|
"image",
|
|
9387
9450
|
"image-settings",
|
|
9451
|
+
"integration-instances",
|
|
9388
9452
|
"integrations",
|
|
9389
9453
|
"intercom",
|
|
9390
9454
|
"ir-transmitter",
|
|
@@ -11318,7 +11382,7 @@ object({
|
|
|
11318
11382
|
params: record(string(), union([string(), number()])).optional()
|
|
11319
11383
|
});
|
|
11320
11384
|
//#endregion
|
|
11321
|
-
//#region ../types/dist/composition-
|
|
11385
|
+
//#region ../types/dist/composition-BDUoQsw9.mjs
|
|
11322
11386
|
/**
|
|
11323
11387
|
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
11324
11388
|
*
|
|
@@ -13743,6 +13807,16 @@ var MigrationPlanSchema = object({ edits: array(discriminatedUnion("op", [
|
|
|
13743
13807
|
precondition: PreconditionSchema
|
|
13744
13808
|
})
|
|
13745
13809
|
])) });
|
|
13810
|
+
/** `JSON.stringify` with object keys sorted, so equal values spell the same. */
|
|
13811
|
+
function canonicalJson(value) {
|
|
13812
|
+
if (Array.isArray(value)) return `[${value.map((item) => canonicalJson(item)).join(",")}]`;
|
|
13813
|
+
if (typeof value === "object" && value !== null) return `{${Object.entries(value).filter(([, item]) => item !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([key, item]) => `${JSON.stringify(key)}:${canonicalJson(item)}`).join(",")}}`;
|
|
13814
|
+
return JSON.stringify(value) ?? "null";
|
|
13815
|
+
}
|
|
13816
|
+
/** The precondition string for a value a plan read (`null` when it read nothing). */
|
|
13817
|
+
function preconditionOf(value) {
|
|
13818
|
+
return canonicalJson(value ?? null);
|
|
13819
|
+
}
|
|
13746
13820
|
/**
|
|
13747
13821
|
* What a `procedure` body reports. `already-done` means the rerun observed the
|
|
13748
13822
|
* work finished (a crash between the work and the ledger row, or a manual fix)
|
|
@@ -15691,8 +15765,18 @@ var LogChannelDescriptorSchema = object({
|
|
|
15691
15765
|
* the operator narrows to one camera, sees nothing, and concludes the code
|
|
15692
15766
|
* path was never taken.
|
|
15693
15767
|
*/
|
|
15694
|
-
perDevice: boolean()
|
|
15695
|
-
|
|
15768
|
+
perDevice: boolean(),
|
|
15769
|
+
/**
|
|
15770
|
+
* What the channel is FOR, so the UI can list the channels an addon offers.
|
|
15771
|
+
*
|
|
15772
|
+
* - `diagnostic` (the default): a per-component diagnostic armed from the
|
|
15773
|
+
* Levels page, emitted at its declared level.
|
|
15774
|
+
* - `debug`: a `debug.<channel>` dump watched live for a short window
|
|
15775
|
+
* (`ctx.debug`). Always per-device, and its lines are denied by the log
|
|
15776
|
+
* ring unless somebody is watching that device.
|
|
15777
|
+
*/
|
|
15778
|
+
kind: _enum(["diagnostic", "debug"]).default("diagnostic")
|
|
15779
|
+
}).refine((d) => d.kind !== "debug" || d.name.startsWith("debug.") && d.perDevice, { message: "a debug channel is named debug.<channel> and is per-device" });
|
|
15696
15780
|
/**
|
|
15697
15781
|
* An armed window over one channel, as the document hands it to a mirror.
|
|
15698
15782
|
*
|
|
@@ -20915,6 +20999,7 @@ var SYSTEM_CAP_VOCABULARY = {
|
|
|
20915
20999
|
"load-contribution": system(INTERNAL),
|
|
20916
21000
|
"local-network": system(NETWORK),
|
|
20917
21001
|
"log-channels": system(INTERNAL),
|
|
21002
|
+
"integration-instances": system(INTERNAL),
|
|
20918
21003
|
"log-destination": system(INTERNAL),
|
|
20919
21004
|
"login-method": system(IDENTITY),
|
|
20920
21005
|
"mesh-network": system(NETWORK),
|
|
@@ -43061,7 +43146,7 @@ var TargetKindCapsSchema = object({
|
|
|
43061
43146
|
* the union is large and not meant for runtime validation here; the exported
|
|
43062
43147
|
* `TargetKind` type re-tightens `configSchema` to `ConfigUISchema`.
|
|
43063
43148
|
*/
|
|
43064
|
-
var ConfigSchemaPassthrough$
|
|
43149
|
+
var ConfigSchemaPassthrough$4 = unknown();
|
|
43065
43150
|
var TargetKindSchema = object({
|
|
43066
43151
|
kind: string(),
|
|
43067
43152
|
label: string(),
|
|
@@ -43098,7 +43183,7 @@ var TargetKindSchema = object({
|
|
|
43098
43183
|
* its raster path, which is the safe default for an unknown image.
|
|
43099
43184
|
*/
|
|
43100
43185
|
iconMediaType: string().optional(),
|
|
43101
|
-
configSchema: ConfigSchemaPassthrough$
|
|
43186
|
+
configSchema: ConfigSchemaPassthrough$4,
|
|
43102
43187
|
/**
|
|
43103
43188
|
* The config keys that decide WHERE this kind's secrets are sent (server,
|
|
43104
43189
|
* base URL, instance, chat, recipient). A save that changes any of them
|
|
@@ -49521,6 +49606,45 @@ method(_void(), _void(), { kind: "mutation" }), method(_void(), _void(), { kind:
|
|
|
49521
49606
|
auth: "admin"
|
|
49522
49607
|
});
|
|
49523
49608
|
/**
|
|
49609
|
+
* What the passive listener of `local-network` saw on the wire, before any
|
|
49610
|
+
* provider classified it. Device-manager turns an observation into the hits
|
|
49611
|
+
* of the providers whose declared discovery modes it matches.
|
|
49612
|
+
*/
|
|
49613
|
+
var DiscoveryObservationSchema = discriminatedUnion("kind", [object({
|
|
49614
|
+
kind: literal("mdns"),
|
|
49615
|
+
/** Normalised DNS-SD service type, e.g. `_esphomelib._tcp`. */
|
|
49616
|
+
serviceType: string(),
|
|
49617
|
+
instance: string(),
|
|
49618
|
+
host: string(),
|
|
49619
|
+
/** The A record address when the announcement carried one. */
|
|
49620
|
+
address: string().nullable(),
|
|
49621
|
+
port: number().int(),
|
|
49622
|
+
txt: record(string(), string())
|
|
49623
|
+
}), object({
|
|
49624
|
+
kind: literal("ssdp"),
|
|
49625
|
+
/** Sender address of the datagram. */
|
|
49626
|
+
host: string(),
|
|
49627
|
+
port: number().int(),
|
|
49628
|
+
/** `NT` of a NOTIFY, `ST` of a search response. */
|
|
49629
|
+
target: string(),
|
|
49630
|
+
headers: record(string(), string())
|
|
49631
|
+
})]);
|
|
49632
|
+
object({
|
|
49633
|
+
addonId: string(),
|
|
49634
|
+
candidate: DiscoveryCandidateSchema,
|
|
49635
|
+
firstSeenAt: number(),
|
|
49636
|
+
lastSeenAt: number(),
|
|
49637
|
+
dismissed: boolean()
|
|
49638
|
+
});
|
|
49639
|
+
var DiscoveryProposalSchema = object({
|
|
49640
|
+
id: string(),
|
|
49641
|
+
addonId: string(),
|
|
49642
|
+
candidate: DiscoveryCandidateSchema,
|
|
49643
|
+
firstSeenAt: number(),
|
|
49644
|
+
lastSeenAt: number(),
|
|
49645
|
+
dismissed: boolean()
|
|
49646
|
+
});
|
|
49647
|
+
/**
|
|
49524
49648
|
* Device Manager capability — hub-side singleton that unifies device persistence,
|
|
49525
49649
|
* live registry access, and all management operations into a single tRPC surface.
|
|
49526
49650
|
*
|
|
@@ -50249,6 +50373,19 @@ method(object({
|
|
|
50249
50373
|
}), object({ candidates: array(DiscoveryCandidateSchema).readonly() }), {
|
|
50250
50374
|
kind: "mutation",
|
|
50251
50375
|
auth: "admin"
|
|
50376
|
+
}), method(object({}), object({ proposals: array(DiscoveryProposalSchema).readonly() }), { auth: "admin" }), method(object({ id: string() }), object({ dismissed: boolean() }), {
|
|
50377
|
+
kind: "mutation",
|
|
50378
|
+
auth: "admin"
|
|
50379
|
+
}), method(object({ observations: array(DiscoveryObservationSchema).max(512) }), object({ proposed: number().int() }), {
|
|
50380
|
+
kind: "mutation",
|
|
50381
|
+
auth: "admin"
|
|
50382
|
+
}), method(object({}), object({
|
|
50383
|
+
providers: number().int(),
|
|
50384
|
+
proposed: number().int()
|
|
50385
|
+
}), {
|
|
50386
|
+
kind: "mutation",
|
|
50387
|
+
auth: "admin",
|
|
50388
|
+
timeoutMs: 12e4
|
|
50252
50389
|
}), method(object({ addonId: string() }), object({ deviceType: _enum(DeviceType).nullable() }), { auth: "admin" }), method(object({ addonId: string() }), unknown(), { auth: "admin" }), method(object({
|
|
50253
50390
|
deviceId: number(),
|
|
50254
50391
|
key: string(),
|
|
@@ -52794,9 +52931,15 @@ var AvailableIntegrationTypeSchema = object({
|
|
|
52794
52931
|
* branch on CAP — never on addon name. `device-adoption` integrations
|
|
52795
52932
|
* (Home Assistant, …) route through the broker step (Approach A);
|
|
52796
52933
|
* `device-provider` integrations (Reolink/ONVIF) keep the
|
|
52797
|
-
* legacy config → discovery flow.
|
|
52934
|
+
* legacy config → discovery flow. `connection` is an addon that only holds a
|
|
52935
|
+
* connection as typed records (`integration-instances`, D985): no devices,
|
|
52936
|
+
* no discovery.
|
|
52798
52937
|
*/
|
|
52799
|
-
kind: _enum([
|
|
52938
|
+
kind: _enum([
|
|
52939
|
+
"device-adoption",
|
|
52940
|
+
"device-provider",
|
|
52941
|
+
"connection"
|
|
52942
|
+
]),
|
|
52800
52943
|
/**
|
|
52801
52944
|
* For `device-adoption` addons: the broker kind to create/link
|
|
52802
52945
|
* (e.g. `home-assistant`), declared in the addon manifest. `null` for
|
|
@@ -52909,6 +53052,67 @@ method(_void(), array(IntegrationWithStateSchema)), method(object({ id: string()
|
|
|
52909
53052
|
auth: "admin"
|
|
52910
53053
|
});
|
|
52911
53054
|
/**
|
|
53055
|
+
* `integration-instances` - the connection of an addon that holds ONE or SEVERAL
|
|
53056
|
+
* (an account, a relay, a destination) as typed records, shown on the
|
|
53057
|
+
* Integrations page like every other integration (D985, D986).
|
|
53058
|
+
*
|
|
53059
|
+
* A collection of providers: each addon that holds connections registers one
|
|
53060
|
+
* and the hub aggregator (`integrations.*`) reaches a provider with the pinned
|
|
53061
|
+
* `addonId`. It is internal and has no route: the operator-facing surface is
|
|
53062
|
+
* the `integrations` cap, which keeps ONE list.
|
|
53063
|
+
*
|
|
53064
|
+
* Identity: the instance id IS the `integrations` registry id (`int_NNNN`,
|
|
53065
|
+
* immutable, already in the `/integrations/<id>` URL). A second operator-chosen
|
|
53066
|
+
* slug would be a second authority over one identity (D224). `name` is the
|
|
53067
|
+
* editable label.
|
|
53068
|
+
*
|
|
53069
|
+
* Secrets: every field the instance kind marks `.meta({ secret: true })` reaches
|
|
53070
|
+
* the form as a `SecretFieldView`, never text (D789). A patch value omitted, `''`
|
|
53071
|
+
* or the redaction token KEEPS the stored secret; `{ $secretClear: true }`
|
|
53072
|
+
* clears it.
|
|
53073
|
+
*/
|
|
53074
|
+
var ConfigSchemaPassthrough$3 = custom();
|
|
53075
|
+
var IntegrationInstanceIdSchema = string().min(1);
|
|
53076
|
+
var IntegrationInstanceDescriptionSchema = object({
|
|
53077
|
+
/** `single`: at most one instance can exist (Loki). `multiple`: an account each. */
|
|
53078
|
+
instanceMode: _enum(["single", "multiple"]),
|
|
53079
|
+
/** What the instance is, for the UI (`destination`, `relay`, `account`). */
|
|
53080
|
+
kind: string(),
|
|
53081
|
+
/** True when `testInstance` really probes the remote. */
|
|
53082
|
+
canTest: boolean()
|
|
53083
|
+
});
|
|
53084
|
+
var IntegrationInstanceStatusSchema = object({
|
|
53085
|
+
state: _enum([
|
|
53086
|
+
"ok",
|
|
53087
|
+
"off",
|
|
53088
|
+
"error",
|
|
53089
|
+
"unknown"
|
|
53090
|
+
]),
|
|
53091
|
+
detail: string().optional()
|
|
53092
|
+
});
|
|
53093
|
+
var IntegrationInstanceSchema = object({
|
|
53094
|
+
id: IntegrationInstanceIdSchema,
|
|
53095
|
+
name: string(),
|
|
53096
|
+
/** The addon's own rule (an URL is present, a client id is present...). */
|
|
53097
|
+
configured: boolean(),
|
|
53098
|
+
/** Values for the instance form; a secret is a `SecretFieldView`, never text. */
|
|
53099
|
+
formValues: record(string(), unknown()),
|
|
53100
|
+
status: IntegrationInstanceStatusSchema.optional()
|
|
53101
|
+
});
|
|
53102
|
+
var IntegrationInstancePatchSchema = object({
|
|
53103
|
+
id: IntegrationInstanceIdSchema,
|
|
53104
|
+
name: string().min(1).optional(),
|
|
53105
|
+
/** Omitted / '' / redaction token keeps a secret; `{ $secretClear: true }` clears it. */
|
|
53106
|
+
values: record(string(), unknown())
|
|
53107
|
+
});
|
|
53108
|
+
method(_void(), IntegrationInstanceDescriptionSchema), method(object({ id: IntegrationInstanceIdSchema.nullable() }), ConfigSchemaPassthrough$3), method(_void(), array(IntegrationInstanceSchema).readonly()), method(object({ id: IntegrationInstanceIdSchema }), IntegrationInstanceSchema.nullable()), method(object({
|
|
53109
|
+
id: IntegrationInstanceIdSchema,
|
|
53110
|
+
name: string().min(1)
|
|
53111
|
+
}), object({ id: string() }), { kind: "mutation" }), method(IntegrationInstancePatchSchema, object({ ok: literal(true) }), { kind: "mutation" }), method(object({ id: IntegrationInstanceIdSchema }), object({ ok: literal(true) }), { kind: "mutation" }), optionalMethod(object({
|
|
53112
|
+
id: IntegrationInstanceIdSchema.nullable(),
|
|
53113
|
+
values: record(string(), unknown())
|
|
53114
|
+
}), TestConnectionResultSchema$1, { kind: "mutation" });
|
|
53115
|
+
/**
|
|
52912
53116
|
* Two-way audio / talk-back cap. Clients open a WebRTC audio-only
|
|
52913
53117
|
* session (server-initiated offer pattern, identical to the main
|
|
52914
53118
|
* video WebRTC flow) and the browser captures the mic; the server
|
|
@@ -72058,6 +72262,40 @@ var LoggingSettingsStateSchema = object({
|
|
|
72058
72262
|
opsLogRetentionDays: number().int().min(0),
|
|
72059
72263
|
persisted: boolean()
|
|
72060
72264
|
});
|
|
72265
|
+
/**
|
|
72266
|
+
* Debug WATCH — a short, per-device window over `debug.<channel>` lines.
|
|
72267
|
+
*
|
|
72268
|
+
* `start` opens (or re-arms) a 10 minute window; `rearm` extends a LIVE one
|
|
72269
|
+
* and never revives a lapsed one; `stop` closes it; `list` only reads. No
|
|
72270
|
+
* chain of re-arms outlives 60 minutes from the first start. The hub holds the
|
|
72271
|
+
* watches in memory and pushes the interest to every node, so a watch lapses
|
|
72272
|
+
* by itself and survives nothing — a restart is a stop.
|
|
72273
|
+
*/
|
|
72274
|
+
var DebugWatchInputSchema = object({
|
|
72275
|
+
action: _enum([
|
|
72276
|
+
"list",
|
|
72277
|
+
"start",
|
|
72278
|
+
"rearm",
|
|
72279
|
+
"stop"
|
|
72280
|
+
]),
|
|
72281
|
+
/** Full channel names, `debug.<channel>`, each declared with `kind: 'debug'`. */
|
|
72282
|
+
channels: array(string().min(1)).readonly().default([]),
|
|
72283
|
+
/** Numeric device ids. Required (non-empty) for `start`. */
|
|
72284
|
+
deviceIds: array(number().int()).readonly().default([])
|
|
72285
|
+
});
|
|
72286
|
+
var DebugWatchStateSchema = object({
|
|
72287
|
+
channel: string(),
|
|
72288
|
+
deviceIds: array(number().int()).readonly(),
|
|
72289
|
+
startedAtMs: number(),
|
|
72290
|
+
untilMs: number(),
|
|
72291
|
+
capAtMs: number()
|
|
72292
|
+
});
|
|
72293
|
+
var DebugWatchResultSchema = object({
|
|
72294
|
+
nowMs: number(),
|
|
72295
|
+
watches: array(DebugWatchStateSchema).readonly(),
|
|
72296
|
+
/** Channels a `rearm` found already lapsed: nothing was revived. */
|
|
72297
|
+
lapsed: array(string()).readonly()
|
|
72298
|
+
});
|
|
72061
72299
|
method(_void(), SystemInfoSchema), method(_void(), HealthStatusSchema), method(_void(), FeatureManifestSchema), method(_void(), array(NetworkAddressSchema).readonly()), method(_void(), unknown().nullable(), { auth: "admin" }), method(record(string(), unknown()), _null(), {
|
|
72062
72300
|
kind: "mutation",
|
|
72063
72301
|
auth: "admin"
|
|
@@ -72073,6 +72311,9 @@ method(_void(), SystemInfoSchema), method(_void(), HealthStatusSchema), method(_
|
|
|
72073
72311
|
}), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(_void(), array(ReportedFailureContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
|
|
72074
72312
|
kind: "mutation",
|
|
72075
72313
|
auth: "admin"
|
|
72314
|
+
}), method(DebugWatchInputSchema, DebugWatchResultSchema, {
|
|
72315
|
+
kind: "mutation",
|
|
72316
|
+
auth: "admin"
|
|
72076
72317
|
});
|
|
72077
72318
|
object({
|
|
72078
72319
|
/** True when the device's tamper switch / case-open contact is
|
|
@@ -76946,6 +77187,13 @@ Object.freeze({
|
|
|
76946
77187
|
access: "view",
|
|
76947
77188
|
role: "admin"
|
|
76948
77189
|
},
|
|
77190
|
+
"deviceManager.dismissDiscoveryProposal": {
|
|
77191
|
+
capName: "device-manager",
|
|
77192
|
+
capScope: "system",
|
|
77193
|
+
addonId: null,
|
|
77194
|
+
access: "create",
|
|
77195
|
+
role: "admin"
|
|
77196
|
+
},
|
|
76949
77197
|
"deviceManager.enable": {
|
|
76950
77198
|
capName: "device-manager",
|
|
76951
77199
|
capScope: "system",
|
|
@@ -77128,6 +77376,13 @@ Object.freeze({
|
|
|
77128
77376
|
access: "view",
|
|
77129
77377
|
role: "viewer"
|
|
77130
77378
|
},
|
|
77379
|
+
"deviceManager.listDiscoveryProposals": {
|
|
77380
|
+
capName: "device-manager",
|
|
77381
|
+
capScope: "system",
|
|
77382
|
+
addonId: null,
|
|
77383
|
+
access: "view",
|
|
77384
|
+
role: "admin"
|
|
77385
|
+
},
|
|
77131
77386
|
"deviceManager.listLocationDescriptions": {
|
|
77132
77387
|
capName: "device-manager",
|
|
77133
77388
|
capScope: "system",
|
|
@@ -77282,6 +77537,13 @@ Object.freeze({
|
|
|
77282
77537
|
access: "create",
|
|
77283
77538
|
role: "admin"
|
|
77284
77539
|
},
|
|
77540
|
+
"deviceManager.reportDiscoveryObservations": {
|
|
77541
|
+
capName: "device-manager",
|
|
77542
|
+
capScope: "system",
|
|
77543
|
+
addonId: null,
|
|
77544
|
+
access: "create",
|
|
77545
|
+
role: "admin"
|
|
77546
|
+
},
|
|
77285
77547
|
"deviceManager.runDeviceAction": {
|
|
77286
77548
|
capName: "device-manager",
|
|
77287
77549
|
capScope: "system",
|
|
@@ -77289,6 +77551,13 @@ Object.freeze({
|
|
|
77289
77551
|
access: "create",
|
|
77290
77552
|
role: "admin"
|
|
77291
77553
|
},
|
|
77554
|
+
"deviceManager.runDiscoverySweep": {
|
|
77555
|
+
capName: "device-manager",
|
|
77556
|
+
capScope: "system",
|
|
77557
|
+
addonId: null,
|
|
77558
|
+
access: "create",
|
|
77559
|
+
role: "admin"
|
|
77560
|
+
},
|
|
77292
77561
|
"deviceManager.setChildLayout": {
|
|
77293
77562
|
capName: "device-manager",
|
|
77294
77563
|
capScope: "system",
|
|
@@ -78220,6 +78489,62 @@ Object.freeze({
|
|
|
78220
78489
|
access: "create",
|
|
78221
78490
|
role: "admin"
|
|
78222
78491
|
},
|
|
78492
|
+
"integrationInstances.createInstance": {
|
|
78493
|
+
capName: "integration-instances",
|
|
78494
|
+
capScope: "system",
|
|
78495
|
+
addonId: null,
|
|
78496
|
+
access: "create",
|
|
78497
|
+
role: "admin"
|
|
78498
|
+
},
|
|
78499
|
+
"integrationInstances.deleteInstance": {
|
|
78500
|
+
capName: "integration-instances",
|
|
78501
|
+
capScope: "system",
|
|
78502
|
+
addonId: null,
|
|
78503
|
+
access: "delete",
|
|
78504
|
+
role: "admin"
|
|
78505
|
+
},
|
|
78506
|
+
"integrationInstances.describe": {
|
|
78507
|
+
capName: "integration-instances",
|
|
78508
|
+
capScope: "system",
|
|
78509
|
+
addonId: null,
|
|
78510
|
+
access: "view",
|
|
78511
|
+
role: "admin"
|
|
78512
|
+
},
|
|
78513
|
+
"integrationInstances.getInstance": {
|
|
78514
|
+
capName: "integration-instances",
|
|
78515
|
+
capScope: "system",
|
|
78516
|
+
addonId: null,
|
|
78517
|
+
access: "view",
|
|
78518
|
+
role: "admin"
|
|
78519
|
+
},
|
|
78520
|
+
"integrationInstances.instanceFormSchema": {
|
|
78521
|
+
capName: "integration-instances",
|
|
78522
|
+
capScope: "system",
|
|
78523
|
+
addonId: null,
|
|
78524
|
+
access: "view",
|
|
78525
|
+
role: "admin"
|
|
78526
|
+
},
|
|
78527
|
+
"integrationInstances.listInstances": {
|
|
78528
|
+
capName: "integration-instances",
|
|
78529
|
+
capScope: "system",
|
|
78530
|
+
addonId: null,
|
|
78531
|
+
access: "view",
|
|
78532
|
+
role: "admin"
|
|
78533
|
+
},
|
|
78534
|
+
"integrationInstances.testInstance": {
|
|
78535
|
+
capName: "integration-instances",
|
|
78536
|
+
capScope: "system",
|
|
78537
|
+
addonId: null,
|
|
78538
|
+
access: "create",
|
|
78539
|
+
role: "admin"
|
|
78540
|
+
},
|
|
78541
|
+
"integrationInstances.updateInstance": {
|
|
78542
|
+
capName: "integration-instances",
|
|
78543
|
+
capScope: "system",
|
|
78544
|
+
addonId: null,
|
|
78545
|
+
access: "create",
|
|
78546
|
+
role: "admin"
|
|
78547
|
+
},
|
|
78223
78548
|
"integrations.create": {
|
|
78224
78549
|
capName: "integrations",
|
|
78225
78550
|
capScope: "system",
|
|
@@ -83876,6 +84201,13 @@ Object.freeze({
|
|
|
83876
84201
|
access: "create",
|
|
83877
84202
|
role: "viewer"
|
|
83878
84203
|
},
|
|
84204
|
+
"system.debugWatch": {
|
|
84205
|
+
capName: "system",
|
|
84206
|
+
capScope: "system",
|
|
84207
|
+
addonId: null,
|
|
84208
|
+
access: "create",
|
|
84209
|
+
role: "admin"
|
|
84210
|
+
},
|
|
83879
84211
|
"system.detectSiteLocation": {
|
|
83880
84212
|
capName: "system",
|
|
83881
84213
|
capScope: "system",
|
|
@@ -87819,6 +88151,11 @@ Object.freeze({
|
|
|
87819
88151
|
form: "single",
|
|
87820
88152
|
optional: false
|
|
87821
88153
|
}],
|
|
88154
|
+
"system.debugWatch": [{
|
|
88155
|
+
name: "deviceIds",
|
|
88156
|
+
form: "array",
|
|
88157
|
+
optional: true
|
|
88158
|
+
}],
|
|
87822
88159
|
"tamper.getStatus": [{
|
|
87823
88160
|
name: "deviceId",
|
|
87824
88161
|
form: "single",
|
|
@@ -89711,38 +90048,6 @@ var ActionSceneExports = class {
|
|
|
89711
90048
|
}
|
|
89712
90049
|
};
|
|
89713
90050
|
//#endregion
|
|
89714
|
-
//#region src/custom-actions.ts
|
|
89715
|
-
/**
|
|
89716
|
-
* Google Home Export — customActions catalog.
|
|
89717
|
-
*
|
|
89718
|
-
* One entry. The settings form's `addon-action-button` dispatches through the
|
|
89719
|
-
* generic `api.addons.custom.mutate({ addonId, action, input })` channel and
|
|
89720
|
-
* shows the result under the button, so a button here costs no capability, no
|
|
89721
|
-
* codegen and no framework publish train — the catalog travels inside this
|
|
89722
|
-
* addon's own bundle. Admin-only: it writes this addon's settings.
|
|
89723
|
-
*/
|
|
89724
|
-
var exportGoogleActions = defineCustomActions({
|
|
89725
|
-
/**
|
|
89726
|
-
* Re-scan the connected `network-access` providers and refresh the address
|
|
89727
|
-
* shown under the field.
|
|
89728
|
-
*
|
|
89729
|
-
* Deliberately NOT the same contract as `export-alexa`'s action of the same
|
|
89730
|
-
* shape: that one replaces a manual override when it is no longer detected,
|
|
89731
|
-
* because Alexa ROUTES on the value. Nothing routes on this one — it is what
|
|
89732
|
-
* the operator already pasted into Google's console — so this only fills the
|
|
89733
|
-
* field when it is empty. `filled` says whether it did.
|
|
89734
|
-
*/
|
|
89735
|
-
detectPublicHubUrl: customAction(object({}).optional(), object({
|
|
89736
|
-
publicHubUrl: string(),
|
|
89737
|
-
detectedPublicHubUrl: string(),
|
|
89738
|
-
filled: boolean(),
|
|
89739
|
-
/** One sentence saying what happened, for the button. */
|
|
89740
|
-
summary: string()
|
|
89741
|
-
}), {
|
|
89742
|
-
kind: "mutation",
|
|
89743
|
-
auth: "admin"
|
|
89744
|
-
}) });
|
|
89745
|
-
//#endregion
|
|
89746
90051
|
//#region src/google-home/trait-catalog.ts
|
|
89747
90052
|
/**
|
|
89748
90053
|
* The trait catalog — one ROW per camstack capability, and that row is the
|
|
@@ -90539,217 +90844,104 @@ function buildGoogleOauthIntegration() {
|
|
|
90539
90844
|
};
|
|
90540
90845
|
}
|
|
90541
90846
|
//#endregion
|
|
90542
|
-
//#region src/public-hub-url.ts
|
|
90543
|
-
/**
|
|
90544
|
-
* The hub's public
|
|
90545
|
-
*
|
|
90546
|
-
*
|
|
90547
|
-
*
|
|
90548
|
-
*
|
|
90549
|
-
|
|
90550
|
-
|
|
90551
|
-
|
|
90552
|
-
|
|
90553
|
-
*
|
|
90554
|
-
*
|
|
90555
|
-
*
|
|
90556
|
-
|
|
90557
|
-
|
|
90558
|
-
|
|
90559
|
-
|
|
90560
|
-
|
|
90561
|
-
|
|
90562
|
-
|
|
90563
|
-
|
|
90564
|
-
|
|
90565
|
-
|
|
90566
|
-
|
|
90567
|
-
|
|
90568
|
-
|
|
90569
|
-
|
|
90570
|
-
|
|
90571
|
-
|
|
90572
|
-
|
|
90573
|
-
|
|
90574
|
-
|
|
90575
|
-
|
|
90576
|
-
|
|
90577
|
-
|
|
90578
|
-
|
|
90579
|
-
|
|
90580
|
-
|
|
90581
|
-
|
|
90582
|
-
|
|
90583
|
-
|
|
90584
|
-
|
|
90585
|
-
|
|
90586
|
-
|
|
90587
|
-
|
|
90588
|
-
|
|
90589
|
-
|
|
90590
|
-
|
|
90591
|
-
|
|
90592
|
-
|
|
90593
|
-
|
|
90594
|
-
|
|
90595
|
-
|
|
90596
|
-
|
|
90597
|
-
|
|
90598
|
-
|
|
90599
|
-
|
|
90600
|
-
* Whether Google's cloud could plausibly reach this origin.
|
|
90601
|
-
*
|
|
90602
|
-
* The `network-access` providers this hub ships (Cloudflare Tunnel, Tailscale
|
|
90603
|
-
* Funnel) publish public FQDNs, but the cap does not promise it: a provider is
|
|
90604
|
-
* free to report an HTTPS ingress on a private address. Defaulting the field to
|
|
90605
|
-
* one of those would hand the operator three console URLs that look finished
|
|
90606
|
-
* and can never answer — strictly worse than an empty field, because an empty
|
|
90607
|
-
* field is visibly unfinished.
|
|
90608
|
-
*
|
|
90609
|
-
* Conservative on purpose: only loopback, RFC1918, link-local, `.local` and
|
|
90610
|
-
* dotless hostnames are refused. A public tunnel hostname always has a dot.
|
|
90611
|
-
*/
|
|
90612
|
-
var isPubliclyRoutableOrigin = (origin) => {
|
|
90613
|
-
let host;
|
|
90614
|
-
try {
|
|
90615
|
-
host = new URL(origin).hostname.toLowerCase();
|
|
90616
|
-
} catch {
|
|
90617
|
-
return false;
|
|
90618
|
-
}
|
|
90619
|
-
if (host.length === 0) return false;
|
|
90620
|
-
if (LOOPBACK_HOSTS.includes(host)) return false;
|
|
90621
|
-
if (host.startsWith("127.") || host.startsWith("169.254.")) return false;
|
|
90622
|
-
if (host.startsWith("10.") || host.startsWith("192.168.")) return false;
|
|
90623
|
-
if (/^172\.(1[6-9]|2\d|3[01])\./.test(host)) return false;
|
|
90624
|
-
if (host.endsWith(".local") || host.endsWith(".internal") || host.endsWith(".lan")) return false;
|
|
90625
|
-
if (!host.includes(".")) return false;
|
|
90626
|
-
return true;
|
|
90627
|
-
};
|
|
90628
|
-
/**
|
|
90629
|
-
* Every publicly routable HTTPS origin the `network-access` cap reports, in the
|
|
90630
|
-
* cap's own order, deduped. Empty when there is none — the caller leaves the
|
|
90631
|
-
* field alone rather than inventing a value.
|
|
90632
|
-
*/
|
|
90633
|
-
var detectPublicHubOrigins = async (deps) => {
|
|
90634
|
-
const fromList = await originsFromListEndpoints(deps);
|
|
90635
|
-
if (fromList.length > 0) return fromList;
|
|
90636
|
-
const fromStatus = await originFromGetStatus(deps);
|
|
90637
|
-
if (fromStatus.length > 0) return [fromStatus];
|
|
90638
|
-
deps.logger.warn("export-google: no connected HTTPS external address — the public hub URL cannot be derived, so the Google console URLs stay unrendered. Set up remote access (Cloudflare Tunnel, Tailscale Funnel, …) and press \"Detect external address\", or type the URL on the settings form.");
|
|
90639
|
-
return [];
|
|
90640
|
-
};
|
|
90641
|
-
var usableOrigins = (candidates, logger) => {
|
|
90642
|
-
const out = /* @__PURE__ */ new Set();
|
|
90643
|
-
for (const candidate of candidates) {
|
|
90644
|
-
if (candidate.protocol !== "https" || candidate.url.length === 0) continue;
|
|
90645
|
-
const origin = normalisePublicHubUrl(candidate.url);
|
|
90646
|
-
if (!isPubliclyRoutableOrigin(origin)) {
|
|
90647
|
-
logger.info("export-google: ignored an external address that is not reachable from the internet — Google calls the fulfillment URL from its own cloud", { meta: { origin } });
|
|
90648
|
-
continue;
|
|
90649
|
-
}
|
|
90650
|
-
out.add(origin);
|
|
90651
|
-
}
|
|
90652
|
-
return [...out];
|
|
90653
|
-
};
|
|
90654
|
-
var originsFromListEndpoints = async (deps) => {
|
|
90655
|
-
try {
|
|
90656
|
-
return usableOrigins(await deps.network.listEndpoints(), deps.logger);
|
|
90657
|
-
} catch (err) {
|
|
90658
|
-
deps.logger.debug("export-google: networkAccess.listEndpoints failed", { meta: { error: errMsg$1(err) } });
|
|
90659
|
-
return [];
|
|
90660
|
-
}
|
|
90661
|
-
};
|
|
90662
|
-
var originFromGetStatus = async (deps) => {
|
|
90663
|
-
try {
|
|
90664
|
-
const status = await deps.network.getStatus();
|
|
90665
|
-
if (status === null || !status.connected || status.endpoint === null) return "";
|
|
90666
|
-
return usableOrigins([status.endpoint], deps.logger)[0] ?? "";
|
|
90667
|
-
} catch (err) {
|
|
90668
|
-
deps.logger.debug("export-google: networkAccess.getStatus failed", { meta: { error: errMsg$1(err) } });
|
|
90669
|
-
return "";
|
|
90670
|
-
}
|
|
90847
|
+
//#region src/migrations/drop-public-hub-url.ts
|
|
90848
|
+
/**
|
|
90849
|
+
* The hub's public URL is no longer a setting of this addon (D986 §5): Google reads the
|
|
90850
|
+
* `publicEndpoint` role of the local-network palette on every use. The two keys older
|
|
90851
|
+
* versions persisted are deleted. Every other key is left exactly as stored.
|
|
90852
|
+
*
|
|
90853
|
+
* Idempotent: a store without either key yields an empty plan, which writes nothing.
|
|
90854
|
+
*/
|
|
90855
|
+
/** The addon id, the prefix of its rows in the canonical settings table. */
|
|
90856
|
+
var GOOGLE_ADDON_ID = "export-google";
|
|
90857
|
+
/**
|
|
90858
|
+
* Where the addon's global settings live: the canonical `addon-settings` table, one row per
|
|
90859
|
+
* key, id `<addonId>.<key>`, data `{ addonId, key, value }` (never a per-addon scoped table,
|
|
90860
|
+
* which exists only when something lazily declared it).
|
|
90861
|
+
*/
|
|
90862
|
+
var ADDON_SETTINGS_TABLE = "addon-settings";
|
|
90863
|
+
var RETIRED_PUBLIC_URL_KEYS = ["publicHubUrl", "detectedPublicHubUrl"];
|
|
90864
|
+
async function planDropPublicHubUrl(ports) {
|
|
90865
|
+
const stored = await ports.readStored();
|
|
90866
|
+
const present = RETIRED_PUBLIC_URL_KEYS.filter((key) => key in stored);
|
|
90867
|
+
if (present.length === 0) return { edits: [] };
|
|
90868
|
+
const rowId = (key) => `${GOOGLE_ADDON_ID}.${key}`;
|
|
90869
|
+
return { edits: [{
|
|
90870
|
+
op: "deleteKeys",
|
|
90871
|
+
scope: ADDON_SETTINGS_TABLE,
|
|
90872
|
+
keys: present.map(rowId),
|
|
90873
|
+
precondition: preconditionOf(Object.fromEntries(present.map((key) => [rowId(key), {
|
|
90874
|
+
addonId: GOOGLE_ADDON_ID,
|
|
90875
|
+
key,
|
|
90876
|
+
value: stored[key]
|
|
90877
|
+
}])))
|
|
90878
|
+
}] };
|
|
90879
|
+
}
|
|
90880
|
+
//#endregion
|
|
90881
|
+
//#region src/migrations/index.ts
|
|
90882
|
+
/** The `export-google` catalogue (D987): offered to the engine when the addon initialises. */
|
|
90883
|
+
var ADDON_MIGRATIONS = [{
|
|
90884
|
+
meta: {
|
|
90885
|
+
id: "export-google/2026-11-02-drop-public-hub-url",
|
|
90886
|
+
owner: "export-google",
|
|
90887
|
+
level: "addon-state",
|
|
90888
|
+
seq: 1,
|
|
90889
|
+
dependsOn: [],
|
|
90890
|
+
store: "settings",
|
|
90891
|
+
scope: "cluster",
|
|
90892
|
+
onFailure: "tolerate",
|
|
90893
|
+
bodyKind: "plan",
|
|
90894
|
+
description: "Delete the retired publicHubUrl and detectedPublicHubUrl settings; the public URL is the publicEndpoint role",
|
|
90895
|
+
fixtureMark: "the exposed device list the migration does not know"
|
|
90896
|
+
},
|
|
90897
|
+
plan: planDropPublicHubUrl
|
|
90898
|
+
}];
|
|
90899
|
+
//#endregion
|
|
90900
|
+
//#region src/public-endpoint.ts
|
|
90901
|
+
/** The typed refusal when the role resolves to nothing. */
|
|
90902
|
+
var NO_PUBLIC_ENDPOINT_REASON = {
|
|
90903
|
+
code: "no-public-endpoint",
|
|
90904
|
+
message: "The hub has no public endpoint. Set up remote access (a tunnel) and flag an address as \"Public endpoint\" on the Network page; Google calls this hub from its own cloud."
|
|
90671
90905
|
};
|
|
90672
|
-
/**
|
|
90673
|
-
|
|
90674
|
-
|
|
90675
|
-
|
|
90676
|
-
|
|
90677
|
-
|
|
90678
|
-
|
|
90679
|
-
|
|
90680
|
-
const detectedPublicHubUrl = detected[0] ?? "";
|
|
90681
|
-
if (current.length > 0) return {
|
|
90682
|
-
patch: { detectedPublicHubUrl },
|
|
90683
|
-
publicHubUrl: current,
|
|
90684
|
-
detectedPublicHubUrl,
|
|
90685
|
-
defaulted: false
|
|
90686
|
-
};
|
|
90687
|
-
if (detectedPublicHubUrl.length === 0) return {
|
|
90688
|
-
patch: { detectedPublicHubUrl },
|
|
90689
|
-
publicHubUrl: "",
|
|
90690
|
-
detectedPublicHubUrl,
|
|
90691
|
-
defaulted: false
|
|
90906
|
+
/** Trailing slashes off, surrounding space off. Nothing else is rewritten. */
|
|
90907
|
+
var normaliseOrigin = (raw) => raw.trim().replace(/\/+$/, "");
|
|
90908
|
+
var resolvePublicEndpoint = (book) => {
|
|
90909
|
+
const resolved = book.roles.publicEndpoint.resolved;
|
|
90910
|
+
const origin = resolved === null ? "" : normaliseOrigin(resolved);
|
|
90911
|
+
if (origin.length === 0) return {
|
|
90912
|
+
ok: false,
|
|
90913
|
+
reason: NO_PUBLIC_ENDPOINT_REASON
|
|
90692
90914
|
};
|
|
90693
90915
|
return {
|
|
90694
|
-
|
|
90695
|
-
|
|
90696
|
-
detectedPublicHubUrl
|
|
90697
|
-
},
|
|
90698
|
-
publicHubUrl: detectedPublicHubUrl,
|
|
90699
|
-
detectedPublicHubUrl,
|
|
90700
|
-
defaulted: true
|
|
90916
|
+
ok: true,
|
|
90917
|
+
origin
|
|
90701
90918
|
};
|
|
90702
90919
|
};
|
|
90703
|
-
/** Which of the two authored the value currently in the field. */
|
|
90704
|
-
var publicHubUrlSource = (state) => {
|
|
90705
|
-
if (state.publicHubUrl.length === 0) return "unset";
|
|
90706
|
-
if (state.detectedPublicHubUrl.length > 0 && state.publicHubUrl === state.detectedPublicHubUrl) return "derived";
|
|
90707
|
-
return "operator-set";
|
|
90708
|
-
};
|
|
90709
|
-
/**
|
|
90710
|
-
* The line under the field. A URL that appeared by itself with no provenance is
|
|
90711
|
-
* worse than a blank field: the operator cannot tell whether it is right.
|
|
90712
|
-
*/
|
|
90713
|
-
var buildPublicHubUrlNotice = (state) => {
|
|
90714
|
-
switch (publicHubUrlSource(state)) {
|
|
90715
|
-
case "derived": return {
|
|
90716
|
-
variant: "info",
|
|
90717
|
-
content: `Derived from remote access — ${state.publicHubUrl} is the first HTTPS address the network-access capability reports. Edit the field to override it; nothing here ever overwrites a value you set.`
|
|
90718
|
-
};
|
|
90719
|
-
case "operator-set": return {
|
|
90720
|
-
variant: "info",
|
|
90721
|
-
content: state.detectedPublicHubUrl.length > 0 ? `Set by you — ${state.publicHubUrl}. The address currently detected from remote access is ${state.detectedPublicHubUrl}; paste it in yourself if you want to switch, detection will not do it for you.` : `Set by you — ${state.publicHubUrl}. No external HTTPS address is detected right now, so nothing is corroborating it.`
|
|
90722
|
-
};
|
|
90723
|
-
case "unset": return state.detectedPublicHubUrl.length > 0 ? {
|
|
90724
|
-
variant: "info",
|
|
90725
|
-
content: `Detected external address: ${state.detectedPublicHubUrl}. Press "Detect external address" to fill the field with it.`
|
|
90726
|
-
} : {
|
|
90727
|
-
variant: "warning",
|
|
90728
|
-
content: "No public HTTPS address detected — no network-access provider on this hub reports a connected HTTPS endpoint, so there is nothing to derive from. Set up remote access (Cloudflare Tunnel, Tailscale Funnel, …) and press \"Detect external address\", or type the URL yourself. An address on your own network will not do: Google calls this URL from its own cloud."
|
|
90729
|
-
};
|
|
90730
|
-
}
|
|
90731
|
-
};
|
|
90732
90920
|
/**
|
|
90733
90921
|
* The `device-export` setup block: the three console URLs plus the
|
|
90734
|
-
* linked-account count
|
|
90735
|
-
*
|
|
90922
|
+
* linked-account count, all off the SAME origin so they cannot disagree.
|
|
90923
|
+
* A read that fails is the same refusal as a role that resolves to nothing.
|
|
90736
90924
|
*/
|
|
90737
|
-
var
|
|
90738
|
-
const origin = normalisePublicHubUrl(input.publicHubUrl);
|
|
90925
|
+
var buildConsoleSetupFromRole = async (input) => {
|
|
90739
90926
|
const linked = String(input.linkedAccounts);
|
|
90740
|
-
|
|
90741
|
-
|
|
90927
|
+
const result = await input.read().then(resolvePublicEndpoint).catch(() => ({
|
|
90928
|
+
ok: false,
|
|
90929
|
+
reason: NO_PUBLIC_ENDPOINT_REASON
|
|
90930
|
+
}));
|
|
90931
|
+
if (!result.ok) return {
|
|
90932
|
+
note: `Refused (${result.reason.code}): ${result.reason.message}`,
|
|
90742
90933
|
fields: [{
|
|
90743
90934
|
label: "Linked Google accounts",
|
|
90744
90935
|
value: linked
|
|
90745
90936
|
}]
|
|
90746
90937
|
};
|
|
90938
|
+
const origin = result.origin;
|
|
90747
90939
|
return {
|
|
90748
90940
|
note: [
|
|
90749
90941
|
"In the Google Home Developer Console create a cloud-to-cloud integration, then paste these three URLs.",
|
|
90750
90942
|
"The integration stays in test mode: publishing requires Google certification, which a private hub cannot obtain.",
|
|
90751
90943
|
"This hub pushes nothing to Google — state is read by polling, so a change made outside the Home app appears on the next query, not instantly.",
|
|
90752
|
-
|
|
90944
|
+
`The URLs follow the "Public endpoint" role on the Network page (${origin}).`
|
|
90753
90945
|
].join("\n"),
|
|
90754
90946
|
fields: [
|
|
90755
90947
|
{
|
|
@@ -90771,37 +90963,9 @@ var buildConsoleSetup = (input) => {
|
|
|
90771
90963
|
]
|
|
90772
90964
|
};
|
|
90773
90965
|
};
|
|
90774
|
-
/**
|
|
90775
|
-
* Detect, apply the policy, persist, and say out loud what happened.
|
|
90776
|
-
*
|
|
90777
|
-
* Every branch here logs: a fill names the URL it picked and the source it came
|
|
90778
|
-
* from, and a miss that leaves the field empty says so rather than passing for
|
|
90779
|
-
* "never ran".
|
|
90780
|
-
*/
|
|
90781
|
-
var refreshPublicHubUrl = async (deps) => {
|
|
90782
|
-
const detected = await deps.detect();
|
|
90783
|
-
const resolution = resolvePublicHubUrl(deps.current().publicHubUrl, detected);
|
|
90784
|
-
await deps.persist(resolution.patch);
|
|
90785
|
-
if (resolution.defaulted) deps.logger.info("export-google: defaulted public hub URL to the detected external address", { meta: {
|
|
90786
|
-
publicHubUrl: resolution.publicHubUrl,
|
|
90787
|
-
source: "network-access"
|
|
90788
|
-
} });
|
|
90789
|
-
else if (resolution.publicHubUrl.length === 0) deps.logger.warn("export-google: public hub URL still unset after detection — the Google console URLs cannot be rendered until one is available", { meta: { detectedCount: detected.length } });
|
|
90790
|
-
return resolution;
|
|
90791
|
-
};
|
|
90792
|
-
/** What "Detect external address" did, in one sentence for the button. */
|
|
90793
|
-
function describeDetectResult(result) {
|
|
90794
|
-
const { publicHubUrl, detectedPublicHubUrl, filled } = result;
|
|
90795
|
-
if (filled) return `Filled in ${publicHubUrl}.`;
|
|
90796
|
-
if (detectedPublicHubUrl.length === 0) return publicHubUrl.length > 0 ? `No public HTTPS address detected; your value ${publicHubUrl} was kept.` : "No public HTTPS address detected. Set up remote access first.";
|
|
90797
|
-
if (detectedPublicHubUrl === publicHubUrl) return `Detected ${publicHubUrl}, already in use.`;
|
|
90798
|
-
return `Detected ${detectedPublicHubUrl}; your value ${publicHubUrl} was kept.`;
|
|
90799
|
-
}
|
|
90800
90966
|
//#endregion
|
|
90801
90967
|
//#region src/types.ts
|
|
90802
90968
|
var DEFAULT_SETTINGS = {
|
|
90803
|
-
publicHubUrl: "",
|
|
90804
|
-
detectedPublicHubUrl: "",
|
|
90805
90969
|
exposed: [],
|
|
90806
90970
|
exposedActions: [],
|
|
90807
90971
|
linkedAccounts: []
|
|
@@ -90856,9 +91020,7 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
90856
91020
|
logger: this.ctx.logger
|
|
90857
91021
|
});
|
|
90858
91022
|
this.gateway = gateway;
|
|
90859
|
-
this.
|
|
90860
|
-
this.ctx.logger.warn("export-google: public hub URL auto-detect failed", { meta: { error: errMsg$1(err) } });
|
|
90861
|
-
});
|
|
91023
|
+
await this.runMigrations(defineAddonMigrations(ADDON_MIGRATIONS, { readStored: async () => this.resolveGlobalStore() }));
|
|
90862
91024
|
const actionScenes = new ActionSceneExports({
|
|
90863
91025
|
api: this.ctx.api,
|
|
90864
91026
|
logger: this.ctx.logger,
|
|
@@ -90874,7 +91036,7 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
90874
91036
|
getStatus: async () => ({
|
|
90875
91037
|
linkState: this.config.linkedAccounts.length > 0 ? "linked" : "unlinked",
|
|
90876
91038
|
exposedDeviceCount: this.config.exposed.length,
|
|
90877
|
-
setup: this.buildSetupBlock()
|
|
91039
|
+
setup: await this.buildSetupBlock()
|
|
90878
91040
|
}),
|
|
90879
91041
|
listSupportedDeviceKinds: async () => [...SUPPORTED_DEVICE_KINDS],
|
|
90880
91042
|
listExposedDevices: async () => this.config.exposed.map((entry) => ({ deviceId: String(entry.deviceId) })),
|
|
@@ -90930,97 +91092,25 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
90930
91092
|
}
|
|
90931
91093
|
}));
|
|
90932
91094
|
const oauthIntegrationProvider = { getDescriptor: async () => buildGoogleOauthIntegration() };
|
|
90933
|
-
const offTunnelStarted = this.ctx.eventBus.subscribe({ category: EventCategory.NetworkTunnelStarted }, () => {
|
|
90934
|
-
this.detectPublicHubUrl().catch((err) => {
|
|
90935
|
-
this.ctx.logger.warn("export-google: public hub URL detect after tunnel connect failed", { meta: { error: errMsg$1(err) } });
|
|
90936
|
-
});
|
|
90937
|
-
});
|
|
90938
|
-
this.ctx.addDisposer(async () => offTunnelStarted());
|
|
90939
91095
|
this.ctx.logger.info("export-google: initialized", { meta: {
|
|
90940
91096
|
exposedCount: this.config.exposed.length,
|
|
90941
91097
|
linkedAccounts: this.config.linkedAccounts.length,
|
|
90942
|
-
publicHubUrlSet: this.config.publicHubUrl.length > 0,
|
|
90943
91098
|
willReportState: false
|
|
90944
91099
|
} });
|
|
90945
|
-
return
|
|
90946
|
-
|
|
90947
|
-
|
|
90948
|
-
|
|
90949
|
-
provider: deviceExportProvider
|
|
90950
|
-
},
|
|
90951
|
-
{
|
|
90952
|
-
capability: addonRoutesCapability,
|
|
90953
|
-
provider: routeProvider
|
|
90954
|
-
},
|
|
90955
|
-
{
|
|
90956
|
-
capability: oauthIntegrationCapability,
|
|
90957
|
-
provider: oauthIntegrationProvider
|
|
90958
|
-
}
|
|
90959
|
-
],
|
|
90960
|
-
customActions: exportGoogleActions,
|
|
90961
|
-
actionHandlers: { detectPublicHubUrl: async () => this.detectPublicHubUrl() }
|
|
90962
|
-
};
|
|
90963
|
-
}
|
|
90964
|
-
/** This addon's slice of `PublicHubUrlState`. */
|
|
90965
|
-
publicHubUrlState() {
|
|
90966
|
-
return {
|
|
90967
|
-
publicHubUrl: this.config.publicHubUrl,
|
|
90968
|
-
detectedPublicHubUrl: this.config.detectedPublicHubUrl
|
|
90969
|
-
};
|
|
90970
|
-
}
|
|
90971
|
-
/**
|
|
90972
|
-
* Adapter from the codegen'd `network-access` router onto the narrow reader
|
|
90973
|
-
* `public-hub-url.ts` consumes. Fields are copied one by one rather than
|
|
90974
|
-
* passed through, so the module never depends on the cap's wider shape and a
|
|
90975
|
-
* test double for it needs no cast.
|
|
90976
|
-
*/
|
|
90977
|
-
networkAccessReader() {
|
|
90978
|
-
return {
|
|
90979
|
-
listEndpoints: async () => {
|
|
90980
|
-
return (await this.ctx.api.networkAccess.listEndpoints.query({})).map((entry) => ({
|
|
90981
|
-
url: entry.url,
|
|
90982
|
-
protocol: entry.protocol
|
|
90983
|
-
}));
|
|
91100
|
+
return [
|
|
91101
|
+
{
|
|
91102
|
+
capability: deviceExportCapability,
|
|
91103
|
+
provider: deviceExportProvider
|
|
90984
91104
|
},
|
|
90985
|
-
|
|
90986
|
-
|
|
90987
|
-
|
|
90988
|
-
|
|
90989
|
-
|
|
90990
|
-
|
|
90991
|
-
|
|
90992
|
-
}
|
|
90993
|
-
};
|
|
91105
|
+
{
|
|
91106
|
+
capability: addonRoutesCapability,
|
|
91107
|
+
provider: routeProvider
|
|
91108
|
+
},
|
|
91109
|
+
{
|
|
91110
|
+
capability: oauthIntegrationCapability,
|
|
91111
|
+
provider: oauthIntegrationProvider
|
|
90994
91112
|
}
|
|
90995
|
-
|
|
90996
|
-
}
|
|
90997
|
-
/**
|
|
90998
|
-
* Refresh the detected address and DEFAULT the field to it when it is empty.
|
|
90999
|
-
* Backs both the boot-time detect and the "Detect external address" button.
|
|
91000
|
-
*
|
|
91001
|
-
* Never replaces a value the operator set — that value is what they already
|
|
91002
|
-
* pasted into the Google console, and rewriting it here would leave the two
|
|
91003
|
-
* sides disagreeing with nothing on screen to say so.
|
|
91004
|
-
*/
|
|
91005
|
-
async detectPublicHubUrl() {
|
|
91006
|
-
const resolution = await refreshPublicHubUrl({
|
|
91007
|
-
current: () => this.publicHubUrlState(),
|
|
91008
|
-
detect: () => detectPublicHubOrigins({
|
|
91009
|
-
network: this.networkAccessReader(),
|
|
91010
|
-
logger: this.ctx.logger
|
|
91011
|
-
}),
|
|
91012
|
-
persist: (patch) => this.updateGlobalSettings(patch),
|
|
91013
|
-
logger: this.ctx.logger
|
|
91014
|
-
});
|
|
91015
|
-
const result = {
|
|
91016
|
-
publicHubUrl: resolution.publicHubUrl,
|
|
91017
|
-
detectedPublicHubUrl: resolution.detectedPublicHubUrl,
|
|
91018
|
-
filled: resolution.defaulted
|
|
91019
|
-
};
|
|
91020
|
-
return {
|
|
91021
|
-
...result,
|
|
91022
|
-
summary: describeDetectResult(result)
|
|
91023
|
-
};
|
|
91113
|
+
];
|
|
91024
91114
|
}
|
|
91025
91115
|
async onShutdown() {
|
|
91026
91116
|
this.gateway = null;
|
|
@@ -91089,11 +91179,11 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
91089
91179
|
* value still travels in the `getStatus` response — so it would be the wrong
|
|
91090
91180
|
* tool for a real credential anyway (docs/decisions/adr-0269-a-google-export-that-holds-no-google-credential.md).
|
|
91091
91181
|
*/
|
|
91092
|
-
buildSetupBlock() {
|
|
91093
|
-
return
|
|
91182
|
+
async buildSetupBlock() {
|
|
91183
|
+
return buildConsoleSetupFromRole({
|
|
91094
91184
|
addonId: ADDON_ID,
|
|
91095
|
-
|
|
91096
|
-
|
|
91185
|
+
linkedAccounts: this.config.linkedAccounts.length,
|
|
91186
|
+
read: () => this.ctx.api.localNetwork.getAddresses.query()
|
|
91097
91187
|
});
|
|
91098
91188
|
}
|
|
91099
91189
|
globalSettingsSchema() {
|
|
@@ -91102,44 +91192,17 @@ var ExportGoogleAddon = class extends BaseAddon {
|
|
|
91102
91192
|
title: "Connection",
|
|
91103
91193
|
description: "Publishes switches, dimmable lights, locks and covers to Google Home. The hub answers Google directly — no cloud function, and no Google credential is stored here.",
|
|
91104
91194
|
columns: 1,
|
|
91105
|
-
fields: [
|
|
91106
|
-
|
|
91107
|
-
|
|
91108
|
-
|
|
91109
|
-
|
|
91110
|
-
|
|
91111
|
-
|
|
91112
|
-
|
|
91113
|
-
|
|
91114
|
-
|
|
91115
|
-
|
|
91116
|
-
},
|
|
91117
|
-
this.field({
|
|
91118
|
-
type: "text",
|
|
91119
|
-
key: "publicHubUrl",
|
|
91120
|
-
label: "Public hub URL",
|
|
91121
|
-
description: "HTTPS origin Google reaches this hub on, e.g. https://hub.example.com. Used to render the URLs you paste into the Google console. Left empty, it defaults to the first external address remote access reports; once it holds a value, nothing overwrites it.",
|
|
91122
|
-
placeholder: "https://hub.example.com",
|
|
91123
|
-
default: DEFAULT_SETTINGS.publicHubUrl
|
|
91124
|
-
}),
|
|
91125
|
-
{
|
|
91126
|
-
type: "info",
|
|
91127
|
-
key: "__public-hub-url-source",
|
|
91128
|
-
label: "Where this came from",
|
|
91129
|
-
...buildPublicHubUrlNotice(this.publicHubUrlState())
|
|
91130
|
-
},
|
|
91131
|
-
{
|
|
91132
|
-
type: "addon-action-button",
|
|
91133
|
-
addonId: ADDON_ID,
|
|
91134
|
-
key: "__detect-public-hub-url",
|
|
91135
|
-
label: "External address",
|
|
91136
|
-
description: "Re-scan the connected remote-access providers. Fills the field above when it is empty; a value you set is left exactly as it is.",
|
|
91137
|
-
buttonLabel: "Detect external address",
|
|
91138
|
-
action: "detectPublicHubUrl",
|
|
91139
|
-
variant: "default",
|
|
91140
|
-
successMessage: "{summary}"
|
|
91141
|
-
}
|
|
91142
|
-
]
|
|
91195
|
+
fields: [{
|
|
91196
|
+
type: "info",
|
|
91197
|
+
key: "__google-setup-banner",
|
|
91198
|
+
label: "Setup overview",
|
|
91199
|
+
variant: "info",
|
|
91200
|
+
content: [
|
|
91201
|
+
"This hub must be reachable from the public internet over HTTPS (Cloudflare Tunnel, Tailscale Funnel, …) — Google calls the fulfillment URL from its own cloud.",
|
|
91202
|
+
"Create a cloud-to-cloud integration in the Google Home Developer Console, paste the three URLs from the Export panel, and link your account from the Home app.",
|
|
91203
|
+
"Cameras are not exported, and state is not pushed: Google polls. Ask \"Hey Google, sync my devices\" after exposing something new."
|
|
91204
|
+
].join("\n")
|
|
91205
|
+
}]
|
|
91143
91206
|
}] });
|
|
91144
91207
|
}
|
|
91145
91208
|
/**
|