@camstack/server 1.2.932 → 1.2.933
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/api/trpc/generated-cap-routers.js +20 -0
- package/package.json +7 -7
- package/system/dist/addon-utils.mjs +1 -1
- package/system/dist/{base-device-IuM1AwXZ.mjs → base-device-Bwiblqmn.mjs} +1 -1
- package/system/dist/{base-device-2sL1DMm1.js → base-device-C1z4zYGR.js} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +3 -3
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +4 -4
- package/system/dist/builtins/alerts/alerts.addon.js +2 -2
- package/system/dist/builtins/alerts/alerts.addon.mjs +4 -4
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +4 -4
- package/system/dist/builtins/camera-grid/index.js +2 -2
- package/system/dist/builtins/camera-grid/index.mjs +2 -2
- package/system/dist/builtins/composer/composer.addon.js +5 -5
- package/system/dist/builtins/composer/composer.addon.mjs +5 -5
- package/system/dist/builtins/core-blocks/cap-links.d.ts +34 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +4 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +282 -8
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +282 -8
- package/system/dist/builtins/device-manager/device-manager.addon.js +18 -4
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +18 -4
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +3 -3
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +9 -9
- package/system/dist/builtins/platform-probe/index.mjs +9 -9
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +19 -19
- package/system/dist/builtins/system-config/system-config.addon.mjs +113 -113
- package/system/dist/{composition-sources-BEUWn2s_.mjs → composition-sources-B0QW4g86.mjs} +2 -2
- package/system/dist/{composition-sources-acfR4hDq.js → composition-sources-BtUx1MfU.js} +2 -2
- package/system/dist/{coral-accelerators-zTMTEd-8.mjs → coral-accelerators-BKcXP59c.mjs} +6 -6
- package/system/dist/{core-blocks.cap-BRPsLAij.mjs → core-blocks.cap-CnwBuf7E.mjs} +1524 -1267
- package/system/dist/{core-blocks.cap-BMeMCBrx.js → core-blocks.cap-DlEuHq-S.js} +1555 -1268
- package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
- package/system/dist/{error.cap-CSM_SRfR.mjs → error.cap-5zNPAgU2.mjs} +19 -2
- package/system/dist/{error.cap-DBhgPeWK.js → error.cap-BCqzFlo2.js} +24 -1
- package/system/dist/{hub-identity-_IOgPJ00.mjs → hub-identity-DjMN9Ac2.mjs} +9 -9
- package/system/dist/{hub-mdns-ciao-Dk7ts_Uk.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +1 -1
- package/system/dist/index.js +2 -2
- package/system/dist/index.mjs +214 -214
- package/system/dist/{prefix-walk-ifwg_ukx.mjs → prefix-walk-CRnbYJcC.mjs} +2 -2
- package/system/dist/{prefix-walk-BkMxoXpL.js → prefix-walk-DD1BM923.js} +2 -2
- package/system/dist/{rename-composition-block-BJsL58Ih.js → rename-composition-block-BRgyBO25.js} +20 -2
- package/system/dist/{rename-composition-block-OAtErZgq.mjs → rename-composition-block-BYRBlx-V.mjs} +20 -2
- package/system/dist/{restore-archive-kSFNjkWY.mjs → restore-archive-CjAyKpgX.mjs} +93 -93
- package/system/package.json +1 -1
|
@@ -3,7 +3,7 @@ const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
|
3
3
|
const require_stream_catalog_cap = require("../../stream-catalog.cap-D3uwePiA.js");
|
|
4
4
|
const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
|
|
5
5
|
const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
6
|
-
const require_rename_composition_block = require("../../rename-composition-block-
|
|
6
|
+
const require_rename_composition_block = require("../../rename-composition-block-BRgyBO25.js");
|
|
7
7
|
const require_notification_targets = require("../../notification-targets-CRH-9Dy5.js");
|
|
8
8
|
const require_notification_rules_cap = require("../../notification-rules.cap-BDh0LDhV.js");
|
|
9
9
|
const require_record_kind = require("../../record-kind-DoBfYHCs.js");
|
|
@@ -14,13 +14,13 @@ const require_quantity = require("../../quantity-lY1KiTSZ.js");
|
|
|
14
14
|
const require_tag = require("../../tag-BxLazvVb.js");
|
|
15
15
|
const require_device_type = require("../../device-type-CbQsnFdC.js");
|
|
16
16
|
const require_device_kind = require("../../device-kind-CsSiv_YF.js");
|
|
17
|
-
const require_core_blocks_cap = require("../../core-blocks.cap-
|
|
18
|
-
const require_error_cap = require("../../error.cap-
|
|
19
|
-
const require_prefix_walk = require("../../prefix-walk-
|
|
17
|
+
const require_core_blocks_cap = require("../../core-blocks.cap-DlEuHq-S.js");
|
|
18
|
+
const require_error_cap = require("../../error.cap-BCqzFlo2.js");
|
|
19
|
+
const require_prefix_walk = require("../../prefix-walk-DD1BM923.js");
|
|
20
20
|
const require_l10n = require("../../l10n-CGMvp7NF.js");
|
|
21
21
|
const require_integration_instances_cap = require("../../integration-instances.cap-dJIxg2_s.js");
|
|
22
22
|
const require_cap_call_context = require("../../cap-call-context-Bd76CbOW.js");
|
|
23
|
-
const require_composition_sources = require("../../composition-sources-
|
|
23
|
+
const require_composition_sources = require("../../composition-sources-BtUx1MfU.js");
|
|
24
24
|
const require_declared_device = require("../../declared-device-BWphj9WE.js");
|
|
25
25
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
26
26
|
const require_capture_engine = require("../../capture-engine-DZ0LIUqA.js");
|
|
@@ -14752,6 +14752,233 @@ var RemoteComponentsService = class {
|
|
|
14752
14752
|
}
|
|
14753
14753
|
};
|
|
14754
14754
|
//#endregion
|
|
14755
|
+
//#region src/builtins/core-blocks/cap-links.ts
|
|
14756
|
+
/**
|
|
14757
|
+
* Whole-capability links at runtime (D1076): the read behind `getCapLinks` and
|
|
14758
|
+
* the one-off conversion behind `migrateCapLinks`.
|
|
14759
|
+
*
|
|
14760
|
+
* The compile path is not here: a `capLink` is expanded by `planComposition`
|
|
14761
|
+
* into the field claims the composer already runs. This file only READS the
|
|
14762
|
+
* stored links (state per link, `not-loaded` until the compositions were read,
|
|
14763
|
+
* D315) and REWRITES plain per-field links into one link (bounded, idempotent,
|
|
14764
|
+
* D345).
|
|
14765
|
+
*/
|
|
14766
|
+
function hostBlock(blocks, host) {
|
|
14767
|
+
const key = require_error_cap.compositionSourceKey(host);
|
|
14768
|
+
return blocks.find((block) => {
|
|
14769
|
+
const target = require_core_blocks_cap.coreBlockComposition(block)?.target;
|
|
14770
|
+
return target?.kind === "existing" && require_error_cap.compositionSourceKey(target.device) === key;
|
|
14771
|
+
}) ?? null;
|
|
14772
|
+
}
|
|
14773
|
+
function capLinkFeatures(composition) {
|
|
14774
|
+
return (composition?.features ?? []).flatMap((feature) => feature.kind === "capLink" ? [feature] : []);
|
|
14775
|
+
}
|
|
14776
|
+
var CapLinksService = class {
|
|
14777
|
+
ports;
|
|
14778
|
+
/** `host:cap:link` keys whose source-gone was already logged: one line per loss, not per read. */
|
|
14779
|
+
goneLogged = /* @__PURE__ */ new Set();
|
|
14780
|
+
constructor(ports) {
|
|
14781
|
+
this.ports = ports;
|
|
14782
|
+
}
|
|
14783
|
+
async read(deviceId) {
|
|
14784
|
+
const blocks = this.ports.blocks();
|
|
14785
|
+
if (blocks === null) return { status: "not-loaded" };
|
|
14786
|
+
const host = await this.ports.refOfDevice(deviceId);
|
|
14787
|
+
if (host === null) return {
|
|
14788
|
+
status: "ok",
|
|
14789
|
+
links: []
|
|
14790
|
+
};
|
|
14791
|
+
const block = hostBlock(blocks, host);
|
|
14792
|
+
const features = capLinkFeatures(block === null ? null : require_core_blocks_cap.coreBlockComposition(block));
|
|
14793
|
+
const links = [];
|
|
14794
|
+
for (const feature of features) {
|
|
14795
|
+
const declared = require_core_blocks_cap.declaredCapLink(feature.cap, feature.linkId);
|
|
14796
|
+
if (declared === void 0) continue;
|
|
14797
|
+
const sourceId = await this.ports.deviceIdOf(feature.source);
|
|
14798
|
+
const gone = sourceId === null;
|
|
14799
|
+
const state = !require_error_cap.compositionFeatureEnabled(feature) ? "disabled" : gone ? "source-gone" : "linked";
|
|
14800
|
+
if (state === "source-gone") this.logGone(deviceId, feature);
|
|
14801
|
+
else this.goneLogged.delete(goneKey(deviceId, feature));
|
|
14802
|
+
links.push({
|
|
14803
|
+
linkId: feature.linkId,
|
|
14804
|
+
cap: feature.cap,
|
|
14805
|
+
slot: declared.slot ?? null,
|
|
14806
|
+
mode: declared.mode,
|
|
14807
|
+
source: {
|
|
14808
|
+
deviceId: sourceId,
|
|
14809
|
+
cap: declared.sourceCap
|
|
14810
|
+
},
|
|
14811
|
+
state
|
|
14812
|
+
});
|
|
14813
|
+
}
|
|
14814
|
+
return {
|
|
14815
|
+
status: "ok",
|
|
14816
|
+
links
|
|
14817
|
+
};
|
|
14818
|
+
}
|
|
14819
|
+
logGone(deviceId, feature) {
|
|
14820
|
+
const key = goneKey(deviceId, feature);
|
|
14821
|
+
if (this.goneLogged.has(key)) return;
|
|
14822
|
+
this.goneLogged.add(key);
|
|
14823
|
+
this.ports.logger.warn("cap link: the source device is gone — the linked cap reads unknown", {
|
|
14824
|
+
tags: { deviceId },
|
|
14825
|
+
meta: {
|
|
14826
|
+
cap: feature.cap,
|
|
14827
|
+
linkId: feature.linkId,
|
|
14828
|
+
source: feature.source
|
|
14829
|
+
}
|
|
14830
|
+
});
|
|
14831
|
+
}
|
|
14832
|
+
async migrate(dryRun) {
|
|
14833
|
+
const blocks = this.ports.blocks();
|
|
14834
|
+
if (blocks === null) throw new Error("core-blocks: the compositions have not loaded yet — migrateCapLinks refused");
|
|
14835
|
+
const report = {
|
|
14836
|
+
dryRun,
|
|
14837
|
+
converted: [],
|
|
14838
|
+
mixed: [],
|
|
14839
|
+
skipped: 0,
|
|
14840
|
+
alreadyLinked: 0
|
|
14841
|
+
};
|
|
14842
|
+
for (const block of blocks) {
|
|
14843
|
+
const composition = require_core_blocks_cap.coreBlockComposition(block);
|
|
14844
|
+
if (composition === null || composition.target.kind !== "existing") continue;
|
|
14845
|
+
const deviceId = await this.ports.deviceIdOf(composition.target.device);
|
|
14846
|
+
if (deviceId === null) {
|
|
14847
|
+
this.ports.logger.warn("cap link migration: host device not found — customization left as is", { meta: { blockId: block.id } });
|
|
14848
|
+
continue;
|
|
14849
|
+
}
|
|
14850
|
+
await this.migrateBlock(block, composition, deviceId, dryRun, report);
|
|
14851
|
+
}
|
|
14852
|
+
return report;
|
|
14853
|
+
}
|
|
14854
|
+
async migrateBlock(stored, composition, deviceId, dryRun, report) {
|
|
14855
|
+
const caps = [...new Set(composition.features.flatMap((f) => f.kind === "fields" || f.kind === "capLink" ? [f.cap] : []))];
|
|
14856
|
+
let block = stored;
|
|
14857
|
+
let next = composition;
|
|
14858
|
+
for (const cap of caps) {
|
|
14859
|
+
const link = require_core_blocks_cap.projectCapLinkOf(cap);
|
|
14860
|
+
if (link === void 0) continue;
|
|
14861
|
+
if (capLinkFeatures(next).some((f) => f.cap === cap)) {
|
|
14862
|
+
report.alreadyLinked += 1;
|
|
14863
|
+
continue;
|
|
14864
|
+
}
|
|
14865
|
+
const plain = next.features.filter((f) => f.kind === "fields" && f.cap === cap);
|
|
14866
|
+
const candidates = plain.filter((f) => f.contributedBy === void 0 && require_error_cap.compositionFeatureEnabled(f));
|
|
14867
|
+
report.skipped += plain.length - candidates.length;
|
|
14868
|
+
if (candidates.length === 0) continue;
|
|
14869
|
+
const verdict = identityGroup(candidates, link.sourceCap, link.map);
|
|
14870
|
+
const hostFields = this.ports.hostFieldsOf(cap);
|
|
14871
|
+
const reasons = "reasons" in verdict ? verdict.reasons : hostFields === null ? [`the capability ${cap} is unknown here`] : widening(require_core_blocks_cap.capLinkServedFields(link, hostFields), verdict.fields, next, candidates);
|
|
14872
|
+
if ("reasons" in verdict || reasons.length > 0) {
|
|
14873
|
+
report.mixed.push({
|
|
14874
|
+
deviceId,
|
|
14875
|
+
cap,
|
|
14876
|
+
reasons
|
|
14877
|
+
});
|
|
14878
|
+
continue;
|
|
14879
|
+
}
|
|
14880
|
+
if ("reasons" in verdict) continue;
|
|
14881
|
+
const feature = {
|
|
14882
|
+
kind: "capLink",
|
|
14883
|
+
cap,
|
|
14884
|
+
linkId: link.id,
|
|
14885
|
+
source: verdict.source
|
|
14886
|
+
};
|
|
14887
|
+
const replaced = new Set(candidates);
|
|
14888
|
+
const kept = next.features.filter((f) => !replaced.has(f));
|
|
14889
|
+
const candidate = {
|
|
14890
|
+
...next,
|
|
14891
|
+
features: kept.concat(feature)
|
|
14892
|
+
};
|
|
14893
|
+
const converted = {
|
|
14894
|
+
deviceId,
|
|
14895
|
+
cap,
|
|
14896
|
+
linkId: link.id,
|
|
14897
|
+
source: verdict.source,
|
|
14898
|
+
fields: verdict.fields
|
|
14899
|
+
};
|
|
14900
|
+
if (!dryRun) try {
|
|
14901
|
+
block = await this.ports.rewrite(block, candidate);
|
|
14902
|
+
} catch (err) {
|
|
14903
|
+
report.mixed.push({
|
|
14904
|
+
deviceId,
|
|
14905
|
+
cap,
|
|
14906
|
+
reasons: [`the link was refused: ${require_scoped_settings.errMsg(err)}`]
|
|
14907
|
+
});
|
|
14908
|
+
this.ports.logger.warn("cap link migration: conversion refused — left as it was", {
|
|
14909
|
+
tags: { deviceId },
|
|
14910
|
+
meta: {
|
|
14911
|
+
cap,
|
|
14912
|
+
error: require_scoped_settings.errMsg(err)
|
|
14913
|
+
}
|
|
14914
|
+
});
|
|
14915
|
+
continue;
|
|
14916
|
+
}
|
|
14917
|
+
next = candidate;
|
|
14918
|
+
report.converted.push(converted);
|
|
14919
|
+
}
|
|
14920
|
+
}
|
|
14921
|
+
};
|
|
14922
|
+
/**
|
|
14923
|
+
* Why converting would change what the device claims. The link serves EVERY host
|
|
14924
|
+
* field of the cap (and the clock as `now`): a set that covers fewer would newly
|
|
14925
|
+
* take the rest from the source, and an enabled feature another writer left on
|
|
14926
|
+
* the cap would overlap the link. The operator decides per device.
|
|
14927
|
+
*/
|
|
14928
|
+
function widening(served, carried, next, candidates) {
|
|
14929
|
+
const reasons = [];
|
|
14930
|
+
const missing = served.filter((path) => !carried.includes(path));
|
|
14931
|
+
if (missing.length > 0) reasons.push(`partial-set: would also take ${missing.join(", ")}`);
|
|
14932
|
+
const taken = new Set(candidates);
|
|
14933
|
+
for (const other of next.features) {
|
|
14934
|
+
if (other.kind !== "fields" || taken.has(other) || !require_error_cap.compositionFeatureEnabled(other)) continue;
|
|
14935
|
+
const clash = Object.keys(other.fields).filter((path) => served.includes(path));
|
|
14936
|
+
if (clash.length > 0) {
|
|
14937
|
+
const by = other.contributedBy === void 0 ? "another feature" : `the device link ${other.contributedBy.linkId}`;
|
|
14938
|
+
reasons.push(`overlap: ${by} also writes ${clash.join(", ")}, which the link would serve`);
|
|
14939
|
+
}
|
|
14940
|
+
}
|
|
14941
|
+
return reasons;
|
|
14942
|
+
}
|
|
14943
|
+
function goneKey(deviceId, feature) {
|
|
14944
|
+
return `${deviceId}:${feature.cap}:${feature.linkId}`;
|
|
14945
|
+
}
|
|
14946
|
+
/**
|
|
14947
|
+
* The features are ONE link when every field is a plain read of the SAME source
|
|
14948
|
+
* device's `sourceCap`, at the path the link maps it to (the same path without a
|
|
14949
|
+
* map), plus the `now` clock. Anything else is named, per field.
|
|
14950
|
+
*/
|
|
14951
|
+
function identityGroup(features, sourceCap, map) {
|
|
14952
|
+
const reasons = [];
|
|
14953
|
+
const sources = /* @__PURE__ */ new Map();
|
|
14954
|
+
const fields = [];
|
|
14955
|
+
for (const feature of features) {
|
|
14956
|
+
for (const [path, value] of Object.entries(feature.fields)) {
|
|
14957
|
+
fields.push(path);
|
|
14958
|
+
if (value.kind === "expression" && value.expr === "now" && path === "lastFetchedAt") continue;
|
|
14959
|
+
if (path === "lastFetchedAt") {
|
|
14960
|
+
reasons.push("lastFetchedAt: reads the source clock, the link writes now");
|
|
14961
|
+
continue;
|
|
14962
|
+
}
|
|
14963
|
+
if (value.kind !== "from") {
|
|
14964
|
+
reasons.push(`${path}: a ${value.kind} source`);
|
|
14965
|
+
continue;
|
|
14966
|
+
}
|
|
14967
|
+
if (value.cap !== sourceCap) reasons.push(`${path}: reads ${value.cap}, not ${sourceCap}`);
|
|
14968
|
+
else if (value.fieldPath !== (map?.[path] ?? path)) reasons.push(`${path}: reads ${value.fieldPath}, not the same path`);
|
|
14969
|
+
sources.set(require_error_cap.compositionSourceKey(value.source), value.source);
|
|
14970
|
+
}
|
|
14971
|
+
for (const extra of ["items", "commands"]) if (feature[extra] !== void 0) reasons.push(`the feature carries ${extra}`);
|
|
14972
|
+
}
|
|
14973
|
+
const [first] = [...sources.values()];
|
|
14974
|
+
if (sources.size > 1) reasons.push(`${sources.size} different source devices`);
|
|
14975
|
+
if (first === void 0 && reasons.length === 0) reasons.push("no source device");
|
|
14976
|
+
return reasons.length > 0 || first === void 0 ? { reasons } : {
|
|
14977
|
+
source: first,
|
|
14978
|
+
fields
|
|
14979
|
+
};
|
|
14980
|
+
}
|
|
14981
|
+
//#endregion
|
|
14755
14982
|
//#region src/builtins/core-blocks/hero-layout-service.ts
|
|
14756
14983
|
/**
|
|
14757
14984
|
* The `hero-layout` provider of core-blocks (D1023): serves the FIXED layouts
|
|
@@ -17292,7 +17519,8 @@ function replacedOf(stored, description, lookupCap) {
|
|
|
17292
17519
|
return require_core_blocks_cap.replacedFieldKeys(require_core_blocks_cap.planComposition(stored.composition, lookupCap, description));
|
|
17293
17520
|
}
|
|
17294
17521
|
function peerOf(stored, targets, lookupCap, candidateBlockId) {
|
|
17295
|
-
const { blockId
|
|
17522
|
+
const { blockId } = stored;
|
|
17523
|
+
const composition = require_core_blocks_cap.expandCapLinks(stored.composition, (cap) => require_core_blocks_cap.topLevelFieldsOf(cap, lookupCap));
|
|
17296
17524
|
if (composition.target.kind === "new") return {
|
|
17297
17525
|
peer: {
|
|
17298
17526
|
blockId,
|
|
@@ -17303,7 +17531,10 @@ function peerOf(stored, targets, lookupCap, candidateBlockId) {
|
|
|
17303
17531
|
};
|
|
17304
17532
|
const device = composition.target.device;
|
|
17305
17533
|
const key = require_error_cap.compositionSourceKey(device);
|
|
17306
|
-
const replaced = replacedOf(
|
|
17534
|
+
const replaced = replacedOf({
|
|
17535
|
+
blockId,
|
|
17536
|
+
composition
|
|
17537
|
+
}, targets.get(key), lookupCap);
|
|
17307
17538
|
if (!("error" in replaced)) return {
|
|
17308
17539
|
peer: {
|
|
17309
17540
|
blockId,
|
|
@@ -19538,8 +19769,51 @@ var CoreBlocksAddon = class extends require_base_addon.BaseAddon {
|
|
|
19538
19769
|
})) };
|
|
19539
19770
|
},
|
|
19540
19771
|
...this.requireActions().runsApi,
|
|
19541
|
-
...this.sharedCompositionApi()
|
|
19772
|
+
...this.sharedCompositionApi(),
|
|
19773
|
+
getCapLinks: async ({ deviceId }) => this.sharedCapLinks().read(deviceId),
|
|
19774
|
+
migrateCapLinks: async ({ dryRun }) => this.sharedCapLinks().migrate(dryRun)
|
|
19775
|
+
};
|
|
19776
|
+
}
|
|
19777
|
+
capLinks = null;
|
|
19778
|
+
/** Whole-capability links (D1076): the read and the one-off migration, over `ctx.api`. */
|
|
19779
|
+
sharedCapLinks() {
|
|
19780
|
+
this.capLinks ??= this.buildCapLinks();
|
|
19781
|
+
return this.capLinks;
|
|
19782
|
+
}
|
|
19783
|
+
buildCapLinks() {
|
|
19784
|
+
const requireApi = () => {
|
|
19785
|
+
const api = this.ctx.api;
|
|
19786
|
+
if (!api) throw new Error("core-blocks: no ctx.api on this node — cap links cannot be read");
|
|
19787
|
+
return api;
|
|
19542
19788
|
};
|
|
19789
|
+
const store = this.requireStore();
|
|
19790
|
+
const compositions = this.sharedCompositionApi();
|
|
19791
|
+
const lookupCap = require_core_blocks_cap.buildCapabilityLookup(require_rename_composition_block.ALL_CAPABILITY_DEFINITIONS);
|
|
19792
|
+
return new CapLinksService({
|
|
19793
|
+
blocks: () => store.isLoaded() ? store.list() : null,
|
|
19794
|
+
refOfDevice: async (deviceId) => {
|
|
19795
|
+
const found = await requireApi().deviceManager.getDevice.query({ deviceId });
|
|
19796
|
+
return found === null ? null : {
|
|
19797
|
+
addonId: found.addonId,
|
|
19798
|
+
stableId: found.stableId
|
|
19799
|
+
};
|
|
19800
|
+
},
|
|
19801
|
+
deviceIdOf: (ref) => this.deviceIdOfRef(ref),
|
|
19802
|
+
hostFieldsOf: (cap) => require_core_blocks_cap.topLevelFieldsOf(cap, lookupCap),
|
|
19803
|
+
rewrite: async (block, composition) => {
|
|
19804
|
+
const { block: updated } = await compositions.updateComposition({
|
|
19805
|
+
blockId: block.id,
|
|
19806
|
+
expectedUpdatedAt: block.updatedAt,
|
|
19807
|
+
block: { composition },
|
|
19808
|
+
caller: {
|
|
19809
|
+
userId: "cap-links-migration",
|
|
19810
|
+
isAdmin: true
|
|
19811
|
+
}
|
|
19812
|
+
});
|
|
19813
|
+
return updated;
|
|
19814
|
+
},
|
|
19815
|
+
logger: this.ctx.logger.child("cap-links")
|
|
19816
|
+
});
|
|
19543
19817
|
}
|
|
19544
19818
|
sharedCompositionApi() {
|
|
19545
19819
|
this.compositionApi ??= this.buildCompositionApi();
|