@adobe/acc-js-sdk 1.1.59 → 1.1.60
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 +7 -0
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/src/application.js +7 -3
- package/src/client.js +3 -2
- package/test/application.test.js +30 -1
- package/test/client.test.js +36 -0
package/docs/changeLog.html
CHANGED
|
@@ -3,6 +3,13 @@ layout: page
|
|
|
3
3
|
title: Change Log
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
<section class="changelog"><h1>Version 1.1.60</h1>
|
|
7
|
+
<h2>2025/09/04</h2>
|
|
8
|
+
<li>
|
|
9
|
+
Ability to bypass the cache to get a schema
|
|
10
|
+
</li>
|
|
11
|
+
</section>
|
|
12
|
+
|
|
6
13
|
<section class="changelog"><h1>Version 1.1.59</h1>
|
|
7
14
|
<h2>2025/08/22</h2>
|
|
8
15
|
<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.60",
|
|
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.60",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"axios": "^1.7.8",
|
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
|
@@ -1943,9 +1943,10 @@ class Client {
|
|
|
1943
1943
|
* @param {string} schemaId the schema id, such as "xtk:session", or "nms:recipient"
|
|
1944
1944
|
* @param {string} representation an optional representation of the schema: "BadgerFish", "SimpleJson" or "xml". If not set, we'll use the client default representation
|
|
1945
1945
|
* @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
|
|
1946
|
+
* @param {boolean} withoutCache if true, the schema will be fetched from the server without using the cache, defaults to false
|
|
1946
1947
|
* @returns {XML.XtkObject} the schema definition, as either a DOM document or a JSON object
|
|
1947
1948
|
*/
|
|
1948
|
-
async getSchema(schemaId, representation, internal) {
|
|
1949
|
+
async getSchema(schemaId, representation, internal, withoutCache = false) {
|
|
1949
1950
|
// Support for Orchestrated Campaign XDM schemas (do not use cache)
|
|
1950
1951
|
const pipeIndex = schemaId.indexOf("|");
|
|
1951
1952
|
if( pipeIndex != -1 && schemaId.startsWith("xdm:") ) {
|
|
@@ -1955,7 +1956,7 @@ class Client {
|
|
|
1955
1956
|
return entity;
|
|
1956
1957
|
}
|
|
1957
1958
|
var entity = await this._entityCache.get("xtk:schema", schemaId);
|
|
1958
|
-
if (!entity) {
|
|
1959
|
+
if (!entity || withoutCache) {
|
|
1959
1960
|
// special case of "temp:group:*" schemas for nms:group
|
|
1960
1961
|
// Schema "temp:group:*" is not cached because life cycle of this kind of schema is not the same as the others schemas
|
|
1961
1962
|
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);
|