@vibiz/sdk 0.3.12 → 0.3.15
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/README.md +1 -1
- package/dist/client.d.ts +23 -2
- package/dist/index.js +23 -6
- package/dist/one-key.d.ts +1 -1
- package/dist/types.d.ts +24 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @vibiz/sdk
|
|
2
2
|
|
|
3
|
-
The typed client for the [
|
|
3
|
+
The typed client for the [thelastapi](https://app.vibiz.app/docs) API: projects, hosting and
|
|
4
4
|
deploys, databases, sign-in, email, AI, usage, payments and more, with the same calls the `vibiz`
|
|
5
5
|
CLI makes.
|
|
6
6
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ActionInfo, ActionResult, ActionRun, ActionRunList, ActionRunsQuery, ActionUsage, AdminMetrics, AiJob, AiKeyProvider, AiModelInfo, AiProviderKey, AiProviderKeyInput, AiProviderKeyList, AiSettings, AnalyticsPeriod, AnalyticsReport, ApiKey, AppKeyInfo, AppStoreAccount, AppStoreConnectLink, AppStoreSetup, AppStoreSetupInput, AppStoreState, 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, CheckoutBrandPatch, CheckoutInput, Company, CompanyAddressFields, CompanyCatalog, CompanyDraft, CompanyEnvironment, CompanyLink, Connector, ConnectorApproval, ConnectorCall, ConnectorCallInput, ConnectorCheck, ConnectorEnvironment, ConnectorImport, ConnectorInput, ConnectorPatch, ConnectorResponse, ContactPropertyValue, ContactStatus, DashboardLink, DeployFile, Deployment, DeploymentFiles, DesignSectionRead, DesignSpec, DevEnvironment, DnsRecord, DnsRecordInput, DnsRecordList, 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, EnvVarInfo, ExportInput, FileEnvironment, FileList, FileListOptions, FileUploadOptions, HealthList, HealthRun, HealthStatus, HostKind, ImageRequest, ImageResult, InboxSettings, KeyAccess, KeyPermission, KeyPresetChoice, LedgerEntry, Mailbox, MailboxInput, MailDomain, MailFolder, MailReplyInput, MailSendInput, MailThreadDetail, MailThreadList, MailView, MetricsReport, MissionControl, MissionControlLayout, Operation, OwnAccountLink, OwnedDomain, OwnedDomainList, OwnerStripe, OwnerStripeApply, OwnerStripeDisconnect, OwnerStripeLink, Payment, PaymentPrice, PaymentPriceInput, PaymentProduct, PaymentSubscription, PaymentsAccount, PaymentsEnvironment, PaymentsList, PaymentsSimulation, PhoneAnsweringInput, PhoneCall, PhoneCallInput, PhoneCallList, PhoneMessage, PhoneMessageList, PhoneNumber, PhoneNumberList, PhoneQuote, PhoneRegistrationInput, PhoneRegistrationRequirements, PhoneSearch, PhoneSendInput, PhoneThreadList, Project, ProjectExport, ProjectHealth, ProjectSearch, ReplayDetail, ReplayFrames, ReplayFramesOptions, ReplayInsights, ReplayListOptions, ReplayPeriod, ReplayStatus, ReplaySummary, Resource, ResourceType, SearchConnectionList, SearchPageList, SecretLink, SegmentFilter, SendEmailInput, SendEmailOutput, SocialAccount, SocialAccountAnalytics, SocialAdCampaign, SocialAdChange, SocialAdChangeInput, SocialCampaignCreateInput, SocialConnectLink, SocialEnvironment, SocialMedia, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, VersionDiff, VersionList, VersionRestore, VibizFile, WebDesignInput, WebhookDelivery, WebhookEventType, Withdrawal } from './types.js';
|
|
1
|
+
import type { ActionInfo, ActionResult, ActionRun, ActionRunList, ActionRunsQuery, ActionUsage, AdminMetrics, AiJob, AiKeyProvider, AiModelInfo, AiProviderKey, AiProviderKeyInput, AiProviderKeyList, AiSettings, AnalyticsPeriod, AnalyticsReport, ApiKey, AppKeyInfo, AppStoreAccount, AppStoreConnectLink, AppStoreSetup, AppStoreSetupInput, AppStoreState, 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, CheckoutBrandPatch, CheckoutInput, Company, CompanyAddressFields, CompanyCatalog, CompanyDraft, CompanyEnvironment, CompanyLink, Connector, ConnectorApproval, ConnectorCall, ConnectorCallInput, ConnectorCheck, ConnectorEnvironment, ConnectorImport, ConnectorInput, ConnectorPatch, ConnectorResponse, ContactPropertyValue, ContactStatus, DashboardLink, DeployFile, Deployment, DeploymentFiles, DesignSectionRead, DesignSpec, DevEnvironment, DnsRecord, DnsRecordInput, DnsRecordList, 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, EnvVarInfo, ExportInput, FileEnvironment, FileList, FileListOptions, FileUploadOptions, HealthList, HealthRun, HealthStatus, HostKind, ImageRequest, ImageResult, InboxSettings, KeyAccess, KeyPermission, KeyPresetChoice, LedgerEntry, Mailbox, MailboxInput, MailDomain, MailFolder, MailReplyInput, MailSendInput, MailThreadDetail, MailThreadList, MailView, MediaModelInfo, MetricsReport, MissionControl, MissionControlLayout, Operation, OwnAccountLink, OwnedDomain, OwnedDomainList, OwnerStripe, OwnerStripeApply, OwnerStripeDisconnect, OwnerStripeLink, Payment, PaymentPrice, PaymentPriceInput, PaymentProduct, PaymentSubscription, PaymentsAccount, PaymentsEnvironment, PaymentsList, PaymentsSimulation, PhoneAnsweringInput, PhoneCall, PhoneCallInput, PhoneCallList, PhoneMessage, PhoneMessageList, PhoneNumber, PhoneNumberList, PhoneQuote, PhoneRegistrationInput, PhoneRegistrationRequirements, PhoneSearch, PhoneSendInput, PhoneThreadList, Project, ProjectExport, ProjectHealth, ProjectSearch, ReplayDetail, ReplayFrames, ReplayFramesOptions, ReplayInsights, ReplayListOptions, ReplayPeriod, ReplayStatus, ReplaySummary, Resource, ResourceType, SearchConnectionList, SearchPageList, SecretLink, SegmentFilter, SendEmailInput, SendEmailOutput, SocialAccount, SocialAccountAnalytics, SocialAdCampaign, SocialAdChange, SocialAdChangeInput, SocialCampaignCreateInput, SocialConnectLink, SocialEnvironment, SocialMedia, SocialOverview, SocialPost, SocialPostAnalytics, SocialPostInput, SpeechRequest, Transcription, UsageOptions, UsagePeriod, UsageReport, VersionDiff, VersionList, VersionRestore, 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.
|
|
@@ -1060,6 +1060,17 @@ export declare class Vibiz {
|
|
|
1060
1060
|
all?: boolean;
|
|
1061
1061
|
q?: string;
|
|
1062
1062
|
}) => Promise<AiModelInfo[]>;
|
|
1063
|
+
/**
|
|
1064
|
+
* Every image and video model that runs by its id (Kling, Seedance,
|
|
1065
|
+
* face swap, upscalers…), with its live price. Run one with
|
|
1066
|
+
* `jobs.create({ type, model: id, input: { prompt, model_input } })`:
|
|
1067
|
+
* charged from credits.
|
|
1068
|
+
*/
|
|
1069
|
+
mediaModels: (opts?: {
|
|
1070
|
+
q?: string;
|
|
1071
|
+
category?: string;
|
|
1072
|
+
limit?: number;
|
|
1073
|
+
}) => Promise<MediaModelInfo[]>;
|
|
1063
1074
|
jobs: {
|
|
1064
1075
|
create: (input: {
|
|
1065
1076
|
type: "image" | "video";
|
|
@@ -1069,11 +1080,21 @@ export declare class Vibiz {
|
|
|
1069
1080
|
n?: number;
|
|
1070
1081
|
size?: string;
|
|
1071
1082
|
aspect_ratio?: "16:9" | "9:16" | "1:1";
|
|
1072
|
-
/**
|
|
1083
|
+
/** Video: a still to animate. Image: a photo to edit. A public https URL. */
|
|
1084
|
+
image_url?: string;
|
|
1085
|
+
/** Image: more photos to combine, at most 8 with `image_url`. */
|
|
1086
|
+
image_urls?: string[];
|
|
1087
|
+
/**
|
|
1088
|
+
* With a model run by its id (`ai.mediaModels`): that model's own
|
|
1089
|
+
* parameters (face images, duration, …), at most 16 KB.
|
|
1090
|
+
*/
|
|
1091
|
+
model_input?: Record<string, unknown>;
|
|
1092
|
+
/** The older name of `model_input`. */
|
|
1073
1093
|
fal_input?: Record<string, unknown>;
|
|
1074
1094
|
};
|
|
1075
1095
|
}, opts?: {
|
|
1076
1096
|
idempotencyKey?: string;
|
|
1097
|
+
project?: string;
|
|
1077
1098
|
}) => Promise<AiJob>;
|
|
1078
1099
|
get: (id: string) => Promise<AiJob>;
|
|
1079
1100
|
cancel: (id: string) => Promise<AiJob>;
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ function noBodyMessage(status) {
|
|
|
5
5
|
if (status === 413) return "Too large (413): send less at once.";
|
|
6
6
|
if (status === 429) return "Too many requests (429): wait a moment and retry.";
|
|
7
7
|
if (status >= 500) {
|
|
8
|
-
return `The
|
|
8
|
+
return `The thelastapi API did not answer properly (${status}). It is usually brief: retry in a minute.`;
|
|
9
9
|
}
|
|
10
10
|
return `The request failed with ${status} and no explanation from the API.`;
|
|
11
11
|
}
|
|
@@ -41,7 +41,7 @@ var Vibiz = class {
|
|
|
41
41
|
constructor(options) {
|
|
42
42
|
this.options = options;
|
|
43
43
|
if (!options.baseUrl) {
|
|
44
|
-
throw new Error("No
|
|
44
|
+
throw new Error("No thelastapi API URL: pass baseUrl (CLI: --api, or VIBIZ_API_URL).");
|
|
45
45
|
}
|
|
46
46
|
this.baseUrl = options.baseUrl.replace(/\/$/, "");
|
|
47
47
|
this.fetchImpl = options.fetch ?? globalThis.fetch;
|
|
@@ -54,6 +54,7 @@ var Vibiz = class {
|
|
|
54
54
|
if (init.body !== void 0) headers["content-type"] = "application/json";
|
|
55
55
|
if (init.raw) headers["content-type"] = init.contentType ?? "application/octet-stream";
|
|
56
56
|
if (init.idempotencyKey) headers["idempotency-key"] = init.idempotencyKey;
|
|
57
|
+
if (init.project) headers["x-vibiz-project"] = init.project;
|
|
57
58
|
if (this.options.user) headers["x-vibiz-user"] = endUserHeader(this.options.user);
|
|
58
59
|
if (this.options.client) headers["x-vibiz-client"] = this.options.client;
|
|
59
60
|
return this.fetchImpl(`${this.baseUrl}/v1${path}`, {
|
|
@@ -1219,6 +1220,22 @@ var Vibiz = class {
|
|
|
1219
1220
|
const tail = qs2.size ? `?${qs2}` : "";
|
|
1220
1221
|
return this.request(`/ai/models${tail}`).then((r) => r.data);
|
|
1221
1222
|
},
|
|
1223
|
+
/**
|
|
1224
|
+
* Every image and video model that runs by its id (Kling, Seedance,
|
|
1225
|
+
* face swap, upscalers…), with its live price. Run one with
|
|
1226
|
+
* `jobs.create({ type, model: id, input: { prompt, model_input } })`:
|
|
1227
|
+
* charged from credits.
|
|
1228
|
+
*/
|
|
1229
|
+
mediaModels: (opts = {}) => {
|
|
1230
|
+
const qs2 = new URLSearchParams();
|
|
1231
|
+
if (opts.q) qs2.set("q", opts.q);
|
|
1232
|
+
if (opts.category) qs2.set("category", opts.category);
|
|
1233
|
+
if (opts.limit) qs2.set("limit", String(opts.limit));
|
|
1234
|
+
const tail = qs2.size ? `?${qs2}` : "";
|
|
1235
|
+
return this.request(`/ai/media-models${tail}`).then(
|
|
1236
|
+
(r) => r.data
|
|
1237
|
+
);
|
|
1238
|
+
},
|
|
1222
1239
|
jobs: {
|
|
1223
1240
|
create: (input, opts = {}) => this.request("/ai/jobs", { method: "POST", body: input, ...opts }),
|
|
1224
1241
|
get: (id) => this.request(`/ai/jobs/${id}`),
|
|
@@ -1738,7 +1755,7 @@ function deployPathProblem(path) {
|
|
|
1738
1755
|
return "looks like a credential (a private key or a token file), which is never deployed";
|
|
1739
1756
|
if (PRIVATE_DIRS.includes(part)) return `is inside ${part}, a home or config folder`;
|
|
1740
1757
|
if (IGNORED.has(part))
|
|
1741
|
-
return part === "vibiz.json" ? "is vibiz.json, the local link to the project, which is never deployed" : `is inside ${part}, which is never deployed (dependencies, VCS data or build output:
|
|
1758
|
+
return part === "vibiz.json" ? "is vibiz.json, the local link to the project, which is never deployed" : `is inside ${part}, which is never deployed (dependencies, VCS data or build output: thelastapi installs and builds the app itself)`;
|
|
1742
1759
|
}
|
|
1743
1760
|
return null;
|
|
1744
1761
|
}
|
|
@@ -1978,14 +1995,14 @@ function formatMinor(minor, currency) {
|
|
|
1978
1995
|
}
|
|
1979
1996
|
|
|
1980
1997
|
// packages/sdk/src/one-key.ts
|
|
1981
|
-
var APP_SDK_VERSION = "0.3.
|
|
1998
|
+
var APP_SDK_VERSION = "0.3.15";
|
|
1982
1999
|
var ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
|
|
1983
2000
|
function oneKeyMessage(url, host) {
|
|
1984
2001
|
const where = host ?? "your host";
|
|
1985
|
-
return `Add one key to ${where} and your app can use everything on
|
|
2002
|
+
return `Add one key to ${where} and your app can use everything on thelastapi (${ONE_KEY_GIVES}): copy VIBIZ_APP_KEY here: ${url} , paste it into ${host ? `${host}'s` : "your host's"} production environment variables, and redeploy.`;
|
|
1986
2003
|
}
|
|
1987
2004
|
function connectHostMessage(kind, host) {
|
|
1988
|
-
return `Or connect ${host ?? "the host"} once (vibiz hosts add ${kind ?? "<host>"} <app>) and
|
|
2005
|
+
return `Or connect ${host ?? "the host"} once (vibiz hosts add ${kind ?? "<host>"} <app>) and thelastapi keeps every variable in sync.`;
|
|
1989
2006
|
}
|
|
1990
2007
|
export {
|
|
1991
2008
|
APP_SDK_VERSION,
|
package/dist/one-key.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* (`npm install --save-exact @vibiz/app@<this>`). A test keeps it, the skills
|
|
11
11
|
* and the docs equal to packages/app/package.json.
|
|
12
12
|
*/
|
|
13
|
-
export declare const APP_SDK_VERSION = "0.3.
|
|
13
|
+
export declare const APP_SDK_VERSION = "0.3.15";
|
|
14
14
|
/** Everything one app key reaches. */
|
|
15
15
|
export declare const ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
|
|
16
16
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -1409,11 +1409,33 @@ export interface ImageRequest {
|
|
|
1409
1409
|
/** `b64_json` (default) or `url`: a Vibiz link valid for a day. */
|
|
1410
1410
|
response_format?: 'b64_json' | 'url';
|
|
1411
1411
|
/**
|
|
1412
|
-
*
|
|
1413
|
-
*
|
|
1412
|
+
* A photo to edit or start from, public https (a Files link works): the
|
|
1413
|
+
* prompt says what to change. vibiz/image, vibiz/image-pro, vibiz/image-text.
|
|
1414
1414
|
*/
|
|
1415
|
+
image_url?: string;
|
|
1416
|
+
/** Several photos to combine (a person and a product…), at most 8 with `image_url`. */
|
|
1417
|
+
image_urls?: string[];
|
|
1418
|
+
/**
|
|
1419
|
+
* With a model run by its id (`ai.mediaModels`): that model's own
|
|
1420
|
+
* parameters, merged into what it receives (at most 16 KB).
|
|
1421
|
+
*/
|
|
1422
|
+
model_input?: Record<string, unknown>;
|
|
1423
|
+
/** The older name of `model_input`. */
|
|
1415
1424
|
fal_input?: Record<string, unknown>;
|
|
1416
1425
|
}
|
|
1426
|
+
/** An entry of `GET /v1/ai/media-models`: an image or video model that runs by its id. */
|
|
1427
|
+
export interface MediaModelInfo {
|
|
1428
|
+
id: string;
|
|
1429
|
+
name: string;
|
|
1430
|
+
category: string;
|
|
1431
|
+
description: string;
|
|
1432
|
+
type: 'image' | 'video';
|
|
1433
|
+
/** The live price per unit (image, megapixel, video, seconds…), in USD. */
|
|
1434
|
+
price: {
|
|
1435
|
+
unit: string;
|
|
1436
|
+
usd: number;
|
|
1437
|
+
} | null;
|
|
1438
|
+
}
|
|
1417
1439
|
export interface ImageResult {
|
|
1418
1440
|
created: number;
|
|
1419
1441
|
model: string;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibiz/sdk",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"description": "Typed client for the
|
|
3
|
+
"version": "0.3.15",
|
|
4
|
+
"description": "Typed client for the thelastapi API: projects, hosting, databases, sign-in, email, AI, payments and more.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vibiz",
|
|
7
7
|
"sdk",
|