deepline 0.1.228 → 0.1.230
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/coordinator-entry.ts +76 -1842
- package/dist/bundling-sources/apps/play-runner-workers/src/dedup-do.ts +0 -113
- package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +81 -968
- package/dist/bundling-sources/apps/play-runner-workers/src/workflow-retry-state.ts +1 -50
- package/dist/bundling-sources/sdk/src/release.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +67 -15
- package/dist/bundling-sources/shared_libs/play-runtime/child-execution-strategy.ts +84 -79
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +152 -688
- package/dist/bundling-sources/shared_libs/play-runtime/coordinator-headers.ts +3 -10
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-contract.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +12 -47
- package/dist/bundling-sources/shared_libs/play-runtime/governor/block-reserving-budget-state-backend.ts +0 -2
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +12 -200
- package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +2 -17
- package/dist/bundling-sources/shared_libs/play-runtime/play-call-execution.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-latency-trace.ts +28 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-execution-scope.ts +16 -64
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +0 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +37 -9
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +0 -36
- package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +3 -21
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +9 -1
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +2 -0
- package/dist/cli/index.js +45 -92
- package/dist/cli/index.mjs +45 -92
- package/dist/{compiler-manifest-BhgZ23A4.d.ts → compiler-manifest-CYcwzSOJ.d.mts} +2 -0
- package/dist/{compiler-manifest-BhgZ23A4.d.mts → compiler-manifest-CYcwzSOJ.d.ts} +2 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/package.json +1 -1
- package/dist/bundling-sources/apps/play-runner-workers/src/child-manifest-resolver.ts +0 -108
- package/dist/bundling-sources/apps/play-runner-workers/src/child-play-await.ts +0 -374
- package/dist/bundling-sources/apps/play-runner-workers/src/child-play-submit.ts +0 -203
- package/dist/bundling-sources/shared_libs/play-runtime/child-execution-placement.ts +0 -14
- package/dist/bundling-sources/shared_libs/play-runtime/child-run-id.ts +0 -121
package/dist/cli/index.mjs
CHANGED
|
@@ -610,10 +610,10 @@ var SDK_RELEASE = {
|
|
|
610
610
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
611
611
|
// 0.1.220 deprecates SDK CLI versions below 0.1.219 and updates them
|
|
612
612
|
// automatically without blocking their current command.
|
|
613
|
-
version: "0.1.
|
|
613
|
+
version: "0.1.230",
|
|
614
614
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
615
615
|
supportPolicy: {
|
|
616
|
-
latest: "0.1.
|
|
616
|
+
latest: "0.1.230",
|
|
617
617
|
minimumSupported: "0.1.53",
|
|
618
618
|
deprecatedBelow: "0.1.219",
|
|
619
619
|
commandMinimumSupported: [
|
|
@@ -17915,8 +17915,6 @@ function renderExecuteStep(command, options = {
|
|
|
17915
17915
|
force: true` : "";
|
|
17916
17916
|
const legacyEnvelope = options.legacyEnvelope ? `,
|
|
17917
17917
|
legacyEnvelope: true` : "";
|
|
17918
|
-
const waterfallSoftFail = options.waterfallSoftFail ? `,
|
|
17919
|
-
waterfallSoftFail: true` : "";
|
|
17920
17918
|
return [
|
|
17921
17919
|
`async (row, stepCtx) => {`,
|
|
17922
17920
|
...options.precheck ? [` if (${options.precheck}) return null;`] : [],
|
|
@@ -17928,7 +17926,7 @@ function renderExecuteStep(command, options = {
|
|
|
17928
17926
|
` extract: ${extractJs},`,
|
|
17929
17927
|
` runIf: ${runIfJs},`,
|
|
17930
17928
|
` row,`,
|
|
17931
|
-
` stepCtx${description}${force}${legacyEnvelope}
|
|
17929
|
+
` stepCtx${description}${force}${legacyEnvelope}`,
|
|
17932
17930
|
` });`,
|
|
17933
17931
|
`}`
|
|
17934
17932
|
].join("\n");
|
|
@@ -17988,18 +17986,14 @@ function renderIdiomaticExecuteStep(command, options) {
|
|
|
17988
17986
|
`async (row, ctx) => {`,
|
|
17989
17987
|
...options.precheck ? [` if (${options.precheck}) return null;`] : [],
|
|
17990
17988
|
...runIfLines,
|
|
17991
|
-
`
|
|
17992
|
-
`
|
|
17993
|
-
`
|
|
17994
|
-
`
|
|
17995
|
-
`
|
|
17996
|
-
` input: ${input2} as any,`,
|
|
17997
|
-
` description: ${stringLiteral((command.description ?? "").trim() || `Run ${command.alias} via ${command.tool}.`)},`,
|
|
17989
|
+
` const result: any = await ctx.tools.execute({`,
|
|
17990
|
+
` id: ${callId},`,
|
|
17991
|
+
` tool: ${tool},`,
|
|
17992
|
+
` input: ${input2} as any,`,
|
|
17993
|
+
` description: ${stringLiteral((command.description ?? "").trim() || `Run ${command.alias} via ${command.tool}.`)},`,
|
|
17998
17994
|
...options.force ? [` force: true,`] : [],
|
|
17999
|
-
`
|
|
18000
|
-
`
|
|
18001
|
-
...options.waterfallSoftFail ? [` return __dlWaterfallToolFailure(error);`] : [` throw error;`],
|
|
18002
|
-
` }`,
|
|
17995
|
+
` });`,
|
|
17996
|
+
` __dlAssertSuccessfulToolResult(result);`,
|
|
18003
17997
|
` return ${extraction};`,
|
|
18004
17998
|
`}`
|
|
18005
17999
|
].join("\n");
|
|
@@ -18023,21 +18017,19 @@ function renderPlayStep(command, options) {
|
|
|
18023
18017
|
...runIfLines,
|
|
18024
18018
|
` const payload = __dlTemplate(${payload}, templateRow) as Record<string, unknown>;`,
|
|
18025
18019
|
` if (__dlShouldSkipBlankPlayPayload(payload)) return null;`,
|
|
18026
|
-
`
|
|
18027
|
-
` try {`,
|
|
18020
|
+
` const result: unknown = `,
|
|
18028
18021
|
...inlineHandler ? [
|
|
18029
18022
|
// Enrich validates and normalizes this payload against the certified
|
|
18030
18023
|
// prebuilt contract before code generation. The attachment retains
|
|
18031
18024
|
// its concrete input type, while generated payloads are records.
|
|
18032
|
-
`
|
|
18025
|
+
` await __dlRunInlinePlay(${inlineHandler}, stepCtx, payload as never, ${options.force});`
|
|
18033
18026
|
] : [
|
|
18034
|
-
`
|
|
18035
|
-
`
|
|
18027
|
+
` await stepCtx.runPlay(${callId}, ${playRef}, payload, {`,
|
|
18028
|
+
` description: ${stringLiteral(command.description ?? command.alias)}`,
|
|
18036
18029
|
` });`
|
|
18037
18030
|
],
|
|
18038
|
-
|
|
18039
|
-
|
|
18040
|
-
` }`,
|
|
18031
|
+
``,
|
|
18032
|
+
` __dlAssertSuccessfulToolResult(result);`,
|
|
18041
18033
|
` return __dlPlayResultValue(${alias}, result);`,
|
|
18042
18034
|
`}`
|
|
18043
18035
|
].join("\n");
|
|
@@ -18071,23 +18063,17 @@ function renderInlineJavascriptStep(command, options) {
|
|
|
18071
18063
|
`async (row) => {`,
|
|
18072
18064
|
...options.precheck ? [` if (${options.precheck}) return null;`] : [],
|
|
18073
18065
|
...runIfLines,
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
|
|
18079
|
-
|
|
18080
|
-
`${options.waterfallSoftFail ? " " : " "} return (() => {`,
|
|
18066
|
+
` const __dlPayload = __dlRuntimePayload('run_javascript', __dlTemplate(${payload}, row as Record<string, unknown>) as Record<string, unknown>, row as Record<string, unknown>);`,
|
|
18067
|
+
` const rawResult = ((row: Record<string, any>, input: Record<string, any>, context: Record<string, any>) => {`,
|
|
18068
|
+
` const payload = __dlPayload as Record<string, any>;`,
|
|
18069
|
+
` const extract = __dlInlineExtract;`,
|
|
18070
|
+
` const extractList = __dlInlineExtractList;`,
|
|
18071
|
+
` return (() => {`,
|
|
18081
18072
|
indent(renderJavascriptBody(code), 4),
|
|
18082
|
-
|
|
18083
|
-
|
|
18084
|
-
|
|
18085
|
-
|
|
18086
|
-
...options.waterfallSoftFail ? [
|
|
18087
|
-
` } catch (error) {`,
|
|
18088
|
-
` return __dlExtractorFailure(error);`,
|
|
18089
|
-
` }`
|
|
18090
|
-
] : [],
|
|
18073
|
+
` })();`,
|
|
18074
|
+
` })(row as Record<string, any>, row as Record<string, any>, row as Record<string, any>);`,
|
|
18075
|
+
` const result = await Promise.resolve(rawResult);`,
|
|
18076
|
+
` return ${resultExpression};`,
|
|
18091
18077
|
`}`
|
|
18092
18078
|
].join("\n");
|
|
18093
18079
|
}
|
|
@@ -18221,7 +18207,6 @@ function renderWaterfallColumns(command, forceAliases, inlineRunJavascript, idio
|
|
|
18221
18207
|
legacyEnvelope: Boolean(nested.extract_js),
|
|
18222
18208
|
inlineRunJavascript,
|
|
18223
18209
|
idiomaticGetters,
|
|
18224
|
-
waterfallSoftFail: true,
|
|
18225
18210
|
nativeRunIf: Boolean(runIfSource)
|
|
18226
18211
|
}),
|
|
18227
18212
|
{
|
|
@@ -18555,6 +18540,14 @@ function helperSource() {
|
|
|
18555
18540
|
` return status === 'error' || status === 'failed' || (typeof record.error === 'string' && record.error.trim() !== '') || (typeof resultError === 'string' && resultError.trim() !== '');`,
|
|
18556
18541
|
`}`,
|
|
18557
18542
|
``,
|
|
18543
|
+
`function __dlAssertSuccessfulToolResult(value: unknown): void {`,
|
|
18544
|
+
` if (!__dlErrorPayload(value)) return;`,
|
|
18545
|
+
` const record = value as Record<string, unknown>;`,
|
|
18546
|
+
` const result = record.result && typeof record.result === 'object' && !Array.isArray(record.result) ? record.result as Record<string, unknown> : null;`,
|
|
18547
|
+
` const message = typeof record.error === 'string' ? record.error : typeof result?.error === 'string' ? result.error : typeof result?.message === 'string' ? result.message : 'Tool returned an error-shaped result.';`,
|
|
18548
|
+
` throw new Error(message);`,
|
|
18549
|
+
`}`,
|
|
18550
|
+
``,
|
|
18558
18551
|
`function __dlGeneratedCellError(value: unknown): boolean {`,
|
|
18559
18552
|
` if (typeof value === 'string') {`,
|
|
18560
18553
|
` const lower = value.trim().toLowerCase();`,
|
|
@@ -18945,37 +18938,6 @@ function helperSource() {
|
|
|
18945
18938
|
` return keys ? __dlProjectListRows(rows, keys, payload) : rows;`,
|
|
18946
18939
|
`}`,
|
|
18947
18940
|
``,
|
|
18948
|
-
`function __dlErrorMessage(error: unknown): string {`,
|
|
18949
|
-
` if (error instanceof Error && error.message) return error.message;`,
|
|
18950
|
-
` if (typeof error === 'string' && error.trim()) return error.trim();`,
|
|
18951
|
-
` return 'Extractor failed';`,
|
|
18952
|
-
`}`,
|
|
18953
|
-
``,
|
|
18954
|
-
`function __dlErrorDetail(error: unknown): string {`,
|
|
18955
|
-
` const message = __dlErrorMessage(error);`,
|
|
18956
|
-
` if (!__dlRecord(error)) return message;`,
|
|
18957
|
-
` try {`,
|
|
18958
|
-
` return message + ' ' + JSON.stringify(error);`,
|
|
18959
|
-
` } catch {`,
|
|
18960
|
-
` return message;`,
|
|
18961
|
-
` }`,
|
|
18962
|
-
`}`,
|
|
18963
|
-
``,
|
|
18964
|
-
`function __dlRecoverableWaterfallToolError(error: unknown): boolean {`,
|
|
18965
|
-
` const detail = __dlErrorDetail(error).toLowerCase();`,
|
|
18966
|
-
` return /\\b5\\d\\d\\b/.test(detail) || detail.includes('upstream_failure') || detail.includes('"error_category":"upstream"') || (detail.includes('"failure_origin":"provider"') && detail.includes('"status":5')) || detail.includes('bad gateway') || detail.includes('gateway time-out') || detail.includes('gateway timeout') || detail.includes('service unavailable');`,
|
|
18967
|
-
`}`,
|
|
18968
|
-
``,
|
|
18969
|
-
`function __dlWaterfallToolFailure(error: unknown, tool?: string): unknown {`,
|
|
18970
|
-
` if (tool === 'run_javascript' || __dlRecoverableWaterfallToolError(error)) return __dlExtractorFailure(error);`,
|
|
18971
|
-
` throw error;`,
|
|
18972
|
-
`}`,
|
|
18973
|
-
``,
|
|
18974
|
-
`function __dlExtractorFailure(error: unknown): unknown {`,
|
|
18975
|
-
` const message = __dlErrorMessage(error);`,
|
|
18976
|
-
` return { matched_result: null, result: { error: message, message } };`,
|
|
18977
|
-
`}`,
|
|
18978
|
-
``,
|
|
18979
18941
|
`function __dlExtract(alias: string, result: unknown, row: Record<string, unknown>, extractor: ((args: __DlExtractorHelpers) => unknown) | null, legacyEnvelope = false): unknown {`,
|
|
18980
18942
|
` const raw = __dlRawToolOutput(result);`,
|
|
18981
18943
|
` if (!extractor) return raw;`,
|
|
@@ -19016,12 +18978,8 @@ function helperSource() {
|
|
|
19016
18978
|
` };`,
|
|
19017
18979
|
` const get = (path: string): unknown => __dlExtractedValue(result, path) ?? __dlFirstByPaths(raw, path);`,
|
|
19018
18980
|
` let resolved: unknown;`,
|
|
19019
|
-
`
|
|
19020
|
-
`
|
|
19021
|
-
` resolved = typeof extracted === 'function' ? (extracted as (outputData: unknown) => unknown)(__dlLegacyOutputData(result, raw)) : extracted;`,
|
|
19022
|
-
` } catch (error) {`,
|
|
19023
|
-
` return __dlExtractorFailure(error);`,
|
|
19024
|
-
` }`,
|
|
18981
|
+
` const extracted = extractor({ row, result, data: raw, raw, pick, extract, extractList, target: pick, get });`,
|
|
18982
|
+
` resolved = typeof extracted === 'function' ? (extracted as (outputData: unknown) => unknown)(__dlLegacyOutputData(result, raw)) : extracted;`,
|
|
19025
18983
|
` if (resolved && typeof resolved === 'object' && !Array.isArray(resolved) && alias in (resolved as Record<string, unknown>)) {`,
|
|
19026
18984
|
` const aliasValue = (resolved as Record<string, unknown>)[alias];`,
|
|
19027
18985
|
` return legacyEnvelope && __dlMeaningful(aliasValue) ? __dlLegacyMatchedEnvelope(aliasValue, raw) : aliasValue;`,
|
|
@@ -19111,26 +19069,21 @@ function helperSource() {
|
|
|
19111
19069
|
` return result;`,
|
|
19112
19070
|
`}`,
|
|
19113
19071
|
``,
|
|
19114
|
-
`async function __dlRunCommand(input: { alias: string; callId: string; tool: string; payload: Record<string, unknown>; extract: ((args: __DlExtractorHelpers) => unknown) | null; runIf: ((row: Record<string, unknown>) => unknown) | null; row: Record<string, unknown>; stepCtx: { tools: { execute: (request: Record<string, unknown>) => Promise<unknown> } }; description?: string; force?: boolean; legacyEnvelope?: boolean
|
|
19072
|
+
`async function __dlRunCommand(input: { alias: string; callId: string; tool: string; payload: Record<string, unknown>; extract: ((args: __DlExtractorHelpers) => unknown) | null; runIf: ((row: Record<string, unknown>) => unknown) | null; row: Record<string, unknown>; stepCtx: { tools: { execute: (request: Record<string, unknown>) => Promise<unknown> } }; description?: string; force?: boolean; legacyEnvelope?: boolean }): Promise<unknown> {`,
|
|
19115
19073
|
` if (input.runIf) {`,
|
|
19116
19074
|
` const shouldRun = input.runIf(input.row);`,
|
|
19117
19075
|
` if (!shouldRun) return null;`,
|
|
19118
19076
|
` }`,
|
|
19119
19077
|
` const payload = __dlRuntimePayload(input.tool, __dlTemplate(input.payload, input.row) as Record<string, unknown>, input.row);`,
|
|
19120
19078
|
` if (__dlShouldSkipEmptyPayload(input.tool, payload)) return null;`,
|
|
19121
|
-
`
|
|
19122
|
-
`
|
|
19123
|
-
`
|
|
19124
|
-
`
|
|
19125
|
-
`
|
|
19126
|
-
`
|
|
19127
|
-
`
|
|
19128
|
-
`
|
|
19129
|
-
` });`,
|
|
19130
|
-
` } catch (error) {`,
|
|
19131
|
-
` if (input.waterfallSoftFail) return __dlWaterfallToolFailure(error, input.tool);`,
|
|
19132
|
-
` throw error;`,
|
|
19133
|
-
` }`,
|
|
19079
|
+
` const result = await input.stepCtx.tools.execute({`,
|
|
19080
|
+
` id: input.callId,`,
|
|
19081
|
+
` tool: input.tool,`,
|
|
19082
|
+
` input: payload,`,
|
|
19083
|
+
` ...(input.description ? { description: input.description } : {}),`,
|
|
19084
|
+
` ...(input.force ? { force: true } : {}),`,
|
|
19085
|
+
` });`,
|
|
19086
|
+
` __dlAssertSuccessfulToolResult(result);`,
|
|
19134
19087
|
` return __dlExtract(input.alias, result, input.row, input.extract, Boolean(input.legacyEnvelope));`,
|
|
19135
19088
|
`}`
|
|
19136
19089
|
].join("\n");
|
|
@@ -182,6 +182,8 @@ type PlayStaticSubstep = PlayStaticSubstepMetadata & ({
|
|
|
182
182
|
type: 'play_call';
|
|
183
183
|
playId: string;
|
|
184
184
|
execution?: 'inline' | 'child-workflow';
|
|
185
|
+
timeoutMs?: number;
|
|
186
|
+
hasExplicitTimeout?: boolean;
|
|
185
187
|
field: string;
|
|
186
188
|
inLoop?: boolean;
|
|
187
189
|
pipeline?: PlayStaticPipeline | null;
|
|
@@ -182,6 +182,8 @@ type PlayStaticSubstep = PlayStaticSubstepMetadata & ({
|
|
|
182
182
|
type: 'play_call';
|
|
183
183
|
playId: string;
|
|
184
184
|
execution?: 'inline' | 'child-workflow';
|
|
185
|
+
timeoutMs?: number;
|
|
186
|
+
hasExplicitTimeout?: boolean;
|
|
185
187
|
field: string;
|
|
186
188
|
inLoop?: boolean;
|
|
187
189
|
pipeline?: PlayStaticPipeline | null;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as PlayCompilerManifest } from './compiler-manifest-
|
|
1
|
+
import { a as PlayCompilerManifest } from './compiler-manifest-CYcwzSOJ.mjs';
|
|
2
2
|
|
|
3
3
|
declare const DEEPLINE_TOOL_CATEGORIES: readonly ["company_search", "people_search", "people_enrich", "email_finder", "email_verify", "phone_finder", "phone_verify", "identity_resolution", "reverse_lookup", "enrichment", "batch", "premium", "free"];
|
|
4
4
|
type DeeplineToolCategory = (typeof DEEPLINE_TOOL_CATEGORIES)[number] | (string & {});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as PlayCompilerManifest } from './compiler-manifest-
|
|
1
|
+
import { a as PlayCompilerManifest } from './compiler-manifest-CYcwzSOJ.js';
|
|
2
2
|
|
|
3
3
|
declare const DEEPLINE_TOOL_CATEGORIES: readonly ["company_search", "people_search", "people_enrich", "email_finder", "email_verify", "phone_finder", "phone_verify", "identity_resolution", "reverse_lookup", "enrichment", "batch", "premium", "free"];
|
|
4
4
|
type DeeplineToolCategory = (typeof DEEPLINE_TOOL_CATEGORIES)[number] | (string & {});
|
package/dist/index.js
CHANGED
|
@@ -424,10 +424,10 @@ var SDK_RELEASE = {
|
|
|
424
424
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
425
425
|
// 0.1.220 deprecates SDK CLI versions below 0.1.219 and updates them
|
|
426
426
|
// automatically without blocking their current command.
|
|
427
|
-
version: "0.1.
|
|
427
|
+
version: "0.1.230",
|
|
428
428
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
429
429
|
supportPolicy: {
|
|
430
|
-
latest: "0.1.
|
|
430
|
+
latest: "0.1.230",
|
|
431
431
|
minimumSupported: "0.1.53",
|
|
432
432
|
deprecatedBelow: "0.1.219",
|
|
433
433
|
commandMinimumSupported: [
|
package/dist/index.mjs
CHANGED
|
@@ -354,10 +354,10 @@ var SDK_RELEASE = {
|
|
|
354
354
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
355
355
|
// 0.1.220 deprecates SDK CLI versions below 0.1.219 and updates them
|
|
356
356
|
// automatically without blocking their current command.
|
|
357
|
-
version: "0.1.
|
|
357
|
+
version: "0.1.230",
|
|
358
358
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
359
359
|
supportPolicy: {
|
|
360
|
-
latest: "0.1.
|
|
360
|
+
latest: "0.1.230",
|
|
361
361
|
minimumSupported: "0.1.53",
|
|
362
362
|
deprecatedBelow: "0.1.219",
|
|
363
363
|
commandMinimumSupported: [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../compiler-manifest-
|
|
2
|
-
export { b as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-
|
|
1
|
+
import { P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../compiler-manifest-CYcwzSOJ.mjs';
|
|
2
|
+
export { b as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-CYcwzSOJ.mjs';
|
|
3
3
|
|
|
4
4
|
type PlayPackageImport = {
|
|
5
5
|
name: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../compiler-manifest-
|
|
2
|
-
export { b as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-
|
|
1
|
+
import { P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../compiler-manifest-CYcwzSOJ.js';
|
|
2
|
+
export { b as PLAY_ARTIFACT_KINDS } from '../compiler-manifest-CYcwzSOJ.js';
|
|
3
3
|
|
|
4
4
|
type PlayPackageImport = {
|
|
5
5
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
PlayRuntimeManifest,
|
|
3
|
-
PlayRuntimeManifestMap,
|
|
4
|
-
} from '../../../shared_libs/plays/compiler-manifest';
|
|
5
|
-
import { createSingleFlight } from '../../../shared_libs/play-runtime/single-flight';
|
|
6
|
-
|
|
7
|
-
type ChildManifestResolverInput = {
|
|
8
|
-
preloaded?: PlayRuntimeManifestMap | null;
|
|
9
|
-
resolveManifest: (playRef: string) => Promise<PlayRuntimeManifest | null>;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
type ChildManifestResolutionState = {
|
|
13
|
-
resolved: Map<string, PlayRuntimeManifest>;
|
|
14
|
-
flights: ReturnType<
|
|
15
|
-
typeof createSingleFlight<string, PlayRuntimeManifest | null>
|
|
16
|
-
>;
|
|
17
|
-
lastAccessedAt: number;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const RUN_RESOLUTION_CACHE_TTL_MS = 10 * 60_000;
|
|
21
|
-
const RUN_RESOLUTION_CACHE_MAX_ENTRIES = 128;
|
|
22
|
-
const runResolutionStates = new Map<string, ChildManifestResolutionState>();
|
|
23
|
-
|
|
24
|
-
function seedPreloadedManifests(
|
|
25
|
-
resolved: Map<string, PlayRuntimeManifest>,
|
|
26
|
-
preloaded?: PlayRuntimeManifestMap | null,
|
|
27
|
-
): void {
|
|
28
|
-
for (const [playRef, manifest] of Object.entries(preloaded ?? {})) {
|
|
29
|
-
resolved.set(playRef, manifest);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function createResolutionState(
|
|
34
|
-
preloaded?: PlayRuntimeManifestMap | null,
|
|
35
|
-
): ChildManifestResolutionState {
|
|
36
|
-
const resolved = new Map<string, PlayRuntimeManifest>(
|
|
37
|
-
Object.entries(preloaded ?? {}),
|
|
38
|
-
);
|
|
39
|
-
return {
|
|
40
|
-
resolved,
|
|
41
|
-
flights: createSingleFlight<string, PlayRuntimeManifest | null>(),
|
|
42
|
-
lastAccessedAt: Date.now(),
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function resolveWithState(
|
|
47
|
-
state: ChildManifestResolutionState,
|
|
48
|
-
input: ChildManifestResolverInput,
|
|
49
|
-
playRef: string,
|
|
50
|
-
): Promise<PlayRuntimeManifest | null> {
|
|
51
|
-
state.lastAccessedAt = Date.now();
|
|
52
|
-
seedPreloadedManifests(state.resolved, input.preloaded);
|
|
53
|
-
const cached = state.resolved.get(playRef);
|
|
54
|
-
if (cached) return Promise.resolve(cached);
|
|
55
|
-
|
|
56
|
-
return state.flights.run(playRef, async () => {
|
|
57
|
-
const cachedAfterAdmission = state.resolved.get(playRef);
|
|
58
|
-
if (cachedAfterAdmission) return cachedAfterAdmission;
|
|
59
|
-
|
|
60
|
-
const manifest = await input.resolveManifest(playRef);
|
|
61
|
-
if (manifest) state.resolved.set(playRef, manifest);
|
|
62
|
-
return manifest;
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function pruneRunResolutionStates(now: number): void {
|
|
67
|
-
for (const [scopeKey, state] of runResolutionStates) {
|
|
68
|
-
if (
|
|
69
|
-
state.flights.activeCount() === 0 &&
|
|
70
|
-
now - state.lastAccessedAt >= RUN_RESOLUTION_CACHE_TTL_MS
|
|
71
|
-
) {
|
|
72
|
-
runResolutionStates.delete(scopeKey);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (runResolutionStates.size <= RUN_RESOLUTION_CACHE_MAX_ENTRIES) return;
|
|
76
|
-
|
|
77
|
-
const evictable = [...runResolutionStates.entries()]
|
|
78
|
-
.filter(([, state]) => state.flights.activeCount() === 0)
|
|
79
|
-
.sort((a, b) => a[1].lastAccessedAt - b[1].lastAccessedAt);
|
|
80
|
-
for (const [scopeKey] of evictable) {
|
|
81
|
-
if (runResolutionStates.size <= RUN_RESOLUTION_CACHE_MAX_ENTRIES) break;
|
|
82
|
-
runResolutionStates.delete(scopeKey);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export function createChildManifestResolver(
|
|
87
|
-
input: ChildManifestResolverInput,
|
|
88
|
-
): (playRef: string) => Promise<PlayRuntimeManifest | null> {
|
|
89
|
-
const state = createResolutionState(input.preloaded);
|
|
90
|
-
|
|
91
|
-
return (playRef) => resolveWithState(state, input, playRef);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export function createRunScopedChildManifestResolver(
|
|
95
|
-
input: ChildManifestResolverInput & { scopeKey: string },
|
|
96
|
-
): (playRef: string) => Promise<PlayRuntimeManifest | null> {
|
|
97
|
-
const now = Date.now();
|
|
98
|
-
pruneRunResolutionStates(now);
|
|
99
|
-
let state = runResolutionStates.get(input.scopeKey);
|
|
100
|
-
if (!state) {
|
|
101
|
-
state = createResolutionState(input.preloaded);
|
|
102
|
-
runResolutionStates.set(input.scopeKey, state);
|
|
103
|
-
pruneRunResolutionStates(now);
|
|
104
|
-
}
|
|
105
|
-
state.lastAccessedAt = now;
|
|
106
|
-
|
|
107
|
-
return (playRef) => resolveWithState(state, input, playRef);
|
|
108
|
-
}
|