deepline 0.1.74 → 0.1.76
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 +1295 -344
- package/dist/cli/index.mjs +1297 -346
- package/dist/index.d.mts +45 -1
- package/dist/index.d.ts +45 -1
- package/dist/index.js +6 -3
- package/dist/index.mjs +6 -3
- package/dist/repo/apps/play-runner-workers/src/entry.ts +101 -45
- package/dist/repo/sdk/src/client.ts +8 -0
- package/dist/repo/sdk/src/play.ts +2 -1
- package/dist/repo/sdk/src/plays/harness-stub.ts +1 -0
- package/dist/repo/sdk/src/release.ts +3 -3
- package/dist/repo/sdk/src/worker-play-entry.ts +3 -0
- package/dist/repo/shared_libs/play-runtime/cell-staleness.ts +88 -0
- package/dist/repo/shared_libs/play-runtime/step-program-dataset-builder.ts +5 -0
- package/dist/repo/shared_libs/plays/row-identity.ts +0 -40
- package/package.json +1 -1
|
@@ -3,11 +3,13 @@ export type StepProgramDatasetOptions = {
|
|
|
3
3
|
row: Record<string, unknown>,
|
|
4
4
|
index: number,
|
|
5
5
|
) => boolean | Promise<boolean>;
|
|
6
|
+
staleAfterSeconds?: number;
|
|
6
7
|
};
|
|
7
8
|
|
|
8
9
|
export type StepProgramDatasetStep<TResolver> = {
|
|
9
10
|
name: string;
|
|
10
11
|
resolver: TResolver;
|
|
12
|
+
staleAfterSeconds?: number;
|
|
11
13
|
};
|
|
12
14
|
|
|
13
15
|
export type StepProgramDatasetProgram<TStep> = {
|
|
@@ -84,6 +86,9 @@ export class StepProgramDatasetBuilder<
|
|
|
84
86
|
{
|
|
85
87
|
name,
|
|
86
88
|
resolver: this.applyDerivationOptions(resolver, options),
|
|
89
|
+
...(options?.staleAfterSeconds !== undefined
|
|
90
|
+
? { staleAfterSeconds: options.staleAfterSeconds }
|
|
91
|
+
: {}),
|
|
87
92
|
} as TStep,
|
|
88
93
|
];
|
|
89
94
|
return this;
|
|
@@ -192,46 +192,6 @@ export function normalizeTableNamespace(value: string): string {
|
|
|
192
192
|
);
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
export function resolveStaleMapTableNamespace(
|
|
196
|
-
mapKey: string,
|
|
197
|
-
staleAfterSeconds?: number | null,
|
|
198
|
-
nowMs: number = Date.now(),
|
|
199
|
-
): string {
|
|
200
|
-
const normalizedMapKey = normalizeTableNamespace(mapKey);
|
|
201
|
-
if (staleAfterSeconds === undefined || staleAfterSeconds === null) {
|
|
202
|
-
return normalizedMapKey;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (
|
|
206
|
-
!Number.isFinite(staleAfterSeconds) ||
|
|
207
|
-
!Number.isInteger(staleAfterSeconds) ||
|
|
208
|
-
staleAfterSeconds <= 0
|
|
209
|
-
) {
|
|
210
|
-
throw new Error(
|
|
211
|
-
'ctx.dataset() staleAfterSeconds must be a positive whole number of seconds.',
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const bucket = Math.floor(nowMs / (staleAfterSeconds * 1000));
|
|
216
|
-
const stalePartitionKey = `stale_${staleAfterSeconds}_${bucket}`;
|
|
217
|
-
const candidate = `${normalizedMapKey}_${stalePartitionKey}`;
|
|
218
|
-
if (candidate.length <= MAP_KEY_NAMESPACE_MAX_LENGTH) {
|
|
219
|
-
return candidate;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
const digest = sha256Hex(`${normalizedMapKey}\n${stalePartitionKey}`).slice(
|
|
223
|
-
0,
|
|
224
|
-
12,
|
|
225
|
-
);
|
|
226
|
-
const prefixLength = Math.max(
|
|
227
|
-
1,
|
|
228
|
-
MAP_KEY_NAMESPACE_MAX_LENGTH - digest.length - 1,
|
|
229
|
-
);
|
|
230
|
-
const prefix =
|
|
231
|
-
normalizedMapKey.slice(0, prefixLength).replace(/_+$/g, '') || 'map';
|
|
232
|
-
return `${prefix}_${digest}`;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
195
|
export function validatePlaySheetTableName(
|
|
236
196
|
playName: string,
|
|
237
197
|
tableNamespace: string,
|