@spinekit/purchase 0.1.1 → 0.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0 - 2026-08-23
4
+
5
+ ### Changed
6
+
7
+ - **`PurchaseStockReceiptDeps.skuRef` now accepts `string | Promise<string>`** — the correct key is the variant's stamped `skuRef` on the product document; a host resolving it must be allowed a read. Sync legacy derivations remain assignable — no existing host breaks. `createPurchaseStockReceipt` now `await`s the call.
8
+
3
9
  ## 0.1.1 - 2026-08-21
4
10
 
5
11
  ### Changed
@@ -64,7 +64,7 @@ async receive({ purchase, supplierName }) {
64
64
  resolved.push({
65
65
  productId,
66
66
  variantSku,
67
- skuRef: deps.skuRef(productId, variantSku),
67
+ skuRef: await deps.skuRef(productId, variantSku),
68
68
  quantity: Number(item.quantity ?? 0),
69
69
  costMinor: Number(item.costPrice ?? 0),
70
70
  destinationLocationCode
@@ -147,8 +147,15 @@ interface PurchaseStockReceiptDeps<TCtx extends PurchaseReceiptScope = PurchaseR
147
147
  * implementation for a deployment that provisions ahead of time.
148
148
  */
149
149
  ensureBranchReady(organizationId: string): Promise<void>;
150
- /** The host's `productId` (+ variant) → `skuRef` convention. */
151
- skuRef(productId: string, variantSku: string | null): string;
150
+ /**
151
+ * The host's `productId` (+ variant) -> `skuRef` resolution.
152
+ *
153
+ * May be async: the correct key is the variant's STAMPED `skuRef` (ADR
154
+ * `spine/docs/stock-identity-and-product-variants.md`), which lives on the
155
+ * product DOC — a host resolving it must be allowed a read. A sync legacy
156
+ * derivation remains assignable, so no existing host breaks.
157
+ */
158
+ skuRef(productId: string, variantSku: string | null): string | Promise<string>;
152
159
  /** Counterparty location goods arrive FROM — unbounded by design. */
153
160
  vendorLocationId: string;
154
161
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spinekit/purchase",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Arc module for @classytic/purchase — supplier purchase orders (draft→approve→receive with CAS + compensation + pendingStockReceipt crash heal) composed into arc apps. Paisa money wire; catalog/stockReceipt/sequence kernel ports injected; accounting posting + approval stay host seams.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -97,7 +97,7 @@
97
97
  "typescript": "^7.0.2",
98
98
  "vitest": "^3.2.4",
99
99
  "zod": "^4.3.6",
100
- "@spinekit/kit": "0.1.0"
100
+ "@spinekit/kit": "0.1.1"
101
101
  },
102
102
  "author": "Classytic",
103
103
  "homepage": "https://www.npmjs.com/package/@spinekit/purchase",