@spinekit/purchase 0.1.0 → 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,6 +1,12 @@
1
1
  # Changelog
2
2
 
3
- ## 0.1.0 - 2026-08-21
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
+
9
+ ## 0.1.1 - 2026-08-21
4
10
 
5
11
  ### Changed
6
12
  - **License:** relicensed from MIT to the **Classytic Source-Available License**
@@ -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.0",
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",
@@ -74,13 +74,6 @@
74
74
  "README.md",
75
75
  "CHANGELOG.md"
76
76
  ],
77
- "scripts": {
78
- "build": "tsdown",
79
- "typecheck": "tsc --noEmit",
80
- "test": "vitest run",
81
- "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\"",
82
- "prepublishOnly": "npm run typecheck && npm run test && npm run build"
83
- },
84
77
  "peerDependencies": {
85
78
  "@classytic/arc": ">=2.34.0",
86
79
  "@spinekit/kit": ">=0.1.0",
@@ -92,7 +85,6 @@
92
85
  },
93
86
  "devDependencies": {
94
87
  "@classytic/arc": "^2.34.0",
95
- "@spinekit/kit": "workspace:*",
96
88
  "@classytic/arc-testkit": "^0.4.0",
97
89
  "@classytic/mongokit": ">=3.34.0",
98
90
  "@classytic/primitives": ">=0.23.0",
@@ -104,7 +96,8 @@
104
96
  "tsdown": "^0.22.14",
105
97
  "typescript": "^7.0.2",
106
98
  "vitest": "^3.2.4",
107
- "zod": "^4.3.6"
99
+ "zod": "^4.3.6",
100
+ "@spinekit/kit": "0.1.1"
108
101
  },
109
102
  "author": "Classytic",
110
103
  "homepage": "https://www.npmjs.com/package/@spinekit/purchase",
@@ -125,5 +118,11 @@
125
118
  ],
126
119
  "publishConfig": {
127
120
  "access": "public"
121
+ },
122
+ "scripts": {
123
+ "build": "tsdown",
124
+ "typecheck": "tsc --noEmit",
125
+ "test": "vitest run",
126
+ "clean": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\""
128
127
  }
129
- }
128
+ }