terse-types 0.0.47 → 0.0.49

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/README.md CHANGED
@@ -9,7 +9,7 @@ Internal shared types for the [Terse](https://useterse.ai) platform.
9
9
  If you landed here while building a workflow, you almost certainly want one of these instead:
10
10
 
11
11
  - **[`terse-cli`](https://www.npmjs.com/package/terse-cli)** to scaffold, test, and deploy workflows
12
- - **[`terse-sdk`](https://www.npmjs.com/package/terse-sdk)** to write workflow code (`createJob`, `TerseAgent`, trigger types)
12
+ - **[`terse-sdk`](https://www.npmjs.com/package/terse-sdk)** to write workflow code (`createJob`, `generateText`, trigger types)
13
13
  - **[docs.useterse.ai](https://docs.useterse.ai)** for guides and reference
14
14
 
15
15
  If a doc, post, or LLM pointed you at `terse-types` directly, that was probably a mistake on our end. [Let us know](mailto:support@useterse.ai) so we can fix it. The types you actually need are re-exported from `terse-sdk`.
@@ -0,0 +1,112 @@
1
+ import { z } from "zod";
2
+ export declare const eventTypeSchema: z.ZodEnum<{
3
+ JOB_CREATED: "JOB_CREATED";
4
+ AUTOMATION_RAN: "AUTOMATION_RAN";
5
+ }>;
6
+ export type EventType = z.infer<typeof eventTypeSchema>;
7
+ declare const jobCreatedEventSchema: z.ZodObject<{
8
+ eventType: z.ZodLiteral<"JOB_CREATED">;
9
+ jobId: z.ZodString;
10
+ }, z.core.$strip>;
11
+ export type JobCreatedEvent = z.infer<typeof jobCreatedEventSchema>;
12
+ declare const automationSnapshotSchema: z.ZodObject<{
13
+ id: z.ZodString;
14
+ name: z.ZodString;
15
+ organizationId: z.ZodString;
16
+ projectId: z.ZodString;
17
+ userId: z.ZodString;
18
+ requireApproval: z.ZodBoolean;
19
+ }, z.core.$strip>;
20
+ export type AutomationSnapshot = z.infer<typeof automationSnapshotSchema>;
21
+ declare const runSnapshotSchema: z.ZodObject<{
22
+ id: z.ZodString;
23
+ status: z.ZodEnum<{
24
+ readonly SUCCESS: "success";
25
+ readonly FAILED: "failed";
26
+ readonly CANCELLED: "cancelled";
27
+ readonly SKIPPED: "skipped";
28
+ readonly IN_PROGRESS: "in_progress";
29
+ readonly AWAITING_APPROVAL: "awaiting_approval";
30
+ }>;
31
+ isManuallyTriggered: z.ZodBoolean;
32
+ startedAt: z.ZodString;
33
+ trigger: z.ZodObject<{
34
+ event: z.ZodString;
35
+ integration: z.ZodEnum<typeof import("./Integrations.js").IntegrationType>;
36
+ source: z.ZodString;
37
+ title: z.ZodOptional<z.ZodString>;
38
+ subheader: z.ZodOptional<z.ZodString>;
39
+ url: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$strip>;
41
+ }, z.core.$strip>;
42
+ export type RunSnapshot = z.infer<typeof runSnapshotSchema>;
43
+ declare const automationRanEventSchema: z.ZodObject<{
44
+ eventType: z.ZodLiteral<"AUTOMATION_RAN">;
45
+ automation: z.ZodObject<{
46
+ id: z.ZodString;
47
+ name: z.ZodString;
48
+ organizationId: z.ZodString;
49
+ projectId: z.ZodString;
50
+ userId: z.ZodString;
51
+ requireApproval: z.ZodBoolean;
52
+ }, z.core.$strip>;
53
+ run: z.ZodObject<{
54
+ id: z.ZodString;
55
+ status: z.ZodEnum<{
56
+ readonly SUCCESS: "success";
57
+ readonly FAILED: "failed";
58
+ readonly CANCELLED: "cancelled";
59
+ readonly SKIPPED: "skipped";
60
+ readonly IN_PROGRESS: "in_progress";
61
+ readonly AWAITING_APPROVAL: "awaiting_approval";
62
+ }>;
63
+ isManuallyTriggered: z.ZodBoolean;
64
+ startedAt: z.ZodString;
65
+ trigger: z.ZodObject<{
66
+ event: z.ZodString;
67
+ integration: z.ZodEnum<typeof import("./Integrations.js").IntegrationType>;
68
+ source: z.ZodString;
69
+ title: z.ZodOptional<z.ZodString>;
70
+ subheader: z.ZodOptional<z.ZodString>;
71
+ url: z.ZodOptional<z.ZodString>;
72
+ }, z.core.$strip>;
73
+ }, z.core.$strip>;
74
+ }, z.core.$strip>;
75
+ export type AutomationRanEvent = z.infer<typeof automationRanEventSchema>;
76
+ export declare const domainEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
77
+ eventType: z.ZodLiteral<"JOB_CREATED">;
78
+ jobId: z.ZodString;
79
+ }, z.core.$strip>, z.ZodObject<{
80
+ eventType: z.ZodLiteral<"AUTOMATION_RAN">;
81
+ automation: z.ZodObject<{
82
+ id: z.ZodString;
83
+ name: z.ZodString;
84
+ organizationId: z.ZodString;
85
+ projectId: z.ZodString;
86
+ userId: z.ZodString;
87
+ requireApproval: z.ZodBoolean;
88
+ }, z.core.$strip>;
89
+ run: z.ZodObject<{
90
+ id: z.ZodString;
91
+ status: z.ZodEnum<{
92
+ readonly SUCCESS: "success";
93
+ readonly FAILED: "failed";
94
+ readonly CANCELLED: "cancelled";
95
+ readonly SKIPPED: "skipped";
96
+ readonly IN_PROGRESS: "in_progress";
97
+ readonly AWAITING_APPROVAL: "awaiting_approval";
98
+ }>;
99
+ isManuallyTriggered: z.ZodBoolean;
100
+ startedAt: z.ZodString;
101
+ trigger: z.ZodObject<{
102
+ event: z.ZodString;
103
+ integration: z.ZodEnum<typeof import("./Integrations.js").IntegrationType>;
104
+ source: z.ZodString;
105
+ title: z.ZodOptional<z.ZodString>;
106
+ subheader: z.ZodOptional<z.ZodString>;
107
+ url: z.ZodOptional<z.ZodString>;
108
+ }, z.core.$strip>;
109
+ }, z.core.$strip>;
110
+ }, z.core.$strip>], "eventType">;
111
+ export type DomainEvent = z.infer<typeof domainEventSchema>;
112
+ export {};
package/dist/Events.js ADDED
@@ -0,0 +1,32 @@
1
+ import { z } from "zod";
2
+ import { runHistoryStatusSchema } from "./RunHistoryTypes.js";
3
+ import { runHistoryTriggerSchema } from "./types.js";
4
+ export const eventTypeSchema = z.enum(["JOB_CREATED", "AUTOMATION_RAN"]);
5
+ const baseEventSchema = z.object({
6
+ eventType: eventTypeSchema
7
+ });
8
+ const jobCreatedEventSchema = baseEventSchema.extend({
9
+ eventType: z.literal("JOB_CREATED"),
10
+ jobId: z.string()
11
+ });
12
+ const automationSnapshotSchema = z.object({
13
+ id: z.string(),
14
+ name: z.string(),
15
+ organizationId: z.string(),
16
+ projectId: z.string(),
17
+ userId: z.string(),
18
+ requireApproval: z.boolean()
19
+ });
20
+ const runSnapshotSchema = z.object({
21
+ id: z.string(),
22
+ status: runHistoryStatusSchema,
23
+ isManuallyTriggered: z.boolean(),
24
+ startedAt: z.string().datetime(),
25
+ trigger: runHistoryTriggerSchema
26
+ });
27
+ const automationRanEventSchema = baseEventSchema.extend({
28
+ eventType: z.literal("AUTOMATION_RAN"),
29
+ automation: automationSnapshotSchema,
30
+ run: runSnapshotSchema
31
+ });
32
+ export const domainEventSchema = z.discriminatedUnion("eventType", [jobCreatedEventSchema, automationRanEventSchema]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "terse-types",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
4
4
  "type": "module",
5
5
  "description": "Shared Terse TypeScript types, enums, constants, and helpers.",
6
6
  "main": "./dist/index.js",