@fluid-experimental/property-properties 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.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 +1 -0
- package/dist/containerSerializer.d.ts.map +1 -1
- package/dist/containerSerializer.js +5 -5
- package/dist/containerSerializer.js.map +1 -1
- package/dist/enableValidations.js.map +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.d.ts +10 -10
- package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.js +70 -53
- package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/dist/properties/arrayProperty.d.ts.map +1 -1
- package/dist/properties/arrayProperty.js +152 -103
- package/dist/properties/arrayProperty.js.map +1 -1
- package/dist/properties/baseProperty.d.ts +4 -4
- package/dist/properties/baseProperty.d.ts.map +1 -1
- package/dist/properties/baseProperty.js +69 -47
- package/dist/properties/baseProperty.js.map +1 -1
- package/dist/properties/boolProperty.d.ts.map +1 -1
- package/dist/properties/boolProperty.js +3 -3
- package/dist/properties/boolProperty.js.map +1 -1
- package/dist/properties/containerProperty.d.ts +8 -8
- package/dist/properties/containerProperty.d.ts.map +1 -1
- package/dist/properties/containerProperty.js +33 -26
- package/dist/properties/containerProperty.js.map +1 -1
- package/dist/properties/enumArrayProperty.d.ts.map +1 -1
- package/dist/properties/enumArrayProperty.js +14 -14
- package/dist/properties/enumArrayProperty.js.map +1 -1
- package/dist/properties/enumProperty.d.ts.map +1 -1
- package/dist/properties/enumProperty.js +17 -17
- package/dist/properties/enumProperty.js.map +1 -1
- package/dist/properties/floatProperties.js +4 -4
- package/dist/properties/floatProperties.js.map +1 -1
- package/dist/properties/index.d.ts +23 -23
- package/dist/properties/index.d.ts.map +1 -1
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.js +47 -37
- package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/dist/properties/intProperties.d.ts.map +1 -1
- package/dist/properties/intProperties.js +10 -10
- package/dist/properties/intProperties.js.map +1 -1
- package/dist/properties/lazyLoadedProperties.js.map +1 -1
- package/dist/properties/mapProperty.d.ts.map +1 -1
- package/dist/properties/mapProperty.js +21 -17
- package/dist/properties/mapProperty.js.map +1 -1
- package/dist/properties/namedNodeProperty.d.ts.map +1 -1
- package/dist/properties/namedNodeProperty.js +3 -3
- package/dist/properties/namedNodeProperty.js.map +1 -1
- package/dist/properties/namedProperty.d.ts.map +1 -1
- package/dist/properties/namedProperty.js +7 -5
- package/dist/properties/namedProperty.js.map +1 -1
- package/dist/properties/nodeProperty.d.ts.map +1 -1
- package/dist/properties/nodeProperty.js +5 -3
- package/dist/properties/nodeProperty.js.map +1 -1
- package/dist/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/dist/properties/primitiveTypeCasts.js +9 -9
- package/dist/properties/primitiveTypeCasts.js.map +1 -1
- package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
- package/dist/properties/referenceArrayProperty.js +31 -25
- package/dist/properties/referenceArrayProperty.js.map +1 -1
- package/dist/properties/referenceMapProperty.d.ts.map +1 -1
- package/dist/properties/referenceMapProperty.js +18 -18
- package/dist/properties/referenceMapProperty.js.map +1 -1
- package/dist/properties/referenceProperty.d.ts.map +1 -1
- package/dist/properties/referenceProperty.js +33 -29
- package/dist/properties/referenceProperty.js.map +1 -1
- package/dist/properties/setProperty.d.ts.map +1 -1
- package/dist/properties/setProperty.js +31 -29
- package/dist/properties/setProperty.js.map +1 -1
- package/dist/properties/stringProperty.d.ts.map +1 -1
- package/dist/properties/stringProperty.js +56 -40
- package/dist/properties/stringProperty.js.map +1 -1
- package/dist/properties/uintProperties.js +5 -5
- package/dist/properties/uintProperties.js.map +1 -1
- package/dist/properties/valueArrayProperty.d.ts +1 -1
- package/dist/properties/valueArrayProperty.d.ts.map +1 -1
- package/dist/properties/valueArrayProperty.js +30 -29
- package/dist/properties/valueArrayProperty.js.map +1 -1
- package/dist/properties/valueMapProperty.d.ts.map +1 -1
- package/dist/properties/valueMapProperty.js +31 -29
- package/dist/properties/valueMapProperty.js.map +1 -1
- package/dist/properties/valueProperty.d.ts.map +1 -1
- package/dist/properties/valueProperty.js +11 -9
- package/dist/properties/valueProperty.js.map +1 -1
- package/dist/propertyFactory.d.ts.map +1 -1
- package/dist/propertyFactory.js +309 -252
- package/dist/propertyFactory.js.map +1 -1
- package/dist/propertyTemplate.d.ts +17 -17
- package/dist/propertyTemplate.d.ts.map +1 -1
- package/dist/propertyTemplate.js +64 -45
- package/dist/propertyTemplate.js.map +1 -1
- package/dist/propertyTemplateWrapper.d.ts.map +1 -1
- package/dist/propertyTemplateWrapper.js +40 -25
- package/dist/propertyTemplateWrapper.js.map +1 -1
- package/dist/propertyUtils.d.ts.map +1 -1
- package/dist/propertyUtils.js.map +1 -1
- package/dist/test/properties/arrayProperty.spec.js +566 -490
- package/dist/test/properties/arrayProperty.spec.js.map +1 -1
- package/dist/test/properties/baseProperty.spec.js +293 -280
- package/dist/test/properties/baseProperty.spec.js.map +1 -1
- package/dist/test/properties/containerProperty.spec.js +100 -94
- package/dist/test/properties/containerProperty.spec.js.map +1 -1
- package/dist/test/properties/customArrayProperty.spec.js +174 -147
- package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumArrayProperty.spec.js +67 -63
- package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumProperty.spec.js +115 -97
- package/dist/test/properties/enumProperty.spec.js.map +1 -1
- package/dist/test/properties/float32.spec.js +5 -5
- package/dist/test/properties/float32.spec.js.map +1 -1
- package/dist/test/properties/int64ArrayProperty.spec.js +157 -93
- package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/int64MapProperty.spec.js +185 -166
- package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
- package/dist/test/properties/int64Property.spec.js +109 -109
- package/dist/test/properties/int64Property.spec.js.map +1 -1
- package/dist/test/properties/isLeafNode.spec.js +75 -76
- package/dist/test/properties/isLeafNode.spec.js.map +1 -1
- package/dist/test/properties/mapProperty.spec.js +571 -531
- package/dist/test/properties/mapProperty.spec.js.map +1 -1
- package/dist/test/properties/namedNodeProperty.spec.js +31 -31
- package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
- package/dist/test/properties/nodeProperty.spec.js +805 -795
- package/dist/test/properties/nodeProperty.spec.js.map +1 -1
- package/dist/test/properties/referenceProperty.spec.js +729 -679
- package/dist/test/properties/referenceProperty.spec.js.map +1 -1
- package/dist/test/properties/relationshipProperty.spec.js +16 -16
- package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
- package/dist/test/properties/setProperty.spec.js +288 -227
- package/dist/test/properties/setProperty.spec.js.map +1 -1
- package/dist/test/properties/stringProperty.spec.js +326 -318
- package/dist/test/properties/stringProperty.spec.js.map +1 -1
- package/dist/test/properties/uint64Property.spec.js +46 -36
- package/dist/test/properties/uint64Property.spec.js.map +1 -1
- package/dist/test/properties/valueMapProperty.spec.js +259 -246
- package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
- package/dist/test/properties/valueProperty.spec.js +49 -43
- package/dist/test/properties/valueProperty.spec.js.map +1 -1
- package/dist/test/propertyFactory.spec.js +2038 -1631
- package/dist/test/propertyFactory.spec.js.map +1 -1
- package/dist/test/propertyTemplateWrapper.spec.js +72 -102
- package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
- package/dist/test/propertyUtils.spec.js +22 -21
- package/dist/test/propertyUtils.spec.js.map +1 -1
- package/dist/test/reversibleChangeset.spec.js +857 -703
- package/dist/test/reversibleChangeset.spec.js.map +1 -1
- package/dist/test/setup.js +5 -5
- package/dist/test/setup.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +1 -1
- package/dist/test/utils.spec.js +1334 -1144
- package/dist/test/utils.spec.js.map +1 -1
- package/dist/test/validation/badMissingSemverInTypeid.js +20 -20
- package/dist/test/validation/badMissingSemverInTypeid.js.map +1 -1
- package/dist/test/validation/badPrimitiveTypeid.js +12 -12
- package/dist/test/validation/badPrimitiveTypeid.js.map +1 -1
- package/dist/test/validation/goodColorId.js +91 -91
- package/dist/test/validation/goodColorId.js.map +1 -1
- package/dist/test/validation/goodColorPalette.js +4 -4
- package/dist/test/validation/goodColorPalette.js.map +1 -1
- package/dist/test/validation/goodPointId.js +20 -20
- package/dist/test/validation/goodPointId.js.map +1 -1
- package/dist/test/validation/reversibleChangeSetTestData.js +23841 -2
- package/dist/test/validation/reversibleChangeSetTestData.js.map +1 -1
- package/lib/containerSerializer.d.ts.map +1 -1
- package/lib/containerSerializer.js +5 -5
- package/lib/containerSerializer.js.map +1 -1
- package/lib/enableValidations.js.map +1 -1
- package/lib/index.d.ts +19 -19
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +19 -19
- package/lib/index.js.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.d.ts +10 -10
- package/lib/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.js +70 -53
- package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/lib/properties/arrayProperty.d.ts.map +1 -1
- package/lib/properties/arrayProperty.js +152 -103
- package/lib/properties/arrayProperty.js.map +1 -1
- package/lib/properties/baseProperty.d.ts +4 -4
- package/lib/properties/baseProperty.d.ts.map +1 -1
- package/lib/properties/baseProperty.js +73 -51
- package/lib/properties/baseProperty.js.map +1 -1
- package/lib/properties/boolProperty.d.ts.map +1 -1
- package/lib/properties/boolProperty.js +3 -3
- package/lib/properties/boolProperty.js.map +1 -1
- package/lib/properties/containerProperty.d.ts +8 -8
- package/lib/properties/containerProperty.d.ts.map +1 -1
- package/lib/properties/containerProperty.js +33 -26
- package/lib/properties/containerProperty.js.map +1 -1
- package/lib/properties/enumArrayProperty.d.ts.map +1 -1
- package/lib/properties/enumArrayProperty.js +14 -14
- package/lib/properties/enumArrayProperty.js.map +1 -1
- package/lib/properties/enumProperty.d.ts.map +1 -1
- package/lib/properties/enumProperty.js +17 -17
- package/lib/properties/enumProperty.js.map +1 -1
- package/lib/properties/floatProperties.js +4 -4
- package/lib/properties/floatProperties.js.map +1 -1
- package/lib/properties/index.d.ts +23 -23
- package/lib/properties/index.d.ts.map +1 -1
- package/lib/properties/index.js +23 -23
- package/lib/properties/index.js.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.js +47 -37
- package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/lib/properties/intProperties.d.ts.map +1 -1
- package/lib/properties/intProperties.js +10 -10
- package/lib/properties/intProperties.js.map +1 -1
- package/lib/properties/lazyLoadedProperties.js.map +1 -1
- package/lib/properties/mapProperty.d.ts.map +1 -1
- package/lib/properties/mapProperty.js +21 -17
- package/lib/properties/mapProperty.js.map +1 -1
- package/lib/properties/namedNodeProperty.d.ts.map +1 -1
- package/lib/properties/namedNodeProperty.js +3 -3
- package/lib/properties/namedNodeProperty.js.map +1 -1
- package/lib/properties/namedProperty.d.ts.map +1 -1
- package/lib/properties/namedProperty.js +7 -5
- package/lib/properties/namedProperty.js.map +1 -1
- package/lib/properties/nodeProperty.d.ts.map +1 -1
- package/lib/properties/nodeProperty.js +5 -3
- package/lib/properties/nodeProperty.js.map +1 -1
- package/lib/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/lib/properties/primitiveTypeCasts.js +9 -9
- package/lib/properties/primitiveTypeCasts.js.map +1 -1
- package/lib/properties/referenceArrayProperty.d.ts.map +1 -1
- package/lib/properties/referenceArrayProperty.js +31 -25
- package/lib/properties/referenceArrayProperty.js.map +1 -1
- package/lib/properties/referenceMapProperty.d.ts.map +1 -1
- package/lib/properties/referenceMapProperty.js +18 -18
- package/lib/properties/referenceMapProperty.js.map +1 -1
- package/lib/properties/referenceProperty.d.ts.map +1 -1
- package/lib/properties/referenceProperty.js +33 -29
- package/lib/properties/referenceProperty.js.map +1 -1
- package/lib/properties/setProperty.d.ts.map +1 -1
- package/lib/properties/setProperty.js +31 -29
- package/lib/properties/setProperty.js.map +1 -1
- package/lib/properties/stringProperty.d.ts.map +1 -1
- package/lib/properties/stringProperty.js +56 -40
- package/lib/properties/stringProperty.js.map +1 -1
- package/lib/properties/uintProperties.js +5 -5
- package/lib/properties/uintProperties.js.map +1 -1
- package/lib/properties/valueArrayProperty.d.ts +1 -1
- package/lib/properties/valueArrayProperty.d.ts.map +1 -1
- package/lib/properties/valueArrayProperty.js +30 -29
- package/lib/properties/valueArrayProperty.js.map +1 -1
- package/lib/properties/valueMapProperty.d.ts.map +1 -1
- package/lib/properties/valueMapProperty.js +31 -29
- package/lib/properties/valueMapProperty.js.map +1 -1
- package/lib/properties/valueProperty.d.ts.map +1 -1
- package/lib/properties/valueProperty.js +11 -9
- package/lib/properties/valueProperty.js.map +1 -1
- package/lib/propertyFactory.d.ts.map +1 -1
- package/lib/propertyFactory.js +309 -252
- package/lib/propertyFactory.js.map +1 -1
- package/lib/propertyTemplate.d.ts +17 -17
- package/lib/propertyTemplate.d.ts.map +1 -1
- package/lib/propertyTemplate.js +64 -45
- package/lib/propertyTemplate.js.map +1 -1
- package/lib/propertyTemplateWrapper.d.ts.map +1 -1
- package/lib/propertyTemplateWrapper.js +40 -25
- package/lib/propertyTemplateWrapper.js.map +1 -1
- package/lib/propertyUtils.d.ts.map +1 -1
- package/lib/propertyUtils.js.map +1 -1
- package/package.json +28 -28
- package/src/index.d.ts +2750 -2681
|
@@ -8,16 +8,16 @@ exports.ArrayProperty = void 0;
|
|
|
8
8
|
/**
|
|
9
9
|
* @fileoverview Definition of the array property class
|
|
10
10
|
*/
|
|
11
|
-
const { ArrayChangeSetIterator, ChangeSet, PathHelper, TypeIdHelper, } = require(
|
|
12
|
-
const { MSG } = require(
|
|
13
|
-
const { UniversalDataArray, ConsoleUtils } = require(
|
|
14
|
-
const fastestJSONCopy = require(
|
|
15
|
-
const _ = require(
|
|
16
|
-
const { deserializeNonPrimitiveArrayElements } = require(
|
|
17
|
-
const { validationsEnabled } = require(
|
|
18
|
-
const { AbstractStaticCollectionProperty } = require(
|
|
19
|
-
const { BaseProperty } = require(
|
|
20
|
-
const { LazyLoadedProperties: Property } = require(
|
|
11
|
+
const { ArrayChangeSetIterator, ChangeSet, PathHelper, TypeIdHelper, } = require("@fluid-experimental/property-changeset");
|
|
12
|
+
const { MSG } = require("@fluid-experimental/property-common").constants;
|
|
13
|
+
const { UniversalDataArray, ConsoleUtils } = require("@fluid-experimental/property-common");
|
|
14
|
+
const fastestJSONCopy = require("fastest-json-copy");
|
|
15
|
+
const _ = require("lodash");
|
|
16
|
+
const { deserializeNonPrimitiveArrayElements } = require("../containerSerializer");
|
|
17
|
+
const { validationsEnabled } = require("../enableValidations");
|
|
18
|
+
const { AbstractStaticCollectionProperty } = require("./abstractStaticCollectionProperty");
|
|
19
|
+
const { BaseProperty } = require("./baseProperty");
|
|
20
|
+
const { LazyLoadedProperties: Property } = require("./lazyLoadedProperties");
|
|
21
21
|
const deepCopy = fastestJSONCopy.copy;
|
|
22
22
|
var MODIFIED_STATE_FLAGS = BaseProperty.MODIFIED_STATE_FLAGS;
|
|
23
23
|
// Some global constant objects that are used to indicate a few special
|
|
@@ -77,7 +77,7 @@ var _getLongestIncreasingSubsequenceSegments = function (in_segmentStarts, in_se
|
|
|
77
77
|
var currentSegmentStart = in_segmentStarts[i];
|
|
78
78
|
// Perform a binary search to find the largest entry in the list of found sub
|
|
79
79
|
// sequences that has a sequenceEnd that is smaller or equal than currentSegmentStart
|
|
80
|
-
var index = _.sortedIndexBy(foundSubSequences, { sequenceLastEntry: currentSegmentStart },
|
|
80
|
+
var index = _.sortedIndexBy(foundSubSequences, { sequenceLastEntry: currentSegmentStart }, "sequenceLastEntry");
|
|
81
81
|
var lastEntry = index > 0 ? foundSubSequences[index - 1] : undefined;
|
|
82
82
|
// Create a new entry that is obtained by concatenating the longest sequence found so far
|
|
83
83
|
// with the new segment
|
|
@@ -88,7 +88,7 @@ var _getLongestIncreasingSubsequenceSegments = function (in_segmentStarts, in_se
|
|
|
88
88
|
previousEntry: lastEntry,
|
|
89
89
|
};
|
|
90
90
|
// Search for the insertion position for this entry
|
|
91
|
-
var insertionPoint = _.sortedIndexBy(foundSubSequences, newEntry,
|
|
91
|
+
var insertionPoint = _.sortedIndexBy(foundSubSequences, newEntry, "sequenceLength");
|
|
92
92
|
if (foundSubSequences[insertionPoint] !== undefined &&
|
|
93
93
|
foundSubSequences[insertionPoint].sequenceLength === newEntry.sequenceLength) {
|
|
94
94
|
insertionPoint++;
|
|
@@ -152,7 +152,7 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
152
152
|
if (index === -1) {
|
|
153
153
|
throw new Error(MSG.GET_PATH_SEGMENT_CALLED_FOR_NON_ENTRY);
|
|
154
154
|
}
|
|
155
|
-
return
|
|
155
|
+
return "[" + index + "]";
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
158
|
* Resolves a direct child node based on the given path segment
|
|
@@ -270,7 +270,9 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
270
270
|
*/
|
|
271
271
|
pop() {
|
|
272
272
|
if (this._dataArrayGetLength() > 0) {
|
|
273
|
-
var item = this.get(this._dataArrayGetLength() - 1, {
|
|
273
|
+
var item = this.get(this._dataArrayGetLength() - 1, {
|
|
274
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
275
|
+
});
|
|
274
276
|
this.remove(this._dataArrayGetLength() - 1);
|
|
275
277
|
return item;
|
|
276
278
|
}
|
|
@@ -284,7 +286,9 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
284
286
|
*/
|
|
285
287
|
shift() {
|
|
286
288
|
if (this._dataArrayGetLength() > 0) {
|
|
287
|
-
var item = this.get(0, {
|
|
289
|
+
var item = this.get(0, {
|
|
290
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
291
|
+
});
|
|
288
292
|
this.remove(0);
|
|
289
293
|
return item;
|
|
290
294
|
}
|
|
@@ -328,13 +332,14 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
328
332
|
_setValues(in_values, in_typed, in_initial) {
|
|
329
333
|
if (in_typed) {
|
|
330
334
|
if (!this._isPrimitive) {
|
|
331
|
-
ConsoleUtils.assert(_.isArray(in_values), MSG.IN_ARRAY_NOT_ARRAY +
|
|
335
|
+
ConsoleUtils.assert(_.isArray(in_values), MSG.IN_ARRAY_NOT_ARRAY + "ArrayProperty._setValues");
|
|
332
336
|
var arr = [];
|
|
333
337
|
for (var i = 0; i < in_values.length; i++) {
|
|
334
338
|
var prop = in_values[i];
|
|
335
|
-
prop =
|
|
336
|
-
|
|
337
|
-
|
|
339
|
+
prop =
|
|
340
|
+
in_values[i] instanceof BaseProperty
|
|
341
|
+
? in_values[i]
|
|
342
|
+
: Property.PropertyFactory._createProperty(in_values[i].typeid || this._typeid, null, in_values[i].value, this._getScope());
|
|
338
343
|
arr.push(prop);
|
|
339
344
|
}
|
|
340
345
|
this._setValuesInternal(arr);
|
|
@@ -465,8 +470,7 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
465
470
|
*/
|
|
466
471
|
_setChanges(in_pending, in_dirty) {
|
|
467
472
|
var oldFlags = this._dirty ? this._dirty.flags : 0;
|
|
468
|
-
if (this._dirty &&
|
|
469
|
-
this._dirty === DIRTY_STATE_FLAGS_ARRAY[this._dirty.flags]) {
|
|
473
|
+
if (this._dirty && this._dirty === DIRTY_STATE_FLAGS_ARRAY[this._dirty.flags]) {
|
|
470
474
|
this._dirty = undefined;
|
|
471
475
|
}
|
|
472
476
|
if (in_pending !== null) {
|
|
@@ -488,8 +492,7 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
488
492
|
}
|
|
489
493
|
}
|
|
490
494
|
if (this._dirty) {
|
|
491
|
-
if (this._dirty.dirty === undefined &&
|
|
492
|
-
this._dirty.pending === undefined) {
|
|
495
|
+
if (this._dirty.dirty === undefined && this._dirty.pending === undefined) {
|
|
493
496
|
this._dirty = oldFlags === 0 ? undefined : DIRTY_STATE_FLAGS_ARRAY[oldFlags];
|
|
494
497
|
}
|
|
495
498
|
else {
|
|
@@ -546,7 +549,7 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
546
549
|
*/
|
|
547
550
|
insertRange(in_offset, in_array) {
|
|
548
551
|
if (!_.isArray(in_array)) {
|
|
549
|
-
throw new TypeError(MSG.IN_ARRAY_NOT_ARRAY +
|
|
552
|
+
throw new TypeError(MSG.IN_ARRAY_NOT_ARRAY + "ArrayProperty.insertRange");
|
|
550
553
|
}
|
|
551
554
|
if (validationsEnabled.enabled) {
|
|
552
555
|
for (var i = 0; i < in_array.length; i++) {
|
|
@@ -595,7 +598,7 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
595
598
|
this._dataArrayInsertRange(in_offset, in_array);
|
|
596
599
|
// Insert entry into changesets
|
|
597
600
|
var changeSet = {
|
|
598
|
-
|
|
601
|
+
insert: [[in_offset, this._serializeArray(in_array)]],
|
|
599
602
|
};
|
|
600
603
|
this._updateChanges(changeSet);
|
|
601
604
|
}
|
|
@@ -613,10 +616,13 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
613
616
|
* properties removed.
|
|
614
617
|
*/
|
|
615
618
|
removeRange(in_offset, in_deleteCount) {
|
|
616
|
-
ConsoleUtils.assert(_.isNumber(in_offset), MSG.NOT_NUMBER +
|
|
617
|
-
|
|
618
|
-
ConsoleUtils.assert(
|
|
619
|
-
|
|
619
|
+
ConsoleUtils.assert(_.isNumber(in_offset), MSG.NOT_NUMBER + "in_offset, method: ArrayProperty.removeRange or .remove");
|
|
620
|
+
ConsoleUtils.assert(_.isNumber(in_deleteCount), MSG.NOT_NUMBER + "in_deleteCount, method: ArrayProperty.removeRange or .remove");
|
|
621
|
+
ConsoleUtils.assert(in_offset + in_deleteCount < this.length + 1 && in_offset >= 0 && in_deleteCount > 0, MSG.REMOVE_OUT_OF_BOUNDS +
|
|
622
|
+
"Cannot remove " +
|
|
623
|
+
in_deleteCount +
|
|
624
|
+
" items starting at index " +
|
|
625
|
+
in_offset);
|
|
620
626
|
var result = [];
|
|
621
627
|
for (var i = in_offset; i < in_offset + in_deleteCount; i++) {
|
|
622
628
|
result.push(this.get(i));
|
|
@@ -657,7 +663,7 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
657
663
|
this._clearRange(in_offset, in_deleteCount);
|
|
658
664
|
// Insert entry into changesets
|
|
659
665
|
var changeSet = {
|
|
660
|
-
|
|
666
|
+
remove: [[in_offset, in_deleteCount]],
|
|
661
667
|
};
|
|
662
668
|
this._updateChanges(changeSet);
|
|
663
669
|
}
|
|
@@ -672,15 +678,20 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
672
678
|
*/
|
|
673
679
|
setRange(in_offset, in_array) {
|
|
674
680
|
if (!_.isArray(in_array) && !_.isString(in_array)) {
|
|
675
|
-
throw new TypeError(MSG.IN_ARRAY_NOT_ARRAY +
|
|
681
|
+
throw new TypeError(MSG.IN_ARRAY_NOT_ARRAY + "ArrayProperty.setRange");
|
|
676
682
|
}
|
|
677
683
|
in_offset = Math.floor(in_offset);
|
|
678
684
|
if (!isFinite(in_offset)) {
|
|
679
685
|
// eslint-disable-next-line unicorn/prefer-type-error
|
|
680
|
-
throw new Error(MSG.NOT_NUMBER +
|
|
681
|
-
}
|
|
682
|
-
ConsoleUtils.assert(in_offset >= -1 &&
|
|
683
|
-
|
|
686
|
+
throw new Error(MSG.NOT_NUMBER + "in_offset, method: ArrayProperty.setRange or .set");
|
|
687
|
+
}
|
|
688
|
+
ConsoleUtils.assert(in_offset >= -1 && in_offset + in_array.length <= this.getLength(), MSG.SET_OUT_OF_BOUNDS +
|
|
689
|
+
"Cannot set " +
|
|
690
|
+
in_array.length +
|
|
691
|
+
" items starting at index " +
|
|
692
|
+
in_offset +
|
|
693
|
+
". Array length: " +
|
|
694
|
+
this.getLength());
|
|
684
695
|
this._checkIsNotReadOnly(true);
|
|
685
696
|
this._setRangeWithoutDirtying(in_offset, in_array);
|
|
686
697
|
this._setDirty();
|
|
@@ -732,7 +743,7 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
732
743
|
i = j;
|
|
733
744
|
}
|
|
734
745
|
}
|
|
735
|
-
changeSet[
|
|
746
|
+
changeSet["modify"] = changeArray;
|
|
736
747
|
this._updateChanges(changeSet);
|
|
737
748
|
}
|
|
738
749
|
}
|
|
@@ -773,8 +784,9 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
773
784
|
get(in_position, in_options) {
|
|
774
785
|
in_options = in_options || {};
|
|
775
786
|
in_options.referenceResolutionMode =
|
|
776
|
-
in_options.referenceResolutionMode === undefined
|
|
777
|
-
|
|
787
|
+
in_options.referenceResolutionMode === undefined
|
|
788
|
+
? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
|
|
789
|
+
: in_options.referenceResolutionMode;
|
|
778
790
|
var prop = this;
|
|
779
791
|
if (_.isArray(in_position)) {
|
|
780
792
|
var iterationStart = 0;
|
|
@@ -794,9 +806,12 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
794
806
|
ConsoleUtils.assert(pos >= 0 && pos < this.getLength(), MSG.GET_OUT_OF_RANGE + in_position[0]);
|
|
795
807
|
}
|
|
796
808
|
for (var i = iterationStart; i < in_position.length && prop; i++) {
|
|
797
|
-
if (in_options.referenceResolutionMode ===
|
|
798
|
-
|
|
799
|
-
|
|
809
|
+
if (in_options.referenceResolutionMode ===
|
|
810
|
+
BaseProperty.REFERENCE_RESOLUTION.NO_LEAFS) {
|
|
811
|
+
mode =
|
|
812
|
+
i !== in_position.length - 1
|
|
813
|
+
? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
|
|
814
|
+
: BaseProperty.REFERENCE_RESOLUTION.NEVER;
|
|
800
815
|
}
|
|
801
816
|
if (in_position[i + 1] === PATH_TOKENS.REF) {
|
|
802
817
|
mode = BaseProperty.REFERENCE_RESOLUTION.NEVER;
|
|
@@ -887,13 +902,14 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
887
902
|
var insertedPropertyInstances = [];
|
|
888
903
|
var scope = this._getScope();
|
|
889
904
|
for (var i = 0; i < propertyDescriptions.length; ++i) {
|
|
890
|
-
var createdProperty = Property.PropertyFactory._createProperty(propertyDescriptions[i][
|
|
905
|
+
var createdProperty = Property.PropertyFactory._createProperty(propertyDescriptions[i]["typeid"], null, undefined, scope);
|
|
891
906
|
// Set parent so scope is defined for deserialization
|
|
892
907
|
createdProperty._setParent(this);
|
|
893
908
|
createdProperty._deserialize(propertyDescriptions[i], false);
|
|
894
909
|
insertedPropertyInstances.push(createdProperty);
|
|
895
910
|
}
|
|
896
|
-
this._insertRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
911
|
+
this._insertRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
912
|
+
arrayIterator.opDescription.offset, this._deserializeArray(insertedPropertyInstances), false);
|
|
897
913
|
break;
|
|
898
914
|
case ArrayChangeSetIterator.types.REMOVE:
|
|
899
915
|
// Handle removes
|
|
@@ -901,14 +917,18 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
901
917
|
if (!_.isNumber(numRemoved)) {
|
|
902
918
|
numRemoved = numRemoved.length;
|
|
903
919
|
}
|
|
904
|
-
this._removeRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
920
|
+
this._removeRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
921
|
+
arrayIterator.opDescription.offset, numRemoved);
|
|
905
922
|
break;
|
|
906
923
|
case ArrayChangeSetIterator.types.MODIFY:
|
|
907
924
|
// Handle modifies
|
|
908
925
|
var propertyDescriptions = arrayIterator.opDescription.operation[1];
|
|
909
|
-
var startIndex = arrayIterator.opDescription.operation[0] +
|
|
926
|
+
var startIndex = arrayIterator.opDescription.operation[0] +
|
|
927
|
+
arrayIterator.opDescription.offset;
|
|
910
928
|
for (var i = 0; i < propertyDescriptions.length; ++i) {
|
|
911
|
-
var modifiedProperty = this.get(startIndex + i, {
|
|
929
|
+
var modifiedProperty = this.get(startIndex + i, {
|
|
930
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
931
|
+
});
|
|
912
932
|
if (!modifiedProperty) {
|
|
913
933
|
throw new Error(MSG.INDEX_INVALID + (startIndex + i));
|
|
914
934
|
}
|
|
@@ -916,7 +936,9 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
916
936
|
}
|
|
917
937
|
break;
|
|
918
938
|
default:
|
|
919
|
-
console.error(
|
|
939
|
+
console.error("applyChangeset: " +
|
|
940
|
+
MSG.UNKNOWN_OPERATION +
|
|
941
|
+
arrayIterator.opDescription.type);
|
|
920
942
|
}
|
|
921
943
|
arrayIterator.next();
|
|
922
944
|
}
|
|
@@ -927,7 +949,8 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
927
949
|
switch (arrayIterator.opDescription.type) {
|
|
928
950
|
case ArrayChangeSetIterator.types.INSERT:
|
|
929
951
|
// Handle inserts
|
|
930
|
-
this._insertRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
952
|
+
this._insertRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
953
|
+
arrayIterator.opDescription.offset, this._deserializeArray(arrayIterator.opDescription.operation[1]));
|
|
931
954
|
break;
|
|
932
955
|
case ArrayChangeSetIterator.types.REMOVE:
|
|
933
956
|
// Handle removes
|
|
@@ -935,14 +958,18 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
935
958
|
if (_.isArray(removeLength) || _.isString(removeLength)) {
|
|
936
959
|
removeLength = removeLength.length;
|
|
937
960
|
}
|
|
938
|
-
this._removeRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
961
|
+
this._removeRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
962
|
+
arrayIterator.opDescription.offset, removeLength);
|
|
939
963
|
break;
|
|
940
964
|
case ArrayChangeSetIterator.types.MODIFY:
|
|
941
965
|
// Handle modifies
|
|
942
|
-
this._modifyRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
966
|
+
this._modifyRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
967
|
+
arrayIterator.opDescription.offset, this._deserializeArray(arrayIterator.opDescription.operation[1]));
|
|
943
968
|
break;
|
|
944
969
|
default:
|
|
945
|
-
console.error(
|
|
970
|
+
console.error("applyChangeset: " +
|
|
971
|
+
MSG.UNKNOWN_OPERATION +
|
|
972
|
+
arrayIterator.opDescription.type);
|
|
946
973
|
}
|
|
947
974
|
arrayIterator.next();
|
|
948
975
|
}
|
|
@@ -976,8 +1003,7 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
976
1003
|
(in_flags & BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE) !== 0) {
|
|
977
1004
|
pendingChanges = undefined;
|
|
978
1005
|
}
|
|
979
|
-
if (in_flags === undefined ||
|
|
980
|
-
(in_flags & BaseProperty.MODIFIED_STATE_FLAGS.DIRTY) !== 0) {
|
|
1006
|
+
if (in_flags === undefined || (in_flags & BaseProperty.MODIFIED_STATE_FLAGS.DIRTY) !== 0) {
|
|
981
1007
|
dirtyChanges = undefined;
|
|
982
1008
|
}
|
|
983
1009
|
this._setChanges(pendingChanges, dirtyChanges);
|
|
@@ -1027,14 +1053,14 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1027
1053
|
var resultGuidToIndexMap = {};
|
|
1028
1054
|
for (var i = 0; i < targetArray.length; i++) {
|
|
1029
1055
|
var insertedProperty = targetArray[i];
|
|
1030
|
-
if (insertedProperty[
|
|
1031
|
-
insertedProperty[
|
|
1056
|
+
if (insertedProperty["String"] === undefined ||
|
|
1057
|
+
insertedProperty["String"]["guid"] === undefined) {
|
|
1032
1058
|
throw new Error(MSG.MISSING_GUID_IN_NORMALIZED_CHANGESET);
|
|
1033
1059
|
}
|
|
1034
|
-
var guid = insertedProperty[
|
|
1060
|
+
var guid = insertedProperty["String"]["guid"];
|
|
1035
1061
|
// since the spec allows alternatively other changeset formats for strings, we have to support them here:
|
|
1036
|
-
if (!_.isString(guid) && insertedProperty[
|
|
1037
|
-
guid = insertedProperty[
|
|
1062
|
+
if (!_.isString(guid) && insertedProperty["String"]["guid"].insert) {
|
|
1063
|
+
guid = insertedProperty["String"]["guid"].insert[0][1];
|
|
1038
1064
|
}
|
|
1039
1065
|
resultGuidToIndexMap[guid] = i;
|
|
1040
1066
|
}
|
|
@@ -1096,7 +1122,10 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1096
1122
|
// to remove the elements between the two points
|
|
1097
1123
|
if (startPointInInitialArray > lastPositionInInitialArray) {
|
|
1098
1124
|
changes.remove = changes.remove || [];
|
|
1099
|
-
changes.remove.push([
|
|
1125
|
+
changes.remove.push([
|
|
1126
|
+
lastPositionInInitialArray,
|
|
1127
|
+
startPointInInitialArray - lastPositionInInitialArray,
|
|
1128
|
+
]);
|
|
1100
1129
|
this._removeRangeWithoutDirtying(lastPositionInInitialArray + offset, startPointInInitialArray - lastPositionInInitialArray);
|
|
1101
1130
|
offsetChange -= startPointInInitialArray - lastPositionInInitialArray;
|
|
1102
1131
|
}
|
|
@@ -1105,10 +1134,7 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1105
1134
|
if (startPointInTargetArray > lastPositionInTargetArray) {
|
|
1106
1135
|
changes.insert = changes.insert || [];
|
|
1107
1136
|
let elementsToInsert = targetArray.slice(lastPositionInTargetArray, startPointInTargetArray);
|
|
1108
|
-
changes.insert.push([
|
|
1109
|
-
lastPositionInInitialArray,
|
|
1110
|
-
deepCopy(elementsToInsert),
|
|
1111
|
-
]);
|
|
1137
|
+
changes.insert.push([lastPositionInInitialArray, deepCopy(elementsToInsert)]);
|
|
1112
1138
|
var scope = this._getScope();
|
|
1113
1139
|
var insertedProperties = deserializeNonPrimitiveArrayElements(elementsToInsert, scope);
|
|
1114
1140
|
this._insertRangeWithoutDirtying(lastPositionInInitialArray + offset, insertedProperties);
|
|
@@ -1131,7 +1157,8 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1131
1157
|
}
|
|
1132
1158
|
else {
|
|
1133
1159
|
var lastModifiedSequence = _.last(changes.modify);
|
|
1134
|
-
if (lastModifiedSequence[0] + lastModifiedSequence[1].length ===
|
|
1160
|
+
if (lastModifiedSequence[0] + lastModifiedSequence[1].length ===
|
|
1161
|
+
startPointInInitialArray + j) {
|
|
1135
1162
|
lastModifiedSequence[1].push(entryChanges);
|
|
1136
1163
|
}
|
|
1137
1164
|
else {
|
|
@@ -1219,8 +1246,7 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1219
1246
|
throw new Error(MSG.NO_NORMALIZED_CHANGESET);
|
|
1220
1247
|
}
|
|
1221
1248
|
var arrayLength = this._dataArrayGetLength();
|
|
1222
|
-
if (!in_serializedObj.insert ||
|
|
1223
|
-
!in_serializedObj.insert[0]) {
|
|
1249
|
+
if (!in_serializedObj.insert || !in_serializedObj.insert[0]) {
|
|
1224
1250
|
// we've got an empty object, so we have to wipe everything we've got
|
|
1225
1251
|
if (arrayLength > 0) {
|
|
1226
1252
|
this._clearRange(0, arrayLength);
|
|
@@ -1237,14 +1263,18 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1237
1263
|
}
|
|
1238
1264
|
}
|
|
1239
1265
|
var scope = this._getScope();
|
|
1240
|
-
if (Property.PropertyFactory.inheritsFrom(this.getTypeid(),
|
|
1266
|
+
if (Property.PropertyFactory.inheritsFrom(this.getTypeid(), "NamedProperty", {
|
|
1267
|
+
scope: scope,
|
|
1268
|
+
})) {
|
|
1241
1269
|
return this._deserializeNamedPropertyArray(in_serializedObj, in_reportToView);
|
|
1242
1270
|
}
|
|
1243
1271
|
else {
|
|
1244
1272
|
// most simplistic diff method: Remove all existing data and insert the new data
|
|
1245
1273
|
// The changes we will report as result of this function
|
|
1246
1274
|
var simpleChanges = {
|
|
1247
|
-
insert: in_createChangeSet
|
|
1275
|
+
insert: in_createChangeSet
|
|
1276
|
+
? deepCopy(in_serializedObj.insert)
|
|
1277
|
+
: in_serializedObj.insert,
|
|
1248
1278
|
};
|
|
1249
1279
|
if (arrayLength > 0) {
|
|
1250
1280
|
simpleChanges.remove = [[0, arrayLength]];
|
|
@@ -1253,7 +1283,7 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1253
1283
|
var propertyDescriptions = in_serializedObj.insert[0][1];
|
|
1254
1284
|
var result = [];
|
|
1255
1285
|
for (var i = 0; i < propertyDescriptions.length; ++i) {
|
|
1256
|
-
var createdProperty = Property.PropertyFactory._createProperty(propertyDescriptions[i][
|
|
1286
|
+
var createdProperty = Property.PropertyFactory._createProperty(propertyDescriptions[i]["typeid"], null, undefined, scope);
|
|
1257
1287
|
createdProperty._setParent(this);
|
|
1258
1288
|
createdProperty._deserialize(propertyDescriptions[i], false, in_filteringOptions, false);
|
|
1259
1289
|
result.push(createdProperty);
|
|
@@ -1269,10 +1299,11 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1269
1299
|
var changeSetArray = in_serializedObj.insert[0][1];
|
|
1270
1300
|
var len = buffer.length;
|
|
1271
1301
|
var i = 0;
|
|
1272
|
-
if (this._typeid ===
|
|
1302
|
+
if (this._typeid === "Int64" || this._typeid === "Uint64") {
|
|
1273
1303
|
// For (u)int64, we will compare (Ui/I)nt64 objects with arrays [low, high]
|
|
1274
1304
|
for (i = 0; i < len; i++) {
|
|
1275
|
-
if (changeSetArray[i][0] !== buffer[i].getValueLow() ||
|
|
1305
|
+
if (changeSetArray[i][0] !== buffer[i].getValueLow() ||
|
|
1306
|
+
changeSetArray[i][1] !== buffer[i].getValueHigh()) {
|
|
1276
1307
|
break;
|
|
1277
1308
|
}
|
|
1278
1309
|
}
|
|
@@ -1326,7 +1357,8 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1326
1357
|
var lastModify = undefined;
|
|
1327
1358
|
if (result.modify && result.modify.length > 0) {
|
|
1328
1359
|
lastModify = result.modify[result.modify.length - 1];
|
|
1329
|
-
if (lastModify[0] + lastModify[1].length ===
|
|
1360
|
+
if (lastModify[0] + lastModify[1].length ===
|
|
1361
|
+
currentArrayIndex - op.offset) {
|
|
1330
1362
|
// we need to combine, keep lastModify
|
|
1331
1363
|
}
|
|
1332
1364
|
else {
|
|
@@ -1335,8 +1367,10 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1335
1367
|
}
|
|
1336
1368
|
if (lastModify) {
|
|
1337
1369
|
lastModify[1].push(this._dataArrayGetValue(currentArrayIndex).serialize({
|
|
1338
|
-
|
|
1339
|
-
|
|
1370
|
+
dirtyOnly: true,
|
|
1371
|
+
includeRootTypeid: true,
|
|
1372
|
+
dirtinessType: in_dirtinessType,
|
|
1373
|
+
includeReferencedRepositories: in_includeReferencedRepositories,
|
|
1340
1374
|
}));
|
|
1341
1375
|
}
|
|
1342
1376
|
else {
|
|
@@ -1344,19 +1378,28 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1344
1378
|
if (!result.modify) {
|
|
1345
1379
|
result.modify = [];
|
|
1346
1380
|
}
|
|
1347
|
-
result.modify.push([
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1381
|
+
result.modify.push([
|
|
1382
|
+
currentArrayIndex - op.offset,
|
|
1383
|
+
[
|
|
1384
|
+
this._dataArrayGetValue(currentArrayIndex).serialize({
|
|
1385
|
+
dirtyOnly: true,
|
|
1386
|
+
includeRootTypeid: true,
|
|
1387
|
+
dirtinessType: in_dirtinessType,
|
|
1388
|
+
includeReferencedRepositories: in_includeReferencedRepositories,
|
|
1389
|
+
}),
|
|
1390
|
+
],
|
|
1391
|
+
]);
|
|
1352
1392
|
}
|
|
1353
1393
|
currentArrayIndex++;
|
|
1354
1394
|
// add more immediate modifies if possible
|
|
1355
|
-
while (currentArrayIndex < currentArraySize &&
|
|
1395
|
+
while (currentArrayIndex < currentArraySize &&
|
|
1396
|
+
currentArrayIndex < opStartIndex &&
|
|
1356
1397
|
this._dataArrayGetValue(currentArrayIndex)._isDirty(in_dirtinessType)) {
|
|
1357
1398
|
result.modify[result.modify.length - 1][1].push(this._dataArrayGetValue(currentArrayIndex).serialize({
|
|
1358
|
-
|
|
1359
|
-
|
|
1399
|
+
dirtyOnly: true,
|
|
1400
|
+
includeRootTypeid: true,
|
|
1401
|
+
dirtinessType: in_dirtinessType,
|
|
1402
|
+
includeReferencedRepositories: in_includeReferencedRepositories,
|
|
1360
1403
|
}));
|
|
1361
1404
|
currentArrayIndex++;
|
|
1362
1405
|
}
|
|
@@ -1382,11 +1425,13 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1382
1425
|
// TODO: read the data from the array now - remove the data from the op and
|
|
1383
1426
|
// TODO: replace it with just the length instead
|
|
1384
1427
|
if (!this._dataArrayGetValue(opStartIndex + j)) {
|
|
1385
|
-
throw new Error(
|
|
1428
|
+
throw new Error("insert: invalid index");
|
|
1386
1429
|
}
|
|
1387
1430
|
newInsert[1].push(this._dataArrayGetValue(opStartIndex + j).serialize({
|
|
1388
|
-
|
|
1389
|
-
|
|
1431
|
+
dirtyOnly: false,
|
|
1432
|
+
includeRootTypeid: true,
|
|
1433
|
+
dirtinessType: in_dirtinessType,
|
|
1434
|
+
includeReferencedRepositories: in_includeReferencedRepositories,
|
|
1390
1435
|
}));
|
|
1391
1436
|
}
|
|
1392
1437
|
if (!result.insert) {
|
|
@@ -1429,9 +1474,9 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1429
1474
|
var result = AbstractStaticCollectionProperty.prototype._serialize.call(this, in_dirtyOnly, in_includeRootTypeid, in_dirtinessType, in_includeReferencedRepositories);
|
|
1430
1475
|
if (!this._isPrimitive) {
|
|
1431
1476
|
if (in_dirtyOnly) {
|
|
1432
|
-
_.extend(result, in_dirtinessType === BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE
|
|
1433
|
-
this._getChangesetForCustomTypeArray(this._getPendingChanges(), in_dirtinessType, in_includeReferencedRepositories)
|
|
1434
|
-
this._getChangesetForCustomTypeArray(this._getDirtyChanges(), in_dirtinessType, in_includeReferencedRepositories));
|
|
1477
|
+
_.extend(result, in_dirtinessType === BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE
|
|
1478
|
+
? this._getChangesetForCustomTypeArray(this._getPendingChanges(), in_dirtinessType, in_includeReferencedRepositories)
|
|
1479
|
+
: this._getChangesetForCustomTypeArray(this._getDirtyChanges(), in_dirtinessType, in_includeReferencedRepositories));
|
|
1435
1480
|
return result;
|
|
1436
1481
|
}
|
|
1437
1482
|
else {
|
|
@@ -1448,8 +1493,9 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1448
1493
|
}
|
|
1449
1494
|
}
|
|
1450
1495
|
else if (in_dirtyOnly) {
|
|
1451
|
-
return in_dirtinessType === BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE
|
|
1452
|
-
deepCopy(this._getPendingChanges())
|
|
1496
|
+
return in_dirtinessType === BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE
|
|
1497
|
+
? deepCopy(this._getPendingChanges())
|
|
1498
|
+
: deepCopy(this._getDirtyChanges());
|
|
1453
1499
|
}
|
|
1454
1500
|
else {
|
|
1455
1501
|
// returns just an insert with the current data
|
|
@@ -1471,23 +1517,23 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1471
1517
|
* @param {function} printFct - Function to call for printing each property
|
|
1472
1518
|
*/
|
|
1473
1519
|
_prettyPrint(indent, externalId, printFct) {
|
|
1474
|
-
printFct(indent + externalId + this.getId() +
|
|
1520
|
+
printFct(indent + externalId + this.getId() + " (Array of " + this.getTypeid() + "): [");
|
|
1475
1521
|
if (!this._isPrimitive) {
|
|
1476
1522
|
this._prettyPrintChildren(indent, printFct);
|
|
1477
1523
|
}
|
|
1478
1524
|
else {
|
|
1479
|
-
var childIndent = indent +
|
|
1480
|
-
var prefix =
|
|
1481
|
-
var suffix =
|
|
1482
|
-
if (this.getTypeid() ===
|
|
1525
|
+
var childIndent = indent + " ";
|
|
1526
|
+
var prefix = "";
|
|
1527
|
+
var suffix = "";
|
|
1528
|
+
if (this.getTypeid() === "String") {
|
|
1483
1529
|
prefix = '"';
|
|
1484
1530
|
suffix = '"';
|
|
1485
1531
|
}
|
|
1486
1532
|
for (var i = 0; i < this._dataArrayGetLength(); i++) {
|
|
1487
|
-
printFct(childIndent + i +
|
|
1533
|
+
printFct(childIndent + i + ": " + prefix + this._dataArrayGetValue(i) + suffix);
|
|
1488
1534
|
}
|
|
1489
1535
|
}
|
|
1490
|
-
printFct(indent +
|
|
1536
|
+
printFct(indent + "]");
|
|
1491
1537
|
}
|
|
1492
1538
|
/**
|
|
1493
1539
|
* Repeatedly calls back the given function with human-readable string
|
|
@@ -1496,11 +1542,12 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1496
1542
|
* @param {function} printFct - Function to call for printing each property
|
|
1497
1543
|
*/
|
|
1498
1544
|
_prettyPrintChildren(indent, printFct) {
|
|
1499
|
-
indent +=
|
|
1545
|
+
indent += " ";
|
|
1500
1546
|
var ids = this.getIds();
|
|
1501
1547
|
for (var i = 0; i < ids.length; i++) {
|
|
1502
|
-
this.get(ids[i], {
|
|
1503
|
-
|
|
1548
|
+
this.get(ids[i], {
|
|
1549
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
1550
|
+
})._prettyPrint(indent, ids[i] + ": ", printFct);
|
|
1504
1551
|
}
|
|
1505
1552
|
}
|
|
1506
1553
|
/**
|
|
@@ -1519,7 +1566,9 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1519
1566
|
if (!this._isPrimitive) {
|
|
1520
1567
|
var ids = this.getIds();
|
|
1521
1568
|
for (var i = 0; i < ids.length; i++) {
|
|
1522
|
-
json.value.push(this.get(ids[i], {
|
|
1569
|
+
json.value.push(this.get(ids[i], {
|
|
1570
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
1571
|
+
})._toJson());
|
|
1523
1572
|
}
|
|
1524
1573
|
}
|
|
1525
1574
|
else {
|
|
@@ -1536,7 +1585,7 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1536
1585
|
getFullTypeid(in_hideCollection) {
|
|
1537
1586
|
return in_hideCollection
|
|
1538
1587
|
? this._typeid
|
|
1539
|
-
: TypeIdHelper.createSerializationTypeId(this._typeid,
|
|
1588
|
+
: TypeIdHelper.createSerializationTypeId(this._typeid, "array");
|
|
1540
1589
|
}
|
|
1541
1590
|
/**
|
|
1542
1591
|
* Creates and initializes the data array
|
|
@@ -1637,5 +1686,5 @@ class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1637
1686
|
}
|
|
1638
1687
|
exports.ArrayProperty = ArrayProperty;
|
|
1639
1688
|
ArrayProperty.prototype._staticChildren = {};
|
|
1640
|
-
ArrayProperty.prototype._context =
|
|
1689
|
+
ArrayProperty.prototype._context = "array";
|
|
1641
1690
|
//# sourceMappingURL=arrayProperty.js.map
|