@camstack/addon-export-alexa 1.2.43 → 1.2.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/export-alexa.addon.js +127 -0
- package/dist/export-alexa.addon.mjs +127 -0
- package/package.json +1 -1
|
@@ -5943,6 +5943,40 @@ var BaseAddon = class {
|
|
|
5943
5943
|
deviceSettingsSchema() {
|
|
5944
5944
|
return null;
|
|
5945
5945
|
}
|
|
5946
|
+
/**
|
|
5947
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
5948
|
+
* ARE the configuration of its integration.
|
|
5949
|
+
*
|
|
5950
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
5951
|
+
* operator should find on the addon's integration page (System →
|
|
5952
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
5953
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
5954
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
5955
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
5956
|
+
* nature of the integration.
|
|
5957
|
+
*
|
|
5958
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
5959
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
5960
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
5961
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
5962
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
5963
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
5964
|
+
*
|
|
5965
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
5966
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
5967
|
+
* removed with the reason recorded at
|
|
5968
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
5969
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
5970
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
5971
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
5972
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
5973
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
5974
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
5975
|
+
* ids it names.
|
|
5976
|
+
*/
|
|
5977
|
+
integrationSettingSections() {
|
|
5978
|
+
return [];
|
|
5979
|
+
}
|
|
5946
5980
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5947
5981
|
const schema = this.globalSettingsSchema(cap);
|
|
5948
5982
|
if (!schema) return { sections: [] };
|
|
@@ -5953,6 +5987,55 @@ var BaseAddon = class {
|
|
|
5953
5987
|
} : projected);
|
|
5954
5988
|
}
|
|
5955
5989
|
/**
|
|
5990
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
5991
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
5992
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
5993
|
+
*
|
|
5994
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
5995
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
5996
|
+
* as a failed load.
|
|
5997
|
+
*
|
|
5998
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
5999
|
+
* and not in whichever UI happens to render this:
|
|
6000
|
+
*
|
|
6001
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
6002
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
6003
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
6004
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
6005
|
+
* not merely discouraged.
|
|
6006
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
6007
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
6008
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
6009
|
+
* who opened the page (D266).
|
|
6010
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
6011
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
6012
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
6013
|
+
*/
|
|
6014
|
+
async getIntegrationSettings(nodeId) {
|
|
6015
|
+
const declared = this.integrationSettingSections();
|
|
6016
|
+
if (declared.length === 0) return null;
|
|
6017
|
+
const schema = this.globalSettingsSchema();
|
|
6018
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
6019
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
6020
|
+
const sections = [];
|
|
6021
|
+
for (const id of declared) {
|
|
6022
|
+
const section = byId.get(id);
|
|
6023
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
6024
|
+
const fields = dropPerNodeFields(section.fields);
|
|
6025
|
+
if (fields.length === 0) continue;
|
|
6026
|
+
sections.push({
|
|
6027
|
+
...section,
|
|
6028
|
+
fields
|
|
6029
|
+
});
|
|
6030
|
+
}
|
|
6031
|
+
if (sections.length === 0) return null;
|
|
6032
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6033
|
+
return hydrateSchema({
|
|
6034
|
+
...schema,
|
|
6035
|
+
sections
|
|
6036
|
+
}, projected);
|
|
6037
|
+
}
|
|
6038
|
+
/**
|
|
5956
6039
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5957
6040
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5958
6041
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6256,6 +6339,41 @@ var BaseAddon = class {
|
|
|
6256
6339
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6257
6340
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6258
6341
|
*/
|
|
6342
|
+
/**
|
|
6343
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6344
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6345
|
+
* with no child is dropped rather than rendered empty.
|
|
6346
|
+
*
|
|
6347
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6348
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6349
|
+
*/
|
|
6350
|
+
function dropPerNodeFields(fields) {
|
|
6351
|
+
const kept = [];
|
|
6352
|
+
for (const field of fields) {
|
|
6353
|
+
if (field.type === "group") {
|
|
6354
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6355
|
+
if (inner.length > 0) kept.push({
|
|
6356
|
+
...field,
|
|
6357
|
+
fields: inner
|
|
6358
|
+
});
|
|
6359
|
+
continue;
|
|
6360
|
+
}
|
|
6361
|
+
if (field.type === "sub-tabs") {
|
|
6362
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6363
|
+
...tab,
|
|
6364
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6365
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6366
|
+
if (tabs.length > 0) kept.push({
|
|
6367
|
+
...field,
|
|
6368
|
+
tabs
|
|
6369
|
+
});
|
|
6370
|
+
continue;
|
|
6371
|
+
}
|
|
6372
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6373
|
+
kept.push(field);
|
|
6374
|
+
}
|
|
6375
|
+
return kept;
|
|
6376
|
+
}
|
|
6259
6377
|
function collectPerNodeFieldKeys(fields) {
|
|
6260
6378
|
const collected = [];
|
|
6261
6379
|
for (const field of fields) {
|
|
@@ -9646,6 +9764,9 @@ method(object({
|
|
|
9646
9764
|
kind: "mutation",
|
|
9647
9765
|
auth: "admin"
|
|
9648
9766
|
}), method(object({
|
|
9767
|
+
addonId: string(),
|
|
9768
|
+
nodeId: string().optional()
|
|
9769
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
9649
9770
|
addonId: string(),
|
|
9650
9771
|
deviceId: number(),
|
|
9651
9772
|
nodeId: string().optional()
|
|
@@ -28103,6 +28224,12 @@ Object.freeze({
|
|
|
28103
28224
|
addonId: null,
|
|
28104
28225
|
access: "view"
|
|
28105
28226
|
},
|
|
28227
|
+
"addonSettings.getIntegrationSettings": {
|
|
28228
|
+
capName: "addon-settings",
|
|
28229
|
+
capScope: "system",
|
|
28230
|
+
addonId: null,
|
|
28231
|
+
access: "view"
|
|
28232
|
+
},
|
|
28106
28233
|
"addonSettings.updateDeviceSettings": {
|
|
28107
28234
|
capName: "addon-settings",
|
|
28108
28235
|
capScope: "system",
|
|
@@ -5916,6 +5916,40 @@ var BaseAddon = class {
|
|
|
5916
5916
|
deviceSettingsSchema() {
|
|
5917
5917
|
return null;
|
|
5918
5918
|
}
|
|
5919
|
+
/**
|
|
5920
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
5921
|
+
* ARE the configuration of its integration.
|
|
5922
|
+
*
|
|
5923
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
5924
|
+
* operator should find on the addon's integration page (System →
|
|
5925
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
5926
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
5927
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
5928
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
5929
|
+
* nature of the integration.
|
|
5930
|
+
*
|
|
5931
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
5932
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
5933
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
5934
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
5935
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
5936
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
5937
|
+
*
|
|
5938
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
5939
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
5940
|
+
* removed with the reason recorded at
|
|
5941
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
5942
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
5943
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
5944
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
5945
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
5946
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
5947
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
5948
|
+
* ids it names.
|
|
5949
|
+
*/
|
|
5950
|
+
integrationSettingSections() {
|
|
5951
|
+
return [];
|
|
5952
|
+
}
|
|
5919
5953
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5920
5954
|
const schema = this.globalSettingsSchema(cap);
|
|
5921
5955
|
if (!schema) return { sections: [] };
|
|
@@ -5926,6 +5960,55 @@ var BaseAddon = class {
|
|
|
5926
5960
|
} : projected);
|
|
5927
5961
|
}
|
|
5928
5962
|
/**
|
|
5963
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
5964
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
5965
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
5966
|
+
*
|
|
5967
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
5968
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
5969
|
+
* as a failed load.
|
|
5970
|
+
*
|
|
5971
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
5972
|
+
* and not in whichever UI happens to render this:
|
|
5973
|
+
*
|
|
5974
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
5975
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
5976
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
5977
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
5978
|
+
* not merely discouraged.
|
|
5979
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
5980
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
5981
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
5982
|
+
* who opened the page (D266).
|
|
5983
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
5984
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
5985
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
5986
|
+
*/
|
|
5987
|
+
async getIntegrationSettings(nodeId) {
|
|
5988
|
+
const declared = this.integrationSettingSections();
|
|
5989
|
+
if (declared.length === 0) return null;
|
|
5990
|
+
const schema = this.globalSettingsSchema();
|
|
5991
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
5992
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
5993
|
+
const sections = [];
|
|
5994
|
+
for (const id of declared) {
|
|
5995
|
+
const section = byId.get(id);
|
|
5996
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
5997
|
+
const fields = dropPerNodeFields(section.fields);
|
|
5998
|
+
if (fields.length === 0) continue;
|
|
5999
|
+
sections.push({
|
|
6000
|
+
...section,
|
|
6001
|
+
fields
|
|
6002
|
+
});
|
|
6003
|
+
}
|
|
6004
|
+
if (sections.length === 0) return null;
|
|
6005
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6006
|
+
return hydrateSchema({
|
|
6007
|
+
...schema,
|
|
6008
|
+
sections
|
|
6009
|
+
}, projected);
|
|
6010
|
+
}
|
|
6011
|
+
/**
|
|
5929
6012
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5930
6013
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5931
6014
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6229,6 +6312,41 @@ var BaseAddon = class {
|
|
|
6229
6312
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6230
6313
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6231
6314
|
*/
|
|
6315
|
+
/**
|
|
6316
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6317
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6318
|
+
* with no child is dropped rather than rendered empty.
|
|
6319
|
+
*
|
|
6320
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6321
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6322
|
+
*/
|
|
6323
|
+
function dropPerNodeFields(fields) {
|
|
6324
|
+
const kept = [];
|
|
6325
|
+
for (const field of fields) {
|
|
6326
|
+
if (field.type === "group") {
|
|
6327
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6328
|
+
if (inner.length > 0) kept.push({
|
|
6329
|
+
...field,
|
|
6330
|
+
fields: inner
|
|
6331
|
+
});
|
|
6332
|
+
continue;
|
|
6333
|
+
}
|
|
6334
|
+
if (field.type === "sub-tabs") {
|
|
6335
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6336
|
+
...tab,
|
|
6337
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6338
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6339
|
+
if (tabs.length > 0) kept.push({
|
|
6340
|
+
...field,
|
|
6341
|
+
tabs
|
|
6342
|
+
});
|
|
6343
|
+
continue;
|
|
6344
|
+
}
|
|
6345
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6346
|
+
kept.push(field);
|
|
6347
|
+
}
|
|
6348
|
+
return kept;
|
|
6349
|
+
}
|
|
6232
6350
|
function collectPerNodeFieldKeys(fields) {
|
|
6233
6351
|
const collected = [];
|
|
6234
6352
|
for (const field of fields) {
|
|
@@ -9619,6 +9737,9 @@ method(object({
|
|
|
9619
9737
|
kind: "mutation",
|
|
9620
9738
|
auth: "admin"
|
|
9621
9739
|
}), method(object({
|
|
9740
|
+
addonId: string(),
|
|
9741
|
+
nodeId: string().optional()
|
|
9742
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
9622
9743
|
addonId: string(),
|
|
9623
9744
|
deviceId: number(),
|
|
9624
9745
|
nodeId: string().optional()
|
|
@@ -28076,6 +28197,12 @@ Object.freeze({
|
|
|
28076
28197
|
addonId: null,
|
|
28077
28198
|
access: "view"
|
|
28078
28199
|
},
|
|
28200
|
+
"addonSettings.getIntegrationSettings": {
|
|
28201
|
+
capName: "addon-settings",
|
|
28202
|
+
capScope: "system",
|
|
28203
|
+
addonId: null,
|
|
28204
|
+
access: "view"
|
|
28205
|
+
},
|
|
28079
28206
|
"addonSettings.updateDeviceSettings": {
|
|
28080
28207
|
capName: "addon-settings",
|
|
28081
28208
|
capScope: "system",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/addon-export-alexa",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.44",
|
|
4
4
|
"description": "Alexa Smart Home Skill export — hub-side OAuth provider + directive handler. The companion AWS Lambda forwards Alexa directives to this addon's /addon/export-alexa/directive endpoint.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|