@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.
Files changed (681) hide show
  1. package/CHANGELOG.md +184 -0
  2. package/README.md +108 -16
  3. package/lib/commonjs/advanced.js +139 -0
  4. package/lib/commonjs/advanced.js.map +1 -0
  5. package/lib/commonjs/channel/migrate.js +246 -0
  6. package/lib/commonjs/channel/migrate.js.map +1 -0
  7. package/lib/commonjs/channel/tone-map.js +120 -0
  8. package/lib/commonjs/channel/tone-map.js.map +1 -0
  9. package/lib/commonjs/channel/validate-tone.js +61 -0
  10. package/lib/commonjs/channel/validate-tone.js.map +1 -0
  11. package/lib/commonjs/contract/channel.js +52 -0
  12. package/lib/commonjs/contract/channel.js.map +1 -0
  13. package/lib/commonjs/contract/diagnostics.js +25 -0
  14. package/lib/commonjs/contract/diagnostics.js.map +1 -0
  15. package/lib/commonjs/contract/errors.js +126 -0
  16. package/lib/commonjs/contract/errors.js.map +1 -0
  17. package/lib/commonjs/contract/hash.js +35 -0
  18. package/lib/commonjs/contract/hash.js.map +1 -0
  19. package/lib/commonjs/contract/index.js +94 -0
  20. package/lib/commonjs/contract/index.js.map +1 -0
  21. package/lib/commonjs/contract/interaction.js +37 -0
  22. package/lib/commonjs/contract/interaction.js.map +1 -0
  23. package/lib/commonjs/contract/notification.js +42 -0
  24. package/lib/commonjs/contract/notification.js.map +1 -0
  25. package/lib/commonjs/contract/permission.js +2 -0
  26. package/lib/commonjs/contract/permission.js.map +1 -0
  27. package/lib/commonjs/contract/reconcile.js +6 -0
  28. package/lib/commonjs/contract/reconcile.js.map +1 -0
  29. package/lib/commonjs/contract/recurrence.js +53 -0
  30. package/lib/commonjs/contract/recurrence.js.map +1 -0
  31. package/lib/commonjs/diagnostics/burst.js +89 -0
  32. package/lib/commonjs/diagnostics/burst.js.map +1 -0
  33. package/lib/commonjs/diagnostics/events.js +63 -0
  34. package/lib/commonjs/diagnostics/events.js.map +1 -0
  35. package/lib/commonjs/diagnostics/redact.js +48 -0
  36. package/lib/commonjs/diagnostics/redact.js.map +1 -0
  37. package/lib/commonjs/diagnostics/snapshot.js +68 -0
  38. package/lib/commonjs/diagnostics/snapshot.js.map +1 -0
  39. package/lib/commonjs/engine/adapter.js +6 -0
  40. package/lib/commonjs/engine/adapter.js.map +1 -0
  41. package/lib/commonjs/engine/codec.js +84 -0
  42. package/lib/commonjs/engine/codec.js.map +1 -0
  43. package/lib/commonjs/engine/notify-kit/events.js +148 -0
  44. package/lib/commonjs/engine/notify-kit/events.js.map +1 -0
  45. package/lib/commonjs/engine/notify-kit/module.js +119 -0
  46. package/lib/commonjs/engine/notify-kit/module.js.map +1 -0
  47. package/lib/commonjs/engine/notify-kit/platform/android.js +159 -0
  48. package/lib/commonjs/engine/notify-kit/platform/android.js.map +1 -0
  49. package/lib/commonjs/engine/notify-kit/platform/index.js +57 -0
  50. package/lib/commonjs/engine/notify-kit/platform/index.js.map +1 -0
  51. package/lib/commonjs/engine/notify-kit/platform/ios.js +54 -0
  52. package/lib/commonjs/engine/notify-kit/platform/ios.js.map +1 -0
  53. package/lib/commonjs/engine/notify-kit/platform/types.js +6 -0
  54. package/lib/commonjs/engine/notify-kit/platform/types.js.map +1 -0
  55. package/lib/commonjs/engine/notify-kit-engine.js +260 -0
  56. package/lib/commonjs/engine/notify-kit-engine.js.map +1 -0
  57. package/lib/commonjs/index.js +367 -0
  58. package/lib/commonjs/index.js.map +1 -0
  59. package/lib/commonjs/initialize.js +187 -0
  60. package/lib/commonjs/initialize.js.map +1 -0
  61. package/lib/commonjs/interaction/index.js +120 -0
  62. package/lib/commonjs/interaction/index.js.map +1 -0
  63. package/lib/commonjs/maintenance/cycle.js +108 -0
  64. package/lib/commonjs/maintenance/cycle.js.map +1 -0
  65. package/lib/commonjs/maintenance/permission-refresh.js +39 -0
  66. package/lib/commonjs/maintenance/permission-refresh.js.map +1 -0
  67. package/lib/commonjs/maintenance/reanchor.js +99 -0
  68. package/lib/commonjs/maintenance/reanchor.js.map +1 -0
  69. package/lib/commonjs/maintenance/toggle.js +50 -0
  70. package/lib/commonjs/maintenance/toggle.js.map +1 -0
  71. package/lib/commonjs/maintenance/verify.js +70 -0
  72. package/lib/commonjs/maintenance/verify.js.map +1 -0
  73. package/lib/commonjs/maintenance/window-refresh.js +53 -0
  74. package/lib/commonjs/maintenance/window-refresh.js.map +1 -0
  75. package/lib/commonjs/notifications.js +161 -0
  76. package/lib/commonjs/notifications.js.map +1 -0
  77. package/lib/commonjs/package.json +1 -0
  78. package/lib/commonjs/permission/index.js +182 -0
  79. package/lib/commonjs/permission/index.js.map +1 -0
  80. package/lib/commonjs/permission/state.js +92 -0
  81. package/lib/commonjs/permission/state.js.map +1 -0
  82. package/lib/commonjs/push/envelope.js +141 -0
  83. package/lib/commonjs/push/envelope.js.map +1 -0
  84. package/lib/commonjs/push/fcm-provider.js +122 -0
  85. package/lib/commonjs/push/fcm-provider.js.map +1 -0
  86. package/lib/commonjs/push/gate.js +162 -0
  87. package/lib/commonjs/push/gate.js.map +1 -0
  88. package/lib/commonjs/push/index.js +47 -0
  89. package/lib/commonjs/push/index.js.map +1 -0
  90. package/lib/commonjs/push/instructions.js +101 -0
  91. package/lib/commonjs/push/instructions.js.map +1 -0
  92. package/lib/commonjs/push/provider-adapter.js +6 -0
  93. package/lib/commonjs/push/provider-adapter.js.map +1 -0
  94. package/lib/commonjs/push/signout.js +55 -0
  95. package/lib/commonjs/push/signout.js.map +1 -0
  96. package/lib/commonjs/reconcile/chunk.js +49 -0
  97. package/lib/commonjs/reconcile/chunk.js.map +1 -0
  98. package/lib/commonjs/reconcile/diff.js +105 -0
  99. package/lib/commonjs/reconcile/diff.js.map +1 -0
  100. package/lib/commonjs/reconcile/duplicates.js +60 -0
  101. package/lib/commonjs/reconcile/duplicates.js.map +1 -0
  102. package/lib/commonjs/reconcile/index.js +164 -0
  103. package/lib/commonjs/reconcile/index.js.map +1 -0
  104. package/lib/commonjs/reconcile/truncate.js +50 -0
  105. package/lib/commonjs/reconcile/truncate.js.map +1 -0
  106. package/lib/commonjs/recurrence/clock-guard.js +65 -0
  107. package/lib/commonjs/recurrence/clock-guard.js.map +1 -0
  108. package/lib/commonjs/recurrence/expand.js +254 -0
  109. package/lib/commonjs/recurrence/expand.js.map +1 -0
  110. package/lib/commonjs/recurrence/index.js +212 -0
  111. package/lib/commonjs/recurrence/index.js.map +1 -0
  112. package/lib/commonjs/repeat/expiry.js +41 -0
  113. package/lib/commonjs/repeat/expiry.js.map +1 -0
  114. package/lib/commonjs/repeat/index.js +100 -0
  115. package/lib/commonjs/repeat/index.js.map +1 -0
  116. package/lib/commonjs/repeat/marker.js +58 -0
  117. package/lib/commonjs/repeat/marker.js.map +1 -0
  118. package/lib/commonjs/repeat/place.js +83 -0
  119. package/lib/commonjs/repeat/place.js.map +1 -0
  120. package/lib/commonjs/schedule/anchor.js +243 -0
  121. package/lib/commonjs/schedule/anchor.js.map +1 -0
  122. package/lib/commonjs/schedule/index.js +142 -0
  123. package/lib/commonjs/schedule/index.js.map +1 -0
  124. package/lib/commonjs/schedule/partition.js +59 -0
  125. package/lib/commonjs/schedule/partition.js.map +1 -0
  126. package/lib/commonjs/schedule/resolve-moment.js +72 -0
  127. package/lib/commonjs/schedule/resolve-moment.js.map +1 -0
  128. package/lib/commonjs/schedule/validate-content.js +101 -0
  129. package/lib/commonjs/schedule/validate-content.js.map +1 -0
  130. package/lib/commonjs/schedule/validate-identifier.js +126 -0
  131. package/lib/commonjs/schedule/validate-identifier.js.map +1 -0
  132. package/lib/commonjs/schedule/writer.js +44 -0
  133. package/lib/commonjs/schedule/writer.js.map +1 -0
  134. package/lib/commonjs/state/caps.js +101 -0
  135. package/lib/commonjs/state/caps.js.map +1 -0
  136. package/lib/commonjs/state/dedup-ledger.js +39 -0
  137. package/lib/commonjs/state/dedup-ledger.js.map +1 -0
  138. package/lib/commonjs/state/interaction-buffer.js +98 -0
  139. package/lib/commonjs/state/interaction-buffer.js.map +1 -0
  140. package/lib/commonjs/state/mmkv-store.js +75 -0
  141. package/lib/commonjs/state/mmkv-store.js.map +1 -0
  142. package/lib/commonjs/state/permission-history.js +64 -0
  143. package/lib/commonjs/state/permission-history.js.map +1 -0
  144. package/lib/commonjs/state/record.js +269 -0
  145. package/lib/commonjs/state/record.js.map +1 -0
  146. package/lib/commonjs/state/reset.js +37 -0
  147. package/lib/commonjs/state/reset.js.map +1 -0
  148. package/lib/commonjs/state/series-ledger.js +71 -0
  149. package/lib/commonjs/state/series-ledger.js.map +1 -0
  150. package/lib/commonjs/state/store.js +39 -0
  151. package/lib/commonjs/state/store.js.map +1 -0
  152. package/lib/commonjs/testing/conformance/index.js +218 -0
  153. package/lib/commonjs/testing/conformance/index.js.map +1 -0
  154. package/lib/commonjs/testing/fake-engine.js +338 -0
  155. package/lib/commonjs/testing/fake-engine.js.map +1 -0
  156. package/lib/commonjs/testing/fake-provider.js +93 -0
  157. package/lib/commonjs/testing/fake-provider.js.map +1 -0
  158. package/lib/commonjs/testing/faults.js +59 -0
  159. package/lib/commonjs/testing/faults.js.map +1 -0
  160. package/lib/commonjs/testing/index.js +54 -0
  161. package/lib/commonjs/testing/index.js.map +1 -0
  162. package/lib/commonjs/testing/measure.js +298 -0
  163. package/lib/commonjs/testing/measure.js.map +1 -0
  164. package/lib/module/advanced.js +29 -0
  165. package/lib/module/advanced.js.map +1 -0
  166. package/lib/module/channel/migrate.js +242 -0
  167. package/lib/module/channel/migrate.js.map +1 -0
  168. package/lib/module/channel/tone-map.js +112 -0
  169. package/lib/module/channel/tone-map.js.map +1 -0
  170. package/lib/module/channel/validate-tone.js +57 -0
  171. package/lib/module/channel/validate-tone.js.map +1 -0
  172. package/lib/module/contract/channel.js +48 -0
  173. package/lib/module/contract/channel.js.map +1 -0
  174. package/lib/module/contract/diagnostics.js +21 -0
  175. package/lib/module/contract/diagnostics.js.map +1 -0
  176. package/lib/module/contract/errors.js +119 -0
  177. package/lib/module/contract/errors.js.map +1 -0
  178. package/lib/module/contract/hash.js +29 -0
  179. package/lib/module/contract/hash.js.map +1 -0
  180. package/lib/module/contract/index.js +13 -0
  181. package/lib/module/contract/index.js.map +1 -0
  182. package/lib/module/contract/interaction.js +33 -0
  183. package/lib/module/contract/interaction.js.map +1 -0
  184. package/lib/module/contract/notification.js +38 -0
  185. package/lib/module/contract/notification.js.map +1 -0
  186. package/lib/module/contract/permission.js +2 -0
  187. package/lib/module/contract/permission.js.map +1 -0
  188. package/lib/module/contract/reconcile.js +4 -0
  189. package/lib/module/contract/reconcile.js.map +1 -0
  190. package/lib/module/contract/recurrence.js +49 -0
  191. package/lib/module/contract/recurrence.js.map +1 -0
  192. package/lib/module/diagnostics/burst.js +85 -0
  193. package/lib/module/diagnostics/burst.js.map +1 -0
  194. package/lib/module/diagnostics/events.js +58 -0
  195. package/lib/module/diagnostics/events.js.map +1 -0
  196. package/lib/module/diagnostics/redact.js +44 -0
  197. package/lib/module/diagnostics/redact.js.map +1 -0
  198. package/lib/module/diagnostics/snapshot.js +64 -0
  199. package/lib/module/diagnostics/snapshot.js.map +1 -0
  200. package/lib/module/engine/adapter.js +4 -0
  201. package/lib/module/engine/adapter.js.map +1 -0
  202. package/lib/module/engine/codec.js +79 -0
  203. package/lib/module/engine/codec.js.map +1 -0
  204. package/lib/module/engine/notify-kit/events.js +139 -0
  205. package/lib/module/engine/notify-kit/events.js.map +1 -0
  206. package/lib/module/engine/notify-kit/module.js +113 -0
  207. package/lib/module/engine/notify-kit/module.js.map +1 -0
  208. package/lib/module/engine/notify-kit/platform/android.js +155 -0
  209. package/lib/module/engine/notify-kit/platform/android.js.map +1 -0
  210. package/lib/module/engine/notify-kit/platform/index.js +51 -0
  211. package/lib/module/engine/notify-kit/platform/index.js.map +1 -0
  212. package/lib/module/engine/notify-kit/platform/ios.js +49 -0
  213. package/lib/module/engine/notify-kit/platform/ios.js.map +1 -0
  214. package/lib/module/engine/notify-kit/platform/types.js +4 -0
  215. package/lib/module/engine/notify-kit/platform/types.js.map +1 -0
  216. package/lib/module/engine/notify-kit-engine.js +257 -0
  217. package/lib/module/engine/notify-kit-engine.js.map +1 -0
  218. package/lib/module/index.js +98 -0
  219. package/lib/module/index.js.map +1 -0
  220. package/lib/module/initialize.js +182 -0
  221. package/lib/module/initialize.js.map +1 -0
  222. package/lib/module/interaction/index.js +116 -0
  223. package/lib/module/interaction/index.js.map +1 -0
  224. package/lib/module/maintenance/cycle.js +102 -0
  225. package/lib/module/maintenance/cycle.js.map +1 -0
  226. package/lib/module/maintenance/permission-refresh.js +34 -0
  227. package/lib/module/maintenance/permission-refresh.js.map +1 -0
  228. package/lib/module/maintenance/reanchor.js +94 -0
  229. package/lib/module/maintenance/reanchor.js.map +1 -0
  230. package/lib/module/maintenance/toggle.js +45 -0
  231. package/lib/module/maintenance/toggle.js.map +1 -0
  232. package/lib/module/maintenance/verify.js +65 -0
  233. package/lib/module/maintenance/verify.js.map +1 -0
  234. package/lib/module/maintenance/window-refresh.js +48 -0
  235. package/lib/module/maintenance/window-refresh.js.map +1 -0
  236. package/lib/module/notifications.js +157 -0
  237. package/lib/module/notifications.js.map +1 -0
  238. package/lib/module/package.json +1 -0
  239. package/lib/module/permission/index.js +178 -0
  240. package/lib/module/permission/index.js.map +1 -0
  241. package/lib/module/permission/state.js +83 -0
  242. package/lib/module/permission/state.js.map +1 -0
  243. package/lib/module/push/envelope.js +137 -0
  244. package/lib/module/push/envelope.js.map +1 -0
  245. package/lib/module/push/fcm-provider.js +119 -0
  246. package/lib/module/push/fcm-provider.js.map +1 -0
  247. package/lib/module/push/gate.js +158 -0
  248. package/lib/module/push/gate.js.map +1 -0
  249. package/lib/module/push/index.js +16 -0
  250. package/lib/module/push/index.js.map +1 -0
  251. package/lib/module/push/instructions.js +97 -0
  252. package/lib/module/push/instructions.js.map +1 -0
  253. package/lib/module/push/provider-adapter.js +4 -0
  254. package/lib/module/push/provider-adapter.js.map +1 -0
  255. package/lib/module/push/signout.js +51 -0
  256. package/lib/module/push/signout.js.map +1 -0
  257. package/lib/module/reconcile/chunk.js +43 -0
  258. package/lib/module/reconcile/chunk.js.map +1 -0
  259. package/lib/module/reconcile/diff.js +101 -0
  260. package/lib/module/reconcile/diff.js.map +1 -0
  261. package/lib/module/reconcile/duplicates.js +56 -0
  262. package/lib/module/reconcile/duplicates.js.map +1 -0
  263. package/lib/module/reconcile/index.js +161 -0
  264. package/lib/module/reconcile/index.js.map +1 -0
  265. package/lib/module/reconcile/truncate.js +46 -0
  266. package/lib/module/reconcile/truncate.js.map +1 -0
  267. package/lib/module/recurrence/clock-guard.js +60 -0
  268. package/lib/module/recurrence/clock-guard.js.map +1 -0
  269. package/lib/module/recurrence/expand.js +248 -0
  270. package/lib/module/recurrence/expand.js.map +1 -0
  271. package/lib/module/recurrence/index.js +208 -0
  272. package/lib/module/recurrence/index.js.map +1 -0
  273. package/lib/module/repeat/expiry.js +37 -0
  274. package/lib/module/repeat/expiry.js.map +1 -0
  275. package/lib/module/repeat/index.js +67 -0
  276. package/lib/module/repeat/index.js.map +1 -0
  277. package/lib/module/repeat/marker.js +51 -0
  278. package/lib/module/repeat/marker.js.map +1 -0
  279. package/lib/module/repeat/place.js +79 -0
  280. package/lib/module/repeat/place.js.map +1 -0
  281. package/lib/module/schedule/anchor.js +234 -0
  282. package/lib/module/schedule/anchor.js.map +1 -0
  283. package/lib/module/schedule/index.js +137 -0
  284. package/lib/module/schedule/index.js.map +1 -0
  285. package/lib/module/schedule/partition.js +53 -0
  286. package/lib/module/schedule/partition.js.map +1 -0
  287. package/lib/module/schedule/resolve-moment.js +66 -0
  288. package/lib/module/schedule/resolve-moment.js.map +1 -0
  289. package/lib/module/schedule/validate-content.js +95 -0
  290. package/lib/module/schedule/validate-content.js.map +1 -0
  291. package/lib/module/schedule/validate-identifier.js +119 -0
  292. package/lib/module/schedule/validate-identifier.js.map +1 -0
  293. package/lib/module/schedule/writer.js +40 -0
  294. package/lib/module/schedule/writer.js.map +1 -0
  295. package/lib/module/state/caps.js +96 -0
  296. package/lib/module/state/caps.js.map +1 -0
  297. package/lib/module/state/dedup-ledger.js +34 -0
  298. package/lib/module/state/dedup-ledger.js.map +1 -0
  299. package/lib/module/state/interaction-buffer.js +92 -0
  300. package/lib/module/state/interaction-buffer.js.map +1 -0
  301. package/lib/module/state/mmkv-store.js +71 -0
  302. package/lib/module/state/mmkv-store.js.map +1 -0
  303. package/lib/module/state/permission-history.js +56 -0
  304. package/lib/module/state/permission-history.js.map +1 -0
  305. package/lib/module/state/record.js +264 -0
  306. package/lib/module/state/record.js.map +1 -0
  307. package/lib/module/state/reset.js +32 -0
  308. package/lib/module/state/reset.js.map +1 -0
  309. package/lib/module/state/series-ledger.js +62 -0
  310. package/lib/module/state/series-ledger.js.map +1 -0
  311. package/lib/module/state/store.js +35 -0
  312. package/lib/module/state/store.js.map +1 -0
  313. package/lib/module/testing/conformance/index.js +214 -0
  314. package/lib/module/testing/conformance/index.js.map +1 -0
  315. package/lib/module/testing/fake-engine.js +335 -0
  316. package/lib/module/testing/fake-engine.js.map +1 -0
  317. package/lib/module/testing/fake-provider.js +89 -0
  318. package/lib/module/testing/fake-provider.js.map +1 -0
  319. package/lib/module/testing/faults.js +55 -0
  320. package/lib/module/testing/faults.js.map +1 -0
  321. package/lib/module/testing/index.js +19 -0
  322. package/lib/module/testing/index.js.map +1 -0
  323. package/lib/module/testing/measure.js +294 -0
  324. package/lib/module/testing/measure.js.map +1 -0
  325. package/lib/typescript/commonjs/advanced.d.ts +36 -0
  326. package/lib/typescript/commonjs/advanced.d.ts.map +1 -0
  327. package/lib/typescript/commonjs/channel/migrate.d.ts +38 -0
  328. package/lib/typescript/commonjs/channel/migrate.d.ts.map +1 -0
  329. package/lib/typescript/commonjs/channel/tone-map.d.ts +34 -0
  330. package/lib/typescript/commonjs/channel/tone-map.d.ts.map +1 -0
  331. package/lib/typescript/commonjs/channel/validate-tone.d.ts +23 -0
  332. package/lib/typescript/commonjs/channel/validate-tone.d.ts.map +1 -0
  333. package/lib/typescript/commonjs/contract/channel.d.ts +185 -0
  334. package/lib/typescript/commonjs/contract/channel.d.ts.map +1 -0
  335. package/lib/typescript/commonjs/contract/diagnostics.d.ts +92 -0
  336. package/lib/typescript/commonjs/contract/diagnostics.d.ts.map +1 -0
  337. package/lib/typescript/commonjs/contract/errors.d.ts +91 -0
  338. package/lib/typescript/commonjs/contract/errors.d.ts.map +1 -0
  339. package/lib/typescript/commonjs/contract/hash.d.ts +14 -0
  340. package/lib/typescript/commonjs/contract/hash.d.ts.map +1 -0
  341. package/lib/typescript/commonjs/contract/index.d.ts +10 -0
  342. package/lib/typescript/commonjs/contract/index.d.ts.map +1 -0
  343. package/lib/typescript/commonjs/contract/interaction.d.ts +53 -0
  344. package/lib/typescript/commonjs/contract/interaction.d.ts.map +1 -0
  345. package/lib/typescript/commonjs/contract/notification.d.ts +110 -0
  346. package/lib/typescript/commonjs/contract/notification.d.ts.map +1 -0
  347. package/lib/typescript/commonjs/contract/permission.d.ts +49 -0
  348. package/lib/typescript/commonjs/contract/permission.d.ts.map +1 -0
  349. package/lib/typescript/commonjs/contract/reconcile.d.ts +82 -0
  350. package/lib/typescript/commonjs/contract/reconcile.d.ts.map +1 -0
  351. package/lib/typescript/commonjs/contract/recurrence.d.ts +118 -0
  352. package/lib/typescript/commonjs/contract/recurrence.d.ts.map +1 -0
  353. package/lib/typescript/commonjs/diagnostics/burst.d.ts +39 -0
  354. package/lib/typescript/commonjs/diagnostics/burst.d.ts.map +1 -0
  355. package/lib/typescript/commonjs/diagnostics/events.d.ts +28 -0
  356. package/lib/typescript/commonjs/diagnostics/events.d.ts.map +1 -0
  357. package/lib/typescript/commonjs/diagnostics/redact.d.ts +22 -0
  358. package/lib/typescript/commonjs/diagnostics/redact.d.ts.map +1 -0
  359. package/lib/typescript/commonjs/diagnostics/snapshot.d.ts +40 -0
  360. package/lib/typescript/commonjs/diagnostics/snapshot.d.ts.map +1 -0
  361. package/lib/typescript/commonjs/engine/adapter.d.ts +172 -0
  362. package/lib/typescript/commonjs/engine/adapter.d.ts.map +1 -0
  363. package/lib/typescript/commonjs/engine/codec.d.ts +20 -0
  364. package/lib/typescript/commonjs/engine/codec.d.ts.map +1 -0
  365. package/lib/typescript/commonjs/engine/notify-kit/events.d.ts +37 -0
  366. package/lib/typescript/commonjs/engine/notify-kit/events.d.ts.map +1 -0
  367. package/lib/typescript/commonjs/engine/notify-kit/module.d.ts +103 -0
  368. package/lib/typescript/commonjs/engine/notify-kit/module.d.ts.map +1 -0
  369. package/lib/typescript/commonjs/engine/notify-kit/platform/android.d.ts +3 -0
  370. package/lib/typescript/commonjs/engine/notify-kit/platform/android.d.ts.map +1 -0
  371. package/lib/typescript/commonjs/engine/notify-kit/platform/index.d.ts +12 -0
  372. package/lib/typescript/commonjs/engine/notify-kit/platform/index.d.ts.map +1 -0
  373. package/lib/typescript/commonjs/engine/notify-kit/platform/ios.d.ts +3 -0
  374. package/lib/typescript/commonjs/engine/notify-kit/platform/ios.d.ts.map +1 -0
  375. package/lib/typescript/commonjs/engine/notify-kit/platform/types.d.ts +33 -0
  376. package/lib/typescript/commonjs/engine/notify-kit/platform/types.d.ts.map +1 -0
  377. package/lib/typescript/commonjs/engine/notify-kit-engine.d.ts +25 -0
  378. package/lib/typescript/commonjs/engine/notify-kit-engine.d.ts.map +1 -0
  379. package/lib/typescript/commonjs/index.d.ts +106 -0
  380. package/lib/typescript/commonjs/index.d.ts.map +1 -0
  381. package/lib/typescript/commonjs/initialize.d.ts +74 -0
  382. package/lib/typescript/commonjs/initialize.d.ts.map +1 -0
  383. package/lib/typescript/commonjs/interaction/index.d.ts +53 -0
  384. package/lib/typescript/commonjs/interaction/index.d.ts.map +1 -0
  385. package/lib/typescript/commonjs/maintenance/cycle.d.ts +77 -0
  386. package/lib/typescript/commonjs/maintenance/cycle.d.ts.map +1 -0
  387. package/lib/typescript/commonjs/maintenance/permission-refresh.d.ts +19 -0
  388. package/lib/typescript/commonjs/maintenance/permission-refresh.d.ts.map +1 -0
  389. package/lib/typescript/commonjs/maintenance/reanchor.d.ts +26 -0
  390. package/lib/typescript/commonjs/maintenance/reanchor.d.ts.map +1 -0
  391. package/lib/typescript/commonjs/maintenance/toggle.d.ts +35 -0
  392. package/lib/typescript/commonjs/maintenance/toggle.d.ts.map +1 -0
  393. package/lib/typescript/commonjs/maintenance/verify.d.ts +32 -0
  394. package/lib/typescript/commonjs/maintenance/verify.d.ts.map +1 -0
  395. package/lib/typescript/commonjs/maintenance/window-refresh.d.ts +29 -0
  396. package/lib/typescript/commonjs/maintenance/window-refresh.d.ts.map +1 -0
  397. package/lib/typescript/commonjs/notifications.d.ts +78 -0
  398. package/lib/typescript/commonjs/notifications.d.ts.map +1 -0
  399. package/lib/typescript/commonjs/package.json +1 -0
  400. package/lib/typescript/commonjs/permission/index.d.ts +57 -0
  401. package/lib/typescript/commonjs/permission/index.d.ts.map +1 -0
  402. package/lib/typescript/commonjs/permission/state.d.ts +41 -0
  403. package/lib/typescript/commonjs/permission/state.d.ts.map +1 -0
  404. package/lib/typescript/commonjs/push/envelope.d.ts +33 -0
  405. package/lib/typescript/commonjs/push/envelope.d.ts.map +1 -0
  406. package/lib/typescript/commonjs/push/fcm-provider.d.ts +43 -0
  407. package/lib/typescript/commonjs/push/fcm-provider.d.ts.map +1 -0
  408. package/lib/typescript/commonjs/push/gate.d.ts +57 -0
  409. package/lib/typescript/commonjs/push/gate.d.ts.map +1 -0
  410. package/lib/typescript/commonjs/push/index.d.ts +19 -0
  411. package/lib/typescript/commonjs/push/index.d.ts.map +1 -0
  412. package/lib/typescript/commonjs/push/instructions.d.ts +45 -0
  413. package/lib/typescript/commonjs/push/instructions.d.ts.map +1 -0
  414. package/lib/typescript/commonjs/push/provider-adapter.d.ts +50 -0
  415. package/lib/typescript/commonjs/push/provider-adapter.d.ts.map +1 -0
  416. package/lib/typescript/commonjs/push/signout.d.ts +33 -0
  417. package/lib/typescript/commonjs/push/signout.d.ts.map +1 -0
  418. package/lib/typescript/commonjs/reconcile/chunk.d.ts +24 -0
  419. package/lib/typescript/commonjs/reconcile/chunk.d.ts.map +1 -0
  420. package/lib/typescript/commonjs/reconcile/diff.d.ts +54 -0
  421. package/lib/typescript/commonjs/reconcile/diff.d.ts.map +1 -0
  422. package/lib/typescript/commonjs/reconcile/duplicates.d.ts +32 -0
  423. package/lib/typescript/commonjs/reconcile/duplicates.d.ts.map +1 -0
  424. package/lib/typescript/commonjs/reconcile/index.d.ts +35 -0
  425. package/lib/typescript/commonjs/reconcile/index.d.ts.map +1 -0
  426. package/lib/typescript/commonjs/reconcile/truncate.d.ts +26 -0
  427. package/lib/typescript/commonjs/reconcile/truncate.d.ts.map +1 -0
  428. package/lib/typescript/commonjs/recurrence/clock-guard.d.ts +37 -0
  429. package/lib/typescript/commonjs/recurrence/clock-guard.d.ts.map +1 -0
  430. package/lib/typescript/commonjs/recurrence/expand.d.ts +75 -0
  431. package/lib/typescript/commonjs/recurrence/expand.d.ts.map +1 -0
  432. package/lib/typescript/commonjs/recurrence/index.d.ts +40 -0
  433. package/lib/typescript/commonjs/recurrence/index.d.ts.map +1 -0
  434. package/lib/typescript/commonjs/repeat/expiry.d.ts +23 -0
  435. package/lib/typescript/commonjs/repeat/expiry.d.ts.map +1 -0
  436. package/lib/typescript/commonjs/repeat/index.d.ts +49 -0
  437. package/lib/typescript/commonjs/repeat/index.d.ts.map +1 -0
  438. package/lib/typescript/commonjs/repeat/marker.d.ts +36 -0
  439. package/lib/typescript/commonjs/repeat/marker.d.ts.map +1 -0
  440. package/lib/typescript/commonjs/repeat/place.d.ts +39 -0
  441. package/lib/typescript/commonjs/repeat/place.d.ts.map +1 -0
  442. package/lib/typescript/commonjs/schedule/anchor.d.ts +118 -0
  443. package/lib/typescript/commonjs/schedule/anchor.d.ts.map +1 -0
  444. package/lib/typescript/commonjs/schedule/index.d.ts +40 -0
  445. package/lib/typescript/commonjs/schedule/index.d.ts.map +1 -0
  446. package/lib/typescript/commonjs/schedule/partition.d.ts +29 -0
  447. package/lib/typescript/commonjs/schedule/partition.d.ts.map +1 -0
  448. package/lib/typescript/commonjs/schedule/resolve-moment.d.ts +35 -0
  449. package/lib/typescript/commonjs/schedule/resolve-moment.d.ts.map +1 -0
  450. package/lib/typescript/commonjs/schedule/validate-content.d.ts +42 -0
  451. package/lib/typescript/commonjs/schedule/validate-content.d.ts.map +1 -0
  452. package/lib/typescript/commonjs/schedule/validate-identifier.d.ts +30 -0
  453. package/lib/typescript/commonjs/schedule/validate-identifier.d.ts.map +1 -0
  454. package/lib/typescript/commonjs/schedule/writer.d.ts +36 -0
  455. package/lib/typescript/commonjs/schedule/writer.d.ts.map +1 -0
  456. package/lib/typescript/commonjs/state/caps.d.ts +51 -0
  457. package/lib/typescript/commonjs/state/caps.d.ts.map +1 -0
  458. package/lib/typescript/commonjs/state/dedup-ledger.d.ts +21 -0
  459. package/lib/typescript/commonjs/state/dedup-ledger.d.ts.map +1 -0
  460. package/lib/typescript/commonjs/state/interaction-buffer.d.ts +30 -0
  461. package/lib/typescript/commonjs/state/interaction-buffer.d.ts.map +1 -0
  462. package/lib/typescript/commonjs/state/mmkv-store.d.ts +33 -0
  463. package/lib/typescript/commonjs/state/mmkv-store.d.ts.map +1 -0
  464. package/lib/typescript/commonjs/state/permission-history.d.ts +20 -0
  465. package/lib/typescript/commonjs/state/permission-history.d.ts.map +1 -0
  466. package/lib/typescript/commonjs/state/record.d.ts +134 -0
  467. package/lib/typescript/commonjs/state/record.d.ts.map +1 -0
  468. package/lib/typescript/commonjs/state/reset.d.ts +22 -0
  469. package/lib/typescript/commonjs/state/reset.d.ts.map +1 -0
  470. package/lib/typescript/commonjs/state/series-ledger.d.ts +47 -0
  471. package/lib/typescript/commonjs/state/series-ledger.d.ts.map +1 -0
  472. package/lib/typescript/commonjs/state/store.d.ts +20 -0
  473. package/lib/typescript/commonjs/state/store.d.ts.map +1 -0
  474. package/lib/typescript/commonjs/testing/conformance/index.d.ts +32 -0
  475. package/lib/typescript/commonjs/testing/conformance/index.d.ts.map +1 -0
  476. package/lib/typescript/commonjs/testing/fake-engine.d.ts +91 -0
  477. package/lib/typescript/commonjs/testing/fake-engine.d.ts.map +1 -0
  478. package/lib/typescript/commonjs/testing/fake-provider.d.ts +35 -0
  479. package/lib/typescript/commonjs/testing/fake-provider.d.ts.map +1 -0
  480. package/lib/typescript/commonjs/testing/faults.d.ts +38 -0
  481. package/lib/typescript/commonjs/testing/faults.d.ts.map +1 -0
  482. package/lib/typescript/commonjs/testing/index.d.ts +22 -0
  483. package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
  484. package/lib/typescript/commonjs/testing/measure.d.ts +59 -0
  485. package/lib/typescript/commonjs/testing/measure.d.ts.map +1 -0
  486. package/lib/typescript/module/advanced.d.ts +36 -0
  487. package/lib/typescript/module/advanced.d.ts.map +1 -0
  488. package/lib/typescript/module/channel/migrate.d.ts +38 -0
  489. package/lib/typescript/module/channel/migrate.d.ts.map +1 -0
  490. package/lib/typescript/module/channel/tone-map.d.ts +34 -0
  491. package/lib/typescript/module/channel/tone-map.d.ts.map +1 -0
  492. package/lib/typescript/module/channel/validate-tone.d.ts +23 -0
  493. package/lib/typescript/module/channel/validate-tone.d.ts.map +1 -0
  494. package/lib/typescript/module/contract/channel.d.ts +185 -0
  495. package/lib/typescript/module/contract/channel.d.ts.map +1 -0
  496. package/lib/typescript/module/contract/diagnostics.d.ts +92 -0
  497. package/lib/typescript/module/contract/diagnostics.d.ts.map +1 -0
  498. package/lib/typescript/module/contract/errors.d.ts +91 -0
  499. package/lib/typescript/module/contract/errors.d.ts.map +1 -0
  500. package/lib/typescript/module/contract/hash.d.ts +14 -0
  501. package/lib/typescript/module/contract/hash.d.ts.map +1 -0
  502. package/lib/typescript/module/contract/index.d.ts +10 -0
  503. package/lib/typescript/module/contract/index.d.ts.map +1 -0
  504. package/lib/typescript/module/contract/interaction.d.ts +53 -0
  505. package/lib/typescript/module/contract/interaction.d.ts.map +1 -0
  506. package/lib/typescript/module/contract/notification.d.ts +110 -0
  507. package/lib/typescript/module/contract/notification.d.ts.map +1 -0
  508. package/lib/typescript/module/contract/permission.d.ts +49 -0
  509. package/lib/typescript/module/contract/permission.d.ts.map +1 -0
  510. package/lib/typescript/module/contract/reconcile.d.ts +82 -0
  511. package/lib/typescript/module/contract/reconcile.d.ts.map +1 -0
  512. package/lib/typescript/module/contract/recurrence.d.ts +118 -0
  513. package/lib/typescript/module/contract/recurrence.d.ts.map +1 -0
  514. package/lib/typescript/module/diagnostics/burst.d.ts +39 -0
  515. package/lib/typescript/module/diagnostics/burst.d.ts.map +1 -0
  516. package/lib/typescript/module/diagnostics/events.d.ts +28 -0
  517. package/lib/typescript/module/diagnostics/events.d.ts.map +1 -0
  518. package/lib/typescript/module/diagnostics/redact.d.ts +22 -0
  519. package/lib/typescript/module/diagnostics/redact.d.ts.map +1 -0
  520. package/lib/typescript/module/diagnostics/snapshot.d.ts +40 -0
  521. package/lib/typescript/module/diagnostics/snapshot.d.ts.map +1 -0
  522. package/lib/typescript/module/engine/adapter.d.ts +172 -0
  523. package/lib/typescript/module/engine/adapter.d.ts.map +1 -0
  524. package/lib/typescript/module/engine/codec.d.ts +20 -0
  525. package/lib/typescript/module/engine/codec.d.ts.map +1 -0
  526. package/lib/typescript/module/engine/notify-kit/events.d.ts +37 -0
  527. package/lib/typescript/module/engine/notify-kit/events.d.ts.map +1 -0
  528. package/lib/typescript/module/engine/notify-kit/module.d.ts +103 -0
  529. package/lib/typescript/module/engine/notify-kit/module.d.ts.map +1 -0
  530. package/lib/typescript/module/engine/notify-kit/platform/android.d.ts +3 -0
  531. package/lib/typescript/module/engine/notify-kit/platform/android.d.ts.map +1 -0
  532. package/lib/typescript/module/engine/notify-kit/platform/index.d.ts +12 -0
  533. package/lib/typescript/module/engine/notify-kit/platform/index.d.ts.map +1 -0
  534. package/lib/typescript/module/engine/notify-kit/platform/ios.d.ts +3 -0
  535. package/lib/typescript/module/engine/notify-kit/platform/ios.d.ts.map +1 -0
  536. package/lib/typescript/module/engine/notify-kit/platform/types.d.ts +33 -0
  537. package/lib/typescript/module/engine/notify-kit/platform/types.d.ts.map +1 -0
  538. package/lib/typescript/module/engine/notify-kit-engine.d.ts +25 -0
  539. package/lib/typescript/module/engine/notify-kit-engine.d.ts.map +1 -0
  540. package/lib/typescript/module/index.d.ts +106 -0
  541. package/lib/typescript/module/index.d.ts.map +1 -0
  542. package/lib/typescript/module/initialize.d.ts +74 -0
  543. package/lib/typescript/module/initialize.d.ts.map +1 -0
  544. package/lib/typescript/module/interaction/index.d.ts +53 -0
  545. package/lib/typescript/module/interaction/index.d.ts.map +1 -0
  546. package/lib/typescript/module/maintenance/cycle.d.ts +77 -0
  547. package/lib/typescript/module/maintenance/cycle.d.ts.map +1 -0
  548. package/lib/typescript/module/maintenance/permission-refresh.d.ts +19 -0
  549. package/lib/typescript/module/maintenance/permission-refresh.d.ts.map +1 -0
  550. package/lib/typescript/module/maintenance/reanchor.d.ts +26 -0
  551. package/lib/typescript/module/maintenance/reanchor.d.ts.map +1 -0
  552. package/lib/typescript/module/maintenance/toggle.d.ts +35 -0
  553. package/lib/typescript/module/maintenance/toggle.d.ts.map +1 -0
  554. package/lib/typescript/module/maintenance/verify.d.ts +32 -0
  555. package/lib/typescript/module/maintenance/verify.d.ts.map +1 -0
  556. package/lib/typescript/module/maintenance/window-refresh.d.ts +29 -0
  557. package/lib/typescript/module/maintenance/window-refresh.d.ts.map +1 -0
  558. package/lib/typescript/module/notifications.d.ts +78 -0
  559. package/lib/typescript/module/notifications.d.ts.map +1 -0
  560. package/lib/typescript/module/package.json +1 -0
  561. package/lib/typescript/module/permission/index.d.ts +57 -0
  562. package/lib/typescript/module/permission/index.d.ts.map +1 -0
  563. package/lib/typescript/module/permission/state.d.ts +41 -0
  564. package/lib/typescript/module/permission/state.d.ts.map +1 -0
  565. package/lib/typescript/module/push/envelope.d.ts +33 -0
  566. package/lib/typescript/module/push/envelope.d.ts.map +1 -0
  567. package/lib/typescript/module/push/fcm-provider.d.ts +43 -0
  568. package/lib/typescript/module/push/fcm-provider.d.ts.map +1 -0
  569. package/lib/typescript/module/push/gate.d.ts +57 -0
  570. package/lib/typescript/module/push/gate.d.ts.map +1 -0
  571. package/lib/typescript/module/push/index.d.ts +19 -0
  572. package/lib/typescript/module/push/index.d.ts.map +1 -0
  573. package/lib/typescript/module/push/instructions.d.ts +45 -0
  574. package/lib/typescript/module/push/instructions.d.ts.map +1 -0
  575. package/lib/typescript/module/push/provider-adapter.d.ts +50 -0
  576. package/lib/typescript/module/push/provider-adapter.d.ts.map +1 -0
  577. package/lib/typescript/module/push/signout.d.ts +33 -0
  578. package/lib/typescript/module/push/signout.d.ts.map +1 -0
  579. package/lib/typescript/module/reconcile/chunk.d.ts +24 -0
  580. package/lib/typescript/module/reconcile/chunk.d.ts.map +1 -0
  581. package/lib/typescript/module/reconcile/diff.d.ts +54 -0
  582. package/lib/typescript/module/reconcile/diff.d.ts.map +1 -0
  583. package/lib/typescript/module/reconcile/duplicates.d.ts +32 -0
  584. package/lib/typescript/module/reconcile/duplicates.d.ts.map +1 -0
  585. package/lib/typescript/module/reconcile/index.d.ts +35 -0
  586. package/lib/typescript/module/reconcile/index.d.ts.map +1 -0
  587. package/lib/typescript/module/reconcile/truncate.d.ts +26 -0
  588. package/lib/typescript/module/reconcile/truncate.d.ts.map +1 -0
  589. package/lib/typescript/module/recurrence/clock-guard.d.ts +37 -0
  590. package/lib/typescript/module/recurrence/clock-guard.d.ts.map +1 -0
  591. package/lib/typescript/module/recurrence/expand.d.ts +75 -0
  592. package/lib/typescript/module/recurrence/expand.d.ts.map +1 -0
  593. package/lib/typescript/module/recurrence/index.d.ts +40 -0
  594. package/lib/typescript/module/recurrence/index.d.ts.map +1 -0
  595. package/lib/typescript/module/repeat/expiry.d.ts +23 -0
  596. package/lib/typescript/module/repeat/expiry.d.ts.map +1 -0
  597. package/lib/typescript/module/repeat/index.d.ts +49 -0
  598. package/lib/typescript/module/repeat/index.d.ts.map +1 -0
  599. package/lib/typescript/module/repeat/marker.d.ts +36 -0
  600. package/lib/typescript/module/repeat/marker.d.ts.map +1 -0
  601. package/lib/typescript/module/repeat/place.d.ts +39 -0
  602. package/lib/typescript/module/repeat/place.d.ts.map +1 -0
  603. package/lib/typescript/module/schedule/anchor.d.ts +118 -0
  604. package/lib/typescript/module/schedule/anchor.d.ts.map +1 -0
  605. package/lib/typescript/module/schedule/index.d.ts +40 -0
  606. package/lib/typescript/module/schedule/index.d.ts.map +1 -0
  607. package/lib/typescript/module/schedule/partition.d.ts +29 -0
  608. package/lib/typescript/module/schedule/partition.d.ts.map +1 -0
  609. package/lib/typescript/module/schedule/resolve-moment.d.ts +35 -0
  610. package/lib/typescript/module/schedule/resolve-moment.d.ts.map +1 -0
  611. package/lib/typescript/module/schedule/validate-content.d.ts +42 -0
  612. package/lib/typescript/module/schedule/validate-content.d.ts.map +1 -0
  613. package/lib/typescript/module/schedule/validate-identifier.d.ts +30 -0
  614. package/lib/typescript/module/schedule/validate-identifier.d.ts.map +1 -0
  615. package/lib/typescript/module/schedule/writer.d.ts +36 -0
  616. package/lib/typescript/module/schedule/writer.d.ts.map +1 -0
  617. package/lib/typescript/module/state/caps.d.ts +51 -0
  618. package/lib/typescript/module/state/caps.d.ts.map +1 -0
  619. package/lib/typescript/module/state/dedup-ledger.d.ts +21 -0
  620. package/lib/typescript/module/state/dedup-ledger.d.ts.map +1 -0
  621. package/lib/typescript/module/state/interaction-buffer.d.ts +30 -0
  622. package/lib/typescript/module/state/interaction-buffer.d.ts.map +1 -0
  623. package/lib/typescript/module/state/mmkv-store.d.ts +33 -0
  624. package/lib/typescript/module/state/mmkv-store.d.ts.map +1 -0
  625. package/lib/typescript/module/state/permission-history.d.ts +20 -0
  626. package/lib/typescript/module/state/permission-history.d.ts.map +1 -0
  627. package/lib/typescript/module/state/record.d.ts +134 -0
  628. package/lib/typescript/module/state/record.d.ts.map +1 -0
  629. package/lib/typescript/module/state/reset.d.ts +22 -0
  630. package/lib/typescript/module/state/reset.d.ts.map +1 -0
  631. package/lib/typescript/module/state/series-ledger.d.ts +47 -0
  632. package/lib/typescript/module/state/series-ledger.d.ts.map +1 -0
  633. package/lib/typescript/module/state/store.d.ts +20 -0
  634. package/lib/typescript/module/state/store.d.ts.map +1 -0
  635. package/lib/typescript/module/testing/conformance/index.d.ts +32 -0
  636. package/lib/typescript/module/testing/conformance/index.d.ts.map +1 -0
  637. package/lib/typescript/module/testing/fake-engine.d.ts +91 -0
  638. package/lib/typescript/module/testing/fake-engine.d.ts.map +1 -0
  639. package/lib/typescript/module/testing/fake-provider.d.ts +35 -0
  640. package/lib/typescript/module/testing/fake-provider.d.ts.map +1 -0
  641. package/lib/typescript/module/testing/faults.d.ts +38 -0
  642. package/lib/typescript/module/testing/faults.d.ts.map +1 -0
  643. package/lib/typescript/module/testing/index.d.ts +22 -0
  644. package/lib/typescript/module/testing/index.d.ts.map +1 -0
  645. package/lib/typescript/module/testing/measure.d.ts +59 -0
  646. package/lib/typescript/module/testing/measure.d.ts.map +1 -0
  647. package/package.json +74 -23
  648. package/skills/sdk-rn-notification/SKILL.md +6 -5
  649. package/src/advanced.ts +35 -0
  650. package/src/channel/migrate.ts +176 -158
  651. package/src/channel/tone-map.ts +2 -10
  652. package/src/contract/errors.ts +7 -0
  653. package/src/contract/hash.ts +26 -0
  654. package/src/engine/adapter.ts +21 -1
  655. package/src/engine/notify-kit/events.ts +155 -0
  656. package/src/engine/notify-kit/module.ts +148 -0
  657. package/src/engine/notify-kit/platform/android.ts +172 -0
  658. package/src/engine/notify-kit/platform/index.ts +55 -0
  659. package/src/engine/notify-kit/platform/ios.ts +54 -0
  660. package/src/engine/notify-kit/platform/types.ts +40 -0
  661. package/src/engine/notify-kit-engine.ts +96 -477
  662. package/src/index.ts +9 -0
  663. package/src/notifications.ts +195 -0
  664. package/src/permission/index.ts +65 -4
  665. package/src/push/fcm-provider.ts +14 -4
  666. package/src/push/gate.ts +27 -5
  667. package/src/reconcile/diff.ts +38 -27
  668. package/src/reconcile/index.ts +13 -4
  669. package/src/recurrence/index.ts +2 -1
  670. package/src/repeat/expiry.ts +2 -6
  671. package/src/repeat/index.ts +45 -1
  672. package/src/repeat/marker.ts +1 -22
  673. package/src/repeat/place.ts +74 -35
  674. package/src/schedule/index.ts +10 -4
  675. package/src/schedule/partition.ts +0 -19
  676. package/src/schedule/validate-identifier.ts +8 -6
  677. package/src/schedule/writer.ts +13 -4
  678. package/src/state/caps.ts +28 -3
  679. package/src/state/permission-history.ts +25 -0
  680. package/src/state/record.ts +110 -20
  681. package/src/testing/fake-engine.ts +17 -1
@@ -0,0 +1 @@
1
+ {"version":3,"names":["key","kind","ownerTag","hasRequested","state","target","read","permissionHistory","some","entry","requested","recordRequested","now","update","current","filter","at","DEVICE","denialCount","find","denials","recordDenial","clearDenials"],"sourceRoot":"../../../src","sources":["state/permission-history.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,SAASA,GAAGA,CAACC,IAAoB,EAAEC,QAAiB,EAAU;EAC7D,OAAO,GAAGA,QAAQ,IAAI,GAAG,IAAID,IAAI,EAAE;AACpC;AAEA,OAAO,SAASE,YAAYA,CAC3BC,KAAmB,EACnBH,IAAoB,EACpBC,QAAiB,EACP;EACV,MAAMG,MAAM,GAAGL,GAAG,CAACC,IAAI,EAAEC,QAAQ,CAAC;EAClC,OAAOE,KAAK,CAACE,IAAI,CAAC,CAAC,CAACC,iBAAiB,CAACC,IAAI,CAACC,KAAK,IAAIA,KAAK,CAACT,GAAG,KAAKK,MAAM,IAAII,KAAK,CAACC,SAAS,CAAC;AAC7F;AAEA,OAAO,SAASC,eAAeA,CAC9BP,KAAmB,EACnBH,IAAoB,EACpBW,GAAW,EACXV,QAAiB,EACV;EACP,MAAMG,MAAM,GAAGL,GAAG,CAACC,IAAI,EAAEC,QAAQ,CAAC;EAClC,IAAIC,YAAY,CAACC,KAAK,EAAEH,IAAI,EAAEC,QAAQ,CAAC,EAAE;EAEzCE,KAAK,CAACS,MAAM,CAAC,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,MAAM,CAAC;EAChCb,KAAK,CAACS,MAAM,CAAC,mBAAmB,EAAEC,OAAO,IAAIA,OAAO,CAACC,MAAM,CAACN,KAAK,IAAIA,KAAK,CAACT,GAAG,KAAKK,MAAM,CAAC,CAAC;AAC5F","ignoreList":[]}
@@ -0,0 +1,264 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The persisted state record.
5
+ *
6
+ * Six collections, holding only what the platform will not tell us. No
7
+ * notification content, no push token, no desired set. The interaction buffer
8
+ * is the sole content-bearing exception, and it evicts on delivery.
9
+ *
10
+ * Corrupt or incompatible state is discarded and rebuilt rather than blocking:
11
+ * everything already scheduled lives in the OS and is unaffected, which is what
12
+ * makes discarding safe rather than destructive.
13
+ */
14
+
15
+ import { evict, COLLECTION_CAPS } from "./caps.js";
16
+ import { DIAGNOSTIC_CODES } from "../contract/errors.js";
17
+
18
+ /** The single record before 0.6.0; read once to migrate, then deleted. */
19
+ const STATE_KEY = 'chipmobilesdk.notification.state';
20
+ /**
21
+ * Since 0.6.0 each collection has its own key, plus one for the schema version and
22
+ * summaries, so recording one dedup entry writes the dedup ledger and nothing else
23
+ * (NOT-16). Before, every update serialized the whole record — the 500-entry dedup
24
+ * ledger included — synchronously on the JS thread.
25
+ */
26
+ const META_KEY = `${STATE_KEY}:meta`;
27
+ const COLLECTIONS = ['dedupLedger', 'interactionBuffer', 'migrationLedger', 'seriesLedger', 'permissionHistory'];
28
+ const keyFor = collection => `${STATE_KEY}:${collection}`;
29
+
30
+ /**
31
+ * Bumped whenever the shape below changes. A mismatch discards and rebuilds —
32
+ * never a migration, because none of this data is worth migrating and all of it
33
+ * is reconstructible.
34
+ */
35
+ export const STATE_SCHEMA_VERSION = 1;
36
+ export function emptyRecord() {
37
+ return {
38
+ schemaVersion: STATE_SCHEMA_VERSION,
39
+ dedupLedger: [],
40
+ interactionBuffer: [],
41
+ migrationLedger: [],
42
+ seriesLedger: [],
43
+ permissionHistory: []
44
+ };
45
+ }
46
+ /**
47
+ * Owns the record's lifecycle. Reads are synchronous and cheap; writes are
48
+ * best-effort and never propagate a failure to the caller's operation.
49
+ */
50
+ export class StateManager {
51
+ rebuilt = false;
52
+ constructor(options) {
53
+ this.store = options.store;
54
+ this.now = options.now;
55
+ this.emit = options.emit ?? (() => {});
56
+ this.record = this.load();
57
+ }
58
+ load() {
59
+ try {
60
+ const meta = this.store.getString(META_KEY);
61
+ if (meta === undefined) {
62
+ return this.migrateLegacy();
63
+ }
64
+ const parsed = JSON.parse(meta);
65
+ if (parsed.schemaVersion !== STATE_SCHEMA_VERSION) {
66
+ return this.discardAndRebuild('schema-version-mismatch', {
67
+ found: parsed.schemaVersion,
68
+ expected: STATE_SCHEMA_VERSION
69
+ });
70
+ }
71
+ const record = {
72
+ schemaVersion: STATE_SCHEMA_VERSION,
73
+ lastReconcileSummary: parsed.lastReconcileSummary,
74
+ lastMaintenanceSummary: parsed.lastMaintenanceSummary
75
+ };
76
+ for (const collection of COLLECTIONS) {
77
+ const raw = this.store.getString(keyFor(collection));
78
+ const entries = raw === undefined ? [] : JSON.parse(raw);
79
+ if (!Array.isArray(entries)) {
80
+ return this.discardAndRebuild('unparseable', {
81
+ collection
82
+ });
83
+ }
84
+ record[collection] = entries;
85
+ }
86
+ return record;
87
+ } catch {
88
+ return this.discardAndRebuild('unparseable');
89
+ }
90
+ }
91
+
92
+ /** Reads the pre-0.6.0 single record, writes it out per collection, and drops it. */
93
+ migrateLegacy() {
94
+ const raw = this.store.getString(STATE_KEY);
95
+ if (raw === undefined) {
96
+ const fresh = emptyRecord();
97
+ this.persistMeta(fresh);
98
+ return fresh;
99
+ }
100
+ const parsed = JSON.parse(raw);
101
+ if (parsed.schemaVersion !== STATE_SCHEMA_VERSION) {
102
+ return this.discardAndRebuild('schema-version-mismatch', {
103
+ found: parsed.schemaVersion,
104
+ expected: STATE_SCHEMA_VERSION
105
+ });
106
+ }
107
+ this.record = {
108
+ schemaVersion: STATE_SCHEMA_VERSION,
109
+ dedupLedger: parsed.dedupLedger ?? [],
110
+ interactionBuffer: parsed.interactionBuffer ?? [],
111
+ migrationLedger: parsed.migrationLedger ?? [],
112
+ seriesLedger: parsed.seriesLedger ?? [],
113
+ permissionHistory: parsed.permissionHistory ?? [],
114
+ lastReconcileSummary: parsed.lastReconcileSummary,
115
+ lastMaintenanceSummary: parsed.lastMaintenanceSummary
116
+ };
117
+ for (const collection of COLLECTIONS) {
118
+ this.persist(collection);
119
+ }
120
+ this.persistMeta(this.record);
121
+ this.store.delete(STATE_KEY);
122
+ return this.record;
123
+ }
124
+ discardAndRebuild(reason, extra) {
125
+ this.rebuilt = true;
126
+ this.deleteAll();
127
+ this.persistMeta(emptyRecord());
128
+ this.emit({
129
+ code: DIAGNOSTIC_CODES.STATE_CORRUPT_REBUILT,
130
+ // Note what is actually lost, so the consequence is stated rather than implied.
131
+ context: {
132
+ reason,
133
+ lost: ['dedupLedger', 'interactionBuffer'],
134
+ ...extra
135
+ }
136
+ });
137
+ return emptyRecord();
138
+ }
139
+ deleteAll() {
140
+ this.store.delete(STATE_KEY);
141
+ this.store.delete(META_KEY);
142
+ for (const collection of COLLECTIONS) {
143
+ this.store.delete(keyFor(collection));
144
+ }
145
+ }
146
+
147
+ /** Never throws. A storage failure degrades the affected guarantee, nothing more. */
148
+ write(key, value) {
149
+ try {
150
+ this.store.setString(key, JSON.stringify(value));
151
+ } catch (error) {
152
+ this.emit({
153
+ code: DIAGNOSTIC_CODES.STATE_WRITE_FAILED,
154
+ context: {
155
+ reason: error instanceof Error ? error.name : 'unknown'
156
+ }
157
+ });
158
+ }
159
+ }
160
+
161
+ /** Writes one collection, and only that one. */
162
+ persist(collection) {
163
+ this.write(keyFor(collection), this.record[collection]);
164
+ }
165
+
166
+ /** The schema version and summaries. Present whenever any collection is stored. */
167
+ persistMeta(record = this.record) {
168
+ this.write(META_KEY, {
169
+ schemaVersion: STATE_SCHEMA_VERSION,
170
+ lastReconcileSummary: record.lastReconcileSummary,
171
+ lastMaintenanceSummary: record.lastMaintenanceSummary
172
+ });
173
+ }
174
+ read() {
175
+ return this.record;
176
+ }
177
+
178
+ /** Applies a change, evicts the touched collection, and persists. */
179
+ update(collection, mutate) {
180
+ const next = mutate(this.record[collection]);
181
+ const {
182
+ kept,
183
+ evicted,
184
+ reason,
185
+ overCap
186
+ } = evict(next, collection, this.now());
187
+ if (overCap > 0) {
188
+ this.emit({
189
+ code: DIAGNOSTIC_CODES.STATE_CAP_EXCEEDED,
190
+ context: {
191
+ collection,
192
+ overCap,
193
+ cap: COLLECTION_CAPS[collection].maxEntries
194
+ }
195
+ });
196
+ }
197
+ if (evicted.length > 0) {
198
+ this.emit({
199
+ code: collection === 'interactionBuffer' ? DIAGNOSTIC_CODES.INTERACTION_BUFFER_EVICTED : DIAGNOSTIC_CODES.STATE_CAP_EVICTED,
200
+ context: {
201
+ collection,
202
+ evicted: evicted.length,
203
+ reason
204
+ }
205
+ });
206
+ }
207
+ this.record = {
208
+ ...this.record,
209
+ [collection]: kept
210
+ };
211
+ this.persist(collection);
212
+ }
213
+ setSummary(key, value) {
214
+ this.record = {
215
+ ...this.record,
216
+ [key]: value
217
+ };
218
+ this.persistMeta();
219
+ }
220
+
221
+ /** Clears everything. Public through `resetState()`. */
222
+ reset() {
223
+ this.record = emptyRecord();
224
+ this.rebuilt = false;
225
+ this.deleteAll();
226
+ this.persistMeta();
227
+ }
228
+
229
+ /**
230
+ * Clears one owner tag's entries, leaving every other tag untouched.
231
+ *
232
+ * Collections without an owner tag are left alone: a migration ledger and a
233
+ * series ledger describe the device, not an account.
234
+ */
235
+ clearOwner(ownerTag) {
236
+ this.record = {
237
+ ...this.record,
238
+ dedupLedger: this.record.dedupLedger.filter(e => e.ownerTag !== ownerTag),
239
+ interactionBuffer: this.record.interactionBuffer.filter(e => e.ownerTag !== ownerTag),
240
+ permissionHistory: this.record.permissionHistory.filter(e => !e.key.startsWith(`${ownerTag}:`))
241
+ };
242
+ this.persist('dedupLedger');
243
+ this.persist('interactionBuffer');
244
+ this.persist('permissionHistory');
245
+ }
246
+ health() {
247
+ const collections = Object.keys(COLLECTION_CAPS).map(name => {
248
+ const entries = this.record[name];
249
+ return {
250
+ name,
251
+ size: entries.length,
252
+ cap: COLLECTION_CAPS[name].maxEntries,
253
+ oldestEntryAt: entries.length > 0 ? Math.min(...entries.map(e => e.at)) : undefined
254
+ };
255
+ });
256
+ return {
257
+ readable: true,
258
+ rebuilt: this.rebuilt,
259
+ collections,
260
+ approximateBytes: this.store.approximateBytes()
261
+ };
262
+ }
263
+ }
264
+ //# sourceMappingURL=record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["evict","COLLECTION_CAPS","DIAGNOSTIC_CODES","STATE_KEY","META_KEY","COLLECTIONS","keyFor","collection","STATE_SCHEMA_VERSION","emptyRecord","schemaVersion","dedupLedger","interactionBuffer","migrationLedger","seriesLedger","permissionHistory","StateManager","rebuilt","constructor","options","store","now","emit","record","load","meta","getString","undefined","migrateLegacy","parsed","JSON","parse","discardAndRebuild","found","expected","lastReconcileSummary","lastMaintenanceSummary","raw","entries","Array","isArray","fresh","persistMeta","persist","delete","reason","extra","deleteAll","code","STATE_CORRUPT_REBUILT","context","lost","write","key","value","setString","stringify","error","STATE_WRITE_FAILED","Error","name","read","update","mutate","next","kept","evicted","overCap","STATE_CAP_EXCEEDED","cap","maxEntries","length","INTERACTION_BUFFER_EVICTED","STATE_CAP_EVICTED","setSummary","reset","clearOwner","ownerTag","filter","e","startsWith","health","collections","Object","keys","map","size","oldestEntryAt","Math","min","at","readable","approximateBytes"],"sourceRoot":"../../../src","sources":["state/record.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,KAAK,EAAEC,eAAe,QAA+C,WAAQ;AAGtF,SAASC,gBAAgB,QAA6B,uBAAoB;;AAE1E;AACA,MAAMC,SAAS,GAAG,kCAAkC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAQ,GAAG,GAAGD,SAAS,O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;MACd1E,OAAO,EAAE,IAAI,CAACA,OAAO;MACrBiE,WAAW;MACXU,gBAAgB,EAAE,IAAI,CAACxE,KAAK,CAACwE,gBAAgB,CAAC;IAC/C,CAAC;EACF;AACD","ignoreList":[]}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Public state reset and per-owner clearing.
5
+ *
6
+ * These are the only two ways a consumer may touch the persisted record. The
7
+ * record itself is unreachable — a consumer can discard state, but can never
8
+ * read or write it.
9
+ */
10
+
11
+ /** Discards the entire record. Nothing already scheduled with the OS is affected. */
12
+ export function resetState(state) {
13
+ state.reset();
14
+ return {
15
+ clearedCollections: ['dedupLedger', 'interactionBuffer', 'migrationLedger', 'seriesLedger', 'permissionHistory']
16
+ };
17
+ }
18
+
19
+ /**
20
+ * Clears one owner tag's entries on sign-out.
21
+ *
22
+ * Deliberately narrower than a full reset: the migration and series ledgers
23
+ * describe the device rather than an account, so signing one account out must
24
+ * not discard channel migration history that every account depends on.
25
+ */
26
+ export function clearOwner(state, ownerTag) {
27
+ state.clearOwner(ownerTag);
28
+ return {
29
+ clearedCollections: ['dedupLedger', 'interactionBuffer', 'permissionHistory']
30
+ };
31
+ }
32
+ //# sourceMappingURL=reset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["resetState","state","reset","clearedCollections","clearOwner","ownerTag"],"sourceRoot":"../../../src","sources":["state/reset.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA,OAAO,SAASA,UAAUA,CAACC,KAAmB,EAAgB;EAC7DA,KAAK,CAACC,KAAK,CAAC,CAAC;EACb,OAAO;IACNC,kBAAkB,EAAE,CACnB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,mBAAmB;EAErB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAACH,KAAmB,EAAEI,QAAgB,EAAgB;EAC/EJ,KAAK,CAACG,UAAU,CAACC,QAAQ,CAAC;EAC1B,OAAO;IACNF,kBAAkB,EAAE,CAAC,aAAa,EAAE,mBAAmB,EAAE,mBAAmB;EAC7E,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The recurrence series ledger.
5
+ *
6
+ * What makes automatic maintenance possible without a desired set from the
7
+ * consumer: the package remembers which series it owns, how far each has been
8
+ * expanded, and how many occurrences a count-limited series has already
9
+ * emitted. None of that is derivable from the platform's pending set, which
10
+ * knows only about individual notifications.
11
+ *
12
+ * It also defines what maintenance is allowed to touch. An occurrence belongs
13
+ * to a series in this ledger, so cancelling it is within scope; anything else
14
+ * is a directly-scheduled notification the package does not own.
15
+ */
16
+
17
+ export function readSeries(state, seriesId) {
18
+ return state.read().seriesLedger.find(entry => entry.seriesId === seriesId);
19
+ }
20
+ export function listSeries(state) {
21
+ return state.read().seriesLedger;
22
+ }
23
+
24
+ /** Records or updates a series. Replaces in place so a re-registration cannot duplicate. */
25
+ export function upsertSeries(state, rule, update, now) {
26
+ const entry = {
27
+ at: now,
28
+ seriesId: rule.id,
29
+ anchoring: rule.anchoring ?? 'wallClock',
30
+ expandedThrough: update.expandedThrough,
31
+ emittedCount: update.emittedCount,
32
+ exhausted: update.exhausted,
33
+ ...(update.lastEmittedKey !== undefined ? {
34
+ lastEmittedKey: update.lastEmittedKey
35
+ } : {})
36
+ };
37
+ state.update('seriesLedger', current => [...current.filter(existing => existing.seriesId !== rule.id), entry]);
38
+ }
39
+ export function removeSeries(state, seriesId) {
40
+ state.update('seriesLedger', current => current.filter(entry => entry.seriesId !== seriesId));
41
+ }
42
+
43
+ /**
44
+ * Identifiers the package owns.
45
+ *
46
+ * An occurrence identifier is `<seriesId>#<instant>`, so ownership is decided
47
+ * by prefix rather than by an enumeration the ledger would have to keep in sync
48
+ * with the device. That keeps the check correct even for occurrences scheduled
49
+ * before the app last restarted.
50
+ */
51
+ export function ownsIdentifier(state, id) {
52
+ const separator = id.lastIndexOf('#');
53
+ if (separator === -1) return false;
54
+ const seriesId = id.slice(0, separator);
55
+ return state.read().seriesLedger.some(entry => entry.seriesId === seriesId);
56
+ }
57
+
58
+ /** Every occurrence identifier currently attributable to a tracked series. */
59
+ export function ownedIdentifiers(state, pendingIds) {
60
+ return new Set(pendingIds.filter(id => ownsIdentifier(state, id)));
61
+ }
62
+ //# sourceMappingURL=series-ledger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["readSeries","state","seriesId","read","seriesLedger","find","entry","listSeries","upsertSeries","rule","update","now","at","id","anchoring","expandedThrough","emittedCount","exhausted","lastEmittedKey","undefined","current","filter","existing","removeSeries","ownsIdentifier","separator","lastIndexOf","slice","some","ownedIdentifiers","pendingIds","Set"],"sourceRoot":"../../../src","sources":["state/series-ledger.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAgBA,OAAO,SAASA,UAAUA,CAACC,KAAmB,EAAEC,QAAgB,EAA4B;EAC3F,OAAOD,KAAK,CAACE,IAAI,CAAC,CAAC,CAACC,YAAY,CAACC,IAAI,CAACC,KAAK,IAAIA,KAAK,CAACJ,QAAQ,KAAKA,QAAQ,CAAC;AAC5E;AAEA,OAAO,SAASK,UAAUA,CAACN,KAAmB,EAA2B;EACxE,OAAOA,KAAK,CAACE,IAAI,CAAC,CAAC,CAACC,YAAY;AACjC;;AAEA;AACA,OAAO,SAASI,YAAYA,CAC3BP,KAAmB,EACnBQ,IAAoB,EACpBC,MAKC,EACDC,GAAW,EACJ;EACP,MAAML,KAAkB,GAAG;IAC1BM,EAAE,EAAED,GAAG;IACPT,QAAQ,EAAEO,IAAI,CAACI,EAAE;IACjBC,SAAS,EAAEL,IAAI,CAACK,SAAS,IAAI,WAAW;IACxCC,eAAe,EAAEL,MAAM,CAACK,eAAe;IACvCC,YAAY,EAAEN,MAAM,CAACM,YAAY;IACjCC,SAAS,EAAEP,MAAM,CAACO,SAAS;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the persisted state record.
5
+ *
6
+ * Kept as a port so the pure state logic is testable with no native module,
7
+ * and so MMKV stays confined to one file. This is internal — a consumer can
8
+ * reset or clear state, but can never read or write the record directly.
9
+ */
10
+
11
+ /** In-memory store, used by tests and as the fallback when MMKV is unavailable. */
12
+ export function createMemoryStore() {
13
+ const map = new Map();
14
+ return {
15
+ getString: key => map.get(key),
16
+ setString: (key, value) => {
17
+ map.set(key, value);
18
+ },
19
+ delete: key => {
20
+ map.delete(key);
21
+ },
22
+ clearAll: () => {
23
+ map.clear();
24
+ },
25
+ approximateBytes: () => {
26
+ let total = 0;
27
+ for (const [key, value] of map) {
28
+ total += key.length + value.length;
29
+ }
30
+ return total;
31
+ },
32
+ durable: false
33
+ };
34
+ }
35
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createMemoryStore","map","Map","getString","key","get","setString","value","set","delete","clearAll","clear","approximateBytes","total","length","durable"],"sourceRoot":"../../../src","sources":["state/store.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA;AACA,OAAO,SAASA,iBAAiBA,CAAA,EAAe;EAC/C,MAAMC,GAAG,GAAG,IAAIC,GAAG,CAAiB,CAAC;EACrC,OAAO;IACNC,SAAS,EAAEC,GAAG,IAAIH,GAAG,CAACI,GAAG,CAACD,GAAG,CAAC;IAC9BE,SAAS,EAAEA,CAACF,GAAG,EAAEG,KAAK,KAAK;MAC1BN,GAAG,CAACO,GAAG,CAACJ,GAAG,EAAEG,KAAK,CAAC;IACpB,CAAC;IACDE,MAAM,EAAEL,GAAG,IAAI;MACdH,GAAG,CAACQ,MAAM,CAACL,GAAG,CAAC;IAChB,CAAC;IACDM,QAAQ,EAAEA,CAAA,KAAM;MACfT,GAAG,CAACU,KAAK,CAAC,CAAC;IACZ,CAAC;IACDC,gBAAgB,EAAEA,CAAA,KAAM;MACvB,IAAIC,KAAK,GAAG,CAAC;MACb,KAAK,MAAM,CAACT,GAAG,EAAEG,KAAK,CAAC,IAAIN,GAAG,EAAE;QAC/BY,KAAK,IAAIT,GAAG,CAACU,MAAM,GAAGP,KAAK,CAACO,MAAM;MACnC;MACA,OAAOD,KAAK;IACb,CAAC;IACDE,OAAO,EAAE;EACV,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The shared conformance suite.
5
+ *
6
+ * The executable definition of what an engine adapter must do. Run against the
7
+ * real engine and against the fake, it is what backs the claim that testing
8
+ * with fakes proves something about production — if the two ever diverge, this
9
+ * is where it shows up rather than on a user's device.
10
+ *
11
+ * Written as a plain async function rather than a Jest suite so it can be
12
+ * driven from the demo app on a real device as well as from continuous
13
+ * integration.
14
+ */
15
+
16
+ const TONE = {
17
+ toneId: 'conformance',
18
+ version: 1,
19
+ android: {
20
+ channelId: 'conformance.v1',
21
+ importance: 'default',
22
+ vibration: false,
23
+ badge: false,
24
+ bypassDnd: false,
25
+ name: 'Fixture tone',
26
+ loopSound: false,
27
+ alarmCategory: false
28
+ },
29
+ ios: {
30
+ categoryId: 'conformance',
31
+ interruptionLevel: 'active',
32
+ badge: false,
33
+ repeatRefused: false
34
+ }
35
+ };
36
+ export async function runConformanceSuite(adapter, options = {}) {
37
+ const now = options.now ?? (() => Date.now());
38
+ const prefix = options.prefix ?? 'conformance';
39
+ const checks = [];
40
+ const check = async (name, run) => {
41
+ try {
42
+ const outcome = await run();
43
+ checks.push(outcome === true ? {
44
+ name,
45
+ passed: true
46
+ } : {
47
+ name,
48
+ passed: false,
49
+ detail: typeof outcome === 'string' ? outcome : 'returned false'
50
+ });
51
+ } catch (error) {
52
+ checks.push({
53
+ name,
54
+ passed: false,
55
+ detail: error instanceof Error ? error.message : String(error)
56
+ });
57
+ }
58
+ };
59
+ const id = suffix => `${prefix}:${suffix}`;
60
+ const at = now() + 3_600_000;
61
+ const schedule = (suffix, overrides = {}) => adapter.schedule({
62
+ request: {
63
+ id: id(suffix),
64
+ content: {
65
+ title: `Conformance ${suffix}`,
66
+ body: 'Suite entry'
67
+ },
68
+ tone: 'conformance',
69
+ moment: {
70
+ at
71
+ },
72
+ ...overrides
73
+ },
74
+ resolvedAt: at,
75
+ tone: TONE,
76
+ approximate: false
77
+ });
78
+
79
+ // Start clean so a previous run cannot mask a failure.
80
+ await adapter.cancelAll();
81
+ await check('reports its capabilities', async () => {
82
+ const capabilities = await adapter.getCapabilities();
83
+ return capabilities.pendingCeiling > 0 || `pendingCeiling must be positive, got ${capabilities.pendingCeiling}`;
84
+ });
85
+ await check('schedules and reads back an entry', async () => {
86
+ await schedule('a');
87
+ const pending = await adapter.getPending();
88
+ return pending.some(entry => entry.id === id('a')) || 'scheduled entry was not returned';
89
+ });
90
+ await check('returns enough detail to diff, not merely to count', async () => {
91
+ const [entry] = (await adapter.getPending()).filter(e => e.id === id('a'));
92
+ if (entry === undefined) return 'entry missing';
93
+ return entry.content.title.length > 0 && entry.resolvedAt > 0 && entry.anchoring !== undefined || 'entry lacked content, instant, or anchoring mode';
94
+ });
95
+ await check('replaces rather than duplicates on the same identifier', async () => {
96
+ await schedule('a', {
97
+ content: {
98
+ title: 'Replaced',
99
+ body: 'Newer'
100
+ }
101
+ });
102
+ const matching = (await adapter.getPending()).filter(entry => entry.id === id('a'));
103
+ return matching.length === 1 || `expected exactly 1 entry, found ${matching.length}`;
104
+ });
105
+ await check('round-trips a routing payload unchanged', async () => {
106
+ await schedule('routing', {
107
+ routing: {
108
+ screen: 'task',
109
+ nested: {
110
+ deep: true
111
+ }
112
+ }
113
+ });
114
+ const entry = (await adapter.getPending()).find(e => e.id === id('routing'));
115
+ return JSON.stringify(entry?.routing) === JSON.stringify({
116
+ screen: 'task',
117
+ nested: {
118
+ deep: true
119
+ }
120
+ }) || `routing payload changed: ${JSON.stringify(entry?.routing)}`;
121
+ });
122
+ await check('preserves the anchoring mode it was given', async () => {
123
+ await schedule('absolute', {
124
+ moment: {
125
+ at,
126
+ anchoring: 'absolute'
127
+ }
128
+ });
129
+ const entry = (await adapter.getPending()).find(e => e.id === id('absolute'));
130
+ return entry?.anchoring === 'absolute' || `expected absolute, got ${entry?.anchoring}`;
131
+ });
132
+ await check('cancels one entry without touching the others', async () => {
133
+ const before = (await adapter.getPending()).length;
134
+ await adapter.cancel(id('a'));
135
+ const after = await adapter.getPending();
136
+ return after.length === before - 1 && !after.some(entry => entry.id === id('a')) || 'cancel removed the wrong number of entries';
137
+ });
138
+ await check('cancelling something absent is harmless', async () => {
139
+ await adapter.cancel(id('never-existed'));
140
+ return true;
141
+ });
142
+ await check('reports permission state without throwing', async () => {
143
+ const state = await adapter.getPermission('display');
144
+ return ['notAsked', 'granted', 'denied', 'permanentlyDenied', 'provisional', 'notRequired'].includes(state) || `unexpected permission state: ${state}`;
145
+ });
146
+ await check('reports background restrictions, admitting unknown', async () => {
147
+ const report = await adapter.getRestrictions();
148
+ return ['unrestricted', 'restricted', 'unknown'].includes(report.batteryOptimization) || `unexpected restriction status: ${report.batteryOptimization}`;
149
+ });
150
+ await check('returns pending entries in ascending delivery order', async () => {
151
+ const pending = await adapter.getPending();
152
+ const instants = pending.map(entry => entry.resolvedAt);
153
+ const sorted = [...instants].sort((x, y) => x - y);
154
+ return JSON.stringify(instants) === JSON.stringify(sorted) || 'entries were not time-ordered';
155
+ });
156
+ await check('cancelAll leaves nothing behind', async () => {
157
+ await adapter.cancelAll();
158
+ const pending = await adapter.getPending();
159
+ return pending.length === 0 || `${pending.length} entries survived cancelAll`;
160
+ });
161
+
162
+ // --- Repeat expiry -------------------------------------------------------
163
+ // A substituted engine must be checked on these, not trusted: every one of
164
+ // them is a way to end up with a device that will not stop ringing, or with
165
+ // a consumer cancelling an artifact it was never meant to see.
166
+
167
+ await check('answers whether it can repeat an alert, rather than guessing', async () => {
168
+ const capabilities = await adapter.getCapabilities();
169
+ return typeof capabilities.supportsRepeatingAlert === 'boolean' || 'supportsRepeatingAlert was not a boolean';
170
+ });
171
+ await check('reports a repeating alert it cannot honour', async () => {
172
+ const capabilities = await adapter.getCapabilities();
173
+ if (capabilities.supportsRepeatingAlert) return true;
174
+
175
+ // A partially emulated repeat is worse than an honest refusal: the
176
+ // consumer believes the alarm is bounded when nothing bounds it.
177
+ const repeating = {
178
+ ...TONE,
179
+ android: {
180
+ ...TONE.android,
181
+ loopSound: true,
182
+ repeatForMs: 900_000
183
+ },
184
+ ios: {
185
+ ...TONE.ios,
186
+ repeatRefused: true
187
+ }
188
+ };
189
+ return repeating.ios.repeatRefused || 'refusal was not recorded on the resolved tone';
190
+ });
191
+ await check('keeps stop markers out of the consumer-visible pending set', async () => {
192
+ const stops = await adapter.listRepeatStops();
193
+ const pending = await adapter.getPending();
194
+ const leaked = pending.filter(entry => stops.some(stop => stop.markerId === entry.id));
195
+ return leaked.length === 0 || `${leaked.length} package-owned marker(s) were reported as consumer notifications`;
196
+ });
197
+ await check('silencing a notification that is gone is an answer, not a failure', async () => {
198
+ // The ordinary case after the user has handled it. An engine that throws
199
+ // here turns the commonest path into an error.
200
+ const silenced = await adapter.silenceDelivered(id('never-displayed'));
201
+ return silenced === false || 'reported silencing a notification it was not displaying';
202
+ });
203
+ await check('says whether a background delivery handler is registered', async () => {
204
+ return typeof adapter.hasBackgroundDeliveryHandler() === 'boolean' || 'hasBackgroundDeliveryHandler was not a boolean';
205
+ });
206
+ const passed = checks.filter(entry => entry.passed).length;
207
+ return {
208
+ adapter: adapter.name,
209
+ checks,
210
+ passed,
211
+ failed: checks.length - passed
212
+ };
213
+ }
214
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TONE","toneId","version","android","channelId","importance","vibration","badge","bypassDnd","name","loopSound","alarmCategory","ios","categoryId","interruptionLevel","repeatRefused","runConformanceSuite","adapter","options","now","Date","prefix","checks","check","run","outcome","push","passed","detail","error","Error","message","String","id","suffix","at","schedule","overrides","request","content","title","body","tone","moment","resolvedAt","approximate","cancelAll","capabilities","getCapabilities","pendingCeiling","pending","getPending","some","entry","filter","e","undefined","length","anchoring","matching","routing","screen","nested","deep","find","JSON","stringify","before","cancel","after","state","getPermission","includes","report","getRestrictions","batteryOptimization","instants","map","sorted","sort","x","y","supportsRepeatingAlert","repeating","repeatForMs","stops","listRepeatStops","leaked","stop","markerId","silenced","silenceDelivered","hasBackgroundDeliveryHandler","failed"],"sourceRoot":"../../../../src","sources":["testing/conformance/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,MAAMA,IAAkB,GAAG;EAC1BC,MAAM,EAAE,aAAa;EACrBC,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE;IACRC,SAAS,EAAE,gBAAgB;IAC3BC,UAAU,EAAE,SAAS;IACrBC,SAAS,EAAE,KAAK;IAChBC,KAAK,EAAE,KAAK;IACZC,SAAS,EAAE,KAAK;IAChBC,IAAI,EAAE,cAAc;IACpBC,SAAS,EAAE,KAAK;IAChBC,aAAa,EAAE;EAChB,CAAC;EACDC,GAAG,EAAE;IACJC,UAAU,EAAE,aAAa;IACzBC,iBAAiB,EAAE,QAAQ;IAC3BP,KAAK,EAAE,KAAK;IACZQ,aAAa,EAAE;EAChB;AACD,CAAC;AAsBD,OAAO,eAAeC,mBAAmBA,CACxCC,OAAkC,EAClCC,OAA2B,GAAG,CAAC,CAAC,EACH;EAC7B,MAAMC,GAAG,GAAGD,OAAO,CAACC,GAAG,KAAK,MAAMC,IAAI,CAACD,GAAG,CAAC,CAAC,CAAC;EAC7C,MAAME,MAAM,GAAGH,OAAO,CAACG,MAAM,IAAI,aAAa;EAC9C,MAAMC,MAA0B,GAAG,EAAE;EAErC,MAAMC,KAAK,GAAG,MAAAA,CAAOd,IAAY,EAAEe,GAAoC,KAAoB;IAC1F,IAAI;MACH,MAAMC,OAAO,GAAG,MAAMD,GAAG,CAAC,CAAC;MAC3BF,MAAM,CAACI,IAAI,CACVD,OAAO,KAAK,IAAI,GACb;QAAEhB,IAAI;QAAEkB,MAAM,EAAE;MAAK,CAAC,GACtB;QAC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