@vibiz/cli 0.1.0 → 0.2.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/{chunk-NWL4LVVI.js → chunk-GSHNECVT.js} +445 -20
- package/dist/src-2CVAECWM.js +3392 -0
- package/dist/vibiz.js +2229 -160
- package/package.json +1 -1
- package/dist/src-BOTTM5XC.js +0 -2230
|
@@ -108,6 +108,13 @@ var Vibiz = class {
|
|
|
108
108
|
env: (id) => this.request(`/projects/${id}/env`).then((r) => r.env),
|
|
109
109
|
/** The production env's variable names, without values. Any key. */
|
|
110
110
|
envNames: (id) => this.request(`/projects/${id}/env?names=1`).then((r) => r.names),
|
|
111
|
+
/**
|
|
112
|
+
* The names plus the console links where an owner copies the values
|
|
113
|
+
* (`console_url`) or just the production app key (`app_key_console_url`).
|
|
114
|
+
*/
|
|
115
|
+
envLinks: (id) => this.request(
|
|
116
|
+
`/projects/${id}/env?names=1`
|
|
117
|
+
),
|
|
111
118
|
/**
|
|
112
119
|
* The development environment: its own database branch (schema, no
|
|
113
120
|
* production rows), its own sign-in and AI key. What agents and laptops use.
|
|
@@ -278,11 +285,17 @@ var Vibiz = class {
|
|
|
278
285
|
accounts: (id, opts = {}) => this.request(
|
|
279
286
|
`/projects/${id}/social/accounts${qs({ env: opts.env, kind: opts.kind, platform: opts.platform })}`
|
|
280
287
|
),
|
|
281
|
-
/**
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
})
|
|
288
|
+
/**
|
|
289
|
+
* Production (the default): a link (1 h) for the owner to open, approve and
|
|
290
|
+
* sign in to the platform. Development: the test account, made at once.
|
|
291
|
+
*/
|
|
292
|
+
connect: (id, platform, opts = {}) => this.request(
|
|
293
|
+
`/projects/${id}/social/connect${envQuery(opts.env)}`,
|
|
294
|
+
{
|
|
295
|
+
method: "POST",
|
|
296
|
+
body: { platform, ...opts.ads ? { ads: true } : {} }
|
|
297
|
+
}
|
|
298
|
+
),
|
|
286
299
|
refreshAccounts: (id, env) => this.request(
|
|
287
300
|
`/projects/${id}/social/accounts/refresh${envQuery(env)}`,
|
|
288
301
|
{ method: "POST", body: {} }
|
|
@@ -434,7 +447,22 @@ var Vibiz = class {
|
|
|
434
447
|
simulate: (id, input) => this.request(
|
|
435
448
|
`/projects/${id}/payments/simulate?env=development`,
|
|
436
449
|
{ method: "POST", body: input }
|
|
437
|
-
)
|
|
450
|
+
),
|
|
451
|
+
/**
|
|
452
|
+
* The owner's own Stripe account instead of payments through Vibiz
|
|
453
|
+
* (docs/PAYMENTS.md "Your own account"). `link` makes a link for the
|
|
454
|
+
* owner (any key; production unless `env` says): give them `url`, only
|
|
455
|
+
* they can complete it. `disconnect` (owner only) goes back to Vibiz.
|
|
456
|
+
*/
|
|
457
|
+
ownAccount: {
|
|
458
|
+
link: (id, env = "production") => this.request(`/projects/${id}/payments/own-account/link?env=${env}`, {
|
|
459
|
+
method: "POST",
|
|
460
|
+
body: {}
|
|
461
|
+
}),
|
|
462
|
+
disconnect: (id, env) => this.request(`/projects/${id}/payments/own-account${envQuery(env)}`, {
|
|
463
|
+
method: "DELETE"
|
|
464
|
+
})
|
|
465
|
+
}
|
|
438
466
|
},
|
|
439
467
|
/**
|
|
440
468
|
* Custom connectors (docs/CONNECTORS.md): any HTTP API from one manifest,
|
|
@@ -497,17 +525,32 @@ var Vibiz = class {
|
|
|
497
525
|
{ method: "POST", body: {} }
|
|
498
526
|
)
|
|
499
527
|
},
|
|
500
|
-
/**
|
|
528
|
+
/**
|
|
529
|
+
* The owner's own domains: served by Vibiz hosting (with HTTPS once DNS
|
|
530
|
+
* points at it) or trusted for a host elsewhere. Adding and removing need
|
|
531
|
+
* an owner key; any key reads status and asks for a re-check.
|
|
532
|
+
*/
|
|
501
533
|
domains: {
|
|
502
|
-
list: (id) => this.request(`/projects/${id}/domains`)
|
|
503
|
-
|
|
534
|
+
list: (id) => this.request(`/projects/${id}/domains`),
|
|
535
|
+
/** `hosting` defaults to `vibiz` when the project has Vibiz hosting, else `elsewhere`. */
|
|
536
|
+
add: (id, domain, opts = {}) => this.request(`/projects/${id}/domains`, {
|
|
504
537
|
method: "POST",
|
|
505
|
-
body: { domain }
|
|
506
|
-
})
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
538
|
+
body: { domain, ...opts }
|
|
539
|
+
}),
|
|
540
|
+
/** Check DNS and ownership again now. */
|
|
541
|
+
verify: (id, domain) => this.request(`/projects/${id}/domains/${encodeURIComponent(domain)}/verify`, {
|
|
542
|
+
method: "POST",
|
|
543
|
+
body: {}
|
|
544
|
+
}),
|
|
545
|
+
remove: (id, domain) => this.request(`/projects/${id}/domains/${encodeURIComponent(domain)}`, {
|
|
546
|
+
method: "DELETE"
|
|
547
|
+
}),
|
|
548
|
+
/**
|
|
549
|
+
* Owner keys: buy a domain from the account's credits; it serves on this
|
|
550
|
+
* project once registered. An agent key answers `owner_only` with the
|
|
551
|
+
* console link to hand the owner.
|
|
552
|
+
*/
|
|
553
|
+
buy: (id, input) => this.request(`/projects/${id}/domains/buy`, { method: "POST", body: input })
|
|
511
554
|
},
|
|
512
555
|
/** Poll until every resource is ready, or throw on the first failure. */
|
|
513
556
|
waitUntilReady: async (id, opts = {}) => {
|
|
@@ -536,6 +579,92 @@ var Vibiz = class {
|
|
|
536
579
|
}).then((r) => r.missing),
|
|
537
580
|
upload: (sha, bytes) => this.request(`/files/${sha}`, { method: "PUT", raw: bytes })
|
|
538
581
|
};
|
|
582
|
+
/**
|
|
583
|
+
* A project's Files (docs: files): uploads and every AI-generated image,
|
|
584
|
+
* video and speech, kept permanently with a stable link. `env` defaults to
|
|
585
|
+
* production. (`files` above is the deploy upload cache.)
|
|
586
|
+
*/
|
|
587
|
+
projectFiles = {
|
|
588
|
+
list: (projectId, opts = {}) => this.request(`/projects/${projectId}/files${qs({ ...opts })}`),
|
|
589
|
+
/** The newest file matching the filters (404 `not_found` when none). */
|
|
590
|
+
latest: (projectId, opts = {}) => this.request(`/projects/${projectId}/files/latest${qs({ ...opts })}`),
|
|
591
|
+
get: (projectId, fileId, opts = {}) => this.request(
|
|
592
|
+
`/projects/${projectId}/files/${encodeURIComponent(fileId)}${envQuery(opts.env)}`
|
|
593
|
+
),
|
|
594
|
+
/** Upload bytes (or a Blob) as one file; at most 50 MB. */
|
|
595
|
+
upload: async (projectId, file, opts) => {
|
|
596
|
+
const bytes = file instanceof Uint8Array ? file : new Uint8Array(await file.arrayBuffer());
|
|
597
|
+
const contentType = opts.contentType ?? (file instanceof Blob && file.type ? file.type : "application/octet-stream");
|
|
598
|
+
return this.request(
|
|
599
|
+
`/projects/${projectId}/files${qs({
|
|
600
|
+
env: opts.env,
|
|
601
|
+
name: opts.name,
|
|
602
|
+
folder: opts.folder,
|
|
603
|
+
private: opts.private ? 1 : void 0
|
|
604
|
+
})}`,
|
|
605
|
+
{ method: "POST", raw: bytes, contentType }
|
|
606
|
+
);
|
|
607
|
+
},
|
|
608
|
+
/** Save a file from a public URL (at most 50 MB). */
|
|
609
|
+
import: (projectId, input, opts = {}) => this.request(`/projects/${projectId}/files/import${envQuery(opts.env)}`, {
|
|
610
|
+
method: "POST",
|
|
611
|
+
body: input
|
|
612
|
+
}),
|
|
613
|
+
/** Rename, move to a folder (`null`: none), make private, tag or note. */
|
|
614
|
+
update: (projectId, fileId, patch, opts = {}) => this.request(
|
|
615
|
+
`/projects/${projectId}/files/${encodeURIComponent(fileId)}${envQuery(opts.env)}`,
|
|
616
|
+
{ method: "PATCH", body: patch }
|
|
617
|
+
),
|
|
618
|
+
/** Delete a file: its link stops working. */
|
|
619
|
+
delete: (projectId, fileId, opts = {}) => this.request(
|
|
620
|
+
`/projects/${projectId}/files/${encodeURIComponent(fileId)}${envQuery(opts.env)}`,
|
|
621
|
+
{ method: "DELETE" }
|
|
622
|
+
),
|
|
623
|
+
/** The file's bytes (private files too). */
|
|
624
|
+
download: async (projectId, fileId, opts = {}) => {
|
|
625
|
+
const res = await this.stream(
|
|
626
|
+
`/projects/${projectId}/files/${encodeURIComponent(fileId)}/content${envQuery(opts.env)}`
|
|
627
|
+
);
|
|
628
|
+
return new Uint8Array(await res.arrayBuffer());
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
/** Take a project elsewhere, or keep a backup (docs: export). */
|
|
632
|
+
exports = {
|
|
633
|
+
/** Start packing: `202` with the export `queued`. */
|
|
634
|
+
create: (projectId, input = {}) => this.request(`/projects/${projectId}/exports`, {
|
|
635
|
+
method: "POST",
|
|
636
|
+
body: input
|
|
637
|
+
}),
|
|
638
|
+
list: (projectId) => this.request(`/projects/${projectId}/exports`).then((r) => r.data),
|
|
639
|
+
get: (projectId, exportId) => this.request(`/projects/${projectId}/exports/${encodeURIComponent(exportId)}`),
|
|
640
|
+
waitUntilDone: async (projectId, exportId, opts = {}) => {
|
|
641
|
+
const deadline = Date.now() + (opts.timeoutMs ?? 30 * 6e4);
|
|
642
|
+
for (; ; ) {
|
|
643
|
+
const e = await this.exports.get(projectId, exportId);
|
|
644
|
+
opts.onProgress?.(e);
|
|
645
|
+
if (e.status !== "queued" && e.status !== "running") return e;
|
|
646
|
+
if (Date.now() > deadline)
|
|
647
|
+
throw new VibizApiError(408, "timeout", "Timed out waiting for the export.");
|
|
648
|
+
await sleep(opts.intervalMs ?? 2e3);
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
/** One of its files, from its signed link (no key sent). */
|
|
652
|
+
download: async (url) => {
|
|
653
|
+
const res = await this.fetchImpl(url);
|
|
654
|
+
if (!res.ok) return this.fail(res);
|
|
655
|
+
return res;
|
|
656
|
+
},
|
|
657
|
+
/**
|
|
658
|
+
* The environment's secret values as `.env` text. Owner keys only; the
|
|
659
|
+
* call itself is the confirmation, so only make it when the person asked.
|
|
660
|
+
*/
|
|
661
|
+
envFile: async (projectId, exportId) => {
|
|
662
|
+
const res = await this.stream(
|
|
663
|
+
`/projects/${projectId}/exports/${encodeURIComponent(exportId)}/env?confirm=1`
|
|
664
|
+
);
|
|
665
|
+
return res.text();
|
|
666
|
+
}
|
|
667
|
+
};
|
|
539
668
|
deployments = {
|
|
540
669
|
create: (projectId, input, opts = {}) => this.request(
|
|
541
670
|
`/projects/${projectId}/deployments`,
|
|
@@ -611,11 +740,188 @@ var Vibiz = class {
|
|
|
611
740
|
run: (name, input) => this.request(`/actions/${name}`, {
|
|
612
741
|
method: "POST",
|
|
613
742
|
body: { input }
|
|
614
|
-
})
|
|
743
|
+
}),
|
|
744
|
+
/** The web data actions (scrape, crawl, search, ads library…) with their inputs. */
|
|
745
|
+
list: () => this.request("/actions").then((r) => r.data),
|
|
746
|
+
/** Past runs, newest first, and one run with its output. */
|
|
747
|
+
runs: {
|
|
748
|
+
list: (q = {}) => this.request(
|
|
749
|
+
`/actions/runs${qs({ project: q.project, action: q.action, since: q.since, cursor: q.cursor, limit: q.limit })}`
|
|
750
|
+
),
|
|
751
|
+
get: (id) => this.request(`/actions/runs/${encodeURIComponent(id)}`)
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
/**
|
|
755
|
+
* A site's design (docs: design): tokens, component styles, layout,
|
|
756
|
+
* screenshots and exports (Tailwind v4, shadcn/ui, CSS variables, a brief).
|
|
757
|
+
* With `projectId` the spec, brief and screenshots are saved to its Files.
|
|
758
|
+
*/
|
|
759
|
+
design = {
|
|
760
|
+
extract: (input, opts = {}) => opts.projectId ? this.projects.runAction(opts.projectId, "web.design", input) : this.actions.run("web.design", input)
|
|
615
761
|
};
|
|
616
762
|
email = {
|
|
617
763
|
/** Send from the project's address (`info@<slug>.vibiz.app` by default). */
|
|
618
|
-
send: (projectId, input, opts = {}) => this.projects.runAction(projectId, "email.send", input, opts)
|
|
764
|
+
send: (projectId, input, opts = {}) => this.projects.runAction(projectId, "email.send", input, opts),
|
|
765
|
+
/**
|
|
766
|
+
* Business email's settings (docs: email ▸ Broadcasts): the sending address
|
|
767
|
+
* (`news.<slug>`), footer, double opt-in, tracking, signup form, and the
|
|
768
|
+
* owner's monthly allowance for agent-sent mail. `setup` starts the sender.
|
|
769
|
+
*/
|
|
770
|
+
marketing: {
|
|
771
|
+
get: (projectId) => this.request(`${mkt(projectId)}/marketing`),
|
|
772
|
+
update: (projectId, input) => this.request(`${mkt(projectId)}/marketing`, {
|
|
773
|
+
method: "PATCH",
|
|
774
|
+
body: input
|
|
775
|
+
}),
|
|
776
|
+
setup: (projectId) => this.request(`${mkt(projectId)}/marketing/setup`, {
|
|
777
|
+
method: "POST",
|
|
778
|
+
body: {}
|
|
779
|
+
})
|
|
780
|
+
},
|
|
781
|
+
lists: {
|
|
782
|
+
list: (projectId) => this.request(`${mkt(projectId)}/lists`),
|
|
783
|
+
create: (projectId, input) => this.request(`${mkt(projectId)}/lists`, { method: "POST", body: input }),
|
|
784
|
+
update: (projectId, list, input) => this.request(`${mkt(projectId)}/lists/${encodeURIComponent(list)}`, {
|
|
785
|
+
method: "PATCH",
|
|
786
|
+
body: input
|
|
787
|
+
}),
|
|
788
|
+
delete: (projectId, list) => this.request(
|
|
789
|
+
`${mkt(projectId)}/lists/${encodeURIComponent(list)}`,
|
|
790
|
+
{ method: "DELETE" }
|
|
791
|
+
)
|
|
792
|
+
},
|
|
793
|
+
/** Contacts: by id or email. Upserting never re-subscribes someone who left. */
|
|
794
|
+
contacts: {
|
|
795
|
+
list: (projectId, q = {}) => this.request(`${mkt(projectId)}/contacts${qs(q)}`),
|
|
796
|
+
get: (projectId, contact) => this.request(`${mkt(projectId)}/contacts/${encodeURIComponent(contact)}`),
|
|
797
|
+
upsert: (projectId, input) => this.request(`${mkt(projectId)}/contacts`, { method: "POST", body: input }),
|
|
798
|
+
update: (projectId, contact, input) => this.request(`${mkt(projectId)}/contacts/${encodeURIComponent(contact)}`, {
|
|
799
|
+
method: "PATCH",
|
|
800
|
+
body: input
|
|
801
|
+
}),
|
|
802
|
+
delete: (projectId, contact) => this.request(
|
|
803
|
+
`${mkt(projectId)}/contacts/${encodeURIComponent(contact)}`,
|
|
804
|
+
{ method: "DELETE" }
|
|
805
|
+
),
|
|
806
|
+
/** A CSV from any newsletter tool. `dry_run` first: it reports, writes nothing. */
|
|
807
|
+
import: (projectId, input) => this.request(`${mkt(projectId)}/contacts/import`, {
|
|
808
|
+
method: "POST",
|
|
809
|
+
body: input
|
|
810
|
+
}),
|
|
811
|
+
imports: (projectId) => this.request(
|
|
812
|
+
`${mkt(projectId)}/contacts/imports`
|
|
813
|
+
),
|
|
814
|
+
/** Contacts as CSV text. */
|
|
815
|
+
export: async (projectId, q = {}) => {
|
|
816
|
+
const res = await this.stream(`${mkt(projectId)}/contacts/export${qs(q)}`);
|
|
817
|
+
return res.text();
|
|
818
|
+
},
|
|
819
|
+
/** Something the contact did: segments and automations read it. */
|
|
820
|
+
track: (projectId, input) => this.request(`${mkt(projectId)}/events`, { method: "POST", body: input })
|
|
821
|
+
},
|
|
822
|
+
segments: {
|
|
823
|
+
list: (projectId) => this.request(`${mkt(projectId)}/segments`),
|
|
824
|
+
create: (projectId, input) => this.request(`${mkt(projectId)}/segments`, { method: "POST", body: input }),
|
|
825
|
+
update: (projectId, segment, input) => this.request(`${mkt(projectId)}/segments/${encodeURIComponent(segment)}`, {
|
|
826
|
+
method: "PATCH",
|
|
827
|
+
body: input
|
|
828
|
+
}),
|
|
829
|
+
delete: (projectId, segment) => this.request(
|
|
830
|
+
`${mkt(projectId)}/segments/${encodeURIComponent(segment)}`,
|
|
831
|
+
{ method: "DELETE" }
|
|
832
|
+
),
|
|
833
|
+
/** How many subscribed contacts a filter matches, and ten of them. */
|
|
834
|
+
preview: (projectId, filter) => this.request(
|
|
835
|
+
`${mkt(projectId)}/segments/preview`,
|
|
836
|
+
{ method: "POST", body: { filter } }
|
|
837
|
+
)
|
|
838
|
+
},
|
|
839
|
+
/** An email as a contact would get it (a sample contact, or `contact_id`), untracked. */
|
|
840
|
+
render: (projectId, input) => this.request(`${mkt(projectId)}/render`, { method: "POST", body: input }),
|
|
841
|
+
/**
|
|
842
|
+
* Newsletters and announcements. Anyone drafts, reviews and sends tests (an
|
|
843
|
+
* agent's go to the owners); sending is the owner's, or an agent's within the
|
|
844
|
+
* owner's monthly allowance (otherwise `owner_only` with the review link).
|
|
845
|
+
*/
|
|
846
|
+
broadcasts: {
|
|
847
|
+
list: (projectId, q = {}) => this.request(`${mkt(projectId)}/broadcasts${qs(q)}`),
|
|
848
|
+
get: (projectId, id) => this.request(`${mkt(projectId)}/broadcasts/${encodeURIComponent(id)}`),
|
|
849
|
+
create: (projectId, input) => this.request(`${mkt(projectId)}/broadcasts`, { method: "POST", body: input }),
|
|
850
|
+
update: (projectId, id, input) => this.request(`${mkt(projectId)}/broadcasts/${encodeURIComponent(id)}`, {
|
|
851
|
+
method: "PATCH",
|
|
852
|
+
body: input
|
|
853
|
+
}),
|
|
854
|
+
delete: (projectId, id) => this.request(
|
|
855
|
+
`${mkt(projectId)}/broadcasts/${encodeURIComponent(id)}`,
|
|
856
|
+
{ method: "DELETE" }
|
|
857
|
+
),
|
|
858
|
+
/** Everything to fix before sending, the audience, and the cost against the balance. */
|
|
859
|
+
review: (projectId, id) => this.request(
|
|
860
|
+
`${mkt(projectId)}/broadcasts/${encodeURIComponent(id)}/review`
|
|
861
|
+
),
|
|
862
|
+
/** A free, untracked `[Test]` (default: to the account's owners). */
|
|
863
|
+
test: (projectId, id, input = {}) => this.request(
|
|
864
|
+
`${mkt(projectId)}/broadcasts/${encodeURIComponent(id)}/test`,
|
|
865
|
+
{
|
|
866
|
+
method: "POST",
|
|
867
|
+
body: input
|
|
868
|
+
}
|
|
869
|
+
),
|
|
870
|
+
/** Now, or at `scheduled_at` (ISO). */
|
|
871
|
+
send: (projectId, id, input = {}) => this.request(`${mkt(projectId)}/broadcasts/${encodeURIComponent(id)}/send`, {
|
|
872
|
+
method: "POST",
|
|
873
|
+
body: input
|
|
874
|
+
}),
|
|
875
|
+
cancel: (projectId, id) => this.request(`${mkt(projectId)}/broadcasts/${encodeURIComponent(id)}/cancel`, {
|
|
876
|
+
method: "POST",
|
|
877
|
+
body: {}
|
|
878
|
+
}),
|
|
879
|
+
/** Owner only, after a pause. */
|
|
880
|
+
resume: (projectId, id) => this.request(`${mkt(projectId)}/broadcasts/${encodeURIComponent(id)}/resume`, {
|
|
881
|
+
method: "POST",
|
|
882
|
+
body: {}
|
|
883
|
+
}),
|
|
884
|
+
/** `status`: a send status, or `opened`, `clicked`, `unsubscribed`; `mailbox`: gmail, outlook… */
|
|
885
|
+
recipients: (projectId, id, q = {}) => this.request(
|
|
886
|
+
`${mkt(projectId)}/broadcasts/${encodeURIComponent(id)}/recipients${qs(q)}`
|
|
887
|
+
)
|
|
888
|
+
},
|
|
889
|
+
/** Onboarding sequences and the like: a trigger, then waits, emails and branches. */
|
|
890
|
+
automations: {
|
|
891
|
+
list: (projectId) => this.request(`${mkt(projectId)}/automations`),
|
|
892
|
+
get: (projectId, id) => this.request(`${mkt(projectId)}/automations/${encodeURIComponent(id)}`),
|
|
893
|
+
create: (projectId, input) => this.request(`${mkt(projectId)}/automations`, { method: "POST", body: input }),
|
|
894
|
+
update: (projectId, id, input) => this.request(`${mkt(projectId)}/automations/${encodeURIComponent(id)}`, {
|
|
895
|
+
method: "PATCH",
|
|
896
|
+
body: input
|
|
897
|
+
}),
|
|
898
|
+
delete: (projectId, id) => this.request(
|
|
899
|
+
`${mkt(projectId)}/automations/${encodeURIComponent(id)}`,
|
|
900
|
+
{ method: "DELETE" }
|
|
901
|
+
),
|
|
902
|
+
activate: (projectId, id) => this.request(
|
|
903
|
+
`${mkt(projectId)}/automations/${encodeURIComponent(id)}/activate`,
|
|
904
|
+
{
|
|
905
|
+
method: "POST",
|
|
906
|
+
body: {}
|
|
907
|
+
}
|
|
908
|
+
),
|
|
909
|
+
pause: (projectId, id) => this.request(`${mkt(projectId)}/automations/${encodeURIComponent(id)}/pause`, {
|
|
910
|
+
method: "POST",
|
|
911
|
+
body: {}
|
|
912
|
+
}),
|
|
913
|
+
enrollments: (projectId, id, q = {}) => this.request(
|
|
914
|
+
`${mkt(projectId)}/automations/${encodeURIComponent(id)}/enrollments${qs(q)}`
|
|
915
|
+
),
|
|
916
|
+
/** One email step as a free `[Test]` (default: to the owners). */
|
|
917
|
+
test: (projectId, id, input) => this.request(
|
|
918
|
+
`${mkt(projectId)}/automations/${encodeURIComponent(id)}/test`,
|
|
919
|
+
{
|
|
920
|
+
method: "POST",
|
|
921
|
+
body: input
|
|
922
|
+
}
|
|
923
|
+
)
|
|
924
|
+
}
|
|
619
925
|
};
|
|
620
926
|
/**
|
|
621
927
|
* The AI gateway: chat, images, speech and transcription, metered against
|
|
@@ -758,6 +1064,126 @@ var Vibiz = class {
|
|
|
758
1064
|
get: (opts = {}) => this.request(`/usage${usageQuery(opts)}`),
|
|
759
1065
|
project: (projectId, opts = {}) => this.request(`/projects/${projectId}/usage${usageQuery(opts)}`)
|
|
760
1066
|
};
|
|
1067
|
+
/**
|
|
1068
|
+
* Buying domains (docs: buying a domain): search and quote with any key;
|
|
1069
|
+
* the domains the account owns, auto-renew, renewals, the transfer code and
|
|
1070
|
+
* the owner details (the registrant, saved once) need an owner key.
|
|
1071
|
+
*/
|
|
1072
|
+
domains = {
|
|
1073
|
+
search: (q, opts = {}) => this.request(`/domains/search${qs({ q, project_id: opts.projectId })}`),
|
|
1074
|
+
quote: (domain, opts = {}) => this.request(
|
|
1075
|
+
`/domains/quote${qs({ domain, years: opts.years, project_id: opts.projectId })}`
|
|
1076
|
+
),
|
|
1077
|
+
list: () => this.request("/domains"),
|
|
1078
|
+
get: (domain) => this.request(`/domains/${encodeURIComponent(domain)}`),
|
|
1079
|
+
update: (domain, input) => this.request(`/domains/${encodeURIComponent(domain)}`, {
|
|
1080
|
+
method: "PATCH",
|
|
1081
|
+
body: input
|
|
1082
|
+
}),
|
|
1083
|
+
renew: (domain, input) => this.request(`/domains/${encodeURIComponent(domain)}/renew`, {
|
|
1084
|
+
method: "POST",
|
|
1085
|
+
body: input
|
|
1086
|
+
}),
|
|
1087
|
+
authCode: (domain) => this.request(`/domains/${encodeURIComponent(domain)}/auth-code`, { method: "POST", body: {} }),
|
|
1088
|
+
owner: () => this.request("/domains/owner"),
|
|
1089
|
+
setOwner: (contact) => this.request("/domains/owner", { method: "PUT", body: { contact } }),
|
|
1090
|
+
/**
|
|
1091
|
+
* Email forwarding (docs: email ▸ Forwarding): `hello@<domain>` → the
|
|
1092
|
+
* owner's inbox, sent "via Vibiz". Anyone reads and verifies; `set` and
|
|
1093
|
+
* `off` need an owner key (an agent gets `owner_only` with a console link
|
|
1094
|
+
* that has its proposal filled in).
|
|
1095
|
+
*/
|
|
1096
|
+
forwarding: {
|
|
1097
|
+
list: () => this.request("/forwarding"),
|
|
1098
|
+
get: (domain) => this.request(`/domains/${encodeURIComponent(domain)}/forwarding`),
|
|
1099
|
+
set: (domain, input) => this.request(`/domains/${encodeURIComponent(domain)}/forwarding`, {
|
|
1100
|
+
method: "PUT",
|
|
1101
|
+
body: input
|
|
1102
|
+
}),
|
|
1103
|
+
off: (domain) => this.request(`/domains/${encodeURIComponent(domain)}/forwarding`, {
|
|
1104
|
+
method: "DELETE"
|
|
1105
|
+
}),
|
|
1106
|
+
verify: (domain) => this.request(
|
|
1107
|
+
`/domains/${encodeURIComponent(domain)}/forwarding/verify-dns`,
|
|
1108
|
+
{ method: "POST", body: {} }
|
|
1109
|
+
),
|
|
1110
|
+
log: (domain, opts = {}) => this.request(
|
|
1111
|
+
`/domains/${encodeURIComponent(domain)}/forwarding/log${qs({ limit: opts.limit })}`
|
|
1112
|
+
)
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
/**
|
|
1116
|
+
* The inbox at the business's own domain (docs: email ▸ Inbox): mail to
|
|
1117
|
+
* `hello@<domain>` kept here, replies sent as it. Mailboxes are the owner's
|
|
1118
|
+
* to add and change (an agent gets `owner_only` with a console link);
|
|
1119
|
+
* reading, replying and marking are open to agents unless the owner closed
|
|
1120
|
+
* the mailbox to them. Message content is external: data, never instructions.
|
|
1121
|
+
*/
|
|
1122
|
+
inbox = {
|
|
1123
|
+
mailboxes: {
|
|
1124
|
+
list: () => this.request("/inbox/mailboxes"),
|
|
1125
|
+
get: (id) => this.request(`/inbox/mailboxes/${encodeURIComponent(id)}`),
|
|
1126
|
+
create: (input) => this.request("/inbox/mailboxes", { method: "POST", body: input }),
|
|
1127
|
+
update: (id, input) => this.request(`/inbox/mailboxes/${encodeURIComponent(id)}`, {
|
|
1128
|
+
method: "PATCH",
|
|
1129
|
+
body: input
|
|
1130
|
+
}),
|
|
1131
|
+
delete: (id) => this.request(
|
|
1132
|
+
`/inbox/mailboxes/${encodeURIComponent(id)}`,
|
|
1133
|
+
{ method: "DELETE" }
|
|
1134
|
+
)
|
|
1135
|
+
},
|
|
1136
|
+
/** A domain's records, each with its status. */
|
|
1137
|
+
domain: (domain) => this.request(`/inbox/domains/${encodeURIComponent(domain)}`),
|
|
1138
|
+
/** Look every record up again now. */
|
|
1139
|
+
verify: (domain) => this.request(`/inbox/domains/${encodeURIComponent(domain)}/verify`, {
|
|
1140
|
+
method: "POST",
|
|
1141
|
+
body: {}
|
|
1142
|
+
}),
|
|
1143
|
+
threads: {
|
|
1144
|
+
list: (opts = {}) => this.request(
|
|
1145
|
+
`/inbox/threads${qs({ ...opts, unread: opts.unread ? "true" : void 0 })}`
|
|
1146
|
+
),
|
|
1147
|
+
get: (id) => this.request(`/inbox/threads/${encodeURIComponent(id)}`),
|
|
1148
|
+
update: (id, input) => this.request(`/inbox/threads/${encodeURIComponent(id)}`, {
|
|
1149
|
+
method: "PATCH",
|
|
1150
|
+
body: input
|
|
1151
|
+
}),
|
|
1152
|
+
/** Owner keys; only from trash or spam. */
|
|
1153
|
+
delete: (id) => this.request(
|
|
1154
|
+
`/inbox/threads/${encodeURIComponent(id)}`,
|
|
1155
|
+
{ method: "DELETE" }
|
|
1156
|
+
),
|
|
1157
|
+
reply: (id, input, opts = {}) => this.request(`/inbox/threads/${encodeURIComponent(id)}/reply`, {
|
|
1158
|
+
method: "POST",
|
|
1159
|
+
body: input,
|
|
1160
|
+
...opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : {}
|
|
1161
|
+
})
|
|
1162
|
+
},
|
|
1163
|
+
messages: {
|
|
1164
|
+
update: (id, input) => this.request(`/inbox/messages/${encodeURIComponent(id)}`, {
|
|
1165
|
+
method: "PATCH",
|
|
1166
|
+
body: input
|
|
1167
|
+
})
|
|
1168
|
+
},
|
|
1169
|
+
/** A new message (or a forward, with `forward_message_id`) from a mailbox. */
|
|
1170
|
+
send: (input, opts = {}) => this.request("/inbox/send", {
|
|
1171
|
+
method: "POST",
|
|
1172
|
+
body: input,
|
|
1173
|
+
...opts.idempotencyKey ? { idempotencyKey: opts.idempotencyKey } : {}
|
|
1174
|
+
}),
|
|
1175
|
+
/** A file to attach (kept a day until sent); returns its id. */
|
|
1176
|
+
upload: (file) => this.request(`/inbox/files${qs({ name: file.filename })}`, {
|
|
1177
|
+
method: "POST",
|
|
1178
|
+
raw: file.bytes,
|
|
1179
|
+
contentType: file.contentType
|
|
1180
|
+
}),
|
|
1181
|
+
settings: {
|
|
1182
|
+
get: () => this.request("/inbox/settings"),
|
|
1183
|
+
/** Owner keys: the new-mail digest. */
|
|
1184
|
+
update: (input) => this.request("/inbox/settings", { method: "PATCH", body: input })
|
|
1185
|
+
}
|
|
1186
|
+
};
|
|
761
1187
|
/**
|
|
762
1188
|
* The account's own credits (docs/BILLING.md): the balance, the card,
|
|
763
1189
|
* auto-recharge and history. A top-up is a hosted page a person pays on.
|
|
@@ -811,9 +1237,7 @@ var Vibiz = class {
|
|
|
811
1237
|
return this.request("/hosts").then((r) => r.data);
|
|
812
1238
|
}
|
|
813
1239
|
capabilities() {
|
|
814
|
-
return this.request(
|
|
815
|
-
"/capabilities"
|
|
816
|
-
);
|
|
1240
|
+
return this.request("/capabilities");
|
|
817
1241
|
}
|
|
818
1242
|
/** The account and key this client acts as. */
|
|
819
1243
|
whoami() {
|
|
@@ -826,6 +1250,7 @@ var Vibiz = class {
|
|
|
826
1250
|
});
|
|
827
1251
|
}
|
|
828
1252
|
};
|
|
1253
|
+
var mkt = (projectId) => `/projects/${encodeURIComponent(projectId)}/email`;
|
|
829
1254
|
var envQuery = (env) => env ? `?env=${env}` : "";
|
|
830
1255
|
var qs = (q) => {
|
|
831
1256
|
const p = new URLSearchParams();
|