@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.
Files changed (647) hide show
  1. package/CHANGELOG.md +111 -0
  2. package/README.md +8 -6
  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 +72 -26
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Duplicate identifier resolution.
5
+ *
6
+ * An identifier appearing twice in one desired set means the caller's key
7
+ * derivation produced two notifications for one identity. That is a bug, not a
8
+ * preference, so the package refuses rather than silently picking a winner.
9
+ *
10
+ * **Every** copy is rejected — no entry wins. Order-independence then follows
11
+ * for free rather than having to be engineered: there is no "first" or "last"
12
+ * to depend on.
13
+ *
14
+ * The rule applies even to byte-identical duplicates. Treating those as
15
+ * mergeable would require a deep-equality definition that becomes a contract of
16
+ * its own, and a repeated identifier is a key-derivation bug either way.
17
+ */
18
+
19
+ import { DIAGNOSTIC_CODES } from "../contract/errors.js";
20
+ /**
21
+ * Splits a desired set into applicable entries and rejections.
22
+ *
23
+ * `existingIds` lets the rejection state whether a notification already
24
+ * scheduled under that identifier was left in place — without it a caller could
25
+ * reasonably read "rejected" as "cancelled".
26
+ */
27
+ export function splitDuplicates(desired, existingIds = new Set()) {
28
+ const counts = new Map();
29
+ for (const request of desired) {
30
+ counts.set(request.id, (counts.get(request.id) ?? 0) + 1);
31
+ }
32
+ const unique = [];
33
+ const rejected = [];
34
+ for (const request of desired) {
35
+ if ((counts.get(request.id) ?? 0) === 1) {
36
+ unique.push(request);
37
+ }
38
+ }
39
+
40
+ // Sorted so the report itself is order-independent, not merely its effect.
41
+ const repeated = [...counts.entries()].filter(([, count]) => count > 1).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
42
+ for (const [id, occurrences] of repeated) {
43
+ rejected.push({
44
+ id,
45
+ code: DIAGNOSTIC_CODES.DUPLICATE_IDENTIFIER,
46
+ reason: `Identifier appeared ${occurrences} times in one desired set. Every copy was rejected, because the package cannot know which was intended.` + (existingIds.has(id) ? ' Any notification already scheduled under it was left in place — this is a rejection, not a cancellation.' : ''),
47
+ occurrences,
48
+ existingLeftInPlace: existingIds.has(id)
49
+ });
50
+ }
51
+ return {
52
+ unique,
53
+ rejected
54
+ };
55
+ }
56
+ //# sourceMappingURL=duplicates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DIAGNOSTIC_CODES","splitDuplicates","desired","existingIds","Set","counts","Map","request","set","id","get","unique","rejected","push","repeated","entries","filter","count","sort","a","b","occurrences","code","DUPLICATE_IDENTIFIER","reason","has","existingLeftInPlace"],"sourceRoot":"../../../src","sources":["reconcile/duplicates.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,gBAAgB,QAAQ,uBAAoB;AASrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC9BC,OAAuC,EACvCC,WAAgC,GAAG,IAAIC,GAAG,CAAC,CAAC,EAC3B;EACjB,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAAiB,CAAC;EACxC,KAAK,MAAMC,OAAO,IAAIL,OAAO,EAAE;IAC9BG,MAAM,CAACG,GAAG,CAACD,OAAO,CAACE,EAAE,EAAE,CAACJ,MAAM,CAACK,GAAG,CAACH,OAAO,CAACE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;EAC1D;EAEA,MAAME,MAA6B,GAAG,EAAE;EACxC,MAAMC,QAAyB,GAAG,EAAE;EAEpC,KAAK,MAAML,OAAO,IAAIL,OAAO,EAAE;IAC9B,IAAI,CAACG,MAAM,CAACK,GAAG,CAACH,OAAO,CAACE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;MACxCE,MAAM,CAACE,IAAI,CAACN,OAAO,CAAC;IACrB;EACD;;EAEA;EACA,MAAMO,QAAQ,GAAG,CAAC,GAAGT,MAAM,CAACU,OAAO,CAAC,CAAC,CAAC,CACpCC,MAAM,CAAC,CAAC,GAAGC,KAAK,CAAC,KAAKA,KAAK,GAAG,CAAC,CAAC,CAChCC,IAAI,CAAC,CAAC,CAACC,CAAC,CAAC,EAAE,CAACC,CAAC,CAAC,KAAMD,CAAC,GAAGC,CAAC,GAAG,CAAC,CAAC,GAAGD,CAAC,GAAGC,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC;EAElD,KAAK,MAAM,CAACX,EAAE,EAAEY,WAAW,CAAC,IAAIP,QAAQ,EAAE;IACzCF,QAAQ,CAACC,IAAI,CAAC;MACbJ,EAAE;MACFa,IAAI,EAAEtB,gBAAgB,CAACuB,oBAAoB;MAC3CC,MAAM,EACL,uBAAuBH,WAAW,yGAAyG,IAC1IlB,WAAW,CAACsB,GAAG,CAAChB,EAAE,CAAC,GACjB,2GAA2G,GAC3G,EAAE,CAAC;MACPY,WAAW;MACXK,mBAAmB,EAAEvB,WAAW,CAACsB,GAAG,CAAChB,EAAE;IACxC,CAAC,CAAC;EACH;EAEA,OAAO;IAAEE,MAAM;IAAEC;EAAS,CAAC;AAC5B","ignoreList":[]}
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * The reconciliation operation.
5
+ *
6
+ * A caller hands over the complete set its data implies; the package works out
7
+ * what to add, replace, and remove. This is **never** run automatically — only
8
+ * the caller knows what its data implies, and a package that guessed a desired
9
+ * set would cancel notifications it does not understand.
10
+ *
11
+ * Overlapping calls are serialized rather than run concurrently, because two
12
+ * passes interleaving their cancels and creates is exactly how duplicates
13
+ * appear.
14
+ */
15
+
16
+ import { DIAGNOSTIC_CODES } from "../contract/errors.js";
17
+ import { anchorMoment } from "../schedule/anchor.js";
18
+ import { resolveMoment } from "../schedule/resolve-moment.js";
19
+ import { validateRequest } from "../schedule/index.js";
20
+ import { isNotificationError } from "../contract/errors.js";
21
+ import { splitDuplicates } from "./duplicates.js";
22
+ import { truncateToCeiling } from "./truncate.js";
23
+ import { createScheduleWriter } from "../schedule/writer.js";
24
+ import { diff } from "./diff.js";
25
+ import { applyInChunks } from "./chunk.js";
26
+ /**
27
+ * Narrows the device set to the caller's declared domain.
28
+ *
29
+ * Everything outside it is invisible to this pass, which is what makes it safe
30
+ * to cancel strays: a notification from another domain or another library is
31
+ * never a stray, it simply is not ours.
32
+ */
33
+ function inDomain(entry, input) {
34
+ if (entry.pushCreated && input.includePushCreated !== true) return false;
35
+ return entry.groupTag === input.domain;
36
+ }
37
+ export function createReconciler(deps) {
38
+ const emit = deps.emit ?? (() => {});
39
+ const writer = createScheduleWriter(deps.engine);
40
+ let inFlight = Promise.resolve();
41
+ const run = async input => {
42
+ const startedAt = deps.now();
43
+ const zone = deps.timeZone();
44
+ const everything = await deps.engine.getPending();
45
+ const device = everything.filter(entry => inDomain(entry, input));
46
+ // The ceiling is the platform's, shared with every other domain, every
47
+ // recurring series and every directly scheduled notification. Budgeting a
48
+ // domain against the whole of it let two domains and a series overflow iOS's
49
+ // 64 together while each reported "nothing truncated" (NOT-11).
50
+ const heldElsewhere = everything.length - device.length;
51
+ const existingIds = new Set(device.map(entry => entry.id));
52
+
53
+ // Duplicates first: a repeated identifier is refused before anything else
54
+ // looks at it, so no later stage has to decide which copy it meant.
55
+ const {
56
+ unique,
57
+ rejected: duplicateRejections
58
+ } = splitDuplicates(input.desired, existingIds);
59
+ const rejected = [...duplicateRejections];
60
+
61
+ // Validate and anchor. A rejection here removes one entry; it never fails
62
+ // the pass, because 499 valid entries should not be lost to one bad one.
63
+ const valid = [];
64
+ const resolvedAt = new Map();
65
+ for (const request of unique) {
66
+ try {
67
+ validateRequest(request, deps.resolveTone);
68
+ const anchored = anchorMoment(request.moment, zone);
69
+ const resolution = resolveMoment(anchored.resolvedAt, deps.now());
70
+ resolvedAt.set(request.id, resolution.at);
71
+ valid.push(request);
72
+ } catch (error) {
73
+ rejected.push({
74
+ id: request.id,
75
+ code: isNotificationError(error) ? error.code : 'UNKNOWN',
76
+ reason: error instanceof Error ? error.message : String(error),
77
+ occurrences: 1,
78
+ existingLeftInPlace: existingIds.has(request.id)
79
+ });
80
+ }
81
+ }
82
+
83
+ // Stop markers occupy real platform capacity, so the ceiling a consumer's
84
+ // notifications can actually use is smaller than the platform's own.
85
+ // Hiding that would let the package quietly reduce how many notifications
86
+ // fit and report a full set as registered when it was not.
87
+ // One pass: the outstanding stop markers are read once for the capacity and
88
+ // every operation below, not once per operation (NOT-08).
89
+ const pass = writer.pass();
90
+ const {
91
+ kept,
92
+ report: truncation
93
+ } = truncateToCeiling(valid, resolvedAt, Math.max(0, (await pass.capacity()) - heldElsewhere));
94
+ if (truncation !== undefined) {
95
+ emit(DIAGNOSTIC_CODES.TRUNCATED_OVER_CEILING, `Desired set exceeded the platform ceiling of ${truncation.ceiling}; ${truncation.droppedCount} furthest-out entries were not registered. They are re-evaluated at the next window refresh.`, {
96
+ ceiling: truncation.ceiling,
97
+ dropped: truncation.droppedCount
98
+ });
99
+ }
100
+
101
+ // Every rejected identifier is protected from cancellation. A rejection
102
+ // means the package could not tell what the caller intended, and
103
+ // destroying the existing notification on that basis would be the worst
104
+ // available answer (FR-028c).
105
+ const {
106
+ operations,
107
+ unchanged
108
+ } = diff({
109
+ desired: kept,
110
+ resolvedAt,
111
+ device,
112
+ protectedIds: new Set(rejected.map(entry => entry.id))
113
+ });
114
+ const created = [];
115
+ const replaced = [];
116
+ const cancelled = [];
117
+ const approximate = !deps.canScheduleExactly();
118
+ await applyInChunks(operations, async operation => {
119
+ if (operation.kind === 'cancel') {
120
+ await pass.cancel(operation.id);
121
+ cancelled.push(operation.id);
122
+ return;
123
+ }
124
+ const request = operation.request;
125
+ const tone = deps.resolveTone(request.tone);
126
+ await pass.write({
127
+ request,
128
+ resolvedAt: operation.resolvedAt,
129
+ tone,
130
+ anchoringGeneration: (request.moment.anchoring ?? 'wallClock') === 'absolute' ? undefined : zone,
131
+ approximate
132
+ });
133
+ (operation.kind === 'create' ? created : replaced).push(operation.id);
134
+ }, {
135
+ size: deps.chunkSize
136
+ });
137
+ return {
138
+ domain: input.domain,
139
+ created,
140
+ replaced,
141
+ cancelled,
142
+ unchanged,
143
+ rejected,
144
+ truncated: truncation,
145
+ operationCount: operations.length,
146
+ durationMs: deps.now() - startedAt
147
+ };
148
+ };
149
+ return {
150
+ /**
151
+ * Serialized against itself: a second call waits for the first rather than
152
+ * interleaving with it.
153
+ */
154
+ async reconcile(input) {
155
+ const next = inFlight.then(() => run(input), () => run(input));
156
+ inFlight = next.catch(() => undefined);
157
+ return next;
158
+ }
159
+ };
160
+ }
161
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DIAGNOSTIC_CODES","anchorMoment","resolveMoment","validateRequest","isNotificationError","splitDuplicates","truncateToCeiling","createScheduleWriter","diff","applyInChunks","inDomain","entry","input","pushCreated","includePushCreated","groupTag","domain","createReconciler","deps","emit","writer","engine","inFlight","Promise","resolve","run","startedAt","now","zone","timeZone","everything","getPending","device","filter","heldElsewhere","length","existingIds","Set","map","id","unique","rejected","duplicateRejections","desired","valid","resolvedAt","Map","request","resolveTone","anchored","moment","resolution","set","at","push","error","code","reason","Error","message","String","occurrences","existingLeftInPlace","has","pass","kept","report","truncation","Math","max","capacity","undefined","TRUNCATED_OVER_CEILING","ceiling","droppedCount","dropped","operations","unchanged","protectedIds","created","replaced","cancelled","approximate","canScheduleExactly","operation","kind","cancel","tone","write","anchoringGeneration","anchoring","size","chunkSize","truncated","operationCount","durationMs","reconcile","next","then","catch"],"sourceRoot":"../../../src","sources":["reconcile/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAASA,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,YAAY,QAA6B,uBAAoB;AACtE,SAASC,aAAa,QAAQ,+BAA4B;AAC1D,SAASC,eAAe,QAAQ,sBAAa;AAC7C,SAASC,mBAAmB,QAAQ,uBAAoB;AAExD,SAASC,eAAe,QAAQ,iBAAc;AAC9C,SAASC,iBAAiB,QAAQ,eAAY;AAC9C,SAASC,oBAAoB,QAAQ,uBAAoB;AACzD,SAASC,IAAI,QAAQ,WAAQ;AAC7B,SAASC,aAAa,QAAQ,YAAS;AAavC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,QAAQA,CAACC,KAAmB,EAAEC,KAAqB,EAAW;EACtE,IAAID,KAAK,CAACE,WAAW,IAAID,KAAK,CAACE,kBAAkB,KAAK,IAAI,EAAE,OAAO,KAAK;EACxE,OAAOH,KAAK,CAACI,QAAQ,KAAKH,KAAK,CAACI,MAAM;AACvC;AAEA,OAAO,SAASC,gBAAgBA,CAACC,IAA2B,EAAE;EAC7D,MAAMC,IAAI,GAAGD,IAAI,CAACC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC;EACpC,MAAMC,MAAM,GAAGb,oBAAoB,CAACW,IAAI,CAACG,MAAM,CAAC;EAChD,IAAIC,QAAkC,GAAGC,OAAO,CAACC,OAAO,CAAC,CAAwC;EAEjG,MAAMC,GAAG,GAAG,MAAOb,KAAqB,IAA+B;IACtE,MAAMc,SAAS,GAAGR,IAAI,CAACS,GAAG,CAAC,CAAC;IAC5B,MAAMC,IAAI,GAAGV,IAAI,CAACW,QAAQ,CAAC,CAAC;IAE5B,MA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,GAAG3E,QAAQ,CAAC4E,IAAI,CACzB,MAAMzE,GAAG,CAACb,KAAK,CAAC,EAChB,MAAMa,GAAG,CAACb,KAAK,CAChB,CAAC;MACDU,QAAQ,GAAG2E,IAAI,CAACE,KAAK,CAAC,MAAM5B,SAAS,CAA6B;MAClE,OAAO0B,IAAI;IACZ;EACD,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Platform-ceiling truncation.
5
+ *
6
+ * iOS keeps only the 64 soonest pending notifications and silently discards the
7
+ * rest. The package computes the same cut deliberately, so the outcome is
8
+ * reported rather than discovered as missing notifications.
9
+ *
10
+ * Soonest-first is the only rule that degrades gracefully: dropped entries are
11
+ * not lost, they are simply not yet registered, and each window refresh
12
+ * registers those that have moved into range.
13
+ */
14
+
15
+ /**
16
+ * Keeps the `ceiling` soonest entries.
17
+ *
18
+ * Ties on the delivery instant are broken by identifier so the cut is
19
+ * deterministic — otherwise two runs over the same data could drop different
20
+ * entries and the idempotence guarantee would not hold.
21
+ */
22
+ export function truncateToCeiling(desired, resolvedAt, ceiling) {
23
+ if (desired.length <= ceiling) {
24
+ return {
25
+ kept: desired
26
+ };
27
+ }
28
+ const ordered = [...desired].sort((a, b) => {
29
+ const aAt = resolvedAt.get(a.id) ?? a.moment.at;
30
+ const bAt = resolvedAt.get(b.id) ?? b.moment.at;
31
+ if (aAt !== bAt) return aAt - bAt;
32
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
33
+ });
34
+ const kept = ordered.slice(0, ceiling);
35
+ const dropped = ordered.slice(ceiling);
36
+ return {
37
+ kept,
38
+ report: {
39
+ ceiling,
40
+ droppedCount: dropped.length,
41
+ droppedIds: dropped.map(entry => entry.id),
42
+ reEvaluatedOnNextRefresh: true
43
+ }
44
+ };
45
+ }
46
+ //# sourceMappingURL=truncate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["truncateToCeiling","desired","resolvedAt","ceiling","length","kept","ordered","sort","a","b","aAt","get","id","moment","at","bAt","slice","dropped","report","droppedCount","droppedIds","map","entry","reEvaluatedOnNextRefresh"],"sourceRoot":"../../../src","sources":["reconcile/truncate.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,iBAAiBA,CAChCC,OAAuC,EACvCC,UAAuC,EACvCC,OAAe,EACK;EACpB,IAAIF,OAAO,CAACG,MAAM,IAAID,OAAO,EAAE;IAC9B,OAAO;MAAEE,IAAI,EAAEJ;IAAQ,CAAC;EACzB;EAEA,MAAMK,OAAO,GAAG,CAAC,GAAGL,OAAO,CAAC,CAACM,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK;IAC3C,MAAMC,GAAG,GAAGR,UAAU,CAACS,GAAG,CAACH,CAAC,CAACI,EAAE,CAAC,IAAIJ,CAAC,CAACK,MAAM,CAACC,EAAE;IAC/C,MAAMC,GAAG,GAAGb,UAAU,CAACS,GAAG,CAACF,CAAC,CAACG,EAAE,CAAC,IAAIH,CAAC,CAACI,MAAM,CAACC,EAAE;IAC/C,IAAIJ,GAAG,KAAKK,GAAG,EAAE,OAAOL,GAAG,GAAGK,GAAG;IACjC,OAAOP,CAAC,CAACI,EAAE,GAAGH,CAAC,CAACG,EAAE,GAAG,CAAC,CAAC,GAAGJ,CAAC,CAACI,EAAE,GAAGH,CAAC,CAACG,EAAE,GAAG,CAAC,GAAG,CAAC;EAC9C,CAAC,CAAC;EAEF,MAAMP,IAAI,GAAGC,OAAO,CAACU,KAAK,CAAC,CAAC,EAAEb,OAAO,CAAC;EACtC,MAAMc,OAAO,GAAGX,OAAO,CAACU,KAAK,CAACb,OAAO,CAAC;EAEtC,OAAO;IACNE,IAAI;IACJa,MAAM,EAAE;MACPf,OAAO;MACPgB,YAAY,EAAEF,OAAO,CAACb,MAAM;MAC5BgB,UAAU,EAAEH,OAAO,CAACI,GAAG,CAACC,KAAK,IAAIA,KAAK,CAACV,EAAE,CAAC;MAC1CW,wBAAwB,EAAE;IAC3B;EACD,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Clock-discontinuity bounding.
5
+ *
6
+ * A device clock moved backwards makes past occurrences look future again. Left
7
+ * alone, the next expansion would re-register every occurrence the user already
8
+ * received, and moving the clock forward again would fire them all at once.
9
+ *
10
+ * The guard is deliberately blunt: occurrences at or before the last horizon the
11
+ * series already expanded through are never re-emitted. The package would
12
+ * rather lose an occurrence after a manual clock change than deliver a burst of
13
+ * notifications for events that already happened.
14
+ */
15
+
16
+ /** A jump larger than this is treated as a clock change rather than ordinary drift. */
17
+ export const CLOCK_DISCONTINUITY_THRESHOLD_MS = 60 * 60 * 1000;
18
+ /**
19
+ * Drops occurrences that a clock discontinuity would otherwise resurrect.
20
+ *
21
+ * Forward jumps are detected and reported but not filtered: an occurrence that
22
+ * became due because time genuinely passed is legitimate, and the platform's
23
+ * own delivery is the right place for it to be resolved.
24
+ */
25
+ export function guardAgainstClockChange(input) {
26
+ const {
27
+ occurrences,
28
+ previousHorizon,
29
+ now,
30
+ previousNow
31
+ } = input;
32
+ let discontinuity = 'none';
33
+ if (previousNow !== undefined) {
34
+ const delta = now - previousNow;
35
+ if (delta < -CLOCK_DISCONTINUITY_THRESHOLD_MS) {
36
+ discontinuity = 'backwards';
37
+ } else if (delta > CLOCK_DISCONTINUITY_THRESHOLD_MS * 24) {
38
+ discontinuity = 'forwards';
39
+ }
40
+ }
41
+ if (previousHorizon === undefined) {
42
+ return {
43
+ occurrences,
44
+ suppressed: 0,
45
+ discontinuity
46
+ };
47
+ }
48
+
49
+ // Anything at or before the previously-expanded horizon was already handled
50
+ // once. Re-emitting it would mean delivering a notification for an event the
51
+ // user has already seen.
52
+ const kept = occurrences.filter(occurrence => occurrence.at > previousHorizon || occurrence.at > now);
53
+ const alreadyHandled = occurrences.filter(occurrence => occurrence.at <= previousHorizon && occurrence.at <= now);
54
+ return {
55
+ occurrences: kept,
56
+ suppressed: alreadyHandled.length,
57
+ discontinuity
58
+ };
59
+ }
60
+ //# sourceMappingURL=clock-guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CLOCK_DISCONTINUITY_THRESHOLD_MS","guardAgainstClockChange","input","occurrences","previousHorizon","now","previousNow","discontinuity","undefined","delta","suppressed","kept","filter","occurrence","at","alreadyHandled","length"],"sourceRoot":"../../../src","sources":["recurrence/clock-guard.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA,OAAO,MAAMA,gCAAgC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;AAiB9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,uBAAuBA,CAACC,KAAsB,EAAoB;EACjF,MAAM;IAAEC,WAAW;IAAEC,eAAe;IAAEC,GAAG;IAAEC;EAAY,CAAC,GAAGJ,KAAK;EAEhE,IAAIK,aAAgD,GAAG,MAAM;EAC7D,IAAID,WAAW,KAAKE,SAAS,EAAE;IAC9B,MAAMC,KAAK,GAAGJ,GAAG,GAAGC,WAAW;IAC/B,IAAIG,KAAK,GAAG,CAACT,gCAAgC,EAAE;MAC9CO,aAAa,GAAG,WAAW;IAC5B,CAAC,MAAM,IAAIE,KAAK,GAAGT,gCAAgC,GAAG,EAAE,EAAE;MACzDO,aAAa,GAAG,UAAU;IAC3B;EACD;EAEA,IAAIH,eAAe,KAAKI,SAAS,EAAE;IAClC,OAAO;MAAEL,WAAW;MAAEO,UAAU,EAAE,CAAC;MAAEH;IAAc,CAAC;EACrD;;EAEA;EACA;EACA;EACA,MAAMI,IAAI,GAAGR,WAAW,CAACS,MAAM,CAC9BC,UAAU,IAAIA,UAAU,CAACC,EAAE,GAAGV,eAAe,IAAIS,UAAU,CAACC,EAAE,GAAGT,GAClE,CAAC;EACD,MAAMU,cAAc,GAAGZ,WAAW,CAACS,MAAM,CACxCC,UAAU,IAAIA,UAAU,CAACC,EAAE,IAAIV,eAAe,IAAIS,UAAU,CAACC,EAAE,IAAIT,GACpE,CAAC;EAED,OAAO;IACNF,WAAW,EAAEQ,IAAI;IACjBD,UAAU,EAAEK,cAAc,CAACC,MAAM;IACjCT;EACD,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,248 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Recurrence expansion.
5
+ *
6
+ * Written first-party rather than delegated to an RFC 5545 library, because the
7
+ * daylight-saving rules here are specified behaviour (FR-008) rather than a
8
+ * dependency's opinion, and because expansion must be provable with no device.
9
+ *
10
+ * Determinism is the hard requirement: the same rule, anchoring mode, zone, and
11
+ * evaluation moment must produce exactly the same occurrences in the same order
12
+ * on every run and on both platforms. Without that, reconciliation could not be
13
+ * idempotent over a recurring series.
14
+ */
15
+
16
+ import { DIAGNOSTIC_CODES, NotificationError } from "../contract/errors.js";
17
+ import { instantForParts, partsInZone } from "../schedule/anchor.js";
18
+ const pad = (value, width) => String(value).padStart(width, '0');
19
+
20
+ /**
21
+ * The calendar slot of an occurrence: the date and clock time the rule asked
22
+ * for, in the frame the series is anchored in. Fixed-width, so comparing two
23
+ * keys as strings compares them in time.
24
+ */
25
+ export function occurrenceKey(parts) {
26
+ return `${pad(parts.year, 4)}${pad(parts.month, 2)}${pad(parts.day, 2)}T${pad(parts.hour, 2)}${pad(parts.minute, 2)}`;
27
+ }
28
+
29
+ /**
30
+ * Occurrence identity.
31
+ *
32
+ * Derived from the series and the calendar slot, not the instant. Re-expanding
33
+ * the same series produces the same identifiers, which is what lets a refresh
34
+ * recognize an occurrence it already scheduled. Until 0.4.0 the instant was
35
+ * used, so after a time-zone change re-anchoring kept the old identifier while
36
+ * the window refresh derived a new one, and the occurrence was scheduled twice.
37
+ */
38
+ export function occurrenceId(seriesId, slot) {
39
+ return `${seriesId}#${typeof slot === 'string' ? slot : occurrenceKey(slot)}`;
40
+ }
41
+ const MS_PER_DAY = 24 * 60 * 60 * 1000;
42
+ function validatePattern(pattern) {
43
+ const {
44
+ hour,
45
+ minute
46
+ } = pattern;
47
+ if (!Number.isInteger(hour) || hour < 0 || hour > 23) {
48
+ throw new NotificationError(DIAGNOSTIC_CODES.INVALID_RECURRENCE, 'Recurrence hour must be an integer from 0 to 23.', {
49
+ hour
50
+ });
51
+ }
52
+ if (!Number.isInteger(minute) || minute < 0 || minute > 59) {
53
+ throw new NotificationError(DIAGNOSTIC_CODES.INVALID_RECURRENCE, 'Recurrence minute must be an integer from 0 to 59.', {
54
+ minute
55
+ });
56
+ }
57
+ const interval = pattern.interval ?? 1;
58
+ if (!Number.isInteger(interval) || interval < 1) {
59
+ throw new NotificationError(DIAGNOSTIC_CODES.INVALID_RECURRENCE, 'Recurrence interval must be a positive integer.', {
60
+ interval
61
+ });
62
+ }
63
+ if (pattern.kind === 'weekly') {
64
+ if (pattern.weekdays.length === 0) {
65
+ throw new NotificationError(DIAGNOSTIC_CODES.INVALID_RECURRENCE, 'A weekly recurrence must name at least one weekday.');
66
+ }
67
+ for (const day of pattern.weekdays) {
68
+ if (!Number.isInteger(day) || day < 0 || day > 6) {
69
+ throw new NotificationError(DIAGNOSTIC_CODES.INVALID_RECURRENCE, 'Weekdays must be integers from 0 (Sunday) to 6 (Saturday).', {
70
+ day
71
+ });
72
+ }
73
+ }
74
+ }
75
+ if (pattern.kind === 'monthlyByDay') {
76
+ if (!Number.isInteger(pattern.dayOfMonth) || pattern.dayOfMonth < 1 || pattern.dayOfMonth > 31) {
77
+ throw new NotificationError(DIAGNOSTIC_CODES.INVALID_RECURRENCE, 'Day of month must be an integer from 1 to 31.', {
78
+ dayOfMonth: pattern.dayOfMonth
79
+ });
80
+ }
81
+ }
82
+ }
83
+
84
+ /** Calendar date in the anchoring zone, carrying the pattern's clock time. */
85
+ function partsFor(date, pattern) {
86
+ return {
87
+ year: date.year,
88
+ month: date.month,
89
+ day: date.day,
90
+ hour: pattern.hour,
91
+ minute: pattern.minute,
92
+ second: 0
93
+ };
94
+ }
95
+ function addDays(parts, days) {
96
+ const shifted = new Date(Date.UTC(parts.year, parts.month - 1, parts.day) + days * MS_PER_DAY);
97
+ return {
98
+ year: shifted.getUTCFullYear(),
99
+ month: shifted.getUTCMonth() + 1,
100
+ day: shifted.getUTCDate(),
101
+ hour: parts.hour,
102
+ minute: parts.minute,
103
+ second: 0
104
+ };
105
+ }
106
+ function weekdayOf(parts) {
107
+ return new Date(Date.UTC(parts.year, parts.month - 1, parts.day)).getUTCDay();
108
+ }
109
+ function daysInMonth(year, month) {
110
+ return new Date(Date.UTC(year, month, 0)).getUTCDate();
111
+ }
112
+ /**
113
+ * Expands a rule inside the lookahead window.
114
+ *
115
+ * Bounded by both a duration and a count, because either alone fails: a
116
+ * duration alone lets a frequent series exhaust the platform ceiling, and a
117
+ * count alone leaves an annual series scheduled a decade out.
118
+ */
119
+ export function expand(input) {
120
+ const {
121
+ rule,
122
+ from,
123
+ lookahead,
124
+ timeZone
125
+ } = input;
126
+ validatePattern(rule.pattern);
127
+ const anchoring = rule.anchoring ?? 'wallClock';
128
+ const horizon = from + lookahead.days * MS_PER_DAY;
129
+ const start = Math.max(rule.startAt ?? from, from);
130
+ const {
131
+ lastEmittedKey
132
+ } = input;
133
+ const occurrences = [];
134
+ let cursor = partsFor(partsInZone(start, timeZone), rule.pattern);
135
+ // Position of the next not-yet-counted occurrence, for count-limited rules.
136
+ let index = input.alreadyEmitted ?? 0;
137
+ let exhausted = false;
138
+
139
+ // Bounded independently of the emit conditions so a pattern that matches
140
+ // nothing (e.g. day 31 in February) can never spin forever.
141
+ const maxIterations = lookahead.days * 2 + 400;
142
+ for (let iteration = 0; iteration < maxIterations; iteration += 1) {
143
+ if (occurrences.length >= lookahead.occurrencesPerSeries) break;
144
+ const candidate = nextCandidate(cursor, rule.pattern, iteration === 0);
145
+ if (candidate === undefined) break;
146
+ cursor = candidate;
147
+ const at = anchoring === 'absolute' ? Date.UTC(cursor.year, cursor.month - 1, cursor.day, cursor.hour, cursor.minute, 0) : instantForParts(cursor, timeZone);
148
+ if (at > horizon) break;
149
+ if (at > start) {
150
+ if (rule.end.kind === 'untilDate' && at > rule.end.until) {
151
+ exhausted = true;
152
+ break;
153
+ }
154
+ const key = occurrenceKey(cursor);
155
+ const previouslyEmitted = lastEmittedKey !== undefined && key <= lastEmittedKey;
156
+ if (!previouslyEmitted && rule.end.kind === 'count' && index >= rule.end.count) {
157
+ exhausted = true;
158
+ break;
159
+ }
160
+ occurrences.push({
161
+ id: occurrenceId(rule.id, key),
162
+ key,
163
+ seriesId: rule.id,
164
+ at,
165
+ anchoring,
166
+ previouslyEmitted
167
+ });
168
+ if (!previouslyEmitted) index += 1;
169
+ }
170
+ cursor = advance(cursor, rule.pattern);
171
+ }
172
+ return {
173
+ occurrences,
174
+ expandedThrough: horizon,
175
+ exhausted
176
+ };
177
+ }
178
+
179
+ /** Moves the cursor onto the first date the pattern actually matches. */
180
+ function nextCandidate(cursor, pattern, isFirst) {
181
+ if (pattern.kind === 'daily') return cursor;
182
+ if (pattern.kind === 'weekly') {
183
+ const wanted = new Set(pattern.weekdays);
184
+ let candidate = cursor;
185
+ for (let step = 0; step < 14; step += 1) {
186
+ if (wanted.has(weekdayOf(candidate))) return candidate;
187
+ candidate = addDays(candidate, 1);
188
+ }
189
+ return undefined;
190
+ }
191
+ const monthly = pattern;
192
+ let candidate = cursor;
193
+ // Months shorter than the requested day are skipped rather than clamped: a
194
+ // caller asking for the 31st means the 31st, and inventing the 28th would be
195
+ // the package deciding something it was not asked to decide.
196
+ for (let step = 0; step < 48; step += 1) {
197
+ if (daysInMonth(candidate.year, candidate.month) >= monthly.dayOfMonth) {
198
+ const onDay = {
199
+ ...candidate,
200
+ day: monthly.dayOfMonth
201
+ };
202
+ if (isFirst || onDay.day >= candidate.day || step > 0) return onDay;
203
+ }
204
+ candidate = firstOfNextMonth(candidate);
205
+ }
206
+ return undefined;
207
+ }
208
+ function firstOfNextMonth(parts) {
209
+ const month = parts.month === 12 ? 1 : parts.month + 1;
210
+ const year = parts.month === 12 ? parts.year + 1 : parts.year;
211
+ return {
212
+ ...parts,
213
+ year,
214
+ month,
215
+ day: 1
216
+ };
217
+ }
218
+
219
+ /** Steps the cursor past the occurrence just produced. */
220
+ function advance(cursor, pattern) {
221
+ const interval = pattern.interval ?? 1;
222
+ if (pattern.kind === 'daily') {
223
+ return addDays(cursor, pattern.interval ?? 1);
224
+ }
225
+ if (pattern.kind === 'weekly') {
226
+ const wanted = [...new Set(pattern.weekdays)].sort((a, b) => a - b);
227
+ const current = weekdayOf(cursor);
228
+ const next = wanted.find(day => day > current);
229
+
230
+ // Wrapping into a new week is where the interval applies — stepping day by
231
+ // day within the week would multiply the interval by the weekday count.
232
+ return next === undefined ? addDays(cursor, 7 * interval - current + wanted[0]) : addDays(cursor, next - current);
233
+ }
234
+ const monthly = pattern;
235
+ let year = cursor.year;
236
+ let month = cursor.month + interval;
237
+ while (month > 12) {
238
+ month -= 12;
239
+ year += 1;
240
+ }
241
+ return {
242
+ ...cursor,
243
+ year,
244
+ month,
245
+ day: Math.min(monthly.dayOfMonth, daysInMonth(year, month))
246
+ };
247
+ }
248
+ //# sourceMappingURL=expand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DIAGNOSTIC_CODES","NotificationError","instantForParts","partsInZone","pad","value","width","String","padStart","occurrenceKey","parts","year","month","day","hour","minute","occurrenceId","seriesId","slot","MS_PER_DAY","validatePattern","pattern","Number","isInteger","INVALID_RECURRENCE","interval","kind","weekdays","length","dayOfMonth","partsFor","date","second","addDays","days","shifted","Date","UTC","getUTCFullYear","getUTCMonth","getUTCDate","weekdayOf","getUTCDay","daysInMonth","expand","input","rule","from","lookahead","timeZone","anchoring","horizon","start","Math","max","startAt","lastEmittedKey","occurrences","cursor","index","alreadyEmitted","exhausted","maxIterations","iteration","occurrencesPerSeries","candidate","nextCandidate","undefined","at","end","until","key","previouslyEmitted","count","push","id","advance","expandedThrough","isFirst","wanted","Set","step","has","monthly","onDay","firstOfNextMonth","sort","a","b","current","next","find","min"],"sourceRoot":"../../../src","sources":["recurrence/expand.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,SAASA,gBAAgB,EAAEC,iBAAiB,QAAQ,uBAAoB;AACxE,SAASC,eAAe,EAAEC,WAAW,QAA6B,uBAAoB;AActF,MAAMC,GAAG,GAAGA,CAACC,KAAa,EAAEC,KAAa,KAAKC,MAAM,CAACF,KAAK,CAAC,CAACG,QAAQ,CAACF,KAAK,EAAE,GAAG,CAAC;;AAEhF;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,aAAaA,CAACC,KAAqB,EAAU;EAC5D,OAAO,GAAGN,GAAG,CAACM,KAAK,CAACC,IAAI,EAAE,CAAC,CAAC,GAAGP,GAAG,CAACM,KAAK,CAACE,KAAK,EAAE,CAAC,CAAC,GAAGR,GAAG,CAACM,KAAK,CAACG,GAAG,EAAE,CAAC,CAAC,IAAIT,GAAG,CAACM,KAAK,CAACI,IAAI,EAAE,CAAC,CAAC,GAAGV,GAAG,CAACM,KAAK,CAACK,MAAM,EAAE,CAAC,CAAC,EAAE;AACtH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,QAAgB,EAAEC,IAA6B,EAAU;EACrF,OAAO,GAAGD,QAAQ,IAAI,OAAOC,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAGT,aAAa,CAACS,IAAI,CAAC,EAAE;AAC9E;AAEA,MAAMC,UAAU,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;AAEtC,SAASC,eAAeA,CAACC,OAA0B,EAAQ;EAC1D,MAAM;IAAEP,IAAI;IAAEC;EAAO,CAAC,GAAGM,OAAO;EAEhC,IAAI,CAACC,MAAM,CAACC,SAAS,CAACT,IAAI,CAAC,IAAIA,IAAI,GAAG,CAAC,IAAIA,IAAI,GAAG,EAAE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