deepline 0.3.227 → 0.3.229
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/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-data-plane/contracts.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/index.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/sheet-column-storage.ts +252 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/sheet-contract.ts +29 -8
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +250 -37
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-event-transport.ts +29 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-diagnostics.ts +43 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +380 -183
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +17 -28
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +1 -0
- package/dist/bundling-sources/shared_libs/plays/dataset.ts +16 -2
- package/dist/bundling-sources/shared_libs/plays/execution-pipeline.ts +72 -0
- package/dist/bundling-sources/shared_libs/plays/launch/prepare.ts +1 -3
- package/dist/bundling-sources/shared_libs/plays/sheet-filter.ts +9 -13
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +28 -31
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/{compiler-manifest-Dpd2hEet.d.mts → compiler-manifest-n8ZtPv2h.d.mts} +31 -21
- package/dist/{compiler-manifest-Dpd2hEet.d.ts → compiler-manifest-n8ZtPv2h.d.ts} +31 -21
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -1
- package/dist/index.mjs +6 -1
- package/dist/install-integrity.json +4 -2
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +1 -1
- package/dist/release.mjs +1 -1
- package/package.json +1 -1
|
@@ -93,7 +93,6 @@ import {
|
|
|
93
93
|
} from '../log-provenance';
|
|
94
94
|
import {
|
|
95
95
|
buildRunLedgerEventsIdempotencyKey,
|
|
96
|
-
isRunLedgerProjectionChunk,
|
|
97
96
|
RunLedgerProjectionLeaseLostError,
|
|
98
97
|
type RunLedgerProjectionChunk,
|
|
99
98
|
type RunLedgerProjectionLeaseLostReason,
|
|
@@ -101,8 +100,8 @@ import {
|
|
|
101
100
|
buildRunLedgerStartIdempotencyKey,
|
|
102
101
|
buildRunLedgerTerminalIdempotencyKey,
|
|
103
102
|
} from '../run-ledger-projection-contract';
|
|
104
|
-
import {
|
|
105
|
-
import {
|
|
103
|
+
import { runLedgerProjectionMismatchAcrossCandidates } from '../run-ledger-projection-diagnostics';
|
|
104
|
+
import { runEventsForAppRuntimeProjectionCandidates } from '../run-ledger-event-transport';
|
|
106
105
|
import {
|
|
107
106
|
assertTerminalRunResultWithinLimit,
|
|
108
107
|
isLedgerTerminalResultRef,
|
|
@@ -16106,32 +16105,22 @@ export async function assertPostgresRunLedgerDelivery(
|
|
|
16106
16105
|
}),
|
|
16107
16106
|
);
|
|
16108
16107
|
}
|
|
16109
|
-
|
|
16110
|
-
|
|
16111
|
-
|
|
16112
|
-
|
|
16113
|
-
|
|
16114
|
-
|
|
16115
|
-
|
|
16116
|
-
? selectRunEventsForAppRuntimeProjectionChunk(prefixEvents, chunk)
|
|
16117
|
-
: undefined;
|
|
16118
|
-
expectedProjectionEvents =
|
|
16119
|
-
expectedTransportChunk === undefined
|
|
16120
|
-
? undefined
|
|
16108
|
+
const expectedProjectionCandidates =
|
|
16109
|
+
runEventsForAppRuntimeProjectionCandidates(
|
|
16110
|
+
prefixEvents,
|
|
16111
|
+
input.projectionChunk,
|
|
16112
|
+
).map((candidate) =>
|
|
16113
|
+
candidate === null
|
|
16114
|
+
? null
|
|
16121
16115
|
: input.sanitizeExpectedProjectionEvents
|
|
16122
|
-
? input.sanitizeExpectedProjectionEvents(
|
|
16123
|
-
:
|
|
16124
|
-
|
|
16125
|
-
|
|
16126
|
-
|
|
16127
|
-
|
|
16128
|
-
|
|
16129
|
-
|
|
16130
|
-
runLedgerProjectionMismatch({
|
|
16131
|
-
projectedEvents: input.projectedEvents,
|
|
16132
|
-
expectedEvents: expectedProjectionEvents ?? null,
|
|
16133
|
-
...(input.projectionChunk ? { chunk: input.projectionChunk } : {}),
|
|
16134
|
-
});
|
|
16116
|
+
? input.sanitizeExpectedProjectionEvents(candidate)
|
|
16117
|
+
: candidate,
|
|
16118
|
+
);
|
|
16119
|
+
const projectionMismatch = runLedgerProjectionMismatchAcrossCandidates({
|
|
16120
|
+
projectedEvents: input.projectedEvents,
|
|
16121
|
+
expectedEventCandidates: expectedProjectionCandidates,
|
|
16122
|
+
...(input.projectionChunk ? { chunk: input.projectionChunk } : {}),
|
|
16123
|
+
});
|
|
16135
16124
|
if (projectionMismatch === null) return;
|
|
16136
16125
|
throw new RunLedgerProjectionLeaseLostError(
|
|
16137
16126
|
'projected_events_mismatch',
|
|
@@ -1767,6 +1767,7 @@ function createDatasetFromSerializedToolList(
|
|
|
1767
1767
|
residentRows: isPartialPreview ? null : sourceRows,
|
|
1768
1768
|
sourceLabel: serialized.sourceLabel ?? null,
|
|
1769
1769
|
tableNamespace: serialized.tableNamespace ?? null,
|
|
1770
|
+
columnTypes: serialized.columnTypes,
|
|
1770
1771
|
workProgress: serialized._metadata?.workProgress,
|
|
1771
1772
|
resolvers: {
|
|
1772
1773
|
count: async () => serialized.count,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PlayExecutionFileRef } from './file-refs';
|
|
2
|
+
import type { PlayDatasetColumnTypes } from '../play-data-plane/contracts';
|
|
2
3
|
|
|
3
4
|
const PLAY_DATASET_BRAND = Symbol.for('deepline.play.dataset');
|
|
4
5
|
const NODE_INSPECT_CUSTOM = Symbol.for('nodejs.util.inspect.custom');
|
|
@@ -47,6 +48,7 @@ export interface SerializedPlayDataset<T> {
|
|
|
47
48
|
sourceLabel?: string | null;
|
|
48
49
|
tableNamespace?: string | null;
|
|
49
50
|
columns?: string[];
|
|
51
|
+
columnTypes?: PlayDatasetColumnTypes;
|
|
50
52
|
_metadata?: {
|
|
51
53
|
workProgress?: PlayDatasetWorkProgressSummary;
|
|
52
54
|
};
|
|
@@ -107,8 +109,7 @@ export type PlayDatasetTransformOptions = {
|
|
|
107
109
|
* `materialize(limit)` or async iteration only when the dataset is intentionally
|
|
108
110
|
* small and bounded. `PlayDataset` intentionally does not expose `.rows`,
|
|
109
111
|
* `.toArray()`, `.length`, numeric indexing, spread, or synchronous iteration;
|
|
110
|
-
*
|
|
111
|
-
* behavior depend on whether rows happen to be resident.
|
|
112
|
+
* these hide loading costs or make behavior depend on row residency.
|
|
112
113
|
*
|
|
113
114
|
* @sdkReference runtime 190
|
|
114
115
|
*/
|
|
@@ -124,6 +125,8 @@ export interface PlayDataset<T> extends AsyncIterable<T> {
|
|
|
124
125
|
readonly sourceLabel?: string | null;
|
|
125
126
|
/** Runtime table name. */
|
|
126
127
|
readonly tableNamespace?: string | null;
|
|
128
|
+
/** Advisory source types; transformed fields must infer from their values. */
|
|
129
|
+
readonly columnTypes?: PlayDatasetColumnTypes;
|
|
127
130
|
/** Row count. */
|
|
128
131
|
count(): Promise<number>;
|
|
129
132
|
/** Preview rows. */
|
|
@@ -161,6 +164,7 @@ export interface PlayDataset<T> extends AsyncIterable<T> {
|
|
|
161
164
|
sourceLabel?: string | null;
|
|
162
165
|
tableNamespace?: string | null;
|
|
163
166
|
columns?: string[];
|
|
167
|
+
columnTypes?: PlayDatasetColumnTypes;
|
|
164
168
|
_metadata?: {
|
|
165
169
|
workProgress?: PlayDatasetWorkProgressSummary;
|
|
166
170
|
};
|
|
@@ -335,6 +339,7 @@ export function deserializePlayDatasetCell<T>(
|
|
|
335
339
|
residentRows: rows,
|
|
336
340
|
sourceLabel: dataset.sourceLabel ?? null,
|
|
337
341
|
tableNamespace: dataset.tableNamespace ?? null,
|
|
342
|
+
columnTypes: dataset.columnTypes,
|
|
338
343
|
workProgress: dataset._metadata?.workProgress,
|
|
339
344
|
resolvers: {
|
|
340
345
|
count: async () => rows.length,
|
|
@@ -374,6 +379,7 @@ export function deserializeLegacyPlayDataset<T>(
|
|
|
374
379
|
residentRows: complete ? rows : null,
|
|
375
380
|
sourceLabel: dataset.sourceLabel ?? null,
|
|
376
381
|
tableNamespace: dataset.tableNamespace ?? null,
|
|
382
|
+
columnTypes: dataset.columnTypes,
|
|
377
383
|
workProgress: dataset._metadata?.workProgress,
|
|
378
384
|
resolvers: {
|
|
379
385
|
count: async () => dataset.count,
|
|
@@ -417,6 +423,7 @@ class DeferredPlayDataset<T> implements PlayDataset<T> {
|
|
|
417
423
|
readonly backing?: PlayDatasetBacking;
|
|
418
424
|
readonly sourceLabel?: string | null;
|
|
419
425
|
readonly tableNamespace?: string | null;
|
|
426
|
+
readonly columnTypes?: PlayDatasetColumnTypes;
|
|
420
427
|
private readonly previewRows: readonly T[];
|
|
421
428
|
private readonly previewColumns?: string[];
|
|
422
429
|
private readonly workProgress?: PlayDatasetWorkProgressSummary;
|
|
@@ -435,6 +442,7 @@ class DeferredPlayDataset<T> implements PlayDataset<T> {
|
|
|
435
442
|
residentRows?: readonly T[] | null;
|
|
436
443
|
sourceLabel?: string | null;
|
|
437
444
|
tableNamespace?: string | null;
|
|
445
|
+
columnTypes?: PlayDatasetColumnTypes;
|
|
438
446
|
workProgress?: PlayDatasetWorkProgressSummary;
|
|
439
447
|
resolvers: PlayDatasetResolvers<T>;
|
|
440
448
|
}) {
|
|
@@ -449,6 +457,7 @@ class DeferredPlayDataset<T> implements PlayDataset<T> {
|
|
|
449
457
|
this.previewColumns = inferPreviewColumns(this.previewRows);
|
|
450
458
|
this.sourceLabel = input.sourceLabel ?? null;
|
|
451
459
|
this.tableNamespace = input.tableNamespace ?? null;
|
|
460
|
+
this.columnTypes = input.columnTypes;
|
|
452
461
|
this.workProgress = input.workProgress;
|
|
453
462
|
this.resolvers = input.resolvers;
|
|
454
463
|
}
|
|
@@ -592,6 +601,7 @@ class DeferredPlayDataset<T> implements PlayDataset<T> {
|
|
|
592
601
|
...(this.sourceLabel ? { sourceLabel: this.sourceLabel } : {}),
|
|
593
602
|
...(this.tableNamespace ? { tableNamespace: this.tableNamespace } : {}),
|
|
594
603
|
...(this.previewColumns ? { columns: this.previewColumns } : {}),
|
|
604
|
+
...(this.columnTypes ? { columnTypes: this.columnTypes } : {}),
|
|
595
605
|
...(this.workProgress
|
|
596
606
|
? { _metadata: { workProgress: this.workProgress } }
|
|
597
607
|
: {}),
|
|
@@ -721,6 +731,7 @@ function createTransformedPlayDataset<T, U>(
|
|
|
721
731
|
backing: source.backing,
|
|
722
732
|
sourceLabel,
|
|
723
733
|
tableNamespace: options?.key ?? null,
|
|
734
|
+
columnTypes: transform.kind === 'map' ? undefined : source.columnTypes,
|
|
724
735
|
resolvers: {
|
|
725
736
|
count,
|
|
726
737
|
peek: async (limit) => collect(limit),
|
|
@@ -747,6 +758,7 @@ export function createDeferredPlayDataset<T>(input: {
|
|
|
747
758
|
residentRows?: readonly T[] | null;
|
|
748
759
|
sourceLabel?: string | null;
|
|
749
760
|
tableNamespace?: string | null;
|
|
761
|
+
columnTypes?: PlayDatasetColumnTypes;
|
|
750
762
|
workProgress?: PlayDatasetWorkProgressSummary;
|
|
751
763
|
resolvers: PlayDatasetResolvers<T>;
|
|
752
764
|
}): PlayDataset<T> {
|
|
@@ -835,6 +847,7 @@ export function createPlayDataset<T>(
|
|
|
835
847
|
sourceLabel?: string | null;
|
|
836
848
|
tableNamespace?: string | null;
|
|
837
849
|
datasetId?: string;
|
|
850
|
+
columnTypes?: PlayDatasetColumnTypes;
|
|
838
851
|
},
|
|
839
852
|
): PlayDataset<T> {
|
|
840
853
|
// Test/dev helper only. Production play execution should construct
|
|
@@ -850,6 +863,7 @@ export function createPlayDataset<T>(
|
|
|
850
863
|
residentRows: materializedRows,
|
|
851
864
|
sourceLabel: metadata?.sourceLabel ?? null,
|
|
852
865
|
tableNamespace: metadata?.tableNamespace ?? null,
|
|
866
|
+
columnTypes: metadata?.columnTypes,
|
|
853
867
|
resolvers: {
|
|
854
868
|
count: async () => materializedRows.length,
|
|
855
869
|
peek: async (limit) => materializedRows.slice(0, Math.max(0, limit)),
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { PlayStaticPipeline } from './static-pipeline';
|
|
2
|
+
import { staticPipelineStorageCodec } from './static-pipeline-storage-codec';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* An in-process execution snapshot, deliberately distinct from display graphs
|
|
6
|
+
* and Convex's bounded V1 mirror. Never serialize this wrapper: durable/wire
|
|
7
|
+
* contracts continue to carry the original pipeline fields.
|
|
8
|
+
*/
|
|
9
|
+
export class PlayExecutionPipeline {
|
|
10
|
+
readonly #pipeline: PlayStaticPipeline | null;
|
|
11
|
+
|
|
12
|
+
private constructor(pipeline: PlayStaticPipeline | null) {
|
|
13
|
+
this.#pipeline = pipeline;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Read the entire storage carrier, so an existing V2 can never be dropped. */
|
|
17
|
+
static fromStored(record: {
|
|
18
|
+
staticPipeline?: unknown;
|
|
19
|
+
staticPipelineV2?: unknown;
|
|
20
|
+
}): PlayExecutionPipeline {
|
|
21
|
+
return new PlayExecutionPipeline(staticPipelineStorageCodec.read(record));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Only for complete compiler/admitted-artifact graphs, never a stored field. */
|
|
25
|
+
static fromAdmitted(pipeline: unknown): PlayExecutionPipeline {
|
|
26
|
+
if (
|
|
27
|
+
pipeline != null &&
|
|
28
|
+
(typeof pipeline !== 'object' ||
|
|
29
|
+
!('fields' in pipeline) ||
|
|
30
|
+
!Array.isArray(pipeline.fields) ||
|
|
31
|
+
!('substeps' in pipeline) ||
|
|
32
|
+
!Array.isArray(pipeline.substeps))
|
|
33
|
+
) {
|
|
34
|
+
throw new Error('Invalid Play execution pipeline snapshot.');
|
|
35
|
+
}
|
|
36
|
+
// Do not compile or normalize retained contracts under current authoring
|
|
37
|
+
// rules. In particular, preserve additive fields and historical contracts.
|
|
38
|
+
return new PlayExecutionPipeline(
|
|
39
|
+
(pipeline as PlayStaticPipeline | null | undefined) ?? null,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get pipeline(): PlayStaticPipeline | null {
|
|
44
|
+
return this.#pipeline;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Reject accidental raw/serialized inputs before launch has side effects. */
|
|
49
|
+
export function readPlayExecutionPipeline(
|
|
50
|
+
snapshot: PlayExecutionPipeline | undefined,
|
|
51
|
+
): PlayStaticPipeline | null {
|
|
52
|
+
if (snapshot === undefined) return null;
|
|
53
|
+
if (!(snapshot instanceof PlayExecutionPipeline)) {
|
|
54
|
+
throw new Error('Play launch requires a PlayExecutionPipeline snapshot.');
|
|
55
|
+
}
|
|
56
|
+
return snapshot.pipeline;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Execution readers cannot see (and accidentally forward) the stored mirror. */
|
|
60
|
+
export function readStoredPlayExecutionSnapshot<
|
|
61
|
+
T extends { staticPipeline?: unknown; staticPipelineV2?: unknown },
|
|
62
|
+
>(
|
|
63
|
+
record: T,
|
|
64
|
+
): Omit<T, 'staticPipeline' | 'staticPipelineV2'> & {
|
|
65
|
+
executionPipeline: PlayExecutionPipeline;
|
|
66
|
+
} {
|
|
67
|
+
const { staticPipeline: _v1, staticPipelineV2: _v2, ...metadata } = record;
|
|
68
|
+
return {
|
|
69
|
+
...metadata,
|
|
70
|
+
executionPipeline: PlayExecutionPipeline.fromStored(record),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -61,7 +61,6 @@ export function buildPlayRunContractSnapshot(input: {
|
|
|
61
61
|
artifactStorageKey: string;
|
|
62
62
|
artifact: Pick<PlayBundleArtifact, 'compatibility'>;
|
|
63
63
|
validatedSnapshot: PlayRunLaunchValidationSnapshot;
|
|
64
|
-
transportStaticPipeline?: unknown;
|
|
65
64
|
}): PreparedPlayRunContractSnapshot {
|
|
66
65
|
// The runtime backend is launch infrastructure, not an artifact contract.
|
|
67
66
|
// Copy the admitted artifact compatibility so resumed work cannot acquire
|
|
@@ -69,8 +68,7 @@ export function buildPlayRunContractSnapshot(input: {
|
|
|
69
68
|
const compatibility = normalizePlayContractCompatibility(
|
|
70
69
|
input.artifact.compatibility,
|
|
71
70
|
);
|
|
72
|
-
const staticPipeline =
|
|
73
|
-
input.transportStaticPipeline ?? input.validatedSnapshot.staticPipeline;
|
|
71
|
+
const staticPipeline = input.validatedSnapshot.staticPipeline;
|
|
74
72
|
return {
|
|
75
73
|
source: input.source ?? 'published',
|
|
76
74
|
revisionVersion: null,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// Full-table view basic filters. A tiny, deliberately closed predicate model
|
|
2
2
|
// that compiles mechanically to a parameterized SQL WHERE clause against a
|
|
3
|
-
// runtime sheet's physical
|
|
3
|
+
// runtime sheet's physical user-data columns.
|
|
4
4
|
//
|
|
5
5
|
// This is NOT free-text SQL: operators come from a closed enum, columns must
|
|
6
6
|
// be on a caller-supplied allowlist (the sheet's real columns), and every value
|
|
7
7
|
// is bound as a query parameter. Multiple filters AND together. No OR groups.
|
|
8
8
|
//
|
|
9
|
-
// Sheet user-data columns
|
|
10
|
-
//
|
|
11
|
-
// text; numeric comparisons cast that text to numeric.
|
|
9
|
+
// Sheet user-data columns may be native scalars or JSONB. Normalize each cell
|
|
10
|
+
// through to_jsonb before applying the shared scalar and numeric predicates.
|
|
12
11
|
|
|
13
12
|
// ── The operator set, and why it grew ────────────────────────────────────────
|
|
14
13
|
//
|
|
@@ -204,7 +203,7 @@ function coerceFilterNumber(value: unknown, index: number): number {
|
|
|
204
203
|
// → 19991, an object → its JSON text. The single-arg `#>> '{}'` path returns the
|
|
205
204
|
// whole value as text (Postgres jsonb → text).
|
|
206
205
|
function columnAsText(quotedColumn: string): string {
|
|
207
|
-
return `(${quotedColumn} #>> '{}')`;
|
|
206
|
+
return `(to_jsonb(${quotedColumn}) #>> '{}')`;
|
|
208
207
|
}
|
|
209
208
|
|
|
210
209
|
function quoteIdentifier(value: string): string {
|
|
@@ -302,9 +301,10 @@ export function compileSheetFilterWhere(input: {
|
|
|
302
301
|
const num = coerceFilterNumber(filter.value, index);
|
|
303
302
|
const sqlOp = NUMERIC_SQL_OPERATOR[filter.op];
|
|
304
303
|
// Guard the numeric cast to jsonb numbers only, so a stray non-numeric
|
|
305
|
-
// cell can never abort the whole query with a cast error.
|
|
304
|
+
// cell can never abort the whole query with a cast error. CASE also
|
|
305
|
+
// prevents PostgreSQL from reordering a numeric cast before its guard.
|
|
306
306
|
clauses.push(
|
|
307
|
-
`(jsonb_typeof(${quoted}) = 'number'
|
|
307
|
+
`((CASE WHEN jsonb_typeof(to_jsonb(${quoted})) = 'number' THEN ${asText}::numeric END) ${sqlOp} $${paramIdx})`,
|
|
308
308
|
);
|
|
309
309
|
params.push(num);
|
|
310
310
|
paramIdx += 1;
|
|
@@ -317,12 +317,8 @@ export function compileSheetFilterWhere(input: {
|
|
|
317
317
|
// range control means by it. The guard is the same one the scalar
|
|
318
318
|
// comparisons use: a non-numeric cell simply does not match, rather
|
|
319
319
|
// than aborting the query on a cast.
|
|
320
|
-
const body =
|
|
321
|
-
clauses.push(
|
|
322
|
-
`(jsonb_typeof(${quoted}) = 'number' AND ${
|
|
323
|
-
filter.op === 'between' ? body : `NOT (${body})`
|
|
324
|
-
})`,
|
|
325
|
-
);
|
|
320
|
+
const body = `(CASE WHEN jsonb_typeof(to_jsonb(${quoted})) = 'number' THEN ${asText}::numeric END) BETWEEN $${paramIdx} AND $${paramIdx + 1}`;
|
|
321
|
+
clauses.push(`(${filter.op === 'between' ? body : `NOT (${body})`})`);
|
|
326
322
|
params.push(min, max);
|
|
327
323
|
paramIdx += 2;
|
|
328
324
|
break;
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { normalizeTableNamespace } from './row-identity';
|
|
2
2
|
import { sqlSafePlayColumnName } from '../play-data-plane/column-names';
|
|
3
|
+
import type {
|
|
4
|
+
PlaySheetColumnSource,
|
|
5
|
+
PlaySheetColumnContract,
|
|
6
|
+
PlaySheetContract,
|
|
7
|
+
} from '../play-data-plane/contracts';
|
|
8
|
+
export type {
|
|
9
|
+
PlaySheetColumnSource,
|
|
10
|
+
PlaySheetColumnContract,
|
|
11
|
+
PlaySheetContract,
|
|
12
|
+
} from '../play-data-plane/contracts';
|
|
3
13
|
import type { PlayDocflow } from './docflow';
|
|
4
14
|
|
|
5
15
|
export { sqlSafePlayColumnName };
|
|
@@ -144,32 +154,6 @@ export function deriveStaticPipelineEntryInputFields(
|
|
|
144
154
|
: dedupeStaticFieldNames(pipeline.inputFields ?? []);
|
|
145
155
|
}
|
|
146
156
|
|
|
147
|
-
export type PlaySheetColumnSource =
|
|
148
|
-
| 'input'
|
|
149
|
-
| 'datasetColumn'
|
|
150
|
-
| 'waterfallStep'
|
|
151
|
-
| 'childPlayColumn';
|
|
152
|
-
|
|
153
|
-
export interface PlaySheetColumnContract {
|
|
154
|
-
id: string;
|
|
155
|
-
sqlName: string;
|
|
156
|
-
source: PlaySheetColumnSource;
|
|
157
|
-
field?: string;
|
|
158
|
-
parentField?: string;
|
|
159
|
-
playId?: string;
|
|
160
|
-
waterfallId?: string;
|
|
161
|
-
outputField?: string;
|
|
162
|
-
outputSqlName?: string;
|
|
163
|
-
stepId?: string;
|
|
164
|
-
toolId?: string;
|
|
165
|
-
isRowKey?: boolean;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export interface PlaySheetContract {
|
|
169
|
-
tableNamespace: string;
|
|
170
|
-
columns: PlaySheetColumnContract[];
|
|
171
|
-
}
|
|
172
|
-
|
|
173
157
|
export type PlayStaticColumnProducerKind =
|
|
174
158
|
| 'tool'
|
|
175
159
|
| 'waterfall'
|
|
@@ -339,13 +323,15 @@ function truncateStaticControlFlowBranchesForStorage(
|
|
|
339
323
|
maxEmbeddedPlayCallPipelineDepth: number;
|
|
340
324
|
maxStoredSubstepDepth: number;
|
|
341
325
|
storedSubstepDepth: number;
|
|
326
|
+
preserveAdditiveMetadata: boolean;
|
|
342
327
|
},
|
|
343
328
|
): PlayStaticControlFlowBranch[] | undefined {
|
|
344
329
|
if (!branches) return undefined;
|
|
345
330
|
return branches.map((branch) =>
|
|
346
331
|
omitUndefinedProperties({
|
|
347
|
-
|
|
348
|
-
|
|
332
|
+
...(input.preserveAdditiveMetadata
|
|
333
|
+
? branch
|
|
334
|
+
: { label: branch.label, condition: branch.condition }),
|
|
349
335
|
steps: truncateStaticSubstepsForStorage(
|
|
350
336
|
branch.steps,
|
|
351
337
|
nextStoredSubstepInput(input),
|
|
@@ -359,6 +345,7 @@ function nextStoredSubstepInput(input: {
|
|
|
359
345
|
maxEmbeddedPlayCallPipelineDepth: number;
|
|
360
346
|
maxStoredSubstepDepth: number;
|
|
361
347
|
storedSubstepDepth: number;
|
|
348
|
+
preserveAdditiveMetadata: boolean;
|
|
362
349
|
}) {
|
|
363
350
|
return {
|
|
364
351
|
...input,
|
|
@@ -392,6 +379,7 @@ function truncateStaticSubstepsForStorage(
|
|
|
392
379
|
maxEmbeddedPlayCallPipelineDepth: number;
|
|
393
380
|
maxStoredSubstepDepth: number;
|
|
394
381
|
storedSubstepDepth: number;
|
|
382
|
+
preserveAdditiveMetadata: boolean;
|
|
395
383
|
},
|
|
396
384
|
): PlayStaticSubstep[] {
|
|
397
385
|
return (substeps ?? []).map((substep) => {
|
|
@@ -431,6 +419,7 @@ function truncateStaticSubstepsForStorage(
|
|
|
431
419
|
input.embeddedPlayCallPipelineDepth + 1,
|
|
432
420
|
maxStoredSubstepDepth: input.maxStoredSubstepDepth,
|
|
433
421
|
storedSubstepDepth: input.storedSubstepDepth + 1,
|
|
422
|
+
preserveAdditiveMetadata: input.preserveAdditiveMetadata,
|
|
434
423
|
})
|
|
435
424
|
: nestedPipeline;
|
|
436
425
|
}
|
|
@@ -479,9 +468,9 @@ function truncateStaticSubstepsForStorage(
|
|
|
479
468
|
...base,
|
|
480
469
|
steps: base.steps?.map((step) =>
|
|
481
470
|
omitUndefinedProperties({
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
471
|
+
...(input.preserveAdditiveMetadata
|
|
472
|
+
? step
|
|
473
|
+
: { id: step.id, kind: step.kind, toolId: step.toolId }),
|
|
485
474
|
}),
|
|
486
475
|
),
|
|
487
476
|
});
|
|
@@ -551,6 +540,7 @@ function truncateStaticSubstepsForStorage(
|
|
|
551
540
|
embeddedPlayCallPipelineDepth: input.embeddedPlayCallPipelineDepth + 1,
|
|
552
541
|
maxStoredSubstepDepth: input.maxStoredSubstepDepth,
|
|
553
542
|
storedSubstepDepth: input.storedSubstepDepth + 1,
|
|
543
|
+
preserveAdditiveMetadata: input.preserveAdditiveMetadata,
|
|
554
544
|
}),
|
|
555
545
|
});
|
|
556
546
|
});
|
|
@@ -563,6 +553,8 @@ export function truncateStaticPipelineForStorage(
|
|
|
563
553
|
embeddedPlayCallPipelineDepth?: number;
|
|
564
554
|
maxStoredSubstepDepth?: number;
|
|
565
555
|
storedSubstepDepth?: number;
|
|
556
|
+
/** Keep retained additive metadata only in the full runtime contract. */
|
|
557
|
+
preserveAdditiveMetadata?: boolean;
|
|
566
558
|
} = {},
|
|
567
559
|
): PlayStaticPipeline | null | undefined {
|
|
568
560
|
if (!pipeline) {
|
|
@@ -576,6 +568,7 @@ export function truncateStaticPipelineForStorage(
|
|
|
576
568
|
const maxStoredSubstepDepth =
|
|
577
569
|
options.maxStoredSubstepDepth ?? DEFAULT_MAX_STORED_SUBSTEP_DEPTH;
|
|
578
570
|
const storedSubstepDepth = options.storedSubstepDepth ?? 0;
|
|
571
|
+
const preserveAdditiveMetadata = options.preserveAdditiveMetadata ?? false;
|
|
579
572
|
|
|
580
573
|
return stripUndefinedDeep(
|
|
581
574
|
omitUndefinedProperties({
|
|
@@ -593,12 +586,14 @@ export function truncateStaticPipelineForStorage(
|
|
|
593
586
|
maxEmbeddedPlayCallPipelineDepth,
|
|
594
587
|
maxStoredSubstepDepth,
|
|
595
588
|
storedSubstepDepth,
|
|
589
|
+
preserveAdditiveMetadata,
|
|
596
590
|
}),
|
|
597
591
|
substeps: truncateStaticSubstepsForStorage(pipeline.substeps, {
|
|
598
592
|
embeddedPlayCallPipelineDepth,
|
|
599
593
|
maxEmbeddedPlayCallPipelineDepth,
|
|
600
594
|
maxStoredSubstepDepth,
|
|
601
595
|
storedSubstepDepth,
|
|
596
|
+
preserveAdditiveMetadata,
|
|
602
597
|
}),
|
|
603
598
|
sheetContract: cloneStorageSafeSheetContract(pipeline.sheetContract),
|
|
604
599
|
sheetContractErrors: pipeline.sheetContractErrors
|
|
@@ -615,6 +610,8 @@ export function truncateStaticPipelineForRuntimeContract(
|
|
|
615
610
|
// Runtime admission must preserve every dataset contract. The caller's
|
|
616
611
|
// serialized artifact-size budget is the bound; a UI depth cap is not.
|
|
617
612
|
maxStoredSubstepDepth: Number.POSITIVE_INFINITY,
|
|
613
|
+
maxEmbeddedPlayCallPipelineDepth: Number.POSITIVE_INFINITY,
|
|
614
|
+
preserveAdditiveMetadata: true,
|
|
618
615
|
});
|
|
619
616
|
}
|
|
620
617
|
|
package/dist/cli/index.js
CHANGED
|
@@ -3051,7 +3051,7 @@ var SDK_RELEASE = {
|
|
|
3051
3051
|
// getters keep their established compatibility behavior.
|
|
3052
3052
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
3053
3053
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
3054
|
-
version: "0.3.
|
|
3054
|
+
version: "0.3.229",
|
|
3055
3055
|
updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
|
|
3056
3056
|
packageCapabilities: {
|
|
3057
3057
|
updatePreferences: 1
|
package/dist/cli/index.mjs
CHANGED
|
@@ -3046,7 +3046,7 @@ var SDK_RELEASE = {
|
|
|
3046
3046
|
// getters keep their established compatibility behavior.
|
|
3047
3047
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
3048
3048
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
3049
|
-
version: "0.3.
|
|
3049
|
+
version: "0.3.229",
|
|
3050
3050
|
updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
|
|
3051
3051
|
packageCapabilities: {
|
|
3052
3052
|
updatePreferences: 1
|
|
@@ -220,6 +220,33 @@ interface PlayR2FileRef {
|
|
|
220
220
|
}
|
|
221
221
|
type PlayExecutionFileRef = PlayR2FileRef;
|
|
222
222
|
|
|
223
|
+
/** Source evidence is advisory; stored values determine lossless SQL encoding. */
|
|
224
|
+
interface PlayDatasetColumnTypeEvidence {
|
|
225
|
+
postgresTypeId: number;
|
|
226
|
+
valueType: 'boolean' | 'number' | 'string' | 'json';
|
|
227
|
+
}
|
|
228
|
+
type PlayDatasetColumnTypes = Record<string, PlayDatasetColumnTypeEvidence>;
|
|
229
|
+
type PlaySheetColumnSource = 'input' | 'datasetColumn' | 'waterfallStep' | 'childPlayColumn';
|
|
230
|
+
interface PlaySheetColumnContract {
|
|
231
|
+
id: string;
|
|
232
|
+
sqlName: string;
|
|
233
|
+
source: PlaySheetColumnSource;
|
|
234
|
+
field?: string;
|
|
235
|
+
parentField?: string;
|
|
236
|
+
playId?: string;
|
|
237
|
+
waterfallId?: string;
|
|
238
|
+
outputField?: string;
|
|
239
|
+
outputSqlName?: string;
|
|
240
|
+
stepId?: string;
|
|
241
|
+
toolId?: string;
|
|
242
|
+
isRowKey?: boolean;
|
|
243
|
+
typeEvidence?: PlayDatasetColumnTypeEvidence;
|
|
244
|
+
}
|
|
245
|
+
interface PlaySheetContract {
|
|
246
|
+
tableNamespace: string;
|
|
247
|
+
columns: PlaySheetColumnContract[];
|
|
248
|
+
}
|
|
249
|
+
|
|
223
250
|
declare const PLAY_DATASET_BRAND: unique symbol;
|
|
224
251
|
type PlayDatasetKind = 'csv' | 'map';
|
|
225
252
|
type PlayDatasetBacking = {
|
|
@@ -265,8 +292,7 @@ type PlayDatasetTransformOptions = {
|
|
|
265
292
|
* `materialize(limit)` or async iteration only when the dataset is intentionally
|
|
266
293
|
* small and bounded. `PlayDataset` intentionally does not expose `.rows`,
|
|
267
294
|
* `.toArray()`, `.length`, numeric indexing, spread, or synchronous iteration;
|
|
268
|
-
*
|
|
269
|
-
* behavior depend on whether rows happen to be resident.
|
|
295
|
+
* these hide loading costs or make behavior depend on row residency.
|
|
270
296
|
*
|
|
271
297
|
* @sdkReference runtime 190
|
|
272
298
|
*/
|
|
@@ -282,6 +308,8 @@ interface PlayDataset<T> extends AsyncIterable<T> {
|
|
|
282
308
|
readonly sourceLabel?: string | null;
|
|
283
309
|
/** Runtime table name. */
|
|
284
310
|
readonly tableNamespace?: string | null;
|
|
311
|
+
/** Advisory source types; transformed fields must infer from their values. */
|
|
312
|
+
readonly columnTypes?: PlayDatasetColumnTypes;
|
|
285
313
|
/** Row count. */
|
|
286
314
|
count(): Promise<number>;
|
|
287
315
|
/** Preview rows. */
|
|
@@ -309,6 +337,7 @@ interface PlayDataset<T> extends AsyncIterable<T> {
|
|
|
309
337
|
sourceLabel?: string | null;
|
|
310
338
|
tableNamespace?: string | null;
|
|
311
339
|
columns?: string[];
|
|
340
|
+
columnTypes?: PlayDatasetColumnTypes;
|
|
312
341
|
_metadata?: {
|
|
313
342
|
workProgress?: PlayDatasetWorkProgressSummary;
|
|
314
343
|
};
|
|
@@ -2983,25 +3012,6 @@ interface PlayStaticPipeline {
|
|
|
2983
3012
|
sheetContract?: PlaySheetContract | null;
|
|
2984
3013
|
sheetContractErrors?: string[];
|
|
2985
3014
|
}
|
|
2986
|
-
type PlaySheetColumnSource = 'input' | 'datasetColumn' | 'waterfallStep' | 'childPlayColumn';
|
|
2987
|
-
interface PlaySheetColumnContract {
|
|
2988
|
-
id: string;
|
|
2989
|
-
sqlName: string;
|
|
2990
|
-
source: PlaySheetColumnSource;
|
|
2991
|
-
field?: string;
|
|
2992
|
-
parentField?: string;
|
|
2993
|
-
playId?: string;
|
|
2994
|
-
waterfallId?: string;
|
|
2995
|
-
outputField?: string;
|
|
2996
|
-
outputSqlName?: string;
|
|
2997
|
-
stepId?: string;
|
|
2998
|
-
toolId?: string;
|
|
2999
|
-
isRowKey?: boolean;
|
|
3000
|
-
}
|
|
3001
|
-
interface PlaySheetContract {
|
|
3002
|
-
tableNamespace: string;
|
|
3003
|
-
columns: PlaySheetColumnContract[];
|
|
3004
|
-
}
|
|
3005
3015
|
type PlayStaticColumnProducerKind = 'tool' | 'waterfall' | 'stepProgram' | 'playCall' | 'controlFlow' | 'transform';
|
|
3006
3016
|
interface PlayStaticColumnProducer {
|
|
3007
3017
|
id: string;
|