@vibiz/sdk 0.2.0 → 0.2.1

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 CHANGED
@@ -1,4 +1,9 @@
1
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';
2
+ /**
3
+ * An error status with no Vibiz error body: a proxy, a load balancer or the
4
+ * network answered instead of the API. Say so, and what to do.
5
+ */
6
+ export declare function noBodyMessage(status: number): string;
2
7
  export declare class VibizApiError extends Error {
3
8
  readonly status: number;
4
9
  readonly code: string;
@@ -16,6 +21,8 @@ export interface VibizOptions {
16
21
  * not an email.
17
22
  */
18
23
  user?: string;
24
+ /** Who is calling, sent as `X-Vibiz-Client` (the CLI: `vibiz-cli/<version>`), so the API can ask an old one to update. */
25
+ client?: string;
19
26
  }
20
27
  /**
21
28
  * The typed client for the Vibiz Stack API. Used by the CLI, by Principia's
@@ -67,7 +74,7 @@ export declare class Vibiz {
67
74
  project_id: string;
68
75
  usage: ActionUsage | null;
69
76
  }>;
70
- /** The production env. Owner keys only: an agent key gets `forbidden` (use `dev`). */
77
+ /** The production env. Full-access keys only: a Limited key gets `forbidden` (use `dev`). */
71
78
  env: (id: string) => Promise<Record<string, string>>;
72
79
  /** The production env's variable names, without values. Any key. */
73
80
  envNames: (id: string) => Promise<string[]>;
@@ -100,13 +107,13 @@ export declare class Vibiz {
100
107
  /** The app key (`vz_app_…`), per environment. The secret itself only ever travels in the env. */
101
108
  appKeys: {
102
109
  list: (id: string) => Promise<AppKeyInfo[]>;
103
- /** Production's needs an owner key. The old key works for `grace_seconds` (default 3600). */
110
+ /** Production's needs a full-access key. The old key works for `grace_seconds` (default 3600). */
104
111
  rotate: (id: string, opts?: {
105
112
  environment?: "production" | "development";
106
113
  grace_seconds?: number;
107
114
  }) => Promise<AppKeyInfo>;
108
115
  };
109
- /** Hosts outside Vibiz that receive the env server to server. Connecting needs an owner key. */
116
+ /** Hosts outside Vibiz that receive the env server to server. Connecting needs a full-access key. */
110
117
  hosts: {
111
118
  list: (id: string) => Promise<EnvTargetInfo[]>;
112
119
  add: (id: string, input: {
@@ -125,7 +132,7 @@ export declare class Vibiz {
125
132
  }) => Promise<EnvTargetInfo>;
126
133
  };
127
134
  /**
128
- * The app's own database. `production` needs an owner key (it holds the
135
+ * The app's own database. `production` needs a full-access key (it holds the
129
136
  * app's users' data); agents read `development`, the default for them.
130
137
  */
131
138
  database: {
@@ -143,7 +150,7 @@ export declare class Vibiz {
143
150
  };
144
151
  /**
145
152
  * How people sign in to the app (docs/SIGN-IN.md). `production` needs an
146
- * owner key; agents work on `development`, the default for them.
153
+ * full-access key; agents work on `development`, the default for them.
147
154
  */
148
155
  auth: {
149
156
  get: (id: string, env?: AuthEnvironment) => Promise<AuthSettings>;
@@ -160,7 +167,7 @@ export declare class Vibiz {
160
167
  /**
161
168
  * The business behind the project (docs/COMPANY.md). `env` defaults like
162
169
  * the API: production for owners, development for agents. Production
163
- * submit, signing, actions and documents need an owner key.
170
+ * submit, signing, actions and documents need a full-access key.
164
171
  */
165
172
  company: {
166
173
  get: (id: string, env?: CompanyEnvironment) => Promise<Company>;
@@ -174,7 +181,7 @@ export declare class Vibiz {
174
181
  deleted: true;
175
182
  }>;
176
183
  /**
177
- * Production files for real and charges the price: an owner key, `confirm: true`,
184
+ * Production files for real and charges the price: a full-access key, `confirm: true`,
178
185
  * and the `quote.total_cents` and `updated_at` of the draft that was reviewed
179
186
  * (a draft or price changed since is refused with a 409, not filed).
180
187
  */
@@ -185,7 +192,7 @@ export declare class Vibiz {
185
192
  expected_updated_at?: string;
186
193
  }, env?: CompanyEnvironment) => Promise<Company>;
187
194
  /**
188
- * Pay a live filing by card instead of from the balance (owner keys): the same
195
+ * Pay a live filing by card instead of from the balance (full-access keys): the same
189
196
  * body as `submit`; it is filed when the payment arrives (docs/BILLING.md "Company").
190
197
  */
191
198
  checkout: (id: string, input: {
@@ -318,7 +325,7 @@ export declare class Vibiz {
318
325
  * Payments (docs/PAYMENTS.md): Vibiz is the merchant, so an app sells from
319
326
  * its first call. `env` defaults like the API: production for owners,
320
327
  * development for agents. On production, refunds, cancels, withdrawing,
321
- * payout setup and webhook settings need an owner key.
328
+ * payout setup and webhook settings need a full-access key.
322
329
  */
323
330
  payments: {
324
331
  get: (id: string, env?: PaymentsEnvironment) => Promise<PaymentsAccount>;
@@ -412,7 +419,7 @@ export declare class Vibiz {
412
419
  * Custom connectors (docs/CONNECTORS.md): any HTTP API from one manifest,
413
420
  * called through Vibiz, which holds the key. `env` defaults like the API:
414
421
  * production for owners, development for agents. Production keys, and
415
- * approving an agent's dangerous call, need an owner key.
422
+ * approving an agent's dangerous call, need a full-access key.
416
423
  */
417
424
  connectors: {
418
425
  list: (id: string) => Promise<Connector[]>;
@@ -429,10 +436,10 @@ export declare class Vibiz {
429
436
  }) => Promise<ConnectorImport>;
430
437
  update: (id: string, name: string, patch: ConnectorPatch) => Promise<Connector>;
431
438
  delete: (id: string, name: string) => Promise<Connector>;
432
- /** Set values (`null` removes). Production: owner keys. Values are never read back. */
439
+ /** Set values (`null` removes). Production: full-access keys. Values are never read back. */
433
440
  setSecrets: (id: string, name: string, values: Record<string, string | null>, env?: ConnectorEnvironment) => Promise<Connector>;
434
441
  check: (id: string, name: string, env?: ConnectorEnvironment) => Promise<ConnectorCheck>;
435
- /** One operation. A dangerous one (or a production write) by an agent key answers 403 approval_required. */
442
+ /** One operation. A dangerous one (or a production write) by a Limited key answers 403 approval_required. */
436
443
  call: <T = unknown>(id: string, name: string, input: ConnectorCallInput, opts?: {
437
444
  env?: ConnectorEnvironment;
438
445
  idempotencyKey?: string;
@@ -446,15 +453,15 @@ export declare class Vibiz {
446
453
  status?: ConnectorApproval["status"];
447
454
  }) => Promise<ConnectorApproval[]>;
448
455
  approval: (id: string, approvalId: string) => Promise<ConnectorApproval>;
449
- /** Owner keys. */
456
+ /** Full-access keys. */
450
457
  approve: (id: string, approvalId: string) => Promise<ConnectorApproval>;
451
- /** Owner keys. */
458
+ /** Full-access keys. */
452
459
  deny: (id: string, approvalId: string) => Promise<ConnectorApproval>;
453
460
  };
454
461
  /**
455
462
  * The owner's own domains: served by Vibiz hosting (with HTTPS once DNS
456
463
  * points at it) or trusted for a host elsewhere. Adding and removing need
457
- * an owner key; any key reads status and asks for a re-check.
464
+ * a full-access key; any key reads status and asks for a re-check.
458
465
  */
459
466
  domains: {
460
467
  list: (id: string) => Promise<DomainList>;
@@ -468,8 +475,8 @@ export declare class Vibiz {
468
475
  verify: (id: string, domain: string) => Promise<Domain>;
469
476
  remove: (id: string, domain: string) => Promise<DomainList>;
470
477
  /**
471
- * Owner keys: buy a domain from the account's credits; it serves on this
472
- * project once registered. An agent key answers `owner_only` with the
478
+ * Full-access keys: buy a domain from the account's credits; it serves on this
479
+ * project once registered. A Limited key answers `owner_only` with the
473
480
  * console link to hand the owner.
474
481
  */
475
482
  buy: (id: string, input: DomainBuyInput) => Promise<OwnedDomain>;
@@ -546,7 +553,7 @@ export declare class Vibiz {
546
553
  /** One of its files, from its signed link (no key sent). */
547
554
  download: (url: string) => Promise<Response>;
548
555
  /**
549
- * The environment's secret values as `.env` text. Owner keys only; the
556
+ * The environment's secret values as `.env` text. Full-access keys only; the
550
557
  * call itself is the confirmation, so only make it when the person asked.
551
558
  */
552
559
  envFile: (projectId: string, exportId: string) => Promise<string>;
@@ -906,7 +913,7 @@ export declare class Vibiz {
906
913
  * Your own AI provider keys (docs/AI.md "Your own keys"): calls they can
907
914
  * serve run only on them (never falling back to Vibiz) and cost 0 here.
908
915
  * Pass `projectId` for a project's override. Setting and removing need an
909
- * owner key. Secrets are write-only: no method returns one.
916
+ * full-access key. Secrets are write-only: no method returns one.
910
917
  */
911
918
  readonly aiKeys: {
912
919
  list: (opts?: {
@@ -940,7 +947,7 @@ export declare class Vibiz {
940
947
  /**
941
948
  * Buying domains (docs: buying a domain): search and quote with any key;
942
949
  * the domains the account owns, auto-renew, renewals, the transfer code and
943
- * the owner details (the registrant, saved once) need an owner key.
950
+ * the owner details (the registrant, saved once) need a full-access key.
944
951
  */
945
952
  readonly domains: {
946
953
  search: (q: string, opts?: {
@@ -970,7 +977,7 @@ export declare class Vibiz {
970
977
  /**
971
978
  * Email forwarding (docs: email ▸ Forwarding): `hello@<domain>` → the
972
979
  * owner's inbox, sent "via Vibiz". Anyone reads and verifies; `set` and
973
- * `off` need an owner key (an agent gets `owner_only` with a console link
980
+ * `off` need a full-access key (an agent gets `owner_only` with a console link
974
981
  * that has its proposal filled in).
975
982
  */
976
983
  forwarding: {
@@ -1034,7 +1041,7 @@ export declare class Vibiz {
1034
1041
  folder?: MailFolder;
1035
1042
  labels?: string[];
1036
1043
  }) => Promise<MailThreadDetail>;
1037
- /** Owner keys; only from trash or spam. */
1044
+ /** Full-access keys; only from trash or spam. */
1038
1045
  delete: (id: string) => Promise<{
1039
1046
  object: "mail_thread";
1040
1047
  id: string;
@@ -1068,7 +1075,7 @@ export declare class Vibiz {
1068
1075
  }>;
1069
1076
  settings: {
1070
1077
  get: () => Promise<InboxSettings>;
1071
- /** Owner keys: the new-mail digest. */
1078
+ /** Full-access keys: the new-mail digest. */
1072
1079
  update: (input: {
1073
1080
  digest?: boolean;
1074
1081
  }) => Promise<InboxSettings>;
@@ -1080,7 +1087,7 @@ export declare class Vibiz {
1080
1087
  */
1081
1088
  readonly billing: {
1082
1089
  get: () => Promise<Billing>;
1083
- /** Owner keys: auto-recharge and the daily safety cap. */
1090
+ /** Full-access keys: auto-recharge and the daily safety cap. */
1084
1091
  update: (input: BillingUpdate) => Promise<Billing>;
1085
1092
  /** A payment page for `amount_cents` (500–100000); hand its `url` to a person. */
1086
1093
  checkout: (input: {
@@ -1088,7 +1095,7 @@ export declare class Vibiz {
1088
1095
  save_card?: boolean;
1089
1096
  }) => Promise<BillingCheckout>;
1090
1097
  checkoutStatus: (id: string) => Promise<BillingCheckout>;
1091
- /** Owner keys: a page to save or replace the card. */
1098
+ /** Full-access keys: a page to save or replace the card. */
1092
1099
  saveCard: () => Promise<BillingCheckout>;
1093
1100
  removeCard: () => Promise<Billing>;
1094
1101
  ledger: (opts?: {
@@ -1111,13 +1118,18 @@ export declare class Vibiz {
1111
1118
  /** Named keys, one per teammate or agent, so spend shows per person. */
1112
1119
  readonly apiKeys: {
1113
1120
  list: () => Promise<ApiKey[]>;
1114
- /** The secret is returned once, here. */
1115
- /** `agent` by default: builds and runs, never reads production secrets. Needs an owner key. */
1121
+ /**
1122
+ * The secret is returned once, here. Full access (`owner`) by default;
1123
+ * `access: 'agent'` makes it Limited (builds and runs, never reads
1124
+ * production secrets nor moves live money). Needs a full-access key.
1125
+ */
1116
1126
  create: (name: string, opts?: {
1117
1127
  access?: KeyAccess;
1118
1128
  }) => Promise<ApiKey & {
1119
1129
  secret: string;
1120
1130
  }>;
1131
+ /** Full access (`owner`) or Limited (`agent`), afterwards. Needs a full-access key, not this one. */
1132
+ setAccess: (id: string, access: KeyAccess) => Promise<ApiKey>;
1121
1133
  revoke: (id: string) => Promise<ApiKey>;
1122
1134
  };
1123
1135
  /** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
package/dist/index.js CHANGED
@@ -1,4 +1,14 @@
1
1
  // packages/sdk/src/client.ts
2
+ function noBodyMessage(status) {
3
+ if (status === 401) return "Not signed in (401): the API key is missing or was revoked.";
4
+ if (status === 404) return "Not found (404): check the API URL and the id.";
5
+ if (status === 413) return "Too large (413): send less at once.";
6
+ if (status === 429) return "Too many requests (429): wait a moment and retry.";
7
+ if (status >= 500) {
8
+ return `The Vibiz API did not answer properly (${status}). It is usually brief: retry in a minute.`;
9
+ }
10
+ return `The request failed with ${status} and no explanation from the API.`;
11
+ }
2
12
  var VibizApiError = class extends Error {
3
13
  constructor(status, code, message, details) {
4
14
  super(message);
@@ -30,6 +40,7 @@ var Vibiz = class {
30
40
  if (init.raw) headers["content-type"] = init.contentType ?? "application/octet-stream";
31
41
  if (init.idempotencyKey) headers["idempotency-key"] = init.idempotencyKey;
32
42
  if (this.options.user) headers["x-vibiz-user"] = endUserHeader(this.options.user);
43
+ if (this.options.client) headers["x-vibiz-client"] = this.options.client;
33
44
  return this.fetchImpl(`${this.baseUrl}/v1${path}`, {
34
45
  method: init.method ?? "GET",
35
46
  headers,
@@ -42,7 +53,7 @@ var Vibiz = class {
42
53
  throw new VibizApiError(
43
54
  res.status,
44
55
  e?.code ?? "http_error",
45
- e?.message ?? `HTTP ${res.status}`,
56
+ e?.message ?? noBodyMessage(res.status),
46
57
  e?.details
47
58
  );
48
59
  }
@@ -61,7 +72,7 @@ var Vibiz = class {
61
72
  throw new VibizApiError(
62
73
  res.status,
63
74
  e?.code ?? "http_error",
64
- e?.message ?? `HTTP ${res.status}`,
75
+ e?.message ?? noBodyMessage(res.status),
65
76
  e?.details
66
77
  );
67
78
  }
@@ -102,7 +113,7 @@ var Vibiz = class {
102
113
  `/projects/${id}/actions/${name}`,
103
114
  { method: "POST", body: { input }, ...opts }
104
115
  ),
105
- /** The production env. Owner keys only: an agent key gets `forbidden` (use `dev`). */
116
+ /** The production env. Full-access keys only: a Limited key gets `forbidden` (use `dev`). */
106
117
  env: (id) => this.request(`/projects/${id}/env`).then((r) => r.env),
107
118
  /** The production env's variable names, without values. Any key. */
108
119
  envNames: (id) => this.request(`/projects/${id}/env?names=1`).then((r) => r.names),
@@ -154,10 +165,10 @@ var Vibiz = class {
154
165
  /** The app key (`vz_app_…`), per environment. The secret itself only ever travels in the env. */
155
166
  appKeys: {
156
167
  list: (id) => this.request(`/projects/${id}/app-keys`).then((r) => r.data),
157
- /** Production's needs an owner key. The old key works for `grace_seconds` (default 3600). */
168
+ /** Production's needs a full-access key. The old key works for `grace_seconds` (default 3600). */
158
169
  rotate: (id, opts = {}) => this.request(`/projects/${id}/app-keys/rotate`, { method: "POST", body: opts })
159
170
  },
160
- /** Hosts outside Vibiz that receive the env server to server. Connecting needs an owner key. */
171
+ /** Hosts outside Vibiz that receive the env server to server. Connecting needs a full-access key. */
161
172
  hosts: {
162
173
  list: (id) => this.request(`/projects/${id}/hosts`).then((r) => r.data),
163
174
  add: (id, input) => this.request(`/projects/${id}/hosts`, { method: "POST", body: input }),
@@ -171,7 +182,7 @@ var Vibiz = class {
171
182
  )
172
183
  },
173
184
  /**
174
- * The app's own database. `production` needs an owner key (it holds the
185
+ * The app's own database. `production` needs a full-access key (it holds the
175
186
  * app's users' data); agents read `development`, the default for them.
176
187
  */
177
188
  database: {
@@ -186,7 +197,7 @@ var Vibiz = class {
186
197
  },
187
198
  /**
188
199
  * How people sign in to the app (docs/SIGN-IN.md). `production` needs an
189
- * owner key; agents work on `development`, the default for them.
200
+ * full-access key; agents work on `development`, the default for them.
190
201
  */
191
202
  auth: {
192
203
  get: (id, env) => this.request(`/projects/${id}/auth/settings${env ? `?env=${env}` : ""}`),
@@ -212,7 +223,7 @@ var Vibiz = class {
212
223
  /**
213
224
  * The business behind the project (docs/COMPANY.md). `env` defaults like
214
225
  * the API: production for owners, development for agents. Production
215
- * submit, signing, actions and documents need an owner key.
226
+ * submit, signing, actions and documents need a full-access key.
216
227
  */
217
228
  company: {
218
229
  get: (id, env) => this.request(`/projects/${id}/company${envQuery(env)}`),
@@ -231,7 +242,7 @@ var Vibiz = class {
231
242
  { method: "DELETE" }
232
243
  ),
233
244
  /**
234
- * Production files for real and charges the price: an owner key, `confirm: true`,
245
+ * Production files for real and charges the price: a full-access key, `confirm: true`,
235
246
  * and the `quote.total_cents` and `updated_at` of the draft that was reviewed
236
247
  * (a draft or price changed since is refused with a 409, not filed).
237
248
  */
@@ -240,7 +251,7 @@ var Vibiz = class {
240
251
  body: input
241
252
  }),
242
253
  /**
243
- * Pay a live filing by card instead of from the balance (owner keys): the same
254
+ * Pay a live filing by card instead of from the balance (full-access keys): the same
244
255
  * body as `submit`; it is filed when the payment arrives (docs/BILLING.md "Company").
245
256
  */
246
257
  checkout: (id, input) => this.request(`/projects/${id}/company/checkout?env=production`, {
@@ -354,7 +365,7 @@ var Vibiz = class {
354
365
  * Payments (docs/PAYMENTS.md): Vibiz is the merchant, so an app sells from
355
366
  * its first call. `env` defaults like the API: production for owners,
356
367
  * development for agents. On production, refunds, cancels, withdrawing,
357
- * payout setup and webhook settings need an owner key.
368
+ * payout setup and webhook settings need a full-access key.
358
369
  */
359
370
  payments: {
360
371
  get: (id, env) => this.request(`/projects/${id}/payments${envQuery(env)}`),
@@ -466,7 +477,7 @@ var Vibiz = class {
466
477
  * Custom connectors (docs/CONNECTORS.md): any HTTP API from one manifest,
467
478
  * called through Vibiz, which holds the key. `env` defaults like the API:
468
479
  * production for owners, development for agents. Production keys, and
469
- * approving an agent's dangerous call, need an owner key.
480
+ * approving an agent's dangerous call, need a full-access key.
470
481
  */
471
482
  connectors: {
472
483
  list: (id) => this.request(`/projects/${id}/connectors`).then((r) => r.data),
@@ -485,7 +496,7 @@ var Vibiz = class {
485
496
  delete: (id, name) => this.request(`/projects/${id}/connectors/${encodeURIComponent(name)}`, {
486
497
  method: "DELETE"
487
498
  }),
488
- /** Set values (`null` removes). Production: owner keys. Values are never read back. */
499
+ /** Set values (`null` removes). Production: full-access keys. Values are never read back. */
489
500
  setSecrets: (id, name, values, env) => this.request(
490
501
  `/projects/${id}/connectors/${encodeURIComponent(name)}/secrets${envQuery(env)}`,
491
502
  { method: "PUT", body: { values } }
@@ -494,7 +505,7 @@ var Vibiz = class {
494
505
  `/projects/${id}/connectors/${encodeURIComponent(name)}/check${envQuery(env)}`,
495
506
  { method: "POST", body: {} }
496
507
  ),
497
- /** One operation. A dangerous one (or a production write) by an agent key answers 403 approval_required. */
508
+ /** One operation. A dangerous one (or a production write) by a Limited key answers 403 approval_required. */
498
509
  call: (id, name, input, opts = {}) => this.request(
499
510
  `/projects/${id}/connectors/${encodeURIComponent(name)}/call${envQuery(opts.env)}`,
500
511
  {
@@ -512,12 +523,12 @@ var Vibiz = class {
512
523
  approval: (id, approvalId) => this.request(
513
524
  `/projects/${id}/connectors/approvals/${encodeURIComponent(approvalId)}`
514
525
  ),
515
- /** Owner keys. */
526
+ /** Full-access keys. */
516
527
  approve: (id, approvalId) => this.request(
517
528
  `/projects/${id}/connectors/approvals/${encodeURIComponent(approvalId)}/approve`,
518
529
  { method: "POST", body: {} }
519
530
  ),
520
- /** Owner keys. */
531
+ /** Full-access keys. */
521
532
  deny: (id, approvalId) => this.request(
522
533
  `/projects/${id}/connectors/approvals/${encodeURIComponent(approvalId)}/deny`,
523
534
  { method: "POST", body: {} }
@@ -526,7 +537,7 @@ var Vibiz = class {
526
537
  /**
527
538
  * The owner's own domains: served by Vibiz hosting (with HTTPS once DNS
528
539
  * points at it) or trusted for a host elsewhere. Adding and removing need
529
- * an owner key; any key reads status and asks for a re-check.
540
+ * a full-access key; any key reads status and asks for a re-check.
530
541
  */
531
542
  domains: {
532
543
  list: (id) => this.request(`/projects/${id}/domains`),
@@ -544,8 +555,8 @@ var Vibiz = class {
544
555
  method: "DELETE"
545
556
  }),
546
557
  /**
547
- * Owner keys: buy a domain from the account's credits; it serves on this
548
- * project once registered. An agent key answers `owner_only` with the
558
+ * Full-access keys: buy a domain from the account's credits; it serves on this
559
+ * project once registered. A Limited key answers `owner_only` with the
549
560
  * console link to hand the owner.
550
561
  */
551
562
  buy: (id, input) => this.request(`/projects/${id}/domains/buy`, { method: "POST", body: input })
@@ -653,7 +664,7 @@ var Vibiz = class {
653
664
  return res;
654
665
  },
655
666
  /**
656
- * The environment's secret values as `.env` text. Owner keys only; the
667
+ * The environment's secret values as `.env` text. Full-access keys only; the
657
668
  * call itself is the confirmation, so only make it when the person asked.
658
669
  */
659
670
  envFile: async (projectId, exportId) => {
@@ -1034,7 +1045,7 @@ var Vibiz = class {
1034
1045
  * Your own AI provider keys (docs/AI.md "Your own keys"): calls they can
1035
1046
  * serve run only on them (never falling back to Vibiz) and cost 0 here.
1036
1047
  * Pass `projectId` for a project's override. Setting and removing need an
1037
- * owner key. Secrets are write-only: no method returns one.
1048
+ * full-access key. Secrets are write-only: no method returns one.
1038
1049
  */
1039
1050
  aiKeys = {
1040
1051
  list: (opts = {}) => this.request(`${aiKeysBase(opts.projectId)}`),
@@ -1065,7 +1076,7 @@ var Vibiz = class {
1065
1076
  /**
1066
1077
  * Buying domains (docs: buying a domain): search and quote with any key;
1067
1078
  * the domains the account owns, auto-renew, renewals, the transfer code and
1068
- * the owner details (the registrant, saved once) need an owner key.
1079
+ * the owner details (the registrant, saved once) need a full-access key.
1069
1080
  */
1070
1081
  domains = {
1071
1082
  search: (q, opts = {}) => this.request(`/domains/search${qs({ q, project_id: opts.projectId })}`),
@@ -1088,7 +1099,7 @@ var Vibiz = class {
1088
1099
  /**
1089
1100
  * Email forwarding (docs: email ▸ Forwarding): `hello@<domain>` → the
1090
1101
  * owner's inbox, sent "via Vibiz". Anyone reads and verifies; `set` and
1091
- * `off` need an owner key (an agent gets `owner_only` with a console link
1102
+ * `off` need a full-access key (an agent gets `owner_only` with a console link
1092
1103
  * that has its proposal filled in).
1093
1104
  */
1094
1105
  forwarding: {
@@ -1147,7 +1158,7 @@ var Vibiz = class {
1147
1158
  method: "PATCH",
1148
1159
  body: input
1149
1160
  }),
1150
- /** Owner keys; only from trash or spam. */
1161
+ /** Full-access keys; only from trash or spam. */
1151
1162
  delete: (id) => this.request(
1152
1163
  `/inbox/threads/${encodeURIComponent(id)}`,
1153
1164
  { method: "DELETE" }
@@ -1178,7 +1189,7 @@ var Vibiz = class {
1178
1189
  }),
1179
1190
  settings: {
1180
1191
  get: () => this.request("/inbox/settings"),
1181
- /** Owner keys: the new-mail digest. */
1192
+ /** Full-access keys: the new-mail digest. */
1182
1193
  update: (input) => this.request("/inbox/settings", { method: "PATCH", body: input })
1183
1194
  }
1184
1195
  };
@@ -1188,12 +1199,12 @@ var Vibiz = class {
1188
1199
  */
1189
1200
  billing = {
1190
1201
  get: () => this.request("/billing"),
1191
- /** Owner keys: auto-recharge and the daily safety cap. */
1202
+ /** Full-access keys: auto-recharge and the daily safety cap. */
1192
1203
  update: (input) => this.request("/billing", { method: "PATCH", body: input }),
1193
1204
  /** A payment page for `amount_cents` (500–100000); hand its `url` to a person. */
1194
1205
  checkout: (input) => this.request("/billing/checkout", { method: "POST", body: input }),
1195
1206
  checkoutStatus: (id) => this.request(`/billing/checkout/${encodeURIComponent(id)}`),
1196
- /** Owner keys: a page to save or replace the card. */
1207
+ /** Full-access keys: a page to save or replace the card. */
1197
1208
  saveCard: () => this.request("/billing/card", { method: "POST", body: {} }),
1198
1209
  removeCard: () => this.request("/billing/card", { method: "DELETE" }),
1199
1210
  ledger: (opts = {}) => this.request(
@@ -1208,12 +1219,20 @@ var Vibiz = class {
1208
1219
  /** Named keys, one per teammate or agent, so spend shows per person. */
1209
1220
  apiKeys = {
1210
1221
  list: () => this.request("/api-keys").then((r) => r.data),
1211
- /** The secret is returned once, here. */
1212
- /** `agent` by default: builds and runs, never reads production secrets. Needs an owner key. */
1222
+ /**
1223
+ * The secret is returned once, here. Full access (`owner`) by default;
1224
+ * `access: 'agent'` makes it Limited (builds and runs, never reads
1225
+ * production secrets nor moves live money). Needs a full-access key.
1226
+ */
1213
1227
  create: (name, opts = {}) => this.request("/api-keys", {
1214
1228
  method: "POST",
1215
1229
  body: { name, ...opts.access ? { access: opts.access } : {} }
1216
1230
  }),
1231
+ /** Full access (`owner`) or Limited (`agent`), afterwards. Needs a full-access key, not this one. */
1232
+ setAccess: (id, access) => this.request(`/api-keys/${encodeURIComponent(id)}`, {
1233
+ method: "PATCH",
1234
+ body: { access }
1235
+ }),
1217
1236
  revoke: (id) => this.request(`/api-keys/${id}`, { method: "DELETE" })
1218
1237
  };
1219
1238
  /** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
package/dist/types.d.ts CHANGED
@@ -143,7 +143,7 @@ export interface DomainQuote {
143
143
  fields_needed: DomainOwnerField[];
144
144
  };
145
145
  buy_url?: string;
146
- /** This key may buy it directly (an agent key: the owner allowed agents, up to `agent_limit_cents`). */
146
+ /** This key may buy it directly (a Limited key: the owner allowed agents, up to `agent_limit_cents`). */
147
147
  can_buy?: boolean;
148
148
  agent_limit_cents?: number | null;
149
149
  next_step: string;
@@ -311,7 +311,7 @@ export interface Mailbox {
311
311
  display_name: string | null;
312
312
  signature: string | null;
313
313
  project_id: string | null;
314
- /** Agent keys may read and reply here (the owner decides). */
314
+ /** Limited keys may read and reply here (the owner decides). */
315
315
  agent_access: boolean;
316
316
  daily_send_cap: number;
317
317
  sent_today: number;
@@ -1343,7 +1343,10 @@ export interface MetricsReport {
1343
1343
  capability: string;
1344
1344
  }>;
1345
1345
  }
1346
- /** `owner`: everything. `agent`: builds and runs, never reads production secrets. */
1346
+ /**
1347
+ * `owner` (Full access, the default): everything the account's owner can do.
1348
+ * `agent` (Limited): builds and runs, never reads production secrets nor moves live money.
1349
+ */
1347
1350
  export type KeyAccess = 'owner' | 'agent';
1348
1351
  export interface ApiKey {
1349
1352
  object: 'api_key';
@@ -1521,7 +1524,7 @@ export interface CompanyPerson {
1521
1524
  roles: CompanyRole[];
1522
1525
  responsible_party: boolean;
1523
1526
  has_tax_id: boolean;
1524
- /** Owner keys only; null for agents. */
1527
+ /** Full-access keys only; null for agents. */
1525
1528
  tax_id_last4: string | null;
1526
1529
  }
1527
1530
  export interface CompanyPrice {
@@ -1611,7 +1614,7 @@ export interface CompanyDraft {
1611
1614
  ownership_percent?: number | null;
1612
1615
  roles?: CompanyRole[];
1613
1616
  responsible_party?: boolean;
1614
- /** SSN or ITIN. Owner keys only. Write-only. */
1617
+ /** SSN or ITIN. Full-access keys only. Write-only. */
1615
1618
  tax_id?: string | null;
1616
1619
  /** Keep the stored tax id of the person with this id. */
1617
1620
  id?: string;
@@ -1795,7 +1798,10 @@ export interface PaymentsAccount {
1795
1798
  };
1796
1799
  statement_descriptor: string;
1797
1800
  fees: {
1801
+ /** The Vibiz fee on this project's sales now, in basis points (200 = 2%), set per account. */
1798
1802
  platform_bps: number;
1803
+ /** The Vibiz fee on sales charged on the owner's own account (what connecting it would mean). */
1804
+ own_account_bps: number;
1799
1805
  /** The card fee for most US cards: card_fee_bps / 100 % + card_fee_fixed_cents. */
1800
1806
  card_fee_bps: number;
1801
1807
  card_fee_fixed_cents: number;
@@ -2648,7 +2654,7 @@ export interface ProjectExport {
2648
2654
  export interface ExportInput {
2649
2655
  /** Default: code, database (when there is one) and env_guide. */
2650
2656
  include?: ExportPart[];
2651
- /** Default: production for owner keys, development for agent keys. */
2657
+ /** Default: production for full-access keys, development for Limited keys. */
2652
2658
  env?: 'production' | 'development';
2653
2659
  /** Default: the live deployment. */
2654
2660
  deployment_id?: string;
@@ -3032,7 +3038,7 @@ export interface BroadcastReview {
3032
3038
  estimated_days: number;
3033
3039
  paced: boolean;
3034
3040
  };
3035
- /** Agent keys: the owner's monthly allowance. */
3041
+ /** Limited keys: the owner's monthly allowance. */
3036
3042
  agent?: {
3037
3043
  monthly_limit: number | null;
3038
3044
  used_this_month: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibiz/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Typed client for the Vibiz Stack API: projects, hosting, databases, sign-in, email, AI, payments and more.",
5
5
  "keywords": [
6
6
  "vibiz",