totalum-sdk 1.8.1 → 1.10.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.
@@ -1,6 +1,6 @@
1
- import { S as SdkClientErrorCode, a as TotalumError, b as TotalumErrorCode, E as ErrorBody } from '../_types/errors.d-ClHqkAcC.js';
1
+ import { S as SdkClientErrorCode, a as TotalumError, b as TotalumErrorCode, E as ErrorBody } from '../_types/errors.d-BBRayxHv.js';
2
2
  import { TotalumClientOptions } from '../ai/index.js';
3
- export { i as isTotalumError } from '../_types/errors.d-ClHqkAcC.js';
3
+ export { i as isTotalumError } from '../_types/errors.d-BBRayxHv.js';
4
4
 
5
5
  /**
6
6
  * Cloudflare's `D1Database` surface, re-declared structurally so an app needs no Cloudflare types to compile
@@ -1,8 +1,8 @@
1
- import { E as EmailSendInput, k as EmailView } from '../_types/integrations.d-CnW3P404.js';
2
- export { j as EmailSendOutput } from '../_types/integrations.d-CnW3P404.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-ClHqkAcC.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-ClHqkAcC.js';
5
- import '../_types/coerce.d-noA6gCJh.js';
1
+ import { T as TotalumClientOptions, U as Usage } from '../_types/errors.d-BBRayxHv.js';
2
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BBRayxHv.js';
3
+ import { E as EmailSendInput, k as EmailView } from '../_types/integrations.d-Hj3BqI02.js';
4
+ export { j as EmailSendOutput } from '../_types/integrations.d-Hj3BqI02.js';
5
+ import '../_types/coerce.d-3Xj4xYuy.js';
6
6
 
7
7
  /**
8
8
  * `totalum.email` (plan 05 §6.4) over SDK-API `/v1/email/*` (scope `email`): HTML sent byte for byte, charged
@@ -15,18 +15,14 @@ declare function totalumEmail(options?: TotalumClientOptions): {
15
15
  * @example
16
16
  * await email.send({ to: 'ana@example.com', subject: 'Welcome', html: '<p>Hi Ana</p>' });
17
17
  */
18
- send: (msg: EmailSendInput) => Promise<{
18
+ send: (msg: EmailSendInput) => Promise<Omit<{
19
19
  success: true;
20
20
  message: "Email sent successfully";
21
21
  messageId: string;
22
22
  id: string;
23
23
  status: "queued" | "sent";
24
- } & {
25
- usage: {
26
- vendor?: string | undefined;
27
- units?: number | undefined;
28
- credits: number;
29
- };
24
+ }, "usage"> & {
25
+ usage: Usage;
30
26
  }>;
31
27
  /** `null` when the e-mail is not this project's. */
32
28
  get: (id: string) => Promise<EmailView | null>;
@@ -1,8 +1,8 @@
1
- import { F as FileDescriptor, l as FileUploadUrlInput, n as FilesListQuery } from '../_types/integrations.d-CnW3P404.js';
2
- export { m as FileUploadUrlOutput, o as FilesPage } from '../_types/integrations.d-CnW3P404.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-ClHqkAcC.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-ClHqkAcC.js';
5
- import '../_types/coerce.d-noA6gCJh.js';
1
+ import { F as FileDescriptor, l as FileUploadUrlInput, n as FilesListQuery } from '../_types/integrations.d-Hj3BqI02.js';
2
+ export { m as FileUploadUrlOutput, o as FilesPage } from '../_types/integrations.d-Hj3BqI02.js';
3
+ import { T as TotalumClientOptions } from '../_types/errors.d-BBRayxHv.js';
4
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BBRayxHv.js';
5
+ import '../_types/coerce.d-3Xj4xYuy.js';
6
6
 
7
7
  interface TotalumFilesOptions extends TotalumClientOptions {
8
8
  /** The public files host; default `TOTALUM_FILES_URL`, else `https://files.totalum-project.com` (A10.1). */
package/dist/http.js CHANGED
@@ -115,8 +115,9 @@ export function query(params) {
115
115
  q.set(k, Array.isArray(v) ? v.join(',') : String(v));
116
116
  return q.size ? `?${q.toString()}` : '';
117
117
  }
118
- /** `data` + `usage {credits, vendor?, units?}` from `metadata` (plan 11 §0.8: every integration result shows its price). */
119
- export const withUsage = ({ data, metadata }) => ({
120
- ...data,
121
- usage: { credits: metadata?.credits ?? 0, ...metadata?.usage },
122
- });
118
+ /** `data` + `usage {credits}` from `metadata` (plan 11 §0.8: every integration result shows its price, in credits only). */
119
+ export const withUsage = ({ data, metadata, }) => {
120
+ const rest = { ...data };
121
+ delete rest.usage;
122
+ return { ...rest, usage: { credits: metadata?.credits ?? 0 } };
123
+ };
package/dist/index.d.ts CHANGED
@@ -29,13 +29,12 @@ export { TotalumVectors, VectorFilter, VectorMatch, VectorMetadata, VectorRecord
29
29
  import { totalumWeb } from './web/index.js';
30
30
  export { TotalumWeb } from './web/index.js';
31
31
  import { totalumWebhooks } from './webhooks/index.js';
32
- export { TotalumWebhookError, TotalumWebhooks, verifyWebhook } from './webhooks/index.js';
32
+ export { TotalumWebhookError, TotalumWebhooks, WebhookConfig, WebhookEvent, WebhookSecretOutput, verifyWebhook } from './webhooks/index.js';
33
33
  export { D1Database, D1DatabaseSession, D1ExecResult, D1PreparedStatement, D1Result, READ_YOUR_WRITES_COOKIE, TotalumD1ClientCode, TotalumD1Error, TotalumD1ErrorCode, TotalumD1Options, isTotalumD1Error, totalumD1, withTotalumSession } from './d1/index.js';
34
- export { T as TotalumClientOptions, a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from './_types/errors.d-ClHqkAcC.js';
35
- export { C as CheckoutInput, a as CheckoutOutput, b as CheckoutSession, c as CronJob, d as CronJobInput, e as CronJobPatch, f as CronRun, g as CronRunsPage, h as CustomerPortalLinkInput, i as CustomerPortalLinkOutput, E as EmailSendInput, j as EmailSendOutput, k as EmailView, F as FileDescriptor, l as FileUploadUrlInput, m as FileUploadUrlOutput, n as FilesListQuery, o as FilesPage, J as JobCreated, O as OnboardingLinkInput, p as OnboardingLinkOutput, P as PaymentsStatus, q as PdfFromHtmlInput, r as PdfFromUrlInput, s as PdfOutput, R as RefundInput, t as RefundOutput, S as ScanDocumentInput, u as ScanOcrInput, v as ScanOcrOutput, w as ScreenshotInput, x as ScreenshotOutput, y as SeoIndexNowKey, z as SeoNotifyOutput, A as SpeakInput, B as StoredMedia, D as Subscription, G as SubscriptionUpdateInput, T as TranscribeInput, H as TranscribeOutput, W as WebJob, I as WebScrapeOutput, K as WebSearchOutput } from './_types/integrations.d-CnW3P404.js';
36
- export { L as LogsPage, S as SiteAnalyticsOutput, a as SiteDimension, b as SiteMetric } from './_types/ops.d-BT7oxlGp.js';
37
- export { W as WebhookConfig, a as WebhookEvent, b as WebhookSecretOutput } from './_types/billing.d-CsA9ckbO.js';
38
- import './_types/coerce.d-noA6gCJh.js';
34
+ export { T as TotalumClientOptions, a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from './_types/errors.d-BBRayxHv.js';
35
+ export { C as CheckoutInput, a as CheckoutOutput, b as CheckoutSession, c as CronJob, d as CronJobInput, e as CronJobPatch, f as CronRun, g as CronRunsPage, h as CustomerPortalLinkInput, i as CustomerPortalLinkOutput, E as EmailSendInput, j as EmailSendOutput, k as EmailView, F as FileDescriptor, l as FileUploadUrlInput, m as FileUploadUrlOutput, n as FilesListQuery, o as FilesPage, J as JobCreated, O as OnboardingLinkInput, p as OnboardingLinkOutput, P as PaymentsStatus, q as PdfFromHtmlInput, r as PdfFromUrlInput, s as PdfOutput, R as RefundInput, t as RefundOutput, S as ScanDocumentInput, u as ScanOcrInput, v as ScanOcrOutput, w as ScreenshotInput, x as ScreenshotOutput, y as SeoIndexNowKey, z as SeoNotifyOutput, A as SpeakInput, B as StoredMedia, D as Subscription, G as SubscriptionUpdateInput, T as TranscribeInput, H as TranscribeOutput, W as WebJob, I as WebScrapeOutput, K as WebSearchOutput } from './_types/integrations.d-Hj3BqI02.js';
36
+ export { L as LogsPage, S as SiteAnalyticsOutput, a as SiteDimension, b as SiteMetric } from './_types/ops.d-D_3lqkJ2.js';
37
+ import './_types/coerce.d-3Xj4xYuy.js';
39
38
 
40
39
  /** The options of `createTotalum()`: every namespace's options in one object (each falls back to its env var). */
41
40
  type TotalumOptions = TotalumAiOptions & TotalumFilesOptions;
@@ -1,8 +1,8 @@
1
- import { c as LogsQueryInput } from '../_types/ops.d-BT7oxlGp.js';
2
- export { L as LogsPage } from '../_types/ops.d-BT7oxlGp.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-ClHqkAcC.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-ClHqkAcC.js';
5
- import '../_types/coerce.d-noA6gCJh.js';
1
+ import { c as LogsQueryInput } from '../_types/ops.d-D_3lqkJ2.js';
2
+ export { L as LogsPage } from '../_types/ops.d-D_3lqkJ2.js';
3
+ import { T as TotalumClientOptions } from '../_types/errors.d-BBRayxHv.js';
4
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BBRayxHv.js';
5
+ import '../_types/coerce.d-3Xj4xYuy.js';
6
6
 
7
7
  /** A `logs.query` filter: the window (default the last hour), level, substring, status class, path, request id, env. */
8
8
  type LogsQuery = Omit<LogsQueryInput, 'caller' | 'runId'>;
@@ -1,8 +1,8 @@
1
- import { O as OnboardingLinkInput, C as CheckoutInput, h as CustomerPortalLinkInput, G as SubscriptionUpdateInput, R as RefundInput } from '../_types/integrations.d-CnW3P404.js';
2
- export { a as CheckoutOutput, b as CheckoutSession, i as CustomerPortalLinkOutput, p as OnboardingLinkOutput, P as PaymentsStatus, t as RefundOutput, D as Subscription } from '../_types/integrations.d-CnW3P404.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-ClHqkAcC.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-ClHqkAcC.js';
5
- import '../_types/coerce.d-noA6gCJh.js';
1
+ import { O as OnboardingLinkInput, C as CheckoutInput, h as CustomerPortalLinkInput, G as SubscriptionUpdateInput, R as RefundInput } from '../_types/integrations.d-Hj3BqI02.js';
2
+ export { a as CheckoutOutput, b as CheckoutSession, i as CustomerPortalLinkOutput, p as OnboardingLinkOutput, P as PaymentsStatus, t as RefundOutput, D as Subscription } from '../_types/integrations.d-Hj3BqI02.js';
3
+ import { T as TotalumClientOptions } from '../_types/errors.d-BBRayxHv.js';
4
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BBRayxHv.js';
5
+ import '../_types/coerce.d-3Xj4xYuy.js';
6
6
 
7
7
  /**
8
8
  * `totalum.payments` (plan 05, plan 11 §9.5) over SDK-API `/v1/payments/*` with a project key (scope `payments`): Stripe
@@ -1,8 +1,8 @@
1
- import { q as PdfFromHtmlInput, r as PdfFromUrlInput } from '../_types/integrations.d-CnW3P404.js';
2
- export { s as PdfOutput } from '../_types/integrations.d-CnW3P404.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-ClHqkAcC.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-ClHqkAcC.js';
5
- import '../_types/coerce.d-noA6gCJh.js';
1
+ import { T as TotalumClientOptions, U as Usage } from '../_types/errors.d-BBRayxHv.js';
2
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BBRayxHv.js';
3
+ import { q as PdfFromHtmlInput, r as PdfFromUrlInput } from '../_types/integrations.d-Hj3BqI02.js';
4
+ export { s as PdfOutput } from '../_types/integrations.d-Hj3BqI02.js';
5
+ import '../_types/coerce.d-3Xj4xYuy.js';
6
6
 
7
7
  /** `totalum.pdf` (plan 04 §5.5) over `/v1/pdf/*` (scope `files:write`): a new file in the project's storage each time. */
8
8
  declare function totalumPdf(options?: TotalumClientOptions): {
@@ -12,28 +12,20 @@ declare function totalumPdf(options?: TotalumClientOptions): {
12
12
  * @example
13
13
  * const { url } = await pdf.fromHtml({ html: '<h1>Invoice 12</h1>', name: 'invoice-12' });
14
14
  */
15
- fromHtml: (input: PdfFromHtmlInput) => Promise<{
15
+ fromHtml: (input: PdfFromHtmlInput) => Promise<Omit<{
16
16
  url: string;
17
17
  fileName: string;
18
18
  key: string;
19
- } & {
20
- usage: {
21
- vendor?: string | undefined;
22
- units?: number | undefined;
23
- credits: number;
24
- };
19
+ }, "usage"> & {
20
+ usage: Usage;
25
21
  }>;
26
22
  /** A PDF of a web page, stored as a project file. */
27
- fromUrl: (input: PdfFromUrlInput) => Promise<{
23
+ fromUrl: (input: PdfFromUrlInput) => Promise<Omit<{
28
24
  url: string;
29
25
  fileName: string;
30
26
  key: string;
31
- } & {
32
- usage: {
33
- vendor?: string | undefined;
34
- units?: number | undefined;
35
- credits: number;
36
- };
27
+ }, "usage"> & {
28
+ usage: Usage;
37
29
  }>;
38
30
  };
39
31
  type TotalumPdf = ReturnType<typeof totalumPdf>;
@@ -1,5 +1,5 @@
1
- import { Z as ZodObject, c as ZodOptional, d as ZodString, g as ZodUnknown, m as $strip, o as output, u as ZodISODateTime, l as ZodInt, h as ZodRecord, j as ZodBoolean, T as TotalumClientOptions } from '../_types/errors.d-ClHqkAcC.js';
2
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-ClHqkAcC.js';
1
+ import { Z as ZodObject, c as ZodOptional, d as ZodString, g as ZodUnknown, m as $strip, o as output, u as ZodISODateTime, l as ZodInt, h as ZodRecord, j as ZodBoolean, T as TotalumClientOptions } from '../_types/errors.d-BBRayxHv.js';
2
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BBRayxHv.js';
3
3
 
4
4
  /** `POST /v1/realtime/tickets` (scope `realtime`). `ttl` is the join window in seconds, not the session length. */
5
5
  declare const RealtimeTicketInput: ZodObject<{
@@ -1,8 +1,8 @@
1
- import { S as ScanDocumentInput, u as ScanOcrInput } from '../_types/integrations.d-CnW3P404.js';
2
- export { v as ScanOcrOutput } from '../_types/integrations.d-CnW3P404.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-ClHqkAcC.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-ClHqkAcC.js';
5
- import '../_types/coerce.d-noA6gCJh.js';
1
+ import { S as ScanDocumentInput, u as ScanOcrInput } from '../_types/integrations.d-Hj3BqI02.js';
2
+ export { v as ScanOcrOutput } from '../_types/integrations.d-Hj3BqI02.js';
3
+ import { U as Usage, T as TotalumClientOptions } from '../_types/errors.d-BBRayxHv.js';
4
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BBRayxHv.js';
5
+ import '../_types/coerce.d-3Xj4xYuy.js';
6
6
 
7
7
  /**
8
8
  * The v1 scan result: the extracted fields (one set per page with `processEveryPdfPageAsDifferentScan`), the v1
@@ -17,18 +17,14 @@ interface ScanDocumentResult {
17
17
  provider: string;
18
18
  credits: number;
19
19
  };
20
- usage: {
21
- credits: number;
22
- vendor?: string | undefined;
23
- units?: number | undefined;
24
- };
20
+ usage: Usage;
25
21
  }
26
22
  /** `totalum.scan` (plan 05 §6.7) over `/v1/scan/*` (scope `scan`): a vision model through Totalum's AI gateway. */
27
23
  declare function totalumScan(options?: TotalumClientOptions): {
28
24
  /** Extracts the fields described by `properties` from a document or image (one set per page on request). */
29
25
  document: (input: ScanDocumentInput) => Promise<ScanDocumentResult>;
30
26
  /** The text of a document or image, per page as Markdown. */
31
- ocr: (input: ScanOcrInput) => Promise<{
27
+ ocr: (input: ScanOcrInput) => Promise<Omit<{
32
28
  text: string;
33
29
  pages: {
34
30
  markdown: string;
@@ -40,12 +36,8 @@ declare function totalumScan(options?: TotalumClientOptions): {
40
36
  }[] | undefined;
41
37
  }[];
42
38
  fullDetails?: unknown;
43
- } & {
44
- usage: {
45
- vendor?: string | undefined;
46
- units?: number | undefined;
47
- credits: number;
48
- };
39
+ }, "usage"> & {
40
+ usage: Usage;
49
41
  }>;
50
42
  };
51
43
  type TotalumScan = ReturnType<typeof totalumScan>;
@@ -1,7 +1,7 @@
1
- export { y as SeoIndexNowKey, z as SeoNotifyOutput } from '../_types/integrations.d-CnW3P404.js';
2
- import { T as TotalumClientOptions } from '../_types/errors.d-ClHqkAcC.js';
3
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-ClHqkAcC.js';
4
- import '../_types/coerce.d-noA6gCJh.js';
1
+ export { y as SeoIndexNowKey, z as SeoNotifyOutput } from '../_types/integrations.d-Hj3BqI02.js';
2
+ import { T as TotalumClientOptions } from '../_types/errors.d-BBRayxHv.js';
3
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BBRayxHv.js';
4
+ import '../_types/coerce.d-3Xj4xYuy.js';
5
5
 
6
6
  /** `totalum.seo` (plan 05 §6.10) over SDK-API `/v1/seo/*` (scope `seo`): IndexNow for verified custom domains, free. */
7
7
  declare function totalumSeo(options?: TotalumClientOptions): {
@@ -1,8 +1,8 @@
1
- import { T as TranscribeInput, A as SpeakInput, B as StoredMedia } from '../_types/integrations.d-CnW3P404.js';
2
- export { H as TranscribeOutput } from '../_types/integrations.d-CnW3P404.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-ClHqkAcC.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-ClHqkAcC.js';
5
- import '../_types/coerce.d-noA6gCJh.js';
1
+ import { T as TranscribeInput, A as SpeakInput, B as StoredMedia } from '../_types/integrations.d-Hj3BqI02.js';
2
+ export { H as TranscribeOutput } from '../_types/integrations.d-Hj3BqI02.js';
3
+ import { T as TotalumClientOptions } from '../_types/errors.d-BBRayxHv.js';
4
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BBRayxHv.js';
5
+ import '../_types/coerce.d-3Xj4xYuy.js';
6
6
 
7
7
  /** The audio bytes of `synthesize` without `store`, and what the call cost (`usage.credits`, the call's hold). */
8
8
  interface SpeechAudio {
@@ -25,9 +25,6 @@ declare function totalumSpeech(options?: TotalumClientOptions): {
25
25
  durationSec: number;
26
26
  usage: {
27
27
  credits: number;
28
- vendor?: string | undefined;
29
- units?: number | undefined;
30
- vendorCostUsd?: number | undefined;
31
28
  };
32
29
  language?: string | undefined;
33
30
  segments?: {
@@ -1,5 +1,5 @@
1
- import { Z as ZodObject, d as ZodString, c as ZodOptional, e as ZodArray, k as ZodNumber, f as ZodEnum, h as ZodRecord, n as ZodUnion, j as ZodBoolean, m as $strip, o as output, l as ZodInt, q as $partial, x as $strict, T as TotalumClientOptions } from '../_types/errors.d-ClHqkAcC.js';
2
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-ClHqkAcC.js';
1
+ import { Z as ZodObject, d as ZodString, c as ZodOptional, e as ZodArray, k as ZodNumber, f as ZodEnum, h as ZodRecord, n as ZodUnion, j as ZodBoolean, m as $strip, o as output, l as ZodInt, q as $partial, x as $strict, T as TotalumClientOptions, U as Usage } from '../_types/errors.d-BBRayxHv.js';
2
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BBRayxHv.js';
3
3
 
4
4
  /** `text` = the `embed` preset's space; `image` = the `embed-image` preset's text+image space. */
5
5
  declare const VectorSpace: ZodEnum<{
@@ -108,31 +108,20 @@ declare function totalumVectors(options?: TotalumClientOptions): {
108
108
  * The answer (and `count()`) means stored; `query` and `get` see the write later — often seconds, sometimes 10+
109
109
  * minutes (the index applies writes asynchronously). Never wait or poll for a write to become searchable.
110
110
  */
111
- upsert: (vectors: VectorUpsertItem[]) => Promise<Omit<{
111
+ upsert: (vectors: VectorUpsertItem[]) => Promise<Omit<Omit<{
112
112
  upserted: number;
113
113
  count: number;
114
114
  usage: {
115
115
  credits: number;
116
- vendor?: string | undefined;
117
- units?: number | undefined;
118
- vendorCostUsd?: number | undefined;
119
- };
120
- }, "usage"> & {
121
- usage: {
122
- vendor?: string | undefined;
123
- units?: number | undefined;
124
- credits: number;
125
116
  };
117
+ }, "usage">, "usage"> & {
118
+ usage: Usage;
126
119
  }>;
127
120
  /** The `topK` (≤ 50, default 5) closest vectors to `text`, `values` or `image`, with their metadata. */
128
- query: (input: VectorsQueryInput) => Promise<{
121
+ query: (input: VectorsQueryInput) => Promise<Omit<{
129
122
  matches: VectorMatch[];
130
- } & {
131
- usage: {
132
- vendor?: string | undefined;
133
- units?: number | undefined;
134
- credits: number;
135
- };
123
+ }, "usage"> & {
124
+ usage: Usage;
136
125
  }>;
137
126
  /** The stored vectors (values and metadata) of up to 100 ids; unknown and just-written ids are left out. */
138
127
  get: (ids: string[]) => Promise<{
@@ -142,21 +131,14 @@ declare function totalumVectors(options?: TotalumClientOptions): {
142
131
  metadata?: Record<string, string | number | boolean | string[]> | undefined;
143
132
  }[]>;
144
133
  /** Deletes up to 1,000 ids; answers how many existed and how many are left. */
145
- delete: (ids: string[]) => Promise<Omit<{
134
+ delete: (ids: string[]) => Promise<Omit<Omit<{
146
135
  deleted: number;
147
136
  count: number;
148
137
  usage: {
149
138
  credits: number;
150
- vendor?: string | undefined;
151
- units?: number | undefined;
152
- vendorCostUsd?: number | undefined;
153
- };
154
- }, "usage"> & {
155
- usage: {
156
- vendor?: string | undefined;
157
- units?: number | undefined;
158
- credits: number;
159
139
  };
140
+ }, "usage">, "usage"> & {
141
+ usage: Usage;
160
142
  }>;
161
143
  /** How many vectors this environment stores (free). */
162
144
  count: () => Promise<{
@@ -1,8 +1,8 @@
1
- import { L as WebScrapeInput, M as WebSearchInput, N as WebMapInput, Q as WebCrawlInput, w as ScreenshotInput } from '../_types/integrations.d-CnW3P404.js';
2
- export { J as JobCreated, x as ScreenshotOutput, W as WebJob, I as WebScrapeOutput, K as WebSearchOutput } from '../_types/integrations.d-CnW3P404.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-ClHqkAcC.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-ClHqkAcC.js';
5
- import '../_types/coerce.d-noA6gCJh.js';
1
+ import { T as TotalumClientOptions, U as Usage } from '../_types/errors.d-BBRayxHv.js';
2
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BBRayxHv.js';
3
+ import { L as WebScrapeInput, M as WebSearchInput, N as WebMapInput, Q as WebCrawlInput, w as ScreenshotInput } from '../_types/integrations.d-Hj3BqI02.js';
4
+ export { J as JobCreated, x as ScreenshotOutput, W as WebJob, I as WebScrapeOutput, K as WebSearchOutput } from '../_types/integrations.d-Hj3BqI02.js';
5
+ import '../_types/coerce.d-3Xj4xYuy.js';
6
6
 
7
7
  /**
8
8
  * `totalum.web` (plan 05 §6.2) over SDK-API `/v1/web/*` (scope `web`): scrape, search, map, crawl and screenshots,
@@ -26,9 +26,6 @@ declare function totalumWeb(options?: TotalumClientOptions): {
26
26
  };
27
27
  usage: {
28
28
  credits: number;
29
- vendor?: string | undefined;
30
- units?: number | undefined;
31
- vendorCostUsd?: number | undefined;
32
29
  };
33
30
  markdown?: string | undefined;
34
31
  html?: string | undefined;
@@ -40,7 +37,7 @@ declare function totalumWeb(options?: TotalumClientOptions): {
40
37
  contentUrl?: string | undefined;
41
38
  }>;
42
39
  /** A web search; with `scrapeOptions` each result also carries its page content. */
43
- search: (query: string, opts?: Omit<WebSearchInput, "query">) => Promise<{
40
+ search: (query: string, opts?: Omit<WebSearchInput, "query">) => Promise<Omit<{
44
41
  web: {
45
42
  title: string;
46
43
  url: string;
@@ -72,22 +69,14 @@ declare function totalumWeb(options?: TotalumClientOptions): {
72
69
  summary?: string | undefined;
73
70
  contentUrl?: string | undefined;
74
71
  }[] | undefined;
75
- } & {
76
- usage: {
77
- vendor?: string | undefined;
78
- units?: number | undefined;
79
- credits: number;
80
- };
72
+ }, "usage"> & {
73
+ usage: Usage;
81
74
  }>;
82
75
  /** The URLs of a site (sitemap and links), without fetching the pages. */
83
- map: (url: string, opts?: Omit<WebMapInput, "url">) => Promise<{
76
+ map: (url: string, opts?: Omit<WebMapInput, "url">) => Promise<Omit<{
84
77
  links: string[];
85
- } & {
86
- usage: {
87
- vendor?: string | undefined;
88
- units?: number | undefined;
89
- credits: number;
90
- };
78
+ }, "usage"> & {
79
+ usage: Usage;
91
80
  }>;
92
81
  /** `202 {jobId}`: poll `crawlStatus` until the job leaves `running`; that read settles its charge. */
93
82
  crawl: (url: string, opts?: Omit<WebCrawlInput, "url">) => Promise<{
@@ -151,17 +140,13 @@ declare function totalumWeb(options?: TotalumClientOptions): {
151
140
  resultUrl?: string | undefined;
152
141
  }>;
153
142
  /** A screenshot of a `url` or of inline `html`, stored as a project file (`key`, `url`). */
154
- screenshot: (input: ScreenshotInput) => Promise<{
143
+ screenshot: (input: ScreenshotInput) => Promise<Omit<{
155
144
  key: string;
156
145
  url: string;
157
146
  format: "png" | "jpeg" | "webp";
158
147
  base64?: string | undefined;
159
- } & {
160
- usage: {
161
- vendor?: string | undefined;
162
- units?: number | undefined;
163
- credits: number;
164
- };
148
+ }, "usage"> & {
149
+ usage: Usage;
165
150
  }>;
166
151
  };
167
152
  type TotalumWeb = ReturnType<typeof totalumWeb>;
@@ -1,7 +1,32 @@
1
- import { a as WebhookEvent } from '../_types/billing.d-CsA9ckbO.js';
2
- export { W as WebhookConfig, b as WebhookSecretOutput } from '../_types/billing.d-CsA9ckbO.js';
3
- import { T as TotalumClientOptions, a as TotalumError } from '../_types/errors.d-ClHqkAcC.js';
4
- export { b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-ClHqkAcC.js';
1
+ import { Z as ZodObject, d as ZodString, u as ZodISODateTime, f as ZodEnum, c as ZodOptional, j as ZodBoolean, h as ZodRecord, g as ZodUnknown, m as $strip, o as output, w as ZodNullable, p as ZodURL, T as TotalumClientOptions, a as TotalumError } from '../_types/errors.d-BBRayxHv.js';
2
+ export { b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BBRayxHv.js';
3
+
4
+ /** The delivery body: `{id, type, createdAt, projectId, env, livemode?, data}`, idempotent by `id`. */
5
+ declare const WebhookEvent: ZodObject<{
6
+ id: ZodString;
7
+ type: ZodString;
8
+ createdAt: ZodISODateTime;
9
+ projectId: ZodString;
10
+ env: ZodEnum<{
11
+ dev: "dev";
12
+ live: "live";
13
+ }>;
14
+ livemode: ZodOptional<ZodBoolean>;
15
+ data: ZodRecord<ZodString, ZodUnknown>;
16
+ }, $strip>;
17
+ type WebhookEvent = output<typeof WebhookEvent>;
18
+ /** `GET|PUT /v1/webhooks`: the secret itself is shown only by `POST /v1/webhooks/rotate-secret`. */
19
+ declare const WebhookConfig: ZodObject<{
20
+ url: ZodNullable<ZodURL>;
21
+ enabled: ZodBoolean;
22
+ secretPrefix: ZodNullable<ZodString>;
23
+ }, $strip>;
24
+ type WebhookConfig = output<typeof WebhookConfig>;
25
+ /** `POST /v1/webhooks/rotate-secret`: a new signing secret, revealed once (`whsec_` + 64 hex). */
26
+ declare const WebhookSecretOutput: ZodObject<{
27
+ secret: ZodString;
28
+ }, $strip>;
29
+ type WebhookSecretOutput = output<typeof WebhookSecretOutput>;
5
30
 
6
31
  /** A webhook refusal (plan 05 §7.2): the codes never travel, the app answers 400. */
7
32
  declare class TotalumWebhookError extends TotalumError {
@@ -45,5 +70,5 @@ declare function totalumWebhooks(options?: TotalumClientOptions): {
45
70
  };
46
71
  type TotalumWebhooks = ReturnType<typeof totalumWebhooks>;
47
72
 
48
- export { TotalumClientOptions, TotalumError, TotalumWebhookError, WebhookEvent, totalumWebhooks, verifyWebhook };
73
+ export { TotalumClientOptions, TotalumError, TotalumWebhookError, WebhookConfig, WebhookEvent, WebhookSecretOutput, totalumWebhooks, verifyWebhook };
49
74
  export type { TotalumWebhooks };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "totalum-sdk",
3
- "version": "1.8.1",
3
+ "version": "1.10.0",
4
4
  "description": "The SDK generated Totalum apps import: every integration namespace over SDK-API (totalum-sdk, or one subpath each: /files, /ai, /web, \u2026) and totalum-sdk/d1, the D1 driver",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",