@chipmobilesdk/rn-notification 0.6.0 → 0.7.0
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 +111 -0
- package/README.md +8 -6
- package/lib/commonjs/advanced.js +139 -0
- package/lib/commonjs/advanced.js.map +1 -0
- package/lib/commonjs/channel/migrate.js +246 -0
- package/lib/commonjs/channel/migrate.js.map +1 -0
- package/lib/commonjs/channel/tone-map.js +120 -0
- package/lib/commonjs/channel/tone-map.js.map +1 -0
- package/lib/commonjs/channel/validate-tone.js +61 -0
- package/lib/commonjs/channel/validate-tone.js.map +1 -0
- package/lib/commonjs/contract/channel.js +52 -0
- package/lib/commonjs/contract/channel.js.map +1 -0
- package/lib/commonjs/contract/diagnostics.js +25 -0
- package/lib/commonjs/contract/diagnostics.js.map +1 -0
- package/lib/commonjs/contract/errors.js +126 -0
- package/lib/commonjs/contract/errors.js.map +1 -0
- package/lib/commonjs/contract/hash.js +35 -0
- package/lib/commonjs/contract/hash.js.map +1 -0
- package/lib/commonjs/contract/index.js +94 -0
- package/lib/commonjs/contract/index.js.map +1 -0
- package/lib/commonjs/contract/interaction.js +37 -0
- package/lib/commonjs/contract/interaction.js.map +1 -0
- package/lib/commonjs/contract/notification.js +42 -0
- package/lib/commonjs/contract/notification.js.map +1 -0
- package/lib/commonjs/contract/permission.js +2 -0
- package/lib/commonjs/contract/permission.js.map +1 -0
- package/lib/commonjs/contract/reconcile.js +6 -0
- package/lib/commonjs/contract/reconcile.js.map +1 -0
- package/lib/commonjs/contract/recurrence.js +53 -0
- package/lib/commonjs/contract/recurrence.js.map +1 -0
- package/lib/commonjs/diagnostics/burst.js +89 -0
- package/lib/commonjs/diagnostics/burst.js.map +1 -0
- package/lib/commonjs/diagnostics/events.js +63 -0
- package/lib/commonjs/diagnostics/events.js.map +1 -0
- package/lib/commonjs/diagnostics/redact.js +48 -0
- package/lib/commonjs/diagnostics/redact.js.map +1 -0
- package/lib/commonjs/diagnostics/snapshot.js +68 -0
- package/lib/commonjs/diagnostics/snapshot.js.map +1 -0
- package/lib/commonjs/engine/adapter.js +6 -0
- package/lib/commonjs/engine/adapter.js.map +1 -0
- package/lib/commonjs/engine/codec.js +84 -0
- package/lib/commonjs/engine/codec.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/events.js +148 -0
- package/lib/commonjs/engine/notify-kit/events.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/module.js +119 -0
- package/lib/commonjs/engine/notify-kit/module.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/android.js +159 -0
- package/lib/commonjs/engine/notify-kit/platform/android.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/index.js +57 -0
- package/lib/commonjs/engine/notify-kit/platform/index.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/ios.js +54 -0
- package/lib/commonjs/engine/notify-kit/platform/ios.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/types.js +6 -0
- package/lib/commonjs/engine/notify-kit/platform/types.js.map +1 -0
- package/lib/commonjs/engine/notify-kit-engine.js +260 -0
- package/lib/commonjs/engine/notify-kit-engine.js.map +1 -0
- package/lib/commonjs/index.js +367 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/initialize.js +187 -0
- package/lib/commonjs/initialize.js.map +1 -0
- package/lib/commonjs/interaction/index.js +120 -0
- package/lib/commonjs/interaction/index.js.map +1 -0
- package/lib/commonjs/maintenance/cycle.js +108 -0
- package/lib/commonjs/maintenance/cycle.js.map +1 -0
- package/lib/commonjs/maintenance/permission-refresh.js +39 -0
- package/lib/commonjs/maintenance/permission-refresh.js.map +1 -0
- package/lib/commonjs/maintenance/reanchor.js +99 -0
- package/lib/commonjs/maintenance/reanchor.js.map +1 -0
- package/lib/commonjs/maintenance/toggle.js +50 -0
- package/lib/commonjs/maintenance/toggle.js.map +1 -0
- package/lib/commonjs/maintenance/verify.js +70 -0
- package/lib/commonjs/maintenance/verify.js.map +1 -0
- package/lib/commonjs/maintenance/window-refresh.js +53 -0
- package/lib/commonjs/maintenance/window-refresh.js.map +1 -0
- package/lib/commonjs/notifications.js +161 -0
- package/lib/commonjs/notifications.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/permission/index.js +182 -0
- package/lib/commonjs/permission/index.js.map +1 -0
- package/lib/commonjs/permission/state.js +92 -0
- package/lib/commonjs/permission/state.js.map +1 -0
- package/lib/commonjs/push/envelope.js +141 -0
- package/lib/commonjs/push/envelope.js.map +1 -0
- package/lib/commonjs/push/fcm-provider.js +122 -0
- package/lib/commonjs/push/fcm-provider.js.map +1 -0
- package/lib/commonjs/push/gate.js +162 -0
- package/lib/commonjs/push/gate.js.map +1 -0
- package/lib/commonjs/push/index.js +47 -0
- package/lib/commonjs/push/index.js.map +1 -0
- package/lib/commonjs/push/instructions.js +101 -0
- package/lib/commonjs/push/instructions.js.map +1 -0
- package/lib/commonjs/push/provider-adapter.js +6 -0
- package/lib/commonjs/push/provider-adapter.js.map +1 -0
- package/lib/commonjs/push/signout.js +55 -0
- package/lib/commonjs/push/signout.js.map +1 -0
- package/lib/commonjs/reconcile/chunk.js +49 -0
- package/lib/commonjs/reconcile/chunk.js.map +1 -0
- package/lib/commonjs/reconcile/diff.js +105 -0
- package/lib/commonjs/reconcile/diff.js.map +1 -0
- package/lib/commonjs/reconcile/duplicates.js +60 -0
- package/lib/commonjs/reconcile/duplicates.js.map +1 -0
- package/lib/commonjs/reconcile/index.js +164 -0
- package/lib/commonjs/reconcile/index.js.map +1 -0
- package/lib/commonjs/reconcile/truncate.js +50 -0
- package/lib/commonjs/reconcile/truncate.js.map +1 -0
- package/lib/commonjs/recurrence/clock-guard.js +65 -0
- package/lib/commonjs/recurrence/clock-guard.js.map +1 -0
- package/lib/commonjs/recurrence/expand.js +254 -0
- package/lib/commonjs/recurrence/expand.js.map +1 -0
- package/lib/commonjs/recurrence/index.js +212 -0
- package/lib/commonjs/recurrence/index.js.map +1 -0
- package/lib/commonjs/repeat/expiry.js +41 -0
- package/lib/commonjs/repeat/expiry.js.map +1 -0
- package/lib/commonjs/repeat/index.js +100 -0
- package/lib/commonjs/repeat/index.js.map +1 -0
- package/lib/commonjs/repeat/marker.js +58 -0
- package/lib/commonjs/repeat/marker.js.map +1 -0
- package/lib/commonjs/repeat/place.js +83 -0
- package/lib/commonjs/repeat/place.js.map +1 -0
- package/lib/commonjs/schedule/anchor.js +243 -0
- package/lib/commonjs/schedule/anchor.js.map +1 -0
- package/lib/commonjs/schedule/index.js +142 -0
- package/lib/commonjs/schedule/index.js.map +1 -0
- package/lib/commonjs/schedule/partition.js +59 -0
- package/lib/commonjs/schedule/partition.js.map +1 -0
- package/lib/commonjs/schedule/resolve-moment.js +72 -0
- package/lib/commonjs/schedule/resolve-moment.js.map +1 -0
- package/lib/commonjs/schedule/validate-content.js +101 -0
- package/lib/commonjs/schedule/validate-content.js.map +1 -0
- package/lib/commonjs/schedule/validate-identifier.js +126 -0
- package/lib/commonjs/schedule/validate-identifier.js.map +1 -0
- package/lib/commonjs/schedule/writer.js +44 -0
- package/lib/commonjs/schedule/writer.js.map +1 -0
- package/lib/commonjs/state/caps.js +101 -0
- package/lib/commonjs/state/caps.js.map +1 -0
- package/lib/commonjs/state/dedup-ledger.js +39 -0
- package/lib/commonjs/state/dedup-ledger.js.map +1 -0
- package/lib/commonjs/state/interaction-buffer.js +98 -0
- package/lib/commonjs/state/interaction-buffer.js.map +1 -0
- package/lib/commonjs/state/mmkv-store.js +75 -0
- package/lib/commonjs/state/mmkv-store.js.map +1 -0
- package/lib/commonjs/state/permission-history.js +64 -0
- package/lib/commonjs/state/permission-history.js.map +1 -0
- package/lib/commonjs/state/record.js +269 -0
- package/lib/commonjs/state/record.js.map +1 -0
- package/lib/commonjs/state/reset.js +37 -0
- package/lib/commonjs/state/reset.js.map +1 -0
- package/lib/commonjs/state/series-ledger.js +71 -0
- package/lib/commonjs/state/series-ledger.js.map +1 -0
- package/lib/commonjs/state/store.js +39 -0
- package/lib/commonjs/state/store.js.map +1 -0
- package/lib/commonjs/testing/conformance/index.js +218 -0
- package/lib/commonjs/testing/conformance/index.js.map +1 -0
- package/lib/commonjs/testing/fake-engine.js +338 -0
- package/lib/commonjs/testing/fake-engine.js.map +1 -0
- package/lib/commonjs/testing/fake-provider.js +93 -0
- package/lib/commonjs/testing/fake-provider.js.map +1 -0
- package/lib/commonjs/testing/faults.js +59 -0
- package/lib/commonjs/testing/faults.js.map +1 -0
- package/lib/commonjs/testing/index.js +54 -0
- package/lib/commonjs/testing/index.js.map +1 -0
- package/lib/commonjs/testing/measure.js +298 -0
- package/lib/commonjs/testing/measure.js.map +1 -0
- package/lib/module/advanced.js +29 -0
- package/lib/module/advanced.js.map +1 -0
- package/lib/module/channel/migrate.js +242 -0
- package/lib/module/channel/migrate.js.map +1 -0
- package/lib/module/channel/tone-map.js +112 -0
- package/lib/module/channel/tone-map.js.map +1 -0
- package/lib/module/channel/validate-tone.js +57 -0
- package/lib/module/channel/validate-tone.js.map +1 -0
- package/lib/module/contract/channel.js +48 -0
- package/lib/module/contract/channel.js.map +1 -0
- package/lib/module/contract/diagnostics.js +21 -0
- package/lib/module/contract/diagnostics.js.map +1 -0
- package/lib/module/contract/errors.js +119 -0
- package/lib/module/contract/errors.js.map +1 -0
- package/lib/module/contract/hash.js +29 -0
- package/lib/module/contract/hash.js.map +1 -0
- package/lib/module/contract/index.js +13 -0
- package/lib/module/contract/index.js.map +1 -0
- package/lib/module/contract/interaction.js +33 -0
- package/lib/module/contract/interaction.js.map +1 -0
- package/lib/module/contract/notification.js +38 -0
- package/lib/module/contract/notification.js.map +1 -0
- package/lib/module/contract/permission.js +2 -0
- package/lib/module/contract/permission.js.map +1 -0
- package/lib/module/contract/reconcile.js +4 -0
- package/lib/module/contract/reconcile.js.map +1 -0
- package/lib/module/contract/recurrence.js +49 -0
- package/lib/module/contract/recurrence.js.map +1 -0
- package/lib/module/diagnostics/burst.js +85 -0
- package/lib/module/diagnostics/burst.js.map +1 -0
- package/lib/module/diagnostics/events.js +58 -0
- package/lib/module/diagnostics/events.js.map +1 -0
- package/lib/module/diagnostics/redact.js +44 -0
- package/lib/module/diagnostics/redact.js.map +1 -0
- package/lib/module/diagnostics/snapshot.js +64 -0
- package/lib/module/diagnostics/snapshot.js.map +1 -0
- package/lib/module/engine/adapter.js +4 -0
- package/lib/module/engine/adapter.js.map +1 -0
- package/lib/module/engine/codec.js +79 -0
- package/lib/module/engine/codec.js.map +1 -0
- package/lib/module/engine/notify-kit/events.js +139 -0
- package/lib/module/engine/notify-kit/events.js.map +1 -0
- package/lib/module/engine/notify-kit/module.js +113 -0
- package/lib/module/engine/notify-kit/module.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/android.js +155 -0
- package/lib/module/engine/notify-kit/platform/android.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/index.js +51 -0
- package/lib/module/engine/notify-kit/platform/index.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/ios.js +49 -0
- package/lib/module/engine/notify-kit/platform/ios.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/types.js +4 -0
- package/lib/module/engine/notify-kit/platform/types.js.map +1 -0
- package/lib/module/engine/notify-kit-engine.js +257 -0
- package/lib/module/engine/notify-kit-engine.js.map +1 -0
- package/lib/module/index.js +98 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/initialize.js +182 -0
- package/lib/module/initialize.js.map +1 -0
- package/lib/module/interaction/index.js +116 -0
- package/lib/module/interaction/index.js.map +1 -0
- package/lib/module/maintenance/cycle.js +102 -0
- package/lib/module/maintenance/cycle.js.map +1 -0
- package/lib/module/maintenance/permission-refresh.js +34 -0
- package/lib/module/maintenance/permission-refresh.js.map +1 -0
- package/lib/module/maintenance/reanchor.js +94 -0
- package/lib/module/maintenance/reanchor.js.map +1 -0
- package/lib/module/maintenance/toggle.js +45 -0
- package/lib/module/maintenance/toggle.js.map +1 -0
- package/lib/module/maintenance/verify.js +65 -0
- package/lib/module/maintenance/verify.js.map +1 -0
- package/lib/module/maintenance/window-refresh.js +48 -0
- package/lib/module/maintenance/window-refresh.js.map +1 -0
- package/lib/module/notifications.js +157 -0
- package/lib/module/notifications.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/permission/index.js +178 -0
- package/lib/module/permission/index.js.map +1 -0
- package/lib/module/permission/state.js +83 -0
- package/lib/module/permission/state.js.map +1 -0
- package/lib/module/push/envelope.js +137 -0
- package/lib/module/push/envelope.js.map +1 -0
- package/lib/module/push/fcm-provider.js +119 -0
- package/lib/module/push/fcm-provider.js.map +1 -0
- package/lib/module/push/gate.js +158 -0
- package/lib/module/push/gate.js.map +1 -0
- package/lib/module/push/index.js +16 -0
- package/lib/module/push/index.js.map +1 -0
- package/lib/module/push/instructions.js +97 -0
- package/lib/module/push/instructions.js.map +1 -0
- package/lib/module/push/provider-adapter.js +4 -0
- package/lib/module/push/provider-adapter.js.map +1 -0
- package/lib/module/push/signout.js +51 -0
- package/lib/module/push/signout.js.map +1 -0
- package/lib/module/reconcile/chunk.js +43 -0
- package/lib/module/reconcile/chunk.js.map +1 -0
- package/lib/module/reconcile/diff.js +101 -0
- package/lib/module/reconcile/diff.js.map +1 -0
- package/lib/module/reconcile/duplicates.js +56 -0
- package/lib/module/reconcile/duplicates.js.map +1 -0
- package/lib/module/reconcile/index.js +161 -0
- package/lib/module/reconcile/index.js.map +1 -0
- package/lib/module/reconcile/truncate.js +46 -0
- package/lib/module/reconcile/truncate.js.map +1 -0
- package/lib/module/recurrence/clock-guard.js +60 -0
- package/lib/module/recurrence/clock-guard.js.map +1 -0
- package/lib/module/recurrence/expand.js +248 -0
- package/lib/module/recurrence/expand.js.map +1 -0
- package/lib/module/recurrence/index.js +208 -0
- package/lib/module/recurrence/index.js.map +1 -0
- package/lib/module/repeat/expiry.js +37 -0
- package/lib/module/repeat/expiry.js.map +1 -0
- package/lib/module/repeat/index.js +67 -0
- package/lib/module/repeat/index.js.map +1 -0
- package/lib/module/repeat/marker.js +51 -0
- package/lib/module/repeat/marker.js.map +1 -0
- package/lib/module/repeat/place.js +79 -0
- package/lib/module/repeat/place.js.map +1 -0
- package/lib/module/schedule/anchor.js +234 -0
- package/lib/module/schedule/anchor.js.map +1 -0
- package/lib/module/schedule/index.js +137 -0
- package/lib/module/schedule/index.js.map +1 -0
- package/lib/module/schedule/partition.js +53 -0
- package/lib/module/schedule/partition.js.map +1 -0
- package/lib/module/schedule/resolve-moment.js +66 -0
- package/lib/module/schedule/resolve-moment.js.map +1 -0
- package/lib/module/schedule/validate-content.js +95 -0
- package/lib/module/schedule/validate-content.js.map +1 -0
- package/lib/module/schedule/validate-identifier.js +119 -0
- package/lib/module/schedule/validate-identifier.js.map +1 -0
- package/lib/module/schedule/writer.js +40 -0
- package/lib/module/schedule/writer.js.map +1 -0
- package/lib/module/state/caps.js +96 -0
- package/lib/module/state/caps.js.map +1 -0
- package/lib/module/state/dedup-ledger.js +34 -0
- package/lib/module/state/dedup-ledger.js.map +1 -0
- package/lib/module/state/interaction-buffer.js +92 -0
- package/lib/module/state/interaction-buffer.js.map +1 -0
- package/lib/module/state/mmkv-store.js +71 -0
- package/lib/module/state/mmkv-store.js.map +1 -0
- package/lib/module/state/permission-history.js +56 -0
- package/lib/module/state/permission-history.js.map +1 -0
- package/lib/module/state/record.js +264 -0
- package/lib/module/state/record.js.map +1 -0
- package/lib/module/state/reset.js +32 -0
- package/lib/module/state/reset.js.map +1 -0
- package/lib/module/state/series-ledger.js +62 -0
- package/lib/module/state/series-ledger.js.map +1 -0
- package/lib/module/state/store.js +35 -0
- package/lib/module/state/store.js.map +1 -0
- package/lib/module/testing/conformance/index.js +214 -0
- package/lib/module/testing/conformance/index.js.map +1 -0
- package/lib/module/testing/fake-engine.js +335 -0
- package/lib/module/testing/fake-engine.js.map +1 -0
- package/lib/module/testing/fake-provider.js +89 -0
- package/lib/module/testing/fake-provider.js.map +1 -0
- package/lib/module/testing/faults.js +55 -0
- package/lib/module/testing/faults.js.map +1 -0
- package/lib/module/testing/index.js +19 -0
- package/lib/module/testing/index.js.map +1 -0
- package/lib/module/testing/measure.js +294 -0
- package/lib/module/testing/measure.js.map +1 -0
- package/lib/typescript/commonjs/advanced.d.ts +36 -0
- package/lib/typescript/commonjs/advanced.d.ts.map +1 -0
- package/lib/typescript/commonjs/channel/migrate.d.ts +38 -0
- package/lib/typescript/commonjs/channel/migrate.d.ts.map +1 -0
- package/lib/typescript/commonjs/channel/tone-map.d.ts +34 -0
- package/lib/typescript/commonjs/channel/tone-map.d.ts.map +1 -0
- package/lib/typescript/commonjs/channel/validate-tone.d.ts +23 -0
- package/lib/typescript/commonjs/channel/validate-tone.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/channel.d.ts +185 -0
- package/lib/typescript/commonjs/contract/channel.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/diagnostics.d.ts +92 -0
- package/lib/typescript/commonjs/contract/diagnostics.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/errors.d.ts +91 -0
- package/lib/typescript/commonjs/contract/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/hash.d.ts +14 -0
- package/lib/typescript/commonjs/contract/hash.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/index.d.ts +10 -0
- package/lib/typescript/commonjs/contract/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/interaction.d.ts +53 -0
- package/lib/typescript/commonjs/contract/interaction.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/notification.d.ts +110 -0
- package/lib/typescript/commonjs/contract/notification.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/permission.d.ts +49 -0
- package/lib/typescript/commonjs/contract/permission.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/reconcile.d.ts +82 -0
- package/lib/typescript/commonjs/contract/reconcile.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/recurrence.d.ts +118 -0
- package/lib/typescript/commonjs/contract/recurrence.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/burst.d.ts +39 -0
- package/lib/typescript/commonjs/diagnostics/burst.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts +28 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/redact.d.ts +22 -0
- package/lib/typescript/commonjs/diagnostics/redact.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/snapshot.d.ts +40 -0
- package/lib/typescript/commonjs/diagnostics/snapshot.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/adapter.d.ts +172 -0
- package/lib/typescript/commonjs/engine/adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/codec.d.ts +20 -0
- package/lib/typescript/commonjs/engine/codec.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/events.d.ts +37 -0
- package/lib/typescript/commonjs/engine/notify-kit/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/module.d.ts +103 -0
- package/lib/typescript/commonjs/engine/notify-kit/module.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/android.d.ts +3 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/android.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/index.d.ts +12 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/ios.d.ts +3 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/ios.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/types.d.ts +33 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit-engine.d.ts +25 -0
- package/lib/typescript/commonjs/engine/notify-kit-engine.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +106 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/initialize.d.ts +74 -0
- package/lib/typescript/commonjs/initialize.d.ts.map +1 -0
- package/lib/typescript/commonjs/interaction/index.d.ts +53 -0
- package/lib/typescript/commonjs/interaction/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/cycle.d.ts +77 -0
- package/lib/typescript/commonjs/maintenance/cycle.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/permission-refresh.d.ts +19 -0
- package/lib/typescript/commonjs/maintenance/permission-refresh.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/reanchor.d.ts +26 -0
- package/lib/typescript/commonjs/maintenance/reanchor.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/toggle.d.ts +35 -0
- package/lib/typescript/commonjs/maintenance/toggle.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/verify.d.ts +32 -0
- package/lib/typescript/commonjs/maintenance/verify.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/window-refresh.d.ts +29 -0
- package/lib/typescript/commonjs/maintenance/window-refresh.d.ts.map +1 -0
- package/lib/typescript/commonjs/notifications.d.ts +78 -0
- package/lib/typescript/commonjs/notifications.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/permission/index.d.ts +57 -0
- package/lib/typescript/commonjs/permission/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/permission/state.d.ts +41 -0
- package/lib/typescript/commonjs/permission/state.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/envelope.d.ts +33 -0
- package/lib/typescript/commonjs/push/envelope.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/fcm-provider.d.ts +43 -0
- package/lib/typescript/commonjs/push/fcm-provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/gate.d.ts +57 -0
- package/lib/typescript/commonjs/push/gate.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/index.d.ts +19 -0
- package/lib/typescript/commonjs/push/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/instructions.d.ts +45 -0
- package/lib/typescript/commonjs/push/instructions.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/provider-adapter.d.ts +50 -0
- package/lib/typescript/commonjs/push/provider-adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/signout.d.ts +33 -0
- package/lib/typescript/commonjs/push/signout.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/chunk.d.ts +24 -0
- package/lib/typescript/commonjs/reconcile/chunk.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/diff.d.ts +54 -0
- package/lib/typescript/commonjs/reconcile/diff.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/duplicates.d.ts +32 -0
- package/lib/typescript/commonjs/reconcile/duplicates.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/index.d.ts +35 -0
- package/lib/typescript/commonjs/reconcile/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/truncate.d.ts +26 -0
- package/lib/typescript/commonjs/reconcile/truncate.d.ts.map +1 -0
- package/lib/typescript/commonjs/recurrence/clock-guard.d.ts +37 -0
- package/lib/typescript/commonjs/recurrence/clock-guard.d.ts.map +1 -0
- package/lib/typescript/commonjs/recurrence/expand.d.ts +75 -0
- package/lib/typescript/commonjs/recurrence/expand.d.ts.map +1 -0
- package/lib/typescript/commonjs/recurrence/index.d.ts +40 -0
- package/lib/typescript/commonjs/recurrence/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/expiry.d.ts +23 -0
- package/lib/typescript/commonjs/repeat/expiry.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/index.d.ts +49 -0
- package/lib/typescript/commonjs/repeat/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/marker.d.ts +36 -0
- package/lib/typescript/commonjs/repeat/marker.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/place.d.ts +39 -0
- package/lib/typescript/commonjs/repeat/place.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/anchor.d.ts +118 -0
- package/lib/typescript/commonjs/schedule/anchor.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/index.d.ts +40 -0
- package/lib/typescript/commonjs/schedule/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/partition.d.ts +29 -0
- package/lib/typescript/commonjs/schedule/partition.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/resolve-moment.d.ts +35 -0
- package/lib/typescript/commonjs/schedule/resolve-moment.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/validate-content.d.ts +42 -0
- package/lib/typescript/commonjs/schedule/validate-content.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/validate-identifier.d.ts +30 -0
- package/lib/typescript/commonjs/schedule/validate-identifier.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/writer.d.ts +36 -0
- package/lib/typescript/commonjs/schedule/writer.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/caps.d.ts +51 -0
- package/lib/typescript/commonjs/state/caps.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/dedup-ledger.d.ts +21 -0
- package/lib/typescript/commonjs/state/dedup-ledger.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/interaction-buffer.d.ts +30 -0
- package/lib/typescript/commonjs/state/interaction-buffer.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/mmkv-store.d.ts +33 -0
- package/lib/typescript/commonjs/state/mmkv-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/permission-history.d.ts +20 -0
- package/lib/typescript/commonjs/state/permission-history.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/record.d.ts +134 -0
- package/lib/typescript/commonjs/state/record.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/reset.d.ts +22 -0
- package/lib/typescript/commonjs/state/reset.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/series-ledger.d.ts +47 -0
- package/lib/typescript/commonjs/state/series-ledger.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/store.d.ts +20 -0
- package/lib/typescript/commonjs/state/store.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/index.d.ts +32 -0
- package/lib/typescript/commonjs/testing/conformance/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/fake-engine.d.ts +91 -0
- package/lib/typescript/commonjs/testing/fake-engine.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/fake-provider.d.ts +35 -0
- package/lib/typescript/commonjs/testing/fake-provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/faults.d.ts +38 -0
- package/lib/typescript/commonjs/testing/faults.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/index.d.ts +22 -0
- package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/measure.d.ts +59 -0
- package/lib/typescript/commonjs/testing/measure.d.ts.map +1 -0
- package/lib/typescript/module/advanced.d.ts +36 -0
- package/lib/typescript/module/advanced.d.ts.map +1 -0
- package/lib/typescript/module/channel/migrate.d.ts +38 -0
- package/lib/typescript/module/channel/migrate.d.ts.map +1 -0
- package/lib/typescript/module/channel/tone-map.d.ts +34 -0
- package/lib/typescript/module/channel/tone-map.d.ts.map +1 -0
- package/lib/typescript/module/channel/validate-tone.d.ts +23 -0
- package/lib/typescript/module/channel/validate-tone.d.ts.map +1 -0
- package/lib/typescript/module/contract/channel.d.ts +185 -0
- package/lib/typescript/module/contract/channel.d.ts.map +1 -0
- package/lib/typescript/module/contract/diagnostics.d.ts +92 -0
- package/lib/typescript/module/contract/diagnostics.d.ts.map +1 -0
- package/lib/typescript/module/contract/errors.d.ts +91 -0
- package/lib/typescript/module/contract/errors.d.ts.map +1 -0
- package/lib/typescript/module/contract/hash.d.ts +14 -0
- package/lib/typescript/module/contract/hash.d.ts.map +1 -0
- package/lib/typescript/module/contract/index.d.ts +10 -0
- package/lib/typescript/module/contract/index.d.ts.map +1 -0
- package/lib/typescript/module/contract/interaction.d.ts +53 -0
- package/lib/typescript/module/contract/interaction.d.ts.map +1 -0
- package/lib/typescript/module/contract/notification.d.ts +110 -0
- package/lib/typescript/module/contract/notification.d.ts.map +1 -0
- package/lib/typescript/module/contract/permission.d.ts +49 -0
- package/lib/typescript/module/contract/permission.d.ts.map +1 -0
- package/lib/typescript/module/contract/reconcile.d.ts +82 -0
- package/lib/typescript/module/contract/reconcile.d.ts.map +1 -0
- package/lib/typescript/module/contract/recurrence.d.ts +118 -0
- package/lib/typescript/module/contract/recurrence.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/burst.d.ts +39 -0
- package/lib/typescript/module/diagnostics/burst.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/events.d.ts +28 -0
- package/lib/typescript/module/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/redact.d.ts +22 -0
- package/lib/typescript/module/diagnostics/redact.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/snapshot.d.ts +40 -0
- package/lib/typescript/module/diagnostics/snapshot.d.ts.map +1 -0
- package/lib/typescript/module/engine/adapter.d.ts +172 -0
- package/lib/typescript/module/engine/adapter.d.ts.map +1 -0
- package/lib/typescript/module/engine/codec.d.ts +20 -0
- package/lib/typescript/module/engine/codec.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/events.d.ts +37 -0
- package/lib/typescript/module/engine/notify-kit/events.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/module.d.ts +103 -0
- package/lib/typescript/module/engine/notify-kit/module.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/android.d.ts +3 -0
- package/lib/typescript/module/engine/notify-kit/platform/android.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/index.d.ts +12 -0
- package/lib/typescript/module/engine/notify-kit/platform/index.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/ios.d.ts +3 -0
- package/lib/typescript/module/engine/notify-kit/platform/ios.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/types.d.ts +33 -0
- package/lib/typescript/module/engine/notify-kit/platform/types.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit-engine.d.ts +25 -0
- package/lib/typescript/module/engine/notify-kit-engine.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +106 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/initialize.d.ts +74 -0
- package/lib/typescript/module/initialize.d.ts.map +1 -0
- package/lib/typescript/module/interaction/index.d.ts +53 -0
- package/lib/typescript/module/interaction/index.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/cycle.d.ts +77 -0
- package/lib/typescript/module/maintenance/cycle.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/permission-refresh.d.ts +19 -0
- package/lib/typescript/module/maintenance/permission-refresh.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/reanchor.d.ts +26 -0
- package/lib/typescript/module/maintenance/reanchor.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/toggle.d.ts +35 -0
- package/lib/typescript/module/maintenance/toggle.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/verify.d.ts +32 -0
- package/lib/typescript/module/maintenance/verify.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/window-refresh.d.ts +29 -0
- package/lib/typescript/module/maintenance/window-refresh.d.ts.map +1 -0
- package/lib/typescript/module/notifications.d.ts +78 -0
- package/lib/typescript/module/notifications.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/permission/index.d.ts +57 -0
- package/lib/typescript/module/permission/index.d.ts.map +1 -0
- package/lib/typescript/module/permission/state.d.ts +41 -0
- package/lib/typescript/module/permission/state.d.ts.map +1 -0
- package/lib/typescript/module/push/envelope.d.ts +33 -0
- package/lib/typescript/module/push/envelope.d.ts.map +1 -0
- package/lib/typescript/module/push/fcm-provider.d.ts +43 -0
- package/lib/typescript/module/push/fcm-provider.d.ts.map +1 -0
- package/lib/typescript/module/push/gate.d.ts +57 -0
- package/lib/typescript/module/push/gate.d.ts.map +1 -0
- package/lib/typescript/module/push/index.d.ts +19 -0
- package/lib/typescript/module/push/index.d.ts.map +1 -0
- package/lib/typescript/module/push/instructions.d.ts +45 -0
- package/lib/typescript/module/push/instructions.d.ts.map +1 -0
- package/lib/typescript/module/push/provider-adapter.d.ts +50 -0
- package/lib/typescript/module/push/provider-adapter.d.ts.map +1 -0
- package/lib/typescript/module/push/signout.d.ts +33 -0
- package/lib/typescript/module/push/signout.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/chunk.d.ts +24 -0
- package/lib/typescript/module/reconcile/chunk.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/diff.d.ts +54 -0
- package/lib/typescript/module/reconcile/diff.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/duplicates.d.ts +32 -0
- package/lib/typescript/module/reconcile/duplicates.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/index.d.ts +35 -0
- package/lib/typescript/module/reconcile/index.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/truncate.d.ts +26 -0
- package/lib/typescript/module/reconcile/truncate.d.ts.map +1 -0
- package/lib/typescript/module/recurrence/clock-guard.d.ts +37 -0
- package/lib/typescript/module/recurrence/clock-guard.d.ts.map +1 -0
- package/lib/typescript/module/recurrence/expand.d.ts +75 -0
- package/lib/typescript/module/recurrence/expand.d.ts.map +1 -0
- package/lib/typescript/module/recurrence/index.d.ts +40 -0
- package/lib/typescript/module/recurrence/index.d.ts.map +1 -0
- package/lib/typescript/module/repeat/expiry.d.ts +23 -0
- package/lib/typescript/module/repeat/expiry.d.ts.map +1 -0
- package/lib/typescript/module/repeat/index.d.ts +49 -0
- package/lib/typescript/module/repeat/index.d.ts.map +1 -0
- package/lib/typescript/module/repeat/marker.d.ts +36 -0
- package/lib/typescript/module/repeat/marker.d.ts.map +1 -0
- package/lib/typescript/module/repeat/place.d.ts +39 -0
- package/lib/typescript/module/repeat/place.d.ts.map +1 -0
- package/lib/typescript/module/schedule/anchor.d.ts +118 -0
- package/lib/typescript/module/schedule/anchor.d.ts.map +1 -0
- package/lib/typescript/module/schedule/index.d.ts +40 -0
- package/lib/typescript/module/schedule/index.d.ts.map +1 -0
- package/lib/typescript/module/schedule/partition.d.ts +29 -0
- package/lib/typescript/module/schedule/partition.d.ts.map +1 -0
- package/lib/typescript/module/schedule/resolve-moment.d.ts +35 -0
- package/lib/typescript/module/schedule/resolve-moment.d.ts.map +1 -0
- package/lib/typescript/module/schedule/validate-content.d.ts +42 -0
- package/lib/typescript/module/schedule/validate-content.d.ts.map +1 -0
- package/lib/typescript/module/schedule/validate-identifier.d.ts +30 -0
- package/lib/typescript/module/schedule/validate-identifier.d.ts.map +1 -0
- package/lib/typescript/module/schedule/writer.d.ts +36 -0
- package/lib/typescript/module/schedule/writer.d.ts.map +1 -0
- package/lib/typescript/module/state/caps.d.ts +51 -0
- package/lib/typescript/module/state/caps.d.ts.map +1 -0
- package/lib/typescript/module/state/dedup-ledger.d.ts +21 -0
- package/lib/typescript/module/state/dedup-ledger.d.ts.map +1 -0
- package/lib/typescript/module/state/interaction-buffer.d.ts +30 -0
- package/lib/typescript/module/state/interaction-buffer.d.ts.map +1 -0
- package/lib/typescript/module/state/mmkv-store.d.ts +33 -0
- package/lib/typescript/module/state/mmkv-store.d.ts.map +1 -0
- package/lib/typescript/module/state/permission-history.d.ts +20 -0
- package/lib/typescript/module/state/permission-history.d.ts.map +1 -0
- package/lib/typescript/module/state/record.d.ts +134 -0
- package/lib/typescript/module/state/record.d.ts.map +1 -0
- package/lib/typescript/module/state/reset.d.ts +22 -0
- package/lib/typescript/module/state/reset.d.ts.map +1 -0
- package/lib/typescript/module/state/series-ledger.d.ts +47 -0
- package/lib/typescript/module/state/series-ledger.d.ts.map +1 -0
- package/lib/typescript/module/state/store.d.ts +20 -0
- package/lib/typescript/module/state/store.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/index.d.ts +32 -0
- package/lib/typescript/module/testing/conformance/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/fake-engine.d.ts +91 -0
- package/lib/typescript/module/testing/fake-engine.d.ts.map +1 -0
- package/lib/typescript/module/testing/fake-provider.d.ts +35 -0
- package/lib/typescript/module/testing/fake-provider.d.ts.map +1 -0
- package/lib/typescript/module/testing/faults.d.ts +38 -0
- package/lib/typescript/module/testing/faults.d.ts.map +1 -0
- package/lib/typescript/module/testing/index.d.ts +22 -0
- package/lib/typescript/module/testing/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/measure.d.ts +59 -0
- package/lib/typescript/module/testing/measure.d.ts.map +1 -0
- package/package.json +72 -26
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.REPEAT_STOP_PREFIX = void 0;
|
|
7
|
+
exports.isRepeatStopId = isRepeatStopId;
|
|
8
|
+
exports.markerIdFor = markerIdFor;
|
|
9
|
+
exports.repeatStopFor = repeatStopFor;
|
|
10
|
+
var _hash = require("../contract/hash.js");
|
|
11
|
+
/**
|
|
12
|
+
* Stop-marker identity.
|
|
13
|
+
*
|
|
14
|
+
* A repeating alert has to end without the app being alive, and no platform
|
|
15
|
+
* offers "stop the sound at time T but keep the notification". So the package
|
|
16
|
+
* schedules its own notification at T and reacts to its delivery. That
|
|
17
|
+
* notification is a *marker*: it exists to be delivered and immediately
|
|
18
|
+
* removed, never to be read.
|
|
19
|
+
*
|
|
20
|
+
* The marker's identifier is derived from the target's by hashing rather than by
|
|
21
|
+
* concatenation. Concatenation would overflow the package's 128-character
|
|
22
|
+
* identifier limit for any target already near it, and would make the marker's
|
|
23
|
+
* identity a function of a value the consumer controls — which is how a
|
|
24
|
+
* consumer identifier ends up colliding with an internal one.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Reserved identifier namespace.
|
|
29
|
+
*
|
|
30
|
+
* Rejected as a consumer identifier prefix. A consumer id colliding with a
|
|
31
|
+
* marker would not merely confuse a listing: the expiry handler cancels
|
|
32
|
+
* markers, so the collision would delete a real notification.
|
|
33
|
+
*/
|
|
34
|
+
const REPEAT_STOP_PREFIX = exports.REPEAT_STOP_PREFIX = 'cms.stop:';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The marker identifier for a target notification.
|
|
38
|
+
*
|
|
39
|
+
* Two independent hashes rather than one: a single 32-bit hash collides often
|
|
40
|
+
* enough to matter once a device holds a handful of alarms, and a collision here
|
|
41
|
+
* means one alarm's marker silences the other alarm and never silences its own.
|
|
42
|
+
*/
|
|
43
|
+
function markerIdFor(targetId) {
|
|
44
|
+
return `${REPEAT_STOP_PREFIX}${(0, _hash.hex8)((0, _hash.fnv1a)(targetId, 0x811c9dc5))}${(0, _hash.hex8)((0, _hash.fnv1a)(targetId, 0x9e3779b9))}`;
|
|
45
|
+
}
|
|
46
|
+
function isRepeatStopId(id) {
|
|
47
|
+
return id.startsWith(REPEAT_STOP_PREFIX);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Describes the stop for a target whose alert must end at a known instant. */
|
|
51
|
+
function repeatStopFor(targetId, deliveredAt, forMs) {
|
|
52
|
+
return {
|
|
53
|
+
markerId: markerIdFor(targetId),
|
|
54
|
+
targetId,
|
|
55
|
+
dueAt: deliveredAt + forMs
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=marker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_hash","require","REPEAT_STOP_PREFIX","exports","markerIdFor","targetId","hex8","fnv1a","isRepeatStopId","id","startsWith","repeatStopFor","deliveredAt","forMs","markerId","dueAt"],"sourceRoot":"../../../src","sources":["repeat/marker.ts"],"mappings":";;;;;;;;;AAgBA,IAAAA,KAAA,GAAAC,OAAA;AAhBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,WAAW;;AAE7C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,WAAWA,CAACC,QAAgB,EAAU;EACrD,OAAO,GAAGH,kBAAkB,GAAG,IAAAI,UAAI,EAAC,IAAAC,WAAK,EAACF,QAAQ,EAAE,UAAU,CAAC,CAAC,GAAG,IAAAC,UAAI,EAAC,IAAAC,WAAK,EAACF,QAAQ,EAAE,UAAU,CAAC,CAAC,EAAE;AACvG;AAEO,SAASG,cAAcA,CAACC,EAAU,EAAW;EACnD,OAAOA,EAAE,CAACC,UAAU,CAACR,kBAAkB,CAAC;AACzC;;AAEA;AACO,SAASS,aAAaA,CAACN,QAAgB,EAAEO,WAAmB,EAAEC,KAAa,EAAc;EAC/F,OAAO;IACNC,QAAQ,EAAEV,WAAW,CAACC,QAAQ,CAAC;IAC/BA,QAAQ;IACRU,KAAK,EAAEH,WAAW,GAAGC;EACtB,CAAC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createStopPlacement = createStopPlacement;
|
|
7
|
+
var _marker = require("./marker.js");
|
|
8
|
+
/**
|
|
9
|
+
* Keeping a notification's stop marker in step with the notification.
|
|
10
|
+
*
|
|
11
|
+
* Shared by the scheduler and the reconciler rather than written twice. They are
|
|
12
|
+
* two doors into the same act — reconciliation is how most consumers schedule —
|
|
13
|
+
* and a bound that only existed on one path would be a bound that mostly did not
|
|
14
|
+
* exist.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
function createStopPlacement(engine) {
|
|
18
|
+
/** `snapshot`: read once and kept current, for a pass; otherwise read on every call. */
|
|
19
|
+
function placement(snapshot) {
|
|
20
|
+
let known;
|
|
21
|
+
|
|
22
|
+
/** targetId → markerId of every outstanding stop. */
|
|
23
|
+
const outstanding = async () => {
|
|
24
|
+
if (snapshot && known) {
|
|
25
|
+
return known;
|
|
26
|
+
}
|
|
27
|
+
const read = new Map((await engine.listRepeatStops()).map(stop => [stop.targetId, stop.markerId]));
|
|
28
|
+
if (snapshot) {
|
|
29
|
+
known = read;
|
|
30
|
+
}
|
|
31
|
+
return read;
|
|
32
|
+
};
|
|
33
|
+
const release = async targetId => {
|
|
34
|
+
const stops = await outstanding();
|
|
35
|
+
const markerId = stops.get(targetId);
|
|
36
|
+
if (markerId !== undefined) {
|
|
37
|
+
await engine.cancel(markerId);
|
|
38
|
+
stops.delete(targetId);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return {
|
|
42
|
+
release,
|
|
43
|
+
async count() {
|
|
44
|
+
return (await outstanding()).size;
|
|
45
|
+
},
|
|
46
|
+
async sync(targetId, tone, deliversAt) {
|
|
47
|
+
await release(targetId);
|
|
48
|
+
const forMs = tone.android.repeatForMs;
|
|
49
|
+
if (!tone.android.loopSound || forMs === undefined) return;
|
|
50
|
+
const capabilities = await engine.getCapabilities();
|
|
51
|
+
if (!capabilities.supportsRepeatingAlert) return;
|
|
52
|
+
const stop = (0, _marker.repeatStopFor)(targetId, deliversAt, forMs);
|
|
53
|
+
await engine.schedule({
|
|
54
|
+
request: {
|
|
55
|
+
id: stop.markerId,
|
|
56
|
+
// Deliberately empty. A marker is delivered and removed within the
|
|
57
|
+
// same handler invocation; anything readable here would be text a
|
|
58
|
+
// user might glimpse and be confused by.
|
|
59
|
+
content: {
|
|
60
|
+
title: '',
|
|
61
|
+
body: ''
|
|
62
|
+
},
|
|
63
|
+
tone: tone.toneId,
|
|
64
|
+
// Absolute: the bound is a duration from a known instant, not a
|
|
65
|
+
// wall-clock time that should follow the user across time zones.
|
|
66
|
+
moment: {
|
|
67
|
+
at: stop.dueAt,
|
|
68
|
+
anchoring: 'absolute'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
resolvedAt: stop.dueAt,
|
|
72
|
+
tone,
|
|
73
|
+
approximate: false,
|
|
74
|
+
repeatStop: stop
|
|
75
|
+
});
|
|
76
|
+
known?.set(targetId, stop.markerId);
|
|
77
|
+
},
|
|
78
|
+
pass: () => placement(true)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return placement(false);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=place.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_marker","require","createStopPlacement","engine","placement","snapshot","known","outstanding","read","Map","listRepeatStops","map","stop","targetId","markerId","release","stops","get","undefined","cancel","delete","count","size","sync","tone","deliversAt","forMs","android","repeatForMs","loopSound","capabilities","getCapabilities","supportsRepeatingAlert","repeatStopFor","schedule","request","id","content","title","body","toneId","moment","at","dueAt","anchoring","resolvedAt","approximate","repeatStop","set","pass"],"sourceRoot":"../../../src","sources":["repeat/place.ts"],"mappings":";;;;;;AAWA,IAAAA,OAAA,GAAAC,OAAA;AAXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkCO,SAASC,mBAAmBA,CAACC,MAAiC,EAAiB;EACrF;EACA,SAASC,SAASA,CAACC,QAAiB,EAAiB;IACpD,IAAIC,KAAsC;;IAE1C;IACA,MAAMC,WAAW,GAAG,MAAAA,CAAA,KAA0C;MAC7D,IAAIF,QAAQ,IAAIC,KAAK,EAAE;QACtB,OAAOA,KAAK;MACb;MACA,MAAME,IAAI,GAAG,IAAIC,GAAG,CACnB,CAAC,MAAMN,MAAM,CAACO,eAAe,CAAC,CAAC,EAAEC,GAAG,CAACC,IAAI,IAAI,CAACA,IAAI,CAACC,QAAQ,EAAED,IAAI,CAACE,QAAQ,CAAU,CACrF,CAAC;MACD,IAAIT,QAAQ,EAAE;QACbC,KAAK,GAAGE,IAAI;MACb;MACA,OAAOA,IAAI;IACZ,CAAC;IAED,MAAMO,OAAO,GAAG,MAAOF,QAAgB,IAAoB;MAC1D,MAAMG,KAAK,GAAG,MAAMT,WAAW,CAAC,CAAC;MACjC,MAAMO,QAAQ,GAAGE,KAAK,CAACC,GAAG,CAACJ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AAQ,EAAED,IAAI,CAACE,QAAQ,CAAC;MACpC,CAAC;MAEDmC,IAAI,EAAEA,CAAA,KAAM7C,SAAS,CAAC,IAAI;IAC3B,CAAC;EACF;EAEA,OAAOA,SAAS,CAAC,KAAK,CAAC;AACxB","ignoreList":[]}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.anchorMoment = anchorMoment;
|
|
7
|
+
exports.createPlatformTimeZoneReader = createPlatformTimeZoneReader;
|
|
8
|
+
exports.instantForParts = instantForParts;
|
|
9
|
+
exports.isStaleAnchor = isStaleAnchor;
|
|
10
|
+
exports.isValidTimeZone = isValidTimeZone;
|
|
11
|
+
exports.partsInZone = partsInZone;
|
|
12
|
+
exports.planReAnchor = planReAnchor;
|
|
13
|
+
var _rnCore = require("@chipmobilesdk/rn-core");
|
|
14
|
+
var _notification = require("../contract/notification.js");
|
|
15
|
+
/**
|
|
16
|
+
* Time-zone anchoring and re-anchoring.
|
|
17
|
+
*
|
|
18
|
+
* Wall-clock is the default because reminders are wall-clock things: an 08:00
|
|
19
|
+
* reminder should stay 08:00 after the user crosses a time zone, and a caller
|
|
20
|
+
* who does not choose should get what their users expect rather than a silent
|
|
21
|
+
* shift.
|
|
22
|
+
*
|
|
23
|
+
* The cost is re-anchoring. When the device zone changes, every scheduled
|
|
24
|
+
* wall-clock entry must be rewritten to preserve the clock time it named, and
|
|
25
|
+
* every absolute entry must be left completely alone.
|
|
26
|
+
*
|
|
27
|
+
* The limit this cannot fix is stated rather than hidden: a wall-clock
|
|
28
|
+
* notification whose moment arrives while the app has not run since the zone
|
|
29
|
+
* changed fires at the previously anchored instant. The anchoring generation on
|
|
30
|
+
* each entry is what makes that detectable instead of invisible.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/** Reads the platform time zone. Injected so the pure logic needs no native module. */
|
|
34
|
+
|
|
35
|
+
const localizePeer = (0, _rnCore.lazyPeer)('react-native-localize', () => {
|
|
36
|
+
// Inside `try`, so Metro bundles an app that leaves this optional peer out.
|
|
37
|
+
try {
|
|
38
|
+
return require('react-native-localize');
|
|
39
|
+
} catch (cause) {
|
|
40
|
+
throw cause;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Resolves the platform zone via `react-native-localize`.
|
|
46
|
+
*
|
|
47
|
+
* Pure JavaScript is not sufficient here: `Intl.DateTimeFormat().resolvedOptions().timeZone`
|
|
48
|
+
* is documented in React Native as not reliably updating when the device zone
|
|
49
|
+
* changes, so it cannot back re-anchoring. Falls back to `Intl` only when the
|
|
50
|
+
* module is absent, which is better than failing outright.
|
|
51
|
+
*/
|
|
52
|
+
function createPlatformTimeZoneReader() {
|
|
53
|
+
return () => {
|
|
54
|
+
const localize = localizePeer.get();
|
|
55
|
+
try {
|
|
56
|
+
if (localize.ok) return localize.module.getTimeZone();
|
|
57
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone ?? 'UTC';
|
|
58
|
+
} catch {
|
|
59
|
+
try {
|
|
60
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone ?? 'UTC';
|
|
61
|
+
} catch {
|
|
62
|
+
return 'UTC';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The calendar fields a wall-clock moment actually names. */
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Whether a zone name is one the runtime can actually format against.
|
|
72
|
+
*
|
|
73
|
+
* Hermes throws a hard `JSRangeErrorException: Invalid timezone name!` for a
|
|
74
|
+
* bad zone, which kills the JavaScript thread rather than returning an error.
|
|
75
|
+
* A stored anchoring generation is data that can be wrong — a corrupted record,
|
|
76
|
+
* an entry written by an older build, or a defect like the one that stored a
|
|
77
|
+
* tone id here — so it must be checked before it reaches `Intl`.
|
|
78
|
+
*/
|
|
79
|
+
function isValidTimeZone(timeZone) {
|
|
80
|
+
// rn-core memoizes the answer per zone: a recurrence expansion asks thousands
|
|
81
|
+
// of times about the same few zones (PERF-01).
|
|
82
|
+
return (0, _rnCore.isValidTimeZone)(timeZone);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** The options `partsInZone` formats with; one shared formatter per zone. */
|
|
86
|
+
const PARTS_OPTIONS = {
|
|
87
|
+
year: 'numeric',
|
|
88
|
+
month: '2-digit',
|
|
89
|
+
day: '2-digit',
|
|
90
|
+
hour: '2-digit',
|
|
91
|
+
minute: '2-digit',
|
|
92
|
+
second: '2-digit',
|
|
93
|
+
hour12: false
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Decomposes an instant into the clock reading it produces in a given zone.
|
|
98
|
+
*
|
|
99
|
+
* Falls back to UTC for an unusable zone rather than throwing: a bad stored
|
|
100
|
+
* value should degrade one entry's anchoring, not crash the app.
|
|
101
|
+
*/
|
|
102
|
+
function partsInZone(instant, timeZone) {
|
|
103
|
+
const zone = isValidTimeZone(timeZone) ? timeZone : 'UTC';
|
|
104
|
+
// Built once per zone and reused (PERF-01): constructing one per call was
|
|
105
|
+
// most of the cost of expanding a recurrence.
|
|
106
|
+
const formatter = (0, _rnCore.getDateTimeFormat)('en-US', {
|
|
107
|
+
...PARTS_OPTIONS,
|
|
108
|
+
timeZone: zone
|
|
109
|
+
});
|
|
110
|
+
const fields = {};
|
|
111
|
+
for (const part of formatter.formatToParts(new Date(instant))) {
|
|
112
|
+
if (part.type !== 'literal') {
|
|
113
|
+
fields[part.type] = Number.parseInt(part.value, 10);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
year: fields.year,
|
|
118
|
+
month: fields.month,
|
|
119
|
+
day: fields.day,
|
|
120
|
+
// Intl renders midnight as hour 24 in some environments; normalize it.
|
|
121
|
+
hour: fields.hour === 24 ? 0 : fields.hour,
|
|
122
|
+
minute: fields.minute,
|
|
123
|
+
second: fields.second
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** The zone's offset from UTC, in milliseconds, at a given instant. */
|
|
128
|
+
function offsetAt(instant, timeZone) {
|
|
129
|
+
const parts = partsInZone(instant, timeZone);
|
|
130
|
+
const asUtc = Date.UTC(parts.year, parts.month - 1, parts.day, parts.hour, parts.minute, parts.second);
|
|
131
|
+
return asUtc - Math.floor(instant / 1000) * 1000;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Finds the instant at which a zone shows the given clock reading.
|
|
136
|
+
*
|
|
137
|
+
* Two passes, because the offset itself depends on the instant: the first guess
|
|
138
|
+
* uses the offset at the naive UTC interpretation, the second corrects for a
|
|
139
|
+
* daylight-saving boundary crossed by that guess.
|
|
140
|
+
*
|
|
141
|
+
* Daylight-saving resolution, per the documented rule:
|
|
142
|
+
* - a clock time that does not exist resolves **forward** to the next valid instant;
|
|
143
|
+
* - a clock time that occurs twice resolves to its **first** occurrence, so
|
|
144
|
+
* exactly one notification results rather than two.
|
|
145
|
+
*/
|
|
146
|
+
function instantForParts(parts, timeZone) {
|
|
147
|
+
const naive = Date.UTC(parts.year, parts.month - 1, parts.day, parts.hour, parts.minute, parts.second);
|
|
148
|
+
let candidate = naive - offsetAt(naive, timeZone);
|
|
149
|
+
candidate = naive - offsetAt(candidate, timeZone);
|
|
150
|
+
const rendered = partsInZone(candidate, timeZone);
|
|
151
|
+
if (rendered.hour === parts.hour && rendered.minute === parts.minute) {
|
|
152
|
+
// Ambiguous readings (the repeated hour) land here on the first, earlier
|
|
153
|
+
// offset, which is the documented choice.
|
|
154
|
+
return candidate;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// The reading does not exist in this zone — a spring-forward gap. Step
|
|
158
|
+
// forward to the next instant that does exist rather than skipping the
|
|
159
|
+
// occurrence or failing.
|
|
160
|
+
const gapStep = 60 * 60 * 1000;
|
|
161
|
+
for (let attempt = 1; attempt <= 4; attempt += 1) {
|
|
162
|
+
const shifted = candidate + gapStep * attempt;
|
|
163
|
+
const shiftedParts = partsInZone(shifted, timeZone);
|
|
164
|
+
if (shiftedParts.day === parts.day || shiftedParts.hour > parts.hour) {
|
|
165
|
+
return shifted;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return candidate;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Resolves a caller-supplied moment into a firing instant.
|
|
172
|
+
*
|
|
173
|
+
* An absolute moment passes through untouched — that is the entire distinction.
|
|
174
|
+
*/
|
|
175
|
+
function anchorMoment(input, timeZone) {
|
|
176
|
+
const anchoring = input.anchoring ?? _notification.DEFAULT_ANCHORING_MODE;
|
|
177
|
+
if (anchoring === 'absolute') {
|
|
178
|
+
return {
|
|
179
|
+
resolvedAt: input.at,
|
|
180
|
+
anchoring
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
return {
|
|
184
|
+
resolvedAt: input.at,
|
|
185
|
+
anchoring,
|
|
186
|
+
generation: timeZone
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Computes what a zone change requires.
|
|
191
|
+
*
|
|
192
|
+
* Returns an empty plan when the zone has not moved, which is what makes
|
|
193
|
+
* re-anchoring idempotent: the no-change check costs one comparison per entry
|
|
194
|
+
* and issues zero platform operations.
|
|
195
|
+
*/
|
|
196
|
+
function planReAnchor(pending, currentZone) {
|
|
197
|
+
const rewrites = [];
|
|
198
|
+
const unreadableGeneration = [];
|
|
199
|
+
let fromZone;
|
|
200
|
+
for (const entry of pending) {
|
|
201
|
+
// Absolute-instant entries are never re-anchored, re-scheduled, or touched.
|
|
202
|
+
if (entry.anchoring === 'absolute') continue;
|
|
203
|
+
const generation = entry.anchoringGeneration;
|
|
204
|
+
if (generation === undefined || generation === currentZone) continue;
|
|
205
|
+
|
|
206
|
+
// A stored generation is data, and data can be wrong. Re-anchoring against
|
|
207
|
+
// a zone the runtime cannot read would move the entry to an arbitrary
|
|
208
|
+
// instant, which is worse than leaving it where it is and saying so.
|
|
209
|
+
if (!isValidTimeZone(generation)) {
|
|
210
|
+
unreadableGeneration.push(entry.id);
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
fromZone ??= generation;
|
|
214
|
+
|
|
215
|
+
// Preserve the clock reading the entry originally named, not the instant.
|
|
216
|
+
const originalParts = partsInZone(entry.resolvedAt, generation);
|
|
217
|
+
const resolvedAt = instantForParts(originalParts, currentZone);
|
|
218
|
+
if (resolvedAt !== entry.resolvedAt) {
|
|
219
|
+
rewrites.push({
|
|
220
|
+
entry,
|
|
221
|
+
resolvedAt
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
rewrites,
|
|
227
|
+
fromZone,
|
|
228
|
+
toZone: currentZone,
|
|
229
|
+
zoneChanged: rewrites.length > 0 || fromZone !== undefined,
|
|
230
|
+
unreadableGeneration
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* True when an entry was anchored against a zone the device has since left.
|
|
236
|
+
*
|
|
237
|
+
* This is the FR-007c condition: the entry will fire at its old instant, and a
|
|
238
|
+
* consumer can detect and explain that rather than being told nothing happened.
|
|
239
|
+
*/
|
|
240
|
+
function isStaleAnchor(entry, currentZone) {
|
|
241
|
+
return entry.anchoring === 'wallClock' && entry.anchoringGeneration !== undefined && entry.anchoringGeneration !== currentZone;
|
|
242
|
+
}
|
|
243
|
+
//# sourceMappingURL=anchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_rnCore","require","_notification","localizePeer","lazyPeer","cause","createPlatformTimeZoneReader","localize","get","ok","module","getTimeZone","Intl","DateTimeFormat","resolvedOptions","timeZone","isValidTimeZone","isZoneValid","PARTS_OPTIONS","year","month","day","hour","minute","second","hour12","partsInZone","instant","zone","formatter","getDateTimeFormat","fields","part","formatToParts","Date","type","Number","parseInt","value","offsetAt","parts","asUtc","UTC","Math","floor","instantForParts","naive","candidate","rendered","gapStep","attempt","shifted","shiftedParts","anchorMoment","input","anchoring","DEFAULT_ANCHORING_MODE","resolvedAt","at","generation","planReAnchor","pending","currentZone","rewrites","unreadableGeneration","fromZone","entry","anchoringGeneration","undefined","push","id","originalParts","toZone","zoneChanged","length","isStaleAnchor"],"sourceRoot":"../../../src","sources":["schedule/anchor.ts"],"mappings":";;;;;;;;;;;;AAkBA,IAAAA,OAAA,GAAAC,OAAA;AAOA,IAAAC,aAAA,GAAAD,OAAA;AAzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA;;AAGA,MAAME,YAAY,GAAG,IAAAC,gBAAQ,EAAC,uBAAuB,EAAE,MAAM;EAC5D;EACA,IAAI;IACH,OAAOH,OAAO,CAAC,uBAAuB,CAAC;EACxC,CAAC,CAAC,OAAOI,KAAK,EAAE;IACf,MAAMA,KAAK;EACZ;AACD,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,4BAA4BA,CAAA,EAAmB;EAC9D,OAAO,MAAM;IACZ,MAAMC,QAAQ,GAAGJ,YAAY,CAACK,GAAG,CAAC,CAAC;IACnC,IAAI;MACH,IAAID,QAAQ,CAACE,EAAE,EAAE,OAAOF,QAAQ,CAACG,MAAM,CAACC,WAAW,CAAC,CAAC;MACrD,OAAOC,IAAI,CAACC,cAAc,CAAC,CAAC,CAACC,eAAe,CAAC,CAAC,CAACC,QAAQ,IAAI,KAAK;IACjE,CAAC,CAAC,MAAM;MACP,IAAI;QACH,OAAOH,IAAI,CAACC,cAAc,CAAC,CAAC,CAACC,eAAe,CAAC,CAAC,CAACC,QAAQ,IAAI,KAAK;MACjE,CAAC,CAAC,MAAM;QACP,OAAO,KAAK;MACb;IACD;EACD,CAAC;AACF;;AAEA;;AAUA;AACA;AACA;AACA;AACA;AACA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C2C,UAAU,CAAC,EAAE;MACjCK,oBAAoB,CAACK,IAAI,CAACH,KAAK,CAACI,EAAE,CAAC;MACnC;IACD;IAEAL,QAAQ,KAAKN,UAAU;;IAEvB;IACA,MAAMY,aAAa,GAAG7C,WAAW,CAACwC,KAAK,CAACT,UAAU,EAAEE,UAAU,CAAC;IAC/D,MAAMF,UAAU,GAAGZ,eAAe,CAAC0B,aAAa,EAAET,WAAW,CAAC;IAE9D,IAAIL,UAAU,KAAKS,KAAK,CAACT,UAAU,EAAE;MACpCM,QAAQ,CAACM,IAAI,CAAC;QAAEH,KAAK;QAAET;MAAW,CAAC,CAAC;IACrC;EACD;EAEA,OAAO;IACNM,QAAQ;IACRE,QAAQ;IACRO,MAAM,EAAEV,WAAW;IACnBW,WAAW,EAAEV,QAAQ,CAACW,MAAM,GAAG,CAAC,IAAIT,QAAQ,KAAKG,SAAS;IAC1DJ;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,aAAaA,CAACT,KAAmB,EAAEJ,WAAmB,EAAW;EAChF,OACCI,KAAK,CAACX,SAAS,KAAK,WAAW,IAC/BW,KAAK,CAACC,mBAAmB,KAAKC,SAAS,IACvCF,KAAK,CAACC,mBAAmB,KAAKL,WAAW;AAE3C","ignoreList":[]}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createScheduler = createScheduler;
|
|
7
|
+
exports.validateRequest = validateRequest;
|
|
8
|
+
var _errors = require("../contract/errors.js");
|
|
9
|
+
var _interaction = require("../contract/interaction.js");
|
|
10
|
+
var _validateIdentifier = require("./validate-identifier.js");
|
|
11
|
+
var _validateContent = require("./validate-content.js");
|
|
12
|
+
var _resolveMoment = require("./resolve-moment.js");
|
|
13
|
+
var _anchor = require("./anchor.js");
|
|
14
|
+
var _partition = require("./partition.js");
|
|
15
|
+
var _writer = require("./writer.js");
|
|
16
|
+
/**
|
|
17
|
+
* The scheduling operations.
|
|
18
|
+
*
|
|
19
|
+
* Validation runs in a fixed order and completes entirely before any platform
|
|
20
|
+
* call: identifier, tags, content, moment shape, tone, actions, routing size.
|
|
21
|
+
* A caller therefore never sees a native-level error surface through the
|
|
22
|
+
* package, and a rejected request leaves the device untouched.
|
|
23
|
+
*
|
|
24
|
+
* Scheduling an identifier that already has a notification **replaces** it.
|
|
25
|
+
* That is the defined semantic rather than a side effect, which is what lets a
|
|
26
|
+
* caller stop tracking whether it has already scheduled something.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/** Validates a request completely, before the engine is touched at all. */
|
|
30
|
+
function validateRequest(request, resolveTone) {
|
|
31
|
+
(0, _validateIdentifier.validateIdentifier)(request.id, 'id');
|
|
32
|
+
(0, _validateIdentifier.validateOptionalTag)(request.ownerTag, 'ownerTag');
|
|
33
|
+
(0, _validateIdentifier.validateOptionalTag)(request.groupTag, 'groupTag');
|
|
34
|
+
(0, _validateContent.validateContent)(request.content);
|
|
35
|
+
(0, _resolveMoment.validateMoment)(request.moment);
|
|
36
|
+
const tone = resolveTone(request.tone);
|
|
37
|
+
if (tone === undefined) {
|
|
38
|
+
throw new _errors.NotificationError(_errors.DIAGNOSTIC_CODES.UNDECLARED_TONE, `Tone "${request.tone}" was never declared in the package configuration. Declare it before scheduling against it.`, {
|
|
39
|
+
toneId: request.tone
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (request.actions !== undefined) {
|
|
43
|
+
if (request.actions.length > _interaction.MAX_ACTIONS_PER_NOTIFICATION) {
|
|
44
|
+
throw new _errors.NotificationError(_errors.DIAGNOSTIC_CODES.TOO_MANY_ACTIONS, `A notification may carry at most ${_interaction.MAX_ACTIONS_PER_NOTIFICATION} actions; ${request.actions.length} were supplied.`, {
|
|
45
|
+
count: request.actions.length,
|
|
46
|
+
limit: _interaction.MAX_ACTIONS_PER_NOTIFICATION
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
for (const action of request.actions) {
|
|
50
|
+
(0, _validateIdentifier.validateIdentifier)(action.id, 'actionId');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (request.routing !== undefined) {
|
|
54
|
+
// Sized at schedule time rather than discovered as truncated at tap time,
|
|
55
|
+
// which is where an over-large payload would otherwise surface.
|
|
56
|
+
const size = (0, _validateContent.byteLength)(JSON.stringify(request.routing));
|
|
57
|
+
if (size > _interaction.MAX_ROUTING_PAYLOAD_BYTES) {
|
|
58
|
+
throw new _errors.NotificationError(_errors.DIAGNOSTIC_CODES.ROUTING_PAYLOAD_TOO_LARGE, `Routing payload is ${size} bytes, over the ${_interaction.MAX_ROUTING_PAYLOAD_BYTES}-byte limit.`, {
|
|
59
|
+
bytes: size,
|
|
60
|
+
limit: _interaction.MAX_ROUTING_PAYLOAD_BYTES
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return tone;
|
|
65
|
+
}
|
|
66
|
+
function createScheduler(deps) {
|
|
67
|
+
const emit = deps.emit ?? (() => {});
|
|
68
|
+
const writer = (0, _writer.createScheduleWriter)(deps.engine);
|
|
69
|
+
const scheduleOne = async (request, options = {}) => {
|
|
70
|
+
const tone = validateRequest(request, deps.resolveTone);
|
|
71
|
+
const zone = deps.timeZone();
|
|
72
|
+
const anchored = (0, _anchor.anchorMoment)(request.moment, zone);
|
|
73
|
+
const resolution = (0, _resolveMoment.resolveMoment)(anchored.resolvedAt, deps.now());
|
|
74
|
+
|
|
75
|
+
// Identifiers only where the engine can list them cheaply: reading every
|
|
76
|
+
// pending payload across the bridge just to answer "was this one already
|
|
77
|
+
// there" cost a full read per schedule (NOT-08).
|
|
78
|
+
const replaced = deps.engine.pendingIds ? (await deps.engine.pendingIds()).includes(request.id) : (await deps.engine.getPending()).some(entry => entry.id === request.id);
|
|
79
|
+
|
|
80
|
+
// Approximate mode is a degradation, not a refusal: the notification is
|
|
81
|
+
// still scheduled and the caller is told it may arrive late.
|
|
82
|
+
const approximate = !deps.canScheduleExactly();
|
|
83
|
+
if (approximate) {
|
|
84
|
+
emit(_errors.DIAGNOSTIC_CODES.EXACT_ALARM_UNAVAILABLE, 'Scheduled in approximate mode; delivery may be late.', {
|
|
85
|
+
id: request.id
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
await writer.write({
|
|
89
|
+
request,
|
|
90
|
+
resolvedAt: resolution.at,
|
|
91
|
+
tone,
|
|
92
|
+
// The zone this was anchored against, so `getPending` can report it and a
|
|
93
|
+
// consumer can detect a stale anchor (FR-007c). Absent for absolute
|
|
94
|
+
// moments, which are never anchored to a zone.
|
|
95
|
+
anchoringGeneration: anchored.generation,
|
|
96
|
+
approximate,
|
|
97
|
+
seriesId: options.seriesId,
|
|
98
|
+
pushCreated: options.pushCreated
|
|
99
|
+
});
|
|
100
|
+
return {
|
|
101
|
+
id: request.id,
|
|
102
|
+
resolvedAt: resolution.at,
|
|
103
|
+
anchoring: anchored.anchoring,
|
|
104
|
+
replaced,
|
|
105
|
+
deliveredImmediately: resolution.kind === 'immediate',
|
|
106
|
+
mayBeDelayed: approximate
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
schedule: scheduleOne,
|
|
111
|
+
async cancel(id) {
|
|
112
|
+
(0, _validateIdentifier.validateIdentifier)(id, 'id');
|
|
113
|
+
// A marker guarding a notification that no longer exists would fire
|
|
114
|
+
// against nothing. Harmless, but it holds platform capacity a real
|
|
115
|
+
// notification could use.
|
|
116
|
+
await writer.cancel(id);
|
|
117
|
+
},
|
|
118
|
+
async cancelByGroup(groupTag) {
|
|
119
|
+
(0, _validateIdentifier.validateIdentifier)(groupTag, 'groupTag');
|
|
120
|
+
const ids = (0, _partition.idsForTag)(await deps.engine.getPending(), 'group', groupTag);
|
|
121
|
+
await deps.engine.cancelMany(ids);
|
|
122
|
+
const pass = writer.pass();
|
|
123
|
+
for (const id of ids) await pass.releaseStop(id);
|
|
124
|
+
return ids;
|
|
125
|
+
},
|
|
126
|
+
async cancelByOwner(ownerTag) {
|
|
127
|
+
(0, _validateIdentifier.validateIdentifier)(ownerTag, 'ownerTag');
|
|
128
|
+
const ids = (0, _partition.idsForTag)(await deps.engine.getPending(), 'owner', ownerTag);
|
|
129
|
+
await deps.engine.cancelMany(ids);
|
|
130
|
+
const pass = writer.pass();
|
|
131
|
+
for (const id of ids) await pass.releaseStop(id);
|
|
132
|
+
return ids;
|
|
133
|
+
},
|
|
134
|
+
async cancelAll() {
|
|
135
|
+
await deps.engine.cancelAll();
|
|
136
|
+
},
|
|
137
|
+
async getPending() {
|
|
138
|
+
return deps.engine.getPending();
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_errors","require","_interaction","_validateIdentifier","_validateContent","_resolveMoment","_anchor","_partition","_writer","validateRequest","request","resolveTone","validateIdentifier","id","validateOptionalTag","ownerTag","groupTag","validateContent","content","validateMoment","moment","tone","undefined","NotificationError","DIAGNOSTIC_CODES","UNDECLARED_TONE","toneId","actions","length","MAX_ACTIONS_PER_NOTIFICATION","TOO_MANY_ACTIONS","count","limit","action","routing","size","byteLength","JSON","stringify","MAX_ROUTING_PAYLOAD_BYTES","ROUTING_PAYLOAD_TOO_LARGE","bytes","createScheduler","deps","emit","writer","createScheduleWriter","engine","scheduleOne","options","zone","timeZone","anchored","anchorMoment","resolution","resolveMoment","resolvedAt","now","replaced","pendingIds","includes","getPending","some","entry","approximate","canScheduleExactly","EXACT_ALARM_UNAVAILABLE","write","at","anchoringGeneration","generation","seriesId","pushCreated","anchoring","deliveredImmediately","kind","mayBeDelayed","schedule","cancel","cancelByGroup","ids","idsForTag","cancelMany","pass","releaseStop","cancelByOwner","cancelAll"],"sourceRoot":"../../../src","sources":["schedule/index.ts"],"mappings":";;;;;;;AAgBA,IAAAA,OAAA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+1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.idsForTag = idsForTag;
|
|
7
|
+
exports.partition = partition;
|
|
8
|
+
exports.selectByTag = selectByTag;
|
|
9
|
+
/**
|
|
10
|
+
* Owner-tag and group-tag partitioning.
|
|
11
|
+
*
|
|
12
|
+
* A tag is an opaque label the caller supplies and the package never
|
|
13
|
+
* interprets. That is deliberate: modelling identity would mean acquiring an
|
|
14
|
+
* opinion about it, and this package is forbidden from knowing anything about
|
|
15
|
+
* accounts, tenants, or users.
|
|
16
|
+
*
|
|
17
|
+
* What the tag buys is one call — "clear this account's notifications" — on a
|
|
18
|
+
* shared device, without the package ever learning what an account is.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** Selects entries carrying a tag. Comparison is exact; nothing is normalized. */
|
|
22
|
+
function selectByTag(entries, kind, tag) {
|
|
23
|
+
return entries.filter(entry => kind === 'owner' ? entry.ownerTag === tag : entry.groupTag === tag);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Identifiers to cancel for a tag. */
|
|
27
|
+
function idsForTag(entries, kind, tag) {
|
|
28
|
+
return selectByTag(entries, kind, tag).map(entry => entry.id);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Groups entries by a tag, keeping untagged entries under a distinct bucket.
|
|
33
|
+
*
|
|
34
|
+
* Untagged is not the same as any tag: an entry with no owner belongs to no
|
|
35
|
+
* account, and folding it into one would make a sign-out delete notifications
|
|
36
|
+
* that were never that account's.
|
|
37
|
+
*/
|
|
38
|
+
function partition(entries, kind) {
|
|
39
|
+
const tagged = new Map();
|
|
40
|
+
const untagged = [];
|
|
41
|
+
for (const entry of entries) {
|
|
42
|
+
const tag = kind === 'owner' ? entry.ownerTag : entry.groupTag;
|
|
43
|
+
if (tag === undefined) {
|
|
44
|
+
untagged.push(entry);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const bucket = tagged.get(tag);
|
|
48
|
+
if (bucket === undefined) {
|
|
49
|
+
tagged.set(tag, [entry]);
|
|
50
|
+
} else {
|
|
51
|
+
bucket.push(entry);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
tagged,
|
|
56
|
+
untagged
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=partition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["selectByTag","entries","kind","tag","filter","entry","ownerTag","groupTag","idsForTag","map","id","partition","tagged","Map","untagged","undefined","push","bucket","get","set"],"sourceRoot":"../../../src","sources":["schedule/partition.ts"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACO,SAASA,WAAWA,CAC1BC,OAAgC,EAChCC,IAAmB,EACnBC,GAAW,EACe;EAC1B,OAAOF,OAAO,CAACG,MAAM,CAACC,KAAK,IAC1BH,IAAI,KAAK,OAAO,GAAGG,KAAK,CAACC,QAAQ,KAAKH,GAAG,GAAGE,KAAK,CAACE,QAAQ,KAAKJ,GAChE,CAAC;AACF;;AAEA;AACO,SAASK,SAASA,CACxBP,OAAgC,EAChCC,IAAmB,EACnBC,GAAW,EACS;EACpB,OAAOH,WAAW,CAACC,OAAO,EAAEC,IAAI,EAAEC,GAAG,CAAC,CAACM,GAAG,CAACJ,KAAK,IAAIA,KAAK,CAACK,EAAE,CAAC;AAC9D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,SAASA,CACxBV,OAAgC,EAChCC,IAAmB,EAIlB;EACD,MAAMU,MAAM,GAAG,IAAIC,GAAG,CAAyB,CAAC;EAChD,MAAMC,QAAwB,GAAG,EAAE;EAEnC,KAAK,MAAMT,KAAK,IAAIJ,OAAO,EAAE;IAC5B,MAAME,GAAG,GAAGD,IAAI,KA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