@camstack/addon-post-analysis 1.2.28 → 1.2.30

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.
@@ -33,7 +33,7 @@ var e = {
33
33
  },
34
34
  "@camstack/ui-library": {
35
35
  name: "@camstack/ui-library",
36
- version: "1.2.19",
36
+ version: "1.2.22",
37
37
  scope: ["default"],
38
38
  loaded: !1,
39
39
  from: "addon_pipeline_analytics_widgets",
@@ -81,7 +81,7 @@ async function r() {
81
81
  }
82
82
  },
83
83
  "@camstack/ui-library": {
84
- version: "1.2.19",
84
+ version: "1.2.22",
85
85
  scope: "default",
86
86
  shareConfig: {
87
87
  singleton: !0,
@@ -632,17 +632,24 @@ var NC_ALARM_DEVICE_NAME = "Alarm";
632
632
  * does not belong in here.
633
633
  */
634
634
  async function ensureAlarmPanel(deps) {
635
- const integration = await deps.getIntegration(deps.addonId) ?? await deps.createIntegration({
635
+ const existingIntegration = await deps.getIntegration(deps.addonId);
636
+ if (existingIntegration !== null && !existingIntegration.fixed) {
637
+ await deps.markFixed(existingIntegration.id);
638
+ deps.logger.info("marked the notification-center integration as fixed", { meta: { integrationId: existingIntegration.id } });
639
+ }
640
+ const integration = existingIntegration ?? await deps.createIntegration({
636
641
  addonId: deps.addonId,
637
642
  name: deps.integrationName,
638
643
  info: { fixed: true }
639
644
  });
640
- const existingDevice = await deps.findDeviceByStableId(NC_ALARM_STABLE_ID);
641
- if (existingDevice !== null) return {
642
- integrationId: integration.id,
643
- deviceId: existingDevice.id,
644
- created: false
645
- };
645
+ if (await deps.findDeviceByStableId("nc-alarm-panel") !== null) {
646
+ const adopted = await deps.adoptDevice({ stableId: NC_ALARM_STABLE_ID });
647
+ return {
648
+ integrationId: integration.id,
649
+ deviceId: adopted.id,
650
+ created: false
651
+ };
652
+ }
646
653
  const device = await deps.createDevice({
647
654
  stableId: NC_ALARM_STABLE_ID,
648
655
  integrationId: integration.id,
@@ -22342,12 +22349,30 @@ var PipelineAnalyticsAddon = class extends require_dist.BaseAddon {
22342
22349
  */
22343
22350
  async ensureAlarmPanel(api) {
22344
22351
  const devices = this.ctx.kernel.devices;
22352
+ const nodeId = this.ctx.kernel.localNodeId;
22353
+ if (nodeId !== void 0 && nodeId !== "hub") {
22354
+ this.ctx.logger.debug("alarm panel is hub-owned — skipping on this node", { meta: { nodeId } });
22355
+ return;
22356
+ }
22345
22357
  try {
22346
22358
  const result = await ensureAlarmPanel({
22347
22359
  logger: this.ctx.logger.child("alarm"),
22348
22360
  addonId: PIPELINE_ANALYTICS_ADDON_ID,
22349
22361
  integrationName: NC_INTEGRATION_NAME,
22350
- getIntegration: async (addonId) => api.integrations.getByAddonId.query({ addonId }),
22362
+ getIntegration: async (addonId) => {
22363
+ const found = await api.integrations.getByAddonId.query({ addonId });
22364
+ return found === null ? null : {
22365
+ id: found.id,
22366
+ fixed: found.info?.["fixed"] === true
22367
+ };
22368
+ },
22369
+ markFixed: async (integrationId) => {
22370
+ await api.integrations.update.mutate({
22371
+ id: integrationId,
22372
+ info: { fixed: true },
22373
+ skipRestart: true
22374
+ });
22375
+ },
22351
22376
  createIntegration: async (input) => api.integrations.create.mutate(input),
22352
22377
  findDeviceByStableId: async (stableId) => {
22353
22378
  const found = (await api.deviceManager.listAll.query({ addonId: PIPELINE_ANALYTICS_ADDON_ID })).find((d) => d.stableId === stableId);
@@ -22359,6 +22384,9 @@ var PipelineAnalyticsAddon = class extends require_dist.BaseAddon {
22359
22384
  name,
22360
22385
  integrationId
22361
22386
  })).id };
22387
+ },
22388
+ adoptDevice: async ({ stableId }) => {
22389
+ return { id: (await devices.create(stableId, NC_ALARM_DEVICE_CLASS, {}, null, void 0)).id };
22362
22390
  }
22363
22391
  });
22364
22392
  if (result.created) this.ctx.logger.info("notification-center alarm panel ready", { tags: { deviceId: result.deviceId } });
@@ -626,17 +626,24 @@ var NC_ALARM_DEVICE_NAME = "Alarm";
626
626
  * does not belong in here.
627
627
  */
628
628
  async function ensureAlarmPanel(deps) {
629
- const integration = await deps.getIntegration(deps.addonId) ?? await deps.createIntegration({
629
+ const existingIntegration = await deps.getIntegration(deps.addonId);
630
+ if (existingIntegration !== null && !existingIntegration.fixed) {
631
+ await deps.markFixed(existingIntegration.id);
632
+ deps.logger.info("marked the notification-center integration as fixed", { meta: { integrationId: existingIntegration.id } });
633
+ }
634
+ const integration = existingIntegration ?? await deps.createIntegration({
630
635
  addonId: deps.addonId,
631
636
  name: deps.integrationName,
632
637
  info: { fixed: true }
633
638
  });
634
- const existingDevice = await deps.findDeviceByStableId(NC_ALARM_STABLE_ID);
635
- if (existingDevice !== null) return {
636
- integrationId: integration.id,
637
- deviceId: existingDevice.id,
638
- created: false
639
- };
639
+ if (await deps.findDeviceByStableId("nc-alarm-panel") !== null) {
640
+ const adopted = await deps.adoptDevice({ stableId: NC_ALARM_STABLE_ID });
641
+ return {
642
+ integrationId: integration.id,
643
+ deviceId: adopted.id,
644
+ created: false
645
+ };
646
+ }
640
647
  const device = await deps.createDevice({
641
648
  stableId: NC_ALARM_STABLE_ID,
642
649
  integrationId: integration.id,
@@ -22336,12 +22343,30 @@ var PipelineAnalyticsAddon = class extends BaseAddon {
22336
22343
  */
22337
22344
  async ensureAlarmPanel(api) {
22338
22345
  const devices = this.ctx.kernel.devices;
22346
+ const nodeId = this.ctx.kernel.localNodeId;
22347
+ if (nodeId !== void 0 && nodeId !== "hub") {
22348
+ this.ctx.logger.debug("alarm panel is hub-owned — skipping on this node", { meta: { nodeId } });
22349
+ return;
22350
+ }
22339
22351
  try {
22340
22352
  const result = await ensureAlarmPanel({
22341
22353
  logger: this.ctx.logger.child("alarm"),
22342
22354
  addonId: PIPELINE_ANALYTICS_ADDON_ID,
22343
22355
  integrationName: NC_INTEGRATION_NAME,
22344
- getIntegration: async (addonId) => api.integrations.getByAddonId.query({ addonId }),
22356
+ getIntegration: async (addonId) => {
22357
+ const found = await api.integrations.getByAddonId.query({ addonId });
22358
+ return found === null ? null : {
22359
+ id: found.id,
22360
+ fixed: found.info?.["fixed"] === true
22361
+ };
22362
+ },
22363
+ markFixed: async (integrationId) => {
22364
+ await api.integrations.update.mutate({
22365
+ id: integrationId,
22366
+ info: { fixed: true },
22367
+ skipRestart: true
22368
+ });
22369
+ },
22345
22370
  createIntegration: async (input) => api.integrations.create.mutate(input),
22346
22371
  findDeviceByStableId: async (stableId) => {
22347
22372
  const found = (await api.deviceManager.listAll.query({ addonId: PIPELINE_ANALYTICS_ADDON_ID })).find((d) => d.stableId === stableId);
@@ -22353,6 +22378,9 @@ var PipelineAnalyticsAddon = class extends BaseAddon {
22353
22378
  name,
22354
22379
  integrationId
22355
22380
  })).id };
22381
+ },
22382
+ adoptDevice: async ({ stableId }) => {
22383
+ return { id: (await devices.create(stableId, NC_ALARM_DEVICE_CLASS, {}, null, void 0)).id };
22356
22384
  }
22357
22385
  });
22358
22386
  if (result.created) this.ctx.logger.info("notification-center alarm panel ready", { tags: { deviceId: result.deviceId } });
@@ -30,7 +30,7 @@ async function d(e) {
30
30
  }
31
31
  }
32
32
  async function f() {
33
- return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-B7qyOMi9.mjs")).catch((e) => {
33
+ return l ||= d(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-BKtsO4q2.mjs")).catch((e) => {
34
34
  throw l = void 0, e;
35
35
  }), l;
36
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-post-analysis",
3
- "version": "1.2.28",
3
+ "version": "1.2.30",
4
4
  "description": "Post-Analysis bundle — enrichment, embedding-encoder, pipeline-analytics. Multi-entry npm package shipping addons that consume pipeline output.",
5
5
  "keywords": [
6
6
  "camstack",