deepline 0.1.156 → 0.1.158
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/apps/play-runner-workers/src/entry.ts +146 -14
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/map-chunk-plan.ts +53 -1
- package/dist/bundling-sources/sdk/src/play.ts +21 -0
- package/dist/bundling-sources/sdk/src/release.ts +2 -2
- package/dist/bundling-sources/sdk/src/worker-play-entry.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/sheet-contract.ts +8 -4
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-plan.ts +159 -42
- package/dist/bundling-sources/shared_libs/play-runtime/map-chunk-limits.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +0 -1
- package/dist/bundling-sources/shared_libs/play-runtime/step-program-dataset-builder.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +19 -3
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +484 -226
- package/dist/cli/index.js +67 -24
- package/dist/cli/index.mjs +91 -44
- package/dist/index.d.mts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +5 -2
- package/dist/index.mjs +5 -2
- package/dist/plays/bundle-play-file.mjs +338 -181
- package/package.json +3 -1
package/dist/index.mjs
CHANGED
|
@@ -351,10 +351,10 @@ var SDK_RELEASE = {
|
|
|
351
351
|
// 0.1.111 ships dataset-native tool list getters and result row datasets.
|
|
352
352
|
// 0.1.154 removes the short-lived generated enrich StepOptions recompute
|
|
353
353
|
// fields shipped in 0.1.153.
|
|
354
|
-
version: "0.1.
|
|
354
|
+
version: "0.1.158",
|
|
355
355
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
356
356
|
supportPolicy: {
|
|
357
|
-
latest: "0.1.
|
|
357
|
+
latest: "0.1.158",
|
|
358
358
|
minimumSupported: "0.1.53",
|
|
359
359
|
deprecatedBelow: "0.1.53",
|
|
360
360
|
commandMinimumSupported: [
|
|
@@ -5044,6 +5044,9 @@ var DeeplineStepProgram = class _DeeplineStepProgram {
|
|
|
5044
5044
|
...this.steps,
|
|
5045
5045
|
{
|
|
5046
5046
|
name,
|
|
5047
|
+
...options?.recompute === true ? { recompute: true } : {},
|
|
5048
|
+
...options?.recomputeOnError === true ? { recomputeOnError: true } : {},
|
|
5049
|
+
...typeof options?.staleAfterSeconds === "number" ? { staleAfterSeconds: options.staleAfterSeconds } : {},
|
|
5047
5050
|
resolver: stepResolver
|
|
5048
5051
|
}
|
|
5049
5052
|
],
|
|
@@ -19,7 +19,9 @@ import {
|
|
|
19
19
|
resolve
|
|
20
20
|
} from "path";
|
|
21
21
|
import { builtinModules } from "module";
|
|
22
|
-
import {
|
|
22
|
+
import { Parser } from "acorn";
|
|
23
|
+
import { tsPlugin } from "acorn-typescript";
|
|
24
|
+
import { build, transformSync } from "esbuild";
|
|
23
25
|
|
|
24
26
|
// ../shared_libs/play-runtime/backend.ts
|
|
25
27
|
var PLAY_RUNTIME_BACKENDS = {
|
|
@@ -364,24 +366,6 @@ function findSourceImportReferences(sourceCode) {
|
|
|
364
366
|
(left, right) => left.line === right.line ? left.column - right.column : left.line - right.line
|
|
365
367
|
);
|
|
366
368
|
}
|
|
367
|
-
function unquoteStringLiteral(literal) {
|
|
368
|
-
const trimmed = literal.trim();
|
|
369
|
-
const quote = trimmed[0];
|
|
370
|
-
if (quote !== '"' && quote !== "'" && quote !== "`" || trimmed[trimmed.length - 1] !== quote) {
|
|
371
|
-
return null;
|
|
372
|
-
}
|
|
373
|
-
if (quote === "`") {
|
|
374
|
-
const value = trimmed.slice(1, -1);
|
|
375
|
-
return value.includes("${") ? null : value;
|
|
376
|
-
}
|
|
377
|
-
try {
|
|
378
|
-
return JSON.parse(
|
|
379
|
-
quote === '"' ? trimmed : `"${trimmed.slice(1, -1).replace(/"/g, '\\"')}"`
|
|
380
|
-
);
|
|
381
|
-
} catch {
|
|
382
|
-
return trimmed.slice(1, -1);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
369
|
function findMatchingBrace(source, openIndex) {
|
|
386
370
|
const structuralSource = maskSourceForStructure(source);
|
|
387
371
|
let depth = 0;
|
|
@@ -395,198 +379,371 @@ function findMatchingBrace(source, openIndex) {
|
|
|
395
379
|
}
|
|
396
380
|
return -1;
|
|
397
381
|
}
|
|
398
|
-
function
|
|
399
|
-
|
|
400
|
-
let depth = 0;
|
|
401
|
-
for (let index = openIndex; index < structuralSource.length; index += 1) {
|
|
402
|
-
const char = structuralSource[index];
|
|
403
|
-
if (char === "(") depth += 1;
|
|
404
|
-
if (char === ")") {
|
|
405
|
-
depth -= 1;
|
|
406
|
-
if (depth === 0) return index;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
return -1;
|
|
382
|
+
function extractDefinedPlayName(sourceCode) {
|
|
383
|
+
return extractDefinedPlayMetadata(sourceCode, null)?.name ?? null;
|
|
410
384
|
}
|
|
411
|
-
function
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
385
|
+
function extractDefinedPlayNameForExport(sourceCode, exportName) {
|
|
386
|
+
return extractDefinedPlayMetadata(sourceCode, exportName)?.name ?? null;
|
|
387
|
+
}
|
|
388
|
+
function extractDefinedPlayDescription(sourceCode) {
|
|
389
|
+
return extractDefinedPlayMetadata(sourceCode, null)?.description ?? null;
|
|
390
|
+
}
|
|
391
|
+
function extractDefinedPlayDescriptionForExport(sourceCode, exportName) {
|
|
392
|
+
return extractDefinedPlayMetadata(sourceCode, exportName)?.description ?? null;
|
|
393
|
+
}
|
|
394
|
+
var TypeScriptParser = Parser.extend(
|
|
395
|
+
tsPlugin({
|
|
396
|
+
allowSatisfies: true,
|
|
397
|
+
jsx: {
|
|
398
|
+
allowNamespaces: true,
|
|
399
|
+
allowNamespacedObjects: true
|
|
400
|
+
}
|
|
401
|
+
})
|
|
402
|
+
);
|
|
403
|
+
function parsePlaySourceAst(sourceCode) {
|
|
404
|
+
try {
|
|
405
|
+
return TypeScriptParser.parse(sourceCode, {
|
|
406
|
+
ecmaVersion: "latest",
|
|
407
|
+
sourceType: "module",
|
|
408
|
+
allowHashBang: true
|
|
409
|
+
});
|
|
410
|
+
} catch {
|
|
411
|
+
try {
|
|
412
|
+
const transformed = transformSync(sourceCode, {
|
|
413
|
+
loader: "ts",
|
|
414
|
+
format: "esm",
|
|
415
|
+
target: "esnext",
|
|
416
|
+
legalComments: "none",
|
|
417
|
+
sourcemap: false
|
|
418
|
+
}).code;
|
|
419
|
+
return Parser.parse(transformed, {
|
|
420
|
+
ecmaVersion: "latest",
|
|
421
|
+
sourceType: "module",
|
|
422
|
+
allowHashBang: true
|
|
423
|
+
});
|
|
424
|
+
} catch {
|
|
425
|
+
return null;
|
|
429
426
|
}
|
|
430
427
|
}
|
|
431
|
-
const finalArg = source.slice(start).trim();
|
|
432
|
-
if (finalArg) args.push(finalArg);
|
|
433
|
-
return args;
|
|
434
428
|
}
|
|
435
|
-
function
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
429
|
+
function getIdentifierName(node) {
|
|
430
|
+
return isAstNode(node) && node.type === "Identifier" ? typeof node.name === "string" ? node.name : null : null;
|
|
431
|
+
}
|
|
432
|
+
function isAstNode(value) {
|
|
433
|
+
return value !== null && typeof value === "object" && "type" in value;
|
|
434
|
+
}
|
|
435
|
+
function astArray(value) {
|
|
436
|
+
return Array.isArray(value) ? value.filter(isAstNode) : [];
|
|
437
|
+
}
|
|
438
|
+
function memberExpressionPath(node) {
|
|
439
|
+
const expression = unwrapStaticExpression(node);
|
|
440
|
+
if (!expression) return null;
|
|
441
|
+
if (expression.type === "Identifier" && typeof expression.name === "string") {
|
|
442
|
+
return [expression.name];
|
|
443
|
+
}
|
|
444
|
+
if (expression.type !== "MemberExpression") return null;
|
|
445
|
+
const objectPath = memberExpressionPath(
|
|
446
|
+
isAstNode(expression.object) ? expression.object : null
|
|
447
|
+
);
|
|
448
|
+
if (!objectPath) return null;
|
|
449
|
+
const property = isAstNode(expression.property) ? expression.property : null;
|
|
450
|
+
if (!property) return null;
|
|
451
|
+
if (!expression.computed && property.type === "Identifier") {
|
|
452
|
+
return typeof property.name === "string" ? [...objectPath, property.name] : null;
|
|
453
|
+
}
|
|
454
|
+
if (expression.computed && property.type === "Literal") {
|
|
455
|
+
return typeof property.value === "string" ? [...objectPath, property.value] : null;
|
|
445
456
|
}
|
|
446
457
|
return null;
|
|
447
458
|
}
|
|
448
|
-
function
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
459
|
+
function commonJsExportName(left) {
|
|
460
|
+
const path = memberExpressionPath(left);
|
|
461
|
+
if (!path) return null;
|
|
462
|
+
if (path.length === 2 && path[0] === "module" && path[1] === "exports") {
|
|
463
|
+
return "default";
|
|
464
|
+
}
|
|
465
|
+
if (path.length === 3 && path[0] === "module" && path[1] === "exports") {
|
|
466
|
+
return path[2] || null;
|
|
467
|
+
}
|
|
468
|
+
if (path.length === 2 && path[0] === "exports") {
|
|
469
|
+
return path[1] || null;
|
|
452
470
|
}
|
|
453
471
|
return null;
|
|
454
472
|
}
|
|
455
|
-
function
|
|
456
|
-
return
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
473
|
+
function isDefinePlayCallExpression(node) {
|
|
474
|
+
if (!node || node.type !== "CallExpression") return false;
|
|
475
|
+
const callee = isAstNode(node.callee) ? node.callee : null;
|
|
476
|
+
if (!callee) return false;
|
|
477
|
+
if (callee.type === "Identifier") {
|
|
478
|
+
return callee.name === "definePlay" || callee.name === "defineWorkflow";
|
|
479
|
+
}
|
|
480
|
+
if (callee.type === "MemberExpression" && isAstNode(callee.property)) {
|
|
481
|
+
const property = callee.property;
|
|
482
|
+
return !callee.computed && property.type === "Identifier" && (property.name === "definePlay" || property.name === "defineWorkflow");
|
|
483
|
+
}
|
|
484
|
+
return false;
|
|
485
|
+
}
|
|
486
|
+
function canResolveDeclarationInitializer(declarationKind, initializer) {
|
|
487
|
+
return declarationKind === "const" || isDefinePlayCallExpression(initializer);
|
|
488
|
+
}
|
|
489
|
+
function buildPlayMetadataContext(ast) {
|
|
490
|
+
const declarations = /* @__PURE__ */ new Map();
|
|
491
|
+
const namedExports = /* @__PURE__ */ new Map();
|
|
492
|
+
const commonJsExports = /* @__PURE__ */ new Map();
|
|
493
|
+
let defaultExport = null;
|
|
494
|
+
for (const statement of astArray(ast.body)) {
|
|
495
|
+
if (statement.type === "VariableDeclaration") {
|
|
496
|
+
for (const declaration of astArray(statement.declarations)) {
|
|
497
|
+
const name = getIdentifierName(declaration.id);
|
|
498
|
+
if (!name) continue;
|
|
499
|
+
const initializer = isAstNode(declaration.init) ? declaration.init : null;
|
|
500
|
+
declarations.set(
|
|
501
|
+
name,
|
|
502
|
+
canResolveDeclarationInitializer(statement.kind, initializer) ? initializer : null
|
|
503
|
+
);
|
|
504
|
+
}
|
|
505
|
+
continue;
|
|
506
|
+
}
|
|
507
|
+
if (statement.type === "ExportDefaultDeclaration") {
|
|
508
|
+
defaultExport = isAstNode(statement.declaration) ? statement.declaration : null;
|
|
509
|
+
continue;
|
|
510
|
+
}
|
|
511
|
+
if (statement.type === "TSExportAssignment") {
|
|
512
|
+
defaultExport = isAstNode(statement.expression) ? statement.expression : null;
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
if (statement.type === "ExportNamedDeclaration") {
|
|
516
|
+
if (isAstNode(statement.declaration) && statement.declaration.type === "VariableDeclaration") {
|
|
517
|
+
for (const declaration of astArray(statement.declaration.declarations)) {
|
|
518
|
+
const name = getIdentifierName(declaration.id);
|
|
519
|
+
if (!name) continue;
|
|
520
|
+
const initializer = isAstNode(declaration.init) ? declaration.init : null;
|
|
521
|
+
declarations.set(
|
|
522
|
+
name,
|
|
523
|
+
canResolveDeclarationInitializer(
|
|
524
|
+
statement.declaration.kind,
|
|
525
|
+
initializer
|
|
526
|
+
) ? initializer : null
|
|
527
|
+
);
|
|
528
|
+
namedExports.set(name, name);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
for (const specifier of astArray(statement.specifiers)) {
|
|
532
|
+
const localName = getIdentifierName(specifier.local);
|
|
533
|
+
const exportedName = getIdentifierName(specifier.exported) ?? (isAstNode(specifier.exported) && specifier.exported.type === "Literal" && typeof specifier.exported.value === "string" ? specifier.exported.value : null);
|
|
534
|
+
if (localName && exportedName) {
|
|
535
|
+
namedExports.set(exportedName, localName);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
if (statement.type === "ExpressionStatement" && isAstNode(statement.expression) && statement.expression.type === "AssignmentExpression") {
|
|
540
|
+
const exportName = commonJsExportName(
|
|
541
|
+
isAstNode(statement.expression.left) ? statement.expression.left : null
|
|
542
|
+
);
|
|
543
|
+
if (exportName && isAstNode(statement.expression.right)) {
|
|
544
|
+
commonJsExports.set(exportName, statement.expression.right);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
return { declarations, namedExports, commonJsExports, defaultExport };
|
|
549
|
+
}
|
|
550
|
+
function unwrapStaticExpression(node) {
|
|
551
|
+
let current = node ?? null;
|
|
552
|
+
while (current && (current.type === "TSAsExpression" || current.type === "TSSatisfiesExpression" || current.type === "TSTypeAssertion" || current.type === "TSNonNullExpression" || current.type === "ParenthesizedExpression")) {
|
|
553
|
+
current = isAstNode(current.expression) ? current.expression : null;
|
|
554
|
+
}
|
|
555
|
+
return current;
|
|
556
|
+
}
|
|
557
|
+
function staticStringFromExpression(node, context, seen = /* @__PURE__ */ new Set(), trimResult = true) {
|
|
558
|
+
const expression = unwrapStaticExpression(node);
|
|
559
|
+
if (!expression) return null;
|
|
560
|
+
if (expression.type === "Literal") {
|
|
561
|
+
const value = expression.value;
|
|
562
|
+
if (typeof value !== "string" || !value.trim()) return null;
|
|
563
|
+
return trimResult ? value.trim() : value;
|
|
564
|
+
}
|
|
565
|
+
if (expression.type === "TemplateLiteral" && astArray(expression.expressions).length === 0) {
|
|
566
|
+
const firstQuasi = astArray(expression.quasis)[0];
|
|
567
|
+
const cooked = firstQuasi && typeof firstQuasi.value === "object" ? firstQuasi.value.cooked : null;
|
|
568
|
+
if (typeof cooked !== "string" || !cooked.trim()) return null;
|
|
569
|
+
return trimResult ? cooked.trim() : cooked;
|
|
570
|
+
}
|
|
571
|
+
if (expression.type === "BinaryExpression" && expression.operator === "+") {
|
|
572
|
+
const left = staticStringFromExpression(
|
|
573
|
+
isAstNode(expression.left) ? expression.left : null,
|
|
574
|
+
context,
|
|
575
|
+
new Set(seen),
|
|
576
|
+
false
|
|
577
|
+
);
|
|
578
|
+
const right = staticStringFromExpression(
|
|
579
|
+
isAstNode(expression.right) ? expression.right : null,
|
|
580
|
+
context,
|
|
581
|
+
new Set(seen),
|
|
582
|
+
false
|
|
583
|
+
);
|
|
584
|
+
const value = left !== null && right !== null ? `${left}${right}` : null;
|
|
585
|
+
if (!value?.trim()) return null;
|
|
586
|
+
return trimResult ? value.trim() : value;
|
|
587
|
+
}
|
|
588
|
+
const identifier = getIdentifierName(expression);
|
|
589
|
+
if (!identifier || seen.has(identifier)) return null;
|
|
590
|
+
seen.add(identifier);
|
|
591
|
+
return staticStringFromExpression(
|
|
592
|
+
context.declarations.get(identifier),
|
|
593
|
+
context,
|
|
594
|
+
seen,
|
|
595
|
+
trimResult
|
|
460
596
|
);
|
|
461
597
|
}
|
|
462
|
-
function
|
|
463
|
-
return
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
598
|
+
function propertyNameFromKey(property) {
|
|
599
|
+
if (property.computed) return null;
|
|
600
|
+
const key = isAstNode(property.key) ? property.key : null;
|
|
601
|
+
if (!key) return null;
|
|
602
|
+
if (key.type === "Identifier" && typeof key.name === "string") {
|
|
603
|
+
return key.name;
|
|
604
|
+
}
|
|
605
|
+
if (key.type === "Literal" && typeof key.value === "string") {
|
|
606
|
+
return key.value;
|
|
607
|
+
}
|
|
608
|
+
return null;
|
|
468
609
|
}
|
|
469
|
-
function
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
610
|
+
function objectExpressionFromNode(node, context, seen = /* @__PURE__ */ new Set()) {
|
|
611
|
+
const expression = unwrapStaticExpression(node);
|
|
612
|
+
if (!expression) return null;
|
|
613
|
+
if (expression.type === "ObjectExpression") return expression;
|
|
614
|
+
const identifier = getIdentifierName(expression);
|
|
615
|
+
if (!identifier || seen.has(identifier)) return null;
|
|
616
|
+
seen.add(identifier);
|
|
617
|
+
return objectExpressionFromNode(
|
|
618
|
+
context.declarations.get(identifier),
|
|
619
|
+
context,
|
|
620
|
+
seen
|
|
474
621
|
);
|
|
475
622
|
}
|
|
476
|
-
function
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
|
|
623
|
+
function stringPropertyFromObjectExpression(node, propertyName, context, seenObjects = /* @__PURE__ */ new Set()) {
|
|
624
|
+
const object = objectExpressionFromNode(node, context);
|
|
625
|
+
if (!object || seenObjects.has(object)) return null;
|
|
626
|
+
seenObjects.add(object);
|
|
627
|
+
let value = null;
|
|
628
|
+
for (const property of astArray(object.properties)) {
|
|
629
|
+
if (property.type === "SpreadElement") {
|
|
630
|
+
const spreadValue = stringPropertyFromObjectExpression(
|
|
631
|
+
isAstNode(property.argument) ? property.argument : null,
|
|
632
|
+
propertyName,
|
|
633
|
+
context,
|
|
634
|
+
seenObjects
|
|
635
|
+
);
|
|
636
|
+
if (spreadValue) value = spreadValue;
|
|
480
637
|
continue;
|
|
481
638
|
}
|
|
482
|
-
|
|
483
|
-
if (
|
|
639
|
+
if (property.type !== "Property") continue;
|
|
640
|
+
if (propertyNameFromKey(property) !== propertyName) continue;
|
|
641
|
+
const propertyValue = property.shorthand ? property.key : property.value;
|
|
642
|
+
value = staticStringFromExpression(
|
|
643
|
+
isAstNode(propertyValue) ? propertyValue : null,
|
|
644
|
+
context
|
|
645
|
+
);
|
|
484
646
|
}
|
|
485
|
-
return
|
|
647
|
+
return value;
|
|
486
648
|
}
|
|
487
|
-
function
|
|
488
|
-
const
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
const
|
|
495
|
-
|
|
496
|
-
calls.push({
|
|
497
|
-
arguments: splitTopLevelArguments(
|
|
498
|
-
sourceCode.slice(openParen + 1, closeParen)
|
|
499
|
-
),
|
|
500
|
-
exportName: exportNameForDefinePlayCall(sourceCode, callStart)
|
|
501
|
-
});
|
|
649
|
+
function isDefinePlayCallee(node) {
|
|
650
|
+
const callee = unwrapStaticExpression(node);
|
|
651
|
+
if (!callee) return false;
|
|
652
|
+
if (callee.type === "Identifier" && (callee.name === "definePlay" || callee.name === "defineWorkflow")) {
|
|
653
|
+
return true;
|
|
654
|
+
}
|
|
655
|
+
if (callee.type === "MemberExpression" && isAstNode(callee.property)) {
|
|
656
|
+
const property = callee.property;
|
|
657
|
+
return !callee.computed && property.type === "Identifier" && (property.name === "definePlay" || property.name === "defineWorkflow");
|
|
502
658
|
}
|
|
503
|
-
return
|
|
659
|
+
return false;
|
|
504
660
|
}
|
|
505
|
-
function
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
const afterIdentifier = match.index + match[0].length;
|
|
510
|
-
const nextNonSpace = source.slice(afterIdentifier).match(/\S/)?.[0] ?? "";
|
|
511
|
-
if (nextNonSpace !== "(") return match[1] ?? null;
|
|
661
|
+
function playMetadataFromDefinePlayCall(node, context) {
|
|
662
|
+
const expression = unwrapStaticExpression(node);
|
|
663
|
+
if (!expression || expression.type !== "CallExpression" || !isDefinePlayCallee(isAstNode(expression.callee) ? expression.callee : null)) {
|
|
664
|
+
return null;
|
|
512
665
|
}
|
|
513
|
-
|
|
666
|
+
const args = astArray(expression.arguments);
|
|
667
|
+
const firstArg = args[0] ?? null;
|
|
668
|
+
const objectName = stringPropertyFromObjectExpression(firstArg, "id", context);
|
|
669
|
+
const name = objectName ?? staticStringFromExpression(firstArg, context);
|
|
670
|
+
let description = stringPropertyFromObjectExpression(firstArg, "description", context) ?? null;
|
|
671
|
+
for (let index = args.length - 1; !description && index >= 2; index -= 1) {
|
|
672
|
+
description = stringPropertyFromObjectExpression(
|
|
673
|
+
args[index],
|
|
674
|
+
"description",
|
|
675
|
+
context
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
if (!name && !description) return null;
|
|
679
|
+
return { name, description };
|
|
514
680
|
}
|
|
515
|
-
function
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
681
|
+
function resolveExportExpression(exportName, context) {
|
|
682
|
+
if (exportName === "default") {
|
|
683
|
+
const commonJsDefault = context.commonJsExports.get("default");
|
|
684
|
+
if (commonJsDefault) {
|
|
685
|
+
const commonJsDefaultIdentifier = getIdentifierName(
|
|
686
|
+
unwrapStaticExpression(commonJsDefault)
|
|
687
|
+
);
|
|
688
|
+
return commonJsDefaultIdentifier ? context.declarations.get(commonJsDefaultIdentifier) ?? commonJsDefault : commonJsDefault;
|
|
689
|
+
}
|
|
690
|
+
const defaultExpression = unwrapStaticExpression(context.defaultExport);
|
|
691
|
+
const defaultIdentifier = getIdentifierName(defaultExpression);
|
|
692
|
+
if (!defaultIdentifier) {
|
|
693
|
+
const defaultExportName = context.namedExports.get("default");
|
|
694
|
+
return defaultExportName ? context.declarations.get(defaultExportName) ?? null : defaultExpression;
|
|
695
|
+
}
|
|
696
|
+
return defaultIdentifier ? context.declarations.get(defaultIdentifier) ?? context.defaultExport : context.defaultExport;
|
|
697
|
+
}
|
|
698
|
+
if (exportName) {
|
|
699
|
+
const commonJsExport = context.commonJsExports.get(exportName);
|
|
700
|
+
if (commonJsExport) {
|
|
701
|
+
const commonJsExportIdentifier = getIdentifierName(
|
|
702
|
+
unwrapStaticExpression(commonJsExport)
|
|
703
|
+
);
|
|
704
|
+
return commonJsExportIdentifier ? context.declarations.get(commonJsExportIdentifier) ?? commonJsExport : commonJsExport;
|
|
705
|
+
}
|
|
706
|
+
const localName = context.namedExports.get(exportName) ?? exportName;
|
|
707
|
+
return context.declarations.get(localName) ?? null;
|
|
523
708
|
}
|
|
524
709
|
return null;
|
|
525
710
|
}
|
|
526
|
-
function
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
|
|
711
|
+
function extractDefinedPlayMetadata(sourceCode, exportName) {
|
|
712
|
+
const ast = parsePlaySourceAst(sourceCode);
|
|
713
|
+
if (!ast) return null;
|
|
714
|
+
const context = buildPlayMetadataContext(ast);
|
|
715
|
+
const exportedExpression = resolveExportExpression(exportName, context);
|
|
716
|
+
const exportedMetadata = playMetadataFromDefinePlayCall(
|
|
717
|
+
exportedExpression,
|
|
718
|
+
context
|
|
530
719
|
);
|
|
531
|
-
if (
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
720
|
+
if (exportedMetadata) return exportedMetadata;
|
|
721
|
+
if (exportName) return null;
|
|
722
|
+
if (context.defaultExport) {
|
|
723
|
+
const directDefaultMetadata = playMetadataFromDefinePlayCall(
|
|
724
|
+
context.defaultExport,
|
|
725
|
+
context
|
|
536
726
|
);
|
|
537
|
-
if (
|
|
727
|
+
if (directDefaultMetadata) return directDefaultMetadata;
|
|
728
|
+
const defaultIdentifier = getIdentifierName(context.defaultExport);
|
|
729
|
+
if (defaultIdentifier) {
|
|
730
|
+
const defaultMetadata = playMetadataFromDefinePlayCall(
|
|
731
|
+
context.declarations.get(defaultIdentifier),
|
|
732
|
+
context
|
|
733
|
+
);
|
|
734
|
+
if (defaultMetadata) return defaultMetadata;
|
|
735
|
+
}
|
|
538
736
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
return extractStringProperty(objectSource, "description");
|
|
547
|
-
}
|
|
548
|
-
function objectLiteralBodyFromArgument(sourceCode, arg) {
|
|
549
|
-
const trimmed = arg.trim();
|
|
550
|
-
if (trimmed.startsWith("{")) {
|
|
551
|
-
const closeBrace = findMatchingBrace(trimmed, 0);
|
|
552
|
-
return closeBrace >= 0 ? trimmed.slice(1, closeBrace) : trimmed.slice(1);
|
|
553
|
-
}
|
|
554
|
-
if (!/^[A-Za-z_$][\w$]*$/.test(trimmed)) return null;
|
|
555
|
-
return findTopLevelObjectLiteralBody(sourceCode, trimmed);
|
|
556
|
-
}
|
|
557
|
-
function escapeRegExp(value) {
|
|
558
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
559
|
-
}
|
|
560
|
-
function findTopLevelObjectLiteralBody(sourceCode, identifier) {
|
|
561
|
-
const source = maskSourceForStructure(sourceCode);
|
|
562
|
-
const pattern = new RegExp(
|
|
563
|
-
`(?:^|[;\\n])\\s*(?:export\\s+)?(?:const|let|var)\\s+${escapeRegExp(
|
|
564
|
-
identifier
|
|
565
|
-
)}(?:\\s*:[^=;]+)?\\s*=\\s*{`,
|
|
566
|
-
"g"
|
|
567
|
-
);
|
|
568
|
-
for (const match of source.matchAll(pattern)) {
|
|
569
|
-
const openBrace = source.indexOf("{", match.index);
|
|
570
|
-
if (openBrace < 0) continue;
|
|
571
|
-
const closeBrace = findMatchingBrace(sourceCode, openBrace);
|
|
572
|
-
if (closeBrace < 0) continue;
|
|
573
|
-
return sourceCode.slice(openBrace + 1, closeBrace);
|
|
737
|
+
for (const expression of context.declarations.values()) {
|
|
738
|
+
const metadata = playMetadataFromDefinePlayCall(expression, context);
|
|
739
|
+
if (metadata) return metadata;
|
|
740
|
+
}
|
|
741
|
+
for (const expression of context.commonJsExports.values()) {
|
|
742
|
+
const metadata = playMetadataFromDefinePlayCall(expression, context);
|
|
743
|
+
if (metadata) return metadata;
|
|
574
744
|
}
|
|
575
745
|
return null;
|
|
576
746
|
}
|
|
577
|
-
function exportNameForDefinePlayCall(sourceCode, callStart) {
|
|
578
|
-
const source = maskSourceForStructure(sourceCode);
|
|
579
|
-
const structuralPrefix = source.slice(Math.max(0, callStart - 500), callStart).trimEnd();
|
|
580
|
-
if (/\bexport\s+default\s*$/.test(structuralPrefix)) return "default";
|
|
581
|
-
const variableMatch = structuralPrefix.match(
|
|
582
|
-
/\bexport\s+(?:declare\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)(?:\s*:[^=;]+)?\s*=\s*$/
|
|
583
|
-
);
|
|
584
|
-
if (variableMatch?.[1]) return variableMatch[1];
|
|
585
|
-
const localVariableMatch = structuralPrefix.match(
|
|
586
|
-
/\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)(?:\s*:[^=;]+)?\s*=\s*$/
|
|
587
|
-
);
|
|
588
|
-
return localVariableMatch?.[1] ?? null;
|
|
589
|
-
}
|
|
590
747
|
function canonicalizeRootPlayNameForWorkersRuntimeHash(sourceCode) {
|
|
591
748
|
const source = stripCommentsToSpaces(sourceCode);
|
|
592
749
|
const callPattern = /(?:\b[A-Za-z_$][\w$]*\s*\.\s*)?\b(?:definePlay|defineWorkflow)\s*\(/g;
|
|
@@ -1682,7 +1839,7 @@ function stripCommentsToSpaces2(source) {
|
|
|
1682
1839
|
(match, prefix) => prefix + " ".repeat(Math.max(0, match.length - prefix.length))
|
|
1683
1840
|
);
|
|
1684
1841
|
}
|
|
1685
|
-
function
|
|
1842
|
+
function unquoteStringLiteral(literal) {
|
|
1686
1843
|
const trimmed = literal.trim();
|
|
1687
1844
|
const quote = trimmed[0];
|
|
1688
1845
|
if (quote !== '"' && quote !== "'" || trimmed[trimmed.length - 1] !== quote) {
|
|
@@ -1742,7 +1899,7 @@ function isRuntimeInputExpression(expression) {
|
|
|
1742
1899
|
function resolveStringExpression(expression, constants) {
|
|
1743
1900
|
const value = stripOuterParens(expression);
|
|
1744
1901
|
if (/^(['"])(?:\\.|(?!\1)[\s\S])*\1$/.test(value)) {
|
|
1745
|
-
return
|
|
1902
|
+
return unquoteStringLiteral(value);
|
|
1746
1903
|
}
|
|
1747
1904
|
if (/^`(?:\\.|[^`$]|\$(?!\{))*`$/.test(value)) {
|
|
1748
1905
|
return value.slice(1, -1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deepline",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.158",
|
|
4
4
|
"description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
"prepublishOnly": "bun ../scripts/sync-sdk-package-version.ts && tsup"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
+
"acorn": "^8.17.0",
|
|
50
|
+
"acorn-typescript": "^1.4.13",
|
|
49
51
|
"commander": "^14.0.3",
|
|
50
52
|
"csv-parse": "^5.6.0",
|
|
51
53
|
"csv-stringify": "^6.5.0",
|