@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,70 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.VERIFY_ORDER = void 0;
7
+ exports.createVerifyStep = createVerifyStep;
8
+ var _errors = require("../contract/errors.js");
9
+ /**
10
+ * Pending-set verification.
11
+ *
12
+ * Engine boot restoration coverage varies by manufacturer, so after a restart
13
+ * the device may hold fewer notifications than the package expects. This step
14
+ * notices that.
15
+ *
16
+ * It **detects and reports only**. It never re-registers, cancels, or repairs
17
+ * anything — the package deliberately does not persist a desired set, so it
18
+ * cannot tell a restoration gap from an intentional consumer change. Guessing
19
+ * would mean either resurrecting notifications the user cancelled or deleting
20
+ * ones they still want. Repair is consumer-invoked reconciliation.
21
+ *
22
+ * Runs at order 20, after re-anchoring (order 10): re-anchoring rewrites firing
23
+ * instants, and verifying first would compare against instants that are about
24
+ * to change.
25
+ */
26
+
27
+ const VERIFY_ORDER = exports.VERIFY_ORDER = 20;
28
+ function createVerifyStep(deps) {
29
+ return {
30
+ name: 'verify',
31
+ order: VERIFY_ORDER,
32
+ async run(context) {
33
+ const expected = deps.expectedIds();
34
+
35
+ // No recorded expectation is not the same as expecting an empty device.
36
+ // Reporting every pending entry as "unrecognized" on a fresh install
37
+ // would be noise, not a finding.
38
+ if (expected === undefined) {
39
+ return {
40
+ operationCount: 0
41
+ };
42
+ }
43
+ const pending = await deps.engine.getPending();
44
+ const actual = new Set(pending.map(entry => entry.id));
45
+ const missing = [...expected].filter(id => !actual.has(id)).sort();
46
+ const unrecognized = [...actual].filter(id => !expected.has(id)).sort();
47
+ if (missing.length === 0 && unrecognized.length === 0) {
48
+ return {
49
+ operationCount: 0
50
+ };
51
+ }
52
+ const discrepancy = {
53
+ missing,
54
+ unrecognized,
55
+ detectedAt: context.now
56
+ };
57
+ deps.emit?.(_errors.DIAGNOSTIC_CODES.PENDING_SET_DISCREPANCY, `Pending set differs from expectation: ${missing.length} expected but absent, ${unrecognized.length} present but unrecognized. ` + 'Reported only — run reconciliation to repair, since the package cannot distinguish a restoration gap from an intentional change.', {
58
+ missing: missing.length,
59
+ unrecognized: unrecognized.length
60
+ });
61
+ return {
62
+ operationCount: 0,
63
+ discrepancy,
64
+ // Verification repairs nothing, so it cancels nothing.
65
+ cancelledIds: []
66
+ };
67
+ }
68
+ };
69
+ }
70
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_errors","require","VERIFY_ORDER","exports","createVerifyStep","deps","name","order","run","context","expected","expectedIds","undefined","operationCount","pending","engine","getPending","actual","Set","map","entry","id","missing","filter","has","sort","unrecognized","length","discrepancy","detectedAt","now","emit","DIAGNOSTIC_CODES","PENDING_SET_DISCREPANCY","cancelledIds"],"sourceRoot":"../../../src","sources":["maintenance/verify.ts"],"mappings":";;;;;;;AAqBA,IAAAA,OAAA,GAAAC,OAAA;AArBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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C,MAAM,6BAA6B,GAC/H,kIAAkI,EACnI;QAAEL,OAAO,EAAEA,OAAO,CAACK,MAAM;QAAED,YAAY,EAAEA,YAAY,CAACC;MAAO,CAC9D,CAAC;MAED,OAAO;QACNd,cAAc,EAAE,CAAC;QACjBe,WAAW;QACX;QACAM,YAAY,EAAE;MACf,CAAC;IACF;EACD,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WINDOW_REFRESH_ORDER = void 0;
7
+ exports.createWindowRefreshStep = createWindowRefreshStep;
8
+ /**
9
+ * The window-refresh maintenance step.
10
+ *
11
+ * Runs at order 15 — after re-anchoring (10) so it expands against corrected
12
+ * instants, before verification (20) so verification sees the refreshed set
13
+ * rather than reporting occurrences the refresh was about to add.
14
+ *
15
+ * This step is the reason automatic maintenance exists at all: only the package
16
+ * knows when a series' horizon has moved, and it can act on that without ever
17
+ * needing a desired set from the consumer.
18
+ */
19
+
20
+ const WINDOW_REFRESH_ORDER = exports.WINDOW_REFRESH_ORDER = 15;
21
+ function createWindowRefreshStep(deps) {
22
+ return {
23
+ name: 'window-refresh',
24
+ order: WINDOW_REFRESH_ORDER,
25
+ async run(_context) {
26
+ const rules = deps.registeredRules();
27
+ if (rules.length === 0) {
28
+ return {
29
+ operationCount: 0,
30
+ windowRefreshed: false
31
+ };
32
+ }
33
+ let scheduled = 0;
34
+ const cancelled = [];
35
+ for (const rule of rules) {
36
+ const result = await deps.recurrence.refreshSeries(rule);
37
+ scheduled += result.scheduled;
38
+ cancelled.push(...(result.cancelled ?? []));
39
+ }
40
+ return {
41
+ operationCount: scheduled + cancelled.length,
42
+ occurrencesScheduled: scheduled,
43
+ // A refresh that found nothing to add still ran; reporting it as
44
+ // refreshed distinguishes "nothing due" from "step never executed".
45
+ windowRefreshed: true,
46
+ // Only stale occurrences of series the package owns; reported so the
47
+ // registry's scope guard checks them rather than taking it on trust.
48
+ cancelledIds: cancelled
49
+ };
50
+ }
51
+ };
52
+ }
53
+ //# sourceMappingURL=window-refresh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["WINDOW_REFRESH_ORDER","exports","createWindowRefreshStep","deps","name","order","run","_context","rules","registeredRules","length","operationCount","windowRefreshed","scheduled","cancelled","rule","result","recurrence","refreshSeries","push","occurrencesScheduled","cancelledIds"],"sourceRoot":"../../../src","sources":["maintenance/window-refresh.ts"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMO,MAAMA,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,EAAE;AAe/B,SAASE,uBAAuBA,CAACC,IAA+B,EAAmB;EACzF,OAAO;IACNC,IAAI,EAAE,gBAAgB;IACtBC,KAAK,EAAEL,oBAAoB;IAE3B,MAAMM,GAAGA,CAACC,QAA4B,EAAwB;MAC7D,MAAMC,KAAK,GAAGL,IAAI,CAACM,eAAe,CAAC,CAAC;MACpC,IAAID,KAAK,CAACE,MAAM,KAAK,CAAC,EAAE;QACvB,OAAO;UAAEC,cAAc,EAAE,CAAC;UAAEC,eAAe,EAAE;QAAM,CAAC;MACrD;MAEA,IAAIC,SAAS,GAAG,CAAC;MACjB,MAAMC,SAAmB,GAAG,EAAE;MAE9B,KAAK,MAAMC,IAAI,IAAIP,KAAK,EAAE;QACzB,MAAMQ,MAAM,GAAG,MAAMb,IAAI,CAACc,UAAU,CAACC,aAAa,CAACH,IAAI,CAAC;QACxDF,SAAS,IAAIG,MAAM,CAACH,SAAS;QAC7BC,SAAS,CAACK,IAAI,CAAC,IAAIH,MAAM,CAACF,SAAS,IAAI,EAAE,CAAC,CAAC;MAC5C;MAEA,OAAO;QACNH,cAAc,EAAEE,SAAS,GAAGC,SAAS,CAACJ,MAAM;QAC5CU,oBAAoB,EAAEP,SAAS;QAC/B;QACA;QACAD,eAAe,EAAE,IAAI;QACrB;QACA;QACAS,YAAY,EAAEP;MACf,CAAC;IACF;EACD,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createNotifications = createNotifications;
7
+ var _toneMap = require("./channel/tone-map.js");
8
+ var _snapshot = require("./diagnostics/snapshot.js");
9
+ var _notifyKitEngine = require("./engine/notify-kit-engine.js");
10
+ var _index = require("./engine/notify-kit/platform/index.js");
11
+ var _initialize = require("./initialize.js");
12
+ var _index2 = require("./interaction/index.js");
13
+ var _permissionRefresh = require("./maintenance/permission-refresh.js");
14
+ var _reanchor = require("./maintenance/reanchor.js");
15
+ var _windowRefresh = require("./maintenance/window-refresh.js");
16
+ var _index3 = require("./permission/index.js");
17
+ var _index4 = require("./reconcile/index.js");
18
+ var _index5 = require("./recurrence/index.js");
19
+ var _index6 = require("./schedule/index.js");
20
+ var _anchor = require("./schedule/anchor.js");
21
+ var _mmkvStore = require("./state/mmkv-store.js");
22
+ /**
23
+ * One call that assembles the whole package (NOT-07).
24
+ *
25
+ * Until 0.5.0 an app wired a dozen factories itself — scheduler, reconciler,
26
+ * recurrence, permissions, channels, interactions, snapshot, maintenance steps
27
+ * — repeating the engine, tone resolver, clock and time-zone reader for each,
28
+ * and usually hard-coding `canScheduleExactly: () => true`. `createNotifications`
29
+ * does that wiring once, the way the package means it:
30
+ *
31
+ * - every part reports through the one redacting diagnostic emitter;
32
+ * - `canScheduleExactly` follows the exact-alarm permission the package last
33
+ * read, instead of a guess;
34
+ * - automatic maintenance has the standard steps registered (re-anchoring after
35
+ * a time-zone change, refreshing permissions, and refreshing recurrence
36
+ * windows when the app supplies its rules), so it does something on every
37
+ * return to the foreground.
38
+ *
39
+ * The individual factories stay exported for an app that needs a different
40
+ * wiring; they are also available from `@chipmobilesdk/rn-notification/advanced`.
41
+ */
42
+
43
+ /** Exact scheduling only on a positive answer; unknown degrades to approximate, never fails. */
44
+ function allowsExact(state) {
45
+ return state === 'granted' || state === 'notRequired';
46
+ }
47
+ async function createNotifications(config, deps = {}) {
48
+ const engine = deps.engine ?? (0, _notifyKitEngine.createNotifyKitEngine)();
49
+ const now = deps.now ?? (() => Date.now());
50
+ const timeZone = deps.timeZone ?? (0, _anchor.createPlatformTimeZoneReader)();
51
+ const {
52
+ runtime,
53
+ result
54
+ } = await (0, _initialize.initialize)(config, {
55
+ engine,
56
+ store: deps.store ?? (0, _mmkvStore.createMmkvStore)(),
57
+ now,
58
+ timeZone
59
+ });
60
+ const {
61
+ state
62
+ } = runtime;
63
+ const emit = (code, message, context) => runtime.emitter.emit(code, message, context);
64
+ const resolveTone = (0, _toneMap.createToneResolver)(config.tones);
65
+ const permissions = (0, _index3.createPermissions)({
66
+ engine,
67
+ state,
68
+ platform: deps.platform ?? (0, _index.detectPlatform)(),
69
+ now,
70
+ emit
71
+ });
72
+ let exactAlarm;
73
+ const stopWatchingPermissions = permissions.onPermissionChange(report => {
74
+ exactAlarm = report.exactAlarm;
75
+ });
76
+ // Seeds the answer before anything is scheduled. A failed read leaves it
77
+ // unknown, which schedules in approximate mode rather than failing.
78
+ await permissions.getPermissions().catch(() => undefined);
79
+ const canScheduleExactly = () => allowsExact(exactAlarm);
80
+ const scheduling = {
81
+ engine,
82
+ resolveTone,
83
+ timeZone,
84
+ now,
85
+ canScheduleExactly,
86
+ emit
87
+ };
88
+ const scheduler = (0, _index6.createScheduler)(scheduling);
89
+ const reconcilerCore = (0, _index4.createReconciler)(scheduling);
90
+ let lastReconcile;
91
+ const reconciler = {
92
+ ...reconcilerCore,
93
+ async reconcile(input) {
94
+ lastReconcile = await reconcilerCore.reconcile(input);
95
+ return lastReconcile;
96
+ }
97
+ };
98
+ const recurrence = (0, _index5.createRecurrence)({
99
+ ...scheduling,
100
+ state,
101
+ lookahead: runtime.lookahead
102
+ });
103
+ const interactions = (0, _index2.createInteractions)({
104
+ engine,
105
+ state,
106
+ now,
107
+ emit
108
+ });
109
+ let lastExplicit;
110
+ const snapshot = (0, _snapshot.createSnapshot)({
111
+ engine,
112
+ state,
113
+ now,
114
+ permissions: () => permissions.getPermissions(),
115
+ restrictions: () => permissions.getBackgroundRestrictions(),
116
+ appliedTones: () => runtime.channels.appliedVersions(),
117
+ lastReconcile: () => lastReconcile,
118
+ lastMaintenance: () => runtime.lastAutomaticMaintenance() ?? lastExplicit,
119
+ hasPushToken: deps.hasPushToken ?? (() => false)
120
+ });
121
+ const unregister = [runtime.registry.register((0, _reanchor.createReAnchorStep)({
122
+ engine,
123
+ timeZone,
124
+ resolveTone,
125
+ canScheduleExactly,
126
+ emit
127
+ })), runtime.registry.register((0, _permissionRefresh.createPermissionRefreshStep)({
128
+ permissions
129
+ })), ...(deps.recurrenceRules ? [runtime.registry.register((0, _windowRefresh.createWindowRefreshStep)({
130
+ recurrence,
131
+ registeredRules: deps.recurrenceRules,
132
+ emit
133
+ }))] : [])];
134
+ return {
135
+ scheduler,
136
+ reconciler,
137
+ recurrence,
138
+ permissions,
139
+ channels: runtime.channels,
140
+ interactions,
141
+ snapshot,
142
+ runtime,
143
+ initialization: result,
144
+ timeZone,
145
+ onInteraction: handler => interactions.onInteraction(handler),
146
+ async runMaintenance() {
147
+ lastExplicit = await runtime.maintenance.runExplicit();
148
+ return lastExplicit;
149
+ },
150
+ canScheduleExactly,
151
+ dispose() {
152
+ stopWatchingPermissions();
153
+ for (const remove of unregister) {
154
+ remove();
155
+ }
156
+ interactions.dispose();
157
+ runtime.dispose();
158
+ }
159
+ };
160
+ }
161
+ //# sourceMappingURL=notifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_toneMap","require","_snapshot","_notifyKitEngine","_index","_initialize","_index2","_permissionRefresh","_reanchor","_windowRefresh","_index3","_index4","_index5","_index6","_anchor","_mmkvStore","allowsExact","state","createNotifications","config","deps","engine","createNotifyKitEngine","now","Date","timeZone","createPlatformTimeZoneReader","runtime","result","initialize","store","createMmkvStore","emit","code","message","context","emitter","resolveTone","createToneResolver","tones","permissions","createPermissions","platform","detectPlatform","exactAlarm","stopWatchingPermissions","onPermissionChange","report","getPermissions","catch","undefined","canScheduleExactly","scheduling","scheduler","createScheduler","reconcilerCore","createReconciler","lastReconcile","reconciler","reconcile","input","recurrence","createRecurrence","lookahead","interactions","createInteractions","lastExplicit","snapshot","createSnapshot","restrictions","getBackgroundRestrictions","appliedTones","channels","appliedVersions","lastMaintenance","lastAutomaticMaintenance","hasPushToken","unregister","registry","register","createReAnchorStep","createPermissionRefreshStep","recurrenceRules","createWindowRefreshStep","registeredRules","initialization","onInteraction","handler","runMaintenance","maintenance","runExplicit","dispose","remove"],"sourceRoot":"../../src","sources":["notifications.ts"],"mappings":";;;;;;AAqBA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAEA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AACA,IAAAc,UAAA,GAAAd,OAAA;AA1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqEA;AACA,SAASe,WAAWA,CAACC,KAAkC,EAAW;EACjE,OAAOA,KAAK,KAAK,SAAS,IAAIA,KAAK,KAAK,aAAa;AACtD;AAEO,eAAeC,mBAAmBA,CACxCC,MAA0B,EAC1BC,IAA+B,GAAG,CAAC,CAAC,EACX;EACzB,MAAMC,MAAM,GAAGD,IAAI,CAACC,MAAM,IAAI,IAAAC,sC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AAC,4BAAkB,EAAC;IAAE3D,MAAM;IAAEI,QAAQ;IAAEY,WAAW;IAAEc,kBAAkB;IAAEnB;EAAK,CAAC,CAC/E,CAAC,EACDL,OAAO,CAACmD,QAAQ,CAACC,QAAQ,CAAC,IAAAE,8CAA2B,EAAC;IAAEzC;EAAY,CAAC,CAAC,CAAC,EACvE,IAAIpB,IAAI,CAAC8D,eAAe,GACrB,CACAvD,OAAO,CAACmD,QAAQ,CAACC,QAAQ,CACxB,IAAAI,sCAAuB,EAAC;IAAEtB,UAAU;IAAEuB,eAAe,EAAEhE,IAAI,CAAC8D,eAAe;IAAElD;EAAK,CAAC,CACpF,CAAC,CACD,GACA,EAAE,CAAC,CACN;EAED,OAAO;IACNqB,SAAS;IACTK,UAAU;IACVG,UAAU;IACVrB,WAAW;IACXgC,QAAQ,EAAE7C,OAAO,CAAC6C,QAAQ;IAC1BR,YAAY;IACZG,QAAQ;IACRxC,OAAO;IACP0D,cAAc,EAAEzD,MAAM;IACtBH,QAAQ;IACR6D,aAAa,EAAEC,OAAO,IAAIvB,YAAY,CAACsB,aAAa,CAACC,OAAO,CAAC;IAC7D,MAAMC,cAAcA,CAAA,EAAG;MACtBtB,YAAY,GAAG,MAAMvC,OAAO,CAAC8D,WAAW,CAACC,WAAW,CAAC,CAAC;MACtD,OAAOxB,YAAY;IACpB,CAAC;IACDf,kBAAkB;IAClBwC,OAAOA,CAAA,EAAG;MACT9C,uBAAuB,CAAC,CAAC;MACzB,KAAK,MAAM+C,MAAM,IAAIf,UAAU,EAAE;QAChCe,MAAM,CAAC,CAAC;MACT;MACA5B,YAAY,CAAC2B,OAAO,CAAC,CAAC;MACtBhE,OAAO,CAACgE,OAAO,CAAC,CAAC;IAClB;EACD,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createPermissions = createPermissions;
7
+ var _errors = require("../contract/errors.js");
8
+ var _state = require("./state.js");
9
+ var _rnCore = require("@chipmobilesdk/rn-core");
10
+ var _permissionHistory = require("../state/permission-history.js");
11
+ /**
12
+ * Permission coordination.
13
+ *
14
+ * Two rules shape everything here. Reading state never prompts, so the consumer
15
+ * decides when the user is asked — a prompt at the wrong moment is a permanent
16
+ * denial. And a refusal never fails the caller's business operation: the user's
17
+ * actual work completes, and the lost capability is reported separately.
18
+ */
19
+
20
+ /**
21
+ * Refusals after which the system stops showing its prompt (NOT-12). Android 13+
22
+ * allows a second ask; iOS allows one.
23
+ */
24
+ function denialLimit(platform) {
25
+ return platform.os === 'android' ? 2 : 1;
26
+ }
27
+ function createPermissions(deps) {
28
+ const emit = deps.emit ?? (() => {});
29
+ let listeners = [];
30
+ let lastReport;
31
+
32
+ /**
33
+ * The engine's answer plus what only the package remembers. The platform
34
+ * reports a refusal as `denied` however often it happened; once the user has
35
+ * refused as many times as the system will ask, another request shows nothing,
36
+ * so the state is `permanentlyDenied` and the app should offer Settings.
37
+ */
38
+ const derive = (kind, raw) => {
39
+ const state = (0, _state.normalizeState)(kind, raw, deps.platform);
40
+ if (kind !== 'display') return state;
41
+ if (state === 'granted' || state === 'provisional') {
42
+ (0, _permissionHistory.clearDenials)(deps.state, kind);
43
+ return state;
44
+ }
45
+ return state === 'denied' && (0, _permissionHistory.denialCount)(deps.state, kind) >= denialLimit(deps.platform) ? 'permanentlyDenied' : state;
46
+ };
47
+ const read = async () => {
48
+ // Never prompts. This is what lets a consumer decide the moment to ask.
49
+ const [display, exactAlarm] = await Promise.all([deps.engine.getPermission('display'), deps.engine.getPermission('exactAlarm')]);
50
+ return {
51
+ display: derive('display', display),
52
+ exactAlarm: derive('exactAlarm', exactAlarm),
53
+ readAt: deps.now()
54
+ };
55
+ };
56
+ const whenForeground = deps.onForeground ?? (listener => (0, _rnCore.onForeground)(listener));
57
+ let stopAwaitingSettings;
58
+ /**
59
+ * Exact alarms are granted on a system settings screen, so the answer read
60
+ * straight after opening it is always the old one. The real answer is read
61
+ * when the user comes back, and listeners hear it then (NOT-12).
62
+ */
63
+ const rereadOnReturn = () => {
64
+ stopAwaitingSettings?.();
65
+ stopAwaitingSettings = whenForeground(() => {
66
+ stopAwaitingSettings?.();
67
+ stopAwaitingSettings = undefined;
68
+ read().then(notifyIfChanged, () => undefined);
69
+ });
70
+ };
71
+ const notifyIfChanged = report => {
72
+ const changed = lastReport === undefined || lastReport.display !== report.display || lastReport.exactAlarm !== report.exactAlarm;
73
+ lastReport = report;
74
+ if (!changed) return false;
75
+ for (const listener of listeners) {
76
+ try {
77
+ listener(report);
78
+ } catch {
79
+ // A consumer's handler must never break permission reading.
80
+ }
81
+ }
82
+ return true;
83
+ };
84
+ const request = async (kind, ownerTag) => {
85
+ const capability = (0, _state.capabilityFor)(kind, deps.platform);
86
+
87
+ // Requesting something the platform version does not have is a no-op that
88
+ // shows no dialog, rather than a refusal.
89
+ if (!capability.supported) {
90
+ return 'notRequired';
91
+ }
92
+ (0, _permissionHistory.recordRequested)(deps.state, kind, deps.now(), ownerTag);
93
+ const raw = await deps.engine.requestPermission(kind);
94
+ if (kind === 'display' && (0, _state.normalizeState)(kind, raw, deps.platform) === 'denied') {
95
+ (0, _permissionHistory.recordDenial)(deps.state, kind, deps.now());
96
+ }
97
+ const result = derive(kind, raw);
98
+ if (capability.settingsOnly && result !== 'granted') {
99
+ rereadOnReturn();
100
+ }
101
+ if (result === 'denied' || result === 'permanentlyDenied') {
102
+ emit(kind === 'display' ? result === 'permanentlyDenied' ? _errors.DIAGNOSTIC_CODES.DISPLAY_PERMISSION_PERMANENT : _errors.DIAGNOSTIC_CODES.DISPLAY_PERMISSION_DENIED : _errors.DIAGNOSTIC_CODES.EXACT_ALARM_UNAVAILABLE, kind === 'display' ? "Display permission was refused. The caller's operation still succeeded; notifications will not be shown until this is granted." : 'Exact-alarm capability is unavailable. Notifications are still scheduled, in approximate mode, and may be delivered late.', {
103
+ kind,
104
+ state: result
105
+ });
106
+ }
107
+ notifyIfChanged(await read());
108
+ return result;
109
+ };
110
+ return {
111
+ /** Reads every permission state without triggering any dialog. */
112
+ async getPermissions() {
113
+ const report = await read();
114
+ notifyIfChanged(report);
115
+ return report;
116
+ },
117
+ /** Requested independently — an app may need one and not the other. */
118
+ requestDisplayPermission(ownerTag) {
119
+ return request('display', ownerTag);
120
+ },
121
+ requestExactAlarmPermission(ownerTag) {
122
+ return request('exactAlarm', ownerTag);
123
+ },
124
+ /** Whether the package has ever asked — the platform cannot answer this. */
125
+ hasEverRequested(kind, ownerTag) {
126
+ return (0, _permissionHistory.hasRequested)(deps.state, kind, ownerTag);
127
+ },
128
+ /**
129
+ * Opens the settings screen for one specific permission.
130
+ *
131
+ * Telling a user to "find it in settings" is how you lose them, so a
132
+ * platform with no reachable screen is an error rather than a silent no-op.
133
+ */
134
+ async openSettings(kind) {
135
+ if (!(0, _state.capabilityFor)(kind, deps.platform).supported) {
136
+ throw new _errors.NotificationError(_errors.DIAGNOSTIC_CODES.SETTINGS_UNAVAILABLE, `No settings screen exists for ${kind} on this platform version.`, {
137
+ kind,
138
+ os: deps.platform.os,
139
+ apiLevel: deps.platform.apiLevel
140
+ });
141
+ }
142
+ await deps.engine.openSettings(kind);
143
+ },
144
+ onPermissionChange(handler) {
145
+ listeners.push(handler);
146
+ return () => {
147
+ listeners = listeners.filter(l => l !== handler);
148
+ };
149
+ },
150
+ /**
151
+ * Manufacturer background restrictions, reported for information only.
152
+ *
153
+ * `unknown` is a first-class answer: some vendors stop apps in ways with no
154
+ * detection API, and guessing would be worse than admitting it. The package
155
+ * changes none of these settings on the user's behalf.
156
+ */
157
+ async getBackgroundRestrictions() {
158
+ const report = await deps.engine.getRestrictions();
159
+ if (report.batteryOptimization === 'restricted' || report.autoStart === 'restricted') {
160
+ emit(_errors.DIAGNOSTIC_CODES.BACKGROUND_RESTRICTED, 'The device applies a manufacturer background restriction. Notifications may be delayed or suppressed.', {
161
+ battery: report.batteryOptimization,
162
+ autoStart: report.autoStart
163
+ });
164
+ } else if (report.batteryOptimization === 'unknown' || report.autoStart === 'unknown') {
165
+ emit(_errors.DIAGNOSTIC_CODES.BACKGROUND_RESTRICTION_UNKNOWN, 'Manufacturer background restriction could not be determined on this device. Reported as unknown rather than guessed.', {
166
+ battery: report.batteryOptimization,
167
+ autoStart: report.autoStart
168
+ });
169
+ }
170
+ return report;
171
+ },
172
+ /** Called by the permission-refresh maintenance step. */
173
+ async refresh() {
174
+ const report = await read();
175
+ return {
176
+ report,
177
+ changed: notifyIfChanged(report)
178
+ };
179
+ }
180
+ };
181
+ }
182
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_errors","require","_state","_rnCore","_permissionHistory","denialLimit","platform","os","createPermissions","deps","emit","listeners","lastReport","derive","kind","raw","state","normalizeState","clearDenials","denialCount","read","display","exactAlarm","Promise","all","engine","getPermission","readAt","now","whenForeground","onForeground","listener","onAppForeground","stopAwaitingSettings","rereadOnReturn","undefined","then","notifyIfChanged","report","changed","request","ownerTag","capability","capabilityFor","supported","recordRequested","requestPermission","recordDenial","result","settingsOnly","DIAGNOSTIC_CODES","DISPLAY_PERMISSION_PERMANENT","DISPLAY_PERMISSION_DENIED","EXACT_ALARM_UNAVAILABLE","getPermissions","requestDisplayPermission","requestExactAlarmPermission","hasEverRequested","hasRequested","openSettings","NotificationError","SETTINGS_UNAVAILABLE","apiLevel","onPermissionChange","handler","push","filter","l","getBackgroundRestrictions","getRestrictions","batteryOptimization","autoStart","BACKGROUND_RESTRICTED","battery","BACKGROUND_RESTRICTION_UNKNOWN","refresh"],"sourceRoot":"../../../src","sources":["permission/index.ts"],"mappings":";;;;;;AAiBA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA;AArBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmCA;AACA;AACA;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AAgB,CAACsB,qBAAqB,EACtC,uGAAuG,EACvG;UAAEC,OAAO,EAAEnC,MAAM,CAACgC,mBAAmB;UAAEC,SAAS,EAAEjC,MAAM,CAACiC;QAAU,CACpE,CAAC;MACF,CAAC,MAAM,IAAIjC,MAAM,CAACgC,mBAAmB,KAAK,SAAS,IAAIhC,MAAM,CAACiC,SAAS,KAAK,SAAS,EAAE;QACtF7D,IAAI,CACHwC,wBAAgB,CAACwB,8BAA8B,EAC/C,sHAAsH,EACtH;UAAED,OAAO,EAAEnC,MAAM,CAACgC,mBAAmB;UAAEC,SAAS,EAAEjC,MAAM,CAACiC;QAAU,CACpE,CAAC;MACF;MAEA,OAAOjC,MAAM;IACd,CAAC;IAED;IACA,MAAMqC,OAAOA,CAAA,EAA8E;MAC1F,MAAMrC,MAAM,GAAG,MAAMlB,IAAI,CAAC,CAAC;MAC3B,OAAO;QAAEkB,MAAM;QAAEC,OAAO,EAAEF,eAAe,CAACC,MAAM;MAAE,CAAC;IACpD;EACD,CAAC;AACF","ignoreList":[]}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ANDROID_EXACT_ALARM_API = exports.ANDROID_DISPLAY_PERMISSION_API = void 0;
7
+ exports.canDisplay = canDisplay;
8
+ exports.capabilityFor = capabilityFor;
9
+ exports.isTerminal = isTerminal;
10
+ exports.normalizeState = normalizeState;
11
+ exports.shouldOfferSettings = shouldOfferSettings;
12
+ /**
13
+ * The permission state model.
14
+ *
15
+ * Six states, never collapsed. The two that matter most are the ones a naive
16
+ * model loses: `notAsked` must stay distinguishable from `denied`, or reading
17
+ * state without prompting buys nothing; and `notRequired` must never be
18
+ * reported as `denied`, because a platform version with no such concept never
19
+ * refused anything.
20
+ */
21
+
22
+ /** Android runtime notification permission arrived in API 33. */
23
+ const ANDROID_DISPLAY_PERMISSION_API = exports.ANDROID_DISPLAY_PERMISSION_API = 33;
24
+ /** Android exact-alarm permission arrived in API 31. */
25
+ const ANDROID_EXACT_ALARM_API = exports.ANDROID_EXACT_ALARM_API = 31;
26
+ /**
27
+ * Whether a permission concept exists at all on this platform version.
28
+ *
29
+ * Returning `supported: false` is what lets `notRequired` be reported honestly
30
+ * rather than inventing a refusal.
31
+ */
32
+ function capabilityFor(kind, platform) {
33
+ if (kind === 'display') {
34
+ if (platform.os === 'android' && (platform.apiLevel ?? 0) < ANDROID_DISPLAY_PERMISSION_API) {
35
+ return {
36
+ kind,
37
+ supported: false,
38
+ settingsOnly: false
39
+ };
40
+ }
41
+ return {
42
+ kind,
43
+ supported: true,
44
+ settingsOnly: false
45
+ };
46
+ }
47
+
48
+ // Exact alarms exist only on Android 12+, and are granted through system
49
+ // settings rather than an in-app dialog on the versions that gate them.
50
+ if (platform.os !== 'android' || (platform.apiLevel ?? 0) < ANDROID_EXACT_ALARM_API) {
51
+ return {
52
+ kind,
53
+ supported: false,
54
+ settingsOnly: false
55
+ };
56
+ }
57
+ return {
58
+ kind,
59
+ supported: true,
60
+ settingsOnly: true
61
+ };
62
+ }
63
+
64
+ /** Normalizes a platform reading into the six-state model. */
65
+ function normalizeState(kind, raw, platform) {
66
+ if (!capabilityFor(kind, platform).supported) {
67
+ return 'notRequired';
68
+ }
69
+ return raw;
70
+ }
71
+
72
+ /**
73
+ * Whether a state means the package can still show notifications.
74
+ *
75
+ * `provisional` counts: iOS quiet delivery still reaches the user, just without
76
+ * interrupting them. Treating it as denied would suppress notifications the
77
+ * user is in fact receiving.
78
+ */
79
+ function canDisplay(state) {
80
+ return state === 'granted' || state === 'provisional' || state === 'notRequired';
81
+ }
82
+
83
+ /** Whether asking again could produce a dialog, or whether settings is the only route. */
84
+ function isTerminal(state) {
85
+ return state === 'permanentlyDenied' || state === 'notRequired';
86
+ }
87
+
88
+ /** Whether the package has ever asked, which the platform cannot answer after the fact. */
89
+ function shouldOfferSettings(state) {
90
+ return state === 'denied' || state === 'permanentlyDenied';
91
+ }
92
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ANDROID_DISPLAY_PERMISSION_API","exports","ANDROID_EXACT_ALARM_API","capabilityFor","kind","platform","os","apiLevel","supported","settingsOnly","normalizeState","raw","canDisplay","state","isTerminal","shouldOfferSettings"],"sourceRoot":"../../../src","sources":["permission/state.ts"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACO,MAAMA,8BAA8B,GAAAC,OAAA,CAAAD,8BAAA,GAAG,EAAE;AAChD;AACO,MAAME,uBAAuB,GAAAD,OAAA,CAAAC,uBAAA,GAAG,EAAE;AAQzC;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAACC,IAAoB,EAAEC,QAAsB,EAAwB;EACjG,IAAID,IAAI,KAAK,SAAS,EAAE;IACvB,IAAIC,QAAQ,CAACC,EAAE,KAAK,SAAS,IAAI,CAACD,QAAQ,CAACE,QAAQ,IAAI,CAAC,IAAIP,8BAA8B,EAAE;MAC3F,OAAO;QAAEI,IAAI;QAAEI,SAAS,EAAE,KAAK;QAAEC,YAAY,EAAE;MAAM,CAAC;IACvD;IACA,OAAO;MAAEL,IAAI;MAAEI,SAAS,EAAE,IAAI;MAAEC,YAAY,EAAE;IAAM,CAAC;EACtD;;EAEA;EACA;EACA,IAAIJ,QAAQ,CAACC,EAAE,KAAK,SAAS,IAAI,CAACD,QAAQ,CAACE,QAAQ,IAAI,CAAC,IAAIL,uBAAuB,EAAE;IACpF,OAAO;MAAEE,IAAI;MAAEI,SAAS,EAAE,KAAK;MAAEC,YAAY,EAAE;IAAM,CAAC;EACvD;EACA,OAAO;IAAEL,IAAI;IAAEI,SAAS,EAAE,IAAI;IAAEC,YAAY,EAAE;EAAK,CAAC;AACrD;;AAEA;AACO,SAASC,cAAcA,CAC7BN,IAAoB,EACpBO,GAAoB,EACpBN,QAAsB,EACJ;EAClB,IAAI,CAACF,aAAa,CAACC,IAAI,EAAEC,QAAQ,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