totalum-sdk 1.5.2 → 1.7.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,8 +1,8 @@
1
- import { c as LogsQueryInput } from '../_types/ops.d-DahecA8l.js';
2
- export { L as LogsPage } from '../_types/ops.d-DahecA8l.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-CgwliLKZ.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-CgwliLKZ.js';
5
- import '../_types/coerce.d-N9EPblpL.js';
1
+ import { c as LogsQueryInput } from '../_types/ops.d-CkGit8ca.js';
2
+ export { L as LogsPage } from '../_types/ops.d-CkGit8ca.js';
3
+ import { T as TotalumClientOptions } from '../_types/errors.d-4_bQY7cY.js';
4
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-4_bQY7cY.js';
5
+ import '../_types/coerce.d-DrNPZsE2.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, R as RefundInput } from '../_types/integrations.d-e2_1yv7Y.js';
2
- export { a as CheckoutOutput, b as CheckoutSession, i as CustomerPortalLinkOutput, p as OnboardingLinkOutput, P as PaymentsStatus, t as RefundOutput } from '../_types/integrations.d-e2_1yv7Y.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-CgwliLKZ.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-CgwliLKZ.js';
5
- import '../_types/coerce.d-N9EPblpL.js';
1
+ import { O as OnboardingLinkInput, C as CheckoutInput, h as CustomerPortalLinkInput, G as SubscriptionUpdateInput, R as RefundInput } from '../_types/integrations.d-DSTOYTIJ.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-DSTOYTIJ.js';
3
+ import { T as TotalumClientOptions } from '../_types/errors.d-4_bQY7cY.js';
4
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-4_bQY7cY.js';
5
+ import '../_types/coerce.d-DrNPZsE2.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
@@ -33,14 +33,19 @@ declare function totalumPayments(options?: TotalumClientOptions): {
33
33
  url: string;
34
34
  expiresAt: string;
35
35
  }>;
36
- /** A hosted Checkout Session: `payment`, `subscription`, or `setup` (save a card for later). Redirect to `url`. */
36
+ /**
37
+ * A hosted Checkout Session: `payment`, `subscription`, or `setup` (save a card for later). Redirect to `url`. A
38
+ * subscription needs a recurring price: an inline item with `recurring: { interval: 'month' }`, or a `priceId`;
39
+ * its `metadata` is also set on the subscription.
40
+ */
37
41
  createCheckout: (input: CheckoutInput) => Promise<{
38
42
  id: string;
39
43
  url: string;
40
44
  }>;
41
45
  /**
42
46
  * A Checkout Session read back (`paymentStatus: 'paid'`, your `metadata`): the page Stripe returns the buyer to
43
- * (`successUrl` with `?session_id={CHECKOUT_SESSION_ID}`) confirms the payment with it — no webhook needed.
47
+ * (`successUrl` with `?session_id={CHECKOUT_SESSION_ID}`) confirms the payment with it — no webhook needed. A
48
+ * subscription checkout also gives `subscriptionId` and `customerId`: store both on the member.
44
49
  */
45
50
  getCheckout: (sessionId: string) => Promise<{
46
51
  id: string;
@@ -52,11 +57,45 @@ declare function totalumPayments(options?: TotalumClientOptions): {
52
57
  paymentIntentId: string | null;
53
58
  customerEmail: string | null;
54
59
  clientReferenceId: string | null;
60
+ customerId: string | null;
61
+ subscriptionId: string | null;
55
62
  }>;
56
63
  /** Stripe's hosted portal where a customer manages their subscriptions and saved cards. */
57
64
  customerPortalLink: (input: CustomerPortalLinkInput) => Promise<{
58
65
  url: string;
59
66
  }>;
67
+ subscriptions: {
68
+ /** A subscription: access while `status` is `'active'` or `'trialing'`; `currentPeriodEnd` = next renewal. */
69
+ get: (subscriptionId: string) => Promise<{
70
+ id: string;
71
+ status: "active" | "paused" | "unpaid" | "incomplete" | "incomplete_expired" | "trialing" | "past_due" | "canceled";
72
+ customerId: string;
73
+ cancelAtPeriodEnd: boolean;
74
+ currentPeriodEnd: string | null;
75
+ canceledAt: string | null;
76
+ metadata: Record<string, string>;
77
+ }>;
78
+ /** `cancelAtPeriodEnd: true` ends it when the paid period ends (access until then); `false` resumes it. */
79
+ update: (subscriptionId: string, input: SubscriptionUpdateInput) => Promise<{
80
+ id: string;
81
+ status: "active" | "paused" | "unpaid" | "incomplete" | "incomplete_expired" | "trialing" | "past_due" | "canceled";
82
+ customerId: string;
83
+ cancelAtPeriodEnd: boolean;
84
+ currentPeriodEnd: string | null;
85
+ canceledAt: string | null;
86
+ metadata: Record<string, string>;
87
+ }>;
88
+ /** Cancel now: no more charges, `status: 'canceled'` at once. */
89
+ cancel: (subscriptionId: string) => Promise<{
90
+ id: string;
91
+ status: "active" | "paused" | "unpaid" | "incomplete" | "incomplete_expired" | "trialing" | "past_due" | "canceled";
92
+ customerId: string;
93
+ cancelAtPeriodEnd: boolean;
94
+ currentPeriodEnd: string | null;
95
+ canceledAt: string | null;
96
+ metadata: Record<string, string>;
97
+ }>;
98
+ };
60
99
  refunds: {
61
100
  /** Refund a payment (all of it, or `amount` in the smallest unit). */
62
101
  create: (input: RefundInput) => Promise<{
@@ -69,5 +108,5 @@ declare function totalumPayments(options?: TotalumClientOptions): {
69
108
  };
70
109
  type TotalumPayments = ReturnType<typeof totalumPayments>;
71
110
 
72
- export { CheckoutInput, CustomerPortalLinkInput, OnboardingLinkInput, RefundInput, TotalumClientOptions, totalumPayments };
111
+ export { CheckoutInput, CustomerPortalLinkInput, OnboardingLinkInput, RefundInput, SubscriptionUpdateInput, TotalumClientOptions, totalumPayments };
73
112
  export type { TotalumPayments };
@@ -13,15 +13,28 @@ export function totalumPayments(options = {}) {
13
13
  getStatus: () => call('GET', '/v1/payments/status'),
14
14
  /** Stripe's hosted onboarding for the project owner (single use; never for the agent's sandbox key). */
15
15
  onboardingLink: (input) => call('POST', '/v1/payments/onboarding-link', input),
16
- /** A hosted Checkout Session: `payment`, `subscription`, or `setup` (save a card for later). Redirect to `url`. */
16
+ /**
17
+ * A hosted Checkout Session: `payment`, `subscription`, or `setup` (save a card for later). Redirect to `url`. A
18
+ * subscription needs a recurring price: an inline item with `recurring: { interval: 'month' }`, or a `priceId`;
19
+ * its `metadata` is also set on the subscription.
20
+ */
17
21
  createCheckout: (input) => call('POST', '/v1/payments/checkout', input),
18
22
  /**
19
23
  * A Checkout Session read back (`paymentStatus: 'paid'`, your `metadata`): the page Stripe returns the buyer to
20
- * (`successUrl` with `?session_id={CHECKOUT_SESSION_ID}`) confirms the payment with it — no webhook needed.
24
+ * (`successUrl` with `?session_id={CHECKOUT_SESSION_ID}`) confirms the payment with it — no webhook needed. A
25
+ * subscription checkout also gives `subscriptionId` and `customerId`: store both on the member.
21
26
  */
22
27
  getCheckout: (sessionId) => call('GET', `/v1/payments/checkout/${encodeURIComponent(sessionId)}`),
23
28
  /** Stripe's hosted portal where a customer manages their subscriptions and saved cards. */
24
29
  customerPortalLink: (input) => call('POST', '/v1/payments/customer-portal-link', input),
30
+ subscriptions: {
31
+ /** A subscription: access while `status` is `'active'` or `'trialing'`; `currentPeriodEnd` = next renewal. */
32
+ get: (subscriptionId) => call('GET', `/v1/payments/subscriptions/${encodeURIComponent(subscriptionId)}`),
33
+ /** `cancelAtPeriodEnd: true` ends it when the paid period ends (access until then); `false` resumes it. */
34
+ update: (subscriptionId, input) => call('PATCH', `/v1/payments/subscriptions/${encodeURIComponent(subscriptionId)}`, input),
35
+ /** Cancel now: no more charges, `status: 'canceled'` at once. */
36
+ cancel: (subscriptionId) => call('DELETE', `/v1/payments/subscriptions/${encodeURIComponent(subscriptionId)}`),
37
+ },
25
38
  refunds: {
26
39
  /** Refund a payment (all of it, or `amount` in the smallest unit). */
27
40
  create: (input) => call('POST', '/v1/payments/refunds', input),
@@ -1,8 +1,8 @@
1
- import { q as PdfFromHtmlInput, r as PdfFromUrlInput } from '../_types/integrations.d-e2_1yv7Y.js';
2
- export { s as PdfOutput } from '../_types/integrations.d-e2_1yv7Y.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-CgwliLKZ.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-CgwliLKZ.js';
5
- import '../_types/coerce.d-N9EPblpL.js';
1
+ import { q as PdfFromHtmlInput, r as PdfFromUrlInput } from '../_types/integrations.d-DSTOYTIJ.js';
2
+ export { s as PdfOutput } from '../_types/integrations.d-DSTOYTIJ.js';
3
+ import { T as TotalumClientOptions } from '../_types/errors.d-4_bQY7cY.js';
4
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-4_bQY7cY.js';
5
+ import '../_types/coerce.d-DrNPZsE2.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): {
@@ -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-CgwliLKZ.js';
2
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-CgwliLKZ.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-4_bQY7cY.js';
2
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-4_bQY7cY.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-e2_1yv7Y.js';
2
- export { v as ScanOcrOutput } from '../_types/integrations.d-e2_1yv7Y.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-CgwliLKZ.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-CgwliLKZ.js';
5
- import '../_types/coerce.d-N9EPblpL.js';
1
+ import { S as ScanDocumentInput, u as ScanOcrInput } from '../_types/integrations.d-DSTOYTIJ.js';
2
+ export { v as ScanOcrOutput } from '../_types/integrations.d-DSTOYTIJ.js';
3
+ import { T as TotalumClientOptions } from '../_types/errors.d-4_bQY7cY.js';
4
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-4_bQY7cY.js';
5
+ import '../_types/coerce.d-DrNPZsE2.js';
6
6
 
7
7
  /**
8
8
  * The v1 scan result: the extracted fields (one set per page with `processEveryPdfPageAsDifferentScan`), the v1
@@ -1,7 +1,7 @@
1
- export { y as SeoIndexNowKey, z as SeoNotifyOutput } from '../_types/integrations.d-e2_1yv7Y.js';
2
- import { T as TotalumClientOptions } from '../_types/errors.d-CgwliLKZ.js';
3
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-CgwliLKZ.js';
4
- import '../_types/coerce.d-N9EPblpL.js';
1
+ export { y as SeoIndexNowKey, z as SeoNotifyOutput } from '../_types/integrations.d-DSTOYTIJ.js';
2
+ import { T as TotalumClientOptions } from '../_types/errors.d-4_bQY7cY.js';
3
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-4_bQY7cY.js';
4
+ import '../_types/coerce.d-DrNPZsE2.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-e2_1yv7Y.js';
2
- export { D as TranscribeOutput } from '../_types/integrations.d-e2_1yv7Y.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-CgwliLKZ.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-CgwliLKZ.js';
5
- import '../_types/coerce.d-N9EPblpL.js';
1
+ import { T as TranscribeInput, A as SpeakInput, B as StoredMedia } from '../_types/integrations.d-DSTOYTIJ.js';
2
+ export { H as TranscribeOutput } from '../_types/integrations.d-DSTOYTIJ.js';
3
+ import { T as TotalumClientOptions } from '../_types/errors.d-4_bQY7cY.js';
4
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-4_bQY7cY.js';
5
+ import '../_types/coerce.d-DrNPZsE2.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 {
@@ -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-CgwliLKZ.js';
2
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-CgwliLKZ.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 } from '../_types/errors.d-4_bQY7cY.js';
2
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-4_bQY7cY.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<{
@@ -103,7 +103,11 @@ type VectorRecord = output<typeof VectorRecord>;
103
103
  * metadata keys `source`, `type`, `tag`, `group` (strings) and `page` (number).
104
104
  */
105
105
  declare function totalumVectors(options?: TotalumClientOptions): {
106
- /** Inserts or replaces up to 100 vectors (≤ 8 images) from `values`, `text` or `image`, with optional metadata. */
106
+ /**
107
+ * Inserts or replaces up to 100 vectors (≤ 8 images) from `values`, `text` or `image`, with optional metadata.
108
+ * The answer (and `count()`) means stored; `query` and `get` see the write later — often seconds, sometimes 10+
109
+ * minutes (the index applies writes asynchronously). Never wait or poll for a write to become searchable.
110
+ */
107
111
  upsert: (vectors: VectorUpsertItem[]) => Promise<Omit<{
108
112
  upserted: number;
109
113
  count: number;
@@ -130,7 +134,7 @@ declare function totalumVectors(options?: TotalumClientOptions): {
130
134
  credits: number;
131
135
  };
132
136
  }>;
133
- /** The stored vectors (values and metadata) of up to 100 ids; unknown ids are left out. */
137
+ /** The stored vectors (values and metadata) of up to 100 ids; unknown and just-written ids are left out. */
134
138
  get: (ids: string[]) => Promise<{
135
139
  id: string;
136
140
  space: "text" | "image";
@@ -12,13 +12,17 @@ export function totalumVectors(options = {}) {
12
12
  const call = envelopeClient(options);
13
13
  const data = jsonClient(options);
14
14
  return {
15
- /** Inserts or replaces up to 100 vectors (≤ 8 images) from `values`, `text` or `image`, with optional metadata. */
15
+ /**
16
+ * Inserts or replaces up to 100 vectors (≤ 8 images) from `values`, `text` or `image`, with optional metadata.
17
+ * The answer (and `count()`) means stored; `query` and `get` see the write later — often seconds, sometimes 10+
18
+ * minutes (the index applies writes asynchronously). Never wait or poll for a write to become searchable.
19
+ */
16
20
  upsert: async (vectors) => withUsage(await call('POST', '/v1/vectors/upsert', {
17
21
  vectors,
18
22
  })),
19
23
  /** The `topK` (≤ 50, default 5) closest vectors to `text`, `values` or `image`, with their metadata. */
20
24
  query: async (input) => withUsage(await call('POST', '/v1/vectors/query', input)),
21
- /** The stored vectors (values and metadata) of up to 100 ids; unknown ids are left out. */
25
+ /** The stored vectors (values and metadata) of up to 100 ids; unknown and just-written ids are left out. */
22
26
  get: async (ids) => (await data('POST', '/v1/vectors/get', { ids })).vectors,
23
27
  /** Deletes up to 1,000 ids; answers how many existed and how many are left. */
24
28
  delete: async (ids) => withUsage(await call('POST', '/v1/vectors/delete', { ids })),
@@ -1,8 +1,8 @@
1
- import { I as WebScrapeInput, K as WebSearchInput, L as WebMapInput, M as WebCrawlInput, w as ScreenshotInput } from '../_types/integrations.d-e2_1yv7Y.js';
2
- export { J as JobCreated, x as ScreenshotOutput, W as WebJob, G as WebScrapeOutput, H as WebSearchOutput } from '../_types/integrations.d-e2_1yv7Y.js';
3
- import { T as TotalumClientOptions } from '../_types/errors.d-CgwliLKZ.js';
4
- export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-CgwliLKZ.js';
5
- import '../_types/coerce.d-N9EPblpL.js';
1
+ import { L as WebScrapeInput, M as WebSearchInput, N as WebMapInput, Q as WebCrawlInput, w as ScreenshotInput } from '../_types/integrations.d-DSTOYTIJ.js';
2
+ export { J as JobCreated, x as ScreenshotOutput, W as WebJob, I as WebScrapeOutput, K as WebSearchOutput } from '../_types/integrations.d-DSTOYTIJ.js';
3
+ import { T as TotalumClientOptions } from '../_types/errors.d-4_bQY7cY.js';
4
+ export { a as TotalumError, b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-4_bQY7cY.js';
5
+ import '../_types/coerce.d-DrNPZsE2.js';
6
6
 
7
7
  /**
8
8
  * `totalum.web` (plan 05 §6.2) over SDK-API `/v1/web/*` (scope `web`): Firecrawl scrape/search/map/crawl and Browser
@@ -1,7 +1,7 @@
1
- import { a as WebhookEvent } from '../_types/billing.d-D-B_EzGQ.js';
2
- export { W as WebhookConfig, b as WebhookSecretOutput } from '../_types/billing.d-D-B_EzGQ.js';
3
- import { T as TotalumClientOptions, a as TotalumError } from '../_types/errors.d-CgwliLKZ.js';
4
- export { b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-CgwliLKZ.js';
1
+ import { a as WebhookEvent } from '../_types/billing.d-BCV6NeP5.js';
2
+ export { W as WebhookConfig, b as WebhookSecretOutput } from '../_types/billing.d-BCV6NeP5.js';
3
+ import { T as TotalumClientOptions, a as TotalumError } from '../_types/errors.d-4_bQY7cY.js';
4
+ export { b as TotalumErrorCode, i as isTotalumError } from '../_types/errors.d-4_bQY7cY.js';
5
5
 
6
6
  /** A webhook refusal (plan 05 §7.2): the codes never travel, the app answers 400. */
7
7
  declare class TotalumWebhookError extends TotalumError {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "totalum-sdk",
3
- "version": "1.5.2",
3
+ "version": "1.7.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",