deepline 0.1.104 → 0.1.106
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 +586 -15
- package/dist/cli/index.mjs +586 -15
- 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/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
|
@@ -267,10 +267,13 @@ var SDK_RELEASE = {
|
|
|
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
|
-
|
|
270
|
+
// 0.1.105 ships the billing catalog surface: billing plans, subscribe,
|
|
271
|
+
// subscription status/cancel, invoices, and the client.billing namespace.
|
|
272
|
+
// 0.1.106 ships play cell provenance metadata and v2 preview retry hardening.
|
|
273
|
+
version: "0.1.106",
|
|
271
274
|
apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
|
|
272
275
|
supportPolicy: {
|
|
273
|
-
latest: "0.1.
|
|
276
|
+
latest: "0.1.106",
|
|
274
277
|
minimumSupported: "0.1.53",
|
|
275
278
|
deprecatedBelow: "0.1.53"
|
|
276
279
|
}
|
|
@@ -401,7 +404,7 @@ var HttpClient = class {
|
|
|
401
404
|
signal: controller.signal
|
|
402
405
|
});
|
|
403
406
|
clearTimeout(timeoutId);
|
|
404
|
-
if (response.status === 401 || response.status === 403) {
|
|
407
|
+
if (response.status === 401 || response.status === 403 && !options?.forbiddenAsApiError) {
|
|
405
408
|
throw new AuthError();
|
|
406
409
|
}
|
|
407
410
|
if (response.status === 429) {
|
|
@@ -1493,6 +1496,9 @@ var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
|
|
|
1493
1496
|
var EXECUTE_RESPONSE_CONTRACT_HEADER = "x-deepline-execute-response-contract";
|
|
1494
1497
|
var V2_EXECUTE_RESPONSE_CONTRACT = "v2-tool-response";
|
|
1495
1498
|
var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
|
|
1499
|
+
var REGISTER_PLAY_ARTIFACTS_COMPILE_CONCURRENCY = 3;
|
|
1500
|
+
var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_COUNT = 3;
|
|
1501
|
+
var REGISTER_PLAY_ARTIFACTS_MAX_BATCH_BYTES = 25e5;
|
|
1496
1502
|
function sleep2(ms) {
|
|
1497
1503
|
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
1498
1504
|
}
|
|
@@ -1505,6 +1511,45 @@ function isTransientCompileManifestError(error) {
|
|
|
1505
1511
|
message
|
|
1506
1512
|
);
|
|
1507
1513
|
}
|
|
1514
|
+
async function mapWithConcurrency(items, concurrency, mapper) {
|
|
1515
|
+
const results = new Array(items.length);
|
|
1516
|
+
let nextIndex = 0;
|
|
1517
|
+
const workerCount = Math.min(Math.max(1, concurrency), items.length);
|
|
1518
|
+
await Promise.all(
|
|
1519
|
+
Array.from({ length: workerCount }, async () => {
|
|
1520
|
+
for (; ; ) {
|
|
1521
|
+
const index = nextIndex;
|
|
1522
|
+
nextIndex += 1;
|
|
1523
|
+
if (index >= items.length) {
|
|
1524
|
+
return;
|
|
1525
|
+
}
|
|
1526
|
+
results[index] = await mapper(items[index], index);
|
|
1527
|
+
}
|
|
1528
|
+
})
|
|
1529
|
+
);
|
|
1530
|
+
return results;
|
|
1531
|
+
}
|
|
1532
|
+
function jsonUtf8Bytes(value) {
|
|
1533
|
+
return new TextEncoder().encode(JSON.stringify(value)).length;
|
|
1534
|
+
}
|
|
1535
|
+
function chunkRegisterPlayArtifacts(artifacts) {
|
|
1536
|
+
const chunks = [];
|
|
1537
|
+
let current = [];
|
|
1538
|
+
for (const artifact of artifacts) {
|
|
1539
|
+
const candidate = [...current, artifact];
|
|
1540
|
+
const candidateTooLarge = candidate.length > REGISTER_PLAY_ARTIFACTS_MAX_BATCH_COUNT || jsonUtf8Bytes({ artifacts: candidate }) > REGISTER_PLAY_ARTIFACTS_MAX_BATCH_BYTES;
|
|
1541
|
+
if (current.length > 0 && candidateTooLarge) {
|
|
1542
|
+
chunks.push(current);
|
|
1543
|
+
current = [artifact];
|
|
1544
|
+
} else {
|
|
1545
|
+
current = candidate;
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
if (current.length > 0) {
|
|
1549
|
+
chunks.push(current);
|
|
1550
|
+
}
|
|
1551
|
+
return chunks;
|
|
1552
|
+
}
|
|
1508
1553
|
var RUN_LOGS_PAGE_LIMIT = 1e3;
|
|
1509
1554
|
function isRecord2(value) {
|
|
1510
1555
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
@@ -1672,6 +1717,8 @@ var DeeplineClient = class {
|
|
|
1672
1717
|
config;
|
|
1673
1718
|
/** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
|
|
1674
1719
|
runs;
|
|
1720
|
+
/** Billing namespace: subscription status/cancel and invoice history. */
|
|
1721
|
+
billing;
|
|
1675
1722
|
/**
|
|
1676
1723
|
* Create a low-level SDK client.
|
|
1677
1724
|
*
|
|
@@ -1692,6 +1739,16 @@ var DeeplineClient = class {
|
|
|
1692
1739
|
exportDatasetRows: (input) => this.getPlaySheetRows(input),
|
|
1693
1740
|
stop: (runId, options2) => this.stopRun(runId, options2)
|
|
1694
1741
|
};
|
|
1742
|
+
this.billing = {
|
|
1743
|
+
plans: () => this.getBillingPlans(),
|
|
1744
|
+
subscription: {
|
|
1745
|
+
status: () => this.getBillingSubscriptionStatus(),
|
|
1746
|
+
cancel: (options2) => this.cancelBillingSubscription(options2)
|
|
1747
|
+
},
|
|
1748
|
+
invoices: {
|
|
1749
|
+
list: (options2) => this.listBillingInvoices(options2)
|
|
1750
|
+
}
|
|
1751
|
+
};
|
|
1695
1752
|
}
|
|
1696
1753
|
/** The resolved base URL this client is targeting (e.g. `"http://localhost:3000"`). */
|
|
1697
1754
|
get baseUrl() {
|
|
@@ -2060,8 +2117,13 @@ var DeeplineClient = class {
|
|
|
2060
2117
|
* first when a compiler manifest is not already supplied.
|
|
2061
2118
|
*/
|
|
2062
2119
|
async registerPlayArtifacts(artifacts) {
|
|
2063
|
-
|
|
2064
|
-
|
|
2120
|
+
if (artifacts.length === 0) {
|
|
2121
|
+
return this.http.post("/api/v2/plays/artifacts", { artifacts });
|
|
2122
|
+
}
|
|
2123
|
+
const compiledArtifacts = await mapWithConcurrency(
|
|
2124
|
+
artifacts,
|
|
2125
|
+
REGISTER_PLAY_ARTIFACTS_COMPILE_CONCURRENCY,
|
|
2126
|
+
async (artifact) => ({
|
|
2065
2127
|
...artifact,
|
|
2066
2128
|
compilerManifest: artifact.compilerManifest ?? await this.compilePlayManifest({
|
|
2067
2129
|
name: artifact.name,
|
|
@@ -2069,11 +2131,20 @@ var DeeplineClient = class {
|
|
|
2069
2131
|
sourceFiles: artifact.sourceFiles,
|
|
2070
2132
|
artifact: artifact.artifact
|
|
2071
2133
|
})
|
|
2072
|
-
})
|
|
2134
|
+
})
|
|
2073
2135
|
);
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2136
|
+
const responses = [];
|
|
2137
|
+
for (const chunk of chunkRegisterPlayArtifacts(compiledArtifacts)) {
|
|
2138
|
+
responses.push(
|
|
2139
|
+
await this.http.post("/api/v2/plays/artifacts", {
|
|
2140
|
+
artifacts: chunk
|
|
2141
|
+
})
|
|
2142
|
+
);
|
|
2143
|
+
}
|
|
2144
|
+
return {
|
|
2145
|
+
success: responses.every((response) => response.success),
|
|
2146
|
+
artifacts: responses.flatMap((response) => response.artifacts)
|
|
2147
|
+
};
|
|
2077
2148
|
}
|
|
2078
2149
|
/**
|
|
2079
2150
|
* Compile a bundled play artifact into the server-side compiler manifest.
|
|
@@ -3046,6 +3117,61 @@ var DeeplineClient = class {
|
|
|
3046
3117
|
// ——————————————————————————————————————————————————————————
|
|
3047
3118
|
// Health
|
|
3048
3119
|
// ——————————————————————————————————————————————————————————
|
|
3120
|
+
/**
|
|
3121
|
+
* Published plans plus the caller's active plan: prices, monthly grant
|
|
3122
|
+
* credits, rollover policy, and which plans are open for subscription.
|
|
3123
|
+
* Prefer `client.billing.plans()`.
|
|
3124
|
+
*
|
|
3125
|
+
* @returns Snake_case catalog from `GET /api/v2/billing/catalog/current`
|
|
3126
|
+
*/
|
|
3127
|
+
async getBillingPlans() {
|
|
3128
|
+
return this.http.get("/api/v2/billing/catalog/current");
|
|
3129
|
+
}
|
|
3130
|
+
/**
|
|
3131
|
+
* Subscription state for the active workspace: active plan, whether a
|
|
3132
|
+
* Stripe subscription backs it, renewal/cancellation facts, and remaining
|
|
3133
|
+
* Deepline credit pools. Prefer `client.billing.subscription.status()`.
|
|
3134
|
+
*
|
|
3135
|
+
* @returns Snake_case subscription status from `GET /api/v2/billing/subscription/status`
|
|
3136
|
+
*/
|
|
3137
|
+
async getBillingSubscriptionStatus() {
|
|
3138
|
+
return this.http.get(
|
|
3139
|
+
"/api/v2/billing/subscription/status"
|
|
3140
|
+
);
|
|
3141
|
+
}
|
|
3142
|
+
/**
|
|
3143
|
+
* Schedule subscription cancellation at period end, or reverse a pending
|
|
3144
|
+
* cancellation with `{ undo: true }`. The customer keeps the cycle they
|
|
3145
|
+
* paid for and every remaining credit — cancellation never claws back
|
|
3146
|
+
* credits. Prefer `client.billing.subscription.cancel(...)`.
|
|
3147
|
+
*
|
|
3148
|
+
* @throws {@link DeeplineError} with `statusCode: 409` when the workspace
|
|
3149
|
+
* has no active subscription, and `statusCode: 502` when Stripe rejects
|
|
3150
|
+
* the update (the server message is preserved).
|
|
3151
|
+
*/
|
|
3152
|
+
async cancelBillingSubscription(options) {
|
|
3153
|
+
return this.http.post(
|
|
3154
|
+
"/api/v2/billing/subscription/cancel",
|
|
3155
|
+
{ action: options?.undo ? "undo_cancel" : "cancel" }
|
|
3156
|
+
);
|
|
3157
|
+
}
|
|
3158
|
+
/**
|
|
3159
|
+
* Customer-facing billing history: subscription invoices plus one-time
|
|
3160
|
+
* credit purchase receipts, newest first, with Stripe-hosted links.
|
|
3161
|
+
* Prefer `client.billing.invoices.list(...)`.
|
|
3162
|
+
*
|
|
3163
|
+
* @param options.limit - Maximum entries to return (server clamps to 1–100, default 24).
|
|
3164
|
+
*/
|
|
3165
|
+
async listBillingInvoices(options) {
|
|
3166
|
+
const params = new URLSearchParams();
|
|
3167
|
+
if (options?.limit !== void 0) {
|
|
3168
|
+
params.set("limit", String(options.limit));
|
|
3169
|
+
}
|
|
3170
|
+
const suffix = Array.from(params).length > 0 ? `?${params.toString()}` : "";
|
|
3171
|
+
return this.http.get(
|
|
3172
|
+
`/api/v2/billing/invoices${suffix}`
|
|
3173
|
+
);
|
|
3174
|
+
}
|
|
3049
3175
|
/**
|
|
3050
3176
|
* Check API connectivity and server health.
|
|
3051
3177
|
*
|