deepline 0.1.70 → 0.1.71

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.d.mts CHANGED
@@ -19,14 +19,14 @@ interface PlayStaticPipelineSnapshot {
19
19
  csvArg?: string;
20
20
  hasInlineData?: boolean;
21
21
  csvDescription?: string;
22
- mapDescription?: string;
22
+ datasetDescription?: string;
23
23
  fields: string[];
24
24
  stages?: PlayStaticSubstepSnapshot[];
25
25
  substeps: PlayStaticSubstepSnapshot[];
26
26
  sheetContract?: PlaySheetContractSnapshot | null;
27
27
  sheetContractErrors?: string[];
28
28
  }
29
- type PlaySheetColumnSourceSnapshot = 'input' | 'mapField' | 'waterfallStep' | 'childPlayColumn';
29
+ type PlaySheetColumnSourceSnapshot = 'input' | 'datasetColumn' | 'waterfallStep' | 'childPlayColumn';
30
30
  interface PlaySheetColumnContractSnapshot {
31
31
  id: string;
32
32
  sqlName: string;
@@ -63,7 +63,7 @@ type PlayStaticSubstepSnapshot = PlayStaticSubstepMetadataSnapshot & ({
63
63
  callDepth?: number;
64
64
  callPath?: string[];
65
65
  } | {
66
- type: 'map';
66
+ type: 'dataset';
67
67
  field: string;
68
68
  name?: string;
69
69
  tableNamespace?: string;
@@ -827,7 +827,7 @@ interface PlayDetail {
827
827
  deltaCursor: number;
828
828
  }
829
829
  interface ClearPlayHistoryRequest {
830
- /** Optional explicit ctx.map keys to clear. Omit to clear all discovered sheets for the play. */
830
+ /** Optional explicit ctx.dataset keys to clear. Omit to clear all discovered sheets for the play. */
831
831
  tableNamespaces?: string[];
832
832
  }
833
833
  interface ClearPlayHistoryResult {
@@ -1900,13 +1900,13 @@ type PlayDatasetTransformOptions = {
1900
1900
  sourceLabel?: string | null;
1901
1901
  };
1902
1902
  /**
1903
- * Durable handle for rows produced by `ctx.csv(...)` or `ctx.map(...).run()`.
1903
+ * Durable handle for rows produced by `ctx.csv(...)` or `ctx.dataset(...).run()`.
1904
1904
  *
1905
1905
  * A `PlayDataset` is not a normal in-memory array. It points at runtime-managed
1906
1906
  * rows, usually backed by persisted sheet storage, and carries metadata such as
1907
1907
  * dataset kind, dataset id, table namespace, count, and preview rows.
1908
1908
  *
1909
- * Pass dataset handles directly into later `ctx.map(...)` stages by default so
1909
+ * Pass dataset handles directly into later `ctx.dataset(...)` stages by default so
1910
1910
  * Deepline keeps row progress, retries, memory use, and table output under
1911
1911
  * runtime control. Use `count()` and `peek()` for bounded inspection. Use
1912
1912
  * `materialize(limit)` or async iteration only when the dataset is intentionally
@@ -2161,27 +2161,29 @@ type PlayStepProgramStep = {
2161
2161
  readonly name: string;
2162
2162
  readonly resolver: StepResolver<Record<string, unknown>, unknown> | ConditionalStepResolver<Record<string, unknown>, unknown> | StepProgramResolver<Record<string, unknown>, unknown>;
2163
2163
  };
2164
- type MapStepResolver<Row, Value> = StepResolver<Row, Value> | ConditionalStepResolver<Row, Value> | StepProgramResolver<Row, Value>;
2165
- type MapStepBuilder<InputRow extends object, OutputRow extends object> = {
2164
+ type ColumnResolver<Row, Value> = StepResolver<Row, Value> | ConditionalStepResolver<Row, Value> | StepProgramResolver<Row, Value>;
2165
+ type DatasetBuilder<InputRow extends object, OutputRow extends object> = {
2166
2166
  /**
2167
- * Define one output column for every row in this map dataset.
2167
+ * Define one output column for every row in this dataset.
2168
2168
  *
2169
2169
  * The `name` becomes a field on each output row. For example,
2170
- * `.step('contact', ...)` creates `row.contact` in later map stages; it does
2170
+ * `.withColumn('contact', ...)` creates `row.contact` in later column resolvers; it does
2171
2171
  * not spread returned object fields such as `contact.email` into `row.email`.
2172
2172
  * Add a later column resolver when you want a top-level export field:
2173
- * `.step('email', row => row.contact?.email ?? null)`.
2173
+ * `.withColumn('email', row => row.contact?.email ?? null)`.
2174
2174
  *
2175
2175
  * @param name - Output column name.
2176
2176
  * @param resolver - Computes the value for one row.
2177
- * @returns The same map builder with the new column type.
2177
+ * @returns The same dataset builder with the new column type.
2178
2178
  */
2179
- step<Name extends string, Value>(name: Name, resolver: MapStepResolver<OutputRow, Value>): MapStepBuilder<InputRow, OutputRow & Record<Name, Value>>;
2179
+ withColumn<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;
2180
+ /** @deprecated Dataset `.step(...)` was replaced by `.withColumn(...)`. */
2181
+ step<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): never;
2180
2182
  /**
2181
2183
  * Execute the row-column program and return a durable dataset handle.
2182
2184
  *
2183
2185
  * The returned {@link PlayDataset} preserves one output row per input row,
2184
- * with original fields merged with the columns produced by `.step(...)`.
2186
+ * with original fields merged with the columns produced by `.withColumn(...)`.
2185
2187
  *
2186
2188
  * @param options - Run options.
2187
2189
  * @returns Output rows as a dataset handle.
@@ -2240,10 +2242,10 @@ type CsvOptions = {
2240
2242
  * description: 'Look up company details by domain.',
2241
2243
  * });
2242
2244
  *
2243
- * // Fan-out: process items with named steps
2245
+ * // Fan-out: process items with named columns
2244
2246
  * const enriched = await ctx
2245
- * .map('companies', [{ domain: 'a.com' }, { domain: 'b.com' }])
2246
- * .step('company', (row, rowCtx) =>
2247
+ * .dataset('companies', [{ domain: 'a.com' }, { domain: 'b.com' }])
2248
+ * .withColumn('company', (row, rowCtx) =>
2247
2249
  * rowCtx.tools.execute({
2248
2250
  * id: 'company_search',
2249
2251
  * tool: 'test_company_search',
@@ -2273,7 +2275,7 @@ interface DeeplinePlayRuntimeContext {
2273
2275
  * Load a staged CSV file as a durable dataset handle.
2274
2276
  *
2275
2277
  * Use this when a play receives a CSV path from the CLI or API and row work
2276
- * should continue through {@link DeeplinePlayRuntimeContext.map}. The path is
2278
+ * should continue through {@link DeeplinePlayRuntimeContext.dataset}. The path is
2277
2279
  * normally an input field such as `input.csv`, populated by
2278
2280
  * `deepline plays run my.play.ts --csv rows.csv`.
2279
2281
  *
@@ -2285,15 +2287,15 @@ interface DeeplinePlayRuntimeContext {
2285
2287
  * @param path - Staged CSV path.
2286
2288
  * @param options - CSV load options.
2287
2289
  *
2288
- * @returns A {@link PlayDataset} whose rows should usually flow directly into `ctx.map(...)`.
2290
+ * @returns A {@link PlayDataset} whose rows should usually flow directly into `ctx.dataset(...)`.
2289
2291
  */
2290
2292
  csv<T = Record<string, unknown>>(path: string, options?: CsvOptions): Promise<PlayDataset<T>>;
2291
2293
  /**
2292
2294
  * Create a persisted row dataset/table from input rows.
2293
2295
  *
2294
- * `ctx.map` is Deepline's row-work primitive. It records row identity,
2296
+ * `ctx.dataset` is Deepline's row-work primitive. It records row identity,
2295
2297
  * progress, retries, table output, and idempotency for a collection of rows.
2296
- * Use `.step(name, resolver)` on the returned builder to define output
2298
+ * Use `.withColumn(name, resolver)` on the returned builder to define output
2297
2299
  * columns, then `.run(...)` to execute the row program.
2298
2300
  *
2299
2301
  * The `key` identifies the logical dataset/table. Renaming it is a persistence
@@ -2301,10 +2303,10 @@ interface DeeplinePlayRuntimeContext {
2301
2303
  * automatically from input row content unless `.run({ key: ... })` overrides
2302
2304
  * it with stable business fields such as `domain`, `email`, or `linkedin_url`.
2303
2305
  *
2304
- * By default, `ctx.map` is row-preserving: one input row produces one output
2306
+ * By default, `ctx.dataset` is row-preserving: one input row produces one output
2305
2307
  * row, with original fields merged with the columns produced by
2306
- * `.step(...)`. If one input entity must become many output rows, use the
2307
- * documented expand/flatten recipe instead of assuming `ctx.map` changes
2308
+ * `.withColumn(...)`. If one input entity must become many output rows, use the
2309
+ * documented expand/flatten recipe instead of assuming `ctx.dataset` changes
2308
2310
  * row cardinality.
2309
2311
  *
2310
2312
  * @typeParam T - Row type
@@ -2315,8 +2317,8 @@ interface DeeplinePlayRuntimeContext {
2315
2317
  * @example Single tool per row
2316
2318
  * ```typescript
2317
2319
  * const results = await ctx
2318
- * .map('companies', leads)
2319
- * .step('company', (row, ctx) =>
2320
+ * .dataset('companies', leads)
2321
+ * .withColumn('company', (row, ctx) =>
2320
2322
  * ctx.tools.execute({
2321
2323
  * id: 'company_search',
2322
2324
  * tool: 'test_company_search',
@@ -2330,20 +2332,24 @@ interface DeeplinePlayRuntimeContext {
2330
2332
  * @example Multiple columns with pre/post logic
2331
2333
  * ```typescript
2332
2334
  * const results = await ctx
2333
- * .map('leads', leads)
2334
- * .step('company', (row, ctx) =>
2335
+ * .dataset('leads', leads)
2336
+ * .withColumn('company', (row, ctx) =>
2335
2337
  * ctx.tools.execute({
2336
2338
  * id: 'company_search',
2337
2339
  * tool: 'test_company_search',
2338
2340
  * input: { domain: row.domain },
2339
2341
  * description: 'Look up company details by domain.',
2340
2342
  * }))
2341
- * .step('score', (row) =>
2343
+ * .withColumn('score', (row) =>
2342
2344
  * row.company?.employeeCount > 100 ? 'enterprise' : 'smb')
2343
2345
  * .run({ description: 'Enrich leads.' });
2344
2346
  * ```
2345
2347
  */
2346
- map<TItem extends object>(key: string, items: PlayDatasetInput<TItem>): MapStepBuilder<TItem, TItem>;
2348
+ dataset<TItem extends object>(key: string, items: PlayDatasetInput<TItem>): DatasetBuilder<TItem, TItem>;
2349
+ /**
2350
+ * @deprecated `ctx.map(...)` was replaced by `ctx.dataset(...)`.
2351
+ */
2352
+ map<TItem extends object>(key: string, items: PlayDatasetInput<TItem>): never;
2347
2353
  /** Tool execution namespace. */
2348
2354
  tools: {
2349
2355
  /**
@@ -2370,8 +2376,8 @@ interface DeeplinePlayRuntimeContext {
2370
2376
  *
2371
2377
  * `steps().step(...)` is a composable mini-pipeline. Use `ctx.runSteps(...)`
2372
2378
  * when that mini-pipeline should execute outside a row dataset. Inside a
2373
- * `ctx.map` column resolver, pass the step program directly to
2374
- * `.step(name, program)` instead.
2379
+ * `ctx.dataset` column resolver, pass the step program directly to
2380
+ * `.withColumn(name, program)` instead.
2375
2381
  *
2376
2382
  * @param program - Step program.
2377
2383
  * @param input - Program input.
@@ -2390,7 +2396,7 @@ interface DeeplinePlayRuntimeContext {
2390
2396
  * value instead of running `run` again.
2391
2397
  *
2392
2398
  * Plain deterministic assignment does not need `ctx.step`. Use
2393
- * `ctx.map(...).step(...)`, not `ctx.step`, when the value should become a
2399
+ * `ctx.dataset(...).withColumn(...)`, not `ctx.step`, when the value should become a
2394
2400
  * field on each exported row.
2395
2401
  *
2396
2402
  * @param id - Checkpoint id.
@@ -2425,6 +2431,22 @@ interface DeeplinePlayRuntimeContext {
2425
2431
  bodyText: string;
2426
2432
  json: unknown | null;
2427
2433
  }>;
2434
+ /**
2435
+ * Invoke another registered or file-backed play as a child workflow.
2436
+ *
2437
+ * Use this for real composition boundaries, especially when a fitting
2438
+ * scalar prebuilt play already encodes provider order, fallbacks,
2439
+ * normalization, and no-result behavior. Do not invoke plays through
2440
+ * `ctx.tools.execute`; tools and plays are separate namespaces.
2441
+ *
2442
+ * `key` is the stable child-call identity for idempotency and traceability.
2443
+ *
2444
+ * @param key - Stable child-call key.
2445
+ * @param playRef - Registered play name, play handle, or file-backed play reference.
2446
+ * @param input - Input object passed to the child play.
2447
+ * @param options - Child play options.
2448
+ * @returns Child play output.
2449
+ */
2428
2450
  secrets: {
2429
2451
  get(name: string): SecretHandle;
2430
2452
  bearer(secret: SecretHandle): SecretAuth;
@@ -2635,7 +2657,8 @@ type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = {
2635
2657
  billing?: PlayBindings['billing'];
2636
2658
  };
2637
2659
  declare function steps<TInput>(): StepProgram<TInput, TInput, TInput>;
2638
- declare function when<Row, Value>(predicate: (row: Row, index: number) => boolean | Promise<boolean>, resolver: StepResolver<Row, Value>): ConditionalStepResolver<Row, Value, null>;
2660
+ declare function when<Row, Value>(predicate: (row: Row, index: number) => boolean | Promise<boolean>, resolver: StepResolver<Row, Value>): never;
2661
+ declare function runIf<Row, Value>(predicate: (row: Row, index: number) => boolean | Promise<boolean>, resolver: StepResolver<Row, Value>): ConditionalStepResolver<Row, Value, null>;
2639
2662
  /**
2640
2663
  * A defined play: both a callable function and a named play handle.
2641
2664
  *
@@ -2824,8 +2847,8 @@ declare function defineInput<TInput>(schema: Record<string, unknown>): PlayInput
2824
2847
  * const leads = await ctx.csv(input.csv);
2825
2848
  * ctx.log(`Processing ${await leads.count()} rows`);
2826
2849
  * const results = await ctx
2827
- * .map('companies', leads)
2828
- * .step('company', (row, ctx) =>
2850
+ * .dataset('companies', leads)
2851
+ * .withColumn('company', (row, ctx) =>
2829
2852
  * ctx.tools.execute({
2830
2853
  * id: 'company_search',
2831
2854
  * tool: 'test_company_search',
@@ -3047,4 +3070,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
3047
3070
  */
3048
3071
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
3049
3072
 
3050
- export { AuthError, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ConditionalStepResolver, ConfigError, type CsvInput, DEEPLINE_TOOL_CATEGORIES, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, DeeplineError, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplineToolCategory, type DefinePlayConfig, type DefinedPlay, type FileInput, type LiveEventEnvelope, type MapStepBuilder, type MapStepResolver, 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 PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunResult, type PlayRunStart, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, SDK_API_CONTRACT, SDK_VERSION, type StartPlayRunRequest, type StepProgram, type StepProgramResolver, type StepResolver, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolMetadata, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, steps, tryConvertToList, when, writeCsvOutputFile, writeJsonOutputFile };
3073
+ export { AuthError, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, DeeplineError, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplineToolCategory, type DefinePlayConfig, type DefinedPlay, type FileInput, type LiveEventEnvelope, 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 PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunResult, type PlayRunStart, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, SDK_API_CONTRACT, SDK_VERSION, type StartPlayRunRequest, type StepProgram, type StepProgramResolver, type StepResolver, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolMetadata, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, when, writeCsvOutputFile, writeJsonOutputFile };
package/dist/index.d.ts CHANGED
@@ -19,14 +19,14 @@ interface PlayStaticPipelineSnapshot {
19
19
  csvArg?: string;
20
20
  hasInlineData?: boolean;
21
21
  csvDescription?: string;
22
- mapDescription?: string;
22
+ datasetDescription?: string;
23
23
  fields: string[];
24
24
  stages?: PlayStaticSubstepSnapshot[];
25
25
  substeps: PlayStaticSubstepSnapshot[];
26
26
  sheetContract?: PlaySheetContractSnapshot | null;
27
27
  sheetContractErrors?: string[];
28
28
  }
29
- type PlaySheetColumnSourceSnapshot = 'input' | 'mapField' | 'waterfallStep' | 'childPlayColumn';
29
+ type PlaySheetColumnSourceSnapshot = 'input' | 'datasetColumn' | 'waterfallStep' | 'childPlayColumn';
30
30
  interface PlaySheetColumnContractSnapshot {
31
31
  id: string;
32
32
  sqlName: string;
@@ -63,7 +63,7 @@ type PlayStaticSubstepSnapshot = PlayStaticSubstepMetadataSnapshot & ({
63
63
  callDepth?: number;
64
64
  callPath?: string[];
65
65
  } | {
66
- type: 'map';
66
+ type: 'dataset';
67
67
  field: string;
68
68
  name?: string;
69
69
  tableNamespace?: string;
@@ -827,7 +827,7 @@ interface PlayDetail {
827
827
  deltaCursor: number;
828
828
  }
829
829
  interface ClearPlayHistoryRequest {
830
- /** Optional explicit ctx.map keys to clear. Omit to clear all discovered sheets for the play. */
830
+ /** Optional explicit ctx.dataset keys to clear. Omit to clear all discovered sheets for the play. */
831
831
  tableNamespaces?: string[];
832
832
  }
833
833
  interface ClearPlayHistoryResult {
@@ -1900,13 +1900,13 @@ type PlayDatasetTransformOptions = {
1900
1900
  sourceLabel?: string | null;
1901
1901
  };
1902
1902
  /**
1903
- * Durable handle for rows produced by `ctx.csv(...)` or `ctx.map(...).run()`.
1903
+ * Durable handle for rows produced by `ctx.csv(...)` or `ctx.dataset(...).run()`.
1904
1904
  *
1905
1905
  * A `PlayDataset` is not a normal in-memory array. It points at runtime-managed
1906
1906
  * rows, usually backed by persisted sheet storage, and carries metadata such as
1907
1907
  * dataset kind, dataset id, table namespace, count, and preview rows.
1908
1908
  *
1909
- * Pass dataset handles directly into later `ctx.map(...)` stages by default so
1909
+ * Pass dataset handles directly into later `ctx.dataset(...)` stages by default so
1910
1910
  * Deepline keeps row progress, retries, memory use, and table output under
1911
1911
  * runtime control. Use `count()` and `peek()` for bounded inspection. Use
1912
1912
  * `materialize(limit)` or async iteration only when the dataset is intentionally
@@ -2161,27 +2161,29 @@ type PlayStepProgramStep = {
2161
2161
  readonly name: string;
2162
2162
  readonly resolver: StepResolver<Record<string, unknown>, unknown> | ConditionalStepResolver<Record<string, unknown>, unknown> | StepProgramResolver<Record<string, unknown>, unknown>;
2163
2163
  };
2164
- type MapStepResolver<Row, Value> = StepResolver<Row, Value> | ConditionalStepResolver<Row, Value> | StepProgramResolver<Row, Value>;
2165
- type MapStepBuilder<InputRow extends object, OutputRow extends object> = {
2164
+ type ColumnResolver<Row, Value> = StepResolver<Row, Value> | ConditionalStepResolver<Row, Value> | StepProgramResolver<Row, Value>;
2165
+ type DatasetBuilder<InputRow extends object, OutputRow extends object> = {
2166
2166
  /**
2167
- * Define one output column for every row in this map dataset.
2167
+ * Define one output column for every row in this dataset.
2168
2168
  *
2169
2169
  * The `name` becomes a field on each output row. For example,
2170
- * `.step('contact', ...)` creates `row.contact` in later map stages; it does
2170
+ * `.withColumn('contact', ...)` creates `row.contact` in later column resolvers; it does
2171
2171
  * not spread returned object fields such as `contact.email` into `row.email`.
2172
2172
  * Add a later column resolver when you want a top-level export field:
2173
- * `.step('email', row => row.contact?.email ?? null)`.
2173
+ * `.withColumn('email', row => row.contact?.email ?? null)`.
2174
2174
  *
2175
2175
  * @param name - Output column name.
2176
2176
  * @param resolver - Computes the value for one row.
2177
- * @returns The same map builder with the new column type.
2177
+ * @returns The same dataset builder with the new column type.
2178
2178
  */
2179
- step<Name extends string, Value>(name: Name, resolver: MapStepResolver<OutputRow, Value>): MapStepBuilder<InputRow, OutputRow & Record<Name, Value>>;
2179
+ withColumn<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;
2180
+ /** @deprecated Dataset `.step(...)` was replaced by `.withColumn(...)`. */
2181
+ step<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): never;
2180
2182
  /**
2181
2183
  * Execute the row-column program and return a durable dataset handle.
2182
2184
  *
2183
2185
  * The returned {@link PlayDataset} preserves one output row per input row,
2184
- * with original fields merged with the columns produced by `.step(...)`.
2186
+ * with original fields merged with the columns produced by `.withColumn(...)`.
2185
2187
  *
2186
2188
  * @param options - Run options.
2187
2189
  * @returns Output rows as a dataset handle.
@@ -2240,10 +2242,10 @@ type CsvOptions = {
2240
2242
  * description: 'Look up company details by domain.',
2241
2243
  * });
2242
2244
  *
2243
- * // Fan-out: process items with named steps
2245
+ * // Fan-out: process items with named columns
2244
2246
  * const enriched = await ctx
2245
- * .map('companies', [{ domain: 'a.com' }, { domain: 'b.com' }])
2246
- * .step('company', (row, rowCtx) =>
2247
+ * .dataset('companies', [{ domain: 'a.com' }, { domain: 'b.com' }])
2248
+ * .withColumn('company', (row, rowCtx) =>
2247
2249
  * rowCtx.tools.execute({
2248
2250
  * id: 'company_search',
2249
2251
  * tool: 'test_company_search',
@@ -2273,7 +2275,7 @@ interface DeeplinePlayRuntimeContext {
2273
2275
  * Load a staged CSV file as a durable dataset handle.
2274
2276
  *
2275
2277
  * Use this when a play receives a CSV path from the CLI or API and row work
2276
- * should continue through {@link DeeplinePlayRuntimeContext.map}. The path is
2278
+ * should continue through {@link DeeplinePlayRuntimeContext.dataset}. The path is
2277
2279
  * normally an input field such as `input.csv`, populated by
2278
2280
  * `deepline plays run my.play.ts --csv rows.csv`.
2279
2281
  *
@@ -2285,15 +2287,15 @@ interface DeeplinePlayRuntimeContext {
2285
2287
  * @param path - Staged CSV path.
2286
2288
  * @param options - CSV load options.
2287
2289
  *
2288
- * @returns A {@link PlayDataset} whose rows should usually flow directly into `ctx.map(...)`.
2290
+ * @returns A {@link PlayDataset} whose rows should usually flow directly into `ctx.dataset(...)`.
2289
2291
  */
2290
2292
  csv<T = Record<string, unknown>>(path: string, options?: CsvOptions): Promise<PlayDataset<T>>;
2291
2293
  /**
2292
2294
  * Create a persisted row dataset/table from input rows.
2293
2295
  *
2294
- * `ctx.map` is Deepline's row-work primitive. It records row identity,
2296
+ * `ctx.dataset` is Deepline's row-work primitive. It records row identity,
2295
2297
  * progress, retries, table output, and idempotency for a collection of rows.
2296
- * Use `.step(name, resolver)` on the returned builder to define output
2298
+ * Use `.withColumn(name, resolver)` on the returned builder to define output
2297
2299
  * columns, then `.run(...)` to execute the row program.
2298
2300
  *
2299
2301
  * The `key` identifies the logical dataset/table. Renaming it is a persistence
@@ -2301,10 +2303,10 @@ interface DeeplinePlayRuntimeContext {
2301
2303
  * automatically from input row content unless `.run({ key: ... })` overrides
2302
2304
  * it with stable business fields such as `domain`, `email`, or `linkedin_url`.
2303
2305
  *
2304
- * By default, `ctx.map` is row-preserving: one input row produces one output
2306
+ * By default, `ctx.dataset` is row-preserving: one input row produces one output
2305
2307
  * row, with original fields merged with the columns produced by
2306
- * `.step(...)`. If one input entity must become many output rows, use the
2307
- * documented expand/flatten recipe instead of assuming `ctx.map` changes
2308
+ * `.withColumn(...)`. If one input entity must become many output rows, use the
2309
+ * documented expand/flatten recipe instead of assuming `ctx.dataset` changes
2308
2310
  * row cardinality.
2309
2311
  *
2310
2312
  * @typeParam T - Row type
@@ -2315,8 +2317,8 @@ interface DeeplinePlayRuntimeContext {
2315
2317
  * @example Single tool per row
2316
2318
  * ```typescript
2317
2319
  * const results = await ctx
2318
- * .map('companies', leads)
2319
- * .step('company', (row, ctx) =>
2320
+ * .dataset('companies', leads)
2321
+ * .withColumn('company', (row, ctx) =>
2320
2322
  * ctx.tools.execute({
2321
2323
  * id: 'company_search',
2322
2324
  * tool: 'test_company_search',
@@ -2330,20 +2332,24 @@ interface DeeplinePlayRuntimeContext {
2330
2332
  * @example Multiple columns with pre/post logic
2331
2333
  * ```typescript
2332
2334
  * const results = await ctx
2333
- * .map('leads', leads)
2334
- * .step('company', (row, ctx) =>
2335
+ * .dataset('leads', leads)
2336
+ * .withColumn('company', (row, ctx) =>
2335
2337
  * ctx.tools.execute({
2336
2338
  * id: 'company_search',
2337
2339
  * tool: 'test_company_search',
2338
2340
  * input: { domain: row.domain },
2339
2341
  * description: 'Look up company details by domain.',
2340
2342
  * }))
2341
- * .step('score', (row) =>
2343
+ * .withColumn('score', (row) =>
2342
2344
  * row.company?.employeeCount > 100 ? 'enterprise' : 'smb')
2343
2345
  * .run({ description: 'Enrich leads.' });
2344
2346
  * ```
2345
2347
  */
2346
- map<TItem extends object>(key: string, items: PlayDatasetInput<TItem>): MapStepBuilder<TItem, TItem>;
2348
+ dataset<TItem extends object>(key: string, items: PlayDatasetInput<TItem>): DatasetBuilder<TItem, TItem>;
2349
+ /**
2350
+ * @deprecated `ctx.map(...)` was replaced by `ctx.dataset(...)`.
2351
+ */
2352
+ map<TItem extends object>(key: string, items: PlayDatasetInput<TItem>): never;
2347
2353
  /** Tool execution namespace. */
2348
2354
  tools: {
2349
2355
  /**
@@ -2370,8 +2376,8 @@ interface DeeplinePlayRuntimeContext {
2370
2376
  *
2371
2377
  * `steps().step(...)` is a composable mini-pipeline. Use `ctx.runSteps(...)`
2372
2378
  * when that mini-pipeline should execute outside a row dataset. Inside a
2373
- * `ctx.map` column resolver, pass the step program directly to
2374
- * `.step(name, program)` instead.
2379
+ * `ctx.dataset` column resolver, pass the step program directly to
2380
+ * `.withColumn(name, program)` instead.
2375
2381
  *
2376
2382
  * @param program - Step program.
2377
2383
  * @param input - Program input.
@@ -2390,7 +2396,7 @@ interface DeeplinePlayRuntimeContext {
2390
2396
  * value instead of running `run` again.
2391
2397
  *
2392
2398
  * Plain deterministic assignment does not need `ctx.step`. Use
2393
- * `ctx.map(...).step(...)`, not `ctx.step`, when the value should become a
2399
+ * `ctx.dataset(...).withColumn(...)`, not `ctx.step`, when the value should become a
2394
2400
  * field on each exported row.
2395
2401
  *
2396
2402
  * @param id - Checkpoint id.
@@ -2425,6 +2431,22 @@ interface DeeplinePlayRuntimeContext {
2425
2431
  bodyText: string;
2426
2432
  json: unknown | null;
2427
2433
  }>;
2434
+ /**
2435
+ * Invoke another registered or file-backed play as a child workflow.
2436
+ *
2437
+ * Use this for real composition boundaries, especially when a fitting
2438
+ * scalar prebuilt play already encodes provider order, fallbacks,
2439
+ * normalization, and no-result behavior. Do not invoke plays through
2440
+ * `ctx.tools.execute`; tools and plays are separate namespaces.
2441
+ *
2442
+ * `key` is the stable child-call identity for idempotency and traceability.
2443
+ *
2444
+ * @param key - Stable child-call key.
2445
+ * @param playRef - Registered play name, play handle, or file-backed play reference.
2446
+ * @param input - Input object passed to the child play.
2447
+ * @param options - Child play options.
2448
+ * @returns Child play output.
2449
+ */
2428
2450
  secrets: {
2429
2451
  get(name: string): SecretHandle;
2430
2452
  bearer(secret: SecretHandle): SecretAuth;
@@ -2635,7 +2657,8 @@ type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = {
2635
2657
  billing?: PlayBindings['billing'];
2636
2658
  };
2637
2659
  declare function steps<TInput>(): StepProgram<TInput, TInput, TInput>;
2638
- declare function when<Row, Value>(predicate: (row: Row, index: number) => boolean | Promise<boolean>, resolver: StepResolver<Row, Value>): ConditionalStepResolver<Row, Value, null>;
2660
+ declare function when<Row, Value>(predicate: (row: Row, index: number) => boolean | Promise<boolean>, resolver: StepResolver<Row, Value>): never;
2661
+ declare function runIf<Row, Value>(predicate: (row: Row, index: number) => boolean | Promise<boolean>, resolver: StepResolver<Row, Value>): ConditionalStepResolver<Row, Value, null>;
2639
2662
  /**
2640
2663
  * A defined play: both a callable function and a named play handle.
2641
2664
  *
@@ -2824,8 +2847,8 @@ declare function defineInput<TInput>(schema: Record<string, unknown>): PlayInput
2824
2847
  * const leads = await ctx.csv(input.csv);
2825
2848
  * ctx.log(`Processing ${await leads.count()} rows`);
2826
2849
  * const results = await ctx
2827
- * .map('companies', leads)
2828
- * .step('company', (row, ctx) =>
2850
+ * .dataset('companies', leads)
2851
+ * .withColumn('company', (row, ctx) =>
2829
2852
  * ctx.tools.execute({
2830
2853
  * id: 'company_search',
2831
2854
  * tool: 'test_company_search',
@@ -3047,4 +3070,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
3047
3070
  */
3048
3071
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
3049
3072
 
3050
- export { AuthError, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ConditionalStepResolver, ConfigError, type CsvInput, DEEPLINE_TOOL_CATEGORIES, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, DeeplineError, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplineToolCategory, type DefinePlayConfig, type DefinedPlay, type FileInput, type LiveEventEnvelope, type MapStepBuilder, type MapStepResolver, 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 PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunResult, type PlayRunStart, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, SDK_API_CONTRACT, SDK_VERSION, type StartPlayRunRequest, type StepProgram, type StepProgramResolver, type StepResolver, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolMetadata, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, steps, tryConvertToList, when, writeCsvOutputFile, writeJsonOutputFile };
3073
+ export { AuthError, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, DeeplineError, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplineToolCategory, type DefinePlayConfig, type DefinedPlay, type FileInput, type LiveEventEnvelope, 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 PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunResult, type PlayRunStart, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, SDK_API_CONTRACT, SDK_VERSION, type StartPlayRunRequest, type StepProgram, type StepProgramResolver, type StepResolver, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolMetadata, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, when, writeCsvOutputFile, writeJsonOutputFile };
package/dist/index.js CHANGED
@@ -52,6 +52,7 @@ __export(src_exports, {
52
52
  isPlayBootstrapFinderKind: () => isPlayBootstrapFinderKind,
53
53
  isPlayBootstrapTemplate: () => isPlayBootstrapTemplate,
54
54
  resolveConfig: () => resolveConfig,
55
+ runIf: () => runIf,
55
56
  steps: () => steps,
56
57
  tryConvertToList: () => tryConvertToList,
57
58
  when: () => when,
@@ -241,10 +242,10 @@ var import_node_path2 = require("path");
241
242
 
242
243
  // src/release.ts
243
244
  var SDK_RELEASE = {
244
- version: "0.1.70",
245
- apiContract: "2026-05-play-bootstrap-dataset-summary",
245
+ version: "0.1.71",
246
+ apiContract: "2026-06-dataset-column-syntax-cutover",
246
247
  supportPolicy: {
247
- latest: "0.1.70",
248
+ latest: "0.1.71",
248
249
  minimumSupported: "0.1.53",
249
250
  deprecatedBelow: "0.1.53"
250
251
  }
@@ -2435,6 +2436,13 @@ function steps() {
2435
2436
  return new DeeplineStepProgram([]);
2436
2437
  }
2437
2438
  function when(predicate, resolver) {
2439
+ void predicate;
2440
+ void resolver;
2441
+ throw new Error(
2442
+ "when(...) has been replaced by runIf(...). Use runIf(predicate, resolver)."
2443
+ );
2444
+ }
2445
+ function runIf(predicate, resolver) {
2438
2446
  return new DeeplineConditionalStepResolver(predicate, resolver, null);
2439
2447
  }
2440
2448
  var PLAY_METADATA_SYMBOL = /* @__PURE__ */ Symbol.for("deepline.play.metadata");
@@ -3011,6 +3019,7 @@ function extractSummaryFields(payload) {
3011
3019
  isPlayBootstrapFinderKind,
3012
3020
  isPlayBootstrapTemplate,
3013
3021
  resolveConfig,
3022
+ runIf,
3014
3023
  steps,
3015
3024
  tryConvertToList,
3016
3025
  when,
package/dist/index.mjs CHANGED
@@ -179,10 +179,10 @@ import { join as join2 } from "path";
179
179
 
180
180
  // src/release.ts
181
181
  var SDK_RELEASE = {
182
- version: "0.1.70",
183
- apiContract: "2026-05-play-bootstrap-dataset-summary",
182
+ version: "0.1.71",
183
+ apiContract: "2026-06-dataset-column-syntax-cutover",
184
184
  supportPolicy: {
185
- latest: "0.1.70",
185
+ latest: "0.1.71",
186
186
  minimumSupported: "0.1.53",
187
187
  deprecatedBelow: "0.1.53"
188
188
  }
@@ -2373,6 +2373,13 @@ function steps() {
2373
2373
  return new DeeplineStepProgram([]);
2374
2374
  }
2375
2375
  function when(predicate, resolver) {
2376
+ void predicate;
2377
+ void resolver;
2378
+ throw new Error(
2379
+ "when(...) has been replaced by runIf(...). Use runIf(predicate, resolver)."
2380
+ );
2381
+ }
2382
+ function runIf(predicate, resolver) {
2376
2383
  return new DeeplineConditionalStepResolver(predicate, resolver, null);
2377
2384
  }
2378
2385
  var PLAY_METADATA_SYMBOL = /* @__PURE__ */ Symbol.for("deepline.play.metadata");
@@ -2948,6 +2955,7 @@ export {
2948
2955
  isPlayBootstrapFinderKind,
2949
2956
  isPlayBootstrapTemplate,
2950
2957
  resolveConfig,
2958
+ runIf,
2951
2959
  steps,
2952
2960
  tryConvertToList,
2953
2961
  when,