@superdurable/dex 1.2.1 → 1.8.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.
package/README.md CHANGED
@@ -396,9 +396,19 @@ Flow config, Condition ID, and reuse. Parent completion does not cancel an unfin
396
396
  Client calls reject with concrete `DexServiceError` subclasses. Existing-Flow
397
397
  reads (`describeFlow`, `waitForFlow`, and `timeTravel`) use
398
398
  `FlowNotFoundError`; operations that require a running Flow use
399
- `FlowNotActiveError`. Start conflicts, worker failures, RPC lock contention,
399
+ `FlowNotActiveOrNotFoundError`. Start conflicts, worker failures, RPC lock contention,
400
400
  and long-poll timeouts use `FlowAlreadyStartedError`,
401
401
  `WorkerInvocationError`, `RpcLockConflictError`, and `LongPollTimeoutError`.
402
+
403
+ RPCs also use this error when the target Flow cannot be found, including query-only
404
+ reads. A query-only RPC without locks, transactional execution, durable effects, or
405
+ Server-forced Update routing can read a retained terminal execution. At that confirmed
406
+ read boundary, this error means no readable target was found; return the application's
407
+ missing or unavailable result directly, without a lifecycle probe, a short timeout, a
408
+ retry, or historical Step-output decoding. Preserve other service and Worker failures.
409
+ For mutations and active-only RPCs, the error can mean either missing or closed and does
410
+ not prove that the requested action succeeded. RPC success does not prove that the Flow
411
+ is active.
402
412
  Durable Step and Attribute waits reattach transparently instead of exposing
403
413
  `LongPollTimeoutError`.
404
414
 
@@ -406,7 +416,7 @@ Durable Step and Attribute waits reattach transparently instead of exposing
406
416
  try {
407
417
  await client.invokeRPC(orders.updateOrder, flowId, update);
408
418
  } catch (error) {
409
- if (error instanceof FlowNotActiveError) {
419
+ if (error instanceof FlowNotActiveOrNotFoundError) {
410
420
  // The Flow is missing or already closed.
411
421
  } else {
412
422
  throw error;
@@ -1280,6 +1280,8 @@ export interface InterpreterWorkflowInput {
1280
1280
  isResumeFromContinueAsNew: boolean;
1281
1281
  continueAsNewInput: ContinueAsNewInput | undefined;
1282
1282
  timeoutHandlerOptions: FlowTimeoutHandlerOptions | undefined;
1283
+ /** Tenant of a multi-tenant Flow, set at start and copied to SubFlows. Empty in single-tenant mode. */
1284
+ tenantId: string;
1283
1285
  }
1284
1286
  export interface InterpreterWorkflowOutput {
1285
1287
  stepCompletionOutputs: StepCompletionOutput[];
@@ -1293,6 +1295,8 @@ export interface BlobStoreCleanupWorkflowOutput {
1293
1295
  export interface InvokeWaitForMethodActivityInput {
1294
1296
  workerTarget: WorkerTarget | undefined;
1295
1297
  request: InvokeWaitForMethodRequest | undefined;
1298
+ /** Tenant of the dispatching Flow; empty in single-tenant mode. */
1299
+ tenantId: string;
1296
1300
  }
1297
1301
  export interface InvokeWaitForMethodActivityOutput {
1298
1302
  response: InvokeWaitForMethodResponse | undefined;
@@ -1300,6 +1304,8 @@ export interface InvokeWaitForMethodActivityOutput {
1300
1304
  export interface InvokeExecuteMethodActivityInput {
1301
1305
  workerTarget: WorkerTarget | undefined;
1302
1306
  request: InvokeExecuteMethodRequest | undefined;
1307
+ /** Tenant of the dispatching Flow; empty in single-tenant mode. */
1308
+ tenantId: string;
1303
1309
  }
1304
1310
  export interface RecoveryErrorInfo {
1305
1311
  detail: string;
@@ -1324,6 +1330,8 @@ export interface DumpFlowForContinueAsNewActivityOutput {
1324
1330
  export interface InvokeWorkerRPCActivityInput {
1325
1331
  rpcPrep: PrepareRpcQueryResponse | undefined;
1326
1332
  request: InvokeRPCRequest | undefined;
1333
+ /** Tenant of the Flow; empty in single-tenant mode. */
1334
+ tenantId: string;
1327
1335
  }
1328
1336
  export interface InvokeWorkerRPCActivityOutput {
1329
1337
  response: InvokeWorkerRPCResponse | undefined;
@@ -1351,6 +1359,8 @@ export interface StartSubFlowActivityInput {
1351
1359
  parentFlowConfig: FlowConfig | undefined;
1352
1360
  /** Source Step; activity context supplies parent Flow and run IDs. */
1353
1361
  parentStepExecutionId: string;
1362
+ /** Tenant of the parent Flow, inherited by the SubFlow; empty in single-tenant mode. */
1363
+ tenantId: string;
1354
1364
  }
1355
1365
  export interface StartSubFlowActivityOutput {
1356
1366
  immediateFlowResult: FlowResult | undefined;
@@ -1367,8 +1377,6 @@ export interface ReportSubFlowCompletionActivityOutput {
1367
1377
  status: SubFlowCompletionDeliveryStatus;
1368
1378
  }
1369
1379
  export interface ExecuteRpcSignalRequest {
1370
- rpcInput: Value | undefined;
1371
- rpcOutput: Value | undefined;
1372
1380
  upsertAttributes: AttributeWrite[];
1373
1381
  stepDecision: StepDecision | undefined;
1374
1382
  recordEvents: KV[];
@@ -12225,6 +12225,7 @@ function createBaseInterpreterWorkflowInput() {
12225
12225
  isResumeFromContinueAsNew: false,
12226
12226
  continueAsNewInput: undefined,
12227
12227
  timeoutHandlerOptions: undefined,
12228
+ tenantId: "",
12228
12229
  };
12229
12230
  }
12230
12231
  export const InterpreterWorkflowInput = {
@@ -12262,6 +12263,9 @@ export const InterpreterWorkflowInput = {
12262
12263
  if (message.timeoutHandlerOptions !== undefined) {
12263
12264
  FlowTimeoutHandlerOptions.encode(message.timeoutHandlerOptions, writer.uint32(90).fork()).join();
12264
12265
  }
12266
+ if (message.tenantId !== "") {
12267
+ writer.uint32(98).string(message.tenantId);
12268
+ }
12265
12269
  return writer;
12266
12270
  },
12267
12271
  decode(input, length) {
@@ -12348,6 +12352,13 @@ export const InterpreterWorkflowInput = {
12348
12352
  message.timeoutHandlerOptions = FlowTimeoutHandlerOptions.decode(reader, reader.uint32());
12349
12353
  continue;
12350
12354
  }
12355
+ case 12: {
12356
+ if (tag !== 98) {
12357
+ break;
12358
+ }
12359
+ message.tenantId = reader.string();
12360
+ continue;
12361
+ }
12351
12362
  }
12352
12363
  if ((tag & 7) === 4 || tag === 0) {
12353
12364
  break;
@@ -12383,6 +12394,7 @@ export const InterpreterWorkflowInput = {
12383
12394
  (object.timeoutHandlerOptions !== undefined && object.timeoutHandlerOptions !== null)
12384
12395
  ? FlowTimeoutHandlerOptions.fromPartial(object.timeoutHandlerOptions)
12385
12396
  : undefined;
12397
+ message.tenantId = object.tenantId ?? "";
12386
12398
  return message;
12387
12399
  },
12388
12400
  };
@@ -12510,7 +12522,7 @@ export const BlobStoreCleanupWorkflowOutput = {
12510
12522
  },
12511
12523
  };
12512
12524
  function createBaseInvokeWaitForMethodActivityInput() {
12513
- return { workerTarget: undefined, request: undefined };
12525
+ return { workerTarget: undefined, request: undefined, tenantId: "" };
12514
12526
  }
12515
12527
  export const InvokeWaitForMethodActivityInput = {
12516
12528
  encode(message, writer = new BinaryWriter()) {
@@ -12520,6 +12532,9 @@ export const InvokeWaitForMethodActivityInput = {
12520
12532
  if (message.request !== undefined) {
12521
12533
  InvokeWaitForMethodRequest.encode(message.request, writer.uint32(18).fork()).join();
12522
12534
  }
12535
+ if (message.tenantId !== "") {
12536
+ writer.uint32(26).string(message.tenantId);
12537
+ }
12523
12538
  return writer;
12524
12539
  },
12525
12540
  decode(input, length) {
@@ -12543,6 +12558,13 @@ export const InvokeWaitForMethodActivityInput = {
12543
12558
  message.request = InvokeWaitForMethodRequest.decode(reader, reader.uint32());
12544
12559
  continue;
12545
12560
  }
12561
+ case 3: {
12562
+ if (tag !== 26) {
12563
+ break;
12564
+ }
12565
+ message.tenantId = reader.string();
12566
+ continue;
12567
+ }
12546
12568
  }
12547
12569
  if ((tag & 7) === 4 || tag === 0) {
12548
12570
  break;
@@ -12562,6 +12584,7 @@ export const InvokeWaitForMethodActivityInput = {
12562
12584
  message.request = (object.request !== undefined && object.request !== null)
12563
12585
  ? InvokeWaitForMethodRequest.fromPartial(object.request)
12564
12586
  : undefined;
12587
+ message.tenantId = object.tenantId ?? "";
12565
12588
  return message;
12566
12589
  },
12567
12590
  };
@@ -12609,7 +12632,7 @@ export const InvokeWaitForMethodActivityOutput = {
12609
12632
  },
12610
12633
  };
12611
12634
  function createBaseInvokeExecuteMethodActivityInput() {
12612
- return { workerTarget: undefined, request: undefined };
12635
+ return { workerTarget: undefined, request: undefined, tenantId: "" };
12613
12636
  }
12614
12637
  export const InvokeExecuteMethodActivityInput = {
12615
12638
  encode(message, writer = new BinaryWriter()) {
@@ -12619,6 +12642,9 @@ export const InvokeExecuteMethodActivityInput = {
12619
12642
  if (message.request !== undefined) {
12620
12643
  InvokeExecuteMethodRequest.encode(message.request, writer.uint32(18).fork()).join();
12621
12644
  }
12645
+ if (message.tenantId !== "") {
12646
+ writer.uint32(26).string(message.tenantId);
12647
+ }
12622
12648
  return writer;
12623
12649
  },
12624
12650
  decode(input, length) {
@@ -12642,6 +12668,13 @@ export const InvokeExecuteMethodActivityInput = {
12642
12668
  message.request = InvokeExecuteMethodRequest.decode(reader, reader.uint32());
12643
12669
  continue;
12644
12670
  }
12671
+ case 3: {
12672
+ if (tag !== 26) {
12673
+ break;
12674
+ }
12675
+ message.tenantId = reader.string();
12676
+ continue;
12677
+ }
12645
12678
  }
12646
12679
  if ((tag & 7) === 4 || tag === 0) {
12647
12680
  break;
@@ -12661,6 +12694,7 @@ export const InvokeExecuteMethodActivityInput = {
12661
12694
  message.request = (object.request !== undefined && object.request !== null)
12662
12695
  ? InvokeExecuteMethodRequest.fromPartial(object.request)
12663
12696
  : undefined;
12697
+ message.tenantId = object.tenantId ?? "";
12664
12698
  return message;
12665
12699
  },
12666
12700
  };
@@ -12950,7 +12984,7 @@ export const DumpFlowForContinueAsNewActivityOutput = {
12950
12984
  },
12951
12985
  };
12952
12986
  function createBaseInvokeWorkerRPCActivityInput() {
12953
- return { rpcPrep: undefined, request: undefined };
12987
+ return { rpcPrep: undefined, request: undefined, tenantId: "" };
12954
12988
  }
12955
12989
  export const InvokeWorkerRPCActivityInput = {
12956
12990
  encode(message, writer = new BinaryWriter()) {
@@ -12960,6 +12994,9 @@ export const InvokeWorkerRPCActivityInput = {
12960
12994
  if (message.request !== undefined) {
12961
12995
  InvokeRPCRequest.encode(message.request, writer.uint32(18).fork()).join();
12962
12996
  }
12997
+ if (message.tenantId !== "") {
12998
+ writer.uint32(26).string(message.tenantId);
12999
+ }
12963
13000
  return writer;
12964
13001
  },
12965
13002
  decode(input, length) {
@@ -12983,6 +13020,13 @@ export const InvokeWorkerRPCActivityInput = {
12983
13020
  message.request = InvokeRPCRequest.decode(reader, reader.uint32());
12984
13021
  continue;
12985
13022
  }
13023
+ case 3: {
13024
+ if (tag !== 26) {
13025
+ break;
13026
+ }
13027
+ message.tenantId = reader.string();
13028
+ continue;
13029
+ }
12986
13030
  }
12987
13031
  if ((tag & 7) === 4 || tag === 0) {
12988
13032
  break;
@@ -13002,6 +13046,7 @@ export const InvokeWorkerRPCActivityInput = {
13002
13046
  message.request = (object.request !== undefined && object.request !== null)
13003
13047
  ? InvokeRPCRequest.fromPartial(object.request)
13004
13048
  : undefined;
13049
+ message.tenantId = object.tenantId ?? "";
13005
13050
  return message;
13006
13051
  },
13007
13052
  };
@@ -13268,7 +13313,7 @@ export const SyncAttributeBatchActivityInput = {
13268
13313
  },
13269
13314
  };
13270
13315
  function createBaseStartSubFlowActivityInput() {
13271
- return { condition: undefined, parentFlowConfig: undefined, parentStepExecutionId: "" };
13316
+ return { condition: undefined, parentFlowConfig: undefined, parentStepExecutionId: "", tenantId: "" };
13272
13317
  }
13273
13318
  export const StartSubFlowActivityInput = {
13274
13319
  encode(message, writer = new BinaryWriter()) {
@@ -13281,6 +13326,9 @@ export const StartSubFlowActivityInput = {
13281
13326
  if (message.parentStepExecutionId !== "") {
13282
13327
  writer.uint32(26).string(message.parentStepExecutionId);
13283
13328
  }
13329
+ if (message.tenantId !== "") {
13330
+ writer.uint32(34).string(message.tenantId);
13331
+ }
13284
13332
  return writer;
13285
13333
  },
13286
13334
  decode(input, length) {
@@ -13311,6 +13359,13 @@ export const StartSubFlowActivityInput = {
13311
13359
  message.parentStepExecutionId = reader.string();
13312
13360
  continue;
13313
13361
  }
13362
+ case 4: {
13363
+ if (tag !== 34) {
13364
+ break;
13365
+ }
13366
+ message.tenantId = reader.string();
13367
+ continue;
13368
+ }
13314
13369
  }
13315
13370
  if ((tag & 7) === 4 || tag === 0) {
13316
13371
  break;
@@ -13331,6 +13386,7 @@ export const StartSubFlowActivityInput = {
13331
13386
  ? FlowConfig.fromPartial(object.parentFlowConfig)
13332
13387
  : undefined;
13333
13388
  message.parentStepExecutionId = object.parentStepExecutionId ?? "";
13389
+ message.tenantId = object.tenantId ?? "";
13334
13390
  return message;
13335
13391
  },
13336
13392
  };
@@ -13528,8 +13584,6 @@ export const ReportSubFlowCompletionActivityOutput = {
13528
13584
  };
13529
13585
  function createBaseExecuteRpcSignalRequest() {
13530
13586
  return {
13531
- rpcInput: undefined,
13532
- rpcOutput: undefined,
13533
13587
  upsertAttributes: [],
13534
13588
  stepDecision: undefined,
13535
13589
  recordEvents: [],
@@ -13542,12 +13596,6 @@ function createBaseExecuteRpcSignalRequest() {
13542
13596
  }
13543
13597
  export const ExecuteRpcSignalRequest = {
13544
13598
  encode(message, writer = new BinaryWriter()) {
13545
- if (message.rpcInput !== undefined) {
13546
- Value.encode(message.rpcInput, writer.uint32(10).fork()).join();
13547
- }
13548
- if (message.rpcOutput !== undefined) {
13549
- Value.encode(message.rpcOutput, writer.uint32(18).fork()).join();
13550
- }
13551
13599
  for (const v of message.upsertAttributes) {
13552
13600
  AttributeWrite.encode(v, writer.uint32(26).fork()).join();
13553
13601
  }
@@ -13581,20 +13629,6 @@ export const ExecuteRpcSignalRequest = {
13581
13629
  while (reader.pos < end) {
13582
13630
  const tag = reader.uint32();
13583
13631
  switch (tag >>> 3) {
13584
- case 1: {
13585
- if (tag !== 10) {
13586
- break;
13587
- }
13588
- message.rpcInput = Value.decode(reader, reader.uint32());
13589
- continue;
13590
- }
13591
- case 2: {
13592
- if (tag !== 18) {
13593
- break;
13594
- }
13595
- message.rpcOutput = Value.decode(reader, reader.uint32());
13596
- continue;
13597
- }
13598
13632
  case 3: {
13599
13633
  if (tag !== 26) {
13600
13634
  break;
@@ -13664,12 +13698,6 @@ export const ExecuteRpcSignalRequest = {
13664
13698
  },
13665
13699
  fromPartial(object) {
13666
13700
  const message = createBaseExecuteRpcSignalRequest();
13667
- message.rpcInput = (object.rpcInput !== undefined && object.rpcInput !== null)
13668
- ? Value.fromPartial(object.rpcInput)
13669
- : undefined;
13670
- message.rpcOutput = (object.rpcOutput !== undefined && object.rpcOutput !== null)
13671
- ? Value.fromPartial(object.rpcOutput)
13672
- : undefined;
13673
13701
  message.upsertAttributes = object.upsertAttributes?.map((e) => AttributeWrite.fromPartial(e)) || [];
13674
13702
  message.stepDecision = (object.stepDecision !== undefined && object.stepDecision !== null)
13675
13703
  ? StepDecision.fromPartial(object.stepDecision)