@waffo/pancake-cli 0.0.1-rc.1 → 0.0.1-rc.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.
@@ -19,7 +19,7 @@ export function actionResult(spec, data) {
19
19
  throw new CliError('OUTCOME_UNKNOWN', 'The API returned an unexpected action response; the operation may have completed.', { outcome: 'unknown', stage: 'api' });
20
20
  if (spec.sensitiveOutput)
21
21
  return { exported: true };
22
- if (spec.acknowledgementOnly)
22
+ if (spec.verification === 'acknowledgement_only')
23
23
  return { acknowledged: true };
24
24
  if (spec.projectResponse)
25
25
  return spec.projectResponse(data);
@@ -31,10 +31,9 @@ export function priceReplacementWarning(command, input) {
31
31
  : undefined;
32
32
  }
33
33
  export function actionPreview(spec, input) {
34
- const visible = new Set(['type', 'id', 'storeId', 'productId', 'groupId', 'orderId', 'recipientId', 'paymentId', 'ticketId', 'status', 'prices', 'billingPeriod', 'requestedAmount', 'currency', 'changeAmount', 'changeCreditAmount', 'originOrderId']);
35
34
  return { executed: false, validation: 'local', command: spec.definition.id, endpoint: actionEndpoint(spec, input),
36
35
  ...operationImpact(spec.definition), targetEnvironment: operationImpact(spec.definition).impact === 'test-to-prod' ? 'prod' : null, environmentVerified: false,
37
- input: Object.fromEntries(Object.entries(input).map(([key, value]) => [key, visible.has(key) ? value : '[redacted]'])),
36
+ input: spec.previewInput(input),
38
37
  requiresPrivateOutput: spec.sensitiveOutput ?? false,
39
38
  ...(priceReplacementWarning(spec.definition.id, input) ? { warning: priceReplacementWarning(spec.definition.id, input) } : {}),
40
39
  };
@@ -1,7 +1,10 @@
1
+ import { requireActionAuthentication } from "./action-auth.js";
1
2
  import { operationImpact } from "../commands/operation-impact.js";
2
3
  import { requireImpactConfirmation } from "./confirmation.js";
3
- import { randomUUID } from 'node:crypto';
4
- import { argumentError, CliError, safeError } from "../contracts/errors.js";
4
+ import { DEFAULT_API_ORIGIN } from "../contracts/action-routes.js";
5
+ import { createIdempotencyKey } from "./idempotency.js";
6
+ import { beginWriteOperation } from "./write-operation.js";
7
+ import { argumentError, CliError } from "../contracts/errors.js";
5
8
  import { productPriceMismatch } from "./product-verification.js";
6
9
  import { requireWriteEnvironment, credentialContext, contextualError, writeWarning } from "./auth-context.js";
7
10
  import { actionEndpoint, actionResult, priceReplacementWarning } from "./action-result.js";
@@ -14,15 +17,14 @@ export async function executeApiAction(spec, input, options, services) {
14
17
  if (spec.sensitiveOutput && !options.output)
15
18
  throw argumentError('This response contains a token or checkout link. Provide --output with a new private file path.');
16
19
  const credentials = await services.credentials(options);
20
+ requireActionAuthentication(spec.authentication, Boolean(credentials.sessionToken));
17
21
  const attempts = [];
18
22
  const storeId = typeof input.storeId === 'string' ? input.storeId
19
23
  : spec.definition.id.startsWith('stores.') && typeof input.id === 'string' ? input.id : undefined;
20
- const targetResourceId = [input.id, input.productId, input.groupId, input.orderId, input.recipientId, input.ticketId, input.paymentId, input.couponId, input.promotionCodeId].find(value => typeof value === 'string');
24
+ const targetResourceId = spec.targetResourceId(input);
21
25
  let impact = operationImpact(spec.definition);
22
26
  const context = () => ({ ...impact, ...credentialContext(credentials, attempts), storeId, targetResourceId, targetEnvironment: production ? 'prod' : null, ...(replacementWarning ? { priceReplacementWarning: replacementWarning } : {}) });
23
- const key = options.idempotencyKey ?? `${credentials.merchantId}_${randomUUID()}`;
24
- if (!/^[A-Za-z0-9_-]{1,256}$/.test(key))
25
- throw argumentError('Idempotency keys must contain 1–256 letters, numbers, underscores or hyphens.');
27
+ const key = createIdempotencyKey(credentials.merchantId, options.idempotencyKey);
26
28
  let output;
27
29
  try {
28
30
  const gateway = await services.gateway(credentials, event => { attempts.push(event); if (options.debug)
@@ -34,39 +36,35 @@ export async function executeApiAction(spec, input, options, services) {
34
36
  if (options.output)
35
37
  output = await services.prepareOutput(options.output);
36
38
  const { type: _type, ...body } = input;
37
- const operation = await services.operations.begin({ command: spec.definition.id, impact: impact.impact, cliVersion: services.cliVersion, merchantId: credentials.merchantId,
39
+ const operation = await beginWriteOperation(services.operations, { command: spec.definition.id, impact: impact.impact, cliVersion: services.cliVersion, merchantId: credentials.merchantId,
38
40
  storeId, inputHash: services.fingerprint(input), idempotencyKey: key,
39
41
  targetResourceId,
40
- endpoint, apiOrigin: credentials.apiUrl ?? 'https://api.waffo.ai', selectedEnvironment: credentials.environment });
41
- const meta = { ...context(), operationId: operation.operationId, idempotencyKey: key, verification: spec.acknowledgementOnly ? 'acknowledgement_only' : 'response_only' };
42
+ endpoint, apiOrigin: credentials.apiUrl ?? DEFAULT_API_ORIGIN, selectedEnvironment: credentials.sessionToken ? credentials.environment : undefined });
43
+ const meta = { ...context(), operationId: operation.operationId, idempotencyKey: key, verification: spec.verification };
42
44
  services.diagnostic({ stage: 'confirmation', command: spec.definition.id, ...meta,
43
45
  warning: [replacementWarning, production ? 'This operation publishes TEST data to PRODUCTION.' : writeWarning(attempts)].filter(Boolean).join(' ') });
44
46
  let raw, displayed;
45
47
  try {
46
- raw = await gateway.action(endpoint, body, key, spec.acknowledgementOnly);
48
+ raw = await gateway.action(endpoint, body, key, spec.verification === 'acknowledgement_only');
47
49
  displayed = actionResult(spec, raw);
48
50
  }
49
51
  catch (error) {
50
- const failure = safeError(error);
51
- const unknown = !(error instanceof CliError) || failure.outcome === 'unknown';
52
- await services.operations.finish(operation.operationId, { outcome: unknown ? 'unknown' : 'rejected', errorCode: failure.code, attempts }).catch(() => { });
53
- throw new CliError(unknown ? 'OUTCOME_UNKNOWN' : failure.code, failure.message, { outcome: unknown ? 'unknown' : 'rejected', stage: failure.stage,
54
- recovery: unknown ? 'Inspect operations show and query the affected resource or merchant dashboard before taking further action. Do not replay an unknown operation.' : failure.recovery, details: { ...failure.details, ...meta } });
52
+ throw await operation.failed(error, attempts, meta, 'Inspect operations show and query the affected resource or merchant dashboard before taking further action. Do not replay an unknown operation.');
55
53
  }
56
54
  const entity = spec.responseKey ? raw[spec.responseKey] : raw;
57
- const resourceId = [entity?.id, raw.orderId, raw.recipientId, input.id, input.productId, input.groupId, input.orderId].find(value => typeof value === 'string');
55
+ const resourceId = spec.resultResourceId(raw, input);
58
56
  try {
59
- await services.operations.finish(operation.operationId, { outcome: 'committed_unverified', resourceId, attempts });
57
+ await operation.accepted(resourceId, attempts);
60
58
  if (spec.definition.id === 'products.update' && resourceId && productPriceMismatch(input, entity, resourceId))
61
59
  throw new CliError('PRICE_MISMATCH', 'The API accepted the product update but returned prices different from those requested.');
62
60
  if (output)
63
61
  await output.commit(`${JSON.stringify(raw, null, 2)}\n`);
64
- await services.operations.finish(operation.operationId, { outcome: 'completed', resourceId, attempts });
62
+ await operation.completed(resourceId, attempts);
65
63
  }
66
64
  catch (error) {
67
65
  const mismatch = error instanceof CliError && error.code === 'PRICE_MISMATCH';
68
66
  const errorCode = mismatch ? 'PRICE_MISMATCH' : 'VERIFICATION_PENDING';
69
- await services.operations.finish(operation.operationId, { outcome: 'committed_unverified', resourceId, errorCode, attempts }).catch(() => { });
67
+ await operation.accepted(resourceId, attempts, errorCode).catch(() => { });
70
68
  throw new CliError(errorCode, mismatch ? error.message : 'The API accepted the operation, but exporting its result or updating the local record failed.', {
71
69
  outcome: 'committed_unverified', stage: mismatch ? 'verification' : 'local-persistence', recovery: 'Inspect the output file if present, operation record and merchant dashboard. Do not repeat the operation to recover its response.', details: { ...meta, resourceId: resourceId ?? null },
72
70
  });
@@ -28,7 +28,7 @@ export async function executeApiRead(spec, request, options, services) {
28
28
  const output = options.output ? await services.prepareOutput(options.output) : undefined;
29
29
  try {
30
30
  return await readOperation(spec.definition.id, options, services, async (gateway) => {
31
- const response = await gateway.query(request.query, request.variables);
31
+ const response = await gateway.query(request.query, request.variables, spec.definition.id === 'graphql.query' && options.background ? { background: true } : undefined);
32
32
  if (output) {
33
33
  await output.commit(`${JSON.stringify(response, null, 2)}\n`);
34
34
  return { output: options.output, exported: true };
@@ -26,11 +26,11 @@ export async function login(options, services) {
26
26
  ...(isContent ? { privateKey: key } : { privateKeyFile: resolve(path.startsWith('~/') ? homedir() + path.slice(1) : path) }),
27
27
  storeId: options.storeId, source: 'login' };
28
28
  return authenticatedOperation('login', options, services, credentials, async (observer) => {
29
- await services.config.read();
29
+ const snapshot = await services.config.read();
30
30
  const identity = await (await services.gateway(credentials, observer)).me();
31
31
  if (identity.id !== credentials.merchantId)
32
32
  throw new CliError('AUTH_FAILED', 'The authenticated merchant could not be verified.', { stage: 'identity' });
33
- await services.config.save(credentials);
33
+ await services.config.save(credentials, snapshot, options.signal);
34
34
  return { saved: true, merchantId: identity.id, credentialVerified: true, ...environmentContext(identity.environment),
35
35
  savedLoginActive: !services.environmentCredentialsPresent, ...overrideStatus(services), next: 'Run pancake whoami to verify the effective identity, then pancake stores list.' };
36
36
  });
@@ -66,7 +66,10 @@ export async function logout(services) {
66
66
  const credentials = { ...snapshot.credential, source: 'stored' };
67
67
  serverSessionRevoked = await (await services.gateway(credentials, () => { })).revokeSession();
68
68
  }
69
- await services.config.clear(snapshot ? { revision: snapshot.revision } : undefined);
69
+ if (snapshot)
70
+ await services.config.clear(snapshot);
71
+ else
72
+ await services.config.clearInvalid();
70
73
  return { data: { localCredentialsCleared: true, serverKeyRevoked: false, serverSessionRevoked, ...overrideStatus(services) } };
71
74
  }
72
75
  async function loginInBrowser(options, services) {
@@ -85,7 +88,7 @@ async function loginInBrowser(options, services) {
85
88
  throw new CliError('ENVIRONMENT_UNVERIFIED', 'The gateway did not verify the selected environment. Your saved login was not changed.', { stage: 'identity' });
86
89
  if (options.signal?.aborted)
87
90
  throw new CliError('INTERRUPTED', 'Cancelled.', { exitCode: 130 });
88
- await services.config.save(credentials, options.signal, { revision: snapshot.revision });
91
+ await services.config.save(credentials, snapshot, options.signal);
89
92
  return { saved: true, merchantId: identity.id, credentialVerified: true, authentication: 'browser', ...environmentContext(identity.environment), savedLoginActive: !services.environmentCredentialsPresent, ...overrideStatus(services) };
90
93
  });
91
94
  });
@@ -106,7 +109,7 @@ export async function selectEnvironment(environment, options, services) {
106
109
  const identity = await (await services.gateway(credentials, observer)).me();
107
110
  if (identity.id !== credentials.merchantId || identity.environment !== environment)
108
111
  throw new CliError('ENVIRONMENT_UNVERIFIED', 'The gateway did not verify the requested merchant environment. The saved environment was not changed.', { stage: 'identity' });
109
- await services.config.save(credentials, options.signal, { revision: snapshot.revision });
112
+ await services.config.save(credentials, snapshot, options.signal);
110
113
  return { saved: true, merchantId: identity.id, ...environmentContext(identity.environment) };
111
114
  });
112
115
  }
@@ -1,3 +1,5 @@
1
+ import { productPreview } from "../commands/product-preview.js";
2
+ import { webhookPreview } from "../commands/webhook-preview.js";
1
3
  import { operationImpact } from "../commands/operation-impact.js";
2
4
  import { listen } from "./listen.js";
3
5
  import { validateDiscountInput } from "../commands/discount-validation.js";
@@ -16,7 +18,7 @@ import { actionPreview } from "./action-result.js";
16
18
  import { executeApiRead } from "./api-reads.js";
17
19
  import { pagination } from "./queries.js";
18
20
  function preview(id, input) {
19
- const displayed = id === 'products.create' ? { type: input.type, storeId: input.storeId, name: input.name, prices: input.prices, billingPeriod: input.billingPeriod, metadata: input.metadata === undefined ? undefined : '[redacted]', description: input.description === undefined ? undefined : '[redacted]', media: input.media === undefined ? undefined : '[redacted]', successUrl: input.successUrl === undefined ? undefined : '[redacted]' } : { ...input, ...(input.url !== undefined ? { url: '[redacted]' } : {}), ...(input.secret !== undefined ? { secret: '[redacted]' } : {}) };
21
+ const displayed = id === 'products.create' ? productPreview(input) : webhookPreview(input);
20
22
  return { data: { executed: false, validation: 'local', environmentVerified: false, command: id, input: displayed }, meta: { executed: false } };
21
23
  }
22
24
  export function createApplication(services) {
@@ -0,0 +1,8 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { argumentError } from "../contracts/errors.js";
3
+ export function createIdempotencyKey(merchantId, supplied) {
4
+ const key = supplied ?? `${merchantId}_${randomUUID()}`;
5
+ if (!/^[A-Za-z0-9_-]{1,256}$/.test(key))
6
+ throw argumentError('Idempotency keys must contain 1–256 letters, numbers, underscores or hyphens.');
7
+ return key;
8
+ }
@@ -1,7 +1,9 @@
1
1
  import { operationImpact } from "../commands/operation-impact.js";
2
2
  import { requireImpactConfirmation } from "./confirmation.js";
3
- import { randomUUID } from 'node:crypto';
4
- import { CliError, argumentError, safeError } from "../contracts/errors.js";
3
+ import { DEFAULT_API_ORIGIN, productCreateEndpoint } from "../contracts/action-routes.js";
4
+ import { createIdempotencyKey } from "./idempotency.js";
5
+ import { beginWriteOperation } from "./write-operation.js";
6
+ import { CliError } from "../contracts/errors.js";
5
7
  import { requireWriteEnvironment, credentialContext, contextualError, writeWarning } from "./auth-context.js";
6
8
  import { productMatches, productPriceMismatch, safeProduct } from "./product-verification.js";
7
9
  const warning = 'The credential environment cannot be verified. Product creation may affect production; the backend selects the environment from the RSA key.';
@@ -21,10 +23,8 @@ export async function createProduct(input, options, services, fingerprint) {
21
23
  const context = () => ({ ...impact, ...credentialContext(credentials, attempts), storeId: input.storeId, product: proposed, warning: writeWarning(attempts) });
22
24
  if (!options.yes)
23
25
  throw new CliError('INVALID_ARGUMENT', 'Product creation requires --yes after reviewing the product and credential environment.', { exitCode: 2, stage: 'confirmation', recovery: warning, details: context() });
24
- const key = options.idempotencyKey ?? `${credentials.merchantId}_${randomUUID()}`;
25
- if (!/^[A-Za-z0-9_-]{1,256}$/.test(key))
26
- throw contextualError(argumentError('Idempotency keys must contain 1–256 letters, numbers, underscores or hyphens.'), context());
27
26
  try {
27
+ const key = createIdempotencyKey(credentials.merchantId, options.idempotencyKey);
28
28
  const gateway = await services.gateway(credentials, event => { attempts.push(event); if (options.debug)
29
29
  services.diagnostic({ stage: 'api', ...event }); });
30
30
  const identity = await gateway.me();
@@ -33,7 +33,8 @@ export async function createProduct(input, options, services, fingerprint) {
33
33
  requireImpactConfirmation(impact, options);
34
34
  const type = input.type;
35
35
  const { type: _type, ...body } = input;
36
- const operation = await services.operations.begin({ command: 'products.create', impact: impact.impact, cliVersion: services.cliVersion, merchantId: credentials.merchantId, storeId: input.storeId, inputHash: fingerprint, idempotencyKey: key });
36
+ const operation = await beginWriteOperation(services.operations, { command: 'products.create', impact: impact.impact, cliVersion: services.cliVersion, merchantId: credentials.merchantId, storeId: input.storeId, inputHash: fingerprint, idempotencyKey: key,
37
+ endpoint: productCreateEndpoint(type), apiOrigin: credentials.apiUrl ?? DEFAULT_API_ORIGIN, selectedEnvironment: credentials.sessionToken ? credentials.environment : undefined });
37
38
  const meta = { ...context(), operationId: operation.operationId, idempotencyKey: key };
38
39
  let returned;
39
40
  try {
@@ -41,14 +42,11 @@ export async function createProduct(input, options, services, fingerprint) {
41
42
  returned = await gateway.createProduct(type, body, key);
42
43
  }
43
44
  catch (error) {
44
- const failure = safeError(error);
45
- const unknown = !(error instanceof CliError) || failure.outcome === 'unknown';
46
- await services.operations.finish(operation.operationId, { outcome: unknown ? 'unknown' : 'rejected', errorCode: failure.code, attempts }).catch(() => { });
47
- throw new CliError(unknown ? 'OUTCOME_UNKNOWN' : failure.code, failure.message, { stage: failure.stage, outcome: unknown ? 'unknown' : 'rejected', recovery: unknown ? 'Inspect operations show and the merchant dashboard for this store. If a product ID is found, use products get with its type. Do not repeat creation or use a new key.' : failure.recovery, details: { ...meta, ...failure.details } });
45
+ throw await operation.failed(error, attempts, meta, 'Inspect operations show and the merchant dashboard for this store. If a product ID is found, use products get with its type. Do not repeat creation or use a new key.');
48
46
  }
49
47
  const resourceId = returned.id;
50
48
  try {
51
- await services.operations.finish(operation.operationId, { outcome: 'committed_unverified', resourceId, attempts });
49
+ await operation.accepted(resourceId, attempts);
52
50
  if (productPriceMismatch(input, returned, resourceId))
53
51
  throw new CliError('PRICE_MISMATCH', 'The API accepted the product but returned prices different from those requested.');
54
52
  const current = await gateway.product(type, resourceId);
@@ -56,12 +54,12 @@ export async function createProduct(input, options, services, fingerprint) {
56
54
  throw new CliError('PRICE_MISMATCH', 'The saved product prices differ from those requested.');
57
55
  if (!productMatches(input, returned, resourceId) || !productMatches(input, current, resourceId, returned))
58
56
  throw new Error('Verification failed');
59
- await services.operations.finish(operation.operationId, { outcome: 'completed', resourceId, attempts });
57
+ await operation.completed(resourceId, attempts);
60
58
  }
61
59
  catch (error) {
62
60
  const mismatch = error instanceof CliError && error.code === 'PRICE_MISMATCH';
63
61
  const errorCode = mismatch ? 'PRICE_MISMATCH' : 'VERIFICATION_PENDING';
64
- await services.operations.finish(operation.operationId, { outcome: 'committed_unverified', resourceId, errorCode, attempts }).catch(() => { });
62
+ await operation.accepted(resourceId, attempts, errorCode).catch(() => { });
65
63
  throw new CliError(errorCode, mismatch ? error.message : 'Product creation was accepted, but its verification or local record update did not complete.', { outcome: 'committed_unverified', stage: 'verification', recovery: `Run pancake products get ${resourceId} --type ${type} --json with the same credentials, then inspect operations show ${operation.operationId}. Do not repeat creation.`, details: { ...meta, resourceId, type } });
66
64
  }
67
65
  return { data: { product: safeProduct(returned, type) }, meta: { ...meta, ...context(), requestId: attempts.at(-1)?.requestId ?? null } };
@@ -1,3 +1,4 @@
1
+ import { DEFAULT_API_ORIGIN, serviceOrigin } from "../contracts/action-routes.js";
1
2
  import { safeError } from "../contracts/errors.js";
2
3
  import { credentialContext, contextualError } from "./auth-context.js";
3
4
  export async function readOperation(id, options, services, work, suppliedCredentials) {
@@ -6,25 +7,32 @@ export async function readOperation(id, options, services, work, suppliedCredent
6
7
  }
7
8
  export async function authenticatedOperation(id, options, services, credentials, work) {
8
9
  const attempts = [];
10
+ const background = id === 'graphql.query' && options.background;
9
11
  let operationId;
10
- try {
11
- operationId = (await services.operations.begin({ command: id, cliVersion: services.cliVersion, merchantId: credentials.merchantId, storeId: credentials.storeId })).operationId;
12
- }
13
- catch {
14
- services.diagnostic({ level: 'warning', code: 'OPERATION_RECORD_UNAVAILABLE' });
12
+ let apiOrigin;
13
+ if (!background) {
14
+ try {
15
+ operationId = (await services.operations.begin({ command: id, cliVersion: services.cliVersion, merchantId: credentials.merchantId, storeId: credentials.storeId })).operationId;
16
+ }
17
+ catch {
18
+ services.diagnostic({ level: 'warning', code: 'OPERATION_RECORD_UNAVAILABLE' });
19
+ }
15
20
  }
21
+ const metadata = () => ({ ...credentialContext(credentials, attempts), ...(apiOrigin ? { apiOrigin } : {}), operationId: operationId ?? null, requestId: attempts.at(-1)?.requestId ?? null });
16
22
  const observer = (event) => { attempts.push(event); if (options.debug)
17
23
  services.diagnostic({ stage: 'api', ...event }); };
18
24
  try {
25
+ if (background)
26
+ apiOrigin = serviceOrigin(credentials.apiUrl ?? DEFAULT_API_ORIGIN);
19
27
  const data = await work(observer);
20
28
  if (operationId)
21
29
  await services.operations.finish(operationId, { outcome: 'completed', attempts }).catch(() => services.diagnostic({ level: 'warning', code: 'OPERATION_RECORD_UNAVAILABLE' }));
22
- return { data, meta: { operationId: operationId ?? null, requestId: attempts.at(-1)?.requestId ?? null, ...credentialContext(credentials, attempts) } };
30
+ return { data, meta: metadata() };
23
31
  }
24
32
  catch (error) {
25
33
  const failure = safeError(error);
26
34
  if (operationId)
27
35
  await services.operations.finish(operationId, { outcome: failure.outcome, errorCode: failure.code, attempts }).catch(() => { });
28
- throw contextualError(failure, { ...credentialContext(credentials, attempts), operationId: operationId ?? null, requestId: attempts.at(-1)?.requestId ?? null });
36
+ throw contextualError(failure, metadata());
29
37
  }
30
38
  }
@@ -1,14 +1,14 @@
1
1
  import { operationImpact } from "../commands/operation-impact.js";
2
- import { randomUUID } from 'node:crypto';
3
- import { CliError, argumentError, safeError } from "../contracts/errors.js";
2
+ import { DEFAULT_API_ORIGIN, webhookEndpoint } from "../contracts/action-routes.js";
3
+ import { createIdempotencyKey } from "./idempotency.js";
4
+ import { beginWriteOperation } from "./write-operation.js";
5
+ import { CliError, argumentError } from "../contracts/errors.js";
4
6
  import { requireWriteEnvironment, credentialContext } from "./auth-context.js";
5
7
  import { safeWebhook, testWebhook } from "./queries.js";
6
8
  export async function mutateWebhook(action, input, options, services, credentials, gateway, attempts, fingerprint) {
7
9
  if (!options.yes)
8
10
  throw argumentError('Remote changes require --yes after reviewing the input or --dry-run output.');
9
- const key = options.idempotencyKey ?? `${credentials.merchantId}_${randomUUID()}`;
10
- if (!/^[A-Za-z0-9_-]{1,256}$/.test(key))
11
- throw argumentError('Idempotency keys must contain 1–256 letters, numbers, underscores or hyphens.');
11
+ const key = createIdempotencyKey(credentials.merchantId, options.idempotencyKey);
12
12
  const identity = await gateway.me();
13
13
  requireWriteEnvironment(credentials, identity);
14
14
  if (identity.environment !== 'test')
@@ -22,9 +22,9 @@ export async function mutateWebhook(action, input, options, services, credential
22
22
  throw new CliError('ENVIRONMENT_MISMATCH', 'New webhook subscriptions must use testMode:true.');
23
23
  const { storeId: _storeId, ...withoutStore } = input;
24
24
  const body = action === 'add' ? input : withoutStore;
25
- const operation = await services.operations.begin({ command: `webhook.${action}`, impact: impact.impact, cliVersion: services.cliVersion, merchantId: credentials.merchantId, storeId, inputHash: fingerprint, idempotencyKey: key,
26
- targetResourceId: typeof input.id === 'string' ? input.id : undefined, endpoint: `/v1/actions/store/${action}-webhook`,
27
- apiOrigin: credentials.apiUrl ?? 'https://api.waffo.ai', selectedEnvironment: credentials.environment });
25
+ const operation = await beginWriteOperation(services.operations, { command: `webhook.${action}`, impact: impact.impact, cliVersion: services.cliVersion, merchantId: credentials.merchantId, storeId, inputHash: fingerprint, idempotencyKey: key,
26
+ targetResourceId: typeof input.id === 'string' ? input.id : undefined, endpoint: webhookEndpoint(action),
27
+ apiOrigin: credentials.apiUrl ?? DEFAULT_API_ORIGIN, selectedEnvironment: credentials.sessionToken ? credentials.environment : undefined });
28
28
  const meta = { ...impact, operationId: operation.operationId, idempotencyKey: key, resourceEnvironment: 'test', ...credentialContext(credentials, attempts) };
29
29
  const secretReadbackRestricted = !!credentials.sessionToken && input.secret !== undefined;
30
30
  let returned;
@@ -32,13 +32,10 @@ export async function mutateWebhook(action, input, options, services, credential
32
32
  returned = await gateway.mutateWebhook(action, body, key);
33
33
  }
34
34
  catch (error) {
35
- const failure = safeError(error);
36
- const unknown = !(error instanceof CliError) || failure.outcome === 'unknown';
37
- await services.operations.finish(operation.operationId, { outcome: unknown ? 'unknown' : 'rejected', errorCode: failure.code, attempts }).catch(() => { });
38
- throw new CliError(unknown ? 'OUTCOME_UNKNOWN' : failure.code, failure.message, { stage: failure.stage, outcome: unknown ? 'unknown' : 'rejected', recovery: failure.recovery, details: { ...meta, ...failure.details } });
35
+ throw await operation.failed(error, attempts, meta, 'Inspect operations show and run webhook list for the selected store before taking further action. Do not repeat the change or use a new key.');
39
36
  }
40
37
  try {
41
- await services.operations.finish(operation.operationId, { outcome: 'committed_unverified', resourceId: returned.id, attempts });
38
+ await operation.accepted(returned.id, attempts);
42
39
  const after = await gateway.webhooks(storeId, input.secret !== undefined && !secretReadbackRestricted);
43
40
  const current = after.find(item => item.id === returned.id);
44
41
  const targetMatches = action === 'add' || returned.id === input.id;
@@ -49,10 +46,10 @@ export async function mutateWebhook(action, input, options, services, credential
49
46
  (input.events === undefined || JSON.stringify(current.events) === JSON.stringify(input.events));
50
47
  if (!targetMatches || returned.testMode !== true || !fieldsMatch)
51
48
  throw new Error('Verification failed');
52
- await services.operations.finish(operation.operationId, { outcome: 'completed', resourceId: returned.id, attempts });
49
+ await operation.completed(returned.id, attempts);
53
50
  }
54
51
  catch {
55
- await services.operations.finish(operation.operationId, { outcome: 'committed_unverified', resourceId: returned.id, errorCode: 'VERIFICATION_PENDING', attempts }).catch(() => { });
52
+ await operation.accepted(returned.id, attempts, 'VERIFICATION_PENDING').catch(() => { });
56
53
  throw new CliError('VERIFICATION_PENDING', 'The change was accepted, but its verification or local record update did not complete.', { outcome: 'committed_unverified', stage: 'verification', recovery: 'Run webhook list for the selected store. Do not repeat the change.', details: { ...meta, resourceId: returned.id } });
57
54
  }
58
55
  return { data: { webhook: safeWebhook(returned), removed: action === 'remove' }, meta: { ...meta, ...credentialContext(credentials, attempts), requestId: attempts.at(-1)?.requestId ?? null, ...(secretReadbackRestricted ? { verification: 'response_only', unverifiedFields: ['secret'] } : {}) } };
@@ -0,0 +1,26 @@
1
+ import { CliError, safeError } from "../contracts/errors.js";
2
+ export async function beginWriteOperation(repository, input) {
3
+ const { idempotencyKey } = input;
4
+ const { operationId } = await repository.begin(input);
5
+ return Object.freeze({
6
+ operationId,
7
+ idempotencyKey,
8
+ async accepted(resourceId, attempts, errorCode) {
9
+ await repository.finish(operationId, { outcome: 'committed_unverified', resourceId, attempts, ...(errorCode ? { errorCode } : {}) });
10
+ },
11
+ async completed(resourceId, attempts) {
12
+ await repository.finish(operationId, { outcome: 'completed', resourceId, attempts });
13
+ },
14
+ async failed(error, attempts, context, unknownRecovery) {
15
+ const failure = safeError(error);
16
+ const unknown = !(error instanceof CliError) || failure.outcome === 'unknown';
17
+ const outcome = unknown ? 'unknown' : 'rejected';
18
+ await repository.finish(operationId, { outcome, errorCode: failure.code, attempts }).catch(() => { });
19
+ return new CliError(unknown ? 'OUTCOME_UNKNOWN' : failure.code, failure.message, {
20
+ exitCode: unknown ? 1 : failure.exitCode, outcome, stage: failure.stage,
21
+ recovery: unknown ? unknownRecovery : failure.recovery,
22
+ details: { ...failure.details, ...context, operationId, idempotencyKey },
23
+ });
24
+ },
25
+ });
26
+ }
@@ -6,7 +6,7 @@ export function successEnvelope(result, cliVersion) {
6
6
  }
7
7
  export function failureEnvelope(error, cliVersion) {
8
8
  const failure = safeError(error);
9
- const context = Object.fromEntries(['merchantId', 'source', 'actualEnvironment', 'environmentVerified', 'impact', 'impactPolicy', 'requiresProductionConfirmation', 'requiresSharedConfirmation'].filter(key => Object.hasOwn(failure.details, key)).map(key => [key, failure.details[key]]));
9
+ const context = Object.fromEntries(['merchantId', 'source', 'actualEnvironment', 'environmentVerified', 'apiOrigin', 'impact', 'impactPolicy', 'requiresProductionConfirmation', 'requiresSharedConfirmation'].filter(key => Object.hasOwn(failure.details, key)).map(key => [key, failure.details[key]]));
10
10
  return { schemaVersion: 1, ok: false, data: null, error: { code: failure.code, message: failure.message, stage: failure.stage, recovery: failure.recovery, details: failure.details }, meta: { cliVersion, ...context, outcome: failure.outcome, operationId: failure.details.operationId ?? null, requestId: failure.details.requestId ?? null } };
11
11
  }
12
12
  function environmentHeading(meta) {
@@ -1,3 +1,4 @@
1
+ import { storePreview, productActionPreview, groupPreview, checkoutPreview, subscriptionPreview, refundPreview, sessionPreview, recipientPreview, contentPreview } from "./action-previews.js";
1
2
  import { discountActionSpecs } from "./discount-definitions.js";
2
3
  import { contentScanSchema, groupSchemas, recipientSchemas, refundSchemas, sessionSchema, storeSchemas, subscriptionCancelSchema } from "./action-schemas.js";
3
4
  import { checkoutSchema } from "./checkout-action-schema.js";
@@ -25,6 +26,9 @@ export const actionSpecs = [
25
26
  ...['create', 'update', 'delete'].map(action => ({
26
27
  definition: definition(`stores.${action}`, `${action} a store; requires --yes${action === 'delete' ? '; soft-deletes the store and makes it inaccessible' : ''}`, storeSchemas[action]),
27
28
  endpoint: `/v1/actions/store/${action}-store`, documentation: [docs(`stores/${action}-store`)],
29
+ authentication: 'merchant-session-or-rsa', verification: 'response_only', previewInput: storePreview,
30
+ targetResourceId: (input) => action === 'create' ? undefined : input.id,
31
+ resultResourceId: (data) => data.store.id,
28
32
  responseKey: 'store', validateResponse: keyedResponse('store'),
29
33
  })),
30
34
  ...[
@@ -35,41 +39,62 @@ export const actionSpecs = [
35
39
  definition: definition(`products.${action}`, `${description}; requires --yes`, schema, true),
36
40
  endpoint: { onetime: `/v1/actions/onetime-product/${endpoint}`, subscription: `/v1/actions/subscription-product/${endpoint}` },
37
41
  documentation: [docs(`onetime-products/${endpoint}`), docs(`subscription-products/${endpoint}`)],
42
+ authentication: 'merchant-session-or-rsa', verification: 'response_only', previewInput: productActionPreview,
43
+ targetResourceId: (input) => input.id,
44
+ resultResourceId: (data) => data.product.id,
38
45
  responseKey: 'product', validateResponse: keyedResponse('product'),
39
46
  })),
40
47
  ...['create', 'update', 'delete', 'publish'].map(action => ({
41
48
  definition: definition(`groups.${action}`, `${action} a subscription product group; requires --yes${action === 'delete' ? '; permanently deletes only the group' : ''}${action === 'publish' ? '; copies TEST→PRODUCTION using upsert' : ''}`, groupSchemas[action]),
42
49
  endpoint: `/v1/actions/subscription-product-group/${action}-group`, documentation: [docs(`subscription-products/${action}-group`)],
43
- ...(action === 'create' || action === 'update' ? { responseKey: 'group', validateResponse: keyedResponse('group') } : { acknowledgementOnly: true }),
50
+ authentication: 'merchant-session-or-rsa',
51
+ verification: action === 'delete' || action === 'publish' ? 'acknowledgement_only' : 'response_only', previewInput: groupPreview,
52
+ targetResourceId: (input) => action === 'create' ? undefined : input.id,
53
+ resultResourceId: (data, input) => action === 'delete' || action === 'publish' ? input.id : data.group.id,
54
+ ...(action === 'create' || action === 'update' ? { responseKey: 'group', validateResponse: keyedResponse('group') } : {}),
44
55
  })),
45
56
  {
46
57
  definition: definition('checkout.create', 'Create a checkout or plan-change session; requires --yes and --output for the private checkout link', checkoutSchema),
47
58
  endpoint: '/v1/actions/checkout/create-session', documentation: [docs('orders/create-checkout-session')], sensitiveOutput: true,
59
+ authentication: 'merchant-session-or-rsa', verification: 'response_only', previewInput: checkoutPreview,
60
+ targetResourceId: input => input.productId, resultResourceId: data => data.sessionId,
48
61
  validateResponse: data => hasStrings(data, ['sessionId', 'checkoutUrl', 'expiresAt']),
49
62
  },
50
63
  {
51
64
  definition: definition('subscriptions.cancel', 'Request subscription cancellation; timing follows its current state; requires --yes', subscriptionCancelSchema),
52
65
  endpoint: '/v1/actions/subscription-order/cancel-order', documentation: [docs('subscriptions/cancel-subscription')],
66
+ authentication: 'merchant-session-or-rsa', verification: 'response_only', previewInput: subscriptionPreview,
67
+ targetResourceId: input => input.orderId, resultResourceId: data => data.orderId,
53
68
  validateResponse: data => hasStrings(data, ['orderId', 'status']) && ['canceling', 'canceled'].includes(data.status),
54
69
  },
55
70
  ...['create', 'resubmit'].map(action => ({
56
71
  definition: definition(`refunds.${action}`, `${action} a refund ticket; this does not confirm completed repayment; requires --yes`, refundSchemas[action]),
57
72
  endpoint: `/v1/actions/refund-ticket/${action}-ticket`, documentation: [docs(`refunds/${action}-refund-ticket`)],
73
+ authentication: 'merchant-session-or-rsa', verification: 'response_only', previewInput: refundPreview,
74
+ targetResourceId: (input) => (action === 'create' ? input.paymentId : input.ticketId),
75
+ resultResourceId: (data) => data.ticket.id,
58
76
  responseKey: 'ticket', validateResponse: keyedResponse('ticket'),
59
77
  })),
60
78
  {
61
79
  definition: definition('sessions.create', 'Issue a customer token using RSA login; requires --yes and --output', sessionSchema),
62
80
  endpoint: '/v1/actions/auth/issue-session-token', documentation: [docs('auth/issue-session-token')], sensitiveOutput: true,
81
+ authentication: 'merchant-rsa', verification: 'response_only', previewInput: sessionPreview,
82
+ targetResourceId: input => input.productId, resultResourceId: () => undefined,
63
83
  validateResponse: data => hasStrings(data, ['token', 'expiresAt']) && (data.portalUrl === undefined || hasStrings(data, ['portalUrl'])),
64
84
  },
65
85
  ...['add', 'update', 'remove'].map(action => ({
66
86
  definition: definition(`recipients.${action}`, `${action} a store notification recipient; requires --yes${action === 'remove' ? '; removing the last recipient silences merchant notifications' : ''}`, recipientSchemas[action]),
67
87
  endpoint: `/v1/actions/store-notification-recipient/${action}-recipient`, documentation: [docs(`notification-recipients/${action}-recipient`)],
88
+ authentication: 'merchant-session-or-rsa', verification: 'response_only', previewInput: recipientPreview,
89
+ targetResourceId: (input) => action === 'add' ? undefined : input.recipientId,
90
+ resultResourceId: (data) => action === 'remove' ? data.recipientId : data.recipient.id,
68
91
  ...(action === 'remove' ? { validateResponse: (data) => hasStrings(data, ['recipientId']) && data.removed === true } : { responseKey: 'recipient', validateResponse: keyedResponse('recipient') }),
69
92
  })),
70
93
  {
71
94
  definition: definition('content.scan', 'Check prompt safety; requires --yes', contentScanSchema, false, 'read'),
72
95
  endpoint: '/v1/actions/verification/scan-prompt', documentation: [docs('content-safety/scan-prompt')],
96
+ authentication: 'merchant-session-or-rsa', verification: 'response_only', previewInput: contentPreview,
97
+ targetResourceId: () => undefined, resultResourceId: () => undefined,
73
98
  validateResponse: data => hasStrings(data, ['action', 'reasonCode', 'requestId', 'semanticStatus']) && ['allow', 'review', 'block'].includes(data.action) && Array.isArray(data.matchedCategories) && data.matchedCategories.every(value => typeof value === 'string'),
74
99
  },
75
100
  ];
@@ -0,0 +1,12 @@
1
+ export function previewFields(input, visible) {
2
+ return Object.fromEntries(Object.entries(input).map(([key, value]) => [key, visible.includes(key) ? value : '[redacted]']));
3
+ }
4
+ export const storePreview = (input) => previewFields(input, ['id', 'status']);
5
+ export const productActionPreview = (input) => previewFields(input, ['type', 'id', 'status', 'prices', 'billingPeriod']);
6
+ export const groupPreview = (input) => previewFields(input, ['id', 'storeId']);
7
+ export const checkoutPreview = (input) => previewFields(input, ['productId', 'currency', 'changeAmount', 'changeCreditAmount', 'originOrderId']);
8
+ export const subscriptionPreview = (input) => previewFields(input, ['orderId']);
9
+ export const refundPreview = (input) => previewFields(input, ['paymentId', 'ticketId', 'requestedAmount']);
10
+ export const sessionPreview = (input) => previewFields(input, ['storeId', 'productId']);
11
+ export const recipientPreview = (input) => previewFields(input, ['storeId', 'recipientId']);
12
+ export const contentPreview = (input) => previewFields(input, []);
@@ -1,3 +1,4 @@
1
+ import { productCreateEndpoint, webhookEndpoint } from "../contracts/action-routes.js";
1
2
  import { actionSpecs } from "./action-definitions.js";
2
3
  import { readSpecs } from "./read-definitions.js";
3
4
  export function commandApi(id) {
@@ -5,17 +6,17 @@ export function commandApi(id) {
5
6
  return { method: 'POST', endpoints: ['/v1/graphql', ...['start', 'poll', 'ack', 'stop'].map(action => `/v1/actions/notification/cli-listen-${action}`)], authentication: 'merchant-session only', targetEnvironment: 'test by default; --live for prod', temporarySessionTtlSeconds: 90 };
6
7
  const action = actionSpecs.find(spec => spec.definition.id === id);
7
8
  if (action)
8
- return { method: 'POST', endpoints: typeof action.endpoint === 'string' ? [action.endpoint] : Object.values(action.endpoint), authentication: id === 'sessions.create' ? 'merchant-rsa' : 'merchant-session or merchant-rsa; server route permissions apply',
9
+ return { method: 'POST', endpoints: typeof action.endpoint === 'string' ? [action.endpoint] : Object.values(action.endpoint), authentication: action.authentication === 'merchant-rsa' ? 'merchant-rsa' : 'merchant-session or merchant-rsa; server route permissions apply',
9
10
  confirmationRequired: true, privateOutputRequired: action.sensitiveOutput ?? false,
10
11
  targetEnvironment: id.endsWith('.publish') ? 'prod' : 'credential-dependent-unverified',
11
- verification: action.acknowledgementOnly ? 'acknowledgement_only' : 'response_only', documentation: action.documentation };
12
+ verification: action.verification, documentation: action.documentation };
12
13
  const read = readSpecs.find(spec => spec.definition.id === id);
13
14
  if (read)
14
15
  return { method: 'POST', endpoints: ['/v1/graphql'], authentication: 'merchant-session or merchant-rsa; server route permissions apply', privateOutputRequired: read.sensitiveOutput ?? false, documentation: read.documentation };
15
16
  if (id === 'products.create')
16
- return { method: 'POST', endpoints: ['/v1/actions/onetime-product/create-product', '/v1/actions/subscription-product/create-product'], authentication: 'merchant-session or merchant-rsa; server route permissions apply', verification: 'read_back' };
17
+ return { method: 'POST', endpoints: [productCreateEndpoint('onetime'), productCreateEndpoint('subscription')], authentication: 'merchant-session or merchant-rsa; server route permissions apply', verification: 'read_back' };
17
18
  if (['webhook.add', 'webhook.update', 'webhook.remove'].includes(id))
18
- return { method: 'POST', endpoints: [`/v1/actions/store/${id.split('.')[1]}-webhook`], authentication: 'merchant-session or merchant-rsa; server route permissions apply', scope: 'test-webhook-resources-only', verification: id === 'webhook.remove' ? 'read_back' : 'conditional', ...(id === 'webhook.remove' ? {} : { verificationPolicy: { default: 'read_back', browserSecretWrite: 'response_only' } }) };
19
+ return { method: 'POST', endpoints: [webhookEndpoint(id.split('.')[1])], authentication: 'merchant-session or merchant-rsa; server route permissions apply', scope: 'test-webhook-resources-only', verification: id === 'webhook.remove' ? 'read_back' : 'conditional', ...(id === 'webhook.remove' ? {} : { verificationPolicy: { default: 'read_back', browserSecretWrite: 'response_only' } }) };
19
20
  if (id === 'login')
20
21
  return { method: 'POST', endpoints: ['/v1/actions/auth/cli-device-start', '/v1/actions/auth/cli-device-token', '/v1/actions/auth/cli-device-complete', '/v1/graphql'], authentication: 'browser device authorization then merchant-session; explicit merchant-rsa supported' };
21
22
  if (['env', 'whoami', 'doctor', 'stores.list', 'products.get', 'webhook.list'].includes(id))
@@ -1,3 +1,4 @@
1
+ import { couponPreview, promotionCodePreview } from "./discount-preview.js";
1
2
  import { couponId, couponListSchema, discountSchemas, promotionListSchema } from "./discount-schemas.js";
2
3
  import { objectSchema } from "./schemas.js";
3
4
  import { selection } from "./read-query.js";
@@ -20,6 +21,9 @@ export const discountActionSpecs = Object.entries(discountSchemas).map(([id, sch
20
21
  options: [['--dry-run', 'Validate and preview offline'], ['--idempotency-key <key>', 'Unique operation key; no automatic replay'], ['--output <path>', 'Export the complete response to a new private file']], example: `pancake ${id.replace('.', ' ')} --file input.json --dry-run --json` },
21
22
  endpoint: `/v1/actions/${coupon ? 'coupon' : 'promotion-code'}/${action}-${coupon ? 'coupon' : batch ? 'promotion-codes' : 'promotion-code'}`,
22
23
  documentation,
24
+ authentication: 'merchant-session-or-rsa', verification: 'response_only', previewInput: coupon ? couponPreview : promotionCodePreview,
25
+ targetResourceId: input => coupon ? action === 'create' ? undefined : input.id : action === 'deactivate' ? input.id : input.couponId,
26
+ resultResourceId: data => batch ? data.batchId : data[key].id,
23
27
  ...(batch ? {} : { responseKey: key }),
24
28
  validateResponse: data => batch
25
29
  ? typeof data.batchId === 'string' && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(data.batchId) && Array.isArray(data.promotionCodes) && data.promotionCodes.length > 0 && data.promotionCodes.length <= 500 && data.promotionCodes.every(value => entity(value, 'PMC') && typeof value.code === 'string')
@@ -0,0 +1,17 @@
1
+ import { previewFields } from "./action-previews.js";
2
+ function restrictionsPreview(input) {
3
+ return previewFields(input, ['perCustomerLimit', 'maxRedemptions', 'expiresAt', 'minimumAmount']);
4
+ }
5
+ function promotionPreview(input, visible) {
6
+ const result = previewFields(input, visible);
7
+ if (input.restrictions !== undefined)
8
+ result.restrictions = restrictionsPreview(input.restrictions);
9
+ return result;
10
+ }
11
+ export function couponPreview(input) {
12
+ const result = previewFields(input, ['id', 'storeId', 'discount', 'duration', 'durationInPeriods', 'productIds', 'maxRedemptions', 'redeemBy']);
13
+ if (Array.isArray(input.promotionCodes))
14
+ result.promotionCodes = input.promotionCodes.map(item => promotionPreview(item, []));
15
+ return result;
16
+ }
17
+ export const promotionCodePreview = (input) => promotionPreview(input, ['id', 'couponId', 'count', 'length']);
@@ -0,0 +1,5 @@
1
+ export function productPreview(input) {
2
+ return { type: input.type, storeId: input.storeId, name: input.name, prices: input.prices, billingPeriod: input.billingPeriod,
3
+ metadata: input.metadata === undefined ? undefined : '[redacted]', description: input.description === undefined ? undefined : '[redacted]',
4
+ media: input.media === undefined ? undefined : '[redacted]', successUrl: input.successUrl === undefined ? undefined : '[redacted]' };
5
+ }
@@ -86,7 +86,15 @@ export const readSpecs = [
86
86
  listSpec('merchants', 'merchants', fields('id', 'email', 'status', 'createdAt'), objectSchema({}), productDocs),
87
87
  getSpec('merchants', 'merchant', fields('id', 'email', 'status', 'createdAt', 'updatedAt'), merchantId, productDocs, 'MER_abc'),
88
88
  ...['graphql', 'analytics'].map(resource => ({
89
- definition: { id: `${resource}.query`, path: `${resource} query`, description: resource === 'analytics' ? 'Run a custom read-only analytics GraphQL document with explicit nested selections' : 'Run exactly one read-only GraphQL operation; fragments and variables are supported', effect: 'read', file: true, schema: querySchema, options: [previewOption, ['--output <path>', 'Export response to a new private file; required for arbitrary GraphQL']], example: `pancake ${resource} query --file query.json --dry-run --json` },
89
+ definition: {
90
+ id: `${resource}.query`, path: `${resource} query`, description: resource === 'analytics' ? 'Run a custom read-only analytics GraphQL document with explicit nested selections' : 'Run exactly one read-only GraphQL operation; fragments and variables are supported',
91
+ effect: 'read', file: true, schema: querySchema, options: [
92
+ previewOption,
93
+ ['--output <path>', 'Export response to a new private file; required for arbitrary GraphQL'],
94
+ ...(resource === 'graphql' ? [['--background', 'Run this read without adding a local operation record']] : []),
95
+ ],
96
+ example: `pancake ${resource} query --file query.json --dry-run --json`,
97
+ },
90
98
  sensitiveOutput: true, documentation: [`${docs}graphql/${resource === 'analytics' ? 'analytics' : 'overview'}`], request: (input) => readOnlyRequest(input),
91
99
  })),
92
100
  ];