@adobe/acc-js-sdk 1.0.9 → 1.1.0
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/CHANGELOG.md +17 -0
- package/MIGRATION.md +160 -0
- package/README.md +138 -14
- package/package-lock.json +2 -2
- package/package.json +1 -1
- package/src/application.js +347 -141
- package/src/index.js +1 -1
- package/src/util.js +144 -0
- package/src/xtkCaster.js +17 -2
- package/test/application.test.js +1492 -117
- package/test/client.test.js +3 -3
- package/test/util.test.js +167 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,21 @@ 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.1.0
|
|
9
|
+
_2022/03/05_
|
|
10
|
+
|
|
11
|
+
Changes in the metadata api (`application.getSchema`) which was not completely implemented. While this API is meant to be largely compatible with the [ACC JS API](https://docs.adobe.com/content/help/en/campaign-classic/technicalresources/api/c-Application.html), it's not always possible to do so because of the asynchronous nature of the SDK. The JS API is executed inside the Campaign application server can will synchronously and transparently fetch schemas as needed. Howerer the SDK runs outside of the Campaign server. It will synchronously and transparently fetch schemas as needed, but this will be done adynchronously.
|
|
12
|
+
|
|
13
|
+
Differences are document in the `Application` section of the README.
|
|
14
|
+
|
|
15
|
+
* Provide array and map access to XtkSchemaKey.fields,
|
|
16
|
+
* The order of children of a node has been changed. Beore 1.1.0, it was attributes, then elements. After 1.1.0, it's the order defined in the schema XML
|
|
17
|
+
* New application.getEnumeration function to retreive an enumeration
|
|
18
|
+
* Removed the XtkSchemaNode.hasChild function
|
|
19
|
+
* Support for ref nodes and links: XtkSchemaNode.refTarget(), XtkSchemaNode.linkTarget() functions
|
|
20
|
+
* Reviews XtkSchemaNode.findNode() function to support links, refs, ANY type, etc. and is now asynchronous
|
|
21
|
+
* The name attribute of enumerations (`XtkEnumeration.name`) is now the fully qualified name of the enumeration, i.e. is prefixed by the schema id
|
|
22
|
+
|
|
8
23
|
## Version 1.0.9
|
|
9
24
|
_2022/03/02_
|
|
10
25
|
|
|
@@ -25,6 +40,8 @@ _2022/03/02_
|
|
|
25
40
|
* When label or description is missing from schema nodes or from enumerations, they default to the name value
|
|
26
41
|
* application.getSchema now uses a in-memory cache
|
|
27
42
|
|
|
43
|
+
For breaking changes see the [migration guide](MIGRATION.md)
|
|
44
|
+
|
|
28
45
|
|
|
29
46
|
## Version 1.0.7
|
|
30
47
|
_2022/01/24_
|
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Migration guide
|
|
2
|
+
|
|
3
|
+
# Version 1.1.0
|
|
4
|
+
|
|
5
|
+
In version 1.1.0, changes were made in the metadata API. The SDK lets you access schema as JSON objects (method `client.getSchema`) or provides an object model around schemas with typed objects, as in https://experienceleague.adobe.com/developer/campaign-api/api/c-Schema.html, which can be accessed with `application.getSchema`.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
The following potentially breaking changes were introduced
|
|
9
|
+
|
|
10
|
+
* Schemas retreived by `application.getSchema` are cached in memory
|
|
11
|
+
* Attributes without an explicit type will be reported as `string` type instead of empty type
|
|
12
|
+
* The `userDescription` property removed from `XtkSchemaNode` and only available on `XtkSchema`
|
|
13
|
+
* The `children` of a `XtkSchemaNode` are now reported in the same order as they appear in the schema
|
|
14
|
+
* Implicit values are propagated for `XtkSchemaNode` and enumeration. It means that empty labels and desciptions not have a non empty value infered from the name attribute
|
|
15
|
+
* The `XtkSchemaNode.hasChild` function has been removed
|
|
16
|
+
* Enumerations of a schema, values of an enumeration, children of a schema node, keys of a schema, and fields of a key are now returned as a `ArrayMap` type instead of a key/value. This change allows to access elements as either an array or a dictionary, or map, filter, iterate through elements.
|
|
17
|
+
* The string representation of schema nodes : `XtkSchema.toString` and `XtkSchemaNode.toString` has changed
|
|
18
|
+
* The `XtkSchemaNode.findNode` method is now asynchronous and its signature has changed
|
|
19
|
+
* The name attribute of enumerations is now always the fully qualified name (ex: `nms:recipient:gender` instead of `gender`). The non qualified name is still available with the `shortName` property.
|
|
20
|
+
|
|
21
|
+
## In-memory cache
|
|
22
|
+
Schema objects have their own in-memory cache, in addition to the SDK cache
|
|
23
|
+
|
|
24
|
+
## Attribute type
|
|
25
|
+
Attributes with no type are now reported as `string`.
|
|
26
|
+
|
|
27
|
+
Before
|
|
28
|
+
```js
|
|
29
|
+
// Deprecated syntax
|
|
30
|
+
if (!attribute.type || attribute.type === "string") ...
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
After
|
|
34
|
+
```js
|
|
35
|
+
if (attribute.type === "string") ...
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
or better, use `XtkCaster.isStringType` which will handle all variant of string types, such as `memo`, `html`, etc.
|
|
39
|
+
```js
|
|
40
|
+
if (XtkCaster.isStringType(attribute.type)) ...
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## userDescription property
|
|
44
|
+
The `userDescription` property was set on the `XtkSchemaNode` object and has been moved to the `XtkSchema` object
|
|
45
|
+
|
|
46
|
+
## Order of children
|
|
47
|
+
The order of children of a node has been changed. Beore 1.1.0, it was attributes, then elements. After 1.1.0, it's the order defined in the schema XML
|
|
48
|
+
|
|
49
|
+
## Propagate implicit values
|
|
50
|
+
Automatically set schema nodes label and description properties if they are not set.
|
|
51
|
+
* Schema node. If a node does not have a label, the SDK will generate a label from the name (with first letter in upper case) instead of returning an empty string. Similarly, the node description property will be set from the label.
|
|
52
|
+
* enumeration label will be set with the same rules
|
|
53
|
+
|
|
54
|
+
## Removed hasChild function
|
|
55
|
+
The function `XtkSchemaNode.hasChild` has been removed.
|
|
56
|
+
|
|
57
|
+
Before
|
|
58
|
+
```js
|
|
59
|
+
// Deprecated syntax (will fail at runtime)
|
|
60
|
+
if (node.hasChild("@email")) { ... }
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
After
|
|
64
|
+
```js
|
|
65
|
+
if (!node.children.get("@email")) { ... }
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## ArrayMaps
|
|
69
|
+
Collection of child elements which were accessed as maps are now accessed with a special `ArrayMap` object which allows to access them either as maps of arrays and include convenience functions for iteration
|
|
70
|
+
* fields of a key (`XtkSchemaKey.fields`)
|
|
71
|
+
* chldren of a node (`XtkSchemaNode.children`)
|
|
72
|
+
* keys of a node (`XtkSchemaNode.keys`)
|
|
73
|
+
* values of an enumeration (`XtkEnumeration.values`)
|
|
74
|
+
* enumerations of a schema (`XtkSchema.enumerations`)
|
|
75
|
+
|
|
76
|
+
As a consequence, it's deprecated to access the properties above by name. It still works in most of the cases, but will fail for object whose name collides with JavaScript function names. For exampl, for an element named 'forEach'.
|
|
77
|
+
|
|
78
|
+
Instead, use one of the following constructs.
|
|
79
|
+
|
|
80
|
+
To iterate over a collection, use `map`, `forEach`, or a `for ... of` loop. Do not use the for ... in loop.
|
|
81
|
+
|
|
82
|
+
Before
|
|
83
|
+
```js
|
|
84
|
+
// Not supported anymore. Will only work in some cases
|
|
85
|
+
for (key in node.children) { const child = node.children[key]; ... }
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
After
|
|
89
|
+
```js
|
|
90
|
+
node.children.forEach(child => ...);
|
|
91
|
+
node.children.map(child => ...);
|
|
92
|
+
for (child of node.children) { ... }
|
|
93
|
+
for (let i=0 i<node.children.lenght; i++) { const child = node.children[i]; ... }
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Collection items can be accessed by name or index with the `get` function, or with an array index.
|
|
97
|
+
|
|
98
|
+
Before
|
|
99
|
+
```js
|
|
100
|
+
// Not supported anymore. Will only work in some cases
|
|
101
|
+
const child = node.children["@email"];
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
After
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
const child = node.children[3];
|
|
108
|
+
const child = node.children.get(3);
|
|
109
|
+
const child = node.children.get("@email");
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
## Schema and SchemaNode toString
|
|
114
|
+
The `toString` function has been changed to better display a node structure. In general, this function is mostly for debugging purpose, and you should not rely on the exact output.
|
|
115
|
+
|
|
116
|
+
## XtkSchemaNode.findNode
|
|
117
|
+
The `findNode` function has been modified in multiple ways.
|
|
118
|
+
|
|
119
|
+
* The function is now **asynchronous** and returns a Promise. The reason is that in order to support all the use cases supported in Campaign JS API, findNode needs to follow references and links, and therefore may have to dynamically load schemas.
|
|
120
|
+
|
|
121
|
+
* The function now supports `ref` nodes. Ref nodes are schema nodes having a `ref` property which is a reference to another node, possibly in a different schema.
|
|
122
|
+
* If the xpath passed to the function ends with a ref node, the ref node itself will be returned. We're not following the reference. You can use the `refTarget` method to explicitely follow the reference
|
|
123
|
+
* If the xpath traverse intermediate nodes which are ref nodes, the `findNode` method will follow the reference. For instance, the start activity in a workflow is a reference. Finding the xpath "start/@img" will follow the start reference and find the @img attribute from there
|
|
124
|
+
|
|
125
|
+
* Support of type `ANY`. The type `ANY` in Campaign is used to describe a node which can contain arbitrary child nodes, without any strongly defined structure. The `findNode` function will only be able to return direct children of a node of `ANY` type.
|
|
126
|
+
|
|
127
|
+
* Support for links. If the xpath parameter contains links, `findNode` will follow the link target with the same rules as for reference nodes. To get the target of a link, use the `linkTarget` method instead of `refTarget`.
|
|
128
|
+
|
|
129
|
+
* The `findNode` function now takes only one parameter: the xpath to search for. The `strict` and `mustExist` parameters were removed. The function is now always in strict mode, i.e. will not try to guess if you're searching for an element or attribute. The function will only throw if the schema it's working on are malformed. For instance, if the target property of a link is not a syntaxically correct schema id. If however, the node you're looking for does not exist, or if an intermediate node or schema does not exist, findNode will simply return null or undefined, and will not throw. The `mustExist` param may be reintroduced in the future for better error reporting.
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
Basic usage of `findNode`
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
Before
|
|
136
|
+
```js
|
|
137
|
+
// Deprecated, will not work anymore
|
|
138
|
+
try {
|
|
139
|
+
const email = schema.root.findNode("@email");
|
|
140
|
+
} catch(error) {
|
|
141
|
+
// maybe @email does not exist, or maybe the schema is invalid
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
After
|
|
146
|
+
```js
|
|
147
|
+
try {
|
|
148
|
+
const email = await schema.root.findNode("@email");
|
|
149
|
+
if (!email) {
|
|
150
|
+
// @email does not exist
|
|
151
|
+
}
|
|
152
|
+
} catch(error) {
|
|
153
|
+
// schema is invalid
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
## Enumeration name
|
|
159
|
+
|
|
160
|
+
* The name attribute of enumerations (`XtkEnumeration.name`) is now the fully qualified name of the enumeration, i.e. is prefixed by the schema id
|
package/README.md
CHANGED
|
@@ -1340,7 +1340,8 @@ The `application` object can be obtained from a client, and will mimmic the Camp
|
|
|
1340
1340
|
| **instanceName** | The name of the Campaign instance
|
|
1341
1341
|
| **operator** | Information about the current operator (i.e. logged user), of class `CurrentLogin`
|
|
1342
1342
|
| **packages** | List of installed packages, as an array of strings
|
|
1343
|
-
| **getSchema**(schemaId) | Get a schema by id (see the Schemas section below)
|
|
1343
|
+
| async **getSchema**(schemaId) | Get a schema by id (see the Schemas section below)
|
|
1344
|
+
| async **getEnumeration**(enumerationName, schemaOrSchemaId) | Get an enumeration
|
|
1344
1345
|
| **hasPackage**(name) | Tests if a package is installed or not
|
|
1345
1346
|
|
|
1346
1347
|
|
|
@@ -1393,18 +1394,130 @@ The Schema API closely mimmics the Campaign server side API : https://docs.adobe
|
|
|
1393
1394
|
|
|
1394
1395
|
* The `XtkSchema` and associated classes (`XtkSchemaNode`, `XtkSchemaKey`, `XtkEnumeration` and `XtkEnumerationValue`) are all immutable. There are currently no API to create schemas dynamically
|
|
1395
1396
|
* Not all methods and functions are implemented
|
|
1397
|
+
* Several methods are asynchronous because they may require a server round trip to fetch schemas, etc.
|
|
1396
1398
|
* There could be slight differences in usage due to Campaign server side JavaScript using some E4X specific constructs to iterate over collections (ex: for each(...)) which are not available in standard JavaScript environments
|
|
1397
1399
|
|
|
1398
1400
|
The entry point is the application object. Obtain a schema from its id:
|
|
1399
1401
|
|
|
1400
1402
|
```js
|
|
1401
1403
|
const application = client.application;
|
|
1402
|
-
const schema = application.getSchema("nms:recipient");
|
|
1404
|
+
const schema = await application.getSchema("nms:recipient");
|
|
1403
1405
|
```
|
|
1404
1406
|
|
|
1405
1407
|
This return a schema object of class `XtkSchema`
|
|
1406
1408
|
|
|
1407
1409
|
|
|
1410
|
+
### Iterating over collections
|
|
1411
|
+
The metadata SDK closely mimmics the Campaign API, but provides convenience functions to access collections of objects, such as the children of a node, the values of an enumeration, etc. using an `ArrayMap` structure which allows access as both an array and a map.
|
|
1412
|
+
|
|
1413
|
+
Access as a map. Child elements can be accessed with their names, as if it was a JavaScript map. For instance, accessing the gender of a recipient. This method is kept as a compatibility layer with the legacy API and older versions of the SDK but is deprecated / discouraged. The reason is that there are schemas which have attribut names such as "length", or element names such as "forEach" which collide with JavaScript objects.
|
|
1414
|
+
```js
|
|
1415
|
+
const schema = await client.application.getSchema("nms:recipient");
|
|
1416
|
+
const enumerations = schema.enumerations;
|
|
1417
|
+
// deprecated, discouraged
|
|
1418
|
+
expect(enumerations.gender.label).toBe("Gender");
|
|
1419
|
+
```
|
|
1420
|
+
|
|
1421
|
+
Instead, prefer the `get` function which can retreive any enumeration value
|
|
1422
|
+
```js
|
|
1423
|
+
const schema = await client.application.getSchema("nms:recipient");
|
|
1424
|
+
const enumerations = schema.enumerations;
|
|
1425
|
+
expect(enumerations.get("gender").label).toBe("Gender");
|
|
1426
|
+
```
|
|
1427
|
+
|
|
1428
|
+
Elements can also be accessed as an array. In this example, we are iterating over the enumerations of a schema
|
|
1429
|
+
```js
|
|
1430
|
+
const schema = await client.application.getSchema("nms:recipient");
|
|
1431
|
+
const enumerations = schema.enumerations;
|
|
1432
|
+
for (let i=0; i<enumerations.length; i++) {
|
|
1433
|
+
const enumeration = enumerations[i];
|
|
1434
|
+
}
|
|
1435
|
+
```
|
|
1436
|
+
|
|
1437
|
+
Note that this assumes that there is no enumeration called "length" which will override the "length" attribute. Schemas, schema elements, and sql schemas have attributes named "length", but they are attributes, and will therefore be named "@length" in the metadata API. There is no element named "length" in out-of-the-box schemas.
|
|
1438
|
+
|
|
1439
|
+
The ArrayMap also behaves like an iterator and works fine with the `for...of` syntax
|
|
1440
|
+
```js
|
|
1441
|
+
const schema = await client.application.getSchema("nms:recipient");
|
|
1442
|
+
const enumerations = schema.enumerations;
|
|
1443
|
+
for (const enumeration of enumerations) {
|
|
1444
|
+
...
|
|
1445
|
+
}
|
|
1446
|
+
```
|
|
1447
|
+
|
|
1448
|
+
For convenience, the `map` and `forEach`, `find`, `filter`, `get`, and `flatMap` methods are also available and behave as expected:
|
|
1449
|
+
|
|
1450
|
+
```js
|
|
1451
|
+
const schema = await client.application.getSchema("nms:recipient");
|
|
1452
|
+
// comma separated list of enumerations
|
|
1453
|
+
const enumerations = schema.enumerations.map(e => e.name).join(',');
|
|
1454
|
+
```
|
|
1455
|
+
|
|
1456
|
+
```js
|
|
1457
|
+
const schema = await client.application.getSchema("nms:recipient");
|
|
1458
|
+
schema.enumerations.forEach(e => { ... });
|
|
1459
|
+
```
|
|
1460
|
+
|
|
1461
|
+
The `for...in` loop is also supported but deprecated/discouraged as it may return incorrect results for collections having items whose key collide with javaScript properties (such as length, map, forEach, etc.). Use a `for...of` construcr instead, or the `map` or `forEach` functions.
|
|
1462
|
+
```js
|
|
1463
|
+
const schema = await client.application.getSchema("nms:recipient");
|
|
1464
|
+
// deprecated, discouraged
|
|
1465
|
+
for (const key in schema.enumerations) {
|
|
1466
|
+
...
|
|
1467
|
+
}
|
|
1468
|
+
```
|
|
1469
|
+
|
|
1470
|
+
## Navigating schemas
|
|
1471
|
+
The schema API is useful to quickly navigate in the schema hierarchy. Here are a few examples
|
|
1472
|
+
|
|
1473
|
+
Get the label of the email attribute of the nms:recipient schema
|
|
1474
|
+
```js
|
|
1475
|
+
const schema = await application.getSchema("nms:recipient");
|
|
1476
|
+
const email = await schema.root.findNode("@email");
|
|
1477
|
+
console.log(email.label);
|
|
1478
|
+
```
|
|
1479
|
+
|
|
1480
|
+
The `findNode` function follows links and references
|
|
1481
|
+
* The function now supports `ref` nodes. Ref nodes are schema nodes having a `ref` property which is a reference to another node, possibly in a different schema.
|
|
1482
|
+
* If the xpath passed to the function ends with a ref node, the ref node itself will be returned. We're not following the reference. You can use the `refTarget` method to explicitely follow the reference
|
|
1483
|
+
* If the xpath traverse intermediate nodes which are ref nodes, the `findNode` method will follow the reference. For instance, the start activity in a workflow is a reference. Finding the xpath "start/@img" will follow the start reference and find the @img attribute from there
|
|
1484
|
+
|
|
1485
|
+
* Support for links. If the xpath parameter contains links, `findNode` will follow the link
|
|
1486
|
+
target with the same rules as for reference nodes. To get the target of a link, use the `linkTarget` method instead of `refTarget`.
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
For insance, you can get the country of a recipient who clicked in an email. This call follows the link from nms:broadLogRcp to nms:recipient and then from nms:recipient to nms:country, returning the country isoA3 attribute.
|
|
1490
|
+
```js
|
|
1491
|
+
const schema = await application.getSchema("nms:broadLogRcp");
|
|
1492
|
+
const node = await schema.root.findNode("recipient/country/@isoA3");
|
|
1493
|
+
```
|
|
1494
|
+
|
|
1495
|
+
The same syntax can be used for reference nodes. For instance, getting the attributes of the start activity of a workflow:
|
|
1496
|
+
```js
|
|
1497
|
+
const schema = await application.getSchema("xtk:workflow");
|
|
1498
|
+
const node = await schema.root.findNode("start/@name");
|
|
1499
|
+
```
|
|
1500
|
+
|
|
1501
|
+
In order to actually iterate over the children, things are a little bit more complicated
|
|
1502
|
+
```js
|
|
1503
|
+
const schema = await application.getSchema("xtk:workflow");
|
|
1504
|
+
const start = await schema.root.findNode("start");
|
|
1505
|
+
// start is the ref node, not the target of the ref. One need to explicitely
|
|
1506
|
+
// follow the ref in order to get the list of children
|
|
1507
|
+
const target = await start.refTarget();
|
|
1508
|
+
target.children.forEach(child => ... );
|
|
1509
|
+
```
|
|
1510
|
+
|
|
1511
|
+
To get the root node of the target of a link, use the `linkTarget` function
|
|
1512
|
+
```js
|
|
1513
|
+
const schema = await application.getSchema("nms:broadLogRcp");
|
|
1514
|
+
const node = await schema.root.findNode("recipient/country");
|
|
1515
|
+
// node is the country link, not the root node of the nms:country schema
|
|
1516
|
+
const root = await node.linkTarget();
|
|
1517
|
+
// root is the root node of the nms:country schema
|
|
1518
|
+
```
|
|
1519
|
+
|
|
1520
|
+
|
|
1408
1521
|
### XtkSchema
|
|
1409
1522
|
|
|
1410
1523
|
| Attribute | Description |
|
|
@@ -1426,9 +1539,9 @@ A schema is also a `XtkSchemaNode` and the corresponding properties/methods are
|
|
|
1426
1539
|
|
|
1427
1540
|
### XtkSchemaNode
|
|
1428
1541
|
|
|
1429
|
-
| Attribute |
|
|
1542
|
+
| Attribute | Description |
|
|
1430
1543
|
|---|---|
|
|
1431
|
-
| **children** | A map of children of the node
|
|
1544
|
+
| **children** | A array/map of children of the node. See note on the ArrayMap structure below
|
|
1432
1545
|
| **dataPolicy** | Returns a string of characters which provides the data policy of the current node.
|
|
1433
1546
|
| **description** | A long, human readable, description of the node
|
|
1434
1547
|
| **editType** |Returns a string of characters which specifies the editing type of the current node.
|
|
@@ -1438,12 +1551,12 @@ A schema is also a `XtkSchemaNode` and the corresponding properties/methods are
|
|
|
1438
1551
|
| **image** | Returns the name of the image in the form of a string of characters.
|
|
1439
1552
|
| **img** | Returns the name of the image in the form of a string of characters. (alias to `image` property)
|
|
1440
1553
|
| **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`
|
|
1554
|
+
| **keys** | A array/map of keys in this node, indexed by key name. Map values are of type `XtkSchemaKey`
|
|
1442
1555
|
| **hasEnumeration** | Returns a boolean which indicates whether the value of the current node is linked to an enumeration.
|
|
1443
1556
|
| **childrenCount** | Number of children nodes
|
|
1444
1557
|
| **hasSQLTable** | Returns a boolean which indicates whether the current node is linked to an SQL table.
|
|
1445
1558
|
| **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
|
|
1559
|
+
| **schema** | The schema (`XtkSchema`) to which this node belongs
|
|
1447
1560
|
| **isAdvanced** | Returns a boolean which indicates whether the current node is advanced or not.
|
|
1448
1561
|
| **isAnyType** | Returns a boolean which indicates whether the current node is ordinary.
|
|
1449
1562
|
| **isAttribute** | Indicates if the node is an attribute (true) or an element (false)
|
|
@@ -1466,13 +1579,13 @@ A schema is also a `XtkSchemaNode` and the corresponding properties/methods are
|
|
|
1466
1579
|
| **isRequired** | Returns a boolean which indicates whether or not the value of the current node is mandatory.
|
|
1467
1580
|
| **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
1581
|
| **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
|
|
1582
|
+
| **isTemporaryTable** | Returns a boolean indicating whether the table is a temporary table. The table will not be created during database creation.
|
|
1470
1583
|
| **unbound** | Returns a boolean which indicates whether the current node has an unlimited number of children of the same type.
|
|
1471
1584
|
| **joins** | Element of type "link" has an array of XtkJoin. See `joinNodes` method.
|
|
1472
1585
|
| **label** | The label (i.e. human readable, localised) name of the node.
|
|
1473
1586
|
| **name** | The name of the node (internal name)
|
|
1474
|
-
| **nodePath**
|
|
1475
|
-
| **parent** | The parent node. Will be null for schema nodes
|
|
1587
|
+
| **nodePath** | The xpath of the node
|
|
1588
|
+
| **parent** | The parent node (a `XtkSchemaNode` object). Will be null for schema nodes
|
|
1476
1589
|
| **PKSequence** | Returns a character string that provides the name of the sequence to use for the primary key.
|
|
1477
1590
|
| **packageStatus** | Returns a number that gives the package status.
|
|
1478
1591
|
| **packageStatusString** | Returns a string that gives the package status ("never", "always", "default", or "preCreate").
|
|
@@ -1480,17 +1593,28 @@ A schema is also a `XtkSchemaNode` and the corresponding properties/methods are
|
|
|
1480
1593
|
| **SQLName** | The SQL name of the field. The property is an empty string if the object isn't an SQL type field.
|
|
1481
1594
|
| **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
1595
|
| **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
|
|
1596
|
+
| **length** | For string nodes, the maximum length of the node value. Alias to `size`.
|
|
1484
1597
|
| **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
1598
|
| **type** | The data type of the node, for instance "string", "long", etc.
|
|
1486
1599
|
| **userEnumeration** | Returns a string of characters which is the name of the user enumeration used by the current node.
|
|
1487
1600
|
| **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
1601
|
| **isMappedAsXml** | Is the field mapped as XML?
|
|
1489
1602
|
|
|
1603
|
+
|
|
1604
|
+
|
|
1490
1605
|
| Method | Description |
|
|
1491
1606
|
|---|---|
|
|
1492
|
-
| **
|
|
1493
|
-
| **
|
|
1607
|
+
| async **findNode** | Find a child node using a xpath. This function follows links and references if necessary and will dynamically fetch/cache necessary schemas.
|
|
1608
|
+
| async **refTarget** | Get the target node of a reference
|
|
1609
|
+
| async **linkTarget** | Get the target node of a link. See `target`
|
|
1610
|
+
| async **joinNodes** | Get the schema nodes corresponding to link. The function returns nodes for both the source and the destination of the link. See `joins`.
|
|
1611
|
+
| async **reverseLink** | Returns the node corresponding to the reverse link of a link. See `revLink` to get the reverse link name rather than the actual node
|
|
1612
|
+
| async **computeString** | Returns the compute string of a node, following references if necessary
|
|
1613
|
+
| async **enumeration** | For nodes whose value is an enumeration, return the `XtkEnumeration` object corresponding to the enumeration definition. See `enum` property to get the enumeration name instead of the object
|
|
1614
|
+
| **firstInternalKeyDef** |
|
|
1615
|
+
| **firstExternalKeyDef** |
|
|
1616
|
+
| **firstKeyDef** |
|
|
1617
|
+
|
|
1494
1618
|
|
|
1495
1619
|
|
|
1496
1620
|
### XtkSchemaKey
|
|
@@ -1503,7 +1627,7 @@ A schema is also a `XtkSchemaNode` and the corresponding properties/methods are
|
|
|
1503
1627
|
| **description** | A long, human readable, description of the key
|
|
1504
1628
|
| **isInternal** | Indicates if the key is an internal key (as opposed to an external key)
|
|
1505
1629
|
| **allowEmptyPart** |
|
|
1506
|
-
| **fields** | A
|
|
1630
|
+
| **fields** | A ArrayMap of key fields making up the key. Each value is a reference to a `XtkSchemaNode`
|
|
1507
1631
|
|
|
1508
1632
|
### XtkEnumeration
|
|
1509
1633
|
|
|
@@ -1515,7 +1639,7 @@ A schema is also a `XtkSchemaNode` and the corresponding properties/methods are
|
|
|
1515
1639
|
| **baseType** | The base type of the enumeration, usually "string" or "byte"
|
|
1516
1640
|
| **default** | The default value of the enumeration, casted to the enumeration type
|
|
1517
1641
|
| **hasImage** | If the enumeration has an image
|
|
1518
|
-
| **values** | A
|
|
1642
|
+
| **values** | A ArrayMap of enumeration values, of type `XtkEnumerationValue`
|
|
1519
1643
|
|
|
1520
1644
|
### XtkEnumerationValue
|
|
1521
1645
|
|
package/package-lock.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/acc-js-sdk",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@adobe/acc-js-sdk",
|
|
9
|
-
"version": "1.0
|
|
9
|
+
"version": "1.1.0",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"axios": "^0.25.0",
|