@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,298 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PERF_BUDGETS = void 0;
|
|
7
|
+
exports.runMeasurementHarness = runMeasurementHarness;
|
|
8
|
+
var _index = require("../schedule/index.js");
|
|
9
|
+
var _index2 = require("../reconcile/index.js");
|
|
10
|
+
var _index3 = require("../recurrence/index.js");
|
|
11
|
+
var _index4 = require("../permission/index.js");
|
|
12
|
+
var _reanchor = require("../maintenance/reanchor.js");
|
|
13
|
+
var _cycle = require("../maintenance/cycle.js");
|
|
14
|
+
var _record = require("../state/record.js");
|
|
15
|
+
var _store = require("../state/store.js");
|
|
16
|
+
var _anchor = require("../schedule/anchor.js");
|
|
17
|
+
var _dedupLedger = require("../state/dedup-ledger.js");
|
|
18
|
+
/**
|
|
19
|
+
* The PERF-001 measurement harness.
|
|
20
|
+
*
|
|
21
|
+
* Every budget in the specification, measured against the real code paths and
|
|
22
|
+
* reported as pass or fail with the number that produced the verdict. Written
|
|
23
|
+
* as a plain async function rather than a Jest suite so the same harness runs
|
|
24
|
+
* in continuous integration and from the demo app on a physical device — which
|
|
25
|
+
* matters, because PERF-003 forbids emulator numbers standing in as evidence.
|
|
26
|
+
*
|
|
27
|
+
* Five budgets are deliberately absent and reported as such: delivery accuracy,
|
|
28
|
+
* cold-start latency, startup delta and frame rate cannot be measured
|
|
29
|
+
* in-process. The first needs the OS to actually fire an alarm, the second a
|
|
30
|
+
* real process death. Pretending to measure them here would be worse than
|
|
31
|
+
* leaving the gap visible.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/** Every budget PERF-001 states, in milliseconds unless the name says otherwise. */
|
|
35
|
+
const PERF_BUDGETS = exports.PERF_BUDGETS = {
|
|
36
|
+
scheduleOne: 50,
|
|
37
|
+
readPending100: 200,
|
|
38
|
+
reconcileNoChange100: 150,
|
|
39
|
+
reconcile500With100Changes: 1_500,
|
|
40
|
+
maintenanceIdleCycle: 300,
|
|
41
|
+
windowRefresh32Series: 500,
|
|
42
|
+
reAnchor100: 1_000,
|
|
43
|
+
reAnchorNoChangeCheck: 20,
|
|
44
|
+
permissionRead: 50,
|
|
45
|
+
dedupCheck: 20,
|
|
46
|
+
interfaceThreadUnit: 16,
|
|
47
|
+
stateFootprintBytes: 1_048_576
|
|
48
|
+
};
|
|
49
|
+
const TONE = {
|
|
50
|
+
toneId: 'perf',
|
|
51
|
+
version: 1,
|
|
52
|
+
android: {
|
|
53
|
+
channelId: 'perf.v1',
|
|
54
|
+
importance: 'default',
|
|
55
|
+
vibration: false,
|
|
56
|
+
badge: false,
|
|
57
|
+
bypassDnd: false,
|
|
58
|
+
name: 'Fixture tone',
|
|
59
|
+
loopSound: false,
|
|
60
|
+
alarmCategory: false
|
|
61
|
+
},
|
|
62
|
+
ios: {
|
|
63
|
+
categoryId: 'perf',
|
|
64
|
+
interruptionLevel: 'active',
|
|
65
|
+
badge: false,
|
|
66
|
+
repeatRefused: false
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
async function runMeasurementHarness(engine, options = {}) {
|
|
70
|
+
const clock = options.clock ?? (() => Date.now());
|
|
71
|
+
const prefix = options.prefix ?? 'perf';
|
|
72
|
+
const measurements = [];
|
|
73
|
+
const now = () => Date.now();
|
|
74
|
+
const zone = 'UTC';
|
|
75
|
+
const state = new _record.StateManager({
|
|
76
|
+
store: (0, _store.createMemoryStore)(),
|
|
77
|
+
now
|
|
78
|
+
});
|
|
79
|
+
const resolveTone = () => TONE;
|
|
80
|
+
const record = (name, label, measured, operationCount) => {
|
|
81
|
+
const budget = PERF_BUDGETS[name];
|
|
82
|
+
// A budget that also demands zero operations fails on either count.
|
|
83
|
+
const opsOk = operationCount === undefined || operationCount === 0;
|
|
84
|
+
measurements.push({
|
|
85
|
+
name,
|
|
86
|
+
label,
|
|
87
|
+
measured,
|
|
88
|
+
budget,
|
|
89
|
+
unit: name === 'stateFootprintBytes' ? 'bytes' : 'ms',
|
|
90
|
+
passed: measured <= budget && opsOk,
|
|
91
|
+
operationCount
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/** Median of three, so one scheduler hiccup does not decide a verdict. */
|
|
96
|
+
const timeOf = async run => {
|
|
97
|
+
const samples = [];
|
|
98
|
+
for (let i = 0; i < 3; i += 1) {
|
|
99
|
+
const started = clock();
|
|
100
|
+
await run();
|
|
101
|
+
samples.push(clock() - started);
|
|
102
|
+
}
|
|
103
|
+
return samples.sort((a, b) => a - b)[1];
|
|
104
|
+
};
|
|
105
|
+
const request = (id, at) => ({
|
|
106
|
+
id: `${prefix}:${id}`,
|
|
107
|
+
content: {
|
|
108
|
+
title: id,
|
|
109
|
+
body: 'Measurement harness entry'
|
|
110
|
+
},
|
|
111
|
+
tone: 'perf',
|
|
112
|
+
moment: {
|
|
113
|
+
at
|
|
114
|
+
},
|
|
115
|
+
groupTag: prefix
|
|
116
|
+
});
|
|
117
|
+
const scheduler = (0, _index.createScheduler)({
|
|
118
|
+
engine,
|
|
119
|
+
resolveTone,
|
|
120
|
+
timeZone: () => zone,
|
|
121
|
+
now,
|
|
122
|
+
canScheduleExactly: () => true
|
|
123
|
+
});
|
|
124
|
+
await engine.cancelAll();
|
|
125
|
+
|
|
126
|
+
// --- Scheduling -----------------------------------------------------------
|
|
127
|
+
|
|
128
|
+
record('scheduleOne', 'Single schedule operation', await timeOf(() => scheduler.schedule(request('single', now() + 3_600_000))));
|
|
129
|
+
for (let i = 0; i < 100; i += 1) {
|
|
130
|
+
await scheduler.schedule(request(`bulk:${i}`, now() + (i + 1) * 60_000));
|
|
131
|
+
}
|
|
132
|
+
record('readPending100', 'Read pending set of 100', await timeOf(() => scheduler.getPending()));
|
|
133
|
+
|
|
134
|
+
// --- Reconciliation -------------------------------------------------------
|
|
135
|
+
|
|
136
|
+
const reconciler = (0, _index2.createReconciler)({
|
|
137
|
+
engine,
|
|
138
|
+
resolveTone,
|
|
139
|
+
timeZone: () => zone,
|
|
140
|
+
now,
|
|
141
|
+
canScheduleExactly: () => true
|
|
142
|
+
});
|
|
143
|
+
const hundred = Array.from({
|
|
144
|
+
length: 100
|
|
145
|
+
}, (_, i) => request(`recon:${i}`, now() + (i + 1) * 60_000));
|
|
146
|
+
await reconciler.reconcile({
|
|
147
|
+
domain: prefix,
|
|
148
|
+
desired: hundred
|
|
149
|
+
});
|
|
150
|
+
let noChangeOps = 0;
|
|
151
|
+
const noChangeMs = await timeOf(async () => {
|
|
152
|
+
const result = await reconciler.reconcile({
|
|
153
|
+
domain: prefix,
|
|
154
|
+
desired: hundred
|
|
155
|
+
});
|
|
156
|
+
noChangeOps = result.operationCount;
|
|
157
|
+
});
|
|
158
|
+
record('reconcileNoChange100', 'No-change reconcile over 100', noChangeMs, noChangeOps);
|
|
159
|
+
const fiveHundred = Array.from({
|
|
160
|
+
length: 500
|
|
161
|
+
}, (_, i) => request(`recon:${i}`, now() + (i + 1) * 60_000));
|
|
162
|
+
await reconciler.reconcile({
|
|
163
|
+
domain: prefix,
|
|
164
|
+
desired: fiveHundred
|
|
165
|
+
});
|
|
166
|
+
const changed = fiveHundred.map((entry, i) => i < 100 ? {
|
|
167
|
+
...entry,
|
|
168
|
+
content: {
|
|
169
|
+
title: `changed-${i}`,
|
|
170
|
+
body: entry.content.body
|
|
171
|
+
}
|
|
172
|
+
} : entry);
|
|
173
|
+
record('reconcile500With100Changes', '500-entry reconcile with 100 changes', await timeOf(() => reconciler.reconcile({
|
|
174
|
+
domain: prefix,
|
|
175
|
+
desired: changed
|
|
176
|
+
})));
|
|
177
|
+
|
|
178
|
+
// --- Re-anchoring ---------------------------------------------------------
|
|
179
|
+
|
|
180
|
+
const pending = await engine.getPending();
|
|
181
|
+
record('reAnchorNoChangeCheck', 'Re-anchor check with no zone change', await timeOf(async () => (0, _anchor.planReAnchor)(pending, zone)), (0, _anchor.planReAnchor)(pending, zone).rewrites.length);
|
|
182
|
+
const context = {
|
|
183
|
+
trigger: 'foreground',
|
|
184
|
+
now: now(),
|
|
185
|
+
ownedIds: new Set()
|
|
186
|
+
};
|
|
187
|
+
const travelled = (0, _reanchor.createReAnchorStep)({
|
|
188
|
+
engine,
|
|
189
|
+
timeZone: () => 'Asia/Tokyo',
|
|
190
|
+
resolveTone,
|
|
191
|
+
canScheduleExactly: () => true
|
|
192
|
+
});
|
|
193
|
+
record('reAnchor100', 'Re-anchor after a zone change', await timeOf(() => travelled.run(context)));
|
|
194
|
+
|
|
195
|
+
// --- Maintenance ----------------------------------------------------------
|
|
196
|
+
|
|
197
|
+
const registry = new _cycle.MaintenanceRegistry();
|
|
198
|
+
registry.register((0, _reanchor.createReAnchorStep)({
|
|
199
|
+
engine,
|
|
200
|
+
timeZone: () => zone,
|
|
201
|
+
resolveTone,
|
|
202
|
+
canScheduleExactly: () => true
|
|
203
|
+
}));
|
|
204
|
+
let idleOps = 0;
|
|
205
|
+
const idleMs = await timeOf(async () => {
|
|
206
|
+
const result = await registry.run({
|
|
207
|
+
...context,
|
|
208
|
+
now: now()
|
|
209
|
+
});
|
|
210
|
+
idleOps = result.operationCount;
|
|
211
|
+
});
|
|
212
|
+
record('maintenanceIdleCycle', 'Idle maintenance cycle', idleMs, idleOps);
|
|
213
|
+
|
|
214
|
+
// --- Recurrence -----------------------------------------------------------
|
|
215
|
+
|
|
216
|
+
const recurrence = (0, _index3.createRecurrence)({
|
|
217
|
+
engine,
|
|
218
|
+
state,
|
|
219
|
+
resolveTone,
|
|
220
|
+
timeZone: () => zone,
|
|
221
|
+
now,
|
|
222
|
+
lookahead: {
|
|
223
|
+
days: 60,
|
|
224
|
+
occurrencesPerSeries: 32
|
|
225
|
+
},
|
|
226
|
+
canScheduleExactly: () => true
|
|
227
|
+
});
|
|
228
|
+
const series = Array.from({
|
|
229
|
+
length: 32
|
|
230
|
+
}, (_, i) => ({
|
|
231
|
+
id: `${prefix}:series:${i}`,
|
|
232
|
+
pattern: {
|
|
233
|
+
kind: 'daily',
|
|
234
|
+
hour: i % 24,
|
|
235
|
+
minute: 0
|
|
236
|
+
},
|
|
237
|
+
end: {
|
|
238
|
+
kind: 'count',
|
|
239
|
+
count: 2
|
|
240
|
+
},
|
|
241
|
+
template: {
|
|
242
|
+
content: {
|
|
243
|
+
title: `Series ${i}`,
|
|
244
|
+
body: 'Measurement harness series'
|
|
245
|
+
},
|
|
246
|
+
tone: 'perf',
|
|
247
|
+
groupTag: prefix
|
|
248
|
+
}
|
|
249
|
+
}));
|
|
250
|
+
for (const rule of series) {
|
|
251
|
+
await recurrence.registerSeries(rule);
|
|
252
|
+
}
|
|
253
|
+
record('windowRefresh32Series', 'Window refresh across 32 series', await timeOf(async () => {
|
|
254
|
+
for (const rule of series) {
|
|
255
|
+
await recurrence.refreshSeries(rule);
|
|
256
|
+
}
|
|
257
|
+
}));
|
|
258
|
+
|
|
259
|
+
// --- Permissions ----------------------------------------------------------
|
|
260
|
+
|
|
261
|
+
const permissions = (0, _index4.createPermissions)({
|
|
262
|
+
engine,
|
|
263
|
+
state,
|
|
264
|
+
platform: {
|
|
265
|
+
os: 'android',
|
|
266
|
+
apiLevel: 34
|
|
267
|
+
},
|
|
268
|
+
now
|
|
269
|
+
});
|
|
270
|
+
record('permissionRead', 'Read all permission states', await timeOf(() => permissions.getPermissions()));
|
|
271
|
+
|
|
272
|
+
// --- Deduplication and footprint -----------------------------------------
|
|
273
|
+
|
|
274
|
+
for (let i = 0; i < 400; i += 1) {
|
|
275
|
+
(0, _dedupLedger.recordSeen)(state, `${prefix}:dedup:${i}`, now());
|
|
276
|
+
}
|
|
277
|
+
record('dedupCheck', 'Deduplication ledger check', await timeOf(async () => (0, _dedupLedger.recordSeen)(state, `${prefix}:dedup:probe`, now())));
|
|
278
|
+
record('stateFootprintBytes', 'Persisted state on disk at caps', state.health().approximateBytes);
|
|
279
|
+
|
|
280
|
+
// The interface-thread ceiling is a property of one chunked unit of work, not
|
|
281
|
+
// of a whole pass, so it is measured per entry rather than per reconcile.
|
|
282
|
+
const chunkMs = await timeOf(() => reconciler.reconcile({
|
|
283
|
+
domain: prefix,
|
|
284
|
+
desired: hundred.slice(0, 25)
|
|
285
|
+
}));
|
|
286
|
+
record('interfaceThreadUnit', 'Single chunked unit of reconcile work', chunkMs / 25);
|
|
287
|
+
await engine.cancelAll();
|
|
288
|
+
const passed = measurements.filter(measurement => measurement.passed).length;
|
|
289
|
+
return {
|
|
290
|
+
measurements,
|
|
291
|
+
passed,
|
|
292
|
+
failed: measurements.length - passed,
|
|
293
|
+
// Stated rather than silently omitted — these need real hardware.
|
|
294
|
+
requiresDevice: ['Delivery accuracy, exact mode (60 s) — needs the OS to fire a real alarm', 'Delivery accuracy, approximate mode (15 min) — needs a device under no vendor restriction', 'Cold-start tap to handler (500 ms) — needs a real process death and relaunch', 'App startup delta (100 ms) — needs a real cold start', 'Sustained frame rate during reconcile (55 fps) — needs a rendering device'],
|
|
295
|
+
ranAt: now()
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
//# sourceMappingURL=measure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_index","require","_index2","_index3","_index4","_reanchor","_cycle","_record","_store","_anchor","_dedupLedger","PERF_BUDGETS","exports","scheduleOne","readPending100","reconcileNoChange100","reconcile500With100Changes","maintenanceIdleCycle","windowRefresh32Series","reAnchor100","reAnchorNoChangeCheck","permissionRead","dedupCheck","interfaceThreadUnit","stateFootprintBytes","TONE","toneId","version","android","channelId","importance","vibration","badge","bypassDnd","name","loopSound","alarmCategory","ios","categoryId","interruptionLevel","repeatRefused","runMeasurementHarness","engine","options","clock","Date","now","prefix","measurements","zone","state","StateManager","store","createMemoryStore","resolveTone","record","label","measured","operationCount","budget","opsOk","undefined","push","unit","passed","timeOf","run","samples","i","started","sort","a","b","request","id","at","content","title","body","tone","moment","groupTag","scheduler","createScheduler","timeZone","canScheduleExactly","cancelAll","schedule","getPending","reconciler","createReconciler","hundred","Array","from","length","_","reconcile","domain","desired","noChangeOps","noChangeMs","result","fiveHundred","changed","map","entry","pending","planReAnchor","rewrites","context","trigger","ownedIds","Set","travelled","createReAnchorStep","registry","MaintenanceRegistry","register","idleOps","idleMs","recurrence","createRecurrence","lookahead","days","occurrencesPerSeries","series","pattern","kind","hour","minute","end","count","template","rule","registerSeries","refreshSeries","permissions","createPermissions","platform","os","apiLevel","getPermissions","recordSeen","health","approximateBytes","chunkMs","slice","filter","measurement","failed","requiresDevice","ranAt"],"sourceRoot":"../../../src","sources":["testing/measure.ts"],"mappings":";;;;;;;AAoBA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,YAAA,GAAAT,OAAA;AA7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACO,MAAMU,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC3BE,WAAW,EAAE,EAAE;EACfC,cAAc,EAAE,GAAG;EACnBC,oBAAoB,EAAE,GAAG;EACzBC,0BAA0B,EAAE,KAAK;EACjCC,oBAAoB,EAAE,GAAG;EACzBC,qBAAqB,EAAE,GAAG;EAC1BC,WAAW,EAAE,KAAK;EAClBC,qBAAqB,EAAE,EAAE;EACzBC,cAAc,EAAE,EAAE;EAClBC,UAAU,EAAE,EAAE;EACdC,mBAAmB,EAAE,EAAE;EACvBC,mBAAmB,EAAE;AACtB,CAAU;AAyBV,MAAMC,IAAkB,GAAG;EAC1BC,MAAM,EAAE,MAAM;EACdC,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE;IACRC,SAAS,EAAE,SAAS;IACpBC,UAAU,EAAE,SAAS;IACrBC,SAAS,EAAE,KAAK;IAChBC,KAAK,EAAE,KAAK;IACZ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AG,CAAC,CAAC,CAAC;EACjD;EACAS,MAAM,CACL,YAAY,EACZ,4BAA4B,EAC5B,MAAMU,MAAM,CAAC,YAAY,IAAA6E,uBAAU,EAAC5F,KAAK,EAAE,GAAGH,MAAM,cAAc,EAAED,GAAG,CAAC,CAAC,CAAC,CAC3E,CAAC;EAEDS,MAAM,CAAC,qBAAqB,EAAE,iCAAiC,EAAEL,KAAK,CAAC6F,MAAM,CAAC,CAAC,CAACC,gBAAgB,CAAC;;EAEjG;EACA;EACA,MAAMC,OAAO,GAAG,MAAMhF,MAAM,CAAC,MAC5BwB,UAAU,CAACO,SAAS,CAAC;IAAEC,MAAM,EAAElD,MAAM;IAAEmD,OAAO,EAAEP,OAAO,CAACuD,KAAK,CAAC,CAAC,EAAE,EAAE;EAAE,CAAC,CACvE,CAAC;EACD3F,MAAM,CAAC,qBAAqB,EAAE,uCAAuC,EAAE0F,OAAO,GAAG,EAAE,CAAC;EAEpF,MAAMvG,MAAM,CAAC4C,SAAS,CAAC,CAAC;EAExB,MAAMtB,MAAM,GAAGhB,YAAY,CAACmG,MAAM,CAACC,WAAW,IAAIA,WAAW,CAACpF,MAAM,CAAC,CAAC8B,MAAM;EAE5E,OAAO;IACN9C,YAAY;IACZgB,MAAM;IACNqF,MAAM,EAAErG,YAAY,CAAC8C,MAAM,GAAG9B,MAAM;IACpC;IACAsF,cAAc,EAAE,CACf,0EAA0E,EAC1E,2FAA2F,EAC3F,8EAA8E,EAC9E,sDAAsD,EACtD,2EAA2E,CAC3E;IACDC,KAAK,EAAEzG,GAAG,CAAC;EACZ,CAAC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `@chipmobilesdk/rn-notification/advanced`: the individual factories, for an app
|
|
5
|
+
* that wires the package itself instead of using `createNotifications` (NOT-07).
|
|
6
|
+
*
|
|
7
|
+
* The package root still exports them too, for compatibility; new code that needs
|
|
8
|
+
* them should import from here, where they are documented as the advanced path.
|
|
9
|
+
*/
|
|
10
|
+
export { initialize } from "./initialize.js";
|
|
11
|
+
export { createScheduler } from "./schedule/index.js";
|
|
12
|
+
export { createReconciler } from "./reconcile/index.js";
|
|
13
|
+
export { createRecurrence } from "./recurrence/index.js";
|
|
14
|
+
export { createChannels } from "./channel/migrate.js";
|
|
15
|
+
export { createToneResolver } from "./channel/tone-map.js";
|
|
16
|
+
export { createInteractions } from "./interaction/index.js";
|
|
17
|
+
export { createSnapshot } from "./diagnostics/snapshot.js";
|
|
18
|
+
export { createBurstDetector } from "./diagnostics/burst.js";
|
|
19
|
+
export { createPermissions } from "./permission/index.js";
|
|
20
|
+
export { createPermissionRefreshStep } from "./maintenance/permission-refresh.js";
|
|
21
|
+
export { createReAnchorStep } from "./maintenance/reanchor.js";
|
|
22
|
+
export { createVerifyStep } from "./maintenance/verify.js";
|
|
23
|
+
export { createWindowRefreshStep } from "./maintenance/window-refresh.js";
|
|
24
|
+
export { MaintenanceController } from "./maintenance/toggle.js";
|
|
25
|
+
export { MaintenanceRegistry } from "./maintenance/cycle.js";
|
|
26
|
+
export { StateManager } from "./state/record.js";
|
|
27
|
+
export { createMmkvStore } from "./state/mmkv-store.js";
|
|
28
|
+
export { createPlatformTimeZoneReader } from "./schedule/anchor.js";
|
|
29
|
+
//# sourceMappingURL=advanced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["initialize","createScheduler","createReconciler","createRecurrence","createChannels","createToneResolver","createInteractions","createSnapshot","createBurstDetector","createPermissions","createPermissionRefreshStep","createReAnchorStep","createVerifyStep","createWindowRefreshStep","MaintenanceController","MaintenanceRegistry","StateManager","createMmkvStore","createPlatformTimeZoneReader"],"sourceRoot":"../../src","sources":["advanced.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,iBAAc;AAEzC,SAASC,eAAe,QAAQ,qBAAY;AAE5C,SAASC,gBAAgB,QAAQ,sBAAa;AAE9C,SAASC,gBAAgB,QAAQ,uBAAc;AAE/C,SAASC,cAAc,QAAQ,sBAAmB;AAElD,SAASC,kBAAkB,QAAQ,uBAAoB;AACvD,SAASC,kBAAkB,QAAQ,wBAAe;AAElD,SAASC,cAAc,QAAQ,2BAAwB;AAEvD,SAASC,mBAAmB,QAAQ,wBAAqB;AACzD,SAASC,iBAAiB,QAAQ,uBAAc;AAEhD,SAASC,2BAA2B,QAAQ,qCAAkC;AAC9E,SAASC,kBAAkB,QAAQ,2BAAwB;AAC3D,SAASC,gBAAgB,QAAQ,yBAAsB;AACvD,SAASC,uBAAuB,QAAQ,iCAA8B;AACtE,SAASC,qBAAqB,QAAQ,yBAAsB;AAC5D,SAASC,mBAAmB,QAAQ,wBAAqB;AAEzD,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,eAAe,QAAQ,uBAAoB;AACpD,SAASC,4BAA4B,QAAQ,sBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Channel declaration and migration.
|
|
5
|
+
*
|
|
6
|
+
* Android channels are immutable once created: declaring a channel whose id
|
|
7
|
+
* already exists silently keeps the original configuration. That single fact is
|
|
8
|
+
* why changing a tone is a **migration** rather than an assignment, and why
|
|
9
|
+
* this package keeps its own ledger — the platform will not tell you which
|
|
10
|
+
* version of a channel a device already holds.
|
|
11
|
+
*
|
|
12
|
+
* Migration creates the new channel, re-homes notifications still pointing at
|
|
13
|
+
* the old one, and only then retires it. That order matters: retiring first
|
|
14
|
+
* would leave live notifications attached to a channel that no longer exists.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { DIAGNOSTIC_CODES } from "../contract/errors.js";
|
|
18
|
+
import { channelIdFor, resolveTone, toneLabelFingerprint } from "./tone-map.js";
|
|
19
|
+
import { validateToneDeclarations } from "./validate-tone.js";
|
|
20
|
+
import { createScheduleWriter } from "../schedule/writer.js";
|
|
21
|
+
function ledgerFor(state, toneId) {
|
|
22
|
+
return state.read().migrationLedger.find(entry => entry.toneId === toneId && !entry.retired);
|
|
23
|
+
}
|
|
24
|
+
function recordApplied(state, tone, now, retiredChannelId, labelFingerprint) {
|
|
25
|
+
state.update('migrationLedger', current => {
|
|
26
|
+
const withoutTone = current.filter(entry => entry.toneId !== tone.id);
|
|
27
|
+
const retired = retiredChannelId === undefined ? [] : [{
|
|
28
|
+
at: now,
|
|
29
|
+
toneId: tone.id,
|
|
30
|
+
appliedVersion: 0,
|
|
31
|
+
channelId: retiredChannelId,
|
|
32
|
+
retired: true
|
|
33
|
+
}];
|
|
34
|
+
return [...withoutTone, ...retired, {
|
|
35
|
+
at: now,
|
|
36
|
+
toneId: tone.id,
|
|
37
|
+
appliedVersion: tone.version,
|
|
38
|
+
channelId: channelIdFor(tone.id, tone.version),
|
|
39
|
+
retired: false,
|
|
40
|
+
labelFingerprint
|
|
41
|
+
}];
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export function createChannels(deps) {
|
|
45
|
+
const emit = deps.emit ?? (() => {});
|
|
46
|
+
// Re-homing re-writes each notification on the new channel; its stop marker
|
|
47
|
+
// has to follow, or it would retire with the old channel.
|
|
48
|
+
const writer = createScheduleWriter(deps.engine);
|
|
49
|
+
const applyTones = async (tones, groups) => {
|
|
50
|
+
// Validation completes before the first engine call, so a rejected
|
|
51
|
+
// declaration leaves the device exactly as it was — the same order the
|
|
52
|
+
// scheduler has always used.
|
|
53
|
+
validateToneDeclarations(tones);
|
|
54
|
+
const now = deps.now();
|
|
55
|
+
const created = [];
|
|
56
|
+
const migrated = [];
|
|
57
|
+
const labelsRefreshed = [];
|
|
58
|
+
const retired = [];
|
|
59
|
+
const reHomed = [];
|
|
60
|
+
const cancelled = [];
|
|
61
|
+
const bypassUnavailable = [];
|
|
62
|
+
const repeatUnavailable = [];
|
|
63
|
+
const unchanged = [];
|
|
64
|
+
if (groups.length > 0) {
|
|
65
|
+
await deps.engine.declareGroups(groups);
|
|
66
|
+
}
|
|
67
|
+
const capabilities = await deps.engine.getCapabilities();
|
|
68
|
+
for (const tone of tones) {
|
|
69
|
+
const previous = ledgerFor(deps.state, tone.id);
|
|
70
|
+
const resolved = resolveTone(tone);
|
|
71
|
+
const fingerprint = toneLabelFingerprint(tone);
|
|
72
|
+
|
|
73
|
+
// Refusals are reported for every tone that asked, whether or not
|
|
74
|
+
// anything else about it moved. A platform declining an attribute
|
|
75
|
+
// says nothing about whether the channel is new.
|
|
76
|
+
if (tone.bypassDoNotDisturb === true && !capabilities.supportsDoNotDisturbBypass) {
|
|
77
|
+
// Reported honestly rather than silently dropped — a consumer that
|
|
78
|
+
// asked for a bypass deserves to know the platform refused.
|
|
79
|
+
bypassUnavailable.push(tone.id);
|
|
80
|
+
emit(DIAGNOSTIC_CODES.DND_BYPASS_UNAVAILABLE, `Tone "${tone.id}" requested a Do Not Disturb bypass, which this platform does not permit.`, {
|
|
81
|
+
toneId: tone.id
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (tone.repeatAlert !== undefined) {
|
|
85
|
+
if (!capabilities.supportsRepeatingAlert) {
|
|
86
|
+
repeatUnavailable.push(tone.id);
|
|
87
|
+
emit(DIAGNOSTIC_CODES.REPEAT_ALERT_UNAVAILABLE, `Tone "${tone.id}" requested a repeating alert, which this platform does not offer. The notification still delivers and still sounds once.`, {
|
|
88
|
+
toneId: tone.id
|
|
89
|
+
});
|
|
90
|
+
} else if (!deps.engine.hasBackgroundDeliveryHandler()) {
|
|
91
|
+
// Said out loud at declaration time, because the alternative is a
|
|
92
|
+
// user meeting it as a phone that will not stop ringing.
|
|
93
|
+
emit(DIAGNOSTIC_CODES.REPEAT_STOP_HANDLER_MISSING, `Tone "${tone.id}" declares a repeating alert, but no background notification handler is registered. Its alert will not stop on its own while the app is not running. Call registerBackgroundNotificationHandler at module scope in index.js.`, {
|
|
94
|
+
toneId: tone.id
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const versionMoved = previous !== undefined && previous.appliedVersion !== tone.version;
|
|
99
|
+
if (previous !== undefined && !versionMoved) {
|
|
100
|
+
// The version is the same, so nothing the platform freezes has
|
|
101
|
+
// changed. Only the labels can still be stale — and correcting
|
|
102
|
+
// those must cost the user nothing, so the platform is touched
|
|
103
|
+
// only when the fingerprint actually moved.
|
|
104
|
+
if (previous.labelFingerprint === fingerprint) {
|
|
105
|
+
unchanged.push(tone.id);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
const outcome = await deps.engine.declareTone(resolved);
|
|
109
|
+
if (outcome === 'created') {
|
|
110
|
+
// The channel was gone — deleted by the user, or lost with the
|
|
111
|
+
// app's data — so this is a first declaration rather than a
|
|
112
|
+
// refresh, whatever our ledger believed.
|
|
113
|
+
created.push(resolved.android.channelId);
|
|
114
|
+
} else if (outcome === 'labelsRefreshed') {
|
|
115
|
+
labelsRefreshed.push(tone.id);
|
|
116
|
+
emit(DIAGNOSTIC_CODES.TONE_LABELS_REFRESHED, `Tone "${tone.id}" had its name and description updated in place. No channel was recreated, so every setting the user adjusted on it is untouched.`, {
|
|
117
|
+
toneId: tone.id
|
|
118
|
+
});
|
|
119
|
+
} else {
|
|
120
|
+
unchanged.push(tone.id);
|
|
121
|
+
}
|
|
122
|
+
recordApplied(deps.state, tone, now, undefined, fingerprint);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
const outcome = await deps.engine.declareTone(resolved);
|
|
126
|
+
if (outcome === 'created') {
|
|
127
|
+
created.push(resolved.android.channelId);
|
|
128
|
+
}
|
|
129
|
+
if (previous === undefined) {
|
|
130
|
+
recordApplied(deps.state, tone, now, undefined, fingerprint);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// A version moved, so this is a migration rather than a first
|
|
135
|
+
// declaration. Re-home before retiring: the reverse order would leave
|
|
136
|
+
// live notifications attached to a channel that no longer exists.
|
|
137
|
+
emit(DIAGNOSTIC_CODES.CHANNEL_MIGRATION_REQUIRED, `Tone "${tone.id}" moved from version ${previous.appliedVersion} to ${tone.version}. Android channels are immutable, so a new channel was created and the old one is being retired.`, {
|
|
138
|
+
toneId: tone.id,
|
|
139
|
+
from: previous.appliedVersion,
|
|
140
|
+
to: tone.version
|
|
141
|
+
});
|
|
142
|
+
const pending = await deps.engine.getPending();
|
|
143
|
+
const affected = pending.filter(entry => entry.tone === tone.id);
|
|
144
|
+
for (const entry of affected) {
|
|
145
|
+
await writer.write({
|
|
146
|
+
request: {
|
|
147
|
+
id: entry.id,
|
|
148
|
+
content: entry.content,
|
|
149
|
+
tone: entry.tone,
|
|
150
|
+
moment: {
|
|
151
|
+
at: entry.resolvedAt,
|
|
152
|
+
anchoring: entry.anchoring
|
|
153
|
+
},
|
|
154
|
+
routing: entry.routing,
|
|
155
|
+
actions: entry.actions,
|
|
156
|
+
ownerTag: entry.ownerTag,
|
|
157
|
+
groupTag: entry.groupTag
|
|
158
|
+
},
|
|
159
|
+
resolvedAt: entry.resolvedAt,
|
|
160
|
+
tone: resolved,
|
|
161
|
+
// Re-homing changes the channel, not the anchoring — preserve it.
|
|
162
|
+
anchoringGeneration: entry.anchoringGeneration,
|
|
163
|
+
approximate: entry.mayBeDelayed,
|
|
164
|
+
seriesId: entry.seriesId,
|
|
165
|
+
pushCreated: entry.pushCreated
|
|
166
|
+
});
|
|
167
|
+
reHomed.push(entry.id);
|
|
168
|
+
}
|
|
169
|
+
const didRetire = await deps.engine.retireTone(previous.channelId);
|
|
170
|
+
if (didRetire) {
|
|
171
|
+
retired.push(previous.channelId);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// A version move outranks a label change: the new channel simply
|
|
175
|
+
// carries the new labels, and reporting it as a refresh would hide a
|
|
176
|
+
// migration the consumer needs to know about.
|
|
177
|
+
migrated.push({
|
|
178
|
+
toneId: tone.id,
|
|
179
|
+
from: previous.appliedVersion,
|
|
180
|
+
to: tone.version
|
|
181
|
+
});
|
|
182
|
+
recordApplied(deps.state, tone, now, previous.channelId, fingerprint);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Anything left on a retired channel would be an orphan — a notification
|
|
186
|
+
// the user can no longer control from system settings.
|
|
187
|
+
const orphans = await findOrphans(deps, tones);
|
|
188
|
+
if (orphans.length > 0) {
|
|
189
|
+
await deps.engine.cancelMany(orphans);
|
|
190
|
+
cancelled.push(...orphans);
|
|
191
|
+
emit(DIAGNOSTIC_CODES.CHANNEL_ORPHANS_FOUND, `${orphans.length} notification(s) remained on a retired channel and were cancelled, rather than left uncontrollable from system settings.`, {
|
|
192
|
+
count: orphans.length
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
created,
|
|
197
|
+
migrated,
|
|
198
|
+
labelsRefreshed,
|
|
199
|
+
retired,
|
|
200
|
+
reHomed,
|
|
201
|
+
cancelled,
|
|
202
|
+
bypassUnavailable,
|
|
203
|
+
repeatUnavailable,
|
|
204
|
+
unchanged
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
return {
|
|
208
|
+
/**
|
|
209
|
+
* Applies a tone configuration, migrating any tone whose version moved.
|
|
210
|
+
*
|
|
211
|
+
* Applying an unchanged configuration performs no work at all: no channel
|
|
212
|
+
* is recreated and no migration is triggered.
|
|
213
|
+
*/
|
|
214
|
+
apply(tones, groups = []) {
|
|
215
|
+
// The declared channels are read once for the whole apply rather than once
|
|
216
|
+
// per tone, when the engine can hold them (NOT-08).
|
|
217
|
+
const run = () => applyTones(tones, groups);
|
|
218
|
+
return deps.engine.withChannelSnapshot ? deps.engine.withChannelSnapshot(run) : run();
|
|
219
|
+
},
|
|
220
|
+
/** Which version of each tone this device actually holds. */
|
|
221
|
+
appliedVersions() {
|
|
222
|
+
return deps.state.read().migrationLedger.filter(entry => !entry.retired).map(entry => ({
|
|
223
|
+
toneId: entry.toneId,
|
|
224
|
+
appliedVersion: entry.appliedVersion
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** Notifications whose tone is no longer declared at all. */
|
|
231
|
+
async function findOrphans(deps, tones) {
|
|
232
|
+
const declared = new Set(tones.map(tone => tone.id));
|
|
233
|
+
// Only tones this package once applied can leave orphans (NOT-05). An entry
|
|
234
|
+
// with no tone metadata was scheduled by other code through the same engine,
|
|
235
|
+
// and a tone the ledger has never seen is not ours to judge either: cancelling
|
|
236
|
+
// on "not in this call's list" silently deleted other libraries' notifications,
|
|
237
|
+
// and a feature module's own when it applied only its subset of tones.
|
|
238
|
+
const onceApplied = new Set(deps.state.read().migrationLedger.map(entry => entry.toneId));
|
|
239
|
+
const pending = await deps.engine.getPending();
|
|
240
|
+
return pending.filter(entry => entry.tone !== '' && onceApplied.has(entry.tone) && !declared.has(entry.tone)).map(entry => entry.id);
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["DIAGNOSTIC_CODES","channelIdFor","resolveTone","toneLabelFingerprint","validateToneDeclarations","createScheduleWriter","ledgerFor","state","toneId","read","migrationLedger","find","entry","retired","recordApplied","tone","now","retiredChannelId","labelFingerprint","update","current","withoutTone","filter","id","undefined","at","appliedVersion","channelId","version","createChannels","deps","emit","writer","engine","applyTones","tones","groups","created","migrated","labelsRefreshed","reHomed","cancelled","bypassUnavailable","repeatUnavailable","unchanged","length","declareGroups","capabilities","getCapabilities","previous","resolved","fingerprint","bypassDoNotDisturb","supportsDoNotDisturbBypass","push","DND_BYPASS_UNAVAILABLE","repeatAlert","supportsRepeatingAlert","REPEAT_ALERT_UNAVAILABLE","hasBackgroundDeliveryHandler","REPEAT_STOP_HANDLER_MISSING","versionMoved","outcome","declareTone","android","TONE_LABELS_REFRESHED","CHANNEL_MIGRATION_REQUIRED","from","to","pending","getPending","affected","write","request","content","moment","resolvedAt","anchoring","routing","actions","ownerTag","groupTag","anchoringGeneration","approximate","mayBeDelayed","seriesId","pushCreated","didRetire","retireTone","orphans","findOrphans","cancelMany","CHANNEL_ORPHANS_FOUND","count","apply","run","withChannelSnapshot","appliedVersions","map","declared","Set","onceApplied","has"],"sourceRoot":"../../../src","sources":["channel/migrate.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,SAASA,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,YAAY,EAAEC,WAAW,EAAEC,oBAAoB,QAAQ,eAAY;AAC5E,SAASC,wBAAwB,QAAQ,oBAAiB;AAC1D,SAASC,oBAAoB,QAAQ,uBAAoB;AASzD,SAASC,SAASA,CAACC,KAAmB,EAAEC,MAAc,EAA8B;EACnF,OAAOD,KAAK,CAACE,IAAI,CAAC,CAAC,CAACC,eAAe,CAACC,IAAI,CAACC,KAAK,IAAIA,KAAK,CAACJ,MAAM,KAAKA,MAAM,IAAI,CAACI,KAAK,CAACC,OAAO,CAAC;AAC7F;AAEA,SAASC,aAAaA,CACrBP,KAAmB,EACnBQ,IAAqB,EACrBC,GAAW,EACXC,gBAAoC,EACpCC,gBAAwB,EACjB;EACPX,KAAK,CAACY,MAAM,CAAC,iBAAiB,EAAEC,OAAO,IAAI;IAC1C,MAAMC,WAAW,GAAGD,OAAO,CAACE,MAAM,CAACV,KAAK,IAAIA,KAAK,CAACJ,MAAM,KAAKO,IAAI,CAACQ,EAAE,CAAC;IACrE,MAAMV,OAAO,GACZI,gBAAgB,KAAKO,SAAS,GAC3B,EAAE,GACF,CACA;MACCC,EAAE,EAAET,GAAG;MACPR,MAAM,EAAEO,IAAI,CAACQ,EAAE;MACfG,cAAc,EAAE,CAAC;MACjBC,SAAS,EAAEV,gBAAgB;MAC3BJ,OAAO,EAAE;IACV,CAAC,CACD;IAEJ,OAAO,CACN,GAAGQ,WAAW,EACd,GAAGR,OAAO,EACV;MACCY,EAAE,EAAET,GAAG;MACPR,MAAM,EAAEO,IAAI,C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