@openlup/platform 0.21.0 → 0.23.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 (349) hide show
  1. package/CHANGELOG.md +432 -146
  2. package/README.md +82 -589
  3. package/dist/composition/composeBundle.d.ts +7 -0
  4. package/dist/composition/composeBundle.js +2 -0
  5. package/dist/composition/fulfillmentContribution.d.ts +21 -0
  6. package/dist/composition/fulfillmentContribution.js +19 -0
  7. package/dist/composition/index.d.ts +1 -0
  8. package/dist/composition/index.js +1 -0
  9. package/dist/fulfillment/adapterConformance.d.ts +3 -0
  10. package/dist/fulfillment/adapterConformance.js +223 -0
  11. package/dist/fulfillment/bindings.d.ts +3 -0
  12. package/dist/fulfillment/bindings.js +29 -0
  13. package/dist/fulfillment/commerceFulfillmentHandlers.d.ts +29 -0
  14. package/dist/fulfillment/commerceFulfillmentHandlers.js +184 -0
  15. package/dist/fulfillment/commerceFulfillmentReadModel.d.ts +86 -0
  16. package/dist/fulfillment/commerceFulfillmentReadModel.js +131 -0
  17. package/dist/fulfillment/contracts/alignment.d.ts +25 -0
  18. package/dist/fulfillment/contracts/alignment.js +1 -0
  19. package/dist/fulfillment/contracts/bindings.d.ts +51 -0
  20. package/dist/fulfillment/contracts/bindings.js +1 -0
  21. package/dist/fulfillment/contracts/capabilities.d.ts +29 -0
  22. package/dist/fulfillment/contracts/capabilities.js +1 -0
  23. package/dist/fulfillment/contracts/conformance.d.ts +95 -0
  24. package/dist/fulfillment/contracts/conformance.js +1 -0
  25. package/dist/fulfillment/contracts/customerAlignment.d.ts +6 -0
  26. package/dist/fulfillment/contracts/customerAlignment.js +1 -0
  27. package/dist/fulfillment/contracts/dispatch.d.ts +143 -0
  28. package/dist/fulfillment/contracts/dispatch.js +1 -0
  29. package/dist/fulfillment/contracts/index.d.ts +18 -0
  30. package/dist/fulfillment/contracts/index.js +1 -0
  31. package/dist/fulfillment/contracts/label.d.ts +35 -0
  32. package/dist/fulfillment/contracts/label.js +1 -0
  33. package/dist/fulfillment/contracts/nativeUnsupported.d.ts +6 -0
  34. package/dist/fulfillment/contracts/nativeUnsupported.js +1 -0
  35. package/dist/fulfillment/contracts/observation.d.ts +72 -0
  36. package/dist/fulfillment/contracts/observation.js +1 -0
  37. package/dist/fulfillment/contracts/operator.d.ts +64 -0
  38. package/dist/fulfillment/contracts/operator.js +1 -0
  39. package/dist/fulfillment/contracts/read.d.ts +110 -0
  40. package/dist/fulfillment/contracts/read.js +1 -0
  41. package/dist/fulfillment/contracts/readback.d.ts +59 -0
  42. package/dist/fulfillment/contracts/readback.js +1 -0
  43. package/dist/fulfillment/contracts/replacement.d.ts +34 -0
  44. package/dist/fulfillment/contracts/replacement.js +1 -0
  45. package/dist/fulfillment/contracts/store.d.ts +89 -0
  46. package/dist/fulfillment/contracts/store.js +1 -0
  47. package/dist/fulfillment/contracts/sync.d.ts +226 -0
  48. package/dist/fulfillment/contracts/sync.js +1 -0
  49. package/dist/fulfillment/currentFulfillmentParcel.d.ts +2 -0
  50. package/dist/fulfillment/currentFulfillmentParcel.js +1 -0
  51. package/dist/fulfillment/delayReadModel.d.ts +11 -0
  52. package/dist/fulfillment/delayReadModel.js +45 -0
  53. package/dist/fulfillment/deliveryAlignmentReadModel.d.ts +4 -0
  54. package/dist/fulfillment/deliveryAlignmentReadModel.js +12 -0
  55. package/dist/fulfillment/dispatchProjection.d.ts +26 -0
  56. package/dist/fulfillment/dispatchProjection.js +107 -0
  57. package/dist/fulfillment/fulfillmentObservationEffects.d.ts +66 -0
  58. package/dist/fulfillment/fulfillmentObservationEffects.js +36 -0
  59. package/dist/fulfillment/handlerSchemas.d.ts +647 -0
  60. package/dist/fulfillment/handlerSchemas.js +213 -0
  61. package/dist/fulfillment/handlerSupport.d.ts +33 -0
  62. package/dist/fulfillment/handlerSupport.js +25 -0
  63. package/dist/fulfillment/index.d.ts +38 -0
  64. package/dist/fulfillment/index.js +37 -0
  65. package/dist/fulfillment/labelLifecycle.d.ts +24 -0
  66. package/dist/fulfillment/labelLifecycle.js +9 -0
  67. package/dist/fulfillment/lowStockEvidenceHandler.d.ts +36 -0
  68. package/dist/fulfillment/lowStockEvidenceHandler.js +46 -0
  69. package/dist/fulfillment/migrations.d.ts +32 -0
  70. package/dist/fulfillment/migrations.js +9 -0
  71. package/dist/fulfillment/nativeUnsupported.d.ts +10 -0
  72. package/dist/fulfillment/nativeUnsupported.js +18 -0
  73. package/dist/fulfillment/normalizedFulfillmentFacts.d.ts +2 -0
  74. package/dist/fulfillment/normalizedFulfillmentFacts.js +1 -0
  75. package/dist/fulfillment/observationProjection.d.ts +32 -0
  76. package/dist/fulfillment/observationProjection.js +90 -0
  77. package/dist/fulfillment/omnipack/capabilities.d.ts +3 -0
  78. package/dist/fulfillment/omnipack/capabilities.js +16 -0
  79. package/dist/fulfillment/omnipack/client.d.ts +39 -0
  80. package/dist/fulfillment/omnipack/client.js +172 -0
  81. package/dist/fulfillment/omnipack/index.d.ts +55 -0
  82. package/dist/fulfillment/omnipack/index.js +408 -0
  83. package/dist/fulfillment/omnipack/mappers.d.ts +79 -0
  84. package/dist/fulfillment/omnipack/mappers.js +199 -0
  85. package/dist/fulfillment/omnipack/observation.d.ts +28 -0
  86. package/dist/fulfillment/omnipack/observation.js +72 -0
  87. package/dist/fulfillment/omnipack/omnipackDispatchPayload.d.ts +36 -0
  88. package/dist/fulfillment/omnipack/omnipackDispatchPayload.js +63 -0
  89. package/dist/fulfillment/omnipack/omnipackOutboundOrderPayload.d.ts +83 -0
  90. package/dist/fulfillment/omnipack/omnipackOutboundOrderPayload.js +113 -0
  91. package/dist/fulfillment/omnipack/omnipackProductPackPayload.d.ts +11 -0
  92. package/dist/fulfillment/omnipack/omnipackProductPackPayload.js +38 -0
  93. package/dist/fulfillment/omnipack/omnipackProductPayload.d.ts +18 -0
  94. package/dist/fulfillment/omnipack/omnipackProductPayload.js +51 -0
  95. package/dist/fulfillment/omnipack/omnipackReconciliationPayload.d.ts +1 -0
  96. package/dist/fulfillment/omnipack/omnipackReconciliationPayload.js +3 -0
  97. package/dist/fulfillment/omnipack/omnipackStatusVocabulary.d.ts +4 -0
  98. package/dist/fulfillment/omnipack/omnipackStatusVocabulary.js +87 -0
  99. package/dist/fulfillment/omnipack/omnipackWebhookPayload.d.ts +9 -0
  100. package/dist/fulfillment/omnipack/omnipackWebhookPayload.js +76 -0
  101. package/dist/fulfillment/omnipack/productSyncMappers.d.ts +18 -0
  102. package/dist/fulfillment/omnipack/productSyncMappers.js +43 -0
  103. package/dist/fulfillment/omnipack/providerError.d.ts +25 -0
  104. package/dist/fulfillment/omnipack/providerError.js +47 -0
  105. package/dist/fulfillment/omnipack/reconciliation.d.ts +15 -0
  106. package/dist/fulfillment/omnipack/reconciliation.js +55 -0
  107. package/dist/fulfillment/omnipack/trackingReferences.d.ts +16 -0
  108. package/dist/fulfillment/omnipack/trackingReferences.js +52 -0
  109. package/dist/fulfillment/paidFulfillmentRecovery.d.ts +67 -0
  110. package/dist/fulfillment/paidFulfillmentRecovery.js +154 -0
  111. package/dist/fulfillment/paidHandoff.d.ts +27 -0
  112. package/dist/fulfillment/paidHandoff.js +86 -0
  113. package/dist/fulfillment/paidHandoffPorts.d.ts +24 -0
  114. package/dist/fulfillment/paidHandoffPorts.js +3 -0
  115. package/dist/fulfillment/postgresDeliveryAlignment.d.ts +4 -0
  116. package/dist/fulfillment/postgresDeliveryAlignment.js +12 -0
  117. package/dist/fulfillment/postgresDispatchStore.d.ts +16 -0
  118. package/dist/fulfillment/postgresDispatchStore.js +44 -0
  119. package/dist/fulfillment/postgresEvidenceReadPort.d.ts +25 -0
  120. package/dist/fulfillment/postgresEvidenceReadPort.js +45 -0
  121. package/dist/fulfillment/postgresPaidFulfillmentRecovery.d.ts +25 -0
  122. package/dist/fulfillment/postgresPaidFulfillmentRecovery.js +26 -0
  123. package/dist/fulfillment/postgresPaidHandoffStore.d.ts +4 -0
  124. package/dist/fulfillment/postgresPaidHandoffStore.js +10 -0
  125. package/dist/fulfillment/postgresShipmentSpine.d.ts +70 -0
  126. package/dist/fulfillment/postgresShipmentSpine.js +246 -0
  127. package/dist/fulfillment/postgresStockSyncPort.d.ts +8 -0
  128. package/dist/fulfillment/postgresStockSyncPort.js +66 -0
  129. package/dist/fulfillment/productReconciliationEvidenceHandler.d.ts +36 -0
  130. package/dist/fulfillment/productReconciliationEvidenceHandler.js +50 -0
  131. package/dist/fulfillment/providerCapabilities.d.ts +9 -0
  132. package/dist/fulfillment/providerCapabilities.js +17 -0
  133. package/dist/fulfillment/providerCommandLedger.d.ts +143 -0
  134. package/dist/fulfillment/providerCommandLedger.js +14 -0
  135. package/dist/fulfillment/providerDispatchAcceptance.d.ts +27 -0
  136. package/dist/fulfillment/providerDispatchAcceptance.js +29 -0
  137. package/dist/fulfillment/providerDispatchError.d.ts +6 -0
  138. package/dist/fulfillment/providerDispatchError.js +5 -0
  139. package/dist/fulfillment/providerDispatchWorker.d.ts +44 -0
  140. package/dist/fulfillment/providerDispatchWorker.js +199 -0
  141. package/dist/fulfillment/providerProductSyncWorker.d.ts +28 -0
  142. package/dist/fulfillment/providerProductSyncWorker.js +122 -0
  143. package/dist/fulfillment/providerReconciliationError.d.ts +9 -0
  144. package/dist/fulfillment/providerReconciliationError.js +17 -0
  145. package/dist/fulfillment/providerReconciliationTerminalSkip.d.ts +2 -0
  146. package/dist/fulfillment/providerReconciliationTerminalSkip.js +6 -0
  147. package/dist/fulfillment/providerReconciliationTimestamp.d.ts +1 -0
  148. package/dist/fulfillment/providerReconciliationTimestamp.js +27 -0
  149. package/dist/fulfillment/providerReconciliationWorker.d.ts +90 -0
  150. package/dist/fulfillment/providerReconciliationWorker.js +207 -0
  151. package/dist/fulfillment/providerStockAvailability.d.ts +13 -0
  152. package/dist/fulfillment/providerStockAvailability.js +51 -0
  153. package/dist/fulfillment/providerStockSyncWorker.d.ts +41 -0
  154. package/dist/fulfillment/providerStockSyncWorker.js +295 -0
  155. package/dist/fulfillment/providerTrackingReferences.d.ts +16 -0
  156. package/dist/fulfillment/providerTrackingReferences.js +23 -0
  157. package/dist/fulfillment/replacementRefusals.d.ts +5 -0
  158. package/dist/fulfillment/replacementRefusals.js +38 -0
  159. package/dist/fulfillment/replacementShipmentHandler.d.ts +5 -0
  160. package/dist/fulfillment/replacementShipmentHandler.js +46 -0
  161. package/dist/fulfillment/schemaCapabilities.d.ts +13 -0
  162. package/dist/fulfillment/schemaCapabilities.js +7 -0
  163. package/dist/fulfillment/shipmentsOverviewHandler.d.ts +16 -0
  164. package/dist/fulfillment/shipmentsOverviewHandler.js +54 -0
  165. package/dist/fulfillment/statusMap.d.ts +2 -0
  166. package/dist/fulfillment/statusMap.js +1 -0
  167. package/dist/fulfillment/trackingProgress.d.ts +1 -0
  168. package/dist/fulfillment/trackingProgress.js +1 -0
  169. package/dist/fulfillment/verifiedIngress.d.ts +79 -0
  170. package/dist/fulfillment/verifiedIngress.js +94 -0
  171. package/dist/invoicing/capabilities.d.ts +11 -0
  172. package/dist/invoicing/capabilities.js +10 -0
  173. package/dist/invoicing/contracts/capabilities.d.ts +40 -0
  174. package/dist/invoicing/contracts/capabilities.js +1 -0
  175. package/dist/invoicing/contracts/companyLookup.d.ts +49 -0
  176. package/dist/invoicing/contracts/companyLookup.js +1 -0
  177. package/dist/invoicing/contracts/delivery.d.ts +74 -0
  178. package/dist/invoicing/contracts/delivery.js +1 -0
  179. package/dist/invoicing/contracts/facts.d.ts +100 -0
  180. package/dist/invoicing/contracts/facts.js +1 -0
  181. package/dist/invoicing/contracts/host.d.ts +246 -0
  182. package/dist/invoicing/contracts/host.js +1 -0
  183. package/dist/invoicing/contracts/index.d.ts +16 -0
  184. package/dist/invoicing/contracts/index.js +1 -0
  185. package/dist/invoicing/contracts/provider.d.ts +126 -0
  186. package/dist/invoicing/contracts/provider.js +1 -0
  187. package/dist/invoicing/contracts/settlement.d.ts +66 -0
  188. package/dist/invoicing/contracts/settlement.js +1 -0
  189. package/dist/invoicing/contracts/store.d.ts +267 -0
  190. package/dist/invoicing/contracts/store.js +1 -0
  191. package/dist/invoicing/index.d.ts +1 -0
  192. package/dist/invoicing/index.js +1 -0
  193. package/dist/payments/stripe/index.d.ts +25 -0
  194. package/dist/payments/stripe/index.js +25 -0
  195. package/dist/payments/tpay/index.d.ts +30 -0
  196. package/dist/payments/tpay/index.js +30 -0
  197. package/dist/subscriptions/automaticRenewal.d.ts +44 -0
  198. package/dist/subscriptions/automaticRenewal.js +81 -0
  199. package/dist/subscriptions/automaticRenewalExecution.d.ts +21 -0
  200. package/dist/subscriptions/automaticRenewalExecution.js +44 -0
  201. package/dist/subscriptions/contracts/commands.d.ts +115 -0
  202. package/dist/subscriptions/contracts/commands.js +1 -0
  203. package/dist/subscriptions/contracts/dunning.d.ts +133 -0
  204. package/dist/subscriptions/contracts/dunning.js +1 -0
  205. package/dist/subscriptions/contracts/index.d.ts +6 -0
  206. package/dist/subscriptions/contracts/index.js +1 -0
  207. package/dist/subscriptions/contracts/messages.d.ts +43 -0
  208. package/dist/subscriptions/contracts/messages.js +1 -0
  209. package/dist/subscriptions/contracts/renewal.d.ts +533 -0
  210. package/dist/subscriptions/contracts/renewal.js +1 -0
  211. package/dist/subscriptions/contracts/stockWait.d.ts +73 -0
  212. package/dist/subscriptions/contracts/stockWait.js +1 -0
  213. package/dist/subscriptions/index.d.ts +39 -0
  214. package/dist/subscriptions/index.js +17 -0
  215. package/dist/subscriptions/paymentOutcomes.d.ts +8 -0
  216. package/dist/subscriptions/paymentOutcomes.js +27 -0
  217. package/dist/subscriptions/postgresRenewalStore.d.ts +20 -0
  218. package/dist/subscriptions/postgresRenewalStore.js +61 -0
  219. package/dist/subscriptions/postgresRetryStore.d.ts +78 -0
  220. package/dist/subscriptions/postgresRetryStore.js +142 -0
  221. package/dist/subscriptions/renewalCycleFailureMechanism.d.ts +34 -0
  222. package/dist/subscriptions/renewalCycleFailureMechanism.js +79 -0
  223. package/dist/subscriptions/renewalCycleMechanism.d.ts +46 -0
  224. package/dist/subscriptions/renewalCycleMechanism.js +157 -0
  225. package/dist/subscriptions/renewalCycleRefusalMechanism.d.ts +41 -0
  226. package/dist/subscriptions/renewalCycleRefusalMechanism.js +160 -0
  227. package/dist/subscriptions/renewalIdentity.d.ts +3 -0
  228. package/dist/subscriptions/renewalIdentity.js +4 -0
  229. package/package.json +37 -2
  230. package/release-gates.json +97 -3
  231. package/sql/20260808210000_fulfillment_shipment_rail.sql +810 -0
  232. package/sql/20260819150000_fulfillment_shipment_sequence.sql +98 -0
  233. package/sql/20261022080000_fulfillment_command_ledger.sql +786 -0
  234. package/sql/20261022090000_fulfillment_delivery_alignment.sql +1106 -0
  235. package/sql/20261022160000_subscription_retry_lifecycle.sql +328 -0
  236. package/sql/20261022165000_fulfillment_stock_evidence_replay_reopen.sql +30 -0
  237. package/src/composition/composeBundle.ts +4 -0
  238. package/src/composition/fulfillmentContribution.ts +28 -0
  239. package/src/composition/index.ts +1 -0
  240. package/src/fulfillment/adapterConformance.ts +195 -0
  241. package/src/fulfillment/bindings.ts +26 -0
  242. package/src/fulfillment/commerceFulfillmentHandlers.ts +263 -0
  243. package/src/fulfillment/commerceFulfillmentReadModel.ts +257 -0
  244. package/src/fulfillment/contracts/alignment.ts +13 -0
  245. package/src/fulfillment/contracts/bindings.ts +30 -0
  246. package/src/fulfillment/contracts/capabilities.ts +15 -0
  247. package/src/fulfillment/contracts/conformance.ts +63 -0
  248. package/src/fulfillment/contracts/customerAlignment.ts +4 -0
  249. package/src/fulfillment/contracts/dispatch.ts +73 -0
  250. package/src/fulfillment/contracts/index.ts +18 -0
  251. package/src/fulfillment/contracts/label.ts +9 -0
  252. package/src/fulfillment/contracts/nativeUnsupported.ts +6 -0
  253. package/src/fulfillment/contracts/observation.ts +26 -0
  254. package/src/fulfillment/contracts/operator.ts +31 -0
  255. package/src/fulfillment/contracts/read.ts +42 -0
  256. package/src/fulfillment/contracts/readback.ts +24 -0
  257. package/src/fulfillment/contracts/replacement.ts +15 -0
  258. package/src/fulfillment/contracts/store.ts +27 -0
  259. package/src/fulfillment/contracts/sync.ts +72 -0
  260. package/src/fulfillment/currentFulfillmentParcel.ts +2 -0
  261. package/src/fulfillment/delayReadModel.ts +60 -0
  262. package/src/fulfillment/deliveryAlignmentReadModel.ts +15 -0
  263. package/src/fulfillment/dispatchProjection.ts +105 -0
  264. package/src/fulfillment/fulfillmentObservationEffects.ts +86 -0
  265. package/src/fulfillment/handlerSchemas.ts +255 -0
  266. package/src/fulfillment/handlerSupport.ts +25 -0
  267. package/src/fulfillment/index.ts +39 -0
  268. package/src/fulfillment/labelLifecycle.ts +11 -0
  269. package/src/fulfillment/lowStockEvidenceHandler.ts +60 -0
  270. package/src/fulfillment/migrations.ts +9 -0
  271. package/src/fulfillment/nativeUnsupported.ts +23 -0
  272. package/src/fulfillment/normalizedFulfillmentFacts.ts +2 -0
  273. package/src/fulfillment/observationProjection.ts +92 -0
  274. package/src/fulfillment/omnipack/capabilities.ts +18 -0
  275. package/src/fulfillment/omnipack/client.ts +270 -0
  276. package/src/fulfillment/omnipack/index.ts +369 -0
  277. package/src/fulfillment/omnipack/mappers.ts +282 -0
  278. package/src/fulfillment/omnipack/observation.ts +79 -0
  279. package/src/fulfillment/omnipack/omnipackDispatchPayload.ts +93 -0
  280. package/src/fulfillment/omnipack/omnipackOutboundOrderPayload.ts +194 -0
  281. package/src/fulfillment/omnipack/omnipackProductPackPayload.ts +47 -0
  282. package/src/fulfillment/omnipack/omnipackProductPayload.ts +67 -0
  283. package/src/fulfillment/omnipack/omnipackReconciliationPayload.ts +7 -0
  284. package/src/fulfillment/omnipack/omnipackStatusVocabulary.ts +103 -0
  285. package/src/fulfillment/omnipack/omnipackWebhookPayload.ts +73 -0
  286. package/src/fulfillment/omnipack/productSyncMappers.ts +74 -0
  287. package/src/fulfillment/omnipack/providerError.ts +64 -0
  288. package/src/fulfillment/omnipack/reconciliation.ts +56 -0
  289. package/src/fulfillment/omnipack/trackingReferences.ts +77 -0
  290. package/src/fulfillment/paidFulfillmentRecovery.ts +252 -0
  291. package/src/fulfillment/paidHandoff.ts +122 -0
  292. package/src/fulfillment/paidHandoffPorts.ts +21 -0
  293. package/src/fulfillment/postgresDeliveryAlignment.ts +14 -0
  294. package/src/fulfillment/postgresDispatchStore.ts +55 -0
  295. package/src/fulfillment/postgresEvidenceReadPort.ts +59 -0
  296. package/src/fulfillment/postgresPaidFulfillmentRecovery.ts +29 -0
  297. package/src/fulfillment/postgresPaidHandoffStore.ts +11 -0
  298. package/src/fulfillment/postgresShipmentSpine.ts +338 -0
  299. package/src/fulfillment/postgresStockSyncPort.ts +68 -0
  300. package/src/fulfillment/productReconciliationEvidenceHandler.ts +64 -0
  301. package/src/fulfillment/providerCapabilities.ts +18 -0
  302. package/src/fulfillment/providerCommandLedger.ts +53 -0
  303. package/src/fulfillment/providerDispatchAcceptance.ts +37 -0
  304. package/src/fulfillment/providerDispatchError.ts +7 -0
  305. package/src/fulfillment/providerDispatchWorker.ts +159 -0
  306. package/src/fulfillment/providerProductSyncWorker.ts +154 -0
  307. package/src/fulfillment/providerReconciliationError.ts +20 -0
  308. package/src/fulfillment/providerReconciliationTerminalSkip.ts +8 -0
  309. package/src/fulfillment/providerReconciliationTimestamp.ts +34 -0
  310. package/src/fulfillment/providerReconciliationWorker.ts +206 -0
  311. package/src/fulfillment/providerStockAvailability.ts +60 -0
  312. package/src/fulfillment/providerStockSyncWorker.ts +318 -0
  313. package/src/fulfillment/providerTrackingReferences.ts +32 -0
  314. package/src/fulfillment/replacementRefusals.ts +43 -0
  315. package/src/fulfillment/replacementShipmentHandler.ts +47 -0
  316. package/src/fulfillment/schemaCapabilities.ts +7 -0
  317. package/src/fulfillment/shipmentsOverviewHandler.ts +73 -0
  318. package/src/fulfillment/statusMap.ts +2 -0
  319. package/src/fulfillment/trackingProgress.ts +1 -0
  320. package/src/fulfillment/verifiedIngress.ts +113 -0
  321. package/src/invoicing/capabilities.ts +9 -0
  322. package/src/invoicing/contracts/capabilities.ts +15 -0
  323. package/src/invoicing/contracts/companyLookup.ts +13 -0
  324. package/src/invoicing/contracts/delivery.ts +24 -0
  325. package/src/invoicing/contracts/facts.ts +60 -0
  326. package/src/invoicing/contracts/host.ts +85 -0
  327. package/src/invoicing/contracts/index.ts +16 -0
  328. package/src/invoicing/contracts/provider.ts +78 -0
  329. package/src/invoicing/contracts/settlement.ts +39 -0
  330. package/src/invoicing/contracts/store.ts +98 -0
  331. package/src/invoicing/index.ts +1 -0
  332. package/src/payments/stripe/index.ts +30 -0
  333. package/src/payments/tpay/index.ts +36 -0
  334. package/src/subscriptions/automaticRenewal.ts +87 -0
  335. package/src/subscriptions/automaticRenewalExecution.ts +39 -0
  336. package/src/subscriptions/contracts/commands.ts +46 -0
  337. package/src/subscriptions/contracts/dunning.ts +48 -0
  338. package/src/subscriptions/contracts/index.ts +6 -0
  339. package/src/subscriptions/contracts/messages.ts +18 -0
  340. package/src/subscriptions/contracts/renewal.ts +325 -0
  341. package/src/subscriptions/contracts/stockWait.ts +34 -0
  342. package/src/subscriptions/index.ts +24 -0
  343. package/src/subscriptions/paymentOutcomes.ts +23 -0
  344. package/src/subscriptions/postgresRenewalStore.ts +76 -0
  345. package/src/subscriptions/postgresRetryStore.ts +174 -0
  346. package/src/subscriptions/renewalCycleFailureMechanism.ts +119 -0
  347. package/src/subscriptions/renewalCycleMechanism.ts +225 -0
  348. package/src/subscriptions/renewalCycleRefusalMechanism.ts +215 -0
  349. package/src/subscriptions/renewalIdentity.ts +5 -0
package/CHANGELOG.md CHANGED
@@ -10,6 +10,438 @@ in the source repository.
10
10
 
11
11
  ## [Unreleased]
12
12
 
13
+ ## [0.23.0]
14
+
15
+ - Publishable on the npm `latest` dist-tag as `0.23.0`, from tag
16
+ `openlup-platform-v0.23.0`.
17
+
18
+ - Add `approveTrackingUrl` inputs to `verifyAndNormalizeFulfillmentObservation`,
19
+ `PostgresFulfillmentShipmentSpineOptions`, `FulfillmentAdapterConformanceSubject`
20
+ and reconciliation `trackingCodecs`. Under the strict default, provider tracking
21
+ URLs persist only with host approval and must be query-free and credential-free
22
+ HTTPS; host-built tracking URLs pass unchanged, including query strings.
23
+ - Existing `reconcileFulfillmentObservations` callers now receive row-local unknown
24
+ readback failures (`ok: false` with `failures`) while recognized rows still
25
+ process.
26
+ - Observation ingest (`verifyAndNormalizeFulfillmentObservation`, the native
27
+ `recordObservation`, `reconcileFulfillmentObservations` and
28
+ `runFulfillmentReconciliationPage`) now applies the durable-sink sanitizer: provider-derived
29
+ references outside the opaque reference rule (for example `#1001` or
30
+ `ORD/2026/1`) are stored as null or redacted and counted instead of verbatim,
31
+ and `firstReceivedAt` must be an RFC 3339 timestamp with an offset; other
32
+ values fail ingest or the reconciliation row. A correlation refused to null can
33
+ be quarantined as `missing_correlation` in reconciliation.
34
+ - Fulfillment reconciliation inputs replace `readLocalFulfillmentState` with
35
+ `readLocalFulfillmentStatus`, `latestStatusOccurredAt` and `readHandedOverAt`;
36
+ migrate host persistence implementations to these three reads.
37
+ - Add exported page observation contracts and `runFulfillmentReconciliationPage`
38
+ for host-owned scheduling, checkpoint resume and HTTP/ledger result projection;
39
+ exact lookup remains separate. `providerCalls` counts logical page-port reads,
40
+ including failures and exhaustion, separately from transport retries.
41
+ - Add redacted dispatch transcript/mapping fields, typed operation errors,
42
+ acceptance recovery evidence and provider-status occurrence evidence. Existing
43
+ unchanged stage/live dispatch identities retain their stored evidence for native replay.
44
+ - Migration: shadow drafts/attempts recorded by `0.22.0`'s native dispatch store
45
+ do not replay after this change: shadow now hashes the local candidate rather
46
+ than the provider-prepared command. Claim may consume a remap or raise
47
+ `fulfillment_dispatch_remap_exhausted`; an existing attempt may raise
48
+ `fulfillment_attempt_key_conflict`. Complete or abandon such drafts before
49
+ upgrading. The `0.22.0` native dispatch store has no adopter; no compatibility
50
+ transition is supplied.
51
+ - D2 KEEP-GAP: native `fulfillment_dispatch_finish` drops rejected/unknown error
52
+ detail; durable retention is a scheduled SQL follow-up.
53
+
54
+ - Compatibility: `getStock()` and `getStockMovements()` now return a row union;
55
+ consumers must discriminate rejections with
56
+ `"kind" in row && row.kind === "rejected"` before reading observation fields.
57
+ Provider read failures now return failed worker results (`ok: false`) with
58
+ persisted `providerError` diagnostics when the provider supplies a typed failure,
59
+ instead of throwing. Hosts can map those
60
+ failures to HTTP 502; terminal cursor-write failures still reject.
61
+ Cursor reads, running-cursor writes, local stock/class/reservation reads and
62
+ stock/evidence writes or SKU evidence resolution now also resolve `ok: false`
63
+ instead of rejecting when a terminal failed cursor can be persisted.
64
+ - `SyncCursor` adds optional `syncRunId`, `counts`, `items`, `alerts`, `staleSync`
65
+ and `error`, worker results add `rejected`, `items`, `providerError` and `refusal`,
66
+ and `fulfillment_stock_sync_cursors.error_code` now stores safe operation reasons
67
+ (including `operation:SQLSTATE`) or typed provider/admission reasons instead of
68
+ the generic `io_failure`.
69
+ - Mixed valid/rejected batches with valid stock rows succeed, retain rejection
70
+ counts and diagnostics, evaluate/resolve alerts for valid SKUs and advance
71
+ `lastStockSyncedAt`; an empty stock response is also valid, but a nonempty stock
72
+ response with no valid stock rows is malformed and non-retryable even with valid
73
+ movements, preserves prior coverage gaps and cannot resolve stale alerts.
74
+ Typed disabled, not-ready and bad-identity refusals retain their original reason
75
+ and retryability in the worker result and cursor.
76
+ Blank stock SKU references are skipped before persistence; stale-sync recovery
77
+ resolves after the terminal cursor, with cleanup failure preserving success.
78
+ Stock and movement rejection diagnostics carry a `kind` discriminator.
79
+ Stock-sync redirects are non-retryable, report `redirect_refused` and make only
80
+ one GET attempt; exhausted stock network reads remain retryable through the stock
81
+ failure projection. Product-sync retains the base client diagnostics and retry
82
+ behavior, including `retryable: false` after exhausted network reads.
83
+ - Stock-sync alert fingerprints now contain only `requestKey`, `skuRef` and
84
+ `thresholdKind`: changing quantities, severity or run evidence under the same
85
+ key returns `replayed: true`. Different SKUs or thresholds use different keys;
86
+ a changed identity under a reused key still conflicts.
87
+ - Closed the scheduled KEEP-GAP for stock alert refresh/reopen with native forward
88
+ `20261022165000_fulfillment_stock_evidence_replay_reopen.sql`. Matching-identity
89
+ replay reopens the alert, refreshes severity/quantities and clears `resolved_at`;
90
+ identity mismatches retain SQLSTATE `23505`.
91
+
92
+ Migration: install the complete native catalogue through `20261022165000` before
93
+ stock adoption. The package descriptor and SQL asset project that same forward;
94
+ replay preserves the row identity, first-seen time and historical resolver run.
95
+ There is no managed forward or legacy fingerprint rewrite.
96
+
97
+ Migration: alert rows written by 0.22.0's native port carry the earlier whole-input fingerprint; subsequent writes under those keys conflict with SQLSTATE `23505`, and resolve only marks the row resolved while retaining its key and fingerprint, so it does not clear the conflict. Legacy fingerprints are documented only; this change does not rewrite them.
98
+
99
+ - Fulfillment ingress exposes receipt IDs, a host-neutral HTTP result mapping,
100
+ counted correlation/timestamp/tracking refusals and persisted safe superseded
101
+ causes. The opt-in adapter preserves donor webhook key bytes and defaults to
102
+ strict opaque references. Adopters can explicitly allow wider reference shapes
103
+ through `observationCodecs.approveReference`; tracking URLs retain their strict
104
+ default policy. `carrierRef` now stores the service-derived lowercase carrier
105
+ prefix by default, or the safe kind returned by `normalizeCarrier`, and effects
106
+ receive that same value as `carrierKind`. Both are null when no kind is available
107
+ or service evidence is refused; raw provider carrier codes have no fallback,
108
+ matching donor deduplication. Strict timestamp validation applies only at
109
+ webhook ingress, accepting compact offsets and local timestamps as before;
110
+ reconciliation and stock-movement timestamp parsing retain PR2 behavior.
111
+ Hosts retain referenced raw evidence.
112
+
113
+ Migration (observation ingress): donor-format colon identities remain the
114
+ compatibility target. Observation receipts/effects recorded by 0.22.0's native
115
+ stores under package digest keys are not recognized under the incumbent colon
116
+ keys, so retrying such an event can apply tracking again. Replaying a superseded
117
+ receipt processed by 0.22.0 fails with `fulfillment_observation_outcome_conflict`.
118
+ Drain in-flight observation retries before upgrading. No bridges or aliases are
119
+ provided for these native rows. Wider incumbent correlation/tracking references
120
+ require an explicit adopter allowlist; the default refuses and reports them.
121
+
122
+ Close the scheduled native stock-evidence refresh/reopen gap with forward
123
+ `20261022165000_fulfillment_stock_evidence_replay_reopen.sql` and its byte-identical
124
+ fulfillment package projection. Matching fingerprints refresh severity and nullable
125
+ quantities, reopen status, and clear `resolved_at`; identity, first-seen time and
126
+ historical resolver metadata survive. Existing-row replays and resolution serialize
127
+ on the row lock. Fingerprint mismatches still raise `23505`.
128
+
129
+ Migration: install the complete canonical native catalogue through `20261022165000`
130
+ before stock adoption, preserving its immutable ledger prefix. Sparse package SQL
131
+ is not a standalone install chain. The managed baseline already has this behavior.
132
+ Legacy 0.22.0 whole-input fingerprints are not rewritten and still conflict with
133
+ PR1 identity fingerprints, including after resolution.
134
+
135
+ - Add experimental invoicing declarations and explicit default-off capability selection, preserving exact absence, uncertain effects, correction identity and owed-duty visibility.
136
+ - Freeze host fiscal/facts/seller/money, registry, artifact, delivery, payout-item and safe account-history seams without installing a worker, store, provider or route.
137
+
138
+ Approve only the exact frozen M10/F17 native and managed SQL packet through a separate forward-control class, with inert fixtures, refusal plants and a required real PostgreSQL/pgTAP catalog gate. This control adds no migration, runtime activation or new permission to an installation.
139
+
140
+ - Add experimental subscription contracts and exact server/browser subpaths, preserving schedule identity, graph transaction boundaries, deferred admission and explicit native capability refusals.
141
+ - Contribute the unchanged hosted cycle, refusal and durable failure mechanisms with injected policy and their characterization; preserve native captured-case protection through rollback until actual arrival.
142
+
143
+ - Add injected native renewal and retry stores and a native executor using the subscription ports; bind hosted charge/failure facades to the contributed mechanism and existing M07 policies.
144
+ - Type-level change visible to dev-preview consumers: `capabilities.retryRecovery` changes from `"unavailable"` to `"selected"` (asserted in packages/platform/test/subscriptions/portFit.test.ts).
145
+
146
+ Migration: Install native N1 through the full ordered manifest before composing the retry driver. Native declines can retry or recover the original obligation instead of stalling indefinitely (F16); exhaustion leaves an active subscription and open case with no next retry. Preserve ledgers on rollback. The initial binding preserves case-before-outcome order and atomic terminal/bookkeeping writes. An existing immutable receipt short-circuits initial terminal replay before settlement, rebinding or case propagation, preserving all later retry effects; no runner is activated and M07 native prepared-store parity remains unavailable.
147
+
148
+ Host obligations: establish explicit logical-cycle correlation before invoking the runner (including prepare/execute). Ordinary retries must use the frozen mandate/authorization; N1 does not bind an ordinary retry method, so the P8 retry driver or host must enforce this, with a composition witness added in P8. Prepared retries retain the existing non-terminal `retry_scheduled` disposition with no next dispatch date. Bare `failed` execution status without explicit failure evidence requires verified readback (or remains awaiting an ACK).
149
+
150
+ A host or driver must never call `openCase` after a replayed `applyFailure` receipt, and the P8 retry driver must add a zero-delta replay witness.
151
+
152
+ ### Warehouse product-sync parity
153
+
154
+ A3 #311 restores product-sync parity and safe diagnostics in the opt-in warehouse
155
+ adapter, including product/pack projection and injected transport behavior.
156
+ It remains default-off with offline evidence only and no provider-account proof.
157
+
158
+ Migration: upgrade the complete core/outbox/platform set from `0.22.0` to
159
+ `0.23.0` for exact peers. Install the complete canonical native chain through
160
+ position 76 (`20261022165000_fulfillment_stock_evidence_replay_reopen.sql`),
161
+ including native N1, before selecting native stores. Sparse package SQL is not
162
+ an installation chain. Follow the shadow-draft, observation-retry and legacy
163
+ alert-fingerprint migration notes above; rollback preserves the forward ledger.
164
+
165
+ ### Experimental stages: no adopter activation
166
+
167
+ M10 subscription renewal/retry is **EXPERIMENTAL, INCOMPLETE and DEFAULT-OFF**,
168
+ not for adopter activation. This set includes P1 exports, the forward controls,
169
+ and P2 native renewal/retry stores and executor with native N1 SQL landed.
170
+ No runner is activated. G23 composition and N1 correlation, frozen authorization
171
+ and replay obligations remain pending: compose admission before any new cycle,
172
+ bind a logical cycle before prepare/execute, enforce frozen authorization on
173
+ ordinary retries, and never open a case after a replayed failure receipt.
174
+ The later retry driver still owes its zero-delta replay witness.
175
+
176
+ M09 invoicing capability selection and type-only contracts are
177
+ **EXPERIMENTAL, INCOMPLETE and DEFAULT-OFF**, not for adopter activation.
178
+ There is no invoicing SQL, store, worker, provider or route in this stage.
179
+ Installing the set does not register subscription or invoicing routes, workers
180
+ or a renewal runner; host composition remains explicit.
181
+
182
+ ### Known limitations
183
+
184
+ - Managed dunning exhaustion still pauses active subscriptions; retaining active status needs a managed forward. Native N1 lands the bounded retry/failure repair, with the host obligations below still pending.
185
+ - D8-1: native advisory v2 promo-code candidates/rejection details unavailable.
186
+ - D8-2: native mounted v2 issue/honor/fallback unavailable.
187
+ - D8-3: native acquisition-only mounted issuance/honor unavailable.
188
+ - D8-4: full native/managed eligibility equivalence unavailable.
189
+ - Bundle-1: independent DB human-only actor-kind enforcement absent natively; first in the native-backend parity round.
190
+ - Bundle-2: managed-equivalent actor-kind/email history absent natively.
191
+ - Bundle-3 closes injected-reader M05 mounted admin/feed readback only. Native new-purchase stock read absent despite P5a installed-store proof; deferred second after bundle-1 (owner 2026-10-21); readiness refuses.
192
+ - Bundle-4: incumbent real-PostgreSQL contention only; no exactly-once guarantee.
193
+ - Managed schema/pgTAP retain `44.404`; removal needs owner decision/forward; reference composition supplies it to app code.
194
+ - A1 offline only; account/hosted-time/owner TEST evidence unclaimed; `communications/klaviyo` verification-pending.
195
+ - M05 omitted opt-ins preserve defaults/outputs/read order/schedules/refusals/acceptance-token bytes/SQL.
196
+ - Native inventory adjustment unavailable; address writes refuse readiness. Flat-rate save needs selected port/Core readiness/applied-seed observation.
197
+ - Native shipping audit unavailable; handler swallows best-effort audit failure.
198
+ - Native flat-rate integer bounds (0 through host maximum; reference 100,000 minor units) use request schema, not DB CHECK.
199
+ - Managed ATP/forecast/dated-supply/pagination readback unproved/pending M06.
200
+ - Managed two-session locks/concurrency/uncovered compensation unproved/pending M06.
201
+ - Managed exact-prefix upgrade/ledger unproved/pending M06.
202
+ - Managed address idempotency/conflict/readback unproved/pending M06.
203
+ - Managed successful flat-rate read/save unproved/pending host authority.
204
+ - M06 stock-wait lifecycle/durable timing/staging controls retain C5/C6; busy/try-gate, continuity/flag/TTL transfers are dispositions, not PASS.
205
+ - Shipping national-registry fields/locale-specific `canonicalAddressKey` fold await M16 host market pack/key migration; reference shipping copy stays locale-specific until M16.
206
+ - Native durable prepared storage, method setup, absence reopen and cumulative refunds unavailable; no production installation parity claimed.
207
+ - Typed refusal-envelope forwarding unavailable (`failureReason` only); reusable registration needs host ownership resolution.
208
+ - Incomplete chargebacks stay refunds/unapplied: reclassification bypasses evidence validation into dispute apply; limited operator recovery.
209
+ - Audit compatibility still detects `chargeId`; refund operation identity/original money supply no typed charge identity.
210
+ - M07 follow-up: repair poll can clear host redirect; post-timeout verify never restarts polling; unlocalized poller; fixture builds/never calls handler.
211
+ - M07 follow-up: reference status route wrong-rail witness.
212
+ - M07 follow-up: explicit reference-route refusal for unsupported method setup.
213
+ - M07 follow-up: deployment-neutral disabled-verify reason.
214
+ - M07 follow-up: reference card normalizer missing-amount path; package settling evidence already requires positive money.
215
+
216
+ - Native delivery alignment stays off or shadow until a host composes the native automatic-renewal runner with the G23 renewal admission decorator. The decorator alone neither composes nor activates the runner.
217
+ - The core fulfillment status map carries localized adopter labels; replace them with host-injected labels or internationalization keys at the host presentation boundary.
218
+ - The warehouse adapter example is opt-in and has offline conformance only; no provider-account proof or activation is established. Exact absence, label create/void and cancellation remain unsupported.
219
+ - After an alignment extension, a deferred renewal operation at the old schedule remains claimed with no reader or reservation effect. Changed terms snapshots conflict under the existing snapshot-conflict rules.
220
+
221
+ Native parity remains host-owned at these seams. Missing native bindings use the shared `FULFILLMENT_NATIVE_UNSUPPORTED` refusal; no partial write or parity claim is implied.
222
+
223
+ | Amendment | Host-owned seam and native boundary |
224
+ | --- | --- |
225
+ | G18 | Replacement creation and atomic eligibility/replay receipts; native replacement callback refuses. |
226
+ | G19 | Operator mutations, actor attribution and replay receipts; native mutation callbacks refuse. |
227
+ | G20 | Customer alignment rows; native reader refuses, while the pure delay projection remains callable. |
228
+ | G21 | Commerce list/detail and shipments overview; native read callbacks refuse. |
229
+ | G22 | Authoritative preparation edits, authorization and replay receipts; missing preparation binding refuses before dispatch, after disabled/selection/readiness checks. |
230
+
231
+ - M08 parity D2 KEEP-GAP: native dispatch finish still loses rejected/unknown error detail.
232
+ - M08 parity KEEP-GAP: immutable stock snapshot/alert evidence storage is absent; cursor JSON is overwritten. Hosts retain referenced evidence.
233
+ - Stock-evidence replay/reopen is CLOSED by native position 76; legacy `0.22.0` alert fingerprints still conflict with `23505`, including after resolution.
234
+
235
+ ## [0.22.0]
236
+
237
+ - Publishable on the npm `latest` dist-tag as `0.22.0`, from tag
238
+ `openlup-platform-v0.22.0`.
239
+
240
+ - Add eleven experimental reference-application support exports on the existing payment vendor subpaths. Reuse contributed execution, readback, mapping and diagnostic helpers; preserve the no-charge error class identity. Neutral payment exports and default activation remain unchanged.
241
+
242
+ Migration: none.
243
+
244
+ ### Opt-in warehouse fulfillment example
245
+
246
+ Add the experimental, opt-in warehouse fulfillment entry described in the README behind the frozen neutral fulfillment ports: explicit injected I/O, prepared-byte binding, closed evidence, token observations and positive readback. Default-off; account readiness is host-owned. Exact absence, label create/void and cancellation remain unsupported.
247
+
248
+ Missing or malformed evidence refuses before credential resolution or HTTP.
249
+
250
+ Migration: none
251
+
252
+ ### Offline warehouse fulfillment conformance
253
+
254
+ Prove the opt-in warehouse fulfillment entry described in the README with M08's offline conformance runner using injected
255
+ HTTP and synthetic fixtures. Cover dispatch replay and refusals, observation,
256
+ readback, stock and product sync, plus real-worker host-ledger fences after
257
+ restart and retention eviction. No provider-account or activation proof is claimed.
258
+
259
+ Migration: none
260
+
261
+ ### Fulfillment contracts and status canon
262
+
263
+ Add experimental `fulfillment` and type-only `fulfillment/contracts` entries with
264
+ contributed status decisions, strict core parser bindings, concrete provider/store
265
+ ports and injected default-off capabilities. No adapter, executor, route or default
266
+ profile is activated; existing reference integrations remain unchanged.
267
+
268
+ Declared adaptation: empty or absent provider selection is a typed refusal in the
269
+ new package, rather than the donor host's implicit simulator alias. The donor alias
270
+ remains an open owner follow-up; this contribution does not change donor logic.
271
+ Private provider trace columns and registry/environment values are excluded from
272
+ the neutral package; persisted command fingerprints and opaque host keys are retained.
273
+
274
+ Migration: none (new surface; no existing reference behavior changes).
275
+
276
+ ### Fulfillment paid handoff and fenced dispatch
277
+
278
+ Add the paid outbox handler/recovery classifier, injected dispatch worker and
279
+ separate durable command-ledger protocol through the new fulfillment entry.
280
+ Preserve one contact remap, opaque host keys, actual-command fingerprints,
281
+ readback/attempt/begin order and local accepted-proof repair without another POST.
282
+ Provider/money/inventory authority remains injected; no SQL, route or activation.
283
+
284
+ Approved port amendment G14 adds recordProviderAttempt to the new
285
+ FulfillmentStorePort. It records only sanitized prepared DispatchEvidence plus
286
+ mode/recorded status and opaque references, after authoritative claim readback;
287
+ same-key replay writes no second attempt and contact remap retains its own key.
288
+ No new named export or subpath is added by this method. Other contracts are unchanged.
289
+
290
+ Correctable draft re-claim must refresh fingerprint and evidence atomically.
291
+ Store conformance and native durability/fencing and SQL proofs remain later work.
292
+
293
+ Migration: none (new surface; contracts and orchestration land in one release).
294
+
295
+ ### Fulfillment observation and sync workers
296
+
297
+ Add neutral observation effects, verified ingress, observation reconciliation,
298
+ tracking, stock/product sync, read-only evidence handlers and the offline
299
+ runFulfillmentAdapterConformance at the existing fulfillment entry.
300
+
301
+ Migration: approved G15 extends the unreleased SyncCursor with optional
302
+ coverageGapSkus (legacy absence reads as []). Only consecutive succeeded runs
303
+ confirm a reservation coverage gap; running/failed cursors clear the set.
304
+ Migration: approved G16 changes readLocalInventoryStock(requestedAt) to typed
305
+ unaggregated lines with skuRef, quantity balances, fulfillable, locationStatus,
306
+ lotStatus and expiresAt. The worker filters/sums at the captured clock; expiry
307
+ exactly then is excluded. Inventory authority and the provider stock-sync shape
308
+ are unchanged.
309
+ Migration: approved G17 adds inline localPersistence: ingress records eventKey
310
+ receipts preserving firstReceivedAt and marks processing idempotently;
311
+ reconciliation reads local status/latestStatusOccurredAt/handedOverAt. No named
312
+ persistence type is exported. Durable replay and processing remain host obligations.
313
+ A superseding conflict returns superseded but persists only processed status,
314
+ without a dedicated superseded-reason field.
315
+
316
+ Correlated ingress requires a nonblank observation or dispatch external reference
317
+ before acceptance/status/effects/processed mark; failure leaves the receipt
318
+ unprocessed. Stock-contention annotation is best-effort before the original stock
319
+ failure is rethrown; recovered-picked receipt diagnostics remain typed. Effects
320
+ retain stock → handover → tracking → invoice and callback/throw order.
321
+ Reconciliation fails the run on unknown readback and projects unmapped correlation
322
+ evidence before host calls. Product evidence reads retain safe authorization/read
323
+ refusal detail. Private codecs, keys, carrier URLs and provider errors stay
324
+ host-owned; typed evidence replaces raw payload pass-through. The conformance
325
+ runner accepts adapter-owned offline subjects and returns sanitized evidence;
326
+ fixture checks do not establish durable store atomicity or arrival alignment.
327
+
328
+ ### Fulfillment native persistence and delivery alignment
329
+
330
+ Add native shipment, evidence, stock, recovery, dispatch, paid-handoff and
331
+ alignment stores through the existing fulfillment entry. Sparse migration
332
+ projections bind native units 5/27/51/73/74; install the complete catalogue.
333
+ Coverage-gap cursor state and received/status/processed evidence are
334
+ durable, while local inventory lines and contact preparation remain explicit
335
+ host inputs. Native 3pl acceptance uses a dispatch evidence receipt and preserves
336
+ the cancellation fence without inventing an owned label or physical packing.
337
+
338
+ Native admission: overdue-delivery admission guards only NEW cycle
339
+ admission/insert, matching the donor's guard_cycle_insert. Existing-cycle retries
340
+ through renewal operations and dunning bypass admission and neither mint nor
341
+ consume a one-use receipt. No retry_scheduled state or payments lifecycle change is
342
+ introduced. Native continuity requires the complete canonical migration graph,
343
+ real-PostgreSQL installation, replay and access-control checks.
344
+
345
+ ### Fulfillment operator lifecycle and customer delay projection
346
+
347
+ Add host-owned operator and replacement handlers through the fulfillment entry.
348
+ Mutation callbacks require actor attribution and idempotency keys; the host owns
349
+ atomic replay receipts and replacement eligibility, reservation and hold effects.
350
+ Native bindings return a shared typed unsupported refusal without writing.
351
+ Customer delay projection keeps absent cases distinct, hides aligned history
352
+ when the schedule advances and never presents manual review as protection.
353
+ Label helpers preserve transient downloads and cleanup uncertainty. Current
354
+ parcel helpers retain sequence selection and companion attribution. These
355
+ exports mount no route, dispatch no parcel and attest no replacement arrival.
356
+
357
+ ### Fulfillment commerce reads and recorded progress
358
+
359
+ Add host-owned commerce list/detail projections, a shipments overview handler and
360
+ typed read callbacks. Projected payment status passes through unchanged and
361
+ native reads return the shared unsupported refusal. Preserve opaque host overview
362
+ buckets and the legacy shipment-status facade. Progress completion requires
363
+ recorded milestones and uses the host-resolved customer step.
364
+
365
+ ### Fulfillment internal simplification
366
+
367
+ Reuse the empty stock-balance constructor in aggregation and sync, and append to
368
+ private recovery groups without copying each growing array. Fulfillment results,
369
+ public contracts, key bytes and effect order remain unchanged.
370
+
371
+ ### Fulfillment service composition and preparation
372
+
373
+ Add explicit default-off fulfillment services, a structural contribution and an
374
+ inert reference preparation binding. Authoritative source edits and redacted
375
+ context synchronization share the native dispatch and shipment locks. Missing
376
+ preparation refuses readiness. No route, schedule, renewal wrapper or automatic
377
+ dispatch is activated.
378
+
379
+ ### Fulfillment presentation ownership
380
+
381
+ The status canon, actual-evidence tracking progress, current-parcel selection and
382
+ canonical fact parsers belong to `@openlup/core/fulfillment`. Platform keeps thin
383
+ compatibility re-exports and preserves its existing narrowed fact type names.
384
+ Fulfillment contracts re-export the shared status and progress types from core.
385
+ Server orchestration remains in platform. Browser code, including the host
386
+ status, fact and current-parcel facades and the account order views, imports
387
+ these helpers from core, so no browser graph loads the platform fulfillment
388
+ runtime.
389
+
390
+ Migration: existing platform imports remain valid; no application or schema
391
+ migration is required. Core exposes narrowed fact aliases with a `Canonical`
392
+ prefix while its generic fact exports retain their names.
393
+
394
+ Migration: upgrade core, outbox and platform together from `0.21.0` to `0.22.0` for exact peer pins. Install the complete canonical native migration chain through units 73/74 (`20261022080000_fulfillment_command_ledger.sql` and `20261022090000_fulfillment_delivery_alignment.sql`), never the sparse package projections alone. Before, these fulfillment services were host-owned; after, explicitly compose selected ports and default-off services. Nothing mounts routes, schedules dispatch or composes the native renewal runner automatically. Keep native alignment off or shadow until the G23 decorator is composed. Arrival alignment remains once and later-only; undelivered replacements remain outstanding, and replacement confirmation must only record actual customer arrival. Preserve G15–G17 cursor, receipt and local-status persistence when implementing host stores. An application rollback does not reverse the forward migrations; older runners refuse the extended ledger.
395
+
396
+ ### Known limitations
397
+
398
+ - Portable dunning repair has no managed twin: exhaustion still pauses active subscriptions there; retaining active status needs a managed forward.
399
+ - D8-1: native advisory v2 promo-code candidates/rejection details unavailable.
400
+ - D8-2: native mounted v2 issue/honor/fallback unavailable.
401
+ - D8-3: native acquisition-only mounted issuance/honor unavailable.
402
+ - D8-4: full native/managed eligibility equivalence unavailable.
403
+ - Bundle-1: independent DB human-only actor-kind enforcement absent natively; first in the native-backend parity round.
404
+ - Bundle-2: managed-equivalent actor-kind/email history absent natively.
405
+ - Bundle-3 closes injected-reader M05 mounted admin/feed readback only. Native new-purchase stock read absent despite P5a installed-store proof; deferred second after bundle-1 (owner 2026-10-21); readiness refuses.
406
+ - Bundle-4: incumbent real-PostgreSQL contention only; no exactly-once guarantee.
407
+ - Managed schema/pgTAP retain `44.404`; removal needs owner decision/forward; reference composition supplies it to app code.
408
+ - A1 offline only; account/hosted-time/owner TEST evidence unclaimed; `communications/klaviyo` verification-pending.
409
+ - M05 omitted opt-ins preserve defaults/outputs/read order/schedules/refusals/acceptance-token bytes/SQL.
410
+ - Native inventory adjustment unavailable; address writes refuse readiness. Flat-rate save needs selected port/Core readiness/applied-seed observation.
411
+ - Native shipping audit unavailable; handler swallows best-effort audit failure.
412
+ - Native flat-rate integer bounds (0 through host maximum; reference 100,000 minor units) use request schema, not DB CHECK.
413
+ - Managed ATP/forecast/dated-supply/pagination readback unproved/pending M06.
414
+ - Managed two-session locks/concurrency/uncovered compensation unproved/pending M06.
415
+ - Managed exact-prefix upgrade/ledger unproved/pending M06.
416
+ - Managed address idempotency/conflict/readback unproved/pending M06.
417
+ - Managed successful flat-rate read/save unproved/pending host authority.
418
+ - M06 stock-wait lifecycle/durable timing/staging controls retain C5/C6; busy/try-gate, continuity/flag/TTL transfers are dispositions, not PASS.
419
+ - Shipping national-registry fields/locale-specific `canonicalAddressKey` fold await M16 host market pack/key migration; reference shipping copy stays locale-specific until M16.
420
+ - Native durable prepared storage, method setup, absence reopen and cumulative refunds unavailable; no production installation parity claimed.
421
+ - Typed refusal-envelope forwarding unavailable (`failureReason` only); reusable registration needs host ownership resolution.
422
+ - Incomplete chargebacks stay refunds/unapplied: reclassification bypasses evidence validation into dispute apply; limited operator recovery.
423
+ - Audit compatibility still detects `chargeId`; refund operation identity/original money supply no typed charge identity.
424
+ - M07 follow-up: repair poll can clear host redirect; post-timeout verify never restarts polling; unlocalized poller; fixture builds/never calls handler.
425
+ - M07 follow-up: reference status route wrong-rail witness.
426
+ - M07 follow-up: explicit reference-route refusal for unsupported method setup.
427
+ - M07 follow-up: deployment-neutral disabled-verify reason.
428
+ - M07 follow-up: reference card normalizer missing-amount path; package settling evidence already requires positive money.
429
+
430
+ - Native delivery alignment stays off or shadow until a host composes the native automatic-renewal runner with the G23 renewal admission decorator. The decorator alone neither composes nor activates the runner.
431
+ - The core fulfillment status map carries localized adopter labels; replace them with host-injected labels or internationalization keys before any stable-framework claim.
432
+ - The warehouse adapter example is opt-in and has offline conformance only; no provider-account proof or activation is established. Exact absence, label create/void and cancellation remain unsupported.
433
+ - After an alignment extension, a deferred renewal operation at the old schedule remains claimed with no reader or reservation effect. Changed terms snapshots conflict under the existing snapshot-conflict rules.
434
+
435
+ Native parity remains host-owned at these seams. Missing native bindings use the shared `FULFILLMENT_NATIVE_UNSUPPORTED` refusal; no partial write or parity claim is implied.
436
+
437
+ | Amendment | Host-owned seam and native boundary |
438
+ | --- | --- |
439
+ | G18 | Replacement creation and atomic eligibility/replay receipts; native replacement callback refuses. |
440
+ | G19 | Operator mutations, actor attribution and replay receipts; native mutation callbacks refuse. |
441
+ | G20 | Customer alignment rows; native reader refuses, while the pure delay projection remains callable. |
442
+ | G21 | Commerce list/detail and shipments overview; native read callbacks refuse. |
443
+ | G22 | Authoritative preparation edits, authorization and replay receipts; missing preparation binding refuses before dispatch, after disabled/selection/readiness checks. |
444
+
13
445
  ## [0.21.0]
14
446
 
15
447
  - Publishable on the npm `latest` dist-tag as `0.21.0`, from tag
@@ -68,149 +500,3 @@ Migration: D11 changes every caller of the reference payment control port (the s
68
500
  - M07 follow-up: explicit reference-route refusal for unsupported method setup.
69
501
  - M07 follow-up: deployment-neutral disabled-verify reason.
70
502
  - M07 follow-up: reference card normalizer missing-amount path; package settling evidence already requires positive money.
71
-
72
- ## [0.20.0]
73
-
74
- - Publishable on the npm `latest` dist-tag as `0.20.0`, from tag
75
- `openlup-platform-v0.20.0`.
76
-
77
- - Refresh release size-gate baselines from the published `0.19.0` tarballs; all caps remain unchanged.
78
-
79
- - Keep active subscriptions active on portable dunning exhaustion (invariant repair).
80
-
81
- Migration: apply the complete portable catalogue through
82
- `20261021120000_dunning_lifecycle_active_repair.sql` at position 71. Previously,
83
- NULL next retry expired the case and paused an active subscription; it now leaves
84
- the case open and repairable, retains the final notice and exhaustion event, and
85
- changes no subscription or cycle dates. Existing rows are not rewritten. Pass
86
- NULL only when `isDunningLadderExhausted` holds; a class-terminated rung-one refusal
87
- still must not be passed as NULL. There is no managed twin yet; the managed
88
- baseline still needs a separate forward.
89
-
90
- - Add the readiness-gated native flat-rate binding; the host supplies the named
91
- role-free lane and fixed-key rate port, as in the reference composition.
92
- - Require the native port and Core readiness for the shipping seed migration.
93
- - Refuse missing-row saves; native audit remains explicitly unsupported and best effort.
94
-
95
- Migration:
96
- Apply the complete portable chain through 20261021200000_shipping_flat_rate_seed.
97
- The seed preserves an existing rate and inserts zero only when absent; no ACL or
98
- role changes are made. New code on an unmigrated schema keeps refusing. Older code
99
- reads the seeded zero as it read an absent row. An application rollback does not reverse either forward
100
- (positions 71 and 72), and older runners refuse the extended ledger.
101
- Managed host-save authority remains pending.
102
-
103
- - Add the shipping `SHIPPING_MIGRATIONS` export and the optional
104
- `nativeRateReadiness` / `nativeRateSchema` binding dependencies.
105
-
106
- Migration: upgrade the complete `@openlup/*` set from `0.19.0` to `0.20.0`
107
- for exact internal pins. Native rate bindings require the selected port plus
108
- Core readiness and a same-database schema observation of the applied seed.
109
- Install the complete canonical migration catalogue, never sparse package
110
- projections as an installation chain.
111
-
112
- ### Cumulative M06 status
113
-
114
- - M06 remains incomplete: inventory and shipping are development-preview
115
- surfaces, with managed-host proof classes pending.
116
- - Inventory and shipping contracts, stock/ATP reads, reserve/release/expire
117
- operations, subscription forecasts, delivery selection, address and flat-rate
118
- handlers first shipped in `0.18.0`. Opt-in inventory/shipping/composition
119
- bindings (P5a/P5b) first shipped in `0.19.0`. M06's only new behaviour in
120
- `0.20.0` is native flat-rate save behind readiness; the portable dunning
121
- invariant repair is separate from M06. Host-owned policy and unsupported
122
- operations retain their explicit boundaries.
123
-
124
- ### Known limitations
125
-
126
- - The portable dunning invariant repair has no managed twin in this set. The
127
- managed baseline pauses active subscriptions on exhaustion; keeping them active
128
- requires a separate managed forward. Portable proof does not establish managed parity.
129
-
130
- - D8-1: native advisory v2 promo-code candidates and rejection details are not supported on the native backend.
131
- - D8-2: native mounted v2 code issue/honor/fallback is not supported on the native backend.
132
- - D8-3: acquisition-only mounted issuance/honor is not supported on the native backend.
133
- - D8-4: full native/managed eligibility equivalence is not supported on the native backend.
134
- - Bundle-1: independent database human-only actor-kind enforcement is not supported on the native backend and is the first item of a future native-backend parity round.
135
- - Bundle-2: managed-equivalent actor-kind/email history is not supported on the native backend.
136
- - Bundle-3 remains closed for M05 mounted admin/feed readback with an injected stock reader, while native new-purchase stock reads remain unsupported despite P5a's installed native inventory-store read proof.
137
- - Bundle-4 establishes only incumbent real-PostgreSQL contention characterization and provides no exactly-once guarantee.
138
- - The managed baseline schema and its pgTAP tests retain the incumbent legacy value `44.404`; removing it needs a forward migration and an owner decision, while reference composition supplies that value to application code.
139
- - A1 evidence is offline only: account verification, hosted-time behaviour and owner TEST certification are not claimed, and the `communications/klaviyo` adapter's capabilities stay verification-pending.
140
- - M05 parity seams are opt-in and omitted bindings preserve incumbent defaults, outputs, read order, scheduling, refusals, acceptance-token bytes and exported SQL.
141
- - Native inventory adjustment remains unsupported; native address writes refuse
142
- required-capability readiness. Native flat-rate save is supported only behind
143
- the selected port, Core readiness and applied-seed schema observation.
144
- - Native new-purchase stock read is deferred to the native-backend parity round
145
- (owner 2026-10-21), second after M05 bundle-1; required readiness still refuses
146
- honestly.
147
- - Native shipping-rate save has no durable audit: audit is explicitly unsupported,
148
- and the incumbent handler swallows the best-effort audit failure.
149
- - Native flat-rate value bounds (integer, 0 <= value <= the host request schema's
150
- maximum) are enforced by that schema, not a database CHECK; the reference
151
- maximum is 100,000 minor units.
152
- - Managed host ATP/forecast/dated-supply/pagination readback is not proved and
153
- remains pending in the M06 ledger; no managed-host parity is claimed.
154
- - Managed two-session lock order/concurrency and uncovered compensation paths
155
- are not proved on a managed host and remain pending; no equivalence is claimed.
156
- - Managed exact-prefix upgrade/ledger is not proved on a managed host and remains
157
- pending; no managed installation equivalence is claimed.
158
- - Managed address adapter idempotency/conflict/readback is not proved on a managed
159
- host and remains pending; no fixture-to-host equivalence is claimed.
160
- - Managed successful flat-rate read/save remains pending host authority and is
161
- not proved on a managed host; no successful managed host-save claim is made.
162
- - M06 adopter stock-wait lifecycle, durable subscription timing and staging
163
- control observations retain their separate C5/C6 evidence gates. Busy/try-gate
164
- protocol, durable stock-wait continuity and staging flag/TTL rows transferred
165
- to C5 adopter evidence are dispositions, not PASS.
166
- - Shipping contracts retain national-registry address fields and
167
- `canonicalAddressKey` retains a locale-specific character fold. M16 owns their
168
- move behind a host-supplied market pack with a canonical-key migration plan.
169
- - Reference shipping UI copy remains locale-specific until M16.
170
-
171
- ## [0.19.0]
172
-
173
- - Publishable on the npm `latest` dist-tag as `0.19.0`, from tag
174
- `openlup-platform-v0.19.0`.
175
-
176
- ### 0.18.0 → 0.19.0 set scope
177
-
178
- - Prepare the complete development-preview minor set at `0.19.0`, including everything on main since `0.18.0`; core and outbox are unchanged republications, and UI stays private `0.0.0`.
179
- - M05 parity adds opt-in shipping-promise consent, post-discount threshold shipping and acquisition orchestration to the experimental pricing, promotions and shipping entries; financial policy and acquisition capability remain host supplied.
180
- - M05 parity adds effective native bundle selection and an authoritative preview hook, optional resolved-target/detail/feed context fields and `selectEffectiveBundleTargetPrice`; effective feeds require unambiguous gross unit anchors and whole-BOM readiness.
181
- - Add `createConcurrentCommercePriceAuthorityPort` with concurrent history scheduling, selected-list identity and base-refusal precedence; browser additions are type-only.
182
- - Catalog/contracts draft canonical JSON detects lone surrogates without regex lookbehind so it loads in Safari before 16.4, with unchanged behavior.
183
- - M06 P5a adds explicit inventory store/provider bindings and structural inventory contribution, keeping reference catalog-stock composition inert and managed authorization intact; native new-purchase stock reads remain unsupported pending an owner decision and native adjustment still refuses.
184
- - M06 P5a retains focused installed-consumer, runtime-role, managed FEFO/adjustment and consume/refund replay evidence with unproved parity gates retained in the M06 ledger.
185
- - M06 P5b adds opt-in shipping selection, address and flat-rate bindings with injected validation and authority; native address writes remain unsupported and refuse required readiness.
186
- - M06 P5b adds the final isolated installed inventory/shipping consumer, preserving incumbent selection errors and flat-rate behavior.
187
- - M06 in progress: inventory and shipping entries are early surfaces; module not complete
188
- - Supporting main changes sort platform registration lists one item per line and use the database clock in the M05 P7 quote witness; neither adds runtime behavior.
189
-
190
- Migration: upgrade the complete `@openlup/*` set from `0.18.0` to `0.19.0` for exact internal pins; existing bindings need no change and new module adoption remains explicit and experimental. Hosts selecting shipping promises must forward `shippingTerms` through both acceptance callbacks and use a context schema that preserves the selected terms. Bind `resolveQuoteShippingPromotions` to the promotions factory to select the bounded two-pass threshold path; financial policy and acquisition capability remain host supplied. The additive APIs require a minor set and introduce no activation. For both M05 24b and M06 P5b, the pricing and promotions API reports reorder existing enum/union members because declaration emit order changed (24b follows the catalog-to-pricing import); no member is added, removed or changed and callers need no migration for that reorder. Install the complete canonical migration catalogue, never sparse package projections as an installation chain; this preparation adds no SQL migration.
191
-
192
- ### Known limitations
193
-
194
- - D8-1: native advisory v2 promo-code candidates and rejection details are not supported on the native backend.
195
- - D8-2: native mounted v2 code issue/honor/fallback is not supported on the native backend.
196
- - D8-3: acquisition-only mounted issuance/honor is not supported on the native backend.
197
- - D8-4: full native/managed eligibility equivalence is not supported on the native backend.
198
- - Bundle-1: independent database human-only actor-kind enforcement is not supported on the native backend and is the first item of a future native-backend parity round.
199
- - Bundle-2: managed-equivalent actor-kind/email history is not supported on the native backend.
200
- - Bundle-3 remains closed for M05 mounted admin/feed readback with an injected stock reader, while native new-purchase stock reads remain unsupported despite P5a's installed native inventory-store read proof.
201
- - Bundle-4 establishes only incumbent real-PostgreSQL contention characterization and provides no exactly-once guarantee.
202
- - The managed baseline schema and its pgTAP tests retain the incumbent legacy value `44.404`; removing it needs a forward migration and an owner decision, while reference composition supplies that value to application code.
203
- - A1 evidence is offline only: account verification, hosted-time behaviour and owner TEST certification are not claimed, and the `communications/klaviyo` adapter's capabilities stay verification-pending.
204
- - M05 parity seams are opt-in and omitted bindings preserve incumbent defaults, outputs, read order, scheduling, refusals, acceptance-token bytes and exported SQL.
205
- - Native inventory adjustment remains unsupported; native address writes and flat-rate saves refuse required-capability readiness.
206
- - M06 managed host ATP/forecast/supply/pagination, remaining compensation/concurrency/lock-order, exact-prefix upgrade/ledger, address idempotency/conflict/readback and runtime rate authority remain pending in the M06 ledger.
207
- - M06 adopter stock-wait lifecycle, durable subscription timing and staging control observations retain their separate C5/C6 evidence gates.
208
-
209
- ### Size note
210
-
211
- Only platform `pack.docs.maxPackedBytes` rises from 40,960 to 49,152 B; all other caps and budgets remain unchanged. All three baselines use integrity-verified published `0.18.0` tarballs.
212
-
213
- Question (2026-10-21): "The platform package's root docs (README + CHANGELOG) will exceed their 40,960 B gzip cap at the next release. What should we do?"
214
- Owner's answer: "Raise to 49,152 B (Recommended)"
215
- Option description shown to the owner: "Same figure as core. Unblocks the next few releases; the CHANGELOG grows every release, so this cap would otherwise block each one."
216
- Recorded as an owner decision taken through the coordinator's question on 2026-10-21.