@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
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @fileoverview Definition of the array property class
|
|
7
7
|
*/
|
|
8
|
-
const { ArrayChangeSetIterator, ChangeSet, PathHelper, TypeIdHelper, } = require(
|
|
9
|
-
const { MSG } = require(
|
|
10
|
-
const { UniversalDataArray, ConsoleUtils } = require(
|
|
11
|
-
const fastestJSONCopy = require(
|
|
12
|
-
const _ = require(
|
|
13
|
-
const { deserializeNonPrimitiveArrayElements } = require(
|
|
14
|
-
const { validationsEnabled } = require(
|
|
15
|
-
const { AbstractStaticCollectionProperty } = require(
|
|
16
|
-
const { BaseProperty } = require(
|
|
17
|
-
const { LazyLoadedProperties: Property } = require(
|
|
8
|
+
const { ArrayChangeSetIterator, ChangeSet, PathHelper, TypeIdHelper, } = require("@fluid-experimental/property-changeset");
|
|
9
|
+
const { MSG } = require("@fluid-experimental/property-common").constants;
|
|
10
|
+
const { UniversalDataArray, ConsoleUtils } = require("@fluid-experimental/property-common");
|
|
11
|
+
const fastestJSONCopy = require("fastest-json-copy");
|
|
12
|
+
const _ = require("lodash");
|
|
13
|
+
const { deserializeNonPrimitiveArrayElements } = require("../containerSerializer");
|
|
14
|
+
const { validationsEnabled } = require("../enableValidations");
|
|
15
|
+
const { AbstractStaticCollectionProperty } = require("./abstractStaticCollectionProperty");
|
|
16
|
+
const { BaseProperty } = require("./baseProperty");
|
|
17
|
+
const { LazyLoadedProperties: Property } = require("./lazyLoadedProperties");
|
|
18
18
|
const deepCopy = fastestJSONCopy.copy;
|
|
19
19
|
var MODIFIED_STATE_FLAGS = BaseProperty.MODIFIED_STATE_FLAGS;
|
|
20
20
|
// Some global constant objects that are used to indicate a few special
|
|
@@ -74,7 +74,7 @@ var _getLongestIncreasingSubsequenceSegments = function (in_segmentStarts, in_se
|
|
|
74
74
|
var currentSegmentStart = in_segmentStarts[i];
|
|
75
75
|
// Perform a binary search to find the largest entry in the list of found sub
|
|
76
76
|
// sequences that has a sequenceEnd that is smaller or equal than currentSegmentStart
|
|
77
|
-
var index = _.sortedIndexBy(foundSubSequences, { sequenceLastEntry: currentSegmentStart },
|
|
77
|
+
var index = _.sortedIndexBy(foundSubSequences, { sequenceLastEntry: currentSegmentStart }, "sequenceLastEntry");
|
|
78
78
|
var lastEntry = index > 0 ? foundSubSequences[index - 1] : undefined;
|
|
79
79
|
// Create a new entry that is obtained by concatenating the longest sequence found so far
|
|
80
80
|
// with the new segment
|
|
@@ -85,7 +85,7 @@ var _getLongestIncreasingSubsequenceSegments = function (in_segmentStarts, in_se
|
|
|
85
85
|
previousEntry: lastEntry,
|
|
86
86
|
};
|
|
87
87
|
// Search for the insertion position for this entry
|
|
88
|
-
var insertionPoint = _.sortedIndexBy(foundSubSequences, newEntry,
|
|
88
|
+
var insertionPoint = _.sortedIndexBy(foundSubSequences, newEntry, "sequenceLength");
|
|
89
89
|
if (foundSubSequences[insertionPoint] !== undefined &&
|
|
90
90
|
foundSubSequences[insertionPoint].sequenceLength === newEntry.sequenceLength) {
|
|
91
91
|
insertionPoint++;
|
|
@@ -149,7 +149,7 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
149
149
|
if (index === -1) {
|
|
150
150
|
throw new Error(MSG.GET_PATH_SEGMENT_CALLED_FOR_NON_ENTRY);
|
|
151
151
|
}
|
|
152
|
-
return
|
|
152
|
+
return "[" + index + "]";
|
|
153
153
|
}
|
|
154
154
|
/**
|
|
155
155
|
* Resolves a direct child node based on the given path segment
|
|
@@ -267,7 +267,9 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
267
267
|
*/
|
|
268
268
|
pop() {
|
|
269
269
|
if (this._dataArrayGetLength() > 0) {
|
|
270
|
-
var item = this.get(this._dataArrayGetLength() - 1, {
|
|
270
|
+
var item = this.get(this._dataArrayGetLength() - 1, {
|
|
271
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
272
|
+
});
|
|
271
273
|
this.remove(this._dataArrayGetLength() - 1);
|
|
272
274
|
return item;
|
|
273
275
|
}
|
|
@@ -281,7 +283,9 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
281
283
|
*/
|
|
282
284
|
shift() {
|
|
283
285
|
if (this._dataArrayGetLength() > 0) {
|
|
284
|
-
var item = this.get(0, {
|
|
286
|
+
var item = this.get(0, {
|
|
287
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
288
|
+
});
|
|
285
289
|
this.remove(0);
|
|
286
290
|
return item;
|
|
287
291
|
}
|
|
@@ -325,13 +329,14 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
325
329
|
_setValues(in_values, in_typed, in_initial) {
|
|
326
330
|
if (in_typed) {
|
|
327
331
|
if (!this._isPrimitive) {
|
|
328
|
-
ConsoleUtils.assert(_.isArray(in_values), MSG.IN_ARRAY_NOT_ARRAY +
|
|
332
|
+
ConsoleUtils.assert(_.isArray(in_values), MSG.IN_ARRAY_NOT_ARRAY + "ArrayProperty._setValues");
|
|
329
333
|
var arr = [];
|
|
330
334
|
for (var i = 0; i < in_values.length; i++) {
|
|
331
335
|
var prop = in_values[i];
|
|
332
|
-
prop =
|
|
333
|
-
|
|
334
|
-
|
|
336
|
+
prop =
|
|
337
|
+
in_values[i] instanceof BaseProperty
|
|
338
|
+
? in_values[i]
|
|
339
|
+
: Property.PropertyFactory._createProperty(in_values[i].typeid || this._typeid, null, in_values[i].value, this._getScope());
|
|
335
340
|
arr.push(prop);
|
|
336
341
|
}
|
|
337
342
|
this._setValuesInternal(arr);
|
|
@@ -462,8 +467,7 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
462
467
|
*/
|
|
463
468
|
_setChanges(in_pending, in_dirty) {
|
|
464
469
|
var oldFlags = this._dirty ? this._dirty.flags : 0;
|
|
465
|
-
if (this._dirty &&
|
|
466
|
-
this._dirty === DIRTY_STATE_FLAGS_ARRAY[this._dirty.flags]) {
|
|
470
|
+
if (this._dirty && this._dirty === DIRTY_STATE_FLAGS_ARRAY[this._dirty.flags]) {
|
|
467
471
|
this._dirty = undefined;
|
|
468
472
|
}
|
|
469
473
|
if (in_pending !== null) {
|
|
@@ -485,8 +489,7 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
485
489
|
}
|
|
486
490
|
}
|
|
487
491
|
if (this._dirty) {
|
|
488
|
-
if (this._dirty.dirty === undefined &&
|
|
489
|
-
this._dirty.pending === undefined) {
|
|
492
|
+
if (this._dirty.dirty === undefined && this._dirty.pending === undefined) {
|
|
490
493
|
this._dirty = oldFlags === 0 ? undefined : DIRTY_STATE_FLAGS_ARRAY[oldFlags];
|
|
491
494
|
}
|
|
492
495
|
else {
|
|
@@ -543,7 +546,7 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
543
546
|
*/
|
|
544
547
|
insertRange(in_offset, in_array) {
|
|
545
548
|
if (!_.isArray(in_array)) {
|
|
546
|
-
throw new TypeError(MSG.IN_ARRAY_NOT_ARRAY +
|
|
549
|
+
throw new TypeError(MSG.IN_ARRAY_NOT_ARRAY + "ArrayProperty.insertRange");
|
|
547
550
|
}
|
|
548
551
|
if (validationsEnabled.enabled) {
|
|
549
552
|
for (var i = 0; i < in_array.length; i++) {
|
|
@@ -592,7 +595,7 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
592
595
|
this._dataArrayInsertRange(in_offset, in_array);
|
|
593
596
|
// Insert entry into changesets
|
|
594
597
|
var changeSet = {
|
|
595
|
-
|
|
598
|
+
insert: [[in_offset, this._serializeArray(in_array)]],
|
|
596
599
|
};
|
|
597
600
|
this._updateChanges(changeSet);
|
|
598
601
|
}
|
|
@@ -610,10 +613,13 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
610
613
|
* properties removed.
|
|
611
614
|
*/
|
|
612
615
|
removeRange(in_offset, in_deleteCount) {
|
|
613
|
-
ConsoleUtils.assert(_.isNumber(in_offset), MSG.NOT_NUMBER +
|
|
614
|
-
|
|
615
|
-
ConsoleUtils.assert(
|
|
616
|
-
|
|
616
|
+
ConsoleUtils.assert(_.isNumber(in_offset), MSG.NOT_NUMBER + "in_offset, method: ArrayProperty.removeRange or .remove");
|
|
617
|
+
ConsoleUtils.assert(_.isNumber(in_deleteCount), MSG.NOT_NUMBER + "in_deleteCount, method: ArrayProperty.removeRange or .remove");
|
|
618
|
+
ConsoleUtils.assert(in_offset + in_deleteCount < this.length + 1 && in_offset >= 0 && in_deleteCount > 0, MSG.REMOVE_OUT_OF_BOUNDS +
|
|
619
|
+
"Cannot remove " +
|
|
620
|
+
in_deleteCount +
|
|
621
|
+
" items starting at index " +
|
|
622
|
+
in_offset);
|
|
617
623
|
var result = [];
|
|
618
624
|
for (var i = in_offset; i < in_offset + in_deleteCount; i++) {
|
|
619
625
|
result.push(this.get(i));
|
|
@@ -654,7 +660,7 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
654
660
|
this._clearRange(in_offset, in_deleteCount);
|
|
655
661
|
// Insert entry into changesets
|
|
656
662
|
var changeSet = {
|
|
657
|
-
|
|
663
|
+
remove: [[in_offset, in_deleteCount]],
|
|
658
664
|
};
|
|
659
665
|
this._updateChanges(changeSet);
|
|
660
666
|
}
|
|
@@ -669,15 +675,20 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
669
675
|
*/
|
|
670
676
|
setRange(in_offset, in_array) {
|
|
671
677
|
if (!_.isArray(in_array) && !_.isString(in_array)) {
|
|
672
|
-
throw new TypeError(MSG.IN_ARRAY_NOT_ARRAY +
|
|
678
|
+
throw new TypeError(MSG.IN_ARRAY_NOT_ARRAY + "ArrayProperty.setRange");
|
|
673
679
|
}
|
|
674
680
|
in_offset = Math.floor(in_offset);
|
|
675
681
|
if (!isFinite(in_offset)) {
|
|
676
682
|
// eslint-disable-next-line unicorn/prefer-type-error
|
|
677
|
-
throw new Error(MSG.NOT_NUMBER +
|
|
678
|
-
}
|
|
679
|
-
ConsoleUtils.assert(in_offset >= -1 &&
|
|
680
|
-
|
|
683
|
+
throw new Error(MSG.NOT_NUMBER + "in_offset, method: ArrayProperty.setRange or .set");
|
|
684
|
+
}
|
|
685
|
+
ConsoleUtils.assert(in_offset >= -1 && in_offset + in_array.length <= this.getLength(), MSG.SET_OUT_OF_BOUNDS +
|
|
686
|
+
"Cannot set " +
|
|
687
|
+
in_array.length +
|
|
688
|
+
" items starting at index " +
|
|
689
|
+
in_offset +
|
|
690
|
+
". Array length: " +
|
|
691
|
+
this.getLength());
|
|
681
692
|
this._checkIsNotReadOnly(true);
|
|
682
693
|
this._setRangeWithoutDirtying(in_offset, in_array);
|
|
683
694
|
this._setDirty();
|
|
@@ -729,7 +740,7 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
729
740
|
i = j;
|
|
730
741
|
}
|
|
731
742
|
}
|
|
732
|
-
changeSet[
|
|
743
|
+
changeSet["modify"] = changeArray;
|
|
733
744
|
this._updateChanges(changeSet);
|
|
734
745
|
}
|
|
735
746
|
}
|
|
@@ -770,8 +781,9 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
770
781
|
get(in_position, in_options) {
|
|
771
782
|
in_options = in_options || {};
|
|
772
783
|
in_options.referenceResolutionMode =
|
|
773
|
-
in_options.referenceResolutionMode === undefined
|
|
774
|
-
|
|
784
|
+
in_options.referenceResolutionMode === undefined
|
|
785
|
+
? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
|
|
786
|
+
: in_options.referenceResolutionMode;
|
|
775
787
|
var prop = this;
|
|
776
788
|
if (_.isArray(in_position)) {
|
|
777
789
|
var iterationStart = 0;
|
|
@@ -791,9 +803,12 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
791
803
|
ConsoleUtils.assert(pos >= 0 && pos < this.getLength(), MSG.GET_OUT_OF_RANGE + in_position[0]);
|
|
792
804
|
}
|
|
793
805
|
for (var i = iterationStart; i < in_position.length && prop; i++) {
|
|
794
|
-
if (in_options.referenceResolutionMode ===
|
|
795
|
-
|
|
796
|
-
|
|
806
|
+
if (in_options.referenceResolutionMode ===
|
|
807
|
+
BaseProperty.REFERENCE_RESOLUTION.NO_LEAFS) {
|
|
808
|
+
mode =
|
|
809
|
+
i !== in_position.length - 1
|
|
810
|
+
? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
|
|
811
|
+
: BaseProperty.REFERENCE_RESOLUTION.NEVER;
|
|
797
812
|
}
|
|
798
813
|
if (in_position[i + 1] === PATH_TOKENS.REF) {
|
|
799
814
|
mode = BaseProperty.REFERENCE_RESOLUTION.NEVER;
|
|
@@ -884,13 +899,14 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
884
899
|
var insertedPropertyInstances = [];
|
|
885
900
|
var scope = this._getScope();
|
|
886
901
|
for (var i = 0; i < propertyDescriptions.length; ++i) {
|
|
887
|
-
var createdProperty = Property.PropertyFactory._createProperty(propertyDescriptions[i][
|
|
902
|
+
var createdProperty = Property.PropertyFactory._createProperty(propertyDescriptions[i]["typeid"], null, undefined, scope);
|
|
888
903
|
// Set parent so scope is defined for deserialization
|
|
889
904
|
createdProperty._setParent(this);
|
|
890
905
|
createdProperty._deserialize(propertyDescriptions[i], false);
|
|
891
906
|
insertedPropertyInstances.push(createdProperty);
|
|
892
907
|
}
|
|
893
|
-
this._insertRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
908
|
+
this._insertRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
909
|
+
arrayIterator.opDescription.offset, this._deserializeArray(insertedPropertyInstances), false);
|
|
894
910
|
break;
|
|
895
911
|
case ArrayChangeSetIterator.types.REMOVE:
|
|
896
912
|
// Handle removes
|
|
@@ -898,14 +914,18 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
898
914
|
if (!_.isNumber(numRemoved)) {
|
|
899
915
|
numRemoved = numRemoved.length;
|
|
900
916
|
}
|
|
901
|
-
this._removeRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
917
|
+
this._removeRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
918
|
+
arrayIterator.opDescription.offset, numRemoved);
|
|
902
919
|
break;
|
|
903
920
|
case ArrayChangeSetIterator.types.MODIFY:
|
|
904
921
|
// Handle modifies
|
|
905
922
|
var propertyDescriptions = arrayIterator.opDescription.operation[1];
|
|
906
|
-
var startIndex = arrayIterator.opDescription.operation[0] +
|
|
923
|
+
var startIndex = arrayIterator.opDescription.operation[0] +
|
|
924
|
+
arrayIterator.opDescription.offset;
|
|
907
925
|
for (var i = 0; i < propertyDescriptions.length; ++i) {
|
|
908
|
-
var modifiedProperty = this.get(startIndex + i, {
|
|
926
|
+
var modifiedProperty = this.get(startIndex + i, {
|
|
927
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
928
|
+
});
|
|
909
929
|
if (!modifiedProperty) {
|
|
910
930
|
throw new Error(MSG.INDEX_INVALID + (startIndex + i));
|
|
911
931
|
}
|
|
@@ -913,7 +933,9 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
913
933
|
}
|
|
914
934
|
break;
|
|
915
935
|
default:
|
|
916
|
-
console.error(
|
|
936
|
+
console.error("applyChangeset: " +
|
|
937
|
+
MSG.UNKNOWN_OPERATION +
|
|
938
|
+
arrayIterator.opDescription.type);
|
|
917
939
|
}
|
|
918
940
|
arrayIterator.next();
|
|
919
941
|
}
|
|
@@ -924,7 +946,8 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
924
946
|
switch (arrayIterator.opDescription.type) {
|
|
925
947
|
case ArrayChangeSetIterator.types.INSERT:
|
|
926
948
|
// Handle inserts
|
|
927
|
-
this._insertRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
949
|
+
this._insertRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
950
|
+
arrayIterator.opDescription.offset, this._deserializeArray(arrayIterator.opDescription.operation[1]));
|
|
928
951
|
break;
|
|
929
952
|
case ArrayChangeSetIterator.types.REMOVE:
|
|
930
953
|
// Handle removes
|
|
@@ -932,14 +955,18 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
932
955
|
if (_.isArray(removeLength) || _.isString(removeLength)) {
|
|
933
956
|
removeLength = removeLength.length;
|
|
934
957
|
}
|
|
935
|
-
this._removeRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
958
|
+
this._removeRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
959
|
+
arrayIterator.opDescription.offset, removeLength);
|
|
936
960
|
break;
|
|
937
961
|
case ArrayChangeSetIterator.types.MODIFY:
|
|
938
962
|
// Handle modifies
|
|
939
|
-
this._modifyRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
963
|
+
this._modifyRangeWithoutDirtying(arrayIterator.opDescription.operation[0] +
|
|
964
|
+
arrayIterator.opDescription.offset, this._deserializeArray(arrayIterator.opDescription.operation[1]));
|
|
940
965
|
break;
|
|
941
966
|
default:
|
|
942
|
-
console.error(
|
|
967
|
+
console.error("applyChangeset: " +
|
|
968
|
+
MSG.UNKNOWN_OPERATION +
|
|
969
|
+
arrayIterator.opDescription.type);
|
|
943
970
|
}
|
|
944
971
|
arrayIterator.next();
|
|
945
972
|
}
|
|
@@ -973,8 +1000,7 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
973
1000
|
(in_flags & BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE) !== 0) {
|
|
974
1001
|
pendingChanges = undefined;
|
|
975
1002
|
}
|
|
976
|
-
if (in_flags === undefined ||
|
|
977
|
-
(in_flags & BaseProperty.MODIFIED_STATE_FLAGS.DIRTY) !== 0) {
|
|
1003
|
+
if (in_flags === undefined || (in_flags & BaseProperty.MODIFIED_STATE_FLAGS.DIRTY) !== 0) {
|
|
978
1004
|
dirtyChanges = undefined;
|
|
979
1005
|
}
|
|
980
1006
|
this._setChanges(pendingChanges, dirtyChanges);
|
|
@@ -1024,14 +1050,14 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1024
1050
|
var resultGuidToIndexMap = {};
|
|
1025
1051
|
for (var i = 0; i < targetArray.length; i++) {
|
|
1026
1052
|
var insertedProperty = targetArray[i];
|
|
1027
|
-
if (insertedProperty[
|
|
1028
|
-
insertedProperty[
|
|
1053
|
+
if (insertedProperty["String"] === undefined ||
|
|
1054
|
+
insertedProperty["String"]["guid"] === undefined) {
|
|
1029
1055
|
throw new Error(MSG.MISSING_GUID_IN_NORMALIZED_CHANGESET);
|
|
1030
1056
|
}
|
|
1031
|
-
var guid = insertedProperty[
|
|
1057
|
+
var guid = insertedProperty["String"]["guid"];
|
|
1032
1058
|
// since the spec allows alternatively other changeset formats for strings, we have to support them here:
|
|
1033
|
-
if (!_.isString(guid) && insertedProperty[
|
|
1034
|
-
guid = insertedProperty[
|
|
1059
|
+
if (!_.isString(guid) && insertedProperty["String"]["guid"].insert) {
|
|
1060
|
+
guid = insertedProperty["String"]["guid"].insert[0][1];
|
|
1035
1061
|
}
|
|
1036
1062
|
resultGuidToIndexMap[guid] = i;
|
|
1037
1063
|
}
|
|
@@ -1093,7 +1119,10 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1093
1119
|
// to remove the elements between the two points
|
|
1094
1120
|
if (startPointInInitialArray > lastPositionInInitialArray) {
|
|
1095
1121
|
changes.remove = changes.remove || [];
|
|
1096
|
-
changes.remove.push([
|
|
1122
|
+
changes.remove.push([
|
|
1123
|
+
lastPositionInInitialArray,
|
|
1124
|
+
startPointInInitialArray - lastPositionInInitialArray,
|
|
1125
|
+
]);
|
|
1097
1126
|
this._removeRangeWithoutDirtying(lastPositionInInitialArray + offset, startPointInInitialArray - lastPositionInInitialArray);
|
|
1098
1127
|
offsetChange -= startPointInInitialArray - lastPositionInInitialArray;
|
|
1099
1128
|
}
|
|
@@ -1102,10 +1131,7 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1102
1131
|
if (startPointInTargetArray > lastPositionInTargetArray) {
|
|
1103
1132
|
changes.insert = changes.insert || [];
|
|
1104
1133
|
let elementsToInsert = targetArray.slice(lastPositionInTargetArray, startPointInTargetArray);
|
|
1105
|
-
changes.insert.push([
|
|
1106
|
-
lastPositionInInitialArray,
|
|
1107
|
-
deepCopy(elementsToInsert),
|
|
1108
|
-
]);
|
|
1134
|
+
changes.insert.push([lastPositionInInitialArray, deepCopy(elementsToInsert)]);
|
|
1109
1135
|
var scope = this._getScope();
|
|
1110
1136
|
var insertedProperties = deserializeNonPrimitiveArrayElements(elementsToInsert, scope);
|
|
1111
1137
|
this._insertRangeWithoutDirtying(lastPositionInInitialArray + offset, insertedProperties);
|
|
@@ -1128,7 +1154,8 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1128
1154
|
}
|
|
1129
1155
|
else {
|
|
1130
1156
|
var lastModifiedSequence = _.last(changes.modify);
|
|
1131
|
-
if (lastModifiedSequence[0] + lastModifiedSequence[1].length ===
|
|
1157
|
+
if (lastModifiedSequence[0] + lastModifiedSequence[1].length ===
|
|
1158
|
+
startPointInInitialArray + j) {
|
|
1132
1159
|
lastModifiedSequence[1].push(entryChanges);
|
|
1133
1160
|
}
|
|
1134
1161
|
else {
|
|
@@ -1216,8 +1243,7 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1216
1243
|
throw new Error(MSG.NO_NORMALIZED_CHANGESET);
|
|
1217
1244
|
}
|
|
1218
1245
|
var arrayLength = this._dataArrayGetLength();
|
|
1219
|
-
if (!in_serializedObj.insert ||
|
|
1220
|
-
!in_serializedObj.insert[0]) {
|
|
1246
|
+
if (!in_serializedObj.insert || !in_serializedObj.insert[0]) {
|
|
1221
1247
|
// we've got an empty object, so we have to wipe everything we've got
|
|
1222
1248
|
if (arrayLength > 0) {
|
|
1223
1249
|
this._clearRange(0, arrayLength);
|
|
@@ -1234,14 +1260,18 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1234
1260
|
}
|
|
1235
1261
|
}
|
|
1236
1262
|
var scope = this._getScope();
|
|
1237
|
-
if (Property.PropertyFactory.inheritsFrom(this.getTypeid(),
|
|
1263
|
+
if (Property.PropertyFactory.inheritsFrom(this.getTypeid(), "NamedProperty", {
|
|
1264
|
+
scope: scope,
|
|
1265
|
+
})) {
|
|
1238
1266
|
return this._deserializeNamedPropertyArray(in_serializedObj, in_reportToView);
|
|
1239
1267
|
}
|
|
1240
1268
|
else {
|
|
1241
1269
|
// most simplistic diff method: Remove all existing data and insert the new data
|
|
1242
1270
|
// The changes we will report as result of this function
|
|
1243
1271
|
var simpleChanges = {
|
|
1244
|
-
insert: in_createChangeSet
|
|
1272
|
+
insert: in_createChangeSet
|
|
1273
|
+
? deepCopy(in_serializedObj.insert)
|
|
1274
|
+
: in_serializedObj.insert,
|
|
1245
1275
|
};
|
|
1246
1276
|
if (arrayLength > 0) {
|
|
1247
1277
|
simpleChanges.remove = [[0, arrayLength]];
|
|
@@ -1250,7 +1280,7 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1250
1280
|
var propertyDescriptions = in_serializedObj.insert[0][1];
|
|
1251
1281
|
var result = [];
|
|
1252
1282
|
for (var i = 0; i < propertyDescriptions.length; ++i) {
|
|
1253
|
-
var createdProperty = Property.PropertyFactory._createProperty(propertyDescriptions[i][
|
|
1283
|
+
var createdProperty = Property.PropertyFactory._createProperty(propertyDescriptions[i]["typeid"], null, undefined, scope);
|
|
1254
1284
|
createdProperty._setParent(this);
|
|
1255
1285
|
createdProperty._deserialize(propertyDescriptions[i], false, in_filteringOptions, false);
|
|
1256
1286
|
result.push(createdProperty);
|
|
@@ -1266,10 +1296,11 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1266
1296
|
var changeSetArray = in_serializedObj.insert[0][1];
|
|
1267
1297
|
var len = buffer.length;
|
|
1268
1298
|
var i = 0;
|
|
1269
|
-
if (this._typeid ===
|
|
1299
|
+
if (this._typeid === "Int64" || this._typeid === "Uint64") {
|
|
1270
1300
|
// For (u)int64, we will compare (Ui/I)nt64 objects with arrays [low, high]
|
|
1271
1301
|
for (i = 0; i < len; i++) {
|
|
1272
|
-
if (changeSetArray[i][0] !== buffer[i].getValueLow() ||
|
|
1302
|
+
if (changeSetArray[i][0] !== buffer[i].getValueLow() ||
|
|
1303
|
+
changeSetArray[i][1] !== buffer[i].getValueHigh()) {
|
|
1273
1304
|
break;
|
|
1274
1305
|
}
|
|
1275
1306
|
}
|
|
@@ -1323,7 +1354,8 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1323
1354
|
var lastModify = undefined;
|
|
1324
1355
|
if (result.modify && result.modify.length > 0) {
|
|
1325
1356
|
lastModify = result.modify[result.modify.length - 1];
|
|
1326
|
-
if (lastModify[0] + lastModify[1].length ===
|
|
1357
|
+
if (lastModify[0] + lastModify[1].length ===
|
|
1358
|
+
currentArrayIndex - op.offset) {
|
|
1327
1359
|
// we need to combine, keep lastModify
|
|
1328
1360
|
}
|
|
1329
1361
|
else {
|
|
@@ -1332,8 +1364,10 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1332
1364
|
}
|
|
1333
1365
|
if (lastModify) {
|
|
1334
1366
|
lastModify[1].push(this._dataArrayGetValue(currentArrayIndex).serialize({
|
|
1335
|
-
|
|
1336
|
-
|
|
1367
|
+
dirtyOnly: true,
|
|
1368
|
+
includeRootTypeid: true,
|
|
1369
|
+
dirtinessType: in_dirtinessType,
|
|
1370
|
+
includeReferencedRepositories: in_includeReferencedRepositories,
|
|
1337
1371
|
}));
|
|
1338
1372
|
}
|
|
1339
1373
|
else {
|
|
@@ -1341,19 +1375,28 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1341
1375
|
if (!result.modify) {
|
|
1342
1376
|
result.modify = [];
|
|
1343
1377
|
}
|
|
1344
|
-
result.modify.push([
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1378
|
+
result.modify.push([
|
|
1379
|
+
currentArrayIndex - op.offset,
|
|
1380
|
+
[
|
|
1381
|
+
this._dataArrayGetValue(currentArrayIndex).serialize({
|
|
1382
|
+
dirtyOnly: true,
|
|
1383
|
+
includeRootTypeid: true,
|
|
1384
|
+
dirtinessType: in_dirtinessType,
|
|
1385
|
+
includeReferencedRepositories: in_includeReferencedRepositories,
|
|
1386
|
+
}),
|
|
1387
|
+
],
|
|
1388
|
+
]);
|
|
1349
1389
|
}
|
|
1350
1390
|
currentArrayIndex++;
|
|
1351
1391
|
// add more immediate modifies if possible
|
|
1352
|
-
while (currentArrayIndex < currentArraySize &&
|
|
1392
|
+
while (currentArrayIndex < currentArraySize &&
|
|
1393
|
+
currentArrayIndex < opStartIndex &&
|
|
1353
1394
|
this._dataArrayGetValue(currentArrayIndex)._isDirty(in_dirtinessType)) {
|
|
1354
1395
|
result.modify[result.modify.length - 1][1].push(this._dataArrayGetValue(currentArrayIndex).serialize({
|
|
1355
|
-
|
|
1356
|
-
|
|
1396
|
+
dirtyOnly: true,
|
|
1397
|
+
includeRootTypeid: true,
|
|
1398
|
+
dirtinessType: in_dirtinessType,
|
|
1399
|
+
includeReferencedRepositories: in_includeReferencedRepositories,
|
|
1357
1400
|
}));
|
|
1358
1401
|
currentArrayIndex++;
|
|
1359
1402
|
}
|
|
@@ -1379,11 +1422,13 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1379
1422
|
// TODO: read the data from the array now - remove the data from the op and
|
|
1380
1423
|
// TODO: replace it with just the length instead
|
|
1381
1424
|
if (!this._dataArrayGetValue(opStartIndex + j)) {
|
|
1382
|
-
throw new Error(
|
|
1425
|
+
throw new Error("insert: invalid index");
|
|
1383
1426
|
}
|
|
1384
1427
|
newInsert[1].push(this._dataArrayGetValue(opStartIndex + j).serialize({
|
|
1385
|
-
|
|
1386
|
-
|
|
1428
|
+
dirtyOnly: false,
|
|
1429
|
+
includeRootTypeid: true,
|
|
1430
|
+
dirtinessType: in_dirtinessType,
|
|
1431
|
+
includeReferencedRepositories: in_includeReferencedRepositories,
|
|
1387
1432
|
}));
|
|
1388
1433
|
}
|
|
1389
1434
|
if (!result.insert) {
|
|
@@ -1426,9 +1471,9 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1426
1471
|
var result = AbstractStaticCollectionProperty.prototype._serialize.call(this, in_dirtyOnly, in_includeRootTypeid, in_dirtinessType, in_includeReferencedRepositories);
|
|
1427
1472
|
if (!this._isPrimitive) {
|
|
1428
1473
|
if (in_dirtyOnly) {
|
|
1429
|
-
_.extend(result, in_dirtinessType === BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE
|
|
1430
|
-
this._getChangesetForCustomTypeArray(this._getPendingChanges(), in_dirtinessType, in_includeReferencedRepositories)
|
|
1431
|
-
this._getChangesetForCustomTypeArray(this._getDirtyChanges(), in_dirtinessType, in_includeReferencedRepositories));
|
|
1474
|
+
_.extend(result, in_dirtinessType === BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE
|
|
1475
|
+
? this._getChangesetForCustomTypeArray(this._getPendingChanges(), in_dirtinessType, in_includeReferencedRepositories)
|
|
1476
|
+
: this._getChangesetForCustomTypeArray(this._getDirtyChanges(), in_dirtinessType, in_includeReferencedRepositories));
|
|
1432
1477
|
return result;
|
|
1433
1478
|
}
|
|
1434
1479
|
else {
|
|
@@ -1445,8 +1490,9 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1445
1490
|
}
|
|
1446
1491
|
}
|
|
1447
1492
|
else if (in_dirtyOnly) {
|
|
1448
|
-
return in_dirtinessType === BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE
|
|
1449
|
-
deepCopy(this._getPendingChanges())
|
|
1493
|
+
return in_dirtinessType === BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE
|
|
1494
|
+
? deepCopy(this._getPendingChanges())
|
|
1495
|
+
: deepCopy(this._getDirtyChanges());
|
|
1450
1496
|
}
|
|
1451
1497
|
else {
|
|
1452
1498
|
// returns just an insert with the current data
|
|
@@ -1468,23 +1514,23 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1468
1514
|
* @param {function} printFct - Function to call for printing each property
|
|
1469
1515
|
*/
|
|
1470
1516
|
_prettyPrint(indent, externalId, printFct) {
|
|
1471
|
-
printFct(indent + externalId + this.getId() +
|
|
1517
|
+
printFct(indent + externalId + this.getId() + " (Array of " + this.getTypeid() + "): [");
|
|
1472
1518
|
if (!this._isPrimitive) {
|
|
1473
1519
|
this._prettyPrintChildren(indent, printFct);
|
|
1474
1520
|
}
|
|
1475
1521
|
else {
|
|
1476
|
-
var childIndent = indent +
|
|
1477
|
-
var prefix =
|
|
1478
|
-
var suffix =
|
|
1479
|
-
if (this.getTypeid() ===
|
|
1522
|
+
var childIndent = indent + " ";
|
|
1523
|
+
var prefix = "";
|
|
1524
|
+
var suffix = "";
|
|
1525
|
+
if (this.getTypeid() === "String") {
|
|
1480
1526
|
prefix = '"';
|
|
1481
1527
|
suffix = '"';
|
|
1482
1528
|
}
|
|
1483
1529
|
for (var i = 0; i < this._dataArrayGetLength(); i++) {
|
|
1484
|
-
printFct(childIndent + i +
|
|
1530
|
+
printFct(childIndent + i + ": " + prefix + this._dataArrayGetValue(i) + suffix);
|
|
1485
1531
|
}
|
|
1486
1532
|
}
|
|
1487
|
-
printFct(indent +
|
|
1533
|
+
printFct(indent + "]");
|
|
1488
1534
|
}
|
|
1489
1535
|
/**
|
|
1490
1536
|
* Repeatedly calls back the given function with human-readable string
|
|
@@ -1493,11 +1539,12 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1493
1539
|
* @param {function} printFct - Function to call for printing each property
|
|
1494
1540
|
*/
|
|
1495
1541
|
_prettyPrintChildren(indent, printFct) {
|
|
1496
|
-
indent +=
|
|
1542
|
+
indent += " ";
|
|
1497
1543
|
var ids = this.getIds();
|
|
1498
1544
|
for (var i = 0; i < ids.length; i++) {
|
|
1499
|
-
this.get(ids[i], {
|
|
1500
|
-
|
|
1545
|
+
this.get(ids[i], {
|
|
1546
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
1547
|
+
})._prettyPrint(indent, ids[i] + ": ", printFct);
|
|
1501
1548
|
}
|
|
1502
1549
|
}
|
|
1503
1550
|
/**
|
|
@@ -1516,7 +1563,9 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1516
1563
|
if (!this._isPrimitive) {
|
|
1517
1564
|
var ids = this.getIds();
|
|
1518
1565
|
for (var i = 0; i < ids.length; i++) {
|
|
1519
|
-
json.value.push(this.get(ids[i], {
|
|
1566
|
+
json.value.push(this.get(ids[i], {
|
|
1567
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
1568
|
+
})._toJson());
|
|
1520
1569
|
}
|
|
1521
1570
|
}
|
|
1522
1571
|
else {
|
|
@@ -1533,7 +1582,7 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1533
1582
|
getFullTypeid(in_hideCollection) {
|
|
1534
1583
|
return in_hideCollection
|
|
1535
1584
|
? this._typeid
|
|
1536
|
-
: TypeIdHelper.createSerializationTypeId(this._typeid,
|
|
1585
|
+
: TypeIdHelper.createSerializationTypeId(this._typeid, "array");
|
|
1537
1586
|
}
|
|
1538
1587
|
/**
|
|
1539
1588
|
* Creates and initializes the data array
|
|
@@ -1633,5 +1682,5 @@ export class ArrayProperty extends AbstractStaticCollectionProperty {
|
|
|
1633
1682
|
}
|
|
1634
1683
|
}
|
|
1635
1684
|
ArrayProperty.prototype._staticChildren = {};
|
|
1636
|
-
ArrayProperty.prototype._context =
|
|
1685
|
+
ArrayProperty.prototype._context = "array";
|
|
1637
1686
|
//# sourceMappingURL=arrayProperty.js.map
|