@porulle/core 0.11.0 → 0.13.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 (289) hide show
  1. package/dist/auth/auth-schema-guard.d.ts +2444 -0
  2. package/dist/auth/auth-schema-guard.d.ts.map +1 -0
  3. package/dist/auth/auth-schema-guard.js +113 -0
  4. package/dist/auth/auth-schema.d.ts +228 -0
  5. package/dist/auth/auth-schema.d.ts.map +1 -1
  6. package/dist/auth/auth-schema.js +24 -2
  7. package/dist/auth/middleware.d.ts +1 -0
  8. package/dist/auth/middleware.d.ts.map +1 -1
  9. package/dist/auth/middleware.js +13 -5
  10. package/dist/auth/org.d.ts +8 -2
  11. package/dist/auth/org.d.ts.map +1 -1
  12. package/dist/auth/org.js +12 -4
  13. package/dist/auth/organization-guard.d.ts +5 -0
  14. package/dist/auth/organization-guard.d.ts.map +1 -0
  15. package/dist/auth/organization-guard.js +124 -0
  16. package/dist/auth/permissions.d.ts +10 -0
  17. package/dist/auth/permissions.d.ts.map +1 -1
  18. package/dist/auth/permissions.js +31 -7
  19. package/dist/auth/role-authority.d.ts +44 -0
  20. package/dist/auth/role-authority.d.ts.map +1 -0
  21. package/dist/auth/role-authority.js +85 -0
  22. package/dist/auth/setup.d.ts.map +1 -1
  23. package/dist/auth/setup.js +17 -0
  24. package/dist/auth/strict-org-resolution.d.ts.map +1 -1
  25. package/dist/auth/strict-org-resolution.js +9 -1
  26. package/dist/auth/types.d.ts +1 -1
  27. package/dist/auth/types.d.ts.map +1 -1
  28. package/dist/config/defaults.d.ts.map +1 -1
  29. package/dist/config/defaults.js +2 -0
  30. package/dist/config/types.d.ts +30 -4
  31. package/dist/config/types.d.ts.map +1 -1
  32. package/dist/hooks/checkout.d.ts.map +1 -1
  33. package/dist/hooks/checkout.js +10 -9
  34. package/dist/index.d.ts +6 -5
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +4 -3
  37. package/dist/interfaces/rest/audit-middleware.d.ts.map +1 -1
  38. package/dist/interfaces/rest/audit-middleware.js +2 -0
  39. package/dist/interfaces/rest/customer-portal.d.ts.map +1 -1
  40. package/dist/interfaces/rest/customer-portal.js +9 -8
  41. package/dist/interfaces/rest/route-coverage.d.ts +14 -0
  42. package/dist/interfaces/rest/route-coverage.d.ts.map +1 -0
  43. package/dist/interfaces/rest/route-coverage.js +81 -0
  44. package/dist/interfaces/rest/router.d.ts +7 -2
  45. package/dist/interfaces/rest/router.d.ts.map +1 -1
  46. package/dist/interfaces/rest/router.js +8 -4
  47. package/dist/interfaces/rest/routes/admin/compensation-failures.d.ts.map +1 -1
  48. package/dist/interfaces/rest/routes/admin/compensation-failures.js +7 -5
  49. package/dist/interfaces/rest/routes/admin/custom-field-proposals.js +2 -2
  50. package/dist/interfaces/rest/routes/admin/permissions.d.ts +1 -1
  51. package/dist/interfaces/rest/routes/admin/permissions.d.ts.map +1 -1
  52. package/dist/interfaces/rest/routes/admin/permissions.js +2 -0
  53. package/dist/interfaces/rest/routes/admin/staff.d.ts.map +1 -1
  54. package/dist/interfaces/rest/routes/admin/staff.js +126 -66
  55. package/dist/interfaces/rest/routes/admin-jobs.js +3 -3
  56. package/dist/interfaces/rest/routes/audit.js +3 -3
  57. package/dist/interfaces/rest/routes/carts.d.ts.map +1 -1
  58. package/dist/interfaces/rest/routes/carts.js +13 -10
  59. package/dist/interfaces/rest/routes/catalog.d.ts.map +1 -1
  60. package/dist/interfaces/rest/routes/catalog.js +10 -2
  61. package/dist/interfaces/rest/routes/checkout.d.ts.map +1 -1
  62. package/dist/interfaces/rest/routes/checkout.js +30 -35
  63. package/dist/interfaces/rest/routes/documents.d.ts.map +1 -1
  64. package/dist/interfaces/rest/routes/documents.js +10 -5
  65. package/dist/interfaces/rest/routes/inventory.d.ts.map +1 -1
  66. package/dist/interfaces/rest/routes/inventory.js +2 -0
  67. package/dist/interfaces/rest/routes/media.d.ts.map +1 -1
  68. package/dist/interfaces/rest/routes/media.js +7 -3
  69. package/dist/interfaces/rest/routes/orders.d.ts.map +1 -1
  70. package/dist/interfaces/rest/routes/orders.js +26 -8
  71. package/dist/interfaces/rest/routes/pricing.js +2 -2
  72. package/dist/interfaces/rest/routes/promotions.d.ts.map +1 -1
  73. package/dist/interfaces/rest/routes/promotions.js +13 -10
  74. package/dist/interfaces/rest/routes/search.d.ts.map +1 -1
  75. package/dist/interfaces/rest/routes/search.js +2 -1
  76. package/dist/interfaces/rest/schemas/carts.d.ts +7 -0
  77. package/dist/interfaces/rest/schemas/carts.d.ts.map +1 -1
  78. package/dist/interfaces/rest/schemas/customer-portal.d.ts +35 -0
  79. package/dist/interfaces/rest/schemas/customer-portal.d.ts.map +1 -1
  80. package/dist/interfaces/rest/schemas/orders.d.ts +204 -0
  81. package/dist/interfaces/rest/schemas/orders.d.ts.map +1 -1
  82. package/dist/interfaces/rest/schemas/responses.d.ts +71 -0
  83. package/dist/interfaces/rest/schemas/responses.d.ts.map +1 -1
  84. package/dist/interfaces/rest/utils.d.ts +15 -0
  85. package/dist/interfaces/rest/utils.d.ts.map +1 -1
  86. package/dist/interfaces/rest/utils.js +45 -2
  87. package/dist/kernel/compensation/executor.js +2 -2
  88. package/dist/kernel/database/tx-context.d.ts +8 -0
  89. package/dist/kernel/database/tx-context.d.ts.map +1 -1
  90. package/dist/kernel/database/tx-context.js +13 -0
  91. package/dist/kernel/hooks/create-context.d.ts +2 -0
  92. package/dist/kernel/hooks/create-context.d.ts.map +1 -1
  93. package/dist/kernel/hooks/create-context.js +1 -0
  94. package/dist/kernel/hooks/types.d.ts +2 -0
  95. package/dist/kernel/hooks/types.d.ts.map +1 -1
  96. package/dist/kernel/plugin/manifest.d.ts.map +1 -1
  97. package/dist/kernel/plugin/manifest.js +9 -5
  98. package/dist/modules/analytics/service.js +2 -2
  99. package/dist/modules/audit/service.js +3 -3
  100. package/dist/modules/cart/repository/index.d.ts +13 -7
  101. package/dist/modules/cart/repository/index.d.ts.map +1 -1
  102. package/dist/modules/cart/repository/index.js +16 -10
  103. package/dist/modules/cart/schema.d.ts +17 -0
  104. package/dist/modules/cart/schema.d.ts.map +1 -1
  105. package/dist/modules/cart/schema.js +4 -0
  106. package/dist/modules/cart/service.d.ts +22 -9
  107. package/dist/modules/cart/service.d.ts.map +1 -1
  108. package/dist/modules/cart/service.js +57 -33
  109. package/dist/modules/catalog/brand-service.js +7 -7
  110. package/dist/modules/catalog/category-service.js +7 -7
  111. package/dist/modules/catalog/entity-service.d.ts +14 -7
  112. package/dist/modules/catalog/entity-service.d.ts.map +1 -1
  113. package/dist/modules/catalog/entity-service.js +109 -31
  114. package/dist/modules/catalog/read-policy.d.ts +9 -0
  115. package/dist/modules/catalog/read-policy.d.ts.map +1 -0
  116. package/dist/modules/catalog/read-policy.js +8 -0
  117. package/dist/modules/catalog/repository/index.d.ts +3 -2
  118. package/dist/modules/catalog/repository/index.d.ts.map +1 -1
  119. package/dist/modules/catalog/repository/index.js +14 -4
  120. package/dist/modules/catalog/service.d.ts +15 -13
  121. package/dist/modules/catalog/service.d.ts.map +1 -1
  122. package/dist/modules/catalog/service.js +25 -18
  123. package/dist/modules/customers/module.d.ts.map +1 -1
  124. package/dist/modules/customers/module.js +1 -0
  125. package/dist/modules/customers/service.d.ts +2 -0
  126. package/dist/modules/customers/service.d.ts.map +1 -1
  127. package/dist/modules/customers/service.js +21 -20
  128. package/dist/modules/documents/module.d.ts.map +1 -1
  129. package/dist/modules/documents/module.js +1 -0
  130. package/dist/modules/documents/service.d.ts +18 -4
  131. package/dist/modules/documents/service.d.ts.map +1 -1
  132. package/dist/modules/documents/service.js +54 -16
  133. package/dist/modules/fulfillment/module.d.ts.map +1 -1
  134. package/dist/modules/fulfillment/module.js +1 -0
  135. package/dist/modules/fulfillment/service.d.ts +2 -0
  136. package/dist/modules/fulfillment/service.d.ts.map +1 -1
  137. package/dist/modules/fulfillment/service.js +15 -6
  138. package/dist/modules/inventory/service.d.ts.map +1 -1
  139. package/dist/modules/inventory/service.js +15 -14
  140. package/dist/modules/media/service.js +6 -6
  141. package/dist/modules/orders/guest-access.d.ts +27 -0
  142. package/dist/modules/orders/guest-access.d.ts.map +1 -0
  143. package/dist/modules/orders/guest-access.js +46 -0
  144. package/dist/modules/orders/module.d.ts.map +1 -1
  145. package/dist/modules/orders/module.js +1 -0
  146. package/dist/modules/orders/quote.d.ts.map +1 -1
  147. package/dist/modules/orders/quote.js +1 -0
  148. package/dist/modules/orders/repository/index.d.ts +1 -1
  149. package/dist/modules/orders/repository/index.d.ts.map +1 -1
  150. package/dist/modules/orders/repository/index.js +2 -2
  151. package/dist/modules/orders/schema.d.ts +17 -0
  152. package/dist/modules/orders/schema.d.ts.map +1 -1
  153. package/dist/modules/orders/schema.js +5 -3
  154. package/dist/modules/orders/service.d.ts +16 -7
  155. package/dist/modules/orders/service.d.ts.map +1 -1
  156. package/dist/modules/orders/service.js +184 -55
  157. package/dist/modules/pricing/module.d.ts.map +1 -1
  158. package/dist/modules/pricing/module.js +1 -0
  159. package/dist/modules/pricing/service.d.ts +2 -0
  160. package/dist/modules/pricing/service.d.ts.map +1 -1
  161. package/dist/modules/pricing/service.js +12 -11
  162. package/dist/modules/promotions/module.d.ts.map +1 -1
  163. package/dist/modules/promotions/module.js +1 -0
  164. package/dist/modules/promotions/service.d.ts +3 -0
  165. package/dist/modules/promotions/service.d.ts.map +1 -1
  166. package/dist/modules/promotions/service.js +19 -11
  167. package/dist/modules/search/adapter.d.ts +6 -0
  168. package/dist/modules/search/adapter.d.ts.map +1 -1
  169. package/dist/modules/search/module.d.ts.map +1 -1
  170. package/dist/modules/search/module.js +1 -0
  171. package/dist/modules/search/service.d.ts +1 -0
  172. package/dist/modules/search/service.d.ts.map +1 -1
  173. package/dist/modules/search/service.js +57 -6
  174. package/dist/modules/settings/module.d.ts.map +1 -1
  175. package/dist/modules/settings/module.js +1 -0
  176. package/dist/modules/settings/service.d.ts +3 -0
  177. package/dist/modules/settings/service.d.ts.map +1 -1
  178. package/dist/modules/settings/service.js +6 -4
  179. package/dist/modules/shipping/service.js +9 -9
  180. package/dist/modules/tax/module.d.ts.map +1 -1
  181. package/dist/modules/tax/module.js +1 -0
  182. package/dist/modules/tax/service.d.ts +3 -0
  183. package/dist/modules/tax/service.d.ts.map +1 -1
  184. package/dist/modules/tax/service.js +11 -9
  185. package/dist/modules/webhooks/hook.js +2 -2
  186. package/dist/modules/webhooks/module.d.ts.map +1 -1
  187. package/dist/modules/webhooks/module.js +1 -0
  188. package/dist/modules/webhooks/service.d.ts +2 -0
  189. package/dist/modules/webhooks/service.d.ts.map +1 -1
  190. package/dist/modules/webhooks/service.js +4 -4
  191. package/dist/runtime/server.d.ts.map +1 -1
  192. package/dist/runtime/server.js +10 -2
  193. package/dist/test-utils/create-pglite-adapter.d.ts.map +1 -1
  194. package/dist/test-utils/create-pglite-adapter.js +35 -13
  195. package/dist/test-utils/create-test-config.d.ts.map +1 -1
  196. package/dist/test-utils/create-test-config.js +4 -0
  197. package/dist/test-utils/rest-api-test-utils.d.ts.map +1 -1
  198. package/dist/test-utils/rest-api-test-utils.js +2 -0
  199. package/dist/test-utils/test-actors.js +2 -2
  200. package/dist/utils/id.d.ts +2 -0
  201. package/dist/utils/id.d.ts.map +1 -1
  202. package/dist/utils/id.js +11 -0
  203. package/package.json +6 -5
  204. package/src/auth/auth-schema-guard.ts +143 -0
  205. package/src/auth/auth-schema.ts +50 -19
  206. package/src/auth/middleware.ts +17 -5
  207. package/src/auth/org.ts +15 -3
  208. package/src/auth/organization-guard.ts +158 -0
  209. package/src/auth/permissions.ts +31 -8
  210. package/src/auth/role-authority.ts +107 -0
  211. package/src/auth/setup.ts +17 -0
  212. package/src/auth/strict-org-resolution.ts +7 -1
  213. package/src/auth/types.ts +1 -1
  214. package/src/config/defaults.ts +2 -0
  215. package/src/config/types.ts +29 -4
  216. package/src/hooks/checkout.ts +19 -12
  217. package/src/index.ts +16 -6
  218. package/src/interfaces/rest/audit-middleware.ts +2 -0
  219. package/src/interfaces/rest/customer-portal.ts +31 -24
  220. package/src/interfaces/rest/route-coverage.ts +103 -0
  221. package/src/interfaces/rest/router.ts +16 -10
  222. package/src/interfaces/rest/routes/admin/compensation-failures.ts +8 -5
  223. package/src/interfaces/rest/routes/admin/custom-field-proposals.ts +2 -2
  224. package/src/interfaces/rest/routes/admin/permissions.ts +3 -1
  225. package/src/interfaces/rest/routes/admin/staff.ts +161 -72
  226. package/src/interfaces/rest/routes/admin-jobs.ts +3 -3
  227. package/src/interfaces/rest/routes/audit.ts +3 -3
  228. package/src/interfaces/rest/routes/carts.ts +17 -7
  229. package/src/interfaces/rest/routes/catalog.ts +11 -0
  230. package/src/interfaces/rest/routes/checkout.ts +41 -38
  231. package/src/interfaces/rest/routes/documents.ts +15 -1
  232. package/src/interfaces/rest/routes/inventory.ts +2 -0
  233. package/src/interfaces/rest/routes/media.ts +8 -3
  234. package/src/interfaces/rest/routes/orders.ts +27 -8
  235. package/src/interfaces/rest/routes/pricing.ts +2 -2
  236. package/src/interfaces/rest/routes/promotions.ts +12 -9
  237. package/src/interfaces/rest/routes/search.ts +3 -1
  238. package/src/interfaces/rest/utils.ts +61 -2
  239. package/src/kernel/compensation/executor.ts +2 -2
  240. package/src/kernel/database/tx-context.ts +25 -0
  241. package/src/kernel/hooks/create-context.ts +3 -0
  242. package/src/kernel/hooks/types.ts +2 -0
  243. package/src/kernel/plugin/manifest.ts +9 -5
  244. package/src/modules/analytics/service.ts +2 -2
  245. package/src/modules/audit/service.ts +3 -3
  246. package/src/modules/cart/repository/index.ts +22 -8
  247. package/src/modules/cart/schema.ts +4 -0
  248. package/src/modules/cart/service.ts +62 -27
  249. package/src/modules/catalog/brand-service.ts +7 -7
  250. package/src/modules/catalog/category-service.ts +7 -7
  251. package/src/modules/catalog/entity-service.ts +117 -35
  252. package/src/modules/catalog/read-policy.ts +16 -0
  253. package/src/modules/catalog/repository/index.ts +19 -3
  254. package/src/modules/catalog/service.ts +46 -31
  255. package/src/modules/customers/module.ts +2 -0
  256. package/src/modules/customers/service.ts +23 -22
  257. package/src/modules/documents/module.ts +2 -0
  258. package/src/modules/documents/service.ts +74 -11
  259. package/src/modules/fulfillment/module.ts +2 -0
  260. package/src/modules/fulfillment/service.ts +17 -6
  261. package/src/modules/inventory/service.ts +15 -24
  262. package/src/modules/media/service.ts +6 -6
  263. package/src/modules/orders/guest-access.ts +55 -0
  264. package/src/modules/orders/module.ts +1 -0
  265. package/src/modules/orders/quote.ts +1 -0
  266. package/src/modules/orders/repository/index.ts +2 -0
  267. package/src/modules/orders/schema.ts +5 -3
  268. package/src/modules/orders/service.ts +302 -52
  269. package/src/modules/pricing/module.ts +2 -0
  270. package/src/modules/pricing/service.ts +14 -16
  271. package/src/modules/promotions/module.ts +2 -0
  272. package/src/modules/promotions/service.ts +25 -16
  273. package/src/modules/search/adapter.ts +6 -0
  274. package/src/modules/search/module.ts +1 -0
  275. package/src/modules/search/service.ts +55 -6
  276. package/src/modules/settings/module.ts +2 -0
  277. package/src/modules/settings/service.ts +8 -4
  278. package/src/modules/shipping/service.ts +9 -9
  279. package/src/modules/tax/module.ts +1 -0
  280. package/src/modules/tax/service.ts +13 -9
  281. package/src/modules/webhooks/hook.ts +2 -2
  282. package/src/modules/webhooks/module.ts +2 -0
  283. package/src/modules/webhooks/service.ts +6 -4
  284. package/src/runtime/server.ts +16 -2
  285. package/src/test-utils/create-pglite-adapter.ts +34 -12
  286. package/src/test-utils/create-test-config.ts +10 -6
  287. package/src/test-utils/rest-api-test-utils.ts +2 -0
  288. package/src/test-utils/test-actors.ts +2 -2
  289. package/src/utils/id.ts +20 -0
@@ -1,4 +1,4 @@
1
- import { resolveOrgId } from "../../auth/org.js";
1
+ import { resolveOrgIdForCommerce } from "../../auth/org.js";
2
2
  import { assertPermission } from "../../auth/permissions.js";
3
3
  import { CommerceForbiddenError, CommerceNotFoundError, CommerceValidationError, toCommerceError, } from "../../kernel/errors.js";
4
4
  import { runAfterHooks, runBeforeHooks } from "../../kernel/hooks/executor.js";
@@ -7,7 +7,7 @@ import { Err, Ok } from "../../kernel/result.js";
7
7
  import { createLogger } from "../../utils/logger.js";
8
8
  import { paginate } from "../../utils/pagination.js";
9
9
  import { defaultCartItemMatcher } from "./matcher.js";
10
- function makeContext(actor, services, database, tx = null) {
10
+ function makeContext(actor, services, database, config, tx = null) {
11
11
  return createHookContext({
12
12
  actor,
13
13
  tx,
@@ -15,6 +15,7 @@ function makeContext(actor, services, database, tx = null) {
15
15
  services,
16
16
  context: { moduleName: "cart" },
17
17
  database: { db: database.db },
18
+ commerceConfig: config,
18
19
  });
19
20
  }
20
21
  function isExpired(cart) {
@@ -38,7 +39,7 @@ export class CartService {
38
39
  }
39
40
  const ttlMinutes = this.deps.config.cart?.ttlMinutes ?? 60 * 24 * 7;
40
41
  const now = new Date();
41
- const orgId = resolveOrgId(actor ?? null);
42
+ const orgId = resolveOrgIdForCommerce(actor ?? null, this.deps.config);
42
43
  // SECURITY: cart.customerId is service-managed.
43
44
  //
44
45
  // VAPT r2 (claude-glm) follow-up: the previous "set null for customer
@@ -74,6 +75,7 @@ export class CartService {
74
75
  }
75
76
  }
76
77
  }
78
+ const guestSecret = resolvedCustomerId === null ? crypto.randomUUID() : undefined;
77
79
  const cart = await this.repo.create({
78
80
  organizationId: orgId,
79
81
  status: "active",
@@ -81,6 +83,7 @@ export class CartService {
81
83
  metadata: input.metadata ?? {},
82
84
  expiresAt: new Date(now.getTime() + ttlMinutes * 60 * 1000),
83
85
  ...(resolvedCustomerId !== null ? { customerId: resolvedCustomerId } : {}),
86
+ ...(guestSecret !== undefined ? { secret: guestSecret } : {}),
84
87
  ...(input.email !== undefined ? { email: input.email } : {}),
85
88
  }, ctx);
86
89
  return Ok(cart);
@@ -92,7 +95,7 @@ export class CartService {
92
95
  // read any cart's contents, prices, line items, and metadata. This now
93
96
  // requires either an authenticated owner/staff actor OR the cart's
94
97
  // secret token (returned only at createGuest()).
95
- const orgId = resolveOrgId(actor ?? ctx?.actor ?? null);
98
+ const orgId = resolveOrgIdForCommerce(actor ?? ctx?.actor ?? null, this.deps.config);
96
99
  const cart = await this.repo.findById(orgId, id, ctx);
97
100
  if (!cart)
98
101
  return Err(new CommerceNotFoundError("Cart not found."));
@@ -112,19 +115,34 @@ export class CartService {
112
115
  lineItems,
113
116
  });
114
117
  }
115
- async addItem(input, actor, ctx) {
118
+ /**
119
+ * Reads a cart for a trusted server pipeline after the request boundary has
120
+ * already authenticated the caller. Organization scope is explicit; caller
121
+ * identity and guest secrets are intentionally not consulted here.
122
+ */
123
+ async getByIdForInternalUse(id, organizationId, ctx) {
124
+ const cart = await this.repo.findById(organizationId, id, ctx);
125
+ if (!cart)
126
+ return Err(new CommerceNotFoundError("Cart not found."));
127
+ const lineItems = await this.repo.findLineItemsByCartId(id, ctx);
128
+ return Ok({
129
+ ...cart,
130
+ lineItems,
131
+ });
132
+ }
133
+ async addItem(input, actor, ctx, presentedSecret) {
116
134
  try {
117
135
  assertPermission(actor ?? null, "cart:update");
118
136
  }
119
137
  catch (error) {
120
138
  return Err(toCommerceError(error));
121
139
  }
122
- const orgId = resolveOrgId(actor ?? null);
140
+ const orgId = resolveOrgIdForCommerce(actor ?? null, this.deps.config);
123
141
  const cart = await this.repo.findById(orgId, input.cartId, ctx);
124
142
  if (!cart)
125
143
  return Err(new CommerceNotFoundError("Cart not found."));
126
144
  try {
127
- await this.assertCartOwnership(actor ?? null, cart, ctx);
145
+ await this.assertCartOwnership(actor ?? null, cart, ctx, presentedSecret);
128
146
  }
129
147
  catch (error) {
130
148
  return Err(toCommerceError(error));
@@ -153,7 +171,7 @@ export class CartService {
153
171
  },
154
172
  ]));
155
173
  }
156
- const context = makeContext(actor ?? null, this.deps.services, this.deps.database, ctx?.tx);
174
+ const context = makeContext(actor ?? null, this.deps.services, this.deps.database, this.deps.config, ctx?.tx);
157
175
  const beforeHooks = this.deps.hooks.resolve("cart.beforeAddItem");
158
176
  const afterHooks = this.deps.hooks.resolve("cart.afterAddItem");
159
177
  const processed = await runBeforeHooks(beforeHooks, input, "addItem", context);
@@ -188,19 +206,19 @@ export class CartService {
188
206
  await runAfterHooks(afterHooks, null, item, "addItem", context);
189
207
  return Ok(item);
190
208
  }
191
- async removeItem(cartId, itemId, actor, ctx) {
209
+ async removeItem(cartId, itemId, actor, ctx, presentedSecret) {
192
210
  try {
193
211
  assertPermission(actor ?? null, "cart:update");
194
212
  }
195
213
  catch (error) {
196
214
  return Err(toCommerceError(error));
197
215
  }
198
- const orgId = resolveOrgId(actor ?? null);
216
+ const orgId = resolveOrgIdForCommerce(actor ?? null, this.deps.config);
199
217
  const cart = await this.repo.findById(orgId, cartId, ctx);
200
218
  if (!cart)
201
219
  return Err(new CommerceNotFoundError("Cart not found."));
202
220
  try {
203
- await this.assertCartOwnership(actor ?? null, cart, ctx);
221
+ await this.assertCartOwnership(actor ?? null, cart, ctx, presentedSecret);
204
222
  }
205
223
  catch (error) {
206
224
  return Err(toCommerceError(error));
@@ -209,7 +227,7 @@ export class CartService {
209
227
  if (!existing || existing.cartId !== cartId) {
210
228
  return Err(new CommerceNotFoundError("Cart item not found."));
211
229
  }
212
- const context = makeContext(actor ?? null, this.deps.services, this.deps.database, ctx?.tx);
230
+ const context = makeContext(actor ?? null, this.deps.services, this.deps.database, this.deps.config, ctx?.tx);
213
231
  const beforeHooks = this.deps.hooks.resolve("cart.beforeRemoveItem");
214
232
  const afterHooks = this.deps.hooks.resolve("cart.afterRemoveItem");
215
233
  await runBeforeHooks(beforeHooks, existing, "removeItem", context);
@@ -217,19 +235,19 @@ export class CartService {
217
235
  await runAfterHooks(afterHooks, existing, existing, "removeItem", context);
218
236
  return Ok(undefined);
219
237
  }
220
- async updateQuantity(input, actor, ctx) {
238
+ async updateQuantity(input, actor, ctx, presentedSecret) {
221
239
  try {
222
240
  assertPermission(actor ?? null, "cart:update");
223
241
  }
224
242
  catch (error) {
225
243
  return Err(toCommerceError(error));
226
244
  }
227
- const orgId = resolveOrgId(actor ?? null);
245
+ const orgId = resolveOrgIdForCommerce(actor ?? null, this.deps.config);
228
246
  const cart = await this.repo.findById(orgId, input.cartId, ctx);
229
247
  if (!cart)
230
248
  return Err(new CommerceNotFoundError("Cart not found."));
231
249
  try {
232
- await this.assertCartOwnership(actor ?? null, cart, ctx);
250
+ await this.assertCartOwnership(actor ?? null, cart, ctx, presentedSecret);
233
251
  }
234
252
  catch (error) {
235
253
  return Err(toCommerceError(error));
@@ -241,7 +259,7 @@ export class CartService {
241
259
  if (input.quantity <= 0) {
242
260
  return Err(new CommerceValidationError("Quantity must be greater than zero."));
243
261
  }
244
- const context = makeContext(actor ?? null, this.deps.services, this.deps.database, ctx?.tx);
262
+ const context = makeContext(actor ?? null, this.deps.services, this.deps.database, this.deps.config, ctx?.tx);
245
263
  const beforeHooks = this.deps.hooks.resolve("cart.beforeUpdateQuantity");
246
264
  const afterHooks = this.deps.hooks.resolve("cart.afterUpdateQuantity");
247
265
  await runBeforeHooks(beforeHooks, input, "update", context);
@@ -259,7 +277,7 @@ export class CartService {
259
277
  catch (error) {
260
278
  return Err(toCommerceError(error));
261
279
  }
262
- const orgId = resolveOrgId(actor ?? null);
280
+ const orgId = resolveOrgIdForCommerce(actor ?? null, this.deps.config);
263
281
  const source = await this.repo.findById(orgId, sourceCartId, ctx);
264
282
  const target = await this.repo.findById(orgId, targetCartId, ctx);
265
283
  if (!source || !target)
@@ -294,7 +312,7 @@ export class CartService {
294
312
  catch (error) {
295
313
  return Err(toCommerceError(error));
296
314
  }
297
- const orgId = resolveOrgId(actor ?? ctx?.actor ?? null);
315
+ const orgId = resolveOrgIdForCommerce(actor ?? ctx?.actor ?? null, this.deps.config);
298
316
  const rows = await this.repo.list(orgId, {
299
317
  ...(filter?.status !== undefined ? { status: filter.status } : {}),
300
318
  ...(filter?.olderThan !== undefined ? { olderThan: filter.olderThan } : {}),
@@ -316,7 +334,7 @@ export class CartService {
316
334
  catch (error) {
317
335
  return Err(toCommerceError(error));
318
336
  }
319
- const orgId = resolveOrgId(actor ?? ctx?.actor ?? null);
337
+ const orgId = resolveOrgIdForCommerce(actor ?? ctx?.actor ?? null, this.deps.config);
320
338
  const cart = await this.repo.findById(orgId, cartId, ctx);
321
339
  if (!cart)
322
340
  return Err(new CommerceNotFoundError("Cart not found."));
@@ -328,7 +346,7 @@ export class CartService {
328
346
  const expiresAt = new Date(Date.now() + ttlMinutes * 60 * 1000);
329
347
  const updated = await this.repo.update(cart.id, { status: "active", secret, expiresAt }, ctx);
330
348
  const afterHooks = this.deps.hooks.resolve("cart.afterRecover");
331
- await runAfterHooks(afterHooks, null, updated ?? cart, "recover", makeContext(actor ?? null, this.deps.services, this.deps.database, ctx?.tx ?? null));
349
+ await runAfterHooks(afterHooks, null, updated ?? cart, "recover", makeContext(actor ?? null, this.deps.services, this.deps.database, this.deps.config, ctx?.tx ?? null));
332
350
  return Ok({
333
351
  cartId: cart.id,
334
352
  secret,
@@ -339,7 +357,7 @@ export class CartService {
339
357
  });
340
358
  }
341
359
  async abandon(cartId, actor, ctx) {
342
- const orgId = resolveOrgId(actor ?? ctx?.actor ?? null);
360
+ const orgId = resolveOrgIdForCommerce(actor ?? ctx?.actor ?? null, this.deps.config);
343
361
  const cart = await this.repo.findById(orgId, cartId, ctx);
344
362
  if (!cart)
345
363
  return Err(new CommerceNotFoundError("Cart not found."));
@@ -347,20 +365,22 @@ export class CartService {
347
365
  return Ok(undefined);
348
366
  }
349
367
  async markAsCheckedOut(cartId, actor, ctx) {
350
- const orgId = resolveOrgId(actor ?? ctx?.actor ?? null);
368
+ const orgId = resolveOrgIdForCommerce(actor ?? ctx?.actor ?? null, this.deps.config);
351
369
  const cart = await this.repo.findById(orgId, cartId, ctx);
352
370
  if (!cart)
353
371
  return Err(new CommerceNotFoundError("Cart not found."));
354
- await this.repo.updateStatus(cartId, "checked_out", ctx);
372
+ await this.repo.update(cartId, { status: "checked_out", checkoutClaimToken: null }, ctx);
355
373
  return Ok(undefined);
356
374
  }
357
375
  /**
358
- * Atomically transitions a cart from "active" to "checking_out".
359
- * Returns Err if the cart was already claimed by a concurrent checkout.
360
- * This prevents TOCTOU race conditions on double-checkout.
376
+ * Atomically transitions a cart from "active" to "checking_out", recording
377
+ * `claimToken` as the holder. Returns Err if the cart was already claimed by
378
+ * a concurrent checkout. This prevents TOCTOU race conditions on
379
+ * double-checkout, and the token is what lets {@link releaseCheckoutClaim}
380
+ * tell the winner's release from a loser's.
361
381
  */
362
- async claimForCheckout(cartId, ctx) {
363
- const claimed = await this.repo.transitionToCheckingOut(cartId, ctx);
382
+ async claimForCheckout(cartId, claimToken, ctx) {
383
+ const claimed = await this.repo.transitionToCheckingOut(cartId, claimToken, ctx);
364
384
  if (!claimed) {
365
385
  return Err(new CommerceValidationError("Cart is not available for checkout. It may have already been checked out by a concurrent request."));
366
386
  }
@@ -368,10 +388,13 @@ export class CartService {
368
388
  }
369
389
  /**
370
390
  * Atomically returns a failed checkout claim to `active`. A checked-out,
371
- * merged, abandoned, or already-active cart is left untouched.
391
+ * merged, abandoned, or already-active cart is left untouched — and so is a
392
+ * claim held by a different checkout attempt, so a losing attempt's failure
393
+ * path cannot reopen the cart the winner is still checking out. Returns null
394
+ * when nothing was released.
372
395
  */
373
- async releaseCheckoutClaim(cartId, ctx) {
374
- return Ok((await this.repo.releaseCheckoutClaim(cartId, ctx)) ?? null);
396
+ async releaseCheckoutClaim(cartId, claimToken, ctx) {
397
+ return Ok((await this.repo.releaseCheckoutClaim(cartId, claimToken, ctx)) ?? null);
375
398
  }
376
399
  /**
377
400
  * Creates an anonymous guest cart with a secret token for access control.
@@ -383,7 +406,8 @@ export class CartService {
383
406
  const ttlMinutes = this.deps.config.cart?.ttlMinutes ?? 60 * 24 * 7;
384
407
  const now = new Date();
385
408
  const cart = await this.repo.create({
386
- organizationId: resolveOrgId(null),
409
+ // Actor-less by design; resolves to the deployment's declared organization.
410
+ organizationId: resolveOrgIdForCommerce(null, this.deps.config),
387
411
  customerId: undefined,
388
412
  status: "active",
389
413
  currency,
@@ -399,7 +423,7 @@ export class CartService {
399
423
  * The source cart's secret must be provided for access control.
400
424
  */
401
425
  async mergeCarts(targetCartId, sourceCartId, sourceSecret, actor, ctx) {
402
- const orgId = resolveOrgId(actor);
426
+ const orgId = resolveOrgIdForCommerce(actor, this.deps.config);
403
427
  const sourceCart = await this.repo.findById(orgId, sourceCartId, ctx);
404
428
  if (!sourceCart || sourceCart.secret !== sourceSecret) {
405
429
  return Err(new CommerceValidationError("Invalid cart or cart secret."));
@@ -1,4 +1,4 @@
1
- import { resolveOrgId } from "../../auth/org.js";
1
+ import { resolveOrgIdForCommerce } from "../../auth/org.js";
2
2
  import { assertPermission } from "../../auth/permissions.js";
3
3
  import { CommerceConflictError, CommerceNotFoundError, toCommerceError, } from "../../kernel/errors.js";
4
4
  import { Err, Ok } from "../../kernel/result.js";
@@ -13,13 +13,13 @@ export class BrandService {
13
13
  assertSameOrg(resource, actor) {
14
14
  if (!resource)
15
15
  return;
16
- const orgId = resolveOrgId(actor);
16
+ const orgId = resolveOrgIdForCommerce(actor, this.deps.config);
17
17
  if (resource.organizationId && resource.organizationId !== orgId) {
18
18
  throw new CommerceNotFoundError("Entity not found.");
19
19
  }
20
20
  }
21
21
  async listBrands(ctx) {
22
- const allBrands = await this.repo.findAllBrands(resolveOrgId(ctx?.actor ?? null), ctx);
22
+ const allBrands = await this.repo.findAllBrands(resolveOrgIdForCommerce(ctx?.actor ?? null, this.deps.config), ctx);
23
23
  return Ok(allBrands.sort((a, b) => a.displayName.localeCompare(b.displayName)));
24
24
  }
25
25
  async createBrand(input, actor, ctx) {
@@ -29,7 +29,7 @@ export class BrandService {
29
29
  if (existingById)
30
30
  return Err(new CommerceConflictError(`Brand with id ${input.id} already exists.`));
31
31
  }
32
- const orgId = resolveOrgId(actor);
32
+ const orgId = resolveOrgIdForCommerce(actor, this.deps.config);
33
33
  const existingBySlug = await this.repo.findBrandBySlug(orgId, input.slug, ctx);
34
34
  if (existingBySlug)
35
35
  return Err(new CommerceConflictError(`Brand with slug ${input.slug} already exists.`));
@@ -47,7 +47,7 @@ export class BrandService {
47
47
  return Err(toCommerceError(error));
48
48
  }
49
49
  if (input.slug) {
50
- const existingBySlug = await this.repo.findBrandBySlug(resolveOrgId(actor), input.slug, ctx);
50
+ const existingBySlug = await this.repo.findBrandBySlug(resolveOrgIdForCommerce(actor, this.deps.config), input.slug, ctx);
51
51
  if (existingBySlug && existingBySlug.id !== id)
52
52
  return Err(new CommerceConflictError(`Brand with slug ${input.slug} already exists.`));
53
53
  }
@@ -87,7 +87,7 @@ export class BrandService {
87
87
  catch (error) {
88
88
  return Err(toCommerceError(error));
89
89
  }
90
- const addBrandOrgId = resolveOrgId(actor ?? ctx?.actor ?? null);
90
+ const addBrandOrgId = resolveOrgIdForCommerce(actor ?? ctx?.actor ?? null, this.deps.config);
91
91
  const isBrandUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(brandId);
92
92
  let brand = isBrandUuid ? await this.repo.findBrandById(brandId, ctx) : null;
93
93
  if (!brand)
@@ -117,7 +117,7 @@ export class BrandService {
117
117
  const isBrUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(brandId);
118
118
  let brand = isBrUuid ? await this.repo.findBrandById(brandId, ctx) : null;
119
119
  if (!brand)
120
- brand = await this.repo.findBrandBySlug(resolveOrgId(actor ?? ctx?.actor ?? null), brandId, ctx);
120
+ brand = await this.repo.findBrandBySlug(resolveOrgIdForCommerce(actor ?? ctx?.actor ?? null, this.deps.config), brandId, ctx);
121
121
  const removed = await this.repo.removeEntityFromBrand(entityId, brand?.id ?? brandId, ctx);
122
122
  if (!removed)
123
123
  return Err(new CommerceNotFoundError("Brand assignment not found."));
@@ -1,4 +1,4 @@
1
- import { resolveOrgId } from "../../auth/org.js";
1
+ import { resolveOrgIdForCommerce } from "../../auth/org.js";
2
2
  import { assertPermission } from "../../auth/permissions.js";
3
3
  import { CommerceConflictError, CommerceNotFoundError, toCommerceError, } from "../../kernel/errors.js";
4
4
  import { Err, Ok } from "../../kernel/result.js";
@@ -13,13 +13,13 @@ export class CategoryService {
13
13
  assertSameOrg(resource, actor) {
14
14
  if (!resource)
15
15
  return;
16
- const orgId = resolveOrgId(actor);
16
+ const orgId = resolveOrgIdForCommerce(actor, this.deps.config);
17
17
  if (resource.organizationId && resource.organizationId !== orgId) {
18
18
  throw new CommerceNotFoundError("Entity not found.");
19
19
  }
20
20
  }
21
21
  async listCategories(ctx, opts) {
22
- const allCategories = await this.repo.findAllCategories(resolveOrgId(ctx?.actor ?? null), ctx);
22
+ const allCategories = await this.repo.findAllCategories(resolveOrgIdForCommerce(ctx?.actor ?? null, this.deps.config), ctx);
23
23
  const visible = opts?.includeArchived
24
24
  ? allCategories
25
25
  : allCategories.filter((c) => (c.status ?? "active") === "active");
@@ -60,7 +60,7 @@ export class CategoryService {
60
60
  if (existingById)
61
61
  return Err(new CommerceConflictError(`Category with id ${input.id} already exists.`));
62
62
  }
63
- const orgId = resolveOrgId(actor);
63
+ const orgId = resolveOrgIdForCommerce(actor, this.deps.config);
64
64
  const existingBySlug = await this.repo.findCategoryBySlug(orgId, input.slug, ctx);
65
65
  if (existingBySlug)
66
66
  return Err(new CommerceConflictError(`Category with slug ${input.slug} already exists.`));
@@ -79,7 +79,7 @@ export class CategoryService {
79
79
  return Err(toCommerceError(error));
80
80
  }
81
81
  if (input.slug) {
82
- const existingBySlug = await this.repo.findCategoryBySlug(resolveOrgId(actor), input.slug, ctx);
82
+ const existingBySlug = await this.repo.findCategoryBySlug(resolveOrgIdForCommerce(actor, this.deps.config), input.slug, ctx);
83
83
  if (existingBySlug && existingBySlug.id !== id)
84
84
  return Err(new CommerceConflictError(`Category with slug ${input.slug} already exists.`));
85
85
  }
@@ -119,7 +119,7 @@ export class CategoryService {
119
119
  catch (error) {
120
120
  return Err(toCommerceError(error));
121
121
  }
122
- const addCatOrgId = resolveOrgId(actor ?? ctx?.actor ?? null);
122
+ const addCatOrgId = resolveOrgIdForCommerce(actor ?? ctx?.actor ?? null, this.deps.config);
123
123
  const isUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(categoryId);
124
124
  let category = isUuid ? await this.repo.findCategoryById(categoryId, ctx) : null;
125
125
  if (!category)
@@ -149,7 +149,7 @@ export class CategoryService {
149
149
  const isCatUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(categoryId);
150
150
  let category = isCatUuid ? await this.repo.findCategoryById(categoryId, ctx) : null;
151
151
  if (!category)
152
- category = await this.repo.findCategoryBySlug(resolveOrgId(actor ?? ctx?.actor ?? null), categoryId, ctx);
152
+ category = await this.repo.findCategoryBySlug(resolveOrgIdForCommerce(actor ?? ctx?.actor ?? null, this.deps.config), categoryId, ctx);
153
153
  const removed = await this.repo.removeEntityFromCategory(entityId, category?.id ?? categoryId, ctx);
154
154
  if (!removed)
155
155
  return Err(new CommerceNotFoundError("Category assignment not found."));
@@ -1,6 +1,6 @@
1
1
  import type { Actor } from "../../auth/types.js";
2
2
  import { type Result } from "../../kernel/result.js";
3
- import type { TxContext } from "../../kernel/database/tx-context.js";
3
+ import type { CatalogWriteContext, TxContext } from "../../kernel/database/tx-context.js";
4
4
  import type { CatalogServiceDeps, CatalogEntityHydrated, CatalogListResult, CreateEntityInput, GetOptions, ListParams, SetAttributesInput, UpdateEntityInput, VariantGenerationStrategy, CreateOptionTypeInput, CreateOptionValueInput, CreateVariantInput, EntityFieldDefinitionResolver } from "./service.js";
5
5
  import type { SellableAttribute, OptionType, OptionValue, Variant } from "./repository/index.js";
6
6
  export declare class EntityService {
@@ -14,17 +14,24 @@ export declare class EntityService {
14
14
  private writeCustomFields;
15
15
  private hydrateEntity;
16
16
  create(input: CreateEntityInput, actor: Actor | null, ctx?: TxContext): Promise<Result<CatalogEntityHydrated>>;
17
- update(id: string, input: UpdateEntityInput, actor: Actor | null, ctx?: TxContext): Promise<Result<CatalogEntityHydrated>>;
17
+ update(id: string, input: UpdateEntityInput, actor: Actor | null, ctx?: CatalogWriteContext): Promise<Result<CatalogEntityHydrated>>;
18
18
  delete(id: string, actor: Actor | null, ctx?: TxContext): Promise<Result<void>>;
19
- getById(id: string, options?: GetOptions, actor?: Actor | null, ctx?: TxContext): Promise<Result<CatalogEntityHydrated>>;
20
- getBySlug(slug: string, options?: GetOptions, actor?: Actor | null, ctx?: TxContext): Promise<Result<CatalogEntityHydrated>>;
21
- list(params: ListParams, actor?: Actor | null, ctx?: TxContext): Promise<Result<CatalogListResult>>;
19
+ getById(id: string, options: GetOptions | undefined, actor: Actor | null, ctx?: TxContext): Promise<Result<CatalogEntityHydrated>>;
20
+ /**
21
+ * Reads an entity for a trusted server pipeline after the request boundary
22
+ * has already authorized the caller. Organization scope is explicit; the
23
+ * storefront visibility policy is intentionally not applied, so an internal
24
+ * invariant check never depends on the caller's catalog permissions.
25
+ */
26
+ getByIdForInternalUse(id: string, organizationId: string, options?: GetOptions, ctx?: TxContext): Promise<Result<CatalogEntityHydrated>>;
27
+ getBySlug(slug: string, options: GetOptions | undefined, actor: Actor | null, ctx?: TxContext): Promise<Result<CatalogEntityHydrated>>;
28
+ list(params: ListParams, actor: Actor | null, ctx?: TxContext): Promise<Result<CatalogListResult>>;
22
29
  private changeStatus;
23
30
  publish(id: string, actor: Actor | null, ctx?: TxContext): Promise<Result<CatalogEntityHydrated>>;
24
31
  archive(id: string, actor: Actor | null, ctx?: TxContext): Promise<Result<CatalogEntityHydrated>>;
25
32
  discontinue(id: string, actor: Actor | null, ctx?: TxContext): Promise<Result<CatalogEntityHydrated>>;
26
- setAttributes(entityId: string, locale: string, attrs: SetAttributesInput, actor: Actor | null, ctx?: TxContext): Promise<Result<void>>;
27
- getAttributes(entityId: string, locale: string, ctx?: TxContext): Promise<Result<SellableAttribute>>;
33
+ setAttributes(entityId: string, locale: string, attrs: SetAttributesInput, actor: Actor | null, ctx?: CatalogWriteContext): Promise<Result<void>>;
34
+ getAttributes(entityId: string, locale: string, actor: Actor | null, ctx?: TxContext): Promise<Result<SellableAttribute>>;
28
35
  createOptionType(input: CreateOptionTypeInput, actor: Actor | null, ctx?: TxContext): Promise<Result<OptionType>>;
29
36
  createOptionValue(input: CreateOptionValueInput, actor: Actor | null, ctx?: TxContext): Promise<Result<OptionValue>>;
30
37
  createVariant(input: CreateVariantInput, actor: Actor | null, ctx?: TxContext): Promise<Result<Variant>>;
@@ -1 +1 @@
1
- {"version":3,"file":"entity-service.d.ts","sourceRoot":"","sources":["../../../src/modules/catalog/entity-service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAkBjD,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAI9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,6BAA6B,EAC9B,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAEV,iBAAiB,EAGjB,UAAU,EACV,WAAW,EACX,OAAO,EACR,MAAM,uBAAuB,CAAC;AA0C/B,qBAAa,aAAa;IAEtB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,6BAA6B;gBAD7B,IAAI,EAAE,kBAAkB,EACxB,6BAA6B,EAAE,6BAA6B;IAG/E,OAAO,KAAK,IAAI,GAEf;IAED,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,oBAAoB;YAId,oBAAoB;YAkFpB,iBAAiB;YAYjB,aAAa;IAkDrB,MAAM,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,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