@ajna-inc/workflow 0.5.38 → 0.6.2
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/.npmvc/attestations.jsonld +43 -0
- package/.npmvc/sbom.cdx.json +23758 -0
- package/LICENSE +202 -0
- package/build/WorkflowEvents.d.mts +40 -0
- package/build/WorkflowEvents.d.mts.map +1 -0
- package/build/WorkflowEvents.mjs +11 -0
- package/build/WorkflowEvents.mjs.map +1 -0
- package/build/WorkflowModule.d.mts +17 -0
- package/build/WorkflowModule.d.mts.map +1 -0
- package/build/WorkflowModule.mjs +446 -0
- package/build/WorkflowModule.mjs.map +1 -0
- package/build/WorkflowModuleConfig.d.mts +39 -0
- package/build/WorkflowModuleConfig.d.mts.map +1 -0
- package/build/WorkflowModuleConfig.mjs +19 -0
- package/build/WorkflowModuleConfig.mjs.map +1 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorate.mjs +14 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateMetadata.mjs +11 -0
- package/build/_virtual/_@oxc-project_runtime@0.99.0/helpers/decorateParam.mjs +9 -0
- package/build/_virtual/rolldown_runtime.mjs +41 -0
- package/build/actions/ActionRegistry.d.mts +64 -0
- package/build/actions/ActionRegistry.d.mts.map +1 -0
- package/build/actions/ActionRegistry.mjs +304 -0
- package/build/actions/ActionRegistry.mjs.map +1 -0
- package/build/api/WorkflowApi.d.mts +99 -0
- package/build/api/WorkflowApi.d.mts.map +1 -0
- package/build/api/WorkflowApi.mjs +228 -0
- package/build/api/WorkflowApi.mjs.map +1 -0
- package/build/engine/AttributePlanner.d.mts +12 -0
- package/build/engine/AttributePlanner.d.mts.map +1 -0
- package/build/engine/AttributePlanner.mjs +58 -0
- package/build/engine/AttributePlanner.mjs.map +1 -0
- package/build/engine/GuardEvaluator.d.mts +16 -0
- package/build/engine/GuardEvaluator.d.mts.map +1 -0
- package/build/engine/GuardEvaluator.mjs +38 -0
- package/build/engine/GuardEvaluator.mjs.map +1 -0
- package/build/index.d.mts +46 -0
- package/build/index.mjs +53 -0
- package/build/index.mjs.map +1 -0
- package/build/model/TemplateValidation.d.mts +8 -0
- package/build/model/TemplateValidation.d.mts.map +1 -0
- package/build/model/TemplateValidation.mjs +278 -0
- package/build/model/TemplateValidation.mjs.map +1 -0
- package/build/model/types.d.mts +120 -0
- package/build/model/types.d.mts.map +1 -0
- package/build/model/types.mjs +11 -0
- package/build/model/types.mjs.map +1 -0
- package/build/protocol/WorkflowMessageTypes.d.mts +19 -0
- package/build/protocol/WorkflowMessageTypes.d.mts.map +1 -0
- package/build/protocol/WorkflowMessageTypes.mjs +20 -0
- package/build/protocol/WorkflowMessageTypes.mjs.map +1 -0
- package/build/protocol/handlers/AdvanceHandler.d.mts +16 -0
- package/build/protocol/handlers/AdvanceHandler.d.mts.map +1 -0
- package/build/protocol/handlers/AdvanceHandler.mjs +148 -0
- package/build/protocol/handlers/AdvanceHandler.mjs.map +1 -0
- package/build/protocol/handlers/CancelHandler.d.mts +16 -0
- package/build/protocol/handlers/CancelHandler.d.mts.map +1 -0
- package/build/protocol/handlers/CancelHandler.mjs +103 -0
- package/build/protocol/handlers/CancelHandler.mjs.map +1 -0
- package/build/protocol/handlers/CompleteHandler.d.mts +16 -0
- package/build/protocol/handlers/CompleteHandler.d.mts.map +1 -0
- package/build/protocol/handlers/CompleteHandler.mjs +103 -0
- package/build/protocol/handlers/CompleteHandler.mjs.map +1 -0
- package/build/protocol/handlers/DiscoverHandler.d.mts +15 -0
- package/build/protocol/handlers/DiscoverHandler.d.mts.map +1 -0
- package/build/protocol/handlers/DiscoverHandler.mjs +73 -0
- package/build/protocol/handlers/DiscoverHandler.mjs.map +1 -0
- package/build/protocol/handlers/FetchTemplateHandler.d.mts +16 -0
- package/build/protocol/handlers/FetchTemplateHandler.d.mts.map +1 -0
- package/build/protocol/handlers/FetchTemplateHandler.mjs +64 -0
- package/build/protocol/handlers/FetchTemplateHandler.mjs.map +1 -0
- package/build/protocol/handlers/PauseHandler.d.mts +16 -0
- package/build/protocol/handlers/PauseHandler.d.mts.map +1 -0
- package/build/protocol/handlers/PauseHandler.mjs +103 -0
- package/build/protocol/handlers/PauseHandler.mjs.map +1 -0
- package/build/protocol/handlers/ProblemReportHandler.d.mts +11 -0
- package/build/protocol/handlers/ProblemReportHandler.d.mts.map +1 -0
- package/build/protocol/handlers/ProblemReportHandler.mjs +26 -0
- package/build/protocol/handlers/ProblemReportHandler.mjs.map +1 -0
- package/build/protocol/handlers/PublishTemplateHandler.d.mts +15 -0
- package/build/protocol/handlers/PublishTemplateHandler.d.mts.map +1 -0
- package/build/protocol/handlers/PublishTemplateHandler.mjs +47 -0
- package/build/protocol/handlers/PublishTemplateHandler.mjs.map +1 -0
- package/build/protocol/handlers/ResumeHandler.d.mts +16 -0
- package/build/protocol/handlers/ResumeHandler.d.mts.map +1 -0
- package/build/protocol/handlers/ResumeHandler.mjs +103 -0
- package/build/protocol/handlers/ResumeHandler.mjs.map +1 -0
- package/build/protocol/handlers/StartHandler.d.mts +16 -0
- package/build/protocol/handlers/StartHandler.d.mts.map +1 -0
- package/build/protocol/handlers/StartHandler.mjs +238 -0
- package/build/protocol/handlers/StartHandler.mjs.map +1 -0
- package/build/protocol/handlers/StatusHandler.d.mts +16 -0
- package/build/protocol/handlers/StatusHandler.d.mts.map +1 -0
- package/build/protocol/handlers/StatusHandler.mjs +169 -0
- package/build/protocol/handlers/StatusHandler.mjs.map +1 -0
- package/build/protocol/handlers/TemplateHandler.d.mts +14 -0
- package/build/protocol/handlers/TemplateHandler.d.mts.map +1 -0
- package/build/protocol/handlers/TemplateHandler.mjs +66 -0
- package/build/protocol/handlers/TemplateHandler.mjs.map +1 -0
- package/build/protocol/messages/AdvanceMessage.d.mts +22 -0
- package/build/protocol/messages/AdvanceMessage.d.mts.map +1 -0
- package/build/protocol/messages/AdvanceMessage.mjs +25 -0
- package/build/protocol/messages/AdvanceMessage.mjs.map +1 -0
- package/build/protocol/messages/CancelMessage.d.mts +20 -0
- package/build/protocol/messages/CancelMessage.d.mts.map +1 -0
- package/build/protocol/messages/CancelMessage.mjs +25 -0
- package/build/protocol/messages/CancelMessage.mjs.map +1 -0
- package/build/protocol/messages/CompleteMessage.d.mts +20 -0
- package/build/protocol/messages/CompleteMessage.d.mts.map +1 -0
- package/build/protocol/messages/CompleteMessage.mjs +25 -0
- package/build/protocol/messages/CompleteMessage.mjs.map +1 -0
- package/build/protocol/messages/DiscoverMessage.d.mts +29 -0
- package/build/protocol/messages/DiscoverMessage.d.mts.map +1 -0
- package/build/protocol/messages/DiscoverMessage.mjs +25 -0
- package/build/protocol/messages/DiscoverMessage.mjs.map +1 -0
- package/build/protocol/messages/FetchTemplateMessage.d.mts +21 -0
- package/build/protocol/messages/FetchTemplateMessage.d.mts.map +1 -0
- package/build/protocol/messages/FetchTemplateMessage.mjs +31 -0
- package/build/protocol/messages/FetchTemplateMessage.mjs.map +1 -0
- package/build/protocol/messages/PauseMessage.d.mts +20 -0
- package/build/protocol/messages/PauseMessage.d.mts.map +1 -0
- package/build/protocol/messages/PauseMessage.mjs +25 -0
- package/build/protocol/messages/PauseMessage.mjs.map +1 -0
- package/build/protocol/messages/ProblemReportMessage.d.mts +21 -0
- package/build/protocol/messages/ProblemReportMessage.d.mts.map +1 -0
- package/build/protocol/messages/ProblemReportMessage.mjs +25 -0
- package/build/protocol/messages/ProblemReportMessage.mjs.map +1 -0
- package/build/protocol/messages/PublishTemplateMessage.d.mts +23 -0
- package/build/protocol/messages/PublishTemplateMessage.d.mts.map +1 -0
- package/build/protocol/messages/PublishTemplateMessage.mjs +24 -0
- package/build/protocol/messages/PublishTemplateMessage.mjs.map +1 -0
- package/build/protocol/messages/ResumeMessage.d.mts +20 -0
- package/build/protocol/messages/ResumeMessage.d.mts.map +1 -0
- package/build/protocol/messages/ResumeMessage.mjs +25 -0
- package/build/protocol/messages/ResumeMessage.mjs.map +1 -0
- package/build/protocol/messages/StartMessage.d.mts +27 -0
- package/build/protocol/messages/StartMessage.d.mts.map +1 -0
- package/build/protocol/messages/StartMessage.mjs +25 -0
- package/build/protocol/messages/StartMessage.mjs.map +1 -0
- package/build/protocol/messages/StatusMessage.d.mts +35 -0
- package/build/protocol/messages/StatusMessage.d.mts.map +1 -0
- package/build/protocol/messages/StatusMessage.mjs +25 -0
- package/build/protocol/messages/StatusMessage.mjs.map +1 -0
- package/build/protocol/messages/StatusRequestMessage.d.mts +29 -0
- package/build/protocol/messages/StatusRequestMessage.d.mts.map +1 -0
- package/build/protocol/messages/StatusRequestMessage.mjs +25 -0
- package/build/protocol/messages/StatusRequestMessage.mjs.map +1 -0
- package/build/protocol/messages/TemplateMessage.d.mts +20 -0
- package/build/protocol/messages/TemplateMessage.d.mts.map +1 -0
- package/build/protocol/messages/TemplateMessage.mjs +25 -0
- package/build/protocol/messages/TemplateMessage.mjs.map +1 -0
- package/build/protocol/messages/WorkflowsMessage.d.mts +28 -0
- package/build/protocol/messages/WorkflowsMessage.d.mts.map +1 -0
- package/build/protocol/messages/WorkflowsMessage.mjs +25 -0
- package/build/protocol/messages/WorkflowsMessage.mjs.map +1 -0
- package/build/queue/CommandQueue.d.mts +22 -0
- package/build/queue/CommandQueue.d.mts.map +1 -0
- package/build/queue/CommandQueue.mjs +6 -0
- package/build/queue/CommandQueue.mjs.map +1 -0
- package/build/queue/PersistentCommandQueue.d.mts +56 -0
- package/build/queue/PersistentCommandQueue.d.mts.map +1 -0
- package/build/queue/PersistentCommandQueue.mjs +273 -0
- package/build/queue/PersistentCommandQueue.mjs.map +1 -0
- package/build/repository/WorkflowCommandRecord.d.mts +50 -0
- package/build/repository/WorkflowCommandRecord.d.mts.map +1 -0
- package/build/repository/WorkflowCommandRecord.mjs +48 -0
- package/build/repository/WorkflowCommandRecord.mjs.map +1 -0
- package/build/repository/WorkflowCommandRepository.d.mts +59 -0
- package/build/repository/WorkflowCommandRepository.d.mts.map +1 -0
- package/build/repository/WorkflowCommandRepository.mjs +136 -0
- package/build/repository/WorkflowCommandRepository.mjs.map +1 -0
- package/build/repository/WorkflowInstanceRecord.d.mts +65 -0
- package/build/repository/WorkflowInstanceRecord.d.mts.map +1 -0
- package/build/repository/WorkflowInstanceRecord.mjs +44 -0
- package/build/repository/WorkflowInstanceRecord.mjs.map +1 -0
- package/build/repository/WorkflowInstanceRepository.d.mts +15 -0
- package/build/repository/WorkflowInstanceRepository.d.mts.map +1 -0
- package/build/repository/WorkflowInstanceRepository.mjs +48 -0
- package/build/repository/WorkflowInstanceRepository.mjs.map +1 -0
- package/build/repository/WorkflowTemplateRecord.d.mts +27 -0
- package/build/repository/WorkflowTemplateRecord.d.mts.map +1 -0
- package/build/repository/WorkflowTemplateRecord.mjs +29 -0
- package/build/repository/WorkflowTemplateRecord.mjs.map +1 -0
- package/build/repository/WorkflowTemplateRepository.d.mts +11 -0
- package/build/repository/WorkflowTemplateRepository.d.mts.map +1 -0
- package/build/repository/WorkflowTemplateRepository.mjs +43 -0
- package/build/repository/WorkflowTemplateRepository.mjs.map +1 -0
- package/build/services/WorkflowService.d.mts +107 -0
- package/build/services/WorkflowService.d.mts.map +1 -0
- package/build/services/WorkflowService.mjs +582 -0
- package/build/services/WorkflowService.mjs.map +1 -0
- package/build/ui/UiFilter.mjs +85 -0
- package/build/ui/UiFilter.mjs.map +1 -0
- package/package.json +27 -33
- package/build/WorkflowEvents.d.ts +0 -35
- package/build/WorkflowEvents.js +0 -10
- package/build/WorkflowEvents.js.map +0 -1
- package/build/WorkflowModule.d.ts +0 -13
- package/build/WorkflowModule.js +0 -647
- package/build/WorkflowModule.js.map +0 -1
- package/build/WorkflowModuleConfig.d.ts +0 -35
- package/build/WorkflowModuleConfig.js +0 -19
- package/build/WorkflowModuleConfig.js.map +0 -1
- package/build/actions/ActionRegistry.d.ts +0 -59
- package/build/actions/ActionRegistry.js +0 -367
- package/build/actions/ActionRegistry.js.map +0 -1
- package/build/api/WorkflowApi.d.ts +0 -94
- package/build/api/WorkflowApi.js +0 -241
- package/build/api/WorkflowApi.js.map +0 -1
- package/build/engine/AttributePlanner.d.ts +0 -7
- package/build/engine/AttributePlanner.js +0 -81
- package/build/engine/AttributePlanner.js.map +0 -1
- package/build/engine/GuardEvaluator.d.ts +0 -11
- package/build/engine/GuardEvaluator.js +0 -40
- package/build/engine/GuardEvaluator.js.map +0 -1
- package/build/index.d.ts +0 -45
- package/build/index.js +0 -69
- package/build/index.js.map +0 -1
- package/build/model/TemplateValidation.d.ts +0 -3
- package/build/model/TemplateValidation.js +0 -231
- package/build/model/TemplateValidation.js.map +0 -1
- package/build/model/types.d.ts +0 -116
- package/build/model/types.js +0 -15
- package/build/model/types.js.map +0 -1
- package/build/protocol/WorkflowMessageTypes.d.ts +0 -15
- package/build/protocol/WorkflowMessageTypes.js +0 -22
- package/build/protocol/WorkflowMessageTypes.js.map +0 -1
- package/build/protocol/handlers/AdvanceHandler.d.ts +0 -12
- package/build/protocol/handlers/AdvanceHandler.js +0 -149
- package/build/protocol/handlers/AdvanceHandler.js.map +0 -1
- package/build/protocol/handlers/CancelHandler.d.ts +0 -12
- package/build/protocol/handlers/CancelHandler.js +0 -124
- package/build/protocol/handlers/CancelHandler.js.map +0 -1
- package/build/protocol/handlers/CompleteHandler.d.ts +0 -12
- package/build/protocol/handlers/CompleteHandler.js +0 -125
- package/build/protocol/handlers/CompleteHandler.js.map +0 -1
- package/build/protocol/handlers/DiscoverHandler.d.ts +0 -11
- package/build/protocol/handlers/DiscoverHandler.js +0 -71
- package/build/protocol/handlers/DiscoverHandler.js.map +0 -1
- package/build/protocol/handlers/FetchTemplateHandler.d.ts +0 -12
- package/build/protocol/handlers/FetchTemplateHandler.js +0 -71
- package/build/protocol/handlers/FetchTemplateHandler.js.map +0 -1
- package/build/protocol/handlers/PauseHandler.d.ts +0 -12
- package/build/protocol/handlers/PauseHandler.js +0 -124
- package/build/protocol/handlers/PauseHandler.js.map +0 -1
- package/build/protocol/handlers/ProblemReportHandler.d.ts +0 -6
- package/build/protocol/handlers/ProblemReportHandler.js +0 -28
- package/build/protocol/handlers/ProblemReportHandler.js.map +0 -1
- package/build/protocol/handlers/PublishTemplateHandler.d.ts +0 -11
- package/build/protocol/handlers/PublishTemplateHandler.js +0 -53
- package/build/protocol/handlers/PublishTemplateHandler.js.map +0 -1
- package/build/protocol/handlers/ResumeHandler.d.ts +0 -12
- package/build/protocol/handlers/ResumeHandler.js +0 -124
- package/build/protocol/handlers/ResumeHandler.js.map +0 -1
- package/build/protocol/handlers/StartHandler.d.ts +0 -12
- package/build/protocol/handlers/StartHandler.js +0 -274
- package/build/protocol/handlers/StartHandler.js.map +0 -1
- package/build/protocol/handlers/StatusHandler.d.ts +0 -12
- package/build/protocol/handlers/StatusHandler.js +0 -202
- package/build/protocol/handlers/StatusHandler.js.map +0 -1
- package/build/protocol/handlers/TemplateHandler.d.ts +0 -9
- package/build/protocol/handlers/TemplateHandler.js +0 -83
- package/build/protocol/handlers/TemplateHandler.js.map +0 -1
- package/build/protocol/messages/AdvanceMessage.d.ts +0 -16
- package/build/protocol/messages/AdvanceMessage.js +0 -33
- package/build/protocol/messages/AdvanceMessage.js.map +0 -1
- package/build/protocol/messages/CancelMessage.d.ts +0 -14
- package/build/protocol/messages/CancelMessage.js +0 -33
- package/build/protocol/messages/CancelMessage.js.map +0 -1
- package/build/protocol/messages/CompleteMessage.d.ts +0 -14
- package/build/protocol/messages/CompleteMessage.js +0 -33
- package/build/protocol/messages/CompleteMessage.js.map +0 -1
- package/build/protocol/messages/DiscoverMessage.d.ts +0 -23
- package/build/protocol/messages/DiscoverMessage.js +0 -33
- package/build/protocol/messages/DiscoverMessage.js.map +0 -1
- package/build/protocol/messages/FetchTemplateMessage.d.ts +0 -15
- package/build/protocol/messages/FetchTemplateMessage.js +0 -33
- package/build/protocol/messages/FetchTemplateMessage.js.map +0 -1
- package/build/protocol/messages/PauseMessage.d.ts +0 -14
- package/build/protocol/messages/PauseMessage.js +0 -33
- package/build/protocol/messages/PauseMessage.js.map +0 -1
- package/build/protocol/messages/ProblemReportMessage.d.ts +0 -15
- package/build/protocol/messages/ProblemReportMessage.js +0 -33
- package/build/protocol/messages/ProblemReportMessage.js.map +0 -1
- package/build/protocol/messages/PublishTemplateMessage.d.ts +0 -17
- package/build/protocol/messages/PublishTemplateMessage.js +0 -31
- package/build/protocol/messages/PublishTemplateMessage.js.map +0 -1
- package/build/protocol/messages/ResumeMessage.d.ts +0 -14
- package/build/protocol/messages/ResumeMessage.js +0 -33
- package/build/protocol/messages/ResumeMessage.js.map +0 -1
- package/build/protocol/messages/StartMessage.d.ts +0 -21
- package/build/protocol/messages/StartMessage.js +0 -33
- package/build/protocol/messages/StartMessage.js.map +0 -1
- package/build/protocol/messages/StatusMessage.d.ts +0 -29
- package/build/protocol/messages/StatusMessage.js +0 -33
- package/build/protocol/messages/StatusMessage.js.map +0 -1
- package/build/protocol/messages/StatusRequestMessage.d.ts +0 -23
- package/build/protocol/messages/StatusRequestMessage.js +0 -33
- package/build/protocol/messages/StatusRequestMessage.js.map +0 -1
- package/build/protocol/messages/TemplateMessage.d.ts +0 -14
- package/build/protocol/messages/TemplateMessage.js +0 -33
- package/build/protocol/messages/TemplateMessage.js.map +0 -1
- package/build/protocol/messages/WorkflowsMessage.d.ts +0 -22
- package/build/protocol/messages/WorkflowsMessage.js +0 -33
- package/build/protocol/messages/WorkflowsMessage.js.map +0 -1
- package/build/queue/CommandQueue.d.ts +0 -18
- package/build/queue/CommandQueue.js +0 -8
- package/build/queue/CommandQueue.js.map +0 -1
- package/build/queue/PersistentCommandQueue.d.ts +0 -51
- package/build/queue/PersistentCommandQueue.js +0 -348
- package/build/queue/PersistentCommandQueue.js.map +0 -1
- package/build/repository/WorkflowCommandRecord.d.ts +0 -46
- package/build/repository/WorkflowCommandRecord.js +0 -52
- package/build/repository/WorkflowCommandRecord.js.map +0 -1
- package/build/repository/WorkflowCommandRepository.d.ts +0 -55
- package/build/repository/WorkflowCommandRepository.js +0 -149
- package/build/repository/WorkflowCommandRepository.js.map +0 -1
- package/build/repository/WorkflowInstanceRecord.d.ts +0 -61
- package/build/repository/WorkflowInstanceRecord.js +0 -43
- package/build/repository/WorkflowInstanceRecord.js.map +0 -1
- package/build/repository/WorkflowInstanceRepository.d.ts +0 -10
- package/build/repository/WorkflowInstanceRepository.js +0 -52
- package/build/repository/WorkflowInstanceRepository.js.map +0 -1
- package/build/repository/WorkflowTemplateRecord.d.ts +0 -23
- package/build/repository/WorkflowTemplateRecord.js +0 -28
- package/build/repository/WorkflowTemplateRecord.js.map +0 -1
- package/build/repository/WorkflowTemplateRepository.d.ts +0 -6
- package/build/repository/WorkflowTemplateRepository.js +0 -56
- package/build/repository/WorkflowTemplateRepository.js.map +0 -1
- package/build/services/WorkflowService.d.ts +0 -102
- package/build/services/WorkflowService.js +0 -712
- package/build/services/WorkflowService.js.map +0 -1
- package/build/ui/UiFilter.d.ts +0 -5
- package/build/ui/UiFilter.js +0 -104
- package/build/ui/UiFilter.js.map +0 -1
- package/build/ui/UiTypes.d.ts +0 -28
- package/build/ui/UiTypes.js +0 -3
- package/build/ui/UiTypes.js.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
7
|
+
var __export = (all, symbols) => {
|
|
8
|
+
let target = {};
|
|
9
|
+
for (var name in all) {
|
|
10
|
+
__defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
if (symbols) {
|
|
16
|
+
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
17
|
+
}
|
|
18
|
+
return target;
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
23
|
+
key = keys[i];
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
25
|
+
__defProp(to, key, {
|
|
26
|
+
get: ((k) => from[k]).bind(null, key),
|
|
27
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
36
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
37
|
+
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function.");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { __esmMin, __export, __require, __toCommonJS };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { ActionDef, WorkflowInstanceData, WorkflowTemplate } from "../model/types.mjs";
|
|
2
|
+
import { AgentContext } from "@credo-ts/core";
|
|
3
|
+
|
|
4
|
+
//#region src/actions/ActionRegistry.d.ts
|
|
5
|
+
type ActionCtx = {
|
|
6
|
+
agentContext: AgentContext;
|
|
7
|
+
template: WorkflowTemplate;
|
|
8
|
+
instance: WorkflowInstanceData;
|
|
9
|
+
action: ActionDef;
|
|
10
|
+
input?: Record<string, unknown>;
|
|
11
|
+
};
|
|
12
|
+
type ActionResult = {
|
|
13
|
+
artifacts?: Record<string, unknown>;
|
|
14
|
+
contextMerge?: Record<string, unknown>;
|
|
15
|
+
messageId?: string;
|
|
16
|
+
};
|
|
17
|
+
interface WorkflowActionHandler {
|
|
18
|
+
readonly typeUri: string;
|
|
19
|
+
execute(ctx: ActionCtx): Promise<ActionResult>;
|
|
20
|
+
}
|
|
21
|
+
declare class ActionRegistry {
|
|
22
|
+
private handlers;
|
|
23
|
+
register(handler: WorkflowActionHandler): void;
|
|
24
|
+
get(typeUri: string): WorkflowActionHandler | undefined;
|
|
25
|
+
}
|
|
26
|
+
declare class LocalStateSetAction implements WorkflowActionHandler {
|
|
27
|
+
readonly typeUri = "https://didcomm.org/workflow/actions/state:set@1";
|
|
28
|
+
execute(ctx: ActionCtx): Promise<ActionResult>;
|
|
29
|
+
}
|
|
30
|
+
declare class IssueCredentialV2Action implements WorkflowActionHandler {
|
|
31
|
+
readonly typeUri = "https://didcomm.org/issue-credential/2.0/offer-credential";
|
|
32
|
+
execute(ctx: ActionCtx): Promise<ActionResult>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* ProposeCredentialV2Action - Holder proposes a credential to the issuer
|
|
36
|
+
* Used when holder initiates the credential issuance flow
|
|
37
|
+
*/
|
|
38
|
+
declare class ProposeCredentialV2Action implements WorkflowActionHandler {
|
|
39
|
+
readonly typeUri = "https://didcomm.org/issue-credential/2.0/propose-credential";
|
|
40
|
+
execute(ctx: ActionCtx): Promise<ActionResult>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* RequestCredentialV2Action - Holder accepts a credential offer
|
|
44
|
+
* Used when holder receives an offer and wants to request the credential
|
|
45
|
+
*/
|
|
46
|
+
declare class RequestCredentialV2Action implements WorkflowActionHandler {
|
|
47
|
+
readonly typeUri = "https://didcomm.org/issue-credential/2.0/request-credential";
|
|
48
|
+
execute(ctx: ActionCtx): Promise<ActionResult>;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* IssueCredentialMessageV2Action - Issuer issues the credential after receiving a request
|
|
52
|
+
* Used when issuer receives a credential request and wants to issue the credential
|
|
53
|
+
*/
|
|
54
|
+
declare class IssueCredentialMessageV2Action implements WorkflowActionHandler {
|
|
55
|
+
readonly typeUri = "https://didcomm.org/issue-credential/2.0/issue-credential";
|
|
56
|
+
execute(ctx: ActionCtx): Promise<ActionResult>;
|
|
57
|
+
}
|
|
58
|
+
declare class PresentProofV2Action implements WorkflowActionHandler {
|
|
59
|
+
readonly typeUri = "https://didcomm.org/present-proof/2.0/request-presentation";
|
|
60
|
+
execute(ctx: ActionCtx): Promise<ActionResult>;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { ActionCtx, ActionRegistry, ActionResult, IssueCredentialMessageV2Action, IssueCredentialV2Action, LocalStateSetAction, PresentProofV2Action, ProposeCredentialV2Action, RequestCredentialV2Action, WorkflowActionHandler };
|
|
64
|
+
//# sourceMappingURL=ActionRegistry.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionRegistry.d.mts","names":[],"sources":["../../src/actions/ActionRegistry.ts"],"sourcesContent":[],"mappings":";;;;KASY,SAAA;gBACI;EADJ,QAAA,EAEA,gBAFS;EACL,QAAA,EAEJ,oBAFI;EACJ,MAAA,EAEF,SAFE;EACA,KAAA,CAAA,EAEF,MAFE,CAAA,MAAA,EAAA,OAAA,CAAA;CACF;AACA,KAGE,YAAA,GAHF;EAAM,SAAA,CAAA,EAIF,MAJE,CAAA,MAAA,EAAA,OAAA,CAAA;EAGJ,YAAA,CAAA,EAEK,MAFO,CAAA,MACV,EAAA,OACG,CAAA;EAIA,SAAA,CAAA,EAAA,MAAA;CAEF;AAAoB,UAFlB,qBAAA,CAEkB;EAAR,SAAA,OAAA,EAAA,MAAA;EAAO,OAAA,CAAA,GAAA,EAAnB,SAAmB,CAAA,EAAP,OAAO,CAAC,YAAD,CAAA;AAGlC;AAUa,cAVA,cAAA,CAUoB;EAEL,QAAA,QAAA;EAAoB,QAAA,CAAA,OAAA,EAVrB,qBAUqB,CAAA,EAAA,IAAA;EAAR,GAAA,CAAA,OAAA,EAAA,MAAA,CAAA,EAPT,qBAOS,GAAA,SAAA;;AAFyB,cAApD,mBAAA,YAA+B,qBAAqB,CAAA;EAiCpD,SAAA,OAAA,GAAA,kDAAwB;EAET,OAAA,CAAA,GAAA,EAjCA,SAiCA,CAAA,EAjCY,OAiCZ,CAjCoB,YAiCpB,CAAA;;AAAY,cAF3B,uBAAA,YAAmC,qBAER,CAAA;EAFQ,SAAA,OAAA,GAAA,2DAAA;EAAqB,OAAA,CAAA,GAAA,EAEzC,SAFyC,CAAA,EAE7B,OAF6B,CAErB,YAFqB,CAAA;AA2DrE;;;;;AAAuE,cAA1D,yBAAA,YAAqC,qBAAqB,CAAA;EAkE1D,SAAA,OAAA,GAAA,6DAA0B;EAGX,OAAA,CAAA,GAAA,EAlEA,SAkEA,CAAA,EAlEY,OAkEZ,CAlEoB,YAkEpB,CAAA;;;;;AA4D5B;AAG4B,cAlEf,yBAAA,YAAqC,qBAkEtB,CAAA;EAAoB,SAAA,OAAA,GAAA,6DAAA;EAAR,OAAA,CAAA,GAAA,EA/DZ,SA+DY,CAAA,EA/DA,OA+DA,CA/DQ,YA+DR,CAAA;;;AAsDxC;;;AAEwC,cA3D3B,8BAAA,YAA0C,qBA2Df,CAAA;EAFK,SAAA,OAAA,GAAA,2DAAA;EAAqB,OAAA,CAAA,GAAA,EAtDtC,SAsDsC,CAAA,EAtD1B,OAsD0B,CAtDlB,YAsDkB,CAAA;;cAArD,oBAAA,YAAgC;;eAEjB,YAAY,QAAQ"}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { AttributePlanner, deepMerge } from "../engine/AttributePlanner.mjs";
|
|
2
|
+
import { DidCommConnectionService, DidCommCredentialsApi, DidCommProofsApi } from "@credo-ts/didcomm";
|
|
3
|
+
|
|
4
|
+
//#region src/actions/ActionRegistry.ts
|
|
5
|
+
var ActionRegistry = class {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.handlers = /* @__PURE__ */ new Map();
|
|
8
|
+
}
|
|
9
|
+
register(handler) {
|
|
10
|
+
this.handlers.set(handler.typeUri, handler);
|
|
11
|
+
}
|
|
12
|
+
get(typeUri) {
|
|
13
|
+
return this.handlers.get(typeUri);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var LocalStateSetAction = class {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.typeUri = "https://didcomm.org/workflow/actions/state:set@1";
|
|
19
|
+
}
|
|
20
|
+
async execute(ctx) {
|
|
21
|
+
const mergeObj = ctx.action?.staticInput;
|
|
22
|
+
const mergeValue = typeof mergeObj === "object" && mergeObj ? mergeObj.merge : mergeObj;
|
|
23
|
+
if (mergeValue && typeof mergeValue === "object") return { contextMerge: deepMerge({ ...ctx.instance.context || {} }, mergeValue) };
|
|
24
|
+
if (typeof mergeValue === "string" && ctx.input && mergeValue.includes("input.")) try {
|
|
25
|
+
const value = mergeValue.replace(/\{\{|\}\}/g, "").trim().replace(/^input\./, "").split(".").reduce((acc, p) => {
|
|
26
|
+
if (acc === null || acc === void 0) return void 0;
|
|
27
|
+
if (typeof acc !== "object") return void 0;
|
|
28
|
+
return acc[p];
|
|
29
|
+
}, ctx.input);
|
|
30
|
+
if (value && typeof value === "object") return { contextMerge: deepMerge({ ...ctx.instance.context || {} }, value) };
|
|
31
|
+
} catch (_e) {}
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var IssueCredentialV2Action = class {
|
|
36
|
+
constructor() {
|
|
37
|
+
this.typeUri = "https://didcomm.org/issue-credential/2.0/offer-credential";
|
|
38
|
+
}
|
|
39
|
+
async execute(ctx) {
|
|
40
|
+
const ref = ctx.action.profile_ref;
|
|
41
|
+
if (!ref?.startsWith("cp.")) throw Object.assign(/* @__PURE__ */ new Error("invalid profile_ref"), { code: "action_error" });
|
|
42
|
+
const key = ref.slice(3);
|
|
43
|
+
const profile = ctx.template.catalog?.credential_profiles?.[key];
|
|
44
|
+
if (!profile) throw Object.assign(/* @__PURE__ */ new Error("missing catalog profile"), { code: "action_error" });
|
|
45
|
+
const attrs = AttributePlanner.materialize(profile.attribute_plan || {}, ctx.instance);
|
|
46
|
+
const attributes = Object.entries(attrs).map(([name, value]) => ({
|
|
47
|
+
name,
|
|
48
|
+
value: String(value)
|
|
49
|
+
}));
|
|
50
|
+
const connectionId = ctx.instance.connection_id;
|
|
51
|
+
if (!connectionId) throw Object.assign(/* @__PURE__ */ new Error("connectionId required"), { code: "action_error" });
|
|
52
|
+
{
|
|
53
|
+
const toRef = profile.to_ref;
|
|
54
|
+
const expectedDid = toRef ? ctx.instance.participants?.[toRef]?.did : void 0;
|
|
55
|
+
if (expectedDid && ctx.instance.connection_id) {
|
|
56
|
+
const theirDid = (await ctx.agentContext.dependencyManager.resolve(DidCommConnectionService).getById(ctx.agentContext, ctx.instance.connection_id))?.theirDid;
|
|
57
|
+
if (theirDid && theirDid !== expectedDid) throw Object.assign(/* @__PURE__ */ new Error("to_ref DID mismatch"), { code: "forbidden" });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi);
|
|
62
|
+
const record = await credsApi.offerCredential({
|
|
63
|
+
connectionId,
|
|
64
|
+
protocolVersion: "v2",
|
|
65
|
+
credentialFormats: { anoncreds: {
|
|
66
|
+
credentialDefinitionId: profile.cred_def_id,
|
|
67
|
+
attributes
|
|
68
|
+
} },
|
|
69
|
+
comment: profile.options?.comment
|
|
70
|
+
});
|
|
71
|
+
let messageId = record?.id || record?.credentialRecord?.id;
|
|
72
|
+
try {
|
|
73
|
+
if (messageId) {
|
|
74
|
+
const found = await credsApi.findOfferMessage(messageId);
|
|
75
|
+
if (found && typeof found === "object") {
|
|
76
|
+
const f = found;
|
|
77
|
+
messageId = f.message?.id || f.id || messageId;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} catch (_e) {}
|
|
81
|
+
return {
|
|
82
|
+
artifacts: { issueRecordId: record?.id || record?.credentialRecord?.id },
|
|
83
|
+
messageId
|
|
84
|
+
};
|
|
85
|
+
} catch (e) {
|
|
86
|
+
throw Object.assign(/* @__PURE__ */ new Error(`issue action error: ${e.message}`), { code: "action_error" });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* ProposeCredentialV2Action - Holder proposes a credential to the issuer
|
|
92
|
+
* Used when holder initiates the credential issuance flow
|
|
93
|
+
*/
|
|
94
|
+
var ProposeCredentialV2Action = class {
|
|
95
|
+
constructor() {
|
|
96
|
+
this.typeUri = "https://didcomm.org/issue-credential/2.0/propose-credential";
|
|
97
|
+
}
|
|
98
|
+
async execute(ctx) {
|
|
99
|
+
const ref = ctx.action.profile_ref;
|
|
100
|
+
if (!ref?.startsWith("cp.")) throw Object.assign(/* @__PURE__ */ new Error("invalid profile_ref"), { code: "action_error" });
|
|
101
|
+
const key = ref.slice(3);
|
|
102
|
+
const profile = ctx.template.catalog?.credential_profiles?.[key];
|
|
103
|
+
if (!profile) throw Object.assign(/* @__PURE__ */ new Error("missing catalog profile"), { code: "action_error" });
|
|
104
|
+
const attrs = AttributePlanner.materialize(profile.attribute_plan || {}, ctx.instance);
|
|
105
|
+
const attributes = Object.entries(attrs).map(([name, value]) => ({
|
|
106
|
+
name,
|
|
107
|
+
value: String(value)
|
|
108
|
+
}));
|
|
109
|
+
const connectionId = ctx.instance.connection_id;
|
|
110
|
+
if (!connectionId) throw Object.assign(/* @__PURE__ */ new Error("connectionId required"), { code: "action_error" });
|
|
111
|
+
try {
|
|
112
|
+
const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi);
|
|
113
|
+
const record = await credsApi.proposeCredential({
|
|
114
|
+
connectionId,
|
|
115
|
+
protocolVersion: "v2",
|
|
116
|
+
credentialFormats: { anoncreds: {
|
|
117
|
+
credentialDefinitionId: profile.cred_def_id,
|
|
118
|
+
attributes
|
|
119
|
+
} },
|
|
120
|
+
comment: profile.options?.comment
|
|
121
|
+
});
|
|
122
|
+
let messageId = record?.id || record?.credentialRecord?.id;
|
|
123
|
+
try {
|
|
124
|
+
if (messageId) {
|
|
125
|
+
const found = await credsApi.findProposalMessage(messageId);
|
|
126
|
+
if (found && typeof found === "object") {
|
|
127
|
+
const f = found;
|
|
128
|
+
messageId = f.message?.id || f.id || messageId;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
} catch (_e) {}
|
|
132
|
+
return {
|
|
133
|
+
artifacts: { credentialRecordId: record?.id || record?.credentialRecord?.id },
|
|
134
|
+
messageId
|
|
135
|
+
};
|
|
136
|
+
} catch (e) {
|
|
137
|
+
throw Object.assign(/* @__PURE__ */ new Error(`propose action error: ${e.message}`), { code: "action_error" });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* RequestCredentialV2Action - Holder accepts a credential offer
|
|
143
|
+
* Used when holder receives an offer and wants to request the credential
|
|
144
|
+
*/
|
|
145
|
+
var RequestCredentialV2Action = class {
|
|
146
|
+
constructor() {
|
|
147
|
+
this.typeUri = "https://didcomm.org/issue-credential/2.0/request-credential";
|
|
148
|
+
}
|
|
149
|
+
async execute(ctx) {
|
|
150
|
+
const connectionId = ctx.instance.connection_id;
|
|
151
|
+
if (!connectionId) throw Object.assign(/* @__PURE__ */ new Error("connectionId required"), { code: "action_error" });
|
|
152
|
+
try {
|
|
153
|
+
const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi);
|
|
154
|
+
let credentialRecordId = ctx.instance.artifacts?.credentialRecordId;
|
|
155
|
+
if (!credentialRecordId) {
|
|
156
|
+
const matches = (await credsApi.getAll()).filter((r) => r.connectionId === connectionId && r.state === "offer-received").sort((a, b) => {
|
|
157
|
+
const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
|
|
158
|
+
return (b.updatedAt ? new Date(b.updatedAt).getTime() : 0) - dateA;
|
|
159
|
+
});
|
|
160
|
+
if (matches.length === 0) throw Object.assign(/* @__PURE__ */ new Error("no offer found to accept"), { code: "action_error" });
|
|
161
|
+
credentialRecordId = matches[0].id;
|
|
162
|
+
}
|
|
163
|
+
const record = await credsApi.acceptOffer({ credentialRecordId });
|
|
164
|
+
let messageId = record?.id;
|
|
165
|
+
try {
|
|
166
|
+
if (messageId) {
|
|
167
|
+
const found = await credsApi.findRequestMessage(messageId);
|
|
168
|
+
if (found && typeof found === "object") {
|
|
169
|
+
const f = found;
|
|
170
|
+
messageId = f.message?.id || f.id || messageId;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
} catch (_e) {}
|
|
174
|
+
return {
|
|
175
|
+
artifacts: { credentialRecordId: record?.id },
|
|
176
|
+
messageId
|
|
177
|
+
};
|
|
178
|
+
} catch (e) {
|
|
179
|
+
throw Object.assign(/* @__PURE__ */ new Error(`request action error: ${e.message}`), { code: "action_error" });
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* IssueCredentialMessageV2Action - Issuer issues the credential after receiving a request
|
|
185
|
+
* Used when issuer receives a credential request and wants to issue the credential
|
|
186
|
+
*/
|
|
187
|
+
var IssueCredentialMessageV2Action = class {
|
|
188
|
+
constructor() {
|
|
189
|
+
this.typeUri = "https://didcomm.org/issue-credential/2.0/issue-credential";
|
|
190
|
+
}
|
|
191
|
+
async execute(ctx) {
|
|
192
|
+
const connectionId = ctx.instance.connection_id;
|
|
193
|
+
if (!connectionId) throw Object.assign(/* @__PURE__ */ new Error("connectionId required"), { code: "action_error" });
|
|
194
|
+
try {
|
|
195
|
+
const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi);
|
|
196
|
+
let credentialRecordId = ctx.instance.artifacts?.credentialRecordId;
|
|
197
|
+
if (!credentialRecordId) {
|
|
198
|
+
const matches = (await credsApi.getAll()).filter((r) => r.connectionId === connectionId && r.state === "request-received").sort((a, b) => {
|
|
199
|
+
const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
|
|
200
|
+
return (b.updatedAt ? new Date(b.updatedAt).getTime() : 0) - dateA;
|
|
201
|
+
});
|
|
202
|
+
if (matches.length === 0) throw Object.assign(/* @__PURE__ */ new Error("no request found to issue"), { code: "action_error" });
|
|
203
|
+
credentialRecordId = matches[0].id;
|
|
204
|
+
}
|
|
205
|
+
const record = await credsApi.acceptRequest({ credentialRecordId });
|
|
206
|
+
let messageId = record?.id;
|
|
207
|
+
try {
|
|
208
|
+
if (messageId) {
|
|
209
|
+
const found = await credsApi.findCredentialMessage(messageId);
|
|
210
|
+
if (found && typeof found === "object") {
|
|
211
|
+
const f = found;
|
|
212
|
+
messageId = f.message?.id || f.id || messageId;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
} catch (_e) {}
|
|
216
|
+
return {
|
|
217
|
+
artifacts: { issuedCredentialRecordId: record?.id },
|
|
218
|
+
messageId
|
|
219
|
+
};
|
|
220
|
+
} catch (e) {
|
|
221
|
+
throw Object.assign(/* @__PURE__ */ new Error(`issue action error: ${e.message}`), { code: "action_error" });
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
var PresentProofV2Action = class {
|
|
226
|
+
constructor() {
|
|
227
|
+
this.typeUri = "https://didcomm.org/present-proof/2.0/request-presentation";
|
|
228
|
+
}
|
|
229
|
+
async execute(ctx) {
|
|
230
|
+
const ref = ctx.action.profile_ref;
|
|
231
|
+
if (!ref?.startsWith("pp.")) throw Object.assign(/* @__PURE__ */ new Error("invalid profile_ref"), { code: "action_error" });
|
|
232
|
+
const key = ref.slice(3);
|
|
233
|
+
const profile = ctx.template.catalog?.proof_profiles?.[key];
|
|
234
|
+
if (!profile) throw Object.assign(/* @__PURE__ */ new Error("missing catalog profile"), { code: "action_error" });
|
|
235
|
+
const connectionId = ctx.instance.connection_id;
|
|
236
|
+
if (!connectionId) throw Object.assign(/* @__PURE__ */ new Error("connectionId required"), { code: "action_error" });
|
|
237
|
+
{
|
|
238
|
+
const toRef2 = profile.to_ref;
|
|
239
|
+
const expectedDid2 = toRef2 ? ctx.instance.participants?.[toRef2]?.did : void 0;
|
|
240
|
+
if (expectedDid2 && ctx.instance.connection_id) {
|
|
241
|
+
const theirDid = (await ctx.agentContext.dependencyManager.resolve(DidCommConnectionService).getById(ctx.agentContext, ctx.instance.connection_id))?.theirDid;
|
|
242
|
+
if (theirDid && theirDid !== expectedDid2) throw Object.assign(/* @__PURE__ */ new Error("to_ref DID mismatch"), { code: "forbidden" });
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
try {
|
|
246
|
+
const proofsApi = ctx.agentContext.dependencyManager.resolve(DidCommProofsApi);
|
|
247
|
+
const credDefId = profile.cred_def_id;
|
|
248
|
+
const schemaId = profile.schema_id;
|
|
249
|
+
const restriction = credDefId ? { cred_def_id: credDefId } : schemaId ? { schema_id: schemaId } : void 0;
|
|
250
|
+
const reqAttrs = (profile.requested_attributes || []).reduce((acc, name, idx) => {
|
|
251
|
+
acc[`attr${idx + 1}`] = restriction ? {
|
|
252
|
+
name,
|
|
253
|
+
restrictions: [restriction]
|
|
254
|
+
} : { name };
|
|
255
|
+
return acc;
|
|
256
|
+
}, {});
|
|
257
|
+
const reqPreds = (profile.requested_predicates || []).reduce((acc, p, idx) => {
|
|
258
|
+
acc[`pred${idx + 1}`] = restriction ? {
|
|
259
|
+
name: p.name,
|
|
260
|
+
p_type: p.p_type,
|
|
261
|
+
p_value: p.p_value,
|
|
262
|
+
restrictions: [restriction]
|
|
263
|
+
} : {
|
|
264
|
+
name: p.name,
|
|
265
|
+
p_type: p.p_type,
|
|
266
|
+
p_value: p.p_value
|
|
267
|
+
};
|
|
268
|
+
return acc;
|
|
269
|
+
}, {});
|
|
270
|
+
const record = await proofsApi.requestProof({
|
|
271
|
+
connectionId,
|
|
272
|
+
protocolVersion: "v2",
|
|
273
|
+
proofFormats: { anoncreds: {
|
|
274
|
+
name: "Workflow Proof Request",
|
|
275
|
+
version: "1.0",
|
|
276
|
+
requested_attributes: reqAttrs,
|
|
277
|
+
requested_predicates: reqPreds
|
|
278
|
+
} },
|
|
279
|
+
willConfirm: true,
|
|
280
|
+
comment: profile.options?.comment
|
|
281
|
+
});
|
|
282
|
+
let messageId = record?.id || record?.proofRecord?.id;
|
|
283
|
+
try {
|
|
284
|
+
if (messageId) {
|
|
285
|
+
const found = await proofsApi.findRequestMessage(messageId);
|
|
286
|
+
if (found && typeof found === "object") {
|
|
287
|
+
const f = found;
|
|
288
|
+
messageId = f.message?.id || f.id || messageId;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
} catch (_e) {}
|
|
292
|
+
return {
|
|
293
|
+
artifacts: { proofRecordId: record?.id || record?.proofRecord?.id },
|
|
294
|
+
messageId
|
|
295
|
+
};
|
|
296
|
+
} catch (e) {
|
|
297
|
+
throw Object.assign(/* @__PURE__ */ new Error(`proof action error: ${e.message}`), { code: "action_error" });
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
//#endregion
|
|
303
|
+
export { ActionRegistry, IssueCredentialMessageV2Action, IssueCredentialV2Action, LocalStateSetAction, PresentProofV2Action, ProposeCredentialV2Action, RequestCredentialV2Action };
|
|
304
|
+
//# sourceMappingURL=ActionRegistry.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionRegistry.mjs","names":["ref: string","messageId: string | undefined"],"sources":["../../src/actions/ActionRegistry.ts"],"sourcesContent":["import type { ActionDef, WorkflowInstanceData, WorkflowTemplate } from '../model/types'\nimport type { AgentContext } from '@credo-ts/core'\n\nimport { DidCommCredentialsApi, DidCommProofsApi } from '@credo-ts/didcomm'\n\nimport { DidCommConnectionService } from '@credo-ts/didcomm'\n\nimport { AttributePlanner, deepMerge } from '../engine/AttributePlanner'\n\nexport type ActionCtx = {\n agentContext: AgentContext\n template: WorkflowTemplate\n instance: WorkflowInstanceData\n action: ActionDef\n input?: Record<string, unknown>\n}\n\nexport type ActionResult = {\n artifacts?: Record<string, unknown>\n contextMerge?: Record<string, unknown>\n messageId?: string\n}\n\nexport interface WorkflowActionHandler {\n readonly typeUri: string\n execute(ctx: ActionCtx): Promise<ActionResult>\n}\n\nexport class ActionRegistry {\n private handlers = new Map<string, WorkflowActionHandler>()\n public register(handler: WorkflowActionHandler) {\n this.handlers.set(handler.typeUri, handler)\n }\n public get(typeUri: string): WorkflowActionHandler | undefined {\n return this.handlers.get(typeUri)\n }\n}\n\nexport class LocalStateSetAction implements WorkflowActionHandler {\n public readonly typeUri = 'https://didcomm.org/workflow/actions/state:set@1'\n public async execute(ctx: ActionCtx): Promise<ActionResult> {\n const mergeObj = (ctx.action as { staticInput?: unknown })?.staticInput as { merge?: unknown } | undefined | string\n const mergeValue = typeof mergeObj === 'object' && mergeObj ? (mergeObj as { merge?: unknown }).merge : mergeObj\n if (mergeValue && typeof mergeValue === 'object') {\n const next = deepMerge({ ...(ctx.instance.context || {}) }, mergeValue as Record<string, unknown>)\n return { contextMerge: next }\n }\n // if string with template, try basic input resolution: '{{ input.form }}'\n if (typeof mergeValue === 'string' && ctx.input && mergeValue.includes('input.')) {\n try {\n const path = mergeValue\n .replace(/\\{\\{|\\}\\}/g, '')\n .trim()\n .replace(/^input\\./, '')\n const value = path.split('.').reduce<unknown>((acc, p) => {\n if (acc === null || acc === undefined) return undefined\n if (typeof acc !== 'object') return undefined\n return (acc as Record<string, unknown>)[p]\n }, ctx.input)\n if (value && typeof value === 'object') {\n const next = deepMerge({ ...(ctx.instance.context || {}) }, value as Record<string, unknown>)\n return { contextMerge: next }\n }\n } catch (_e) {\n void 0\n }\n }\n return {}\n }\n}\n\nexport class IssueCredentialV2Action implements WorkflowActionHandler {\n public readonly typeUri = 'https://didcomm.org/issue-credential/2.0/offer-credential'\n public async execute(ctx: ActionCtx): Promise<ActionResult> {\n const act = ctx.action as { profile_ref: string }\n const ref: string = act.profile_ref\n if (!ref?.startsWith('cp.')) throw Object.assign(new Error('invalid profile_ref'), { code: 'action_error' })\n const key = ref.slice(3)\n const profile = ctx.template.catalog?.credential_profiles?.[key]\n if (!profile) throw Object.assign(new Error('missing catalog profile'), { code: 'action_error' })\n const attrs = AttributePlanner.materialize(profile.attribute_plan || {}, ctx.instance)\n const attributes = Object.entries(attrs).map(([name, value]) => ({ name, value: String(value) }))\n const connectionId = ctx.instance.connection_id\n if (!connectionId) throw Object.assign(new Error('connectionId required'), { code: 'action_error' })\n // Enforce to_ref recipient DID against connection counterparty DID (if available)\n {\n const toRef = profile.to_ref\n const expectedDid = toRef ? ctx.instance.participants?.[toRef]?.did : undefined\n if (expectedDid && ctx.instance.connection_id) {\n const connSvc = ctx.agentContext.dependencyManager.resolve(DidCommConnectionService)\n const conn = await connSvc.getById(ctx.agentContext, ctx.instance.connection_id)\n const theirDid = (conn as unknown as { theirDid?: string })?.theirDid\n if (theirDid && theirDid !== expectedDid)\n throw Object.assign(new Error('to_ref DID mismatch'), { code: 'forbidden' })\n }\n }\n try {\n const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi) as unknown as {\n offerCredential: (options: unknown) => Promise<{ id: string; credentialRecord?: { id?: string } }>\n findOfferMessage: (id: string) => Promise<unknown>\n }\n const record = await credsApi.offerCredential({\n connectionId,\n protocolVersion: 'v2',\n credentialFormats: { anoncreds: { credentialDefinitionId: profile.cred_def_id, attributes } },\n comment: profile.options?.comment,\n })\n let messageId: string | undefined = record?.id || record?.credentialRecord?.id\n try {\n if (messageId) {\n const found = (await credsApi.findOfferMessage(messageId)) as unknown\n if (found && typeof found === 'object') {\n const f = found as { id?: string; message?: { id?: string } }\n messageId = f.message?.id || f.id || messageId\n }\n }\n } catch (_e) {\n void 0\n }\n return { artifacts: { issueRecordId: record?.id || record?.credentialRecord?.id }, messageId }\n } catch (e) {\n throw Object.assign(new Error(`issue action error: ${(e as Error).message}`), { code: 'action_error' })\n }\n }\n}\n\n/**\n * ProposeCredentialV2Action - Holder proposes a credential to the issuer\n * Used when holder initiates the credential issuance flow\n */\nexport class ProposeCredentialV2Action implements WorkflowActionHandler {\n public readonly typeUri = 'https://didcomm.org/issue-credential/2.0/propose-credential'\n\n public async execute(ctx: ActionCtx): Promise<ActionResult> {\n const act = ctx.action as { profile_ref: string }\n const ref: string = act.profile_ref\n if (!ref?.startsWith('cp.')) throw Object.assign(new Error('invalid profile_ref'), { code: 'action_error' })\n\n const key = ref.slice(3)\n const profile = ctx.template.catalog?.credential_profiles?.[key]\n if (!profile) throw Object.assign(new Error('missing catalog profile'), { code: 'action_error' })\n\n // Materialize attributes from context using attribute_plan\n const attrs = AttributePlanner.materialize(profile.attribute_plan || {}, ctx.instance)\n const attributes = Object.entries(attrs).map(([name, value]) => ({ name, value: String(value) }))\n\n const connectionId = ctx.instance.connection_id\n if (!connectionId) throw Object.assign(new Error('connectionId required'), { code: 'action_error' })\n\n try {\n const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi) as unknown as {\n proposeCredential: (options: unknown) => Promise<{ id: string; credentialRecord?: { id?: string } }>\n findProposalMessage: (id: string) => Promise<unknown>\n }\n\n const record = await credsApi.proposeCredential({\n connectionId,\n protocolVersion: 'v2',\n credentialFormats: {\n anoncreds: {\n credentialDefinitionId: profile.cred_def_id,\n attributes,\n },\n },\n comment: profile.options?.comment,\n })\n\n // Extract message ID for correlation\n let messageId: string | undefined = record?.id || record?.credentialRecord?.id\n try {\n if (messageId) {\n const found = await credsApi.findProposalMessage(messageId)\n if (found && typeof found === 'object') {\n const f = found as { id?: string; message?: { id?: string } }\n messageId = f.message?.id || f.id || messageId\n }\n }\n } catch (_e) {\n void 0\n }\n\n // Store record ID in artifacts for later actions to find\n return {\n artifacts: { credentialRecordId: record?.id || record?.credentialRecord?.id },\n messageId,\n }\n } catch (e) {\n throw Object.assign(new Error(`propose action error: ${(e as Error).message}`), { code: 'action_error' })\n }\n }\n}\n\n/**\n * RequestCredentialV2Action - Holder accepts a credential offer\n * Used when holder receives an offer and wants to request the credential\n */\nexport class RequestCredentialV2Action implements WorkflowActionHandler {\n public readonly typeUri = 'https://didcomm.org/issue-credential/2.0/request-credential'\n\n public async execute(ctx: ActionCtx): Promise<ActionResult> {\n const connectionId = ctx.instance.connection_id\n if (!connectionId) throw Object.assign(new Error('connectionId required'), { code: 'action_error' })\n\n try {\n const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi) as unknown as {\n acceptOffer: (options: { credentialRecordId: string }) => Promise<{ id: string }>\n getAll: () => Promise<Array<{ id: string; connectionId?: string; state: string; updatedAt?: Date }>>\n findRequestMessage: (id: string) => Promise<unknown>\n }\n\n // Find the credential record with OfferReceived state for this connection\n // Option 1: Check artifacts for stored credentialRecordId\n let credentialRecordId = ctx.instance.artifacts?.credentialRecordId as string | undefined\n\n // Option 2: Query by connection + state if not in artifacts\n if (!credentialRecordId) {\n const all = await credsApi.getAll()\n const matches = all\n .filter((r) => r.connectionId === connectionId && r.state === 'offer-received')\n .sort((a, b) => {\n const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0\n const dateB = b.updatedAt ? new Date(b.updatedAt).getTime() : 0\n return dateB - dateA // Most recent first\n })\n if (matches.length === 0) {\n throw Object.assign(new Error('no offer found to accept'), { code: 'action_error' })\n }\n credentialRecordId = matches[0].id\n }\n\n const record = await credsApi.acceptOffer({ credentialRecordId })\n\n let messageId: string | undefined = record?.id\n try {\n if (messageId) {\n const found = await credsApi.findRequestMessage(messageId)\n if (found && typeof found === 'object') {\n const f = found as { id?: string; message?: { id?: string } }\n messageId = f.message?.id || f.id || messageId\n }\n }\n } catch (_e) {\n void 0\n }\n\n return {\n artifacts: { credentialRecordId: record?.id },\n messageId,\n }\n } catch (e) {\n throw Object.assign(new Error(`request action error: ${(e as Error).message}`), { code: 'action_error' })\n }\n }\n}\n\n/**\n * IssueCredentialMessageV2Action - Issuer issues the credential after receiving a request\n * Used when issuer receives a credential request and wants to issue the credential\n */\nexport class IssueCredentialMessageV2Action implements WorkflowActionHandler {\n public readonly typeUri = 'https://didcomm.org/issue-credential/2.0/issue-credential'\n\n public async execute(ctx: ActionCtx): Promise<ActionResult> {\n const connectionId = ctx.instance.connection_id\n if (!connectionId) throw Object.assign(new Error('connectionId required'), { code: 'action_error' })\n\n try {\n const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi) as unknown as {\n acceptRequest: (options: { credentialRecordId: string }) => Promise<{ id: string }>\n getAll: () => Promise<Array<{ id: string; connectionId?: string; state: string; updatedAt?: Date }>>\n findCredentialMessage: (id: string) => Promise<unknown>\n }\n\n // Find the credential record with RequestReceived state for this connection\n let credentialRecordId = ctx.instance.artifacts?.credentialRecordId as string | undefined\n\n if (!credentialRecordId) {\n const all = await credsApi.getAll()\n const matches = all\n .filter((r) => r.connectionId === connectionId && r.state === 'request-received')\n .sort((a, b) => {\n const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0\n const dateB = b.updatedAt ? new Date(b.updatedAt).getTime() : 0\n return dateB - dateA // Most recent first\n })\n if (matches.length === 0) {\n throw Object.assign(new Error('no request found to issue'), { code: 'action_error' })\n }\n credentialRecordId = matches[0].id\n }\n\n const record = await credsApi.acceptRequest({ credentialRecordId })\n\n let messageId: string | undefined = record?.id\n try {\n if (messageId) {\n const found = await credsApi.findCredentialMessage(messageId)\n if (found && typeof found === 'object') {\n const f = found as { id?: string; message?: { id?: string } }\n messageId = f.message?.id || f.id || messageId\n }\n }\n } catch (_e) {\n void 0\n }\n\n return {\n artifacts: { issuedCredentialRecordId: record?.id },\n messageId,\n }\n } catch (e) {\n throw Object.assign(new Error(`issue action error: ${(e as Error).message}`), { code: 'action_error' })\n }\n }\n}\n\nexport class PresentProofV2Action implements WorkflowActionHandler {\n public readonly typeUri = 'https://didcomm.org/present-proof/2.0/request-presentation'\n public async execute(ctx: ActionCtx): Promise<ActionResult> {\n const act = ctx.action as { profile_ref: string }\n const ref: string = act.profile_ref\n if (!ref?.startsWith('pp.')) throw Object.assign(new Error('invalid profile_ref'), { code: 'action_error' })\n const key = ref.slice(3)\n const profile = ctx.template.catalog?.proof_profiles?.[key]\n if (!profile) throw Object.assign(new Error('missing catalog profile'), { code: 'action_error' })\n const connectionId = ctx.instance.connection_id\n if (!connectionId) throw Object.assign(new Error('connectionId required'), { code: 'action_error' })\n // Enforce to_ref recipient DID against connection counterparty DID (if available)\n {\n const toRef2 = profile.to_ref\n const expectedDid2 = toRef2 ? ctx.instance.participants?.[toRef2]?.did : undefined\n if (expectedDid2 && ctx.instance.connection_id) {\n const connSvc = ctx.agentContext.dependencyManager.resolve(DidCommConnectionService)\n const conn = await connSvc.getById(ctx.agentContext, ctx.instance.connection_id)\n const theirDid = (conn as unknown as { theirDid?: string })?.theirDid\n if (theirDid && theirDid !== expectedDid2)\n throw Object.assign(new Error('to_ref DID mismatch'), { code: 'forbidden' })\n }\n }\n try {\n const proofsApi = ctx.agentContext.dependencyManager.resolve(DidCommProofsApi) as unknown as {\n requestProof: (options: unknown) => Promise<{ id: string; proofRecord?: { id?: string } }>\n findRequestMessage: (id: string) => Promise<unknown>\n }\n const credDefId = (profile as { cred_def_id?: string }).cred_def_id\n const schemaId = (profile as { schema_id?: string }).schema_id\n const restriction = credDefId ? { cred_def_id: credDefId } : schemaId ? { schema_id: schemaId } : undefined\n\n const reqAttrs = (profile.requested_attributes || []).reduce<Record<string, unknown>>(\n (acc, name: string, idx: number) => {\n acc[`attr${idx + 1}`] = restriction ? { name, restrictions: [restriction] } : { name }\n return acc\n },\n {}\n )\n const reqPreds = (profile.requested_predicates || []).reduce<Record<string, unknown>>(\n (acc, p: { name: string; p_type: string; p_value: number }, idx: number) => {\n acc[`pred${idx + 1}`] = restriction\n ? { name: p.name, p_type: p.p_type, p_value: p.p_value, restrictions: [restriction] }\n : { name: p.name, p_type: p.p_type, p_value: p.p_value }\n return acc\n },\n {}\n )\n const record = await proofsApi.requestProof({\n connectionId,\n protocolVersion: 'v2',\n proofFormats: {\n anoncreds: {\n name: 'Workflow Proof Request',\n version: '1.0',\n requested_attributes: reqAttrs,\n requested_predicates: reqPreds,\n },\n },\n willConfirm: true,\n comment: profile.options?.comment,\n })\n let messageId: string | undefined = record?.id || record?.proofRecord?.id\n try {\n if (messageId) {\n const found = (await proofsApi.findRequestMessage(messageId)) as unknown\n if (found && typeof found === 'object') {\n const f = found as { id?: string; message?: { id?: string } }\n messageId = f.message?.id || f.id || messageId\n }\n }\n } catch (_e) {\n void 0\n }\n return { artifacts: { proofRecordId: record?.id || record?.proofRecord?.id }, messageId }\n } catch (e) {\n throw Object.assign(new Error(`proof action error: ${(e as Error).message}`), { code: 'action_error' })\n }\n }\n}\n"],"mappings":";;;;AA4BA,IAAa,iBAAb,MAA4B;;OAClB,2BAAW,IAAI,KAAoC;;CAC3D,AAAO,SAAS,SAAgC;AAC9C,OAAK,SAAS,IAAI,QAAQ,SAAS,QAAQ;;CAE7C,AAAO,IAAI,SAAoD;AAC7D,SAAO,KAAK,SAAS,IAAI,QAAQ;;;AAIrC,IAAa,sBAAb,MAAkE;;OAChD,UAAU;;CAC1B,MAAa,QAAQ,KAAuC;EAC1D,MAAM,WAAY,IAAI,QAAsC;EAC5D,MAAM,aAAa,OAAO,aAAa,YAAY,WAAY,SAAiC,QAAQ;AACxG,MAAI,cAAc,OAAO,eAAe,SAEtC,QAAO,EAAE,cADI,UAAU,EAAE,GAAI,IAAI,SAAS,WAAW,EAAE,EAAG,EAAE,WAAsC,EACrE;AAG/B,MAAI,OAAO,eAAe,YAAY,IAAI,SAAS,WAAW,SAAS,SAAS,CAC9E,KAAI;GAKF,MAAM,QAJO,WACV,QAAQ,cAAc,GAAG,CACzB,MAAM,CACN,QAAQ,YAAY,GAAG,CACP,MAAM,IAAI,CAAC,QAAiB,KAAK,MAAM;AACxD,QAAI,QAAQ,QAAQ,QAAQ,OAAW,QAAO;AAC9C,QAAI,OAAO,QAAQ,SAAU,QAAO;AACpC,WAAQ,IAAgC;MACvC,IAAI,MAAM;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,MAAM,UAAU,mBAAmB,UAAU;AAC5D,SAAI,SAAS,OAAO,UAAU,UAAU;MACtC,MAAM,IAAI;AACV,kBAAY,EAAE,SAAS,MAAM,EAAE,MAAM;;;YAGlC,IAAI;AAGb,UAAO;IAAE,WAAW,EAAE,eAAe,QAAQ,MAAM,QAAQ,aAAa,IAAI;IAAE;IAAW;WAClF,GAAG;AACV,SAAM,OAAO,uBAAO,IAAI,MAAM,uBAAwB,EAAY,UAAU,EAAE,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Participants, UiItem, WorkflowTemplate } from "../model/types.mjs";
|
|
2
|
+
import { WorkflowInstanceRecord } from "../repository/WorkflowInstanceRecord.mjs";
|
|
3
|
+
import { WorkflowTemplateRecord } from "../repository/WorkflowTemplateRecord.mjs";
|
|
4
|
+
import { WorkflowService } from "../services/WorkflowService.mjs";
|
|
5
|
+
import { AgentContext } from "@credo-ts/core";
|
|
6
|
+
|
|
7
|
+
//#region src/api/WorkflowApi.d.ts
|
|
8
|
+
declare class WorkflowApi {
|
|
9
|
+
private readonly service;
|
|
10
|
+
private readonly agentContext;
|
|
11
|
+
constructor(service: WorkflowService, agentContext: AgentContext);
|
|
12
|
+
publishTemplate(template: WorkflowTemplate): Promise<WorkflowTemplateRecord>;
|
|
13
|
+
start(opts: {
|
|
14
|
+
template_id: string;
|
|
15
|
+
template_version?: string;
|
|
16
|
+
instance_id?: string;
|
|
17
|
+
connection_id?: string;
|
|
18
|
+
participants?: Participants;
|
|
19
|
+
context?: Record<string, unknown>;
|
|
20
|
+
}): Promise<WorkflowInstanceRecord>;
|
|
21
|
+
advance(opts: {
|
|
22
|
+
instance_id: string;
|
|
23
|
+
event: string;
|
|
24
|
+
idempotency_key?: string;
|
|
25
|
+
input?: Record<string, unknown>;
|
|
26
|
+
}): Promise<WorkflowInstanceRecord>;
|
|
27
|
+
listTemplates(): Promise<WorkflowTemplateRecord[]>;
|
|
28
|
+
getTemplate(template_id: string, template_version?: string): Promise<WorkflowTemplateRecord | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Ensure a template exists locally by fetching it from the counterparty.
|
|
31
|
+
* If template_version is omitted, the remote will return its preferred/latest version.
|
|
32
|
+
* Returns the stored record or null when not found within waitMs.
|
|
33
|
+
*/
|
|
34
|
+
ensureTemplate(opts: {
|
|
35
|
+
connection_id: string;
|
|
36
|
+
template_id: string;
|
|
37
|
+
template_version?: string;
|
|
38
|
+
prefer_hash?: string;
|
|
39
|
+
waitMs?: number;
|
|
40
|
+
}): Promise<WorkflowTemplateRecord | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Ask counterparty to list workflows matching filters. This sends DIDComm only.
|
|
43
|
+
* Note: The reply (WorkflowsMessage) is not persisted; use for UX hints or pair with ensureTemplate.
|
|
44
|
+
*/
|
|
45
|
+
discoverTemplates(connection_id: string, opts?: {
|
|
46
|
+
template_id?: string;
|
|
47
|
+
version?: string;
|
|
48
|
+
include_hash?: boolean;
|
|
49
|
+
}): Promise<void>;
|
|
50
|
+
status(opts: {
|
|
51
|
+
instance_id: string;
|
|
52
|
+
include_actions?: boolean;
|
|
53
|
+
include_ui?: boolean;
|
|
54
|
+
ui_profile?: string;
|
|
55
|
+
viewer?: {
|
|
56
|
+
role?: string;
|
|
57
|
+
connection_id?: string;
|
|
58
|
+
did?: string;
|
|
59
|
+
participantKey?: string;
|
|
60
|
+
};
|
|
61
|
+
capabilities?: string[];
|
|
62
|
+
}): Promise<{
|
|
63
|
+
instance_id: string;
|
|
64
|
+
state: string;
|
|
65
|
+
section?: string;
|
|
66
|
+
allowed_events: string[];
|
|
67
|
+
action_menu: Array<{
|
|
68
|
+
label?: string;
|
|
69
|
+
event: string;
|
|
70
|
+
}>;
|
|
71
|
+
artifacts: Record<string, unknown>;
|
|
72
|
+
ui?: UiItem[];
|
|
73
|
+
ui_profile?: string;
|
|
74
|
+
assets?: Record<string, {
|
|
75
|
+
mediaType: string;
|
|
76
|
+
uri?: string;
|
|
77
|
+
attachmentId?: string;
|
|
78
|
+
}>;
|
|
79
|
+
}>;
|
|
80
|
+
pause(opts: {
|
|
81
|
+
instance_id: string;
|
|
82
|
+
reason?: string;
|
|
83
|
+
}): Promise<WorkflowInstanceRecord>;
|
|
84
|
+
resume(opts: {
|
|
85
|
+
instance_id: string;
|
|
86
|
+
reason?: string;
|
|
87
|
+
}): Promise<WorkflowInstanceRecord>;
|
|
88
|
+
cancel(opts: {
|
|
89
|
+
instance_id: string;
|
|
90
|
+
reason?: string;
|
|
91
|
+
}): Promise<WorkflowInstanceRecord>;
|
|
92
|
+
complete(opts: {
|
|
93
|
+
instance_id: string;
|
|
94
|
+
reason?: string;
|
|
95
|
+
}): Promise<WorkflowInstanceRecord>;
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { WorkflowApi };
|
|
99
|
+
//# sourceMappingURL=WorkflowApi.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowApi.d.mts","names":[],"sources":["../../src/api/WorkflowApi.ts"],"sourcesContent":[],"mappings":";;;;;;;cAiBa,WAAA;;EAAA,iBAAW,YAAA;EACuB,WAAA,CAAA,OAAA,EAAA,eAAA,EAAA,YAAA,EAAgD,YAAhD;EAAgD,eAAA,CAAA,QAAA,EAE5D,gBAF4D,CAAA,EAEzC,OAFyC,CAEjC,sBAFiC,CAAA;EAE5D,KAAA,CAAA,IAAA,EAAA;IAA2B,WAAA,EAAA,MAAA;IAAR,gBAAA,CAAA,EAAA,MAAA;IASnC,WAAA,CAAA,EAAA,MAAA;IACL,aAAA,CAAA,EAAA,MAAA;IACA,YAAA,CAAA,EAFK,YAEL;IAAR,OAAA,CAAA,EADQ,MACR,CAAA,MAAA,EAAA,OAAA,CAAA;EA0CM,CAAA,CAAA,EA1CN,OA0CM,CA1CE,sBA0CF,CAAA;EACE,OAAA,CAAA,IAAA,EAAA;IAAR,WAAA,EAAA,MAAA;IAsCkC,KAAA,EAAA,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