terse-types 0.0.33 → 0.0.35

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/Triggers.js CHANGED
@@ -1,9 +1,17 @@
1
1
  import { z } from "zod";
2
- import { GitHubEventType, HeyReachEventType, WorkOSEventType, frequencyUnitSchema, gitHubEventTypeSchema, gmailEventTypeSchema, heyReachEventTypeSchema, linearEventTypeSchema, slackEventTypeSchema, workOSEventTypeSchema } from "./Configs.js";
2
+ import { AttioEventType, GitHubEventType, HeyReachEventType, WorkOSEventType, attioEventTypeSchema, frequencyUnitSchema, gitHubEventTypeSchema, gmailEventTypeSchema, heyReachEventTypeSchema, linearEventTypeSchema, slackEventTypeSchema, workOSEventTypeSchema } from "./Configs.js";
3
3
  import { IntegrationType, integrationTypeEnum } from "./Integrations.js";
4
4
  import { SlackChannelType } from "./SlackTypes.js";
5
5
  import { debugTrigger as debugTriggerWithPresenter, displayTrigger as displayTriggerWithPresenter, formatTriggerForAgent as formatTriggerForAgentWithPresenter } from "./TriggerPresenters.js";
6
- const providerTriggerTypeSchema = z.union([slackEventTypeSchema, gitHubEventTypeSchema, linearEventTypeSchema, gmailEventTypeSchema, workOSEventTypeSchema, heyReachEventTypeSchema]);
6
+ const providerTriggerTypeSchema = z.union([
7
+ slackEventTypeSchema,
8
+ gitHubEventTypeSchema,
9
+ linearEventTypeSchema,
10
+ gmailEventTypeSchema,
11
+ workOSEventTypeSchema,
12
+ heyReachEventTypeSchema,
13
+ attioEventTypeSchema
14
+ ]);
7
15
  const TriggerHeaderSchema = z.object({
8
16
  integrationType: integrationTypeEnum,
9
17
  eventType: providerTriggerTypeSchema
@@ -238,6 +246,7 @@ export const TriggerTypeSchema = z.union([
238
246
  gmailEventTypeSchema,
239
247
  workOSEventTypeSchema,
240
248
  heyReachEventTypeSchema,
249
+ attioEventTypeSchema,
241
250
  webhookTriggerTypeSchema,
242
251
  cronTriggerTypeSchema,
243
252
  webMonitorTriggerTypeSchema,
@@ -497,6 +506,121 @@ export const heyReachTriggerSchema = z.discriminatedUnion("eventType", [
497
506
  heyReachCampaignCompletedTriggerSchema,
498
507
  heyReachLeadTagUpdatedTriggerSchema
499
508
  ]);
509
+ // MARK: Attio Triggers
510
+ export const AttioActorType = {
511
+ API_TOKEN: "api-token",
512
+ WORKSPACE_MEMBER: "workspace-member",
513
+ SYSTEM: "system",
514
+ APP: "app"
515
+ };
516
+ export const attioActorTypeSchema = z.enum(AttioActorType);
517
+ export const attioWebhookActorSchema = z.object({
518
+ type: attioActorTypeSchema.nullable(),
519
+ id: z.string().nullable()
520
+ });
521
+ export const attioWebhookEventIdSchema = z.object({
522
+ workspace_id: z.string(),
523
+ object_id: z.string().optional(),
524
+ record_id: z.string().optional(),
525
+ list_id: z.string().optional(),
526
+ entry_id: z.string().optional(),
527
+ note_id: z.string().optional(),
528
+ task_id: z.string().optional(),
529
+ comment_id: z.string().optional(),
530
+ attribute_id: z.string().optional(),
531
+ call_recording_id: z.string().optional(),
532
+ meeting_id: z.string().optional(),
533
+ workspace_member_id: z.string().optional()
534
+ });
535
+ export const attioWebhookEventSchema = z.object({
536
+ event_type: attioEventTypeSchema,
537
+ id: attioWebhookEventIdSchema,
538
+ actor: attioWebhookActorSchema
539
+ });
540
+ export const attioWebhookPayloadSchema = z.object({
541
+ webhook_id: z.string(),
542
+ events: z.array(attioWebhookEventSchema)
543
+ });
544
+ export const attioRecordPayloadSchema = z.object({
545
+ id: z.object({
546
+ workspace_id: z.string(),
547
+ object_id: z.string(),
548
+ record_id: z.string()
549
+ }),
550
+ values: z.record(z.string(), z.unknown()),
551
+ web_url: z.string().optional(),
552
+ created_at: z.string().optional()
553
+ });
554
+ export const attioTriggerBaseSchema = baseTriggerSchema.extend({
555
+ integrationType: z.literal(IntegrationType.ATTIO),
556
+ eventType: attioEventTypeSchema,
557
+ /** Set from the inbound `Idempotency-Key` header; Attio does not include an event id in the body. */
558
+ eventId: z.string(),
559
+ /** Server-side receipt timestamp; Attio does not include a timestamp in the body. */
560
+ createdAt: z.string(),
561
+ workspaceId: z.string(),
562
+ resourceIds: attioWebhookEventIdSchema,
563
+ /** Object slug resolved by the backend when the event targets a record. */
564
+ objectSlug: z.string().nullable().optional(),
565
+ actor: attioWebhookActorSchema,
566
+ rawEvent: z.record(z.string(), z.unknown())
567
+ });
568
+ export const attioCallRecordingCreatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.CALL_RECORDING_CREATED) });
569
+ export const attioCommentCreatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.COMMENT_CREATED) });
570
+ export const attioCommentResolvedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.COMMENT_RESOLVED) });
571
+ export const attioCommentUnresolvedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.COMMENT_UNRESOLVED) });
572
+ export const attioCommentDeletedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.COMMENT_DELETED) });
573
+ export const attioListCreatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.LIST_CREATED) });
574
+ export const attioListUpdatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.LIST_UPDATED) });
575
+ export const attioListDeletedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.LIST_DELETED) });
576
+ export const attioListAttributeCreatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.LIST_ATTRIBUTE_CREATED) });
577
+ export const attioListAttributeUpdatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.LIST_ATTRIBUTE_UPDATED) });
578
+ export const attioListEntryCreatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.LIST_ENTRY_CREATED) });
579
+ export const attioListEntryUpdatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.LIST_ENTRY_UPDATED) });
580
+ export const attioListEntryDeletedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.LIST_ENTRY_DELETED) });
581
+ export const attioObjectAttributeCreatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.OBJECT_ATTRIBUTE_CREATED) });
582
+ export const attioObjectAttributeUpdatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.OBJECT_ATTRIBUTE_UPDATED) });
583
+ export const attioNoteCreatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.NOTE_CREATED) });
584
+ export const attioNoteContentUpdatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.NOTE_CONTENT_UPDATED) });
585
+ export const attioNoteUpdatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.NOTE_UPDATED) });
586
+ export const attioNoteDeletedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.NOTE_DELETED) });
587
+ export const attioRecordCreatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.RECORD_CREATED), record: attioRecordPayloadSchema });
588
+ export const attioRecordMergedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.RECORD_MERGED), record: attioRecordPayloadSchema });
589
+ export const attioRecordUpdatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.RECORD_UPDATED), record: attioRecordPayloadSchema });
590
+ export const attioRecordDeletedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.RECORD_DELETED) });
591
+ export const attioTaskCreatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.TASK_CREATED) });
592
+ export const attioTaskUpdatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.TASK_UPDATED) });
593
+ export const attioTaskDeletedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.TASK_DELETED) });
594
+ export const attioWorkspaceMemberCreatedTriggerSchema = attioTriggerBaseSchema.extend({ eventType: z.literal(AttioEventType.WORKSPACE_MEMBER_CREATED) });
595
+ export const attioTriggerSchema = z.discriminatedUnion("eventType", [
596
+ attioCallRecordingCreatedTriggerSchema,
597
+ attioCommentCreatedTriggerSchema,
598
+ attioCommentResolvedTriggerSchema,
599
+ attioCommentUnresolvedTriggerSchema,
600
+ attioCommentDeletedTriggerSchema,
601
+ attioListCreatedTriggerSchema,
602
+ attioListUpdatedTriggerSchema,
603
+ attioListDeletedTriggerSchema,
604
+ attioListAttributeCreatedTriggerSchema,
605
+ attioListAttributeUpdatedTriggerSchema,
606
+ attioListEntryCreatedTriggerSchema,
607
+ attioListEntryUpdatedTriggerSchema,
608
+ attioListEntryDeletedTriggerSchema,
609
+ attioObjectAttributeCreatedTriggerSchema,
610
+ attioObjectAttributeUpdatedTriggerSchema,
611
+ attioNoteCreatedTriggerSchema,
612
+ attioNoteContentUpdatedTriggerSchema,
613
+ attioNoteUpdatedTriggerSchema,
614
+ attioNoteDeletedTriggerSchema,
615
+ attioRecordCreatedTriggerSchema,
616
+ attioRecordMergedTriggerSchema,
617
+ attioRecordUpdatedTriggerSchema,
618
+ attioRecordDeletedTriggerSchema,
619
+ attioTaskCreatedTriggerSchema,
620
+ attioTaskUpdatedTriggerSchema,
621
+ attioTaskDeletedTriggerSchema,
622
+ attioWorkspaceMemberCreatedTriggerSchema
623
+ ]);
500
624
  export const webhookTriggerSchema = baseTriggerSchema.extend({
501
625
  integrationType: z.literal(IntegrationType.WEBHOOK),
502
626
  eventType: webhookTriggerTypeSchema,
@@ -566,6 +690,7 @@ export const TriggerSchema = z.union([
566
690
  linearTriggerSchema,
567
691
  workOSTriggerSchema,
568
692
  heyReachTriggerSchema,
693
+ attioTriggerSchema,
569
694
  webhookTriggerSchema,
570
695
  cronTriggerSchema,
571
696
  webMonitorTriggerSchema,