@unifiedcommerce/core 0.0.1 → 0.0.2

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 (554) hide show
  1. package/dist/auth/access.d.ts +1 -1
  2. package/dist/auth/access.d.ts.map +1 -1
  3. package/dist/auth/auth-schema.js +3 -3
  4. package/dist/auth/middleware.d.ts +2 -2
  5. package/dist/auth/middleware.d.ts.map +1 -1
  6. package/dist/auth/middleware.js +37 -10
  7. package/dist/auth/org.js +1 -1
  8. package/dist/auth/permissions.d.ts +1 -1
  9. package/dist/auth/permissions.d.ts.map +1 -1
  10. package/dist/auth/permissions.js +1 -1
  11. package/dist/auth/setup.d.ts +19 -10
  12. package/dist/auth/setup.d.ts.map +1 -1
  13. package/dist/auth/setup.js +3 -4
  14. package/dist/auth/system-actor.d.ts +1 -1
  15. package/dist/auth/system-actor.d.ts.map +1 -1
  16. package/dist/auth/system-actor.js +1 -1
  17. package/dist/config/defaults.d.ts +1 -1
  18. package/dist/config/defaults.d.ts.map +1 -1
  19. package/dist/config/define-config.d.ts +1 -1
  20. package/dist/config/define-config.d.ts.map +1 -1
  21. package/dist/config/define-config.js +2 -2
  22. package/dist/config/types.d.ts +11 -11
  23. package/dist/config/types.d.ts.map +1 -1
  24. package/dist/hooks/checkout-completion.d.ts +2 -2
  25. package/dist/hooks/checkout-completion.d.ts.map +1 -1
  26. package/dist/hooks/checkout-completion.js +2 -2
  27. package/dist/hooks/checkout.d.ts +3 -3
  28. package/dist/hooks/checkout.d.ts.map +1 -1
  29. package/dist/hooks/checkout.js +3 -3
  30. package/dist/hooks/order-emails.d.ts +1 -1
  31. package/dist/hooks/order-emails.d.ts.map +1 -1
  32. package/dist/index.d.ts +81 -81
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +50 -13381
  35. package/dist/interfaces/mcp/context-enrichment.d.ts +2 -2
  36. package/dist/interfaces/mcp/context-enrichment.d.ts.map +1 -1
  37. package/dist/interfaces/mcp/context-enrichment.js +1 -1
  38. package/dist/interfaces/mcp/server.d.ts +2 -2
  39. package/dist/interfaces/mcp/server.d.ts.map +1 -1
  40. package/dist/interfaces/mcp/server.js +3 -3
  41. package/dist/interfaces/mcp/transport.d.ts +2 -2
  42. package/dist/interfaces/mcp/transport.d.ts.map +1 -1
  43. package/dist/interfaces/mcp/transport.js +1 -1
  44. package/dist/interfaces/rest/customer-portal.d.ts +2 -2
  45. package/dist/interfaces/rest/customer-portal.d.ts.map +1 -1
  46. package/dist/interfaces/rest/customer-portal.js +3 -3
  47. package/dist/interfaces/rest/index.d.ts +2 -2
  48. package/dist/interfaces/rest/index.d.ts.map +1 -1
  49. package/dist/interfaces/rest/index.js +13 -13
  50. package/dist/interfaces/rest/router.d.ts +1 -1
  51. package/dist/interfaces/rest/router.d.ts.map +1 -1
  52. package/dist/interfaces/rest/router.js +4 -4
  53. package/dist/interfaces/rest/routes/admin-jobs.d.ts +2 -2
  54. package/dist/interfaces/rest/routes/admin-jobs.d.ts.map +1 -1
  55. package/dist/interfaces/rest/routes/admin-jobs.js +4 -4
  56. package/dist/interfaces/rest/routes/audit.d.ts +2 -2
  57. package/dist/interfaces/rest/routes/audit.d.ts.map +1 -1
  58. package/dist/interfaces/rest/routes/audit.js +3 -3
  59. package/dist/interfaces/rest/routes/carts.d.ts +2 -2
  60. package/dist/interfaces/rest/routes/carts.d.ts.map +1 -1
  61. package/dist/interfaces/rest/routes/carts.js +2 -2
  62. package/dist/interfaces/rest/routes/catalog.d.ts +2 -2
  63. package/dist/interfaces/rest/routes/catalog.d.ts.map +1 -1
  64. package/dist/interfaces/rest/routes/catalog.js +2 -2
  65. package/dist/interfaces/rest/routes/checkout.d.ts +2 -2
  66. package/dist/interfaces/rest/routes/checkout.d.ts.map +1 -1
  67. package/dist/interfaces/rest/routes/checkout.js +7 -7
  68. package/dist/interfaces/rest/routes/inventory.d.ts +2 -2
  69. package/dist/interfaces/rest/routes/inventory.d.ts.map +1 -1
  70. package/dist/interfaces/rest/routes/inventory.js +2 -2
  71. package/dist/interfaces/rest/routes/media.d.ts +2 -2
  72. package/dist/interfaces/rest/routes/media.d.ts.map +1 -1
  73. package/dist/interfaces/rest/routes/media.js +2 -2
  74. package/dist/interfaces/rest/routes/orders.d.ts +2 -2
  75. package/dist/interfaces/rest/routes/orders.d.ts.map +1 -1
  76. package/dist/interfaces/rest/routes/orders.js +2 -2
  77. package/dist/interfaces/rest/routes/payments.d.ts +2 -2
  78. package/dist/interfaces/rest/routes/payments.d.ts.map +1 -1
  79. package/dist/interfaces/rest/routes/payments.js +2 -2
  80. package/dist/interfaces/rest/routes/pricing.d.ts +2 -2
  81. package/dist/interfaces/rest/routes/pricing.d.ts.map +1 -1
  82. package/dist/interfaces/rest/routes/pricing.js +2 -2
  83. package/dist/interfaces/rest/routes/promotions.d.ts +2 -2
  84. package/dist/interfaces/rest/routes/promotions.d.ts.map +1 -1
  85. package/dist/interfaces/rest/routes/promotions.js +3 -3
  86. package/dist/interfaces/rest/routes/search.d.ts +2 -2
  87. package/dist/interfaces/rest/routes/search.d.ts.map +1 -1
  88. package/dist/interfaces/rest/routes/search.js +2 -2
  89. package/dist/interfaces/rest/routes/webhooks.d.ts +2 -2
  90. package/dist/interfaces/rest/routes/webhooks.d.ts.map +1 -1
  91. package/dist/interfaces/rest/routes/webhooks.js +2 -2
  92. package/dist/interfaces/rest/schemas/admin-jobs.js +1 -1
  93. package/dist/interfaces/rest/schemas/carts.d.ts +1 -1
  94. package/dist/interfaces/rest/schemas/carts.d.ts.map +1 -1
  95. package/dist/interfaces/rest/schemas/carts.js +3 -3
  96. package/dist/interfaces/rest/schemas/catalog.js +3 -3
  97. package/dist/interfaces/rest/schemas/checkout.js +1 -1
  98. package/dist/interfaces/rest/schemas/customer-portal.js +2 -2
  99. package/dist/interfaces/rest/schemas/inventory.d.ts +1 -1
  100. package/dist/interfaces/rest/schemas/inventory.d.ts.map +1 -1
  101. package/dist/interfaces/rest/schemas/inventory.js +2 -2
  102. package/dist/interfaces/rest/schemas/media.js +1 -1
  103. package/dist/interfaces/rest/schemas/orders.js +2 -2
  104. package/dist/interfaces/rest/schemas/pricing.d.ts +1 -1
  105. package/dist/interfaces/rest/schemas/pricing.d.ts.map +1 -1
  106. package/dist/interfaces/rest/schemas/pricing.js +2 -2
  107. package/dist/interfaces/rest/schemas/promotions.d.ts +1 -1
  108. package/dist/interfaces/rest/schemas/promotions.d.ts.map +1 -1
  109. package/dist/interfaces/rest/schemas/promotions.js +2 -2
  110. package/dist/interfaces/rest/schemas/responses.js +5 -5
  111. package/dist/interfaces/rest/schemas/search.js +1 -1
  112. package/dist/interfaces/rest/schemas/webhooks.js +1 -1
  113. package/dist/interfaces/rest/utils.d.ts +2 -2
  114. package/dist/interfaces/rest/utils.d.ts.map +1 -1
  115. package/dist/interfaces/rest/utils.js +2 -2
  116. package/dist/interfaces/rest/webhook-router.d.ts +1 -1
  117. package/dist/interfaces/rest/webhook-router.d.ts.map +1 -1
  118. package/dist/kernel/compensation/executor.d.ts +2 -2
  119. package/dist/kernel/compensation/executor.d.ts.map +1 -1
  120. package/dist/kernel/compensation/types.d.ts +3 -3
  121. package/dist/kernel/compensation/types.d.ts.map +1 -1
  122. package/dist/kernel/database/drizzle-db.d.ts +1 -1
  123. package/dist/kernel/database/drizzle-db.d.ts.map +1 -1
  124. package/dist/kernel/database/drizzle-db.js +1 -1
  125. package/dist/kernel/database/migrate.d.ts +2 -2
  126. package/dist/kernel/database/migrate.d.ts.map +1 -1
  127. package/dist/kernel/database/migrate.js +1 -1
  128. package/dist/kernel/database/schema.d.ts +13 -13
  129. package/dist/kernel/database/schema.d.ts.map +1 -1
  130. package/dist/kernel/database/schema.js +13 -13
  131. package/dist/kernel/database/tx-context.d.ts +2 -2
  132. package/dist/kernel/database/tx-context.d.ts.map +1 -1
  133. package/dist/kernel/error-mapper.js +1 -1
  134. package/dist/kernel/factory/repository-factory.d.ts +2 -2
  135. package/dist/kernel/factory/repository-factory.d.ts.map +1 -1
  136. package/dist/kernel/factory/repository-factory.js +1 -1
  137. package/dist/kernel/hooks/create-context.d.ts +4 -4
  138. package/dist/kernel/hooks/create-context.d.ts.map +1 -1
  139. package/dist/kernel/hooks/create-context.js +1 -1
  140. package/dist/kernel/hooks/executor.d.ts +1 -1
  141. package/dist/kernel/hooks/executor.d.ts.map +1 -1
  142. package/dist/kernel/hooks/types.d.ts +3 -3
  143. package/dist/kernel/hooks/types.d.ts.map +1 -1
  144. package/dist/kernel/http-error.d.ts +1 -1
  145. package/dist/kernel/http-error.d.ts.map +1 -1
  146. package/dist/kernel/jobs/drizzle-adapter.d.ts +3 -3
  147. package/dist/kernel/jobs/drizzle-adapter.d.ts.map +1 -1
  148. package/dist/kernel/jobs/drizzle-adapter.js +2 -2
  149. package/dist/kernel/jobs/runner.d.ts +3 -3
  150. package/dist/kernel/jobs/runner.d.ts.map +1 -1
  151. package/dist/kernel/jobs/runner.js +1 -1
  152. package/dist/kernel/jobs/schema.js +1 -1
  153. package/dist/kernel/jobs/types.d.ts +2 -2
  154. package/dist/kernel/jobs/types.d.ts.map +1 -1
  155. package/dist/kernel/local-api.d.ts +21 -21
  156. package/dist/kernel/local-api.d.ts.map +1 -1
  157. package/dist/kernel/plugin/manifest.d.ts +1 -1
  158. package/dist/kernel/plugin/manifest.d.ts.map +1 -1
  159. package/dist/kernel/query/executor.d.ts +1 -1
  160. package/dist/kernel/query/executor.d.ts.map +1 -1
  161. package/dist/kernel/query/executor.js +1 -1
  162. package/dist/kernel/result.d.ts +1 -1
  163. package/dist/kernel/result.d.ts.map +1 -1
  164. package/dist/kernel/state-machine/machine.js +1 -1
  165. package/dist/modules/analytics/drizzle-adapter.d.ts +3 -3
  166. package/dist/modules/analytics/drizzle-adapter.d.ts.map +1 -1
  167. package/dist/modules/analytics/drizzle-adapter.js +2 -2
  168. package/dist/modules/analytics/models.d.ts +1 -1
  169. package/dist/modules/analytics/models.d.ts.map +1 -1
  170. package/dist/modules/analytics/repository/index.d.ts +1 -1
  171. package/dist/modules/analytics/repository/index.d.ts.map +1 -1
  172. package/dist/modules/analytics/service.d.ts +4 -4
  173. package/dist/modules/analytics/service.d.ts.map +1 -1
  174. package/dist/modules/analytics/service.js +2 -2
  175. package/dist/modules/analytics/types.d.ts +1 -1
  176. package/dist/modules/analytics/types.d.ts.map +1 -1
  177. package/dist/modules/audit/hooks.d.ts +1 -1
  178. package/dist/modules/audit/hooks.d.ts.map +1 -1
  179. package/dist/modules/audit/schema.js +1 -1
  180. package/dist/modules/audit/service.d.ts +4 -4
  181. package/dist/modules/audit/service.d.ts.map +1 -1
  182. package/dist/modules/audit/service.js +2 -2
  183. package/dist/modules/cart/access.d.ts +2 -2
  184. package/dist/modules/cart/access.d.ts.map +1 -1
  185. package/dist/modules/cart/matcher.d.ts +1 -1
  186. package/dist/modules/cart/matcher.d.ts.map +1 -1
  187. package/dist/modules/cart/repository/index.d.ts +3 -3
  188. package/dist/modules/cart/repository/index.d.ts.map +1 -1
  189. package/dist/modules/cart/repository/index.js +1 -1
  190. package/dist/modules/cart/schema.js +2 -2
  191. package/dist/modules/cart/service.d.ts +10 -10
  192. package/dist/modules/cart/service.d.ts.map +1 -1
  193. package/dist/modules/cart/service.js +8 -8
  194. package/dist/modules/catalog/repository/index.d.ts +3 -3
  195. package/dist/modules/catalog/repository/index.d.ts.map +1 -1
  196. package/dist/modules/catalog/repository/index.js +1 -1
  197. package/dist/modules/catalog/schema.js +1 -1
  198. package/dist/modules/catalog/service.d.ts +9 -9
  199. package/dist/modules/catalog/service.d.ts.map +1 -1
  200. package/dist/modules/catalog/service.js +8 -8
  201. package/dist/modules/customers/repository/index.d.ts +3 -3
  202. package/dist/modules/customers/repository/index.d.ts.map +1 -1
  203. package/dist/modules/customers/repository/index.js +1 -1
  204. package/dist/modules/customers/schema.js +1 -1
  205. package/dist/modules/customers/service.d.ts +4 -4
  206. package/dist/modules/customers/service.d.ts.map +1 -1
  207. package/dist/modules/customers/service.js +3 -3
  208. package/dist/modules/fulfillment/repository/index.d.ts +3 -3
  209. package/dist/modules/fulfillment/repository/index.d.ts.map +1 -1
  210. package/dist/modules/fulfillment/repository/index.js +1 -1
  211. package/dist/modules/fulfillment/schema.js +2 -2
  212. package/dist/modules/fulfillment/service.d.ts +6 -6
  213. package/dist/modules/fulfillment/service.d.ts.map +1 -1
  214. package/dist/modules/fulfillment/service.js +4 -4
  215. package/dist/modules/fulfillment/types.d.ts +2 -2
  216. package/dist/modules/fulfillment/types.d.ts.map +1 -1
  217. package/dist/modules/inventory/repository/index.d.ts +3 -3
  218. package/dist/modules/inventory/repository/index.d.ts.map +1 -1
  219. package/dist/modules/inventory/repository/index.js +1 -1
  220. package/dist/modules/inventory/schema.js +2 -2
  221. package/dist/modules/inventory/service.d.ts +9 -9
  222. package/dist/modules/inventory/service.d.ts.map +1 -1
  223. package/dist/modules/inventory/service.js +8 -8
  224. package/dist/modules/media/adapter.d.ts +1 -1
  225. package/dist/modules/media/adapter.d.ts.map +1 -1
  226. package/dist/modules/media/repository/index.d.ts +3 -3
  227. package/dist/modules/media/repository/index.d.ts.map +1 -1
  228. package/dist/modules/media/repository/index.js +1 -1
  229. package/dist/modules/media/schema.js +2 -2
  230. package/dist/modules/media/service.d.ts +6 -6
  231. package/dist/modules/media/service.d.ts.map +1 -1
  232. package/dist/modules/media/service.js +4 -4
  233. package/dist/modules/orders/repository/index.d.ts +3 -3
  234. package/dist/modules/orders/repository/index.d.ts.map +1 -1
  235. package/dist/modules/orders/repository/index.js +1 -1
  236. package/dist/modules/orders/schema.js +2 -2
  237. package/dist/modules/orders/service.d.ts +8 -8
  238. package/dist/modules/orders/service.d.ts.map +1 -1
  239. package/dist/modules/orders/service.js +9 -9
  240. package/dist/modules/orders/stale-order-cleanup.d.ts +1 -1
  241. package/dist/modules/orders/stale-order-cleanup.d.ts.map +1 -1
  242. package/dist/modules/orders/stale-order-cleanup.js +1 -1
  243. package/dist/modules/organization/service.d.ts +1 -1
  244. package/dist/modules/organization/service.d.ts.map +1 -1
  245. package/dist/modules/organization/service.js +1 -1
  246. package/dist/modules/payments/adapter.d.ts +1 -1
  247. package/dist/modules/payments/adapter.d.ts.map +1 -1
  248. package/dist/modules/payments/repository/index.d.ts +1 -1
  249. package/dist/modules/payments/repository/index.d.ts.map +1 -1
  250. package/dist/modules/payments/service.d.ts +3 -3
  251. package/dist/modules/payments/service.d.ts.map +1 -1
  252. package/dist/modules/payments/service.js +2 -2
  253. package/dist/modules/pricing/repository/index.d.ts +3 -3
  254. package/dist/modules/pricing/repository/index.d.ts.map +1 -1
  255. package/dist/modules/pricing/repository/index.js +1 -1
  256. package/dist/modules/pricing/schema.js +2 -2
  257. package/dist/modules/pricing/service.d.ts +7 -7
  258. package/dist/modules/pricing/service.d.ts.map +1 -1
  259. package/dist/modules/pricing/service.js +3 -3
  260. package/dist/modules/promotions/repository/index.d.ts +3 -3
  261. package/dist/modules/promotions/repository/index.d.ts.map +1 -1
  262. package/dist/modules/promotions/repository/index.js +1 -1
  263. package/dist/modules/promotions/schema.js +1 -1
  264. package/dist/modules/promotions/service.d.ts +8 -8
  265. package/dist/modules/promotions/service.d.ts.map +1 -1
  266. package/dist/modules/promotions/service.js +3 -3
  267. package/dist/modules/search/adapter.d.ts +1 -1
  268. package/dist/modules/search/adapter.d.ts.map +1 -1
  269. package/dist/modules/search/hooks.d.ts +1 -1
  270. package/dist/modules/search/hooks.d.ts.map +1 -1
  271. package/dist/modules/search/repository/index.d.ts +1 -1
  272. package/dist/modules/search/repository/index.d.ts.map +1 -1
  273. package/dist/modules/search/service.d.ts +4 -4
  274. package/dist/modules/search/service.d.ts.map +1 -1
  275. package/dist/modules/search/service.js +2 -2
  276. package/dist/modules/shipping/calculator.d.ts +3 -3
  277. package/dist/modules/shipping/calculator.d.ts.map +1 -1
  278. package/dist/modules/shipping/repository/index.d.ts +1 -1
  279. package/dist/modules/shipping/repository/index.d.ts.map +1 -1
  280. package/dist/modules/shipping/service.d.ts +5 -5
  281. package/dist/modules/shipping/service.d.ts.map +1 -1
  282. package/dist/modules/shipping/service.js +2 -2
  283. package/dist/modules/tax/adapter.d.ts +1 -1
  284. package/dist/modules/tax/adapter.d.ts.map +1 -1
  285. package/dist/modules/tax/repository/index.d.ts +1 -1
  286. package/dist/modules/tax/repository/index.d.ts.map +1 -1
  287. package/dist/modules/tax/service.d.ts +2 -2
  288. package/dist/modules/tax/service.d.ts.map +1 -1
  289. package/dist/modules/tax/service.js +2 -2
  290. package/dist/modules/webhooks/hook.d.ts +1 -1
  291. package/dist/modules/webhooks/hook.d.ts.map +1 -1
  292. package/dist/modules/webhooks/repository/index.d.ts +3 -3
  293. package/dist/modules/webhooks/repository/index.d.ts.map +1 -1
  294. package/dist/modules/webhooks/repository/index.js +1 -1
  295. package/dist/modules/webhooks/schema.js +1 -1
  296. package/dist/modules/webhooks/service.d.ts +4 -4
  297. package/dist/modules/webhooks/service.d.ts.map +1 -1
  298. package/dist/modules/webhooks/service.js +3 -3
  299. package/dist/modules/webhooks/tasks.d.ts +1 -1
  300. package/dist/modules/webhooks/tasks.d.ts.map +1 -1
  301. package/dist/modules/webhooks/tasks.js +1 -1
  302. package/dist/modules/webhooks/worker.d.ts +1 -1
  303. package/dist/modules/webhooks/worker.d.ts.map +1 -1
  304. package/dist/modules/webhooks/worker.js +2 -2
  305. package/dist/runtime/commerce.d.ts +9 -9
  306. package/dist/runtime/commerce.d.ts.map +1 -1
  307. package/dist/runtime/commerce.js +5 -5
  308. package/dist/runtime/kernel.d.ts +21 -21
  309. package/dist/runtime/kernel.d.ts.map +1 -1
  310. package/dist/runtime/kernel.js +41 -41
  311. package/dist/runtime/logger.d.ts +1 -1
  312. package/dist/runtime/logger.d.ts.map +1 -1
  313. package/dist/runtime/server.d.ts +6 -6
  314. package/dist/runtime/server.d.ts.map +1 -1
  315. package/dist/runtime/server.js +8 -6
  316. package/dist/runtime/shutdown.d.ts +1 -1
  317. package/dist/runtime/shutdown.d.ts.map +1 -1
  318. package/dist/test-utils/create-pglite-adapter.d.ts +2 -2
  319. package/dist/test-utils/create-pglite-adapter.d.ts.map +1 -1
  320. package/dist/test-utils/create-pglite-adapter.js +3 -3
  321. package/dist/test-utils/create-plugin-test-app.d.ts +3 -3
  322. package/dist/test-utils/create-plugin-test-app.d.ts.map +1 -1
  323. package/dist/test-utils/create-plugin-test-app.js +4 -4
  324. package/dist/test-utils/create-repository-test-harness.d.ts +2 -2
  325. package/dist/test-utils/create-repository-test-harness.d.ts.map +1 -1
  326. package/dist/test-utils/create-repository-test-harness.js +2 -2
  327. package/dist/test-utils/create-test-config.d.ts +1 -1
  328. package/dist/test-utils/create-test-config.d.ts.map +1 -1
  329. package/dist/test-utils/create-test-config.js +4 -4
  330. package/dist/test-utils/create-test-kernel.d.ts +2 -2
  331. package/dist/test-utils/create-test-kernel.d.ts.map +1 -1
  332. package/dist/test-utils/create-test-kernel.js +2 -2
  333. package/dist/test-utils/create-test-plugin-context.d.ts +2 -2
  334. package/dist/test-utils/create-test-plugin-context.d.ts.map +1 -1
  335. package/dist/test-utils/create-test-plugin-context.js +3 -3
  336. package/dist/test-utils/rest-api-test-utils.d.ts +4 -4
  337. package/dist/test-utils/rest-api-test-utils.d.ts.map +1 -1
  338. package/dist/test-utils/rest-api-test-utils.js +8 -8
  339. package/dist/test-utils/test-actors.d.ts +1 -1
  340. package/dist/test-utils/test-actors.d.ts.map +1 -1
  341. package/dist/test-utils/typed-hooks.d.ts +2 -2
  342. package/dist/test-utils/typed-hooks.d.ts.map +1 -1
  343. package/dist/types/commerce-types.d.ts +5 -5
  344. package/dist/types/commerce-types.d.ts.map +1 -1
  345. package/dist/utils/logger.d.ts +1 -1
  346. package/dist/utils/logger.d.ts.map +1 -1
  347. package/package.json +17 -9
  348. package/src/auth/access.ts +1 -1
  349. package/src/auth/auth-schema.ts +3 -3
  350. package/src/auth/middleware.ts +43 -14
  351. package/src/auth/org.ts +1 -1
  352. package/src/auth/permissions.ts +2 -2
  353. package/src/auth/setup.ts +18 -14
  354. package/src/auth/system-actor.ts +2 -2
  355. package/src/config/defaults.ts +1 -1
  356. package/src/config/define-config.ts +3 -3
  357. package/src/config/types.ts +11 -11
  358. package/src/hooks/checkout-completion.ts +4 -4
  359. package/src/hooks/checkout.ts +8 -8
  360. package/src/hooks/order-emails.ts +1 -1
  361. package/src/index.ts +83 -83
  362. package/src/interfaces/mcp/context-enrichment.ts +3 -3
  363. package/src/interfaces/mcp/server.ts +6 -6
  364. package/src/interfaces/mcp/transport.ts +3 -3
  365. package/src/interfaces/rest/customer-portal.ts +6 -6
  366. package/src/interfaces/rest/index.ts +15 -15
  367. package/src/interfaces/rest/router.ts +5 -5
  368. package/src/interfaces/rest/routes/admin-jobs.ts +5 -5
  369. package/src/interfaces/rest/routes/audit.ts +4 -4
  370. package/src/interfaces/rest/routes/carts.ts +4 -4
  371. package/src/interfaces/rest/routes/catalog.ts +5 -5
  372. package/src/interfaces/rest/routes/checkout.ts +11 -11
  373. package/src/interfaces/rest/routes/inventory.ts +3 -3
  374. package/src/interfaces/rest/routes/media.ts +4 -4
  375. package/src/interfaces/rest/routes/orders.ts +3 -3
  376. package/src/interfaces/rest/routes/payments.ts +3 -3
  377. package/src/interfaces/rest/routes/pricing.ts +3 -3
  378. package/src/interfaces/rest/routes/promotions.ts +4 -4
  379. package/src/interfaces/rest/routes/search.ts +3 -3
  380. package/src/interfaces/rest/routes/webhooks.ts +3 -3
  381. package/src/interfaces/rest/schemas/admin-jobs.ts +1 -1
  382. package/src/interfaces/rest/schemas/carts.ts +3 -3
  383. package/src/interfaces/rest/schemas/catalog.ts +3 -3
  384. package/src/interfaces/rest/schemas/checkout.ts +1 -1
  385. package/src/interfaces/rest/schemas/customer-portal.ts +2 -2
  386. package/src/interfaces/rest/schemas/inventory.ts +2 -2
  387. package/src/interfaces/rest/schemas/media.ts +1 -1
  388. package/src/interfaces/rest/schemas/orders.ts +2 -2
  389. package/src/interfaces/rest/schemas/pricing.ts +2 -2
  390. package/src/interfaces/rest/schemas/promotions.ts +2 -2
  391. package/src/interfaces/rest/schemas/responses.ts +5 -5
  392. package/src/interfaces/rest/schemas/search.ts +1 -1
  393. package/src/interfaces/rest/schemas/webhooks.ts +1 -1
  394. package/src/interfaces/rest/utils.ts +4 -4
  395. package/src/interfaces/rest/webhook-router.ts +1 -1
  396. package/src/kernel/compensation/executor.ts +2 -2
  397. package/src/kernel/compensation/types.ts +3 -3
  398. package/src/kernel/database/drizzle-db.ts +1 -1
  399. package/src/kernel/database/migrate.ts +2 -2
  400. package/src/kernel/database/schema.ts +13 -13
  401. package/src/kernel/database/tx-context.ts +2 -2
  402. package/src/kernel/error-mapper.ts +1 -1
  403. package/src/kernel/factory/repository-factory.ts +3 -3
  404. package/src/kernel/hooks/create-context.ts +5 -5
  405. package/src/kernel/hooks/executor.ts +1 -1
  406. package/src/kernel/hooks/types.ts +3 -3
  407. package/src/kernel/http-error.ts +1 -1
  408. package/src/kernel/jobs/drizzle-adapter.ts +5 -5
  409. package/src/kernel/jobs/runner.ts +4 -4
  410. package/src/kernel/jobs/schema.ts +1 -1
  411. package/src/kernel/jobs/types.ts +2 -2
  412. package/src/kernel/local-api.ts +4 -4
  413. package/src/kernel/plugin/manifest.ts +1 -1
  414. package/src/kernel/query/executor.ts +2 -2
  415. package/src/kernel/result.ts +1 -1
  416. package/src/kernel/state-machine/machine.ts +1 -1
  417. package/src/modules/analytics/drizzle-adapter.ts +4 -4
  418. package/src/modules/analytics/models.ts +1 -1
  419. package/src/modules/analytics/repository/index.ts +1 -1
  420. package/src/modules/analytics/service.ts +5 -5
  421. package/src/modules/analytics/types.ts +1 -1
  422. package/src/modules/audit/hooks.ts +3 -3
  423. package/src/modules/audit/schema.ts +1 -1
  424. package/src/modules/audit/service.ts +5 -5
  425. package/src/modules/cart/access.ts +2 -2
  426. package/src/modules/cart/matcher.ts +1 -1
  427. package/src/modules/cart/repository/index.ts +3 -3
  428. package/src/modules/cart/schema.ts +2 -2
  429. package/src/modules/cart/service.ts +17 -17
  430. package/src/modules/catalog/repository/index.ts +3 -3
  431. package/src/modules/catalog/schema.ts +1 -1
  432. package/src/modules/catalog/service.ts +16 -16
  433. package/src/modules/customers/repository/index.ts +3 -3
  434. package/src/modules/customers/schema.ts +1 -1
  435. package/src/modules/customers/service.ts +6 -6
  436. package/src/modules/fulfillment/repository/index.ts +3 -3
  437. package/src/modules/fulfillment/schema.ts +2 -2
  438. package/src/modules/fulfillment/service.ts +9 -9
  439. package/src/modules/fulfillment/types.ts +2 -2
  440. package/src/modules/inventory/repository/index.ts +3 -3
  441. package/src/modules/inventory/schema.ts +2 -2
  442. package/src/modules/inventory/service.ts +16 -16
  443. package/src/modules/media/adapter.ts +1 -1
  444. package/src/modules/media/repository/index.ts +3 -3
  445. package/src/modules/media/schema.ts +2 -2
  446. package/src/modules/media/service.ts +9 -9
  447. package/src/modules/orders/repository/index.ts +3 -3
  448. package/src/modules/orders/schema.ts +2 -2
  449. package/src/modules/orders/service.ts +15 -15
  450. package/src/modules/orders/stale-order-cleanup.ts +2 -2
  451. package/src/modules/organization/service.ts +2 -2
  452. package/src/modules/payments/adapter.ts +1 -1
  453. package/src/modules/payments/repository/index.ts +1 -1
  454. package/src/modules/payments/service.ts +3 -3
  455. package/src/modules/pricing/repository/index.ts +3 -3
  456. package/src/modules/pricing/schema.ts +2 -2
  457. package/src/modules/pricing/service.ts +9 -9
  458. package/src/modules/promotions/repository/index.ts +3 -3
  459. package/src/modules/promotions/schema.ts +1 -1
  460. package/src/modules/promotions/service.ts +10 -10
  461. package/src/modules/search/adapter.ts +1 -1
  462. package/src/modules/search/hooks.ts +2 -2
  463. package/src/modules/search/repository/index.ts +1 -1
  464. package/src/modules/search/service.ts +5 -5
  465. package/src/modules/shipping/calculator.ts +3 -3
  466. package/src/modules/shipping/repository/index.ts +1 -1
  467. package/src/modules/shipping/service.ts +5 -5
  468. package/src/modules/tax/adapter.ts +1 -1
  469. package/src/modules/tax/repository/index.ts +1 -1
  470. package/src/modules/tax/service.ts +3 -3
  471. package/src/modules/webhooks/hook.ts +1 -1
  472. package/src/modules/webhooks/repository/index.ts +3 -3
  473. package/src/modules/webhooks/schema.ts +1 -1
  474. package/src/modules/webhooks/service.ts +6 -6
  475. package/src/modules/webhooks/tasks.ts +3 -3
  476. package/src/modules/webhooks/worker.ts +3 -3
  477. package/src/runtime/commerce.ts +11 -11
  478. package/src/runtime/kernel.ts +45 -45
  479. package/src/runtime/logger.ts +1 -1
  480. package/src/runtime/server.ts +17 -13
  481. package/src/runtime/shutdown.ts +1 -1
  482. package/src/test-utils/create-pglite-adapter.ts +5 -5
  483. package/src/test-utils/create-plugin-test-app.ts +7 -7
  484. package/src/test-utils/create-repository-test-harness.ts +3 -3
  485. package/src/test-utils/create-test-config.ts +6 -6
  486. package/src/test-utils/create-test-kernel.ts +3 -3
  487. package/src/test-utils/create-test-plugin-context.ts +4 -4
  488. package/src/test-utils/rest-api-test-utils.ts +11 -11
  489. package/src/test-utils/test-actors.ts +1 -1
  490. package/src/test-utils/typed-hooks.ts +2 -2
  491. package/src/types/commerce-types.ts +5 -5
  492. package/src/utils/logger.ts +1 -1
  493. package/dist/auth/pos.d.ts +0 -3
  494. package/dist/auth/pos.d.ts.map +0 -1
  495. package/dist/auth/pos.js +0 -62
  496. package/dist/index.js.map +0 -156
  497. package/dist/interfaces/graphql/index.d.ts +0 -4
  498. package/dist/interfaces/graphql/index.d.ts.map +0 -1
  499. package/dist/interfaces/graphql/index.js +0 -415
  500. package/dist/kernel/factory/in-memory-repository-factory.d.ts +0 -20
  501. package/dist/kernel/factory/in-memory-repository-factory.d.ts.map +0 -1
  502. package/dist/kernel/factory/in-memory-repository-factory.js +0 -83
  503. package/dist/kernel/plugin/capability-registry.d.ts +0 -9
  504. package/dist/kernel/plugin/capability-registry.d.ts.map +0 -1
  505. package/dist/kernel/plugin/capability-registry.js +0 -28
  506. package/dist/kernel/plugin/dependency-graph.d.ts +0 -6
  507. package/dist/kernel/plugin/dependency-graph.d.ts.map +0 -1
  508. package/dist/kernel/plugin/dependency-graph.js +0 -55
  509. package/dist/modules/analytics/cubes.d.ts +0 -19
  510. package/dist/modules/analytics/cubes.d.ts.map +0 -1
  511. package/dist/modules/analytics/cubes.js +0 -187
  512. package/dist/modules/cart/repository/in-memory.d.ts +0 -30
  513. package/dist/modules/cart/repository/in-memory.d.ts.map +0 -1
  514. package/dist/modules/cart/repository/in-memory.js +0 -159
  515. package/dist/modules/catalog/repository/in-memory.d.ts +0 -82
  516. package/dist/modules/catalog/repository/in-memory.d.ts.map +0 -1
  517. package/dist/modules/catalog/repository/in-memory.js +0 -444
  518. package/dist/modules/customers/repository/in-memory.d.ts +0 -37
  519. package/dist/modules/customers/repository/in-memory.d.ts.map +0 -1
  520. package/dist/modules/customers/repository/in-memory.js +0 -278
  521. package/dist/modules/fulfillment/repository/in-memory.d.ts +0 -53
  522. package/dist/modules/fulfillment/repository/in-memory.d.ts.map +0 -1
  523. package/dist/modules/fulfillment/repository/in-memory.js +0 -327
  524. package/dist/modules/inventory/repository/in-memory.d.ts +0 -51
  525. package/dist/modules/inventory/repository/in-memory.d.ts.map +0 -1
  526. package/dist/modules/inventory/repository/in-memory.js +0 -281
  527. package/dist/modules/media/repository/in-memory.d.ts +0 -26
  528. package/dist/modules/media/repository/in-memory.d.ts.map +0 -1
  529. package/dist/modules/media/repository/in-memory.js +0 -145
  530. package/dist/modules/orders/repository/in-memory.d.ts +0 -40
  531. package/dist/modules/orders/repository/in-memory.d.ts.map +0 -1
  532. package/dist/modules/orders/repository/in-memory.js +0 -245
  533. package/dist/modules/pricing/repository/in-memory.d.ts +0 -25
  534. package/dist/modules/pricing/repository/in-memory.d.ts.map +0 -1
  535. package/dist/modules/pricing/repository/in-memory.js +0 -288
  536. package/dist/modules/promotions/repository/in-memory.d.ts +0 -32
  537. package/dist/modules/promotions/repository/in-memory.d.ts.map +0 -1
  538. package/dist/modules/promotions/repository/in-memory.js +0 -227
  539. package/dist/modules/webhooks/repository/in-memory.d.ts +0 -31
  540. package/dist/modules/webhooks/repository/in-memory.d.ts.map +0 -1
  541. package/dist/modules/webhooks/repository/in-memory.js +0 -187
  542. package/dist/runtime/state-manager.d.ts +0 -14
  543. package/dist/runtime/state-manager.d.ts.map +0 -1
  544. package/dist/runtime/state-manager.js +0 -84
  545. package/dist/runtime/state-repository.d.ts +0 -13
  546. package/dist/runtime/state-repository.d.ts.map +0 -1
  547. package/dist/runtime/state-repository.js +0 -160
  548. package/dist/runtime/state.d.ts +0 -382
  549. package/dist/runtime/state.d.ts.map +0 -1
  550. package/dist/runtime/state.js +0 -37
  551. package/dist/runtime/store.d.ts +0 -382
  552. package/dist/runtime/store.d.ts.map +0 -1
  553. package/dist/runtime/store.js +0 -37
  554. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,6 +1,6 @@
1
1
  import { index, integer, jsonb, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
2
- import { organization } from "../../auth/auth-schema";
3
- import { sellableEntities, variants } from "../catalog/schema";
2
+ import { organization } from "../../auth/auth-schema.js";
3
+ import { sellableEntities, variants } from "../catalog/schema.js";
4
4
 
5
5
  export const carts = pgTable("carts", {
6
6
  id: uuid("id").defaultRandom().primaryKey(),
@@ -1,39 +1,39 @@
1
- import { resolveOrgId } from "../../auth/org";
2
- import { assertOwnership, assertPermission } from "../../auth/permissions";
3
- import type { Actor } from "../../auth/types";
4
- import type { CommerceConfig } from "../../config/types";
1
+ import { resolveOrgId } from "../../auth/org.js";
2
+ import { assertOwnership, assertPermission } from "../../auth/permissions.js";
3
+ import type { Actor } from "../../auth/types.js";
4
+ import type { CommerceConfig } from "../../config/types.js";
5
5
  import {
6
6
  CommerceNotFoundError,
7
7
  CommerceValidationError,
8
8
  toCommerceError,
9
- } from "../../kernel/errors";
10
- import { runAfterHooks, runBeforeHooks } from "../../kernel/hooks/executor";
11
- import { createHookContext } from "../../kernel/hooks/create-context";
9
+ } from "../../kernel/errors.js";
10
+ import { runAfterHooks, runBeforeHooks } from "../../kernel/hooks/executor.js";
11
+ import { createHookContext } from "../../kernel/hooks/create-context.js";
12
12
  import type {
13
13
  AfterHook,
14
14
  BeforeHook,
15
15
  HookContext,
16
- } from "../../kernel/hooks/types";
17
- import type { HookRegistry } from "../../kernel/hooks/registry";
18
- import { Err, Ok, type Result } from "../../kernel/result";
19
- import { createLogger } from "../../utils/logger";
20
- import type { TxContext } from "../../kernel/database/tx-context";
21
- import { CartRepository, type Cart, type CartLineItem } from "./repository";
22
- import type { CatalogRepository } from "../catalog/repository";
16
+ } from "../../kernel/hooks/types.js";
17
+ import type { HookRegistry } from "../../kernel/hooks/registry.js";
18
+ import { Err, Ok, type Result } from "../../kernel/result.js";
19
+ import { createLogger } from "../../utils/logger.js";
20
+ import type { TxContext } from "../../kernel/database/tx-context.js";
21
+ import { CartRepository, type Cart, type CartLineItem } from "./repository/index.js";
22
+ import type { CatalogRepository } from "../catalog/repository/index.js";
23
23
 
24
24
  export type {
25
25
  CreateCartInput,
26
26
  AddCartItemInput,
27
27
  UpdateCartItemInput,
28
- } from "./schemas";
28
+ } from "./schemas.js";
29
29
 
30
30
  import type {
31
31
  CreateCartInput,
32
32
  AddCartItemInput,
33
33
  UpdateCartItemInput,
34
- } from "./schemas";
34
+ } from "./schemas.js";
35
35
 
36
- import { defaultCartItemMatcher, type CartItemMatcher } from "./matcher";
36
+ import { defaultCartItemMatcher, type CartItemMatcher } from "./matcher.js";
37
37
 
38
38
  export interface CartServiceDeps {
39
39
  repository: CartRepository;
@@ -1,9 +1,9 @@
1
1
  import { eq, and, inArray, type SQL } from "drizzle-orm";
2
- import type { TxContext } from "../../../kernel/database/tx-context";
2
+ import type { TxContext } from "../../../kernel/database/tx-context.js";
3
3
  import type {
4
4
  DrizzleDatabase,
5
5
  DbOrTx,
6
- } from "../../../kernel/database/drizzle-db";
6
+ } from "../../../kernel/database/drizzle-db.js";
7
7
  import {
8
8
  sellableEntities,
9
9
  sellableAttributes,
@@ -16,7 +16,7 @@ import {
16
16
  optionValues,
17
17
  variants,
18
18
  variantOptionValues,
19
- } from "../schema";
19
+ } from "../schema.js";
20
20
 
21
21
  // Infer types from Drizzle schema
22
22
  export type SellableEntity = typeof sellableEntities.$inferSelect;
@@ -10,7 +10,7 @@ import {
10
10
  uniqueIndex,
11
11
  uuid,
12
12
  } from "drizzle-orm/pg-core";
13
- import { organization } from "../../auth/auth-schema";
13
+ import { organization } from "../../auth/auth-schema.js";
14
14
 
15
15
  export const sellableEntities = pgTable(
16
16
  "sellable_entities",
@@ -1,25 +1,25 @@
1
- import { resolveOrgId } from "../../auth/org";
2
- import { assertPermission } from "../../auth/permissions";
3
- import type { Actor } from "../../auth/types";
4
- import type { CommerceConfig } from "../../config/types";
1
+ import { resolveOrgId } from "../../auth/org.js";
2
+ import { assertPermission } from "../../auth/permissions.js";
3
+ import type { Actor } from "../../auth/types.js";
4
+ import type { CommerceConfig } from "../../config/types.js";
5
5
  import {
6
6
  CommerceConflictError,
7
7
  CommerceNotFoundError,
8
8
  CommerceValidationError,
9
9
  toCommerceError,
10
- } from "../../kernel/errors";
11
- import { runAfterHooks, runBeforeHooks } from "../../kernel/hooks/executor";
12
- import { createHookContext } from "../../kernel/hooks/create-context";
10
+ } from "../../kernel/errors.js";
11
+ import { runAfterHooks, runBeforeHooks } from "../../kernel/hooks/executor.js";
12
+ import { createHookContext } from "../../kernel/hooks/create-context.js";
13
13
  import type {
14
14
  AfterHook,
15
15
  BeforeHook,
16
16
  HookContext,
17
- } from "../../kernel/hooks/types";
18
- import type { HookRegistry } from "../../kernel/hooks/registry";
19
- import { Err, Ok, type Result } from "../../kernel/result";
20
- import { createLogger } from "../../utils/logger";
21
- import { paginate, type Pagination } from "../../utils/pagination";
22
- import type { TxContext } from "../../kernel/database/tx-context";
17
+ } from "../../kernel/hooks/types.js";
18
+ import type { HookRegistry } from "../../kernel/hooks/registry.js";
19
+ import { Err, Ok, type Result } from "../../kernel/result.js";
20
+ import { createLogger } from "../../utils/logger.js";
21
+ import { paginate, type Pagination } from "../../utils/pagination.js";
22
+ import type { TxContext } from "../../kernel/database/tx-context.js";
23
23
  import {
24
24
  CatalogRepository,
25
25
  type SellableEntity,
@@ -33,7 +33,7 @@ import {
33
33
  type OptionType,
34
34
  type OptionValue,
35
35
  type Variant,
36
- } from "./repository";
36
+ } from "./repository/index.js";
37
37
 
38
38
  // ─── Re-exported schema-derived types ────────────────────────────────────────
39
39
  export type {
@@ -46,7 +46,7 @@ export type {
46
46
  CreateOptionTypeInput,
47
47
  CreateOptionValueInput,
48
48
  CreateVariantInput,
49
- } from "./schemas";
49
+ } from "./schemas.js";
50
50
 
51
51
  import type {
52
52
  CreateEntityInput,
@@ -58,7 +58,7 @@ import type {
58
58
  CreateOptionTypeInput,
59
59
  CreateOptionValueInput,
60
60
  CreateVariantInput,
61
- } from "./schemas";
61
+ } from "./schemas.js";
62
62
 
63
63
  // ─── Hand-written types (not derivable from a single z.infer) ───────────────
64
64
 
@@ -1,15 +1,15 @@
1
1
  import { eq, and } from "drizzle-orm";
2
- import type { TxContext } from "../../../kernel/database/tx-context";
2
+ import type { TxContext } from "../../../kernel/database/tx-context.js";
3
3
  import type {
4
4
  DrizzleDatabase,
5
5
  DbOrTx,
6
- } from "../../../kernel/database/drizzle-db";
6
+ } from "../../../kernel/database/drizzle-db.js";
7
7
  import {
8
8
  customers,
9
9
  customerAddresses,
10
10
  customerGroups,
11
11
  customerGroupMembers,
12
- } from "../schema";
12
+ } from "../schema.js";
13
13
 
14
14
  // Infer types from Drizzle schema
15
15
  export type Customer = typeof customers.$inferSelect;
@@ -1,5 +1,5 @@
1
1
  import { boolean, index, jsonb, pgTable, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
2
- import { organization } from "../../auth/auth-schema";
2
+ import { organization } from "../../auth/auth-schema.js";
3
3
 
4
4
  export const customers = pgTable("customers", {
5
5
  id: uuid("id").defaultRandom().primaryKey(),
@@ -1,14 +1,14 @@
1
- import { resolveOrgId } from "../../auth/org";
2
- import type { Actor } from "../../auth/types";
3
- import { CommerceNotFoundError } from "../../kernel/errors";
4
- import { Err, Ok, type Result } from "../../kernel/result";
5
- import type { TxContext } from "../../kernel/database/tx-context";
1
+ import { resolveOrgId } from "../../auth/org.js";
2
+ import type { Actor } from "../../auth/types.js";
3
+ import { CommerceNotFoundError } from "../../kernel/errors.js";
4
+ import { Err, Ok, type Result } from "../../kernel/result.js";
5
+ import type { TxContext } from "../../kernel/database/tx-context.js";
6
6
  import type {
7
7
  CustomersRepository,
8
8
  Customer,
9
9
  CustomerAddress,
10
10
  CustomerAddressInsert,
11
- } from "./repository";
11
+ } from "./repository/index.js";
12
12
 
13
13
  interface CustomerServiceDeps {
14
14
  repository: CustomersRepository;
@@ -1,14 +1,14 @@
1
1
  import { eq, desc, and, sql } from "drizzle-orm";
2
- import type { TxContext } from "../../../kernel/database/tx-context";
2
+ import type { TxContext } from "../../../kernel/database/tx-context.js";
3
3
  import type {
4
4
  DrizzleDatabase,
5
5
  DbOrTx,
6
- } from "../../../kernel/database/drizzle-db";
6
+ } from "../../../kernel/database/drizzle-db.js";
7
7
  import {
8
8
  fulfillmentRecords,
9
9
  fulfillmentLineItems,
10
10
  fulfillmentEvents,
11
- } from "../schema";
11
+ } from "../schema.js";
12
12
 
13
13
  // Infer types from Drizzle schema
14
14
  export type FulfillmentRecord = typeof fulfillmentRecords.$inferSelect;
@@ -7,8 +7,8 @@ import {
7
7
  uuid,
8
8
  boolean,
9
9
  } from "drizzle-orm/pg-core";
10
- import { orders, orderLineItems } from "../orders/schema";
11
- import { customers } from "../customers/schema";
10
+ import { orders, orderLineItems } from "../orders/schema.js";
11
+ import { customers } from "../customers/schema.js";
12
12
 
13
13
  /**
14
14
  * Fulfillment Records Table
@@ -1,18 +1,18 @@
1
1
  import { createHmac } from "node:crypto";
2
- import { resolveOrgId } from "../../auth/org";
3
- import type { Actor } from "../../auth/types";
4
- import { CommerceNotFoundError } from "../../kernel/errors";
5
- import { Err, Ok, type Result } from "../../kernel/result";
6
- import type { TxContext } from "../../kernel/database/tx-context";
7
- import type { FulfillmentRepository } from "./repository";
8
- import type { OrdersRepository } from "../orders/repository";
2
+ import { resolveOrgId } from "../../auth/org.js";
3
+ import type { Actor } from "../../auth/types.js";
4
+ import { CommerceNotFoundError } from "../../kernel/errors.js";
5
+ import { Err, Ok, type Result } from "../../kernel/result.js";
6
+ import type { TxContext } from "../../kernel/database/tx-context.js";
7
+ import type { FulfillmentRepository } from "./repository/index.js";
8
+ import type { OrdersRepository } from "../orders/repository/index.js";
9
9
  import type {
10
10
  FulfillmentLineItem,
11
11
  FulfillmentRecord,
12
12
  FulfillmentStrategy,
13
13
  FulfillmentStrategyContext,
14
- } from "./types";
15
- import { makeId } from "../../utils/id";
14
+ } from "./types.js";
15
+ import { makeId } from "../../utils/id.js";
16
16
 
17
17
  interface InventoryServiceLike {
18
18
  adjust(input: {
@@ -1,5 +1,5 @@
1
- import type { Result } from "../../kernel/result";
2
- import type { OrderLineItem } from "../orders/repository";
1
+ import type { Result } from "../../kernel/result.js";
2
+ import type { OrderLineItem } from "../orders/repository/index.js";
3
3
 
4
4
  export interface FulfillmentRecord {
5
5
  id: string;
@@ -1,10 +1,10 @@
1
1
  import { eq, and, inArray, isNull, sql } from "drizzle-orm";
2
- import type { TxContext } from "../../../kernel/database/tx-context";
2
+ import type { TxContext } from "../../../kernel/database/tx-context.js";
3
3
  import type {
4
4
  DrizzleDatabase,
5
5
  DbOrTx,
6
- } from "../../../kernel/database/drizzle-db";
7
- import { warehouses, inventoryLevels, inventoryMovements } from "../schema";
6
+ } from "../../../kernel/database/drizzle-db.js";
7
+ import { warehouses, inventoryLevels, inventoryMovements } from "../schema.js";
8
8
 
9
9
  // Infer types from Drizzle schema
10
10
  export type Warehouse = typeof warehouses.$inferSelect;
@@ -9,8 +9,8 @@ import {
9
9
  uniqueIndex,
10
10
  uuid,
11
11
  } from "drizzle-orm/pg-core";
12
- import { organization } from "../../auth/auth-schema";
13
- import { sellableEntities, variants } from "../catalog/schema";
12
+ import { organization } from "../../auth/auth-schema.js";
13
+ import { sellableEntities, variants } from "../catalog/schema.js";
14
14
 
15
15
  export const warehouses = pgTable(
16
16
  "warehouses",
@@ -1,28 +1,28 @@
1
- import { resolveOrgId } from "../../auth/org";
2
- import { assertPermission } from "../../auth/permissions";
3
- import type { Actor } from "../../auth/types";
4
- import type { CommerceConfig } from "../../config/types";
1
+ import { resolveOrgId } from "../../auth/org.js";
2
+ import { assertPermission } from "../../auth/permissions.js";
3
+ import type { Actor } from "../../auth/types.js";
4
+ import type { CommerceConfig } from "../../config/types.js";
5
5
  import {
6
6
  CommerceNotFoundError,
7
7
  CommerceValidationError,
8
8
  toCommerceError,
9
- } from "../../kernel/errors";
10
- import { runAfterHooks } from "../../kernel/hooks/executor";
11
- import { createHookContext } from "../../kernel/hooks/create-context";
12
- import type { HookContext } from "../../kernel/hooks/types";
13
- import type { HookRegistry } from "../../kernel/hooks/registry";
14
- import { Err, Ok, type Result } from "../../kernel/result";
15
- import { createLogger } from "../../utils/logger";
16
- import type { DatabaseAdapter } from "../../kernel/database/adapter";
17
- import { createTxContext, type TxContext } from "../../kernel/database/tx-context";
9
+ } from "../../kernel/errors.js";
10
+ import { runAfterHooks } from "../../kernel/hooks/executor.js";
11
+ import { createHookContext } from "../../kernel/hooks/create-context.js";
12
+ import type { HookContext } from "../../kernel/hooks/types.js";
13
+ import type { HookRegistry } from "../../kernel/hooks/registry.js";
14
+ import { Err, Ok, type Result } from "../../kernel/result.js";
15
+ import { createLogger } from "../../utils/logger.js";
16
+ import type { DatabaseAdapter } from "../../kernel/database/adapter.js";
17
+ import { createTxContext, type TxContext } from "../../kernel/database/tx-context.js";
18
18
  import {
19
19
  InventoryRepository,
20
20
  type Warehouse,
21
21
  type InventoryLevel,
22
- } from "./repository";
22
+ } from "./repository/index.js";
23
23
 
24
- export type { InventoryAdjustInput, InventoryReserveInput, InventoryReleaseInput } from "./schemas";
25
- import type { InventoryAdjustInput, InventoryReserveInput, InventoryReleaseInput } from "./schemas";
24
+ export type { InventoryAdjustInput, InventoryReserveInput, InventoryReleaseInput } from "./schemas.js";
25
+ import type { InventoryAdjustInput, InventoryReserveInput, InventoryReleaseInput } from "./schemas.js";
26
26
 
27
27
  export interface InventoryServiceDeps {
28
28
  repository: InventoryRepository;
@@ -1,4 +1,4 @@
1
- import type { Result } from "../../kernel/result";
1
+ import type { Result } from "../../kernel/result.js";
2
2
 
3
3
  export interface StoredFile {
4
4
  key: string;
@@ -1,10 +1,10 @@
1
1
  import { eq, and, inArray } from "drizzle-orm";
2
- import type { TxContext } from "../../../kernel/database/tx-context";
2
+ import type { TxContext } from "../../../kernel/database/tx-context.js";
3
3
  import type {
4
4
  DrizzleDatabase,
5
5
  DbOrTx,
6
- } from "../../../kernel/database/drizzle-db";
7
- import { mediaAssets, entityMedia } from "../schema";
6
+ } from "../../../kernel/database/drizzle-db.js";
7
+ import { mediaAssets, entityMedia } from "../schema.js";
8
8
 
9
9
  // Infer types from Drizzle schema
10
10
  export type MediaAsset = typeof mediaAssets.$inferSelect;
@@ -1,6 +1,6 @@
1
1
  import { index, integer, jsonb, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
2
- import { organization } from "../../auth/auth-schema";
3
- import { sellableEntities, variants } from "../catalog/schema";
2
+ import { organization } from "../../auth/auth-schema.js";
3
+ import { sellableEntities, variants } from "../catalog/schema.js";
4
4
 
5
5
  export const mediaAssets = pgTable(
6
6
  "media_assets",
@@ -1,15 +1,15 @@
1
- import { resolveOrgId } from "../../auth/org";
2
- import type { Actor } from "../../auth/types";
3
- import type { StorageAdapter, StoredFile } from "./adapter";
4
- import { Err, Ok, type Result } from "../../kernel/result";
1
+ import { resolveOrgId } from "../../auth/org.js";
2
+ import type { Actor } from "../../auth/types.js";
3
+ import type { StorageAdapter, StoredFile } from "./adapter.js";
4
+ import { Err, Ok, type Result } from "../../kernel/result.js";
5
5
  import {
6
6
  CommerceNotFoundError,
7
7
  CommerceValidationError,
8
- } from "../../kernel/errors";
9
- import type { MediaRepository } from "./repository";
10
- import type { CatalogRepository } from "../catalog/repository";
11
- import type { TxContext } from "../../kernel/database/tx-context";
12
- import { makeId } from "../../utils/id";
8
+ } from "../../kernel/errors.js";
9
+ import type { MediaRepository } from "./repository/index.js";
10
+ import type { CatalogRepository } from "../catalog/repository/index.js";
11
+ import type { TxContext } from "../../kernel/database/tx-context.js";
12
+ import { makeId } from "../../utils/id.js";
13
13
 
14
14
  export interface UploadMediaInput {
15
15
  filename: string;
@@ -1,10 +1,10 @@
1
1
  import { eq, and, desc, sql } from "drizzle-orm";
2
- import type { TxContext } from "../../../kernel/database/tx-context";
2
+ import type { TxContext } from "../../../kernel/database/tx-context.js";
3
3
  import type {
4
4
  DrizzleDatabase,
5
5
  DbOrTx,
6
- } from "../../../kernel/database/drizzle-db";
7
- import { orders, orderLineItems, orderStatusHistory } from "../schema";
6
+ } from "../../../kernel/database/drizzle-db.js";
7
+ import { orders, orderLineItems, orderStatusHistory } from "../schema.js";
8
8
 
9
9
  // Infer types from Drizzle schema
10
10
  export type Order = typeof orders.$inferSelect;
@@ -1,6 +1,6 @@
1
1
  import { index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, uuid } from "drizzle-orm/pg-core";
2
- import { organization } from "../../auth/auth-schema";
3
- import { sellableEntities, variants } from "../catalog/schema";
2
+ import { organization } from "../../auth/auth-schema.js";
3
+ import { sellableEntities, variants } from "../catalog/schema.js";
4
4
 
5
5
  export const orders = pgTable("orders", {
6
6
  id: uuid("id").defaultRandom().primaryKey(),
@@ -1,37 +1,37 @@
1
- import { resolveOrgId } from "../../auth/org";
2
- import { assertOwnership, assertPermission } from "../../auth/permissions";
3
- import type { Actor } from "../../auth/types";
1
+ import { resolveOrgId } from "../../auth/org.js";
2
+ import { assertOwnership, assertPermission } from "../../auth/permissions.js";
3
+ import type { Actor } from "../../auth/types.js";
4
4
  import {
5
5
  CommerceInvalidTransitionError,
6
6
  CommerceNotFoundError,
7
7
  CommerceValidationError,
8
8
  toCommerceError,
9
- } from "../../kernel/errors";
10
- import { runAfterHooks, runBeforeHooks } from "../../kernel/hooks/executor";
11
- import { createHookContext } from "../../kernel/hooks/create-context";
9
+ } from "../../kernel/errors.js";
10
+ import { runAfterHooks, runBeforeHooks } from "../../kernel/hooks/executor.js";
11
+ import { createHookContext } from "../../kernel/hooks/create-context.js";
12
12
  import type {
13
13
  AfterHook,
14
14
  BeforeHook,
15
15
  HookContext,
16
- } from "../../kernel/hooks/types";
17
- import type { HookRegistry } from "../../kernel/hooks/registry";
16
+ } from "../../kernel/hooks/types.js";
17
+ import type { HookRegistry } from "../../kernel/hooks/registry.js";
18
18
  import {
19
19
  canTransition,
20
20
  orderStateMachine,
21
21
  type OrderState,
22
22
  type StateDefinition,
23
- } from "../../kernel/state-machine/machine";
24
- import { Err, Ok, type Result } from "../../kernel/result";
25
- import { createLogger } from "../../utils/logger";
26
- import { paginate, type Pagination } from "../../utils/pagination";
27
- import type { TxContext } from "../../kernel/database/tx-context";
28
- import type { PluginDb } from "../../kernel/database/plugin-types";
23
+ } from "../../kernel/state-machine/machine.js";
24
+ import { Err, Ok, type Result } from "../../kernel/result.js";
25
+ import { createLogger } from "../../utils/logger.js";
26
+ import { paginate, type Pagination } from "../../utils/pagination.js";
27
+ import type { TxContext } from "../../kernel/database/tx-context.js";
28
+ import type { PluginDb } from "../../kernel/database/plugin-types.js";
29
29
  import {
30
30
  OrdersRepository,
31
31
  type Order,
32
32
  type OrderLineItem,
33
33
  type OrderStatusHistory,
34
- } from "./repository";
34
+ } from "./repository/index.js";
35
35
 
36
36
  export interface CreateOrderInput {
37
37
  customerId?: string;
@@ -1,6 +1,6 @@
1
1
  import { eq, and, lt, sql } from "drizzle-orm";
2
- import { orders } from "./schema";
3
- import type { TaskDefinition, TaskContext } from "../../kernel/jobs/types";
2
+ import { orders } from "./schema.js";
3
+ import type { TaskDefinition, TaskContext } from "../../kernel/jobs/types.js";
4
4
 
5
5
  /**
6
6
  * Stale Order Cleanup Task
@@ -10,8 +10,8 @@
10
10
 
11
11
  import { eq } from "drizzle-orm";
12
12
  import type { PgDatabase, PgQueryResultHKT } from "drizzle-orm/pg-core";
13
- import { organization, member } from "../../auth/auth-schema";
14
- import type { AuthInstance } from "../../auth/setup";
13
+ import { organization, member } from "../../auth/auth-schema.js";
14
+ import type { AuthInstance } from "../../auth/setup.js";
15
15
 
16
16
  type DrizzleDb = PgDatabase<PgQueryResultHKT, Record<string, unknown>>;
17
17
 
@@ -1,4 +1,4 @@
1
- import type { Result } from "../../kernel/result";
1
+ import type { Result } from "../../kernel/result.js";
2
2
 
3
3
  export interface PaymentIntent {
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import type { TxContext } from "../../../kernel/database/tx-context";
1
+ import type { TxContext } from "../../../kernel/database/tx-context.js";
2
2
 
3
3
  export interface PaymentsRepository {
4
4
  // RFC-002 scaffold: module repositories become the only persistence boundary.
@@ -1,12 +1,12 @@
1
- import { CommerceValidationError } from "../../kernel/errors";
2
- import { Err, Ok, type Result } from "../../kernel/result";
1
+ import { CommerceValidationError } from "../../kernel/errors.js";
2
+ import { Err, Ok, type Result } from "../../kernel/result.js";
3
3
  import type {
4
4
  CreatePaymentIntentParams,
5
5
  PaymentAdapter,
6
6
  PaymentCapture,
7
7
  PaymentIntent,
8
8
  PaymentRefund,
9
- } from "./adapter";
9
+ } from "./adapter.js";
10
10
 
11
11
  export class PaymentsService {
12
12
  private readonly adapterMap: Map<string, PaymentAdapter>;
@@ -1,10 +1,10 @@
1
1
  import { eq, and, lte, gte, or, isNull } from "drizzle-orm";
2
- import type { TxContext } from "../../../kernel/database/tx-context";
2
+ import type { TxContext } from "../../../kernel/database/tx-context.js";
3
3
  import type {
4
4
  DrizzleDatabase,
5
5
  DbOrTx,
6
- } from "../../../kernel/database/drizzle-db";
7
- import { prices, priceModifiers } from "../schema";
6
+ } from "../../../kernel/database/drizzle-db.js";
7
+ import { prices, priceModifiers } from "../schema.js";
8
8
 
9
9
  // Infer types from Drizzle schema
10
10
  export type Price = typeof prices.$inferSelect;
@@ -1,6 +1,6 @@
1
1
  import { index, integer, jsonb, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
2
- import { organization } from "../../auth/auth-schema";
3
- import { sellableEntities, variants } from "../catalog/schema";
2
+ import { organization } from "../../auth/auth-schema.js";
3
+ import { sellableEntities, variants } from "../catalog/schema.js";
4
4
 
5
5
  export const prices = pgTable(
6
6
  "prices",
@@ -1,19 +1,19 @@
1
- import { resolveOrgId } from "../../auth/org";
2
- import type { Actor } from "../../auth/types";
1
+ import { resolveOrgId } from "../../auth/org.js";
2
+ import type { Actor } from "../../auth/types.js";
3
3
  import {
4
4
  CommerceNotFoundError,
5
5
  CommerceValidationError,
6
- } from "../../kernel/errors";
7
- import { Err, Ok, type Result } from "../../kernel/result";
8
- import type { TxContext } from "../../kernel/database/tx-context";
6
+ } from "../../kernel/errors.js";
7
+ import { Err, Ok, type Result } from "../../kernel/result.js";
8
+ import type { TxContext } from "../../kernel/database/tx-context.js";
9
9
  import type {
10
10
  PricingRepository,
11
11
  Price,
12
12
  PriceModifier,
13
13
  PriceInsert,
14
14
  PriceModifierInsert,
15
- } from "./repository";
16
- import type { CatalogRepository } from "../catalog/repository";
15
+ } from "./repository/index.js";
16
+ import type { CatalogRepository } from "../catalog/repository/index.js";
17
17
 
18
18
  // Re-export PriceModifierType from schema for external use
19
19
  export type PriceModifierType =
@@ -61,8 +61,8 @@ export interface ResolvedPrice {
61
61
  basePriceId: string;
62
62
  }
63
63
 
64
- export type { SetBasePriceInput, CreatePriceModifierInput } from "./schemas";
65
- import type { SetBasePriceInput, CreatePriceModifierInput } from "./schemas";
64
+ export type { SetBasePriceInput, CreatePriceModifierInput } from "./schemas.js";
65
+ import type { SetBasePriceInput, CreatePriceModifierInput } from "./schemas.js";
66
66
 
67
67
  function matchesQuantity(
68
68
  min: number | null | undefined,
@@ -1,10 +1,10 @@
1
1
  import { eq, and, lte, gte, or, isNull, desc, sql } from "drizzle-orm";
2
- import type { TxContext } from "../../../kernel/database/tx-context";
2
+ import type { TxContext } from "../../../kernel/database/tx-context.js";
3
3
  import type {
4
4
  DrizzleDatabase,
5
5
  DbOrTx,
6
- } from "../../../kernel/database/drizzle-db";
7
- import { promotions, promotionUsages } from "../schema";
6
+ } from "../../../kernel/database/drizzle-db.js";
7
+ import { promotions, promotionUsages } from "../schema.js";
8
8
 
9
9
  // Infer types from Drizzle schema
10
10
  export type Promotion = typeof promotions.$inferSelect;