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/d1/errors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TotalumError } from '../errors.js';
|
|
2
2
|
/**
|
|
3
|
-
* The database `TotalumError
|
|
3
|
+
* The database `TotalumError`: `message` is `D1_ERROR: …`-shaped so it reads like a native failure —
|
|
4
4
|
* byte-identical to the binding's message when the failure is SQLite's.
|
|
5
5
|
*/
|
|
6
6
|
export class TotalumD1Error extends TotalumError {
|
|
@@ -13,7 +13,7 @@ export class TotalumD1Error extends TotalumError {
|
|
|
13
13
|
return new TotalumD1Error(errorCode, `D1_ERROR: ${errorCode}: ${message}`);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* SQLite's own failure, as the binding throws it
|
|
16
|
+
* SQLite's own failure, as the binding throws it: `name` `Error`, `message` `D1_ERROR: <sqlite>`, `cause`
|
|
17
17
|
* an `Error` with SQLite's words — so `String(err)`, `err.message` and `String(err.cause)` read the same on every path.
|
|
18
18
|
* Still a `TotalumD1Error` (`errorCode` `SQL_ERROR`) for code that checks.
|
|
19
19
|
*/
|
|
@@ -33,7 +33,7 @@ export class TotalumD1Error extends TotalumError {
|
|
|
33
33
|
});
|
|
34
34
|
return e;
|
|
35
35
|
}
|
|
36
|
-
/** The
|
|
36
|
+
/** The Totalum API error envelope → typed error; `SQL_ERROR` is rebuilt as the binding's own error from `sqliteMessage`. */
|
|
37
37
|
static fromWire(errors, status, requestId) {
|
|
38
38
|
const details = isRecord(errors.errorDetails) ? errors.errorDetails : undefined;
|
|
39
39
|
const sqlite = details?.['sqliteMessage'];
|
package/dist/d1/https.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TotalumD1Error } from './errors.js';
|
|
2
2
|
import { bindable, pickFirst } from './sql.js';
|
|
3
3
|
/**
|
|
4
|
-
* The wire headers the driver sends, as literals so the published package has no runtime dependency (
|
|
4
|
+
* The wire headers the driver sends, as literals so the published package has no runtime dependency (
|
|
5
5
|
* §1); `satisfies` over contracts' `as const` object fails the build if either side ever drifts.
|
|
6
6
|
*/
|
|
7
7
|
const HEADERS = {
|
|
@@ -9,7 +9,7 @@ const HEADERS = {
|
|
|
9
9
|
migrate: 'x-totalum-migrate',
|
|
10
10
|
migrateDestructive: 'x-totalum-migrate-destructive',
|
|
11
11
|
};
|
|
12
|
-
/** The `D1Database` half that speaks `POST /v1/db/query|batch` (
|
|
12
|
+
/** The `D1Database` half that speaks `POST /v1/db/query|batch` (contracts `db.ts`). */
|
|
13
13
|
export function httpsExecutor(config) {
|
|
14
14
|
const headers = {
|
|
15
15
|
authorization: `Bearer ${config.key}`,
|
|
@@ -86,7 +86,7 @@ export function httpsExecutor(config) {
|
|
|
86
86
|
},
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
/** Bytes travel as `{ $bytes: base64 }
|
|
89
|
+
/** Bytes travel as `{ $bytes: base64 }`; every other bindable value is JSON already. */
|
|
90
90
|
function encodeParam(value) {
|
|
91
91
|
if (value instanceof ArrayBuffer)
|
|
92
92
|
return { $bytes: toBase64(new Uint8Array(value)) };
|
package/dist/d1/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { S as SdkClientErrorCode, a as TotalumError, b as TotalumErrorCode, E as ErrorBody } from '../_types/errors.d-
|
|
1
|
+
import { S as SdkClientErrorCode, a as TotalumError, b as TotalumErrorCode, E as ErrorBody } from '../_types/errors.d-BfXTsxYG.js';
|
|
2
2
|
import { TotalumClientOptions } from '../ai/index.js';
|
|
3
|
-
export { i as isTotalumError } from '../_types/errors.d-
|
|
3
|
+
export { i as isTotalumError } from '../_types/errors.d-BfXTsxYG.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Cloudflare's `D1Database` surface, re-declared structurally so an app needs no Cloudflare types to compile
|
|
7
|
-
* and `drizzle-orm/d1` accepts the object
|
|
7
|
+
* and `drizzle-orm/d1` accepts the object. `D1Meta` is Cloudflare's own interface
|
|
8
8
|
* (`size_after` required); the contracts wire shape is looser and every value here satisfies it (type-tested).
|
|
9
9
|
*/
|
|
10
10
|
type D1Meta = {
|
|
@@ -55,7 +55,7 @@ interface D1Database {
|
|
|
55
55
|
interface TotalumD1Options extends TotalumClientOptions {
|
|
56
56
|
/** `'migrate'` (scripts/migrate.ts only) sends `x-totalum-migrate: 1` and enables `exec()`; default `'query'`. */
|
|
57
57
|
mode?: 'query' | 'migrate';
|
|
58
|
-
/** Migrate mode only: sends `x-totalum-migrate-destructive: 1
|
|
58
|
+
/** Migrate mode only: sends `x-totalum-migrate-destructive: 1`. */
|
|
59
59
|
destructive?: boolean;
|
|
60
60
|
/** An explicit binding wins over detection (plain Workers: `env.TOTALUM_DB`; tests: a Miniflare D1). */
|
|
61
61
|
binding?: D1Database;
|
|
@@ -63,12 +63,12 @@ interface TotalumD1Options extends TotalumClientOptions {
|
|
|
63
63
|
transport?: 'auto' | 'https';
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
/** The client-side codes the driver throws
|
|
66
|
+
/** The client-side codes the driver throws, from contracts' `SDK_CLIENT_ERROR_CODES`. */
|
|
67
67
|
type TotalumD1ClientCode = Extract<SdkClientErrorCode, 'SDK_NOT_CONFIGURED' | 'NOT_SUPPORTED' | 'BATCH_FOREIGN_STATEMENT' | 'NETWORK_ERROR' | 'RESPONSE_PARSE_ERROR'>;
|
|
68
68
|
/** @deprecated Since 1.0.0: use `TotalumErrorCode` (the same type). */
|
|
69
69
|
type TotalumD1ErrorCode = TotalumErrorCode;
|
|
70
70
|
/**
|
|
71
|
-
* The database `TotalumError
|
|
71
|
+
* The database `TotalumError`: `message` is `D1_ERROR: …`-shaped so it reads like a native failure —
|
|
72
72
|
* byte-identical to the binding's message when the failure is SQLite's.
|
|
73
73
|
*/
|
|
74
74
|
declare class TotalumD1Error extends TotalumError {
|
|
@@ -81,7 +81,7 @@ declare class TotalumD1Error extends TotalumError {
|
|
|
81
81
|
/** A client-side refusal (`D1_ERROR: <code>: <message>`). */
|
|
82
82
|
static client(errorCode: TotalumD1ClientCode | 'EXEC_REQUIRES_MIGRATE_MODE', message: string): TotalumD1Error;
|
|
83
83
|
/**
|
|
84
|
-
* SQLite's own failure, as the binding throws it
|
|
84
|
+
* SQLite's own failure, as the binding throws it: `name` `Error`, `message` `D1_ERROR: <sqlite>`, `cause`
|
|
85
85
|
* an `Error` with SQLite's words — so `String(err)`, `err.message` and `String(err.cause)` read the same on every path.
|
|
86
86
|
* Still a `TotalumD1Error` (`errorCode` `SQL_ERROR`) for code that checks.
|
|
87
87
|
*/
|
|
@@ -90,7 +90,7 @@ declare class TotalumD1Error extends TotalumError {
|
|
|
90
90
|
details?: Record<string, unknown>;
|
|
91
91
|
requestId?: string;
|
|
92
92
|
}): TotalumD1Error;
|
|
93
|
-
/** The
|
|
93
|
+
/** The Totalum API error envelope → typed error; `SQL_ERROR` is rebuilt as the binding's own error from `sqliteMessage`. */
|
|
94
94
|
static fromWire(errors: ErrorBody, status: number, requestId: string | undefined): TotalumD1Error;
|
|
95
95
|
}
|
|
96
96
|
declare function isTotalumD1Error(e: unknown): e is TotalumD1Error;
|
|
@@ -98,12 +98,12 @@ declare function isTotalumD1Error(e: unknown): e is TotalumD1Error;
|
|
|
98
98
|
/** Set on every mutating response; while the browser holds it, its reads go to the primary (read-your-writes). */
|
|
99
99
|
declare const READ_YOUR_WRITES_COOKIE = "__tlm_d1_w";
|
|
100
100
|
/**
|
|
101
|
-
* Runs one request of a Worker with a replicated D1
|
|
101
|
+
* Runs one request of a Worker with a replicated D1: a `GET`/`HEAD` reads through a
|
|
102
102
|
* `first-unconstrained` session — the nearest replica — unless the browser wrote in the last 10 s; any other method
|
|
103
103
|
* uses the plain binding (writes go to the primary; measured faster than any session) and its response sets the short
|
|
104
104
|
* cookie that sends that browser's next reads to the primary. A replica read that takes over `REPLICA_READ_TIMEOUT_MS`
|
|
105
105
|
* is answered by the primary instead, and the rest of that request reads the primary. A mutation's pure read the primary
|
|
106
|
-
* does not answer in that time is asked again on the primary (
|
|
106
|
+
* does not answer in that time is asked again on the primary (one call stalled while the database answered
|
|
107
107
|
* others; a sign-up waited on its first SELECT until the Worker was cancelled). `run` receives the env to hand to the
|
|
108
108
|
* app, whose `totalumD1()` reads `TOTALUM_DB` from it on every statement. No D1 binding (Turso, a laptop): `run(env)`
|
|
109
109
|
* unchanged.
|
|
@@ -111,9 +111,9 @@ declare const READ_YOUR_WRITES_COOKIE = "__tlm_d1_w";
|
|
|
111
111
|
declare function withTotalumSession<E extends object>(request: Request, env: E, run: (env: E) => Promise<Response>): Promise<Response>;
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
|
-
* A `D1Database` for the project's own database wherever the code runs
|
|
114
|
+
* A `D1Database` for the project's own database wherever the code runs: the bound
|
|
115
115
|
* `TOTALUM_DB` inside a Worker, the libsql adapter when the environment moved to Turso, the local D1 that
|
|
116
|
-
* `initOpenNextCloudflareForDev()` binds under `next dev`, and an HTTPS client to
|
|
116
|
+
* `initOpenNextCloudflareForDev()` binds under `next dev`, and an HTTPS client to the Totalum API everywhere else.
|
|
117
117
|
* Detection happens on the first statement, never at call time (§3.1).
|
|
118
118
|
*/
|
|
119
119
|
declare function totalumD1(options?: TotalumD1Options): D1Database;
|
package/dist/d1/index.js
CHANGED
|
@@ -8,9 +8,9 @@ export { TotalumError, isTotalumError } from '../errors.js';
|
|
|
8
8
|
export { TotalumD1Error, isTotalumD1Error } from './errors.js';
|
|
9
9
|
export { READ_YOUR_WRITES_COOKIE, withTotalumSession } from './session.js';
|
|
10
10
|
/**
|
|
11
|
-
* A `D1Database` for the project's own database wherever the code runs
|
|
11
|
+
* A `D1Database` for the project's own database wherever the code runs: the bound
|
|
12
12
|
* `TOTALUM_DB` inside a Worker, the libsql adapter when the environment moved to Turso, the local D1 that
|
|
13
|
-
* `initOpenNextCloudflareForDev()` binds under `next dev`, and an HTTPS client to
|
|
13
|
+
* `initOpenNextCloudflareForDev()` binds under `next dev`, and an HTTPS client to the Totalum API everywhere else.
|
|
14
14
|
* Detection happens on the first statement, never at call time (§3.1).
|
|
15
15
|
*/
|
|
16
16
|
export function totalumD1(options = {}) {
|
package/dist/d1/lazy.js
CHANGED
|
@@ -14,7 +14,7 @@ const READ = /^\s*(select|with)\b/i;
|
|
|
14
14
|
const uniqueColumns = (sql) => READ.test(sql) ? `SELECT * FROM (\n${sql.replace(/[\s;]+$/, '')}\n)` : sql;
|
|
15
15
|
/**
|
|
16
16
|
* The object `totalumD1()` hands out: no I/O and no environment detection until the first statement runs;
|
|
17
|
-
* the target is resolved once and cached
|
|
17
|
+
* the target is resolved once and cached — in a Worker that target reads the request's own binding on
|
|
18
18
|
* every statement (`index.ts`), so one module-scope instance serves every request with that request's database.
|
|
19
19
|
* Statements remember `sql` + params and are materialised on the target when executed, so `drizzle(totalumD1())` at
|
|
20
20
|
* module scope is legal.
|
|
@@ -40,14 +40,14 @@ export function lazyD1(resolve, migrate, { destructive = false } = {}) {
|
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Off the binding, several statements in one call run as one batch (atomic, as on D1) and answer the last one's
|
|
43
|
-
* result with every statement's `changes
|
|
43
|
+
* result with every statement's `changes`; one statement is prepared as written.
|
|
44
44
|
*/
|
|
45
45
|
async result() {
|
|
46
46
|
const t = await this.on();
|
|
47
47
|
if (isNative(t)) {
|
|
48
48
|
assertStatement(this.sql);
|
|
49
49
|
const params = bindable(this.params);
|
|
50
|
-
// a migration straight onto a binding (`npm run dev`'s local D1) follows
|
|
50
|
+
// a migration straight onto a binding (`npm run dev`'s local D1) follows the Totalum API's migrate-mode rules
|
|
51
51
|
if (migrate) {
|
|
52
52
|
refuseTransactions(this.sql);
|
|
53
53
|
guardMigration([{ sql: this.sql }], destructive);
|
|
@@ -131,7 +131,7 @@ export function lazyD1(resolve, migrate, { destructive = false } = {}) {
|
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
133
|
/**
|
|
134
|
-
* A D1 session (read replication
|
|
134
|
+
* A D1 session (read replication): on the native binding the binding's own `withSession()`, created on the
|
|
135
135
|
* first statement, so bookmarks work in hand-written code; on HTTPS and Turso there are no replicas and the session
|
|
136
136
|
* is the database itself, `getBookmark()` → `null`.
|
|
137
137
|
*/
|
package/dist/d1/libsql.js
CHANGED
|
@@ -3,13 +3,13 @@ import { TotalumD1Error } from './errors.js';
|
|
|
3
3
|
import { NO_STATEMENTS } from './native-shape.js';
|
|
4
4
|
import { bindable, pickFirst } from './sql.js';
|
|
5
5
|
/**
|
|
6
|
-
* D1 enforces foreign keys; a Turso database on the new engine
|
|
6
|
+
* D1 enforces foreign keys; a Turso database on the new engine starts every connection with them off, and each
|
|
7
7
|
* Hrana request is a new connection. So every request carries the pragma, inside the one transaction libsql opens for
|
|
8
8
|
* it (the new engine applies it there; libSQL has them on already and ignores it inside a transaction).
|
|
9
9
|
*/
|
|
10
10
|
const FOREIGN_KEYS_ON = { sql: 'PRAGMA foreign_keys = ON', args: [] };
|
|
11
11
|
/**
|
|
12
|
-
* The Turso path
|
|
12
|
+
* The Turso path: a `D1Database`-compatible executor over a libsql client created with
|
|
13
13
|
* `intMode: 'bigint'` (integers beyond 2^53 then degrade to the same double D1 returns instead of throwing).
|
|
14
14
|
* `meta` is synthesised from what libsql reports; `size_after` is not reported by libsql and is 0.
|
|
15
15
|
*/
|
|
@@ -135,7 +135,7 @@ function d1Error(sqliteMessage) {
|
|
|
135
135
|
return TotalumD1Error.engine(sqliteMessage, { status: 400, details: { sqliteMessage } });
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
|
-
* Turso's own failures in the words D1 has for the same situation (
|
|
138
|
+
* Turso's own failures in the words D1 has for the same situation (D1's list:
|
|
139
139
|
* developers.cloudflare.com/d1/observability/debug-d1), so code and the driver's retry rule (`retry.ts`) read one
|
|
140
140
|
* vocabulary on every connection: a statement cut off for running too long (524 after ≈ 125 s, 504), a gateway that
|
|
141
141
|
* lost the database (502, 52x: the statement may have run), a request not taken (503: it did not run), too many
|
|
@@ -174,7 +174,7 @@ function fromLibsqlValue(v) {
|
|
|
174
174
|
return v;
|
|
175
175
|
}
|
|
176
176
|
/**
|
|
177
|
-
* The new engine (
|
|
177
|
+
* The new engine (recorded 2026-09-24) words the same SQLite failures as `Tursodb error: Runtime error: <msg> (19)`
|
|
178
178
|
* or `Tursodb error: Parse error: <msg>`, and a composite key as `t.(a, b)` where SQLite says `t.a, t.b`.
|
|
179
179
|
*/
|
|
180
180
|
const TURSODB_PREFIX = /^Tursodb error: [A-Za-z ]+ error: /;
|
|
@@ -191,7 +191,7 @@ function mapLibsqlError(e, primaryKey) {
|
|
|
191
191
|
if (typeof err.message !== 'string')
|
|
192
192
|
return e;
|
|
193
193
|
if (typeof err.code !== 'string') {
|
|
194
|
-
// not libsql's: the Worker's own failure while reading the answer, or the connection
|
|
194
|
+
// not libsql's: the Worker's own failure while reading the answer, or the connection
|
|
195
195
|
if (err.message.startsWith('Memory limit exceeded'))
|
|
196
196
|
return d1Error(err.message);
|
|
197
197
|
return DROPPED.test(err.message) ? providerError(LOST) : e;
|
package/dist/d1/migrate-rules.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { TotalumD1Error } from './errors.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* of `npm run dev` (`scripts/migrate.ts --local
|
|
3
|
+
* the Totalum API's migrate-mode rules, applied where a migration reaches a D1 binding directly — the local D1
|
|
4
|
+
* of `npm run dev` (`scripts/migrate.ts --local`): a migration that the pipeline refuses is refused here
|
|
5
5
|
* too, with the same code and words, and drizzle-kit's table rebuild keeps the child rows as it does there. Without
|
|
6
6
|
* them `--local` accepted FTS5 tables and unconfirmed drops the preview then refused, and a rebuild emptied every
|
|
7
7
|
* table referencing the rebuilt one (D1 ignores `PRAGMA foreign_keys=OFF` inside a batch).
|
|
8
8
|
*
|
|
9
|
-
* `classify` is a copy of
|
|
9
|
+
* `classify` is a copy of the Totalum API's `packages/data-worker/guard.mjs`, `keepChildRows` of contracts'
|
|
10
10
|
* `sql-rebuild.ts` (with `safeRebuilds`) and `rowLoss` of contracts' `sql-row-loss.ts` (this package has no runtime
|
|
11
|
-
* dependency
|
|
11
|
+
* dependency); `test/node/migrate-rules.test.ts` holds the copies to the originals on a corpus.
|
|
12
12
|
*/
|
|
13
13
|
const READ_PRAGMAS = new Set([
|
|
14
14
|
'TABLE_INFO',
|
|
@@ -111,7 +111,7 @@ function mainKeywordAfterCte(body) {
|
|
|
111
111
|
}
|
|
112
112
|
return '';
|
|
113
113
|
}
|
|
114
|
-
/** One statement: read / write / DDL, or the guard's refusal (
|
|
114
|
+
/** One statement: read / write / DDL, or the guard's refusal ( keyword table). */
|
|
115
115
|
export function classify(sql) {
|
|
116
116
|
const { statements, norm } = tokenize(sql);
|
|
117
117
|
if (statements !== 1)
|
package/dist/d1/native-shape.js
CHANGED
|
@@ -2,12 +2,12 @@ import { TotalumD1Error } from './errors.js';
|
|
|
2
2
|
import { splitStatements } from './sql.js';
|
|
3
3
|
/**
|
|
4
4
|
* What the native binding does with the text of a statement, for the executors that are not the binding (HTTPS to
|
|
5
|
-
*
|
|
5
|
+
* the Totalum API, libsql to Turso): measured on production D1, so a statement answers the same on every path.
|
|
6
6
|
*
|
|
7
7
|
* - no statement (empty, only comments) → `D1_ERROR: No SQL statements detected.`;
|
|
8
8
|
* - transaction control (`BEGIN`, `COMMIT`, `END`, `ROLLBACK`, `SAVEPOINT`, `RELEASE`) → D1's refusal, word for word;
|
|
9
9
|
* - several statements in one call run as one atomic unit and answer the last one's rows, their `changes` summed; only
|
|
10
|
-
*
|
|
10
|
+
* the last may have parameters; inside `batch()` such a statement is refused.
|
|
11
11
|
*/
|
|
12
12
|
export const NO_STATEMENTS = 'No SQL statements detected.';
|
|
13
13
|
export const TRANSACTIONS = "To execute a transaction, please use the state.storage.transaction() or state.storage.transactionSync() APIs instead of the SQL BEGIN TRANSACTION or SAVEPOINT statements. The JavaScript API is safer because it will automatically roll back on exceptions, and because it interacts correctly with Durable Objects' automatic atomic write coalescing.";
|
package/dist/d1/retry.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { bare } from './native-shape.js';
|
|
2
2
|
/**
|
|
3
|
-
* The failures the driver repeats
|
|
3
|
+
* The failures the driver repeats, named by D1's own words — the Turso adapter words its provider's
|
|
4
4
|
* failures the same way (`libsql.ts`), so one rule covers the binding, Turso and the HTTPS path.
|
|
5
5
|
*
|
|
6
6
|
* - `TRANSIENT`: what Cloudflare documents as retryable (developers.cloudflare.com/d1/observability/debug-d1), plus the
|
|
7
|
-
*
|
|
7
|
+
* HTTPS path's `NETWORK_ERROR`. The statement may or may not have run, so only a pure read is repeated.
|
|
8
8
|
* - `NEVER_RAN`: the request did not reach a running database (D1 could not resolve or start it; Turso answered 503),
|
|
9
|
-
*
|
|
9
|
+
* so a write is repeated too.
|
|
10
10
|
*
|
|
11
11
|
* Never repeated: an overloaded database (D1: "send fewer requests"), a statement over a time, memory or size limit,
|
|
12
12
|
* any SQL error, and a write after `Network connection lost.` (it may have been applied).
|
package/dist/d1/session.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Set on every mutating response; while the browser holds it, its reads go to the primary (read-your-writes). */
|
|
2
2
|
export const READ_YOUR_WRITES_COOKIE = '__tlm_d1_w';
|
|
3
|
-
/** Replicas lag the primary by 30–75 ms (Cloudflare); 10 s leaves a wide margin
|
|
3
|
+
/** Replicas lag the primary by 30–75 ms (Cloudflare); 10 s leaves a wide margin. */
|
|
4
4
|
const WINDOW_SECONDS = 10;
|
|
5
5
|
const READS = new Set(['GET', 'HEAD']);
|
|
6
6
|
/**
|
|
@@ -13,12 +13,12 @@ export const REPLICA_READ_TIMEOUT_MS = 2000;
|
|
|
13
13
|
const PURE_READ = /^\s*select\b/i;
|
|
14
14
|
const LATE = Symbol('late');
|
|
15
15
|
/**
|
|
16
|
-
* Runs one request of a Worker with a replicated D1
|
|
16
|
+
* Runs one request of a Worker with a replicated D1: a `GET`/`HEAD` reads through a
|
|
17
17
|
* `first-unconstrained` session — the nearest replica — unless the browser wrote in the last 10 s; any other method
|
|
18
18
|
* uses the plain binding (writes go to the primary; measured faster than any session) and its response sets the short
|
|
19
19
|
* cookie that sends that browser's next reads to the primary. A replica read that takes over `REPLICA_READ_TIMEOUT_MS`
|
|
20
20
|
* is answered by the primary instead, and the rest of that request reads the primary. A mutation's pure read the primary
|
|
21
|
-
* does not answer in that time is asked again on the primary (
|
|
21
|
+
* does not answer in that time is asked again on the primary (one call stalled while the database answered
|
|
22
22
|
* others; a sign-up waited on its first SELECT until the Worker was cancelled). `run` receives the env to hand to the
|
|
23
23
|
* app, whose `totalumD1()` reads `TOTALUM_DB` from it on every statement. No D1 binding (Turso, a laptop): `run(env)`
|
|
24
24
|
* unchanged.
|
package/dist/d1/sql.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isRecord } from './errors.js';
|
|
2
2
|
/**
|
|
3
|
-
* Each value as the native binding binds it (
|
|
3
|
+
* Each value as the native binding binds it (measured on production D1): `null`, strings, numbers and
|
|
4
4
|
* booleans as they are (a non-finite number binds as `NULL`); `ArrayBuffer`, `Uint8Array` (a `Buffer`) and an empty
|
|
5
5
|
* array as a BLOB; a `DataView` as an empty BLOB; any other typed array as its text (`Int16Array [1, 256]` → `'1,256'`).
|
|
6
6
|
* Anything else is refused at `bind()` with the binding's own `D1_TYPE_ERROR` (the value printed as `${value}`).
|
|
@@ -40,7 +40,7 @@ export function pickFirst(results, colName) {
|
|
|
40
40
|
return row[colName];
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
|
-
* A `;` inside the `BEGIN … END` body of a `CREATE TRIGGER` ends one of its statements, not the trigger (as
|
|
43
|
+
* A `;` inside the `BEGIN … END` body of a `CREATE TRIGGER` ends one of its statements, not the trigger (as the Totalum API's
|
|
44
44
|
* statement guard reads it). Keywords are counted with literals and comments blanked; a `CASE` brings its own `END`.
|
|
45
45
|
*/
|
|
46
46
|
function insideTriggerBody(fragment) {
|
package/dist/email/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 { E as EmailSendInput, k as EmailView } from '../_types/integrations.d-DL2_rTOs.js';
|
|
4
|
+
export { j as EmailSendOutput } from '../_types/integrations.d-DL2_rTOs.js';
|
|
5
|
+
import '../_types/coerce.d-DiNiCkat.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* `totalum.email`
|
|
8
|
+
* `totalum.email` over the Totalum API `/v1/email/*` (scope `email`): HTML sent byte for byte, charged
|
|
9
9
|
* per recipient. On dev only allow-listed recipients are accepted (`DEV_RECIPIENT_NOT_ALLOWED`).
|
|
10
10
|
*/
|
|
11
11
|
declare function totalumEmail(options?: TotalumClientOptions): {
|
|
@@ -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>;
|
package/dist/email/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { isTotalumError } from '../errors.js';
|
|
|
2
2
|
import { envelopeClient, jsonClient, withUsage } from '../http.js';
|
|
3
3
|
export { TotalumError, isTotalumError } from '../errors.js';
|
|
4
4
|
/**
|
|
5
|
-
* `totalum.email`
|
|
5
|
+
* `totalum.email` over the Totalum API `/v1/email/*` (scope `email`): HTML sent byte for byte, charged
|
|
6
6
|
* per recipient. On dev only allow-listed recipients are accepted (`DEV_RECIPIENT_NOT_ALLOWED`).
|
|
7
7
|
*/
|
|
8
8
|
export function totalumEmail(options = {}) {
|
package/dist/errors.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The one error every `totalum-sdk` call throws
|
|
2
|
+
* The one error every `totalum-sdk` call throws: the Totalum API envelope's frozen `errorCode`, the HTTP
|
|
3
3
|
* status and `details`. `TotalumD1Error` (`totalum-sdk/d1`) and `TotalumWebhookError` (`totalum-sdk/webhooks`)
|
|
4
4
|
* extend it, so one `isTotalumError(e)` check covers the whole package.
|
|
5
5
|
*/
|
|
@@ -9,7 +9,7 @@ export class TotalumError extends Error {
|
|
|
9
9
|
/** HTTP status; 0 for network errors, 500 for client-side refusals. */
|
|
10
10
|
status;
|
|
11
11
|
details;
|
|
12
|
-
/**
|
|
12
|
+
/** the Totalum API's request id, for support and the logs explorer. */
|
|
13
13
|
requestId;
|
|
14
14
|
constructor(errorCode, message, status = 500, details, requestId) {
|
|
15
15
|
super(message);
|
|
@@ -39,10 +39,10 @@ export class TotalumError extends Error {
|
|
|
39
39
|
export function isTotalumError(e) {
|
|
40
40
|
return e instanceof TotalumError;
|
|
41
41
|
}
|
|
42
|
-
/** Inside workerd: the preview and the published app
|
|
42
|
+
/** Inside workerd: the preview and the published app. */
|
|
43
43
|
export const inWorker = () => typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers';
|
|
44
44
|
/**
|
|
45
|
-
* Refuses a Node-only method inside a Worker
|
|
45
|
+
* Refuses a Node-only method inside a Worker: the message says where the app runs, what was called and
|
|
46
46
|
* the HTTPS replacement; `details {method, replacement, docsUrl}` lets a caller render the hint.
|
|
47
47
|
*/
|
|
48
48
|
export function assertNode(method, replacement, docsUrl) {
|
package/dist/files/index.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { F as FileDescriptor, l as FileUploadUrlInput, n as FilesListQuery } from '../_types/integrations.d-
|
|
2
|
-
export { m as FileUploadUrlOutput, o as FilesPage } 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 { F as FileDescriptor, l as FileUploadUrlInput, n as FilesListQuery } from '../_types/integrations.d-DL2_rTOs.js';
|
|
2
|
+
export { m as FileUploadUrlOutput, o as FilesPage } 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
|
interface TotalumFilesOptions extends TotalumClientOptions {
|
|
8
|
-
/** The public files host; default `TOTALUM_FILES_URL`, else `https://files.totalum-project.com
|
|
8
|
+
/** The public files host; default `TOTALUM_FILES_URL`, else `https://files.totalum-project.com`. */
|
|
9
9
|
filesUrl?: string;
|
|
10
10
|
}
|
|
11
11
|
interface UploadOptions {
|
|
12
12
|
name?: string;
|
|
13
13
|
contentType?: string;
|
|
14
|
-
/** `true` stores the file under the private prefix: no public URL, read it through `getSignedUrl
|
|
14
|
+
/** `true` stores the file under the private prefix: no public URL, read it through `getSignedUrl`. */
|
|
15
15
|
private?: boolean;
|
|
16
16
|
folder?: string;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* `totalum.files` (
|
|
19
|
+
* `totalum.files` (the Totalum API ) over HTTPS with the project key. Every call returns the file
|
|
20
20
|
* descriptor `{key, fileName, fileSize, contentType, fileUrl, visibility, createdAt}` meant to be stored as-is in the
|
|
21
|
-
* row's file column; failures throw `TotalumError` with
|
|
21
|
+
* row's file column; failures throw `TotalumError` with the Totalum API's frozen code.
|
|
22
22
|
*/
|
|
23
23
|
declare function totalumFiles(options?: TotalumFilesOptions): {
|
|
24
|
-
/** Up to 25 MB through
|
|
24
|
+
/** Up to 25 MB through the Totalum API; larger files go through `getUploadUrl` + `complete`. */
|
|
25
25
|
upload(input: Blob | ArrayBuffer | Uint8Array | string, opts?: UploadOptions): Promise<FileDescriptor>;
|
|
26
26
|
/**
|
|
27
27
|
* A presigned PUT (15 min, bound to this type and size) for a direct browser/Node upload; then `complete(key)`.
|
|
@@ -116,7 +116,7 @@ declare function totalumFiles(options?: TotalumFilesOptions): {
|
|
|
116
116
|
stream: (key: string, opts?: {
|
|
117
117
|
range?: string;
|
|
118
118
|
}) => Promise<Response>;
|
|
119
|
-
/** Sync, no I/O: the public URL of a `p/` key, or the authenticated
|
|
119
|
+
/** Sync, no I/O: the public URL of a `p/` key, or the authenticated the Totalum API URL of a private `pv/` key. */
|
|
120
120
|
url(key: string): string;
|
|
121
121
|
};
|
|
122
122
|
type TotalumFiles = ReturnType<typeof totalumFiles>;
|
package/dist/files/index.js
CHANGED
|
@@ -3,9 +3,9 @@ import { apiUrlOf, jsonClient, query, rawClient, readEnv } from '../http.js';
|
|
|
3
3
|
export { TotalumError, isTotalumError } from '../errors.js';
|
|
4
4
|
const DEFAULT_FILES_URL = 'https://files.totalum-project.com';
|
|
5
5
|
/**
|
|
6
|
-
* `totalum.files` (
|
|
6
|
+
* `totalum.files` (the Totalum API ) over HTTPS with the project key. Every call returns the file
|
|
7
7
|
* descriptor `{key, fileName, fileSize, contentType, fileUrl, visibility, createdAt}` meant to be stored as-is in the
|
|
8
|
-
* row's file column; failures throw `TotalumError` with
|
|
8
|
+
* row's file column; failures throw `TotalumError` with the Totalum API's frozen code.
|
|
9
9
|
*/
|
|
10
10
|
export function totalumFiles(options = {}) {
|
|
11
11
|
const call = jsonClient(options);
|
|
@@ -17,7 +17,7 @@ export function totalumFiles(options = {}) {
|
|
|
17
17
|
return (await call('GET', `${path(key)}/download-url${q}`)).url;
|
|
18
18
|
};
|
|
19
19
|
return {
|
|
20
|
-
/** Up to 25 MB through
|
|
20
|
+
/** Up to 25 MB through the Totalum API; larger files go through `getUploadUrl` + `complete`. */
|
|
21
21
|
upload(input, opts = {}) {
|
|
22
22
|
const type = opts.contentType ?? (input instanceof Blob ? input.type : '');
|
|
23
23
|
const name = opts.name ?? (input instanceof File ? input.name : 'file');
|
|
@@ -64,7 +64,7 @@ export function totalumFiles(options = {}) {
|
|
|
64
64
|
},
|
|
65
65
|
/** The object itself (private files included), with `Range` support; errors throw like every other call. */
|
|
66
66
|
stream: (key, opts = {}) => raw(path(key), undefined, 'GET', opts.range ? { range: opts.range } : {}),
|
|
67
|
-
/** Sync, no I/O: the public URL of a `p/` key, or the authenticated
|
|
67
|
+
/** Sync, no I/O: the public URL of a `p/` key, or the authenticated the Totalum API URL of a private `pv/` key. */
|
|
68
68
|
url(key) {
|
|
69
69
|
return key.startsWith('pv/') ? apiUrlOf(options) + path(key) : `${filesUrl()}/${key}`;
|
|
70
70
|
},
|
package/dist/http.js
CHANGED
|
@@ -19,15 +19,15 @@ export function projectKey(options) {
|
|
|
19
19
|
}
|
|
20
20
|
export const apiUrlOf = (options) => options.apiUrl ?? readEnv('TOTALUM_SDK_API_URL') ?? DEFAULT_API_URL;
|
|
21
21
|
export const envOf = (options) => options.env ?? (readEnv('TOTALUM_ENV') === 'dev' ? 'dev' : 'live');
|
|
22
|
-
/** One HTTPS call to
|
|
22
|
+
/** One HTTPS call to the Totalum API with the project key; a transport failure is `NETWORK_ERROR`. */
|
|
23
23
|
export async function send(options, method, route, body, extra = {}) {
|
|
24
24
|
const headers = {
|
|
25
25
|
...extra,
|
|
26
26
|
authorization: `Bearer ${projectKey(options)}`,
|
|
27
27
|
'x-totalum-env': envOf(options),
|
|
28
28
|
};
|
|
29
|
-
// which deployment is calling (
|
|
30
|
-
// in Stripe live mode only from `live`
|
|
29
|
+
// which deployment is calling (Totalum binds `dev` on the preview Worker, `live` on the published one): payments charge
|
|
30
|
+
// in Stripe live mode only from `live`
|
|
31
31
|
const usageEnv = readEnv('TOTALUM_USAGE_ENV');
|
|
32
32
|
if (usageEnv === 'dev' || usageEnv === 'live')
|
|
33
33
|
headers['x-totalum-usage-env'] = usageEnv;
|
|
@@ -58,7 +58,7 @@ export async function send(options, method, route, body, extra = {}) {
|
|
|
58
58
|
/** A `429 RATE_LIMITED` (the project's built-in calls per second) is retried this many times, then thrown. */
|
|
59
59
|
const RATE_RETRIES = 2;
|
|
60
60
|
/**
|
|
61
|
-
* The wait before retrying a `429 RATE_LIMITED`, else 0.
|
|
61
|
+
* The wait before retrying a `429 RATE_LIMITED`, else 0. the Totalum API refuses it before any charge or vendor call, so a retry
|
|
62
62
|
* is always safe; `retryAfterMs` plus up to as much again of jitter spreads a burst over the next second.
|
|
63
63
|
*/
|
|
64
64
|
async function rateLimitedWait(res) {
|
|
@@ -89,11 +89,11 @@ export async function envelopeOf(res) {
|
|
|
89
89
|
}
|
|
90
90
|
return envelope;
|
|
91
91
|
}
|
|
92
|
-
/** JSON calls to
|
|
92
|
+
/** JSON calls to the Totalum API with the project key: the whole envelope, or `TotalumError` with the frozen code. */
|
|
93
93
|
export function envelopeClient(options) {
|
|
94
94
|
return async (method, route, body) => envelopeOf(await send(options, method, route, body));
|
|
95
95
|
}
|
|
96
|
-
/** JSON calls to
|
|
96
|
+
/** JSON calls to the Totalum API with the project key: the envelope's `data`, or `TotalumError` with the frozen code. */
|
|
97
97
|
export function jsonClient(options) {
|
|
98
98
|
const call = envelopeClient(options);
|
|
99
99
|
return async (method, route, body) => (await call(method, route, body)).data;
|
|
@@ -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
|
|
119
|
-
export const withUsage = ({ data, metadata }) =>
|
|
120
|
-
...data
|
|
121
|
-
|
|
122
|
-
}
|
|
118
|
+
/** `data` + `usage {credits}` from `metadata` (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-
|
|
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-
|
|
36
|
-
export { L as LogsPage, S as SiteAnalyticsOutput, a as SiteDimension, b as SiteMetric } from './_types/ops.d-
|
|
37
|
-
|
|
38
|
-
import './_types/coerce.d-Cli9TkUD.js';
|
|
34
|
+
export { T as TotalumClientOptions, a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from './_types/errors.d-BfXTsxYG.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-DL2_rTOs.js';
|
|
36
|
+
export { L as LogsPage, S as SiteAnalyticsOutput, a as SiteDimension, b as SiteMetric } from './_types/ops.d-fwLDriUN.js';
|
|
37
|
+
import './_types/coerce.d-DiNiCkat.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;
|
|
@@ -61,7 +60,7 @@ type Totalum = {
|
|
|
61
60
|
readonly [K in keyof typeof namespaces]: ReturnType<(typeof namespaces)[K]>;
|
|
62
61
|
};
|
|
63
62
|
/**
|
|
64
|
-
* Every integration namespace on one object
|
|
63
|
+
* Every integration namespace on one object, each built on first access with the same options — no I/O
|
|
65
64
|
* and no env read until a method is called. The database is `totalumD1()` from `totalum-sdk/d1`, not a namespace.
|
|
66
65
|
*
|
|
67
66
|
* @example
|
package/dist/index.js
CHANGED
|
@@ -50,7 +50,7 @@ const namespaces = {
|
|
|
50
50
|
webhooks: totalumWebhooks,
|
|
51
51
|
};
|
|
52
52
|
/**
|
|
53
|
-
* Every integration namespace on one object
|
|
53
|
+
* Every integration namespace on one object, each built on first access with the same options — no I/O
|
|
54
54
|
* and no env read until a method is called. The database is `totalumD1()` from `totalum-sdk/d1`, not a namespace.
|
|
55
55
|
*
|
|
56
56
|
* @example
|
package/dist/logs/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { c as LogsQueryInput } from '../_types/ops.d-
|
|
2
|
-
export { L as LogsPage } from '../_types/ops.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 { c as LogsQueryInput } from '../_types/ops.d-fwLDriUN.js';
|
|
2
|
+
export { L as LogsPage } from '../_types/ops.d-fwLDriUN.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
|
/** 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'>;
|
|
9
9
|
/**
|
|
10
|
-
* `totalum.logs`
|
|
10
|
+
* `totalum.logs` over the Totalum API `/v1/logs` (scope `logs:read`; the agent's sandbox key reads its dev
|
|
11
11
|
* preview for free): the Worker invocations of the published app (`env: 'live'`) or the preview (`'dev'`). Free.
|
|
12
12
|
*/
|
|
13
13
|
declare function totalumLogs(options?: TotalumClientOptions): {
|