totalum-sdk 0.1.0-dev.10

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.
Files changed (53) hide show
  1. package/README.md +18 -0
  2. package/dist/_types/billing.d-BbSZh1wY.d.ts +38 -0
  3. package/dist/_types/coerce.d-C0KIW76L.d.ts +6 -0
  4. package/dist/_types/errors.d-Cu3q_E_r.d.ts +3093 -0
  5. package/dist/_types/integrations.d-BNGV70e3.d.ts +793 -0
  6. package/dist/_types/ops.d-C9375KIG.d.ts +117 -0
  7. package/dist/ai/index.d.ts +424 -0
  8. package/dist/ai/index.js +185 -0
  9. package/dist/analytics/index.d.ts +35 -0
  10. package/dist/analytics/index.js +15 -0
  11. package/dist/browser/index.d.ts +1595 -0
  12. package/dist/browser/index.js +168 -0
  13. package/dist/cron/index.d.ts +180 -0
  14. package/dist/cron/index.js +61 -0
  15. package/dist/d1/errors.js +31 -0
  16. package/dist/d1/https.js +103 -0
  17. package/dist/d1/index.d.ts +107 -0
  18. package/dist/d1/index.js +73 -0
  19. package/dist/d1/lazy.js +112 -0
  20. package/dist/d1/libsql.js +125 -0
  21. package/dist/d1/session.js +38 -0
  22. package/dist/d1/sql.js +87 -0
  23. package/dist/d1/types.js +1 -0
  24. package/dist/email/index.d.ts +31 -0
  25. package/dist/email/index.js +30 -0
  26. package/dist/errors.js +35 -0
  27. package/dist/files/index.d.ts +119 -0
  28. package/dist/files/index.js +63 -0
  29. package/dist/http.js +85 -0
  30. package/dist/index.d.ts +73 -0
  31. package/dist/index.js +68 -0
  32. package/dist/logs/index.d.ts +51 -0
  33. package/dist/logs/index.js +18 -0
  34. package/dist/payments/index.d.ts +47 -0
  35. package/dist/payments/index.js +20 -0
  36. package/dist/pdf/index.d.ts +42 -0
  37. package/dist/pdf/index.js +17 -0
  38. package/dist/react/index.d.ts +91 -0
  39. package/dist/react/index.js +178 -0
  40. package/dist/realtime/index.d.ts +103 -0
  41. package/dist/realtime/index.js +30 -0
  42. package/dist/scan/index.d.ts +46 -0
  43. package/dist/scan/index.js +12 -0
  44. package/dist/seo/index.d.ts +23 -0
  45. package/dist/seo/index.js +12 -0
  46. package/dist/speech/index.d.ts +41 -0
  47. package/dist/speech/index.js +22 -0
  48. package/dist/web/index.d.ts +170 -0
  49. package/dist/web/index.js +31 -0
  50. package/dist/webhooks/index.d.ts +48 -0
  51. package/dist/webhooks/index.js +61 -0
  52. package/package.json +146 -0
  53. package/totalum-sdk.md +1088 -0
package/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # totalum-sdk
2
+
3
+ The SDK Totalum v2 apps — and the coding agent building them — import for Totalum's built-in capabilities: the project database (`totalum-sdk/d1`, used through Drizzle) and every integration over HTTPS (files, AI, web, PDF, scan, speech, e-mail, cron, SEO, payments, browser, realtime tickets, logs, analytics, webhooks). No runtime dependencies. Server-side only.
4
+
5
+ ```ts
6
+ import { drizzle } from 'drizzle-orm/d1';
7
+ import { totalum } from 'totalum-sdk'; // or one namespace: import { totalumFiles } from 'totalum-sdk/files'
8
+ import { totalumD1 } from 'totalum-sdk/d1';
9
+
10
+ export const db = drizzle(totalumD1()); // the bound TOTALUM_DB in a Worker, HTTPS elsewhere; no I/O until the first statement
11
+ const { url } = await totalum.pdf.fromHtml({ html: '<h1>Invoice 12</h1>', name: 'invoice-12' });
12
+ ```
13
+
14
+ Configured by the environment, read at call time: `TOTALUM_PROJECT_KEY`, `TOTALUM_SDK_API_URL`, `TOTALUM_ENV=dev|live`. Every failure throws `TotalumError` (`errorCode`, `status`, `details`, `requestId`); `TotalumD1Error` keeps the binding's `D1_ERROR: …` message byte for byte.
15
+
16
+ The whole reference is [`totalum-sdk.md`](./totalum-sdk.md) (shipped in the package, generated from the types).
17
+
18
+ Pre-release (`0.1.0-dev.N`, dist-tag `dev`): the API may change until 0.1.0.
@@ -0,0 +1,38 @@
1
+ import { Z as ZodObject, k as ZodNumber, c as ZodOptional, d as ZodString, m as $strip, o as output, t as ZodISODateTime, f as ZodEnum, j as ZodBoolean, h as ZodRecord, g as ZodUnknown, v as ZodNullable, p as ZodURL } from './errors.d-Cu3q_E_r.js';
2
+
3
+ /** `usage` on every integration result (plan 11 §0.8): what the call cost, credits with 4 decimals. */
4
+ declare const IntegrationUsage: ZodObject<{
5
+ credits: ZodNumber;
6
+ vendor: ZodOptional<ZodString>;
7
+ units: ZodOptional<ZodNumber>;
8
+ vendorCostUsd: ZodOptional<ZodNumber>;
9
+ }, $strip>;
10
+ type IntegrationUsage = output<typeof IntegrationUsage>;
11
+ /** The delivery body: `{id, type, createdAt, projectId, env, livemode?, data}`, idempotent by `id`. */
12
+ declare const WebhookEvent: ZodObject<{
13
+ id: ZodString;
14
+ type: ZodString;
15
+ createdAt: ZodISODateTime;
16
+ projectId: ZodString;
17
+ env: ZodEnum<{
18
+ dev: "dev";
19
+ live: "live";
20
+ }>;
21
+ livemode: ZodOptional<ZodBoolean>;
22
+ data: ZodRecord<ZodString, ZodUnknown>;
23
+ }, $strip>;
24
+ type WebhookEvent = output<typeof WebhookEvent>;
25
+ /** `GET|PUT /v1/webhooks`: the secret itself is shown only by `POST /v1/webhooks/rotate-secret`. */
26
+ declare const WebhookConfig: ZodObject<{
27
+ url: ZodNullable<ZodURL>;
28
+ enabled: ZodBoolean;
29
+ secretPrefix: ZodNullable<ZodString>;
30
+ }, $strip>;
31
+ type WebhookConfig = output<typeof WebhookConfig>;
32
+ /** `POST /v1/webhooks/rotate-secret`: a new signing secret, revealed once (`whsec_` + 64 hex). */
33
+ declare const WebhookSecretOutput: ZodObject<{
34
+ secret: ZodString;
35
+ }, $strip>;
36
+ type WebhookSecretOutput = output<typeof WebhookSecretOutput>;
37
+
38
+ export { IntegrationUsage as I, WebhookConfig as W, WebhookEvent as a, WebhookSecretOutput as b };
@@ -0,0 +1,6 @@
1
+ import { _ as _ZodNumber, x as $ZodNumberInternals } from './errors.d-Cu3q_E_r.js';
2
+
3
+ interface ZodCoercedNumber<T = unknown> extends _ZodNumber<$ZodNumberInternals<T>> {
4
+ }
5
+
6
+ export type { ZodCoercedNumber as Z };