@fluid-experimental/property-changeset 2.0.0-internal.1.2.0.93071 → 2.0.0-internal.1.2.2
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/dist/changeset.d.ts.map +1 -1
- package/dist/changeset.js +3 -6
- package/dist/changeset.js.map +1 -1
- package/dist/changeset_operations/array.d.ts +31 -0
- package/dist/changeset_operations/array.d.ts.map +1 -1
- package/dist/changeset_operations/array.js +52 -47
- package/dist/changeset_operations/array.js.map +1 -1
- package/dist/changeset_operations/indexedCollection.d.ts +12 -14
- package/dist/changeset_operations/indexedCollection.d.ts.map +1 -1
- package/dist/changeset_operations/indexedCollection.js +13 -14
- package/dist/changeset_operations/indexedCollection.js.map +1 -1
- package/dist/helpers/typeidHelper.d.ts +6 -6
- package/dist/helpers/typeidHelper.d.ts.map +1 -1
- package/dist/helpers/typeidHelper.js +16 -26
- package/dist/helpers/typeidHelper.js.map +1 -1
- package/dist/pathHelper.d.ts +1 -1
- package/dist/pathHelper.d.ts.map +1 -1
- package/dist/pathHelper.js +50 -52
- package/dist/pathHelper.js.map +1 -1
- package/dist/templateValidator.d.ts +58 -26
- package/dist/templateValidator.d.ts.map +1 -1
- package/dist/templateValidator.js +64 -38
- package/dist/templateValidator.js.map +1 -1
- package/dist/test/array.spec.js +3 -6
- package/dist/test/array.spec.js.map +1 -1
- package/dist/test/pathHelper.spec.js +2 -4
- package/dist/test/pathHelper.spec.js.map +1 -1
- package/dist/test/reversibleCs.spec.js +2 -4
- package/dist/test/reversibleCs.spec.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/dist/test/validator/templateValidator.spec.js +5 -10
- package/dist/test/validator/templateValidator.spec.js.map +1 -1
- package/dist/utils.d.ts +131 -103
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +160 -167
- package/dist/utils.js.map +1 -1
- package/dist/validationResultBuilder.d.ts +2 -4
- package/dist/validationResultBuilder.d.ts.map +1 -1
- package/dist/validationResultBuilder.js +1 -7
- package/dist/validationResultBuilder.js.map +1 -1
- package/lib/changeset.js +3 -6
- package/lib/changeset.js.map +1 -1
- package/lib/changeset_operations/array.js +52 -47
- package/lib/changeset_operations/array.js.map +1 -1
- package/lib/changeset_operations/indexedCollection.js +13 -14
- package/lib/changeset_operations/indexedCollection.js.map +1 -1
- package/lib/helpers/typeidHelper.js +16 -26
- package/lib/helpers/typeidHelper.js.map +1 -1
- package/lib/pathHelper.js +50 -52
- package/lib/pathHelper.js.map +1 -1
- package/lib/templateValidator.js +64 -38
- package/lib/templateValidator.js.map +1 -1
- package/lib/utils.js +160 -167
- package/lib/utils.js.map +1 -1
- package/lib/validationResultBuilder.js +1 -7
- package/lib/validationResultBuilder.js.map +1 -1
- package/package.json +3 -3
package/dist/utils.js
CHANGED
|
@@ -30,16 +30,17 @@ const { PROPERTY_PATH_DELIMITER, MSG } = property_common_1.constants;
|
|
|
30
30
|
* @alias property-changeset.Utils
|
|
31
31
|
* @class
|
|
32
32
|
*/
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
33
34
|
var Utils;
|
|
34
35
|
(function (Utils) {
|
|
35
36
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
* Traverses a ChangeSet recursively and invokes the callback for each visited property.
|
|
38
|
+
*
|
|
39
|
+
* @param in_preCallback - The (pre-order) callback function that is invoked for each property
|
|
40
|
+
* @param in_postCallback - The (post-order) callback function that is invoked for each property
|
|
41
|
+
* @param in_context - The traversal context for the currently processed property
|
|
42
|
+
* @param in_levelCallback - A callback for when a node is reached
|
|
43
|
+
*/
|
|
43
44
|
function _traverseChangeSetRecursivelyAsync(in_preCallback, in_postCallback, in_context, in_levelCallback) {
|
|
44
45
|
let pathSeparator;
|
|
45
46
|
let currentPath;
|
|
@@ -112,14 +113,11 @@ var Utils;
|
|
|
112
113
|
let nextSegmentToPushInParentStack = in_context.getLastSegment();
|
|
113
114
|
// Note: we don't quote the path string here, since the paths
|
|
114
115
|
// in a ChangeSet are already quoted, if necessary
|
|
115
|
-
|
|
116
|
+
in_context._lastSegmentString = currentTypeIdContext === "map" ||
|
|
116
117
|
currentTypeIdContext === "array" ||
|
|
117
|
-
currentTypeIdContext === "set"
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
else {
|
|
121
|
-
in_context._lastSegmentString = pathSeparator + escapedSegment;
|
|
122
|
-
}
|
|
118
|
+
currentTypeIdContext === "set"
|
|
119
|
+
? `[${escapedSegment}]`
|
|
120
|
+
: pathSeparator + escapedSegment;
|
|
123
121
|
in_context._fullPath = currentPath + in_context.getLastSegmentString();
|
|
124
122
|
// Store the typeid and nested ChangeSet
|
|
125
123
|
in_context._typeid = in_nestedTypeid;
|
|
@@ -469,14 +467,11 @@ var Utils;
|
|
|
469
467
|
const escapedSegment = in_escape && (0, isString_1.default)(in_segment) ? pathHelper_1.PathHelper.quotePathSegmentIfNeeded(in_segment) : in_segment;
|
|
470
468
|
let nextSegmentToPushInParentStack = in_context._lastSegment;
|
|
471
469
|
// Note: we don't quote the path string here, since the paths in a ChangeSet are already quoted, if necessary
|
|
472
|
-
|
|
470
|
+
in_context._lastSegmentString = currentTypeIdContext === "map" ||
|
|
473
471
|
currentTypeIdContext === "array" ||
|
|
474
|
-
currentTypeIdContext === "set"
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
else {
|
|
478
|
-
in_context._lastSegmentString = pathSeparator + escapedSegment;
|
|
479
|
-
}
|
|
472
|
+
currentTypeIdContext === "set"
|
|
473
|
+
? `[${escapedSegment}]`
|
|
474
|
+
: pathSeparator + escapedSegment;
|
|
480
475
|
in_context._fullPath = currentPath + in_context._lastSegmentString;
|
|
481
476
|
// Store the typeid and nested ChangeSet
|
|
482
477
|
in_context._typeid = in_nestedTypeid;
|
|
@@ -759,12 +754,9 @@ var Utils;
|
|
|
759
754
|
*/
|
|
760
755
|
getPostLastSegment() {
|
|
761
756
|
if (this._propertyContainerType === "array" && (0, isNumber_1.default)(this._lastSegment) && this._arrayIteratorOffset !== undefined) {
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
else {
|
|
766
|
-
return this._lastSegment + this._arrayIteratorOffset;
|
|
767
|
-
}
|
|
757
|
+
return this._operationType === "remove"
|
|
758
|
+
? this._lastSegment + this._arrayIteratorOffset - this._arrayLocalIndex
|
|
759
|
+
: this._lastSegment + this._arrayIteratorOffset;
|
|
768
760
|
}
|
|
769
761
|
else {
|
|
770
762
|
return this._lastSegment;
|
|
@@ -989,14 +981,7 @@ var Utils;
|
|
|
989
981
|
}
|
|
990
982
|
else {
|
|
991
983
|
// if we're given an extra rootTypeId, use that
|
|
992
|
-
|
|
993
|
-
context._typeid = in_params.rootTypeid;
|
|
994
|
-
}
|
|
995
|
-
else {
|
|
996
|
-
// By default, we assume that a ChangeSet without a typeid affects a NodeProperty, since that is the default
|
|
997
|
-
// for a repository root
|
|
998
|
-
context._typeid = "NodeProperty";
|
|
999
|
-
}
|
|
984
|
+
context._typeid = in_params.rootTypeid ? in_params.rootTypeid : "NodeProperty";
|
|
1000
985
|
}
|
|
1001
986
|
context._nestedChangeSet = in_changeSet;
|
|
1002
987
|
context._parentNestedChangeSet = in_changeSet;
|
|
@@ -1027,14 +1012,7 @@ var Utils;
|
|
|
1027
1012
|
}
|
|
1028
1013
|
else {
|
|
1029
1014
|
// if we're given an extra rootTypeId, use that
|
|
1030
|
-
|
|
1031
|
-
context._typeid = in_params.rootTypeid;
|
|
1032
|
-
}
|
|
1033
|
-
else {
|
|
1034
|
-
// By default, we assume that a ChangeSet without a typeid affects a NodeProperty, since that is the default
|
|
1035
|
-
// for a repository root
|
|
1036
|
-
context._typeid = "NodeProperty";
|
|
1037
|
-
}
|
|
1015
|
+
context._typeid = in_params.rootTypeid ? in_params.rootTypeid : "NodeProperty";
|
|
1038
1016
|
}
|
|
1039
1017
|
context._nestedChangeSet = in_changeSet;
|
|
1040
1018
|
context._parentNestedChangeSet = in_changeSet;
|
|
@@ -1075,9 +1053,8 @@ var Utils;
|
|
|
1075
1053
|
* @param in_callback - A callback that is used to emit every template
|
|
1076
1054
|
* @param in_finalizer - A callback that is called when enumeration is completed
|
|
1077
1055
|
*
|
|
1078
|
-
* @returns All templates that appear in the ChangeSet
|
|
1079
|
-
*
|
|
1080
|
-
* definition (object)
|
|
1056
|
+
* @returns All templates that appear in the ChangeSet.
|
|
1057
|
+
* The returned object has members key (string), corresponding to the type and value with the definition (object)
|
|
1081
1058
|
*/
|
|
1082
1059
|
function enumerateSchemas(in_changeSet, in_callback, in_finalizer) {
|
|
1083
1060
|
const result = [];
|
|
@@ -1117,14 +1094,10 @@ var Utils;
|
|
|
1117
1094
|
}
|
|
1118
1095
|
return;
|
|
1119
1096
|
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
}
|
|
1125
|
-
else {
|
|
1126
|
-
operationScope = userData;
|
|
1127
|
-
}
|
|
1097
|
+
const operationScope = in_context.getPropertyContainerType() !== "template"
|
|
1098
|
+
? (userData[in_context.getOperationType()] = userData[in_context.getOperationType()]
|
|
1099
|
+
|| (in_context.getPropertyContainerType() === "array" ? [] : {}))
|
|
1100
|
+
: userData;
|
|
1128
1101
|
if (typeidHelper_1.TypeIdHelper.isPrimitiveType(in_context.getTypeid())) {
|
|
1129
1102
|
// This is a primitive type, we store it under its name in the result
|
|
1130
1103
|
operationScope[in_context.getLastSegment()] = in_context.getNestedChangeSet();
|
|
@@ -1200,10 +1173,13 @@ var Utils;
|
|
|
1200
1173
|
* @param in_changeSet - The ChangeSet to process
|
|
1201
1174
|
* @param in_excludetypeids - Exclude all typeids from the returned ChangeSet
|
|
1202
1175
|
* @throws if path is invalid.
|
|
1203
|
-
* @returns The changes that are applied to the given path
|
|
1176
|
+
* @returns The changes that are applied to the given path.
|
|
1177
|
+
*
|
|
1178
|
+
* ```
|
|
1204
1179
|
* <pre>
|
|
1205
1180
|
* {insert: Object|undefined, modify: Object|undefined, remove: boolean|undefined}
|
|
1206
1181
|
* </pre>
|
|
1182
|
+
* ```
|
|
1207
1183
|
*/
|
|
1208
1184
|
function getChangesByPath(in_path, in_root, in_changeSet, in_excludetypeids) {
|
|
1209
1185
|
// if we're asked for the root, just return the root (in a modify)
|
|
@@ -1275,65 +1251,78 @@ var Utils;
|
|
|
1275
1251
|
/**
|
|
1276
1252
|
* Invoke a callback for all nested ChangeSets that correspond to a set of user supplied tokenized paths.
|
|
1277
1253
|
*
|
|
1278
|
-
* @param in_paths -
|
|
1279
|
-
*
|
|
1280
|
-
*
|
|
1281
|
-
*
|
|
1282
|
-
*
|
|
1283
|
-
*
|
|
1284
|
-
*
|
|
1254
|
+
* @param in_paths - A map or object which contains the tokenized paths as nested elements.
|
|
1255
|
+
* Common path segment are thus shared.
|
|
1256
|
+
*
|
|
1257
|
+
* NOTE: It is recommended to use Map as it provides better performance.
|
|
1258
|
+
* For example, for these three paths:
|
|
1259
|
+
*
|
|
1260
|
+
* - 'entry1'
|
|
1261
|
+
*
|
|
1262
|
+
* - 'nested.entry2'
|
|
1263
|
+
*
|
|
1264
|
+
* - 'nested.entry3'
|
|
1285
1265
|
*
|
|
1286
|
-
*
|
|
1287
|
-
* new Map([
|
|
1288
|
-
* ['entry', new Map()],
|
|
1289
|
-
* ['nested', new Map([
|
|
1290
|
-
* ['entry2', new Map()],
|
|
1291
|
-
* ['entry3', new Map()]
|
|
1292
|
-
* ])]
|
|
1293
|
-
* ])
|
|
1266
|
+
* Using a map for paths would look like this:
|
|
1294
1267
|
*
|
|
1295
|
-
*
|
|
1296
|
-
*
|
|
1297
|
-
*
|
|
1298
|
-
*
|
|
1299
|
-
*
|
|
1300
|
-
*
|
|
1301
|
-
*
|
|
1302
|
-
*
|
|
1268
|
+
* ```typescript
|
|
1269
|
+
* new Map([
|
|
1270
|
+
* ['entry', new Map()],
|
|
1271
|
+
* ['nested', new Map([
|
|
1272
|
+
* ['entry2', new Map()],
|
|
1273
|
+
* ['entry3', new Map()]
|
|
1274
|
+
* ])]
|
|
1275
|
+
* ])
|
|
1276
|
+
* ```
|
|
1303
1277
|
*
|
|
1304
|
-
*
|
|
1305
|
-
*
|
|
1306
|
-
*
|
|
1307
|
-
*
|
|
1308
|
-
*
|
|
1309
|
-
*
|
|
1310
|
-
*
|
|
1311
|
-
*
|
|
1312
|
-
*
|
|
1313
|
-
*
|
|
1314
|
-
*
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
*
|
|
1318
|
-
*
|
|
1319
|
-
*
|
|
1320
|
-
*
|
|
1321
|
-
*
|
|
1322
|
-
*
|
|
1323
|
-
*
|
|
1324
|
-
*
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
* @param
|
|
1331
|
-
*
|
|
1278
|
+
* While using objects for paths would look like this:
|
|
1279
|
+
*
|
|
1280
|
+
* ```typescript
|
|
1281
|
+
* {
|
|
1282
|
+
* entry: {},
|
|
1283
|
+
* nested: {
|
|
1284
|
+
* entry2: {}
|
|
1285
|
+
* entry3: {}
|
|
1286
|
+
* }
|
|
1287
|
+
* }
|
|
1288
|
+
* ```
|
|
1289
|
+
*
|
|
1290
|
+
* The element under the path, will be provided to the callback. If you have to pass additional data
|
|
1291
|
+
* to the callback, you can add private data by prefixing it with __ and setting
|
|
1292
|
+
* in_options.escapeLeadingDoubleUnderscore to true.
|
|
1293
|
+
* In case you do that, bear in mind that paths that refer to changeSet properties that have at least
|
|
1294
|
+
* two underscores as prefix in its id, should contain an extra underscore character as prefix:
|
|
1295
|
+
*
|
|
1296
|
+
* ```
|
|
1297
|
+
* | Path in changeSet | Path in paths |
|
|
1298
|
+
* | path0 | path0 | (unescaped)
|
|
1299
|
+
* | _path1 | _path1 | (unescaoed)
|
|
1300
|
+
* | __path2 | ___path2 | (escaped with one extra leading underscore)
|
|
1301
|
+
* | ___path3 | ____path3 | (also escaped, the same applies to N underscores where N >= 2)
|
|
1302
|
+
* ```
|
|
1303
|
+
* @param in_changeSet - The ChangeSet to process
|
|
1304
|
+
* @param in_callback - The function to invoke at the registered paths (it is called both for the interior and the
|
|
1305
|
+
* leaf nodes). The callback will be called for each node with the following parameters:
|
|
1306
|
+
*
|
|
1307
|
+
* - `context`: The current TraversalContext as returned by Utils.traverseChangeSetRecursively.
|
|
1308
|
+
* Can be used for querying the current Property type, operation, etc.
|
|
1309
|
+
*
|
|
1310
|
+
* - `currentSubPaths`: A subset of the tokenized paths passed in as input to this function that still need to be
|
|
1311
|
+
* processed from the current node
|
|
1312
|
+
*
|
|
1313
|
+
* - `currentTokenizedPath`: The tokenized path leading to the current node
|
|
1314
|
+
*
|
|
1315
|
+
* - `contractedPathSegment`: True if the current node is inside a contracted path segment (e.g.
|
|
1316
|
+
* currentTokenizedPath is ['foo'], coming from the changeset segment 'foo.bar'), false otherwise. If true, the
|
|
1317
|
+
* typeid from the context parameter may not be valid at the current node. Callbacks may ignore this if they are
|
|
1318
|
+
* not concerned with the type.
|
|
1319
|
+
*
|
|
1320
|
+
* @param in_options.rootOperation - The operation that has been applied to the root of the ChangeSet
|
|
1321
|
+
* (either 'insert' or 'modify')
|
|
1332
1322
|
* @param in_options.rootTypeid - The full type of the root Property of the ChangeSet
|
|
1333
|
-
* @param in_options.escapeLeadingDoubleUnderscore -
|
|
1334
|
-
*
|
|
1335
|
-
*
|
|
1336
|
-
* application.
|
|
1323
|
+
* @param in_options.escapeLeadingDoubleUnderscore - If this is set to true, keys which start with '__' will be
|
|
1324
|
+
* escaped (by adding an additional '_') before the lookup into the paths map. This frees the keyspace with
|
|
1325
|
+
* duplicated underscores for the use by the calling application.
|
|
1337
1326
|
*/
|
|
1338
1327
|
function getChangesToTokenizedPaths(in_paths, in_changeSet, in_callback, in_options = { escapeLeadingDoubleUnderscore: false, rootOperation: 'modify' }) {
|
|
1339
1328
|
const currentTokenizedPath = [];
|
|
@@ -1381,14 +1370,11 @@ var Utils;
|
|
|
1381
1370
|
return thisLevel;
|
|
1382
1371
|
};
|
|
1383
1372
|
const _toCallbackParam = (pathLevels) => {
|
|
1384
|
-
|
|
1373
|
+
return legacyPaths
|
|
1385
1374
|
// If a user provided objects as paths, they would expect objects in their callbacks as well.
|
|
1386
1375
|
// So, we transform the parameter to an object, which is not very performant but is backwards compatible.
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
else {
|
|
1390
|
-
return pathLevels;
|
|
1391
|
-
}
|
|
1376
|
+
? _convertMapToLevel(pathLevels)
|
|
1377
|
+
: pathLevels;
|
|
1392
1378
|
};
|
|
1393
1379
|
if (!(in_paths instanceof Map)) {
|
|
1394
1380
|
legacyPaths = true;
|
|
@@ -1484,32 +1470,37 @@ var Utils;
|
|
|
1484
1470
|
* Given a change set, this function will filter it based on a series of paths.
|
|
1485
1471
|
* The final ChangeSet will only include the paths in question starting from the root of
|
|
1486
1472
|
* the ChangeSet.
|
|
1487
|
-
*
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1491
|
-
*
|
|
1492
|
-
*
|
|
1493
|
-
*
|
|
1494
|
-
*
|
|
1495
|
-
*
|
|
1496
|
-
*
|
|
1497
|
-
*
|
|
1498
|
-
*
|
|
1499
|
-
*
|
|
1500
|
-
*
|
|
1501
|
-
*
|
|
1502
|
-
*
|
|
1473
|
+
*
|
|
1474
|
+
* @example Given the following change set:
|
|
1475
|
+
*
|
|
1476
|
+
* ```json
|
|
1477
|
+
* 'insert': {
|
|
1478
|
+
* 'String': {
|
|
1479
|
+
* 'string1': 'hello',
|
|
1480
|
+
* 'string2': 'world
|
|
1481
|
+
* }
|
|
1482
|
+
* }
|
|
1483
|
+
* ```
|
|
1484
|
+
*
|
|
1485
|
+
* And the path `['string1']`, the resulting ChangeSet will be:
|
|
1486
|
+
*
|
|
1487
|
+
* ```json
|
|
1488
|
+
* 'insert': {
|
|
1489
|
+
* 'String': {
|
|
1490
|
+
* 'string1': 'hello'
|
|
1491
|
+
* }
|
|
1492
|
+
* }
|
|
1493
|
+
* ```
|
|
1503
1494
|
*
|
|
1504
1495
|
* NOTE: Paths that traverse through sets and arrays are not supported.
|
|
1505
1496
|
*
|
|
1506
|
-
* @param in_changeSet - The changeset to parse
|
|
1497
|
+
* @param in_changeSet - The changeset to parse.
|
|
1507
1498
|
* @param in_paths - List of paths to filter by. This can either be passed
|
|
1508
|
-
*
|
|
1509
|
-
*
|
|
1510
|
-
*
|
|
1499
|
+
* as a flat array of paths or as a Map with the tokenized, tree structured paths, see the
|
|
1500
|
+
* documentation of getChangesToTokenizedPaths for an example.
|
|
1501
|
+
* Note: duplicate paths will be ignored including ones that encompasse other paths.
|
|
1511
1502
|
*
|
|
1512
|
-
* @throws
|
|
1503
|
+
* @throws If a path given resolves into an array or set.
|
|
1513
1504
|
* @returns - Filtered ChangeSet
|
|
1514
1505
|
*/
|
|
1515
1506
|
function getFilteredChangeSetByPaths(in_changeSet, in_paths) {
|
|
@@ -1556,21 +1547,15 @@ var Utils;
|
|
|
1556
1547
|
changeSetToPopulate = pathToChangeSet[parentPath] || changeSetToPopulate;
|
|
1557
1548
|
}
|
|
1558
1549
|
else if (index < tokenizedPath.length - 1) {
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
else {
|
|
1563
|
-
parentPath += `[${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}]`;
|
|
1564
|
-
}
|
|
1550
|
+
parentPath += context.getContainerStack()[index] !== "set" && context.getContainerStack()[index] !== "map"
|
|
1551
|
+
? `.${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}`
|
|
1552
|
+
: `[${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}]`;
|
|
1565
1553
|
changeSetToPopulate = pathToChangeSet[parentPath] || changeSetToPopulate;
|
|
1566
1554
|
}
|
|
1567
1555
|
else {
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
else {
|
|
1572
|
-
parentPath += `[${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}]`;
|
|
1573
|
-
}
|
|
1556
|
+
parentPath += context.getContainerStack()[index] !== "set" && context.getContainerStack()[index] !== "map"
|
|
1557
|
+
? `.${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}`
|
|
1558
|
+
: `[${pathHelper_1.PathHelper.quotePathSegmentIfNeeded(segment)}]`;
|
|
1574
1559
|
fullPath = parentPath;
|
|
1575
1560
|
}
|
|
1576
1561
|
pathsToDelete.push(parentPath);
|
|
@@ -1703,7 +1688,7 @@ var Utils;
|
|
|
1703
1688
|
*
|
|
1704
1689
|
* @param in_paths - An array with paths
|
|
1705
1690
|
* @returns {Map} A tree structured representation of the tokenized paths that can be
|
|
1706
|
-
*
|
|
1691
|
+
* passed to getChangesToTokenizedPaths and getFilteredChangeSetByPaths.
|
|
1707
1692
|
*/
|
|
1708
1693
|
function convertPathArrayToTree(in_paths) {
|
|
1709
1694
|
in_paths = Array.isArray(in_paths) ? in_paths : [in_paths];
|
|
@@ -1743,22 +1728,27 @@ var Utils;
|
|
|
1743
1728
|
* Given a change set, this function will filter it based on a series of paths.
|
|
1744
1729
|
* The final ChangeSet will exclude the paths in question starting from the root of
|
|
1745
1730
|
* the ChangeSet.
|
|
1746
|
-
*
|
|
1747
|
-
*
|
|
1748
|
-
*
|
|
1749
|
-
*
|
|
1750
|
-
*
|
|
1751
|
-
*
|
|
1752
|
-
*
|
|
1753
|
-
*
|
|
1754
|
-
*
|
|
1755
|
-
*
|
|
1756
|
-
*
|
|
1757
|
-
*
|
|
1758
|
-
*
|
|
1759
|
-
*
|
|
1760
|
-
*
|
|
1761
|
-
*
|
|
1731
|
+
*
|
|
1732
|
+
* @example Given the following change set:
|
|
1733
|
+
*
|
|
1734
|
+
* ```json
|
|
1735
|
+
* 'insert': {
|
|
1736
|
+
* 'String': {
|
|
1737
|
+
* 'string1': 'hello',
|
|
1738
|
+
* 'string2': 'world
|
|
1739
|
+
* }
|
|
1740
|
+
* }
|
|
1741
|
+
* ```
|
|
1742
|
+
*
|
|
1743
|
+
* And the path `['string1']`, the resulting ChangeSet will be:
|
|
1744
|
+
*
|
|
1745
|
+
* ```json
|
|
1746
|
+
* 'insert': {
|
|
1747
|
+
* 'String': {
|
|
1748
|
+
* 'string2': 'world'
|
|
1749
|
+
* }
|
|
1750
|
+
* }
|
|
1751
|
+
* ```
|
|
1762
1752
|
*
|
|
1763
1753
|
* NOTE: Paths that traverse through sets and arrays are not supported.
|
|
1764
1754
|
*
|
|
@@ -1793,7 +1783,8 @@ var Utils;
|
|
|
1793
1783
|
Utils.excludePathsFromChangeSet = excludePathsFromChangeSet;
|
|
1794
1784
|
/**
|
|
1795
1785
|
* Extract all paths from the ChangeSet in a flattened list and include the operations and typeid information.
|
|
1796
|
-
* NOTE: The paths returned also include the parent. i.e. the path 'nodeProp.subproperty' will result in
|
|
1786
|
+
* @remarks NOTE: The paths returned also include the parent. i.e. the path 'nodeProp.subproperty' will result in:
|
|
1787
|
+
* ```json
|
|
1797
1788
|
* {
|
|
1798
1789
|
* nodeProp: {
|
|
1799
1790
|
* operation: 'modify',
|
|
@@ -1804,6 +1795,8 @@ var Utils;
|
|
|
1804
1795
|
* typeid: { typeid: 'Float32', context: 'single', isEnum: false }
|
|
1805
1796
|
* }
|
|
1806
1797
|
* }
|
|
1798
|
+
* ```
|
|
1799
|
+
*
|
|
1807
1800
|
* @param in_changeSet - The changeset to extract paths from
|
|
1808
1801
|
* @param in_options - Set of options
|
|
1809
1802
|
* @param in_options.includeOperation - Flag to include the operation
|