@adobe/acc-js-sdk 1.1.46 → 1.1.47
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/docs/changeLog.html +9 -0
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/samples/030 - basics - workflows.js +40 -0
- package/src/client.js +3 -1
- package/test/client.test.js +37 -19
- package/test/mock.js +28 -0
package/docs/changeLog.html
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
layout: page
|
|
3
3
|
title: Change Log
|
|
4
4
|
---
|
|
5
|
+
<section class="changelog"><h1>Version 1.1.47</h1>
|
|
6
|
+
<h2>2024/04/23</h2>
|
|
7
|
+
<li>
|
|
8
|
+
Issue 105 (https://github.com/adobe/acc-js-sdk/issues/105). Fix XML name of parameters in workflow functions. The name is expected to be 'variables' and not 'parameters'.
|
|
9
|
+
Methods StartWithParameters, PostEvent, SimulateWithParameters, SpawnWithParameters, and SpawnWithParametersEx are included.
|
|
10
|
+
</li>
|
|
11
|
+
</section>
|
|
12
|
+
|
|
13
|
+
|
|
5
14
|
<section class="changelog"><h1>Version 1.1.46</h1>
|
|
6
15
|
<h2>2024/03/19</h2>
|
|
7
16
|
<li>
|
package/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/acc-js-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.47",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@adobe/acc-js-sdk",
|
|
9
|
-
"version": "1.1.
|
|
9
|
+
"version": "1.1.47",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"axios": "^1.2.1",
|
package/package.json
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
const utils = require("./utils.js");
|
|
13
|
+
|
|
14
|
+
/* Basic samples illustrating how to manage workflows
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
( async () => {
|
|
18
|
+
|
|
19
|
+
await utils.sample({
|
|
20
|
+
title: "Activate a workflow via a signal",
|
|
21
|
+
labels: [ "xtk:workflow", "Basics", "Workflow", "Signal" ],
|
|
22
|
+
description: `The PostEvent method activats a signal activity of a workflow`,
|
|
23
|
+
code: async() => {
|
|
24
|
+
return await utils.logon(async (client, NLWS) => {
|
|
25
|
+
console.log("This sample will post an event to a signal activity of a workflow.");
|
|
26
|
+
|
|
27
|
+
const workflowIdOrName = "WKF20";
|
|
28
|
+
const activityName = "signal";
|
|
29
|
+
const transitionName = "";
|
|
30
|
+
const variables = { hello: "world" };
|
|
31
|
+
const complete = false;
|
|
32
|
+
await NLWS.xtkWorkflow.postEvent(workflowIdOrName, activityName, transitionName, variables, complete);
|
|
33
|
+
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
})();
|
|
40
|
+
|
package/src/client.js
CHANGED
|
@@ -1197,7 +1197,9 @@ class Client {
|
|
|
1197
1197
|
// Hack for workflow API. The C++ code checks that the name of the XML element is <variables>. When
|
|
1198
1198
|
// using xml representation at the SDK level, it's ok since the SDK caller will set that. But this does
|
|
1199
1199
|
// not work when using "BadgerFish" representation where we do not know the root element name.
|
|
1200
|
-
if (entitySchemaId == "xtk:workflow" &&
|
|
1200
|
+
if (entitySchemaId == "xtk:workflow" && paramName == "parameters" && (
|
|
1201
|
+
methodName == "StartWithParameters" || methodName == "PostEvent" || methodName == "SimulateWithParameters" ||
|
|
1202
|
+
methodName == "SpawnWithParameters" || methodName == "SpawnWithParametersEx") )
|
|
1201
1203
|
docName = "variables";
|
|
1202
1204
|
if (entitySchemaId == "nms:rtEvent" && methodName == "PushEvent")
|
|
1203
1205
|
docName = "rtEvent";
|
package/test/client.test.js
CHANGED
|
@@ -1061,26 +1061,44 @@ describe('ACC Client', function () {
|
|
|
1061
1061
|
await client.NLWS.xtkSession.logon();
|
|
1062
1062
|
|
|
1063
1063
|
client._transport.mockReturnValueOnce(Mock.GET_XTK_WORKFLOW_SCHEMA_RESPONSE);
|
|
1064
|
-
client._transport.mockImplementationOnce(options => {
|
|
1065
|
-
const doc = DomUtil.parse(options.data);
|
|
1066
|
-
const body = DomUtil.findElement(doc.documentElement, "SOAP-ENV:Body");
|
|
1067
|
-
const method = DomUtil.getFirstChildElement(body);
|
|
1068
|
-
const parameters = DomUtil.findElement(method, "parameters");
|
|
1069
|
-
const variables = DomUtil.getFirstChildElement(parameters, "variables");
|
|
1070
|
-
if (!variables)
|
|
1071
|
-
throw new Error("Did not find 'variables' node");
|
|
1072
|
-
if (variables.getAttribute("hello") != "world")
|
|
1073
|
-
throw new Error("Did not find 'hello' variable");
|
|
1074
1064
|
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1065
|
+
const mockImpl = (methodName) => {
|
|
1066
|
+
client._transport.mockImplementationOnce(options => {
|
|
1067
|
+
const doc = DomUtil.parse(options.data);
|
|
1068
|
+
const body = DomUtil.findElement(doc.documentElement, "SOAP-ENV:Body");
|
|
1069
|
+
const method = DomUtil.getFirstChildElement(body);
|
|
1070
|
+
const parameters = DomUtil.findElement(method, "parameters");
|
|
1071
|
+
const variables = DomUtil.getFirstChildElement(parameters, "variables");
|
|
1072
|
+
if (!variables)
|
|
1073
|
+
throw new Error("Did not find 'variables' node");
|
|
1074
|
+
if (variables.getAttribute("hello") != "world")
|
|
1075
|
+
throw new Error("Did not find 'hello' variable");
|
|
1076
|
+
|
|
1077
|
+
const tagName = methodName + "Response";
|
|
1078
|
+
return Promise.resolve(`<?xml version='1.0'?>
|
|
1079
|
+
<SOAP-ENV:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ns='urn:xtk:workflow' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
|
|
1080
|
+
<SOAP-ENV:Body>
|
|
1081
|
+
<${tagName} xmlns='urn:xtk:workflow' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
|
|
1082
|
+
</${tagName}>
|
|
1083
|
+
</SOAP-ENV:Body>
|
|
1084
|
+
</SOAP-ENV:Envelope>`);
|
|
1085
|
+
});
|
|
1086
|
+
};
|
|
1087
|
+
|
|
1088
|
+
const variables = { "hello": "world" };
|
|
1089
|
+
|
|
1090
|
+
mockImpl("StartWithParameters");
|
|
1091
|
+
await client.NLWS.xtkWorkflow.startWithParameters(4900, variables);
|
|
1092
|
+
mockImpl("SimulateWithParameters");
|
|
1093
|
+
await client.NLWS.xtkWorkflow.simulateWithParameters(4900, variables);
|
|
1094
|
+
mockImpl("PostEvent");
|
|
1095
|
+
await client.NLWS.xtkWorkflow.postEvent("WFK123", "signal", "", variables, false);
|
|
1096
|
+
|
|
1097
|
+
// return parameter instanceId has been removed from the mock method definition to simplify the unit test
|
|
1098
|
+
mockImpl("SpawnWithParameters");
|
|
1099
|
+
await client.NLWS.xtkWorkflow.spawnWithParameters(4900, variables);
|
|
1100
|
+
mockImpl("SpawnWithParametersEx");
|
|
1101
|
+
await client.NLWS.xtkWorkflow.spawnWithParametersEx(4900, true, variables);
|
|
1084
1102
|
|
|
1085
1103
|
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
|
|
1086
1104
|
await client.NLWS.xtkSession.logoff();
|
package/test/mock.js
CHANGED
|
@@ -742,6 +742,34 @@ const GET_XTK_WORKFLOW_SCHEMA_RESPONSE = Promise.resolve(`<?xml version='1.0'?>
|
|
|
742
742
|
<param name="parameters" type="DOMElement" inout="in"></param>
|
|
743
743
|
</parameters>
|
|
744
744
|
</method>
|
|
745
|
+
<method name="SimulateWithParameters" static="true">
|
|
746
|
+
<parameters>
|
|
747
|
+
<param name="workflowId" type="string" inout="in" />
|
|
748
|
+
<param name="parameters" type="DOMElement" inout="in"></param>
|
|
749
|
+
</parameters>
|
|
750
|
+
</method>
|
|
751
|
+
<method name="PostEvent" static="true">
|
|
752
|
+
<parameters>
|
|
753
|
+
<param name="workflowId" type="string" inout="in"/>
|
|
754
|
+
<param name="activity" type="string" inout="in"/>
|
|
755
|
+
<param name="transition" type="string" inout="in"/>
|
|
756
|
+
<param name="parameters" type="DOMElement" inout="in"/>
|
|
757
|
+
<param name="complete" type="boolean" inout="in"/>
|
|
758
|
+
</parameters>
|
|
759
|
+
</method>
|
|
760
|
+
<method name="SpawnWithParameters" static="true">
|
|
761
|
+
<parameters>
|
|
762
|
+
<param name="workflowId" type="string" inout="in" />
|
|
763
|
+
<param name="parameters" type="DOMElement" inout="in"></param>
|
|
764
|
+
</parameters>
|
|
765
|
+
</method>
|
|
766
|
+
<method name="SpawnWithParametersEx" static="true">
|
|
767
|
+
<parameters>
|
|
768
|
+
<param name="workflowId" type="string" inout="in" />
|
|
769
|
+
<param name="simulation" type="boolean" inout="in"/>
|
|
770
|
+
<param name="parameters" type="DOMElement" inout="in"></param>
|
|
771
|
+
</parameters>
|
|
772
|
+
</method>
|
|
745
773
|
</methods>
|
|
746
774
|
</schema>
|
|
747
775
|
</pdomDoc>
|