adobe / acc-js-sdk Goto Github PK
View Code? Open in Web Editor NEWA JavaScript SDK for Adobe Campaign Classic
License: Apache License 2.0
A JavaScript SDK for Adobe Campaign Classic
License: Apache License 2.0
Using a QueryDef in getIfExists mode should return null/undefined when requested object is not found.
Currently returns {}
After logging in a Campaign instance, the "logon" call returns a list of active packages on the instance.
Make this list available to the clients and add hasPackage function with 2 syntaxes:
Hi Team, I am facing below issue when I try to access the Element of type Memo using query def:
export const queryDef = (schemaName: string, id: string, customProps: Record<string, XtkSchemaNode>): QueryDef => { const query = { operation: 'get', schema: schemaName, select: { node: [{ expr: '@id' }], }, where: { condition: [ { expr:
@id = ${id}, }, ], }, }; Object.keys(customProps).map((propKey: string) => { query.select.node.push({ expr: customProps[propKey]?.parent?.parent?.id != schemaName || propKey.includes('-id') ?
[${customProps[propKey].nodePath.slice(1)}]// Non Root children Attributes :
${customProps[propKey].nodePath.slice(1)}, // Root children Attributes }); }); return query; };
It is returning memo field as empty object like below:
testmemoElement: {}
But it is expected to come as below:
$testmemoElement: ""
I am using two field of type element those are CDATA and memo. but CDATA is coming as expected, when it is empty. memo field is coming as empty object when it is empty.
JSDOM is one of the dependencies of adobe/acc-js-sdk package which I am using to make connection to Adobe Campaign in a cdk project. While deploying the application using 'cdk deploy' there is a build error for /xhr-sync-worker.js which occurs at the location node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js
Application building successfully
An error with JSDOM
ERROR Uncaught Exception {
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module './xhr-sync-worker.js'\nRequire stack:\n- /var/task/index.js\n- /var/runtime/index.mjs",
"stack": [
"Runtime.ImportModuleError: Error: Cannot find module './xhr-sync-worker.js'",
"Require stack:",
"- /var/task/index.js",
"- /var/runtime/index.mjs",
" at _loadUserApp (file:///var/runtime/index.mjs:1000:17)",
" at async Object.UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1035:21)",
" at async start (file:///var/runtime/index.mjs:1200:23)",
" at async file:///var/runtime/index.mjs:1206:1"
]
}
"aws-cdk-lib": "2.35.0"
"@adobe/acc-js-sdk": 1.1.17
const adobe = require("@adobe/acc-js-sdk");
Don't really know if the issue is with this package or the JSDOM package
Thanks in advance
I've encountered this problem in a project where I use this library to update the html source of deliveries in a campaign. After creating the html files externally, we run our tool to load the contents of the files into the related deliveries, with the following code:
const d = {
xtkschema: "nms:delivery",
_operation: "update",
_key: "@id",
id: delivery.id,
content: {
html: {
$source: content
}
}
};
await NLWS.xtkSession.write(d);
I expect the content of my html file to be correctly uploaded and visible inside the Adobe Campaign delivery.
If the html contains some special elements, such as the Italian accented characters (à è ì ò ù), they break after the upload:
What I wrote in my editor (VS Code):
What I see in Adobe Campaign after running the update query:
SDK 1.1.0
After investigating, I discovered that there's probably a problem in the request encoding: in the Content-type header, the charset is missing.
After inserting the UTF-8 charset like this:
in the soap.js file, the upload was successful:
So I'm kindly asking if you can update the file with the correct UTF-8 character encoding or at least make it configurable while creating the client, so that issues like mine can be solved.
Thanks in advance.
PostEvent
from xtk:workflow
to send an event to a signal in a workflow
The SDK throws an error because it's expecting the parameters to be inside a variables
entity.
Just use the SDK and call PostEvent
method:
await NLWS.xtkWorkflow.postEvent(name, 'signal', '', variables, false);
Please see above
CampaignException {
name: 'CampaignException',
message: "500 - Error SOAP-ENV:Server calling method 'xtk:workflow#PostEvent': SOP-330011 Error while executing the method 'PostEvent' of service 'xtk:workflow'.. Parameters must be inside a 'variables' entity (instead of 'parameters').",
statusCode: 500,
methodCall: {
type: 'SOAP',
url: 'https://sprich-mkt-stage2.campaign.adobe.com/nl/jsp/soaprouter.jsp?soapAction=xtk%3Aworkflow%23PostEvent',
urn: 'xtk:workflow',
methodName: 'PostEvent',
request: {
url: 'https://sprich-mkt-stage2.campaign.adobe.com/nl/jsp/soaprouter.jsp?soapAction=xtk%3Aworkflow%23PostEvent',
method: 'POST',
headers: [Object],
data: '<SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://xml.apache.org/xml-soap"><SOAP-ENV:Header><X-Security-Token/></SOAP-ENV:Header><SOAP-ENV:Body><m:PostEvent xmlns:m="urn:xtk:workflow" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><sessiontoken xsi:type="xsd:string"/><workflowId xsi:type="xsd:string">sprProofAbandonedCartEmail</workflowId><activity xsi:type="xsd:string">signal</activity><transition xsi:type="xsd:string"/><parameters xsi:type="ns:Element" SOAP-ENV:encodingStyle="http://xml.apache.org/xml-soap/literalxml"><parameters id="1000"/></parameters><complete xsi:type="xsd:boolean">false</complete></m:PostEvent></SOAP-ENV:Body></SOAP-ENV:Envelope>'
},
response: "<?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:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Server</faultcode><faultstring xsi:type='xsd:string'>SOP-330011 Error while executing the method 'PostEvent' of service 'xtk:workflow'.</faultstring><detail xsi:type='xsd:string'>Parameters must be inside a 'variables' entity (instead of 'parameters').</detail></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>"
},
errorCode: 'SOP-330011',
faultCode: 'SOAP-ENV:Server',
faultString: "Error while executing the method 'PostEvent' of service 'xtk:workflow'.",
detail: "Parameters must be inside a 'variables' entity (instead of 'parameters').",
cause: undefined
}
The SDK throws an error when I try to use PostEvent
from xtk:workflow
schema. The error says that Parameters must be inside a 'variables
' entity (instead of 'parameters
').
I took a look at the code and it looks like the XML element name is overriden for method StartWithParameters
only.
// Hack for workflow API. The C++ code checks that the name of the XML element is <variables>. When
// using xml representation at the SDK level, it's ok since the SDK caller will set that. But this does
// not work when using "BadgerFish" representation where we do not know the root element name.
if (entitySchemaId == "xtk:workflow" && methodName == "StartWithParameters" && paramName == "parameters")
docName = "variables";
Is there a reason this hack is not implemented for the other methods? PostEvent
for example?
Using a QueryDef in select mode should always return an array.
When the result is exactly one record, the first element of the array is returned rather than an array containing the element
The following code (assuming there's a single recipient in the database)
const queryDef = {
"@schema": "nms:recipient",
"@operation": "select",
"select": {
"node": [
{ "@expr": "@id" }
]
}
};
const query = NLWS.xtkQueryDef.create(queryDef);
const profiles = await query.executeQuery();
console.log(profiles);
will return
{ recipient: { '@id': '1000' } }
instead of the expected
{ recipient: [ { '@id': '1000' } ] }
Version 0.1.0
Currently there is no way to abort a request from the client. For example:
Hi,
I'm using SDK version 1.1.1. Trying to send a proof via the LaunchFCP method (NLWS.nmsDelivery.launchFCP (deliveryId)), I get an error due to the timeout being exceeded:
My code (delivery object was previously created and populated):
log(`Sending proof for delivery ${delivery["label"]}`);
await NLWS.nmsDelivery.launchFCP(delivery["id"]);
log(`Proof for delivery ${delivery["label"]} sent`);
My logs:
[11:37:24] Sending proof for delivery **********
[11:37:30] 500 - Error calling method 'nms:delivery#LaunchFCP': Error: timeout of 5000ms exceeded
Checking the transport.js file - timeout
property, line 61 - I can see that it is set to 5000
, as indicated by the error message.
By increasing this value, for example to 10000
, I can see that the proof is sent successfully:
[12:15:09] Sending proof for delivery **********
[12:15:19] Proof for delivery ********** sent
So I'd like to ask if it's possible to increase this value or make it configurable, for example with a parameter when creating the connection object, so that anyone can customize it according to their needs.
Thanks in advance.
Hi Team,
I'm facing an issue calling anonymous methods. Normal behavior through SOAP call would allow for an anonymous method to be called without any authentification.
Through the SDK though, this behavior is not possible through anonymous logon. An "Access Forbidden" error is sent when making the call since the method "xtk:persist#GetEntityIfMoreRecent" is being called before every request which requires authentication.
Is it possible to fix this issue if it is within the intended purposes of the anonymous logon, otherwise is there a turnaround ?
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.