@adobe/acc-js-sdk 1.0.7 → 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/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.
@@ -470,7 +471,12 @@ More dynamic conversions can be achieved using the `as` function. See the types
470
471
 
471
472
  ```js
472
473
  stringValue = XtkCaster.as(anyValue, 6);
473
- ````
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
474
480
 
475
481
 
476
482
  ## DOM helpers
@@ -1013,6 +1019,8 @@ It's common to use variables in query conditions. For instance, in the above exa
1013
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
1014
1020
  parameter contains single quotes, your code will not work, but could also cause vulnerabilities.
1015
1021
 
1022
+ ### sdk.escapeXtk
1023
+
1016
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.
1017
1025
 
1018
1026
  You can use string concatenation like this. Note the lack of single quotes around the value.
@@ -1039,6 +1047,35 @@ This can also be used to escape other data types such as timestamps
1039
1047
  will return `{ expr: "@lastModified > = #2021-07-07T10:03:33.332Z# }`
1040
1048
 
1041
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
+
1042
1079
 
1043
1080
  ## Pagination
1044
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)
@@ -1299,23 +1336,24 @@ The `application` object can be obtained from a client, and will mimmic the Camp
1299
1336
 
1300
1337
  | Attribute/Method | Description |
1301
1338
  |---|---|
1302
- | buildNumber | The server build number
1303
- | instanceName | The name of the Campaign instance
1304
- | operator | Information about the current operator (i.e. logged user), of class `CurrentLogin`
1305
- | packages | List of installed packages, as an array of strings
1306
- | getSchema(schemaId) | Get a schema by id (see the Schemas section below)
1307
- | 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
+ | async **getSchema**(schemaId) | Get a schema by id (see the Schemas section below)
1344
+ | async **getEnumeration**(enumerationName, schemaOrSchemaId) | Get an enumeration
1345
+ | **hasPackage**(name) | Tests if a package is installed or not
1308
1346
 
1309
1347
 
1310
1348
  The `CurrentLogin` object has the following attributes / functions
1311
1349
 
1312
1350
  | Attribute/Method | Description |
1313
1351
  |---|---|
1314
- | id | the internal id (int32) of the operator
1315
- | login | the login name of the operator
1316
- | computeString | A human readable name for the operator
1317
- | timezone | The timezone of the operator
1318
- | rights | An array of strings describing the rights of the operators
1352
+ | **id** | the internal id (int32) of the operator
1353
+ | **login** | the login name of the operator
1354
+ | **computeString** | A human readable name for the operator
1355
+ | **timezone** | The timezone of the operator
1356
+ | **rights** | An array of strings describing the rights of the operators
1319
1357
 
1320
1358
  # Schemas
1321
1359
 
@@ -1356,85 +1394,264 @@ The Schema API closely mimmics the Campaign server side API : https://docs.adobe
1356
1394
 
1357
1395
  * The `XtkSchema` and associated classes (`XtkSchemaNode`, `XtkSchemaKey`, `XtkEnumeration` and `XtkEnumerationValue`) are all immutable. There are currently no API to create schemas dynamically
1358
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.
1359
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
1360
1399
 
1361
1400
  The entry point is the application object. Obtain a schema from its id:
1362
1401
 
1363
1402
  ```js
1364
1403
  const application = client.application;
1365
- const schema = application.getSchema("nms:recipient");
1404
+ const schema = await application.getSchema("nms:recipient");
1366
1405
  ```
1367
1406
 
1368
1407
  This return a schema object of class `XtkSchema`
1369
1408
 
1370
1409
 
1371
- ### XtkSchema / XtkSchemaNode
1372
-
1373
- | Attribute/Method | | Description |
1374
- |---|---|---|
1375
- | schema | | The schema to which this node belongs
1376
- | id | schema | For schemas, the id of the schema. For instance "nms:recipient"
1377
- | namespace | schema | For schemas, the namespace of the schema. For instance "nms"
1378
- | name | | The name of the node (internal name)
1379
- | label | | The label (i.e. human readable, localised) name of the node.
1380
- | labelSingular | schema | The singular label (i.e. human readable, localised) name of the schema. The label of a schema is typically a plural.
1381
- | description | | A long, human readable, description of the node
1382
- | img | | The name of the image (if any) corresponding to the node
1383
- | type | | The data type of the node, for instance "string", "long", etc.
1384
- | length | | For string nodes, the maximum length of the node value
1385
- | ref | |
1386
- | isAttribute | | Indicates if the node is an attribute (true) or an element (false)
1387
- | children | | A map of children of the node, indexed by name. Names never contain the "@" sign, even attribute names
1388
- | childrenCount | | Number of children nodes
1389
- | parent | | The parent node. Will be null for schema nodes
1390
- | 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
1391
- | userDescription | |
1392
- | keys | | A map of keys in this node, indexed by key name. Map values are of type `XtkSchemaKey`
1393
- | nodePath | | The absolute full path of the node
1394
- | hasChild(name) | | Tests if the node has a child wih the given name
1395
- | findNode(path) | Find a child node using a xpath
1396
- | isLibrary | schema | For schemas, indicates if the schema is a library
1397
- | mappingType | schema | Schema mapping type. Usually "sql"
1398
- | xml | schema | The XML (DOM) corresponding to this schema
1399
- | root | schema | The schema root node, if there is one. A reference to a `XtkSchemaNode`
1400
- | enumerations | schema | Map of enumerations in this schema, indexed by enumeration name. Values are of type `XtkEnumeration`
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
+
1521
+ ### XtkSchema
1522
+
1523
+ | Attribute | Description |
1524
+ |---|---|
1525
+ | **id** | The id of the schema. For instance "nms:recipient"
1526
+ | **namespace** | The namespace of the schema. For instance "nms"
1527
+ | **name** | The name of the schema (internal name)
1528
+ | **label** | The label (i.e. human readable, localised) name of the node.
1529
+ | **labelSingular** | The singular label (i.e. human readable, localised) name of the schema. The label of a schema is typically a plural.
1530
+ | **isLibrary** | For schemas, indicates if the schema is a library
1531
+ | **mappingType** |Schema mapping type. Usually "sql"
1532
+ | **md5** | The MD5 code of the schema in the form of a hexadecimal string
1533
+ | **xml** | The XML (DOM) corresponding to this schema.<br>Note: this attribute is not available in the JS SDK.
1534
+ | **root** | The schema root node, if there is one. A reference to a `XtkSchemaNode`
1535
+ | **enumerations** | Map of enumerations in this schema, indexed by enumeration name. Values are of type `XtkEnumeration`
1536
+ | **userDescription** | The description of the schema in the form of a string.
1537
+
1538
+ A schema is also a `XtkSchemaNode` and the corresponding properties/methods are also availale.
1539
+
1540
+ ### XtkSchemaNode
1541
+
1542
+ | Attribute | Description |
1543
+ |---|---|
1544
+ | **children** | A array/map of children of the node. See note on the ArrayMap structure below
1545
+ | **dataPolicy** | Returns a string of characters which provides the data policy of the current node.
1546
+ | **description** | A long, human readable, description of the node
1547
+ | **editType** |Returns a string of characters which specifies the editing type of the current node.
1548
+ | **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`
1549
+ | **enumerationImage** | Returns the name of the image of the current node in the form of a string of characters.
1550
+ | **folderModel** |Only on the root node, returns a string which contains the folder template(s). On the other nodes, it returns undefined.
1551
+ | **image** | Returns the name of the image in the form of a string of characters.
1552
+ | **img** | Returns the name of the image in the form of a string of characters. (alias to `image` property)
1553
+ | **integrity** | Returns the link integrity type.
1554
+ | **keys** | A array/map of keys in this node, indexed by key name. Map values are of type `XtkSchemaKey`
1555
+ | **hasEnumeration** | Returns a boolean which indicates whether the value of the current node is linked to an enumeration.
1556
+ | **childrenCount** | Number of children nodes
1557
+ | **hasSQLTable** | Returns a boolean which indicates whether the current node is linked to an SQL table.
1558
+ | **hasUserEnumeration** | Returns a boolean which indicates whether the value of the current node is linked to a user enumeration.
1559
+ | **schema** | The schema (`XtkSchema`) to which this node belongs
1560
+ | **isAdvanced** | Returns a boolean which indicates whether the current node is advanced or not.
1561
+ | **isAnyType** | Returns a boolean which indicates whether the current node is ordinary.
1562
+ | **isAttribute** | Indicates if the node is an attribute (true) or an element (false)
1563
+ | **isAutoIncrement** | Returns a boolean which indicates whether the value of the current node is incremented automatically.
1564
+ | **isAutoPK** | Returns a boolean which indicates whether the current node is a primary key.
1565
+ | **isAutoUUID** | Yes | No | Returns a boolean which indicates whether the current node is an automatic UUID
1566
+ | **isAutoStg** | Yes | No | Returns a boolean which indicates whether the schema is a staging schema
1567
+ | **isBlob** | Returns a boolean which indicates whether the current node is a BLOB.
1568
+ | **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.
1569
+ | **isCDATA** | Returns a boolean which indicates whether the current node is mapped from CDATA type XML.
1570
+ | **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.
1571
+ | **isDefaultOnDuplicate** | Returns a boolean. If the value added is vrai, during record deduplication, the default value (defined in defaultValue) is automatically reapplied during recording.
1572
+ | **isElementOnly** | Returns a boolean which indicates whether the current node is a logical sub-division of the schema.
1573
+ | **isExternalJoin** | True if the node is a link and if the join is external.
1574
+ | **isLink** | Returns a boolean which indicates whether the node is a link.
1575
+ | **isMappedAsXML** | Returns a boolean which indicates whether the node is an XML mapping.
1576
+ | **isMemo** | Returns a boolean which indicates whether the current node is mapped by a Memo.
1577
+ | **isMemoData** | Returns a boolean which indicates whether the current node is mapped by a MemoData.
1578
+ | **isNotNull** | Returns a boolean which indicates whether or not the current node can take the null value into account.
1579
+ | **isRequired** | Returns a boolean which indicates whether or not the value of the current node is mandatory.
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
1581
+ | **isSQL** | Returns a boolean which indicates whether the current node is mapped in SQL.
1582
+ | **isTemporaryTable** | Returns a boolean indicating whether the table is a temporary table. The table will not be created during database creation.
1583
+ | **unbound** | Returns a boolean which indicates whether the current node has an unlimited number of children of the same type.
1584
+ | **joins** | Element of type "link" has an array of XtkJoin. See `joinNodes` method.
1585
+ | **label** | The label (i.e. human readable, localised) name of the node.
1586
+ | **name** | The name of the node (internal name)
1587
+ | **nodePath** | The xpath of the node
1588
+ | **parent** | The parent node (a `XtkSchemaNode` object). Will be null for schema nodes
1589
+ | **PKSequence** | Returns a character string that provides the name of the sequence to use for the primary key.
1590
+ | **packageStatus** | Returns a number that gives the package status.
1591
+ | **packageStatusString** | Returns a string that gives the package status ("never", "always", "default", or "preCreate").
1592
+ | **revLink** | Returns the name of the reverse link in the link target schema. See `reverseLink` method to get the actual reverse link object
1593
+ | **SQLName** | The SQL name of the field. The property is an empty string if the object isn't an SQL type field.
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.
1595
+ | **size** | For string nodes, the maximum length of the node value. Alias to `length`.
1596
+ | **length** | For string nodes, the maximum length of the node value. Alias to `size`.
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.
1598
+ | **type** | The data type of the node, for instance "string", "long", etc.
1599
+ | **userEnumeration** | Returns a string of characters which is the name of the user enumeration used by the current node.
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.
1601
+ | **isMappedAsXml** | Is the field mapped as XML?
1602
+
1603
+
1604
+
1605
+ | Method | Description |
1606
+ |---|---|
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
+
1401
1618
 
1402
1619
 
1403
1620
  ### XtkSchemaKey
1404
1621
 
1405
1622
  | Attribute/Method | Description |
1406
1623
  |---|---|
1407
- | schema | The schema to which this key belongs
1408
- | name | The name of the key (internal name)
1409
- | label | The label (i.e. human readable, localised) name of the key
1410
- | description | A long, human readable, description of the key
1411
- | isInternal |
1412
- | allowEmptyPart |
1413
- | fields | A map of key fields making up the key. Each value is a reference to a `XtkSchemaNode`
1624
+ | **schema** | The schema to which this key belongs
1625
+ | **name** | The name of the key (internal name)
1626
+ | **label** | The label (i.e. human readable, localised) name of the key
1627
+ | **description** | A long, human readable, description of the key
1628
+ | **isInternal** | Indicates if the key is an internal key (as opposed to an external key)
1629
+ | **allowEmptyPart** |
1630
+ | **fields** | A ArrayMap of key fields making up the key. Each value is a reference to a `XtkSchemaNode`
1414
1631
 
1415
1632
  ### XtkEnumeration
1416
1633
 
1417
1634
  | Attribute/Method | Description |
1418
1635
  |---|---|
1419
- | name | The name of the key (internal name)
1420
- | label | The label (i.e. human readable, localised) name of the key
1421
- | description | A long, human readable, description of the key
1422
- | baseType |
1423
- | default |
1424
- | hasImage |
1425
- | values | A map of enumeration values, by name of value. Value is of type `XtkEnumerationValue`
1636
+ | **name** | The name of the enumeration, fully qualified, i.e. prefixed with the schema id
1637
+ | **label** | The label (i.e. human readable, localised) name of the key
1638
+ | **description** | A long, human readable, description of the key
1639
+ | **baseType** | The base type of the enumeration, usually "string" or "byte"
1640
+ | **default** | The default value of the enumeration, casted to the enumeration type
1641
+ | **hasImage** | If the enumeration has an image
1642
+ | **values** | A ArrayMap of enumeration values, of type `XtkEnumerationValue`
1426
1643
 
1427
1644
  ### XtkEnumerationValue
1428
1645
 
1429
1646
  | Attribute/Method | Description |
1430
1647
  |---|---|
1431
- | name | The name of the key (internal name)
1432
- | label | The label (i.e. human readable, localised) name of the key
1433
- | description | A long, human readable, description of the key
1434
- | image |
1435
- | enabledIf |
1436
- | applicableIf |
1437
- | value | The value of the enumeration (casted to the proper Javascript type)
1648
+ | **name** | The name of the key (internal name)
1649
+ | **label** | The label (i.e. human readable, localised) name of the key
1650
+ | **description** | A long, human readable, description of the key
1651
+ | **image** |
1652
+ | **enabledIf** |
1653
+ | **applicableIf** |
1654
+ | **value** | The value of the enumeration (casted to the proper Javascript type)
1438
1655
 
1439
1656
  # Advanced Topics
1440
1657
 
@@ -1454,6 +1671,28 @@ If you need to access entity attributes (or child elements) in a generic way, yo
1454
1671
  * `getChildElements` to get the child elements. The result can be iterated on with a `for...of...` loop
1455
1672
  * `getElement` to get a child element whose attributes and child elements can also be accessed by the EntityAccessor API
1456
1673
 
1674
+ ## Invoking SOAP calls dynamically
1675
+ Soap calls can be invoked dynamically as follows
1676
+
1677
+ ```js
1678
+ const namespace = client.NLWS["xtkSession"];
1679
+ const method = namespace["getOption"];
1680
+ const result = await method.call(namespace, parameters);
1681
+ ```
1682
+
1683
+ where parameters is the list of parameters to the SOAP call.
1684
+ Parameters can be a function which can compute and return the list of parameters as the function is being called:
1685
+
1686
+ ```js
1687
+ const result = await method.call(namespace, (method, callContext) => {
1688
+ return parameters;
1689
+ });
1690
+ ```
1691
+ The `method` parameter is the XML definition of the SOAP method call. The `callContext` is an object which contains the following attributes:
1692
+ * `schemaId` is the id of the schema containing the SOAP method
1693
+ * `namespace` is the call namespace
1694
+ * `object` is only used for non-static call and contains the "this" of the call.
1695
+
1457
1696
 
1458
1697
 
1459
1698
  # Build & Run
package/compile.js CHANGED
@@ -38,6 +38,7 @@ var resources = [
38
38
  { name: "./optionCache.js" },
39
39
  { name: "./soap.js" },
40
40
  { name: "./crypto.js" },
41
+ { name: "./testUtil.js" },
41
42
  { name: "./application.js" },
42
43
  { name: "./client.js" },
43
44
  { name: "./index.js" },
package/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@adobe/acc-js-sdk",
3
- "version": "1.0.7",
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.7",
9
+ "version": "1.1.0",
10
10
  "license": "ISC",
11
11
  "dependencies": {
12
12
  "axios": "^0.25.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/acc-js-sdk",
3
- "version": "1.0.7",
3
+ "version": "1.1.0",
4
4
  "description": "ACC Javascript SDK",
5
5
  "main": "src/index.js",
6
6
  "homepage": "https://github.com/adobe/acc-js-sdk#readme",