deepline 0.1.83 → 0.1.88
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 +481 -79
- package/dist/cli/index.mjs +500 -92
- package/dist/index.d.mts +604 -28
- package/dist/index.d.ts +604 -28
- package/dist/index.js +274 -4
- package/dist/index.mjs +269 -4
- package/dist/repo/apps/play-runner-workers/src/dedup-do.ts +1 -0
- package/dist/repo/apps/play-runner-workers/src/entry.ts +345 -72
- package/dist/repo/sdk/src/client.ts +155 -1
- package/dist/repo/sdk/src/http.ts +11 -0
- package/dist/repo/sdk/src/index.ts +35 -1
- package/dist/repo/sdk/src/play.ts +254 -15
- package/dist/repo/sdk/src/plays/harness-stub.ts +2 -1
- package/dist/repo/sdk/src/release.ts +2 -2
- package/dist/repo/sdk/src/types.ts +65 -0
- package/dist/repo/sdk/src/worker-play-entry.ts +6 -3
- package/dist/repo/shared_libs/play-runtime/cell-staleness.ts +179 -7
- package/dist/repo/shared_libs/play-runtime/coordinator-headers.ts +10 -0
- package/dist/repo/shared_libs/play-runtime/execution-plan.ts +3 -3
- package/dist/repo/shared_libs/play-runtime/extractor-targets.ts +106 -0
- package/dist/repo/shared_libs/play-runtime/providers.ts +28 -0
- package/dist/repo/shared_libs/play-runtime/scheduler-backend.ts +21 -1
- package/dist/repo/shared_libs/play-runtime/step-program-dataset-builder.ts +96 -6
- package/dist/repo/shared_libs/play-runtime/tool-result.ts +82 -0
- package/dist/repo/shared_libs/plays/bundling/index.ts +23 -16
- package/dist/repo/shared_libs/plays/dataset.ts +2 -0
- package/dist/repo/shared_libs/plays/static-pipeline.ts +133 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -22,11 +22,15 @@ var src_exports = {};
|
|
|
22
22
|
__export(src_exports, {
|
|
23
23
|
AuthError: () => AuthError,
|
|
24
24
|
ConfigError: () => ConfigError,
|
|
25
|
+
DEEPLINE_EXTRACTOR_TARGETS: () => DEEPLINE_EXTRACTOR_TARGETS,
|
|
26
|
+
DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS: () => DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS,
|
|
25
27
|
DEEPLINE_TOOL_CATEGORIES: () => DEEPLINE_TOOL_CATEGORIES,
|
|
26
28
|
Deepline: () => Deepline,
|
|
27
29
|
DeeplineClient: () => DeeplineClient,
|
|
28
30
|
DeeplineContext: () => DeeplineContext,
|
|
29
31
|
DeeplineError: () => DeeplineError,
|
|
32
|
+
JOB_CHANGE_STATUS_VALUES: () => JOB_CHANGE_STATUS_VALUES,
|
|
33
|
+
PHONE_STATUS_VALUES: () => PHONE_STATUS_VALUES,
|
|
30
34
|
PLAY_BOOTSTRAP_COMPANY_FIELDS: () => PLAY_BOOTSTRAP_COMPANY_FIELDS,
|
|
31
35
|
PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY: () => PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY,
|
|
32
36
|
PLAY_BOOTSTRAP_CONTACT_FIELDS: () => PLAY_BOOTSTRAP_CONTACT_FIELDS,
|
|
@@ -49,6 +53,7 @@ __export(src_exports, {
|
|
|
49
53
|
formatPlayBootstrapFinderKindsForSentence: () => formatPlayBootstrapFinderKindsForSentence,
|
|
50
54
|
formatPlayBootstrapTemplates: () => formatPlayBootstrapTemplates,
|
|
51
55
|
getDefinedPlayMetadata: () => getDefinedPlayMetadata,
|
|
56
|
+
isDeeplineExtractorTarget: () => isDeeplineExtractorTarget,
|
|
52
57
|
isPlayBootstrapFinderKind: () => isPlayBootstrapFinderKind,
|
|
53
58
|
isPlayBootstrapTemplate: () => isPlayBootstrapTemplate,
|
|
54
59
|
resolveConfig: () => resolveConfig,
|
|
@@ -241,10 +246,10 @@ var import_node_path2 = require("path");
|
|
|
241
246
|
|
|
242
247
|
// src/release.ts
|
|
243
248
|
var SDK_RELEASE = {
|
|
244
|
-
version: "0.1.
|
|
249
|
+
version: "0.1.88",
|
|
245
250
|
apiContract: "2026-06-dataset-column-cell-stale-hard-cutover",
|
|
246
251
|
supportPolicy: {
|
|
247
|
-
latest: "0.1.
|
|
252
|
+
latest: "0.1.88",
|
|
248
253
|
minimumSupported: "0.1.53",
|
|
249
254
|
deprecatedBelow: "0.1.53"
|
|
250
255
|
}
|
|
@@ -258,6 +263,7 @@ var SDK_API_CONTRACT = SDK_RELEASE.apiContract;
|
|
|
258
263
|
var COORDINATOR_INTERNAL_TOKEN_HEADER = "x-deepline-internal-token";
|
|
259
264
|
var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
|
|
260
265
|
var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
|
|
266
|
+
var SYNTHETIC_RUN_HEADER = "x-deepline-synthetic-run";
|
|
261
267
|
|
|
262
268
|
// src/http.ts
|
|
263
269
|
var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
|
|
@@ -325,6 +331,10 @@ var HttpClient = class {
|
|
|
325
331
|
if (workerCallbackUrl?.trim()) {
|
|
326
332
|
headers[WORKER_CALLBACK_URL_OVERRIDE_HEADER] = workerCallbackUrl.trim();
|
|
327
333
|
}
|
|
334
|
+
const syntheticRun = typeof process !== "undefined" ? process.env?.DEEPLINE_SYNTHETIC_RUN : void 0;
|
|
335
|
+
if (syntheticRun && syntheticRun.trim() && syntheticRun.trim() !== "0") {
|
|
336
|
+
headers[SYNTHETIC_RUN_HEADER] = "1";
|
|
337
|
+
}
|
|
328
338
|
return headers;
|
|
329
339
|
}
|
|
330
340
|
/**
|
|
@@ -615,6 +625,21 @@ function isTransientCompileManifestError(error) {
|
|
|
615
625
|
function isRecord(value) {
|
|
616
626
|
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
617
627
|
}
|
|
628
|
+
function isPrebuiltPlayDescription(play) {
|
|
629
|
+
return play.origin === "prebuilt" || play.ownerType === "deepline";
|
|
630
|
+
}
|
|
631
|
+
function preferPrebuiltPlayDescriptions(plays) {
|
|
632
|
+
const prebuilt = [];
|
|
633
|
+
const owned = [];
|
|
634
|
+
for (const play of plays) {
|
|
635
|
+
if (isPrebuiltPlayDescription(play)) {
|
|
636
|
+
prebuilt.push(play);
|
|
637
|
+
} else {
|
|
638
|
+
owned.push(play);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return [...prebuilt, ...owned];
|
|
642
|
+
}
|
|
618
643
|
function isPlayRunPackage(value) {
|
|
619
644
|
return Boolean(
|
|
620
645
|
value && typeof value === "object" && !Array.isArray(value) && value.kind === "play_run" && value.run && typeof value.run?.id === "string"
|
|
@@ -738,8 +763,14 @@ function playRunStatusFromState(state) {
|
|
|
738
763
|
var DeeplineClient = class {
|
|
739
764
|
http;
|
|
740
765
|
config;
|
|
766
|
+
/** Canonical run lifecycle namespace backed by `/api/v2/runs`. */
|
|
741
767
|
runs;
|
|
742
768
|
/**
|
|
769
|
+
* Create a low-level SDK client.
|
|
770
|
+
*
|
|
771
|
+
* Most callers can omit options and let the SDK resolve auth/config from
|
|
772
|
+
* environment variables and CLI-managed credentials.
|
|
773
|
+
*
|
|
743
774
|
* @param options - Optional overrides for API key, base URL, timeout, and retries.
|
|
744
775
|
* @throws {@link ConfigError} if no API key can be resolved from any source.
|
|
745
776
|
*/
|
|
@@ -841,12 +872,19 @@ var DeeplineClient = class {
|
|
|
841
872
|
// ——————————————————————————————————————————————————————————
|
|
842
873
|
// Secrets
|
|
843
874
|
// ——————————————————————————————————————————————————————————
|
|
875
|
+
/** List secret metadata visible to the current workspace. */
|
|
844
876
|
async listSecrets() {
|
|
845
877
|
const response = await this.http.get(
|
|
846
878
|
"/api/v2/secrets"
|
|
847
879
|
);
|
|
848
880
|
return Array.isArray(response.secrets) ? response.secrets : [];
|
|
849
881
|
}
|
|
882
|
+
/**
|
|
883
|
+
* Check whether a named secret exists, is active, and has a stored value.
|
|
884
|
+
*
|
|
885
|
+
* @param name - Secret name. It is normalized to uppercase before lookup.
|
|
886
|
+
* @returns Matching active secret metadata, or `null`.
|
|
887
|
+
*/
|
|
850
888
|
async checkSecret(name) {
|
|
851
889
|
const normalized = name.trim().toUpperCase();
|
|
852
890
|
const secrets = await this.listSecrets();
|
|
@@ -959,9 +997,21 @@ var DeeplineClient = class {
|
|
|
959
997
|
headers
|
|
960
998
|
);
|
|
961
999
|
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Back-compatible alias for {@link executeTool}.
|
|
1002
|
+
*
|
|
1003
|
+
* Retained for callers that still use the older raw naming while the response
|
|
1004
|
+
* envelope remains the same.
|
|
1005
|
+
*/
|
|
962
1006
|
async executeToolRaw(toolId, input, options) {
|
|
963
1007
|
return this.executeTool(toolId, input, options);
|
|
964
1008
|
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Run a bounded SQL query against the customer data plane.
|
|
1011
|
+
*
|
|
1012
|
+
* Use this from trusted backend or agent contexts only. The API enforces
|
|
1013
|
+
* workspace scoping and row limits.
|
|
1014
|
+
*/
|
|
965
1015
|
async queryCustomerDb(input) {
|
|
966
1016
|
return this.http.post("/api/v2/db/query", {
|
|
967
1017
|
sql: input.sql,
|
|
@@ -1033,6 +1083,17 @@ var DeeplineClient = class {
|
|
|
1033
1083
|
);
|
|
1034
1084
|
return normalizePlayRunStart(response);
|
|
1035
1085
|
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Start a play run and stream live runtime events from the same request.
|
|
1088
|
+
*
|
|
1089
|
+
* Use this when a caller wants low-level event handling instead of submitting
|
|
1090
|
+
* first and then connecting to `streamPlayRunEvents(runId)`.
|
|
1091
|
+
*
|
|
1092
|
+
* @param request - Play run configuration.
|
|
1093
|
+
* @param options - Optional streaming options.
|
|
1094
|
+
* @param options.signal - Optional abort signal for the streaming request.
|
|
1095
|
+
* @returns Async stream of play-scoped live events.
|
|
1096
|
+
*/
|
|
1036
1097
|
async *startPlayRunStream(request, options) {
|
|
1037
1098
|
const body = {
|
|
1038
1099
|
...request.name ? { name: request.name } : {},
|
|
@@ -1085,6 +1146,12 @@ var DeeplineClient = class {
|
|
|
1085
1146
|
compilerManifest
|
|
1086
1147
|
});
|
|
1087
1148
|
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Register multiple bundled play artifacts in one request.
|
|
1151
|
+
*
|
|
1152
|
+
* Used by packaging and prebuilt publication flows. Each artifact is compiled
|
|
1153
|
+
* first when a compiler manifest is not already supplied.
|
|
1154
|
+
*/
|
|
1088
1155
|
async registerPlayArtifacts(artifacts) {
|
|
1089
1156
|
const compiledArtifacts = await Promise.all(
|
|
1090
1157
|
artifacts.map(async (artifact) => ({
|
|
@@ -1101,6 +1168,13 @@ var DeeplineClient = class {
|
|
|
1101
1168
|
artifacts: compiledArtifacts
|
|
1102
1169
|
});
|
|
1103
1170
|
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Compile a bundled play artifact into the server-side compiler manifest.
|
|
1173
|
+
*
|
|
1174
|
+
* The manifest records imports, trigger bindings, static pipeline shape, and
|
|
1175
|
+
* runtime metadata needed before a play artifact can be checked, registered,
|
|
1176
|
+
* or run.
|
|
1177
|
+
*/
|
|
1104
1178
|
async compilePlayManifest(input) {
|
|
1105
1179
|
const retryDelays = COMPILE_MANIFEST_RETRY_DELAYS_MS.slice(
|
|
1106
1180
|
0,
|
|
@@ -1129,9 +1203,21 @@ var DeeplineClient = class {
|
|
|
1129
1203
|
async checkPlayArtifact(input) {
|
|
1130
1204
|
return this.http.post("/api/v2/plays/check", input);
|
|
1131
1205
|
}
|
|
1206
|
+
/**
|
|
1207
|
+
* Compile legacy enrich command arguments into a runtime plan.
|
|
1208
|
+
*
|
|
1209
|
+
* This is primarily used by CLI compatibility paths that translate older
|
|
1210
|
+
* enrichment commands onto the play runtime.
|
|
1211
|
+
*/
|
|
1132
1212
|
async compileEnrichPlan(input) {
|
|
1133
1213
|
return this.http.post("/api/v2/enrich/compile", input);
|
|
1134
1214
|
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Register an already-bundled play artifact and start a run from it.
|
|
1217
|
+
*
|
|
1218
|
+
* This is the low-level file-backed run path used by SDK/CLI packaging
|
|
1219
|
+
* wrappers after local bundling has produced the runtime artifact.
|
|
1220
|
+
*/
|
|
1135
1221
|
async startPlayRunFromBundle(input) {
|
|
1136
1222
|
const compilerManifest = input.compilerManifest ?? await this.compilePlayManifest({
|
|
1137
1223
|
name: input.name,
|
|
@@ -1289,6 +1375,12 @@ var DeeplineClient = class {
|
|
|
1289
1375
|
const response = await this.http.postFormData("/api/v2/plays/files/stage", buildFormData);
|
|
1290
1376
|
return response.files;
|
|
1291
1377
|
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Resolve staged play files by content hash without uploading bytes.
|
|
1380
|
+
*
|
|
1381
|
+
* Missing files are returned so callers can upload only the files the server
|
|
1382
|
+
* does not already have.
|
|
1383
|
+
*/
|
|
1292
1384
|
async resolveStagedPlayFiles(files) {
|
|
1293
1385
|
return this.http.post("/api/v2/plays/files/stage", { files });
|
|
1294
1386
|
}
|
|
@@ -1505,6 +1597,12 @@ var DeeplineClient = class {
|
|
|
1505
1597
|
entries
|
|
1506
1598
|
};
|
|
1507
1599
|
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Export persisted runtime-sheet rows for a play dataset/table namespace.
|
|
1602
|
+
*
|
|
1603
|
+
* This is the SDK form of exporting `ctx.dataset(...).run()` output for a
|
|
1604
|
+
* specific play and optional run id.
|
|
1605
|
+
*/
|
|
1508
1606
|
async getPlaySheetRows(input) {
|
|
1509
1607
|
const params = new URLSearchParams({
|
|
1510
1608
|
tableNamespace: input.tableNamespace,
|
|
@@ -1533,6 +1631,12 @@ var DeeplineClient = class {
|
|
|
1533
1631
|
options?.reason ? { reason: options.reason } : {}
|
|
1534
1632
|
);
|
|
1535
1633
|
}
|
|
1634
|
+
/**
|
|
1635
|
+
* List callable plays visible to the workspace.
|
|
1636
|
+
*
|
|
1637
|
+
* Pass `origin: "prebuilt"` for Deepline-managed prebuilts or
|
|
1638
|
+
* `origin: "owned"` for org-owned plays.
|
|
1639
|
+
*/
|
|
1536
1640
|
async listPlays(options) {
|
|
1537
1641
|
const params = new URLSearchParams();
|
|
1538
1642
|
if (options?.origin) params.set("origin", options.origin);
|
|
@@ -1547,15 +1651,32 @@ var DeeplineClient = class {
|
|
|
1547
1651
|
);
|
|
1548
1652
|
return response.plays ?? [];
|
|
1549
1653
|
}
|
|
1654
|
+
/**
|
|
1655
|
+
* Search callable plays and return compact play descriptions.
|
|
1656
|
+
*
|
|
1657
|
+
* Prebuilt plays are preferred by default because they have maintained
|
|
1658
|
+
* contracts and stable run behavior.
|
|
1659
|
+
*/
|
|
1550
1660
|
async searchPlays(options) {
|
|
1551
1661
|
const params = new URLSearchParams();
|
|
1552
1662
|
params.set("search", options.query.trim());
|
|
1663
|
+
const scope = options.scope ?? "prebuilt";
|
|
1664
|
+
if (scope !== "all") {
|
|
1665
|
+
params.set("origin", scope);
|
|
1666
|
+
}
|
|
1553
1667
|
const response = await this.http.get(
|
|
1554
1668
|
`/api/v2/plays?${params.toString()}`
|
|
1555
1669
|
);
|
|
1556
|
-
|
|
1670
|
+
const plays = (response.plays ?? []).map(
|
|
1557
1671
|
(play) => this.summarizePlayListItem(play, options)
|
|
1558
1672
|
);
|
|
1673
|
+
if (scope === "prebuilt") {
|
|
1674
|
+
return plays.filter(isPrebuiltPlayDescription);
|
|
1675
|
+
}
|
|
1676
|
+
if (scope === "owned") {
|
|
1677
|
+
return plays.filter((play) => !isPrebuiltPlayDescription(play));
|
|
1678
|
+
}
|
|
1679
|
+
return preferPrebuiltPlayDescriptions(plays);
|
|
1559
1680
|
}
|
|
1560
1681
|
/**
|
|
1561
1682
|
* Get the full definition and state of a named play.
|
|
@@ -1578,6 +1699,12 @@ var DeeplineClient = class {
|
|
|
1578
1699
|
const encodedName = encodeURIComponent(name);
|
|
1579
1700
|
return this.http.get(`/api/v2/plays/${encodedName}`);
|
|
1580
1701
|
}
|
|
1702
|
+
/**
|
|
1703
|
+
* Get a normalized play description suitable for agents and CLIs.
|
|
1704
|
+
*
|
|
1705
|
+
* The description includes runnable examples, input/output summaries, clone
|
|
1706
|
+
* guidance, revision state, and latest run metadata when available.
|
|
1707
|
+
*/
|
|
1581
1708
|
async describePlay(name, options) {
|
|
1582
1709
|
const detail = await this.getPlay(name);
|
|
1583
1710
|
return this.summarizePlayDetail(detail, options);
|
|
@@ -2064,6 +2191,58 @@ function buildEmailStatus({
|
|
|
2064
2191
|
};
|
|
2065
2192
|
}
|
|
2066
2193
|
|
|
2194
|
+
// ../shared_libs/play-runtime/extractor-targets.ts
|
|
2195
|
+
var JOB_CHANGE_STATUS_VALUES = [
|
|
2196
|
+
"moved",
|
|
2197
|
+
"no_change",
|
|
2198
|
+
"left_company",
|
|
2199
|
+
"unknown",
|
|
2200
|
+
"profile_unavailable",
|
|
2201
|
+
"no_new_company"
|
|
2202
|
+
];
|
|
2203
|
+
var PHONE_STATUS_VALUES = ["valid", "invalid", "unknown"];
|
|
2204
|
+
var DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS = {
|
|
2205
|
+
id: { identity: true, valueKind: "string" },
|
|
2206
|
+
name: { identity: true, valueKind: "string" },
|
|
2207
|
+
email: { identity: true, valueKind: "string" },
|
|
2208
|
+
personal_email: { identity: true, valueKind: "string" },
|
|
2209
|
+
phone: { identity: true, valueKind: "string" },
|
|
2210
|
+
linkedin: { identity: true, valueKind: "string" },
|
|
2211
|
+
linkedin_url: { identity: true, valueKind: "string" },
|
|
2212
|
+
domain: { identity: true, valueKind: "string" },
|
|
2213
|
+
website: { identity: true, valueKind: "string" },
|
|
2214
|
+
first_name: { identity: true, valueKind: "string" },
|
|
2215
|
+
last_name: { identity: true, valueKind: "string" },
|
|
2216
|
+
full_name: { identity: true, valueKind: "string" },
|
|
2217
|
+
company: { identity: true, valueKind: "string" },
|
|
2218
|
+
company_name: { identity: true, valueKind: "string" },
|
|
2219
|
+
organization_name: { identity: true, valueKind: "string" },
|
|
2220
|
+
company_domain: { identity: true, valueKind: "string" },
|
|
2221
|
+
company_website: { identity: true, valueKind: "string" },
|
|
2222
|
+
company_linkedin_url: { identity: true, valueKind: "string" },
|
|
2223
|
+
title: { identity: false, valueKind: "string" },
|
|
2224
|
+
industry: { identity: false, valueKind: "string" },
|
|
2225
|
+
status: { identity: false, valueKind: "string" },
|
|
2226
|
+
job_change: { identity: false, valueKind: "job_change" },
|
|
2227
|
+
job_change_status: {
|
|
2228
|
+
identity: false,
|
|
2229
|
+
valueKind: "job_change_status",
|
|
2230
|
+
enum: JOB_CHANGE_STATUS_VALUES
|
|
2231
|
+
},
|
|
2232
|
+
email_status: { identity: false, valueKind: "email_status" },
|
|
2233
|
+
phone_status: {
|
|
2234
|
+
identity: false,
|
|
2235
|
+
valueKind: "phone_status",
|
|
2236
|
+
enum: PHONE_STATUS_VALUES
|
|
2237
|
+
}
|
|
2238
|
+
};
|
|
2239
|
+
var DEEPLINE_EXTRACTOR_TARGETS = Object.keys(
|
|
2240
|
+
DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS
|
|
2241
|
+
);
|
|
2242
|
+
function isDeeplineExtractorTarget(value) {
|
|
2243
|
+
return value in DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS;
|
|
2244
|
+
}
|
|
2245
|
+
|
|
2067
2246
|
// ../shared_libs/play-runtime/tool-result.ts
|
|
2068
2247
|
var TARGET_FALLBACK_KEYS = {
|
|
2069
2248
|
email: [/^email$/i, /^address$/i, /email/i],
|
|
@@ -2337,10 +2516,61 @@ function normalizePhoneStatus(value) {
|
|
|
2337
2516
|
}
|
|
2338
2517
|
return normalized;
|
|
2339
2518
|
}
|
|
2519
|
+
function normalizeJobChangeStatus(value) {
|
|
2520
|
+
if (typeof value === "boolean") return value ? "moved" : "no_change";
|
|
2521
|
+
const normalized = normalizeString(value)?.toLowerCase().replace(/[\s-]+/g, "_");
|
|
2522
|
+
if (!normalized) return "unknown";
|
|
2523
|
+
if (["true", "yes", "moved", "changed", "new_company"].includes(normalized)) {
|
|
2524
|
+
return "moved";
|
|
2525
|
+
}
|
|
2526
|
+
if (["false", "no", "same", "no_change"].includes(normalized))
|
|
2527
|
+
return "no_change";
|
|
2528
|
+
if (["left", "left_company"].includes(normalized)) return "left_company";
|
|
2529
|
+
if (JOB_CHANGE_STATUS_VALUES.includes(normalized)) {
|
|
2530
|
+
return normalized;
|
|
2531
|
+
}
|
|
2532
|
+
return "unknown";
|
|
2533
|
+
}
|
|
2534
|
+
function firstExperienceDate(value) {
|
|
2535
|
+
if (!Array.isArray(value)) return null;
|
|
2536
|
+
for (const entry of value) {
|
|
2537
|
+
if (!isRecord2(entry)) continue;
|
|
2538
|
+
const date = normalizeString(
|
|
2539
|
+
entry.start_date ?? entry.started_at ?? entry.startDate
|
|
2540
|
+
);
|
|
2541
|
+
if (date) return date;
|
|
2542
|
+
}
|
|
2543
|
+
return null;
|
|
2544
|
+
}
|
|
2545
|
+
function normalizeJobChange(value) {
|
|
2546
|
+
const record = isRecord2(value) ? value : {};
|
|
2547
|
+
const nested = isRecord2(record.job_change) ? record.job_change : record;
|
|
2548
|
+
const output = isRecord2(nested.output) ? nested.output : nested;
|
|
2549
|
+
const person = isRecord2(output.person) ? output.person : {};
|
|
2550
|
+
const status = normalizeJobChangeStatus(
|
|
2551
|
+
output.status ?? output.job_change_status ?? output.job_changed ?? output.changed
|
|
2552
|
+
);
|
|
2553
|
+
const moved = status === "moved";
|
|
2554
|
+
return {
|
|
2555
|
+
status,
|
|
2556
|
+
date: moved ? normalizeString(
|
|
2557
|
+
output.date ?? output.job_change_date ?? output.change_date ?? output.changed_at
|
|
2558
|
+
) ?? firstExperienceDate(person.experiences) : null,
|
|
2559
|
+
new_company: moved ? normalizeString(
|
|
2560
|
+
output.new_company ?? output.current_company ?? person.company_name ?? person.current_company
|
|
2561
|
+
) : null,
|
|
2562
|
+
new_title: moved ? normalizeString(
|
|
2563
|
+
output.new_title ?? output.current_title ?? person.title ?? person.headline
|
|
2564
|
+
) : null
|
|
2565
|
+
};
|
|
2566
|
+
}
|
|
2340
2567
|
function applyExtractorTransforms(value, descriptor) {
|
|
2341
2568
|
return (descriptor.transforms ?? []).reduce((current, transform) => {
|
|
2342
2569
|
if (transform.endsWith("emailStatus")) return normalizeEmailStatus(current);
|
|
2343
2570
|
if (transform.endsWith("phoneStatus")) return normalizePhoneStatus(current);
|
|
2571
|
+
if (transform === "jobChange") return normalizeJobChange(current);
|
|
2572
|
+
if (transform === "jobChangeStatus")
|
|
2573
|
+
return normalizeJobChangeStatus(current);
|
|
2344
2574
|
return current;
|
|
2345
2575
|
}, value);
|
|
2346
2576
|
}
|
|
@@ -2628,7 +2858,10 @@ var DeeplineStepProgram = class _DeeplineStepProgram {
|
|
|
2628
2858
|
...this.steps,
|
|
2629
2859
|
{
|
|
2630
2860
|
name,
|
|
2631
|
-
resolver: stepResolver
|
|
2861
|
+
resolver: stepResolver,
|
|
2862
|
+
...options?.staleAfterSeconds !== void 0 ? {
|
|
2863
|
+
staleAfterSeconds: options.staleAfterSeconds
|
|
2864
|
+
} : {}
|
|
2632
2865
|
}
|
|
2633
2866
|
],
|
|
2634
2867
|
this.returnResolver
|
|
@@ -2728,6 +2961,14 @@ function createNamedPlayHandle(clientFactory, name) {
|
|
|
2728
2961
|
}
|
|
2729
2962
|
var DeeplineContext = class {
|
|
2730
2963
|
client;
|
|
2964
|
+
/**
|
|
2965
|
+
* Create a high-level SDK context.
|
|
2966
|
+
*
|
|
2967
|
+
* Most callers should use {@link Deepline.connect}; direct construction is
|
|
2968
|
+
* equivalent when you already have explicit client options.
|
|
2969
|
+
*
|
|
2970
|
+
* @param options - Optional SDK client configuration.
|
|
2971
|
+
*/
|
|
2731
2972
|
constructor(options) {
|
|
2732
2973
|
this.client = new DeeplineClient(options);
|
|
2733
2974
|
}
|
|
@@ -2757,12 +2998,25 @@ var DeeplineContext = class {
|
|
|
2757
2998
|
}
|
|
2758
2999
|
};
|
|
2759
3000
|
}
|
|
3001
|
+
/**
|
|
3002
|
+
* Play discovery and named-play handles.
|
|
3003
|
+
*
|
|
3004
|
+
* Use `plays.list()` for discovery and `plays.get(name)` when you prefer a
|
|
3005
|
+
* namespace spelling over `ctx.play(name)`.
|
|
3006
|
+
*/
|
|
2760
3007
|
get plays() {
|
|
2761
3008
|
return {
|
|
2762
3009
|
list: () => this.client.listPlays(),
|
|
2763
3010
|
get: (name) => this.play(name)
|
|
2764
3011
|
};
|
|
2765
3012
|
}
|
|
3013
|
+
/**
|
|
3014
|
+
* Convenience references for Deepline-managed prebuilt plays.
|
|
3015
|
+
*
|
|
3016
|
+
* Known prebuilts are exposed by camel-cased aliases. Any other property is
|
|
3017
|
+
* converted into `prebuilt/<property>` so callers can pass the reference to
|
|
3018
|
+
* `ctx.runPlay(...)`.
|
|
3019
|
+
*/
|
|
2766
3020
|
get prebuilt() {
|
|
2767
3021
|
const explicit = {
|
|
2768
3022
|
companyToContact: {
|
|
@@ -2817,6 +3071,17 @@ var DeeplineContext = class {
|
|
|
2817
3071
|
play(name) {
|
|
2818
3072
|
return createNamedPlayHandle(() => this.client, name);
|
|
2819
3073
|
}
|
|
3074
|
+
/**
|
|
3075
|
+
* Run a named or prebuilt play and wait for its output.
|
|
3076
|
+
*
|
|
3077
|
+
* This is the high-level SDK equivalent of `ctx.play(name).runSync(input)`.
|
|
3078
|
+
* Inside a play runtime, prefer the in-play `ctx.runPlay(key, playRef, input,
|
|
3079
|
+
* options)` form so the child run is checkpointed under a stable key.
|
|
3080
|
+
*
|
|
3081
|
+
* @param playOrRef - Play name or prebuilt/reference object.
|
|
3082
|
+
* @param input - JSON input passed to the play.
|
|
3083
|
+
* @returns Completed play output.
|
|
3084
|
+
*/
|
|
2820
3085
|
async runPlay(playOrRef, input) {
|
|
2821
3086
|
const name = typeof playOrRef === "string" ? playOrRef : playOrRef.playName ?? playOrRef.name ?? "";
|
|
2822
3087
|
return await this.play(name).runSync(input);
|
|
@@ -3191,11 +3456,15 @@ function extractSummaryFields(payload) {
|
|
|
3191
3456
|
0 && (module.exports = {
|
|
3192
3457
|
AuthError,
|
|
3193
3458
|
ConfigError,
|
|
3459
|
+
DEEPLINE_EXTRACTOR_TARGETS,
|
|
3460
|
+
DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS,
|
|
3194
3461
|
DEEPLINE_TOOL_CATEGORIES,
|
|
3195
3462
|
Deepline,
|
|
3196
3463
|
DeeplineClient,
|
|
3197
3464
|
DeeplineContext,
|
|
3198
3465
|
DeeplineError,
|
|
3466
|
+
JOB_CHANGE_STATUS_VALUES,
|
|
3467
|
+
PHONE_STATUS_VALUES,
|
|
3199
3468
|
PLAY_BOOTSTRAP_COMPANY_FIELDS,
|
|
3200
3469
|
PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY,
|
|
3201
3470
|
PLAY_BOOTSTRAP_CONTACT_FIELDS,
|
|
@@ -3218,6 +3487,7 @@ function extractSummaryFields(payload) {
|
|
|
3218
3487
|
formatPlayBootstrapFinderKindsForSentence,
|
|
3219
3488
|
formatPlayBootstrapTemplates,
|
|
3220
3489
|
getDefinedPlayMetadata,
|
|
3490
|
+
isDeeplineExtractorTarget,
|
|
3221
3491
|
isPlayBootstrapFinderKind,
|
|
3222
3492
|
isPlayBootstrapTemplate,
|
|
3223
3493
|
resolveConfig,
|