totalum-sdk 1.9.0 → 1.10.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/_types/{coerce.d-Cli9TkUD.d.ts → coerce.d-DiNiCkat.d.ts} +1 -1
- package/dist/_types/{errors.d-WcXvShIX.d.ts → errors.d-BfXTsxYG.d.ts} +11 -7
- package/dist/_types/{integrations.d-WM81VvEj.d.ts → integrations.d-DL2_rTOs.d.ts} +11 -20
- package/dist/_types/{ops.d-CS92EKY-.d.ts → ops.d-fwLDriUN.d.ts} +3 -3
- package/dist/ai/index.d.ts +14 -48
- package/dist/ai/index.js +6 -6
- package/dist/analytics/index.d.ts +5 -5
- package/dist/analytics/index.js +1 -1
- package/dist/browser/index.d.ts +10 -10
- package/dist/browser/index.js +4 -4
- package/dist/cron/index.d.ts +10 -10
- package/dist/cron/index.js +5 -5
- package/dist/d1/d1-limits.js +1 -1
- package/dist/d1/errors.js +3 -3
- package/dist/d1/https.js +3 -3
- package/dist/d1/index.d.ts +12 -12
- package/dist/d1/index.js +2 -2
- package/dist/d1/lazy.js +4 -4
- package/dist/d1/libsql.js +5 -5
- package/dist/d1/migrate-rules.js +5 -5
- package/dist/d1/native-shape.js +2 -2
- package/dist/d1/retry.js +3 -3
- package/dist/d1/session.js +3 -3
- package/dist/d1/sql.js +2 -2
- package/dist/email/index.d.ts +9 -13
- package/dist/email/index.js +1 -1
- package/dist/errors.js +4 -4
- package/dist/files/index.d.ts +11 -11
- package/dist/files/index.js +4 -4
- package/dist/http.js +12 -11
- package/dist/index.d.ts +6 -7
- package/dist/index.js +1 -1
- package/dist/logs/index.d.ts +6 -6
- package/dist/logs/index.js +1 -1
- package/dist/payments/index.d.ts +7 -7
- package/dist/payments/index.js +2 -2
- package/dist/pdf/index.d.ts +12 -20
- package/dist/pdf/index.js +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/realtime/index.d.ts +5 -5
- package/dist/realtime/index.js +1 -1
- package/dist/scan/index.d.ts +10 -18
- package/dist/scan/index.js +1 -1
- package/dist/seo/index.d.ts +5 -5
- package/dist/seo/index.js +1 -1
- package/dist/speech/index.d.ts +6 -9
- package/dist/speech/index.js +1 -1
- package/dist/vectors/index.d.ts +13 -31
- package/dist/web/index.d.ts +15 -30
- package/dist/web/index.js +1 -1
- package/dist/webhooks/index.d.ts +33 -8
- package/dist/webhooks/index.js +4 -4
- package/package.json +1 -1
- package/totalum-sdk.md +54 -54
- package/totalum-sdk.signatures.json +5 -5
- package/dist/_types/billing.d-Bl2JQGMY.d.ts +0 -42
package/dist/logs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsonClient } from '../http.js';
|
|
2
2
|
export { TotalumError, isTotalumError } from '../errors.js';
|
|
3
3
|
/**
|
|
4
|
-
* `totalum.logs`
|
|
4
|
+
* `totalum.logs` over the Totalum API `/v1/logs` (scope `logs:read`; the agent's sandbox key reads its dev
|
|
5
5
|
* preview for free): the Worker invocations of the published app (`env: 'live'`) or the preview (`'dev'`). Free.
|
|
6
6
|
*/
|
|
7
7
|
export function totalumLogs(options = {}) {
|
package/dist/payments/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { O as OnboardingLinkInput, C as CheckoutInput, h as CustomerPortalLinkInput, G as SubscriptionUpdateInput, R as RefundInput } from '../_types/integrations.d-
|
|
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-
|
|
3
|
-
import { T as TotalumClientOptions } from '../_types/errors.d-
|
|
4
|
-
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-
|
|
5
|
-
import '../_types/coerce.d-
|
|
1
|
+
import { O as OnboardingLinkInput, C as CheckoutInput, h as CustomerPortalLinkInput, G as SubscriptionUpdateInput, R as RefundInput } from '../_types/integrations.d-DL2_rTOs.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-DL2_rTOs.js';
|
|
3
|
+
import { T as TotalumClientOptions } from '../_types/errors.d-BfXTsxYG.js';
|
|
4
|
+
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BfXTsxYG.js';
|
|
5
|
+
import '../_types/coerce.d-DiNiCkat.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* `totalum.payments`
|
|
8
|
+
* `totalum.payments` over the Totalum API `/v1/payments/*` with a project key (scope `payments`): Stripe
|
|
9
9
|
* Connect direct charges on the project's own connected account. Card data never passes through here — send buyers to
|
|
10
|
-
* the hosted Checkout `url` (SAQ-A);
|
|
10
|
+
* the hosted Checkout `url` (SAQ-A); the Totalum API refuses card fields with `CARD_DATA_NOT_ACCEPTED`. Stripe test mode on the
|
|
11
11
|
* preview and in the sandbox; live mode only on the published site, once the owner onboarded and switched live on.
|
|
12
12
|
*/
|
|
13
13
|
declare function totalumPayments(options?: TotalumClientOptions): {
|
package/dist/payments/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsonClient } from '../http.js';
|
|
2
2
|
export { TotalumError, isTotalumError } from '../errors.js';
|
|
3
3
|
/**
|
|
4
|
-
* `totalum.payments`
|
|
4
|
+
* `totalum.payments` over the Totalum API `/v1/payments/*` with a project key (scope `payments`): Stripe
|
|
5
5
|
* Connect direct charges on the project's own connected account. Card data never passes through here — send buyers to
|
|
6
|
-
* the hosted Checkout `url` (SAQ-A);
|
|
6
|
+
* the hosted Checkout `url` (SAQ-A); the Totalum API refuses card fields with `CARD_DATA_NOT_ACCEPTED`. Stripe test mode on the
|
|
7
7
|
* preview and in the sandbox; live mode only on the published site, once the owner onboarded and switched live on.
|
|
8
8
|
*/
|
|
9
9
|
export function totalumPayments(options = {}) {
|
package/dist/pdf/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import '../_types/coerce.d-
|
|
1
|
+
import { T as TotalumClientOptions, U as Usage } from '../_types/errors.d-BfXTsxYG.js';
|
|
2
|
+
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BfXTsxYG.js';
|
|
3
|
+
import { q as PdfFromHtmlInput, r as PdfFromUrlInput } from '../_types/integrations.d-DL2_rTOs.js';
|
|
4
|
+
export { s as PdfOutput } from '../_types/integrations.d-DL2_rTOs.js';
|
|
5
|
+
import '../_types/coerce.d-DiNiCkat.js';
|
|
6
6
|
|
|
7
|
-
/** `totalum.pdf`
|
|
7
|
+
/** `totalum.pdf` over `/v1/pdf/*` (scope `files:write`): a new file in the project's storage each time. */
|
|
8
8
|
declare function totalumPdf(options?: TotalumClientOptions): {
|
|
9
9
|
/**
|
|
10
10
|
* A PDF rendered from HTML, stored as a project file (`key`, `url`).
|
|
@@ -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>;
|
package/dist/pdf/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { envelopeClient, withUsage } from '../http.js';
|
|
2
2
|
export { TotalumError, isTotalumError } from '../errors.js';
|
|
3
|
-
/** `totalum.pdf`
|
|
3
|
+
/** `totalum.pdf` over `/v1/pdf/*` (scope `files:write`): a new file in the project's storage each time. */
|
|
4
4
|
export function totalumPdf(options = {}) {
|
|
5
5
|
const call = envelopeClient(options);
|
|
6
6
|
return {
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `totalum-sdk/react
|
|
2
|
+
* `totalum-sdk/react`: the browser side of `totalum.realtime`. The page never holds a key: it
|
|
3
3
|
* asks the app's own server for a ticket (`POST ticketUrl {room}`, default `/api/realtime/ticket`), opens the room's
|
|
4
4
|
* socket, and on every drop — a Totalum deploy drops them all — re-tickets and reconnects with backoff. Presence is
|
|
5
5
|
* built on the same socket: `presence:*` messages plus a 30 s heartbeat (a room with present users stays awake).
|
package/dist/realtime/index.d.ts
CHANGED
|
@@ -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-
|
|
2
|
-
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-
|
|
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-BfXTsxYG.js';
|
|
2
|
+
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BfXTsxYG.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<{
|
|
@@ -33,8 +33,8 @@ declare const RealtimeTicketOutput: ZodObject<{
|
|
|
33
33
|
}, $strip>;
|
|
34
34
|
type RealtimeTicketOutput = output<typeof RealtimeTicketOutput>;
|
|
35
35
|
/**
|
|
36
|
-
* `POST /v1/realtime/rooms/:room/publish` (scope `realtime
|
|
37
|
-
* app's own routes or a cron job. The room is resolved inside the key's project
|
|
36
|
+
* `POST /v1/realtime/rooms/:room/publish` (scope `realtime`): server-side publish over HTTPS from the
|
|
37
|
+
* app's own routes or a cron job. The room is resolved inside the key's project; `identity` defaults to
|
|
38
38
|
* `{id: 'server'}`. Answers `202`.
|
|
39
39
|
*/
|
|
40
40
|
declare const RealtimePublishInput: ZodObject<{
|
|
@@ -55,7 +55,7 @@ declare const RealtimePublishOutput: ZodObject<{
|
|
|
55
55
|
type RealtimePublishOutput = output<typeof RealtimePublishOutput>;
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* `totalum.realtime` server side
|
|
58
|
+
* `totalum.realtime` server side over the Totalum API `/v1/realtime/*` (scope `realtime`). The app's own
|
|
59
59
|
* server mints a short-lived ticket after its own auth check and hands `{ticket, url}` to the page; the page opens the
|
|
60
60
|
* `wss://` `url` and never holds a key.
|
|
61
61
|
*
|
package/dist/realtime/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsonClient } from '../http.js';
|
|
2
2
|
export { TotalumError, isTotalumError } from '../errors.js';
|
|
3
3
|
/**
|
|
4
|
-
* `totalum.realtime` server side
|
|
4
|
+
* `totalum.realtime` server side over the Totalum API `/v1/realtime/*` (scope `realtime`). The app's own
|
|
5
5
|
* server mints a short-lived ticket after its own auth check and hands `{ticket, url}` to the page; the page opens the
|
|
6
6
|
* `wss://` `url` and never holds a key.
|
|
7
7
|
*
|
package/dist/scan/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as ScanDocumentInput, u as ScanOcrInput } from '../_types/integrations.d-
|
|
2
|
-
export { v as ScanOcrOutput } from '../_types/integrations.d-
|
|
3
|
-
import { T as TotalumClientOptions } from '../_types/errors.d-
|
|
4
|
-
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-
|
|
5
|
-
import '../_types/coerce.d-
|
|
1
|
+
import { S as ScanDocumentInput, u as ScanOcrInput } from '../_types/integrations.d-DL2_rTOs.js';
|
|
2
|
+
export { v as ScanOcrOutput } from '../_types/integrations.d-DL2_rTOs.js';
|
|
3
|
+
import { U as Usage, T as TotalumClientOptions } from '../_types/errors.d-BfXTsxYG.js';
|
|
4
|
+
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BfXTsxYG.js';
|
|
5
|
+
import '../_types/coerce.d-DiNiCkat.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
|
-
/** `totalum.scan`
|
|
22
|
+
/** `totalum.scan` 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>;
|
package/dist/scan/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { envelopeClient, withUsage } from '../http.js';
|
|
2
2
|
export { TotalumError, isTotalumError } from '../errors.js';
|
|
3
|
-
/** `totalum.scan`
|
|
3
|
+
/** `totalum.scan` over `/v1/scan/*` (scope `scan`): a vision model through Totalum's AI gateway. */
|
|
4
4
|
export function totalumScan(options = {}) {
|
|
5
5
|
const call = envelopeClient(options);
|
|
6
6
|
return {
|
package/dist/seo/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { y as SeoIndexNowKey, z as SeoNotifyOutput } from '../_types/integrations.d-
|
|
2
|
-
import { T as TotalumClientOptions } from '../_types/errors.d-
|
|
3
|
-
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-
|
|
4
|
-
import '../_types/coerce.d-
|
|
1
|
+
export { y as SeoIndexNowKey, z as SeoNotifyOutput } from '../_types/integrations.d-DL2_rTOs.js';
|
|
2
|
+
import { T as TotalumClientOptions } from '../_types/errors.d-BfXTsxYG.js';
|
|
3
|
+
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BfXTsxYG.js';
|
|
4
|
+
import '../_types/coerce.d-DiNiCkat.js';
|
|
5
5
|
|
|
6
|
-
/** `totalum.seo`
|
|
6
|
+
/** `totalum.seo` over the Totalum API `/v1/seo/*` (scope `seo`): IndexNow for verified custom domains, free. */
|
|
7
7
|
declare function totalumSeo(options?: TotalumClientOptions): {
|
|
8
8
|
/** Tells search engines (IndexNow) that these URLs of the project's custom domains changed. */
|
|
9
9
|
notifyChanged: (urls: string[]) => Promise<{
|
package/dist/seo/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsonClient } from '../http.js';
|
|
2
2
|
export { TotalumError, isTotalumError } from '../errors.js';
|
|
3
|
-
/** `totalum.seo`
|
|
3
|
+
/** `totalum.seo` over the Totalum API `/v1/seo/*` (scope `seo`): IndexNow for verified custom domains, free. */
|
|
4
4
|
export function totalumSeo(options = {}) {
|
|
5
5
|
const call = jsonClient(options);
|
|
6
6
|
return {
|
package/dist/speech/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { T as TranscribeInput, A as SpeakInput, B as StoredMedia } from '../_types/integrations.d-
|
|
2
|
-
export { H as TranscribeOutput } from '../_types/integrations.d-
|
|
3
|
-
import { T as TotalumClientOptions } from '../_types/errors.d-
|
|
4
|
-
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-
|
|
5
|
-
import '../_types/coerce.d-
|
|
1
|
+
import { T as TranscribeInput, A as SpeakInput, B as StoredMedia } from '../_types/integrations.d-DL2_rTOs.js';
|
|
2
|
+
export { H as TranscribeOutput } from '../_types/integrations.d-DL2_rTOs.js';
|
|
3
|
+
import { T as TotalumClientOptions } from '../_types/errors.d-BfXTsxYG.js';
|
|
4
|
+
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BfXTsxYG.js';
|
|
5
|
+
import '../_types/coerce.d-DiNiCkat.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 {
|
|
@@ -14,7 +14,7 @@ interface SpeechAudio {
|
|
|
14
14
|
/** @deprecated Since 1.0.0: use `usage.credits` (the same number). */
|
|
15
15
|
readonly credits: number;
|
|
16
16
|
}
|
|
17
|
-
/** `totalum.speech`
|
|
17
|
+
/** `totalum.speech` over `/v1/speech/*` (scope `speech`): speech to text and text to speech through Totalum. */
|
|
18
18
|
declare function totalumSpeech(options?: TotalumClientOptions): {
|
|
19
19
|
/**
|
|
20
20
|
* Speech to text from `audioBase64` (+ `filename` with its extension) or a `url` — a public one, or a file this
|
|
@@ -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?: {
|
package/dist/speech/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { deprecated } from '../deprecate.js';
|
|
2
2
|
import { jsonClient, rawClient } from '../http.js';
|
|
3
3
|
export { TotalumError, isTotalumError } from '../errors.js';
|
|
4
|
-
/** `totalum.speech`
|
|
4
|
+
/** `totalum.speech` over `/v1/speech/*` (scope `speech`): speech to text and text to speech through Totalum. */
|
|
5
5
|
export function totalumSpeech(options = {}) {
|
|
6
6
|
const call = jsonClient(options);
|
|
7
7
|
const raw = rawClient(options);
|
package/dist/vectors/index.d.ts
CHANGED
|
@@ -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-
|
|
2
|
-
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-
|
|
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-BfXTsxYG.js';
|
|
2
|
+
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BfXTsxYG.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<{
|
|
@@ -7,7 +7,7 @@ declare const VectorSpace: ZodEnum<{
|
|
|
7
7
|
image: "image";
|
|
8
8
|
}>;
|
|
9
9
|
type VectorSpace = output<typeof VectorSpace>;
|
|
10
|
-
/** ≤ 9 KiB as JSON (
|
|
10
|
+
/** ≤ 9 KiB as JSON (the vector index keeps 10 KiB); keys starting with `_` are reserved. */
|
|
11
11
|
declare const VectorMetadata: ZodRecord<ZodString, ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>>;
|
|
12
12
|
type VectorMetadata = output<typeof VectorMetadata>;
|
|
13
13
|
declare const VectorUpsertItem: ZodObject<{
|
|
@@ -22,7 +22,7 @@ declare const VectorUpsertItem: ZodObject<{
|
|
|
22
22
|
metadata: ZodOptional<ZodRecord<ZodString, ZodUnion<readonly [ZodString, ZodNumber, ZodBoolean, ZodArray<ZodString>]>>>;
|
|
23
23
|
}, $strip>;
|
|
24
24
|
type VectorUpsertItem = output<typeof VectorUpsertItem>;
|
|
25
|
-
/** A
|
|
25
|
+
/** A the vector index metadata filter on `VECTOR_FILTER_KEYS` only. */
|
|
26
26
|
declare const VectorFilter: ZodRecord<ZodEnum<{
|
|
27
27
|
type: "type";
|
|
28
28
|
source: "source";
|
|
@@ -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<{
|
package/dist/web/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
import '../_types/coerce.d-
|
|
1
|
+
import { T as TotalumClientOptions, U as Usage } from '../_types/errors.d-BfXTsxYG.js';
|
|
2
|
+
export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BfXTsxYG.js';
|
|
3
|
+
import { L as WebScrapeInput, M as WebSearchInput, N as WebMapInput, Q as WebCrawlInput, w as ScreenshotInput } from '../_types/integrations.d-DL2_rTOs.js';
|
|
4
|
+
export { J as JobCreated, x as ScreenshotOutput, W as WebJob, I as WebScrapeOutput, K as WebSearchOutput } from '../_types/integrations.d-DL2_rTOs.js';
|
|
5
|
+
import '../_types/coerce.d-DiNiCkat.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* `totalum.web`
|
|
8
|
+
* `totalum.web` over the Totalum API `/v1/web/*` (scope `web`): scrape, search, map, crawl and screenshots,
|
|
9
9
|
* billed in credits — every result carries `usage.credits`.
|
|
10
10
|
*/
|
|
11
11
|
declare function totalumWeb(options?: TotalumClientOptions): {
|
|
@@ -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>;
|
package/dist/web/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { envelopeClient, withUsage } from '../http.js';
|
|
2
2
|
export { TotalumError, isTotalumError } from '../errors.js';
|
|
3
3
|
/**
|
|
4
|
-
* `totalum.web`
|
|
4
|
+
* `totalum.web` over the Totalum API `/v1/web/*` (scope `web`): scrape, search, map, crawl and screenshots,
|
|
5
5
|
* billed in credits — every result carries `usage.credits`.
|
|
6
6
|
*/
|
|
7
7
|
export function totalumWeb(options = {}) {
|
package/dist/webhooks/index.d.ts
CHANGED
|
@@ -1,16 +1,41 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export {
|
|
3
|
-
import { T as TotalumClientOptions, a as TotalumError } from '../_types/errors.d-WcXvShIX.js';
|
|
4
|
-
export { b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-WcXvShIX.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-BfXTsxYG.js';
|
|
2
|
+
export { b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-BfXTsxYG.js';
|
|
5
3
|
|
|
6
|
-
/**
|
|
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>;
|
|
30
|
+
|
|
31
|
+
/** A webhook refusal: the codes never travel, the app answers 400. */
|
|
7
32
|
declare class TotalumWebhookError extends TotalumError {
|
|
8
33
|
name: string;
|
|
9
34
|
readonly errorCode: 'WEBHOOK_SECRET_MISSING' | 'WEBHOOK_SIGNATURE_INVALID' | 'WEBHOOK_TIMESTAMP_EXPIRED';
|
|
10
35
|
constructor(errorCode: TotalumWebhookError['errorCode'], message: string);
|
|
11
36
|
}
|
|
12
37
|
/**
|
|
13
|
-
* `totalum.webhooks.verify
|
|
38
|
+
* `totalum.webhooks.verify`: checks `Totalum-Signature: t=…,v1=…` — HMAC-SHA256 keyed with the
|
|
14
39
|
* endpoint's secret string over `${t}.${rawBody}` — within ±300 s, and returns the parsed event. Pass the body exactly
|
|
15
40
|
* as received (`await request.text()`). `secret` defaults to `TOTALUM_WEBHOOK_SECRET`, which Totalum sets on the
|
|
16
41
|
* preview, the published site and the sandbox (a rotation reaches them at once): never ask the owner to set it.
|
|
@@ -20,7 +45,7 @@ declare class TotalumWebhookError extends TotalumError {
|
|
|
20
45
|
*/
|
|
21
46
|
declare function verifyWebhook(rawBody: string, headers: Headers | Record<string, string | undefined>, secret?: string | undefined, now?: number): Promise<WebhookEvent>;
|
|
22
47
|
/**
|
|
23
|
-
* `totalum.webhooks`
|
|
48
|
+
* `totalum.webhooks` over the Totalum API `/v1/webhooks` (a key with scope `*`): where the project receives its
|
|
24
49
|
* signed events (payments, e-mail, browser programs, `project.credits.exhausted`) and the secret they are signed with.
|
|
25
50
|
*/
|
|
26
51
|
declare function totalumWebhooks(options?: TotalumClientOptions): {
|
|
@@ -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/dist/webhooks/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TotalumError } from '../errors.js';
|
|
2
2
|
import { jsonClient, readEnv } from '../http.js';
|
|
3
3
|
export { TotalumError, isTotalumError } from '../errors.js';
|
|
4
|
-
/** Literals type-locked to contracts, so the published package imports nothing at runtime
|
|
4
|
+
/** Literals type-locked to contracts, so the published package imports nothing at runtime. */
|
|
5
5
|
const SIGNATURE_HEADER = 'Totalum-Signature';
|
|
6
6
|
const TOLERANCE_SECONDS = 300;
|
|
7
|
-
/** A webhook refusal
|
|
7
|
+
/** A webhook refusal: the codes never travel, the app answers 400. */
|
|
8
8
|
export class TotalumWebhookError extends TotalumError {
|
|
9
9
|
name = 'TotalumWebhookError';
|
|
10
10
|
constructor(errorCode, message) {
|
|
@@ -13,7 +13,7 @@ export class TotalumWebhookError extends TotalumError {
|
|
|
13
13
|
}
|
|
14
14
|
const enc = new TextEncoder();
|
|
15
15
|
/**
|
|
16
|
-
* `totalum.webhooks.verify
|
|
16
|
+
* `totalum.webhooks.verify`: checks `Totalum-Signature: t=…,v1=…` — HMAC-SHA256 keyed with the
|
|
17
17
|
* endpoint's secret string over `${t}.${rawBody}` — within ±300 s, and returns the parsed event. Pass the body exactly
|
|
18
18
|
* as received (`await request.text()`). `secret` defaults to `TOTALUM_WEBHOOK_SECRET`, which Totalum sets on the
|
|
19
19
|
* preview, the published site and the sandbox (a rotation reaches them at once): never ask the owner to set it.
|
|
@@ -44,7 +44,7 @@ export async function verifyWebhook(rawBody, headers, secret = readEnv('TOTALUM_
|
|
|
44
44
|
throw new TotalumWebhookError('WEBHOOK_SIGNATURE_INVALID', 'Totalum-Signature does not match');
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
|
-
* `totalum.webhooks`
|
|
47
|
+
* `totalum.webhooks` over the Totalum API `/v1/webhooks` (a key with scope `*`): where the project receives its
|
|
48
48
|
* signed events (payments, e-mail, browser programs, `project.credits.exhausted`) and the secret they are signed with.
|
|
49
49
|
*/
|
|
50
50
|
export function totalumWebhooks(options = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "totalum-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.1",
|
|
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",
|