@vibiz/sdk 0.2.1 → 0.2.2
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/client.d.ts +21 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +36 -0
- package/dist/one-key.d.ts +22 -0
- package/dist/types.d.ts +47 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionInfo, ActionResult, ActionRun, ActionRunList, ActionRunsQuery, ActionUsage, AdminMetrics, AiJob, AiModelInfo, AiProviderKey, AiProviderKeyInput, AiProviderKeyList, AiSettings, AnalyticsPeriod, AnalyticsReport, ApiKey, AppKeyInfo, AuthEnvironment, AuthProviderId, AuthProviderInput, AuthSettings, AuthSettingsPatch, Automation, AutomationEnrollment, AutomationInput, AutomationTrigger, Billing, BillingCharge, BillingCheckout, BillingEntry, BillingEntryKind, BillingList, BillingUpdate, Broadcast, BroadcastInput, BroadcastRecipient, BroadcastReview, BroadcastStatus, ChatChunk, ChatCompletion, ChatRequest, Checkout, CheckoutInput, Company, CompanyAddressFields, CompanyCatalog, CompanyDraft, CompanyEnvironment, CompanyLink, Connector, ConnectorApproval, ConnectorCall, ConnectorCallInput, ConnectorCheck, ConnectorEnvironment, ConnectorImport, ConnectorInput, ConnectorPatch, ConnectorResponse, ContactPropertyValue, ContactStatus, DashboardLink, DeployFile, Deployment, DesignSpec, DevEnvironment, Domain, DomainBuyInput, DomainList, DomainOwnerContact, DomainOwnerDetails, DomainQuote, DomainSearch, EmailContact, EmailContactInput, EmailContactList, EmailContactPatch, EmailForwarding, EmailForwardingLog, EmailForwardingRule, EmailImportInput, EmailImportReport, EmailList, EmailMarketing, EmailMarketingPatch, EmailPage, EmailPreview, EmailSegment, EmailTestResult, EnvTargetInfo, ExportInput, FileEnvironment, FileList, FileListOptions, FileUploadOptions, HostKind, ImageRequest, ImageResult, InboxSettings, KeyAccess, LedgerEntry, Mailbox, MailboxInput, MailDomain, MailFolder, MailReplyInput, MailSendInput, MailThreadDetail, MailThreadList, MailView, MetricsReport, Operation, OwnAccountLink, OwnedDomain, OwnedDomainList, Payment, PaymentPrice, PaymentPriceInput, PaymentProduct, PaymentSubscription, PaymentsAccount, PaymentsEnvironment, PaymentsList, PaymentsSimulation, Project, ProjectExport, ReplayDetail, ReplayInsights, ReplayListOptions, ReplayPeriod, ReplayStatus, ReplaySummary, Resource, ResourceType, SegmentFilter, SendEmailInput, SendEmailOutput, SocialAccount, SocialAccountAnalytics, SocialAdCampaign, SocialAdChange, SocialAdChangeInput, SocialConnectLink, SocialEnvironment, SocialMedia, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, VibizFile, WebDesignInput, WebhookDelivery, WebhookEventType, Withdrawal } from './types.js';
|
|
1
|
+
import type { ActionInfo, ActionResult, ActionRun, ActionRunList, ActionRunsQuery, ActionUsage, AdminMetrics, AiJob, AiModelInfo, AiProviderKey, AiProviderKeyInput, AiProviderKeyList, AiSettings, AnalyticsPeriod, AnalyticsReport, ApiKey, AppKeyInfo, AuthEnvironment, AuthProviderId, AuthProviderInput, AuthSettings, AuthSettingsPatch, Automation, AutomationEnrollment, AutomationInput, AutomationTrigger, Billing, BillingCharge, BillingCheckout, BillingEntry, BillingEntryKind, BillingList, BillingUpdate, Broadcast, BroadcastInput, BroadcastRecipient, BroadcastReview, BroadcastStatus, ChatChunk, ChatCompletion, ChatRequest, Checkout, CheckoutInput, Company, CompanyAddressFields, CompanyCatalog, CompanyDraft, CompanyEnvironment, CompanyLink, Connector, ConnectorApproval, ConnectorCall, ConnectorCallInput, ConnectorCheck, ConnectorEnvironment, ConnectorImport, ConnectorInput, ConnectorPatch, ConnectorResponse, ContactPropertyValue, ContactStatus, DashboardLink, DeployFile, Deployment, DesignSpec, DevEnvironment, Domain, DomainBuyInput, DomainList, DomainOwnerContact, DomainOwnerDetails, DomainQuote, DomainSearch, DomainUse, DomainUseInput, EmailContact, EmailContactInput, EmailContactList, EmailContactPatch, EmailForwarding, EmailForwardingLog, EmailForwardingRule, EmailImportInput, EmailImportReport, EmailList, EmailMarketing, EmailMarketingPatch, EmailPage, EmailPreview, EmailSegment, EmailTestResult, EnvTargetInfo, ExportInput, FileEnvironment, FileList, FileListOptions, FileUploadOptions, HostKind, ImageRequest, ImageResult, InboxSettings, KeyAccess, LedgerEntry, Mailbox, MailboxInput, MailDomain, MailFolder, MailReplyInput, MailSendInput, MailThreadDetail, MailThreadList, MailView, MetricsReport, Operation, OwnAccountLink, OwnedDomain, OwnedDomainList, Payment, PaymentPrice, PaymentPriceInput, PaymentProduct, PaymentSubscription, PaymentsAccount, PaymentsEnvironment, PaymentsList, PaymentsSimulation, Project, ProjectExport, ReplayDetail, ReplayInsights, ReplayListOptions, ReplayPeriod, ReplayStatus, ReplaySummary, Resource, ResourceType, SegmentFilter, SendEmailInput, SendEmailOutput, SocialAccount, SocialAccountAnalytics, SocialAdCampaign, SocialAdChange, SocialAdChangeInput, SocialConnectLink, SocialEnvironment, SocialMedia, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, VibizFile, WebDesignInput, WebhookDelivery, WebhookEventType, Withdrawal } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* An error status with no Vibiz error body: a proxy, a load balancer or the
|
|
4
4
|
* network answered instead of the API. Say so, and what to do.
|
|
@@ -972,6 +972,26 @@ export declare class Vibiz {
|
|
|
972
972
|
auth_code: string;
|
|
973
973
|
next_step: string;
|
|
974
974
|
}>;
|
|
975
|
+
/**
|
|
976
|
+
* Use a bought domain (or a name under it) on any of the account's
|
|
977
|
+
* projects: no DNS to set, trusted for sign-in at once. Any key. A name
|
|
978
|
+
* another project uses answers 409 `in_use` with the move.
|
|
979
|
+
*/
|
|
980
|
+
use: (domain: string, projectId: string, input?: DomainUseInput) => Promise<DomainUse>;
|
|
981
|
+
/** Full-access keys: move a name from the project using it to `toProjectId`. */
|
|
982
|
+
move: (domain: string, toProjectId: string, input?: DomainUseInput & {
|
|
983
|
+
from_project_id?: string;
|
|
984
|
+
}) => Promise<DomainUse>;
|
|
985
|
+
/** A bought name used by an app elsewhere: point it at that host (`null` clears it). */
|
|
986
|
+
point: (domain: string, input: {
|
|
987
|
+
name?: string;
|
|
988
|
+
points_to: string | null;
|
|
989
|
+
project_id?: string;
|
|
990
|
+
}) => Promise<DomainUse>;
|
|
991
|
+
/** Buy for the account: on `project_id` once registered, or none to use later. */
|
|
992
|
+
buy: (input: DomainBuyInput & {
|
|
993
|
+
project_id?: string | null;
|
|
994
|
+
}) => Promise<OwnedDomain>;
|
|
975
995
|
owner: () => Promise<DomainOwnerDetails>;
|
|
976
996
|
setOwner: (contact: DomainOwnerContact) => Promise<DomainOwnerDetails>;
|
|
977
997
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ export { endUserHeader, Vibiz, VibizApiError, type VibizOptions, type WhoAmI } f
|
|
|
2
2
|
export { assertDeployableRoot, collectFiles, deployDirectory, type LocalFile } from './deploy.js';
|
|
3
3
|
export { mergeEnvFile, writeEnvFile } from './env.js';
|
|
4
4
|
export { formatUnits, formatUsd } from './format.js';
|
|
5
|
+
export { APP_SDK_VERSION, connectHostMessage, ONE_KEY_GIVES, oneKeyMessage, } from './one-key.js';
|
|
5
6
|
export type * from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -1094,6 +1094,27 @@ var Vibiz = class {
|
|
|
1094
1094
|
body: input
|
|
1095
1095
|
}),
|
|
1096
1096
|
authCode: (domain) => this.request(`/domains/${encodeURIComponent(domain)}/auth-code`, { method: "POST", body: {} }),
|
|
1097
|
+
/**
|
|
1098
|
+
* Use a bought domain (or a name under it) on any of the account's
|
|
1099
|
+
* projects: no DNS to set, trusted for sign-in at once. Any key. A name
|
|
1100
|
+
* another project uses answers 409 `in_use` with the move.
|
|
1101
|
+
*/
|
|
1102
|
+
use: (domain, projectId, input = {}) => this.request(`/domains/${encodeURIComponent(domain)}/use`, {
|
|
1103
|
+
method: "POST",
|
|
1104
|
+
body: { project_id: projectId, ...input }
|
|
1105
|
+
}),
|
|
1106
|
+
/** Full-access keys: move a name from the project using it to `toProjectId`. */
|
|
1107
|
+
move: (domain, toProjectId, input = {}) => this.request(`/domains/${encodeURIComponent(domain)}/move`, {
|
|
1108
|
+
method: "POST",
|
|
1109
|
+
body: { to_project_id: toProjectId, ...input }
|
|
1110
|
+
}),
|
|
1111
|
+
/** A bought name used by an app elsewhere: point it at that host (`null` clears it). */
|
|
1112
|
+
point: (domain, input) => this.request(`/domains/${encodeURIComponent(domain)}/point`, {
|
|
1113
|
+
method: "POST",
|
|
1114
|
+
body: input
|
|
1115
|
+
}),
|
|
1116
|
+
/** Buy for the account: on `project_id` once registered, or none to use later. */
|
|
1117
|
+
buy: (input) => this.request("/domains/buy", { method: "POST", body: input }),
|
|
1097
1118
|
owner: () => this.request("/domains/owner"),
|
|
1098
1119
|
setOwner: (contact) => this.request("/domains/owner", { method: "PUT", body: { contact } }),
|
|
1099
1120
|
/**
|
|
@@ -1445,15 +1466,30 @@ function formatUnits(units) {
|
|
|
1445
1466
|
}
|
|
1446
1467
|
return parts.join(" \xB7 ") || "\u2013";
|
|
1447
1468
|
}
|
|
1469
|
+
|
|
1470
|
+
// packages/sdk/src/one-key.ts
|
|
1471
|
+
var APP_SDK_VERSION = "0.2.2";
|
|
1472
|
+
var ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social and connectors";
|
|
1473
|
+
function oneKeyMessage(url, host) {
|
|
1474
|
+
const where = host ?? "your host";
|
|
1475
|
+
return `Add one key to ${where} and your app can use everything on Vibiz (${ONE_KEY_GIVES}): copy VIBIZ_APP_KEY here: ${url} , paste it into ${host ? `${host}'s` : "your host's"} production environment variables, and redeploy.`;
|
|
1476
|
+
}
|
|
1477
|
+
function connectHostMessage(kind, host) {
|
|
1478
|
+
return `Or connect ${host ?? "the host"} once (vibiz hosts add ${kind ?? "<host>"} <app>) and Vibiz keeps every variable in sync.`;
|
|
1479
|
+
}
|
|
1448
1480
|
export {
|
|
1481
|
+
APP_SDK_VERSION,
|
|
1482
|
+
ONE_KEY_GIVES,
|
|
1449
1483
|
Vibiz,
|
|
1450
1484
|
VibizApiError,
|
|
1451
1485
|
assertDeployableRoot,
|
|
1452
1486
|
collectFiles,
|
|
1487
|
+
connectHostMessage,
|
|
1453
1488
|
deployDirectory,
|
|
1454
1489
|
endUserHeader,
|
|
1455
1490
|
formatUnits,
|
|
1456
1491
|
formatUsd,
|
|
1457
1492
|
mergeEnvFile,
|
|
1493
|
+
oneKeyMessage,
|
|
1458
1494
|
writeEnvFile
|
|
1459
1495
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one-key rule, worded once (docs/KEYS.md). A running app needs one
|
|
3
|
+
* secret, VIBIZ_APP_KEY, and with it reaches everything its project has. The
|
|
4
|
+
* CLI and the MCP server tell a person exactly this, with the console link
|
|
5
|
+
* that opens the key ready to copy (`app_key_console_url` from the API),
|
|
6
|
+
* never directions to find it.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The published `@vibiz/app` that agents pin when they add it to a website
|
|
10
|
+
* (`npm install --save-exact @vibiz/app@<this>`). A test keeps it, the skills
|
|
11
|
+
* and the docs equal to packages/app/package.json.
|
|
12
|
+
*/
|
|
13
|
+
export declare const APP_SDK_VERSION = "0.2.2";
|
|
14
|
+
/** Everything one app key reaches. */
|
|
15
|
+
export declare const ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social and connectors";
|
|
16
|
+
/**
|
|
17
|
+
* The sentence for a person who must put the key in a host. `url` is the
|
|
18
|
+
* API's `app_key_console_url`; `host` names their host when it is known.
|
|
19
|
+
*/
|
|
20
|
+
export declare function oneKeyMessage(url: string, host?: string): string;
|
|
21
|
+
/** The other way: the owner connects the host once and Vibiz keeps it in sync. */
|
|
22
|
+
export declare function connectHostMessage(kind?: string, host?: string): string;
|
package/dist/types.d.ts
CHANGED
|
@@ -56,6 +56,12 @@ export interface Domain {
|
|
|
56
56
|
project_id: string;
|
|
57
57
|
/** `vibiz`: Vibiz hosting serves it. `elsewhere`: another host does. */
|
|
58
58
|
hosting: 'vibiz' | 'elsewhere';
|
|
59
|
+
/** `purchased`: inside a domain this account bought through Vibiz, so there is no DNS to set. */
|
|
60
|
+
source: 'external' | 'purchased';
|
|
61
|
+
/** True for a bought domain: Vibiz sets every DNS record it needs (`records_to_set` stays empty). */
|
|
62
|
+
dns_by_vibiz: boolean;
|
|
63
|
+
/** A bought name used by an app on another host: where we point it in its DNS (null: not set yet). */
|
|
64
|
+
points_to: string | null;
|
|
59
65
|
/** False: an agent added it; analytics counts it, sign-in waits for `trust_record` or an owner. */
|
|
60
66
|
trusted_for_sign_in: boolean;
|
|
61
67
|
/**
|
|
@@ -174,11 +180,28 @@ export interface DomainOwnerDetails {
|
|
|
174
180
|
applies_to: 'new_domains';
|
|
175
181
|
console_url: string;
|
|
176
182
|
}
|
|
183
|
+
/** One name of a bought domain in use on one project. */
|
|
184
|
+
export interface OwnedDomainUse {
|
|
185
|
+
project_id: string;
|
|
186
|
+
project_name: string;
|
|
187
|
+
project_slug: string;
|
|
188
|
+
/** The domain itself or a name under it (`app.example.com`). */
|
|
189
|
+
name: string;
|
|
190
|
+
hosting: 'vibiz' | 'elsewhere';
|
|
191
|
+
www_redirect: string | null;
|
|
192
|
+
console_url: string;
|
|
193
|
+
}
|
|
177
194
|
export interface OwnedDomain {
|
|
178
195
|
object: 'owned_domain';
|
|
179
196
|
id: string;
|
|
180
197
|
domain: string;
|
|
198
|
+
/** The project the domain itself (the apex) serves on, if any. */
|
|
181
199
|
project_id: string | null;
|
|
200
|
+
/**
|
|
201
|
+
* Every project using it, the domain or any name under it. A bought domain
|
|
202
|
+
* works on any of the account's projects with no DNS to set (`use`).
|
|
203
|
+
*/
|
|
204
|
+
used_on: OwnedDomainUse[];
|
|
182
205
|
/** `registering` until the registry confirms; `failed`: refunded. */
|
|
183
206
|
status: 'registering' | 'active' | 'expired' | 'failed';
|
|
184
207
|
/** Renewed from credits about 30 days before `expires_at`. */
|
|
@@ -433,6 +456,30 @@ export interface InboxSettings {
|
|
|
433
456
|
digest: boolean;
|
|
434
457
|
console_url: string;
|
|
435
458
|
}
|
|
459
|
+
/** `use` / `move`: a bought domain on a project, with no DNS to set. */
|
|
460
|
+
export interface DomainUse {
|
|
461
|
+
object: 'domain_use';
|
|
462
|
+
domain: string;
|
|
463
|
+
/** The full name now on the project (`app.example.com`, or the domain itself). */
|
|
464
|
+
name: string;
|
|
465
|
+
project_id: string;
|
|
466
|
+
/** Set by `move`: where it was before. */
|
|
467
|
+
moved_from: {
|
|
468
|
+
project_id: string;
|
|
469
|
+
project_name: string;
|
|
470
|
+
} | null;
|
|
471
|
+
project_domain: Domain | null;
|
|
472
|
+
owned: OwnedDomain;
|
|
473
|
+
next_step: string;
|
|
474
|
+
}
|
|
475
|
+
export interface DomainUseInput {
|
|
476
|
+
/** The domain itself (default), a prefix (`app`) or a full name under it (`app.example.com`). */
|
|
477
|
+
name?: string;
|
|
478
|
+
/** Defaults to `vibiz` when the project has Vibiz hosting, else `elsewhere`. */
|
|
479
|
+
hosting?: 'vibiz' | 'elsewhere';
|
|
480
|
+
/** An app on another host: its address (host name or IP); we write the record. */
|
|
481
|
+
points_to?: string | null;
|
|
482
|
+
}
|
|
436
483
|
export interface DomainBuyInput {
|
|
437
484
|
domain: string;
|
|
438
485
|
years?: number;
|