@adobe/acc-js-sdk 1.0.6 → 1.0.9
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/.github/workflows/codeql-analysis.yml +70 -0
- package/CHANGELOG.md +32 -0
- package/README.md +192 -63
- package/compile.js +1 -0
- package/package-lock.json +2156 -3344
- package/package.json +6 -7
- package/samples/002 - basics - schemas.js +3 -3
- package/samples/020 - encryption.js +5 -5
- package/src/application.js +427 -77
- package/src/campaign.js +4 -0
- package/src/client.js +61 -14
- package/src/domUtil.js +6 -3
- package/src/entityAccessor.js +5 -5
- package/src/index.js +58 -2
- package/src/soap.js +44 -18
- package/src/testUtil.js +47 -0
- package/src/xtkCaster.js +80 -6
- package/test/application.test.js +684 -616
- package/test/client.test.js +238 -15
- package/test/crypto.test.js +16 -12
- package/test/domUtil.test.js +150 -2
- package/test/escape.test.js +79 -47
- package/test/index.test.js +69 -1
- package/test/mock.js +35 -7
- package/test/soap.test.js +0 -6
- package/test/testUtil.test.js +64 -0
- package/test/xtkCaster.test.js +219 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
|
2
|
+
# to commit it to your repository.
|
|
3
|
+
#
|
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
|
5
|
+
# or to provide custom queries or build logic.
|
|
6
|
+
#
|
|
7
|
+
# ******** NOTE ********
|
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
|
10
|
+
# supported CodeQL languages.
|
|
11
|
+
#
|
|
12
|
+
name: "CodeQL"
|
|
13
|
+
|
|
14
|
+
on:
|
|
15
|
+
push:
|
|
16
|
+
branches: [ master ]
|
|
17
|
+
pull_request:
|
|
18
|
+
# The branches below must be a subset of the branches above
|
|
19
|
+
branches: [ master ]
|
|
20
|
+
schedule:
|
|
21
|
+
- cron: '34 13 * * 4'
|
|
22
|
+
|
|
23
|
+
jobs:
|
|
24
|
+
analyze:
|
|
25
|
+
name: Analyze
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
permissions:
|
|
28
|
+
actions: read
|
|
29
|
+
contents: read
|
|
30
|
+
security-events: write
|
|
31
|
+
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
language: [ 'javascript' ]
|
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
37
|
+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
|
38
|
+
|
|
39
|
+
steps:
|
|
40
|
+
- name: Checkout repository
|
|
41
|
+
uses: actions/checkout@v2
|
|
42
|
+
|
|
43
|
+
# Initializes the CodeQL tools for scanning.
|
|
44
|
+
- name: Initialize CodeQL
|
|
45
|
+
uses: github/codeql-action/init@v1
|
|
46
|
+
with:
|
|
47
|
+
languages: ${{ matrix.language }}
|
|
48
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
49
|
+
# By default, queries listed here will override any specified in a config file.
|
|
50
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
51
|
+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
52
|
+
|
|
53
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
54
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
|
55
|
+
- name: Autobuild
|
|
56
|
+
uses: github/codeql-action/autobuild@v1
|
|
57
|
+
|
|
58
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
|
59
|
+
# 📚 https://git.io/JvXDl
|
|
60
|
+
|
|
61
|
+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
62
|
+
# and modify them (or add more) to build your code if your project
|
|
63
|
+
# uses a compiled language
|
|
64
|
+
|
|
65
|
+
#- run: |
|
|
66
|
+
# make bootstrap
|
|
67
|
+
# make release
|
|
68
|
+
|
|
69
|
+
- name: Perform CodeQL Analysis
|
|
70
|
+
uses: github/codeql-action/analyze@v1
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,38 @@ This is a node.js SDK for Campaign API. It exposes the Campaign API exactly like
|
|
|
5
5
|
|
|
6
6
|
# Changelog
|
|
7
7
|
|
|
8
|
+
## Version 1.0.9
|
|
9
|
+
_2022/03/02_
|
|
10
|
+
|
|
11
|
+
* Ability to invoke SOAP calls dynamically with parameters computed at invocation time by a delegate function
|
|
12
|
+
* Fixed bug in XPath constructor which now supports expanded paths, i.e. xpaths such as `[@recipient-id]`.
|
|
13
|
+
* EntityAccessor: change the heuristic to detect XML types: use "nodeType" and "tagName" functions instead of "insertAdjacentElement" (which was not always working in the context of a React application)
|
|
14
|
+
* Add new escaping functions: `escapeForLike`, `expandXPath`, `unexpandXPath`, `xtkConstText`
|
|
15
|
+
* New XtkCaster methods: `asDatetime` (alias to `asTimestamp`), `isStringType`, and `isNumericType`
|
|
16
|
+
* Metadata API (application.getSchema)
|
|
17
|
+
* keys have a `isInternal` internal attribute which was mistakenly using the "string" type. It's now correctly using the boolean type.
|
|
18
|
+
* Added missing attributes on the XtkSchema: md5
|
|
19
|
+
* Added missing attributes on the XtkSchemaNode objects: dataPolicy, editType folderModel, enumerationImage, size, userEnumeration, hasUserEnumeration, isCollection,
|
|
20
|
+
isAdvanced, isAnyType, isLink, hasEnumeration, hasSQLTable, SQLName, SQLTable, isMappedAsXML, isTemporaryTable, isElementOnly, isDefaultOnDuplicate, isExternalJoin,
|
|
21
|
+
isMemo, isMemoData, isBlob, isCDATA, isNotNull, isRequired, isSQL, PKSequence, revLink, isCalculated, expr, isAutoIncrement, isAutoPK, isAutoUUID, isAutoStg, packageStatusString, and packageStatus
|
|
22
|
+
* Attribute type defaults to string if not set
|
|
23
|
+
* Removed userDescription attribut from schema nodes (only available at the schema level)
|
|
24
|
+
* Changed the toString function to use 4 spaces instead of 3 for indentation and display node label and internal name
|
|
25
|
+
* When label or description is missing from schema nodes or from enumerations, they default to the name value
|
|
26
|
+
* application.getSchema now uses a in-memory cache
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Version 1.0.7
|
|
30
|
+
_2022/01/24_
|
|
31
|
+
* Added a hook `refreshClient` on connection parameters. This is a callback called when an authentication token expires. It can be used to implement reconnection logic
|
|
32
|
+
* New attributes on the schema API (application.getSchema)
|
|
33
|
+
* The `enum` attribute of a schema node returns the corresponding enum attribute, i.e. the enumeration name
|
|
34
|
+
* The `target` attribute of a schema node (of type link) returns the target (schema id) of the link
|
|
35
|
+
* The `integrity` attribute of a schema node (of type link) returns the link integrity ("define", "own", etc.)
|
|
36
|
+
* Added a github workflow for code analysis (CodeQL) to detect more potential issues before release
|
|
37
|
+
* Upgrade dependencies to fix some vulnerabilities
|
|
38
|
+
* Add new conversion functions in XtkCaster to support for int, timespan, uuid, html and blob
|
|
39
|
+
|
|
8
40
|
## Version 1.0.6
|
|
9
41
|
_2021/11/03_
|
|
10
42
|
* New ofBearerToken authentication for IMS access token
|
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
This is a node.js SDK for Campaign API. It exposes the Campaign API exactly like it is used inside Campaign using the NLWS notation.
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
|
|
6
7
|
# Change log
|
|
7
8
|
|
|
8
9
|
See the [Change log](./CHANGELOG.md) for more information about the different versions, changes, etc.
|
|
@@ -127,6 +128,7 @@ traceAPICalls|false| Activates tracing of API calls or not
|
|
|
127
128
|
transport|axios|Overrides the transport layer
|
|
128
129
|
noStorage|false|De-activate using of local storage
|
|
129
130
|
storage|localStorage|Overrides the local storage for caches
|
|
131
|
+
refreshClient|undefined|Async callback to run when the session token is expired
|
|
130
132
|
|
|
131
133
|
```js
|
|
132
134
|
const connectionParameters = sdk.ConnectionParameters.ofUserAndPassword(
|
|
@@ -219,6 +221,19 @@ await client.logon();
|
|
|
219
221
|
await client.logoff();
|
|
220
222
|
```
|
|
221
223
|
|
|
224
|
+
## refreshClient callback
|
|
225
|
+
The refreshClient is an async callback function with the SDK client as parameter, it is called when the ACC session is expired.
|
|
226
|
+
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.
|
|
227
|
+
|
|
228
|
+
```js
|
|
229
|
+
const connectionParameters = sdk.ConnectionParameters.ofUserAndPassword(
|
|
230
|
+
url, "admin", "admin",
|
|
231
|
+
{ refreshClient: async (client) => {
|
|
232
|
+
await client.logon();
|
|
233
|
+
return client;
|
|
234
|
+
}});
|
|
235
|
+
```
|
|
236
|
+
|
|
222
237
|
## IP Whitelisting
|
|
223
238
|
|
|
224
239
|
Campaign includes an IP whitelisting component which prevents connections from unauthorized IP addresses. This is a common source of authentication errors.
|
|
@@ -456,7 +471,12 @@ More dynamic conversions can be achieved using the `as` function. See the types
|
|
|
456
471
|
|
|
457
472
|
```js
|
|
458
473
|
stringValue = XtkCaster.as(anyValue, 6);
|
|
459
|
-
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
In addition, the following helpers are available
|
|
477
|
+
* `XtkCaster.isTimeType` to test if a data type is a date, time or timestamp
|
|
478
|
+
* `XtkCaster.isStringType` to test if a data type is a string type (string, memo, etc.)
|
|
479
|
+
* `XtkCaster.isNumericType` to test if a data type is a numeric type
|
|
460
480
|
|
|
461
481
|
|
|
462
482
|
## DOM helpers
|
|
@@ -999,6 +1019,8 @@ It's common to use variables in query conditions. For instance, in the above exa
|
|
|
999
1019
|
To prevent xtk ingestions vulnerabilities, you should not concatenate strings and write code such as expr: "@name = '" + name + "'": if the value of the name
|
|
1000
1020
|
parameter contains single quotes, your code will not work, but could also cause vulnerabilities.
|
|
1001
1021
|
|
|
1022
|
+
### sdk.escapeXtk
|
|
1023
|
+
|
|
1002
1024
|
The `sdk.escapeXtk` can be used to properly escape string litterals in xtk expressions. The function will also surround the escaped value with single quotes.
|
|
1003
1025
|
|
|
1004
1026
|
You can use string concatenation like this. Note the lack of single quotes around the value.
|
|
@@ -1025,6 +1047,35 @@ This can also be used to escape other data types such as timestamps
|
|
|
1025
1047
|
will return `{ expr: "@lastModified > = #2021-07-07T10:03:33.332Z# }`
|
|
1026
1048
|
|
|
1027
1049
|
|
|
1050
|
+
### sdk.escapeForLike
|
|
1051
|
+
|
|
1052
|
+
This function escapes values so that they can be used in SQL or XTK like conditions. For example a search term "term" can be escaped as follows to implement a search conditions
|
|
1053
|
+
|
|
1054
|
+
```
|
|
1055
|
+
expr: `Lower([${xpath}]) LIKE '%${sdk.escapeForLike(term)}%'`,
|
|
1056
|
+
```
|
|
1057
|
+
|
|
1058
|
+
### sdk.expandXPath & sdk.unexpandXPath
|
|
1059
|
+
|
|
1060
|
+
In Campaign, xpaths are used to access attributes of entities. When XPaths are used in XTK expressions, there can be ambiguities, for instance, in the expression "country/@name", is "country/@name" a xpath or are we dividing the variable country by the value of the attribute @name?
|
|
1061
|
+
|
|
1062
|
+
Amibiguity can be resolved by "expanding" the xpath from "country/@name" to "[country/@name]". The square brackets indicate an xpath.
|
|
1063
|
+
|
|
1064
|
+
```
|
|
1065
|
+
const expandedXPath = sdk.expandXPath(xpath);
|
|
1066
|
+
const unexpandedXPath = sdk.unexpandXPath(expandedXPath);
|
|
1067
|
+
```
|
|
1068
|
+
|
|
1069
|
+
### xtkConstText
|
|
1070
|
+
|
|
1071
|
+
This function allows to convert literal values to xtk text constants, providing correct serialization. For instance, text constants will be quoted with single quotes, timestamps with the "#" character, etc.
|
|
1072
|
+
|
|
1073
|
+
```
|
|
1074
|
+
expect(sdk.xtkConstText("Hello", "string")).toBe("'Hello'");
|
|
1075
|
+
expect(sdk.xtkConstText(-42.3, "double")).toBe("-42.3");
|
|
1076
|
+
expect(sdk.xtkConstText("2022-02-15T09:49:04.000Z", "datetime")).toBe("#2022-02-15T09:49:04.000Z#");
|
|
1077
|
+
```
|
|
1078
|
+
|
|
1028
1079
|
|
|
1029
1080
|
## Pagination
|
|
1030
1081
|
Results can be retrieved in different pages, using the `@lineCount` and `@startLine` attributes. For instance, retrieves profiles 3 and 4 (skip 1 and 2)
|
|
@@ -1285,23 +1336,23 @@ The `application` object can be obtained from a client, and will mimmic the Camp
|
|
|
1285
1336
|
|
|
1286
1337
|
| Attribute/Method | Description |
|
|
1287
1338
|
|---|---|
|
|
1288
|
-
| buildNumber | The server build number
|
|
1289
|
-
| instanceName | The name of the Campaign instance
|
|
1290
|
-
| operator | Information about the current operator (i.e. logged user), of class `CurrentLogin`
|
|
1291
|
-
| packages | List of installed packages, as an array of strings
|
|
1292
|
-
| getSchema(schemaId) | Get a schema by id (see the Schemas section below)
|
|
1293
|
-
| hasPackage(name) | Tests if a package is installed or not
|
|
1339
|
+
| **buildNumber** | The server build number
|
|
1340
|
+
| **instanceName** | The name of the Campaign instance
|
|
1341
|
+
| **operator** | Information about the current operator (i.e. logged user), of class `CurrentLogin`
|
|
1342
|
+
| **packages** | List of installed packages, as an array of strings
|
|
1343
|
+
| **getSchema**(schemaId) | Get a schema by id (see the Schemas section below)
|
|
1344
|
+
| **hasPackage**(name) | Tests if a package is installed or not
|
|
1294
1345
|
|
|
1295
1346
|
|
|
1296
1347
|
The `CurrentLogin` object has the following attributes / functions
|
|
1297
1348
|
|
|
1298
1349
|
| Attribute/Method | Description |
|
|
1299
1350
|
|---|---|
|
|
1300
|
-
| id | the internal id (int32) of the operator
|
|
1301
|
-
| login | the login name of the operator
|
|
1302
|
-
| computeString | A human readable name for the operator
|
|
1303
|
-
| timezone | The timezone of the operator
|
|
1304
|
-
| rights | An array of strings describing the rights of the operators
|
|
1351
|
+
| **id** | the internal id (int32) of the operator
|
|
1352
|
+
| **login** | the login name of the operator
|
|
1353
|
+
| **computeString** | A human readable name for the operator
|
|
1354
|
+
| **timezone** | The timezone of the operator
|
|
1355
|
+
| **rights** | An array of strings describing the rights of the operators
|
|
1305
1356
|
|
|
1306
1357
|
# Schemas
|
|
1307
1358
|
|
|
@@ -1354,73 +1405,129 @@ const schema = application.getSchema("nms:recipient");
|
|
|
1354
1405
|
This return a schema object of class `XtkSchema`
|
|
1355
1406
|
|
|
1356
1407
|
|
|
1357
|
-
### XtkSchema
|
|
1358
|
-
|
|
1359
|
-
| Attribute
|
|
1360
|
-
|
|
1361
|
-
|
|
|
1362
|
-
|
|
|
1363
|
-
|
|
|
1364
|
-
|
|
|
1365
|
-
|
|
|
1366
|
-
|
|
|
1367
|
-
|
|
|
1368
|
-
|
|
|
1369
|
-
|
|
|
1370
|
-
|
|
|
1371
|
-
|
|
|
1372
|
-
|
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
|
1379
|
-
|
|
1380
|
-
|
|
|
1381
|
-
|
|
|
1382
|
-
|
|
|
1383
|
-
|
|
|
1384
|
-
|
|
|
1385
|
-
|
|
|
1386
|
-
|
|
|
1408
|
+
### XtkSchema
|
|
1409
|
+
|
|
1410
|
+
| Attribute | Description |
|
|
1411
|
+
|---|---|
|
|
1412
|
+
| **id** | The id of the schema. For instance "nms:recipient"
|
|
1413
|
+
| **namespace** | The namespace of the schema. For instance "nms"
|
|
1414
|
+
| **name** | The name of the schema (internal name)
|
|
1415
|
+
| **label** | The label (i.e. human readable, localised) name of the node.
|
|
1416
|
+
| **labelSingular** | The singular label (i.e. human readable, localised) name of the schema. The label of a schema is typically a plural.
|
|
1417
|
+
| **isLibrary** | For schemas, indicates if the schema is a library
|
|
1418
|
+
| **mappingType** |Schema mapping type. Usually "sql"
|
|
1419
|
+
| **md5** | The MD5 code of the schema in the form of a hexadecimal string
|
|
1420
|
+
| **xml** | The XML (DOM) corresponding to this schema.<br>Note: this attribute is not available in the JS SDK.
|
|
1421
|
+
| **root** | The schema root node, if there is one. A reference to a `XtkSchemaNode`
|
|
1422
|
+
| **enumerations** | Map of enumerations in this schema, indexed by enumeration name. Values are of type `XtkEnumeration`
|
|
1423
|
+
| **userDescription** | The description of the schema in the form of a string.
|
|
1424
|
+
|
|
1425
|
+
A schema is also a `XtkSchemaNode` and the corresponding properties/methods are also availale.
|
|
1426
|
+
|
|
1427
|
+
### XtkSchemaNode
|
|
1428
|
+
|
|
1429
|
+
| Attribute | | Description |
|
|
1430
|
+
|---|---|
|
|
1431
|
+
| **children** | A map of children of the node, indexed by name. Names never contain the "@" sign, even attribute names
|
|
1432
|
+
| **dataPolicy** | Returns a string of characters which provides the data policy of the current node.
|
|
1433
|
+
| **description** | A long, human readable, description of the node
|
|
1434
|
+
| **editType** |Returns a string of characters which specifies the editing type of the current node.
|
|
1435
|
+
| **enum** | The name of the enumeration for the node, or an empty string if the node does node have an enumeration. See `enumeration()` method to get the corresponding `XtkSchemaNode`
|
|
1436
|
+
| **enumerationImage** | Returns the name of the image of the current node in the form of a string of characters.
|
|
1437
|
+
| **folderModel** |Only on the root node, returns a string which contains the folder template(s). On the other nodes, it returns undefined.
|
|
1438
|
+
| **image** | Returns the name of the image in the form of a string of characters.
|
|
1439
|
+
| **img** | Returns the name of the image in the form of a string of characters. (alias to `image` property)
|
|
1440
|
+
| **integrity** | Returns the link integrity type.
|
|
1441
|
+
| **keys** | A map of keys in this node, indexed by key name. Map values are of type `XtkSchemaKey`
|
|
1442
|
+
| **hasEnumeration** | Returns a boolean which indicates whether the value of the current node is linked to an enumeration.
|
|
1443
|
+
| **childrenCount** | Number of children nodes
|
|
1444
|
+
| **hasSQLTable** | Returns a boolean which indicates whether the current node is linked to an SQL table.
|
|
1445
|
+
| **hasUserEnumeration** | Returns a boolean which indicates whether the value of the current node is linked to a user enumeration.
|
|
1446
|
+
| **schema** | The schema to which this node belongs
|
|
1447
|
+
| **isAdvanced** | Returns a boolean which indicates whether the current node is advanced or not.
|
|
1448
|
+
| **isAnyType** | Returns a boolean which indicates whether the current node is ordinary.
|
|
1449
|
+
| **isAttribute** | Indicates if the node is an attribute (true) or an element (false)
|
|
1450
|
+
| **isAutoIncrement** | Returns a boolean which indicates whether the value of the current node is incremented automatically.
|
|
1451
|
+
| **isAutoPK** | Returns a boolean which indicates whether the current node is a primary key.
|
|
1452
|
+
| **isAutoUUID** | Yes | No | Returns a boolean which indicates whether the current node is an automatic UUID
|
|
1453
|
+
| **isAutoStg** | Yes | No | Returns a boolean which indicates whether the schema is a staging schema
|
|
1454
|
+
| **isBlob** | Returns a boolean which indicates whether the current node is a BLOB.
|
|
1455
|
+
| **isCalculated** | Returns a boolean which indicates whether the value of the current node is the result of a calculation. Note that compute strings are not considered as calculated attributes.
|
|
1456
|
+
| **isCDATA** | Returns a boolean which indicates whether the current node is mapped from CDATA type XML.
|
|
1457
|
+
| **isCollection** | Returns a boolean which indicates whether the current node is a collection of sub-elements and/or attributes. This is an alias to `unbound` and `isUnbound` properties.
|
|
1458
|
+
| **isDefaultOnDuplicate** | Returns a boolean. If the value added is vrai, during record deduplication, the default value (defined in defaultValue) is automatically reapplied during recording.
|
|
1459
|
+
| **isElementOnly** | Returns a boolean which indicates whether the current node is a logical sub-division of the schema.
|
|
1460
|
+
| **isExternalJoin** | True if the node is a link and if the join is external.
|
|
1461
|
+
| **isLink** | Returns a boolean which indicates whether the node is a link.
|
|
1462
|
+
| **isMappedAsXML** | Returns a boolean which indicates whether the node is an XML mapping.
|
|
1463
|
+
| **isMemo** | Returns a boolean which indicates whether the current node is mapped by a Memo.
|
|
1464
|
+
| **isMemoData** | Returns a boolean which indicates whether the current node is mapped by a MemoData.
|
|
1465
|
+
| **isNotNull** | Returns a boolean which indicates whether or not the current node can take the null value into account.
|
|
1466
|
+
| **isRequired** | Returns a boolean which indicates whether or not the value of the current node is mandatory.
|
|
1467
|
+
| **isRoot** | Indicates if the node is the root node of a schema, i.e. the first child of the schema node, whose name matches the schema name
|
|
1468
|
+
| **isSQL** | Returns a boolean which indicates whether the current node is mapped in SQL.
|
|
1469
|
+
| **isTemporaryTable** | Returns a boolean indicating whether the table is a temporary table. The table will not be created during database creation.| id | schema | For schemas, the id of the schema. For instance "nms:recipient"
|
|
1470
|
+
| **unbound** | Returns a boolean which indicates whether the current node has an unlimited number of children of the same type.
|
|
1471
|
+
| **joins** | Element of type "link" has an array of XtkJoin. See `joinNodes` method.
|
|
1472
|
+
| **label** | The label (i.e. human readable, localised) name of the node.
|
|
1473
|
+
| **name** | The name of the node (internal name)
|
|
1474
|
+
| **nodePath** | The absolute full path of the node
|
|
1475
|
+
| **parent** | The parent node. Will be null for schema nodes
|
|
1476
|
+
| **PKSequence** | Returns a character string that provides the name of the sequence to use for the primary key.
|
|
1477
|
+
| **packageStatus** | Returns a number that gives the package status.
|
|
1478
|
+
| **packageStatusString** | Returns a string that gives the package status ("never", "always", "default", or "preCreate").
|
|
1479
|
+
| **revLink** | Returns the name of the reverse link in the link target schema. See `reverseLink` method to get the actual reverse link object
|
|
1480
|
+
| **SQLName** | The SQL name of the field. The property is an empty string if the object isn't an SQL type field.
|
|
1481
|
+
| **SQLTable** | The SQL name of the table. The property is an empty string if the object isn't the main element or if schema mapping isn't of SQL type.
|
|
1482
|
+
| **size** | For string nodes, the maximum length of the node value. Alias to `length`.
|
|
1483
|
+
| **length** | For string nodes, the maximum length of the node value
|
|
1484
|
+
| **target** | A string corresponding to the target of a link. Note that in the SDK, this is a string, whereas in the JS API, this is the actual target node. Because the SDK is async. Use `linkTarget` to get the target node of a link.
|
|
1485
|
+
| **type** | The data type of the node, for instance "string", "long", etc.
|
|
1486
|
+
| **userEnumeration** | Returns a string of characters which is the name of the user enumeration used by the current node.
|
|
1487
|
+
| **ref** | Some nodes are only references to other nodes. There are 2 kind of references. Local references are simply a xpath in the current schema (starting from the schema itself, and not the schema root). Fully qualified references are prefixed with a schema id. The target node can be accessed with the `refTarget` funtion.
|
|
1488
|
+
| **isMappedAsXml** | Is the field mapped as XML?
|
|
1489
|
+
|
|
1490
|
+
| Method | Description |
|
|
1491
|
+
|---|---|
|
|
1492
|
+
| **hasChild**(name) | | Tests if the node has a child wih the given name
|
|
1493
|
+
| **findNode**(path) | Find a child node using a xpath
|
|
1387
1494
|
|
|
1388
1495
|
|
|
1389
1496
|
### XtkSchemaKey
|
|
1390
1497
|
|
|
1391
1498
|
| Attribute/Method | Description |
|
|
1392
1499
|
|---|---|
|
|
1393
|
-
| schema | The schema to which this key belongs
|
|
1394
|
-
| name | The name of the key (internal name)
|
|
1395
|
-
| label | The label (i.e. human readable, localised) name of the key
|
|
1396
|
-
| description | A long, human readable, description of the key
|
|
1397
|
-
| isInternal |
|
|
1398
|
-
| allowEmptyPart |
|
|
1399
|
-
| fields | A map of key fields making up the key. Each value is a reference to a `XtkSchemaNode`
|
|
1500
|
+
| **schema** | The schema to which this key belongs
|
|
1501
|
+
| **name** | The name of the key (internal name)
|
|
1502
|
+
| **label** | The label (i.e. human readable, localised) name of the key
|
|
1503
|
+
| **description** | A long, human readable, description of the key
|
|
1504
|
+
| **isInternal** | Indicates if the key is an internal key (as opposed to an external key)
|
|
1505
|
+
| **allowEmptyPart** |
|
|
1506
|
+
| **fields** | A map of key fields making up the key. Each value is a reference to a `XtkSchemaNode`
|
|
1400
1507
|
|
|
1401
1508
|
### XtkEnumeration
|
|
1402
1509
|
|
|
1403
1510
|
| Attribute/Method | Description |
|
|
1404
1511
|
|---|---|
|
|
1405
|
-
| name | The name of the
|
|
1406
|
-
| label | The label (i.e. human readable, localised) name of the key
|
|
1407
|
-
| description | A long, human readable, description of the key
|
|
1408
|
-
| baseType |
|
|
1409
|
-
| default |
|
|
1410
|
-
| hasImage |
|
|
1411
|
-
| values | A map of enumeration values, by name of value. Value is of type `XtkEnumerationValue`
|
|
1512
|
+
| **name** | The name of the enumeration, fully qualified, i.e. prefixed with the schema id
|
|
1513
|
+
| **label** | The label (i.e. human readable, localised) name of the key
|
|
1514
|
+
| **description** | A long, human readable, description of the key
|
|
1515
|
+
| **baseType** | The base type of the enumeration, usually "string" or "byte"
|
|
1516
|
+
| **default** | The default value of the enumeration, casted to the enumeration type
|
|
1517
|
+
| **hasImage** | If the enumeration has an image
|
|
1518
|
+
| **values** | A map of enumeration values, by name of value. Value is of type `XtkEnumerationValue`
|
|
1412
1519
|
|
|
1413
1520
|
### XtkEnumerationValue
|
|
1414
1521
|
|
|
1415
1522
|
| Attribute/Method | Description |
|
|
1416
1523
|
|---|---|
|
|
1417
|
-
| name | The name of the key (internal name)
|
|
1418
|
-
| label | The label (i.e. human readable, localised) name of the key
|
|
1419
|
-
| description | A long, human readable, description of the key
|
|
1420
|
-
| image |
|
|
1421
|
-
| enabledIf |
|
|
1422
|
-
| applicableIf |
|
|
1423
|
-
| value | The value of the enumeration (casted to the proper Javascript type)
|
|
1524
|
+
| **name** | The name of the key (internal name)
|
|
1525
|
+
| **label** | The label (i.e. human readable, localised) name of the key
|
|
1526
|
+
| **description** | A long, human readable, description of the key
|
|
1527
|
+
| **image** |
|
|
1528
|
+
| **enabledIf** |
|
|
1529
|
+
| **applicableIf** |
|
|
1530
|
+
| **value** | The value of the enumeration (casted to the proper Javascript type)
|
|
1424
1531
|
|
|
1425
1532
|
# Advanced Topics
|
|
1426
1533
|
|
|
@@ -1440,6 +1547,28 @@ If you need to access entity attributes (or child elements) in a generic way, yo
|
|
|
1440
1547
|
* `getChildElements` to get the child elements. The result can be iterated on with a `for...of...` loop
|
|
1441
1548
|
* `getElement` to get a child element whose attributes and child elements can also be accessed by the EntityAccessor API
|
|
1442
1549
|
|
|
1550
|
+
## Invoking SOAP calls dynamically
|
|
1551
|
+
Soap calls can be invoked dynamically as follows
|
|
1552
|
+
|
|
1553
|
+
```js
|
|
1554
|
+
const namespace = client.NLWS["xtkSession"];
|
|
1555
|
+
const method = namespace["getOption"];
|
|
1556
|
+
const result = await method.call(namespace, parameters);
|
|
1557
|
+
```
|
|
1558
|
+
|
|
1559
|
+
where parameters is the list of parameters to the SOAP call.
|
|
1560
|
+
Parameters can be a function which can compute and return the list of parameters as the function is being called:
|
|
1561
|
+
|
|
1562
|
+
```js
|
|
1563
|
+
const result = await method.call(namespace, (method, callContext) => {
|
|
1564
|
+
return parameters;
|
|
1565
|
+
});
|
|
1566
|
+
```
|
|
1567
|
+
The `method` parameter is the XML definition of the SOAP method call. The `callContext` is an object which contains the following attributes:
|
|
1568
|
+
* `schemaId` is the id of the schema containing the SOAP method
|
|
1569
|
+
* `namespace` is the call namespace
|
|
1570
|
+
* `object` is only used for non-static call and contains the "this" of the call.
|
|
1571
|
+
|
|
1443
1572
|
|
|
1444
1573
|
|
|
1445
1574
|
# Build & Run
|