zupost 0.5.1 → 0.6.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/index.d.mts +188 -1
- package/dist/index.d.ts +188 -1
- package/dist/index.js +98 -1
- package/dist/index.mjs +98 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -618,6 +618,183 @@ declare class Sequences {
|
|
|
618
618
|
trigger(id: string, options: TriggerRunOptions): Promise<SequenceRun>;
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
+
/**
|
|
622
|
+
* Verification status shared by a domain and its individual DNS records.
|
|
623
|
+
*/
|
|
624
|
+
type DomainVerificationStatus = 'NOT_STARTED' | 'PENDING' | 'SUCCESS' | 'FAILED' | 'TEMPORARY_FAILURE';
|
|
625
|
+
type DomainDnsRecordType = 'MX' | 'TXT' | 'CNAME';
|
|
626
|
+
/**
|
|
627
|
+
* A single DNS record you need to add at your DNS provider for the domain to
|
|
628
|
+
* verify (DKIM, SPF, the verification TXT record, optional DMARC, …).
|
|
629
|
+
*/
|
|
630
|
+
interface DomainDnsRecord {
|
|
631
|
+
type: DomainDnsRecordType;
|
|
632
|
+
/** Record name/host, e.g. `mail` or `@`. */
|
|
633
|
+
name: string;
|
|
634
|
+
/** Record value, e.g. the SPF or DKIM string. */
|
|
635
|
+
value: string;
|
|
636
|
+
/** Recommended TTL, e.g. `Auto`. */
|
|
637
|
+
ttl: string;
|
|
638
|
+
/** Priority for MX records. */
|
|
639
|
+
priority?: string | null;
|
|
640
|
+
/** Verification status of this specific record. */
|
|
641
|
+
status?: DomainVerificationStatus | null;
|
|
642
|
+
/** Whether adding this record is recommended (e.g. DMARC). */
|
|
643
|
+
recommended?: boolean;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* A sending domain with its DNS records and verification state.
|
|
647
|
+
*/
|
|
648
|
+
interface Domain {
|
|
649
|
+
id: string;
|
|
650
|
+
/** The domain name, e.g. `example.com`. */
|
|
651
|
+
name: string;
|
|
652
|
+
projectId: string;
|
|
653
|
+
/** Primary sending region, e.g. `eu-central-1`. */
|
|
654
|
+
mainRegion: string;
|
|
655
|
+
/** All regions the domain is provisioned in. */
|
|
656
|
+
regions: string[];
|
|
657
|
+
clickTracking: boolean;
|
|
658
|
+
openTracking: boolean;
|
|
659
|
+
dkimTokens: string[];
|
|
660
|
+
dkimStatus?: DomainVerificationStatus | null;
|
|
661
|
+
/** Overall verification status of the domain. */
|
|
662
|
+
status?: DomainVerificationStatus | null;
|
|
663
|
+
spfStatus?: DomainVerificationStatus | null;
|
|
664
|
+
createdAt: string;
|
|
665
|
+
updatedAt: string;
|
|
666
|
+
dmarcAdded: boolean;
|
|
667
|
+
verificationInProcess: boolean;
|
|
668
|
+
errorMessage?: string | null;
|
|
669
|
+
subdomain?: string | null;
|
|
670
|
+
verificationError?: string | null;
|
|
671
|
+
lastCheckedTime?: string | null;
|
|
672
|
+
scheduledForDeletion: boolean;
|
|
673
|
+
/** DNS records to add at your DNS provider to verify the domain. */
|
|
674
|
+
dnsRecords: DomainDnsRecord[];
|
|
675
|
+
}
|
|
676
|
+
interface CreateDomainOptions {
|
|
677
|
+
/** The domain name to register, e.g. `example.com`. */
|
|
678
|
+
name: string;
|
|
679
|
+
/**
|
|
680
|
+
* Sending region for the domain. Defaults to `eu-central-1`.
|
|
681
|
+
*/
|
|
682
|
+
region?: string;
|
|
683
|
+
}
|
|
684
|
+
interface DeleteDomainResponse {
|
|
685
|
+
success: boolean;
|
|
686
|
+
message: string;
|
|
687
|
+
}
|
|
688
|
+
interface VerifyDomainResponse {
|
|
689
|
+
message: string;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Domains API.
|
|
694
|
+
*
|
|
695
|
+
* A Domain is a sending domain you own (e.g. `example.com`). After creating it
|
|
696
|
+
* you add the returned `dnsRecords` (DKIM, SPF, verification TXT) at your DNS
|
|
697
|
+
* provider and then `verify` it. Only verified domains can send email and
|
|
698
|
+
* receive inbound mail.
|
|
699
|
+
*/
|
|
700
|
+
declare class Domains {
|
|
701
|
+
private readonly http;
|
|
702
|
+
constructor(http: HttpClient);
|
|
703
|
+
/**
|
|
704
|
+
* Register a new sending domain. The response contains the `dnsRecords` you
|
|
705
|
+
* need to add at your DNS provider before calling {@link verify}.
|
|
706
|
+
*
|
|
707
|
+
* @example
|
|
708
|
+
* ```typescript
|
|
709
|
+
* const domain = await zupost.domains.create({ name: 'example.com' });
|
|
710
|
+
* for (const record of domain.dnsRecords) {
|
|
711
|
+
* console.log(record.type, record.name, record.value);
|
|
712
|
+
* }
|
|
713
|
+
* ```
|
|
714
|
+
*/
|
|
715
|
+
create(options: CreateDomainOptions): Promise<Domain>;
|
|
716
|
+
/**
|
|
717
|
+
* Get a domain by ID, including its current verification status and DNS
|
|
718
|
+
* records.
|
|
719
|
+
*/
|
|
720
|
+
get(id: string): Promise<Domain>;
|
|
721
|
+
/**
|
|
722
|
+
* List all domains in the project.
|
|
723
|
+
*/
|
|
724
|
+
list(): Promise<Domain[]>;
|
|
725
|
+
/**
|
|
726
|
+
* Start the verification process for a domain. Add the DNS records returned
|
|
727
|
+
* by {@link create} or {@link get} first; Zupost then checks them and
|
|
728
|
+
* updates the domain's `status`.
|
|
729
|
+
*/
|
|
730
|
+
verify(id: string): Promise<VerifyDomainResponse>;
|
|
731
|
+
/**
|
|
732
|
+
* Schedule a domain for deletion.
|
|
733
|
+
*/
|
|
734
|
+
delete(id: string): Promise<DeleteDomainResponse>;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
interface CreateInboundChannelOptions {
|
|
738
|
+
/** Human-readable name for the channel (1-100 characters). */
|
|
739
|
+
name: string;
|
|
740
|
+
/** ID of a verified domain that should receive inbound email. */
|
|
741
|
+
domainId: string;
|
|
742
|
+
/**
|
|
743
|
+
* HTTPS URL parsed inbound emails are delivered to. Must resolve to a
|
|
744
|
+
* public address.
|
|
745
|
+
*/
|
|
746
|
+
webhookUrl: string;
|
|
747
|
+
/**
|
|
748
|
+
* Shared secret (32-512 characters) used to sign webhook deliveries so you
|
|
749
|
+
* can verify they originate from Zupost.
|
|
750
|
+
*/
|
|
751
|
+
webhookSecret: string;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* An inbound email channel: it routes mail received on a domain to your
|
|
755
|
+
* `webhookUrl`.
|
|
756
|
+
*/
|
|
757
|
+
interface InboundChannel {
|
|
758
|
+
id: string;
|
|
759
|
+
name: string;
|
|
760
|
+
projectId: string;
|
|
761
|
+
domainId: string;
|
|
762
|
+
webhookUrl: string;
|
|
763
|
+
createdAt: string;
|
|
764
|
+
updatedAt: string;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Inbound API.
|
|
769
|
+
*
|
|
770
|
+
* Receive email sent to a verified domain by routing it through an inbound
|
|
771
|
+
* channel to your own HTTPS webhook. Deliveries are signed with the
|
|
772
|
+
* `webhookSecret` you provide so you can verify their authenticity.
|
|
773
|
+
*/
|
|
774
|
+
declare class Inbound {
|
|
775
|
+
private readonly http;
|
|
776
|
+
constructor(http: HttpClient);
|
|
777
|
+
/**
|
|
778
|
+
* Inbound channels route mail received on a domain to a webhook.
|
|
779
|
+
*/
|
|
780
|
+
readonly channels: {
|
|
781
|
+
/**
|
|
782
|
+
* Create an inbound channel for a verified domain.
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* ```typescript
|
|
786
|
+
* const channel = await zupost.inbound.channels.create({
|
|
787
|
+
* name: 'Support inbox',
|
|
788
|
+
* domainId: 'dom_123',
|
|
789
|
+
* webhookUrl: 'https://example.com/zupost/inbound',
|
|
790
|
+
* webhookSecret: process.env.ZUPOST_INBOUND_SECRET!,
|
|
791
|
+
* });
|
|
792
|
+
* ```
|
|
793
|
+
*/
|
|
794
|
+
create: (options: CreateInboundChannelOptions) => Promise<InboundChannel>;
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
|
|
621
798
|
interface ZupostOptions {
|
|
622
799
|
/**
|
|
623
800
|
* Custom API URL. Defaults to 'https://api.zupost.com'.
|
|
@@ -644,6 +821,16 @@ declare class Zupost {
|
|
|
644
821
|
* transactional) with branches, waits, tags and webhooks.
|
|
645
822
|
*/
|
|
646
823
|
readonly sequences: Sequences;
|
|
824
|
+
/**
|
|
825
|
+
* Domains API. A Domain is a sending domain you own, with DNS records and
|
|
826
|
+
* verification state. Only verified domains can send and receive email.
|
|
827
|
+
*/
|
|
828
|
+
readonly domains: Domains;
|
|
829
|
+
/**
|
|
830
|
+
* Inbound API. Receive email on a verified domain and have it delivered to
|
|
831
|
+
* your own webhook through an inbound channel.
|
|
832
|
+
*/
|
|
833
|
+
readonly inbound: Inbound;
|
|
647
834
|
constructor(apiKey: string, options?: ZupostOptions);
|
|
648
835
|
}
|
|
649
836
|
|
|
@@ -713,4 +900,4 @@ declare function defineSequence<TSteps extends Record<string, SequenceStep>>(def
|
|
|
713
900
|
steps: TSteps;
|
|
714
901
|
}): SequenceDefinition;
|
|
715
902
|
|
|
716
|
-
export { type BranchCondition, type Contact, type ContactEvent, type ContactEventType, type ContactExport, type ContactTag, type CreateContactOptions, type CreateSequenceOptions, type EmailRecipientType, type ForgetContactResponse, type ListContactsOptions, type ListContactsResponse, type ListEventsOptions, type ListEventsResponse, type ListRunsOptions, type ListRunsResponse, type ListSequencesOptions, type ListSequencesResponse, type SaveVersionOptions, type SendCampaignOptions, type SendCampaignResponse, type SendEmailOptions, type SendEmailResponse, type Sequence, type SequenceDefinition, type SequenceRun, type SequenceRunStatus, type SequenceStatus, type SequenceStep, type SequenceTriggerType, type SequenceType, type SequenceVersion, type TriggerRunOptions, type UpdateContactOptions, type WaitDuration, Zupost, ZupostError, type ZupostOptions, defineSequence };
|
|
903
|
+
export { type BranchCondition, type Contact, type ContactEvent, type ContactEventType, type ContactExport, type ContactTag, type CreateContactOptions, type CreateDomainOptions, type CreateInboundChannelOptions, type CreateSequenceOptions, type DeleteDomainResponse, type Domain, type DomainDnsRecord, type DomainDnsRecordType, type DomainVerificationStatus, type EmailRecipientType, type ForgetContactResponse, type InboundChannel, type ListContactsOptions, type ListContactsResponse, type ListEventsOptions, type ListEventsResponse, type ListRunsOptions, type ListRunsResponse, type ListSequencesOptions, type ListSequencesResponse, type SaveVersionOptions, type SendCampaignOptions, type SendCampaignResponse, type SendEmailOptions, type SendEmailResponse, type Sequence, type SequenceDefinition, type SequenceRun, type SequenceRunStatus, type SequenceStatus, type SequenceStep, type SequenceTriggerType, type SequenceType, type SequenceVersion, type TriggerRunOptions, type UpdateContactOptions, type VerifyDomainResponse, type WaitDuration, Zupost, ZupostError, type ZupostOptions, defineSequence };
|
package/dist/index.d.ts
CHANGED
|
@@ -618,6 +618,183 @@ declare class Sequences {
|
|
|
618
618
|
trigger(id: string, options: TriggerRunOptions): Promise<SequenceRun>;
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
+
/**
|
|
622
|
+
* Verification status shared by a domain and its individual DNS records.
|
|
623
|
+
*/
|
|
624
|
+
type DomainVerificationStatus = 'NOT_STARTED' | 'PENDING' | 'SUCCESS' | 'FAILED' | 'TEMPORARY_FAILURE';
|
|
625
|
+
type DomainDnsRecordType = 'MX' | 'TXT' | 'CNAME';
|
|
626
|
+
/**
|
|
627
|
+
* A single DNS record you need to add at your DNS provider for the domain to
|
|
628
|
+
* verify (DKIM, SPF, the verification TXT record, optional DMARC, …).
|
|
629
|
+
*/
|
|
630
|
+
interface DomainDnsRecord {
|
|
631
|
+
type: DomainDnsRecordType;
|
|
632
|
+
/** Record name/host, e.g. `mail` or `@`. */
|
|
633
|
+
name: string;
|
|
634
|
+
/** Record value, e.g. the SPF or DKIM string. */
|
|
635
|
+
value: string;
|
|
636
|
+
/** Recommended TTL, e.g. `Auto`. */
|
|
637
|
+
ttl: string;
|
|
638
|
+
/** Priority for MX records. */
|
|
639
|
+
priority?: string | null;
|
|
640
|
+
/** Verification status of this specific record. */
|
|
641
|
+
status?: DomainVerificationStatus | null;
|
|
642
|
+
/** Whether adding this record is recommended (e.g. DMARC). */
|
|
643
|
+
recommended?: boolean;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* A sending domain with its DNS records and verification state.
|
|
647
|
+
*/
|
|
648
|
+
interface Domain {
|
|
649
|
+
id: string;
|
|
650
|
+
/** The domain name, e.g. `example.com`. */
|
|
651
|
+
name: string;
|
|
652
|
+
projectId: string;
|
|
653
|
+
/** Primary sending region, e.g. `eu-central-1`. */
|
|
654
|
+
mainRegion: string;
|
|
655
|
+
/** All regions the domain is provisioned in. */
|
|
656
|
+
regions: string[];
|
|
657
|
+
clickTracking: boolean;
|
|
658
|
+
openTracking: boolean;
|
|
659
|
+
dkimTokens: string[];
|
|
660
|
+
dkimStatus?: DomainVerificationStatus | null;
|
|
661
|
+
/** Overall verification status of the domain. */
|
|
662
|
+
status?: DomainVerificationStatus | null;
|
|
663
|
+
spfStatus?: DomainVerificationStatus | null;
|
|
664
|
+
createdAt: string;
|
|
665
|
+
updatedAt: string;
|
|
666
|
+
dmarcAdded: boolean;
|
|
667
|
+
verificationInProcess: boolean;
|
|
668
|
+
errorMessage?: string | null;
|
|
669
|
+
subdomain?: string | null;
|
|
670
|
+
verificationError?: string | null;
|
|
671
|
+
lastCheckedTime?: string | null;
|
|
672
|
+
scheduledForDeletion: boolean;
|
|
673
|
+
/** DNS records to add at your DNS provider to verify the domain. */
|
|
674
|
+
dnsRecords: DomainDnsRecord[];
|
|
675
|
+
}
|
|
676
|
+
interface CreateDomainOptions {
|
|
677
|
+
/** The domain name to register, e.g. `example.com`. */
|
|
678
|
+
name: string;
|
|
679
|
+
/**
|
|
680
|
+
* Sending region for the domain. Defaults to `eu-central-1`.
|
|
681
|
+
*/
|
|
682
|
+
region?: string;
|
|
683
|
+
}
|
|
684
|
+
interface DeleteDomainResponse {
|
|
685
|
+
success: boolean;
|
|
686
|
+
message: string;
|
|
687
|
+
}
|
|
688
|
+
interface VerifyDomainResponse {
|
|
689
|
+
message: string;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Domains API.
|
|
694
|
+
*
|
|
695
|
+
* A Domain is a sending domain you own (e.g. `example.com`). After creating it
|
|
696
|
+
* you add the returned `dnsRecords` (DKIM, SPF, verification TXT) at your DNS
|
|
697
|
+
* provider and then `verify` it. Only verified domains can send email and
|
|
698
|
+
* receive inbound mail.
|
|
699
|
+
*/
|
|
700
|
+
declare class Domains {
|
|
701
|
+
private readonly http;
|
|
702
|
+
constructor(http: HttpClient);
|
|
703
|
+
/**
|
|
704
|
+
* Register a new sending domain. The response contains the `dnsRecords` you
|
|
705
|
+
* need to add at your DNS provider before calling {@link verify}.
|
|
706
|
+
*
|
|
707
|
+
* @example
|
|
708
|
+
* ```typescript
|
|
709
|
+
* const domain = await zupost.domains.create({ name: 'example.com' });
|
|
710
|
+
* for (const record of domain.dnsRecords) {
|
|
711
|
+
* console.log(record.type, record.name, record.value);
|
|
712
|
+
* }
|
|
713
|
+
* ```
|
|
714
|
+
*/
|
|
715
|
+
create(options: CreateDomainOptions): Promise<Domain>;
|
|
716
|
+
/**
|
|
717
|
+
* Get a domain by ID, including its current verification status and DNS
|
|
718
|
+
* records.
|
|
719
|
+
*/
|
|
720
|
+
get(id: string): Promise<Domain>;
|
|
721
|
+
/**
|
|
722
|
+
* List all domains in the project.
|
|
723
|
+
*/
|
|
724
|
+
list(): Promise<Domain[]>;
|
|
725
|
+
/**
|
|
726
|
+
* Start the verification process for a domain. Add the DNS records returned
|
|
727
|
+
* by {@link create} or {@link get} first; Zupost then checks them and
|
|
728
|
+
* updates the domain's `status`.
|
|
729
|
+
*/
|
|
730
|
+
verify(id: string): Promise<VerifyDomainResponse>;
|
|
731
|
+
/**
|
|
732
|
+
* Schedule a domain for deletion.
|
|
733
|
+
*/
|
|
734
|
+
delete(id: string): Promise<DeleteDomainResponse>;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
interface CreateInboundChannelOptions {
|
|
738
|
+
/** Human-readable name for the channel (1-100 characters). */
|
|
739
|
+
name: string;
|
|
740
|
+
/** ID of a verified domain that should receive inbound email. */
|
|
741
|
+
domainId: string;
|
|
742
|
+
/**
|
|
743
|
+
* HTTPS URL parsed inbound emails are delivered to. Must resolve to a
|
|
744
|
+
* public address.
|
|
745
|
+
*/
|
|
746
|
+
webhookUrl: string;
|
|
747
|
+
/**
|
|
748
|
+
* Shared secret (32-512 characters) used to sign webhook deliveries so you
|
|
749
|
+
* can verify they originate from Zupost.
|
|
750
|
+
*/
|
|
751
|
+
webhookSecret: string;
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* An inbound email channel: it routes mail received on a domain to your
|
|
755
|
+
* `webhookUrl`.
|
|
756
|
+
*/
|
|
757
|
+
interface InboundChannel {
|
|
758
|
+
id: string;
|
|
759
|
+
name: string;
|
|
760
|
+
projectId: string;
|
|
761
|
+
domainId: string;
|
|
762
|
+
webhookUrl: string;
|
|
763
|
+
createdAt: string;
|
|
764
|
+
updatedAt: string;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Inbound API.
|
|
769
|
+
*
|
|
770
|
+
* Receive email sent to a verified domain by routing it through an inbound
|
|
771
|
+
* channel to your own HTTPS webhook. Deliveries are signed with the
|
|
772
|
+
* `webhookSecret` you provide so you can verify their authenticity.
|
|
773
|
+
*/
|
|
774
|
+
declare class Inbound {
|
|
775
|
+
private readonly http;
|
|
776
|
+
constructor(http: HttpClient);
|
|
777
|
+
/**
|
|
778
|
+
* Inbound channels route mail received on a domain to a webhook.
|
|
779
|
+
*/
|
|
780
|
+
readonly channels: {
|
|
781
|
+
/**
|
|
782
|
+
* Create an inbound channel for a verified domain.
|
|
783
|
+
*
|
|
784
|
+
* @example
|
|
785
|
+
* ```typescript
|
|
786
|
+
* const channel = await zupost.inbound.channels.create({
|
|
787
|
+
* name: 'Support inbox',
|
|
788
|
+
* domainId: 'dom_123',
|
|
789
|
+
* webhookUrl: 'https://example.com/zupost/inbound',
|
|
790
|
+
* webhookSecret: process.env.ZUPOST_INBOUND_SECRET!,
|
|
791
|
+
* });
|
|
792
|
+
* ```
|
|
793
|
+
*/
|
|
794
|
+
create: (options: CreateInboundChannelOptions) => Promise<InboundChannel>;
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
|
|
621
798
|
interface ZupostOptions {
|
|
622
799
|
/**
|
|
623
800
|
* Custom API URL. Defaults to 'https://api.zupost.com'.
|
|
@@ -644,6 +821,16 @@ declare class Zupost {
|
|
|
644
821
|
* transactional) with branches, waits, tags and webhooks.
|
|
645
822
|
*/
|
|
646
823
|
readonly sequences: Sequences;
|
|
824
|
+
/**
|
|
825
|
+
* Domains API. A Domain is a sending domain you own, with DNS records and
|
|
826
|
+
* verification state. Only verified domains can send and receive email.
|
|
827
|
+
*/
|
|
828
|
+
readonly domains: Domains;
|
|
829
|
+
/**
|
|
830
|
+
* Inbound API. Receive email on a verified domain and have it delivered to
|
|
831
|
+
* your own webhook through an inbound channel.
|
|
832
|
+
*/
|
|
833
|
+
readonly inbound: Inbound;
|
|
647
834
|
constructor(apiKey: string, options?: ZupostOptions);
|
|
648
835
|
}
|
|
649
836
|
|
|
@@ -713,4 +900,4 @@ declare function defineSequence<TSteps extends Record<string, SequenceStep>>(def
|
|
|
713
900
|
steps: TSteps;
|
|
714
901
|
}): SequenceDefinition;
|
|
715
902
|
|
|
716
|
-
export { type BranchCondition, type Contact, type ContactEvent, type ContactEventType, type ContactExport, type ContactTag, type CreateContactOptions, type CreateSequenceOptions, type EmailRecipientType, type ForgetContactResponse, type ListContactsOptions, type ListContactsResponse, type ListEventsOptions, type ListEventsResponse, type ListRunsOptions, type ListRunsResponse, type ListSequencesOptions, type ListSequencesResponse, type SaveVersionOptions, type SendCampaignOptions, type SendCampaignResponse, type SendEmailOptions, type SendEmailResponse, type Sequence, type SequenceDefinition, type SequenceRun, type SequenceRunStatus, type SequenceStatus, type SequenceStep, type SequenceTriggerType, type SequenceType, type SequenceVersion, type TriggerRunOptions, type UpdateContactOptions, type WaitDuration, Zupost, ZupostError, type ZupostOptions, defineSequence };
|
|
903
|
+
export { type BranchCondition, type Contact, type ContactEvent, type ContactEventType, type ContactExport, type ContactTag, type CreateContactOptions, type CreateDomainOptions, type CreateInboundChannelOptions, type CreateSequenceOptions, type DeleteDomainResponse, type Domain, type DomainDnsRecord, type DomainDnsRecordType, type DomainVerificationStatus, type EmailRecipientType, type ForgetContactResponse, type InboundChannel, type ListContactsOptions, type ListContactsResponse, type ListEventsOptions, type ListEventsResponse, type ListRunsOptions, type ListRunsResponse, type ListSequencesOptions, type ListSequencesResponse, type SaveVersionOptions, type SendCampaignOptions, type SendCampaignResponse, type SendEmailOptions, type SendEmailResponse, type Sequence, type SequenceDefinition, type SequenceRun, type SequenceRunStatus, type SequenceStatus, type SequenceStep, type SequenceTriggerType, type SequenceType, type SequenceVersion, type TriggerRunOptions, type UpdateContactOptions, type VerifyDomainResponse, type WaitDuration, Zupost, ZupostError, type ZupostOptions, defineSequence };
|
package/dist/index.js
CHANGED
|
@@ -79,7 +79,7 @@ __export(index_exports, {
|
|
|
79
79
|
module.exports = __toCommonJS(index_exports);
|
|
80
80
|
|
|
81
81
|
// package.json
|
|
82
|
-
var version = "0.
|
|
82
|
+
var version = "0.6.0";
|
|
83
83
|
|
|
84
84
|
// src/errors.ts
|
|
85
85
|
var ZupostError = class _ZupostError extends Error {
|
|
@@ -536,6 +536,101 @@ var Sequences = class {
|
|
|
536
536
|
}
|
|
537
537
|
};
|
|
538
538
|
|
|
539
|
+
// src/domain/domains.ts
|
|
540
|
+
var DEFAULT_REGION = "eu-central-1";
|
|
541
|
+
var Domains = class {
|
|
542
|
+
constructor(http) {
|
|
543
|
+
this.http = http;
|
|
544
|
+
}
|
|
545
|
+
/**
|
|
546
|
+
* Register a new sending domain. The response contains the `dnsRecords` you
|
|
547
|
+
* need to add at your DNS provider before calling {@link verify}.
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* ```typescript
|
|
551
|
+
* const domain = await zupost.domains.create({ name: 'example.com' });
|
|
552
|
+
* for (const record of domain.dnsRecords) {
|
|
553
|
+
* console.log(record.type, record.name, record.value);
|
|
554
|
+
* }
|
|
555
|
+
* ```
|
|
556
|
+
*/
|
|
557
|
+
create(options) {
|
|
558
|
+
return __async(this, null, function* () {
|
|
559
|
+
var _a;
|
|
560
|
+
return this.http.post("/domain", {
|
|
561
|
+
name: options.name,
|
|
562
|
+
region: (_a = options.region) != null ? _a : DEFAULT_REGION
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Get a domain by ID, including its current verification status and DNS
|
|
568
|
+
* records.
|
|
569
|
+
*/
|
|
570
|
+
get(id) {
|
|
571
|
+
return __async(this, null, function* () {
|
|
572
|
+
return this.http.get(`/domain/${encodeURIComponent(id)}`);
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* List all domains in the project.
|
|
577
|
+
*/
|
|
578
|
+
list() {
|
|
579
|
+
return __async(this, null, function* () {
|
|
580
|
+
return this.http.get("/domain");
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Start the verification process for a domain. Add the DNS records returned
|
|
585
|
+
* by {@link create} or {@link get} first; Zupost then checks them and
|
|
586
|
+
* updates the domain's `status`.
|
|
587
|
+
*/
|
|
588
|
+
verify(id) {
|
|
589
|
+
return __async(this, null, function* () {
|
|
590
|
+
return this.http.post(
|
|
591
|
+
`/domain/${encodeURIComponent(id)}/verify`,
|
|
592
|
+
void 0
|
|
593
|
+
);
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Schedule a domain for deletion.
|
|
598
|
+
*/
|
|
599
|
+
delete(id) {
|
|
600
|
+
return __async(this, null, function* () {
|
|
601
|
+
return this.http.delete(`/domain/${encodeURIComponent(id)}`);
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
// src/inbound/inbound.ts
|
|
607
|
+
var Inbound = class {
|
|
608
|
+
constructor(http) {
|
|
609
|
+
this.http = http;
|
|
610
|
+
/**
|
|
611
|
+
* Inbound channels route mail received on a domain to a webhook.
|
|
612
|
+
*/
|
|
613
|
+
this.channels = {
|
|
614
|
+
/**
|
|
615
|
+
* Create an inbound channel for a verified domain.
|
|
616
|
+
*
|
|
617
|
+
* @example
|
|
618
|
+
* ```typescript
|
|
619
|
+
* const channel = await zupost.inbound.channels.create({
|
|
620
|
+
* name: 'Support inbox',
|
|
621
|
+
* domainId: 'dom_123',
|
|
622
|
+
* webhookUrl: 'https://example.com/zupost/inbound',
|
|
623
|
+
* webhookSecret: process.env.ZUPOST_INBOUND_SECRET!,
|
|
624
|
+
* });
|
|
625
|
+
* ```
|
|
626
|
+
*/
|
|
627
|
+
create: (options) => __async(this, null, function* () {
|
|
628
|
+
return this.http.post("/inbound-channel", options);
|
|
629
|
+
})
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
|
|
539
634
|
// src/zupost.ts
|
|
540
635
|
var _client;
|
|
541
636
|
var Zupost = class {
|
|
@@ -551,6 +646,8 @@ var Zupost = class {
|
|
|
551
646
|
this.campaigns = new Campaigns(__privateGet(this, _client));
|
|
552
647
|
this.contacts = new Contacts(__privateGet(this, _client));
|
|
553
648
|
this.sequences = new Sequences(__privateGet(this, _client));
|
|
649
|
+
this.domains = new Domains(__privateGet(this, _client));
|
|
650
|
+
this.inbound = new Inbound(__privateGet(this, _client));
|
|
554
651
|
}
|
|
555
652
|
};
|
|
556
653
|
_client = new WeakMap();
|
package/dist/index.mjs
CHANGED
|
@@ -44,7 +44,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
// package.json
|
|
47
|
-
var version = "0.
|
|
47
|
+
var version = "0.6.0";
|
|
48
48
|
|
|
49
49
|
// src/errors.ts
|
|
50
50
|
var ZupostError = class _ZupostError extends Error {
|
|
@@ -501,6 +501,101 @@ var Sequences = class {
|
|
|
501
501
|
}
|
|
502
502
|
};
|
|
503
503
|
|
|
504
|
+
// src/domain/domains.ts
|
|
505
|
+
var DEFAULT_REGION = "eu-central-1";
|
|
506
|
+
var Domains = class {
|
|
507
|
+
constructor(http) {
|
|
508
|
+
this.http = http;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Register a new sending domain. The response contains the `dnsRecords` you
|
|
512
|
+
* need to add at your DNS provider before calling {@link verify}.
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
* ```typescript
|
|
516
|
+
* const domain = await zupost.domains.create({ name: 'example.com' });
|
|
517
|
+
* for (const record of domain.dnsRecords) {
|
|
518
|
+
* console.log(record.type, record.name, record.value);
|
|
519
|
+
* }
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
|
+
create(options) {
|
|
523
|
+
return __async(this, null, function* () {
|
|
524
|
+
var _a;
|
|
525
|
+
return this.http.post("/domain", {
|
|
526
|
+
name: options.name,
|
|
527
|
+
region: (_a = options.region) != null ? _a : DEFAULT_REGION
|
|
528
|
+
});
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* Get a domain by ID, including its current verification status and DNS
|
|
533
|
+
* records.
|
|
534
|
+
*/
|
|
535
|
+
get(id) {
|
|
536
|
+
return __async(this, null, function* () {
|
|
537
|
+
return this.http.get(`/domain/${encodeURIComponent(id)}`);
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* List all domains in the project.
|
|
542
|
+
*/
|
|
543
|
+
list() {
|
|
544
|
+
return __async(this, null, function* () {
|
|
545
|
+
return this.http.get("/domain");
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Start the verification process for a domain. Add the DNS records returned
|
|
550
|
+
* by {@link create} or {@link get} first; Zupost then checks them and
|
|
551
|
+
* updates the domain's `status`.
|
|
552
|
+
*/
|
|
553
|
+
verify(id) {
|
|
554
|
+
return __async(this, null, function* () {
|
|
555
|
+
return this.http.post(
|
|
556
|
+
`/domain/${encodeURIComponent(id)}/verify`,
|
|
557
|
+
void 0
|
|
558
|
+
);
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Schedule a domain for deletion.
|
|
563
|
+
*/
|
|
564
|
+
delete(id) {
|
|
565
|
+
return __async(this, null, function* () {
|
|
566
|
+
return this.http.delete(`/domain/${encodeURIComponent(id)}`);
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
// src/inbound/inbound.ts
|
|
572
|
+
var Inbound = class {
|
|
573
|
+
constructor(http) {
|
|
574
|
+
this.http = http;
|
|
575
|
+
/**
|
|
576
|
+
* Inbound channels route mail received on a domain to a webhook.
|
|
577
|
+
*/
|
|
578
|
+
this.channels = {
|
|
579
|
+
/**
|
|
580
|
+
* Create an inbound channel for a verified domain.
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* ```typescript
|
|
584
|
+
* const channel = await zupost.inbound.channels.create({
|
|
585
|
+
* name: 'Support inbox',
|
|
586
|
+
* domainId: 'dom_123',
|
|
587
|
+
* webhookUrl: 'https://example.com/zupost/inbound',
|
|
588
|
+
* webhookSecret: process.env.ZUPOST_INBOUND_SECRET!,
|
|
589
|
+
* });
|
|
590
|
+
* ```
|
|
591
|
+
*/
|
|
592
|
+
create: (options) => __async(this, null, function* () {
|
|
593
|
+
return this.http.post("/inbound-channel", options);
|
|
594
|
+
})
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
|
+
|
|
504
599
|
// src/zupost.ts
|
|
505
600
|
var _client;
|
|
506
601
|
var Zupost = class {
|
|
@@ -516,6 +611,8 @@ var Zupost = class {
|
|
|
516
611
|
this.campaigns = new Campaigns(__privateGet(this, _client));
|
|
517
612
|
this.contacts = new Contacts(__privateGet(this, _client));
|
|
518
613
|
this.sequences = new Sequences(__privateGet(this, _client));
|
|
614
|
+
this.domains = new Domains(__privateGet(this, _client));
|
|
615
|
+
this.inbound = new Inbound(__privateGet(this, _client));
|
|
519
616
|
}
|
|
520
617
|
};
|
|
521
618
|
_client = new WeakMap();
|