@vibiz/sdk 0.3.10 → 0.3.12

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,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, 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, 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.
@@ -9,6 +9,14 @@ export declare class VibizApiError extends Error {
9
9
  readonly code: string;
10
10
  readonly details?: unknown | undefined;
11
11
  constructor(status: number, code: string, message: string, details?: unknown | undefined);
12
+ private detail;
13
+ /**
14
+ * The permission a Limited key was refused for (`database.production:read`,
15
+ * or `*` when it needs Full access); undefined for other errors.
16
+ */
17
+ get permission(): string | undefined;
18
+ /** The console link that opens this key with that permission ready to allow (give it to the user). */
19
+ get grantUrl(): string | undefined;
12
20
  }
13
21
  export interface VibizOptions {
14
22
  apiKey: string;
@@ -734,6 +742,11 @@ export declare class Vibiz {
734
742
  }) => Promise<SearchConnectionList>;
735
743
  /** Owner: the Bing Webmaster API key, for every project. */
736
744
  connectBing: (apiKey: string) => Promise<SearchConnectionList>;
745
+ /**
746
+ * Owner: push pages Google hasn't crawled yet to Google's Indexing API
747
+ * (off by default; up to 200 a day per Google Cloud project).
748
+ */
749
+ setGooglePush: (enabled: boolean) => Promise<SearchConnectionList>;
737
750
  /** Owner: disconnect a Google account or the Bing key. */
738
751
  disconnect: (id: string) => Promise<{
739
752
  object: "search_connection";
@@ -1424,15 +1437,25 @@ export declare class Vibiz {
1424
1437
  /**
1425
1438
  * The secret is returned once, here. Full access (`owner`) by default;
1426
1439
  * `access: 'agent'` makes it Limited (builds and runs, never reads
1427
- * production secrets nor moves live money). Needs a full-access key.
1440
+ * production secrets nor moves live money), `preset: 'read_all'` Limited
1441
+ * that reads everything, `grants` Limited with those permissions
1442
+ * (`permissions()`). A Limited caller never gives more than it has.
1428
1443
  */
1429
1444
  create: (name: string, opts?: {
1430
1445
  access?: KeyAccess;
1446
+ preset?: KeyPresetChoice;
1447
+ grants?: string[];
1431
1448
  }) => Promise<ApiKey & {
1432
1449
  secret: string;
1433
1450
  }>;
1434
- /** Full access (`owner`) or Limited (`agent`), afterwards. Needs a full-access key, not this one. */
1451
+ /** Full access (`owner`) or Limited (`agent`), afterwards. Needs `keys:write`, and not this key. */
1435
1452
  setAccess: (id: string, access: KeyAccess) => Promise<ApiKey>;
1453
+ /** Full access, Read everything or Limited (`full`, `read_all`, `limited`), afterwards. */
1454
+ setPreset: (id: string, preset: KeyPresetChoice) => Promise<ApiKey>;
1455
+ /** A Limited key with exactly these permissions (replaces its list). */
1456
+ setGrants: (id: string, grants: string[]) => Promise<ApiKey>;
1457
+ /** Every permission a Limited key can be given, with its plain-words label. */
1458
+ permissions: () => Promise<KeyPermission[]>;
1436
1459
  revoke: (id: string) => Promise<ApiKey>;
1437
1460
  };
1438
1461
  /** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
@@ -1494,9 +1517,15 @@ export interface WhoAmI {
1494
1517
  prefix: string;
1495
1518
  kind: 'key' | 'console';
1496
1519
  access: 'owner' | 'agent';
1520
+ /** `full`, `read_all`, `custom` or `limited`. */
1521
+ preset?: 'full' | 'read_all' | 'custom' | 'limited';
1522
+ /** A Limited key's permissions. */
1523
+ grants?: string[];
1497
1524
  created_at: string;
1498
1525
  };
1499
1526
  role: 'tenant' | 'admin';
1527
+ /** Where the owner changes this key's permissions. */
1528
+ access_url?: string;
1500
1529
  }
1501
1530
  /**
1502
1531
  * Header values must be Latin-1, so an id outside printable ASCII (`用户-7`,
package/dist/index.js CHANGED
@@ -20,6 +20,21 @@ var VibizApiError = class extends Error {
20
20
  status;
21
21
  code;
22
22
  details;
23
+ detail(k) {
24
+ const d = this.details;
25
+ return d && typeof d[k] === "string" ? d[k] : void 0;
26
+ }
27
+ /**
28
+ * The permission a Limited key was refused for (`database.production:read`,
29
+ * or `*` when it needs Full access); undefined for other errors.
30
+ */
31
+ get permission() {
32
+ return this.detail("permission");
33
+ }
34
+ /** The console link that opens this key with that permission ready to allow (give it to the user). */
35
+ get grantUrl() {
36
+ return this.detail("grant_url");
37
+ }
23
38
  };
24
39
  var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
25
40
  var Vibiz = class {
@@ -860,6 +875,14 @@ var Vibiz = class {
860
875
  method: "POST",
861
876
  body: { api_key: apiKey }
862
877
  }),
878
+ /**
879
+ * Owner: push pages Google hasn't crawled yet to Google's Indexing API
880
+ * (off by default; up to 200 a day per Google Cloud project).
881
+ */
882
+ setGooglePush: (enabled) => this.request("/search/settings", {
883
+ method: "PATCH",
884
+ body: { google_push: enabled }
885
+ }),
863
886
  /** Owner: disconnect a Google account or the Bing key. */
864
887
  disconnect: (id) => this.request(
865
888
  `/search/connections/${id}`,
@@ -1520,17 +1543,31 @@ var Vibiz = class {
1520
1543
  /**
1521
1544
  * The secret is returned once, here. Full access (`owner`) by default;
1522
1545
  * `access: 'agent'` makes it Limited (builds and runs, never reads
1523
- * production secrets nor moves live money). Needs a full-access key.
1546
+ * production secrets nor moves live money), `preset: 'read_all'` Limited
1547
+ * that reads everything, `grants` Limited with those permissions
1548
+ * (`permissions()`). A Limited caller never gives more than it has.
1524
1549
  */
1525
1550
  create: (name, opts = {}) => this.request("/api-keys", {
1526
1551
  method: "POST",
1527
- body: { name, ...opts.access ? { access: opts.access } : {} }
1552
+ body: { name, ...opts }
1528
1553
  }),
1529
- /** Full access (`owner`) or Limited (`agent`), afterwards. Needs a full-access key, not this one. */
1554
+ /** Full access (`owner`) or Limited (`agent`), afterwards. Needs `keys:write`, and not this key. */
1530
1555
  setAccess: (id, access) => this.request(`/api-keys/${encodeURIComponent(id)}`, {
1531
1556
  method: "PATCH",
1532
1557
  body: { access }
1533
1558
  }),
1559
+ /** Full access, Read everything or Limited (`full`, `read_all`, `limited`), afterwards. */
1560
+ setPreset: (id, preset) => this.request(`/api-keys/${encodeURIComponent(id)}`, {
1561
+ method: "PATCH",
1562
+ body: { preset }
1563
+ }),
1564
+ /** A Limited key with exactly these permissions (replaces its list). */
1565
+ setGrants: (id, grants) => this.request(`/api-keys/${encodeURIComponent(id)}`, {
1566
+ method: "PATCH",
1567
+ body: { grants }
1568
+ }),
1569
+ /** Every permission a Limited key can be given, with its plain-words label. */
1570
+ permissions: () => this.request("/api-keys/permissions").then((r) => r.data),
1534
1571
  revoke: (id) => this.request(`/api-keys/${id}`, { method: "DELETE" })
1535
1572
  };
1536
1573
  /** A short-lived link to the hosted usage dashboard (admin scope needs an admin key). */
@@ -1941,7 +1978,7 @@ function formatMinor(minor, currency) {
1941
1978
  }
1942
1979
 
1943
1980
  // packages/sdk/src/one-key.ts
1944
- var APP_SDK_VERSION = "0.3.10";
1981
+ var APP_SDK_VERSION = "0.3.12";
1945
1982
  var ONE_KEY_GIVES = "database, sign-in, email and inbox, AI models, files, payments, analytics with session replays, web data, social, phone and connectors";
1946
1983
  function oneKeyMessage(url, host) {
1947
1984
  const where = host ?? "your host";
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.10";
13
+ export declare const APP_SDK_VERSION = "0.3.12";
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
@@ -156,6 +156,24 @@ export interface DomainQuote {
156
156
  key_url?: string;
157
157
  next_step: string;
158
158
  }
159
+ /**
160
+ * The `details` of a Limited key's refusal (code `forbidden`, reason
161
+ * `owner_only`): which permission, and the link that allows it.
162
+ */
163
+ export interface MissingPermissionDetails {
164
+ reason: 'owner_only';
165
+ /** `database.production:read`, or `*` when it needs Full access. */
166
+ permission?: string;
167
+ permission_label?: string;
168
+ key_id?: string;
169
+ /** The key's page with the permission ready to allow ("Allow this" / "Allow everything"). */
170
+ grant_url?: string;
171
+ /** The key's page. */
172
+ key_url?: string;
173
+ /** Where a person does the action by hand. */
174
+ console_url?: string;
175
+ next_step: string;
176
+ }
159
177
  /** The legal registrant domains are registered to, saved once per account. */
160
178
  export interface DomainOwnerContact {
161
179
  first_name: string;
@@ -1722,9 +1740,24 @@ export interface ApiKey {
1722
1740
  prefix: string;
1723
1741
  kind?: 'key' | 'console';
1724
1742
  access?: KeyAccess;
1743
+ /** `full`, `read_all` (Read everything), `custom` (some permissions) or `limited` (none). */
1744
+ preset?: 'full' | 'read_all' | 'custom' | 'limited';
1745
+ /** A Limited key's permissions (docs/KEYS.md "Permissions"). */
1746
+ grants?: string[];
1725
1747
  created_at: string;
1726
1748
  revoked_at: string | null;
1727
1749
  }
1750
+ /** What a key's access is set to: Full access, Read everything, or Limited with nothing extra. */
1751
+ export type KeyPresetChoice = 'full' | 'read_all' | 'limited';
1752
+ /** One permission a Limited key can be given (`GET /v1/api-keys/permissions`). */
1753
+ export interface KeyPermission {
1754
+ /** `<area>:<read|write>`, e.g. `database.production:read`. */
1755
+ id: string;
1756
+ /** The console group it shows under. */
1757
+ area: string;
1758
+ /** What it lets the key do, in plain words. */
1759
+ label: string;
1760
+ }
1728
1761
  export interface AppKeyInfo {
1729
1762
  object: 'app_key';
1730
1763
  environment: 'production' | 'development';
@@ -4365,6 +4398,7 @@ export interface ProjectSearch {
4365
4398
  pages_known: number;
4366
4399
  indexed: number;
4367
4400
  not_indexed: number;
4401
+ not_crawled: number;
4368
4402
  not_inspected: number;
4369
4403
  };
4370
4404
  clicks_28d: number;
@@ -4383,6 +4417,15 @@ export interface ProjectSearch {
4383
4417
  url: string;
4384
4418
  })[];
4385
4419
  search_console_url: string | null;
4420
+ /** Pushing pages to Google to crawl (Indexing API), opt-in per account. */
4421
+ push: {
4422
+ enabled: boolean;
4423
+ pushed_today: number;
4424
+ pushed_total: number;
4425
+ /** Pushed pages Google has indexed since. */
4426
+ indexed_after_push: number;
4427
+ note: string | null;
4428
+ };
4386
4429
  };
4387
4430
  /** The account's own Bing Webmaster, best effort (IndexNow already tells Bing about pages). */
4388
4431
  bing: {
@@ -4393,6 +4436,28 @@ export interface ProjectSearch {
4393
4436
  sitemap_submitted_at: string | null;
4394
4437
  clicks_28d: number | null;
4395
4438
  impressions_28d: number | null;
4439
+ /** Pages in Bing's index (its crawl stats, newest day); null until read. */
4440
+ indexed: number | null;
4441
+ crawled_28d: number | null;
4442
+ crawl_errors: number | null;
4443
+ blocked_by_robots: number | null;
4444
+ indexed_daily: {
4445
+ date: string;
4446
+ indexed: number;
4447
+ }[];
4448
+ top_queries: {
4449
+ query: string;
4450
+ clicks: number;
4451
+ impressions: number;
4452
+ position: number | null;
4453
+ }[];
4454
+ last_sync_at: string | null;
4455
+ webmaster_url: string | null;
4456
+ /** Pages sent through Bing Webmaster's URL submission. */
4457
+ submitted_today: number;
4458
+ submitted_total: number;
4459
+ /** Bing's quota left today (null until the site's first submission today). */
4460
+ quota_left: number | null;
4396
4461
  note: string | null;
4397
4462
  };
4398
4463
  }
@@ -4439,6 +4504,14 @@ export interface SearchConnection {
4439
4504
  /** Sites set up on it; Google allows `site_limit` (1,000) per account. */
4440
4505
  sites: number;
4441
4506
  site_limit: number | null;
4507
+ /** Google only: pushing pages to crawl (Indexing API), opt-in. */
4508
+ push: {
4509
+ enabled: boolean;
4510
+ pushed_today: number;
4511
+ paused_until: string | null;
4512
+ /** Why pushing stopped and what to do (null when fine). */
4513
+ note: string | null;
4514
+ } | null;
4442
4515
  status: 'connected' | 'error';
4443
4516
  error: string | null;
4444
4517
  error_at: string | null;
@@ -4449,6 +4522,8 @@ export interface SearchConnectionList {
4449
4522
  data: SearchConnection[];
4450
4523
  /** Whether this Stack can connect Google (its OAuth client is set). */
4451
4524
  google_available: boolean;
4525
+ /** Pushing pages to Google (Indexing API) is on for the account. */
4526
+ google_push: boolean;
4452
4527
  console_url?: string;
4453
4528
  }
4454
4529
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibiz/sdk",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
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",