@powerhousedao/reactor-workflow 6.2.3-dev.75 → 6.2.3-dev.77

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,4 +1,4 @@
1
- import { $ as rememberSecrets, A as AttachmentCache, B as SecretNotFoundError, C as blockLabel, D as describeBuiltinPiece, E as builtinPiece, F as shapeConnection, G as PieceWorkerPool, H as secretRefFromId, I as resolveStepInput, J as PieceWorkerError, K as PieceWorker, L as expressionsIn, N as declaredConnectionIds, O as CORE_PIECE_NAME, P as declaredReactorConnectionIds, Q as redactMessage, S as storeHandlers, T as blockPorts, U as stepBlock, V as parseSecretRef, W as triggerBlock, X as containsRedactedMarker, Y as PieceWorkerTimeoutError, Z as redact, _ as effectiveRetryPolicy, _t as npmRegistryBaseUrl, a as PieceRegistry, at as FileTooLargeError, b as isHostBound, bt as isIndeterminateError, c as packagePieces, ct as pieceModuleRef, d as runWorkflow, dt as UnsupportedPieceFeatureError, et as secretsFor, f as canonicalJson, ft as authMethodFor, g as checkDynamicProperties, h as DynamicPropertiesError, i as tracedSteps, it as extractDedupeKey, j as BoundConnectionResolver, k as CORE_PIECE_VERSION, lt as sourcedResolver, m as stepConfigHash, mt as unsupportedTrigger, n as WorkflowTelemetry, nt as isPrivateAddress, o as installedPiece, ot as maxFileBytes, p as hashOf, pt as unsupportedAuth, q as PieceWorkerDisposedError, r as tracedMethods, rt as parseAddress, s as installedPieces, st as bundleResolver, t as TELEMETRY_SCOPE, tt as DEFAULT_EGRESS_POLICY, u as errorNameOf, v as ActivepiecesBlockExecutor, vt as pieceRegistrySource, w as unpinnedNote, x as resolvedBlock, y as CompositeBlockExecutor, yt as setPieceRegistryUrl, z as SecretDeletedError } from "./telemetry-tEuCNuOU.js";
1
+ import { $ as rememberSecrets, A as AttachmentCache, B as SecretNotFoundError, C as blockLabel, D as describeBuiltinPiece, E as builtinPiece, F as shapeConnection, G as PieceWorkerPool, H as secretRefFromId, I as resolveStepInput, J as PieceWorkerError, K as PieceWorker, L as expressionsIn, N as declaredConnectionIds, O as CORE_PIECE_NAME, P as declaredReactorConnectionIds, Q as redactMessage, S as storeHandlers, T as blockPorts, U as stepBlock, V as parseSecretRef, W as triggerBlock, X as containsRedactedMarker, Y as PieceWorkerTimeoutError, Z as redact, _ as effectiveRetryPolicy, _t as npmRegistryBaseUrl, a as PieceRegistry, at as FileTooLargeError, b as isHostBound, bt as isIndeterminateError, c as packagePieces, ct as pieceModuleRef, d as runWorkflow, dt as UnsupportedPieceFeatureError, et as secretsFor, f as canonicalJson, ft as authMethodFor, g as checkDynamicProperties, h as DynamicPropertiesError, i as tracedSteps, it as extractDedupeKey, j as BoundConnectionResolver, k as CORE_PIECE_VERSION, lt as sourcedResolver, m as stepConfigHash, mt as unsupportedTrigger, n as WorkflowTelemetry, nt as isPrivateAddress, o as installedPiece, ot as maxFileBytes, p as hashOf, pt as unsupportedAuth, q as PieceWorkerDisposedError, r as tracedMethods, rt as parseAddress, s as installedPieces, st as bundleResolver, t as TELEMETRY_SCOPE, tt as DEFAULT_EGRESS_POLICY, u as errorNameOf, v as ActivepiecesBlockExecutor, vt as pieceRegistrySource, w as unpinnedNote, x as resolvedBlock, y as CompositeBlockExecutor, yt as setPieceRegistryUrl, z as SecretDeletedError } from "./telemetry-CohENxMR.js";
2
2
  import { ReactorAccessDeniedError, ReactorAccessDeniedError as ReactorAccessDeniedError$1, ReactorActionsFailedError, ReactorJobFailedError, ReactorJobPendingError as ReactorJobPendingError$1, WebhookHandshakeStrategy } from "@powerhousedao/pieces-framework";
3
3
  import { mkdirSync, openAsBlob, readFileSync, writeFileSync } from "node:fs";
4
4
  import { open, readdir, rm, stat } from "node:fs/promises";
@@ -2066,16 +2066,27 @@ var RunScopedReactorClient = class {
2066
2066
  }
2067
2067
  async execute(documentIdentifier, branch, actions, signal, subject) {
2068
2068
  if (subject !== void 0) throw accessDenied("A piece may not choose the subject it reads as");
2069
- this.assertWritable("execute");
2070
2069
  const abort = this.signal(signal);
2070
+ const { id } = await this.apply("execute", documentIdentifier, branch, actions, abort);
2071
+ return this.readBack(id, branch, abort);
2072
+ }
2073
+ async executeAsync(documentIdentifier, branch, actions, signal) {
2074
+ const abort = this.signal(signal);
2075
+ const { job } = await this.apply("executeAsync", documentIdentifier, branch, actions, abort);
2076
+ return job;
2077
+ }
2078
+ async apply(method, documentIdentifier, branch, actions, abort) {
2079
+ this.assertWritable(method);
2071
2080
  for (const action of actions) {
2072
2081
  if (action.context?.signer) throw accessDenied(`Action ${action.type} carries a signer; the host signs every action`);
2073
2082
  if (DOCUMENT_SCOPE_ACTION_TYPES.has(action.type)) throw accessDenied(`${action.type} is a document lifecycle action, which pieces may not execute`);
2074
2083
  }
2075
2084
  const id = await this.resolveReference(documentIdentifier, branch, abort);
2076
2085
  await this.gate(id, branch, actions, abort);
2077
- await this.run(id, branch, actions, abort);
2078
- return this.readBack(id, branch, abort);
2086
+ return {
2087
+ id,
2088
+ job: await this.run(id, branch, actions, abort)
2089
+ };
2079
2090
  }
2080
2091
  async deleteDocument(identifier, propagate, signal) {
2081
2092
  this.assertWritable("deleteDocument");
@@ -2145,6 +2156,7 @@ var RunScopedReactorClient = class {
2145
2156
  const settled = await this.settle(info.id, signal);
2146
2157
  if (settled.status === JobStatus.FAILED) throw jobFailed(settled);
2147
2158
  assertActionsApplied(settled, actions);
2159
+ return settled;
2148
2160
  }
2149
2161
  assertTimeLeft(what) {
2150
2162
  if (Date.now() >= this.stopAt) throw new Error(`No time was left before the step deadline to submit ${what}; nothing was submitted`);
@@ -2271,9 +2283,11 @@ const SERVED = {
2271
2283
  create: true,
2272
2284
  createEmpty: true,
2273
2285
  execute: true,
2286
+ executeAsync: true,
2274
2287
  deleteDocument: true
2275
2288
  };
2276
2289
  const REFUSED = {
2290
+ getMany: true,
2277
2291
  createDocumentInDrive: true,
2278
2292
  executeBatch: true,
2279
2293
  rename: true,
@@ -2284,7 +2298,6 @@ const REFUSED = {
2284
2298
  moveRelationship: true,
2285
2299
  upgradeDocument: true,
2286
2300
  deleteDocuments: true,
2287
- executeAsync: true,
2288
2301
  createAsync: true,
2289
2302
  createEmptyAsync: true,
2290
2303
  getJobStatus: true,