deepline 0.1.103 → 0.1.105
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/cli/index.js +577 -16
- package/dist/cli/index.mjs +577 -16
- package/dist/index.d.mts +184 -1
- package/dist/index.d.ts +184 -1
- package/dist/index.js +135 -9
- package/dist/index.mjs +135 -9
- package/dist/repo/sdk/src/client.ts +312 -6
- package/dist/repo/sdk/src/http.ts +12 -1
- package/dist/repo/sdk/src/index.ts +6 -0
- package/dist/repo/sdk/src/release.ts +5 -2
- package/dist/repo/shared_libs/play-runtime/csv-rename.ts +26 -0
- package/dist/repo/shared_libs/play-runtime/providers.ts +2 -2
- package/dist/repo/shared_libs/play-runtime/scheduler-backend.ts +2 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1371,6 +1371,148 @@ type RunsNamespace = {
|
|
|
1371
1371
|
reason?: string;
|
|
1372
1372
|
}) => Promise<StopPlayRunResult>;
|
|
1373
1373
|
};
|
|
1374
|
+
/** One credit grant pool reported by the billing subscription status endpoint. */
|
|
1375
|
+
type BillingCreditPool = {
|
|
1376
|
+
pool: string;
|
|
1377
|
+
credits_remaining: number;
|
|
1378
|
+
credits_granted: number;
|
|
1379
|
+
source: string;
|
|
1380
|
+
cycle_key: string | null;
|
|
1381
|
+
effective_at: string;
|
|
1382
|
+
};
|
|
1383
|
+
/**
|
|
1384
|
+
* Subscription state for the active workspace, from
|
|
1385
|
+
* `GET /api/v2/billing/subscription/status`. All amounts are Deepline credits
|
|
1386
|
+
* and Deepline-facing USD — never provider spend.
|
|
1387
|
+
*/
|
|
1388
|
+
type BillingSubscriptionStatus = {
|
|
1389
|
+
org_id: string;
|
|
1390
|
+
plan_version_id: string;
|
|
1391
|
+
plan_name: string;
|
|
1392
|
+
plan_family_id: string;
|
|
1393
|
+
/** Whether a Stripe subscription backs the active plan. */
|
|
1394
|
+
subscribed: boolean;
|
|
1395
|
+
price_usd: number | null;
|
|
1396
|
+
price_interval: string | null;
|
|
1397
|
+
monthly_grant_credits: number;
|
|
1398
|
+
assigned_by: string;
|
|
1399
|
+
assigned_at: string | null;
|
|
1400
|
+
credit_pools: BillingCreditPool[];
|
|
1401
|
+
pooled_credits_remaining: number;
|
|
1402
|
+
/** End of the current paid period (ISO timestamp), when Stripe is reachable. */
|
|
1403
|
+
current_period_end: string | null;
|
|
1404
|
+
/** True when a cancellation is already scheduled for period end. */
|
|
1405
|
+
cancel_at_period_end: boolean | null;
|
|
1406
|
+
stripe_status: string | null;
|
|
1407
|
+
};
|
|
1408
|
+
/**
|
|
1409
|
+
* Result of `POST /api/v2/billing/subscription/cancel`. Cancellation is always
|
|
1410
|
+
* at period end: the customer keeps the cycle they paid for and every
|
|
1411
|
+
* remaining credit. `undo_cancel` reverses a pending cancellation.
|
|
1412
|
+
*/
|
|
1413
|
+
type BillingSubscriptionCancelResult = {
|
|
1414
|
+
org_id: string;
|
|
1415
|
+
subscription_id: string;
|
|
1416
|
+
cancel_at_period_end: boolean;
|
|
1417
|
+
current_period_end: string | null;
|
|
1418
|
+
status: string;
|
|
1419
|
+
message: string;
|
|
1420
|
+
};
|
|
1421
|
+
/**
|
|
1422
|
+
* One customer-facing billing history entry from
|
|
1423
|
+
* `GET /api/v2/billing/invoices`: a subscription invoice or a one-time credit
|
|
1424
|
+
* purchase receipt. Amounts are what the customer paid — never provider spend.
|
|
1425
|
+
*/
|
|
1426
|
+
type BillingInvoiceEntry = {
|
|
1427
|
+
kind: 'invoice' | 'receipt';
|
|
1428
|
+
id: string;
|
|
1429
|
+
created_at: string;
|
|
1430
|
+
description: string;
|
|
1431
|
+
amount_cents: number;
|
|
1432
|
+
currency: string;
|
|
1433
|
+
status: string;
|
|
1434
|
+
/** Stripe-hosted page (invoice or card receipt). */
|
|
1435
|
+
url: string | null;
|
|
1436
|
+
/** Direct PDF when Stripe provides one (invoices only). */
|
|
1437
|
+
pdf_url: string | null;
|
|
1438
|
+
};
|
|
1439
|
+
type BillingInvoicesResult = {
|
|
1440
|
+
org_id: string;
|
|
1441
|
+
entries: BillingInvoiceEntry[];
|
|
1442
|
+
};
|
|
1443
|
+
/** One published plan from `GET /api/v2/billing/catalog/current`. */
|
|
1444
|
+
type BillingPlanEntry = {
|
|
1445
|
+
plan_family_id: string;
|
|
1446
|
+
plan_version_id: string;
|
|
1447
|
+
public_name: string;
|
|
1448
|
+
price_usd: number | null;
|
|
1449
|
+
price_interval: string | null;
|
|
1450
|
+
monthly_grant_credits: number;
|
|
1451
|
+
rollover: {
|
|
1452
|
+
mode: string;
|
|
1453
|
+
max_credits?: number;
|
|
1454
|
+
};
|
|
1455
|
+
/** Whether the plan can be purchased via subscription checkout. */
|
|
1456
|
+
acquirable: boolean;
|
|
1457
|
+
};
|
|
1458
|
+
/** One usage metric published in the billing catalog. */
|
|
1459
|
+
type BillingMetricEntry = {
|
|
1460
|
+
id: string;
|
|
1461
|
+
name: string;
|
|
1462
|
+
};
|
|
1463
|
+
/** The caller's active plan as reported by the plans endpoint. */
|
|
1464
|
+
type BillingActivePlan = {
|
|
1465
|
+
plan_family_id: string;
|
|
1466
|
+
plan_version_id: string;
|
|
1467
|
+
public_name: string;
|
|
1468
|
+
rate_card_id: string;
|
|
1469
|
+
assigned_by: string;
|
|
1470
|
+
assigned_at: string | null;
|
|
1471
|
+
has_subscription: boolean;
|
|
1472
|
+
};
|
|
1473
|
+
/**
|
|
1474
|
+
* Published plans plus the caller's active plan, from
|
|
1475
|
+
* `GET /api/v2/billing/catalog/current`. Answers "what plans exist and what
|
|
1476
|
+
* am I on". All amounts are Deepline credits and Deepline-facing USD — never
|
|
1477
|
+
* provider spend.
|
|
1478
|
+
*/
|
|
1479
|
+
type BillingPlansResult = {
|
|
1480
|
+
catalog_id: string;
|
|
1481
|
+
catalog_version: string;
|
|
1482
|
+
active_plan: BillingActivePlan;
|
|
1483
|
+
plans: BillingPlanEntry[];
|
|
1484
|
+
metrics: BillingMetricEntry[];
|
|
1485
|
+
};
|
|
1486
|
+
/**
|
|
1487
|
+
* Public billing namespace exposed as `client.billing`.
|
|
1488
|
+
*
|
|
1489
|
+
* Carries the durable Deepline billing product model — plans, subscription
|
|
1490
|
+
* state, period-end cancellation, and invoice/receipt history — so CLI
|
|
1491
|
+
* commands and programmatic callers share the same surface.
|
|
1492
|
+
*
|
|
1493
|
+
* @sdkReference client 030 client.billing
|
|
1494
|
+
*/
|
|
1495
|
+
type BillingNamespace = {
|
|
1496
|
+
/** Published plans plus the plan you are on ("what plans exist and what am I on"). */
|
|
1497
|
+
plans: () => Promise<BillingPlansResult>;
|
|
1498
|
+
subscription: {
|
|
1499
|
+
/** Active plan, Stripe subscription state, and remaining credit pools. */
|
|
1500
|
+
status: () => Promise<BillingSubscriptionStatus>;
|
|
1501
|
+
/**
|
|
1502
|
+
* Schedule cancellation at period end (credits are kept), or reverse a
|
|
1503
|
+
* pending cancellation with `{ undo: true }`.
|
|
1504
|
+
*/
|
|
1505
|
+
cancel: (options?: {
|
|
1506
|
+
undo?: boolean;
|
|
1507
|
+
}) => Promise<BillingSubscriptionCancelResult>;
|
|
1508
|
+
};
|
|
1509
|
+
invoices: {
|
|
1510
|
+
/** Subscription invoices plus credit purchase receipts, newest first. */
|
|
1511
|
+
list: (options?: {
|
|
1512
|
+
limit?: number;
|
|
1513
|
+
}) => Promise<BillingInvoicesResult>;
|
|
1514
|
+
};
|
|
1515
|
+
};
|
|
1374
1516
|
/**
|
|
1375
1517
|
* Low-level client for the Deepline REST API.
|
|
1376
1518
|
*
|
|
@@ -1398,6 +1540,8 @@ declare class DeeplineClient {
|
|
|
1398
1540
|
private readonly config;
|
|
1399
1541
|
/** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
|
|
1400
1542
|
readonly runs: RunsNamespace;
|
|
1543
|
+
/** Billing namespace: subscription status/cancel and invoice history. */
|
|
1544
|
+
readonly billing: BillingNamespace;
|
|
1401
1545
|
/**
|
|
1402
1546
|
* Create a low-level SDK client.
|
|
1403
1547
|
*
|
|
@@ -2131,6 +2275,45 @@ declare class DeeplineClient {
|
|
|
2131
2275
|
/** Compatibility flag; active sibling runs are allowed. */
|
|
2132
2276
|
force?: boolean;
|
|
2133
2277
|
}): Promise<PlayRunResult>;
|
|
2278
|
+
/**
|
|
2279
|
+
* Published plans plus the caller's active plan: prices, monthly grant
|
|
2280
|
+
* credits, rollover policy, and which plans are open for subscription.
|
|
2281
|
+
* Prefer `client.billing.plans()`.
|
|
2282
|
+
*
|
|
2283
|
+
* @returns Snake_case catalog from `GET /api/v2/billing/catalog/current`
|
|
2284
|
+
*/
|
|
2285
|
+
getBillingPlans(): Promise<BillingPlansResult>;
|
|
2286
|
+
/**
|
|
2287
|
+
* Subscription state for the active workspace: active plan, whether a
|
|
2288
|
+
* Stripe subscription backs it, renewal/cancellation facts, and remaining
|
|
2289
|
+
* Deepline credit pools. Prefer `client.billing.subscription.status()`.
|
|
2290
|
+
*
|
|
2291
|
+
* @returns Snake_case subscription status from `GET /api/v2/billing/subscription/status`
|
|
2292
|
+
*/
|
|
2293
|
+
getBillingSubscriptionStatus(): Promise<BillingSubscriptionStatus>;
|
|
2294
|
+
/**
|
|
2295
|
+
* Schedule subscription cancellation at period end, or reverse a pending
|
|
2296
|
+
* cancellation with `{ undo: true }`. The customer keeps the cycle they
|
|
2297
|
+
* paid for and every remaining credit — cancellation never claws back
|
|
2298
|
+
* credits. Prefer `client.billing.subscription.cancel(...)`.
|
|
2299
|
+
*
|
|
2300
|
+
* @throws {@link DeeplineError} with `statusCode: 409` when the workspace
|
|
2301
|
+
* has no active subscription, and `statusCode: 502` when Stripe rejects
|
|
2302
|
+
* the update (the server message is preserved).
|
|
2303
|
+
*/
|
|
2304
|
+
cancelBillingSubscription(options?: {
|
|
2305
|
+
undo?: boolean;
|
|
2306
|
+
}): Promise<BillingSubscriptionCancelResult>;
|
|
2307
|
+
/**
|
|
2308
|
+
* Customer-facing billing history: subscription invoices plus one-time
|
|
2309
|
+
* credit purchase receipts, newest first, with Stripe-hosted links.
|
|
2310
|
+
* Prefer `client.billing.invoices.list(...)`.
|
|
2311
|
+
*
|
|
2312
|
+
* @param options.limit - Maximum entries to return (server clamps to 1–100, default 24).
|
|
2313
|
+
*/
|
|
2314
|
+
listBillingInvoices(options?: {
|
|
2315
|
+
limit?: number;
|
|
2316
|
+
}): Promise<BillingInvoicesResult>;
|
|
2134
2317
|
/**
|
|
2135
2318
|
* Check API connectivity and server health.
|
|
2136
2319
|
*
|
|
@@ -3916,4 +4099,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
|
|
|
3916
4099
|
*/
|
|
3917
4100
|
declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
|
|
3918
4101
|
|
|
3919
|
-
export { AuthError, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FileInput, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, PHONE_STATUS_VALUES, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PhoneStatus, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PreviousCell, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, SDK_API_CONTRACT, SDK_VERSION, type StaleAfterSeconds, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopPlayRunResult, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolExecutionRequest, type ToolMetadata, type ToolSearchOptions, type ToolSearchResult, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
|
|
4102
|
+
export { AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FileInput, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, PHONE_STATUS_VALUES, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PhoneStatus, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PreviousCell, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, SDK_API_CONTRACT, SDK_VERSION, type StaleAfterSeconds, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopPlayRunResult, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolExecutionRequest, type ToolMetadata, type ToolSearchOptions, type ToolSearchResult, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
|
package/dist/index.d.ts
CHANGED
|
@@ -1371,6 +1371,148 @@ type RunsNamespace = {
|
|
|
1371
1371
|
reason?: string;
|
|
1372
1372
|
}) => Promise<StopPlayRunResult>;
|
|
1373
1373
|
};
|
|
1374
|
+
/** One credit grant pool reported by the billing subscription status endpoint. */
|
|
1375
|
+
type BillingCreditPool = {
|
|
1376
|
+
pool: string;
|
|
1377
|
+
credits_remaining: number;
|
|
1378
|
+
credits_granted: number;
|
|
1379
|
+
source: string;
|
|
1380
|
+
cycle_key: string | null;
|
|
1381
|
+
effective_at: string;
|
|
1382
|
+
};
|
|
1383
|
+
/**
|
|
1384
|
+
* Subscription state for the active workspace, from
|
|
1385
|
+
* `GET /api/v2/billing/subscription/status`. All amounts are Deepline credits
|
|
1386
|
+
* and Deepline-facing USD — never provider spend.
|
|
1387
|
+
*/
|
|
1388
|
+
type BillingSubscriptionStatus = {
|
|
1389
|
+
org_id: string;
|
|
1390
|
+
plan_version_id: string;
|
|
1391
|
+
plan_name: string;
|
|
1392
|
+
plan_family_id: string;
|
|
1393
|
+
/** Whether a Stripe subscription backs the active plan. */
|
|
1394
|
+
subscribed: boolean;
|
|
1395
|
+
price_usd: number | null;
|
|
1396
|
+
price_interval: string | null;
|
|
1397
|
+
monthly_grant_credits: number;
|
|
1398
|
+
assigned_by: string;
|
|
1399
|
+
assigned_at: string | null;
|
|
1400
|
+
credit_pools: BillingCreditPool[];
|
|
1401
|
+
pooled_credits_remaining: number;
|
|
1402
|
+
/** End of the current paid period (ISO timestamp), when Stripe is reachable. */
|
|
1403
|
+
current_period_end: string | null;
|
|
1404
|
+
/** True when a cancellation is already scheduled for period end. */
|
|
1405
|
+
cancel_at_period_end: boolean | null;
|
|
1406
|
+
stripe_status: string | null;
|
|
1407
|
+
};
|
|
1408
|
+
/**
|
|
1409
|
+
* Result of `POST /api/v2/billing/subscription/cancel`. Cancellation is always
|
|
1410
|
+
* at period end: the customer keeps the cycle they paid for and every
|
|
1411
|
+
* remaining credit. `undo_cancel` reverses a pending cancellation.
|
|
1412
|
+
*/
|
|
1413
|
+
type BillingSubscriptionCancelResult = {
|
|
1414
|
+
org_id: string;
|
|
1415
|
+
subscription_id: string;
|
|
1416
|
+
cancel_at_period_end: boolean;
|
|
1417
|
+
current_period_end: string | null;
|
|
1418
|
+
status: string;
|
|
1419
|
+
message: string;
|
|
1420
|
+
};
|
|
1421
|
+
/**
|
|
1422
|
+
* One customer-facing billing history entry from
|
|
1423
|
+
* `GET /api/v2/billing/invoices`: a subscription invoice or a one-time credit
|
|
1424
|
+
* purchase receipt. Amounts are what the customer paid — never provider spend.
|
|
1425
|
+
*/
|
|
1426
|
+
type BillingInvoiceEntry = {
|
|
1427
|
+
kind: 'invoice' | 'receipt';
|
|
1428
|
+
id: string;
|
|
1429
|
+
created_at: string;
|
|
1430
|
+
description: string;
|
|
1431
|
+
amount_cents: number;
|
|
1432
|
+
currency: string;
|
|
1433
|
+
status: string;
|
|
1434
|
+
/** Stripe-hosted page (invoice or card receipt). */
|
|
1435
|
+
url: string | null;
|
|
1436
|
+
/** Direct PDF when Stripe provides one (invoices only). */
|
|
1437
|
+
pdf_url: string | null;
|
|
1438
|
+
};
|
|
1439
|
+
type BillingInvoicesResult = {
|
|
1440
|
+
org_id: string;
|
|
1441
|
+
entries: BillingInvoiceEntry[];
|
|
1442
|
+
};
|
|
1443
|
+
/** One published plan from `GET /api/v2/billing/catalog/current`. */
|
|
1444
|
+
type BillingPlanEntry = {
|
|
1445
|
+
plan_family_id: string;
|
|
1446
|
+
plan_version_id: string;
|
|
1447
|
+
public_name: string;
|
|
1448
|
+
price_usd: number | null;
|
|
1449
|
+
price_interval: string | null;
|
|
1450
|
+
monthly_grant_credits: number;
|
|
1451
|
+
rollover: {
|
|
1452
|
+
mode: string;
|
|
1453
|
+
max_credits?: number;
|
|
1454
|
+
};
|
|
1455
|
+
/** Whether the plan can be purchased via subscription checkout. */
|
|
1456
|
+
acquirable: boolean;
|
|
1457
|
+
};
|
|
1458
|
+
/** One usage metric published in the billing catalog. */
|
|
1459
|
+
type BillingMetricEntry = {
|
|
1460
|
+
id: string;
|
|
1461
|
+
name: string;
|
|
1462
|
+
};
|
|
1463
|
+
/** The caller's active plan as reported by the plans endpoint. */
|
|
1464
|
+
type BillingActivePlan = {
|
|
1465
|
+
plan_family_id: string;
|
|
1466
|
+
plan_version_id: string;
|
|
1467
|
+
public_name: string;
|
|
1468
|
+
rate_card_id: string;
|
|
1469
|
+
assigned_by: string;
|
|
1470
|
+
assigned_at: string | null;
|
|
1471
|
+
has_subscription: boolean;
|
|
1472
|
+
};
|
|
1473
|
+
/**
|
|
1474
|
+
* Published plans plus the caller's active plan, from
|
|
1475
|
+
* `GET /api/v2/billing/catalog/current`. Answers "what plans exist and what
|
|
1476
|
+
* am I on". All amounts are Deepline credits and Deepline-facing USD — never
|
|
1477
|
+
* provider spend.
|
|
1478
|
+
*/
|
|
1479
|
+
type BillingPlansResult = {
|
|
1480
|
+
catalog_id: string;
|
|
1481
|
+
catalog_version: string;
|
|
1482
|
+
active_plan: BillingActivePlan;
|
|
1483
|
+
plans: BillingPlanEntry[];
|
|
1484
|
+
metrics: BillingMetricEntry[];
|
|
1485
|
+
};
|
|
1486
|
+
/**
|
|
1487
|
+
* Public billing namespace exposed as `client.billing`.
|
|
1488
|
+
*
|
|
1489
|
+
* Carries the durable Deepline billing product model — plans, subscription
|
|
1490
|
+
* state, period-end cancellation, and invoice/receipt history — so CLI
|
|
1491
|
+
* commands and programmatic callers share the same surface.
|
|
1492
|
+
*
|
|
1493
|
+
* @sdkReference client 030 client.billing
|
|
1494
|
+
*/
|
|
1495
|
+
type BillingNamespace = {
|
|
1496
|
+
/** Published plans plus the plan you are on ("what plans exist and what am I on"). */
|
|
1497
|
+
plans: () => Promise<BillingPlansResult>;
|
|
1498
|
+
subscription: {
|
|
1499
|
+
/** Active plan, Stripe subscription state, and remaining credit pools. */
|
|
1500
|
+
status: () => Promise<BillingSubscriptionStatus>;
|
|
1501
|
+
/**
|
|
1502
|
+
* Schedule cancellation at period end (credits are kept), or reverse a
|
|
1503
|
+
* pending cancellation with `{ undo: true }`.
|
|
1504
|
+
*/
|
|
1505
|
+
cancel: (options?: {
|
|
1506
|
+
undo?: boolean;
|
|
1507
|
+
}) => Promise<BillingSubscriptionCancelResult>;
|
|
1508
|
+
};
|
|
1509
|
+
invoices: {
|
|
1510
|
+
/** Subscription invoices plus credit purchase receipts, newest first. */
|
|
1511
|
+
list: (options?: {
|
|
1512
|
+
limit?: number;
|
|
1513
|
+
}) => Promise<BillingInvoicesResult>;
|
|
1514
|
+
};
|
|
1515
|
+
};
|
|
1374
1516
|
/**
|
|
1375
1517
|
* Low-level client for the Deepline REST API.
|
|
1376
1518
|
*
|
|
@@ -1398,6 +1540,8 @@ declare class DeeplineClient {
|
|
|
1398
1540
|
private readonly config;
|
|
1399
1541
|
/** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
|
|
1400
1542
|
readonly runs: RunsNamespace;
|
|
1543
|
+
/** Billing namespace: subscription status/cancel and invoice history. */
|
|
1544
|
+
readonly billing: BillingNamespace;
|
|
1401
1545
|
/**
|
|
1402
1546
|
* Create a low-level SDK client.
|
|
1403
1547
|
*
|
|
@@ -2131,6 +2275,45 @@ declare class DeeplineClient {
|
|
|
2131
2275
|
/** Compatibility flag; active sibling runs are allowed. */
|
|
2132
2276
|
force?: boolean;
|
|
2133
2277
|
}): Promise<PlayRunResult>;
|
|
2278
|
+
/**
|
|
2279
|
+
* Published plans plus the caller's active plan: prices, monthly grant
|
|
2280
|
+
* credits, rollover policy, and which plans are open for subscription.
|
|
2281
|
+
* Prefer `client.billing.plans()`.
|
|
2282
|
+
*
|
|
2283
|
+
* @returns Snake_case catalog from `GET /api/v2/billing/catalog/current`
|
|
2284
|
+
*/
|
|
2285
|
+
getBillingPlans(): Promise<BillingPlansResult>;
|
|
2286
|
+
/**
|
|
2287
|
+
* Subscription state for the active workspace: active plan, whether a
|
|
2288
|
+
* Stripe subscription backs it, renewal/cancellation facts, and remaining
|
|
2289
|
+
* Deepline credit pools. Prefer `client.billing.subscription.status()`.
|
|
2290
|
+
*
|
|
2291
|
+
* @returns Snake_case subscription status from `GET /api/v2/billing/subscription/status`
|
|
2292
|
+
*/
|
|
2293
|
+
getBillingSubscriptionStatus(): Promise<BillingSubscriptionStatus>;
|
|
2294
|
+
/**
|
|
2295
|
+
* Schedule subscription cancellation at period end, or reverse a pending
|
|
2296
|
+
* cancellation with `{ undo: true }`. The customer keeps the cycle they
|
|
2297
|
+
* paid for and every remaining credit — cancellation never claws back
|
|
2298
|
+
* credits. Prefer `client.billing.subscription.cancel(...)`.
|
|
2299
|
+
*
|
|
2300
|
+
* @throws {@link DeeplineError} with `statusCode: 409` when the workspace
|
|
2301
|
+
* has no active subscription, and `statusCode: 502` when Stripe rejects
|
|
2302
|
+
* the update (the server message is preserved).
|
|
2303
|
+
*/
|
|
2304
|
+
cancelBillingSubscription(options?: {
|
|
2305
|
+
undo?: boolean;
|
|
2306
|
+
}): Promise<BillingSubscriptionCancelResult>;
|
|
2307
|
+
/**
|
|
2308
|
+
* Customer-facing billing history: subscription invoices plus one-time
|
|
2309
|
+
* credit purchase receipts, newest first, with Stripe-hosted links.
|
|
2310
|
+
* Prefer `client.billing.invoices.list(...)`.
|
|
2311
|
+
*
|
|
2312
|
+
* @param options.limit - Maximum entries to return (server clamps to 1–100, default 24).
|
|
2313
|
+
*/
|
|
2314
|
+
listBillingInvoices(options?: {
|
|
2315
|
+
limit?: number;
|
|
2316
|
+
}): Promise<BillingInvoicesResult>;
|
|
2134
2317
|
/**
|
|
2135
2318
|
* Check API connectivity and server health.
|
|
2136
2319
|
*
|
|
@@ -3916,4 +4099,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
|
|
|
3916
4099
|
*/
|
|
3917
4100
|
declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
|
|
3918
4101
|
|
|
3919
|
-
export { AuthError, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FileInput, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, PHONE_STATUS_VALUES, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PhoneStatus, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PreviousCell, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, SDK_API_CONTRACT, SDK_VERSION, type StaleAfterSeconds, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopPlayRunResult, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolExecutionRequest, type ToolMetadata, type ToolSearchOptions, type ToolSearchResult, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
|
|
4102
|
+
export { AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, type CsvOptions, type CustomerDbQueryResult, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, type DatasetColumnDefinition, type DatasetColumnRunInput, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplinePlaysNamespace, type DeeplineToolCategory, type DeeplineToolsNamespace, type DefinePlayConfig, type DefinedPlay, type FileInput, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, PHONE_STATUS_VALUES, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PhoneStatus, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunResult, type PlayRunStart, type PlaySheetRow, type PlaySheetRowsResult, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PreviousCell, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, RunObserveTransportUnavailableError, type RunsListOptions, type RunsLogsOptions, type RunsLogsResult, type RunsNamespace, type RunsTailOptions, SDK_API_CONTRACT, SDK_VERSION, type StaleAfterSeconds, type StartPlayRunRequest, type StepOptions, type StepProgram, type StepProgramResolver, type StepResolver, type StopPlayRunResult, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolExecutionRequest, type ToolMetadata, type ToolSearchOptions, type ToolSearchResult, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
|
package/dist/index.js
CHANGED
|
@@ -266,10 +266,13 @@ var SDK_RELEASE = {
|
|
|
266
266
|
// preflight (existence, data rows, quotes, duplicate headers), HTML error
|
|
267
267
|
// scrubbing, and word-boundary watch truncation.
|
|
268
268
|
// 0.1.103 ships the refined SDK CLI command surface.
|
|
269
|
-
|
|
269
|
+
// 0.1.104 ships postgres_fast suspension/billing parity and runtime worker hardening.
|
|
270
|
+
// 0.1.105 ships the billing catalog surface: billing plans, subscribe,
|
|
271
|
+
// subscription status/cancel, invoices, and the client.billing namespace.
|
|
272
|
+
version: "0.1.105",
|
|
270
273
|
apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
|
|
271
274
|
supportPolicy: {
|
|
272
|
-
latest: "0.1.
|
|
275
|
+
latest: "0.1.105",
|
|
273
276
|
minimumSupported: "0.1.53",
|
|
274
277
|
deprecatedBelow: "0.1.53"
|
|
275
278
|
}
|
|
@@ -400,7 +403,7 @@ var HttpClient = class {
|
|
|
400
403
|
signal: controller.signal
|
|
401
404
|
});
|
|
402
405
|
clearTimeout(timeoutId);
|
|
403
|
-
if (response.status === 401 || response.status === 403) {
|
|
406
|
+
if (response.status === 401 || response.status === 403 && !options?.forbiddenAsApiError) {
|
|
404
407
|
throw new AuthError();
|
|
405
408
|
}
|
|
406
409
|
if (response.status === 429) {
|
|
@@ -1492,6 +1495,9 @@ var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
|
|
|
1492
1495
|
var EXECUTE_RESPONSE_CONTRACT_HEADER = "x-deepline-execute-response-contract";
|
|
1493
1496
|
var V2_EXECUTE_RESPONSE_CONTRACT = "v2-tool-response";
|
|
1494
1497
|
var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
|
|
1498
|
+
var REGISTER_PLAY_ARTIFACTS_COMPILE_CONCURRENCY = 3;
|
|
1499
|
+
var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_COUNT = 3;
|
|
1500
|
+
var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_BYTES = 25e5;
|
|
1495
1501
|
function sleep2(ms) {
|
|
1496
1502
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
1497
1503
|
}
|
|
@@ -1504,6 +1510,45 @@ function isTransientCompileManifestError(error) {
|
|
|
1504
1510
|
message
|
|
1505
1511
|
);
|
|
1506
1512
|
}
|
|
1513
|
+
async function mapWithConcurrency(items, concurrency, mapper) {
|
|
1514
|
+
const results = new Array(items.length);
|
|
1515
|
+
let nextIndex = 0;
|
|
1516
|
+
const workerCount = Math.min(Math.max(1, concurrency), items.length);
|
|
1517
|
+
await Promise.all(
|
|
1518
|
+
Array.from({ length: workerCount }, async () => {
|
|
1519
|
+
for (; ; ) {
|
|
1520
|
+
const index = nextIndex;
|
|
1521
|
+
nextIndex += 1;
|
|
1522
|
+
if (index >= items.length) {
|
|
1523
|
+
return;
|
|
1524
|
+
}
|
|
1525
|
+
results[index] = await mapper(items[index], index);
|
|
1526
|
+
}
|
|
1527
|
+
})
|
|
1528
|
+
);
|
|
1529
|
+
return results;
|
|
1530
|
+
}
|
|
1531
|
+
function jsonUtf8Bytes(value) {
|
|
1532
|
+
return new TextEncoder().encode(JSON.stringify(value)).length;
|
|
1533
|
+
}
|
|
1534
|
+
function chunkRegisterPlayArtifacts(artifacts) {
|
|
1535
|
+
const chunks = [];
|
|
1536
|
+
let current = [];
|
|
1537
|
+
for (const artifact of artifacts) {
|
|
1538
|
+
const candidate = [...current, artifact];
|
|
1539
|
+
const candidateTooLarge = candidate.length > REGISTER_PLAY_ARTIFACTS_MAX_BATCH_COUNT || jsonUtf8Bytes({ artifacts: candidate }) > REGISTER_PLAY_ARTIFACTS_MAX_BATCH_BYTES;
|
|
1540
|
+
if (current.length > 0 && candidateTooLarge) {
|
|
1541
|
+
chunks.push(current);
|
|
1542
|
+
current = [artifact];
|
|
1543
|
+
} else {
|
|
1544
|
+
current = candidate;
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
if (current.length > 0) {
|
|
1548
|
+
chunks.push(current);
|
|
1549
|
+
}
|
|
1550
|
+
return chunks;
|
|
1551
|
+
}
|
|
1507
1552
|
var RUN_LOGS_PAGE_LIMIT = 1e3;
|
|
1508
1553
|
function isRecord2(value) {
|
|
1509
1554
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
@@ -1671,6 +1716,8 @@ var DeeplineClient = class {
|
|
|
1671
1716
|
config;
|
|
1672
1717
|
/** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
|
|
1673
1718
|
runs;
|
|
1719
|
+
/** Billing namespace: subscription status/cancel and invoice history. */
|
|
1720
|
+
billing;
|
|
1674
1721
|
/**
|
|
1675
1722
|
* Create a low-level SDK client.
|
|
1676
1723
|
*
|
|
@@ -1691,6 +1738,16 @@ var DeeplineClient = class {
|
|
|
1691
1738
|
exportDatasetRows: (input) => this.getPlaySheetRows(input),
|
|
1692
1739
|
stop: (runId, options2) => this.stopRun(runId, options2)
|
|
1693
1740
|
};
|
|
1741
|
+
this.billing = {
|
|
1742
|
+
plans: () => this.getBillingPlans(),
|
|
1743
|
+
subscription: {
|
|
1744
|
+
status: () => this.getBillingSubscriptionStatus(),
|
|
1745
|
+
cancel: (options2) => this.cancelBillingSubscription(options2)
|
|
1746
|
+
},
|
|
1747
|
+
invoices: {
|
|
1748
|
+
list: (options2) => this.listBillingInvoices(options2)
|
|
1749
|
+
}
|
|
1750
|
+
};
|
|
1694
1751
|
}
|
|
1695
1752
|
/** The resolved base URL this client is targeting (e.g. `"http://localhost:3000"`). */
|
|
1696
1753
|
get baseUrl() {
|
|
@@ -2059,8 +2116,13 @@ var DeeplineClient = class {
|
|
|
2059
2116
|
* first when a compiler manifest is not already supplied.
|
|
2060
2117
|
*/
|
|
2061
2118
|
async registerPlayArtifacts(artifacts) {
|
|
2062
|
-
|
|
2063
|
-
|
|
2119
|
+
if (artifacts.length === 0) {
|
|
2120
|
+
return this.http.post("/api/v2/plays/artifacts", { artifacts });
|
|
2121
|
+
}
|
|
2122
|
+
const compiledArtifacts = await mapWithConcurrency(
|
|
2123
|
+
artifacts,
|
|
2124
|
+
REGISTER_PLAY_ARTIFACTS_COMPILE_CONCURRENCY,
|
|
2125
|
+
async (artifact) => ({
|
|
2064
2126
|
...artifact,
|
|
2065
2127
|
compilerManifest: artifact.compilerManifest ?? await this.compilePlayManifest({
|
|
2066
2128
|
name: artifact.name,
|
|
@@ -2068,11 +2130,20 @@ var DeeplineClient = class {
|
|
|
2068
2130
|
sourceFiles: artifact.sourceFiles,
|
|
2069
2131
|
artifact: artifact.artifact
|
|
2070
2132
|
})
|
|
2071
|
-
})
|
|
2133
|
+
})
|
|
2072
2134
|
);
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2135
|
+
const responses = [];
|
|
2136
|
+
for (const chunk of chunkRegisterPlayArtifacts(compiledArtifacts)) {
|
|
2137
|
+
responses.push(
|
|
2138
|
+
await this.http.post("/api/v2/plays/artifacts", {
|
|
2139
|
+
artifacts: chunk
|
|
2140
|
+
})
|
|
2141
|
+
);
|
|
2142
|
+
}
|
|
2143
|
+
return {
|
|
2144
|
+
success: responses.every((response) => response.success),
|
|
2145
|
+
artifacts: responses.flatMap((response) => response.artifacts)
|
|
2146
|
+
};
|
|
2076
2147
|
}
|
|
2077
2148
|
/**
|
|
2078
2149
|
* Compile a bundled play artifact into the server-side compiler manifest.
|
|
@@ -3045,6 +3116,61 @@ var DeeplineClient = class {
|
|
|
3045
3116
|
// ——————————————————————————————————————————————————————————
|
|
3046
3117
|
// Health
|
|
3047
3118
|
// ——————————————————————————————————————————————————————————
|
|
3119
|
+
/**
|
|
3120
|
+
* Published plans plus the caller's active plan: prices, monthly grant
|
|
3121
|
+
* credits, rollover policy, and which plans are open for subscription.
|
|
3122
|
+
* Prefer `client.billing.plans()`.
|
|
3123
|
+
*
|
|
3124
|
+
* @returns Snake_case catalog from `GET /api/v2/billing/catalog/current`
|
|
3125
|
+
*/
|
|
3126
|
+
async getBillingPlans() {
|
|
3127
|
+
return this.http.get("/api/v2/billing/catalog/current");
|
|
3128
|
+
}
|
|
3129
|
+
/**
|
|
3130
|
+
* Subscription state for the active workspace: active plan, whether a
|
|
3131
|
+
* Stripe subscription backs it, renewal/cancellation facts, and remaining
|
|
3132
|
+
* Deepline credit pools. Prefer `client.billing.subscription.status()`.
|
|
3133
|
+
*
|
|
3134
|
+
* @returns Snake_case subscription status from `GET /api/v2/billing/subscription/status`
|
|
3135
|
+
*/
|
|
3136
|
+
async getBillingSubscriptionStatus() {
|
|
3137
|
+
return this.http.get(
|
|
3138
|
+
"/api/v2/billing/subscription/status"
|
|
3139
|
+
);
|
|
3140
|
+
}
|
|
3141
|
+
/**
|
|
3142
|
+
* Schedule subscription cancellation at period end, or reverse a pending
|
|
3143
|
+
* cancellation with `{ undo: true }`. The customer keeps the cycle they
|
|
3144
|
+
* paid for and every remaining credit — cancellation never claws back
|
|
3145
|
+
* credits. Prefer `client.billing.subscription.cancel(...)`.
|
|
3146
|
+
*
|
|
3147
|
+
* @throws {@link DeeplineError} with `statusCode: 409` when the workspace
|
|
3148
|
+
* has no active subscription, and `statusCode: 502` when Stripe rejects
|
|
3149
|
+
* the update (the server message is preserved).
|
|
3150
|
+
*/
|
|
3151
|
+
async cancelBillingSubscription(options) {
|
|
3152
|
+
return this.http.post(
|
|
3153
|
+
"/api/v2/billing/subscription/cancel",
|
|
3154
|
+
{ action: options?.undo ? "undo_cancel" : "cancel" }
|
|
3155
|
+
);
|
|
3156
|
+
}
|
|
3157
|
+
/**
|
|
3158
|
+
* Customer-facing billing history: subscription invoices plus one-time
|
|
3159
|
+
* credit purchase receipts, newest first, with Stripe-hosted links.
|
|
3160
|
+
* Prefer `client.billing.invoices.list(...)`.
|
|
3161
|
+
*
|
|
3162
|
+
* @param options.limit - Maximum entries to return (server clamps to 1–100, default 24).
|
|
3163
|
+
*/
|
|
3164
|
+
async listBillingInvoices(options) {
|
|
3165
|
+
const params = new URLSearchParams();
|
|
3166
|
+
if (options?.limit !== void 0) {
|
|
3167
|
+
params.set("limit", String(options.limit));
|
|
3168
|
+
}
|
|
3169
|
+
const suffix = Array.from(params).length > 0 ? `?${params.toString()}` : "";
|
|
3170
|
+
return this.http.get(
|
|
3171
|
+
`/api/v2/billing/invoices${suffix}`
|
|
3172
|
+
);
|
|
3173
|
+
}
|
|
3048
3174
|
/**
|
|
3049
3175
|
* Check API connectivity and server health.
|
|
3050
3176
|
*
|