terse-types 0.0.71 → 0.0.73

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.
@@ -88,6 +88,7 @@ export declare const ApiRoutes: {
88
88
  INTEGRATIONS: string;
89
89
  OAUTH_CALLBACK: string;
90
90
  OBJECTS: string;
91
+ LISTS: string;
91
92
  };
92
93
  HEY_REACH: {
93
94
  INTEGRATIONS: string;
@@ -87,7 +87,8 @@
87
87
  "ATTIO": {
88
88
  "INTEGRATIONS": "/attio/integrations",
89
89
  "OAUTH_CALLBACK": "/attio/oauth/callback",
90
- "OBJECTS": "/attio/integrations/:integrationId/objects"
90
+ "OBJECTS": "/attio/integrations/:integrationId/objects",
91
+ "LISTS": "/attio/integrations/:integrationId/lists"
91
92
  },
92
93
  "HEY_REACH": {
93
94
  "INTEGRATIONS": "/heyreach/integrations",
@@ -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]);
@@ -40,6 +40,62 @@ function memoryLabel(command, done) {
40
40
  return done ? "Renamed memory file" : "Reorganizing memory";
41
41
  }
42
42
  }
43
+ function safeParseCount(result) {
44
+ const parsed = safeParseResult(result);
45
+ return typeof parsed?.count === "number" ? parsed.count : undefined;
46
+ }
47
+ function attioActionLabel(params, noun, done, count) {
48
+ const request = params?.request;
49
+ const action = request?.action ?? "";
50
+ const verbByPrefix = [
51
+ ["list", ["Loading", "Loaded"]],
52
+ ["query", ["Loading", "Loaded"]],
53
+ ["get", ["Loading", "Loaded"]],
54
+ ["create", ["Creating", "Created"]],
55
+ ["add", ["Adding", "Added"]],
56
+ ["upsert", ["Saving", "Saved"]],
57
+ ["update", ["Updating", "Updated"]],
58
+ ["upload", ["Uploading", "Uploaded"]],
59
+ ["delete", ["Deleting", "Deleted"]],
60
+ ["remove", ["Removing", "Removed"]]
61
+ ];
62
+ const match = verbByPrefix.find(([prefix]) => action.startsWith(prefix));
63
+ const verb = match ? match[1][done ? 1 : 0] : done ? "Finished" : "Working with";
64
+ const plural = action.startsWith("list") || action.startsWith("query");
65
+ if (done && count !== undefined && plural)
66
+ return `${verb} ${count} ${noun}${count !== 1 ? "s" : ""}`;
67
+ return `${verb} ${noun}${plural ? "s" : ""}`;
68
+ }
69
+ function attioRecordsRequest(params) {
70
+ const request = params?.request;
71
+ return request && typeof request === "object" && "action" in request ? request : undefined;
72
+ }
73
+ function attioRecordsLabel(request, done, count) {
74
+ if (!request)
75
+ return done ? "Updated records" : "Working with records";
76
+ const target = `${request.objectSlug} record`;
77
+ switch (request.action) {
78
+ case "query":
79
+ case "search":
80
+ if (done && count !== undefined)
81
+ return `Found ${count} ${target}${count !== 1 ? "s" : ""}`;
82
+ return (done ? "Searched" : "Searching") + ` ${target}s`;
83
+ case "get":
84
+ return (done ? "Loaded" : "Loading") + ` ${target}`;
85
+ case "get_attribute_history":
86
+ return (done ? "Loaded" : "Loading") + ` ${target} history`;
87
+ case "create":
88
+ return (done ? "Created" : "Creating") + ` ${target}`;
89
+ case "update":
90
+ return (done ? "Updated" : "Updating") + ` ${target}`;
91
+ case "upsert":
92
+ if (done && count !== undefined && count !== 1)
93
+ return `Saved ${count} ${target}s`;
94
+ return (done ? "Saved" : "Saving") + ` ${target}`;
95
+ case "delete":
96
+ return (done ? "Deleted" : "Deleting") + ` ${target}`;
97
+ }
98
+ }
43
99
  /**
44
100
  * Display configurations for all tools.
45
101
  * Each tool defines how it should be displayed in preparing, executing, and complete phases.
@@ -672,57 +728,69 @@ const TOOL_DISPLAY_CONFIG = {
672
728
  // ===================
673
729
  // Attio Tools
674
730
  // ===================
675
- attio_upsert_record: {
676
- preparing: "Getting your record ready",
677
- executing: params => {
678
- const objectSlug = params?.objectSlug;
679
- return objectSlug ? `Saving ${objectSlug} record` : "Saving record";
680
- },
731
+ attio_records: {
732
+ preparing: "Getting records ready",
733
+ executing: params => attioRecordsLabel(attioRecordsRequest(params), false),
681
734
  complete: (params, result) => {
682
735
  const parsed = safeParseResult(result);
683
- const actions = parsed?.actions;
684
- const target = actions?.[0]?.target;
685
- const objectSlug = params?.objectSlug;
686
- if (target)
687
- return `Saved ${objectSlug || "record"}: ${truncate(target, 30)}`;
688
- if (objectSlug)
689
- return `Saved ${objectSlug} record`;
690
- return "Record saved";
736
+ const count = parsed?.count;
737
+ return attioRecordsLabel(attioRecordsRequest(params), true, count);
691
738
  },
692
739
  approval: params => {
693
- const objectSlug = params?.objectSlug;
694
- return objectSlug ? `Save ${objectSlug} record?` : "Save this record?";
740
+ const request = attioRecordsRequest(params);
741
+ const target = request ? `${request.objectSlug} record` : "record";
742
+ return request?.action === "delete" ? `Delete this ${target}? This cannot be undone.` : `Save ${target}?`;
695
743
  }
696
744
  },
697
- attio_query_records: {
698
- preparing: "Looking up records",
745
+ attio_workspace_members: {
746
+ preparing: "Looking up workspace members",
699
747
  executing: params => {
700
- const objectSlug = params?.objectSlug;
701
- return objectSlug ? `Searching ${objectSlug} records` : "Searching records";
748
+ const request = params?.request;
749
+ return request?.action === "get" ? "Loading workspace member" : "Loading workspace members";
702
750
  },
703
751
  complete: (params, result) => {
704
752
  const parsed = safeParseResult(result);
705
753
  const count = parsed?.count;
706
- const objectSlug = params?.objectSlug;
707
- if (count !== undefined && objectSlug)
708
- return `Found ${count} ${objectSlug} record${count !== 1 ? "s" : ""}`;
709
- if (count !== undefined)
710
- return `Found ${count} record${count !== 1 ? "s" : ""}`;
711
- if (objectSlug)
712
- return `Searched ${objectSlug} records`;
713
- return "Search complete";
714
- }
715
- },
716
- attio_list_objects: {
717
- preparing: "Loading object types",
718
- executing: () => "Loading object types",
719
- complete: (_params, result) => {
720
- const parsed = safeParseResult(result);
721
- const count = parsed?.count;
722
- if (count !== undefined)
723
- return `Found ${count} object type${count !== 1 ? "s" : ""}`;
724
- return "Object types loaded";
725
- }
754
+ const request = params?.request;
755
+ if (request?.action === "get")
756
+ return "Loaded workspace member";
757
+ return count !== undefined ? `Found ${count} workspace member${count !== 1 ? "s" : ""}` : "Workspace members loaded";
758
+ }
759
+ },
760
+ attio_tasks: {
761
+ preparing: "Working with tasks",
762
+ executing: params => attioActionLabel(params, "task", false),
763
+ complete: (params, result) => attioActionLabel(params, "task", true, safeParseCount(result))
764
+ },
765
+ attio_notes: {
766
+ preparing: "Working with notes",
767
+ executing: params => attioActionLabel(params, "note", false),
768
+ complete: (params, result) => attioActionLabel(params, "note", true, safeParseCount(result))
769
+ },
770
+ attio_comments: {
771
+ preparing: "Working with comments",
772
+ executing: params => attioActionLabel(params, "comment", false),
773
+ complete: (params, result) => attioActionLabel(params, "comment", true, safeParseCount(result))
774
+ },
775
+ attio_lists: {
776
+ preparing: "Working with lists",
777
+ executing: params => attioActionLabel(params, "list entry", false),
778
+ complete: (params, result) => attioActionLabel(params, "list entry", true, safeParseCount(result))
779
+ },
780
+ attio_meetings: {
781
+ preparing: "Loading meetings",
782
+ executing: params => attioActionLabel(params, "meeting", false),
783
+ complete: (params, result) => attioActionLabel(params, "meeting", true, safeParseCount(result))
784
+ },
785
+ attio_files: {
786
+ preparing: "Working with files",
787
+ executing: params => attioActionLabel(params, "file", false),
788
+ complete: (params, result) => attioActionLabel(params, "file", true, safeParseCount(result))
789
+ },
790
+ attio_schema: {
791
+ preparing: "Loading workspace schema",
792
+ executing: params => attioActionLabel(params, "schema item", false),
793
+ complete: (params, result) => attioActionLabel(params, "schema item", true, safeParseCount(result))
726
794
  },
727
795
  // ===================
728
796
  // WorkOS Tools