@powerhousedao/reactor-workflow 6.2.3-dev.32 → 6.2.3-dev.33

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/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { H as authMethodFor, S as maxFileBytes, U as unsupportedAuth, V as UnsupportedPieceFeatureError, W as unsupportedTrigger, a as redactMessage, c as DEFAULT_EGRESS_POLICY, d as parseAddress, m as extractDedupeKey, n as containsRedactedMarker, o as rememberSecrets, r as redact, s as secretsFor, u as isPrivateAddress, y as FileTooLargeError } from "./redact-LRWHJGW9.js";
2
- import { A as expressionsIn, B as PieceWorker, C as describeBuiltinPiece, E as BoundConnectionResolver, F as parseSecretRef, G as sourcedResolver, H as PieceWorkerTimeoutError, I as secretRefFromId, J as npmRegistryBaseUrl, L as stepBlock, N as SecretDeletedError, O as declaredConnectionIds, P as SecretNotFoundError, R as triggerBlock, S as builtinPiece, T as CORE_PIECE_VERSION, U as bundleResolver, V as PieceWorkerError, W as pieceModuleRef, X as setPieceRegistryUrl, Y as pieceRegistrySource, _ as servesReactorPort, a as runWorkflow, b as unpinnedNote, c as stepConfigHash, d as ActivepiecesBlockExecutor, f as CompositeBlockExecutor, g as resolvedBlock, h as reactorHandlers, i as packagePieces, j as resolveExpressions, k as shapeConnection, l as DynamicPropertiesError, m as isHostBound, n as installedPiece, o as canonicalJson, p as REACTOR_PORT_PIECE, r as installedPieces, s as hashOf, t as PieceRegistry, u as checkDynamicProperties, v as storeHandlers, w as CORE_PIECE_NAME, x as blockPorts, y as blockLabel, z as PieceWorkerPool } from "./piece-registry-BAm8pRDY.js";
2
+ import { A as expressionsIn, B as PieceWorker, C as describeBuiltinPiece, E as BoundConnectionResolver, F as parseSecretRef, G as sourcedResolver, H as PieceWorkerTimeoutError, I as secretRefFromId, J as npmRegistryBaseUrl, L as stepBlock, N as SecretDeletedError, O as declaredConnectionIds, P as SecretNotFoundError, R as triggerBlock, S as builtinPiece, T as CORE_PIECE_VERSION, U as bundleResolver, V as PieceWorkerError, W as pieceModuleRef, X as setPieceRegistryUrl, Y as pieceRegistrySource, _ as servesReactorPort, a as runWorkflow, b as unpinnedNote, c as stepConfigHash, d as ActivepiecesBlockExecutor, f as CompositeBlockExecutor, g as resolvedBlock, h as reactorHandlers, i as packagePieces, j as resolveExpressions, k as shapeConnection, l as DynamicPropertiesError, m as isHostBound, n as installedPiece, o as canonicalJson, p as REACTOR_PORT_PIECE, r as installedPieces, s as hashOf, t as PieceRegistry, u as checkDynamicProperties, v as storeHandlers, w as CORE_PIECE_NAME, x as blockPorts, y as blockLabel, z as PieceWorkerPool } from "./piece-registry-Cy1a1UIa.js";
3
3
  import { WebhookHandshakeStrategy } from "@powerhousedao/pieces-framework";
4
4
  import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
5
5
  import { open, readFile, rm } from "node:fs/promises";
@@ -8474,6 +8474,11 @@ var WorkflowRuntimeService = class {
8474
8474
  seedError;
8475
8475
  constructor(host) {
8476
8476
  this.host = host;
8477
+ this.blockResolver = new BlockResolver({
8478
+ local: installedPiece,
8479
+ timeoutMs: host.pieceVersionLookupMs ?? PIECE_VERSION_LOOKUP_TIMEOUT_MS,
8480
+ hasBlock: (ref, version, source) => this.versionHasBlock(ref, version, source)
8481
+ });
8477
8482
  this.logger = host.logger ?? logger;
8478
8483
  this.attachments = host.attachments ? createAttachmentPort(host.attachments, () => currentWorkflowId(), (documentId, ref) => host.canReadAttachmentRef?.(documentId, ref) ?? Promise.resolve(false)) : void 0;
8479
8484
  this.storePromise = WorkflowRunStore.create(host.relationalDb);
@@ -8746,11 +8751,7 @@ var WorkflowRuntimeService = class {
8746
8751
  }
8747
8752
  };
8748
8753
  }
8749
- blockResolver = new BlockResolver({
8750
- local: installedPiece,
8751
- timeoutMs: PIECE_VERSION_LOOKUP_TIMEOUT_MS,
8752
- hasBlock: (ref, version, source) => this.versionHasBlock(ref, version, source)
8753
- });
8754
+ blockResolver;
8754
8755
  async versionHasBlock(ref, version, source) {
8755
8756
  let descriptor;
8756
8757
  try {
@@ -10420,38 +10421,18 @@ const WORKFLOW_TRIGGERS_READ_MODEL = "workflow-triggers";
10420
10421
  const WORKFLOW_TRIGGERS_READ_MODEL_STAGE = "post_ready";
10421
10422
  var WorkflowTriggersReadModel = class extends BaseReadModel {
10422
10423
  runtime;
10423
- freshRegistration = false;
10424
10424
  constructor(db, operationIndex, writeCache, consistencyTracker, runtime) {
10425
10425
  super(db, operationIndex, writeCache, consistencyTracker, {
10426
10426
  readModelId: WORKFLOW_TRIGGERS_READ_MODEL,
10427
10427
  rebuildStateOnInit: false,
10428
- indexing: defaultReadModelIndexingConfig
10428
+ indexing: defaultReadModelIndexingConfig,
10429
+ startFrom: "head"
10429
10430
  });
10430
10431
  this.runtime = runtime;
10431
10432
  }
10432
- async init() {
10433
- if (await this.loadState() === void 0) {
10434
- this.freshRegistration = true;
10435
- return;
10436
- }
10437
- this.freshRegistration = false;
10438
- await super.init();
10439
- }
10440
- async indexOperations(items) {
10441
- if (items.length === 0) return;
10442
- await super.indexOperations(items);
10443
- this.freshRegistration = false;
10444
- }
10445
10433
  async commitOperations(items) {
10446
10434
  await this.runtime.onOperations(items);
10447
10435
  }
10448
- async saveState(trx, items) {
10449
- if (this.freshRegistration) await trx.insertInto("ViewState").values({
10450
- readModelId: this.config.readModelId,
10451
- lastOrdinal: 0
10452
- }).onConflict((oc) => oc.column("readModelId").doNothing()).execute();
10453
- await super.saveState(trx, items);
10454
- }
10455
10436
  };
10456
10437
  //#endregion
10457
10438
  export { CORE_PIECE_NAME, CORE_PIECE_VERSION, InvalidRunCursorError, PieceRegistry, WORKFLOW_PACKAGE_NAME, WORKFLOW_SYNCING_MESSAGE, WORKFLOW_TRIGGERS_READ_MODEL, WORKFLOW_TRIGGERS_READ_MODEL_STAGE, WorkflowRuntimeService, WorkflowSyncingError, WorkflowTriggersReadModel, createAttachmentPort, createWorkflowRuntime, packagePieces, setPieceRegistryUrl };