@camstack/addon-decoder-ffmpeg 1.2.35 → 1.2.37
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/index.js +127 -0
- package/dist/index.mjs +127 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5921,6 +5921,40 @@ var BaseAddon = class {
|
|
|
5921
5921
|
deviceSettingsSchema() {
|
|
5922
5922
|
return null;
|
|
5923
5923
|
}
|
|
5924
|
+
/**
|
|
5925
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
5926
|
+
* ARE the configuration of its integration.
|
|
5927
|
+
*
|
|
5928
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
5929
|
+
* operator should find on the addon's integration page (System →
|
|
5930
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
5931
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
5932
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
5933
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
5934
|
+
* nature of the integration.
|
|
5935
|
+
*
|
|
5936
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
5937
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
5938
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
5939
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
5940
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
5941
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
5942
|
+
*
|
|
5943
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
5944
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
5945
|
+
* removed with the reason recorded at
|
|
5946
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
5947
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
5948
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
5949
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
5950
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
5951
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
5952
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
5953
|
+
* ids it names.
|
|
5954
|
+
*/
|
|
5955
|
+
integrationSettingSections() {
|
|
5956
|
+
return [];
|
|
5957
|
+
}
|
|
5924
5958
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5925
5959
|
const schema = this.globalSettingsSchema(cap);
|
|
5926
5960
|
if (!schema) return { sections: [] };
|
|
@@ -5931,6 +5965,55 @@ var BaseAddon = class {
|
|
|
5931
5965
|
} : projected);
|
|
5932
5966
|
}
|
|
5933
5967
|
/**
|
|
5968
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
5969
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
5970
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
5971
|
+
*
|
|
5972
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
5973
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
5974
|
+
* as a failed load.
|
|
5975
|
+
*
|
|
5976
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
5977
|
+
* and not in whichever UI happens to render this:
|
|
5978
|
+
*
|
|
5979
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
5980
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
5981
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
5982
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
5983
|
+
* not merely discouraged.
|
|
5984
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
5985
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
5986
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
5987
|
+
* who opened the page (D266).
|
|
5988
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
5989
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
5990
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
5991
|
+
*/
|
|
5992
|
+
async getIntegrationSettings(nodeId) {
|
|
5993
|
+
const declared = this.integrationSettingSections();
|
|
5994
|
+
if (declared.length === 0) return null;
|
|
5995
|
+
const schema = this.globalSettingsSchema();
|
|
5996
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
5997
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
5998
|
+
const sections = [];
|
|
5999
|
+
for (const id of declared) {
|
|
6000
|
+
const section = byId.get(id);
|
|
6001
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
6002
|
+
const fields = dropPerNodeFields(section.fields);
|
|
6003
|
+
if (fields.length === 0) continue;
|
|
6004
|
+
sections.push({
|
|
6005
|
+
...section,
|
|
6006
|
+
fields
|
|
6007
|
+
});
|
|
6008
|
+
}
|
|
6009
|
+
if (sections.length === 0) return null;
|
|
6010
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6011
|
+
return hydrateSchema({
|
|
6012
|
+
...schema,
|
|
6013
|
+
sections
|
|
6014
|
+
}, projected);
|
|
6015
|
+
}
|
|
6016
|
+
/**
|
|
5934
6017
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5935
6018
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5936
6019
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6234,6 +6317,41 @@ var BaseAddon = class {
|
|
|
6234
6317
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6235
6318
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6236
6319
|
*/
|
|
6320
|
+
/**
|
|
6321
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6322
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6323
|
+
* with no child is dropped rather than rendered empty.
|
|
6324
|
+
*
|
|
6325
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6326
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6327
|
+
*/
|
|
6328
|
+
function dropPerNodeFields(fields) {
|
|
6329
|
+
const kept = [];
|
|
6330
|
+
for (const field of fields) {
|
|
6331
|
+
if (field.type === "group") {
|
|
6332
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6333
|
+
if (inner.length > 0) kept.push({
|
|
6334
|
+
...field,
|
|
6335
|
+
fields: inner
|
|
6336
|
+
});
|
|
6337
|
+
continue;
|
|
6338
|
+
}
|
|
6339
|
+
if (field.type === "sub-tabs") {
|
|
6340
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6341
|
+
...tab,
|
|
6342
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6343
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6344
|
+
if (tabs.length > 0) kept.push({
|
|
6345
|
+
...field,
|
|
6346
|
+
tabs
|
|
6347
|
+
});
|
|
6348
|
+
continue;
|
|
6349
|
+
}
|
|
6350
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6351
|
+
kept.push(field);
|
|
6352
|
+
}
|
|
6353
|
+
return kept;
|
|
6354
|
+
}
|
|
6237
6355
|
function collectPerNodeFieldKeys(fields) {
|
|
6238
6356
|
const collected = [];
|
|
6239
6357
|
for (const field of fields) {
|
|
@@ -9399,6 +9517,9 @@ method(object({
|
|
|
9399
9517
|
kind: "mutation",
|
|
9400
9518
|
auth: "admin"
|
|
9401
9519
|
}), method(object({
|
|
9520
|
+
addonId: string(),
|
|
9521
|
+
nodeId: string().optional()
|
|
9522
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
9402
9523
|
addonId: string(),
|
|
9403
9524
|
deviceId: number(),
|
|
9404
9525
|
nodeId: string().optional()
|
|
@@ -27923,6 +28044,12 @@ Object.freeze({
|
|
|
27923
28044
|
addonId: null,
|
|
27924
28045
|
access: "view"
|
|
27925
28046
|
},
|
|
28047
|
+
"addonSettings.getIntegrationSettings": {
|
|
28048
|
+
capName: "addon-settings",
|
|
28049
|
+
capScope: "system",
|
|
28050
|
+
addonId: null,
|
|
28051
|
+
access: "view"
|
|
28052
|
+
},
|
|
27926
28053
|
"addonSettings.updateDeviceSettings": {
|
|
27927
28054
|
capName: "addon-settings",
|
|
27928
28055
|
capScope: "system",
|
package/dist/index.mjs
CHANGED
|
@@ -5917,6 +5917,40 @@ var BaseAddon = class {
|
|
|
5917
5917
|
deviceSettingsSchema() {
|
|
5918
5918
|
return null;
|
|
5919
5919
|
}
|
|
5920
|
+
/**
|
|
5921
|
+
* INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
|
|
5922
|
+
* ARE the configuration of its integration.
|
|
5923
|
+
*
|
|
5924
|
+
* Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
|
|
5925
|
+
* operator should find on the addon's integration page (System →
|
|
5926
|
+
* Integrations → <name>) rather than only in the cluster-wide list of every
|
|
5927
|
+
* addon. Empty (the default) means the addon has no integration-level
|
|
5928
|
+
* settings and no such surface is offered — this is opt-in, because whether
|
|
5929
|
+
* an addon's configuration IS its integration's configuration depends on the
|
|
5930
|
+
* nature of the integration.
|
|
5931
|
+
*
|
|
5932
|
+
* WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
|
|
5933
|
+
* the ONE global schema, in the ONE addon store, written by the ONE
|
|
5934
|
+
* `updateGlobalSettings` path. There is deliberately no
|
|
5935
|
+
* `updateIntegrationSettings`: a second write path is how a surface acquires
|
|
5936
|
+
* a second store key, and this repo has shipped that twice (`btmPath@hub`,
|
|
5937
|
+
* D266). Selecting sections cannot introduce a key that selecting cannot.
|
|
5938
|
+
*
|
|
5939
|
+
* WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
|
|
5940
|
+
* `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
|
|
5941
|
+
* removed with the reason recorded at
|
|
5942
|
+
* `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
|
|
5943
|
+
* determined by WHICH schema it lives in, not by a field-level marker."* A
|
|
5944
|
+
* marker sprinkled across sections also has to borrow a field that already
|
|
5945
|
+
* means something else; borrowing `section.tab` put the literal word
|
|
5946
|
+
* "integration" into an operator-facing tab bar, because `tab` means "how to
|
|
5947
|
+
* GROUP this visually" and cannot also mean "where this lives" (D269
|
|
5948
|
+
* supersedes D268). One declaration, in one place, next to the schema whose
|
|
5949
|
+
* ids it names.
|
|
5950
|
+
*/
|
|
5951
|
+
integrationSettingSections() {
|
|
5952
|
+
return [];
|
|
5953
|
+
}
|
|
5920
5954
|
async getGlobalSettings(overlay, cap, nodeId) {
|
|
5921
5955
|
const schema = this.globalSettingsSchema(cap);
|
|
5922
5956
|
if (!schema) return { sections: [] };
|
|
@@ -5927,6 +5961,55 @@ var BaseAddon = class {
|
|
|
5927
5961
|
} : projected);
|
|
5928
5962
|
}
|
|
5929
5963
|
/**
|
|
5964
|
+
* The integration-level view of this addon's settings: exactly the sections
|
|
5965
|
+
* named by {@link integrationSettingSections}, hydrated from the SAME store
|
|
5966
|
+
* `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
|
|
5967
|
+
*
|
|
5968
|
+
* Returns `null` when the addon declared nothing — an addon that opts out has
|
|
5969
|
+
* no integration settings surface at all, rather than an empty one that reads
|
|
5970
|
+
* as a failed load.
|
|
5971
|
+
*
|
|
5972
|
+
* Three properties hold BY CONSTRUCTION, which is why they are here in core
|
|
5973
|
+
* and not in whichever UI happens to render this:
|
|
5974
|
+
*
|
|
5975
|
+
* 1. **One key.** The payload is a SUBSET of the global schema, so a field
|
|
5976
|
+
* shown here is the same field, with the same bare key, that the addon's
|
|
5977
|
+
* own page shows. There is no integration-specific writer — callers save
|
|
5978
|
+
* through `updateGlobalSettings` — so a second store key is unreachable,
|
|
5979
|
+
* not merely discouraged.
|
|
5980
|
+
* 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
|
|
5981
|
+
* is `<key>@<nodeId>` and an integration is not a node; whichever node
|
|
5982
|
+
* such a field silently picked would be a wrong answer for the operator
|
|
5983
|
+
* who opened the page (D266).
|
|
5984
|
+
* 3. **No silent typo.** A declared id that names no section throws. The
|
|
5985
|
+
* alternative — skip it — turns a rename into a surface that quietly
|
|
5986
|
+
* empties, which looks exactly like an addon with nothing to configure.
|
|
5987
|
+
*/
|
|
5988
|
+
async getIntegrationSettings(nodeId) {
|
|
5989
|
+
const declared = this.integrationSettingSections();
|
|
5990
|
+
if (declared.length === 0) return null;
|
|
5991
|
+
const schema = this.globalSettingsSchema();
|
|
5992
|
+
if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
|
|
5993
|
+
const byId = new Map(schema.sections.map((section) => [section.id, section]));
|
|
5994
|
+
const sections = [];
|
|
5995
|
+
for (const id of declared) {
|
|
5996
|
+
const section = byId.get(id);
|
|
5997
|
+
if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
|
|
5998
|
+
const fields = dropPerNodeFields(section.fields);
|
|
5999
|
+
if (fields.length === 0) continue;
|
|
6000
|
+
sections.push({
|
|
6001
|
+
...section,
|
|
6002
|
+
fields
|
|
6003
|
+
});
|
|
6004
|
+
}
|
|
6005
|
+
if (sections.length === 0) return null;
|
|
6006
|
+
const projected = await this.resolveGlobalStore(nodeId);
|
|
6007
|
+
return hydrateSchema({
|
|
6008
|
+
...schema,
|
|
6009
|
+
sections
|
|
6010
|
+
}, projected);
|
|
6011
|
+
}
|
|
6012
|
+
/**
|
|
5930
6013
|
* The raw addon store PROJECTED onto the target node's bare per-node keys:
|
|
5931
6014
|
* every `perNode: true` field carries THAT node's scoped value on its bare
|
|
5932
6015
|
* key (absent scoped key ⇒ key absent, so the schema `default` wins — no
|
|
@@ -6230,6 +6313,41 @@ var BaseAddon = class {
|
|
|
6230
6313
|
* `hydrateSchema` does. Valueless structural fields (separator/info/…)
|
|
6231
6314
|
* don't declare `perNode` and are excluded by the `in` narrowing.
|
|
6232
6315
|
*/
|
|
6316
|
+
/**
|
|
6317
|
+
* The same fields with every `perNode: true` one removed, recursing into layout
|
|
6318
|
+
* containers exactly as {@link collectPerNodeFieldKeys} does. A container left
|
|
6319
|
+
* with no child is dropped rather than rendered empty.
|
|
6320
|
+
*
|
|
6321
|
+
* Used by `getIntegrationSettings`: an integration is not a node, so a field
|
|
6322
|
+
* whose store key is `<key>@<nodeId>` has no node to belong to there.
|
|
6323
|
+
*/
|
|
6324
|
+
function dropPerNodeFields(fields) {
|
|
6325
|
+
const kept = [];
|
|
6326
|
+
for (const field of fields) {
|
|
6327
|
+
if (field.type === "group") {
|
|
6328
|
+
const inner = dropPerNodeFields(field.fields);
|
|
6329
|
+
if (inner.length > 0) kept.push({
|
|
6330
|
+
...field,
|
|
6331
|
+
fields: inner
|
|
6332
|
+
});
|
|
6333
|
+
continue;
|
|
6334
|
+
}
|
|
6335
|
+
if (field.type === "sub-tabs") {
|
|
6336
|
+
const tabs = field.tabs.map((tab) => ({
|
|
6337
|
+
...tab,
|
|
6338
|
+
fields: dropPerNodeFields(tab.fields)
|
|
6339
|
+
})).filter((tab) => tab.fields.length > 0);
|
|
6340
|
+
if (tabs.length > 0) kept.push({
|
|
6341
|
+
...field,
|
|
6342
|
+
tabs
|
|
6343
|
+
});
|
|
6344
|
+
continue;
|
|
6345
|
+
}
|
|
6346
|
+
if ("perNode" in field && field.perNode === true) continue;
|
|
6347
|
+
kept.push(field);
|
|
6348
|
+
}
|
|
6349
|
+
return kept;
|
|
6350
|
+
}
|
|
6233
6351
|
function collectPerNodeFieldKeys(fields) {
|
|
6234
6352
|
const collected = [];
|
|
6235
6353
|
for (const field of fields) {
|
|
@@ -9395,6 +9513,9 @@ method(object({
|
|
|
9395
9513
|
kind: "mutation",
|
|
9396
9514
|
auth: "admin"
|
|
9397
9515
|
}), method(object({
|
|
9516
|
+
addonId: string(),
|
|
9517
|
+
nodeId: string().optional()
|
|
9518
|
+
}), SettingsSchemaWithValuesSchema.nullable()), method(object({
|
|
9398
9519
|
addonId: string(),
|
|
9399
9520
|
deviceId: number(),
|
|
9400
9521
|
nodeId: string().optional()
|
|
@@ -27919,6 +28040,12 @@ Object.freeze({
|
|
|
27919
28040
|
addonId: null,
|
|
27920
28041
|
access: "view"
|
|
27921
28042
|
},
|
|
28043
|
+
"addonSettings.getIntegrationSettings": {
|
|
28044
|
+
capName: "addon-settings",
|
|
28045
|
+
capScope: "system",
|
|
28046
|
+
addonId: null,
|
|
28047
|
+
access: "view"
|
|
28048
|
+
},
|
|
27922
28049
|
"addonSettings.updateDeviceSettings": {
|
|
27923
28050
|
capName: "addon-settings",
|
|
27924
28051
|
capScope: "system",
|