@primitivedotdev/cli 0.26.3 → 0.26.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/dist/oclif/index.js +32 -0
- package/package.json +1 -1
package/dist/oclif/index.js
CHANGED
|
@@ -9597,6 +9597,32 @@ async function maybeWriteFunctionEndpointRedirect(inputs) {
|
|
|
9597
9597
|
return match;
|
|
9598
9598
|
}
|
|
9599
9599
|
//#endregion
|
|
9600
|
+
//#region src/oclif/idempotent-replay-banner.ts
|
|
9601
|
+
/**
|
|
9602
|
+
* If `data` carries `idempotent_replay: true`, write a multi-line
|
|
9603
|
+
* stderr banner explaining the replay condition and what the caller
|
|
9604
|
+
* can do to bypass it. Otherwise no-op.
|
|
9605
|
+
*/
|
|
9606
|
+
function writeIdempotentReplayBannerIfReplay(data, options) {
|
|
9607
|
+
if (!isReplay(data)) return;
|
|
9608
|
+
const probe = data;
|
|
9609
|
+
const rowId = typeof probe.id === "string" ? probe.id : null;
|
|
9610
|
+
const status = typeof probe.status === "string" ? probe.status : null;
|
|
9611
|
+
const deliveryStatus = typeof probe.delivery_status === "string" ? probe.delivery_status : null;
|
|
9612
|
+
const lines = ["note: idempotent replay. this exact send already happened earlier.", " no new MX traffic was generated by this call. nothing new will arrive in any inbox."];
|
|
9613
|
+
if (rowId) lines.push(` cached row id: ${rowId}`);
|
|
9614
|
+
if (status || deliveryStatus) {
|
|
9615
|
+
const parts = [status ? `status=${status}` : null, deliveryStatus && deliveryStatus !== status ? `delivery_status=${deliveryStatus}` : null].filter((part) => part !== null);
|
|
9616
|
+
if (parts.length > 0) lines.push(` original ${parts.join(", ")}`);
|
|
9617
|
+
}
|
|
9618
|
+
lines.push(" to send a fresh copy: vary any field (subject, body, etc.) or", " pass a unique Idempotency-Key on the underlying API call.");
|
|
9619
|
+
options.write(`${lines.join("\n")}\n`);
|
|
9620
|
+
}
|
|
9621
|
+
function isReplay(data) {
|
|
9622
|
+
if (data === null || typeof data !== "object") return false;
|
|
9623
|
+
return data.idempotent_replay === true;
|
|
9624
|
+
}
|
|
9625
|
+
//#endregion
|
|
9600
9626
|
//#region src/oclif/api-command.ts
|
|
9601
9627
|
const API_ERROR_CODES = {
|
|
9602
9628
|
accessDenied: "access_denied",
|
|
@@ -10031,6 +10057,9 @@ function createOperationCommand(operation) {
|
|
|
10031
10057
|
const hint = EMPTY_RESULT_HINTS[operation.sdkName];
|
|
10032
10058
|
if (hint) process.stderr.write(`${hint}\n`);
|
|
10033
10059
|
}
|
|
10060
|
+
writeIdempotentReplayBannerIfReplay(envelope?.data, { write: (chunk) => {
|
|
10061
|
+
process.stderr.write(chunk);
|
|
10062
|
+
} });
|
|
10034
10063
|
this.log(JSON.stringify(envelope?.data ?? null, null, 2));
|
|
10035
10064
|
});
|
|
10036
10065
|
}
|
|
@@ -12330,6 +12359,9 @@ var SendCommand = class SendCommand extends Command {
|
|
|
12330
12359
|
return;
|
|
12331
12360
|
}
|
|
12332
12361
|
const envelope = result.data;
|
|
12362
|
+
writeIdempotentReplayBannerIfReplay(envelope?.data, { write: (chunk) => {
|
|
12363
|
+
process.stderr.write(chunk);
|
|
12364
|
+
} });
|
|
12333
12365
|
this.log(JSON.stringify(envelope?.data ?? null, null, 2));
|
|
12334
12366
|
});
|
|
12335
12367
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primitivedotdev/cli",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.4",
|
|
4
4
|
"description": "Official Primitive CLI: deploy Primitive Functions, send and inspect mail, manage endpoints, all from the terminal. Wraps the @primitivedotdev/sdk runtime client with one-shot commands.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|