@adobe/acc-js-sdk 1.1.61 → 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.
- package/.cursor/commands/opsx-apply.md +152 -0
- package/.cursor/commands/opsx-archive.md +157 -0
- package/.cursor/commands/opsx-explore.md +173 -0
- package/.cursor/commands/opsx-propose.md +106 -0
- package/.cursor/skills/openspec-apply-change/SKILL.md +156 -0
- package/.cursor/skills/openspec-archive-change/SKILL.md +114 -0
- package/.cursor/skills/openspec-explore/SKILL.md +288 -0
- package/.cursor/skills/openspec-propose/SKILL.md +110 -0
- package/.eslintrc.js +2 -2
- package/.github/prompts/opsx-apply.prompt.md +149 -0
- package/.github/prompts/opsx-archive.prompt.md +154 -0
- package/.github/prompts/opsx-explore.prompt.md +170 -0
- package/.github/prompts/opsx-propose.prompt.md +103 -0
- package/.github/skills/openspec-apply-change/SKILL.md +156 -0
- package/.github/skills/openspec-archive-change/SKILL.md +114 -0
- package/.github/skills/openspec-explore/SKILL.md +288 -0
- package/.github/skills/openspec-propose/SKILL.md +110 -0
- package/.github/workflows/codeql-analysis.yml +5 -4
- package/.github/workflows/npm-publish.yml +3 -3
- package/AGENTS.md +117 -0
- package/CLAUDE.md +2 -0
- package/MIGRATION.md +10 -0
- package/README.md +6 -2
- package/ai-docs/coding-rules.md +95 -0
- package/ai-docs/tech-stack.md +43 -0
- package/babel.config.js +5 -0
- package/docs/changeLog.html +34 -0
- package/docs/checkList.html +2 -2
- package/docs/connectionParameters.html +5 -0
- package/docs/quickstart.html +2 -1
- package/docs/release.html +1 -1
- package/openspec/config.yaml +20 -0
- package/package-lock.json +7437 -3924
- package/package.json +9 -7
- package/src/AGENTS.md +98 -0
- package/src/CLAUDE.md +2 -0
- package/src/application.js +637 -637
- package/src/cache.js +133 -133
- package/src/cacheRefresher.js +190 -190
- package/src/campaign.js +532 -532
- package/src/client.js +1539 -1532
- package/src/crypto.js +52 -52
- package/src/domUtil.js +346 -346
- package/src/entityAccessor.js +61 -61
- package/src/index.js +83 -83
- package/src/methodCache.js +69 -69
- package/src/optionCache.js +26 -26
- package/src/soap.js +321 -322
- package/src/testUtil.js +13 -13
- package/src/transport.js +70 -70
- package/src/util.js +147 -147
- package/src/web/bundler.js +5 -5
- package/src/xtkCaster.js +258 -258
- package/src/xtkEntityCache.js +34 -34
- package/src/xtkJob.js +185 -185
- package/test/AGENTS.md +37 -0
- package/test/CLAUDE.md +2 -0
- package/test/cacheRefresher.test.js +7 -0
- package/test/client.test.js +123 -81
- package/test/jest.config.js +6 -0
- package/test/observability.test.js +6 -1
- package/test/xtkJob.test.js +2 -2
package/src/util.js
CHANGED
|
@@ -10,185 +10,185 @@ 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";
|
|
13
|
+
"use strict";
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
/**********************************************************************************
|
|
16
|
+
/**********************************************************************************
|
|
17
17
|
*
|
|
18
18
|
* Generic utilities
|
|
19
19
|
*
|
|
20
20
|
*********************************************************************************/
|
|
21
21
|
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
23
|
* @namespace Utils
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
27
|
* @memberof Utils
|
|
28
28
|
* @class
|
|
29
29
|
* @constructor
|
|
30
30
|
*/
|
|
31
|
-
class Util {
|
|
31
|
+
class Util {
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
/**
|
|
34
34
|
* Generic helper functions available everywhere in the SDK. Al functions are static, it is not necessary to create new instances of this object
|
|
35
35
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
constructor() {
|
|
37
|
+
}
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
/**
|
|
40
40
|
* Indicates whether the SDK is running in a browser or not
|
|
41
41
|
* @returns {boolean} a boolean indicating if the SDK is running in a browser or not
|
|
42
42
|
*/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
static isBrowser() {
|
|
44
|
+
const browser = typeof window !== 'undefined';
|
|
45
|
+
return browser;
|
|
46
|
+
}
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
/**
|
|
49
49
|
* Tests if an object is a JavaScript array
|
|
50
50
|
* @param {*} obj the object to test, may be undefined
|
|
51
51
|
* @returns {boolean} true if the object is an array
|
|
52
52
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
static isArray(obj) {
|
|
54
|
+
return Array.isArray(obj);
|
|
55
|
+
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
// Helper function for trim() to replace text between 2 indices
|
|
58
|
+
static _removeBetween(text, from, to) {
|
|
59
|
+
var index = 0;
|
|
60
|
+
while (index < text.length) {
|
|
61
|
+
index = text.indexOf(from, index);
|
|
62
|
+
if (index == -1) break;
|
|
63
|
+
const index2 = text.indexOf(to, index);
|
|
64
|
+
if (index2 == -1) {
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
text = text.substring(0, index + from.length) + '***' + text.substring(index2);
|
|
68
|
+
index = index2;
|
|
66
69
|
}
|
|
67
|
-
|
|
68
|
-
index = index2;
|
|
70
|
+
return text;
|
|
69
71
|
}
|
|
70
|
-
return text;
|
|
71
|
-
}
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
/**
|
|
74
74
|
* Trims a text, an object or an array and remove sensitive information, such as session tokens, passwords, etc.
|
|
75
75
|
*
|
|
76
76
|
* @param {string|Object|Array} obj is the object to trim
|
|
77
77
|
* @returns {string|Object|Array} the trimmed object
|
|
78
78
|
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
static trim(obj) {
|
|
80
|
+
if (obj == null || obj == undefined) return undefined;
|
|
81
|
+
if (Util.isArray(obj)) {
|
|
82
|
+
const a = [];
|
|
83
|
+
for (const p of obj) {
|
|
84
|
+
a.push(Util.trim(p));
|
|
85
|
+
}
|
|
86
|
+
return a;
|
|
85
87
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
else if (p === "Cookie") {
|
|
94
|
-
var index = obj[p].toLowerCase().indexOf("__sessiontoken");
|
|
95
|
-
if (index !== -1) {
|
|
96
|
-
index = obj[p].indexOf("=", index);
|
|
88
|
+
if (typeof obj == "object") {
|
|
89
|
+
for (const p in obj) {
|
|
90
|
+
const lowerP = p.toLowerCase();
|
|
91
|
+
if (lowerP === "x-security-token" || lowerP === "x-session-token")
|
|
92
|
+
obj[p] = "***";
|
|
93
|
+
else if (p === "Cookie") {
|
|
94
|
+
var index = obj[p].toLowerCase().indexOf("__sessiontoken");
|
|
97
95
|
if (index !== -1) {
|
|
98
|
-
index = index
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
96
|
+
index = obj[p].indexOf("=", index);
|
|
97
|
+
if (index !== -1) {
|
|
98
|
+
index = index + 1;
|
|
99
|
+
const endIndex = obj[p].indexOf(";", index);
|
|
100
|
+
if (endIndex == -1)
|
|
101
|
+
obj[p] = obj[p].substring(0, index) + "***";
|
|
102
|
+
else
|
|
103
|
+
obj[p] = obj[p].substring(0, index) + "***" + obj[p].substring(endIndex);
|
|
104
|
+
}
|
|
104
105
|
}
|
|
105
106
|
}
|
|
107
|
+
else
|
|
108
|
+
obj[p] = Util.trim(obj[p]);
|
|
106
109
|
}
|
|
107
|
-
else
|
|
108
|
-
obj[p] = Util.trim(obj[p]);
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
-
if (typeof obj == "string") {
|
|
111
|
+
if (typeof obj == "string") {
|
|
112
112
|
// Remove trailing blanks
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
113
|
+
while (obj && (obj.endsWith(' ') || obj.endsWith('\n') || obj.endsWith('\r') || obj.endsWith('\t')))
|
|
114
|
+
obj = obj.substring(0, obj.length - 1);
|
|
115
|
+
|
|
116
|
+
// Hide session tokens
|
|
117
|
+
obj = this._removeBetween(obj, "<Cookie>__sessiontoken=", "</Cookie>");
|
|
118
|
+
obj = this._removeBetween(obj, "<X-Security-Token>", "</X-Security-Token>");
|
|
119
|
+
obj = this._removeBetween(obj, "<X-Session-Token>", "</X-Session-Token>");
|
|
120
|
+
obj = this._removeBetween(obj, '<sessiontoken xsi:type="xsd:string">', '</sessiontoken>');
|
|
121
|
+
obj = this._removeBetween(obj, "<pstrSessionToken xsi:type='xsd:string'>", "</pstrSessionToken>");
|
|
122
|
+
obj = this._removeBetween(obj, "<pstrSecurityToken xsi:type='xsd:string'>", "</pstrSecurityToken>");
|
|
123
|
+
obj = this._removeBetween(obj, '<password xsi:type="xsd:string">', '</password>');
|
|
124
|
+
}
|
|
125
|
+
return obj;
|
|
124
126
|
}
|
|
125
|
-
return obj;
|
|
126
|
-
}
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
/**
|
|
129
129
|
* Get Schema id from namespace (find first upper case letter)
|
|
130
130
|
* @param {string} namespace a SDK namespace, i.e. xtkWorkflow, nmsDelivery, etc.
|
|
131
131
|
* @return {string} the corresponding schema id, i.e. xtk:workflow, nms:delivery, etc.
|
|
132
132
|
*/
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
static schemaIdFromNamespace(namespace) {
|
|
134
|
+
var schemaId = "";
|
|
135
|
+
for (var i=0; i<namespace.length; i++) {
|
|
136
136
|
const c = namespace[i];
|
|
137
137
|
if (c >='A' && c<='Z') {
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
schemaId = schemaId + ":" + c.toLowerCase() + namespace.substr(i+1);
|
|
139
|
+
break;
|
|
140
140
|
}
|
|
141
141
|
schemaId = schemaId + c;
|
|
142
|
+
}
|
|
143
|
+
return schemaId;
|
|
142
144
|
}
|
|
143
|
-
return schemaId;
|
|
144
|
-
}
|
|
145
145
|
|
|
146
|
-
|
|
147
|
-
|
|
146
|
+
static validateFileResPrefix(prefix, defaultPrefix = 'RES') {
|
|
147
|
+
const regex = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
148
148
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
if (typeof prefix !== "string" || !regex.test(prefix)) {
|
|
150
|
+
return defaultPrefix;
|
|
151
|
+
}
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
return prefix;
|
|
154
|
+
}
|
|
155
155
|
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
static getUUID() {
|
|
157
|
+
if (globalThis.crypto &&
|
|
158
158
|
globalThis.crypto.randomUUID &&
|
|
159
159
|
typeof globalThis.crypto.randomUUID === 'function') {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
160
|
+
return globalThis.crypto.randomUUID(); // browser
|
|
161
|
+
}
|
|
162
|
+
const nodeCrypto = (() => {
|
|
163
|
+
return require("crypto");
|
|
164
|
+
})();
|
|
165
|
+
if (nodeCrypto && nodeCrypto.randomUUID) {
|
|
166
|
+
return nodeCrypto.randomUUID(); // Node
|
|
167
|
+
}
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
//Nothing worked
|
|
170
|
+
throw new Error('Unable to generate UUID');
|
|
171
|
+
}
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
/**
|
|
174
174
|
* Test if an object is a promise
|
|
175
175
|
* @param {*} object the object to test
|
|
176
176
|
* @returns {boolean} if the object is a promise
|
|
177
177
|
*/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
178
|
+
static isPromise(object) {
|
|
179
|
+
if (object === null || object === undefined) return false;
|
|
180
|
+
if (object.then && (typeof object.then === "function")) return true;
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
183
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
184
|
+
static asPromise(object) {
|
|
185
|
+
if (this.isPromise(object))
|
|
186
|
+
return object;
|
|
187
|
+
return Promise.resolve(object);
|
|
188
|
+
}
|
|
188
189
|
}
|
|
189
|
-
}
|
|
190
190
|
|
|
191
|
-
/**
|
|
191
|
+
/**
|
|
192
192
|
* The ArrayMap object is used to access elements as either an array or a map
|
|
193
193
|
*
|
|
194
194
|
* @class
|
|
@@ -196,8 +196,8 @@ class Util {
|
|
|
196
196
|
* @memberof Utils
|
|
197
197
|
*/
|
|
198
198
|
|
|
199
|
-
class ArrayMap {
|
|
200
|
-
|
|
199
|
+
class ArrayMap {
|
|
200
|
+
constructor() {
|
|
201
201
|
// List of items, as an ordered array. Use defineProperty to make it non-enumerable
|
|
202
202
|
// and support for for ... in loop to iterate by item key
|
|
203
203
|
Object.defineProperty(this, "_items", {
|
|
@@ -219,9 +219,9 @@ class ArrayMap {
|
|
|
219
219
|
writable: true,
|
|
220
220
|
enumerable: false,
|
|
221
221
|
});
|
|
222
|
-
|
|
222
|
+
}
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
_push(key, value, withoutIndexing) {
|
|
225
225
|
let isNumKey = false;
|
|
226
226
|
let updateIndex = -1;
|
|
227
227
|
|
|
@@ -267,82 +267,82 @@ class ArrayMap {
|
|
|
267
267
|
else
|
|
268
268
|
this._items[updateIndex] = value;
|
|
269
269
|
this.length = this._items.length;
|
|
270
|
-
|
|
270
|
+
}
|
|
271
271
|
|
|
272
|
-
|
|
272
|
+
/**
|
|
273
273
|
* Executes a provided function once for each array element.
|
|
274
274
|
* @param {*} callback Function that is called for every element of the array
|
|
275
275
|
* @param {*} thisArg Optional value to use as this when executing the callback function.
|
|
276
276
|
* @returns a new array
|
|
277
277
|
*/
|
|
278
|
-
|
|
278
|
+
forEach(callback, thisArg) {
|
|
279
279
|
return this._items.forEach(callback, thisArg);
|
|
280
|
-
|
|
280
|
+
}
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
/**
|
|
283
283
|
* Returns the first element that satisfies the provided testing function. If no values satisfy the testing function, undefined is returned.
|
|
284
284
|
* @param {*} callback Function that is called for every element of the array
|
|
285
285
|
* @param {*} thisArg Optional value to use as this when executing the callback function.
|
|
286
286
|
* @returns the first element matching the testing function
|
|
287
287
|
*/
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
find(callback, thisArg) {
|
|
289
|
+
return this._items.find(callback, thisArg);
|
|
290
|
+
}
|
|
291
291
|
|
|
292
|
-
|
|
292
|
+
/**
|
|
293
293
|
* creates a new array with all elements that pass the test implemented by the provided function.
|
|
294
294
|
* @param {*} callback Function that is called for every element of the array
|
|
295
295
|
* @param {*} thisArg Optional value to use as this when executing the callback function.
|
|
296
296
|
* @returns an array containing elements passing the test function
|
|
297
297
|
*/
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
298
|
+
filter(callback, thisArg) {
|
|
299
|
+
return this._items.filter(callback, thisArg);
|
|
300
|
+
}
|
|
301
301
|
|
|
302
|
-
|
|
302
|
+
/**
|
|
303
303
|
* Get a element by either name (access as a map) or index (access as an array). Returns undefined if the element does not exist or
|
|
304
304
|
* if the array index is out of range.
|
|
305
305
|
* @param {string|number} indexOrKey the name or index of the element
|
|
306
306
|
* @returns the element matching the name or index
|
|
307
307
|
*/
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
get(indexOrKey) {
|
|
309
|
+
if (typeof indexOrKey === 'number') return this._items[indexOrKey];
|
|
310
|
+
return this._map[indexOrKey];
|
|
311
|
+
}
|
|
312
312
|
|
|
313
|
-
|
|
313
|
+
/**
|
|
314
314
|
* Creates a new array populated with the results of calling a provided function on every element in the calling array.
|
|
315
315
|
* @param {*} callback Function that is called for every element of the array
|
|
316
316
|
* @param {*} thisArg Optional value to use as this when executing the callback function.
|
|
317
317
|
* @returns a new array
|
|
318
318
|
*/
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
319
|
+
map(callback, thisArg) {
|
|
320
|
+
return this._items.map(callback, thisArg);
|
|
321
|
+
}
|
|
322
322
|
|
|
323
|
-
|
|
323
|
+
/**
|
|
324
324
|
* Returns a new array formed by applying a given callback function to each element of the array, and then flattening the result by one level.
|
|
325
325
|
* @param {*} callback Function that is called for every element of the array
|
|
326
326
|
* @param {*} thisArg Optional value to use as this when executing the callback function.
|
|
327
327
|
* @returns a new array
|
|
328
328
|
*/
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
329
|
+
flatMap(callback, thisArg) {
|
|
330
|
+
return this._items.flatMap(callback, thisArg);
|
|
331
|
+
}
|
|
332
332
|
|
|
333
|
-
|
|
333
|
+
/**
|
|
334
334
|
* Iterates over all the elements using the for ... of syntax.
|
|
335
335
|
* @returns returns each element one after the other
|
|
336
336
|
*/
|
|
337
|
-
|
|
337
|
+
*[Symbol.iterator] () {
|
|
338
338
|
for (const item of this._items) {
|
|
339
|
-
|
|
339
|
+
yield item;
|
|
340
340
|
}
|
|
341
|
+
}
|
|
341
342
|
}
|
|
342
|
-
}
|
|
343
343
|
|
|
344
|
-
// Public expots
|
|
345
|
-
exports.Util = Util;
|
|
346
|
-
exports.ArrayMap = ArrayMap;
|
|
344
|
+
// Public expots
|
|
345
|
+
exports.Util = Util;
|
|
346
|
+
exports.ArrayMap = ArrayMap;
|
|
347
347
|
|
|
348
348
|
})();
|
package/src/web/bundler.js
CHANGED
|
@@ -26,14 +26,14 @@ governing permissions and limitations under the License.
|
|
|
26
26
|
const modules = {};
|
|
27
27
|
|
|
28
28
|
function define(name) {
|
|
29
|
-
|
|
29
|
+
modules[name] = { exports: {} };
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
function require(name) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
const module = modules[name];
|
|
34
|
+
if (!module) throw new Error(`Module ${name} not found`);
|
|
35
|
+
if (typeof module.exports != "function" && Object.keys(module.exports).length == 0) throw new Error(`Module ${name} found but not loaded yet`);
|
|
36
|
+
return module.exports;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// Useful for node.js tests
|