@tokenoftrust/storefront-runner 7.6.4 → 7.6.5
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.
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* - the ROLE-GATED routes in {@link AGENT_ROLE_ROUTES}, each only while the agent's
|
|
15
15
|
* grant roles name that route's role: the PII-blind order reads (`admin:read`) and
|
|
16
16
|
* the fulfil-by-id operation (`orders:fulfil-by-id`, which tot20 still decides per
|
|
17
|
-
* call)
|
|
17
|
+
* call), and the stock levels and movement history reads (`admin:read`). Those
|
|
18
|
+
* handlers project an agent's view; the gate only admits.
|
|
18
19
|
*
|
|
19
20
|
* Everything else — every other `/api` route (so no derived credential such as the
|
|
20
21
|
* CLI sign-in code or the activity-ingest token), `/admin`, `/cockpit`, `/dev`,
|
|
@@ -41,6 +42,8 @@ export const AGENT_ALLOWED_ROUTES: ReadonlyArray<{ method: string; path: string
|
|
|
41
42
|
export const AGENT_ROLE_ROUTES: ReadonlyArray<{ method: string; path: string; role: AgentRoleId }> = [
|
|
42
43
|
{ method: "GET", path: "/api/admin/orders", role: ADMIN_READ_ROLE },
|
|
43
44
|
{ method: "GET", path: "/api/admin/orders/:id", role: ADMIN_READ_ROLE },
|
|
45
|
+
{ method: "GET", path: "/api/admin/inventory/levels", role: ADMIN_READ_ROLE },
|
|
46
|
+
{ method: "GET", path: "/api/admin/inventory/history", role: ADMIN_READ_ROLE },
|
|
44
47
|
{ method: "POST", path: "/api/admin/fulfillment/fulfil-by-id", role: ORDERS_FULFIL_BY_ID_ROLE },
|
|
45
48
|
];
|
|
46
49
|
|
|
@@ -1006,19 +1006,30 @@ export async function importSourceOnHand(
|
|
|
1006
1006
|
input: {
|
|
1007
1007
|
tenantId: string;
|
|
1008
1008
|
stage: CommerceStage;
|
|
1009
|
-
lines: readonly { sku: string; onHand: number }[];
|
|
1009
|
+
lines: readonly { sku: string; onHand: number; locationId?: string }[];
|
|
1010
1010
|
runId: string;
|
|
1011
1011
|
asOf: string;
|
|
1012
1012
|
},
|
|
1013
1013
|
): Promise<void> {
|
|
1014
1014
|
for (const line of input.lines) {
|
|
1015
|
+
const locationId = line.locationId ?? MIRROR_LOCATION_UNSPECIFIED;
|
|
1016
|
+
if (!(await mirrorLocationKnown(db, { tenantId: input.tenantId, stage: input.stage, locationId }))) {
|
|
1017
|
+
throw new InventoryMovementError("invalid-movement");
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
for (const line of input.lines) {
|
|
1021
|
+
const locationId = line.locationId ?? MIRROR_LOCATION_UNSPECIFIED;
|
|
1015
1022
|
await appendSourceOnHand(db, {
|
|
1016
1023
|
tenantId: input.tenantId,
|
|
1017
1024
|
stage: input.stage,
|
|
1018
1025
|
sku: line.sku,
|
|
1019
|
-
locationId
|
|
1026
|
+
locationId,
|
|
1020
1027
|
source: CATALOG_IMPORT_SOURCE,
|
|
1021
|
-
sourceEventId: await catalogImportEventId(
|
|
1028
|
+
sourceEventId: await catalogImportEventId(
|
|
1029
|
+
input.runId,
|
|
1030
|
+
locationId === MIRROR_LOCATION_UNSPECIFIED ? line.sku : `${line.sku}.${locationId}`,
|
|
1031
|
+
line.onHand,
|
|
1032
|
+
),
|
|
1022
1033
|
onHand: line.onHand,
|
|
1023
1034
|
asOf: input.asOf,
|
|
1024
1035
|
actorId: CATALOG_IMPORT_ACTOR_ID,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/storefront-runner",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.5",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
|
|
6
6
|
"packageManager": "pnpm@11.9.0",
|