@lostgradient/weft 0.13.0 → 0.14.0

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.
Files changed (51) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/help-text.d.ts +3 -3
  3. package/dist/cli/help-text.js +4 -4
  4. package/dist/cli/operation-catalog-snapshot.d.ts +1 -1
  5. package/dist/cli/schedule.js +1 -3
  6. package/dist/cli/serve-registrations.d.ts +3 -3
  7. package/dist/cli/serve-registrations.js +2 -2
  8. package/dist/cli/shutdown.d.ts +11 -0
  9. package/dist/cli/shutdown.js +25 -0
  10. package/dist/cli/validate.d.ts +1 -1
  11. package/dist/cli/version-check.d.ts +1 -1
  12. package/dist/cli/version-check.js +1 -1
  13. package/dist/cli-main.js +10 -29
  14. package/dist/client/http-client-storage.js +7 -35
  15. package/dist/client/http-request.d.ts +8 -9
  16. package/dist/client/http-request.js +3 -25
  17. package/dist/core/context/parallel-operations.d.ts +0 -2
  18. package/dist/core/context/parallel-operations.js +0 -7
  19. package/dist/core/engine/callback-checkpoint-persistence.d.ts +2 -0
  20. package/dist/core/engine/callback-checkpoint-persistence.js +6 -3
  21. package/dist/core/engine/callback-creators.js +4 -22
  22. package/dist/core/engine/checkpoint-io.d.ts +1 -1
  23. package/dist/core/engine/operations-coordination.js +1 -1
  24. package/dist/core/engine/parallel-dispatch.d.ts +1 -1
  25. package/dist/core/engine/parallel-dispatch.js +1 -1
  26. package/dist/core/engine/review-list-entries.d.ts +1 -1
  27. package/dist/core/engine/review-list-entries.js +6 -30
  28. package/dist/core/engine/timeline-coordinator-detail.d.ts +1 -1
  29. package/dist/core/review/index.d.ts +87 -0
  30. package/dist/core/review/index.js +29 -0
  31. package/dist/diagnostics/validate.d.ts +9 -30
  32. package/dist/diagnostics/validate.js +83 -21
  33. package/dist/diagnostics/version-check.d.ts +2 -2
  34. package/dist/http.js +2 -2
  35. package/dist/server/openapi-error-responses.js +0 -14
  36. package/dist/server/operation-catalog/index.d.ts +1 -1
  37. package/dist/server/operation-catalog/raise-fault.d.ts +2 -1
  38. package/dist/server/operation-catalog/types.d.ts +2 -1
  39. package/dist/server/operation-fault.d.ts +1 -4
  40. package/dist/server/operation-fault.js +1 -1
  41. package/dist/server/operation-registry.d.ts +1 -1
  42. package/dist/server/operations/list-reviews.js +2 -19
  43. package/dist/server/operations/recover-all.js +1 -10
  44. package/dist/server/operations/single-workflow-control-operation.d.ts +2 -1
  45. package/dist/storage/bounded-ndjson-response.d.ts +5 -0
  46. package/dist/storage/bounded-ndjson-response.js +33 -0
  47. package/dist/storage/http.js +5 -37
  48. package/dist/storage/neon.d.ts +3 -16
  49. package/dist/version.d.ts +1 -1
  50. package/dist/version.js +1 -1
  51. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import { readBoundedNdjsonResponse } from "./bounded-ndjson-response.js";
1
2
  import { decodeBase64ToBytes, encodeBytesToBase64, isRecord } from "./byte-encoding.js";
2
3
  import { normalizeDeleteRangeOptions } from "./delete-range.js";
3
4
  import {
@@ -47,42 +48,6 @@ function parseScanLine(line) {
47
48
  const entry = parseScanEntry(JSON.parse(line));
48
49
  return [entry.key, decodeBase64ToBytes(entry.value)];
49
50
  }
50
- function assertScanResponseSize(bytesRead) {
51
- if (bytesRead > MAX_SCAN_RESPONSE_BYTES)
52
- throw Error("HTTPStorage scan response exceeded the maximum allowed size.");
53
- }
54
- async function* readNdjsonLines(response) {
55
- if (response.body === null)
56
- return;
57
- const reader = response.body.getReader(), decoder = new TextDecoder;
58
- let bufferedText = "", bytesRead = 0, reachedEndOfStream = !1;
59
- try {
60
- while (!0) {
61
- const { done, value } = await reader.read();
62
- if (done) {
63
- reachedEndOfStream = !0;
64
- break;
65
- }
66
- bytesRead += value.byteLength;
67
- assertScanResponseSize(bytesRead);
68
- bufferedText += decoder.decode(value, { stream: !0 });
69
- const lines = bufferedText.split(`
70
- `);
71
- bufferedText = lines.pop() ?? "";
72
- for (const line of lines)
73
- yield line;
74
- }
75
- bufferedText += decoder.decode();
76
- if (bufferedText.length > 0)
77
- yield bufferedText;
78
- } finally {
79
- try {
80
- if (!reachedEndOfStream)
81
- await reader.cancel();
82
- } catch {}
83
- reader.releaseLock();
84
- }
85
- }
86
51
 
87
52
  export class HTTPStorage {
88
53
  #baseUrl;
@@ -151,7 +116,10 @@ export class HTTPStorage {
151
116
  method: "GET",
152
117
  headers: { accept: "application/x-ndjson" }
153
118
  });
154
- for await (const line of readNdjsonLines(response)) {
119
+ for await (const line of readBoundedNdjsonResponse(response, {
120
+ maximumBytes: MAX_SCAN_RESPONSE_BYTES,
121
+ sizeLimitError: () => Error("HTTPStorage scan response exceeded the maximum allowed size.")
122
+ })) {
155
123
  const entry = parseScanLine(line);
156
124
  if (entry !== null)
157
125
  yield entry;
@@ -1,20 +1,7 @@
1
- import { PostgresKeyValueStorage, type PostgresKeyValueStorageOptions, type PostgresPool, type PostgresPoolClient } from './postgres-key-value-storage.ts';
1
+ import { PostgresKeyValueStorage, type PostgresKeyValueStorageOptions, type PostgresPool } from './postgres-key-value-storage.ts';
2
2
  /**
3
- * A connection that can run a single interactive transaction, obtained from
4
- * {@link NeonPool.connect}. Alias of the driver-agnostic
5
- * {@link PostgresPoolClient}; kept for backward-compatible imports.
6
- */
7
- export type NeonPoolClient = PostgresPoolClient;
8
- /**
9
- * Minimal structural view of a node-postgres `Pool`. The Neon serverless `Pool`
10
- * satisfies this; the PGlite test backend is wrapped to satisfy it too. Alias of
11
- * the driver-agnostic {@link PostgresPool}; kept for backward-compatible imports.
12
- */
13
- export type NeonPool = PostgresPool;
14
- /**
15
- * Configuration for connecting to a Neon (or any Postgres) database. Alias of the
16
- * shared {@link PostgresKeyValueStorageOptions}; `url` is optional and required
17
- * only when no `pool` is supplied.
3
+ * Configuration for connecting {@link NeonStorage} to a Neon database.
4
+ * `url` is optional and required only when no `pool` is supplied.
18
5
  *
19
6
  * @example
20
7
  * ```ts
package/dist/version.d.ts CHANGED
@@ -9,4 +9,4 @@
9
9
  * console.log(`Running Weft ${VERSION}`);
10
10
  * ```
11
11
  */
12
- export declare const VERSION = "0.13.0";
12
+ export declare const VERSION = "0.14.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.13.0";
1
+ export const VERSION = "0.14.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lostgradient/weft",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "A Bun-native durable execution engine with pluggable key-value storage.",
5
5
  "keywords": [
6
6
  "bun",