@adobe/acc-js-sdk 1.1.59 → 1.1.61
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 +17 -0
- package/package-lock.json +10 -10
- package/package.json +1 -1
- package/src/application.js +7 -3
- package/src/client.js +15 -3
- package/test/application.test.js +30 -1
- package/test/client.test.js +98 -1
package/docs/changeLog.html
CHANGED
|
@@ -3,6 +3,23 @@ layout: page
|
|
|
3
3
|
title: Change Log
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
<section class="changelog"><h1>Version 1.1.61</h1>
|
|
7
|
+
<h2>2025/09/16</h2>
|
|
8
|
+
<li>
|
|
9
|
+
Add request id to SOAP calls
|
|
10
|
+
</li>
|
|
11
|
+
<li>
|
|
12
|
+
Bumped dependencies version to fix vulnerabilities
|
|
13
|
+
</li>
|
|
14
|
+
</section>
|
|
15
|
+
|
|
16
|
+
<section class="changelog"><h1>Version 1.1.60</h1>
|
|
17
|
+
<h2>2025/09/04</h2>
|
|
18
|
+
<li>
|
|
19
|
+
Ability to bypass the cache to get a schema
|
|
20
|
+
</li>
|
|
21
|
+
</section>
|
|
22
|
+
|
|
6
23
|
<section class="changelog"><h1>Version 1.1.59</h1>
|
|
7
24
|
<h2>2025/08/22</h2>
|
|
8
25
|
<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.61",
|
|
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.61",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"axios": "^1.7.8",
|
|
@@ -1169,12 +1169,12 @@
|
|
|
1169
1169
|
"license": "MIT"
|
|
1170
1170
|
},
|
|
1171
1171
|
"node_modules/axios": {
|
|
1172
|
-
"version": "1.
|
|
1173
|
-
"resolved": "https://registry.npmjs.org/axios/-/axios-1.
|
|
1174
|
-
"integrity": "sha512-
|
|
1172
|
+
"version": "1.12.2",
|
|
1173
|
+
"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",
|
|
1174
|
+
"integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==",
|
|
1175
1175
|
"dependencies": {
|
|
1176
1176
|
"follow-redirects": "^1.15.6",
|
|
1177
|
-
"form-data": "^4.0.
|
|
1177
|
+
"form-data": "^4.0.4",
|
|
1178
1178
|
"proxy-from-env": "^1.1.0"
|
|
1179
1179
|
}
|
|
1180
1180
|
},
|
|
@@ -5488,12 +5488,12 @@
|
|
|
5488
5488
|
"version": "0.4.0"
|
|
5489
5489
|
},
|
|
5490
5490
|
"axios": {
|
|
5491
|
-
"version": "1.
|
|
5492
|
-
"resolved": "https://registry.npmjs.org/axios/-/axios-1.
|
|
5493
|
-
"integrity": "sha512-
|
|
5491
|
+
"version": "1.12.2",
|
|
5492
|
+
"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",
|
|
5493
|
+
"integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==",
|
|
5494
5494
|
"requires": {
|
|
5495
5495
|
"follow-redirects": "^1.15.6",
|
|
5496
|
-
"form-data": "^4.0.
|
|
5496
|
+
"form-data": "^4.0.4",
|
|
5497
5497
|
"proxy-from-env": "^1.1.0"
|
|
5498
5498
|
}
|
|
5499
5499
|
},
|
package/package.json
CHANGED
package/src/application.js
CHANGED
|
@@ -1419,15 +1419,19 @@ class Application {
|
|
|
1419
1419
|
* Using the `XtkSchema` API makes it easier to navigate schemas than using a plain XML or JSON object
|
|
1420
1420
|
*
|
|
1421
1421
|
* @param {string} schemaId
|
|
1422
|
+
* @param {boolean} withoutCache if true, the schema will be fetched from the server without using the cache, defaults to false
|
|
1422
1423
|
* @returns {Campaign.XtkSchema} the schema, or null if the schema was not found
|
|
1423
1424
|
*/
|
|
1424
|
-
async getSchema(schemaId) {
|
|
1425
|
+
async getSchema(schemaId, withoutCache = false) {
|
|
1426
|
+
if (withoutCache) {
|
|
1427
|
+
return this._getSchema(schemaId, withoutCache);
|
|
1428
|
+
}
|
|
1425
1429
|
return this._schemaCache.getSchema(schemaId);
|
|
1426
1430
|
}
|
|
1427
1431
|
|
|
1428
1432
|
// Private function: get a schema without using the SchemaCache
|
|
1429
|
-
async _getSchema(schemaId) {
|
|
1430
|
-
const xml = await this.client.getSchema(schemaId, "xml");
|
|
1433
|
+
async _getSchema(schemaId, withoutCache = false) {
|
|
1434
|
+
const xml = await this.client.getSchema(schemaId, "xml", undefined, withoutCache);
|
|
1431
1435
|
if (!xml)
|
|
1432
1436
|
return null;
|
|
1433
1437
|
return newSchema(xml, this);
|
package/src/client.js
CHANGED
|
@@ -1178,11 +1178,22 @@ class Client {
|
|
|
1178
1178
|
* parameters should be set
|
|
1179
1179
|
*/
|
|
1180
1180
|
_prepareSoapCall(urn, method, isStatic, internal, extraHttpHeaders, pushDownOptions) {
|
|
1181
|
+
// Generate unique request ID for every SOAP call
|
|
1182
|
+
let requestId;
|
|
1183
|
+
try {
|
|
1184
|
+
requestId = Util.getUUID();
|
|
1185
|
+
} catch (error) {
|
|
1186
|
+
console.error("Failed to generate request ID", error);
|
|
1187
|
+
}
|
|
1188
|
+
const updatedExtraHttpHeaders = requestId ? Object.assign({}, extraHttpHeaders, {
|
|
1189
|
+
"x-request-id": requestId,
|
|
1190
|
+
})
|
|
1191
|
+
: extraHttpHeaders;
|
|
1181
1192
|
const soapCall = new SoapMethodCall(this._transport, urn, method,
|
|
1182
1193
|
this._sessionToken, this._securityToken,
|
|
1183
1194
|
this._getUserAgentString(),
|
|
1184
1195
|
Object.assign({}, this._connectionParameters._options, pushDownOptions),
|
|
1185
|
-
|
|
1196
|
+
updatedExtraHttpHeaders,
|
|
1186
1197
|
this._bearerToken);
|
|
1187
1198
|
soapCall.internal = !!internal;
|
|
1188
1199
|
soapCall.isStatic = isStatic;
|
|
@@ -1943,9 +1954,10 @@ class Client {
|
|
|
1943
1954
|
* @param {string} schemaId the schema id, such as "xtk:session", or "nms:recipient"
|
|
1944
1955
|
* @param {string} representation an optional representation of the schema: "BadgerFish", "SimpleJson" or "xml". If not set, we'll use the client default representation
|
|
1945
1956
|
* @param {boolean} internal indicates an "internal" call, i.e. a call performed by the SDK itself rather than the user of the SDK. For instance, the SDK will dynamically load schemas to find method definitions
|
|
1957
|
+
* @param {boolean} withoutCache if true, the schema will be fetched from the server without using the cache, defaults to false
|
|
1946
1958
|
* @returns {XML.XtkObject} the schema definition, as either a DOM document or a JSON object
|
|
1947
1959
|
*/
|
|
1948
|
-
async getSchema(schemaId, representation, internal) {
|
|
1960
|
+
async getSchema(schemaId, representation, internal, withoutCache = false) {
|
|
1949
1961
|
// Support for Orchestrated Campaign XDM schemas (do not use cache)
|
|
1950
1962
|
const pipeIndex = schemaId.indexOf("|");
|
|
1951
1963
|
if( pipeIndex != -1 && schemaId.startsWith("xdm:") ) {
|
|
@@ -1955,7 +1967,7 @@ class Client {
|
|
|
1955
1967
|
return entity;
|
|
1956
1968
|
}
|
|
1957
1969
|
var entity = await this._entityCache.get("xtk:schema", schemaId);
|
|
1958
|
-
if (!entity) {
|
|
1970
|
+
if (!entity || withoutCache) {
|
|
1959
1971
|
// special case of "temp:group:*" schemas for nms:group
|
|
1960
1972
|
// Schema "temp:group:*" is not cached because life cycle of this kind of schema is not the same as the others schemas
|
|
1961
1973
|
if (schemaId.startsWith("temp:group:")) {
|
package/test/application.test.js
CHANGED
|
@@ -2543,7 +2543,36 @@ describe('Application', () => {
|
|
|
2543
2543
|
client._transport.mockReturnValueOnce(Mock.GET_MISSING_SCHEMA_RESPONSE);
|
|
2544
2544
|
const schema = await client.application.getSchema("xtk:dummy")
|
|
2545
2545
|
expect(schema).toBeNull();
|
|
2546
|
-
})
|
|
2546
|
+
});
|
|
2547
|
+
|
|
2548
|
+
it("Should respect withoutCache parameter", async () => {
|
|
2549
|
+
const client = await Mock.makeClient();
|
|
2550
|
+
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
2551
|
+
await client.NLWS.xtkSession.logon();
|
|
2552
|
+
|
|
2553
|
+
// First call - should use cache
|
|
2554
|
+
client._transport.mockReturnValueOnce(Mock.GET_XTK_SESSION_SCHEMA_RESPONSE);
|
|
2555
|
+
const schema = await client.application.getSchema("xtk:session");
|
|
2556
|
+
expect(schema.namespace).toBe("xtk");
|
|
2557
|
+
expect(schema.name).toBe("session");
|
|
2558
|
+
expect(client._transport).toHaveBeenCalledTimes(2); // Logon + getSchema
|
|
2559
|
+
|
|
2560
|
+
// Second call - should use cache (no transport call)
|
|
2561
|
+
const schema2 = await client.application.getSchema("xtk:session");
|
|
2562
|
+
expect(schema2.namespace).toBe("xtk");
|
|
2563
|
+
expect(schema2.name).toBe("session");
|
|
2564
|
+
expect(client._transport).toHaveBeenCalledTimes(2); // Still only 2 calls (no new transport call)
|
|
2565
|
+
|
|
2566
|
+
// Third call with withoutCache=true - should bypass cache and make transport call
|
|
2567
|
+
client._transport.mockReturnValueOnce(Mock.GET_XTK_SESSION_SCHEMA_RESPONSE);
|
|
2568
|
+
const schema3 = await client.application.getSchema("xtk:session", true);
|
|
2569
|
+
expect(schema3.namespace).toBe("xtk");
|
|
2570
|
+
expect(schema3.name).toBe("session");
|
|
2571
|
+
expect(client._transport).toHaveBeenCalledTimes(3); // Now 3 calls (bypassed cache)
|
|
2572
|
+
|
|
2573
|
+
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
|
|
2574
|
+
await client.NLWS.xtkSession.logoff();
|
|
2575
|
+
});
|
|
2547
2576
|
});
|
|
2548
2577
|
|
|
2549
2578
|
describe("application.hasPackage", () => {
|
package/test/client.test.js
CHANGED
|
@@ -436,6 +436,42 @@ describe('ACC Client', function () {
|
|
|
436
436
|
await client.NLWS.xtkSession.logoff();
|
|
437
437
|
});
|
|
438
438
|
|
|
439
|
+
it("Should respect withoutCache parameter", async () => {
|
|
440
|
+
const client = await Mock.makeClient();
|
|
441
|
+
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
442
|
+
await client.NLWS.xtkSession.logon();
|
|
443
|
+
|
|
444
|
+
// First call - should cache the schema
|
|
445
|
+
client._transport.mockReturnValueOnce(Mock.GET_NMS_EXTACCOUNT_SCHEMA_RESPONSE);
|
|
446
|
+
var schema = await client.getSchema("nms:extAccount");
|
|
447
|
+
expect(schema["namespace"]).toBe("nms");
|
|
448
|
+
expect(schema["name"]).toBe("extAccount");
|
|
449
|
+
expect(client._transport).toHaveBeenCalledTimes(2); // Logon + getSchema
|
|
450
|
+
|
|
451
|
+
// Second call - should use cache (no transport call)
|
|
452
|
+
schema = await client.getSchema("nms:extAccount");
|
|
453
|
+
expect(schema["namespace"]).toBe("nms");
|
|
454
|
+
expect(schema["name"]).toBe("extAccount");
|
|
455
|
+
expect(client._transport).toHaveBeenCalledTimes(2); // Still only 2 calls (no new transport call)
|
|
456
|
+
|
|
457
|
+
// Third call with withoutCache=true - should bypass cache and make transport call
|
|
458
|
+
client._transport.mockReturnValueOnce(Mock.GET_NMS_EXTACCOUNT_SCHEMA_RESPONSE);
|
|
459
|
+
schema = await client.getSchema("nms:extAccount", undefined, undefined, true);
|
|
460
|
+
expect(schema["namespace"]).toBe("nms");
|
|
461
|
+
expect(schema["name"]).toBe("extAccount");
|
|
462
|
+
expect(client._transport).toHaveBeenCalledTimes(3); // Now 3 calls (bypassed cache)
|
|
463
|
+
|
|
464
|
+
// Fourth call with withoutCache=true and custom representation - should bypass cache
|
|
465
|
+
client._transport.mockReturnValueOnce(Mock.GET_NMS_EXTACCOUNT_SCHEMA_RESPONSE);
|
|
466
|
+
schema = await client.getSchema("nms:extAccount", "xml", undefined, true);
|
|
467
|
+
expect(schema.getAttribute("namespace")).toBe("nms");
|
|
468
|
+
expect(schema.getAttribute("name")).toBe("extAccount");
|
|
469
|
+
expect(client._transport).toHaveBeenCalledTimes(4); // Now 4 calls (bypassed cache again)
|
|
470
|
+
|
|
471
|
+
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
|
|
472
|
+
await client.NLWS.xtkSession.logoff();
|
|
473
|
+
});
|
|
474
|
+
|
|
439
475
|
it("Should return XDM schema definition", async () => {
|
|
440
476
|
const client = await Mock.makeClient();
|
|
441
477
|
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
@@ -3410,6 +3446,67 @@ describe('ACC Client', function () {
|
|
|
3410
3446
|
"X-Query-Source": `${sdk.getSDKVersion().name} ${sdk.getSDKVersion().version},Test client app`,
|
|
3411
3447
|
});
|
|
3412
3448
|
});
|
|
3449
|
+
|
|
3450
|
+
it("Should add x-request-id header to every SOAP call", async () => {
|
|
3451
|
+
const client = await Mock.makeClient();
|
|
3452
|
+
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
3453
|
+
await client.NLWS.xtkSession.logon();
|
|
3454
|
+
|
|
3455
|
+
const mockGetUUID = jest.spyOn(Util, 'getUUID').mockImplementation(() => { return 'test-uuid'; });
|
|
3456
|
+
|
|
3457
|
+
client._transport.mockReturnValueOnce(Mock.GET_XTK_QUERY_SCHEMA_RESPONSE);
|
|
3458
|
+
client._transport.mockReturnValueOnce(Mock.GET_QUERY_EXECUTE_RESPONSE);
|
|
3459
|
+
|
|
3460
|
+
const queryDef = {
|
|
3461
|
+
"schema": "nms:extAccount",
|
|
3462
|
+
"operation": "select",
|
|
3463
|
+
"select": {
|
|
3464
|
+
"node": [
|
|
3465
|
+
{ "expr": "@id" },
|
|
3466
|
+
{ "expr": "@name" }
|
|
3467
|
+
]
|
|
3468
|
+
}
|
|
3469
|
+
};
|
|
3470
|
+
const query = client.NLWS.xtkQueryDef.create(queryDef);
|
|
3471
|
+
|
|
3472
|
+
const headers = await collectHeaders(client, async() => {
|
|
3473
|
+
await query.executeQuery();
|
|
3474
|
+
});
|
|
3475
|
+
|
|
3476
|
+
expect(headers["x-request-id"]).toBe('test-uuid');
|
|
3477
|
+
|
|
3478
|
+
// Restore the mock
|
|
3479
|
+
mockGetUUID.mockRestore();
|
|
3480
|
+
});
|
|
3481
|
+
|
|
3482
|
+
it("Should call SOAP call on request ID generation failure", async () => {
|
|
3483
|
+
const client = await Mock.makeClient();
|
|
3484
|
+
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
|
|
3485
|
+
await client.NLWS.xtkSession.logon();
|
|
3486
|
+
|
|
3487
|
+
const mockGetUUID = jest.spyOn(Util, 'getUUID').mockImplementation(() => { throw new Error('UUID error'); });
|
|
3488
|
+
|
|
3489
|
+
client._transport.mockReturnValueOnce(Mock.GET_XTK_QUERY_SCHEMA_RESPONSE);
|
|
3490
|
+
client._transport.mockReturnValueOnce(Mock.GET_QUERY_EXECUTE_RESPONSE);
|
|
3491
|
+
const queryDef = {
|
|
3492
|
+
"schema": "nms:extAccount",
|
|
3493
|
+
"operation": "select",
|
|
3494
|
+
"select": {
|
|
3495
|
+
"node": [{ "expr": "@id" }]
|
|
3496
|
+
}
|
|
3497
|
+
};
|
|
3498
|
+
|
|
3499
|
+
const query = client.NLWS.xtkQueryDef.create(queryDef);
|
|
3500
|
+
|
|
3501
|
+
const headers = await collectHeaders(client, async() => {
|
|
3502
|
+
await query.executeQuery();
|
|
3503
|
+
});
|
|
3504
|
+
|
|
3505
|
+
expect(headers["x-request-id"]).toBeUndefined();
|
|
3506
|
+
|
|
3507
|
+
// Restore the mock
|
|
3508
|
+
mockGetUUID.mockRestore();
|
|
3509
|
+
});
|
|
3413
3510
|
});
|
|
3414
3511
|
|
|
3415
3512
|
describe("Pushdown parameters", () => {
|
|
@@ -4318,7 +4415,7 @@ describe('ACC Client', function () {
|
|
|
4318
4415
|
type: "text/html",
|
|
4319
4416
|
size: 12345,
|
|
4320
4417
|
}, undefined, 'PREFIX');
|
|
4321
|
-
expect(Util.getUUID).toHaveBeenCalledTimes(
|
|
4418
|
+
expect(Util.getUUID).toHaveBeenCalledTimes(8);
|
|
4322
4419
|
});
|
|
4323
4420
|
}); // "File uploader - on browser"
|
|
4324
4421
|
}); // 'upload'
|