terse-types 0.0.77 → 0.1.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.
- package/dist/Events.d.ts +112 -0
- package/dist/Events.js +32 -0
- package/dist/Integrations.d.ts +6 -0
- package/dist/Integrations.js +9 -0
- package/dist/Tools.js +4 -2
- package/dist/TriggerDefinition.d.ts +34 -0
- package/dist/TriggerDefinition.js +6 -0
- package/dist/TriggerPresenters.d.ts +38 -8
- package/dist/TriggerPresenters.js +233 -294
- package/dist/TriggerProjections.d.ts +18 -0
- package/dist/TriggerProjections.js +167 -0
- package/dist/Triggers.d.ts +2111 -30
- package/dist/Triggers.js +633 -25
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types.d.ts +66 -66
- package/package.json +1 -1
- package/dist/AttioRecordFlatten.d.ts +0 -19
- package/dist/AttioRecordFlatten.js +0 -71
- package/dist/OrganizationMetadata.d.ts +0 -6
- package/dist/OrganizationMetadata.js +0 -10
- package/dist/json-schema/terse-types.schema.json +0 -15994
package/dist/Events.d.ts
ADDED
|
@@ -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/dist/Integrations.d.ts
CHANGED
|
@@ -19,6 +19,12 @@ export declare enum IntegrationType {
|
|
|
19
19
|
WEBMONITOR = "webmonitor"
|
|
20
20
|
}
|
|
21
21
|
export declare const integrationTypeEnum: z.ZodEnum<typeof IntegrationType>;
|
|
22
|
+
export declare const BUILT_IN_INTEGRATION_TYPES: readonly [IntegrationType.TERSE, IntegrationType.CRON_JOB, IntegrationType.WEBHOOK, IntegrationType.WEBMONITOR];
|
|
23
|
+
export type BuiltInIntegrationType = (typeof BUILT_IN_INTEGRATION_TYPES)[number];
|
|
24
|
+
export type ExternalIntegrationType = Exclude<IntegrationType, BuiltInIntegrationType>;
|
|
25
|
+
export declare function isBuiltInIntegrationType(type: IntegrationType): type is BuiltInIntegrationType;
|
|
26
|
+
export declare function isExternalIntegrationType(type: IntegrationType): type is ExternalIntegrationType;
|
|
27
|
+
export declare const EXTERNAL_INTEGRATION_TYPES: readonly ExternalIntegrationType[];
|
|
22
28
|
export interface IntegrationDetails {
|
|
23
29
|
type: IntegrationType;
|
|
24
30
|
name: string;
|
package/dist/Integrations.js
CHANGED
|
@@ -21,6 +21,15 @@ export var IntegrationType;
|
|
|
21
21
|
IntegrationType["WEBMONITOR"] = "webmonitor";
|
|
22
22
|
})(IntegrationType || (IntegrationType = {}));
|
|
23
23
|
export const integrationTypeEnum = z.enum(IntegrationType);
|
|
24
|
+
export const BUILT_IN_INTEGRATION_TYPES = [IntegrationType.TERSE, IntegrationType.CRON_JOB, IntegrationType.WEBHOOK, IntegrationType.WEBMONITOR];
|
|
25
|
+
const builtInIntegrationTypes = new Set(BUILT_IN_INTEGRATION_TYPES);
|
|
26
|
+
export function isBuiltInIntegrationType(type) {
|
|
27
|
+
return builtInIntegrationTypes.has(type);
|
|
28
|
+
}
|
|
29
|
+
export function isExternalIntegrationType(type) {
|
|
30
|
+
return !isBuiltInIntegrationType(type);
|
|
31
|
+
}
|
|
32
|
+
export const EXTERNAL_INTEGRATION_TYPES = Object.values(IntegrationType).filter(isExternalIntegrationType);
|
|
24
33
|
// Metadata objects - using const objects instead of classes
|
|
25
34
|
export const GmailIntegrationMetadata = {
|
|
26
35
|
type: IntegrationType.GMAIL,
|
package/dist/Tools.js
CHANGED
|
@@ -225,7 +225,8 @@ export const notionReadablePropertyValueSchema = z.union([
|
|
|
225
225
|
z.array(notionFileReferenceSchema),
|
|
226
226
|
notionLooseObjectSchema
|
|
227
227
|
]);
|
|
228
|
-
export const notionPageBlockSchema = z
|
|
228
|
+
export const notionPageBlockSchema = z
|
|
229
|
+
.lazy(() => z.object({
|
|
229
230
|
id: z.string(),
|
|
230
231
|
type: z.string(),
|
|
231
232
|
object: z.string(),
|
|
@@ -250,7 +251,8 @@ export const notionPageBlockSchema = z.lazy(() => z.object({
|
|
|
250
251
|
page_id: z.string().optional(),
|
|
251
252
|
database_id: z.string().optional(),
|
|
252
253
|
children: z.array(notionPageBlockSchema).optional()
|
|
253
|
-
}))
|
|
254
|
+
}))
|
|
255
|
+
.meta({ id: "NotionBlock" });
|
|
254
256
|
export const notionPageQueryMetadataSchema = z.object({
|
|
255
257
|
page_id: z.string(),
|
|
256
258
|
object: z.string(),
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { IntegrationType } from "./Integrations.js";
|
|
3
|
+
export declare function defineTrigger<S extends z.ZodType>(definition: Omit<ConcreteTriggerDefinition<S>, "kind">): ConcreteTriggerDefinition<S>;
|
|
4
|
+
export declare function defineTriggerUnion(definition: Omit<UnionTriggerDefinition, "kind">): UnionTriggerDefinition;
|
|
5
|
+
export interface TriggerDisplay {
|
|
6
|
+
title: string;
|
|
7
|
+
subtitle: string;
|
|
8
|
+
}
|
|
9
|
+
export type TriggerPrintHints = {
|
|
10
|
+
readonly typeParams?: string;
|
|
11
|
+
readonly aliasArgs?: string;
|
|
12
|
+
readonly fieldOverrides?: Readonly<Record<string, string>>;
|
|
13
|
+
readonly imports?: readonly string[];
|
|
14
|
+
};
|
|
15
|
+
export type TriggerPresenter<T> = {
|
|
16
|
+
formatForAgent(trigger: T): string;
|
|
17
|
+
debug(trigger: T): string;
|
|
18
|
+
display(trigger: T): TriggerDisplay;
|
|
19
|
+
};
|
|
20
|
+
export type ConcreteTriggerDefinition<S extends z.ZodType = z.ZodType> = {
|
|
21
|
+
readonly kind: "concrete";
|
|
22
|
+
readonly integration: IntegrationType;
|
|
23
|
+
readonly schema: S;
|
|
24
|
+
readonly eventTypes: readonly string[];
|
|
25
|
+
readonly printHints?: TriggerPrintHints;
|
|
26
|
+
readonly presenter?: TriggerPresenter<z.infer<S>>;
|
|
27
|
+
};
|
|
28
|
+
export type UnionTriggerDefinition = {
|
|
29
|
+
readonly kind: "union";
|
|
30
|
+
readonly integration: IntegrationType;
|
|
31
|
+
readonly members: readonly string[];
|
|
32
|
+
readonly presenter?: TriggerPresenter<unknown>;
|
|
33
|
+
};
|
|
34
|
+
export type TriggerDefinition = ConcreteTriggerDefinition | UnionTriggerDefinition;
|
|
@@ -1,9 +1,39 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { TriggerDisplay } from "./TriggerDefinition.js";
|
|
3
|
+
import type { AttioTrigger, CronTrigger, GithubTrigger, GmailTrigger, HeyReachTrigger, LinearTrigger, ManualSampleTrigger, WebMonitorTrigger, WebhookTrigger, WorkOSTrigger, slackTriggerSchema } from "./Triggers.js";
|
|
4
|
+
export type { TriggerDisplay } from "./TriggerDefinition.js";
|
|
5
|
+
export declare function formatManualSampleTrigger(event: ManualSampleTrigger): string;
|
|
6
|
+
export declare function debugManualSampleTrigger(event: ManualSampleTrigger): string;
|
|
7
|
+
export declare function displayManualSampleTrigger(event: ManualSampleTrigger): TriggerDisplay;
|
|
8
|
+
export declare function formatGithubTrigger(event: GithubTrigger): string;
|
|
9
|
+
export declare function debugGithubTrigger(event: GithubTrigger): string;
|
|
10
|
+
export declare function formatGithubDisplay(event: GithubTrigger): TriggerDisplay;
|
|
11
|
+
export declare function formatSlackTrigger(event: SlackTriggerEvent): string;
|
|
12
|
+
export declare function debugSlackTrigger(event: SlackTriggerEvent): string;
|
|
13
|
+
export declare function formatSlackDisplay(event: SlackTriggerEvent): TriggerDisplay;
|
|
14
|
+
export declare function formatGmailTrigger(event: GmailTrigger): string;
|
|
15
|
+
export declare function debugGmailTrigger(event: GmailTrigger): string;
|
|
16
|
+
export declare function formatGmailDisplay(event: GmailTrigger): TriggerDisplay;
|
|
17
|
+
export declare function formatLinearTrigger(event: LinearTrigger): string;
|
|
18
|
+
export declare function debugLinearTrigger(event: LinearTrigger): string;
|
|
19
|
+
export declare function formatLinearDisplay(event: LinearTrigger): TriggerDisplay;
|
|
20
|
+
export declare function formatWorkOSTrigger(event: WorkOSTrigger): string;
|
|
21
|
+
export declare function debugWorkOSTrigger(event: WorkOSTrigger): string;
|
|
22
|
+
export declare function formatWorkOSDisplay(event: WorkOSTrigger): TriggerDisplay;
|
|
23
|
+
export declare function formatHeyReachTrigger(event: HeyReachTrigger): string;
|
|
24
|
+
export declare function debugHeyReachTrigger(event: HeyReachTrigger): string;
|
|
25
|
+
export declare function formatHeyReachDisplay(event: HeyReachTrigger): TriggerDisplay;
|
|
26
|
+
export declare function formatAttioTrigger(event: AttioTrigger): string;
|
|
27
|
+
export declare function debugAttioTrigger(event: AttioTrigger): string;
|
|
28
|
+
export declare function formatAttioDisplay(event: AttioTrigger): TriggerDisplay;
|
|
9
29
|
export declare function humanizeAttioEventType(eventType: string): string;
|
|
30
|
+
export declare function formatWebhookTrigger(event: WebhookTrigger): string;
|
|
31
|
+
export declare function debugWebhookTrigger(event: WebhookTrigger): string;
|
|
32
|
+
export declare function formatWebhookDisplay(event: WebhookTrigger): TriggerDisplay;
|
|
33
|
+
export declare function formatCronTrigger(event: CronTrigger): string;
|
|
34
|
+
export declare function debugCronTrigger(event: CronTrigger): string;
|
|
35
|
+
export declare function formatCronDisplay(event: CronTrigger): TriggerDisplay;
|
|
36
|
+
export declare function formatWebMonitorTrigger(event: WebMonitorTrigger): string;
|
|
37
|
+
export declare function debugWebMonitorTrigger(event: WebMonitorTrigger): string;
|
|
38
|
+
export declare function formatWebMonitorDisplay(event: WebMonitorTrigger): TriggerDisplay;
|
|
39
|
+
type SlackTriggerEvent = z.infer<typeof slackTriggerSchema>;
|