@spinekit/purchase 0.3.0 → 0.4.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 +21 -0
- package/dist/{entity-model-D-03ovSg.mjs → entity-model-DUlcwEr1.mjs} +1 -4
- package/dist/resources/purchase-order/purchase-order.resource.mjs +2 -2
- package/dist/resources/supplier/supplier.resource.d.mts +22 -0
- package/dist/resources/supplier/supplier.resource.mjs +4 -2
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0 — 2026-09-04
|
|
4
|
+
|
|
5
|
+
### Added — `disabledRoutes` and `extraActions` on `SupplierResourceDeps`
|
|
6
|
+
|
|
7
|
+
`createSupplierResource` now accepts two additional optional knobs:
|
|
8
|
+
|
|
9
|
+
- `disabledRoutes` — passed straight to `defineResource`. Lets the host omit CRUD
|
|
10
|
+
slots that should not exist for a given deployment (e.g. disable `delete` when the
|
|
11
|
+
supplier is a party-identity facet so nothing silently orphans the role grant).
|
|
12
|
+
- `extraActions` — passed to `defineResource` as `actions`. Additional verbs on
|
|
13
|
+
`POST /:id/action`; each carries its own `permissions`. Intended for the retirement
|
|
14
|
+
verb that replaces a disabled delete, and any other vertical-specific verb.
|
|
15
|
+
|
|
16
|
+
Both props are optional with no default, so the existing `0.3.0` surface is unchanged.
|
|
17
|
+
|
|
18
|
+
### Changed — peer floors raised to current
|
|
19
|
+
|
|
20
|
+
- `@classytic/arc` `>=2.36.0` → **`>=2.38.0`**
|
|
21
|
+
- `@classytic/primitives` `>=0.26.2` → **`>=0.26.4`**
|
|
22
|
+
- `@spinekit/kit` `>=0.1.0` → **`>=0.4.0`**
|
|
23
|
+
|
|
3
24
|
## 0.3.0 - 2026-08-24
|
|
4
25
|
|
|
5
26
|
### Added
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
//#region src/entity-model.ts
|
|
2
|
-
function asEntityModel(model) {
|
|
3
|
-
return model;
|
|
4
|
-
}
|
|
5
2
|
/**
|
|
6
3
|
* Arc's resource layer (custom-controller path) speaks `AnyRecord` — an
|
|
7
4
|
* index-signed record — while the kernel repository is typed on the CLOSED
|
|
@@ -20,4 +17,4 @@ function asRecord(doc) {
|
|
|
20
17
|
return doc;
|
|
21
18
|
}
|
|
22
19
|
//#endregion
|
|
23
|
-
export {
|
|
20
|
+
export { asRecordRepository as n, asRecord as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { n as asRecordRepository, t as asRecord } from "../../entity-model-DUlcwEr1.mjs";
|
|
2
2
|
import { BaseController, defineResource } from "@classytic/arc";
|
|
3
3
|
import { permissionMatrix } from "@classytic/arc/permissions";
|
|
4
4
|
import { getUserId, scopeFirstCtx } from "@classytic/arc/scope";
|
|
@@ -120,7 +120,7 @@ function createPurchaseOrderResource(args) {
|
|
|
120
120
|
audit: true,
|
|
121
121
|
tenantField: false,
|
|
122
122
|
adapter: createMongooseAdapter({
|
|
123
|
-
model:
|
|
123
|
+
model: engine.models.PurchaseOrder,
|
|
124
124
|
repository: asRecordRepository(engine.repositories.purchaseOrder)
|
|
125
125
|
}),
|
|
126
126
|
controller: new PurchaseOrderModuleController(),
|
|
@@ -28,6 +28,28 @@ interface SupplierResourceDeps<TSupplier extends SupplierFacet = SupplierFacet>
|
|
|
28
28
|
* Absent, behaviour is unchanged — this is additive.
|
|
29
29
|
*/
|
|
30
30
|
queryParser?: Parameters<typeof defineResource>[0]['queryParser'];
|
|
31
|
+
/**
|
|
32
|
+
* CRUD slots to leave UNMOUNTED. Absent ⇒ all five mount, unchanged.
|
|
33
|
+
*
|
|
34
|
+
* The route surface is the host's to shape: a supplier-management portal wants
|
|
35
|
+
* full CRUD, while a deployment where the supplier is a facet of a party
|
|
36
|
+
* identity must not hard-delete one — the identity root would keep granting the
|
|
37
|
+
* `supplier` role with nothing left pointing at it, and no event would say so.
|
|
38
|
+
*
|
|
39
|
+
* `disabledRoutes`, not a deny-gate: the declared surface IS the intended
|
|
40
|
+
* surface, so a slot the host excludes should not exist rather than exist
|
|
41
|
+
* behind a lock (FAIL LOUD rule 5).
|
|
42
|
+
*/
|
|
43
|
+
disabledRoutes?: Parameters<typeof defineResource>[0]['disabledRoutes'];
|
|
44
|
+
/**
|
|
45
|
+
* Host actions mounted on `POST /:id/action` — the retirement verb that
|
|
46
|
+
* replaces `delete` when the host disables it, and anything else a vertical
|
|
47
|
+
* needs.
|
|
48
|
+
*
|
|
49
|
+
* Each action carries its OWN `permissions`; this factory does not supply a
|
|
50
|
+
* default, so an ungated action is the host's declaration, not an inherited one.
|
|
51
|
+
*/
|
|
52
|
+
extraActions?: Parameters<typeof defineResource>[0]['actions'];
|
|
31
53
|
}
|
|
32
54
|
declare function createSupplierResource<TSupplier extends SupplierFacet = SupplierFacet>(deps: SupplierResourceDeps<TSupplier>): import("@classytic/arc").ResourceDefinition<AnyRecord>;
|
|
33
55
|
//#endregion
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as asRecordRepository } from "../../entity-model-DUlcwEr1.mjs";
|
|
2
2
|
import { defineResource } from "@classytic/arc";
|
|
3
3
|
import { ValidationError } from "@classytic/arc/utils";
|
|
4
4
|
import { createMongooseAdapter } from "@classytic/mongokit/adapter";
|
|
@@ -23,7 +23,7 @@ import { buildCrudSchemasFromModel } from "@classytic/mongokit/utils";
|
|
|
23
23
|
/** Import batch ceiling. Row-by-row work is linear, so the cap bounds the request, not the loop. */
|
|
24
24
|
const IMPORT_MAX_ROWS = 500;
|
|
25
25
|
function createSupplierResource(deps) {
|
|
26
|
-
const { model, repository, permissions, prefix = "/inventory/suppliers", extraFilterableFields, queryParser } = deps;
|
|
26
|
+
const { model, repository, permissions, prefix = "/inventory/suppliers", extraFilterableFields, queryParser, disabledRoutes, extraActions } = deps;
|
|
27
27
|
/**
|
|
28
28
|
* Wire schemas derived FROM THE MODEL, so a country pack's `extraFields` are accepted without
|
|
29
29
|
* anyone remembering to widen a hand-written schema — and `strictAdditionalProperties` still
|
|
@@ -87,6 +87,8 @@ function createSupplierResource(deps) {
|
|
|
87
87
|
};
|
|
88
88
|
return defineResource({
|
|
89
89
|
...queryParser ? { queryParser } : {},
|
|
90
|
+
...disabledRoutes?.length ? { disabledRoutes } : {},
|
|
91
|
+
...extraActions ? { actions: extraActions } : {},
|
|
90
92
|
name: "supplier",
|
|
91
93
|
displayName: "Suppliers",
|
|
92
94
|
tag: "Inventory - Suppliers",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spinekit/purchase",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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",
|
|
@@ -83,19 +83,19 @@
|
|
|
83
83
|
"CHANGELOG.md"
|
|
84
84
|
],
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@classytic/arc": ">=2.
|
|
87
|
-
"@
|
|
88
|
-
"@classytic/
|
|
89
|
-
"@classytic/primitives": ">=0.23.0",
|
|
86
|
+
"@classytic/arc": ">=2.38.0",
|
|
87
|
+
"@classytic/mongokit": ">=3.36.0",
|
|
88
|
+
"@classytic/primitives": ">=0.26.4",
|
|
90
89
|
"@classytic/purchase": ">=0.6.0",
|
|
90
|
+
"@spinekit/kit": ">=0.4.0",
|
|
91
91
|
"mongoose": ">=9.4.1",
|
|
92
92
|
"zod": ">=4.0.0"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
|
-
"@classytic/arc": "^2.
|
|
95
|
+
"@classytic/arc": "^2.38.0",
|
|
96
96
|
"@classytic/arc-testkit": "^0.4.0",
|
|
97
|
-
"@classytic/mongokit": "
|
|
98
|
-
"@classytic/primitives": ">=0.
|
|
97
|
+
"@classytic/mongokit": "^3.36.0",
|
|
98
|
+
"@classytic/primitives": ">=0.26.4",
|
|
99
99
|
"@classytic/purchase": ">=0.6.0",
|
|
100
100
|
"@types/node": "^24.3.0",
|
|
101
101
|
"fastify": "^5.12.0",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"typescript": "^7.0.2",
|
|
106
106
|
"vitest": "^3.2.4",
|
|
107
107
|
"zod": "^4.3.6",
|
|
108
|
-
"@spinekit/kit": "0.
|
|
108
|
+
"@spinekit/kit": "0.4.0"
|
|
109
109
|
},
|
|
110
110
|
"author": "Classytic",
|
|
111
111
|
"homepage": "https://www.npmjs.com/package/@spinekit/purchase",
|