samva 0.43.3 → 0.45.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/AGENTS.md +3 -0
- package/README.md +4 -0
- package/dist/client/sdk.gen.d.ts +308 -2
- package/dist/client/sdk.gen.js +937 -2
- package/dist/client/types.gen.d.ts +2294 -54
- package/dist/effect/agents.d.ts +86 -86
- package/dist/effect/agents.js +2 -2
- package/dist/effect/api-keys.d.ts +36 -36
- package/dist/effect/api-keys.js +2 -2
- package/dist/effect/attachments.d.ts +3 -3
- package/dist/effect/attachments.js +1 -1
- package/dist/effect/campaigns.d.ts +250 -250
- package/dist/effect/campaigns.js +3 -3
- package/dist/effect/categories.d.ts +23 -5
- package/dist/effect/categories.js +11 -20
- package/dist/effect/contact-groups.d.ts +44 -44
- package/dist/effect/contact-groups.js +3 -3
- package/dist/effect/contacts.d.ts +3 -3
- package/dist/effect/contacts.js +1 -1
- package/dist/effect/conversations.d.ts +53 -53
- package/dist/effect/conversations.js +1 -1
- package/dist/effect/email.d.ts +99 -97
- package/dist/effect/email.js +21 -21
- package/dist/effect/errors.d.ts +1 -1
- package/dist/effect/errors.js +2 -2
- package/dist/effect/extension-installations.d.ts +6 -6
- package/dist/effect/extension-installations.js +1 -1
- package/dist/effect/generated/campaigns.js +2 -2
- package/dist/effect/generated/email.d.ts +7 -0
- package/dist/effect/generated/email.js +8 -9
- package/dist/effect/generated/index.d.ts +9 -1
- package/dist/effect/generated/journeys.d.ts +1 -3
- package/dist/effect/generated/journeys.js +2 -6
- package/dist/effect/generated/mailboxes.d.ts +14 -14
- package/dist/effect/generated/mailboxes.js +2 -0
- package/dist/effect/generated/messages.d.ts +1 -5
- package/dist/effect/generated/messages.js +2 -10
- package/dist/effect/generated/newsletter-issues.js +29 -29
- package/dist/effect/generated/organizations.js +2 -2
- package/dist/effect/generated/scheduled-messages.js +3 -3
- package/dist/effect/generated/shared.d.ts +112 -2
- package/dist/effect/generated/shared.js +66 -25
- package/dist/effect/generated/subscriptions.js +4 -4
- package/dist/effect/generated/template-registrations.d.ts +651 -0
- package/dist/effect/generated/template-registrations.js +138 -0
- package/dist/effect/generated/templates.d.ts +789 -6
- package/dist/effect/generated/templates.js +156 -54
- package/dist/effect/generated/whats-app-flows.d.ts +1838 -0
- package/dist/effect/generated/whats-app-flows.js +338 -0
- package/dist/effect/generated/whats-app-setup-links.d.ts +705 -0
- package/dist/effect/generated/whats-app-setup-links.js +150 -0
- package/dist/effect/generated/whats-app.d.ts +2089 -0
- package/dist/effect/generated/whats-app.js +633 -0
- package/dist/effect/generated-metadata.d.ts +257 -0
- package/dist/effect/generated-metadata.js +223 -48
- package/dist/effect/index.d.ts +4 -0
- package/dist/effect/index.js +6 -2
- package/dist/effect/mailboxes.d.ts +301 -301
- package/dist/effect/mailboxes.js +3 -3
- package/dist/effect/media.d.ts +4 -4
- package/dist/effect/media.js +2 -2
- package/dist/effect/messages.d.ts +17 -17
- package/dist/effect/messages.js +4 -4
- package/dist/effect/namespaces.d.ts +5 -5
- package/dist/effect/namespaces.js +1 -1
- package/dist/effect/newsletter-issues.d.ts +8 -8
- package/dist/effect/newsletter-issues.js +2 -2
- package/dist/effect/newsletters.d.ts +3 -3
- package/dist/effect/newsletters.js +1 -1
- package/dist/effect/organizations.d.ts +10 -10
- package/dist/effect/organizations.js +1 -1
- package/dist/effect/runtime.d.ts +2 -0
- package/dist/effect/runtime.js +2 -1
- package/dist/effect/scheduled-messages.d.ts +839 -839
- package/dist/effect/scheduled-messages.js +1 -1
- package/dist/effect/template-registrations.d.ts +12 -0
- package/dist/effect/template-registrations.js +16 -0
- package/dist/effect/templates.d.ts +66 -56
- package/dist/effect/templates.js +16 -12
- package/dist/effect/topic-forms.d.ts +4 -4
- package/dist/effect/topic-forms.js +1 -1
- package/dist/effect/topics.d.ts +11 -11
- package/dist/effect/topics.js +2 -2
- package/dist/effect/webhooks.d.ts +18 -18
- package/dist/effect/webhooks.js +3 -3
- package/dist/effect/whatsapp-flows.d.ts +34 -0
- package/dist/effect/whatsapp-flows.js +30 -0
- package/dist/effect/whatsapp-setup-links.d.ts +66 -0
- package/dist/effect/whatsapp-setup-links.js +18 -0
- package/dist/effect/whatsapp.d.ts +51 -0
- package/dist/effect/whatsapp.js +34 -0
- package/dist/index.js +2 -2
- package/dist/mailbox/types.d.ts +2 -1
- package/dist/package.js +1 -1
- package/dist/promises/client.d.ts +9 -1
- package/dist/promises/client.js +11 -3
- package/dist/promises/errors.gen.d.ts +38 -2
- package/dist/promises/errors.gen.js +160 -3
- package/dist/promises/index.js +2 -2
- package/dist/promises/types.gen.d.ts +1 -1
- package/dist/service-map.d.ts +923 -734
- package/dist/service-map.js +288 -233
- package/package.json +27 -11
|
@@ -476,6 +476,249 @@ export declare const sendTest: (input: {
|
|
|
476
476
|
};
|
|
477
477
|
readonly contactId?: string | null | undefined;
|
|
478
478
|
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"campaignsSendTest">;
|
|
479
|
+
export declare const create: (input: {
|
|
480
|
+
readonly name: string;
|
|
481
|
+
readonly channel: "email" | "sms" | "whatsapp";
|
|
482
|
+
readonly content: {
|
|
483
|
+
readonly channel: "sms";
|
|
484
|
+
readonly sms: {
|
|
485
|
+
readonly text?: string | null | undefined;
|
|
486
|
+
readonly templateId?: string | null | undefined;
|
|
487
|
+
readonly templateSlug?: string | null | undefined;
|
|
488
|
+
readonly templateData?: {
|
|
489
|
+
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | /*elided*/ any | {
|
|
490
|
+
readonly [x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null | undefined;
|
|
491
|
+
} | null)[] | {
|
|
492
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
493
|
+
} | null)[] | {
|
|
494
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
495
|
+
} | null)[] | {
|
|
496
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
497
|
+
} | null)[] | {
|
|
498
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
499
|
+
} | null)[] | {
|
|
500
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
501
|
+
} | null)[] | {
|
|
502
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
503
|
+
} | null)[] | {
|
|
504
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
505
|
+
} | null)[] | {
|
|
506
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
507
|
+
} | null)[] | {
|
|
508
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
509
|
+
} | null)[] | {
|
|
510
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
511
|
+
} | null)[] | {
|
|
512
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
513
|
+
} | null | undefined;
|
|
514
|
+
} | null | undefined;
|
|
515
|
+
};
|
|
516
|
+
readonly conversationId?: string | null | undefined;
|
|
517
|
+
readonly metadata?: {
|
|
518
|
+
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
519
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
520
|
+
} | null)[] | {
|
|
521
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
522
|
+
} | null)[] | {
|
|
523
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
524
|
+
} | null)[] | {
|
|
525
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
526
|
+
} | null)[] | {
|
|
527
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
528
|
+
} | null)[] | {
|
|
529
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
530
|
+
} | null)[] | {
|
|
531
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
532
|
+
} | null)[] | {
|
|
533
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
534
|
+
} | null)[] | {
|
|
535
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
536
|
+
} | null)[] | {
|
|
537
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
538
|
+
} | null)[] | {
|
|
539
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
540
|
+
} | null)[] | {
|
|
541
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
542
|
+
} | null | undefined;
|
|
543
|
+
} | null | undefined;
|
|
544
|
+
} | {
|
|
545
|
+
readonly channel: "email";
|
|
546
|
+
readonly email: {
|
|
547
|
+
readonly subject?: string | null | undefined;
|
|
548
|
+
readonly html?: string | null | undefined;
|
|
549
|
+
readonly text?: string | null | undefined;
|
|
550
|
+
readonly attachments?: readonly {
|
|
551
|
+
readonly filename: string;
|
|
552
|
+
readonly content?: string | null | undefined;
|
|
553
|
+
readonly mediaId?: string | null | undefined;
|
|
554
|
+
readonly contentType: string;
|
|
555
|
+
readonly size: number;
|
|
556
|
+
}[] | null | undefined;
|
|
557
|
+
readonly publicationId?: string | undefined;
|
|
558
|
+
readonly inputContractId?: string | undefined;
|
|
559
|
+
readonly templateId?: string | null | undefined;
|
|
560
|
+
readonly templateSlug?: string | null | undefined;
|
|
561
|
+
readonly templateData?: {
|
|
562
|
+
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
563
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
564
|
+
} | null)[] | {
|
|
565
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
566
|
+
} | null)[] | {
|
|
567
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
568
|
+
} | null)[] | {
|
|
569
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
570
|
+
} | null)[] | {
|
|
571
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
572
|
+
} | null)[] | {
|
|
573
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
574
|
+
} | null)[] | {
|
|
575
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
576
|
+
} | null)[] | {
|
|
577
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
578
|
+
} | null)[] | {
|
|
579
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
580
|
+
} | null)[] | {
|
|
581
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
582
|
+
} | null)[] | {
|
|
583
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
584
|
+
} | null)[] | {
|
|
585
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
586
|
+
} | null | undefined;
|
|
587
|
+
} | null | undefined;
|
|
588
|
+
readonly locale?: string | undefined;
|
|
589
|
+
readonly timeZone?: string | undefined;
|
|
590
|
+
readonly inReplyToMessageId?: string | null | undefined;
|
|
591
|
+
readonly replyTo?: readonly string[] | null | undefined;
|
|
592
|
+
readonly topicId?: string | null | undefined;
|
|
593
|
+
readonly tracking?: {
|
|
594
|
+
readonly opens?: boolean | undefined;
|
|
595
|
+
readonly clicks?: boolean | undefined;
|
|
596
|
+
} | undefined;
|
|
597
|
+
readonly footer?: {
|
|
598
|
+
readonly enabled?: boolean | null | undefined;
|
|
599
|
+
} | undefined;
|
|
600
|
+
readonly headers?: {
|
|
601
|
+
readonly [x: string]: string | undefined;
|
|
602
|
+
} | null | undefined;
|
|
603
|
+
readonly preheader?: string | null | undefined;
|
|
604
|
+
};
|
|
605
|
+
readonly issue?: {
|
|
606
|
+
readonly path: string;
|
|
607
|
+
readonly commit: string;
|
|
608
|
+
} | null | undefined;
|
|
609
|
+
readonly from?: {
|
|
610
|
+
readonly email: string;
|
|
611
|
+
readonly name?: string | null | undefined;
|
|
612
|
+
} | null | undefined;
|
|
613
|
+
readonly replyMailboxId?: string | null | undefined;
|
|
614
|
+
readonly conversationId?: string | null | undefined;
|
|
615
|
+
readonly metadata?: {
|
|
616
|
+
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
617
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
618
|
+
} | null)[] | {
|
|
619
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
620
|
+
} | null)[] | {
|
|
621
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
622
|
+
} | null)[] | {
|
|
623
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
624
|
+
} | null)[] | {
|
|
625
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
626
|
+
} | null)[] | {
|
|
627
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
628
|
+
} | null)[] | {
|
|
629
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
630
|
+
} | null)[] | {
|
|
631
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
632
|
+
} | null)[] | {
|
|
633
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
634
|
+
} | null)[] | {
|
|
635
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
636
|
+
} | null)[] | {
|
|
637
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
638
|
+
} | null)[] | {
|
|
639
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
640
|
+
} | null | undefined;
|
|
641
|
+
} | null | undefined;
|
|
642
|
+
} | {
|
|
643
|
+
readonly channel: "whatsapp";
|
|
644
|
+
readonly whatsapp: {
|
|
645
|
+
readonly template: string;
|
|
646
|
+
readonly templateData?: {
|
|
647
|
+
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
648
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
649
|
+
} | null)[] | {
|
|
650
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
651
|
+
} | null)[] | {
|
|
652
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
653
|
+
} | null)[] | {
|
|
654
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
655
|
+
} | null)[] | {
|
|
656
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
657
|
+
} | null)[] | {
|
|
658
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
659
|
+
} | null)[] | {
|
|
660
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
661
|
+
} | null)[] | {
|
|
662
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
663
|
+
} | null)[] | {
|
|
664
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
665
|
+
} | null)[] | {
|
|
666
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
667
|
+
} | null)[] | {
|
|
668
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
669
|
+
} | null)[] | {
|
|
670
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
671
|
+
} | null | undefined;
|
|
672
|
+
} | undefined;
|
|
673
|
+
readonly bindings?: {
|
|
674
|
+
readonly [x: string]: {
|
|
675
|
+
readonly contact: "company" | "displayName" | "email" | "externalId" | "firstName" | "id" | "jobTitle" | "lastName" | "name" | "phone";
|
|
676
|
+
} | {
|
|
677
|
+
readonly customField: string;
|
|
678
|
+
} | undefined;
|
|
679
|
+
} | undefined;
|
|
680
|
+
readonly businessAccountId?: string | undefined;
|
|
681
|
+
};
|
|
682
|
+
readonly conversationId?: string | null | undefined;
|
|
683
|
+
readonly metadata?: {
|
|
684
|
+
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
685
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
686
|
+
} | null)[] | {
|
|
687
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
688
|
+
} | null)[] | {
|
|
689
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
690
|
+
} | null)[] | {
|
|
691
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
692
|
+
} | null)[] | {
|
|
693
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
694
|
+
} | null)[] | {
|
|
695
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
696
|
+
} | null)[] | {
|
|
697
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
698
|
+
} | null)[] | {
|
|
699
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
700
|
+
} | null)[] | {
|
|
701
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
702
|
+
} | null)[] | {
|
|
703
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
704
|
+
} | null)[] | {
|
|
705
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
706
|
+
} | null)[] | {
|
|
707
|
+
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
708
|
+
} | null | undefined;
|
|
709
|
+
} | null | undefined;
|
|
710
|
+
};
|
|
711
|
+
readonly audience: {
|
|
712
|
+
readonly topicId: string;
|
|
713
|
+
readonly includeTags?: readonly string[] | null | undefined;
|
|
714
|
+
readonly excludeTags?: readonly string[] | null | undefined;
|
|
715
|
+
readonly contactIds?: readonly string[] | null | undefined;
|
|
716
|
+
readonly groupIds?: readonly string[] | null | undefined;
|
|
717
|
+
};
|
|
718
|
+
readonly policy?: {
|
|
719
|
+
readonly pageSize?: number | null | undefined;
|
|
720
|
+
} | null | undefined;
|
|
721
|
+
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"campaignsCreate">;
|
|
479
722
|
export declare const list: ((input?: {
|
|
480
723
|
readonly status?: "archived" | "draft" | undefined;
|
|
481
724
|
readonly limit?: number | null | undefined;
|
|
@@ -737,255 +980,9 @@ export declare const list: ((input?: {
|
|
|
737
980
|
readonly series: readonly number[];
|
|
738
981
|
}, import("./errors").ForbiddenError | import("./errors").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors").InternalError | import("./errors").MalformedRequestError | import("effect/Schema").SchemaError | import("./errors").UnauthorizedError | import("./errors").ValidationError, import("./client").Service>;
|
|
739
982
|
};
|
|
740
|
-
export declare const create: (input: {
|
|
741
|
-
readonly name: string;
|
|
742
|
-
readonly channel: "email" | "sms" | "whatsapp";
|
|
743
|
-
readonly content: {
|
|
744
|
-
readonly channel: "sms";
|
|
745
|
-
readonly sms: {
|
|
746
|
-
readonly text?: string | null | undefined;
|
|
747
|
-
readonly templateId?: string | null | undefined;
|
|
748
|
-
readonly templateSlug?: string | null | undefined;
|
|
749
|
-
readonly templateData?: {
|
|
750
|
-
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | /*elided*/ any | {
|
|
751
|
-
readonly [x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any | null | undefined;
|
|
752
|
-
} | null)[] | {
|
|
753
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
754
|
-
} | null)[] | {
|
|
755
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
756
|
-
} | null)[] | {
|
|
757
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
758
|
-
} | null)[] | {
|
|
759
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
760
|
-
} | null)[] | {
|
|
761
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
762
|
-
} | null)[] | {
|
|
763
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
764
|
-
} | null)[] | {
|
|
765
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
766
|
-
} | null)[] | {
|
|
767
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
768
|
-
} | null)[] | {
|
|
769
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
770
|
-
} | null)[] | {
|
|
771
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
772
|
-
} | null)[] | {
|
|
773
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
774
|
-
} | null | undefined;
|
|
775
|
-
} | null | undefined;
|
|
776
|
-
};
|
|
777
|
-
readonly conversationId?: string | null | undefined;
|
|
778
|
-
readonly metadata?: {
|
|
779
|
-
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
780
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
781
|
-
} | null)[] | {
|
|
782
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
783
|
-
} | null)[] | {
|
|
784
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
785
|
-
} | null)[] | {
|
|
786
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
787
|
-
} | null)[] | {
|
|
788
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
789
|
-
} | null)[] | {
|
|
790
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
791
|
-
} | null)[] | {
|
|
792
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
793
|
-
} | null)[] | {
|
|
794
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
795
|
-
} | null)[] | {
|
|
796
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
797
|
-
} | null)[] | {
|
|
798
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
799
|
-
} | null)[] | {
|
|
800
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
801
|
-
} | null)[] | {
|
|
802
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
803
|
-
} | null | undefined;
|
|
804
|
-
} | null | undefined;
|
|
805
|
-
} | {
|
|
806
|
-
readonly channel: "email";
|
|
807
|
-
readonly email: {
|
|
808
|
-
readonly subject?: string | null | undefined;
|
|
809
|
-
readonly html?: string | null | undefined;
|
|
810
|
-
readonly text?: string | null | undefined;
|
|
811
|
-
readonly attachments?: readonly {
|
|
812
|
-
readonly filename: string;
|
|
813
|
-
readonly content?: string | null | undefined;
|
|
814
|
-
readonly mediaId?: string | null | undefined;
|
|
815
|
-
readonly contentType: string;
|
|
816
|
-
readonly size: number;
|
|
817
|
-
}[] | null | undefined;
|
|
818
|
-
readonly publicationId?: string | undefined;
|
|
819
|
-
readonly inputContractId?: string | undefined;
|
|
820
|
-
readonly templateId?: string | null | undefined;
|
|
821
|
-
readonly templateSlug?: string | null | undefined;
|
|
822
|
-
readonly templateData?: {
|
|
823
|
-
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
824
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
825
|
-
} | null)[] | {
|
|
826
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
827
|
-
} | null)[] | {
|
|
828
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
829
|
-
} | null)[] | {
|
|
830
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
831
|
-
} | null)[] | {
|
|
832
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
833
|
-
} | null)[] | {
|
|
834
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
835
|
-
} | null)[] | {
|
|
836
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
837
|
-
} | null)[] | {
|
|
838
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
839
|
-
} | null)[] | {
|
|
840
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
841
|
-
} | null)[] | {
|
|
842
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
843
|
-
} | null)[] | {
|
|
844
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
845
|
-
} | null)[] | {
|
|
846
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
847
|
-
} | null | undefined;
|
|
848
|
-
} | null | undefined;
|
|
849
|
-
readonly locale?: string | undefined;
|
|
850
|
-
readonly timeZone?: string | undefined;
|
|
851
|
-
readonly inReplyToMessageId?: string | null | undefined;
|
|
852
|
-
readonly replyTo?: readonly string[] | null | undefined;
|
|
853
|
-
readonly topicId?: string | null | undefined;
|
|
854
|
-
readonly tracking?: {
|
|
855
|
-
readonly opens?: boolean | undefined;
|
|
856
|
-
readonly clicks?: boolean | undefined;
|
|
857
|
-
} | undefined;
|
|
858
|
-
readonly footer?: {
|
|
859
|
-
readonly enabled?: boolean | null | undefined;
|
|
860
|
-
} | undefined;
|
|
861
|
-
readonly headers?: {
|
|
862
|
-
readonly [x: string]: string | undefined;
|
|
863
|
-
} | null | undefined;
|
|
864
|
-
readonly preheader?: string | null | undefined;
|
|
865
|
-
};
|
|
866
|
-
readonly issue?: {
|
|
867
|
-
readonly path: string;
|
|
868
|
-
readonly commit: string;
|
|
869
|
-
} | null | undefined;
|
|
870
|
-
readonly from?: {
|
|
871
|
-
readonly email: string;
|
|
872
|
-
readonly name?: string | null | undefined;
|
|
873
|
-
} | null | undefined;
|
|
874
|
-
readonly replyMailboxId?: string | null | undefined;
|
|
875
|
-
readonly conversationId?: string | null | undefined;
|
|
876
|
-
readonly metadata?: {
|
|
877
|
-
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
878
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
879
|
-
} | null)[] | {
|
|
880
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
881
|
-
} | null)[] | {
|
|
882
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
883
|
-
} | null)[] | {
|
|
884
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
885
|
-
} | null)[] | {
|
|
886
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
887
|
-
} | null)[] | {
|
|
888
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
889
|
-
} | null)[] | {
|
|
890
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
891
|
-
} | null)[] | {
|
|
892
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
893
|
-
} | null)[] | {
|
|
894
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
895
|
-
} | null)[] | {
|
|
896
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
897
|
-
} | null)[] | {
|
|
898
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
899
|
-
} | null)[] | {
|
|
900
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
901
|
-
} | null | undefined;
|
|
902
|
-
} | null | undefined;
|
|
903
|
-
} | {
|
|
904
|
-
readonly channel: "whatsapp";
|
|
905
|
-
readonly whatsapp: {
|
|
906
|
-
readonly template: string;
|
|
907
|
-
readonly templateData?: {
|
|
908
|
-
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
909
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
910
|
-
} | null)[] | {
|
|
911
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
912
|
-
} | null)[] | {
|
|
913
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
914
|
-
} | null)[] | {
|
|
915
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
916
|
-
} | null)[] | {
|
|
917
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
918
|
-
} | null)[] | {
|
|
919
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
920
|
-
} | null)[] | {
|
|
921
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
922
|
-
} | null)[] | {
|
|
923
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
924
|
-
} | null)[] | {
|
|
925
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
926
|
-
} | null)[] | {
|
|
927
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
928
|
-
} | null)[] | {
|
|
929
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
930
|
-
} | null)[] | {
|
|
931
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
932
|
-
} | null | undefined;
|
|
933
|
-
} | undefined;
|
|
934
|
-
readonly bindings?: {
|
|
935
|
-
readonly [x: string]: {
|
|
936
|
-
readonly contact: "company" | "displayName" | "email" | "externalId" | "firstName" | "id" | "jobTitle" | "lastName" | "name" | "phone";
|
|
937
|
-
} | {
|
|
938
|
-
readonly customField: string;
|
|
939
|
-
} | undefined;
|
|
940
|
-
} | undefined;
|
|
941
|
-
readonly businessAccountId?: string | undefined;
|
|
942
|
-
};
|
|
943
|
-
readonly conversationId?: string | null | undefined;
|
|
944
|
-
readonly metadata?: {
|
|
945
|
-
readonly [x: string]: string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | readonly (string | number | boolean | any | {
|
|
946
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
947
|
-
} | null)[] | {
|
|
948
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
949
|
-
} | null)[] | {
|
|
950
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
951
|
-
} | null)[] | {
|
|
952
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
953
|
-
} | null)[] | {
|
|
954
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
955
|
-
} | null)[] | {
|
|
956
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
957
|
-
} | null)[] | {
|
|
958
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
959
|
-
} | null)[] | {
|
|
960
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
961
|
-
} | null)[] | {
|
|
962
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
963
|
-
} | null)[] | {
|
|
964
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
965
|
-
} | null)[] | {
|
|
966
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
967
|
-
} | null)[] | {
|
|
968
|
-
readonly [x: string]: string | number | boolean | any | any | null | undefined;
|
|
969
|
-
} | null | undefined;
|
|
970
|
-
} | null | undefined;
|
|
971
|
-
};
|
|
972
|
-
readonly audience: {
|
|
973
|
-
readonly topicId: string;
|
|
974
|
-
readonly includeTags?: readonly string[] | null | undefined;
|
|
975
|
-
readonly excludeTags?: readonly string[] | null | undefined;
|
|
976
|
-
readonly contactIds?: readonly string[] | null | undefined;
|
|
977
|
-
readonly groupIds?: readonly string[] | null | undefined;
|
|
978
|
-
};
|
|
979
|
-
readonly policy?: {
|
|
980
|
-
readonly pageSize?: number | null | undefined;
|
|
981
|
-
} | null | undefined;
|
|
982
|
-
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"campaignsCreate">;
|
|
983
983
|
export declare const get: (input: {
|
|
984
984
|
readonly id: string;
|
|
985
985
|
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"campaignsGet">;
|
|
986
|
-
export declare const archive: (input: {
|
|
987
|
-
readonly id: string;
|
|
988
|
-
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"campaignsArchive">;
|
|
989
986
|
export declare const update: (input: {
|
|
990
987
|
readonly id: string;
|
|
991
988
|
readonly name?: string | null | undefined;
|
|
@@ -1229,6 +1226,13 @@ export declare const update: (input: {
|
|
|
1229
1226
|
readonly pageSize?: number | null | undefined;
|
|
1230
1227
|
} | null | undefined;
|
|
1231
1228
|
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"campaignsUpdate">;
|
|
1229
|
+
export declare const archive: (input: {
|
|
1230
|
+
readonly id: string;
|
|
1231
|
+
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"campaignsArchive">;
|
|
1232
|
+
export declare const scheduleRun: (input: {
|
|
1233
|
+
readonly id: string;
|
|
1234
|
+
readonly scheduledFor?: Date | null | undefined;
|
|
1235
|
+
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"campaignsScheduleRun">;
|
|
1232
1236
|
export declare const listRuns: ((input: {
|
|
1233
1237
|
readonly id: string;
|
|
1234
1238
|
readonly status?: "cancelled" | "completed" | "dispatching" | "failed" | "paused" | "resolving" | "scheduled" | undefined;
|
|
@@ -1499,10 +1503,6 @@ export declare const listRuns: ((input: {
|
|
|
1499
1503
|
readonly updatedAt: string;
|
|
1500
1504
|
}, import("./errors").ForbiddenError | import("./errors").GatewayTimeoutError | import("effect/http/HttpClientError").HttpClientError | import("./errors").InternalError | import("./errors").MalformedRequestError | import("./errors").ResourceNotFoundError | import("effect/Schema").SchemaError | import("./errors").UnauthorizedError | import("./errors").ValidationError, import("./client").Service>;
|
|
1501
1505
|
};
|
|
1502
|
-
export declare const scheduleRun: (input: {
|
|
1503
|
-
readonly id: string;
|
|
1504
|
-
readonly scheduledFor?: Date | null | undefined;
|
|
1505
|
-
}, options?: import("./internal/operation").OperationOptions) => import("./internal/operation").OperationResult<"campaignsScheduleRun">;
|
|
1506
1506
|
export declare const getRun: (input: {
|
|
1507
1507
|
readonly id: string;
|
|
1508
1508
|
readonly runId: string;
|
package/dist/effect/campaigns.js
CHANGED
|
@@ -22,13 +22,13 @@ var campaigns_exports = /* @__PURE__ */ __exportAll({
|
|
|
22
22
|
const make = /* @__PURE__ */ forGroup(CampaignsGroup);
|
|
23
23
|
const preview = /* @__PURE__ */ make("campaignsPreview");
|
|
24
24
|
const sendTest = /* @__PURE__ */ make("campaignsSendTest");
|
|
25
|
-
const list = /* @__PURE__ */ make("campaignsList");
|
|
26
25
|
const create = /* @__PURE__ */ make("campaignsCreate");
|
|
26
|
+
const list = /* @__PURE__ */ make("campaignsList");
|
|
27
27
|
const get = /* @__PURE__ */ make("campaignsGet");
|
|
28
|
-
const archive = /* @__PURE__ */ make("campaignsArchive");
|
|
29
28
|
const update = /* @__PURE__ */ make("campaignsUpdate");
|
|
30
|
-
const
|
|
29
|
+
const archive = /* @__PURE__ */ make("campaignsArchive");
|
|
31
30
|
const scheduleRun = /* @__PURE__ */ make("campaignsScheduleRun");
|
|
31
|
+
const listRuns = /* @__PURE__ */ make("campaignsListRuns");
|
|
32
32
|
const getRun = /* @__PURE__ */ make("campaignsGetRun");
|
|
33
33
|
const getRunReport = /* @__PURE__ */ make("campaignsGetRunReport");
|
|
34
34
|
const pauseRun = /* @__PURE__ */ make("campaignsPauseRun");
|
|
@@ -18,7 +18,8 @@
|
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
import { Effect } from "effect";
|
|
21
|
-
import type { BillingProviderError, ConflictError,
|
|
21
|
+
import type { BillingProviderError, ConflictError, ExternalServiceError, ForbiddenError, FromAddressRequiredError, GatewayTimeoutError, InternalError, MalformedRequestError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, UnauthorizedError, ValidationError, DeliveryUnavailableError } from "./errors";
|
|
22
|
+
import { SamvaErrorMetadata } from "./generated-metadata";
|
|
22
23
|
export type ErrorCategory = "auth" | "validation" | "notFound" | "conflict" | "throttling" | "billing" | "transient";
|
|
23
24
|
export declare const categoriesOf: (error: unknown) => ReadonlyArray<ErrorCategory>;
|
|
24
25
|
export declare const hasCategory: (error: unknown, category: ErrorCategory) => boolean;
|
|
@@ -31,8 +32,25 @@ type CategoryError = {
|
|
|
31
32
|
readonly billing: PaymentRequiredError;
|
|
32
33
|
readonly transient: InternalError | GatewayTimeoutError | ExternalServiceError | BillingProviderError | DeliveryUnavailableError;
|
|
33
34
|
};
|
|
34
|
-
type
|
|
35
|
-
type
|
|
35
|
+
type ErrorExports = typeof import("./errors");
|
|
36
|
+
type PublicError = {
|
|
37
|
+
[Key in keyof ErrorExports]: ErrorExports[Key] extends {
|
|
38
|
+
readonly prototype: infer Error;
|
|
39
|
+
} ? Error : never;
|
|
40
|
+
}[keyof ErrorExports];
|
|
41
|
+
type RuleCategory<Entry> = Entry extends {
|
|
42
|
+
readonly rules: {
|
|
43
|
+
readonly cases: infer Cases;
|
|
44
|
+
};
|
|
45
|
+
} ? Cases[keyof Cases] extends {
|
|
46
|
+
readonly categories: ReadonlyArray<infer Category>;
|
|
47
|
+
} ? Category : never : never;
|
|
48
|
+
type PerInstanceError<Category extends ErrorCategory> = {
|
|
49
|
+
[Tag in keyof typeof SamvaErrorMetadata]: Category extends RuleCategory<(typeof SamvaErrorMetadata)[Tag]> ? Extract<PublicError, {
|
|
50
|
+
readonly _tag: Tag;
|
|
51
|
+
}> : never;
|
|
52
|
+
}[keyof typeof SamvaErrorMetadata];
|
|
53
|
+
type CategoryHandlerError<Category extends ErrorCategory> = CategoryError[Category] | PerInstanceError<Category>;
|
|
36
54
|
export declare const isAuthError: (error: unknown) => error is CategoryHandlerError<"auth">;
|
|
37
55
|
export declare const isValidationError: (error: unknown) => error is CategoryHandlerError<"validation">;
|
|
38
56
|
export declare const isNotFoundError: (error: unknown) => error is ResourceNotFoundError;
|
|
@@ -45,9 +63,9 @@ export declare const isTransient: (error: unknown) => boolean;
|
|
|
45
63
|
export declare const isRetryable: (error: unknown) => boolean;
|
|
46
64
|
/**
|
|
47
65
|
* Catch every error in `category`. The handler receives the category's error
|
|
48
|
-
* union — including
|
|
66
|
+
* union — including reason- and retryability-based errors where their fields place them in the
|
|
49
67
|
* category — while only total-membership classes are narrowed out of the error
|
|
50
|
-
* channel (
|
|
68
|
+
* channel (per-instance errors stay: other instances pass through).
|
|
51
69
|
*/
|
|
52
70
|
export declare const catchCategory: <Category extends ErrorCategory, A2, E2, R2>(category: Category, handler: (error: CategoryHandlerError<Category>) => Effect.Effect<A2, E2, R2>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A | A2, Exclude<E, CategoryError[Category]> | E2, R | R2>;
|
|
53
71
|
export declare const catchAuthError: <A2, E2, R2>(handler: (error: CategoryHandlerError<"auth">) => Effect.Effect<A2, E2, R2>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A | A2, E2 | Exclude<E, ForbiddenError | UnauthorizedError>, R | R2>;
|
|
@@ -21,26 +21,17 @@ import * as Predicate$1 from "effect/Predicate";
|
|
|
21
21
|
* );
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const categoriesOf = (error) => {
|
|
34
|
-
if (!Predicate$1.isObject(error) || typeof error._tag !== "string") return [];
|
|
35
|
-
if (error._tag === "EmailChannelError") return emailChannelCategories(error.reason);
|
|
36
|
-
return SamvaErrorMetadata[error._tag]?.categories ?? [];
|
|
24
|
+
const metadata = SamvaErrorMetadata;
|
|
25
|
+
const outcomeOf = (error) => {
|
|
26
|
+
if (!Predicate$1.isObject(error) || typeof error._tag !== "string") return void 0;
|
|
27
|
+
const entry = metadata[error._tag];
|
|
28
|
+
if (entry?.rules === void 0) return entry;
|
|
29
|
+
const value = error[entry.rules.field];
|
|
30
|
+
return typeof value === "string" || typeof value === "boolean" ? entry.rules.cases[String(value)] ?? entry : entry;
|
|
37
31
|
};
|
|
32
|
+
const categoriesOf = (error) => outcomeOf(error)?.categories ?? [];
|
|
38
33
|
const hasCategory = (error, category) => categoriesOf(error).includes(category);
|
|
39
|
-
const isRetryableError = (error) =>
|
|
40
|
-
if (!Predicate$1.isObject(error) || typeof error._tag !== "string") return false;
|
|
41
|
-
if (error._tag === "EmailChannelError") return categoriesOf(error).includes("transient");
|
|
42
|
-
return SamvaErrorMetadata[error._tag]?.retryable ?? false;
|
|
43
|
-
};
|
|
34
|
+
const isRetryableError = (error) => outcomeOf(error)?.retryable ?? false;
|
|
44
35
|
const categoryGuard = (category) => (error) => hasCategory(error, category);
|
|
45
36
|
const isAuthError = categoryGuard("auth");
|
|
46
37
|
const isValidationError = categoryGuard("validation");
|
|
@@ -65,9 +56,9 @@ const isTransient = (error) => hasCategory(error, "transient") || isRequestTrans
|
|
|
65
56
|
const isRetryable = (error) => isRetryableError(error) || isRequestTransportError(error);
|
|
66
57
|
/**
|
|
67
58
|
* Catch every error in `category`. The handler receives the category's error
|
|
68
|
-
* union — including
|
|
59
|
+
* union — including reason- and retryability-based errors where their fields place them in the
|
|
69
60
|
* category — while only total-membership classes are narrowed out of the error
|
|
70
|
-
* channel (
|
|
61
|
+
* channel (per-instance errors stay: other instances pass through).
|
|
71
62
|
*/
|
|
72
63
|
const catchCategory = (category, handler) => (effect) => {
|
|
73
64
|
const inCategory = (error) => hasCategory(error, category);
|