@chipmobilesdk/rn-notification 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +111 -0
- package/README.md +8 -6
- package/lib/commonjs/advanced.js +139 -0
- package/lib/commonjs/advanced.js.map +1 -0
- package/lib/commonjs/channel/migrate.js +246 -0
- package/lib/commonjs/channel/migrate.js.map +1 -0
- package/lib/commonjs/channel/tone-map.js +120 -0
- package/lib/commonjs/channel/tone-map.js.map +1 -0
- package/lib/commonjs/channel/validate-tone.js +61 -0
- package/lib/commonjs/channel/validate-tone.js.map +1 -0
- package/lib/commonjs/contract/channel.js +52 -0
- package/lib/commonjs/contract/channel.js.map +1 -0
- package/lib/commonjs/contract/diagnostics.js +25 -0
- package/lib/commonjs/contract/diagnostics.js.map +1 -0
- package/lib/commonjs/contract/errors.js +126 -0
- package/lib/commonjs/contract/errors.js.map +1 -0
- package/lib/commonjs/contract/hash.js +35 -0
- package/lib/commonjs/contract/hash.js.map +1 -0
- package/lib/commonjs/contract/index.js +94 -0
- package/lib/commonjs/contract/index.js.map +1 -0
- package/lib/commonjs/contract/interaction.js +37 -0
- package/lib/commonjs/contract/interaction.js.map +1 -0
- package/lib/commonjs/contract/notification.js +42 -0
- package/lib/commonjs/contract/notification.js.map +1 -0
- package/lib/commonjs/contract/permission.js +2 -0
- package/lib/commonjs/contract/permission.js.map +1 -0
- package/lib/commonjs/contract/reconcile.js +6 -0
- package/lib/commonjs/contract/reconcile.js.map +1 -0
- package/lib/commonjs/contract/recurrence.js +53 -0
- package/lib/commonjs/contract/recurrence.js.map +1 -0
- package/lib/commonjs/diagnostics/burst.js +89 -0
- package/lib/commonjs/diagnostics/burst.js.map +1 -0
- package/lib/commonjs/diagnostics/events.js +63 -0
- package/lib/commonjs/diagnostics/events.js.map +1 -0
- package/lib/commonjs/diagnostics/redact.js +48 -0
- package/lib/commonjs/diagnostics/redact.js.map +1 -0
- package/lib/commonjs/diagnostics/snapshot.js +68 -0
- package/lib/commonjs/diagnostics/snapshot.js.map +1 -0
- package/lib/commonjs/engine/adapter.js +6 -0
- package/lib/commonjs/engine/adapter.js.map +1 -0
- package/lib/commonjs/engine/codec.js +84 -0
- package/lib/commonjs/engine/codec.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/events.js +148 -0
- package/lib/commonjs/engine/notify-kit/events.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/module.js +119 -0
- package/lib/commonjs/engine/notify-kit/module.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/android.js +159 -0
- package/lib/commonjs/engine/notify-kit/platform/android.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/index.js +57 -0
- package/lib/commonjs/engine/notify-kit/platform/index.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/ios.js +54 -0
- package/lib/commonjs/engine/notify-kit/platform/ios.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/types.js +6 -0
- package/lib/commonjs/engine/notify-kit/platform/types.js.map +1 -0
- package/lib/commonjs/engine/notify-kit-engine.js +260 -0
- package/lib/commonjs/engine/notify-kit-engine.js.map +1 -0
- package/lib/commonjs/index.js +367 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/initialize.js +187 -0
- package/lib/commonjs/initialize.js.map +1 -0
- package/lib/commonjs/interaction/index.js +120 -0
- package/lib/commonjs/interaction/index.js.map +1 -0
- package/lib/commonjs/maintenance/cycle.js +108 -0
- package/lib/commonjs/maintenance/cycle.js.map +1 -0
- package/lib/commonjs/maintenance/permission-refresh.js +39 -0
- package/lib/commonjs/maintenance/permission-refresh.js.map +1 -0
- package/lib/commonjs/maintenance/reanchor.js +99 -0
- package/lib/commonjs/maintenance/reanchor.js.map +1 -0
- package/lib/commonjs/maintenance/toggle.js +50 -0
- package/lib/commonjs/maintenance/toggle.js.map +1 -0
- package/lib/commonjs/maintenance/verify.js +70 -0
- package/lib/commonjs/maintenance/verify.js.map +1 -0
- package/lib/commonjs/maintenance/window-refresh.js +53 -0
- package/lib/commonjs/maintenance/window-refresh.js.map +1 -0
- package/lib/commonjs/notifications.js +161 -0
- package/lib/commonjs/notifications.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/permission/index.js +182 -0
- package/lib/commonjs/permission/index.js.map +1 -0
- package/lib/commonjs/permission/state.js +92 -0
- package/lib/commonjs/permission/state.js.map +1 -0
- package/lib/commonjs/push/envelope.js +141 -0
- package/lib/commonjs/push/envelope.js.map +1 -0
- package/lib/commonjs/push/fcm-provider.js +122 -0
- package/lib/commonjs/push/fcm-provider.js.map +1 -0
- package/lib/commonjs/push/gate.js +162 -0
- package/lib/commonjs/push/gate.js.map +1 -0
- package/lib/commonjs/push/index.js +47 -0
- package/lib/commonjs/push/index.js.map +1 -0
- package/lib/commonjs/push/instructions.js +101 -0
- package/lib/commonjs/push/instructions.js.map +1 -0
- package/lib/commonjs/push/provider-adapter.js +6 -0
- package/lib/commonjs/push/provider-adapter.js.map +1 -0
- package/lib/commonjs/push/signout.js +55 -0
- package/lib/commonjs/push/signout.js.map +1 -0
- package/lib/commonjs/reconcile/chunk.js +49 -0
- package/lib/commonjs/reconcile/chunk.js.map +1 -0
- package/lib/commonjs/reconcile/diff.js +105 -0
- package/lib/commonjs/reconcile/diff.js.map +1 -0
- package/lib/commonjs/reconcile/duplicates.js +60 -0
- package/lib/commonjs/reconcile/duplicates.js.map +1 -0
- package/lib/commonjs/reconcile/index.js +164 -0
- package/lib/commonjs/reconcile/index.js.map +1 -0
- package/lib/commonjs/reconcile/truncate.js +50 -0
- package/lib/commonjs/reconcile/truncate.js.map +1 -0
- package/lib/commonjs/recurrence/clock-guard.js +65 -0
- package/lib/commonjs/recurrence/clock-guard.js.map +1 -0
- package/lib/commonjs/recurrence/expand.js +254 -0
- package/lib/commonjs/recurrence/expand.js.map +1 -0
- package/lib/commonjs/recurrence/index.js +212 -0
- package/lib/commonjs/recurrence/index.js.map +1 -0
- package/lib/commonjs/repeat/expiry.js +41 -0
- package/lib/commonjs/repeat/expiry.js.map +1 -0
- package/lib/commonjs/repeat/index.js +100 -0
- package/lib/commonjs/repeat/index.js.map +1 -0
- package/lib/commonjs/repeat/marker.js +58 -0
- package/lib/commonjs/repeat/marker.js.map +1 -0
- package/lib/commonjs/repeat/place.js +83 -0
- package/lib/commonjs/repeat/place.js.map +1 -0
- package/lib/commonjs/schedule/anchor.js +243 -0
- package/lib/commonjs/schedule/anchor.js.map +1 -0
- package/lib/commonjs/schedule/index.js +142 -0
- package/lib/commonjs/schedule/index.js.map +1 -0
- package/lib/commonjs/schedule/partition.js +59 -0
- package/lib/commonjs/schedule/partition.js.map +1 -0
- package/lib/commonjs/schedule/resolve-moment.js +72 -0
- package/lib/commonjs/schedule/resolve-moment.js.map +1 -0
- package/lib/commonjs/schedule/validate-content.js +101 -0
- package/lib/commonjs/schedule/validate-content.js.map +1 -0
- package/lib/commonjs/schedule/validate-identifier.js +126 -0
- package/lib/commonjs/schedule/validate-identifier.js.map +1 -0
- package/lib/commonjs/schedule/writer.js +44 -0
- package/lib/commonjs/schedule/writer.js.map +1 -0
- package/lib/commonjs/state/caps.js +101 -0
- package/lib/commonjs/state/caps.js.map +1 -0
- package/lib/commonjs/state/dedup-ledger.js +39 -0
- package/lib/commonjs/state/dedup-ledger.js.map +1 -0
- package/lib/commonjs/state/interaction-buffer.js +98 -0
- package/lib/commonjs/state/interaction-buffer.js.map +1 -0
- package/lib/commonjs/state/mmkv-store.js +75 -0
- package/lib/commonjs/state/mmkv-store.js.map +1 -0
- package/lib/commonjs/state/permission-history.js +64 -0
- package/lib/commonjs/state/permission-history.js.map +1 -0
- package/lib/commonjs/state/record.js +269 -0
- package/lib/commonjs/state/record.js.map +1 -0
- package/lib/commonjs/state/reset.js +37 -0
- package/lib/commonjs/state/reset.js.map +1 -0
- package/lib/commonjs/state/series-ledger.js +71 -0
- package/lib/commonjs/state/series-ledger.js.map +1 -0
- package/lib/commonjs/state/store.js +39 -0
- package/lib/commonjs/state/store.js.map +1 -0
- package/lib/commonjs/testing/conformance/index.js +218 -0
- package/lib/commonjs/testing/conformance/index.js.map +1 -0
- package/lib/commonjs/testing/fake-engine.js +338 -0
- package/lib/commonjs/testing/fake-engine.js.map +1 -0
- package/lib/commonjs/testing/fake-provider.js +93 -0
- package/lib/commonjs/testing/fake-provider.js.map +1 -0
- package/lib/commonjs/testing/faults.js +59 -0
- package/lib/commonjs/testing/faults.js.map +1 -0
- package/lib/commonjs/testing/index.js +54 -0
- package/lib/commonjs/testing/index.js.map +1 -0
- package/lib/commonjs/testing/measure.js +298 -0
- package/lib/commonjs/testing/measure.js.map +1 -0
- package/lib/module/advanced.js +29 -0
- package/lib/module/advanced.js.map +1 -0
- package/lib/module/channel/migrate.js +242 -0
- package/lib/module/channel/migrate.js.map +1 -0
- package/lib/module/channel/tone-map.js +112 -0
- package/lib/module/channel/tone-map.js.map +1 -0
- package/lib/module/channel/validate-tone.js +57 -0
- package/lib/module/channel/validate-tone.js.map +1 -0
- package/lib/module/contract/channel.js +48 -0
- package/lib/module/contract/channel.js.map +1 -0
- package/lib/module/contract/diagnostics.js +21 -0
- package/lib/module/contract/diagnostics.js.map +1 -0
- package/lib/module/contract/errors.js +119 -0
- package/lib/module/contract/errors.js.map +1 -0
- package/lib/module/contract/hash.js +29 -0
- package/lib/module/contract/hash.js.map +1 -0
- package/lib/module/contract/index.js +13 -0
- package/lib/module/contract/index.js.map +1 -0
- package/lib/module/contract/interaction.js +33 -0
- package/lib/module/contract/interaction.js.map +1 -0
- package/lib/module/contract/notification.js +38 -0
- package/lib/module/contract/notification.js.map +1 -0
- package/lib/module/contract/permission.js +2 -0
- package/lib/module/contract/permission.js.map +1 -0
- package/lib/module/contract/reconcile.js +4 -0
- package/lib/module/contract/reconcile.js.map +1 -0
- package/lib/module/contract/recurrence.js +49 -0
- package/lib/module/contract/recurrence.js.map +1 -0
- package/lib/module/diagnostics/burst.js +85 -0
- package/lib/module/diagnostics/burst.js.map +1 -0
- package/lib/module/diagnostics/events.js +58 -0
- package/lib/module/diagnostics/events.js.map +1 -0
- package/lib/module/diagnostics/redact.js +44 -0
- package/lib/module/diagnostics/redact.js.map +1 -0
- package/lib/module/diagnostics/snapshot.js +64 -0
- package/lib/module/diagnostics/snapshot.js.map +1 -0
- package/lib/module/engine/adapter.js +4 -0
- package/lib/module/engine/adapter.js.map +1 -0
- package/lib/module/engine/codec.js +79 -0
- package/lib/module/engine/codec.js.map +1 -0
- package/lib/module/engine/notify-kit/events.js +139 -0
- package/lib/module/engine/notify-kit/events.js.map +1 -0
- package/lib/module/engine/notify-kit/module.js +113 -0
- package/lib/module/engine/notify-kit/module.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/android.js +155 -0
- package/lib/module/engine/notify-kit/platform/android.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/index.js +51 -0
- package/lib/module/engine/notify-kit/platform/index.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/ios.js +49 -0
- package/lib/module/engine/notify-kit/platform/ios.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/types.js +4 -0
- package/lib/module/engine/notify-kit/platform/types.js.map +1 -0
- package/lib/module/engine/notify-kit-engine.js +257 -0
- package/lib/module/engine/notify-kit-engine.js.map +1 -0
- package/lib/module/index.js +98 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/initialize.js +182 -0
- package/lib/module/initialize.js.map +1 -0
- package/lib/module/interaction/index.js +116 -0
- package/lib/module/interaction/index.js.map +1 -0
- package/lib/module/maintenance/cycle.js +102 -0
- package/lib/module/maintenance/cycle.js.map +1 -0
- package/lib/module/maintenance/permission-refresh.js +34 -0
- package/lib/module/maintenance/permission-refresh.js.map +1 -0
- package/lib/module/maintenance/reanchor.js +94 -0
- package/lib/module/maintenance/reanchor.js.map +1 -0
- package/lib/module/maintenance/toggle.js +45 -0
- package/lib/module/maintenance/toggle.js.map +1 -0
- package/lib/module/maintenance/verify.js +65 -0
- package/lib/module/maintenance/verify.js.map +1 -0
- package/lib/module/maintenance/window-refresh.js +48 -0
- package/lib/module/maintenance/window-refresh.js.map +1 -0
- package/lib/module/notifications.js +157 -0
- package/lib/module/notifications.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/permission/index.js +178 -0
- package/lib/module/permission/index.js.map +1 -0
- package/lib/module/permission/state.js +83 -0
- package/lib/module/permission/state.js.map +1 -0
- package/lib/module/push/envelope.js +137 -0
- package/lib/module/push/envelope.js.map +1 -0
- package/lib/module/push/fcm-provider.js +119 -0
- package/lib/module/push/fcm-provider.js.map +1 -0
- package/lib/module/push/gate.js +158 -0
- package/lib/module/push/gate.js.map +1 -0
- package/lib/module/push/index.js +16 -0
- package/lib/module/push/index.js.map +1 -0
- package/lib/module/push/instructions.js +97 -0
- package/lib/module/push/instructions.js.map +1 -0
- package/lib/module/push/provider-adapter.js +4 -0
- package/lib/module/push/provider-adapter.js.map +1 -0
- package/lib/module/push/signout.js +51 -0
- package/lib/module/push/signout.js.map +1 -0
- package/lib/module/reconcile/chunk.js +43 -0
- package/lib/module/reconcile/chunk.js.map +1 -0
- package/lib/module/reconcile/diff.js +101 -0
- package/lib/module/reconcile/diff.js.map +1 -0
- package/lib/module/reconcile/duplicates.js +56 -0
- package/lib/module/reconcile/duplicates.js.map +1 -0
- package/lib/module/reconcile/index.js +161 -0
- package/lib/module/reconcile/index.js.map +1 -0
- package/lib/module/reconcile/truncate.js +46 -0
- package/lib/module/reconcile/truncate.js.map +1 -0
- package/lib/module/recurrence/clock-guard.js +60 -0
- package/lib/module/recurrence/clock-guard.js.map +1 -0
- package/lib/module/recurrence/expand.js +248 -0
- package/lib/module/recurrence/expand.js.map +1 -0
- package/lib/module/recurrence/index.js +208 -0
- package/lib/module/recurrence/index.js.map +1 -0
- package/lib/module/repeat/expiry.js +37 -0
- package/lib/module/repeat/expiry.js.map +1 -0
- package/lib/module/repeat/index.js +67 -0
- package/lib/module/repeat/index.js.map +1 -0
- package/lib/module/repeat/marker.js +51 -0
- package/lib/module/repeat/marker.js.map +1 -0
- package/lib/module/repeat/place.js +79 -0
- package/lib/module/repeat/place.js.map +1 -0
- package/lib/module/schedule/anchor.js +234 -0
- package/lib/module/schedule/anchor.js.map +1 -0
- package/lib/module/schedule/index.js +137 -0
- package/lib/module/schedule/index.js.map +1 -0
- package/lib/module/schedule/partition.js +53 -0
- package/lib/module/schedule/partition.js.map +1 -0
- package/lib/module/schedule/resolve-moment.js +66 -0
- package/lib/module/schedule/resolve-moment.js.map +1 -0
- package/lib/module/schedule/validate-content.js +95 -0
- package/lib/module/schedule/validate-content.js.map +1 -0
- package/lib/module/schedule/validate-identifier.js +119 -0
- package/lib/module/schedule/validate-identifier.js.map +1 -0
- package/lib/module/schedule/writer.js +40 -0
- package/lib/module/schedule/writer.js.map +1 -0
- package/lib/module/state/caps.js +96 -0
- package/lib/module/state/caps.js.map +1 -0
- package/lib/module/state/dedup-ledger.js +34 -0
- package/lib/module/state/dedup-ledger.js.map +1 -0
- package/lib/module/state/interaction-buffer.js +92 -0
- package/lib/module/state/interaction-buffer.js.map +1 -0
- package/lib/module/state/mmkv-store.js +71 -0
- package/lib/module/state/mmkv-store.js.map +1 -0
- package/lib/module/state/permission-history.js +56 -0
- package/lib/module/state/permission-history.js.map +1 -0
- package/lib/module/state/record.js +264 -0
- package/lib/module/state/record.js.map +1 -0
- package/lib/module/state/reset.js +32 -0
- package/lib/module/state/reset.js.map +1 -0
- package/lib/module/state/series-ledger.js +62 -0
- package/lib/module/state/series-ledger.js.map +1 -0
- package/lib/module/state/store.js +35 -0
- package/lib/module/state/store.js.map +1 -0
- package/lib/module/testing/conformance/index.js +214 -0
- package/lib/module/testing/conformance/index.js.map +1 -0
- package/lib/module/testing/fake-engine.js +335 -0
- package/lib/module/testing/fake-engine.js.map +1 -0
- package/lib/module/testing/fake-provider.js +89 -0
- package/lib/module/testing/fake-provider.js.map +1 -0
- package/lib/module/testing/faults.js +55 -0
- package/lib/module/testing/faults.js.map +1 -0
- package/lib/module/testing/index.js +19 -0
- package/lib/module/testing/index.js.map +1 -0
- package/lib/module/testing/measure.js +294 -0
- package/lib/module/testing/measure.js.map +1 -0
- package/lib/typescript/commonjs/advanced.d.ts +36 -0
- package/lib/typescript/commonjs/advanced.d.ts.map +1 -0
- package/lib/typescript/commonjs/channel/migrate.d.ts +38 -0
- package/lib/typescript/commonjs/channel/migrate.d.ts.map +1 -0
- package/lib/typescript/commonjs/channel/tone-map.d.ts +34 -0
- package/lib/typescript/commonjs/channel/tone-map.d.ts.map +1 -0
- package/lib/typescript/commonjs/channel/validate-tone.d.ts +23 -0
- package/lib/typescript/commonjs/channel/validate-tone.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/channel.d.ts +185 -0
- package/lib/typescript/commonjs/contract/channel.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/diagnostics.d.ts +92 -0
- package/lib/typescript/commonjs/contract/diagnostics.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/errors.d.ts +91 -0
- package/lib/typescript/commonjs/contract/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/hash.d.ts +14 -0
- package/lib/typescript/commonjs/contract/hash.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/index.d.ts +10 -0
- package/lib/typescript/commonjs/contract/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/interaction.d.ts +53 -0
- package/lib/typescript/commonjs/contract/interaction.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/notification.d.ts +110 -0
- package/lib/typescript/commonjs/contract/notification.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/permission.d.ts +49 -0
- package/lib/typescript/commonjs/contract/permission.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/reconcile.d.ts +82 -0
- package/lib/typescript/commonjs/contract/reconcile.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/recurrence.d.ts +118 -0
- package/lib/typescript/commonjs/contract/recurrence.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/burst.d.ts +39 -0
- package/lib/typescript/commonjs/diagnostics/burst.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts +28 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/redact.d.ts +22 -0
- package/lib/typescript/commonjs/diagnostics/redact.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/snapshot.d.ts +40 -0
- package/lib/typescript/commonjs/diagnostics/snapshot.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/adapter.d.ts +172 -0
- package/lib/typescript/commonjs/engine/adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/codec.d.ts +20 -0
- package/lib/typescript/commonjs/engine/codec.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/events.d.ts +37 -0
- package/lib/typescript/commonjs/engine/notify-kit/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/module.d.ts +103 -0
- package/lib/typescript/commonjs/engine/notify-kit/module.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/android.d.ts +3 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/android.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/index.d.ts +12 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/ios.d.ts +3 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/ios.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/types.d.ts +33 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit-engine.d.ts +25 -0
- package/lib/typescript/commonjs/engine/notify-kit-engine.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +106 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/initialize.d.ts +74 -0
- package/lib/typescript/commonjs/initialize.d.ts.map +1 -0
- package/lib/typescript/commonjs/interaction/index.d.ts +53 -0
- package/lib/typescript/commonjs/interaction/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/cycle.d.ts +77 -0
- package/lib/typescript/commonjs/maintenance/cycle.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/permission-refresh.d.ts +19 -0
- package/lib/typescript/commonjs/maintenance/permission-refresh.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/reanchor.d.ts +26 -0
- package/lib/typescript/commonjs/maintenance/reanchor.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/toggle.d.ts +35 -0
- package/lib/typescript/commonjs/maintenance/toggle.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/verify.d.ts +32 -0
- package/lib/typescript/commonjs/maintenance/verify.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/window-refresh.d.ts +29 -0
- package/lib/typescript/commonjs/maintenance/window-refresh.d.ts.map +1 -0
- package/lib/typescript/commonjs/notifications.d.ts +78 -0
- package/lib/typescript/commonjs/notifications.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/permission/index.d.ts +57 -0
- package/lib/typescript/commonjs/permission/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/permission/state.d.ts +41 -0
- package/lib/typescript/commonjs/permission/state.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/envelope.d.ts +33 -0
- package/lib/typescript/commonjs/push/envelope.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/fcm-provider.d.ts +43 -0
- package/lib/typescript/commonjs/push/fcm-provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/gate.d.ts +57 -0
- package/lib/typescript/commonjs/push/gate.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/index.d.ts +19 -0
- package/lib/typescript/commonjs/push/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/instructions.d.ts +45 -0
- package/lib/typescript/commonjs/push/instructions.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/provider-adapter.d.ts +50 -0
- package/lib/typescript/commonjs/push/provider-adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/signout.d.ts +33 -0
- package/lib/typescript/commonjs/push/signout.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/chunk.d.ts +24 -0
- package/lib/typescript/commonjs/reconcile/chunk.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/diff.d.ts +54 -0
- package/lib/typescript/commonjs/reconcile/diff.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/duplicates.d.ts +32 -0
- package/lib/typescript/commonjs/reconcile/duplicates.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/index.d.ts +35 -0
- package/lib/typescript/commonjs/reconcile/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/truncate.d.ts +26 -0
- package/lib/typescript/commonjs/reconcile/truncate.d.ts.map +1 -0
- package/lib/typescript/commonjs/recurrence/clock-guard.d.ts +37 -0
- package/lib/typescript/commonjs/recurrence/clock-guard.d.ts.map +1 -0
- package/lib/typescript/commonjs/recurrence/expand.d.ts +75 -0
- package/lib/typescript/commonjs/recurrence/expand.d.ts.map +1 -0
- package/lib/typescript/commonjs/recurrence/index.d.ts +40 -0
- package/lib/typescript/commonjs/recurrence/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/expiry.d.ts +23 -0
- package/lib/typescript/commonjs/repeat/expiry.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/index.d.ts +49 -0
- package/lib/typescript/commonjs/repeat/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/marker.d.ts +36 -0
- package/lib/typescript/commonjs/repeat/marker.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/place.d.ts +39 -0
- package/lib/typescript/commonjs/repeat/place.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/anchor.d.ts +118 -0
- package/lib/typescript/commonjs/schedule/anchor.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/index.d.ts +40 -0
- package/lib/typescript/commonjs/schedule/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/partition.d.ts +29 -0
- package/lib/typescript/commonjs/schedule/partition.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/resolve-moment.d.ts +35 -0
- package/lib/typescript/commonjs/schedule/resolve-moment.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/validate-content.d.ts +42 -0
- package/lib/typescript/commonjs/schedule/validate-content.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/validate-identifier.d.ts +30 -0
- package/lib/typescript/commonjs/schedule/validate-identifier.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/writer.d.ts +36 -0
- package/lib/typescript/commonjs/schedule/writer.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/caps.d.ts +51 -0
- package/lib/typescript/commonjs/state/caps.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/dedup-ledger.d.ts +21 -0
- package/lib/typescript/commonjs/state/dedup-ledger.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/interaction-buffer.d.ts +30 -0
- package/lib/typescript/commonjs/state/interaction-buffer.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/mmkv-store.d.ts +33 -0
- package/lib/typescript/commonjs/state/mmkv-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/permission-history.d.ts +20 -0
- package/lib/typescript/commonjs/state/permission-history.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/record.d.ts +134 -0
- package/lib/typescript/commonjs/state/record.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/reset.d.ts +22 -0
- package/lib/typescript/commonjs/state/reset.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/series-ledger.d.ts +47 -0
- package/lib/typescript/commonjs/state/series-ledger.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/store.d.ts +20 -0
- package/lib/typescript/commonjs/state/store.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/index.d.ts +32 -0
- package/lib/typescript/commonjs/testing/conformance/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/fake-engine.d.ts +91 -0
- package/lib/typescript/commonjs/testing/fake-engine.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/fake-provider.d.ts +35 -0
- package/lib/typescript/commonjs/testing/fake-provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/faults.d.ts +38 -0
- package/lib/typescript/commonjs/testing/faults.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/index.d.ts +22 -0
- package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/measure.d.ts +59 -0
- package/lib/typescript/commonjs/testing/measure.d.ts.map +1 -0
- package/lib/typescript/module/advanced.d.ts +36 -0
- package/lib/typescript/module/advanced.d.ts.map +1 -0
- package/lib/typescript/module/channel/migrate.d.ts +38 -0
- package/lib/typescript/module/channel/migrate.d.ts.map +1 -0
- package/lib/typescript/module/channel/tone-map.d.ts +34 -0
- package/lib/typescript/module/channel/tone-map.d.ts.map +1 -0
- package/lib/typescript/module/channel/validate-tone.d.ts +23 -0
- package/lib/typescript/module/channel/validate-tone.d.ts.map +1 -0
- package/lib/typescript/module/contract/channel.d.ts +185 -0
- package/lib/typescript/module/contract/channel.d.ts.map +1 -0
- package/lib/typescript/module/contract/diagnostics.d.ts +92 -0
- package/lib/typescript/module/contract/diagnostics.d.ts.map +1 -0
- package/lib/typescript/module/contract/errors.d.ts +91 -0
- package/lib/typescript/module/contract/errors.d.ts.map +1 -0
- package/lib/typescript/module/contract/hash.d.ts +14 -0
- package/lib/typescript/module/contract/hash.d.ts.map +1 -0
- package/lib/typescript/module/contract/index.d.ts +10 -0
- package/lib/typescript/module/contract/index.d.ts.map +1 -0
- package/lib/typescript/module/contract/interaction.d.ts +53 -0
- package/lib/typescript/module/contract/interaction.d.ts.map +1 -0
- package/lib/typescript/module/contract/notification.d.ts +110 -0
- package/lib/typescript/module/contract/notification.d.ts.map +1 -0
- package/lib/typescript/module/contract/permission.d.ts +49 -0
- package/lib/typescript/module/contract/permission.d.ts.map +1 -0
- package/lib/typescript/module/contract/reconcile.d.ts +82 -0
- package/lib/typescript/module/contract/reconcile.d.ts.map +1 -0
- package/lib/typescript/module/contract/recurrence.d.ts +118 -0
- package/lib/typescript/module/contract/recurrence.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/burst.d.ts +39 -0
- package/lib/typescript/module/diagnostics/burst.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/events.d.ts +28 -0
- package/lib/typescript/module/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/redact.d.ts +22 -0
- package/lib/typescript/module/diagnostics/redact.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/snapshot.d.ts +40 -0
- package/lib/typescript/module/diagnostics/snapshot.d.ts.map +1 -0
- package/lib/typescript/module/engine/adapter.d.ts +172 -0
- package/lib/typescript/module/engine/adapter.d.ts.map +1 -0
- package/lib/typescript/module/engine/codec.d.ts +20 -0
- package/lib/typescript/module/engine/codec.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/events.d.ts +37 -0
- package/lib/typescript/module/engine/notify-kit/events.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/module.d.ts +103 -0
- package/lib/typescript/module/engine/notify-kit/module.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/android.d.ts +3 -0
- package/lib/typescript/module/engine/notify-kit/platform/android.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/index.d.ts +12 -0
- package/lib/typescript/module/engine/notify-kit/platform/index.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/ios.d.ts +3 -0
- package/lib/typescript/module/engine/notify-kit/platform/ios.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/types.d.ts +33 -0
- package/lib/typescript/module/engine/notify-kit/platform/types.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit-engine.d.ts +25 -0
- package/lib/typescript/module/engine/notify-kit-engine.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +106 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/initialize.d.ts +74 -0
- package/lib/typescript/module/initialize.d.ts.map +1 -0
- package/lib/typescript/module/interaction/index.d.ts +53 -0
- package/lib/typescript/module/interaction/index.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/cycle.d.ts +77 -0
- package/lib/typescript/module/maintenance/cycle.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/permission-refresh.d.ts +19 -0
- package/lib/typescript/module/maintenance/permission-refresh.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/reanchor.d.ts +26 -0
- package/lib/typescript/module/maintenance/reanchor.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/toggle.d.ts +35 -0
- package/lib/typescript/module/maintenance/toggle.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/verify.d.ts +32 -0
- package/lib/typescript/module/maintenance/verify.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/window-refresh.d.ts +29 -0
- package/lib/typescript/module/maintenance/window-refresh.d.ts.map +1 -0
- package/lib/typescript/module/notifications.d.ts +78 -0
- package/lib/typescript/module/notifications.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/permission/index.d.ts +57 -0
- package/lib/typescript/module/permission/index.d.ts.map +1 -0
- package/lib/typescript/module/permission/state.d.ts +41 -0
- package/lib/typescript/module/permission/state.d.ts.map +1 -0
- package/lib/typescript/module/push/envelope.d.ts +33 -0
- package/lib/typescript/module/push/envelope.d.ts.map +1 -0
- package/lib/typescript/module/push/fcm-provider.d.ts +43 -0
- package/lib/typescript/module/push/fcm-provider.d.ts.map +1 -0
- package/lib/typescript/module/push/gate.d.ts +57 -0
- package/lib/typescript/module/push/gate.d.ts.map +1 -0
- package/lib/typescript/module/push/index.d.ts +19 -0
- package/lib/typescript/module/push/index.d.ts.map +1 -0
- package/lib/typescript/module/push/instructions.d.ts +45 -0
- package/lib/typescript/module/push/instructions.d.ts.map +1 -0
- package/lib/typescript/module/push/provider-adapter.d.ts +50 -0
- package/lib/typescript/module/push/provider-adapter.d.ts.map +1 -0
- package/lib/typescript/module/push/signout.d.ts +33 -0
- package/lib/typescript/module/push/signout.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/chunk.d.ts +24 -0
- package/lib/typescript/module/reconcile/chunk.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/diff.d.ts +54 -0
- package/lib/typescript/module/reconcile/diff.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/duplicates.d.ts +32 -0
- package/lib/typescript/module/reconcile/duplicates.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/index.d.ts +35 -0
- package/lib/typescript/module/reconcile/index.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/truncate.d.ts +26 -0
- package/lib/typescript/module/reconcile/truncate.d.ts.map +1 -0
- package/lib/typescript/module/recurrence/clock-guard.d.ts +37 -0
- package/lib/typescript/module/recurrence/clock-guard.d.ts.map +1 -0
- package/lib/typescript/module/recurrence/expand.d.ts +75 -0
- package/lib/typescript/module/recurrence/expand.d.ts.map +1 -0
- package/lib/typescript/module/recurrence/index.d.ts +40 -0
- package/lib/typescript/module/recurrence/index.d.ts.map +1 -0
- package/lib/typescript/module/repeat/expiry.d.ts +23 -0
- package/lib/typescript/module/repeat/expiry.d.ts.map +1 -0
- package/lib/typescript/module/repeat/index.d.ts +49 -0
- package/lib/typescript/module/repeat/index.d.ts.map +1 -0
- package/lib/typescript/module/repeat/marker.d.ts +36 -0
- package/lib/typescript/module/repeat/marker.d.ts.map +1 -0
- package/lib/typescript/module/repeat/place.d.ts +39 -0
- package/lib/typescript/module/repeat/place.d.ts.map +1 -0
- package/lib/typescript/module/schedule/anchor.d.ts +118 -0
- package/lib/typescript/module/schedule/anchor.d.ts.map +1 -0
- package/lib/typescript/module/schedule/index.d.ts +40 -0
- package/lib/typescript/module/schedule/index.d.ts.map +1 -0
- package/lib/typescript/module/schedule/partition.d.ts +29 -0
- package/lib/typescript/module/schedule/partition.d.ts.map +1 -0
- package/lib/typescript/module/schedule/resolve-moment.d.ts +35 -0
- package/lib/typescript/module/schedule/resolve-moment.d.ts.map +1 -0
- package/lib/typescript/module/schedule/validate-content.d.ts +42 -0
- package/lib/typescript/module/schedule/validate-content.d.ts.map +1 -0
- package/lib/typescript/module/schedule/validate-identifier.d.ts +30 -0
- package/lib/typescript/module/schedule/validate-identifier.d.ts.map +1 -0
- package/lib/typescript/module/schedule/writer.d.ts +36 -0
- package/lib/typescript/module/schedule/writer.d.ts.map +1 -0
- package/lib/typescript/module/state/caps.d.ts +51 -0
- package/lib/typescript/module/state/caps.d.ts.map +1 -0
- package/lib/typescript/module/state/dedup-ledger.d.ts +21 -0
- package/lib/typescript/module/state/dedup-ledger.d.ts.map +1 -0
- package/lib/typescript/module/state/interaction-buffer.d.ts +30 -0
- package/lib/typescript/module/state/interaction-buffer.d.ts.map +1 -0
- package/lib/typescript/module/state/mmkv-store.d.ts +33 -0
- package/lib/typescript/module/state/mmkv-store.d.ts.map +1 -0
- package/lib/typescript/module/state/permission-history.d.ts +20 -0
- package/lib/typescript/module/state/permission-history.d.ts.map +1 -0
- package/lib/typescript/module/state/record.d.ts +134 -0
- package/lib/typescript/module/state/record.d.ts.map +1 -0
- package/lib/typescript/module/state/reset.d.ts +22 -0
- package/lib/typescript/module/state/reset.d.ts.map +1 -0
- package/lib/typescript/module/state/series-ledger.d.ts +47 -0
- package/lib/typescript/module/state/series-ledger.d.ts.map +1 -0
- package/lib/typescript/module/state/store.d.ts +20 -0
- package/lib/typescript/module/state/store.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/index.d.ts +32 -0
- package/lib/typescript/module/testing/conformance/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/fake-engine.d.ts +91 -0
- package/lib/typescript/module/testing/fake-engine.d.ts.map +1 -0
- package/lib/typescript/module/testing/fake-provider.d.ts +35 -0
- package/lib/typescript/module/testing/fake-provider.d.ts.map +1 -0
- package/lib/typescript/module/testing/faults.d.ts +38 -0
- package/lib/typescript/module/testing/faults.d.ts.map +1 -0
- package/lib/typescript/module/testing/index.d.ts +22 -0
- package/lib/typescript/module/testing/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/measure.d.ts +59 -0
- package/lib/typescript/module/testing/measure.d.ts.map +1 -0
- package/package.json +72 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,116 @@
|
|
|
1
1
|
# @chipmobilesdk/rn-notification
|
|
2
2
|
|
|
3
|
+
## 0.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Every peer range has an upper bound, and no package declares a peer it does not use. ([#21](https://github.com/operationd8979/chip-mobile-sdk/pull/21))
|
|
8
|
+
|
|
9
|
+
A peer range is now a caret, a tilde or an explicit `<`, except for `react` and
|
|
10
|
+
`react-native`: an app brings exactly one of each, so a floor is the only useful thing
|
|
11
|
+
to say about them. Every other peer is a library the app installs beside us, and an
|
|
12
|
+
open `>=` was a promise about versions nobody had run — mmkv 3→4 lost entitlements and
|
|
13
|
+
pending purchases exactly that way.
|
|
14
|
+
|
|
15
|
+
**Four of the new ceilings exclude a version that is already published**, so an app
|
|
16
|
+
that took the open range at its word may now see a peer warning. The new bound is the
|
|
17
|
+
major this release is tested against, which is the thing the old range failed to say:
|
|
18
|
+
|
|
19
|
+
| Peer | Was | Now | Published above the ceiling |
|
|
20
|
+
|---|---|---|---|
|
|
21
|
+
| `react-native-app-auth` (rn-auth) | `>=8` | `^8.0.0` | 9.0.0 |
|
|
22
|
+
| `react-native-keychain` (rn-auth) | `>=10` | `^10.0.0` | 11.0.0 |
|
|
23
|
+
| `@op-engineering/op-sqlite` (rn-local-db) | `>=17.1.0` | `^17.1.0` | 18.x, 19.x |
|
|
24
|
+
| `@react-native-firebase/messaging` (rn-notification) | `>=26.0.0` | `^26.0.0` | 27.x |
|
|
25
|
+
|
|
26
|
+
The others — `react-native-vision-camera` `^5.1.1`, `react-native-svg` `^15.15.0`,
|
|
27
|
+
`react-native-unistyles` `^3.2.0`, `@dr.pogodin/react-native-fs` `^2.39.2`,
|
|
28
|
+
`react-native-quick-crypto` `^1.0.0`, `react-native-notify-kit` `^10.5.0`,
|
|
29
|
+
`react-native-localize` `^3.7.0`, `react-native-mmkv` `^4.0.0` — exclude nothing that
|
|
30
|
+
exists today. rn-payment's mmkv range was already bounded (`>=4.0.0 <5`) and is now
|
|
31
|
+
written as the caret that means the same thing.
|
|
32
|
+
|
|
33
|
+
Peers nothing imports are gone. `rn-theme`, `rn-local-db` and `rn-notification` asked
|
|
34
|
+
for `react` without having a component or a hook between them; `rn-auth`, `rn-ai` and
|
|
35
|
+
`rn-i18n` asked for `react-native` without touching a React Native API (rn-auth reaches
|
|
36
|
+
both native modules through `lazyPeer`, rn-i18n formats on `Intl`); `rn-notification`
|
|
37
|
+
asked for `@react-native-firebase/app`, which messaging declares itself. `rn-ai` no
|
|
38
|
+
longer peers on `@chipmobilesdk/rn-auth` at all — it asks for a `TokenProvider`, a
|
|
39
|
+
two-method interface rn-auth's `auth` satisfies, so an app with its own token source
|
|
40
|
+
installs nothing extra. An app that enables push or signs in through rn-auth installs
|
|
41
|
+
the same packages as before; it is the manifest that stopped overstating.
|
|
42
|
+
|
|
43
|
+
`react-native-localize` is declared optional, which is what the code already did: the
|
|
44
|
+
time-zone reader goes through `lazyPeer` and falls back to `Intl` without it. The
|
|
45
|
+
`peerDependenciesMeta` entries that said `optional: false` are gone — that is npm's
|
|
46
|
+
default, and writing it down only invited the question of which peers were undecided.
|
|
47
|
+
|
|
48
|
+
`npm run check:manifests` now fails on an unbounded peer range, a peer nothing in
|
|
49
|
+
`src/` imports, and a `peerDependenciesMeta` entry for either, so the policy holds
|
|
50
|
+
without anyone remembering it.
|
|
51
|
+
|
|
52
|
+
- Every package now ships built JavaScript with declaration files, instead of asking the
|
|
53
|
+
app to compile its TypeScript. ([#22](https://github.com/operationd8979/chip-mobile-sdk/pull/22))
|
|
54
|
+
|
|
55
|
+
Each tarball carries `lib/commonjs`, `lib/module` and `lib/typescript` (built with
|
|
56
|
+
`react-native-builder-bob`), and `src/` alongside them. What that changes for a
|
|
57
|
+
consumer:
|
|
58
|
+
|
|
59
|
+
- **Nothing to add to `transformIgnorePatterns`.** `require` resolves to the CommonJS
|
|
60
|
+
build, so an app's Jest loads this package without being told to transform it. That
|
|
61
|
+
was the one thing every consuming app had to know about us (DEP-04).
|
|
62
|
+
- **Typechecking reads our `.d.ts`** rather than compiling our source under our
|
|
63
|
+
`tsconfig`. A consumer's stricter — or looser — settings no longer meet our code.
|
|
64
|
+
- **`import` resolves to ESM**, so a bundler can tree-shake what it does not use.
|
|
65
|
+
|
|
66
|
+
No exported name changed, and no subpath moved: `.`, `./testing`, `./push`,
|
|
67
|
+
`./advanced`, `./app-auth`, `./keychain` and rn-core's twelve subpaths resolve exactly
|
|
68
|
+
as before, each now with its own declarations for both module systems. publint and
|
|
69
|
+
`attw --profile node16` pass on all twelve packages, which they could not before.
|
|
70
|
+
|
|
71
|
+
Inside the monorepo nothing changed either, and that is deliberate: every subpath also
|
|
72
|
+
declares a private `chipmobilesdk-source` condition pointing at its TypeScript, and
|
|
73
|
+
Metro, Jest and `tsc` here ask for that condition first. The demo app bundles 371
|
|
74
|
+
modules straight from `packages/*/src`, so editing a package still changes the app with
|
|
75
|
+
no build step, and coverage is still measured on the source. The condition is named for
|
|
76
|
+
this organization rather than using the conventional `source` because third-party
|
|
77
|
+
packages declare that one too — `@dr.pogodin/react-native-fs` does — and asking for it
|
|
78
|
+
pulled their sources into our stricter compile.
|
|
79
|
+
|
|
80
|
+
`npm run build:packages` builds everything, `prepack` rebuilds before any `npm pack`,
|
|
81
|
+
and `lib/` is git-ignored: the published bytes are produced by the release, never
|
|
82
|
+
committed. `npm run check:manifests` now fails a package whose `main`, `module`,
|
|
83
|
+
`types`, `source` condition, `files`, build script or `prepack` do not match this shape.
|
|
84
|
+
|
|
85
|
+
### Patch Changes
|
|
86
|
+
|
|
87
|
+
- Each package's public API and its weight are now recorded in the repository, so a change
|
|
88
|
+
to either is reviewed rather than discovered. ([#23](https://github.com/operationd8979/chip-mobile-sdk/pull/23))
|
|
89
|
+
|
|
90
|
+
`packages/<pkg>/etc/*.api.md` is an api-extractor report per entrypoint — twenty-seven
|
|
91
|
+
of them, generated from the declarations the package publishes and committed. A renamed
|
|
92
|
+
type, a widened union, one more optional field: all of it shows up in a pull request's
|
|
93
|
+
diff. `npm run check:api` fails when a report is out of date and `npm run api:update`
|
|
94
|
+
rewrites them.
|
|
95
|
+
|
|
96
|
+
A report that moves now needs a **minor or major** changeset for that package.
|
|
97
|
+
`check:changesets` enforces it, because the report is generated from what the package
|
|
98
|
+
publishes, and a patch release that moves the public surface is how a consumer's build
|
|
99
|
+
breaks on `npm update`. A report added for the first time is a baseline, not a change.
|
|
100
|
+
`./testing` deliberately has no report: test doubles are not a surface a release is
|
|
101
|
+
gated on.
|
|
102
|
+
|
|
103
|
+
`npm run check:size` holds every entrypoint to a budget in `.size-limit.json`, measured
|
|
104
|
+
on the ESM build with peers and rn-core treated as external — they are what an app
|
|
105
|
+
installs beside us, not our weight. Each budget started at today's measurement plus five
|
|
106
|
+
per cent, so growth becomes a decision someone makes instead of a drift nobody sees. The
|
|
107
|
+
current figures run from 500 B (`rn-core/lazy`) to 19 kB (rn-notification).
|
|
108
|
+
|
|
109
|
+
No behaviour or API changed in this release; the entry is here so the changelog records
|
|
110
|
+
when the reports and the budgets began.
|
|
111
|
+
- Updated dependencies ([#22](https://github.com/operationd8979/chip-mobile-sdk/pull/22), [#23](https://github.com/operationd8979/chip-mobile-sdk/pull/23)):
|
|
112
|
+
- @chipmobilesdk/rn-core@0.2.0
|
|
113
|
+
|
|
3
114
|
## 0.6.0
|
|
4
115
|
|
|
5
116
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -78,12 +78,14 @@ cd ios && pod install
|
|
|
78
78
|
|
|
79
79
|
| Package | Required | Purpose |
|
|
80
80
|
|---|---|---|
|
|
81
|
-
| `react
|
|
82
|
-
| `react-native-notify-kit`
|
|
83
|
-
| `react-native-mmkv`
|
|
84
|
-
| `react-native-localize`
|
|
85
|
-
| `@react-native-firebase/
|
|
86
|
-
|
|
81
|
+
| `react-native` >= 0.85 | yes | Host platform. There is no `react` peer: this package has no component and no hook |
|
|
82
|
+
| `react-native-notify-kit` `^10.5.0` | yes | Local notification engine |
|
|
83
|
+
| `react-native-mmkv` `^4.0.0` | yes | Bounded persisted state |
|
|
84
|
+
| `react-native-localize` `^3.7.0` | **optional** | Platform time zone for re-anchoring. Already reached through `lazyPeer`: without it the reader falls back to `Intl`, which React Native does not promise to update when the device zone changes |
|
|
85
|
+
| `@react-native-firebase/messaging` `^26.0.0` | **optional** | Push only |
|
|
86
|
+
|
|
87
|
+
`@react-native-firebase/app` is not a peer of this package — messaging declares it
|
|
88
|
+
itself — but an app that enables push still has to install it, as the note below says.
|
|
87
89
|
|
|
88
90
|
### Enabling push (optional)
|
|
89
91
|
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "MaintenanceController", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _toggle.MaintenanceController;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "MaintenanceRegistry", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _cycle.MaintenanceRegistry;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "StateManager", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _record.StateManager;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "createBurstDetector", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _burst.createBurstDetector;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "createChannels", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _migrate.createChannels;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "createInteractions", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _index4.createInteractions;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "createMmkvStore", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _mmkvStore.createMmkvStore;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "createPermissionRefreshStep", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _permissionRefresh.createPermissionRefreshStep;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "createPermissions", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _index5.createPermissions;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "createPlatformTimeZoneReader", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _anchor.createPlatformTimeZoneReader;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "createReAnchorStep", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _reanchor.createReAnchorStep;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "createReconciler", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _index2.createReconciler;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "createRecurrence", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return _index3.createRecurrence;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "createScheduler", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _index.createScheduler;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "createSnapshot", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _snapshot.createSnapshot;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "createToneResolver", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () {
|
|
99
|
+
return _toneMap.createToneResolver;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, "createVerifyStep", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () {
|
|
105
|
+
return _verify.createVerifyStep;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "createWindowRefreshStep", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return _windowRefresh.createWindowRefreshStep;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "initialize", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function () {
|
|
117
|
+
return _initialize.initialize;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
var _initialize = require("./initialize.js");
|
|
121
|
+
var _index = require("./schedule/index.js");
|
|
122
|
+
var _index2 = require("./reconcile/index.js");
|
|
123
|
+
var _index3 = require("./recurrence/index.js");
|
|
124
|
+
var _migrate = require("./channel/migrate.js");
|
|
125
|
+
var _toneMap = require("./channel/tone-map.js");
|
|
126
|
+
var _index4 = require("./interaction/index.js");
|
|
127
|
+
var _snapshot = require("./diagnostics/snapshot.js");
|
|
128
|
+
var _burst = require("./diagnostics/burst.js");
|
|
129
|
+
var _index5 = require("./permission/index.js");
|
|
130
|
+
var _permissionRefresh = require("./maintenance/permission-refresh.js");
|
|
131
|
+
var _reanchor = require("./maintenance/reanchor.js");
|
|
132
|
+
var _verify = require("./maintenance/verify.js");
|
|
133
|
+
var _windowRefresh = require("./maintenance/window-refresh.js");
|
|
134
|
+
var _toggle = require("./maintenance/toggle.js");
|
|
135
|
+
var _cycle = require("./maintenance/cycle.js");
|
|
136
|
+
var _record = require("./state/record.js");
|
|
137
|
+
var _mmkvStore = require("./state/mmkv-store.js");
|
|
138
|
+
var _anchor = require("./schedule/anchor.js");
|
|
139
|
+
//# sourceMappingURL=advanced.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_initialize","require","_index","_index2","_index3","_migrate","_toneMap","_index4","_snapshot","_burst","_index5","_permissionRefresh","_reanchor","_verify","_windowRefresh","_toggle","_cycle","_record","_mmkvStore","_anchor"],"sourceRoot":"../../src","sources":["advanced.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AAEA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAEA,IAAAO,SAAA,GAAAP,OAAA;AAEA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAEA,IAAAU,kBAAA,GAAAV,OAAA;AACA,IAAAW,SAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AACA,IAAAa,cAAA,GAAAb,OAAA;AACA,IAAAc,OAAA,GAAAd,OAAA;AACA,IAAAe,MAAA,GAAAf,OAAA;AAEA,IAAAgB,OAAA,GAAAhB,OAAA;AACA,IAAAiB,UAAA,GAAAjB,OAAA;AACA,IAAAkB,OAAA,GAAAlB,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createChannels = createChannels;
|
|
7
|
+
var _errors = require("../contract/errors.js");
|
|
8
|
+
var _toneMap = require("./tone-map.js");
|
|
9
|
+
var _validateTone = require("./validate-tone.js");
|
|
10
|
+
var _writer = require("../schedule/writer.js");
|
|
11
|
+
/**
|
|
12
|
+
* Channel declaration and migration.
|
|
13
|
+
*
|
|
14
|
+
* Android channels are immutable once created: declaring a channel whose id
|
|
15
|
+
* already exists silently keeps the original configuration. That single fact is
|
|
16
|
+
* why changing a tone is a **migration** rather than an assignment, and why
|
|
17
|
+
* this package keeps its own ledger — the platform will not tell you which
|
|
18
|
+
* version of a channel a device already holds.
|
|
19
|
+
*
|
|
20
|
+
* Migration creates the new channel, re-homes notifications still pointing at
|
|
21
|
+
* the old one, and only then retires it. That order matters: retiring first
|
|
22
|
+
* would leave live notifications attached to a channel that no longer exists.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
function ledgerFor(state, toneId) {
|
|
26
|
+
return state.read().migrationLedger.find(entry => entry.toneId === toneId && !entry.retired);
|
|
27
|
+
}
|
|
28
|
+
function recordApplied(state, tone, now, retiredChannelId, labelFingerprint) {
|
|
29
|
+
state.update('migrationLedger', current => {
|
|
30
|
+
const withoutTone = current.filter(entry => entry.toneId !== tone.id);
|
|
31
|
+
const retired = retiredChannelId === undefined ? [] : [{
|
|
32
|
+
at: now,
|
|
33
|
+
toneId: tone.id,
|
|
34
|
+
appliedVersion: 0,
|
|
35
|
+
channelId: retiredChannelId,
|
|
36
|
+
retired: true
|
|
37
|
+
}];
|
|
38
|
+
return [...withoutTone, ...retired, {
|
|
39
|
+
at: now,
|
|
40
|
+
toneId: tone.id,
|
|
41
|
+
appliedVersion: tone.version,
|
|
42
|
+
channelId: (0, _toneMap.channelIdFor)(tone.id, tone.version),
|
|
43
|
+
retired: false,
|
|
44
|
+
labelFingerprint
|
|
45
|
+
}];
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function createChannels(deps) {
|
|
49
|
+
const emit = deps.emit ?? (() => {});
|
|
50
|
+
// Re-homing re-writes each notification on the new channel; its stop marker
|
|
51
|
+
// has to follow, or it would retire with the old channel.
|
|
52
|
+
const writer = (0, _writer.createScheduleWriter)(deps.engine);
|
|
53
|
+
const applyTones = async (tones, groups) => {
|
|
54
|
+
// Validation completes before the first engine call, so a rejected
|
|
55
|
+
// declaration leaves the device exactly as it was — the same order the
|
|
56
|
+
// scheduler has always used.
|
|
57
|
+
(0, _validateTone.validateToneDeclarations)(tones);
|
|
58
|
+
const now = deps.now();
|
|
59
|
+
const created = [];
|
|
60
|
+
const migrated = [];
|
|
61
|
+
const labelsRefreshed = [];
|
|
62
|
+
const retired = [];
|
|
63
|
+
const reHomed = [];
|
|
64
|
+
const cancelled = [];
|
|
65
|
+
const bypassUnavailable = [];
|
|
66
|
+
const repeatUnavailable = [];
|
|
67
|
+
const unchanged = [];
|
|
68
|
+
if (groups.length > 0) {
|
|
69
|
+
await deps.engine.declareGroups(groups);
|
|
70
|
+
}
|
|
71
|
+
const capabilities = await deps.engine.getCapabilities();
|
|
72
|
+
for (const tone of tones) {
|
|
73
|
+
const previous = ledgerFor(deps.state, tone.id);
|
|
74
|
+
const resolved = (0, _toneMap.resolveTone)(tone);
|
|
75
|
+
const fingerprint = (0, _toneMap.toneLabelFingerprint)(tone);
|
|
76
|
+
|
|
77
|
+
// Refusals are reported for every tone that asked, whether or not
|
|
78
|
+
// anything else about it moved. A platform declining an attribute
|
|
79
|
+
// says nothing about whether the channel is new.
|
|
80
|
+
if (tone.bypassDoNotDisturb === true && !capabilities.supportsDoNotDisturbBypass) {
|
|
81
|
+
// Reported honestly rather than silently dropped — a consumer that
|
|
82
|
+
// asked for a bypass deserves to know the platform refused.
|
|
83
|
+
bypassUnavailable.push(tone.id);
|
|
84
|
+
emit(_errors.DIAGNOSTIC_CODES.DND_BYPASS_UNAVAILABLE, `Tone "${tone.id}" requested a Do Not Disturb bypass, which this platform does not permit.`, {
|
|
85
|
+
toneId: tone.id
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (tone.repeatAlert !== undefined) {
|
|
89
|
+
if (!capabilities.supportsRepeatingAlert) {
|
|
90
|
+
repeatUnavailable.push(tone.id);
|
|
91
|
+
emit(_errors.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.`, {
|
|
92
|
+
toneId: tone.id
|
|
93
|
+
});
|
|
94
|
+
} else if (!deps.engine.hasBackgroundDeliveryHandler()) {
|
|
95
|
+
// Said out loud at declaration time, because the alternative is a
|
|
96
|
+
// user meeting it as a phone that will not stop ringing.
|
|
97
|
+
emit(_errors.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.`, {
|
|
98
|
+
toneId: tone.id
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const versionMoved = previous !== undefined && previous.appliedVersion !== tone.version;
|
|
103
|
+
if (previous !== undefined && !versionMoved) {
|
|
104
|
+
// The version is the same, so nothing the platform freezes has
|
|
105
|
+
// changed. Only the labels can still be stale — and correcting
|
|
106
|
+
// those must cost the user nothing, so the platform is touched
|
|
107
|
+
// only when the fingerprint actually moved.
|
|
108
|
+
if (previous.labelFingerprint === fingerprint) {
|
|
109
|
+
unchanged.push(tone.id);
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const outcome = await deps.engine.declareTone(resolved);
|
|
113
|
+
if (outcome === 'created') {
|
|
114
|
+
// The channel was gone — deleted by the user, or lost with the
|
|
115
|
+
// app's data — so this is a first declaration rather than a
|
|
116
|
+
// refresh, whatever our ledger believed.
|
|
117
|
+
created.push(resolved.android.channelId);
|
|
118
|
+
} else if (outcome === 'labelsRefreshed') {
|
|
119
|
+
labelsRefreshed.push(tone.id);
|
|
120
|
+
emit(_errors.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.`, {
|
|
121
|
+
toneId: tone.id
|
|
122
|
+
});
|
|
123
|
+
} else {
|
|
124
|
+
unchanged.push(tone.id);
|
|
125
|
+
}
|
|
126
|
+
recordApplied(deps.state, tone, now, undefined, fingerprint);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const outcome = await deps.engine.declareTone(resolved);
|
|
130
|
+
if (outcome === 'created') {
|
|
131
|
+
created.push(resolved.android.channelId);
|
|
132
|
+
}
|
|
133
|
+
if (previous === undefined) {
|
|
134
|
+
recordApplied(deps.state, tone, now, undefined, fingerprint);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// A version moved, so this is a migration rather than a first
|
|
139
|
+
// declaration. Re-home before retiring: the reverse order would leave
|
|
140
|
+
// live notifications attached to a channel that no longer exists.
|
|
141
|
+
emit(_errors.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.`, {
|
|
142
|
+
toneId: tone.id,
|
|
143
|
+
from: previous.appliedVersion,
|
|
144
|
+
to: tone.version
|
|
145
|
+
});
|
|
146
|
+
const pending = await deps.engine.getPending();
|
|
147
|
+
const affected = pending.filter(entry => entry.tone === tone.id);
|
|
148
|
+
for (const entry of affected) {
|
|
149
|
+
await writer.write({
|
|
150
|
+
request: {
|
|
151
|
+
id: entry.id,
|
|
152
|
+
content: entry.content,
|
|
153
|
+
tone: entry.tone,
|
|
154
|
+
moment: {
|
|
155
|
+
at: entry.resolvedAt,
|
|
156
|
+
anchoring: entry.anchoring
|
|
157
|
+
},
|
|
158
|
+
routing: entry.routing,
|
|
159
|
+
actions: entry.actions,
|
|
160
|
+
ownerTag: entry.ownerTag,
|
|
161
|
+
groupTag: entry.groupTag
|
|
162
|
+
},
|
|
163
|
+
resolvedAt: entry.resolvedAt,
|
|
164
|
+
tone: resolved,
|
|
165
|
+
// Re-homing changes the channel, not the anchoring — preserve it.
|
|
166
|
+
anchoringGeneration: entry.anchoringGeneration,
|
|
167
|
+
approximate: entry.mayBeDelayed,
|
|
168
|
+
seriesId: entry.seriesId,
|
|
169
|
+
pushCreated: entry.pushCreated
|
|
170
|
+
});
|
|
171
|
+
reHomed.push(entry.id);
|
|
172
|
+
}
|
|
173
|
+
const didRetire = await deps.engine.retireTone(previous.channelId);
|
|
174
|
+
if (didRetire) {
|
|
175
|
+
retired.push(previous.channelId);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// A version move outranks a label change: the new channel simply
|
|
179
|
+
// carries the new labels, and reporting it as a refresh would hide a
|
|
180
|
+
// migration the consumer needs to know about.
|
|
181
|
+
migrated.push({
|
|
182
|
+
toneId: tone.id,
|
|
183
|
+
from: previous.appliedVersion,
|
|
184
|
+
to: tone.version
|
|
185
|
+
});
|
|
186
|
+
recordApplied(deps.state, tone, now, previous.channelId, fingerprint);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Anything left on a retired channel would be an orphan — a notification
|
|
190
|
+
// the user can no longer control from system settings.
|
|
191
|
+
const orphans = await findOrphans(deps, tones);
|
|
192
|
+
if (orphans.length > 0) {
|
|
193
|
+
await deps.engine.cancelMany(orphans);
|
|
194
|
+
cancelled.push(...orphans);
|
|
195
|
+
emit(_errors.DIAGNOSTIC_CODES.CHANNEL_ORPHANS_FOUND, `${orphans.length} notification(s) remained on a retired channel and were cancelled, rather than left uncontrollable from system settings.`, {
|
|
196
|
+
count: orphans.length
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
created,
|
|
201
|
+
migrated,
|
|
202
|
+
labelsRefreshed,
|
|
203
|
+
retired,
|
|
204
|
+
reHomed,
|
|
205
|
+
cancelled,
|
|
206
|
+
bypassUnavailable,
|
|
207
|
+
repeatUnavailable,
|
|
208
|
+
unchanged
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
return {
|
|
212
|
+
/**
|
|
213
|
+
* Applies a tone configuration, migrating any tone whose version moved.
|
|
214
|
+
*
|
|
215
|
+
* Applying an unchanged configuration performs no work at all: no channel
|
|
216
|
+
* is recreated and no migration is triggered.
|
|
217
|
+
*/
|
|
218
|
+
apply(tones, groups = []) {
|
|
219
|
+
// The declared channels are read once for the whole apply rather than once
|
|
220
|
+
// per tone, when the engine can hold them (NOT-08).
|
|
221
|
+
const run = () => applyTones(tones, groups);
|
|
222
|
+
return deps.engine.withChannelSnapshot ? deps.engine.withChannelSnapshot(run) : run();
|
|
223
|
+
},
|
|
224
|
+
/** Which version of each tone this device actually holds. */
|
|
225
|
+
appliedVersions() {
|
|
226
|
+
return deps.state.read().migrationLedger.filter(entry => !entry.retired).map(entry => ({
|
|
227
|
+
toneId: entry.toneId,
|
|
228
|
+
appliedVersion: entry.appliedVersion
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Notifications whose tone is no longer declared at all. */
|
|
235
|
+
async function findOrphans(deps, tones) {
|
|
236
|
+
const declared = new Set(tones.map(tone => tone.id));
|
|
237
|
+
// Only tones this package once applied can leave orphans (NOT-05). An entry
|
|
238
|
+
// with no tone metadata was scheduled by other code through the same engine,
|
|
239
|
+
// and a tone the ledger has never seen is not ours to judge either: cancelling
|
|
240
|
+
// on "not in this call's list" silently deleted other libraries' notifications,
|
|
241
|
+
// and a feature module's own when it applied only its subset of tones.
|
|
242
|
+
const onceApplied = new Set(deps.state.read().migrationLedger.map(entry => entry.toneId));
|
|
243
|
+
const pending = await deps.engine.getPending();
|
|
244
|
+
return pending.filter(entry => entry.tone !== '' && onceApplied.has(entry.tone) && !declared.has(entry.tone)).map(entry => entry.id);
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_errors","require","_toneMap","_validateTone","_writer","ledgerFor","state","toneId","read","migrationLedger","find","entry","retired","recordApplied","tone","now","retiredChannelId","labelFingerprint","update","current","withoutTone","filter","id","undefined","at","appliedVersion","channelId","version","channelIdFor","createChannels","deps","emit","writer","createScheduleWriter","engine","applyTones","tones","groups","validateToneDeclarations","created","migrated","labelsRefreshed","reHomed","cancelled","bypassUnavailable","repeatUnavailable","unchanged","length","declareGroups","capabilities","getCapabilities","previous","resolved","resolveTone","fingerprint","toneLabelFingerprint","bypassDoNotDisturb","supportsDoNotDisturbBypass","push","DIAGNOSTIC_CODES","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":";;;;;;AAiBA,IAAAA,OAAA,GAAAC,OAAA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C,eAAe,CAACY,MAAM,CAACV,KAAK,IAAI,CAACA,KAAK,CAACC,OAAO,CAAC,CAC/C2F,GAAG,CAAC5F,KAAK,KAAK;QAAEJ,MAAM,EAAEI,KAAK,CAACJ,MAAM;QAAEkB,cAAc,EAAEd,KAAK,CAACc;MAAe,CAAC,CAAC,CAAC;IACjF;EACD,CAAC;AACF;;AAEA;AACA,eAAesE,WAAWA,CACzBjE,IAAyB,EACzBM,KAAiC,EACJ;EAC7B,MAAMoE,QAAQ,GAAG,IAAIC,GAAG,CAACrE,KAAK,CAACmE,GAAG,CAACzF,IAAI,IAAIA,IAAI,CAACQ,EAAE,CAAC,CAAC;EACpD;EACA;EACA;EACA;EACA;EACA,MAAMoF,WAAW,GAAG,IAAID,GAAG,CAAC3E,IAAI,CAACxB,KAAK,CAACE,IAAI,CAAC,CAAC,CAACC,eAAe,CAAC8F,GAAG,CAAC5F,KAAK,IAAIA,KAAK,CAACJ,MAAM,CAAC,CAAC;EACzF,MAAMmE,OAAO,GAAG,MAAM5C,IAAI,CAACI,MAAM,CAACyC,UAAU,CAAC,CAAC;EAC9C,OAAOD,OAAO,CACZrD,MAAM,CAACV,KAAK,IAAIA,KAAK,CAACG,IAAI,KAAK,EAAE,IAAI4F,WAAW,CAACC,GAAG,CAAChG,KAAK,CAACG,IAAI,CAAC,IAAI,CAAC0F,QAAQ,CAACG,GAAG,CAAChG,KAAK,CAACG,IAAI,CAAC,CAAC,CAC9FyF,GAAG,CAAC5F,KAAK,IAAIA,KAAK,CAACW,EAAE,CAAC;AACzB","ignoreList":[]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.channelIdFor = channelIdFor;
|
|
7
|
+
exports.createToneResolver = createToneResolver;
|
|
8
|
+
exports.parseChannelId = parseChannelId;
|
|
9
|
+
exports.resolveTone = resolveTone;
|
|
10
|
+
exports.toneLabelFingerprint = toneLabelFingerprint;
|
|
11
|
+
var _hash = require("../contract/hash.js");
|
|
12
|
+
/**
|
|
13
|
+
* Tone-to-platform mapping.
|
|
14
|
+
*
|
|
15
|
+
* A tone is declared once and realized on each platform here, so consumer code
|
|
16
|
+
* contains zero platform branches. The two platforms model urgency differently
|
|
17
|
+
* — Android by channel importance, iOS by interruption level — and reconciling
|
|
18
|
+
* that difference is exactly the work this package exists to absorb.
|
|
19
|
+
*
|
|
20
|
+
* The channel id carries the tone version. Android channels are immutable once
|
|
21
|
+
* created and re-declaration is silently ignored, so a configuration change has
|
|
22
|
+
* to produce a *new* channel or it will never reach a device that already holds
|
|
23
|
+
* the old one.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const ANDROID_IMPORTANCE = {
|
|
27
|
+
min: 'min',
|
|
28
|
+
low: 'low',
|
|
29
|
+
default: 'default',
|
|
30
|
+
high: 'high',
|
|
31
|
+
// Android has no level above `high`; max urgency is expressed by the DND
|
|
32
|
+
// bypass rather than by a distinct importance.
|
|
33
|
+
max: 'high'
|
|
34
|
+
};
|
|
35
|
+
const IOS_INTERRUPTION = {
|
|
36
|
+
min: 'passive',
|
|
37
|
+
low: 'passive',
|
|
38
|
+
default: 'active',
|
|
39
|
+
high: 'active',
|
|
40
|
+
// `timeSensitive` is the highest level available without the Critical Alerts
|
|
41
|
+
// entitlement, which is out of scope for v1.
|
|
42
|
+
max: 'timeSensitive'
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** Channel id for a tone at a given version. Stable, derived, never random. */
|
|
46
|
+
function channelIdFor(toneId, version) {
|
|
47
|
+
return `${toneId}.v${version}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Extracts the tone and version encoded in a channel id, if it is one of ours. */
|
|
51
|
+
function parseChannelId(channelId) {
|
|
52
|
+
const separator = channelId.lastIndexOf('.v');
|
|
53
|
+
if (separator === -1) return undefined;
|
|
54
|
+
const version = Number.parseInt(channelId.slice(separator + 2), 10);
|
|
55
|
+
if (!Number.isInteger(version) || version < 1) return undefined;
|
|
56
|
+
return {
|
|
57
|
+
toneId: channelId.slice(0, separator),
|
|
58
|
+
version
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function resolveTone(tone) {
|
|
62
|
+
const silent = tone.sound?.enabled === false;
|
|
63
|
+
const repeats = tone.repeatAlert !== undefined;
|
|
64
|
+
return {
|
|
65
|
+
toneId: tone.id,
|
|
66
|
+
version: tone.version,
|
|
67
|
+
android: {
|
|
68
|
+
channelId: channelIdFor(tone.id, tone.version),
|
|
69
|
+
// The declared label, not the identifier. Passing the identifier here
|
|
70
|
+
// is what put a technical string on the one screen these exist for.
|
|
71
|
+
name: tone.name,
|
|
72
|
+
description: tone.description,
|
|
73
|
+
importance: ANDROID_IMPORTANCE[tone.urgency],
|
|
74
|
+
sound: silent ? undefined : tone.sound?.name,
|
|
75
|
+
vibration: tone.vibration ?? false,
|
|
76
|
+
badge: tone.badge ?? false,
|
|
77
|
+
bypassDnd: tone.bypassDoNotDisturb ?? false,
|
|
78
|
+
groupId: tone.groupId,
|
|
79
|
+
// Both are per-notification rather than channel configuration, which
|
|
80
|
+
// is precisely why neither obliges a consumer to bump `version`.
|
|
81
|
+
loopSound: repeats,
|
|
82
|
+
alarmCategory: tone.timeSensitive ?? false,
|
|
83
|
+
repeatForMs: tone.repeatAlert?.forMs
|
|
84
|
+
},
|
|
85
|
+
ios: {
|
|
86
|
+
// iOS categories are not versioned: they carry actions rather than
|
|
87
|
+
// user-adjustable settings, so re-declaring one is harmless.
|
|
88
|
+
categoryId: tone.id,
|
|
89
|
+
interruptionLevel: tone.timeSensitive === true ? 'timeSensitive' : IOS_INTERRUPTION[tone.urgency],
|
|
90
|
+
sound: silent ? undefined : tone.sound?.name,
|
|
91
|
+
badge: tone.badge ?? false,
|
|
92
|
+
// iOS exposes no looping-sound API at all. Recorded as data so the
|
|
93
|
+
// refusal can be reported rather than discovered.
|
|
94
|
+
repeatRefused: repeats
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* A stable fingerprint of a tone's user-visible labels.
|
|
101
|
+
*
|
|
102
|
+
* Lets an unchanged configuration skip the platform entirely, which is what
|
|
103
|
+
* keeps "re-applying changes nothing" literally true rather than merely
|
|
104
|
+
* approximately true. A hash rather than the labels themselves, so persisted
|
|
105
|
+
* state continues to hold no consumer-supplied text.
|
|
106
|
+
*/
|
|
107
|
+
function toneLabelFingerprint(tone) {
|
|
108
|
+
// The separator matters: without it, a name of "ab" with description "c" and
|
|
109
|
+
// a name of "a" with description "bc" would fingerprint identically, and one
|
|
110
|
+
// of the two would never get its correction.
|
|
111
|
+
const source = `${tone.name}\u0000${tone.description ?? ''}`;
|
|
112
|
+
return (0, _hash.hex8)((0, _hash.fnv1a)(source));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Builds a lookup over a declared configuration. */
|
|
116
|
+
function createToneResolver(tones) {
|
|
117
|
+
const resolved = new Map(tones.map(tone => [tone.id, resolveTone(tone)]));
|
|
118
|
+
return toneId => resolved.get(toneId);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=tone-map.js.map
|