terse-cli 0.1.76 → 0.2.0

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.
@@ -0,0 +1,3 @@
1
+ import type { SerializedEvent } from "terse-types";
2
+ export declare function parseSerializedEventJson(raw: string, flagLabel: string): SerializedEvent;
3
+ //# sourceMappingURL=serializedEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializedEvent.d.ts","sourceRoot":"","sources":["../src/serializedEvent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAKlD,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,eAAe,CAExF"}
@@ -0,0 +1,40 @@
1
+ import { serializedEventSchema } from "terse-types";
2
+ import { z } from "zod";
3
+ import { CliError } from "./cliError.js";
4
+ export function parseSerializedEventJson(raw, flagLabel) {
5
+ return validateSerializedEvent(parseJson(raw, flagLabel));
6
+ }
7
+ function parseJson(raw, flagLabel) {
8
+ try {
9
+ return JSON.parse(raw);
10
+ }
11
+ catch (err) {
12
+ throw new CliError("invalid_event_json", `${flagLabel} must be valid JSON.`, {
13
+ detail: err instanceof Error ? err.message : String(err)
14
+ });
15
+ }
16
+ }
17
+ function validateSerializedEvent(parsed) {
18
+ const result = serializedEventSchema.safeParse(parsed);
19
+ if (result.success)
20
+ return result.data;
21
+ throw new CliError("invalid_event_shape", "Event JSON does not match the canonical Trigger schema.", {
22
+ detail: `${EXPECTED_ENVELOPE_HINT}\n\nValidation issues:\n${z.prettifyError(result.error)}`
23
+ });
24
+ }
25
+ const EXPECTED_ENVELOPE_HINT = `Expected envelope (webhook example):
26
+ {
27
+ "integrationType": "webhook",
28
+ "eventType": "webhook",
29
+ "formattedContent": "<any string>",
30
+ "debugLog": "<any string>",
31
+ "data": {
32
+ "integrationType": "webhook",
33
+ "eventType": "webhook",
34
+ "body": <your provider payload>,
35
+ "headers": { "content-type": "application/json" },
36
+ "method": "POST"
37
+ }
38
+ }
39
+ Tip: \`terse test show <id> --json\` prints a valid event.`;
40
+ //# sourceMappingURL=serializedEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializedEvent.js","sourceRoot":"","sources":["../src/serializedEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,UAAU,wBAAwB,CAAC,GAAW,EAAE,SAAiB;IACnE,OAAO,uBAAuB,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAA;AAC7D,CAAC;AAED,SAAS,SAAS,CAAC,GAAW,EAAE,SAAiB;IAC7C,IAAI,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC1B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACX,MAAM,IAAI,QAAQ,CAAC,oBAAoB,EAAE,GAAG,SAAS,sBAAsB,EAAE;YACzE,MAAM,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;SAC3D,CAAC,CAAA;IACN,CAAC;AACL,CAAC;AAED,SAAS,uBAAuB,CAAC,MAAe;IAC5C,MAAM,MAAM,GAAG,qBAAqB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;IACtD,IAAI,MAAM,CAAC,OAAO;QAAE,OAAO,MAAM,CAAC,IAAI,CAAA;IACtC,MAAM,IAAI,QAAQ,CAAC,qBAAqB,EAAE,yDAAyD,EAAE;QACjG,MAAM,EAAE,GAAG,sBAAsB,2BAA2B,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;KAC9F,CAAC,CAAA;AACN,CAAC;AAED,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;2DAc4B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terse-cli",
3
- "version": "0.1.76",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "repository": {
@@ -38,8 +38,8 @@
38
38
  "typescript": "^5.0.0",
39
39
  "workflow": "5.0.0-beta.19",
40
40
  "zod": "^4.3.6",
41
- "terse-sdk": "0.1.65",
42
- "terse-types": "0.0.60"
41
+ "terse-types": "0.0.61",
42
+ "terse-sdk": "0.2.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/luxon": "^3.7.1",