Code Monkey home page Code Monkey logo

acc-js-sdk's People

Contributors

aibisevic avatar blfakir avatar dhltiti avatar gauravmakkar avatar hayveno avatar infinity1013 avatar junliadobe avatar kvikram1988 avatar mkiki avatar mukulgupta21 avatar obriard avatar pk28yadav avatar rahuljain936 avatar sewagner-adobe avatar sewagneradobe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

acc-js-sdk's Issues

Add missing hasPackage function

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:

  • hasPackage(packageId)
  • hasPackage(namespace, name)

Element of type memo is coming as empty Object when there is not value in it.

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.

Error with package dependency

Description

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

Expected Behaviour

Application building successfully

Actual Behaviour

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"
    ]
}

Platform and Version

"aws-cdk-lib": "2.35.0"
"@adobe/acc-js-sdk": 1.1.17

Sample Code that illustrates the problem

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

Wrong charset while updating html source

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);

Expected Behaviour

I expect the content of my html file to be correctly uploaded and visible inside the Adobe Campaign delivery.

Actual Behaviour

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):
image

What I see in Adobe Campaign after running the update query:
image

Platform and Version

SDK 1.1.0

Further information

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:
image
in the soap.js file, the upload was successful:
image

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.

Workflow PostEvent method not working

Expected Behaviour

PostEvent from xtk:workflow to send an event to a signal in a workflow

Actual Behaviour

The SDK throws an error because it's expecting the parameters to be inside a variables entity.

Reproduce Scenario (including but not limited to)

Just use the SDK and call PostEvent method:
await NLWS.xtkWorkflow.postEvent(name, 'signal', '', variables, false);

Steps to Reproduce

Platform and Version

Sample Code that illustrates the problem

Please see above

Logs taken while reproducing problem

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?

Query in select mode should always return an array, even if result is empty or one one row

Expected Behaviour

Using a QueryDef in select mode should always return an array.

Actual Behaviour

When the result is exactly one record, the first element of the array is returned rather than an array containing the element

Steps to Reproduce

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' } ] }

Platform and Version

Version 0.1.0

SDK should support abortable requests

Currently there is no way to abort a request from the client. For example:

  1. UI makes requests to fetch the data
  2. While the call is in progress, the UI component unmounts/redirects to some other component.
  3. While un-mounting, the UI should be able to cancel pending HTTP calls to avoid unnecessary attempts to re-render.

Expected Behaviour

Actual Behaviour

Reproduce Scenario (including but not limited to)

Steps to Reproduce

Platform and Version

Sample Code that illustrates the problem

Logs taken while reproducing problem

Timeout too short when sending a proof

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.

Failing to call anonymous methods

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.