@adobe/acc-js-sdk 1.1.62 → 1.2.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.
Files changed (61) hide show
  1. package/.cursor/commands/opsx-apply.md +152 -0
  2. package/.cursor/commands/opsx-archive.md +157 -0
  3. package/.cursor/commands/opsx-explore.md +173 -0
  4. package/.cursor/commands/opsx-propose.md +106 -0
  5. package/.cursor/skills/openspec-apply-change/SKILL.md +156 -0
  6. package/.cursor/skills/openspec-archive-change/SKILL.md +114 -0
  7. package/.cursor/skills/openspec-explore/SKILL.md +288 -0
  8. package/.cursor/skills/openspec-propose/SKILL.md +110 -0
  9. package/.eslintrc.js +2 -2
  10. package/.github/prompts/opsx-apply.prompt.md +149 -0
  11. package/.github/prompts/opsx-archive.prompt.md +154 -0
  12. package/.github/prompts/opsx-explore.prompt.md +170 -0
  13. package/.github/prompts/opsx-propose.prompt.md +103 -0
  14. package/.github/skills/openspec-apply-change/SKILL.md +156 -0
  15. package/.github/skills/openspec-archive-change/SKILL.md +114 -0
  16. package/.github/skills/openspec-explore/SKILL.md +288 -0
  17. package/.github/skills/openspec-propose/SKILL.md +110 -0
  18. package/.github/workflows/codeql-analysis.yml +5 -4
  19. package/.github/workflows/npm-publish.yml +3 -3
  20. package/AGENTS.md +117 -0
  21. package/CLAUDE.md +2 -0
  22. package/MIGRATION.md +10 -0
  23. package/README.md +6 -2
  24. package/ai-docs/coding-rules.md +95 -0
  25. package/ai-docs/tech-stack.md +43 -0
  26. package/babel.config.js +5 -0
  27. package/docs/changeLog.html +28 -2
  28. package/docs/checkList.html +2 -2
  29. package/docs/quickstart.html +2 -1
  30. package/docs/release.html +1 -1
  31. package/openspec/config.yaml +20 -0
  32. package/package-lock.json +6055 -4036
  33. package/package.json +9 -7
  34. package/src/AGENTS.md +98 -0
  35. package/src/CLAUDE.md +2 -0
  36. package/src/application.js +637 -637
  37. package/src/cache.js +133 -133
  38. package/src/cacheRefresher.js +190 -190
  39. package/src/campaign.js +532 -532
  40. package/src/client.js +1539 -1537
  41. package/src/crypto.js +52 -52
  42. package/src/domUtil.js +346 -346
  43. package/src/entityAccessor.js +61 -61
  44. package/src/index.js +83 -83
  45. package/src/methodCache.js +69 -69
  46. package/src/optionCache.js +26 -26
  47. package/src/soap.js +321 -322
  48. package/src/testUtil.js +13 -13
  49. package/src/transport.js +70 -70
  50. package/src/util.js +147 -147
  51. package/src/web/bundler.js +5 -5
  52. package/src/xtkCaster.js +258 -258
  53. package/src/xtkEntityCache.js +34 -34
  54. package/src/xtkJob.js +185 -185
  55. package/test/AGENTS.md +37 -0
  56. package/test/CLAUDE.md +2 -0
  57. package/test/cacheRefresher.test.js +7 -0
  58. package/test/client.test.js +90 -78
  59. package/test/jest.config.js +6 -0
  60. package/test/observability.test.js +6 -1
  61. package/test/xtkJob.test.js +2 -2
package/src/soap.js CHANGED
@@ -10,10 +10,9 @@ OF ANY KIND, either express or implied. See the License for the specific languag
10
10
  governing permissions and limitations under the License.
11
11
  */
12
12
  (function() {
13
- "use strict";
14
- /*jshint sub:true*/
13
+ "use strict";
15
14
 
16
- /**********************************************************************************
15
+ /**********************************************************************************
17
16
  *
18
17
  * SOAP calls wrapper
19
18
  *
@@ -46,28 +45,28 @@ governing permissions and limitations under the License.
46
45
  *
47
46
  *********************************************************************************/
48
47
 
49
- const { DomUtil, DomException } = require('./domUtil.js');
50
- const XtkCaster = require('./xtkCaster.js').XtkCaster;
51
- const { CampaignException, makeCampaignException } = require('./campaign.js');
52
- const SOAP_ENCODING_NATIVE = "http://schemas.xmlsoap.org/soap/encoding/";
53
- const SOAP_ENCODING_XML = "http://xml.apache.org/xml-soap/literalxml";
54
- const NS_ENV = "http://schemas.xmlsoap.org/soap/envelope/";
55
- const NS_XSI = "http://www.w3.org/2001/XMLSchema-instance";
56
- const NS_XSD = "http://www.w3.org/2001/XMLSchema";
48
+ const { DomUtil, DomException } = require('./domUtil.js');
49
+ const XtkCaster = require('./xtkCaster.js').XtkCaster;
50
+ const { CampaignException, makeCampaignException } = require('./campaign.js');
51
+ const SOAP_ENCODING_NATIVE = "http://schemas.xmlsoap.org/soap/encoding/";
52
+ const SOAP_ENCODING_XML = "http://xml.apache.org/xml-soap/literalxml";
53
+ const NS_ENV = "http://schemas.xmlsoap.org/soap/envelope/";
54
+ const NS_XSI = "http://www.w3.org/2001/XMLSchema-instance";
55
+ const NS_XSD = "http://www.w3.org/2001/XMLSchema";
57
56
 
58
57
 
59
- /**
58
+ /**
60
59
  * @namespace SOAP
61
60
  */
62
61
 
63
62
 
64
63
 
65
- /**
64
+ /**
66
65
  * @namespace SOAP
67
66
  */
68
67
 
69
68
 
70
- /**
69
+ /**
71
70
  * Creates a SOAP method call object which encapsulates a SOAP call and helper methods to constructs
72
71
  * the call and decode the result.
73
72
  *
@@ -83,47 +82,47 @@ const NS_XSD = "http://www.w3.org/2001/XMLSchema";
83
82
  * @param {string} bearerToken The bearer token to use for HTTP requests. Only required for ImsBearerToken authentication
84
83
  * @memberof SOAP
85
84
  */
86
- class SoapMethodCall {
85
+ class SoapMethodCall {
87
86
 
88
87
  constructor(transport, urn, methodName, sessionToken, securityToken, userAgentString, pushDownOptions, extraHttpHeaders, bearerToken) {
89
- this.request = undefined; // The HTTP request (object literal passed to the transport layer)
90
- this.requestOptions = undefined;
91
- this.response = undefined; // The HTTP response object (in case of success)
88
+ this.request = undefined; // The HTTP request (object literal passed to the transport layer)
89
+ this.requestOptions = undefined;
90
+ this.response = undefined; // The HTTP response object (in case of success)
92
91
 
93
- // Current URN and method (for error reporting)
94
- this.urn = urn;
95
- this.methodName = methodName;
96
- this.isStatic = false;
92
+ // Current URN and method (for error reporting)
93
+ this.urn = urn;
94
+ this.methodName = methodName;
95
+ this.isStatic = false;
97
96
 
98
- // Soap calls marked as internal are calls performed by the framework internally
99
- // (such as GetEntityIfMoreRecent calls needed to lookup schemas)
100
- this.internal = false;
101
- // Enable soap retry
102
- this.retry = true;
103
- this._retryCount = 0;
97
+ // Soap calls marked as internal are calls performed by the framework internally
98
+ // (such as GetEntityIfMoreRecent calls needed to lookup schemas)
99
+ this.internal = false;
100
+ // Enable soap retry
101
+ this.retry = true;
102
+ this._retryCount = 0;
104
103
 
105
- this._sessionToken = sessionToken || "";
106
- this._securityToken = securityToken || "";
107
- this._bearerToken = bearerToken; // may be undefined if not using bearer token authentication
108
- this._userAgentString = userAgentString;
109
- this._pushDownOptions = pushDownOptions || {};
110
- this._charset = this._pushDownOptions.charset || '';
111
- this._extraHttpHeaders = extraHttpHeaders || {};
104
+ this._sessionToken = sessionToken || "";
105
+ this._securityToken = securityToken || "";
106
+ this._bearerToken = bearerToken; // may be undefined if not using bearer token authentication
107
+ this._userAgentString = userAgentString;
108
+ this._pushDownOptions = pushDownOptions || {};
109
+ this._charset = this._pushDownOptions.charset || '';
110
+ this._extraHttpHeaders = extraHttpHeaders || {};
112
111
 
113
- // THe SOAP call being built
114
- this._doc = undefined; // XML document for SOAP call
115
- this._root = undefined; // Root of the document
116
- this._header = undefined; // SOAP-ENV:Header
117
- this._data = undefined; // SOAP-ENV:Body
118
- this._method = undefined; // XML element for the method
112
+ // THe SOAP call being built
113
+ this._doc = undefined; // XML document for SOAP call
114
+ this._root = undefined; // Root of the document
115
+ this._header = undefined; // SOAP-ENV:Header
116
+ this._data = undefined; // SOAP-ENV:Body
117
+ this._method = undefined; // XML element for the method
119
118
 
120
- this._initMessage(urn, methodName, SOAP_ENCODING_NATIVE);
119
+ this._initMessage(urn, methodName, SOAP_ENCODING_NATIVE);
121
120
 
122
- // Current DOM element for reading result (getNext* functions)
123
- this.elemCurrent = undefined;
121
+ // Current DOM element for reading result (getNext* functions)
122
+ this.elemCurrent = undefined;
124
123
 
125
- // Transport object to perform HTTP request (request or mock)
126
- this._transport = transport;
124
+ // Transport object to perform HTTP request (request or mock)
125
+ this._transport = transport;
127
126
  }
128
127
 
129
128
  /**
@@ -131,9 +130,9 @@ class SoapMethodCall {
131
130
  * @returns {boolean} indicates if the call requires a Logon first
132
131
  */
133
132
  requiresLogon() {
134
- const requiresLogon = !(this.urn === "xtk:session" &&
133
+ const requiresLogon = !(this.urn === "xtk:session" &&
135
134
  (this.methodName === "Logon" || this.methodName === "BearerTokenLogon") ) ;
136
- return requiresLogon;
135
+ return requiresLogon;
137
136
  }
138
137
 
139
138
  /**
@@ -145,24 +144,24 @@ class SoapMethodCall {
145
144
  * @param {string} encoding the SOAP encoding style (SOAP-ENV:encodingStyle)
146
145
  */
147
146
  _initMessage(urn, method, encoding) {
148
- this.urn = urn;
149
- this.methodName = method;
150
- this.encoding = encoding;
151
- var urnPath = "urn:" + urn;
147
+ this.urn = urn;
148
+ this.methodName = method;
149
+ this.encoding = encoding;
150
+ var urnPath = "urn:" + urn;
152
151
 
153
- this._doc = DomUtil.parse(`<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:xsd='${NS_XSD}' xmlns:xsi='${NS_XSI}' xmlns:SOAP-ENV='${NS_ENV}' xmlns:ns='http://xml.apache.org/xml-soap'></SOAP-ENV:Envelope>`);
154
- this._root = this._doc.documentElement;
152
+ this._doc = DomUtil.parse(`<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope xmlns:xsd='${NS_XSD}' xmlns:xsi='${NS_XSI}' xmlns:SOAP-ENV='${NS_ENV}' xmlns:ns='http://xml.apache.org/xml-soap'></SOAP-ENV:Envelope>`);
153
+ this._root = this._doc.documentElement;
155
154
 
156
- this._header = this._doc.createElement(`SOAP-ENV:Header`);
157
- this._root.appendChild(this._header);
155
+ this._header = this._doc.createElement(`SOAP-ENV:Header`);
156
+ this._root.appendChild(this._header);
158
157
 
159
- this._data = this._doc.createElement(`SOAP-ENV:Body`);
160
- this._root.appendChild(this._data);
158
+ this._data = this._doc.createElement(`SOAP-ENV:Body`);
159
+ this._root.appendChild(this._data);
161
160
 
162
- this._method = this._doc.createElement(`m:${method}`);
163
- this._method.setAttribute(`xmlns:m`, urnPath);
164
- this._method.setAttribute(`SOAP-ENV:encodingStyle`, encoding);
165
- this._data.appendChild(this._method);
161
+ this._method = this._doc.createElement(`m:${method}`);
162
+ this._method.setAttribute(`xmlns:m`, urnPath);
163
+ this._method.setAttribute(`SOAP-ENV:encodingStyle`, encoding);
164
+ this._data.appendChild(this._method);
166
165
  }
167
166
 
168
167
  /**
@@ -176,14 +175,14 @@ class SoapMethodCall {
176
175
  * @returns the XML element to be added to the SOAP call
177
176
  */
178
177
  _addNode(tag, type, value, encoding) {
179
- const node = this._doc.createElement(tag);
180
- node.setAttribute("xsi:type", type);
181
- if (encoding != this.encoding)
178
+ const node = this._doc.createElement(tag);
179
+ node.setAttribute("xsi:type", type);
180
+ if (encoding != this.encoding)
182
181
  node.setAttribute("SOAP-ENV:encodingStyle", encoding);
183
- if (value !== null && value !== undefined)
184
- node.textContent = value;
185
- this._method.appendChild(node);
186
- return node;
182
+ if (value !== null && value !== undefined)
183
+ node.textContent = value;
184
+ this._method.appendChild(node);
185
+ return node;
187
186
  }
188
187
 
189
188
  /**
@@ -192,8 +191,8 @@ class SoapMethodCall {
192
191
  * @param {*} value the parameter value, which will be casted to a byte according to xtk rules
193
192
  */
194
193
  writeByte(tag, value) {
195
- value = XtkCaster.asByte(value);
196
- this._addNode(tag, "xsd:byte", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
194
+ value = XtkCaster.asByte(value);
195
+ this._addNode(tag, "xsd:byte", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
197
196
  }
198
197
 
199
198
  /**
@@ -202,8 +201,8 @@ class SoapMethodCall {
202
201
  * @param {*} value the parameter value, which will be casted to a boolean according to xtk rules
203
202
  */
204
203
  writeBoolean(tag, value) {
205
- value = XtkCaster.asBoolean(value);
206
- this._addNode(tag, "xsd:boolean", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
204
+ value = XtkCaster.asBoolean(value);
205
+ this._addNode(tag, "xsd:boolean", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
207
206
  }
208
207
 
209
208
  /**
@@ -212,8 +211,8 @@ class SoapMethodCall {
212
211
  * @param {*} value the parameter value, which will be casted to a short according to xtk rules
213
212
  */
214
213
  writeShort(tag, value) {
215
- value = XtkCaster.asShort(value);
216
- this._addNode(tag, "xsd:short", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
214
+ value = XtkCaster.asShort(value);
215
+ this._addNode(tag, "xsd:short", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
217
216
  }
218
217
 
219
218
  /**
@@ -222,8 +221,8 @@ class SoapMethodCall {
222
221
  * @param {*} value the parameter value, which will be casted to a int32 according to xtk rules
223
222
  */
224
223
  writeLong(tag, value) {
225
- value = XtkCaster.asLong(value);
226
- this._addNode(tag, "xsd:int", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
224
+ value = XtkCaster.asLong(value);
225
+ this._addNode(tag, "xsd:int", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
227
226
  }
228
227
 
229
228
  /**
@@ -232,8 +231,8 @@ class SoapMethodCall {
232
231
  * @param {*} value the parameter value, which will be casted to a int64 according to xtk rules
233
232
  */
234
233
  writeInt64(tag, value) {
235
- value = XtkCaster.asInt64(value);
236
- this._addNode(tag, "xsd:long", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
234
+ value = XtkCaster.asInt64(value);
235
+ this._addNode(tag, "xsd:long", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
237
236
  }
238
237
 
239
238
  /**
@@ -242,8 +241,8 @@ class SoapMethodCall {
242
241
  * @param {*} value the parameter value, which will be casted to a float according to xtk rules
243
242
  */
244
243
  writeFloat(tag, value) {
245
- value = XtkCaster.asNumber(value);
246
- this._addNode(tag, "xsd:float", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
244
+ value = XtkCaster.asNumber(value);
245
+ this._addNode(tag, "xsd:float", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
247
246
  }
248
247
 
249
248
  /**
@@ -252,8 +251,8 @@ class SoapMethodCall {
252
251
  * @param {*} value the parameter value, which will be casted to a double according to xtk rules
253
252
  */
254
253
  writeDouble(tag, value) {
255
- value = XtkCaster.asNumber(value);
256
- this._addNode(tag, "xsd:double", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
254
+ value = XtkCaster.asNumber(value);
255
+ this._addNode(tag, "xsd:double", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
257
256
  }
258
257
 
259
258
  /**
@@ -262,8 +261,8 @@ class SoapMethodCall {
262
261
  * @param {*} value the parameter value, which will be casted to a string according to xtk rules
263
262
  */
264
263
  writeString(tag, value) {
265
- value = XtkCaster.asString(value);
266
- this._addNode(tag, "xsd:string", value, SOAP_ENCODING_NATIVE);
264
+ value = XtkCaster.asString(value);
265
+ this._addNode(tag, "xsd:string", value, SOAP_ENCODING_NATIVE);
267
266
  }
268
267
 
269
268
  /**
@@ -272,8 +271,8 @@ class SoapMethodCall {
272
271
  * @param {*} value the parameter value, which will be casted to a timestamp according to xtk rules
273
272
  */
274
273
  writeTimestamp(tag, value) {
275
- value = XtkCaster.asTimestamp(value);
276
- this._addNode(tag, "xsd:datetime", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
274
+ value = XtkCaster.asTimestamp(value);
275
+ this._addNode(tag, "xsd:datetime", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
277
276
  }
278
277
 
279
278
  /**
@@ -282,8 +281,8 @@ class SoapMethodCall {
282
281
  * @param {*} value the parameter value, which will be casted to a date according to xtk rules
283
282
  */
284
283
  writeDate(tag, value) {
285
- value = XtkCaster.asDate(value);
286
- this._addNode(tag, "xsd:date", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
284
+ value = XtkCaster.asDate(value);
285
+ this._addNode(tag, "xsd:date", XtkCaster.asString(value), SOAP_ENCODING_NATIVE);
287
286
  }
288
287
 
289
288
  /**
@@ -292,12 +291,12 @@ class SoapMethodCall {
292
291
  * @param {Element} value the parameter value (XML element)
293
292
  */
294
293
  writeElement(tag, element) {
295
- const node = this._addNode(tag, "ns:Element", null, SOAP_ENCODING_XML);
296
- if (element !== null && element !== undefined) {
297
- if (element.nodeType === 9) element = element.documentElement;
298
- const child = this._doc.importNode(element, true);
299
- node.appendChild(child);
300
- }
294
+ const node = this._addNode(tag, "ns:Element", null, SOAP_ENCODING_XML);
295
+ if (element !== null && element !== undefined) {
296
+ if (element.nodeType === 9) element = element.documentElement;
297
+ const child = this._doc.importNode(element, true);
298
+ node.appendChild(child);
299
+ }
301
300
  }
302
301
 
303
302
  /**
@@ -306,12 +305,12 @@ class SoapMethodCall {
306
305
  * @param {Document} value the parameter value (XML document)
307
306
  */
308
307
  writeDocument(tag, document) {
309
- const node = this._addNode(tag, "", null, SOAP_ENCODING_XML);
310
- if (document !== null && document !== undefined) {
311
- const element = document.nodeType === 1 ? document : document.documentElement;
312
- const child = this._doc.importNode(element, true);
313
- node.appendChild(child);
314
- }
308
+ const node = this._addNode(tag, "", null, SOAP_ENCODING_XML);
309
+ if (document !== null && document !== undefined) {
310
+ const element = document.nodeType === 1 ? document : document.documentElement;
311
+ const child = this._doc.importNode(element, true);
312
+ node.appendChild(child);
313
+ }
315
314
  }
316
315
 
317
316
  /**
@@ -323,14 +322,14 @@ class SoapMethodCall {
323
322
  * @throws {CampaignException} if the current return value type does not match the expected type
324
323
  */
325
324
  _checkTypeMatch(type) {
326
- if (this.elemCurrent === null || this.elemCurrent === undefined) {
327
- throw new CampaignException(this, 400, `Missing parameter for method '${this.methodName}' of urn '${this.urn}'`);
328
- } else if ( type != "ns:Document") {
329
- var xsiType = this.elemCurrent.getAttribute("xsi:type");
330
- if (xsiType === null || xsiType === undefined || xsiType !== type) {
331
- throw new CampaignException(this, 400, `Parameter type mismatch for method '${this.methodName}' of urn '${this.urn}'. Expected '${type}', got '${xsiType}'`);
332
- }
325
+ if (this.elemCurrent === null || this.elemCurrent === undefined) {
326
+ throw new CampaignException(this, 400, `Missing parameter for method '${this.methodName}' of urn '${this.urn}'`);
327
+ } else if ( type != "ns:Document") {
328
+ var xsiType = this.elemCurrent.getAttribute("xsi:type");
329
+ if (xsiType === null || xsiType === undefined || xsiType !== type) {
330
+ throw new CampaignException(this, 400, `Parameter type mismatch for method '${this.methodName}' of urn '${this.urn}'. Expected '${type}', got '${xsiType}'`);
333
331
  }
332
+ }
334
333
  }
335
334
 
336
335
  /**
@@ -343,16 +342,16 @@ class SoapMethodCall {
343
342
  * @returns the Entity DOM Element if there's one, or null if there isn't. The currentElement pointer will be updated accordingly
344
343
  */
345
344
  getEntity() {
346
- if (!this.elemCurrent)
347
- return null;
348
- if (this.elemCurrent.getAttribute("xsi:type") != "ns:Element")
349
- return null;
350
- if (this.elemCurrent.tagName != "entity" && this.elemCurrent.tagName != "this")
351
- return null;
352
- var entity = this.elemCurrent;
353
- entity = DomUtil.getFirstChildElement(entity);
354
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
355
- return entity;
345
+ if (!this.elemCurrent)
346
+ return null;
347
+ if (this.elemCurrent.getAttribute("xsi:type") != "ns:Element")
348
+ return null;
349
+ if (this.elemCurrent.tagName != "entity" && this.elemCurrent.tagName != "this")
350
+ return null;
351
+ var entity = this.elemCurrent;
352
+ entity = DomUtil.getFirstChildElement(entity);
353
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
354
+ return entity;
356
355
  }
357
356
 
358
357
  /**
@@ -361,10 +360,10 @@ class SoapMethodCall {
361
360
  * @returns {string} the string result value
362
361
  */
363
362
  getNextString() {
364
- this._checkTypeMatch("xsd:string");
365
- var value = DomUtil.elementValue(this.elemCurrent);
366
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
367
- return value;
363
+ this._checkTypeMatch("xsd:string");
364
+ var value = DomUtil.elementValue(this.elemCurrent);
365
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
366
+ return value;
368
367
  }
369
368
 
370
369
  /**
@@ -373,10 +372,10 @@ class SoapMethodCall {
373
372
  * @returns {string} the primary key string result value
374
373
  */
375
374
  getNextPrimaryKey() {
376
- this._checkTypeMatch("xsd:primarykey");
377
- var value = DomUtil.elementValue(this.elemCurrent);
378
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
379
- return value;
375
+ this._checkTypeMatch("xsd:primarykey");
376
+ var value = DomUtil.elementValue(this.elemCurrent);
377
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
378
+ return value;
380
379
  }
381
380
 
382
381
  /**
@@ -385,10 +384,10 @@ class SoapMethodCall {
385
384
  * @returns {number} the boolean result value
386
385
  */
387
386
  getNextBoolean() {
388
- this._checkTypeMatch("xsd:boolean");
389
- var value = DomUtil.elementValue(this.elemCurrent);
390
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
391
- return XtkCaster.asBoolean(value);
387
+ this._checkTypeMatch("xsd:boolean");
388
+ var value = DomUtil.elementValue(this.elemCurrent);
389
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
390
+ return XtkCaster.asBoolean(value);
392
391
  }
393
392
 
394
393
  /**
@@ -397,10 +396,10 @@ class SoapMethodCall {
397
396
  * @returns {number} the byte result value
398
397
  */
399
398
  getNextByte() {
400
- this._checkTypeMatch("xsd:byte");
401
- var value = DomUtil.elementValue(this.elemCurrent);
402
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
403
- return XtkCaster.asByte(value);
399
+ this._checkTypeMatch("xsd:byte");
400
+ var value = DomUtil.elementValue(this.elemCurrent);
401
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
402
+ return XtkCaster.asByte(value);
404
403
  }
405
404
 
406
405
  /**
@@ -409,10 +408,10 @@ class SoapMethodCall {
409
408
  * @returns {number} the short result value
410
409
  */
411
410
  getNextShort() {
412
- this._checkTypeMatch("xsd:short");
413
- var value = DomUtil.elementValue(this.elemCurrent);
414
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
415
- return XtkCaster.asShort(value);
411
+ this._checkTypeMatch("xsd:short");
412
+ var value = DomUtil.elementValue(this.elemCurrent);
413
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
414
+ return XtkCaster.asShort(value);
416
415
  }
417
416
 
418
417
  /**
@@ -421,10 +420,10 @@ class SoapMethodCall {
421
420
  * @returns {number} the int32 result value
422
421
  */
423
422
  getNextLong() {
424
- this._checkTypeMatch("xsd:int");
425
- var value = DomUtil.elementValue(this.elemCurrent);
426
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
427
- return XtkCaster.asLong(value);
423
+ this._checkTypeMatch("xsd:int");
424
+ var value = DomUtil.elementValue(this.elemCurrent);
425
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
426
+ return XtkCaster.asLong(value);
428
427
  }
429
428
 
430
429
  /**
@@ -434,10 +433,10 @@ class SoapMethodCall {
434
433
  * @returns {string} the int64 result value as a string
435
434
  */
436
435
  getNextInt64() {
437
- this._checkTypeMatch("xsd:long");
438
- var value = DomUtil.elementValue(this.elemCurrent);
439
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
440
- return value;
436
+ this._checkTypeMatch("xsd:long");
437
+ var value = DomUtil.elementValue(this.elemCurrent);
438
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
439
+ return value;
441
440
  }
442
441
 
443
442
  /**
@@ -446,10 +445,10 @@ class SoapMethodCall {
446
445
  * @returns {number} the float result value
447
446
  */
448
447
  getNextFloat() {
449
- this._checkTypeMatch("xsd:float");
450
- var value = DomUtil.elementValue(this.elemCurrent);
451
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
452
- return XtkCaster.asFloat(value);
448
+ this._checkTypeMatch("xsd:float");
449
+ var value = DomUtil.elementValue(this.elemCurrent);
450
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
451
+ return XtkCaster.asFloat(value);
453
452
  }
454
453
 
455
454
  /**
@@ -458,10 +457,10 @@ class SoapMethodCall {
458
457
  * @returns {number} the double result value
459
458
  */
460
459
  getNextDouble() {
461
- this._checkTypeMatch("xsd:double");
462
- var value = DomUtil.elementValue(this.elemCurrent);
463
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
464
- return XtkCaster.asDouble(value);
460
+ this._checkTypeMatch("xsd:double");
461
+ var value = DomUtil.elementValue(this.elemCurrent);
462
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
463
+ return XtkCaster.asDouble(value);
465
464
  }
466
465
 
467
466
  /**
@@ -470,10 +469,10 @@ class SoapMethodCall {
470
469
  * @returns {Date} the timestamp result value
471
470
  */
472
471
  getNextDateTime() {
473
- this._checkTypeMatch("xsd:dateTime");
474
- var value = DomUtil.elementValue(this.elemCurrent);
475
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
476
- return XtkCaster.asTimestamp(value);
472
+ this._checkTypeMatch("xsd:dateTime");
473
+ var value = DomUtil.elementValue(this.elemCurrent);
474
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
475
+ return XtkCaster.asTimestamp(value);
477
476
  }
478
477
 
479
478
  /**
@@ -482,10 +481,10 @@ class SoapMethodCall {
482
481
  * @returns {Date} the date result value
483
482
  */
484
483
  getNextDate() {
485
- this._checkTypeMatch("xsd:date");
486
- var value = DomUtil.elementValue(this.elemCurrent);
487
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
488
- return XtkCaster.asDate(value);
484
+ this._checkTypeMatch("xsd:date");
485
+ var value = DomUtil.elementValue(this.elemCurrent);
486
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
487
+ return XtkCaster.asDate(value);
489
488
  }
490
489
 
491
490
  /**
@@ -494,15 +493,15 @@ class SoapMethodCall {
494
493
  * @returns {Document} the XML document result value
495
494
  */
496
495
  getNextDocument() {
497
- this._checkTypeMatch("ns:Document");
498
- var elemValue = DomUtil.getFirstChildElement(this.elemCurrent);
499
- if (elemValue === null || elemValue === undefined) {
500
- this.elemValue = null;
501
- return null;
502
- }
503
- var docValue = elemValue;
504
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
505
- return docValue;
496
+ this._checkTypeMatch("ns:Document");
497
+ var elemValue = DomUtil.getFirstChildElement(this.elemCurrent);
498
+ if (elemValue === null || elemValue === undefined) {
499
+ this.elemValue = null;
500
+ return null;
501
+ }
502
+ var docValue = elemValue;
503
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
504
+ return docValue;
506
505
  }
507
506
 
508
507
  /**
@@ -511,14 +510,14 @@ class SoapMethodCall {
511
510
  * @returns {Element} the XML element result value
512
511
  */
513
512
  getNextElement() {
514
- this._checkTypeMatch("ns:Element");
515
- var elemValue = DomUtil.getFirstChildElement(this.elemCurrent);
516
- if (elemValue === null || elemValue === undefined) {
517
- this.elemValue = null;
518
- return null;
519
- }
520
- this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
521
- return elemValue;
513
+ this._checkTypeMatch("ns:Element");
514
+ var elemValue = DomUtil.getFirstChildElement(this.elemCurrent);
515
+ if (elemValue === null || elemValue === undefined) {
516
+ this.elemValue = null;
517
+ return null;
518
+ }
519
+ this.elemCurrent = DomUtil.getNextSiblingElement(this.elemCurrent);
520
+ return elemValue;
522
521
  }
523
522
 
524
523
  /**
@@ -527,7 +526,7 @@ class SoapMethodCall {
527
526
  * @returns a boolean set to true if ther are no more response args to read
528
527
  */
529
528
  checkNoMoreArgs() {
530
- return !this.elemCurrent;
529
+ return !this.elemCurrent;
531
530
  }
532
531
 
533
532
  /**
@@ -538,44 +537,44 @@ class SoapMethodCall {
538
537
  */
539
538
  _createHTTPRequest(url, requestOptions) {
540
539
 
541
- const headers = {
542
- 'Content-type': `application/soap+xml${this._charset ? ";charset=" + this._charset : ""}`,
543
- 'SoapAction': `${this.urn}#${this.methodName}`,
544
- };
545
- if (this._bearerToken) {
546
- headers['Authorization'] = `Bearer ${this._bearerToken}`;
547
- }
548
- else {
549
- headers['X-Security-Token'] = this._securityToken;
550
- headers['X-Session-Token'] = this._sessionToken;
551
- }
552
-
553
- // Add HTTP headers specific to the SOAP call for better tracing/troubleshooting
554
- if (this._extraHttpHeaders && this._extraHttpHeaders['ACC-SDK-Version']) {
555
- // "this.retry" means that the call can be retried, not that it is being retried. The HTTP header howerver, indicates that this
556
- // is actually a retry of a previously failed call (expired token)
557
- if (this._retryCount > 0) headers["ACC-SDK-Call-RetryCount"] = `${this._retryCount}`;
558
- if (this.internal) headers["ACC-SDK-Call-Internal"] = "1";
559
- }
560
-
561
- const request = {
562
- url: url,
563
- method: 'POST',
564
- headers: headers,
565
- data: DomUtil.toXMLString(this._doc)
566
- };
567
- if (this._sessionToken)
568
- request.headers.Cookie = '__sessiontoken=' + this._sessionToken;
569
- if (this._userAgentString)
570
- request.headers['User-Agent'] = this._userAgentString;
571
-
572
- // Override http headers with custom headers
573
- for (let h in this._extraHttpHeaders) {
574
- request.headers[h] = this._extraHttpHeaders[h];
575
- }
576
-
577
- const extraOptions = Object.assign({}, this._pushDownOptions, requestOptions);
578
- return [ request, extraOptions ];
540
+ const headers = {
541
+ 'Content-type': `application/soap+xml${this._charset ? ";charset=" + this._charset : ""}`,
542
+ 'SoapAction': `${this.urn}#${this.methodName}`,
543
+ };
544
+ if (this._bearerToken) {
545
+ headers['Authorization'] = `Bearer ${this._bearerToken}`;
546
+ }
547
+ else {
548
+ headers['X-Security-Token'] = this._securityToken;
549
+ headers['X-Session-Token'] = this._sessionToken;
550
+ }
551
+
552
+ // Add HTTP headers specific to the SOAP call for better tracing/troubleshooting
553
+ if (this._extraHttpHeaders && this._extraHttpHeaders['ACC-SDK-Version']) {
554
+ // "this.retry" means that the call can be retried, not that it is being retried. The HTTP header howerver, indicates that this
555
+ // is actually a retry of a previously failed call (expired token)
556
+ if (this._retryCount > 0) headers["ACC-SDK-Call-RetryCount"] = `${this._retryCount}`;
557
+ if (this.internal) headers["ACC-SDK-Call-Internal"] = "1";
558
+ }
559
+
560
+ const request = {
561
+ url: url,
562
+ method: 'POST',
563
+ headers: headers,
564
+ data: DomUtil.toXMLString(this._doc)
565
+ };
566
+ if (this._sessionToken)
567
+ request.headers.Cookie = '__sessiontoken=' + this._sessionToken;
568
+ if (this._userAgentString)
569
+ request.headers['User-Agent'] = this._userAgentString;
570
+
571
+ // Override http headers with custom headers
572
+ for (let h in this._extraHttpHeaders) {
573
+ request.headers[h] = this._extraHttpHeaders[h];
574
+ }
575
+
576
+ const extraOptions = Object.assign({}, this._pushDownOptions, requestOptions);
577
+ return [ request, extraOptions ];
579
578
  }
580
579
 
581
580
  /**
@@ -584,50 +583,50 @@ class SoapMethodCall {
584
583
  * @param {client.Client} sdk client (optional)
585
584
  */
586
585
  finalize(url, client) {
587
- if (client) {
588
- this._sessionToken = client._sessionToken;
589
- this._securityToken = client._securityToken;
590
- this._bearerToken = client._bearerToken;
586
+ if (client) {
587
+ this._sessionToken = client._sessionToken;
588
+ this._securityToken = client._securityToken;
589
+ this._bearerToken = client._bearerToken;
590
+ }
591
+
592
+ var cookieHeader = DomUtil.findElement(this._header, "Cookie");
593
+ if (this._sessionToken) {
594
+ if (!cookieHeader) {
595
+ cookieHeader = this._doc.createElement("Cookie");
596
+ this._header.appendChild(cookieHeader);
591
597
  }
592
-
593
- var cookieHeader = DomUtil.findElement(this._header, "Cookie");
594
- if (this._sessionToken) {
595
- if (!cookieHeader) {
596
- cookieHeader = this._doc.createElement("Cookie");
597
- this._header.appendChild(cookieHeader);
598
- }
599
- cookieHeader.textContent = `__sessiontoken=${this._sessionToken}`;
600
- } else if (cookieHeader) {
601
- cookieHeader.remove();
602
- }
603
-
604
- var securityTokenHeader = DomUtil.findElement(this._header, "X-Security-Token");
605
- if (!securityTokenHeader) {
606
- securityTokenHeader = this._doc.createElement("X-Security-Token");
607
- this._header.appendChild(securityTokenHeader);
608
- }
609
- securityTokenHeader.textContent = this._securityToken;
610
-
611
- // Always write a sessiontoken element as the first parameter. Even when using SecurityToken authentication
612
- // and when the session token is actually passed implicitely as a cookie, one must write a sessiontoken
613
- // element. If not, authentication will fail because the first parameter is interpreted as the "authentication mode"
614
- // and eventually passed as the first parameter of CXtkLocalSessionPart::GetXtkSecurity
615
- var sessionTokenElem = DomUtil.findElement(this._method, "sessiontoken");
616
- if (sessionTokenElem) {
617
- sessionTokenElem.textContent = this._sessionToken;
618
- } else {
619
- sessionTokenElem = this._doc.createElement("sessiontoken");
620
- sessionTokenElem.setAttribute("xsi:type", "xsd:string");
621
- // sessionTokenElem.setAttribute("SOAP-ENV:encodingStyle", SOAP_ENCODING_NATIVE);
622
- sessionTokenElem.textContent = this._sessionToken;
623
- this._method.prepend(sessionTokenElem);
624
- }
625
- const noMethodInURL = !!this._pushDownOptions.noMethodInURL;
626
- const actualUrl = noMethodInURL ? url : `${url}?soapAction=${encodeURIComponent(this.urn + "#" + this.methodName)}`;
627
-
628
- // Prepare request and empty response objects
629
- [this.request, this.requestOptions] = this._createHTTPRequest(actualUrl);
630
- this.response = undefined;
598
+ cookieHeader.textContent = `__sessiontoken=${this._sessionToken}`;
599
+ } else if (cookieHeader) {
600
+ cookieHeader.remove();
601
+ }
602
+
603
+ var securityTokenHeader = DomUtil.findElement(this._header, "X-Security-Token");
604
+ if (!securityTokenHeader) {
605
+ securityTokenHeader = this._doc.createElement("X-Security-Token");
606
+ this._header.appendChild(securityTokenHeader);
607
+ }
608
+ securityTokenHeader.textContent = this._securityToken;
609
+
610
+ // Always write a sessiontoken element as the first parameter. Even when using SecurityToken authentication
611
+ // and when the session token is actually passed implicitely as a cookie, one must write a sessiontoken
612
+ // element. If not, authentication will fail because the first parameter is interpreted as the "authentication mode"
613
+ // and eventually passed as the first parameter of CXtkLocalSessionPart::GetXtkSecurity
614
+ var sessionTokenElem = DomUtil.findElement(this._method, "sessiontoken");
615
+ if (sessionTokenElem) {
616
+ sessionTokenElem.textContent = this._sessionToken;
617
+ } else {
618
+ sessionTokenElem = this._doc.createElement("sessiontoken");
619
+ sessionTokenElem.setAttribute("xsi:type", "xsd:string");
620
+ // sessionTokenElem.setAttribute("SOAP-ENV:encodingStyle", SOAP_ENCODING_NATIVE);
621
+ sessionTokenElem.textContent = this._sessionToken;
622
+ this._method.prepend(sessionTokenElem);
623
+ }
624
+ const noMethodInURL = !!this._pushDownOptions.noMethodInURL;
625
+ const actualUrl = noMethodInURL ? url : `${url}?soapAction=${encodeURIComponent(this.urn + "#" + this.methodName)}`;
626
+
627
+ // Prepare request and empty response objects
628
+ [this.request, this.requestOptions] = this._createHTTPRequest(actualUrl);
629
+ this.response = undefined;
631
630
  }
632
631
 
633
632
  /**
@@ -638,65 +637,65 @@ class SoapMethodCall {
638
637
  * @param {string} url the Campaign endpoint, such as "http://ffdamkt:8080/nl/jsp/soaprouter.jsp"
639
638
  */
640
639
  async execute() {
641
- const that = this;
642
- const promise = this._transport(this.request, this.requestOptions);
643
- return promise.then(function(body) {
644
- that.response = body;
645
- // Response is a serialized XML document with the following structure
646
- //
647
- // Success:
648
- // <SOAP-ENV:Envelope>
649
- // <SOAP-ENV:Body>
650
- // <{{method}}Response>
651
- // {{ return values (one element per return value) }}
652
- // </{{method}}Response>
653
- // </SOAP-ENV:Body>
654
- // </SOAP-ENV:Envelope>
655
- //
656
- // Failure:
657
- // <SOAP-ENV:Envelope>
658
- // <SOAP-ENV:Body>
659
- // <SOAP-ENV:Fault>
660
- // <faultcode/>
661
- // <faultstring/>
662
- // <detail/>
663
- // </SOAP-ENV:Fault>
664
- // </SOAP-ENV:Body>
665
- // </SOAP-ENV:Envelope>
666
- const dom = DomUtil.parse(body);
667
- that.elemCurrent = dom.documentElement;
668
- that.elemCurrent = DomUtil.findElement(that.elemCurrent, "SOAP-ENV:Body");
669
- if (!that.elemCurrent)
670
- throw new DomException("Malformed SOAP response: missing body element");
671
- that.elemCurrent = DomUtil.getFirstChildElement(that.elemCurrent);
672
- if (!that.elemCurrent)
673
- throw new DomException("Malformed SOAP response: body element is empty");
640
+ const that = this;
641
+ const promise = this._transport(this.request, this.requestOptions);
642
+ return promise.then(function(body) {
643
+ that.response = body;
644
+ // Response is a serialized XML document with the following structure
645
+ //
646
+ // Success:
647
+ // <SOAP-ENV:Envelope>
648
+ // <SOAP-ENV:Body>
649
+ // <{{method}}Response>
650
+ // {{ return values (one element per return value) }}
651
+ // </{{method}}Response>
652
+ // </SOAP-ENV:Body>
653
+ // </SOAP-ENV:Envelope>
654
+ //
655
+ // Failure:
656
+ // <SOAP-ENV:Envelope>
657
+ // <SOAP-ENV:Body>
658
+ // <SOAP-ENV:Fault>
659
+ // <faultcode/>
660
+ // <faultstring/>
661
+ // <detail/>
662
+ // </SOAP-ENV:Fault>
663
+ // </SOAP-ENV:Body>
664
+ // </SOAP-ENV:Envelope>
665
+ const dom = DomUtil.parse(body);
666
+ that.elemCurrent = dom.documentElement;
667
+ that.elemCurrent = DomUtil.findElement(that.elemCurrent, "SOAP-ENV:Body");
668
+ if (!that.elemCurrent)
669
+ throw new DomException("Malformed SOAP response: missing body element");
670
+ that.elemCurrent = DomUtil.getFirstChildElement(that.elemCurrent);
671
+ if (!that.elemCurrent)
672
+ throw new DomException("Malformed SOAP response: body element is empty");
674
673
 
675
- // Error management
676
- if (that.elemCurrent.nodeName == "SOAP-ENV:Fault") {
677
- const faultCode = DomUtil.findElement(that.elemCurrent, "faultcode").textContent;
678
- const faultString = DomUtil.findElement(that.elemCurrent, "faultstring").textContent;
679
- const detailNode = DomUtil.findElement(that.elemCurrent, "detail");
680
- const detail = detailNode ? detailNode.textContent : undefined;
681
- throw new CampaignException(that, 500, faultCode, faultString, detail);
682
- }
683
- // Set current element for subsequent calls to getNext*
684
- while (that.elemCurrent) {
685
- var responseMethodTag = `${that.methodName}Response`;
686
- var nodeName = that.elemCurrent.nodeName;
687
- //if (nodeName === responseMethodTag || nodeName.endsWith(`:${responseMethodTag}`)) {
688
- if (nodeName === responseMethodTag) {
689
- that.elemCurrent = DomUtil.getFirstChildElement(that.elemCurrent);
690
- break;
691
- }
692
- else
693
- that.elemCurrent = DomUtil.getNextSiblingElement(that.elemCurrent);
694
- }
695
- })
674
+ // Error management
675
+ if (that.elemCurrent.nodeName == "SOAP-ENV:Fault") {
676
+ const faultCode = DomUtil.findElement(that.elemCurrent, "faultcode").textContent;
677
+ const faultString = DomUtil.findElement(that.elemCurrent, "faultstring").textContent;
678
+ const detailNode = DomUtil.findElement(that.elemCurrent, "detail");
679
+ const detail = detailNode ? detailNode.textContent : undefined;
680
+ throw new CampaignException(that, 500, faultCode, faultString, detail);
681
+ }
682
+ // Set current element for subsequent calls to getNext*
683
+ while (that.elemCurrent) {
684
+ var responseMethodTag = `${that.methodName}Response`;
685
+ var nodeName = that.elemCurrent.nodeName;
686
+ //if (nodeName === responseMethodTag || nodeName.endsWith(`:${responseMethodTag}`)) {
687
+ if (nodeName === responseMethodTag) {
688
+ that.elemCurrent = DomUtil.getFirstChildElement(that.elemCurrent);
689
+ break;
690
+ }
691
+ else
692
+ that.elemCurrent = DomUtil.getNextSiblingElement(that.elemCurrent);
693
+ }
694
+ })
696
695
  .catch(function(err) {
697
- if (that.response && that.response.indexOf(`XSV-350008`) != -1)
698
- throw CampaignException.SESSION_EXPIRED();
699
- else throw makeCampaignException(that, err);
696
+ if (that.response && that.response.indexOf(`XSV-350008`) != -1)
697
+ throw CampaignException.SESSION_EXPIRED();
698
+ else throw makeCampaignException(that, err);
700
699
  });
701
700
  }
702
701
 
@@ -709,12 +708,12 @@ class SoapMethodCall {
709
708
  * @returns {Element} the XML element (empty)
710
709
  */
711
710
  createElement(tagName) {
712
- return this._doc.createElement(tagName);
711
+ return this._doc.createElement(tagName);
713
712
  }
714
713
 
715
- }
714
+ }
716
715
 
717
- // Public exports
718
- exports.SoapMethodCall = SoapMethodCall;
716
+ // Public exports
717
+ exports.SoapMethodCall = SoapMethodCall;
719
718
 
720
719
  })();