@tokenoftrust/cli 6.12.2 → 6.12.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenoftrust/cli",
|
|
3
|
-
"version": "6.12.
|
|
3
|
+
"version": "6.12.3",
|
|
4
4
|
"description": "Token of Trust developer CLI — clone a tenant store, run it locally with save→reload, and submit it for preview. Installs the `tot` command.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Token of Trust",
|
|
@@ -45,11 +45,68 @@ tot app dev mint
|
|
|
45
45
|
offline — nothing here is a real ToT-issued credential. Run `tot app dev --help`
|
|
46
46
|
for the full command surface.
|
|
47
47
|
|
|
48
|
-
##
|
|
48
|
+
## Reference recipes & examples in the public Devkit
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
See [`https://github.com/tokenoftrust/storefront-devkit/tree/main/apps/private`](https://github.com/tokenoftrust/storefront-devkit/tree/main/apps/private)
|
|
51
|
+
for runnable reference connectors against the v1.3 contract:
|
|
52
|
+
|
|
53
|
+
- **`examples/hello-inventory`** — starter reference: locations (`GET`/`PUT /inventory/locations`),
|
|
54
|
+
mirror stock reads/writes (`GET /inventory`, `POST /inventory/movements`), and synthetic test
|
|
55
|
+
orders (`POST /api/apps/admin/test-orders`).
|
|
56
|
+
- **`recipes/inventory-sync-skuvault`** — multi-location WMS sync (SkuVault, Finale Inventory):
|
|
57
|
+
`GET`/`PUT /inventory/locations/{locationId}`, `PUT /inventory/levels` (`expectedVersion` CAS
|
|
58
|
+
reconciliation), batch `POST /inventory/movements` (`receive`, `pick`, `cycle_count`, `damage`,
|
|
59
|
+
`transfer_in`, `transfer_out`, `return_restock`), and `inventory.changed` webhooks (`low_stock`,
|
|
60
|
+
`out_of_stock`, `back_in_stock`).
|
|
61
|
+
- **`recipes/fulfillment-shipstation`** — shipping and label station (ShipStation, Shippo,
|
|
62
|
+
PirateShip): `fulfillment.assignment.created`/`updated`, `GET /fulfillment/assignments`,
|
|
63
|
+
`GET /fulfillment/orders/{orderId}/recipient`, `GET /fulfillment/carriers` (PACT Act &
|
|
64
|
+
`adultSignature` carrier profiles), 1:N split cartons
|
|
65
|
+
(`POST /fulfillment/assignments/{assignmentId}/shipments`), and whole-order `shipment-evidence`
|
|
66
|
+
(`label-purchased`, `label-voided`, `handed-off`).
|
|
67
|
+
- **`recipes/dropship-split-duoplane`** — 3PL and multi-vendor dropship routing (Duoplane, DSCO):
|
|
68
|
+
location-keyed processor coexistence per `(tenant, stage, location_id)` (Stone 1), assignments
|
|
69
|
+
with `locationId` and `lines[]` (`sku`, `quantity`, `fulfilledQuantity`, `cancelledQuantity`),
|
|
70
|
+
partial line shipments (`order.partially_fulfilled` -> `order.fulfilled`), and line exceptions
|
|
71
|
+
(`POST /fulfillment/assignments/{assignmentId}/exceptions`: `backordered`, `cannot_fulfill`,
|
|
72
|
+
`address_undeliverable`).
|
|
73
|
+
|
|
74
|
+
## Self-serve `env="test"` preview loop (v1.3)
|
|
75
|
+
|
|
76
|
+
Developers holding `preview-access` or `ship-on-behalf` on a store can verify an app end-to-end on
|
|
77
|
+
the preview stage without waiting on the store owner:
|
|
78
|
+
|
|
79
|
+
1. **Seed preview catalog & stock:**
|
|
80
|
+
```bash
|
|
81
|
+
tot catalog seed --store <tenant> --preset general|regulated-vape|multi-warehouse
|
|
82
|
+
# or inside a cloned store checkout:
|
|
83
|
+
tot catalog seed --preset=general|regulated-vape|multi-warehouse
|
|
84
|
+
```
|
|
85
|
+
2. **Self-serve install in `env="test"`:**
|
|
86
|
+
```bash
|
|
87
|
+
tot app install --store <tenant> --env test --manifest ./tot-app.json
|
|
88
|
+
# or inside your app directory:
|
|
89
|
+
tot app install --tenant <tenant> --env test
|
|
90
|
+
```
|
|
91
|
+
Manage your test install at any time with `tot app update <installId>`,
|
|
92
|
+
`tot app rotate <installId>`, `tot app list`, and `tot app replay <deliveryId>`.
|
|
93
|
+
3. **Trigger synthetic preview orders bound to the `test` install:**
|
|
94
|
+
Call `POST /api/apps/admin/test-orders` (`action: "bind" | "create" | "release"`) to bind your
|
|
95
|
+
`test` install as the preview fulfillment processor and emit synthetic preview orders with
|
|
96
|
+
RFC-reserved recipient fixtures. Preview tokens and webhooks are isolated by the stage wall
|
|
97
|
+
(`403 stage_mismatch` if used against live publication hosts).
|
|
98
|
+
|
|
99
|
+
## Going live (`private_key_jwt` candidate staging & 1-click Owner approval)
|
|
100
|
+
|
|
101
|
+
1. Point `webhooks.endpoint` at your real, publicly reachable HTTPS receiver and swap the dev-only
|
|
102
|
+
signature verification in `server.js` for the platform's published JWKS/signing-key metadata
|
|
103
|
+
(see the Devkit's
|
|
55
104
|
[`webhooks-and-api.md`](https://github.com/tokenoftrust/storefront-devkit/blob/main/apps/private/webhooks-and-api.md)).
|
|
105
|
+
2. **Stage a `private_key_jwt` `production` candidate (`pending_approval`):**
|
|
106
|
+
POST to `POST /api/apps/admin/candidates` with `tokenEndpointAuthMethod: "private_key_jwt"` and
|
|
107
|
+
your app's `jwksUri` or pinned `publicKeyJwk`. This records a `status: "pending_approval"`
|
|
108
|
+
production candidate with zero shared secrets to hand off.
|
|
109
|
+
3. **1-click Store Owner approval:**
|
|
110
|
+
The Store Owner reviews the requested scopes, webhook endpoint, and key metadata in
|
|
111
|
+
`/admin#integrations` and approves in 1 click (`POST /api/apps/admin/candidates/{candidateId}/approve`),
|
|
112
|
+
activating the `production` install immediately.
|
|
@@ -8,8 +8,17 @@
|
|
|
8
8
|
* Trusts the public key `tot app dev` wrote to .tot/dev-keys.json (re-read on
|
|
9
9
|
* every request, so it always sees the harness's current key). That file is
|
|
10
10
|
* dev-only scaffolding: your real receiver checks against the platform's
|
|
11
|
-
* published JWKS/signing-key metadata instead — see the
|
|
12
|
-
*
|
|
11
|
+
* published JWKS/signing-key metadata instead — see the Devkit's
|
|
12
|
+
* https://github.com/tokenoftrust/storefront-devkit/tree/main/apps/private
|
|
13
|
+
* (`examples/hello-inventory`, `recipes/inventory-sync-skuvault`,
|
|
14
|
+
* `recipes/fulfillment-shipstation`, `recipes/dropship-split-duoplane`).
|
|
15
|
+
*
|
|
16
|
+
* Online preview & production flow (see README.md):
|
|
17
|
+
* 1. `tot catalog seed --store <tenant> --preset general|regulated-vape|multi-warehouse`
|
|
18
|
+
* 2. `tot app install --store <tenant> --env test --manifest ./tot-app.json`
|
|
19
|
+
* 3. `POST /api/apps/admin/test-orders` (synthetic preview orders bound to `test` install)
|
|
20
|
+
* 4. `POST /api/apps/admin/candidates` (`private_key_jwt`, `pending_approval`) ->
|
|
21
|
+
* 1-click Store Owner approval in `/admin#integrations`
|
|
13
22
|
*/
|
|
14
23
|
import { createServer } from "node:http";
|
|
15
24
|
import { existsSync, readFileSync } from "node:fs";
|