@powerhousedao/reactor-workflow 6.2.3-dev.54 → 6.2.3-dev.56

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/testing.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as sourcedResolver, D as PackagePiece, E as LocalPiece, L as PieceDescriptor, M as RecordedSchedule, N as extractDedupeKey, O as PieceResolver, R as buildDescriptor, a as runWorkflow, c as CompositeBlockExecutor, d as InMemorySecretProvider, g as PieceWorker, k as PieceTarget, m as IPieceWorker, o as ActivepiecesBlockExecutor, p as PieceWorkerPool, s as AttachmentPort, t as PieceRegistry, u as StaticConnectionResolver, w as WorkflowRunResult, x as BlockExecution, z as loadPieceFromDir } from "./piece-registry-BdkdVugw.js";
1
+ import { A as sourcedResolver, D as PackagePiece, E as LocalPiece, L as PieceDescriptor, M as RecordedSchedule, N as extractDedupeKey, O as PieceResolver, R as buildDescriptor, a as runWorkflow, c as CompositeBlockExecutor, d as InMemorySecretProvider, g as PieceWorker, k as PieceTarget, m as IPieceWorker, o as ActivepiecesBlockExecutor, p as PieceWorkerPool, s as AttachmentPort, t as PieceRegistry, u as StaticConnectionResolver, w as WorkflowRunResult, x as BlockExecution, y as WorkflowTelemetry, z as loadPieceFromDir } from "./piece-registry-BbeuE8TB.js";
2
2
  //#region src/pieces/activepieces/fetch.d.ts
3
3
  interface FetchPieceBundleOptions {
4
4
  name: string;
@@ -21,6 +21,6 @@ interface FetchedBundle {
21
21
  export declare function fetchPieceBundle(options: FetchPieceBundleOptions): Promise<FetchedBundle>;
22
22
  export declare function ensurePieceBundle(options: FetchPieceBundleOptions): Promise<FetchedBundle>;
23
23
  //#endregion
24
- export { ActivepiecesBlockExecutor, type AttachmentPort, type BlockExecution, CompositeBlockExecutor, type IPieceWorker, InMemorySecretProvider, type LocalPiece, type PackagePiece, type PieceDescriptor, PieceRegistry, type PieceResolver, type PieceTarget, PieceWorker, PieceWorkerPool, type RecordedSchedule, StaticConnectionResolver, type WorkflowRunResult, buildDescriptor, extractDedupeKey, loadPieceFromDir, runWorkflow, sourcedResolver };
24
+ export { ActivepiecesBlockExecutor, type AttachmentPort, type BlockExecution, CompositeBlockExecutor, type IPieceWorker, InMemorySecretProvider, type LocalPiece, type PackagePiece, type PieceDescriptor, PieceRegistry, type PieceResolver, type PieceTarget, PieceWorker, PieceWorkerPool, type RecordedSchedule, StaticConnectionResolver, type WorkflowRunResult, WorkflowTelemetry, buildDescriptor, extractDedupeKey, loadPieceFromDir, runWorkflow, sourcedResolver };
25
25
  export {};
26
26
  //# sourceMappingURL=testing.d.ts.map
package/dist/testing.js CHANGED
@@ -1,4 +1,4 @@
1
- import { F as InMemorySecretProvider, H as PieceWorkerPool, U as PieceWorker, ft as ensurePieceBundle, h as CompositeBlockExecutor, k as StaticConnectionResolver, m as ActivepiecesBlockExecutor, ot as sourcedResolver, pt as fetchPieceBundle, s as runWorkflow, st as buildDescriptor, t as PieceRegistry, tt as extractDedupeKey } from "./piece-registry-0pdOQQdk.js";
1
+ import { G as PieceWorkerPool, K as PieceWorker, M as StaticConnectionResolver, R as InMemorySecretProvider, a as PieceRegistry, d as runWorkflow, gt as fetchPieceBundle, ht as ensurePieceBundle, it as extractDedupeKey, lt as sourcedResolver, n as WorkflowTelemetry, ut as buildDescriptor, v as ActivepiecesBlockExecutor, y as CompositeBlockExecutor } from "./telemetry-CM82x7pC.js";
2
2
  import { createRequire } from "node:module";
3
3
  import { readFileSync, realpathSync } from "node:fs";
4
4
  import path from "node:path";
@@ -87,6 +87,6 @@ async function loadPieceFromDir(pieceDir) {
87
87
  return loadPiece(resolveEntry(pieceDir));
88
88
  }
89
89
  //#endregion
90
- export { ActivepiecesBlockExecutor, CompositeBlockExecutor, InMemorySecretProvider, PieceRegistry, PieceWorker, PieceWorkerPool, StaticConnectionResolver, buildDescriptor, ensurePieceBundle, extractDedupeKey, fetchPieceBundle, loadPieceFromDir, runWorkflow, sourcedResolver };
90
+ export { ActivepiecesBlockExecutor, CompositeBlockExecutor, InMemorySecretProvider, PieceRegistry, PieceWorker, PieceWorkerPool, StaticConnectionResolver, WorkflowTelemetry, buildDescriptor, ensurePieceBundle, extractDedupeKey, fetchPieceBundle, loadPieceFromDir, runWorkflow, sourcedResolver };
91
91
 
92
92
  //# sourceMappingURL=testing.js.map
@@ -1,6 +1,6 @@
1
1
  import { createRequire, flushCompileCache } from "node:module";
2
2
  import crypto from "crypto";
3
- import path from "node:path";
3
+ import path, { resolve } from "node:path";
4
4
  import { mkdir, readFile, rm, stat, writeFile } from "node:fs/promises";
5
5
  import { format } from "node:util";
6
6
  import { Readable, Transform } from "node:stream";
@@ -4645,6 +4645,11 @@ var StagedFilesService = class {
4645
4645
  };
4646
4646
  //#endregion
4647
4647
  //#region src/pieces/activepieces/context/normalize.ts
4648
+ function lazyFileStream(filePath) {
4649
+ return Readable.from((async function* () {
4650
+ yield* createReadStream(filePath);
4651
+ })(), { objectMode: false });
4652
+ }
4648
4653
  const FETCH_TIMEOUT_MS = 3e4;
4649
4654
  const FILE_REF = /^(?:attachment|apfile):\/\//i;
4650
4655
  var FileFetchError = class extends Error {
@@ -4805,12 +4810,13 @@ function decodeDataUri(match) {
4805
4810
  mime: mime || void 0
4806
4811
  };
4807
4812
  }
4808
- function streamingValue(name, extension, size, body) {
4813
+ function streamingValue(name, extension, size, body, path) {
4809
4814
  return {
4810
4815
  filename: name,
4811
4816
  ...extension ? { extension } : {},
4812
4817
  ...size !== void 0 ? { size } : {},
4813
- body
4818
+ body,
4819
+ ...path ? { path } : {}
4814
4820
  };
4815
4821
  }
4816
4822
  async function toApStreamingFile(value, options = {}) {
@@ -4833,7 +4839,8 @@ async function toApStreamingFile(value, options = {}) {
4833
4839
  const opened = await options.openRef(trimmed);
4834
4840
  assertWithinLimit(opened.size);
4835
4841
  const { name, extension } = fileName(opened.filename, opened.contentType);
4836
- return streamingValue(name, extension, opened.size, createReadStream(opened.path));
4842
+ const filePath = resolve(opened.path);
4843
+ return streamingValue(name, extension, opened.size, lazyFileStream(filePath), filePath);
4837
4844
  }
4838
4845
  if (/^https?:\/\//i.test(trimmed)) {
4839
4846
  const { response, declared, filename } = await openUrl(trimmed);
@@ -5773,9 +5780,22 @@ function installEgressGuard() {
5773
5780
  }
5774
5781
  //#endregion
5775
5782
  //#region src/pieces/activepieces/worker/timings.ts
5776
- function epochNow() {
5777
- return performance.timeOrigin + performance.now();
5783
+ const ANCHOR_MS = 1e3;
5784
+ const STEP_MS = 5;
5785
+ function wallClock() {
5786
+ let anchoredAt = performance.now();
5787
+ let anchor = Date.now() - anchoredAt;
5788
+ return () => {
5789
+ const now = performance.now();
5790
+ if (now - anchoredAt >= ANCHOR_MS) {
5791
+ anchoredAt = now;
5792
+ const next = Date.now() - now;
5793
+ if (Math.abs(next - anchor) > STEP_MS) anchor = next;
5794
+ }
5795
+ return anchor + now;
5796
+ };
5778
5797
  }
5798
+ const epochNow = wallClock();
5779
5799
  let readyAt;
5780
5800
  let bootReported = false;
5781
5801
  function markWorkerReady() {
@@ -5812,10 +5832,17 @@ async function timed(name, fn, attributes) {
5812
5832
  function finishRequestTimings(timings) {
5813
5833
  const boot = !bootReported && readyAt !== void 0;
5814
5834
  bootReported = true;
5835
+ const { rss, heapUsed, heapTotal, external } = process.memoryUsage();
5815
5836
  return {
5816
5837
  received: timings.received,
5817
5838
  sent: epochNow(),
5818
5839
  phases: timings.phases,
5840
+ memory: {
5841
+ rss,
5842
+ heapUsed,
5843
+ heapTotal,
5844
+ external
5845
+ },
5819
5846
  ...boot ? { ready: readyAt } : {}
5820
5847
  };
5821
5848
  }