Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@adobe/acc-js-sdk

Package Overview
Dependencies
Maintainers
21
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adobe/acc-js-sdk - npm Package Compare versions

Comparing version 1.1.16 to 1.1.17

2

package.json
{
"name": "@adobe/acc-js-sdk",
"version": "1.1.16",
"version": "1.1.17",
"description": "ACC Javascript SDK",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -258,3 +258,3 @@ /*

*/
this.editType = EntityAccessor.getAttributeAsString(xml, "editType");
this.editType = EntityAccessor.getAttributeAsString(xml, "edit");

@@ -261,0 +261,0 @@ /**

@@ -149,3 +149,3 @@ /*

const that = this;
const soapCall = this._client._prepareSoapCall("xtk:session", "GetModifiedEntities", true, this._connectionParameters._options.extraHttpHeaders);
const soapCall = this._client._prepareSoapCall("xtk:session", "GetModifiedEntities", true, true, this._connectionParameters._options.extraHttpHeaders);

@@ -195,2 +195,3 @@ if (this._lastTime === undefined) {

// which might not contain the method GetModifiedEntities just after a build updgrade from a old version of acc
// This is an internal SOAP call that cannot be intercepted by observers onBeforeCall / onAfterCall
return this._client._makeSoapCall(soapCall)

@@ -197,0 +198,0 @@ .then(() => {

@@ -33,3 +33,3 @@ /*

static INVALID_REPRESENTATION(representation, details) { return new CampaignException(undefined, 400, 16384, `SDK-000004 Invalid representation '${representation}'.`, details); }
static CREDENTIALS_FOR_INVALID_EXT_ACCOUNT(name, type) { return new CampaignException(undefined, 400, 16384, `SDK-000005 Cannot created connection parameters for external account '${name}': account type ${type} not supported`); }
static CREDENTIALS_FOR_INVALID_EXT_ACCOUNT(name, type) { return new CampaignException(undefined, 400, 16384, `SDK-000005 Cannot create connection parameters for external account '${name}': account type ${type} not supported`); }
static BAD_PARAMETER(name, value, details) { return new CampaignException(undefined, 400, 16384, `SDK-000006 Bad parameter '${name}' with value '${value}'`, details); }

@@ -36,0 +36,0 @@ static UNEXPECTED_SOAP_RESPONSE(call, details) { return new CampaignException( call, 500, -53, `SDK-000007 Unexpected response from SOAP call`, details); }

@@ -95,2 +95,3 @@ /*

this.methodName = methodName;
this.isStatic = false;

@@ -345,3 +346,3 @@ // Soap calls marked as internal are calls performed by the framework internally

return null;
if (this.elemCurrent.getAttribute("xsi:type") != "ns:Element")
if (this.elemCurrent.getAttribute("xsi:type") != "ns:Element")
return null;

@@ -617,3 +618,3 @@ if (this.elemCurrent.tagName != "entity")

const noMethodInURL = !!this._pushDownOptions.noMethodInURL;
const actualUrl = noMethodInURL ? url : `${url}?${this.urn}:${this.methodName}`;
const actualUrl = noMethodInURL ? url : `${url}?soapAction=${encodeURIComponent(this.urn + "#" + this.methodName)}`;

@@ -620,0 +621,0 @@ // Prepare request and empty response objects

@@ -266,3 +266,152 @@ /*

describe("SOAP method intercept", () => {
it("Should intercept SOAP call", async () => {
const [client, assertion] = await makeObservableClient();
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
await client.NLWS.xtkSession.logon();
const observer = { beforeSoapCall: jest.fn(), afterSoapCall: jest.fn() };
client.registerObserver(observer);
client._transport.mockReturnValueOnce(Mock.GET_XTK_SESSION_SCHEMA_RESPONSE);
client._transport.mockReturnValueOnce(Mock.GET_DATABASEID_RESPONSE);
await client.getOption("XtkDatabaseId");
// Only one call is intercepted: xtk:session#GetOption. The internal call to get the xtk:session schema is internal
// and hence not interceptable
expect(observer.beforeSoapCall).toHaveBeenCalledTimes(1);
expect(observer.beforeSoapCall.mock.calls[0]).toEqual([ { urn:"xtk:session", name: "GetOption" }, [ { name:"name", type:"string", value:"XtkDatabaseId" } ], "SimpleJson" ]);
expect(observer.afterSoapCall).toHaveBeenCalledTimes(1);
expect(observer.afterSoapCall.mock.calls[0]).toEqual([ { urn:"xtk:session", name: "GetOption" }, [ { name:"name", type:"string", value:"XtkDatabaseId" } ], "SimpleJson", [ { name:"value", type:"string", value:"uFE80000000000000F1FA913DD7CC7C480041161C" }, { name:"type", type:"byte", value:6 }] ]);
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
await client.NLWS.xtkSession.logoff();
});
it("Should support intercept callback to get schemas", async () => {
const [client, assertion] = await makeObservableClient();
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
await client.NLWS.xtkSession.logon();
const observer = { beforeSoapCall: jest.fn(), afterSoapCall: jest.fn() };
client.registerObserver(observer);
var extAccountSchema;
client._transport.mockReturnValueOnce(Mock.GET_XTK_SESSION_SCHEMA_RESPONSE);
client._transport.mockReturnValueOnce(Mock.GET_NMS_EXTACCOUNT_SCHEMA_RESPONSE);
client._transport.mockReturnValueOnce(Mock.GET_DATABASEID_RESPONSE);
observer.beforeSoapCall.mockImplementationOnce(async (method, inputParameters, representation) => {
extAccountSchema = await client.getSchema("nms:extAccount");
});
var databaseId = await client.getOption("XtkDatabaseId");
expect(databaseId).toBe("uFE80000000000000F1FA913DD7CC7C480041161C");
expect(extAccountSchema.name).toBe("extAccount");
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
await client.NLWS.xtkSession.logoff();
});
it("Should allow to rewrite method call parameters", async () => {
const [client, assertion] = await makeObservableClient();
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
await client.NLWS.xtkSession.logon();
const observer = { beforeSoapCall: jest.fn(), afterSoapCall: jest.fn() };
client.registerObserver(observer);
client._transport.mockReturnValueOnce(Mock.GET_XTK_SESSION_SCHEMA_RESPONSE);
const getOption = (options) => {
// SOAP request contains the option name as <name xsi:type="xsd:string">Dummy</name>
const index = options.data.indexOf('<name xsi:type="xsd:string">');
const index2 = options.data.indexOf('</name>', index);
const name = options.data.substring(index + 28, index2);
// Option value is the option name followed by a "ZZ"
return Promise.resolve(`<?xml version='1.0'?>
<SOAP-ENV:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ns='urn:xtk:session' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
<SOAP-ENV:Body>
<GetOptionResponse xmlns='urn:xtk:session' SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
<pstrValue xsi:type='xsd:string'>${name}ZZ</pstrValue>
<pbtType xsi:type='xsd:byte'>6</pbtType>
</GetOptionResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>`);
};
client._transport.mockImplementationOnce(getOption);
client.clearOptionCache();
var value = await client.getOption("Dummy");
expect(value).toBe("DummyZZ");
jest.clearAllMocks();
observer.beforeSoapCall.mockImplementationOnce(async (method, inputParameters, representation) => {
if (inputParameters[0].value === "Dummy") inputParameters[0].value = "XtkDatabaseId";
});
client._transport.mockImplementationOnce(getOption);
client.clearOptionCache();
var value = await client.getOption("Dummy");
expect(value).toBe("XtkDatabaseIdZZ");
// Only one call is intercepted: xtk:session#GetOption. The internal call to get the xtk:session schema is internal
// and hence not interceptable
expect(observer.beforeSoapCall).toHaveBeenCalledTimes(1);
expect(observer.beforeSoapCall.mock.calls[0]).toEqual([ { urn:"xtk:session", name: "GetOption" }, [ { name:"name", type:"string", value:"XtkDatabaseId" } ], "SimpleJson" ]);
expect(observer.afterSoapCall).toHaveBeenCalledTimes(1);
expect(observer.afterSoapCall.mock.calls[0]).toEqual([ { urn:"xtk:session", name: "GetOption" }, [ { name:"name", type:"string", value:"XtkDatabaseId" } ], "SimpleJson", [ { name:"value", type:"string", value:"XtkDatabaseIdZZ" }, { name:"type", type:"byte", value:6 }] ]);
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
await client.NLWS.xtkSession.logoff();
});
it("Should allow to rewrite method return parameters", async () => {
const [client, assertion] = await makeObservableClient();
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
await client.NLWS.xtkSession.logon();
const observer = { beforeSoapCall: jest.fn(), afterSoapCall: jest.fn() };
client.registerObserver(observer);
client._transport.mockReturnValueOnce(Mock.GET_XTK_SESSION_SCHEMA_RESPONSE);
client._transport.mockReturnValueOnce(Mock.GET_DATABASEID_RESPONSE);
observer.afterSoapCall.mockImplementationOnce(async (method, inputParameters, representation, outputParameters) => {
outputParameters[0].value = "Patched";
});
var value = await client.getOption("XtkDatabaseId");
expect(value).toBe("Patched");
// Only one call is intercepted: xtk:session#GetOption. The internal call to get the xtk:session schema is internal
// and hence not interceptable
expect(observer.beforeSoapCall).toHaveBeenCalledTimes(1);
expect(observer.beforeSoapCall.mock.calls[0]).toEqual([ { urn:"xtk:session", name: "GetOption" }, [ { name:"name", type:"string", value:"XtkDatabaseId" } ], "SimpleJson" ]);
expect(observer.afterSoapCall).toHaveBeenCalledTimes(1);
expect(observer.afterSoapCall.mock.calls[0]).toEqual([ { urn:"xtk:session", name: "GetOption" }, [ { name:"name", type:"string", value:"XtkDatabaseId" } ], "SimpleJson", [ { name:"value", type:"string", value:"Patched" }, { name:"type", type:"byte", value:6 }] ]);
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
await client.NLWS.xtkSession.logoff();
});
it("Should not intercept internal calls", async () => {
const [client, assertion] = await makeObservableClient();
client._transport.mockReturnValueOnce(Mock.LOGON_RESPONSE);
await client.NLWS.xtkSession.logon();
const observer = { beforeSoapCall: jest.fn(), afterSoapCall: jest.fn() };
client.registerObserver(observer);
client._transport.mockReturnValueOnce(Mock.GET_XTK_SESSION_SCHEMA_RESPONSE);
var schema = await client.getEntityIfMoreRecent("xtk:schema", "xtk:session", undefined, true);
expect(schema.name).toBe("session");
expect(observer.beforeSoapCall).not.toHaveBeenCalled();
expect(observer.afterSoapCall).not.toHaveBeenCalled();
client._transport.mockReturnValueOnce(Mock.GET_XTK_SESSION_SCHEMA_RESPONSE);
schema = await client.getEntityIfMoreRecent("xtk:schema", "xtk:session", undefined, false);
expect(schema.name).toBe("session");
expect(observer.beforeSoapCall).toHaveBeenCalledTimes(1);
expect(observer.afterSoapCall).toHaveBeenCalledTimes(1);
client._transport.mockReturnValueOnce(Mock.LOGOFF_RESPONSE);
await client.NLWS.xtkSession.logoff();
});
});
});

@@ -737,3 +737,3 @@ /*

expect(client._connectionParameters._options.charset).toBe('UTF-8');
const soapCall = client._prepareSoapCall("xtk:persist", "GetEntityIfMoreRecent", true);
const soapCall = client._prepareSoapCall("xtk:persist", "GetEntityIfMoreRecent", true, true);
expect (soapCall._charset).toBe('UTF-8');

@@ -749,3 +749,3 @@ const [ request ] = soapCall._createHTTPRequest(URL);

expect(client._connectionParameters._options.charset).toBe('');
const soapCall = client._prepareSoapCall("xtk:persist", "GetEntityIfMoreRecent", true);
const soapCall = client._prepareSoapCall("xtk:persist", "GetEntityIfMoreRecent", true, true);
expect (soapCall._charset).toBe('');

@@ -761,3 +761,3 @@ const [ request ] = soapCall._createHTTPRequest(URL);

expect(client._connectionParameters._options.charset).toBe('ISO-8859-1');
const soapCall = client._prepareSoapCall("xtk:persist", "GetEntityIfMoreRecent", true);
const soapCall = client._prepareSoapCall("xtk:persist", "GetEntityIfMoreRecent", true, true);
expect (soapCall._charset).toBe('ISO-8859-1');

@@ -907,3 +907,3 @@ const [ request ] = soapCall._createHTTPRequest(URL);

call.finalize(URL);
expect(call.request.url).toBe("https://soap-test/nl/jsp/soaprouter.jsp?xtk:session:Empty");
expect(call.request.url).toBe("https://soap-test/nl/jsp/soaprouter.jsp?soapAction=xtk%3Asession%23Empty");
});

@@ -910,0 +910,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc