deepline 0.1.237 → 0.1.239
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/bundling-sources/apps/play-runner-workers/src/entry.ts +3 -0
- package/dist/bundling-sources/sdk/src/client.ts +72 -8
- package/dist/bundling-sources/sdk/src/http.ts +1 -0
- package/dist/bundling-sources/sdk/src/index.ts +4 -0
- package/dist/bundling-sources/sdk/src/release.ts +6 -4
- package/dist/bundling-sources/sdk/src/types.ts +63 -2
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +16 -9
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-latency-trace.ts +3 -18
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +14 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +42 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +9 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +5 -5
- package/dist/cli/index.js +387 -58
- package/dist/cli/index.mjs +387 -58
- package/dist/index.d.mts +107 -6
- package/dist/index.d.ts +107 -6
- package/dist/index.js +58 -12
- package/dist/index.mjs +58 -12
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -85,12 +85,17 @@ interface CustomerDbColumn {
|
|
|
85
85
|
data_type_id: number | null;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
|
-
* Result returned by {@link DeeplineClient.
|
|
88
|
+
* Result returned by {@link DeeplineClient.db.query}.
|
|
89
89
|
*
|
|
90
90
|
* Rows are intentionally untyped because the schema depends on the caller's SQL
|
|
91
91
|
* query and selected customer tables.
|
|
92
92
|
*/
|
|
93
93
|
interface CustomerDbQueryResult {
|
|
94
|
+
/** This query reads the current mutable customer database, not one run snapshot. */
|
|
95
|
+
scope?: {
|
|
96
|
+
kind: 'database';
|
|
97
|
+
mutability: 'current';
|
|
98
|
+
};
|
|
94
99
|
/** Database command executed by the query endpoint. */
|
|
95
100
|
command: string;
|
|
96
101
|
/** Total affected row count when reported by the database. */
|
|
@@ -410,6 +415,23 @@ interface PlayProgressStatus {
|
|
|
410
415
|
type PlayRunActionPackage = {
|
|
411
416
|
kind: 'deepline_run_inspect';
|
|
412
417
|
runId: string;
|
|
418
|
+
command?: string;
|
|
419
|
+
api: {
|
|
420
|
+
method: 'GET';
|
|
421
|
+
path: string;
|
|
422
|
+
};
|
|
423
|
+
} | {
|
|
424
|
+
kind: 'deepline_run_full';
|
|
425
|
+
runId: string;
|
|
426
|
+
command?: string;
|
|
427
|
+
api: {
|
|
428
|
+
method: 'GET';
|
|
429
|
+
path: string;
|
|
430
|
+
};
|
|
431
|
+
} | {
|
|
432
|
+
kind: 'deepline_run_billing';
|
|
433
|
+
runId: string;
|
|
434
|
+
command?: string;
|
|
413
435
|
api: {
|
|
414
436
|
method: 'GET';
|
|
415
437
|
path: string;
|
|
@@ -422,6 +444,20 @@ type PlayRunActionPackage = {
|
|
|
422
444
|
sqlQualifiedTableName?: string;
|
|
423
445
|
sql: string;
|
|
424
446
|
maxRows: number;
|
|
447
|
+
command?: string;
|
|
448
|
+
scope?: {
|
|
449
|
+
kind: 'database';
|
|
450
|
+
mutability: 'current';
|
|
451
|
+
} | {
|
|
452
|
+
kind: 'run';
|
|
453
|
+
runId: string;
|
|
454
|
+
};
|
|
455
|
+
note?: string;
|
|
456
|
+
deprecated?: {
|
|
457
|
+
replacement: 'queryCurrentTable';
|
|
458
|
+
removeAfter: string;
|
|
459
|
+
reason: string;
|
|
460
|
+
};
|
|
425
461
|
api: {
|
|
426
462
|
method: 'POST';
|
|
427
463
|
path: '/api/v2/db/query';
|
|
@@ -431,6 +467,17 @@ type PlayRunActionPackage = {
|
|
|
431
467
|
runId: string;
|
|
432
468
|
datasetPath: string;
|
|
433
469
|
format: 'csv';
|
|
470
|
+
command?: string;
|
|
471
|
+
scope?: {
|
|
472
|
+
kind: 'run';
|
|
473
|
+
runId: string;
|
|
474
|
+
};
|
|
475
|
+
note?: string;
|
|
476
|
+
deprecated?: {
|
|
477
|
+
replacement: 'datasets[].actions.exportCsv';
|
|
478
|
+
removeAfter: string;
|
|
479
|
+
reason: string;
|
|
480
|
+
};
|
|
434
481
|
} | {
|
|
435
482
|
kind: 'deepline_run_logs';
|
|
436
483
|
runId: string;
|
|
@@ -442,6 +489,33 @@ type PlayRunActionPackage = {
|
|
|
442
489
|
path: string;
|
|
443
490
|
};
|
|
444
491
|
};
|
|
492
|
+
type PlayRunDbQueryAction = Extract<PlayRunActionPackage, {
|
|
493
|
+
kind: 'deepline_db_query';
|
|
494
|
+
}>;
|
|
495
|
+
type PlayRunExportAction = Extract<PlayRunActionPackage, {
|
|
496
|
+
kind: 'deepline_run_export';
|
|
497
|
+
}>;
|
|
498
|
+
type PlayRunDatasetActions = {
|
|
499
|
+
/** @deprecated Use queryCurrentTable or exportCsv. Removed after 2026-08-18. */
|
|
500
|
+
query?: PlayRunDbQueryAction & {
|
|
501
|
+
scope?: {
|
|
502
|
+
kind: 'run';
|
|
503
|
+
runId: string;
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
queryCurrentTable?: PlayRunDbQueryAction & {
|
|
507
|
+
scope?: {
|
|
508
|
+
kind: 'database';
|
|
509
|
+
mutability: 'current';
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
exportCsv?: PlayRunExportAction & {
|
|
513
|
+
scope?: {
|
|
514
|
+
kind: 'run';
|
|
515
|
+
runId: string;
|
|
516
|
+
};
|
|
517
|
+
};
|
|
518
|
+
};
|
|
445
519
|
/**
|
|
446
520
|
* Compact canonical package for an inspected play run.
|
|
447
521
|
*
|
|
@@ -477,9 +551,15 @@ interface PlayRunPackage {
|
|
|
477
551
|
path: string;
|
|
478
552
|
tableNamespace?: string;
|
|
479
553
|
rowCount?: number;
|
|
554
|
+
sqlTableName?: string;
|
|
555
|
+
sqlQualifiedTableName?: string;
|
|
480
556
|
recovered?: true;
|
|
557
|
+
exportUnavailable?: {
|
|
558
|
+
reason: 'empty_dataset' | 'shared_table_namespace';
|
|
559
|
+
message: string;
|
|
560
|
+
};
|
|
481
561
|
preview?: Record<string, unknown>;
|
|
482
|
-
actions?:
|
|
562
|
+
actions?: PlayRunDatasetActions;
|
|
483
563
|
}>;
|
|
484
564
|
/** Small retained tail of customer and runtime logs; fetch the full stream through `runs.logs`. */
|
|
485
565
|
logs?: {
|
|
@@ -491,6 +571,8 @@ interface PlayRunPackage {
|
|
|
491
571
|
/** Follow-up actions a caller can perform against the run. */
|
|
492
572
|
next?: {
|
|
493
573
|
inspect?: PlayRunActionPackage;
|
|
574
|
+
full?: PlayRunActionPackage;
|
|
575
|
+
billing?: PlayRunActionPackage;
|
|
494
576
|
export?: PlayRunActionPackage;
|
|
495
577
|
query?: PlayRunActionPackage;
|
|
496
578
|
logs?: PlayRunActionPackage;
|
|
@@ -1363,6 +1445,12 @@ type PlaySheetRow = {
|
|
|
1363
1445
|
/** Runtime-sheet rows and aggregate progress for one dataset/table namespace. */
|
|
1364
1446
|
type PlaySheetRowsResult = {
|
|
1365
1447
|
rows: PlaySheetRow[];
|
|
1448
|
+
scope?: {
|
|
1449
|
+
kind: 'database';
|
|
1450
|
+
} | {
|
|
1451
|
+
kind: 'run';
|
|
1452
|
+
runId: string;
|
|
1453
|
+
};
|
|
1366
1454
|
summary?: {
|
|
1367
1455
|
stats?: {
|
|
1368
1456
|
total?: number;
|
|
@@ -1426,6 +1514,14 @@ type RunsNamespace = {
|
|
|
1426
1514
|
reason?: string;
|
|
1427
1515
|
}) => Promise<StopAllPlayRunsResult>;
|
|
1428
1516
|
};
|
|
1517
|
+
/** Current mutable customer database namespace exposed as `client.db`. */
|
|
1518
|
+
type DbNamespace = {
|
|
1519
|
+
/** Run a bounded SQL query against the current customer data plane. */
|
|
1520
|
+
query: (input: {
|
|
1521
|
+
sql: string;
|
|
1522
|
+
maxRows?: number;
|
|
1523
|
+
}) => Promise<CustomerDbQueryResult>;
|
|
1524
|
+
};
|
|
1429
1525
|
/** One credit grant pool reported by the billing subscription status endpoint. */
|
|
1430
1526
|
type BillingCreditPool = {
|
|
1431
1527
|
pool: string;
|
|
@@ -1640,6 +1736,8 @@ declare class DeeplineClient {
|
|
|
1640
1736
|
private readonly config;
|
|
1641
1737
|
/** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
|
|
1642
1738
|
readonly runs: RunsNamespace;
|
|
1739
|
+
/** Current mutable customer database namespace backed by `/api/v2/db/query`. */
|
|
1740
|
+
readonly db: DbNamespace;
|
|
1643
1741
|
/** Billing namespace: subscription status/cancel and invoice history. */
|
|
1644
1742
|
readonly billing: BillingNamespace;
|
|
1645
1743
|
/**
|
|
@@ -1746,11 +1844,14 @@ declare class DeeplineClient {
|
|
|
1746
1844
|
* envelope remains the same.
|
|
1747
1845
|
*/
|
|
1748
1846
|
executeToolRaw<TData = unknown, TMeta = Record<string, unknown>>(toolId: string, input: Record<string, unknown>, options?: ExecuteToolRawOptions): Promise<ToolExecution<TData, TMeta>>;
|
|
1847
|
+
private queryDb;
|
|
1749
1848
|
/**
|
|
1750
|
-
* Run a bounded SQL query against the customer
|
|
1849
|
+
* Run a bounded SQL query against the current mutable customer database.
|
|
1850
|
+
*
|
|
1851
|
+
* This query is not scoped to one play run. Use `client.runs` export actions
|
|
1852
|
+
* when the caller needs the rows produced by a specific run.
|
|
1751
1853
|
*
|
|
1752
|
-
* Use
|
|
1753
|
-
* workspace scoping and row limits.
|
|
1854
|
+
* @deprecated Use {@link DeeplineClient.db} `.query(...)`.
|
|
1754
1855
|
*/
|
|
1755
1856
|
queryCustomerDb(input: {
|
|
1756
1857
|
sql: string;
|
|
@@ -4412,4 +4513,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
|
|
|
4412
4513
|
*/
|
|
4413
4514
|
declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
|
|
4414
4515
|
|
|
4415
|
-
export { AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, 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 PlayCallExecution, type PlayCallOptions, 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 SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, 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 };
|
|
4516
|
+
export { AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, 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, type DbNamespace, 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 PlayCallExecution, type PlayCallOptions, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunDatasetActions, type PlayRunPackage, 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 SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, 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
|
@@ -85,12 +85,17 @@ interface CustomerDbColumn {
|
|
|
85
85
|
data_type_id: number | null;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
|
-
* Result returned by {@link DeeplineClient.
|
|
88
|
+
* Result returned by {@link DeeplineClient.db.query}.
|
|
89
89
|
*
|
|
90
90
|
* Rows are intentionally untyped because the schema depends on the caller's SQL
|
|
91
91
|
* query and selected customer tables.
|
|
92
92
|
*/
|
|
93
93
|
interface CustomerDbQueryResult {
|
|
94
|
+
/** This query reads the current mutable customer database, not one run snapshot. */
|
|
95
|
+
scope?: {
|
|
96
|
+
kind: 'database';
|
|
97
|
+
mutability: 'current';
|
|
98
|
+
};
|
|
94
99
|
/** Database command executed by the query endpoint. */
|
|
95
100
|
command: string;
|
|
96
101
|
/** Total affected row count when reported by the database. */
|
|
@@ -410,6 +415,23 @@ interface PlayProgressStatus {
|
|
|
410
415
|
type PlayRunActionPackage = {
|
|
411
416
|
kind: 'deepline_run_inspect';
|
|
412
417
|
runId: string;
|
|
418
|
+
command?: string;
|
|
419
|
+
api: {
|
|
420
|
+
method: 'GET';
|
|
421
|
+
path: string;
|
|
422
|
+
};
|
|
423
|
+
} | {
|
|
424
|
+
kind: 'deepline_run_full';
|
|
425
|
+
runId: string;
|
|
426
|
+
command?: string;
|
|
427
|
+
api: {
|
|
428
|
+
method: 'GET';
|
|
429
|
+
path: string;
|
|
430
|
+
};
|
|
431
|
+
} | {
|
|
432
|
+
kind: 'deepline_run_billing';
|
|
433
|
+
runId: string;
|
|
434
|
+
command?: string;
|
|
413
435
|
api: {
|
|
414
436
|
method: 'GET';
|
|
415
437
|
path: string;
|
|
@@ -422,6 +444,20 @@ type PlayRunActionPackage = {
|
|
|
422
444
|
sqlQualifiedTableName?: string;
|
|
423
445
|
sql: string;
|
|
424
446
|
maxRows: number;
|
|
447
|
+
command?: string;
|
|
448
|
+
scope?: {
|
|
449
|
+
kind: 'database';
|
|
450
|
+
mutability: 'current';
|
|
451
|
+
} | {
|
|
452
|
+
kind: 'run';
|
|
453
|
+
runId: string;
|
|
454
|
+
};
|
|
455
|
+
note?: string;
|
|
456
|
+
deprecated?: {
|
|
457
|
+
replacement: 'queryCurrentTable';
|
|
458
|
+
removeAfter: string;
|
|
459
|
+
reason: string;
|
|
460
|
+
};
|
|
425
461
|
api: {
|
|
426
462
|
method: 'POST';
|
|
427
463
|
path: '/api/v2/db/query';
|
|
@@ -431,6 +467,17 @@ type PlayRunActionPackage = {
|
|
|
431
467
|
runId: string;
|
|
432
468
|
datasetPath: string;
|
|
433
469
|
format: 'csv';
|
|
470
|
+
command?: string;
|
|
471
|
+
scope?: {
|
|
472
|
+
kind: 'run';
|
|
473
|
+
runId: string;
|
|
474
|
+
};
|
|
475
|
+
note?: string;
|
|
476
|
+
deprecated?: {
|
|
477
|
+
replacement: 'datasets[].actions.exportCsv';
|
|
478
|
+
removeAfter: string;
|
|
479
|
+
reason: string;
|
|
480
|
+
};
|
|
434
481
|
} | {
|
|
435
482
|
kind: 'deepline_run_logs';
|
|
436
483
|
runId: string;
|
|
@@ -442,6 +489,33 @@ type PlayRunActionPackage = {
|
|
|
442
489
|
path: string;
|
|
443
490
|
};
|
|
444
491
|
};
|
|
492
|
+
type PlayRunDbQueryAction = Extract<PlayRunActionPackage, {
|
|
493
|
+
kind: 'deepline_db_query';
|
|
494
|
+
}>;
|
|
495
|
+
type PlayRunExportAction = Extract<PlayRunActionPackage, {
|
|
496
|
+
kind: 'deepline_run_export';
|
|
497
|
+
}>;
|
|
498
|
+
type PlayRunDatasetActions = {
|
|
499
|
+
/** @deprecated Use queryCurrentTable or exportCsv. Removed after 2026-08-18. */
|
|
500
|
+
query?: PlayRunDbQueryAction & {
|
|
501
|
+
scope?: {
|
|
502
|
+
kind: 'run';
|
|
503
|
+
runId: string;
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
queryCurrentTable?: PlayRunDbQueryAction & {
|
|
507
|
+
scope?: {
|
|
508
|
+
kind: 'database';
|
|
509
|
+
mutability: 'current';
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
exportCsv?: PlayRunExportAction & {
|
|
513
|
+
scope?: {
|
|
514
|
+
kind: 'run';
|
|
515
|
+
runId: string;
|
|
516
|
+
};
|
|
517
|
+
};
|
|
518
|
+
};
|
|
445
519
|
/**
|
|
446
520
|
* Compact canonical package for an inspected play run.
|
|
447
521
|
*
|
|
@@ -477,9 +551,15 @@ interface PlayRunPackage {
|
|
|
477
551
|
path: string;
|
|
478
552
|
tableNamespace?: string;
|
|
479
553
|
rowCount?: number;
|
|
554
|
+
sqlTableName?: string;
|
|
555
|
+
sqlQualifiedTableName?: string;
|
|
480
556
|
recovered?: true;
|
|
557
|
+
exportUnavailable?: {
|
|
558
|
+
reason: 'empty_dataset' | 'shared_table_namespace';
|
|
559
|
+
message: string;
|
|
560
|
+
};
|
|
481
561
|
preview?: Record<string, unknown>;
|
|
482
|
-
actions?:
|
|
562
|
+
actions?: PlayRunDatasetActions;
|
|
483
563
|
}>;
|
|
484
564
|
/** Small retained tail of customer and runtime logs; fetch the full stream through `runs.logs`. */
|
|
485
565
|
logs?: {
|
|
@@ -491,6 +571,8 @@ interface PlayRunPackage {
|
|
|
491
571
|
/** Follow-up actions a caller can perform against the run. */
|
|
492
572
|
next?: {
|
|
493
573
|
inspect?: PlayRunActionPackage;
|
|
574
|
+
full?: PlayRunActionPackage;
|
|
575
|
+
billing?: PlayRunActionPackage;
|
|
494
576
|
export?: PlayRunActionPackage;
|
|
495
577
|
query?: PlayRunActionPackage;
|
|
496
578
|
logs?: PlayRunActionPackage;
|
|
@@ -1363,6 +1445,12 @@ type PlaySheetRow = {
|
|
|
1363
1445
|
/** Runtime-sheet rows and aggregate progress for one dataset/table namespace. */
|
|
1364
1446
|
type PlaySheetRowsResult = {
|
|
1365
1447
|
rows: PlaySheetRow[];
|
|
1448
|
+
scope?: {
|
|
1449
|
+
kind: 'database';
|
|
1450
|
+
} | {
|
|
1451
|
+
kind: 'run';
|
|
1452
|
+
runId: string;
|
|
1453
|
+
};
|
|
1366
1454
|
summary?: {
|
|
1367
1455
|
stats?: {
|
|
1368
1456
|
total?: number;
|
|
@@ -1426,6 +1514,14 @@ type RunsNamespace = {
|
|
|
1426
1514
|
reason?: string;
|
|
1427
1515
|
}) => Promise<StopAllPlayRunsResult>;
|
|
1428
1516
|
};
|
|
1517
|
+
/** Current mutable customer database namespace exposed as `client.db`. */
|
|
1518
|
+
type DbNamespace = {
|
|
1519
|
+
/** Run a bounded SQL query against the current customer data plane. */
|
|
1520
|
+
query: (input: {
|
|
1521
|
+
sql: string;
|
|
1522
|
+
maxRows?: number;
|
|
1523
|
+
}) => Promise<CustomerDbQueryResult>;
|
|
1524
|
+
};
|
|
1429
1525
|
/** One credit grant pool reported by the billing subscription status endpoint. */
|
|
1430
1526
|
type BillingCreditPool = {
|
|
1431
1527
|
pool: string;
|
|
@@ -1640,6 +1736,8 @@ declare class DeeplineClient {
|
|
|
1640
1736
|
private readonly config;
|
|
1641
1737
|
/** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
|
|
1642
1738
|
readonly runs: RunsNamespace;
|
|
1739
|
+
/** Current mutable customer database namespace backed by `/api/v2/db/query`. */
|
|
1740
|
+
readonly db: DbNamespace;
|
|
1643
1741
|
/** Billing namespace: subscription status/cancel and invoice history. */
|
|
1644
1742
|
readonly billing: BillingNamespace;
|
|
1645
1743
|
/**
|
|
@@ -1746,11 +1844,14 @@ declare class DeeplineClient {
|
|
|
1746
1844
|
* envelope remains the same.
|
|
1747
1845
|
*/
|
|
1748
1846
|
executeToolRaw<TData = unknown, TMeta = Record<string, unknown>>(toolId: string, input: Record<string, unknown>, options?: ExecuteToolRawOptions): Promise<ToolExecution<TData, TMeta>>;
|
|
1847
|
+
private queryDb;
|
|
1749
1848
|
/**
|
|
1750
|
-
* Run a bounded SQL query against the customer
|
|
1849
|
+
* Run a bounded SQL query against the current mutable customer database.
|
|
1850
|
+
*
|
|
1851
|
+
* This query is not scoped to one play run. Use `client.runs` export actions
|
|
1852
|
+
* when the caller needs the rows produced by a specific run.
|
|
1751
1853
|
*
|
|
1752
|
-
* Use
|
|
1753
|
-
* workspace scoping and row limits.
|
|
1854
|
+
* @deprecated Use {@link DeeplineClient.db} `.query(...)`.
|
|
1754
1855
|
*/
|
|
1755
1856
|
queryCustomerDb(input: {
|
|
1756
1857
|
sql: string;
|
|
@@ -4412,4 +4513,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
|
|
|
4412
4513
|
*/
|
|
4413
4514
|
declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
|
|
4414
4515
|
|
|
4415
|
-
export { AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, 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 PlayCallExecution, type PlayCallOptions, 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 SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, 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 };
|
|
4516
|
+
export { AuthError, type BillingCreditPool, type BillingInvoiceEntry, type BillingInvoicesResult, type BillingNamespace, type BillingPaymentMethodSummary, type BillingSubscriptionCancelResult, type BillingSubscriptionStatus, type BillingTopUpResult, 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, type DbNamespace, 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 PlayCallExecution, type PlayCallOptions, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunActionPackage, type PlayRunDatasetActions, type PlayRunPackage, 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 SqlListenerDeclaration, type SqlListenerEvent, type SqlListenerOperation, type SqlQuery, 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
|
@@ -422,19 +422,21 @@ var SDK_RELEASE = {
|
|
|
422
422
|
// 0.1.154 removes the short-lived generated enrich StepOptions recompute
|
|
423
423
|
// fields shipped in 0.1.153.
|
|
424
424
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
425
|
+
// 0.1.230 propagates enrich extractor failures as failed rows rather than
|
|
426
|
+
// silently materializing them as unmatched results.
|
|
425
427
|
// 0.1.220 deprecates SDK CLI versions below 0.1.219 and updates them
|
|
426
428
|
// automatically without blocking their current command.
|
|
427
|
-
version: "0.1.
|
|
429
|
+
version: "0.1.239",
|
|
428
430
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
429
431
|
supportPolicy: {
|
|
430
|
-
latest: "0.1.
|
|
432
|
+
latest: "0.1.239",
|
|
431
433
|
minimumSupported: "0.1.53",
|
|
432
434
|
deprecatedBelow: "0.1.219",
|
|
433
435
|
commandMinimumSupported: [
|
|
434
436
|
{
|
|
435
437
|
command: "enrich",
|
|
436
|
-
minimumSupported: "0.1.
|
|
437
|
-
reason:
|
|
438
|
+
minimumSupported: "0.1.238",
|
|
439
|
+
reason: 'Older SDK CLI enrich generated stale play source; SDK CLI enrich 0.1.153 generated removed StepOptions fields in play source; SDK CLI enrich before 0.1.175 could silently succeed on the empty-waterfall bug when a requested waterfall returned no values for selected rows; SDK CLI enrich before 0.1.230 could convert extractor failures into successful unmatched results; SDK CLI enrich before 0.1.238 could drop a nested provider email match during generic pick("email") extraction and materialize it as NO_MATCH.'
|
|
438
440
|
},
|
|
439
441
|
{
|
|
440
442
|
command: "plays",
|
|
@@ -689,6 +691,7 @@ var HttpClient = class {
|
|
|
689
691
|
"X-Deepline-CLI-Version": SDK_VERSION,
|
|
690
692
|
"X-Deepline-SDK-Version": SDK_VERSION,
|
|
691
693
|
"X-Deepline-API-Contract": SDK_API_CONTRACT,
|
|
694
|
+
"X-Deepline-Run-Result-Shape": "canonical",
|
|
692
695
|
...extra
|
|
693
696
|
};
|
|
694
697
|
const skillsVersion = this.readSkillsVersionHeader();
|
|
@@ -2502,6 +2505,8 @@ var DeeplineClient = class {
|
|
|
2502
2505
|
config;
|
|
2503
2506
|
/** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
|
|
2504
2507
|
runs;
|
|
2508
|
+
/** Current mutable customer database namespace backed by `/api/v2/db/query`. */
|
|
2509
|
+
db;
|
|
2505
2510
|
/** Billing namespace: subscription status/cancel and invoice history. */
|
|
2506
2511
|
billing;
|
|
2507
2512
|
/**
|
|
@@ -2525,6 +2530,9 @@ var DeeplineClient = class {
|
|
|
2525
2530
|
stop: (runId, options2) => this.stopRun(runId, options2),
|
|
2526
2531
|
stopAll: (options2) => this.stopAllRuns(options2)
|
|
2527
2532
|
};
|
|
2533
|
+
this.db = {
|
|
2534
|
+
query: (input) => this.queryDb(input)
|
|
2535
|
+
};
|
|
2528
2536
|
this.billing = {
|
|
2529
2537
|
topUp: (options2) => this.topUpBillingBalance(options2),
|
|
2530
2538
|
plans: () => this.getBillingPlans(),
|
|
@@ -2791,17 +2799,29 @@ var DeeplineClient = class {
|
|
|
2791
2799
|
async executeToolRaw(toolId, input, options) {
|
|
2792
2800
|
return this.executeTool(toolId, input, options);
|
|
2793
2801
|
}
|
|
2802
|
+
async queryDb(input) {
|
|
2803
|
+
const result = await this.http.post(
|
|
2804
|
+
"/api/v2/db/query",
|
|
2805
|
+
{
|
|
2806
|
+
sql: input.sql,
|
|
2807
|
+
...input.maxRows ? { max_rows: input.maxRows } : {}
|
|
2808
|
+
}
|
|
2809
|
+
);
|
|
2810
|
+
return {
|
|
2811
|
+
...result,
|
|
2812
|
+
scope: { kind: "database", mutability: "current" }
|
|
2813
|
+
};
|
|
2814
|
+
}
|
|
2794
2815
|
/**
|
|
2795
|
-
* Run a bounded SQL query against the customer
|
|
2816
|
+
* Run a bounded SQL query against the current mutable customer database.
|
|
2817
|
+
*
|
|
2818
|
+
* This query is not scoped to one play run. Use `client.runs` export actions
|
|
2819
|
+
* when the caller needs the rows produced by a specific run.
|
|
2796
2820
|
*
|
|
2797
|
-
* Use
|
|
2798
|
-
* workspace scoping and row limits.
|
|
2821
|
+
* @deprecated Use {@link DeeplineClient.db} `.query(...)`.
|
|
2799
2822
|
*/
|
|
2800
2823
|
async queryCustomerDb(input) {
|
|
2801
|
-
return this.
|
|
2802
|
-
sql: input.sql,
|
|
2803
|
-
...input.maxRows ? { max_rows: input.maxRows } : {}
|
|
2804
|
-
});
|
|
2824
|
+
return this.db.query(input);
|
|
2805
2825
|
}
|
|
2806
2826
|
/**
|
|
2807
2827
|
* Re-establish this workspace's tenant storage contract: role/DB connect
|
|
@@ -3932,9 +3952,35 @@ var DeeplineClient = class {
|
|
|
3932
3952
|
if (input.rowMode === "all") {
|
|
3933
3953
|
params.set("rowMode", "all");
|
|
3934
3954
|
}
|
|
3935
|
-
|
|
3955
|
+
const result = await this.http.get(
|
|
3936
3956
|
`/api/v2/plays/${encodeURIComponent(input.playName)}/sheet?${params.toString()}`
|
|
3937
3957
|
);
|
|
3958
|
+
const requestedRunId = input.runId?.trim() || "";
|
|
3959
|
+
if (requestedRunId) {
|
|
3960
|
+
const confirmedRunId = result.scope?.kind === "run" ? result.scope.runId.trim() : "";
|
|
3961
|
+
const foreignRowRunIds = [
|
|
3962
|
+
...new Set(
|
|
3963
|
+
result.rows.map(
|
|
3964
|
+
(row) => typeof row.runId === "string" ? row.runId.trim() : ""
|
|
3965
|
+
).filter((runId) => runId && runId !== requestedRunId)
|
|
3966
|
+
)
|
|
3967
|
+
];
|
|
3968
|
+
if (result.scope?.kind !== "run" || confirmedRunId !== requestedRunId || foreignRowRunIds.length > 0) {
|
|
3969
|
+
throw new DeeplineError(
|
|
3970
|
+
`Run-scoped dataset export was not confirmed for ${requestedRunId}; no rows were returned to the caller. Update Deepline, then retry the same export command. Do not rerun the play.`,
|
|
3971
|
+
void 0,
|
|
3972
|
+
"RUN_EXPORT_SCOPE_MISMATCH",
|
|
3973
|
+
{
|
|
3974
|
+
requestedRunId,
|
|
3975
|
+
confirmedScope: result.scope ?? null,
|
|
3976
|
+
foreignRowRunIds,
|
|
3977
|
+
playName: input.playName,
|
|
3978
|
+
tableNamespace: input.tableNamespace
|
|
3979
|
+
}
|
|
3980
|
+
);
|
|
3981
|
+
}
|
|
3982
|
+
}
|
|
3983
|
+
return result;
|
|
3938
3984
|
}
|
|
3939
3985
|
/**
|
|
3940
3986
|
* Stop a run by id using the public runs resource model.
|
package/dist/index.mjs
CHANGED
|
@@ -352,19 +352,21 @@ var SDK_RELEASE = {
|
|
|
352
352
|
// 0.1.154 removes the short-lived generated enrich StepOptions recompute
|
|
353
353
|
// fields shipped in 0.1.153.
|
|
354
354
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
355
|
+
// 0.1.230 propagates enrich extractor failures as failed rows rather than
|
|
356
|
+
// silently materializing them as unmatched results.
|
|
355
357
|
// 0.1.220 deprecates SDK CLI versions below 0.1.219 and updates them
|
|
356
358
|
// automatically without blocking their current command.
|
|
357
|
-
version: "0.1.
|
|
359
|
+
version: "0.1.239",
|
|
358
360
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
359
361
|
supportPolicy: {
|
|
360
|
-
latest: "0.1.
|
|
362
|
+
latest: "0.1.239",
|
|
361
363
|
minimumSupported: "0.1.53",
|
|
362
364
|
deprecatedBelow: "0.1.219",
|
|
363
365
|
commandMinimumSupported: [
|
|
364
366
|
{
|
|
365
367
|
command: "enrich",
|
|
366
|
-
minimumSupported: "0.1.
|
|
367
|
-
reason:
|
|
368
|
+
minimumSupported: "0.1.238",
|
|
369
|
+
reason: 'Older SDK CLI enrich generated stale play source; SDK CLI enrich 0.1.153 generated removed StepOptions fields in play source; SDK CLI enrich before 0.1.175 could silently succeed on the empty-waterfall bug when a requested waterfall returned no values for selected rows; SDK CLI enrich before 0.1.230 could convert extractor failures into successful unmatched results; SDK CLI enrich before 0.1.238 could drop a nested provider email match during generic pick("email") extraction and materialize it as NO_MATCH.'
|
|
368
370
|
},
|
|
369
371
|
{
|
|
370
372
|
command: "plays",
|
|
@@ -619,6 +621,7 @@ var HttpClient = class {
|
|
|
619
621
|
"X-Deepline-CLI-Version": SDK_VERSION,
|
|
620
622
|
"X-Deepline-SDK-Version": SDK_VERSION,
|
|
621
623
|
"X-Deepline-API-Contract": SDK_API_CONTRACT,
|
|
624
|
+
"X-Deepline-Run-Result-Shape": "canonical",
|
|
622
625
|
...extra
|
|
623
626
|
};
|
|
624
627
|
const skillsVersion = this.readSkillsVersionHeader();
|
|
@@ -2432,6 +2435,8 @@ var DeeplineClient = class {
|
|
|
2432
2435
|
config;
|
|
2433
2436
|
/** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
|
|
2434
2437
|
runs;
|
|
2438
|
+
/** Current mutable customer database namespace backed by `/api/v2/db/query`. */
|
|
2439
|
+
db;
|
|
2435
2440
|
/** Billing namespace: subscription status/cancel and invoice history. */
|
|
2436
2441
|
billing;
|
|
2437
2442
|
/**
|
|
@@ -2455,6 +2460,9 @@ var DeeplineClient = class {
|
|
|
2455
2460
|
stop: (runId, options2) => this.stopRun(runId, options2),
|
|
2456
2461
|
stopAll: (options2) => this.stopAllRuns(options2)
|
|
2457
2462
|
};
|
|
2463
|
+
this.db = {
|
|
2464
|
+
query: (input) => this.queryDb(input)
|
|
2465
|
+
};
|
|
2458
2466
|
this.billing = {
|
|
2459
2467
|
topUp: (options2) => this.topUpBillingBalance(options2),
|
|
2460
2468
|
plans: () => this.getBillingPlans(),
|
|
@@ -2721,17 +2729,29 @@ var DeeplineClient = class {
|
|
|
2721
2729
|
async executeToolRaw(toolId, input, options) {
|
|
2722
2730
|
return this.executeTool(toolId, input, options);
|
|
2723
2731
|
}
|
|
2732
|
+
async queryDb(input) {
|
|
2733
|
+
const result = await this.http.post(
|
|
2734
|
+
"/api/v2/db/query",
|
|
2735
|
+
{
|
|
2736
|
+
sql: input.sql,
|
|
2737
|
+
...input.maxRows ? { max_rows: input.maxRows } : {}
|
|
2738
|
+
}
|
|
2739
|
+
);
|
|
2740
|
+
return {
|
|
2741
|
+
...result,
|
|
2742
|
+
scope: { kind: "database", mutability: "current" }
|
|
2743
|
+
};
|
|
2744
|
+
}
|
|
2724
2745
|
/**
|
|
2725
|
-
* Run a bounded SQL query against the customer
|
|
2746
|
+
* Run a bounded SQL query against the current mutable customer database.
|
|
2747
|
+
*
|
|
2748
|
+
* This query is not scoped to one play run. Use `client.runs` export actions
|
|
2749
|
+
* when the caller needs the rows produced by a specific run.
|
|
2726
2750
|
*
|
|
2727
|
-
* Use
|
|
2728
|
-
* workspace scoping and row limits.
|
|
2751
|
+
* @deprecated Use {@link DeeplineClient.db} `.query(...)`.
|
|
2729
2752
|
*/
|
|
2730
2753
|
async queryCustomerDb(input) {
|
|
2731
|
-
return this.
|
|
2732
|
-
sql: input.sql,
|
|
2733
|
-
...input.maxRows ? { max_rows: input.maxRows } : {}
|
|
2734
|
-
});
|
|
2754
|
+
return this.db.query(input);
|
|
2735
2755
|
}
|
|
2736
2756
|
/**
|
|
2737
2757
|
* Re-establish this workspace's tenant storage contract: role/DB connect
|
|
@@ -3862,9 +3882,35 @@ var DeeplineClient = class {
|
|
|
3862
3882
|
if (input.rowMode === "all") {
|
|
3863
3883
|
params.set("rowMode", "all");
|
|
3864
3884
|
}
|
|
3865
|
-
|
|
3885
|
+
const result = await this.http.get(
|
|
3866
3886
|
`/api/v2/plays/${encodeURIComponent(input.playName)}/sheet?${params.toString()}`
|
|
3867
3887
|
);
|
|
3888
|
+
const requestedRunId = input.runId?.trim() || "";
|
|
3889
|
+
if (requestedRunId) {
|
|
3890
|
+
const confirmedRunId = result.scope?.kind === "run" ? result.scope.runId.trim() : "";
|
|
3891
|
+
const foreignRowRunIds = [
|
|
3892
|
+
...new Set(
|
|
3893
|
+
result.rows.map(
|
|
3894
|
+
(row) => typeof row.runId === "string" ? row.runId.trim() : ""
|
|
3895
|
+
).filter((runId) => runId && runId !== requestedRunId)
|
|
3896
|
+
)
|
|
3897
|
+
];
|
|
3898
|
+
if (result.scope?.kind !== "run" || confirmedRunId !== requestedRunId || foreignRowRunIds.length > 0) {
|
|
3899
|
+
throw new DeeplineError(
|
|
3900
|
+
`Run-scoped dataset export was not confirmed for ${requestedRunId}; no rows were returned to the caller. Update Deepline, then retry the same export command. Do not rerun the play.`,
|
|
3901
|
+
void 0,
|
|
3902
|
+
"RUN_EXPORT_SCOPE_MISMATCH",
|
|
3903
|
+
{
|
|
3904
|
+
requestedRunId,
|
|
3905
|
+
confirmedScope: result.scope ?? null,
|
|
3906
|
+
foreignRowRunIds,
|
|
3907
|
+
playName: input.playName,
|
|
3908
|
+
tableNamespace: input.tableNamespace
|
|
3909
|
+
}
|
|
3910
|
+
);
|
|
3911
|
+
}
|
|
3912
|
+
}
|
|
3913
|
+
return result;
|
|
3868
3914
|
}
|
|
3869
3915
|
/**
|
|
3870
3916
|
* Stop a run by id using the public runs resource model.
|