@chipmobilesdk/rn-notification 0.5.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 +184 -0
- package/README.md +108 -16
- 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 +74 -23
- package/skills/sdk-rn-notification/SKILL.md +6 -5
- package/src/advanced.ts +35 -0
- package/src/channel/migrate.ts +176 -158
- package/src/channel/tone-map.ts +2 -10
- package/src/contract/errors.ts +7 -0
- package/src/contract/hash.ts +26 -0
- package/src/engine/adapter.ts +21 -1
- package/src/engine/notify-kit/events.ts +155 -0
- package/src/engine/notify-kit/module.ts +148 -0
- package/src/engine/notify-kit/platform/android.ts +172 -0
- package/src/engine/notify-kit/platform/index.ts +55 -0
- package/src/engine/notify-kit/platform/ios.ts +54 -0
- package/src/engine/notify-kit/platform/types.ts +40 -0
- package/src/engine/notify-kit-engine.ts +96 -477
- package/src/index.ts +9 -0
- package/src/notifications.ts +195 -0
- package/src/permission/index.ts +65 -4
- package/src/push/fcm-provider.ts +14 -4
- package/src/push/gate.ts +27 -5
- package/src/reconcile/diff.ts +38 -27
- package/src/reconcile/index.ts +13 -4
- package/src/recurrence/index.ts +2 -1
- package/src/repeat/expiry.ts +2 -6
- package/src/repeat/index.ts +45 -1
- package/src/repeat/marker.ts +1 -22
- package/src/repeat/place.ts +74 -35
- package/src/schedule/index.ts +10 -4
- package/src/schedule/partition.ts +0 -19
- package/src/schedule/validate-identifier.ts +8 -6
- package/src/schedule/writer.ts +13 -4
- package/src/state/caps.ts +28 -3
- package/src/state/permission-history.ts +25 -0
- package/src/state/record.ts +110 -20
- package/src/testing/fake-engine.ts +17 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @chipmobilesdk/rn-notification
|
|
5
|
+
*
|
|
6
|
+
* Default entrypoint: scheduling, recurrence, reconciliation, permissions,
|
|
7
|
+
* channels, interaction, and diagnostics.
|
|
8
|
+
*
|
|
9
|
+
* Push lives behind `@chipmobilesdk/rn-notification/push` so an app that never
|
|
10
|
+
* enables it ships no provider code, no push permissions, and no entitlements.
|
|
11
|
+
* Test doubles live behind `@chipmobilesdk/rn-notification/testing` so they
|
|
12
|
+
* never reach a production bundle.
|
|
13
|
+
*
|
|
14
|
+
* No engine, provider, or storage type is reachable from here — that is what
|
|
15
|
+
* makes each of them replaceable.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export { DEFAULT_ANCHORING_MODE, DEFAULT_LOOKAHEAD, REPEAT_ALERT_BOUNDS, LOOKAHEAD_BOUNDS, INTERACTION_BUFFER_LIMITS, MAX_ROUTING_PAYLOAD_BYTES, MAX_ACTIONS_PER_NOTIFICATION, DEFAULT_BURST_THRESHOLD, DIAGNOSTIC_CODES, ALL_DIAGNOSTIC_CODES, NotificationError, isNotificationError, isNonFailure } from "./contract/index.js";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The engine port. Exported so a consuming app can supply its own engine, which
|
|
22
|
+
* is the mechanism behind provider and engine substitution.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/** The default engine. Consumers may substitute their own via the port above. */
|
|
26
|
+
export { createNotifyKitEngine } from "./engine/notify-kit-engine.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The whole package, assembled (0.6.0): scheduler, reconciler, recurrence,
|
|
30
|
+
* permissions, channels, interactions, snapshot and maintenance, wired the way the
|
|
31
|
+
* package means them to be. Start here; the factories below are for an app that
|
|
32
|
+
* needs a different wiring, and are also exported from `./advanced`.
|
|
33
|
+
*/
|
|
34
|
+
export { createNotifications } from "./notifications.js";
|
|
35
|
+
/** Initialization and the assembled runtime. */
|
|
36
|
+
export { initialize } from "./initialize.js";
|
|
37
|
+
/** Scheduling operations. */
|
|
38
|
+
export { createScheduler } from "./schedule/index.js";
|
|
39
|
+
/** Reconciliation — always consumer-invoked, never automatic. */
|
|
40
|
+
export { createReconciler } from "./reconcile/index.js";
|
|
41
|
+
/** Recurrence — declare a rule once; the package maintains a bounded window. */
|
|
42
|
+
export { createRecurrence } from "./recurrence/index.js";
|
|
43
|
+
export { occurrenceId } from "./recurrence/expand.js";
|
|
44
|
+
|
|
45
|
+
/** Channels and tones — declared once, mapped to each platform, migrated on change. */
|
|
46
|
+
export { createChannels } from "./channel/migrate.js";
|
|
47
|
+
export { channelIdFor, createToneResolver, parseChannelId, resolveTone } from "./channel/tone-map.js";
|
|
48
|
+
export { validateToneDeclaration, validateToneDeclarations } from "./channel/validate-tone.js";
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Repeat expiry — what bounds an alert that repeats until it is handled.
|
|
52
|
+
*
|
|
53
|
+
* `registerBackgroundNotificationHandler` is the one piece a consumer wires up
|
|
54
|
+
* themselves, at module scope in `index.js`. An app that declares no repeating
|
|
55
|
+
* tone needs none of this.
|
|
56
|
+
*/
|
|
57
|
+
export { createRepeatExpiryHandler, registerBackgroundNotificationHandler, REPEAT_STOP_PREFIX } from "./repeat/index.js";
|
|
58
|
+
/** Interaction routing — one handler for foreground, background, and cold start. */
|
|
59
|
+
export { createInteractions } from "./interaction/index.js";
|
|
60
|
+
/** Observability — snapshot and burst detection. */
|
|
61
|
+
export { createSnapshot } from "./diagnostics/snapshot.js";
|
|
62
|
+
export { createBurstDetector } from "./diagnostics/burst.js";
|
|
63
|
+
export { DiagnosticEmitter } from "./diagnostics/events.js";
|
|
64
|
+
|
|
65
|
+
/** Permission coordination — reading never prompts; a refusal never fails the caller. */
|
|
66
|
+
export { createPermissions } from "./permission/index.js";
|
|
67
|
+
export { canDisplay, capabilityFor, isTerminal, shouldOfferSettings } from "./permission/state.js";
|
|
68
|
+
/** Maintenance steps, registered with the runtime's registry. */
|
|
69
|
+
export { createPermissionRefreshStep } from "./maintenance/permission-refresh.js";
|
|
70
|
+
export { createReAnchorStep } from "./maintenance/reanchor.js";
|
|
71
|
+
export { createVerifyStep } from "./maintenance/verify.js";
|
|
72
|
+
export { createWindowRefreshStep } from "./maintenance/window-refresh.js";
|
|
73
|
+
export { MaintenanceRegistry, MaintenanceScopeViolation } from "./maintenance/cycle.js";
|
|
74
|
+
export { MaintenanceController } from "./maintenance/toggle.js";
|
|
75
|
+
|
|
76
|
+
/** Public state controls — the only two ways a consumer may touch persisted state. */
|
|
77
|
+
export { resetState, clearOwner } from "./state/reset.js";
|
|
78
|
+
/**
|
|
79
|
+
* State plumbing. The record's *schema* stays private — a consumer can create
|
|
80
|
+
* and reset the store, but has no way to read or write what is inside it.
|
|
81
|
+
*/
|
|
82
|
+
export { createMmkvStore } from "./state/mmkv-store.js";
|
|
83
|
+
export { StateManager } from "./state/record.js";
|
|
84
|
+
/** Documented limits, exported so a consumer can validate before calling. */
|
|
85
|
+
export { MAX_IDENTIFIER_LENGTH } from "./schedule/validate-identifier.js";
|
|
86
|
+
export { CONTENT_LIMITS } from "./schedule/validate-content.js";
|
|
87
|
+
export { PAST_TOLERANCE_MS } from "./schedule/resolve-moment.js";
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Reads the platform time zone, which anchoring depends on.
|
|
91
|
+
*
|
|
92
|
+
* Exported because every consumer needs it and pure JavaScript cannot provide
|
|
93
|
+
* it reliably — `Intl.DateTimeFormat().resolvedOptions().timeZone` does not
|
|
94
|
+
* update when the device zone changes. Leaving consumers to write this
|
|
95
|
+
* themselves is how a subtly wrong version ends up in each of them.
|
|
96
|
+
*/
|
|
97
|
+
export { createPlatformTimeZoneReader, isValidTimeZone } from "./schedule/anchor.js";
|
|
98
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DEFAULT_ANCHORING_MODE","DEFAULT_LOOKAHEAD","REPEAT_ALERT_BOUNDS","LOOKAHEAD_BOUNDS","INTERACTION_BUFFER_LIMITS","MAX_ROUTING_PAYLOAD_BYTES","MAX_ACTIONS_PER_NOTIFICATION","DEFAULT_BURST_THRESHOLD","DIAGNOSTIC_CODES","ALL_DIAGNOSTIC_CODES","NotificationError","isNotificationError","isNonFailure","createNotifyKitEngine","createNotifications","initialize","createScheduler","createReconciler","createRecurrence","occurrenceId","createChannels","channelIdFor","createToneResolver","parseChannelId","resolveTone","validateToneDeclaration","validateToneDeclarations","createRepeatExpiryHandler","registerBackgroundNotificationHandler","REPEAT_STOP_PREFIX","createInteractions","createSnapshot","createBurstDetector","DiagnosticEmitter","createPermissions","canDisplay","capabilityFor","isTerminal","shouldOfferSettings","createPermissionRefreshStep","createReAnchorStep","createVerifyStep","createWindowRefreshStep","MaintenanceRegistry","MaintenanceScopeViolation","MaintenanceController","resetState","clearOwner","createMmkvStore","StateManager","MAX_IDENTIFIER_LENGTH","CONTENT_LIMITS","PAST_TOLERANCE_MS","createPlatformTimeZoneReader","isValidTimeZone"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmEA,SACCA,sBAAsB,EACtBC,iBAAiB,EACjBC,mBAAmB,EACnBC,gBAAgB,EAChBC,yBAAyB,EACzBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,uBAAuB,EACvBC,gBAAgB,EAChBC,oBAAoB,EACpBC,iBAAiB,EACjBC,mBAAmB,EACnBC,YAAY,QACN,qBAAY;;AAInB;AACA;AACA;AACA;;AAUA;AACA,SAASC,qBAAqB,QAAQ,+BAA4B;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,oBAAiB;AAGrD;AACA,SAASC,UAAU,QAAQ,iBAAc;AAGzC;AACA,SAASC,eAAe,QAAQ,qBAAY;AAG5C;AACA,SAASC,gBAAgB,QAAQ,sBAAa;AAG9C;AACA,SAASC,gBAAgB,QAAQ,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2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Package initialization.
|
|
5
|
+
*
|
|
6
|
+
* Composes the parts that must be in place before the first schedule call:
|
|
7
|
+
* validate configuration, load persisted state, apply tone declarations, run
|
|
8
|
+
* any pending channel migration, and start the maintenance registry.
|
|
9
|
+
*
|
|
10
|
+
* Budgeted at 100 ms of app startup, which is why state loading is synchronous
|
|
11
|
+
* and tone declaration is the only platform round-trip.
|
|
12
|
+
*
|
|
13
|
+
* Automatic maintenance is started here too: whatever steps are registered on
|
|
14
|
+
* `runtime.registry` run when the app returns to the foreground, with the
|
|
15
|
+
* trigger reported as `timeZoneChange` when the device zone moved meanwhile.
|
|
16
|
+
* Until 0.4.0 nothing ever called `runAutomatic`, so "automatic" maintenance
|
|
17
|
+
* only ran when the app invoked it by hand.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { appLifecycle } from '@chipmobilesdk/rn-core';
|
|
21
|
+
import { DEFAULT_LOOKAHEAD, LOOKAHEAD_BOUNDS } from "./contract/recurrence.js";
|
|
22
|
+
import { DIAGNOSTIC_CODES, NotificationError } from "./contract/errors.js";
|
|
23
|
+
import { DiagnosticEmitter } from "./diagnostics/events.js";
|
|
24
|
+
import { MaintenanceRegistry } from "./maintenance/cycle.js";
|
|
25
|
+
import { MaintenanceController } from "./maintenance/toggle.js";
|
|
26
|
+
import { StateManager } from "./state/record.js";
|
|
27
|
+
import { ownedIdentifiers } from "./state/series-ledger.js";
|
|
28
|
+
import { createChannels } from "./channel/migrate.js";
|
|
29
|
+
import { createPlatformTimeZoneReader } from "./schedule/anchor.js";
|
|
30
|
+
|
|
31
|
+
/** The slice of React Native's `AppState` the lifecycle observer uses. */
|
|
32
|
+
|
|
33
|
+
/** rn-core's shared lifecycle port in the observer's shape: one native subscription for every package (PERF-07). */
|
|
34
|
+
const sharedLifecycle = {
|
|
35
|
+
addEventListener: (_type, listener) => ({
|
|
36
|
+
remove: appLifecycle().subscribe(state => listener(state))
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Everything assembled at initialization, shared by the operation modules. */
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Clamps the lookahead into its documented bounds.
|
|
44
|
+
*
|
|
45
|
+
* Bounded on adjustment because the platform ceiling is not negotiable: a
|
|
46
|
+
* consumer asking for a five-year window would silently exhaust the 64-entry
|
|
47
|
+
* iOS ceiling on the first frequent series.
|
|
48
|
+
*/
|
|
49
|
+
export function resolveLookahead(partial) {
|
|
50
|
+
const days = partial?.days ?? DEFAULT_LOOKAHEAD.days;
|
|
51
|
+
const occurrencesPerSeries = partial?.occurrencesPerSeries ?? DEFAULT_LOOKAHEAD.occurrencesPerSeries;
|
|
52
|
+
return {
|
|
53
|
+
days: Math.min(Math.max(days, LOOKAHEAD_BOUNDS.minDays), LOOKAHEAD_BOUNDS.maxDays),
|
|
54
|
+
occurrencesPerSeries: Math.min(Math.max(occurrencesPerSeries, LOOKAHEAD_BOUNDS.minOccurrences), LOOKAHEAD_BOUNDS.maxOccurrences)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Fails before any platform call, so a bad configuration never half-applies. */
|
|
59
|
+
export function validateConfig(config) {
|
|
60
|
+
if (config.tones.length === 0) {
|
|
61
|
+
throw new NotificationError(DIAGNOSTIC_CODES.UNDECLARED_TONE, 'At least one tone must be declared before notifications can be scheduled.');
|
|
62
|
+
}
|
|
63
|
+
const seen = new Set();
|
|
64
|
+
for (const tone of config.tones) {
|
|
65
|
+
if (seen.has(tone.id)) {
|
|
66
|
+
throw new NotificationError(DIAGNOSTIC_CODES.UNDECLARED_TONE, `Tone "${tone.id}" is declared more than once.`, {
|
|
67
|
+
toneId: tone.id
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
seen.add(tone.id);
|
|
71
|
+
if (!Number.isInteger(tone.version) || tone.version < 1) {
|
|
72
|
+
throw new NotificationError(DIAGNOSTIC_CODES.CHANNEL_MIGRATION_REQUIRED, `Tone "${tone.id}" must carry an integer version of 1 or greater, because a channel configuration change is a migration rather than an assignment.`, {
|
|
73
|
+
toneId: tone.id,
|
|
74
|
+
version: tone.version
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const groupIds = new Set((config.channelGroups ?? []).map(group => group.id));
|
|
79
|
+
for (const tone of config.tones) {
|
|
80
|
+
if (tone.groupId !== undefined && !groupIds.has(tone.groupId)) {
|
|
81
|
+
throw new NotificationError(DIAGNOSTIC_CODES.UNDECLARED_TONE, `Tone "${tone.id}" references undeclared channel group "${tone.groupId}".`, {
|
|
82
|
+
toneId: tone.id,
|
|
83
|
+
groupId: tone.groupId
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export async function initialize(config, deps) {
|
|
89
|
+
const now = deps.now ?? (() => Date.now());
|
|
90
|
+
const startedAt = now();
|
|
91
|
+
validateConfig(config);
|
|
92
|
+
const emitter = new DiagnosticEmitter({
|
|
93
|
+
sink: config.eventSink,
|
|
94
|
+
verbose: config.verboseDiagnostics,
|
|
95
|
+
now
|
|
96
|
+
});
|
|
97
|
+
const state = new StateManager({
|
|
98
|
+
store: deps.store,
|
|
99
|
+
now,
|
|
100
|
+
emit: event => emitter.emit(event.code, describeStateEvent(event.code), event.context)
|
|
101
|
+
});
|
|
102
|
+
const channels = createChannels({
|
|
103
|
+
engine: deps.engine,
|
|
104
|
+
state,
|
|
105
|
+
now,
|
|
106
|
+
// The channel module emits only DIAGNOSTIC_CODES values; its port types the
|
|
107
|
+
// code as a string so it stays usable without the emitter.
|
|
108
|
+
emit: (code, message, context) => emitter.emit(code, message, context)
|
|
109
|
+
});
|
|
110
|
+
// Declares groups and tones, and runs any version migration. An unchanged
|
|
111
|
+
// configuration costs no platform work, so doing this on every launch is free.
|
|
112
|
+
const applied = await channels.apply(config.tones, config.channelGroups ?? []);
|
|
113
|
+
const registry = new MaintenanceRegistry({
|
|
114
|
+
clock: now
|
|
115
|
+
});
|
|
116
|
+
const maintenance = new MaintenanceController({
|
|
117
|
+
registry,
|
|
118
|
+
now,
|
|
119
|
+
// Occurrence identifiers, not series identifiers. Maintenance cancels
|
|
120
|
+
// occurrences, so a set of series ids made every legitimate cancel look
|
|
121
|
+
// like a scope violation.
|
|
122
|
+
ownedIds: async () => ownedIdentifiers(state, (await deps.engine.getPending()).map(entry => entry.id)),
|
|
123
|
+
enabled: config.automaticMaintenance ?? true
|
|
124
|
+
});
|
|
125
|
+
const timeZone = deps.timeZone ?? createPlatformTimeZoneReader();
|
|
126
|
+
let lastZone = timeZone();
|
|
127
|
+
let lastAutomatic;
|
|
128
|
+
const onAppState = next => {
|
|
129
|
+
if (next !== 'active') return;
|
|
130
|
+
const zone = timeZone();
|
|
131
|
+
const trigger = zone !== lastZone ? 'timeZoneChange' : 'foreground';
|
|
132
|
+
lastZone = zone;
|
|
133
|
+
maintenance.runAutomatic(trigger).then(result => {
|
|
134
|
+
if (result !== undefined) lastAutomatic = result;
|
|
135
|
+
}, error => {
|
|
136
|
+
// Nothing awaits an automatic cycle, so a failure is reported here or
|
|
137
|
+
// not at all.
|
|
138
|
+
emitter.emit(DIAGNOSTIC_CODES.MAINTENANCE_FAILED, `Automatic maintenance (${trigger}) failed: ${error instanceof Error ? error.name : 'unknown error'}.`, {
|
|
139
|
+
trigger
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
const subscription = (deps.appState ?? sharedLifecycle).addEventListener('change', onAppState);
|
|
144
|
+
const runtime = {
|
|
145
|
+
engine: deps.engine,
|
|
146
|
+
state,
|
|
147
|
+
emitter,
|
|
148
|
+
registry,
|
|
149
|
+
maintenance,
|
|
150
|
+
channels,
|
|
151
|
+
lookahead: resolveLookahead(config.lookahead),
|
|
152
|
+
config,
|
|
153
|
+
now,
|
|
154
|
+
lastAutomaticMaintenance: () => lastAutomatic,
|
|
155
|
+
dispose: () => subscription.remove()
|
|
156
|
+
};
|
|
157
|
+
return {
|
|
158
|
+
runtime,
|
|
159
|
+
result: {
|
|
160
|
+
tonesApplied: config.tones.length,
|
|
161
|
+
migrationsRun: applied.migrated.length,
|
|
162
|
+
stateRebuilt: state.health().rebuilt,
|
|
163
|
+
automaticMaintenance: maintenance.isEnabled,
|
|
164
|
+
durationMs: now() - startedAt
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function describeStateEvent(code) {
|
|
169
|
+
switch (code) {
|
|
170
|
+
case DIAGNOSTIC_CODES.STATE_CORRUPT_REBUILT:
|
|
171
|
+
return 'Persisted state was unreadable and has been rebuilt. Deduplication history and buffered interactions from before the loss are gone; scheduled notifications are unaffected.';
|
|
172
|
+
case DIAGNOSTIC_CODES.STATE_WRITE_FAILED:
|
|
173
|
+
return 'Persisted state could not be written. The affected guarantee degrades to this session only.';
|
|
174
|
+
case DIAGNOSTIC_CODES.STATE_CAP_EVICTED:
|
|
175
|
+
return 'A persisted collection reached its cap and the oldest entries were evicted.';
|
|
176
|
+
case DIAGNOSTIC_CODES.INTERACTION_BUFFER_EVICTED:
|
|
177
|
+
return 'Buffered interactions were evicted at the cap or retention limit.';
|
|
178
|
+
default:
|
|
179
|
+
return 'Persisted state event.';
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=initialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["appLifecycle","DEFAULT_LOOKAHEAD","LOOKAHEAD_BOUNDS","DIAGNOSTIC_CODES","NotificationError","DiagnosticEmitter","MaintenanceRegistry","MaintenanceController","StateManager","ownedIdentifiers","createChannels","createPlatformTimeZoneReader","sharedLifecycle","addEventListener","_type","listener","remove","subscribe","state","resolveLookahead","partial","days","occurrencesPerSeries","Math","min","max","minDays","maxDays","minOccurrences","maxOccurrences","validateConfig","config","tones","length","UNDECLARED_TONE","seen","Set","tone","has","id","toneId","add","Number","isInteger","version","CHANNEL_MIGRATION_REQUIRED","groupIds","channelGroups","map","group","groupId","undefined","initialize","deps","now","Date","startedAt","emitter","sink","eventSink","verbose","verboseDiagnostics","store","emit","event","code","describeStateEvent","context","channels","engine","message","applied","apply","registry","clock","maintenance","ownedIds","getPending","entry","enabled","automaticMaintenance","timeZone","lastZone","lastAutomatic","onAppState","next","zone","trigger","runAutomatic","then","result","error","MAINTENANCE_FAILED","Error","name","subscription","appState","runtime","lookahead","lastAutomaticMaintenance","dispose","tonesApplied","migrationsRun","migrated","stateRebuilt","health","rebuilt","isEnabled","durationMs","STATE_CORRUPT_REBUILT","STATE_WRITE_FAILED","STATE_CAP_EVICTED","INTERACTION_BUFFER_EVICTED"],"sourceRoot":"../../src","sources":["initialize.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,QAAQ,wBAAwB;AAErD,SAASC,iBAAiB,EAAEC,gBAAgB,QAA8B,0BAAuB;AAEjG,SAASC,gBAAgB,EAAEC,iBAAiB,QAA6B,sBAAmB;AAC5F,SAASC,iBAAiB,QAAQ,yBAAsB;AACxD,SAASC,mBAAmB,QAAQ,wBAAqB;AACzD,SAASC,qBAAqB,QAAQ,yBAAsB;AAC5D,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,gBAAgB,QAAQ,0BAAuB;AAGxD,SAASC,cAAc,QAAuB,sBAAmB;AACjE,SAASC,4BAA4B,QAA6B,sBAAmB;;AAErF;;AAKA;AACA,MAAMC,eAA+B,GAAG;EACvCC,gBAAgB,EAAEA,CAACC,KAAK,EAAEC,QAAQ,MAAM;IACvCC,MAAM,EAAEhB,YAAY,CAAC,CAAC,CAACiB,SAAS,CAACC,KAAK,IAAIH,QAAQ,CAACG,KAAK,CAAC;EAC1D,CAAC;AACF,CAAC;;AAYD;;AAkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,OAA6C,EAAmB;EAChG,M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EtD,GAAG,CAAC,CAAC,GAAGE;IACrB;EACD,CAAC;AACF;AAEA,SAASU,kBAAkBA,CAACD,IAAY,EAAU;EACjD,QAAQA,IAAI;IACX,KAAK9D,gBAAgB,CAAC0G,qBAAqB;MAC1C,OAAO,6KAA6K;IACrL,KAAK1G,gBAAgB,CAAC2G,kBAAkB;MACvC,OAAO,6FAA6F;IACrG,KAAK3G,gBAAgB,CAAC4G,iBAAiB;MACtC,OAAO,6EAA6E;IACrF,KAAK5G,gBAAgB,CAAC6G,0BAA0B;MAC/C,OAAO,mEAAmE;IAC3E;MACC,OAAO,wBAAwB;EACjC;AACD","ignoreList":[]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Interaction routing.
|
|
5
|
+
*
|
|
6
|
+
* One handler covers foreground, background, and cold start. The hard case is
|
|
7
|
+
* the last one: the tap happens before any JavaScript exists to receive it, so
|
|
8
|
+
* the event has to wait — durably — until a handler registers.
|
|
9
|
+
*
|
|
10
|
+
* Events are delivered in occurrence order and never dropped for want of a
|
|
11
|
+
* listener. After delivery the notification leaves the tray, because a
|
|
12
|
+
* notification the user has already acted on sitting there is noise.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { DIAGNOSTIC_CODES } from "../contract/errors.js";
|
|
16
|
+
import { buffer, bufferedCount, drain } from "../state/interaction-buffer.js";
|
|
17
|
+
export function createInteractions(deps) {
|
|
18
|
+
const emit = deps.emit ?? (() => {});
|
|
19
|
+
let handlers = [];
|
|
20
|
+
let engineSubscription;
|
|
21
|
+
/** Serializes delivery so rapid interactions arrive in order, never interleaved. */
|
|
22
|
+
let deliveryChain = Promise.resolve();
|
|
23
|
+
const deliver = event => {
|
|
24
|
+
deliveryChain = deliveryChain.then(async () => {
|
|
25
|
+
for (const handler of handlers) {
|
|
26
|
+
try {
|
|
27
|
+
await handler(event);
|
|
28
|
+
} catch {
|
|
29
|
+
// A consumer's handler failing must not stop the next event, or one
|
|
30
|
+
// bad tap would silently swallow every tap after it.
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Acted on, so it leaves the tray and stops making noise.
|
|
35
|
+
if (event.kind !== 'dismiss') {
|
|
36
|
+
await deps.engine.cancel(event.notificationId).catch(() => undefined);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const route = event => {
|
|
41
|
+
if (handlers.length === 0) {
|
|
42
|
+
buffer(deps.state, event);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
deliver(event);
|
|
46
|
+
};
|
|
47
|
+
const ensureSubscribed = () => {
|
|
48
|
+
engineSubscription ??= deps.engine.subscribeToInteractions(route);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Subscribing immediately rather than on first handler registration: an
|
|
52
|
+
// interaction arriving in the gap would otherwise be lost entirely, which is
|
|
53
|
+
// the exact failure the buffer exists to prevent.
|
|
54
|
+
ensureSubscribed();
|
|
55
|
+
return {
|
|
56
|
+
/**
|
|
57
|
+
* Registers a handler and immediately drains anything that was waiting.
|
|
58
|
+
*
|
|
59
|
+
* The drain is what makes a cold-start tap work: the event was persisted
|
|
60
|
+
* before this handler existed, possibly before this process existed.
|
|
61
|
+
*/
|
|
62
|
+
onInteraction(handler) {
|
|
63
|
+
handlers.push(handler);
|
|
64
|
+
for (const event of drain(deps.state)) {
|
|
65
|
+
deliver(event);
|
|
66
|
+
}
|
|
67
|
+
return () => {
|
|
68
|
+
handlers = handlers.filter(h => h !== handler);
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Collects the interaction that launched the app, if any.
|
|
73
|
+
*
|
|
74
|
+
* Called once during startup. If no handler exists yet the event is
|
|
75
|
+
* buffered rather than discarded.
|
|
76
|
+
*/
|
|
77
|
+
async collectInitial() {
|
|
78
|
+
const initial = await deps.engine.takeInitialInteraction();
|
|
79
|
+
if (initial === undefined) return;
|
|
80
|
+
route(initial);
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* Signals that a routing target no longer exists.
|
|
84
|
+
*
|
|
85
|
+
* The consumer chooses its own fallback screen. No platform error is ever
|
|
86
|
+
* shown to the user for this — a notification pointing at deleted data is
|
|
87
|
+
* an ordinary condition, not a crash.
|
|
88
|
+
*/
|
|
89
|
+
reportTargetMissing(signal) {
|
|
90
|
+
emit(DIAGNOSTIC_CODES.TARGET_MISSING, 'The routing target no longer exists. The consumer chooses a fallback; no platform error is shown to the user.', {
|
|
91
|
+
notificationId: signal.notificationId
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
/** Reports that a background action exceeded the platform's execution window. */
|
|
95
|
+
reportBackgroundTimeout(notificationId, windowMs) {
|
|
96
|
+
emit(DIAGNOSTIC_CODES.BACKGROUND_WINDOW_EXCEEDED, `A background action exceeded the platform's ${windowMs} ms execution window and was cut short.`, {
|
|
97
|
+
notificationId,
|
|
98
|
+
windowMs
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
/** How many interactions are waiting for a handler. */
|
|
102
|
+
pendingCount() {
|
|
103
|
+
return bufferedCount(deps.state);
|
|
104
|
+
},
|
|
105
|
+
/** Settles outstanding deliveries. Exists for tests and orderly shutdown. */
|
|
106
|
+
async flush() {
|
|
107
|
+
await deliveryChain;
|
|
108
|
+
},
|
|
109
|
+
dispose() {
|
|
110
|
+
engineSubscription?.();
|
|
111
|
+
engineSubscription = undefined;
|
|
112
|
+
handlers = [];
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DIAGNOSTIC_CODES","buffer","bufferedCount","drain","createInteractions","deps","emit","handlers","engineSubscription","deliveryChain","Promise","resolve","deliver","event","then","handler","kind","engine","cancel","notificationId","catch","undefined","route","length","state","ensureSubscribed","subscribeToInteractions","onInteraction","push","filter","h","collectInitial","initial","takeInitialInteraction","reportTargetMissing","signal","TARGET_MISSING","reportBackgroundTimeout","windowMs","BACKGROUND_WINDOW_EXCEEDED","pendingCount","flush","dispose"],"sourceRoot":"../../../src","sources":["interaction/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SAASA,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,MAAM,EAAEC,aAAa,EAAEC,KAAK,QAAQ,gCAA6B;AAS1E,OAAO,SAASC,kBAAkBA,CAACC,IAA6B,EAAE;EACjE,MAAMC,IAAI,GAAGD,IAAI,CAACC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC;EACpC,IAAIC,QAA8B,GAAG,EAAE;EACvC,IAAIC,kBAA2C;EAC/C;EACA,IAAIC,aAA4B,GAAGC,OAAO,CAACC,OAAO,CAAC,CAAC;EAEpD,MAAMC,OAAO,GAAIC,KAAuB,IAAW;IAClDJ,aAAa,GAAGA,aAAa,CAACK,IAAI,CAAC,YAAY;MAC9C,KAAK,MAAMC,OAAO,IAAIR,QAAQ,EAAE;QAC/B,IAAI;UACH,MAAMQ,OAAO,CAACF,KAAK,CAAC;QACrB,CAAC,CAAC,MAAM;UACP;UACA;QAAA;MAEF;;MAEA;MACA,IAAIA,KAAK,CAACG,IAAI,KAAK,SAAS,EAAE;QAC7B,MAAMX,IAAI,CAACY,MAAM,CAACC,MAAM,CAACL,KAAK,CAACM,cAAc,CAAC,CAACC,KAAK,CAAC,MAAMC,SAAS,CAAC;MACtE;IACD,CAAC,CAAC;EACH,CAAC;EAED,MAAMC,KAAK,GAAIT,KAAuB,IAAW;IAChD,IAAIN,QAAQ,CAACgB,MAAM,KAAK,CAAC,EAAE;MAC1BtB,MAAM,CAACI,IAAI,CAACmB,KAAK,EAAEX,KAAK,CAAC;MACzB;IACD;IACAD,OAAO,CAACC,KAAK,CAAC;EACf,CAAC;EAED,MAAMY,gBAAgB,GAAGA,CAAA,KAAY;IACpCjB,k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;MAC5B,MAAMhC,aAAa;IACpB,CAAC;IAEDiC,OAAOA,CAAA,EAAS;MACflC,kBAAkB,GAAG,CAAC;MACtBA,kBAAkB,GAAGa,SAAS;MAC9Bd,QAAQ,GAAG,EAAE;IACd;EACD,CAAC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The automatic maintenance cycle.
|
|
5
|
+
*
|
|
6
|
+
* Covers exactly what only the package can know — window refresh, recurrence
|
|
7
|
+
* expansion, wall-clock re-anchoring, pending-set verification, permission
|
|
8
|
+
* re-reads. Full desired-set reconciliation is never automatic, because only
|
|
9
|
+
* the consumer knows what its data implies and a package that guessed would
|
|
10
|
+
* cancel notifications it does not understand.
|
|
11
|
+
*
|
|
12
|
+
* Steps register themselves here rather than being wired in a fixed order. That
|
|
13
|
+
* is what lets scheduling, reconciliation, recurrence, and permissions each
|
|
14
|
+
* contribute a step without importing one another.
|
|
15
|
+
*
|
|
16
|
+
* The rule that makes automatic work safe: a step may act only on notifications
|
|
17
|
+
* the package owns, and may never cancel anything else. It is enforced here
|
|
18
|
+
* rather than trusted to each step.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
export class MaintenanceScopeViolation extends Error {
|
|
22
|
+
constructor(step, offendingIds) {
|
|
23
|
+
super(`Maintenance step "${step}" attempted to cancel ${offendingIds.length} notification(s) it does not own. ` + 'Automatic maintenance may never cancel a directly-scheduled notification.');
|
|
24
|
+
this.name = 'MaintenanceScopeViolation';
|
|
25
|
+
this.step = step;
|
|
26
|
+
this.offendingIds = offendingIds;
|
|
27
|
+
Object.setPrototypeOf(this, MaintenanceScopeViolation.prototype);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class MaintenanceRegistry {
|
|
31
|
+
steps = [];
|
|
32
|
+
inFlight = null;
|
|
33
|
+
constructor(options = {}) {
|
|
34
|
+
this.clock = options.clock ?? (() => Date.now());
|
|
35
|
+
}
|
|
36
|
+
register(step) {
|
|
37
|
+
this.steps.push(step);
|
|
38
|
+
this.steps.sort((a, b) => a.order - b.order);
|
|
39
|
+
return () => {
|
|
40
|
+
this.steps = this.steps.filter(s => s !== step);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
get registered() {
|
|
44
|
+
return this.steps.map(s => s.name);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Runs every registered step in order.
|
|
49
|
+
*
|
|
50
|
+
* Overlapping cycles are joined rather than queued or dropped: a second
|
|
51
|
+
* caller arriving mid-cycle wants the work the running cycle is already
|
|
52
|
+
* doing, so it waits for that cycle and gets its result. It used to get an
|
|
53
|
+
* empty result at once. Since `initialize` started running a cycle on every
|
|
54
|
+
* foreground, an app that ran maintenance and then reconciled on the same
|
|
55
|
+
* event got that empty result and reconciled while the window refresh was
|
|
56
|
+
* still writing: a reminder the reconcile cancelled could be scheduled again.
|
|
57
|
+
*/
|
|
58
|
+
run(context) {
|
|
59
|
+
if (this.inFlight) {
|
|
60
|
+
return this.inFlight;
|
|
61
|
+
}
|
|
62
|
+
const cycle = this.runSteps(context).finally(() => {
|
|
63
|
+
if (this.inFlight === cycle) this.inFlight = null;
|
|
64
|
+
});
|
|
65
|
+
this.inFlight = cycle;
|
|
66
|
+
return cycle;
|
|
67
|
+
}
|
|
68
|
+
async runSteps(context) {
|
|
69
|
+
const started = context.now;
|
|
70
|
+
const clockStart = this.clock();
|
|
71
|
+
const aggregate = {
|
|
72
|
+
windowRefreshed: false,
|
|
73
|
+
occurrencesScheduled: 0,
|
|
74
|
+
reAnchored: 0,
|
|
75
|
+
timeZoneChanged: false,
|
|
76
|
+
permissionChanged: false,
|
|
77
|
+
operationCount: 0
|
|
78
|
+
};
|
|
79
|
+
let discrepancy;
|
|
80
|
+
for (const step of this.steps) {
|
|
81
|
+
const outcome = await step.run(context);
|
|
82
|
+
const offending = (outcome.cancelledIds ?? []).filter(id => !context.ownedIds.has(id));
|
|
83
|
+
if (offending.length > 0) {
|
|
84
|
+
throw new MaintenanceScopeViolation(step.name, offending);
|
|
85
|
+
}
|
|
86
|
+
aggregate.windowRefreshed ||= outcome.windowRefreshed ?? false;
|
|
87
|
+
aggregate.occurrencesScheduled += outcome.occurrencesScheduled ?? 0;
|
|
88
|
+
aggregate.reAnchored += outcome.reAnchored ?? 0;
|
|
89
|
+
aggregate.timeZoneChanged ||= outcome.timeZoneChanged ?? false;
|
|
90
|
+
aggregate.permissionChanged ||= outcome.permissionChanged ?? false;
|
|
91
|
+
aggregate.operationCount += outcome.operationCount ?? 0;
|
|
92
|
+
discrepancy ??= outcome.discrepancy;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
ranAt: started,
|
|
96
|
+
...aggregate,
|
|
97
|
+
discrepancy,
|
|
98
|
+
durationMs: this.clock() - clockStart
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=cycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MaintenanceScopeViolation","Error","constructor","step","offendingIds","length","name","Object","setPrototypeOf","prototype","MaintenanceRegistry","steps","inFlight","options","clock","Date","now","register","push","sort","a","b","order","filter","s","registered","map","run","context","cycle","runSteps","finally","started","clockStart","aggregate","windowRefreshed","occurrencesScheduled","reAnchored","timeZoneChanged","permissionChanged","operationCount","discrepancy","outcome","offending","cancelledIds","id","ownedIds","has","ranAt","durationMs"],"sourceRoot":"../../../src","sources":["maintenance/cycle.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqCA,OAAO,MAAMA,yBAAyB,SAASC,KAAK,CAAC;EAIpDC,WAAWA,CAACC,IAAY,EAAEC,YAA+B,EAAE;IAC1D,KAAK,CACJ,qBAAqBD,IAAI,yBAAyBC,YAAY,CAACC,MAAM,oCAAoC,GACxG,2EACF,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SAAS,CAACM,cAAc,IAAIE,OAAO,CAACF,cAAc,IAAI,CAAC;MACvDC,WAAW,KAAKC,OAAO,CAACD,WAAW;IACpC;IAEA,OAAO;MAAEO,KAAK,EAAEhB,OAAO;MAAE,GAAGE,SAAS;MAAEO,WAAW;MAAEQ,UAAU,EAAE,IAAI,CAACnC,KAAK,CAAC,CAAC,GAAGmB;IAAW,CAAC;EAC5F;AACD","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The permission re-read maintenance step.
|
|
5
|
+
*
|
|
6
|
+
* The user can change permission in system settings while the app is
|
|
7
|
+
* backgrounded, and the platform does not tell anyone. Re-reading on foreground
|
|
8
|
+
* is the only way a consumer's interface avoids showing a stale answer.
|
|
9
|
+
*
|
|
10
|
+
* Runs last (order 30): permission state does not affect what the earlier steps
|
|
11
|
+
* expand or re-anchor, and reading it after they have run means the report
|
|
12
|
+
* reflects the device as the cycle leaves it.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export const PERMISSION_REFRESH_ORDER = 30;
|
|
16
|
+
export function createPermissionRefreshStep(deps) {
|
|
17
|
+
return {
|
|
18
|
+
name: 'permission-refresh',
|
|
19
|
+
order: PERMISSION_REFRESH_ORDER,
|
|
20
|
+
async run(_context) {
|
|
21
|
+
const {
|
|
22
|
+
changed
|
|
23
|
+
} = await deps.permissions.refresh();
|
|
24
|
+
return {
|
|
25
|
+
// Reading permission is not a platform mutation, so it never counts
|
|
26
|
+
// toward the zero-operation guarantee.
|
|
27
|
+
operationCount: 0,
|
|
28
|
+
permissionChanged: changed,
|
|
29
|
+
cancelledIds: []
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=permission-refresh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PERMISSION_REFRESH_ORDER","createPermissionRefreshStep","deps","name","order","run","_context","changed","permissions","refresh","operationCount","permissionChanged","cancelledIds"],"sourceRoot":"../../../src","sources":["maintenance/permission-refresh.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,MAAMA,wBAAwB,GAAG,EAAE;AAM1C,OAAO,SAASC,2BAA2BA,CAACC,IAAmC,EAAmB;EACjG,OAAO;IACNC,IAAI,EAAE,oBAAoB;IAC1BC,KAAK,EAAEJ,wBAAwB;IAE/B,MAAMK,GAAGA,CAACC,QAA4B,EAAwB;MAC7D,MAAM;QAAEC;MAAQ,CAAC,GAAG,MAAML,IAAI,CAACM,WAAW,CAACC,OAAO,CAAC,CAAC;MAEpD,OAAO;QACN;QACA;QACAC,cAAc,EAAE,CAAC;QACjBC,iBAAiB,EAAEJ,OAAO;QAC1BK,YAAY,EAAE;MACf,CAAC;IACF;EACD,CAAC;AACF","ignoreList":[]}
|