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.
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.1.74",
3
+ "version": "0.1.76",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {