@yoooclaw/phone-notifications 1.10.0 → 1.10.1

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.cjs CHANGED
@@ -5409,7 +5409,7 @@ function readBuildInjectedVersion() {
5409
5409
  if (false) {
5410
5410
  return void 0;
5411
5411
  }
5412
- const version = "1.10.0".trim();
5412
+ const version = "1.10.1".trim();
5413
5413
  return version || void 0;
5414
5414
  }
5415
5415
  function readPluginVersionFromPackageJson() {
@@ -12011,8 +12011,13 @@ function registerNotificationInterfaces(deps) {
12011
12011
  filterNotifications,
12012
12012
  registerGatewayMethod,
12013
12013
  tunnelService,
12014
- onAfterIngest
12014
+ onAfterIngest,
12015
+ getCronForHttpIngest
12015
12016
  } = deps;
12017
+ function triggerAfterIngest(insertedCount, cron) {
12018
+ if (insertedCount <= 0 || !onAfterIngest || !cron) return;
12019
+ void Promise.resolve().then(() => onAfterIngest(insertedCount, cron)).catch((err) => logger.warn(`onAfterIngest failed: ${err?.message ?? err}`));
12020
+ }
12016
12021
  registerGatewayMethod(
12017
12022
  "notifications.push",
12018
12023
  async ({ params, respond, context }) => {
@@ -12035,9 +12040,7 @@ function registerNotificationInterfaces(deps) {
12035
12040
  const filtered = filterNotifications(items);
12036
12041
  const result = filtered.length ? await storage.ingest(filtered) : createEmptyIngestResult();
12037
12042
  respond(true, toIngestResponse(result));
12038
- if (result.inserted.length > 0 && onAfterIngest && context?.cron) {
12039
- void Promise.resolve().then(() => onAfterIngest(result.inserted.length, context.cron)).catch((err) => logger.warn(`onAfterIngest failed: ${err?.message ?? err}`));
12040
- }
12043
+ triggerAfterIngest(result.inserted.length, context?.cron);
12041
12044
  }
12042
12045
  );
12043
12046
  api.registerHttpRoute({
@@ -12081,6 +12084,7 @@ function registerNotificationInterfaces(deps) {
12081
12084
  const result = filtered.length ? await storage.ingest(filtered) : createEmptyIngestResult();
12082
12085
  res.writeHead(200, { "Content-Type": "application/json" });
12083
12086
  res.end(JSON.stringify({ ok: true, ...toIngestResponse(result) }));
12087
+ triggerAfterIngest(result.inserted.length, getCronForHttpIngest?.());
12084
12088
  }
12085
12089
  });
12086
12090
  logger.info("Gateway \u901A\u77E5\u65B9\u6CD5\u5DF2\u6CE8\u518C: notifications.push");
@@ -12551,6 +12555,7 @@ var index_default = {
12551
12555
  let storage = null;
12552
12556
  let recordingStorage = null;
12553
12557
  let broadcastFn = null;
12558
+ let cronService = null;
12554
12559
  let autoUpdateLifecycle = null;
12555
12560
  const openclawDir = api.runtime.state.resolveStateDir();
12556
12561
  const logger = openclawDir ? new PluginFileLogger(api.logger, openclawDir) : createVersionAwareLogger(api.logger);
@@ -12581,6 +12586,9 @@ var index_default = {
12581
12586
  function registerGatewayMethodWithBroadcastCapture(method, handler) {
12582
12587
  api.registerGatewayMethod(method, (opts) => {
12583
12588
  cacheBroadcast(opts.context?.broadcast);
12589
+ if (opts.context?.cron) {
12590
+ cronService = opts.context.cron;
12591
+ }
12584
12592
  return handler(opts);
12585
12593
  });
12586
12594
  }
@@ -12629,7 +12637,8 @@ var index_default = {
12629
12637
  tunnelService,
12630
12638
  onAfterIngest: (insertedCount, cron) => {
12631
12639
  void lightRulesEvaluatorJob.triggerIfNeeded(cron, insertedCount);
12632
- }
12640
+ },
12641
+ getCronForHttpIngest: () => cronService
12633
12642
  });
12634
12643
  registerLightControlTool(api, logger);
12635
12644
  registerRecordingInterfaces({