deepline 0.1.55 → 0.1.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +461 -62
- package/dist/cli/index.mjs +461 -62
- package/dist/index.d.mts +220 -34
- package/dist/index.d.ts +220 -34
- package/dist/index.js +22 -4
- package/dist/index.mjs +22 -4
- package/dist/repo/apps/play-runner-workers/src/entry.ts +36 -12
- package/dist/repo/apps/play-runner-workers/src/runtime/dataset-handles.ts +35 -7
- package/dist/repo/sdk/src/client.ts +33 -2
- package/dist/repo/sdk/src/play.ts +167 -33
- package/dist/repo/sdk/src/release.ts +3 -3
- package/dist/repo/sdk/src/types.ts +21 -0
- package/dist/repo/shared_libs/play-runtime/csv-rename.ts +55 -3
- package/dist/repo/shared_libs/plays/dataset.ts +25 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -276,6 +276,22 @@ interface ToolDefinition {
|
|
|
276
276
|
/** Copyable play-runtime guidance for V2 tool execution results. */
|
|
277
277
|
usageGuidance?: {
|
|
278
278
|
execute?: string;
|
|
279
|
+
prefer?: string[];
|
|
280
|
+
access?: {
|
|
281
|
+
extractedLists?: {
|
|
282
|
+
expression?: string;
|
|
283
|
+
meaning?: string;
|
|
284
|
+
};
|
|
285
|
+
extractedValues?: {
|
|
286
|
+
expression?: string;
|
|
287
|
+
meaning?: string;
|
|
288
|
+
};
|
|
289
|
+
rawToolResponse?: {
|
|
290
|
+
expression?: string;
|
|
291
|
+
meaning?: string;
|
|
292
|
+
};
|
|
293
|
+
invalidGetterHint?: string;
|
|
294
|
+
};
|
|
279
295
|
toolExecutionResult?: {
|
|
280
296
|
type?: 'ToolExecutionResult';
|
|
281
297
|
toolResponse?: {
|
|
@@ -758,6 +774,11 @@ interface PlayDescription {
|
|
|
758
774
|
rowOutputSchema?: Record<string, unknown> | null;
|
|
759
775
|
runCommand: string;
|
|
760
776
|
examples: string[];
|
|
777
|
+
cloneEditStarter?: {
|
|
778
|
+
path: string;
|
|
779
|
+
command: string;
|
|
780
|
+
checkCommand: string;
|
|
781
|
+
};
|
|
761
782
|
currentPublishedVersion?: number | null;
|
|
762
783
|
isDraftDirty?: boolean;
|
|
763
784
|
latestRunId?: string | null;
|
|
@@ -1073,6 +1094,8 @@ declare class DeeplineClient {
|
|
|
1073
1094
|
private compactSchema;
|
|
1074
1095
|
private schemaMetadata;
|
|
1075
1096
|
private playRunCommand;
|
|
1097
|
+
private starterPlayPath;
|
|
1098
|
+
private playCloneEditStarter;
|
|
1076
1099
|
private summarizePlayListItem;
|
|
1077
1100
|
private summarizePlayDetail;
|
|
1078
1101
|
/**
|
|
@@ -1464,7 +1487,6 @@ declare class DeeplineClient {
|
|
|
1464
1487
|
}): Promise<PlayListItem[]>;
|
|
1465
1488
|
searchPlays(options: {
|
|
1466
1489
|
query: string;
|
|
1467
|
-
origin?: 'prebuilt' | 'owned';
|
|
1468
1490
|
compact?: boolean;
|
|
1469
1491
|
}): Promise<PlayDescription[]>;
|
|
1470
1492
|
/**
|
|
@@ -1763,14 +1785,34 @@ type PlayDatasetWorkProgressSummary = {
|
|
|
1763
1785
|
};
|
|
1764
1786
|
};
|
|
1765
1787
|
type PlayDatasetInput<T> = ReadonlyArray<T> | Iterable<T> | AsyncIterable<T> | PlayDataset<T>;
|
|
1788
|
+
/**
|
|
1789
|
+
* Durable handle for rows produced by `ctx.csv(...)` or `ctx.map(...).run()`.
|
|
1790
|
+
*
|
|
1791
|
+
* A `PlayDataset` is not a normal in-memory array. It points at runtime-managed
|
|
1792
|
+
* rows, usually backed by persisted sheet storage, and carries metadata such as
|
|
1793
|
+
* dataset kind, dataset id, table namespace, count, and preview rows.
|
|
1794
|
+
*
|
|
1795
|
+
* Pass dataset handles directly into later `ctx.map(...)` stages by default so
|
|
1796
|
+
* Deepline keeps row progress, retries, memory use, and table output under
|
|
1797
|
+
* runtime control. Use `count()` and `peek()` for bounded inspection. Use
|
|
1798
|
+
* `materialize(limit)` or async iteration only when the dataset is intentionally
|
|
1799
|
+
* small and bounded.
|
|
1800
|
+
*/
|
|
1766
1801
|
interface PlayDataset<T> extends AsyncIterable<T> {
|
|
1767
1802
|
readonly [PLAY_DATASET_BRAND]: true;
|
|
1803
|
+
/** Dataset kind. */
|
|
1768
1804
|
readonly datasetKind: PlayDatasetKind;
|
|
1805
|
+
/** Dataset id. */
|
|
1769
1806
|
readonly datasetId: string;
|
|
1807
|
+
/** Backing store info. */
|
|
1770
1808
|
readonly backing?: PlayDatasetBacking;
|
|
1809
|
+
/** Display label. */
|
|
1771
1810
|
readonly sourceLabel?: string | null;
|
|
1811
|
+
/** Runtime table name. */
|
|
1772
1812
|
readonly tableNamespace?: string | null;
|
|
1813
|
+
/** Row count. */
|
|
1773
1814
|
count(): Promise<number>;
|
|
1815
|
+
/** Preview rows. */
|
|
1774
1816
|
peek(limit?: number): Promise<T[]>;
|
|
1775
1817
|
/**
|
|
1776
1818
|
* Explicit escape hatch for bounded result sets.
|
|
@@ -1857,6 +1899,19 @@ type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Rec
|
|
|
1857
1899
|
[K in keyof TLists]: ToolResultListAccessor<TLists[K]>;
|
|
1858
1900
|
};
|
|
1859
1901
|
};
|
|
1902
|
+
/**
|
|
1903
|
+
* Canonical result returned by Deepline tool execution.
|
|
1904
|
+
*
|
|
1905
|
+
* The top-level object is Deepline-owned execution metadata and semantic
|
|
1906
|
+
* extraction state. Raw tool/provider data lives under `toolResponse.raw`;
|
|
1907
|
+
* response metadata lives under `toolResponse.meta`. Semantic single-value
|
|
1908
|
+
* getters live under `extractedValues.<name>.get()`, and list getters live
|
|
1909
|
+
* under `extractedLists.<name>.get()`.
|
|
1910
|
+
*
|
|
1911
|
+
* Use extractors first when a tool contract exposes them. Drop to
|
|
1912
|
+
* `toolResponse.raw` when you need provider-specific fields or when debugging
|
|
1913
|
+
* from persisted run rows.
|
|
1914
|
+
*/
|
|
1860
1915
|
type ToolExecuteResult<TResult = unknown, TMeta = Record<string, unknown>, TExtracted extends Record<string, unknown> = Record<string, unknown>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = ToolExecuteResultBase<TResult, TMeta> & ToolExecuteResultAccessors<TExtracted, TLists>;
|
|
1861
1916
|
|
|
1862
1917
|
/**
|
|
@@ -1915,10 +1970,20 @@ type LoosePlayObject = {
|
|
|
1915
1970
|
[key: string]: LoosePlayObject;
|
|
1916
1971
|
};
|
|
1917
1972
|
|
|
1973
|
+
/**
|
|
1974
|
+
* Keyword-style request object for `ctx.tools.execute(...)`.
|
|
1975
|
+
*
|
|
1976
|
+
* The `tool` value comes from live tool discovery. The `id` is the stable
|
|
1977
|
+
* logical call name inside this play and participates in replay/idempotency.
|
|
1978
|
+
*/
|
|
1918
1979
|
type ToolExecutionRequest = {
|
|
1980
|
+
/** Stable logical id for this tool call within the play. */
|
|
1919
1981
|
id: string;
|
|
1982
|
+
/** Current tool id from `deepline tools search` / `deepline tools describe`. */
|
|
1920
1983
|
tool: string;
|
|
1984
|
+
/** JSON-serializable provider/tool input object. */
|
|
1921
1985
|
input: Record<string, unknown>;
|
|
1986
|
+
/** Human-readable description for logs and run inspection. */
|
|
1922
1987
|
description?: string;
|
|
1923
1988
|
staleAfterSeconds?: number;
|
|
1924
1989
|
};
|
|
@@ -1950,7 +2015,29 @@ type PlayStepProgramStep = {
|
|
|
1950
2015
|
};
|
|
1951
2016
|
type MapStepResolver<Row, Value> = StepResolver<Row, Value> | ConditionalStepResolver<Row, Value> | StepProgramResolver<Row, Value>;
|
|
1952
2017
|
type MapStepBuilder<InputRow extends object, OutputRow extends object> = {
|
|
2018
|
+
/**
|
|
2019
|
+
* Define one output column for every row in this map dataset.
|
|
2020
|
+
*
|
|
2021
|
+
* The `name` becomes a field on each output row. For example,
|
|
2022
|
+
* `.step('contact', ...)` creates `row.contact` in later map stages; it does
|
|
2023
|
+
* not spread returned object fields such as `contact.email` into `row.email`.
|
|
2024
|
+
* Add a later column resolver when you want a top-level export field:
|
|
2025
|
+
* `.step('email', row => row.contact?.email ?? null)`.
|
|
2026
|
+
*
|
|
2027
|
+
* @param name - Output column name.
|
|
2028
|
+
* @param resolver - Computes the value for one row.
|
|
2029
|
+
* @returns The same map builder with the new column type.
|
|
2030
|
+
*/
|
|
1953
2031
|
step<Name extends string, Value>(name: Name, resolver: MapStepResolver<OutputRow, Value>): MapStepBuilder<InputRow, OutputRow & Record<Name, Value>>;
|
|
2032
|
+
/**
|
|
2033
|
+
* Execute the row-column program and return a durable dataset handle.
|
|
2034
|
+
*
|
|
2035
|
+
* The returned {@link PlayDataset} preserves one output row per input row,
|
|
2036
|
+
* with original fields merged with the columns produced by `.step(...)`.
|
|
2037
|
+
*
|
|
2038
|
+
* @param options - Run options.
|
|
2039
|
+
* @returns Output rows as a dataset handle.
|
|
2040
|
+
*/
|
|
1954
2041
|
run(options?: {
|
|
1955
2042
|
description?: string;
|
|
1956
2043
|
staleAfterSeconds?: number;
|
|
@@ -1977,10 +2064,15 @@ type CsvInput<TRow extends object = Record<string, unknown>> = FileInput<{
|
|
|
1977
2064
|
readonly row: TRow;
|
|
1978
2065
|
}>;
|
|
1979
2066
|
type ColumnMap<TRow extends object> = Partial<Record<Extract<keyof TRow, string>, string | readonly string[]>>;
|
|
2067
|
+
/** Options for loading a staged CSV with `ctx.csv(...)`. */
|
|
1980
2068
|
type CsvOptions = {
|
|
2069
|
+
/** Human-readable description for runtime logs and inspection. */
|
|
1981
2070
|
description?: string;
|
|
2071
|
+
/** Canonical field-to-header aliases, e.g. `{ domain: ['domain', 'Company Domain'] }`. */
|
|
1982
2072
|
columns?: CsvRenameMap;
|
|
2073
|
+
/** Header rename map; use `columns` for new code. */
|
|
1983
2074
|
rename?: CsvRenameMap;
|
|
2075
|
+
/** Canonical fields that must be present after header normalization. */
|
|
1984
2076
|
required?: readonly string[];
|
|
1985
2077
|
};
|
|
1986
2078
|
/**
|
|
@@ -2030,41 +2122,47 @@ type CsvOptions = {
|
|
|
2030
2122
|
*/
|
|
2031
2123
|
interface DeeplinePlayRuntimeContext {
|
|
2032
2124
|
/**
|
|
2033
|
-
* Load a CSV file as a dataset handle.
|
|
2125
|
+
* Load a staged CSV file as a durable dataset handle.
|
|
2126
|
+
*
|
|
2127
|
+
* Use this when a play receives a CSV path from the CLI or API and row work
|
|
2128
|
+
* should continue through {@link DeeplinePlayRuntimeContext.map}. The path is
|
|
2129
|
+
* normally an input field such as `input.csv`, populated by
|
|
2130
|
+
* `deepline plays run my.play.ts --csv rows.csv`.
|
|
2034
2131
|
*
|
|
2035
|
-
*
|
|
2036
|
-
*
|
|
2132
|
+
* Each CSV row becomes an object keyed by canonical column names. Use
|
|
2133
|
+
* `options.columns` / `options.rename` to map user headers such as
|
|
2134
|
+
* `"Company Domain"` to stable code fields such as `domain`.
|
|
2037
2135
|
*
|
|
2038
2136
|
* @typeParam T - Row type (defaults to `Record<string, unknown>`)
|
|
2039
|
-
* @param path -
|
|
2040
|
-
*
|
|
2041
|
-
* explicit `materialize()` for small result sets.
|
|
2137
|
+
* @param path - Staged CSV path.
|
|
2138
|
+
* @param options - CSV load options.
|
|
2042
2139
|
*
|
|
2043
|
-
* @returns
|
|
2140
|
+
* @returns A {@link PlayDataset} whose rows should usually flow directly into `ctx.map(...)`.
|
|
2044
2141
|
*/
|
|
2045
2142
|
csv<T = Record<string, unknown>>(path: string, options?: CsvOptions): Promise<PlayDataset<T>>;
|
|
2046
2143
|
/**
|
|
2047
|
-
*
|
|
2144
|
+
* Create a persisted row dataset/table from input rows.
|
|
2048
2145
|
*
|
|
2049
|
-
*
|
|
2050
|
-
*
|
|
2051
|
-
*
|
|
2146
|
+
* `ctx.map` is Deepline's row-work primitive. It records row identity,
|
|
2147
|
+
* progress, retries, table output, and idempotency for a collection of rows.
|
|
2148
|
+
* Use `.step(name, resolver)` on the returned builder to define output
|
|
2149
|
+
* columns, then `.run(...)` to execute the row program.
|
|
2052
2150
|
*
|
|
2053
|
-
*
|
|
2054
|
-
*
|
|
2055
|
-
* automatically from
|
|
2056
|
-
*
|
|
2057
|
-
* relative time window. Use `86400` for daily reruns; retries inside the same
|
|
2058
|
-
* window still replay safely.
|
|
2151
|
+
* The `key` identifies the logical dataset/table. Renaming it is a persistence
|
|
2152
|
+
* migration: existing rows may no longer be reused. Row identity is derived
|
|
2153
|
+
* automatically from input row content unless `.run({ key: ... })` overrides
|
|
2154
|
+
* it with stable business fields such as `domain`, `email`, or `linkedin_url`.
|
|
2059
2155
|
*
|
|
2060
|
-
*
|
|
2061
|
-
*
|
|
2062
|
-
*
|
|
2156
|
+
* By default, `ctx.map` is row-preserving: one input row produces one output
|
|
2157
|
+
* row, with original fields merged with the columns produced by
|
|
2158
|
+
* `.step(...)`. If one input entity must become many output rows, use the
|
|
2159
|
+
* documented expand/flatten recipe instead of assuming `ctx.map` changes
|
|
2160
|
+
* row cardinality.
|
|
2063
2161
|
*
|
|
2064
2162
|
* @typeParam T - Row type
|
|
2065
|
-
* @param key -
|
|
2066
|
-
* @param items - Input rows
|
|
2067
|
-
* @returns
|
|
2163
|
+
* @param key - Dataset/table name.
|
|
2164
|
+
* @param items - Input rows.
|
|
2165
|
+
* @returns A builder. Calling `.run()` returns a `PlayDataset` of rows plus computed columns.
|
|
2068
2166
|
*
|
|
2069
2167
|
* @example Single tool per row
|
|
2070
2168
|
* ```typescript
|
|
@@ -2103,21 +2201,71 @@ interface DeeplinePlayRuntimeContext {
|
|
|
2103
2201
|
/**
|
|
2104
2202
|
* Execute a single tool with a keyword-style request object.
|
|
2105
2203
|
*
|
|
2106
|
-
* @param request
|
|
2107
|
-
* @
|
|
2108
|
-
* @param request.input - Tool-specific input parameters
|
|
2109
|
-
* @returns The tool's output
|
|
2204
|
+
* @param request - Tool call request.
|
|
2205
|
+
* @returns Tool execution result.
|
|
2110
2206
|
*/
|
|
2111
2207
|
execute<TOutput = LoosePlayObject>(request: ToolExecutionRequest & {
|
|
2112
2208
|
staleAfterSeconds?: number;
|
|
2113
2209
|
}): Promise<ToolExecuteResult<TOutput>>;
|
|
2114
2210
|
};
|
|
2211
|
+
/**
|
|
2212
|
+
* Execute a single tool by stable step key and tool ID.
|
|
2213
|
+
*
|
|
2214
|
+
* Shorthand for `ctx.tools.execute(...)`; this is the preferred spelling in
|
|
2215
|
+
* row-level step programs.
|
|
2216
|
+
*/
|
|
2217
|
+
tool<TOutput = LoosePlayObject>(key: string, toolId: string, input: Record<string, unknown>, options?: {
|
|
2218
|
+
description?: string;
|
|
2219
|
+
}): Promise<ToolExecuteResult<TOutput>>;
|
|
2220
|
+
/**
|
|
2221
|
+
* Run a reusable step program against one scalar input object.
|
|
2222
|
+
*
|
|
2223
|
+
* `steps().step(...)` is a composable mini-pipeline. Use `ctx.runSteps(...)`
|
|
2224
|
+
* when that mini-pipeline should execute outside a row dataset. Inside a
|
|
2225
|
+
* `ctx.map` column resolver, pass the step program directly to
|
|
2226
|
+
* `.step(name, program)` instead.
|
|
2227
|
+
*
|
|
2228
|
+
* @param program - Step program.
|
|
2229
|
+
* @param input - Program input.
|
|
2230
|
+
* @param options - Run options.
|
|
2231
|
+
* @returns Program output.
|
|
2232
|
+
*/
|
|
2115
2233
|
runSteps<TInput extends Record<string, unknown>, TOutput>(program: StepProgram<TInput, unknown, TOutput>, input: TInput, options?: {
|
|
2116
2234
|
description?: string;
|
|
2117
2235
|
}): Promise<TOutput>;
|
|
2236
|
+
/**
|
|
2237
|
+
* Create one scalar checkpoint for the whole play run.
|
|
2238
|
+
*
|
|
2239
|
+
* Use `ctx.step` when a value is nondeterministic, expensive, external, or
|
|
2240
|
+
* useful to inspect as a named boundary. The first execution stores the
|
|
2241
|
+
* JSON-serializable output under `id`; replay and retries return the stored
|
|
2242
|
+
* value instead of running `run` again.
|
|
2243
|
+
*
|
|
2244
|
+
* Plain deterministic assignment does not need `ctx.step`. Use
|
|
2245
|
+
* `ctx.map(...).step(...)`, not `ctx.step`, when the value should become a
|
|
2246
|
+
* field on each exported row.
|
|
2247
|
+
*
|
|
2248
|
+
* @param id - Checkpoint id.
|
|
2249
|
+
* @param run - Computes the value once.
|
|
2250
|
+
* @param options - Checkpoint options.
|
|
2251
|
+
* @returns Checkpoint value.
|
|
2252
|
+
*/
|
|
2118
2253
|
step<T>(id: string, run: () => T | Promise<T>, options?: {
|
|
2119
2254
|
staleAfterSeconds?: number;
|
|
2120
2255
|
}): Promise<T>;
|
|
2256
|
+
/**
|
|
2257
|
+
* Durable HTTP fetch.
|
|
2258
|
+
*
|
|
2259
|
+
* Use this for non-provider HTTP calls that must replay safely. The response
|
|
2260
|
+
* is recorded under `key` so workflow replay sees the same value. Prefer
|
|
2261
|
+
* `ctx.tools.execute(...)` for Deepline-managed provider APIs because tools
|
|
2262
|
+
* handle auth, retries, rate limits, extraction metadata, and spend tracking.
|
|
2263
|
+
*
|
|
2264
|
+
* @param key - Checkpoint id.
|
|
2265
|
+
* @param url - URL to fetch.
|
|
2266
|
+
* @param init - Fetch options.
|
|
2267
|
+
* @returns Recorded response.
|
|
2268
|
+
*/
|
|
2121
2269
|
fetch(key: string, url: string | URL, init?: RequestInit, options?: {
|
|
2122
2270
|
staleAfterSeconds?: number;
|
|
2123
2271
|
}): Promise<{
|
|
@@ -2129,6 +2277,22 @@ interface DeeplinePlayRuntimeContext {
|
|
|
2129
2277
|
bodyText: string;
|
|
2130
2278
|
json: unknown | null;
|
|
2131
2279
|
}>;
|
|
2280
|
+
/**
|
|
2281
|
+
* Invoke another registered or file-backed play as a child workflow.
|
|
2282
|
+
*
|
|
2283
|
+
* Use this for real composition boundaries, especially when a fitting
|
|
2284
|
+
* scalar prebuilt play already encodes provider order, fallbacks,
|
|
2285
|
+
* normalization, and no-result behavior. Do not invoke plays through
|
|
2286
|
+
* `ctx.tools.execute`; tools and plays are separate namespaces.
|
|
2287
|
+
*
|
|
2288
|
+
* `key` is the stable child-call identity for idempotency and traceability.
|
|
2289
|
+
*
|
|
2290
|
+
* @param key - Child call id.
|
|
2291
|
+
* @param playRef - Play name or handle.
|
|
2292
|
+
* @param input - Child input.
|
|
2293
|
+
* @param options - Run options.
|
|
2294
|
+
* @returns Child play output.
|
|
2295
|
+
*/
|
|
2132
2296
|
runPlay(key: string, playRef: string | PlayReferenceLike, input: Record<string, unknown>, options: {
|
|
2133
2297
|
description?: string;
|
|
2134
2298
|
staleAfterSeconds?: number;
|
|
@@ -2313,11 +2477,24 @@ type PlayInputContract<TInput> = {
|
|
|
2313
2477
|
readonly schema: Record<string, unknown>;
|
|
2314
2478
|
readonly __inputType?: TInput;
|
|
2315
2479
|
};
|
|
2480
|
+
/**
|
|
2481
|
+
* Object-form play definition accepted by `definePlay(config)`.
|
|
2482
|
+
*
|
|
2483
|
+
* Use this form when the input contract should be explicit at definition time
|
|
2484
|
+
* through `defineInput<T>(schema)`, or when configuration reads clearer as one
|
|
2485
|
+
* object. The shorthand `definePlay(name, fn, bindings?)` is equivalent for
|
|
2486
|
+
* simple file-backed plays.
|
|
2487
|
+
*/
|
|
2316
2488
|
type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = {
|
|
2489
|
+
/** Play id/name. */
|
|
2317
2490
|
id: string;
|
|
2491
|
+
/** Input schema. */
|
|
2318
2492
|
input: PlayInputContract<TInput>;
|
|
2493
|
+
/** Play function. */
|
|
2319
2494
|
run: (ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>;
|
|
2495
|
+
/** Trigger bindings. */
|
|
2320
2496
|
bindings?: PlayBindings;
|
|
2497
|
+
/** Billing options. */
|
|
2321
2498
|
billing?: PlayBindings['billing'];
|
|
2322
2499
|
};
|
|
2323
2500
|
declare function steps<TInput>(): StepProgram<TInput, TInput, TInput>;
|
|
@@ -2482,9 +2659,10 @@ declare function defineInput<TInput>(schema: Record<string, unknown>): PlayInput
|
|
|
2482
2659
|
*
|
|
2483
2660
|
* @typeParam TInput - The input type accepted by the play
|
|
2484
2661
|
* @typeParam TOutput - The return type of the play
|
|
2485
|
-
* @param
|
|
2486
|
-
* @param
|
|
2487
|
-
* @param
|
|
2662
|
+
* @param config - Object-form play config.
|
|
2663
|
+
* @param name - Play name.
|
|
2664
|
+
* @param fn - Play function.
|
|
2665
|
+
* @param bindings - Trigger bindings.
|
|
2488
2666
|
* @returns A {@link DefinedPlay} that is both callable and has lifecycle methods
|
|
2489
2667
|
*
|
|
2490
2668
|
* @example Basic play
|
|
@@ -2505,9 +2683,9 @@ declare function defineInput<TInput>(schema: Record<string, unknown>): PlayInput
|
|
|
2505
2683
|
*
|
|
2506
2684
|
* @example CSV processing play
|
|
2507
2685
|
* ```typescript
|
|
2508
|
-
* export default definePlay('bulk-enrich', async (ctx) => {
|
|
2509
|
-
* const leads = await ctx.csv(
|
|
2510
|
-
* ctx.log(`Processing ${leads.
|
|
2686
|
+
* export default definePlay('bulk-enrich', async (ctx, input: { csv: string }) => {
|
|
2687
|
+
* const leads = await ctx.csv(input.csv);
|
|
2688
|
+
* ctx.log(`Processing ${await leads.count()} rows`);
|
|
2511
2689
|
* const results = await ctx
|
|
2512
2690
|
* .map('companies', leads)
|
|
2513
2691
|
* .step('company', (row, ctx) =>
|
|
@@ -2552,6 +2730,14 @@ declare function defineInput<TInput>(schema: Record<string, unknown>): PlayInput
|
|
|
2552
2730
|
* ```
|
|
2553
2731
|
*/
|
|
2554
2732
|
declare function definePlay<TInput, TOutput extends PlayReturnObject>(config: DefinePlayConfig<TInput, TOutput>): DefinedPlay<TInput, TOutput>;
|
|
2733
|
+
/**
|
|
2734
|
+
* Define a play with a name and function.
|
|
2735
|
+
*
|
|
2736
|
+
* @param name - Play name.
|
|
2737
|
+
* @param fn - Play function.
|
|
2738
|
+
* @param bindings - Trigger bindings.
|
|
2739
|
+
* @returns Play handle.
|
|
2740
|
+
*/
|
|
2555
2741
|
declare function definePlay<TInput, TOutput extends PlayReturnObject>(name: string, fn: (ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>, bindings?: PlayBindings): DefinedPlay<TInput, TOutput>;
|
|
2556
2742
|
/**
|
|
2557
2743
|
* Alias for {@link definePlay}. Workflows and plays share the same public
|