@adobe/acc-js-sdk 1.1.9 → 1.1.11
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/README.md +8 -1960
- package/docs/404.html +11 -0
- package/docs/Gemfile +35 -0
- package/docs/Gemfile.lock +270 -0
- package/docs/_config.yml +55 -0
- package/docs/_data/navigation.yml +119 -0
- package/docs/_includes/navigation.html +33 -0
- package/docs/_layouts/default.html +21 -0
- package/docs/_layouts/home.html +4 -0
- package/docs/_layouts/page.html +5 -0
- package/docs/_layouts/post.html +7 -0
- package/docs/_posts/2022-10-14-welcome.html +149 -0
- package/docs/application.html +366 -0
- package/docs/architecture.html +24 -0
- package/docs/assets/css/styles.css +362 -0
- package/docs/assets/images/adobe-campaign-256.png +0 -0
- package/docs/assets/images/architecture.png +0 -0
- package/docs/assets/images/ref.svg +6 -0
- package/docs/badgerFish.html +14 -0
- package/docs/bestPractices.html +189 -0
- package/docs/blog.html +18 -0
- package/docs/buildAndRun.html +96 -0
- package/docs/caches.html +68 -0
- package/docs/changeLog.html +256 -0
- package/docs/checkList.html +168 -0
- package/docs/concepts.html +130 -0
- package/docs/connecting.html +210 -0
- package/docs/connectionParameters.html +109 -0
- package/docs/contribute.html +54 -0
- package/docs/dataTypes.html +124 -0
- package/docs/differences.html +4 -0
- package/docs/documentation.html +21 -0
- package/docs/domHelper.html +88 -0
- package/docs/dynamicInvoke.html +36 -0
- package/docs/entityAccessor.html +22 -0
- package/docs/errors.html +47 -0
- package/docs/escaping.html +76 -0
- package/docs/favicon.png +0 -0
- package/docs/healthCheck.html +66 -0
- package/docs/httpHeaders.html +78 -0
- package/docs/index.html +64 -0
- package/docs/installation.html +34 -0
- package/docs/license.html +208 -0
- package/docs/messageCenter.html +80 -0
- package/docs/methodLevelRepresentation.html +12 -0
- package/docs/midSourcing.html +19 -0
- package/docs/observability.html +169 -0
- package/docs/passwords.html +27 -0
- package/docs/profiles.html +103 -0
- package/docs/pushDown.html +13 -0
- package/docs/quickstart.html +69 -0
- package/docs/release.html +52 -0
- package/docs/samples.html +82 -0
- package/docs/simpleJson.html +88 -0
- package/docs/soapAPIs.html +234 -0
- package/docs/timeouts.html +23 -0
- package/docs/transport.html +45 -0
- package/docs/troubleshooting.html +17 -0
- package/docs/writeDoc.html +208 -0
- package/docs/xml2json.html +96 -0
- package/docs/xtkCaster.html +67 -0
- package/docs/xtkInterface.html +20 -0
- package/docs/xtkOption.html +54 -0
- package/docs/xtkPackage.html +16 -0
- package/docs/xtkPersist.html +213 -0
- package/docs/xtkQueryDef.html +245 -0
- package/docs/xtkSchema.html +39 -0
- package/docs/xtkSession.html +29 -0
- package/docs/xtkWorkflow.html +28 -0
- package/docs/xtkWrite.html +51 -0
- package/package-lock.json +843 -5820
- package/package.json +1 -1
- package/samples/005 - basics - persist.js +160 -0
- package/src/application.js +5 -0
- package/src/campaign.js +1 -1
- package/src/client.js +68 -25
- package/src/methodCache.js +24 -13
- package/src/soap.js +16 -4
- package/src/xtkCaster.js +61 -3
- package/test/application.test.js +23 -0
- package/test/caches.test.js +1 -1
- package/test/client.test.js +118 -3
- package/test/mock.js +41 -4
- package/test/soap.test.js +13 -0
- package/test/xtkCaster.test.js +62 -0
- package/test/xtkPersist.test.js +97 -0
- package/test/xtkProxy.test.js +81 -0
- package/CHANGELOG.md +0 -245
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Connecting to Campaign
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<p>In order to call any Campaign API, you need to create a <b>client</b> object first using the <b>sdk.init</b> function. You pass it the Campaign URL, as well as your credentials.</p>
|
|
7
|
+
|
|
8
|
+
<pre class="code">
|
|
9
|
+
const sdk = require('@adobe/acc-js-sdk');
|
|
10
|
+
const connectionParameters = sdk.ConnectionParameters.ofUserAndPassword(
|
|
11
|
+
"https://myInstance.campaign.adobe.com",
|
|
12
|
+
"admin", "admin");
|
|
13
|
+
const client = await sdk.init(connectionParameters);
|
|
14
|
+
</pre>
|
|
15
|
+
|
|
16
|
+
<p>Additional parameters can be passed when creating a connection. The connection parameters are described <a href="{{ site.baseurl }}/connectionParameters.html">here.</a></p>
|
|
17
|
+
<pre class="code">
|
|
18
|
+
const connectionParameters = sdk.ConnectionParameters.ofUserAndPassword(
|
|
19
|
+
"https://myInstance.campaign.adobe.com",
|
|
20
|
+
"admin", "admin",
|
|
21
|
+
{ representation: "xml", rememberMe: true });
|
|
22
|
+
</pre>
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
<h1>Logging on</h1>
|
|
26
|
+
<p>
|
|
27
|
+
After a <b>client</b> object has been created, it's time to log on to Campaign.
|
|
28
|
+
The <b>sdk.init</b> call will not actually connect to Campaign, you can call the <b>logon</b> method for this. Logon does not need to be called when using session-token authentication or anonymous authentication.
|
|
29
|
+
</p>
|
|
30
|
+
|
|
31
|
+
<pre class="code">
|
|
32
|
+
await client.logon();
|
|
33
|
+
</pre>
|
|
34
|
+
|
|
35
|
+
<p>It's also best practice to logoff when finished</p>
|
|
36
|
+
|
|
37
|
+
<pre class="code">
|
|
38
|
+
await client.logoff();
|
|
39
|
+
</pre>
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
<h1>User info and Server info</h1>
|
|
44
|
+
|
|
45
|
+
<p>
|
|
46
|
+
upon return, the <b>logon</b> function returns a lot of useful information
|
|
47
|
+
</p>
|
|
48
|
+
<ul>
|
|
49
|
+
<li>Informations about the server, such as the build number, etc.</li>
|
|
50
|
+
<li>The list of available packages</li>
|
|
51
|
+
<li>Informations about the connected user, and it's privileges</li>
|
|
52
|
+
</ul>
|
|
53
|
+
|
|
54
|
+
<p>T
|
|
55
|
+
he most convenient way to access this information is by using the <a href="{{ site.baseurl }}/application.html">Application object</a>, but you can
|
|
56
|
+
also use the <b>client.getSessionInfo().serverInfo</b> and <b>client.getSessionInfo().sessionInfo</b> calls.
|
|
57
|
+
</p>
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
<h1>Credentials</h1>
|
|
62
|
+
|
|
63
|
+
<p>
|
|
64
|
+
There are several methods of the <b>sdk.ConnectionParameters</b> depending on the type of authentication you want to use. They are
|
|
65
|
+
described below.
|
|
66
|
+
</p>>
|
|
67
|
+
|
|
68
|
+
<h2>Login with user and password</h2>
|
|
69
|
+
<p>This is the most common method to log in to Campaign. User the <b>ofUserAndPassword</b> function and pass it the user name and password</p>
|
|
70
|
+
<pre class="code">
|
|
71
|
+
const connectionParameters = sdk.ConnectionParameters.ofUserAndPassword(
|
|
72
|
+
"https://myInstance.campaign.adobe.com",
|
|
73
|
+
"admin", "admin");
|
|
74
|
+
</pre>
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
<h2>Login with IMS access token</h2>
|
|
78
|
+
<p>The SDK supports IMS access token of an IMS user with the <b>ofBearerToken</b> function. Pass it a bearer token.</p>
|
|
79
|
+
<pre class="code">
|
|
80
|
+
const connectionParameters = sdk.ConnectionParameters.ofBearerToken(
|
|
81
|
+
"https://myInstance.campaign.adobe.com",
|
|
82
|
+
"ims_bearer_token");
|
|
83
|
+
</pre>
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
<h2>Login with Session token</h2>
|
|
87
|
+
<p>
|
|
88
|
+
Campaign supports authenticating with a session token in some contexts. This is usually used for Message Center API calls (see the <a href="{{ site.baseurl }}/messageCenter.html">Message Center</a> section).
|
|
89
|
+
|
|
90
|
+
In the following example, the session token is a string composed of the user name, a slash sign, and the password (often empty)
|
|
91
|
+
|
|
92
|
+
<pre class="code">
|
|
93
|
+
const connectionParameters = sdk.ConnectionParameters.ofSessionToken(url, "mc/mc");
|
|
94
|
+
</pre>
|
|
95
|
+
<p>
|
|
96
|
+
Note that this authentication mode is very specific and does not actually performs a Logon: the session token will be passed to each API calls as-is (with an empty security token) and requires proper setup of the security zones for access to be granted.
|
|
97
|
+
</p>
|
|
98
|
+
<p>
|
|
99
|
+
Another consequence is that the Application object will not be available (client.application will be undefined) when using this authentication mode. The reason is that the application object requires an actual login call to be made to be populated.
|
|
100
|
+
</p>
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
<h2>Anonymous logon</h2>
|
|
106
|
+
<p>
|
|
107
|
+
Several Campaign APIs are anonymous, i.e. do not require to actually logon to be used. For instance the <b>/r/test</b> API is anonymous. The SDK supports anonymous APIs but still need to be initialized with anonymous credentials as follows. Of course, anonymous APIs also work if you are logged on with a different method.
|
|
108
|
+
</p>
|
|
109
|
+
|
|
110
|
+
<pre class="code">
|
|
111
|
+
const connectionParameters = sdk.ConnectionParameters.ofAnonymousUser(url);
|
|
112
|
+
const client = await sdk.init(connectionParameters);
|
|
113
|
+
</pre>
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
<h2>Logon with Security token</h2>
|
|
120
|
+
<p>
|
|
121
|
+
If you want to use the SDK client-side in a web page returned by Campaign, you cannot use the previous authentication functions because you do not know the user and password, and because you cannot read the session token cookie.
|
|
122
|
+
</p>
|
|
123
|
+
<p>
|
|
124
|
+
For this scenario, the `ofSecurityToken` function can be used. Pass it a security token (usually available as document.__securitytoken), and the SDK will let the browser handle the session token (cookie) for you.
|
|
125
|
+
</p>
|
|
126
|
+
|
|
127
|
+
<pre class="code">
|
|
128
|
+
<script src="acc-sdk.js"></script>
|
|
129
|
+
<script>
|
|
130
|
+
(async () => {
|
|
131
|
+
try {
|
|
132
|
+
const sdk = document.accSDK;
|
|
133
|
+
var securityToken = "@UyAN...";
|
|
134
|
+
const connectionParameters = sdk.ConnectionParameters.ofSecurityToken(url, securityToken);
|
|
135
|
+
const client = await sdk.init(connectionParameters);
|
|
136
|
+
await client.logon();
|
|
137
|
+
const option = await client.getOption("XtkDatabaseId");
|
|
138
|
+
console.log(option);
|
|
139
|
+
} catch(ex) {
|
|
140
|
+
console.error(ex);
|
|
141
|
+
}
|
|
142
|
+
})();
|
|
143
|
+
</script>
|
|
144
|
+
</body>
|
|
145
|
+
</html>
|
|
146
|
+
</pre>
|
|
147
|
+
<p>
|
|
148
|
+
Note: if the HTML page is served by the Campaign server (which is normally the case in this situation), you can pass an empty url to the `ofSecurityToken` API call.
|
|
149
|
+
</p>
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
<h2>Login with IMS Service Tokens</h2>
|
|
156
|
+
<p>
|
|
157
|
+
The SDK also supports IMS service token with the <b>ofUserAndServiceToken</b> function. Pass it a user to impersonate and the IMS service token.
|
|
158
|
+
</p>
|
|
159
|
+
<p>
|
|
160
|
+
In that context, the IMS service token grants admin-level privileges, and the user indicates which Campaign user to impersonate.
|
|
161
|
+
</p>
|
|
162
|
+
|
|
163
|
+
<pre class="code">
|
|
164
|
+
const connectionParameters = sdk.ConnectionParameters.ofUserAndPassword(
|
|
165
|
+
"https://myInstance.campaign.adobe.com",
|
|
166
|
+
"admin", "==ims_service_token_here");
|
|
167
|
+
</pre>
|
|
168
|
+
|
|
169
|
+
<p class="warning">This ability is reserved for Adobe services only.</p>
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
<h1>Refreshing connection tokens</h1>
|
|
176
|
+
|
|
177
|
+
<p>
|
|
178
|
+
The <b>refreshClient</b> is an async callback function with the SDK client as parameter, it is called when the ACC session is expired.
|
|
179
|
+
The callback must refresh the client session and return it. if a SOAP query fails with session expiration error then it will be retried when the callback is defined.
|
|
180
|
+
</p>
|
|
181
|
+
<pre class="code">
|
|
182
|
+
const connectionParameters = sdk.ConnectionParameters.ofUserAndPassword(
|
|
183
|
+
url, "admin", "admin",
|
|
184
|
+
{ refreshClient: async (client) => {
|
|
185
|
+
await client.logon();
|
|
186
|
+
return client;
|
|
187
|
+
}});
|
|
188
|
+
</pre>
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
<h1>IP Whitelisting</h1>
|
|
192
|
+
<p>
|
|
193
|
+
Campaign includes an IP whitelisting component which prevents connections from unauthorized IP addresses. This is a common source of authentication errors.
|
|
194
|
+
</p>
|
|
195
|
+
<p>
|
|
196
|
+
A node application using the SDK must be whitelisted to be able to access Campaign. The SDK <b>sdk.ip</b> function is a helper function that can help you find the IP or IPs which need to be whitelisted.
|
|
197
|
+
</p>
|
|
198
|
+
<p>
|
|
199
|
+
This API is only meant for troubleshooting purposes and uses the <b>https://api.db-ip.com/v2/free/self</b> service.
|
|
200
|
+
</p>
|
|
201
|
+
|
|
202
|
+
<pre class="code">
|
|
203
|
+
const ip = await sdk.ip();
|
|
204
|
+
</pre>
|
|
205
|
+
<p>
|
|
206
|
+
Will return something like
|
|
207
|
+
</p>
|
|
208
|
+
<pre class="code">
|
|
209
|
+
{ "ipAddress":"AAA.BBB.CCC.DDD","continentCode":"EU","continentName":"Europe","countryCode":"FR","countryName":"France","stateProv":"Centre-Val de Loire","city":"Bourges" }
|
|
210
|
+
</pre>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Connection Parameters
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<p>Connection parameters can also be passed an option object when creating a <b>client</b></p>
|
|
7
|
+
|
|
8
|
+
<pre class="code">
|
|
9
|
+
const connectionParameters = sdk.ConnectionParameters.ofUserAndPassword(
|
|
10
|
+
"https://myInstance.campaign.adobe.com",
|
|
11
|
+
"admin", "admin",
|
|
12
|
+
{ representation: "xml", rememberMe: true });
|
|
13
|
+
</pre>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<p>This table shows the various available properties and their values</p>
|
|
17
|
+
|
|
18
|
+
<table>
|
|
19
|
+
<thead>
|
|
20
|
+
<tr>
|
|
21
|
+
<th>Property</th>
|
|
22
|
+
<th>Default</th>
|
|
23
|
+
<th>Description</th>
|
|
24
|
+
</tr>
|
|
25
|
+
</thead>
|
|
26
|
+
<tbody>
|
|
27
|
+
<tr>
|
|
28
|
+
<td>representation</td>
|
|
29
|
+
<td>"SimpleJson"</td>
|
|
30
|
+
<td> See below. Will determine if the SDK works with xml of json object. Default is JSON</td>
|
|
31
|
+
</tr>
|
|
32
|
+
<tr>
|
|
33
|
+
<td>rememberMe</td>
|
|
34
|
+
<td>false</td>
|
|
35
|
+
<td> The Campaign `rememberMe` attribute which can be used to extend the lifetime of session tokens</td>
|
|
36
|
+
</tr>
|
|
37
|
+
<tr>
|
|
38
|
+
<td>entityCacheTTL</td>
|
|
39
|
+
<td>300000</td>
|
|
40
|
+
<td> The TTL (in milliseconds) for the xtk entity cache</td>
|
|
41
|
+
</tr>
|
|
42
|
+
<tr>
|
|
43
|
+
<td>methodCacheTTL</td>
|
|
44
|
+
<td>300000</td>
|
|
45
|
+
<td> The TTL (in milliseconds) for the xtk method cache</td>
|
|
46
|
+
</tr>
|
|
47
|
+
<tr>
|
|
48
|
+
<td>optionCacheTTL</td>
|
|
49
|
+
<td>300000</td>
|
|
50
|
+
<td> The TTL (in milliseconds) for the xtk option cache</td>
|
|
51
|
+
</tr>
|
|
52
|
+
<tr>
|
|
53
|
+
<td>traceAPICalls</td>
|
|
54
|
+
<td>false</td>
|
|
55
|
+
<td> Activates tracing of API calls or not</td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr>
|
|
58
|
+
<td>transport</td>
|
|
59
|
+
<td>axios</td>
|
|
60
|
+
<td>Overrides the transport layer</td>
|
|
61
|
+
</tr>
|
|
62
|
+
<tr>
|
|
63
|
+
<td>noStorage</td>
|
|
64
|
+
<td>false</td>
|
|
65
|
+
<td>De-activate using of local storage</td>
|
|
66
|
+
</tr>
|
|
67
|
+
<tr>
|
|
68
|
+
<td>storage</td>
|
|
69
|
+
<td>localStorage</td>
|
|
70
|
+
<td>Overrides the local storage for caches</td>
|
|
71
|
+
</tr>
|
|
72
|
+
<tr>
|
|
73
|
+
<td>refreshClient</td>
|
|
74
|
+
<td>undefined</td>
|
|
75
|
+
<td>Async callback to run when the session token is expired</td>
|
|
76
|
+
</tr>
|
|
77
|
+
<tr>
|
|
78
|
+
<td>charset</td>
|
|
79
|
+
<td>UTF-8</td>
|
|
80
|
+
<td>The charset encoding used for http requests. In version 1.1.1 and above, the default will be UTF-8. It's possible to override (including setting an empty character set) with this option.</td>
|
|
81
|
+
</tr>
|
|
82
|
+
<tr>
|
|
83
|
+
<td>extraHttpHeaders</td>
|
|
84
|
+
<td>[string]:string</td>
|
|
85
|
+
<td>An optional dictionary (key/value pairs) of extra HTTP headers to pass to all API calls.</td>
|
|
86
|
+
</tr>
|
|
87
|
+
<tr>
|
|
88
|
+
<td>clientApp</td>
|
|
89
|
+
<td>string</td>
|
|
90
|
+
<td>An optional string describing the name and version of the SDK client application. It will be passed to the server in the ACC-SDK-Client-App HTTP header</td>
|
|
91
|
+
</tr>
|
|
92
|
+
<tr>
|
|
93
|
+
<td>noSDKHeaders</td>
|
|
94
|
+
<td>boolean</td>
|
|
95
|
+
<td>Can be set to disable passing ACC-SDK-* HTTP headers to the server</td>
|
|
96
|
+
</tr>
|
|
97
|
+
<tr>
|
|
98
|
+
<td>noMethodInURL</td>
|
|
99
|
+
<td>boolean</td>
|
|
100
|
+
<td>Can be set to true to remove the method name from the URL</td>
|
|
101
|
+
</tr>
|
|
102
|
+
<tr>
|
|
103
|
+
<td>timeout</td>
|
|
104
|
+
<td>number</td>
|
|
105
|
+
<td>Can be used to set the APIs call timeout (in ms)</td>
|
|
106
|
+
</tr>
|
|
107
|
+
</tbody>
|
|
108
|
+
</table>
|
|
109
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Contributing
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<p>Thanks for choosing to contribute!</p>
|
|
7
|
+
|
|
8
|
+
<p>The following are a set of guidelines to follow when contributing to this project.</p>
|
|
9
|
+
|
|
10
|
+
<h2>Code Of Conduct</h2>
|
|
11
|
+
|
|
12
|
+
<p>
|
|
13
|
+
This project adheres to the Adobe <a href="https://github.com/adobe/acc-js-sdk/blob/master/CODE_OF_CONDUCT.md">code of conduct</a>. By participating,
|
|
14
|
+
you are expected to uphold this code. Please report unacceptable behavior to
|
|
15
|
+
<a href="mailto:Grp-opensourceoffice@adobe.com">Grp-opensourceoffice@adobe.com</a>.
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<h2>Have A Question?</h2>
|
|
19
|
+
|
|
20
|
+
<p>Start by filing an issue. The existing committers on this project work to reach
|
|
21
|
+
consensus around project direction and issue solutions within issue threads
|
|
22
|
+
(when appropriate).</p>
|
|
23
|
+
|
|
24
|
+
<h2>Contributor License Agreement</h2>
|
|
25
|
+
|
|
26
|
+
<p>All third-party contributions to this project must be accompanied by a signed contributor
|
|
27
|
+
license agreement. This gives Adobe permission to redistribute your contributions
|
|
28
|
+
as part of the project. <a href="https://opensource.adobe.com/cla.html">Sign our CLA</a>. You
|
|
29
|
+
only need to submit an Adobe CLA one time, so if you have submitted one previously,
|
|
30
|
+
you are good to go!</p>
|
|
31
|
+
|
|
32
|
+
<h2>Code Reviews</h2>
|
|
33
|
+
|
|
34
|
+
<p>All submissions should come in the form of pull requests and need to be reviewed
|
|
35
|
+
by project committers. Read <a href="https://help.github.com/articles/about-pull-requests/">GitHub's pull request documentation</a>
|
|
36
|
+
for more information on sending pull requests.</p>
|
|
37
|
+
|
|
38
|
+
<p>Lastly, please follow the <a href="https://github.com/adobe/acc-js-sdk/blob/master/.github/PULL_REQUEST_TEMPLATE.md">pull request template</a> when
|
|
39
|
+
submitting a pull request!</p>
|
|
40
|
+
|
|
41
|
+
<h2>From Contributor To Committer</h2>
|
|
42
|
+
|
|
43
|
+
<p>We love contributions from our community! If you'd like to go a step beyond contributor
|
|
44
|
+
and become a committer with full write access and a say in the project, you must
|
|
45
|
+
be invited to the project. The existing committers employ an internal nomination
|
|
46
|
+
process that must reach lazy consensus (silence is approval) before invitations
|
|
47
|
+
are issued. If you feel you are qualified and want to get more deeply involved,
|
|
48
|
+
feel free to reach out to existing committers to have a conversation about that.</p>
|
|
49
|
+
|
|
50
|
+
<h2>Security Issues</h2>
|
|
51
|
+
|
|
52
|
+
<p>
|
|
53
|
+
Security issues shouldn't be reported on this issue tracker. Instead, <a href="https://helpx.adobe.com/security/alertus.html">file an issue to our security experts</a>.
|
|
54
|
+
</p>
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Data Types
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<p>Campaign uses a typed system with some specificities:</p>
|
|
7
|
+
<ul>
|
|
8
|
+
<li>for strings, "", null, or undefined are equivalent</li>
|
|
9
|
+
<li>numerical values cannot be null or undefined (0 is used instead)</li>
|
|
10
|
+
<li>boolean values cannot be null or undefined (false is used instead)</li>
|
|
11
|
+
<li>conversion between types is automatic based on their ISO representation</li>
|
|
12
|
+
</ul>
|
|
13
|
+
|
|
14
|
+
<p></p>
|
|
15
|
+
<table>
|
|
16
|
+
<thead>
|
|
17
|
+
<tr>
|
|
18
|
+
<th>XTK type</th>
|
|
19
|
+
<th></th>
|
|
20
|
+
<th>JS type</th>
|
|
21
|
+
<th>Comment / Description</th>
|
|
22
|
+
</tr>
|
|
23
|
+
</thead>
|
|
24
|
+
<tbody>
|
|
25
|
+
<tr>
|
|
26
|
+
<td>string</td>
|
|
27
|
+
<td>6</td>
|
|
28
|
+
<td>string</td>
|
|
29
|
+
<td>never null, defaults to ""</td>
|
|
30
|
+
</tr>
|
|
31
|
+
<tr>
|
|
32
|
+
<td>memo</td>
|
|
33
|
+
<td>12</td>
|
|
34
|
+
<td>string</td>
|
|
35
|
+
<td></td>
|
|
36
|
+
</tr>
|
|
37
|
+
<tr>
|
|
38
|
+
<td>CDATA</td>
|
|
39
|
+
<td>13</td>
|
|
40
|
+
<td>string</td>
|
|
41
|
+
<td></td>
|
|
42
|
+
</tr>
|
|
43
|
+
<tr>
|
|
44
|
+
<td>byte</td>
|
|
45
|
+
<td>1</td>
|
|
46
|
+
<td>number</td>
|
|
47
|
+
<td>signed integer in the [-128, 128[ range. Never null, defaults to 0</td>
|
|
48
|
+
</tr>
|
|
49
|
+
<tr>
|
|
50
|
+
<td>short</td>
|
|
51
|
+
<td>2</td>
|
|
52
|
+
<td>number</td>
|
|
53
|
+
<td>signed 16 bits integer in the [-32768, 32768[ range. Never null, defaults to 0</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr>
|
|
56
|
+
<td>long</td>
|
|
57
|
+
<td>3</td>
|
|
58
|
+
<td>number</td>
|
|
59
|
+
<td>signed 32 bits integer. Never null, defaults to 0</td>
|
|
60
|
+
</tr>
|
|
61
|
+
<tr>
|
|
62
|
+
<td>int64</td>
|
|
63
|
+
<td></td>
|
|
64
|
+
<td>string</td>
|
|
65
|
+
<td>signed 64 bits integer. As JavaScript handles all numbers as doubles, it's not possible to properly represent an int64 as a number, and it's therefore represented as a string.</td>
|
|
66
|
+
</tr>
|
|
67
|
+
<tr>
|
|
68
|
+
<td>float</td>
|
|
69
|
+
<td>4</td>
|
|
70
|
+
<td>number</td>
|
|
71
|
+
<td>single-percision numeric value. Never null, defaults to 0</td>
|
|
72
|
+
</tr>
|
|
73
|
+
<tr>
|
|
74
|
+
<td>double</td>
|
|
75
|
+
<td>5</td>
|
|
76
|
+
<td>number</td>
|
|
77
|
+
<td>double-percision numeric value. Never null, defaults to 0</td>
|
|
78
|
+
</tr>
|
|
79
|
+
<tr>
|
|
80
|
+
<td>datetime</td>
|
|
81
|
+
<td>7</td>
|
|
82
|
+
<td>Date</td>
|
|
83
|
+
<td>UTC timestamp with second precision. Can be null</td>
|
|
84
|
+
</tr>
|
|
85
|
+
<tr>
|
|
86
|
+
<td>datetimetz</td>
|
|
87
|
+
<td></td>
|
|
88
|
+
<td></td>
|
|
89
|
+
<td></td>
|
|
90
|
+
</tr>
|
|
91
|
+
<tr>
|
|
92
|
+
<td>datetimenotz</td>
|
|
93
|
+
<td></td>
|
|
94
|
+
<td></td>
|
|
95
|
+
<td></td>
|
|
96
|
+
</tr>
|
|
97
|
+
<tr>
|
|
98
|
+
<td>date</td>
|
|
99
|
+
<td>10</td>
|
|
100
|
+
<td>Date</td>
|
|
101
|
+
<td>UTC timestamp with day precision. Can be null</td>
|
|
102
|
+
</tr>
|
|
103
|
+
<tr>
|
|
104
|
+
<td>boolean</td>
|
|
105
|
+
<td>15</td>
|
|
106
|
+
<td>boolean</td>
|
|
107
|
+
<td>boolean value, defaultint to false. Cannot be null</td>
|
|
108
|
+
</tr>
|
|
109
|
+
<tr>
|
|
110
|
+
<td>timespan</td>
|
|
111
|
+
<td></td>
|
|
112
|
+
<td></td>
|
|
113
|
+
<td></td>
|
|
114
|
+
</tr>
|
|
115
|
+
<tr>
|
|
116
|
+
<td>primarykey</td>
|
|
117
|
+
<td></td>
|
|
118
|
+
<td>string</td>
|
|
119
|
+
<td>A primary key is serialized with format <schemaId>|<keyField>[|<keyField>[...]]</td>
|
|
120
|
+
</tr>
|
|
121
|
+
</tbody>
|
|
122
|
+
</table>
|
|
123
|
+
|
|
124
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Documentation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<p>
|
|
7
|
+
This guide is divided in 3 sections
|
|
8
|
+
</p>
|
|
9
|
+
<ul>
|
|
10
|
+
<li>The <b>SDK documentation</b></li>
|
|
11
|
+
<li>The <b>Campaign documentation</b> which is independ from this SDK</li>
|
|
12
|
+
<li>And <b>Advanced topics</b> which provides more insights on the internals of the SDK</li>
|
|
13
|
+
</ul>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<p>
|
|
17
|
+
Campaign API is vast and before you start it's good to make sure you understand some of the
|
|
18
|
+
concepts of Campaign or the SDK.
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p class="ref">Start with the <a href="{{ site.baseurl }}/concepts.html">concepts</a> behind Campaign and the SDK.</p>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Working with XML, DOM Helper
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<p>DOM manipulation is sometimes a bit painful. The <b>DomUtil</b> helper provides a few convenience functions</p>
|
|
7
|
+
|
|
8
|
+
<pre class="code">
|
|
9
|
+
const DomUtil = sdk.DomUtil;
|
|
10
|
+
</pre>
|
|
11
|
+
|
|
12
|
+
<p>or</p>
|
|
13
|
+
|
|
14
|
+
<pre class="code">
|
|
15
|
+
const DomUtil = client.DomUtil;
|
|
16
|
+
</pre>
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<p>Create DOM from XML string:</p>
|
|
20
|
+
<pre class="code">
|
|
21
|
+
const doc = DomUtil.parse(`<root>
|
|
22
|
+
<one/>
|
|
23
|
+
</root>`);
|
|
24
|
+
</pre>
|
|
25
|
+
|
|
26
|
+
<p>Writes a DOM document or element as a string:</p>
|
|
27
|
+
<pre class="code">
|
|
28
|
+
const s = DomUtil.toXMLString(docOrElement);
|
|
29
|
+
</pre>
|
|
30
|
+
|
|
31
|
+
<p>Creates a new document</p>
|
|
32
|
+
<pre class="code">
|
|
33
|
+
const queryDoc = DomUtil.newDocument("queryDef");
|
|
34
|
+
</pre>
|
|
35
|
+
|
|
36
|
+
<p>Escape text value</p>
|
|
37
|
+
<pre class="code">
|
|
38
|
+
const escaped = DomUtil.escapeXmlString(value);
|
|
39
|
+
</pre>
|
|
40
|
+
|
|
41
|
+
<p>Find element by name (finds the first element with given tag). This is a very common operation when manipulating Campaign XML documents</p>
|
|
42
|
+
<pre class="code">
|
|
43
|
+
const el = DomUtil.findElement(parentElement, elementName, shouldThrow);
|
|
44
|
+
</pre>
|
|
45
|
+
|
|
46
|
+
<p>Get the text value of an elemennt. This will accomodate text elements, cdata elements, as well has having multiple text child element (which is ususally not the case in Campaign)</p>
|
|
47
|
+
<pre class="code">
|
|
48
|
+
const text = DomUtil.elementValue(element);
|
|
49
|
+
</pre>
|
|
50
|
+
|
|
51
|
+
<p>Iterates over child elements</p>
|
|
52
|
+
<pre class="code">
|
|
53
|
+
var child = DomUtil.getFirstChildElement(parentElement);
|
|
54
|
+
while (child) {
|
|
55
|
+
...
|
|
56
|
+
child = DomUtil.getNextSiblingElement(child);
|
|
57
|
+
}
|
|
58
|
+
</pre>
|
|
59
|
+
|
|
60
|
+
<p>Iterates over child elements of a given type</p>
|
|
61
|
+
<pre class="code">
|
|
62
|
+
var methodChild = DomUtil.getFirstChildElement(parentElement, "method");
|
|
63
|
+
while (methodChild) {
|
|
64
|
+
...
|
|
65
|
+
methodChild = DomUtil.getNextSiblingElement(methodChild, "method");
|
|
66
|
+
}
|
|
67
|
+
</pre>
|
|
68
|
+
|
|
69
|
+
<p>Get typed attribute values, with automatic conversion to the corresponding xtk type, and handling default values</p>
|
|
70
|
+
<pre class="code">
|
|
71
|
+
const stringValue = DomUtil.getAttributeAsString(element, attributeName)
|
|
72
|
+
const byteValue = DomUtil.getAttributeAsByte(element, attributeName)
|
|
73
|
+
const booleanValue = DomUtil.getAttributeAsBoolean(element, attributeName)
|
|
74
|
+
const shortValue = DomUtil.getAttributeAsShort(element, attributeName)
|
|
75
|
+
const longValue = DomUtil.getAttributeAsLong(element, attributeName)
|
|
76
|
+
</pre>
|
|
77
|
+
|
|
78
|
+
<p>JSON to XML conversion (SimpleJson by default)</p>
|
|
79
|
+
<pre class="code">
|
|
80
|
+
const document = DomUtil.fromJSON(json);
|
|
81
|
+
const json = DomUtil.toJSON(documentOrElement);
|
|
82
|
+
</pre>
|
|
83
|
+
|
|
84
|
+
<p>BadgerFish can be forced as well</p>
|
|
85
|
+
<pre class="code">
|
|
86
|
+
const document = DomUtil.fromJSON(json, "BadgerFish");
|
|
87
|
+
const json = DomUtil.toJSON(documentOrElement, "BadgerFish");
|
|
88
|
+
</pre>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: Dynamic Invocation of SOAP calls
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<p>Soap calls can be invoked dynamically as follows</p>
|
|
7
|
+
|
|
8
|
+
<pre class="code">
|
|
9
|
+
const namespace = client.NLWS["xtkSession"];
|
|
10
|
+
const method = namespace["getOption"];
|
|
11
|
+
const result = await method.call(namespace, parameters);
|
|
12
|
+
</pre>
|
|
13
|
+
|
|
14
|
+
<p>where parameters is the list of parameters to the SOAP call.</p>
|
|
15
|
+
<p>Parameters can be a function which can compute and return the list of parameters as the function is being called:</p>
|
|
16
|
+
|
|
17
|
+
<pre class="code">
|
|
18
|
+
const result = await method.call(namespace, (method, callContext) => {
|
|
19
|
+
return parameters;
|
|
20
|
+
});
|
|
21
|
+
</pre>
|
|
22
|
+
<p>The <b>method</b> parameter is the XML definition of the SOAP method call. The <b>callContext</b> is an object which contains the following attributes:</p>
|
|
23
|
+
|
|
24
|
+
<ul>
|
|
25
|
+
<li><b>schemaId</b> is the id of the schema containing the SOAP method
|
|
26
|
+
<li><b>namespace</b> is the call namespace
|
|
27
|
+
<li><b>object</b> is only used for non-static call and contains the "this" of the call.
|
|
28
|
+
|
|
29
|
+
</ul>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<p>
|
|
33
|
+
In <a href="{{ site.baseurl }}/sdk/update/2022/10/14/welcome.html">this blog post</a>, you'll find an advanced example of how to use a
|
|
34
|
+
dynamic SOAP invocation to implement a REST proxy to the ACC API using the SDK. The example shows how to pass query parameters or body
|
|
35
|
+
to the SOAP call, and how to collect the names of the return value parameters to format the result as a proper JSON object.
|
|
36
|
+
</p>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: page
|
|
3
|
+
title: The Entity Accessor
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
<p>An <b>EntityAccessor</b> provides a simple interface to access entity objects regardless of their representation. For instance, a query result may be a DOM Element, or a object literal, or a BadgerFish objet. Accessing attribute values and sub elements requires to know which representation is used and which representation specific API to call. For instance, to get the "name" attribute of an entity, you'll write:</p>
|
|
8
|
+
|
|
9
|
+
<ul>
|
|
10
|
+
<li>for Simple Json representation, access as JavaScript properties: entity.name or entity["name"]</li>
|
|
11
|
+
<li>for the XML representation, use the DOM API: entity.DomUtil.getAttribute("name)"</li>
|
|
12
|
+
<li>for Badget fish, access as JavaScript properties, but do not forget the "@" sign; entity["@name"]</li>
|
|
13
|
+
</ul>
|
|
14
|
+
|
|
15
|
+
<p>Once done, you'll probably want to cast the value to an XTK type using the XtkCaster.</p>
|
|
16
|
+
|
|
17
|
+
<p>If you need to access entity attributes (or child elements) in a generic way, you can use the <b>EntityAccessor</b>. It has the following static methods:</p>
|
|
18
|
+
<ul>
|
|
19
|
+
<li><b>getAttributeAsString</b>, <b>getAttributeAsLong</b>, <b>getAttributeAsBoolean</b> to get typed attribute values</li>
|
|
20
|
+
<li><b>getChildElements</b> to get the child elements. The result can be iterated on with a <b>for...of...</b> loop</li>
|
|
21
|
+
<li><b>getElement</b> to get a child element whose attributes and child elements can also be accessed by the EntityAccessor API</li>
|
|
22
|
+
</ul>
|