@tokenoftrust/cli 6.14.3 → 6.14.4

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.14.3",
3
+ "version": "6.14.4",
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",
@@ -35,10 +35,12 @@ export const ADMIN_USAGE = `tot app — manage Private App installs on your stor
35
35
  tot app list your store's installs: id, app, version, env, status, scopes (never secrets)
36
36
  tot app replay <deliveryId> re-send a webhook delivery to its install
37
37
  tot app test-order bind <installId>
38
- bind your test install as the preview processor (preview host only)
38
+ bind your test install as the store's preview processor
39
39
  tot app test-order create write one synthetic preview order
40
40
  tot app test-order release <orderId>
41
41
  claim and release one synthetic preview order
42
+ (test orders always act on the store's preview stage, at
43
+ ${DEFAULT_STOREFRONT_ORIGIN}/<tenant>; no --url needed)
42
44
  tot app candidate [--app <dir>] [--jwks-uri <url> | --jwks <file>] [--request-consent] [--webhook-endpoint <url>]
43
45
  stage a production candidate (pending_approval) for owner approval;
44
46
  keys come from --jwks-uri, --jwks, or the manifest's clientAuth
@@ -88,8 +90,11 @@ export function parseAdminArgs(argv) {
88
90
  return a;
89
91
  }
90
92
 
91
- /** The next step for a refused call: the server's `code` first, then the generic admission hint. */
92
- function nextForRefusal(status, body) {
93
+ /**
94
+ * The next step for a refused call: the server's `code` first, then the generic admission hint.
95
+ * @param {number} status @param {any} body @param {{ tenant: string, urlOverridden: boolean }} target
96
+ */
97
+ function nextForRefusal(status, body, target) {
93
98
  const code = typeof body?.code === "string" ? body.code : "";
94
99
  if (code === "owner_required_for_production_app") {
95
100
  return "ask the store owner to install the production app, or install with --env=test";
@@ -98,7 +103,12 @@ function nextForRefusal(status, body) {
98
103
  if (code === "scope_denied") return "remove the refused scopes from tot-app.json, then re-run";
99
104
  if (code === "already_installed") return "run `tot app list` for its installId, then `tot app update <installId>`";
100
105
  if (code === "not_found") return "run `tot app list` to see this store's installs";
101
- if (code === "preview_stage_required") return "point --url at the store's preview host, then re-run";
106
+ if (code === "preview_stage_required") {
107
+ const preview = `${DEFAULT_STOREFRONT_ORIGIN}/${target.tenant}`;
108
+ return target.urlOverridden
109
+ ? `drop --url and TOT_STOREFRONT_URL: test orders run on the store's preview at ${preview}, then re-run`
110
+ : `${preview} has not yet been redeployed with host-free test orders; re-run after its next deploy, or report it with \`tot feedback\``;
111
+ }
102
112
  if (code === "test_install_required") return "bind an install with env test: `tot app list`, then `tot app test-order bind <installId>`";
103
113
  if (code === "invalid_state") return "run `tot app list` to check the install's status";
104
114
  if (status === 403) return refusalHint(status, missingGrantsOf(body));
@@ -236,7 +246,9 @@ export async function runAdmin(argv, ctx, deps = {}) {
236
246
  const reason = typeof data?.error === "string" ? data.error : `the store refused the request (HTTP ${res.status}).`;
237
247
  const denials = Array.isArray(data?.denials) && data.denials.length
238
248
  ? `\n refused scopes: ${data.denials.map((d) => d?.scope ?? d?.id ?? JSON.stringify(d)).join(", ")}` : "";
239
- err(`✗ tot app ${verb}: ${reason}${denials}\n\n → next: ${nextForRefusal(res.status, data)}`);
249
+ const storefrontUrl = String(args.url || env.TOT_STOREFRONT_URL || "").trim().replace(/\/+$/, "");
250
+ const urlOverridden = storefrontUrl !== "" && storefrontUrl !== DEFAULT_STOREFRONT_ORIGIN;
251
+ err(`✗ tot app ${verb}: ${reason}${denials}\n\n → next: ${nextForRefusal(res.status, data, { tenant, urlOverridden })}`);
240
252
  return res.status === 401 || res.status === 403 ? 1 : (res.status >= 500 ? 1 : 2);
241
253
  }
242
254
 
@@ -119,8 +119,10 @@ the preview stage without waiting on the store owner:
119
119
  Manage your test install at any time with `tot app update <installId>`,
120
120
  `tot app rotate <installId>`, `tot app list`, and `tot app replay <deliveryId>`.
121
121
  3. **Trigger synthetic preview orders bound to the `test` install:**
122
- Run `tot app test-order bind <installId>`, `tot app test-order create` and
123
- `tot app test-order release <orderId>` (`POST /api/apps/admin/test-orders`) to bind your
122
+ Run `tot app test-order bind <installId> --tenant <tenant>`, `tot app test-order create` and
123
+ `tot app test-order release <orderId>` (`POST /api/apps/admin/test-orders`) with no `--url`:
124
+ test orders always act on the store's preview stage, at
125
+ `https://storefront.tokenoftrust.store/<tenant>`. They bind your
124
126
  `test` install as the preview fulfillment processor and emit synthetic preview orders with
125
127
  RFC-reserved recipient fixtures. Preview tokens and webhooks are isolated by the stage wall
126
128
  (`403 stage_mismatch` if used against live publication hosts).