deepline 0.2.9 → 0.2.11

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/index.mjs CHANGED
@@ -689,7 +689,7 @@ var SDK_RELEASE = {
689
689
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
690
690
  // exposed storage-dependent synchronous access. This deliberate minor
691
691
  // release keeps lazy paging semantics independent of row residency.
692
- version: "0.2.9",
692
+ version: "0.2.11",
693
693
  contracts: {
694
694
  api: {
695
695
  name: "sdk-http-api",
@@ -1826,6 +1826,13 @@ function projectPlayRunActivity(input) {
1826
1826
  (dataset) => dataset.phase === "registered" || dataset.complete !== true && dataset.phase !== "failed"
1827
1827
  ).sort((left, right) => (right.updatedAt ?? 0) - (left.updatedAt ?? 0))[0];
1828
1828
  if (pendingDataset) {
1829
+ const activeDatasetStep = input.nodeStates?.find(
1830
+ (candidate) => candidate.nodeId === input.activeNodeId && candidate.status === "running" && candidate.artifactTableNamespace === pendingDataset.tableNamespace
1831
+ );
1832
+ const datasetStep = activeDatasetStep ?? input.nodeStates?.find(
1833
+ (candidate) => candidate.artifactTableNamespace === pendingDataset.tableNamespace
1834
+ );
1835
+ const datasetProgress = datasetStep?.progress ?? null;
1829
1836
  return projection(
1830
1837
  {
1831
1838
  schemaVersion: 1,
@@ -1838,12 +1845,12 @@ function projectPlayRunActivity(input) {
1838
1845
  state: {
1839
1846
  kind: "active",
1840
1847
  progress: {
1841
- completed: pendingDataset.persistedRows,
1842
- total: typeof pendingDataset.succeededRows === "number" || typeof pendingDataset.failedRows === "number" ? (pendingDataset.succeededRows ?? 0) + (pendingDataset.failedRows ?? 0) : void 0,
1843
- failed: pendingDataset.failedRows
1848
+ completed: datasetProgress?.completed ?? pendingDataset.persistedRows,
1849
+ total: datasetProgress?.total ?? (typeof pendingDataset.succeededRows === "number" || typeof pendingDataset.failedRows === "number" ? (pendingDataset.succeededRows ?? 0) + (pendingDataset.failedRows ?? 0) : void 0),
1850
+ failed: datasetProgress?.failed ?? pendingDataset.failedRows
1844
1851
  }
1845
1852
  },
1846
- observedAt: pendingDataset.updatedAt ?? observedAt
1853
+ observedAt: datasetStep?.updatedAt ?? pendingDataset.updatedAt ?? observedAt
1847
1854
  },
1848
1855
  now
1849
1856
  );
@@ -3148,6 +3155,17 @@ function resolveToolExecuteTimeoutMs(toolId, input) {
3148
3155
  }
3149
3156
  var RUNS_FAILED_LOG_LIMIT = 20;
3150
3157
  var RUN_LOGS_PAGE_LIMIT = 1e3;
3158
+ function requireTargetBillingIdempotencyKey(value) {
3159
+ const normalized = value.trim();
3160
+ if (normalized.length === 0 || normalized.length > 200 || normalized !== value) {
3161
+ throw new DeeplineError(
3162
+ "Billing idempotencyKey must contain 1\u2013200 characters with no leading or trailing whitespace.",
3163
+ void 0,
3164
+ "INVALID_BILLING_IDEMPOTENCY_KEY"
3165
+ );
3166
+ }
3167
+ return normalized;
3168
+ }
3151
3169
  function isRecord6(value) {
3152
3170
  return Boolean(value && typeof value === "object" && !Array.isArray(value));
3153
3171
  }
@@ -3418,7 +3436,12 @@ var DeeplineClient = class {
3418
3436
  },
3419
3437
  invoices: {
3420
3438
  list: (options2) => this.listBillingInvoices(options2)
3421
- }
3439
+ },
3440
+ targetPlans: () => this.getTargetBillingPlans(),
3441
+ targetStatus: () => this.getTargetBillingStatus(),
3442
+ purchaseCredits: (options2) => this.purchaseTargetBillingCredits(options2),
3443
+ transitionPlan: (options2) => this.transitionTargetBillingPlan(options2),
3444
+ portalSession: () => this.createTargetBillingPortalSession()
3422
3445
  };
3423
3446
  this.monitors = {
3424
3447
  status: () => this.getMonitorsAccess(),
@@ -5332,6 +5355,52 @@ var DeeplineClient = class {
5332
5355
  `/api/v2/billing/invoices${suffix}`
5333
5356
  );
5334
5357
  }
5358
+ /** List the reviewed target plans and whether new acquisition is enabled. */
5359
+ async getTargetBillingPlans() {
5360
+ return this.http.get("/api/v2/billing/plans");
5361
+ }
5362
+ /** Read the workspace's normalized target plan, payment, and balance state. */
5363
+ async getTargetBillingStatus() {
5364
+ return this.http.get("/api/v2/billing/status");
5365
+ }
5366
+ /**
5367
+ * Purchase target-billing credits through the durable commercial operation
5368
+ * flow. The caller supplies an idempotency key for safe retries.
5369
+ */
5370
+ async purchaseTargetBillingCredits(options) {
5371
+ const idempotencyKey = requireTargetBillingIdempotencyKey(
5372
+ options.idempotencyKey
5373
+ );
5374
+ return this.http.post(
5375
+ "/api/v2/billing/credit-purchases",
5376
+ { credits: options.credits },
5377
+ { "Idempotency-Key": idempotencyKey },
5378
+ { maxRetries: 0, exactUrlOnly: true }
5379
+ );
5380
+ }
5381
+ /**
5382
+ * Start, change, cancel, or restore a target plan through one idempotent
5383
+ * commercial operation.
5384
+ */
5385
+ async transitionTargetBillingPlan(options) {
5386
+ const idempotencyKey = requireTargetBillingIdempotencyKey(
5387
+ options.idempotencyKey
5388
+ );
5389
+ return this.http.post(
5390
+ "/api/v2/billing/plan-transitions",
5391
+ {
5392
+ action: options.action,
5393
+ ...options.targetPlanSku ? { target_plan_sku: options.targetPlanSku } : {}
5394
+ },
5395
+ { "Idempotency-Key": idempotencyKey },
5396
+ { maxRetries: 0, exactUrlOnly: true }
5397
+ );
5398
+ }
5399
+ /** Create a Stripe-hosted portal session for payment recovery and invoices. */
5400
+ async createTargetBillingPortalSession() {
5401
+ const response = await this.http.post("/api/v2/billing/portal-sessions", {});
5402
+ return response.data;
5403
+ }
5335
5404
  // ——————————————————————————————————————————————————————————
5336
5405
  // Monitors
5337
5406
  // ——————————————————————————————————————————————————————————
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {