@powerhousedao/reactor-workflow 6.2.3-dev.34 → 6.2.3-dev.36

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.
@@ -1,4 +1,4 @@
1
- import { A as REACTOR_CREATE, D as jsonSafe, F as REACTOR_MODELS, I as STORE_DELETE, J as getActions, L as STORE_GET, M as REACTOR_FIND, N as REACTOR_GET, O as LOG_WRITE, P as REACTOR_MODEL, R as STORE_PUT, a as redactMessage, c as DEFAULT_EGRESS_POLICY, i as redactError, j as REACTOR_EXECUTE, k as OUTPUT_UPDATE, n as containsRedactedMarker, o as rememberSecrets, r as redact, s as secretsFor, t as collectSecretValues, v as rewriteFileRefs, x as configuredMaxFileBytes, z as buildDescriptor } from "./redact-LRWHJGW9.js";
1
+ import { A as REACTOR_FIND, B as buildDescriptor, D as jsonSafe, F as REACTOR_SUBMIT_CREATE, I as REACTOR_WAIT, L as STORE_DELETE, M as REACTOR_MODEL, N as REACTOR_MODELS, O as LOG_WRITE, P as REACTOR_SUBMIT, R as STORE_GET, Y as getActions, a as redactMessage, c as DEFAULT_EGRESS_POLICY, i as redactError, j as REACTOR_GET, k as OUTPUT_UPDATE, n as containsRedactedMarker, o as rememberSecrets, r as redact, s as secretsFor, t as collectSecretValues, v as rewriteFileRefs, x as configuredMaxFileBytes, z as STORE_PUT } from "./redact-DW7W5rrV.js";
2
2
  import { AppConnectionType, PieceCategory, Property, TriggerStrategy, createAction, createPiece, createTrigger } from "@powerhousedao/pieces-framework";
3
3
  import { execFile, fork } from "node:child_process";
4
4
  import { existsSync } from "node:fs";
@@ -18,7 +18,7 @@ function source(baseUrl) {
18
18
  baseUrl,
19
19
  catalogUrl: (suggestions) => suggestions ? `${baseUrl}/pieces?suggestionType=ACTION_AND_TRIGGER` : `${baseUrl}/pieces`,
20
20
  pieceUrl: (name) => `${baseUrl}/pieces/${encodeURIComponent(name)}`,
21
- tarballUrl: (name, version) => `${baseUrl}/-/pieces/bundled/${name.replace("/", "-")}-${version}.tgz`
21
+ tarballUrl: (name, version) => `${baseUrl}/-/pieces/bundled/${name}/${version}.tgz`
22
22
  };
23
23
  }
24
24
  let configured;
@@ -492,6 +492,7 @@ function serveNotify(message, handlers) {
492
492
  var PieceWorker = class {
493
493
  connect;
494
494
  defaultTimeoutMs;
495
+ hostCallTimeoutMs;
495
496
  worker;
496
497
  queue = Promise.resolve();
497
498
  nextId = 1;
@@ -499,6 +500,7 @@ var PieceWorker = class {
499
500
  const entryPath = options.entryPath;
500
501
  this.connect = options.transport ?? (() => createForkTransport(entryPath ?? defaultEntryPath()));
501
502
  this.defaultTimeoutMs = options.defaultTimeoutMs ?? 3e4;
503
+ this.hostCallTimeoutMs = options.hostCallTimeoutMs;
502
504
  }
503
505
  runAction(request, options = {}) {
504
506
  return this.enqueue("run", request, options.timeoutMs, options);
@@ -539,6 +541,7 @@ var PieceWorker = class {
539
541
  const worker = this.spawn();
540
542
  const id = this.nextId++;
541
543
  return new Promise((resolve, reject) => {
544
+ const deadline = Date.now() + timeoutMs;
542
545
  const timer = setTimeout(() => {
543
546
  cleanup();
544
547
  worker.kill();
@@ -587,6 +590,8 @@ var PieceWorker = class {
587
590
  type,
588
591
  request: {
589
592
  maxFileBytes: configuredMaxFileBytes(),
593
+ deadline,
594
+ ...this.hostCallTimeoutMs ? { hostCallTimeoutMs: this.hostCallTimeoutMs } : {},
590
595
  ...request
591
596
  }
592
597
  }));
@@ -1682,7 +1687,7 @@ const manualTrigger = createTrigger({
1682
1687
  });
1683
1688
  //#endregion
1684
1689
  //#region src/pieces/core/version.ts
1685
- const CORE_PIECE_VERSION = "6.2.3-dev.34";
1690
+ const CORE_PIECE_VERSION = "6.2.3-dev.36";
1686
1691
  //#endregion
1687
1692
  //#region src/pieces/core/index.ts
1688
1693
  const corePiece = createPiece({
@@ -1820,6 +1825,11 @@ function storeKeyOf(payload) {
1820
1825
  if (typeof key !== "string" || key === "") throw new Error("Store call carried no key");
1821
1826
  return key;
1822
1827
  }
1828
+ const MAX_REACTOR_WAIT_MS = 5e3;
1829
+ function waitMs(value) {
1830
+ if (typeof value !== "number" || !Number.isFinite(value)) return 0;
1831
+ return Math.min(Math.max(Math.floor(value), 0), MAX_REACTOR_WAIT_MS);
1832
+ }
1823
1833
  function reactorInput(payload) {
1824
1834
  if (typeof payload !== "object" || payload === null || Array.isArray(payload)) throw new Error("Reactor call carried no input object");
1825
1835
  return payload;
@@ -1863,6 +1873,14 @@ function findMatch(value) {
1863
1873
  value: wanted
1864
1874
  };
1865
1875
  }
1876
+ function executeInput(payload) {
1877
+ const input = reactorInput(payload);
1878
+ return {
1879
+ documentId: requiredString(input, "documentId"),
1880
+ ...optionalString(input, "branch") ? { branch: optionalString(input, "branch") } : {},
1881
+ actions: reactorActions(input)
1882
+ };
1883
+ }
1866
1884
  function reactorHandlers(port) {
1867
1885
  return {
1868
1886
  [REACTOR_MODELS]: () => port.models(),
@@ -1884,20 +1902,20 @@ function reactorHandlers(port) {
1884
1902
  ...input.withState === true ? { withState: true } : {}
1885
1903
  });
1886
1904
  },
1887
- [REACTOR_CREATE]: (payload) => {
1905
+ [REACTOR_SUBMIT_CREATE]: (payload) => {
1888
1906
  const input = reactorInput(payload);
1889
- return port.create({
1907
+ return port.submitCreate({
1890
1908
  documentType: requiredString(input, "documentType"),
1891
1909
  ...optionalString(input, "name") ? { name: optionalString(input, "name") } : {},
1892
1910
  ...optionalString(input, "parentId") ? { parentId: optionalString(input, "parentId") } : {}
1893
1911
  });
1894
1912
  },
1895
- [REACTOR_EXECUTE]: (payload) => {
1913
+ [REACTOR_SUBMIT]: (payload) => port.submit(executeInput(payload)),
1914
+ [REACTOR_WAIT]: (payload) => {
1896
1915
  const input = reactorInput(payload);
1897
- return port.execute({
1898
- documentId: requiredString(input, "documentId"),
1899
- ...optionalString(input, "branch") ? { branch: optionalString(input, "branch") } : {},
1900
- actions: reactorActions(input)
1916
+ return port.wait({
1917
+ jobId: requiredString(input, "jobId"),
1918
+ maxWaitMs: waitMs(input.maxWaitMs)
1901
1919
  });
1902
1920
  }
1903
1921
  };
@@ -2463,4 +2481,4 @@ function installedPieces() {
2463
2481
  //#endregion
2464
2482
  export { resolveStepInput as A, PieceWorker as B, describeBuiltinPiece as C, StaticConnectionResolver as D, BoundConnectionResolver as E, parseSecretRef as F, sourcedResolver as G, PieceWorkerTimeoutError as H, secretRefFromId as I, npmRegistryBaseUrl as J, ensurePieceBundle as K, stepBlock as L, InMemorySecretProvider as M, SecretDeletedError as N, declaredConnectionIds as O, SecretNotFoundError as P, triggerBlock as R, builtinPiece as S, CORE_PIECE_VERSION as T, bundleResolver as U, PieceWorkerError as V, pieceModuleRef as W, setPieceRegistryUrl as X, pieceRegistrySource as Y, servesReactorPort as _, runWorkflow as a, unpinnedNote as b, stepConfigHash as c, ActivepiecesBlockExecutor as d, CompositeBlockExecutor as f, resolvedBlock as g, reactorHandlers as h, packagePieces as i, expressionsIn as j, shapeConnection as k, DynamicPropertiesError as l, isHostBound as m, installedPiece as n, canonicalJson as o, REACTOR_PORT_PIECE as p, fetchPieceBundle as q, installedPieces as r, hashOf as s, PieceRegistry as t, checkDynamicProperties as u, storeHandlers as v, CORE_PIECE_NAME$1 as w, blockPorts as x, blockLabel as y, PieceWorkerPool as z };
2465
2483
 
2466
- //# sourceMappingURL=piece-registry-CAMLtGeP.js.map
2484
+ //# sourceMappingURL=piece-registry-BCaD5pxR.js.map