deepline 0.3.421 → 0.3.423
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/client.ts +2 -2
- package/dist/bundling-sources/sdk/src/index.ts +2 -0
- package/dist/bundling-sources/sdk/src/play.ts +227 -184
- package/dist/bundling-sources/sdk/src/plays/local-file-discovery.ts +9 -2
- package/dist/bundling-sources/sdk/src/plays/local-play-execution.ts +1 -1
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/tool-calls.ts +3 -1
- package/dist/bundling-sources/sdk/src/types.ts +5 -5
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +6 -6
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +37 -36
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +179 -38
- package/dist/bundling-sources/shared_libs/plays/dataset.ts +2 -2
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +4 -0
- package/dist/bundling-sources/shared_libs/plays/fetch-http-error.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/local-file-discovery.ts +12 -4
- package/dist/bundling-sources/shared_libs/plays/play-exports.ts +27 -5
- package/dist/bundling-sources/shared_libs/plays/script-entry.ts +992 -0
- package/dist/bundling-sources/shared_libs/plays/source-authoring-edition.ts +63 -0
- package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +8 -4
- package/dist/bundling-sources/shared_libs/plays/ts-ast.ts +2 -0
- package/dist/cli/{auth-56JTC4Q7.mjs → auth-L7Q53QKK.mjs} +4 -4
- package/dist/cli/auth-SUNY477Y.js +40 -0
- package/dist/cli/{billing-ZXOOZEUW.mjs → billing-IH7AKDR2.mjs} +4 -4
- package/dist/cli/{billing-C5LR6FA7.js → billing-QNP6YGI2.js} +73 -73
- package/dist/cli/{chunk-AARWVK4C.mjs → chunk-2BQUML3X.mjs} +792 -69
- package/dist/cli/{chunk-7SRVIWGT.js → chunk-2F5ULM2F.js} +1 -1
- package/dist/cli/{chunk-HP5FD2LI.js → chunk-2U3AMRHF.js} +8 -8
- package/dist/cli/{chunk-ERFN2QY4.mjs → chunk-3DNKFH2G.mjs} +1 -1
- package/dist/cli/{chunk-5F6W5NWV.mjs → chunk-44US3EL2.mjs} +5 -5
- package/dist/cli/{chunk-6UKY4LBW.js → chunk-4WT5RISA.js} +20 -20
- package/dist/cli/{chunk-QJV2ALPN.js → chunk-5DGR3TB6.js} +2 -2
- package/dist/cli/{chunk-UCI4QROZ.mjs → chunk-6FFORGD2.mjs} +2 -2
- package/dist/cli/{chunk-ZSVWCV3G.mjs → chunk-ARTGL3FM.mjs} +1 -1
- package/dist/cli/{chunk-FB5H5OOH.js → chunk-AVOBDFQ5.js} +11 -11
- package/dist/cli/{chunk-2WOVAVJ3.js → chunk-DRK6FYJU.js} +26 -26
- package/dist/cli/{chunk-63ILLN5H.mjs → chunk-DS7Y7X26.mjs} +2 -2
- package/dist/cli/{chunk-CTNA5QY2.mjs → chunk-EER67G2B.mjs} +43 -28
- package/dist/cli/{chunk-GIJ47TAV.js → chunk-EWWWOKX2.js} +6 -6
- package/dist/cli/{chunk-5E55HHW3.mjs → chunk-FJRFSBWO.mjs} +4 -4
- package/dist/cli/{chunk-27GJKC5Q.js → chunk-GXOQRZXG.js} +2 -2
- package/dist/cli/{chunk-RURYN2BE.mjs → chunk-H662SHPT.mjs} +28 -27
- package/dist/cli/{chunk-PKBPSMOT.js → chunk-INFLI36H.js} +43 -28
- package/dist/cli/{chunk-RJLFCJ23.mjs → chunk-IW5QK3K6.mjs} +3 -3
- package/dist/cli/{chunk-SPLOMS4N.mjs → chunk-JDAXVQV7.mjs} +1 -1
- package/dist/cli/{chunk-4PG4ARL2.mjs → chunk-KPKU53YO.mjs} +1 -1
- package/dist/cli/{chunk-IMZ56EOH.mjs → chunk-LXTSVUZN.mjs} +2 -2
- package/dist/cli/{chunk-F4V4JJED.mjs → chunk-MHG3NND4.mjs} +3 -3
- package/dist/cli/{chunk-IHG7UAHD.mjs → chunk-MLJBCS3E.mjs} +32 -13
- package/dist/cli/{chunk-5KYK4DGY.js → chunk-MMI2DXCW.js} +8 -8
- package/dist/cli/{chunk-VEYAPBS4.js → chunk-NA6SGG7X.js} +260 -259
- package/dist/cli/{chunk-AZGJNNNE.mjs → chunk-NFIZ5YED.mjs} +2 -2
- package/dist/cli/{chunk-WR4M5VWK.js → chunk-OMWO2JLC.js} +52 -52
- package/dist/cli/{chunk-EKQH4IUU.mjs → chunk-OPI7UCQG.mjs} +1 -1
- package/dist/cli/{chunk-2XKDLS5P.js → chunk-OZLMMMZH.js} +6 -6
- package/dist/cli/{chunk-ZLPT2RZ5.mjs → chunk-PH4BP6KM.mjs} +2 -2
- package/dist/cli/{chunk-NSJRLP7R.js → chunk-PQ4G6MKI.js} +16 -16
- package/dist/cli/{chunk-4NS4EZHN.mjs → chunk-QN6DG4JO.mjs} +2 -2
- package/dist/cli/{chunk-VC3E5HFO.mjs → chunk-QWJJMQNE.mjs} +1 -1
- package/dist/cli/{chunk-GEJDBXXM.js → chunk-QWRHGGUH.js} +1 -1
- package/dist/cli/{chunk-AD47BXN2.js → chunk-R2QWSSAG.js} +8 -8
- package/dist/cli/{chunk-JJQLBZEW.js → chunk-RAL75ND3.js} +2 -2
- package/dist/cli/{chunk-QADCFSGH.js → chunk-RDIN3NKA.js} +17 -17
- package/dist/cli/{chunk-7TSF7E3B.mjs → chunk-S6KG7JCR.mjs} +2 -2
- package/dist/cli/{chunk-BQR6UN3C.js → chunk-VUYUI35Q.js} +32 -13
- package/dist/cli/{chunk-C25ZYL6U.js → chunk-W42SSVM7.js} +4 -4
- package/dist/cli/{chunk-ZZBXD5VX.js → chunk-WJO7KIFT.js} +50 -50
- package/dist/cli/{chunk-VYLZS7X4.mjs → chunk-XSERB7H2.mjs} +1 -1
- package/dist/cli/{chunk-4I26IVFC.js → chunk-YCHR57TD.js} +35 -35
- package/dist/cli/{chunk-OQQOXSYA.js → chunk-YHRS6XTB.js} +845 -122
- package/dist/cli/{chunk-ZOL3CIKN.mjs → chunk-YNT7PJND.mjs} +3 -3
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-EJ4QRLA2.mjs → csv-5KW7M6ZS.mjs} +3 -3
- package/dist/cli/{csv-G6H3U4XV.js → csv-GF7VRES5.js} +12 -12
- package/dist/cli/{db-WKQFXUWI.js → db-AEDXKB4F.js} +26 -26
- package/dist/cli/{db-PBIIALJ5.mjs → db-NN4JQAC4.mjs} +5 -5
- package/dist/cli/{describe-ZCU36ES2.js → describe-5RLXW332.js} +24 -24
- package/dist/cli/{describe-DMRK4UNO.mjs → describe-RX6VROHQ.mjs} +16 -16
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/describe-core.js +4 -4
- package/dist/cli/describe-core.mjs +3 -3
- package/dist/cli/{executions-JAHW6GMA.mjs → executions-EJZ34VUB.mjs} +4 -4
- package/dist/cli/{executions-SBA3UYMH.js → executions-PGIGFDDS.js} +6 -6
- package/dist/cli/{feedback-PKBUYHMD.mjs → feedback-6MWOKE7H.mjs} +3 -3
- package/dist/cli/{feedback-QAE4V2NY.js → feedback-L2ODMANV.js} +7 -7
- package/dist/cli/git-2ZDCRTBD.js +24 -0
- package/dist/cli/{git-GAO3SJAQ.mjs → git-456RF3AT.mjs} +4 -4
- package/dist/cli/index.js +135 -135
- package/dist/cli/index.mjs +37 -37
- package/dist/cli/{legacy-noops-JCMVW5BL.js → legacy-noops-MDPB3MIS.js} +7 -7
- package/dist/cli/{legacy-noops-5PY2ZZF3.mjs → legacy-noops-ZPRBXQDE.mjs} +4 -4
- package/dist/cli/{monitors-YPS4LPDG.js → monitors-TXKR5XYW.js} +86 -86
- package/dist/cli/{monitors-GVYAZRMB.mjs → monitors-ZLP6A7FT.mjs} +6 -6
- package/dist/cli/{org-OBVAU6K7.js → org-73SQ3AT2.js} +64 -64
- package/dist/cli/{org-R7AKPKUB.mjs → org-YZ62BIGM.mjs} +4 -4
- package/dist/cli/{play-MTHQQHR6.js → play-M75EBXEV.js} +606 -567
- package/dist/cli/{play-3LFM2SV2.mjs → play-VCYQKCKF.mjs} +113 -74
- package/dist/cli/{providers-CTIROUI3.js → providers-GIINJPWQ.js} +7 -7
- package/dist/cli/{providers-IRICPDKU.mjs → providers-JLA6LST3.mjs} +4 -4
- package/dist/cli/{quickstart-5FBQVZ5B.mjs → quickstart-AHCU75GG.mjs} +3 -3
- package/dist/cli/{quickstart-OZDVFNF2.js → quickstart-HHHLYCHT.js} +5 -5
- package/dist/cli/{search-FYM47QFU.mjs → search-5GACUIAX.mjs} +5 -5
- package/dist/cli/search-W2PGBXQO.js +30 -0
- package/dist/cli/{secrets-43GJUDAE.js → secrets-PI7IPCOE.js} +13 -13
- package/dist/cli/{secrets-ENBXU3O3.mjs → secrets-S2NBKAEN.mjs} +4 -4
- package/dist/cli/{sessions-RXX5IHG6.js → sessions-BK4CSRFS.js} +5 -5
- package/dist/cli/{sessions-7IQJOH5Z.mjs → sessions-IBKYGTBD.mjs} +4 -4
- package/dist/cli/{settings-Z2CWWV7P.js → settings-2G7TUDM7.js} +75 -75
- package/dist/cli/{settings-EZGDTS3K.mjs → settings-JY6UN4KO.mjs} +8 -8
- package/dist/cli/{setup-N5UMUBBV.mjs → setup-HS5X3OSN.mjs} +7 -7
- package/dist/cli/{setup-2ON3TUXP.js → setup-R424FIBF.js} +42 -42
- package/dist/cli/skills-M3RZAN4A.js +29 -0
- package/dist/cli/{skills-4MR2Z2M5.mjs → skills-UIBUDTGN.mjs} +5 -5
- package/dist/cli/tools-K2GII2PA.js +44 -0
- package/dist/cli/{tools-MCEIWE3I.mjs → tools-SB4FREB6.mjs} +15 -15
- package/dist/cli/update-C2ORJRXN.js +31 -0
- package/dist/cli/{update-2JDBGLTX.mjs → update-NJSUE2YU.mjs} +7 -7
- package/dist/cli/{workflow-7DNBY4WJ.js → workflow-3AZWZ4J3.js} +19 -19
- package/dist/cli/{workflow-7UDXYU5Y.mjs → workflow-HBG76XYX.mjs} +9 -9
- package/dist/{client-CCWIUnk7.d.mts → client-BTUOYGID.d.mts} +10 -9
- package/dist/{client-vHqBm-OL.d.ts → client-C668iUhZ.d.ts} +10 -9
- package/dist/{compiler-manifest-lzWpbV3w.d.ts → compiler-manifest-DaFuA1ki.d.mts} +35 -32
- package/dist/{compiler-manifest-lzWpbV3w.d.mts → compiler-manifest-DaFuA1ki.d.ts} +35 -32
- package/dist/{index-CtNK-0nI.d.mts → index-0yS9ihly.d.mts} +10 -3
- package/dist/{index-C8Cy-YTm.d.ts → index-CRAScKPg.d.ts} +10 -3
- package/dist/index.d.mts +120 -150
- package/dist/index.d.ts +120 -150
- package/dist/index.js +77 -12
- package/dist/index.mjs +74 -9
- package/dist/install-integrity.json +99 -98
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/bundle-play-file.mjs +1 -1
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/package.json +1 -1
- package/dist/cli/auth-ZQMAF7W5.js +0 -40
- package/dist/cli/git-54INNT33.js +0 -24
- package/dist/cli/search-XIKHDZJ3.js +0 -30
- package/dist/cli/skills-2WIHNEOS.js +0 -29
- package/dist/cli/tools-YUUSOKYX.js +0 -44
- package/dist/cli/update-PWX4MJ3R.js +0 -31
|
@@ -630,7 +630,7 @@ export type RunsGetOptions = {
|
|
|
630
630
|
};
|
|
631
631
|
|
|
632
632
|
export type RunsChildrenOptions = {
|
|
633
|
-
/** Required authored `
|
|
633
|
+
/** Required authored `deepline.runPlayAsync` launch key. */
|
|
634
634
|
launchKey: string;
|
|
635
635
|
/** Opaque cursor returned by the preceding page. */
|
|
636
636
|
cursor?: string;
|
|
@@ -4911,7 +4911,7 @@ export class DeeplineClient {
|
|
|
4911
4911
|
/**
|
|
4912
4912
|
* Export persisted runtime-sheet rows for a play dataset/table namespace.
|
|
4913
4913
|
*
|
|
4914
|
-
* This is the SDK form of exporting `
|
|
4914
|
+
* This is the SDK form of exporting `deepline.dataset(...).run()` output for a
|
|
4915
4915
|
* specific play and optional run id.
|
|
4916
4916
|
*/
|
|
4917
4917
|
async getPlaySheetRows(input: {
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* ## Core concepts
|
|
10
10
|
*
|
|
11
|
-
* - **{@link
|
|
12
|
-
*
|
|
13
|
-
* remote lifecycle management (run, get, publish, tail).
|
|
11
|
+
* - **{@link deepline}** — The play runtime. A play is a `.play.ts` file of
|
|
12
|
+
* top-level code that imports it; see {@link ScriptPlayContext}.
|
|
14
13
|
*
|
|
15
14
|
* - **{@link Deepline.connect}** — Create a client context for programmatic SDK
|
|
16
15
|
* usage. Returns a {@link DeeplineContext} with tool and play handles.
|
|
@@ -20,60 +19,39 @@
|
|
|
20
19
|
*
|
|
21
20
|
* ## Usage patterns
|
|
22
21
|
*
|
|
23
|
-
* ###
|
|
22
|
+
* ### Write and run a play
|
|
24
23
|
*
|
|
25
24
|
* ```typescript
|
|
26
|
-
* //
|
|
27
|
-
* import
|
|
28
|
-
*
|
|
29
|
-
* export default
|
|
30
|
-
*
|
|
31
|
-
*
|
|
25
|
+
* // lookup.play.ts
|
|
26
|
+
* import deepline from 'deepline';
|
|
27
|
+
*
|
|
28
|
+
* export default async function ({ domain }: { domain: string }) {
|
|
29
|
+
* const company = await deepline.tools.execute({
|
|
30
|
+
* id: 'company',
|
|
31
|
+
* tool: 'company_lookup',
|
|
32
|
+
* input: { domain },
|
|
33
|
+
* description: 'Look up the company.',
|
|
32
34
|
* staleAfterSeconds: 0,
|
|
33
|
-
* id: 'company_search',
|
|
34
|
-
* tool: 'test_company_search',
|
|
35
|
-
* input: { domain: input.domain },
|
|
36
|
-
* description: 'Look up company details by domain.',
|
|
37
35
|
* });
|
|
38
|
-
* return company;
|
|
39
|
-
* }
|
|
36
|
+
* return { company };
|
|
37
|
+
* }
|
|
40
38
|
* ```
|
|
41
39
|
*
|
|
42
|
-
*
|
|
43
|
-
* `deepline plays run --file my-play.play.ts`.
|
|
44
|
-
* Installed npm CLIs can also run saved or prebuilt plays by name.
|
|
40
|
+
* Run it with `deepline plays run lookup.play.ts --input '{"domain":"stripe.com"}'`.
|
|
45
41
|
*
|
|
46
42
|
* ### Programmatic usage
|
|
47
43
|
*
|
|
48
44
|
* ```typescript
|
|
49
45
|
* import { Deepline } from 'deepline';
|
|
50
46
|
*
|
|
51
|
-
* const
|
|
52
|
-
* const job = await
|
|
47
|
+
* const client = await Deepline.connect();
|
|
48
|
+
* const job = await client.play('lookup').run({ domain: 'stripe.com' });
|
|
53
49
|
* const result = await job.get(); // Polls until complete
|
|
54
50
|
* ```
|
|
55
51
|
*
|
|
56
|
-
* ### With bindings (cron, webhook)
|
|
57
|
-
*
|
|
58
|
-
* ```typescript
|
|
59
|
-
* import { definePlay } from 'deepline';
|
|
60
|
-
*
|
|
61
|
-
* export default definePlay('daily-sync', async (ctx) => {
|
|
62
|
-
* const data = await ctx.tools.execute({
|
|
63
|
-
* staleAfterSeconds: 0,
|
|
64
|
-
* id: 'crm_export',
|
|
65
|
-
* tool: 'crm_export',
|
|
66
|
-
* input: {},
|
|
67
|
-
* description: 'Export CRM records for the daily sync.',
|
|
68
|
-
* });
|
|
69
|
-
* return data;
|
|
70
|
-
* }, {
|
|
71
|
-
* cron: { schedule: '0 9 * * *', timezone: 'America/New_York' },
|
|
72
|
-
* });
|
|
73
|
-
* ```
|
|
74
|
-
*
|
|
75
52
|
* @module
|
|
76
53
|
*/
|
|
54
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
77
55
|
import { DeeplineClient } from './client';
|
|
78
56
|
import { createPlayClient, type PlayClientOperations } from './plays/client';
|
|
79
57
|
import { DeeplineError } from './errors';
|
|
@@ -189,10 +167,13 @@ export type FetchOptions = PlayAuthoringFetchOptions;
|
|
|
189
167
|
export type PlayFetchResponse = PlayAuthoringFetchResponse;
|
|
190
168
|
|
|
191
169
|
/**
|
|
192
|
-
* Optional Play configuration,
|
|
170
|
+
* Optional Play configuration, declared once at the top of the play file as
|
|
171
|
+
* an object literal: `export const config = { ... };`. Settings: `name`
|
|
172
|
+
* (defaults to the file name), `description`, `displayName`, `cron`,
|
|
173
|
+
* `webhook`, `sqlListeners`, `runtime`, `billing`, `compatibility`. It is
|
|
174
|
+
* read without running the play, so its values must be literals.
|
|
193
175
|
*
|
|
194
|
-
* A play can be triggered three ways
|
|
195
|
-
* {@link definePlay}:
|
|
176
|
+
* A play can be triggered three ways:
|
|
196
177
|
* - `webhook` — an inbound HTTP call (with optional legacy HMAC or Standard
|
|
197
178
|
* Webhooks signature verification).
|
|
198
179
|
* - `cron` — a schedule.
|
|
@@ -201,17 +182,17 @@ export type PlayFetchResponse = PlayAuthoringFetchResponse;
|
|
|
201
182
|
* (e.g. run enrichment every time a watched company posts a new job). Each
|
|
202
183
|
* listener binds to a monitor tool id + one of its output stream keys (see
|
|
203
184
|
* `deepline monitors available <id>` for a tool's streams and row columns).
|
|
204
|
-
* The changed row is delivered
|
|
185
|
+
* The changed row is delivered as the listener event's `after` in the play function's input.
|
|
205
186
|
*
|
|
206
187
|
* The default Play runtime is 30 minutes. For bounded long-running batches, add
|
|
207
188
|
* `runtime: { timeout: '90m', size: 'standard' }`; duration values are whole minutes or hours, up to `4h`.
|
|
208
|
-
* It differs from `
|
|
189
|
+
* It differs from `deepline.tools.execute({ timeoutMs })`, which limits one provider call.
|
|
209
190
|
*
|
|
210
191
|
* @example Webhook with HMAC verification. `secretEnv` is the Deepline Secret
|
|
211
192
|
* name configured with `deepline secrets set`, retained as the legacy field
|
|
212
193
|
* name for SDK compatibility.
|
|
213
194
|
* ```typescript
|
|
214
|
-
*
|
|
195
|
+
* export const config = {
|
|
215
196
|
* webhook: {
|
|
216
197
|
* hmac: {
|
|
217
198
|
* algorithm: 'sha256',
|
|
@@ -221,12 +202,12 @@ export type PlayFetchResponse = PlayAuthoringFetchResponse;
|
|
|
221
202
|
* secretEnv: 'WEBHOOK_SECRET',
|
|
222
203
|
* },
|
|
223
204
|
* },
|
|
224
|
-
* }
|
|
205
|
+
* };
|
|
225
206
|
* ```
|
|
226
207
|
*
|
|
227
208
|
* @example Svix / Standard Webhooks verification with Deepline Secrets
|
|
228
209
|
* ```typescript
|
|
229
|
-
*
|
|
210
|
+
* export const config = {
|
|
230
211
|
* webhook: {
|
|
231
212
|
* auth: {
|
|
232
213
|
* type: 'standard-webhooks',
|
|
@@ -234,19 +215,17 @@ export type PlayFetchResponse = PlayAuthoringFetchResponse;
|
|
|
234
215
|
* signingSecrets: ['VECTOR_WEBHOOK_SECRET'],
|
|
235
216
|
* },
|
|
236
217
|
* },
|
|
237
|
-
* }
|
|
218
|
+
* };
|
|
238
219
|
* ```
|
|
239
220
|
*
|
|
240
221
|
* @example Cron schedule
|
|
241
222
|
* ```typescript
|
|
242
|
-
*
|
|
243
|
-
* cron: { schedule: '0 2 * * *', timezone: 'UTC' },
|
|
244
|
-
* });
|
|
223
|
+
* export const config = { cron: { schedule: '0 2 * * *', timezone: 'UTC' } };
|
|
245
224
|
* ```
|
|
246
225
|
*
|
|
247
226
|
* @example Monitor-triggered (run a play on a monitor's output)
|
|
248
227
|
* ```typescript
|
|
249
|
-
*
|
|
228
|
+
* export const config = {
|
|
250
229
|
* sqlListeners: [
|
|
251
230
|
* {
|
|
252
231
|
* id: 'jobs',
|
|
@@ -255,10 +234,10 @@ export type PlayFetchResponse = PlayAuthoringFetchResponse;
|
|
|
255
234
|
* operations: ['INSERT'],
|
|
256
235
|
* },
|
|
257
236
|
* ],
|
|
258
|
-
* }
|
|
237
|
+
* };
|
|
259
238
|
* ```
|
|
260
239
|
*
|
|
261
|
-
* @sdkReference runtime
|
|
240
|
+
* @sdkReference runtime 006 export const config
|
|
262
241
|
*/
|
|
263
242
|
export type PlayBindings<TInput = Record<string, unknown>> =
|
|
264
243
|
PlayAuthoringBindings<TInput>;
|
|
@@ -270,7 +249,7 @@ export type SqlListenerDeclaration = PlaySqlListenerDeclaration;
|
|
|
270
249
|
export type SqlListenerEvent<T extends object = Record<string, unknown>> =
|
|
271
250
|
PlaySqlListenerEvent<T>;
|
|
272
251
|
|
|
273
|
-
/** @deprecated Pass a SQL string directly to
|
|
252
|
+
/** @deprecated Pass a SQL string directly to deepline.customerDb.query. */
|
|
274
253
|
export type SqlQuery = PlaySqlQuery;
|
|
275
254
|
export type SecretHandle = PlaySecretHandle;
|
|
276
255
|
export type SecretPromise = PlaySecretPromise;
|
|
@@ -311,7 +290,7 @@ export type {
|
|
|
311
290
|
export type { PreviousCell } from '../../shared_libs/plays/cell-staleness.js';
|
|
312
291
|
|
|
313
292
|
/**
|
|
314
|
-
* Keyword-style request object for `
|
|
293
|
+
* Keyword-style request object for `deepline.tools.execute(...)`.
|
|
315
294
|
*
|
|
316
295
|
* The `tool` value comes from live tool discovery. The `id` is the stable
|
|
317
296
|
* logical call name used for logs, metadata, and result-cache identity. Provider
|
|
@@ -397,7 +376,7 @@ export type RunnableStepProgram<TInput, TOutput> = Pick<
|
|
|
397
376
|
> & { readonly __inputType?: (input: TInput) => void };
|
|
398
377
|
|
|
399
378
|
/**
|
|
400
|
-
* Builder returned by `
|
|
379
|
+
* Builder returned by `deepline.dataset(...)` for row-level durable columns.
|
|
401
380
|
*
|
|
402
381
|
* @sdkReference runtime 070 .dataset(...).withColumn(name, resolver).run(options)
|
|
403
382
|
*/
|
|
@@ -438,58 +417,195 @@ export type CsvInput<TRow extends object = Record<string, unknown>> =
|
|
|
438
417
|
export type ColumnMap<TRow extends object> = PlayAuthoringColumnMap<TRow>;
|
|
439
418
|
|
|
440
419
|
/**
|
|
441
|
-
* Options for loading a staged CSV with `
|
|
420
|
+
* Options for loading a staged CSV with `deepline.csv(...)`.
|
|
442
421
|
*
|
|
443
422
|
* @sdkReference runtime 050
|
|
444
423
|
*/
|
|
445
424
|
export type CsvOptions = PlayAuthoringCsvOptions;
|
|
446
425
|
|
|
447
426
|
/**
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
* Provides methods for calling tools, processing data, and emitting logs.
|
|
451
|
-
* This context is injected by the Temporal worker — you never construct it directly.
|
|
427
|
+
* The play runtime: every member of `deepline` except `config`, `input` and
|
|
428
|
+
* `output`. Use it to type a helper module's parameter; pass `deepline` in.
|
|
452
429
|
*
|
|
453
430
|
* @example
|
|
454
431
|
* ```typescript
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
*
|
|
432
|
+
* // enrich.ts
|
|
433
|
+
* import type { DeeplinePlayRuntimeContext } from 'deepline';
|
|
434
|
+
*
|
|
435
|
+
* export function lookUp(deepline: DeeplinePlayRuntimeContext, domain: string) {
|
|
436
|
+
* return deepline.tools.execute({
|
|
437
|
+
* id: 'company',
|
|
438
|
+
* tool: 'company_lookup',
|
|
439
|
+
* input: { domain },
|
|
440
|
+
* description: 'Look up the company.',
|
|
441
|
+
* });
|
|
442
|
+
* }
|
|
443
|
+
* ```
|
|
444
|
+
*/
|
|
445
|
+
export type DeeplinePlayRuntimeContext = PlayAuthoringRuntimeContext<'array'>;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* `import deepline from 'deepline'` — the play runtime. A play is a
|
|
449
|
+
* `.play.ts` file that default-exports an async function of its input; the
|
|
450
|
+
* file name is the play name. The parameter's type is the input contract and
|
|
451
|
+
* the returned object is the result. Every
|
|
452
|
+
* runtime call below is `deepline.<name>`, including inside dataset resolvers
|
|
453
|
+
* and step bodies.
|
|
454
|
+
*
|
|
455
|
+
* ```ts
|
|
456
|
+
* import deepline from 'deepline';
|
|
457
|
+
*
|
|
458
|
+
* export default async function (input: { domain: string }) {
|
|
459
|
+
* const company = await deepline.tools.execute({
|
|
460
|
+
* id: 'company',
|
|
461
|
+
* tool: 'company_lookup',
|
|
460
462
|
* input: { domain: input.domain },
|
|
461
|
-
* description: 'Look up company
|
|
463
|
+
* description: 'Look up the company.',
|
|
464
|
+
* staleAfterSeconds: 0,
|
|
462
465
|
* });
|
|
466
|
+
* return { company };
|
|
467
|
+
* }
|
|
468
|
+
* ```
|
|
463
469
|
*
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
*
|
|
468
|
-
* rowCtx.tools.execute({
|
|
469
|
-
* id: 'company_search',
|
|
470
|
-
* tool: 'test_company_search',
|
|
471
|
-
* input: { domain: row.domain },
|
|
472
|
-
* description: 'Look up company details by domain.',
|
|
473
|
-
* }))
|
|
474
|
-
* .run({ description: 'Look up company details.' });
|
|
475
|
-
*
|
|
476
|
-
* // Load CSV data from a submitted play input field.
|
|
477
|
-
* const leads = await ctx.csv(input.csv);
|
|
478
|
-
*
|
|
479
|
-
* // Emit a log line (visible in `play tail`)
|
|
480
|
-
* ctx.log(`Loaded ${await leads.count()} leads`);
|
|
470
|
+
* ```bash
|
|
471
|
+
* deepline plays run lookup.play.ts --input '{"domain":"stripe.com"}'
|
|
472
|
+
* deepline plays run -e 'deepline.log("hello"); return { ok: true };'
|
|
473
|
+
* ```
|
|
481
474
|
*
|
|
482
|
-
*
|
|
483
|
-
*
|
|
475
|
+
* Compose with `import child from './child.play'` and
|
|
476
|
+
* `await deepline.runPlay('key', child, input, { description })`, or by name.
|
|
477
|
+
* `deepline` works only in the play file; pass it to helper modules as an
|
|
478
|
+
* argument typed {@link DeeplinePlayRuntimeContext}. The file exports only
|
|
479
|
+
* the play function and, optionally, its `config`.
|
|
484
480
|
*
|
|
485
|
-
*
|
|
486
|
-
|
|
481
|
+
* @sdkReference runtime 005 deepline
|
|
482
|
+
*/
|
|
483
|
+
export type ScriptPlayContext = DeeplinePlayRuntimeContext & {
|
|
484
|
+
/** The same settings as `export const config = { ... }`. */
|
|
485
|
+
config(config: PlayBindings & { name?: string }): void;
|
|
486
|
+
/**
|
|
487
|
+
* The run's input. A play function receives it as its parameter instead;
|
|
488
|
+
* this is not called at the top of a play file.
|
|
489
|
+
*/
|
|
490
|
+
input<TInput = Record<string, unknown>>(): TInput;
|
|
491
|
+
/**
|
|
492
|
+
* Sets the play's result; deepline calls after it fail. A play function
|
|
493
|
+
* returns its result instead; this is not called at the top of a play file.
|
|
494
|
+
*/
|
|
495
|
+
output(result: PlayReturnObject): void;
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
/** The run a script play is executing in: its context, input and result. */
|
|
499
|
+
type ScriptRun = {
|
|
500
|
+
readonly context: DeeplinePlayRuntimeContext;
|
|
501
|
+
readonly input: unknown;
|
|
502
|
+
/** Set by `deepline.output`, the run's last deepline call. */
|
|
503
|
+
result: PlayReturnObject | null;
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
const scriptRuns = new AsyncLocalStorage<ScriptRun>();
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* The run whose context a callback the runtime invokes outside the play's
|
|
510
|
+
* async flow belongs to, such as a dataset `key` function called while rows
|
|
511
|
+
* persist. Each play artifact bundles its own SDK and the runner builds an
|
|
512
|
+
* artifact module per run, so it is the last run started outside any run: a
|
|
513
|
+
* nested inline run must not hand the outer run's callbacks its context.
|
|
514
|
+
*/
|
|
515
|
+
let latestScriptRun: ScriptRun | null = null;
|
|
516
|
+
|
|
517
|
+
/** The three script calls; every other member is the run's context. */
|
|
518
|
+
const scriptCalls = {
|
|
519
|
+
// Read statically before the run; nothing to do while it executes.
|
|
520
|
+
config: () => () => undefined,
|
|
521
|
+
input: (run: ScriptRun) => () => run.input,
|
|
522
|
+
// Returns the value so an `$output` diagram node observes the result.
|
|
523
|
+
output: (run: ScriptRun) => (result: PlayReturnObject) =>
|
|
524
|
+
(run.result = playResult(result, 'deepline.output(...)')),
|
|
525
|
+
} satisfies Record<string, (run: ScriptRun) => unknown>;
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Runs a play module's body with `deepline` bound to this run. The bundler
|
|
529
|
+
* wraps the module's code, and the dispatch to its default-exported play
|
|
530
|
+
* function, in this call, so the artifact keeps the runner's
|
|
531
|
+
* `(context, input) => result` contract.
|
|
487
532
|
*
|
|
488
|
-
*
|
|
489
|
-
* });
|
|
490
|
-
* ```
|
|
533
|
+
* @internal
|
|
491
534
|
*/
|
|
492
|
-
export
|
|
535
|
+
export async function runScriptPlay(
|
|
536
|
+
context: DeeplinePlayRuntimeContext,
|
|
537
|
+
input: unknown,
|
|
538
|
+
body: () => Promise<unknown>,
|
|
539
|
+
): Promise<PlayReturnObject> {
|
|
540
|
+
const run: ScriptRun = { context, input, result: null };
|
|
541
|
+
if (!scriptRuns.getStore()) latestScriptRun = run;
|
|
542
|
+
// The play function's return, or a top-level `return value`, is the
|
|
543
|
+
// result, as `return` is in a definePlay handler; otherwise output set it.
|
|
544
|
+
const returned = await scriptRuns.run(run, body);
|
|
545
|
+
if (returned !== undefined)
|
|
546
|
+
return playResult(returned, "A play's return value");
|
|
547
|
+
return run.result ?? {};
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
/** A play's result is a plain object, from `return` or `deepline.output`. */
|
|
551
|
+
function playResult(value: unknown, source: string): PlayReturnObject {
|
|
552
|
+
const prototype =
|
|
553
|
+
value !== null && typeof value === 'object'
|
|
554
|
+
? Object.getPrototypeOf(value)
|
|
555
|
+
: undefined;
|
|
556
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
557
|
+
throw new Error(
|
|
558
|
+
`${source} must be a plain object, such as { company }; got ${Array.isArray(value) ? 'an array' : value === null ? 'null' : typeof value}.`,
|
|
559
|
+
);
|
|
560
|
+
}
|
|
561
|
+
return value as PlayReturnObject;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* The live play runtime for a script play. Inside a run it is that run's
|
|
566
|
+
* context (bound per async flow, so concurrent rows and steps keep their own
|
|
567
|
+
* scope); anywhere else, using it is a mistake worth a clear error.
|
|
568
|
+
*/
|
|
569
|
+
export const deepline: ScriptPlayContext = new Proxy({} as ScriptPlayContext, {
|
|
570
|
+
get(_target, property) {
|
|
571
|
+
if (typeof property !== 'string' || property === 'then') return undefined;
|
|
572
|
+
// Config is read statically; its call does nothing at run time.
|
|
573
|
+
if (property === 'config') return scriptCalls.config();
|
|
574
|
+
const run = scriptRuns.getStore();
|
|
575
|
+
if (!run) {
|
|
576
|
+
if (!latestScriptRun) {
|
|
577
|
+
throw new Error(
|
|
578
|
+
`deepline.${property} is only available while a play runs. Run the file with: deepline plays run <file>.play.ts`,
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
if (Object.hasOwn(scriptCalls, property)) {
|
|
582
|
+
throw new Error(
|
|
583
|
+
`deepline.${property}() belongs in the play's own code, not in a callback the runtime calls later.`,
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
return contextMember(latestScriptRun.context, property);
|
|
587
|
+
}
|
|
588
|
+
if (run.result !== null) {
|
|
589
|
+
// Code after output still runs; a deepline call there would do work the
|
|
590
|
+
// result no longer reflects. A `return` ends a play early.
|
|
591
|
+
throw new Error(
|
|
592
|
+
`deepline.${property} was called after deepline.output(...). Return the play's result from its function instead: return { ... }.`,
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
if (Object.hasOwn(scriptCalls, property)) {
|
|
596
|
+
return scriptCalls[property as keyof typeof scriptCalls](run);
|
|
597
|
+
}
|
|
598
|
+
return contextMember(run.context, property);
|
|
599
|
+
},
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
function contextMember(
|
|
603
|
+
context: DeeplinePlayRuntimeContext,
|
|
604
|
+
property: string,
|
|
605
|
+
): unknown {
|
|
606
|
+
const value: unknown = Reflect.get(context, property);
|
|
607
|
+
return typeof value === 'function' ? value.bind(context) : value;
|
|
608
|
+
}
|
|
493
609
|
|
|
494
610
|
/**
|
|
495
611
|
* Handle to a Play execution: inspect status, stream logs, await output, or cancel.
|
|
@@ -501,7 +617,8 @@ export type DeeplinePlayRuntimeContext = PlayAuthoringRuntimeContext<'array'>;
|
|
|
501
617
|
*
|
|
502
618
|
* @example
|
|
503
619
|
* ```typescript
|
|
504
|
-
* const
|
|
620
|
+
* const client = await Deepline.connect();
|
|
621
|
+
* const job: PlayJob = await client.play('my-play').run({ domain: 'stripe.com' });
|
|
505
622
|
*
|
|
506
623
|
* // Poll status
|
|
507
624
|
* const status = await job.status();
|
|
@@ -572,8 +689,8 @@ export interface PlayJob<TOutput = unknown> {
|
|
|
572
689
|
*
|
|
573
690
|
* @example
|
|
574
691
|
* ```typescript
|
|
575
|
-
* const
|
|
576
|
-
* const play =
|
|
692
|
+
* const client = await Deepline.connect();
|
|
693
|
+
* const play = client.play<{ domain: string }, Company>('company-lookup');
|
|
577
694
|
*
|
|
578
695
|
* // Get play definition
|
|
579
696
|
* const detail = await play.get();
|
|
@@ -659,8 +776,8 @@ export type DeeplineToolCallOptions = Pick<
|
|
|
659
776
|
* Tool/provider operations available from a connected {@link DeeplineContext}.
|
|
660
777
|
*
|
|
661
778
|
* This namespace is for regular SDK callers outside a play runtime. Inside a
|
|
662
|
-
*
|
|
663
|
-
*
|
|
779
|
+
* play, use `deepline.tools.execute({ id, tool, input, ... })` so provider
|
|
780
|
+
* calls become durable runtime checkpoints.
|
|
664
781
|
*
|
|
665
782
|
* @sdkReference tools 010 DeeplineContext.tools
|
|
666
783
|
*/
|
|
@@ -678,7 +795,7 @@ export type DeeplineToolsNamespace = {
|
|
|
678
795
|
/**
|
|
679
796
|
* Execute a provider-backed tool from a regular SDK process.
|
|
680
797
|
*
|
|
681
|
-
* For durable play code, prefer `
|
|
798
|
+
* For durable play code, prefer `deepline.tools.execute(...)` because the play
|
|
682
799
|
* runtime records the call under a stable id.
|
|
683
800
|
*/
|
|
684
801
|
execute(
|
|
@@ -722,7 +839,7 @@ export type PlayReferenceLike<
|
|
|
722
839
|
TInput extends Record<string, unknown> = Record<string, unknown>,
|
|
723
840
|
> = PlayAuthoringReferenceLike<TInput>;
|
|
724
841
|
|
|
725
|
-
/** Branded durable identity returned by
|
|
842
|
+
/** Branded durable identity returned by deepline.runPlayAsync. */
|
|
726
843
|
export type PlayRunId = PlayAuthoringRunId;
|
|
727
844
|
|
|
728
845
|
/** Serializable reference to an independently scheduled Play Run. */
|
|
@@ -741,14 +858,9 @@ export type PlayReturnObject = PlayAuthoringReturnObject;
|
|
|
741
858
|
export type PlayInputContract<TInput> = PlayAuthoringInputContract<TInput>;
|
|
742
859
|
|
|
743
860
|
/**
|
|
744
|
-
* Object-form
|
|
861
|
+
* Object-form config accepted by the older `definePlay(config)` form. Files
|
|
862
|
+
* that export `definePlay(...)` keep working; new plays use {@link deepline}.
|
|
745
863
|
*
|
|
746
|
-
* Use this form when the input contract should be explicit at definition time
|
|
747
|
-
* through `defineInput<T>(schema)`, or when configuration reads clearer as one
|
|
748
|
-
* object. The shorthand `definePlay(name, fn, bindings?)` is equivalent for
|
|
749
|
-
* simple file-backed plays.
|
|
750
|
-
*
|
|
751
|
-
* @sdkReference runtime 020
|
|
752
864
|
*/
|
|
753
865
|
export type DefinePlayConfig<
|
|
754
866
|
TInput,
|
|
@@ -1150,7 +1262,7 @@ export class DeeplineContext {
|
|
|
1150
1262
|
* Play discovery and named-play handles.
|
|
1151
1263
|
*
|
|
1152
1264
|
* Use `plays.list()` for discovery and `plays.get(name)` when you prefer a
|
|
1153
|
-
* namespace spelling over `
|
|
1265
|
+
* namespace spelling over `play(name)`.
|
|
1154
1266
|
*/
|
|
1155
1267
|
get plays(): DeeplinePlaysNamespace {
|
|
1156
1268
|
return {
|
|
@@ -1166,7 +1278,7 @@ export class DeeplineContext {
|
|
|
1166
1278
|
*
|
|
1167
1279
|
* Known prebuilts are exposed by camel-cased aliases. Any other property is
|
|
1168
1280
|
* converted into `prebuilt/<property>` so callers can pass the reference to
|
|
1169
|
-
* `
|
|
1281
|
+
* `deepline.runPlay(...)` inside a play.
|
|
1170
1282
|
*/
|
|
1171
1283
|
get prebuilt(): Record<string, PrebuiltPlayRef> {
|
|
1172
1284
|
const explicit = {
|
|
@@ -1217,7 +1329,7 @@ export class DeeplineContext {
|
|
|
1217
1329
|
*
|
|
1218
1330
|
* @example
|
|
1219
1331
|
* ```typescript
|
|
1220
|
-
* const play =
|
|
1332
|
+
* const play = client.play<{ domain: string }>('email-waterfall');
|
|
1221
1333
|
* const job = await play.run({ domain: 'stripe.com' });
|
|
1222
1334
|
* const result = await job.get();
|
|
1223
1335
|
* ```
|
|
@@ -1231,8 +1343,8 @@ export class DeeplineContext {
|
|
|
1231
1343
|
/**
|
|
1232
1344
|
* Run a named or prebuilt play and wait for its output.
|
|
1233
1345
|
*
|
|
1234
|
-
* This is the high-level SDK equivalent of `
|
|
1235
|
-
* Inside a
|
|
1346
|
+
* This is the high-level SDK equivalent of `client.play(name).runSync(input)`.
|
|
1347
|
+
* Inside a play, use `deepline.runPlay(key, playRef, input, options)`.
|
|
1236
1348
|
* The runtime checkpoints the child run under a stable key.
|
|
1237
1349
|
*
|
|
1238
1350
|
* @param playOrRef - Play name or prebuilt/reference object.
|
|
@@ -1641,12 +1753,8 @@ export function defineInput<TInput>(
|
|
|
1641
1753
|
}
|
|
1642
1754
|
|
|
1643
1755
|
/**
|
|
1644
|
-
*
|
|
1645
|
-
*
|
|
1646
|
-
* The returned value is both a callable function and a named Play handle.
|
|
1647
|
-
* The Deepline runtime calls the function with a runtime context.
|
|
1648
|
-
* The handle provides `.run()`, `.versions()`, `.get()`, and `.publish()` for remote lifecycle operations.
|
|
1649
|
-
* Plays define repeatable data pipelines. The runtime executes them durably with automatic retries and timeouts.
|
|
1756
|
+
* The older play form. Files that export `definePlay(...)` keep working; new
|
|
1757
|
+
* plays are scripts that use {@link deepline}.
|
|
1650
1758
|
*
|
|
1651
1759
|
* @typeParam TInput - The input type accepted by the play
|
|
1652
1760
|
* @typeParam TOutput - The return type of the play
|
|
@@ -1655,70 +1763,6 @@ export function defineInput<TInput>(
|
|
|
1655
1763
|
* @param fn - Play function.
|
|
1656
1764
|
* @param bindings - Play configuration, including runtime limits and triggers.
|
|
1657
1765
|
* @returns A {@link DefinedPlay} that is both callable and has lifecycle methods
|
|
1658
|
-
*
|
|
1659
|
-
* @example Basic play
|
|
1660
|
-
* ```typescript
|
|
1661
|
-
* import { definePlay } from 'deepline';
|
|
1662
|
-
*
|
|
1663
|
-
* export default definePlay('company-lookup', async (ctx, input: { domain: string }) => {
|
|
1664
|
-
* ctx.log(`Searching for ${input.domain}`);
|
|
1665
|
-
* const company = await ctx.tools.execute({
|
|
1666
|
-
* id: 'company_search',
|
|
1667
|
-
* tool: 'test_company_search',
|
|
1668
|
-
* input: { domain: input.domain },
|
|
1669
|
-
* description: 'Look up company details by domain.',
|
|
1670
|
-
* });
|
|
1671
|
-
* return company;
|
|
1672
|
-
* });
|
|
1673
|
-
* ```
|
|
1674
|
-
*
|
|
1675
|
-
* @example CSV processing play
|
|
1676
|
-
* ```typescript
|
|
1677
|
-
* export default definePlay('bulk-enrich', async (ctx, input: { csv: string }) => {
|
|
1678
|
-
* const leads = await ctx.csv(input.csv);
|
|
1679
|
-
* ctx.log(`Processing ${await leads.count()} rows`);
|
|
1680
|
-
* const results = await ctx
|
|
1681
|
-
* .dataset('companies', leads)
|
|
1682
|
-
* .withColumn('company', (row, ctx) =>
|
|
1683
|
-
* ctx.tools.execute({
|
|
1684
|
-
* id: 'company_search',
|
|
1685
|
-
* tool: 'test_company_search',
|
|
1686
|
-
* input: { domain: row.domain },
|
|
1687
|
-
* description: 'Look up company details by domain.',
|
|
1688
|
-
* }))
|
|
1689
|
-
* .run({ description: 'Enrich lead companies.' });
|
|
1690
|
-
* return results;
|
|
1691
|
-
* });
|
|
1692
|
-
* ```
|
|
1693
|
-
*
|
|
1694
|
-
* @example With cron binding
|
|
1695
|
-
* ```typescript
|
|
1696
|
-
* export default definePlay('daily-report', async (ctx) => {
|
|
1697
|
-
* const data = await ctx.tools.execute({
|
|
1698
|
-
* id: 'crm_export',
|
|
1699
|
-
* tool: 'crm_export',
|
|
1700
|
-
* input: { since: 'yesterday' },
|
|
1701
|
-
* description: 'Export yesterday CRM records.',
|
|
1702
|
-
* });
|
|
1703
|
-
* return data;
|
|
1704
|
-
* }, {
|
|
1705
|
-
* cron: { schedule: '0 9 * * *', timezone: 'America/New_York' },
|
|
1706
|
-
* });
|
|
1707
|
-
* ```
|
|
1708
|
-
*
|
|
1709
|
-
* @example Programmatic lifecycle
|
|
1710
|
-
* ```typescript
|
|
1711
|
-
* const myPlay = definePlay('my-play', handler);
|
|
1712
|
-
*
|
|
1713
|
-
* // Get play definition:
|
|
1714
|
-
* const detail = await myPlay.get();
|
|
1715
|
-
*
|
|
1716
|
-
* // Run remotely:
|
|
1717
|
-
* const result = await myPlay.runSync({ domain: 'stripe.com' });
|
|
1718
|
-
*
|
|
1719
|
-
* // Make the current draft live:
|
|
1720
|
-
* await myPlay.publish();
|
|
1721
|
-
* ```
|
|
1722
1766
|
*/
|
|
1723
1767
|
export function definePlay<TInput, TOutput extends PlayReturnObject>(
|
|
1724
1768
|
config: DefinePlayConfig<TInput, TOutput>,
|
|
@@ -1752,7 +1796,6 @@ export function definePlay<
|
|
|
1752
1796
|
): DefinedPlay<PlayHandlerInput<THandler>, PlayHandlerOutput<THandler>>;
|
|
1753
1797
|
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
1754
1798
|
/**
|
|
1755
|
-
* @sdkReference runtime 010
|
|
1756
1799
|
*/
|
|
1757
1800
|
export function definePlay<TInput, TOutput extends PlayReturnObject>(
|
|
1758
1801
|
nameOrConfig: string | DefinePlayConfig<TInput, TOutput>,
|