@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,14 +8,14 @@ exports.MapProperty = void 0;
|
|
|
8
8
|
/**
|
|
9
9
|
* @fileoverview Definition of the map property class
|
|
10
10
|
*/
|
|
11
|
-
const { PathHelper, TypeIdHelper } = require(
|
|
12
|
-
const { MSG } = require(
|
|
13
|
-
const { ConsoleUtils } = require(
|
|
14
|
-
const _ = require(
|
|
15
|
-
const { AbstractStaticCollectionProperty } = require(
|
|
16
|
-
const { BaseProperty } = require(
|
|
17
|
-
const { IndexedCollectionBaseProperty } = require(
|
|
18
|
-
const { LazyLoadedProperties: Property } = require(
|
|
11
|
+
const { PathHelper, TypeIdHelper } = require("@fluid-experimental/property-changeset");
|
|
12
|
+
const { MSG } = require("@fluid-experimental/property-common").constants;
|
|
13
|
+
const { ConsoleUtils } = require("@fluid-experimental/property-common");
|
|
14
|
+
const _ = require("lodash");
|
|
15
|
+
const { AbstractStaticCollectionProperty } = require("./abstractStaticCollectionProperty");
|
|
16
|
+
const { BaseProperty } = require("./baseProperty");
|
|
17
|
+
const { IndexedCollectionBaseProperty } = require("./indexedCollectionBaseProperty");
|
|
18
|
+
const { LazyLoadedProperties: Property } = require("./lazyLoadedProperties");
|
|
19
19
|
const PATH_TOKENS = BaseProperty.PATH_TOKENS;
|
|
20
20
|
/**
|
|
21
21
|
* typedef {property-properties.BaseProperty|string|number|boolean} property-properties.MapProperty~MapValueType
|
|
@@ -39,7 +39,7 @@ class MapProperty extends IndexedCollectionBaseProperty {
|
|
|
39
39
|
constructor(in_params, in_scope) {
|
|
40
40
|
super(in_params);
|
|
41
41
|
this._scope = in_scope;
|
|
42
|
-
this._contextKeyType = in_params.contextKeyType ||
|
|
42
|
+
this._contextKeyType = in_params.contextKeyType || "string";
|
|
43
43
|
/** Contains the actual entries of the map */
|
|
44
44
|
this._dynamicChildren = {};
|
|
45
45
|
}
|
|
@@ -51,7 +51,7 @@ class MapProperty extends IndexedCollectionBaseProperty {
|
|
|
51
51
|
getFullTypeid(in_hideCollection = false) {
|
|
52
52
|
return in_hideCollection
|
|
53
53
|
? this._typeid
|
|
54
|
-
: TypeIdHelper.createSerializationTypeId(this._typeid,
|
|
54
|
+
: TypeIdHelper.createSerializationTypeId(this._typeid, "map");
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
57
|
* Is this property a leaf node with regard to flattening?
|
|
@@ -86,10 +86,13 @@ class MapProperty extends IndexedCollectionBaseProperty {
|
|
|
86
86
|
else {
|
|
87
87
|
var that = this;
|
|
88
88
|
_.each(in_values, function (value, key) {
|
|
89
|
-
var property = that.get(String(key), {
|
|
89
|
+
var property = that.get(String(key), {
|
|
90
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
91
|
+
});
|
|
90
92
|
// if key exists in set replace its value else insert a new key/value
|
|
91
93
|
if (property) {
|
|
92
|
-
if (property instanceof Property.ValueProperty ||
|
|
94
|
+
if (property instanceof Property.ValueProperty ||
|
|
95
|
+
property instanceof Property.StringProperty) {
|
|
93
96
|
property.setValue(value);
|
|
94
97
|
}
|
|
95
98
|
else if (property instanceof BaseProperty && _.isObject(value)) {
|
|
@@ -190,7 +193,7 @@ class MapProperty extends IndexedCollectionBaseProperty {
|
|
|
190
193
|
* @protected
|
|
191
194
|
*/
|
|
192
195
|
_getPathSegmentForChildNode(in_childNode) {
|
|
193
|
-
return
|
|
196
|
+
return "[" + PathHelper.quotePathSegmentIfNeeded(in_childNode._id) + "]";
|
|
194
197
|
}
|
|
195
198
|
/**
|
|
196
199
|
* Resolves a direct child node based on the given path segment
|
|
@@ -311,8 +314,9 @@ class MapProperty extends IndexedCollectionBaseProperty {
|
|
|
311
314
|
else {
|
|
312
315
|
in_options = in_options || {};
|
|
313
316
|
in_options.referenceResolutionMode =
|
|
314
|
-
in_options.referenceResolutionMode === undefined
|
|
315
|
-
|
|
317
|
+
in_options.referenceResolutionMode === undefined
|
|
318
|
+
? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
|
|
319
|
+
: in_options.referenceResolutionMode;
|
|
316
320
|
var prop = this;
|
|
317
321
|
switch (in_ids) {
|
|
318
322
|
case PATH_TOKENS.ROOT: {
|
|
@@ -392,6 +396,6 @@ class MapProperty extends IndexedCollectionBaseProperty {
|
|
|
392
396
|
}
|
|
393
397
|
}
|
|
394
398
|
exports.MapProperty = MapProperty;
|
|
395
|
-
MapProperty.prototype._typeid =
|
|
396
|
-
MapProperty.prototype._context =
|
|
399
|
+
MapProperty.prototype._typeid = "BaseProperty";
|
|
400
|
+
MapProperty.prototype._context = "map";
|
|
397
401
|
//# sourceMappingURL=mapProperty.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapProperty.js","sourceRoot":"","sources":["../../src/properties/mapProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAC3F,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,EAAE,6BAA6B,EAAE,GAAG,OAAO,CAAC,iCAAiC,CAAC,CAAC;AACrF,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAE7E,MAAM,WAAW,GAAG,YAAY,CAAC,WAAW,CAAC;AAE7C;;;;;GAKG;AAEH;;GAEG;AACH,MAAa,WAAY,SAAQ,6BAA6B;IAC1D;;;;;;;;OAQG;IACH,YAAY,SAAS,EAAE,QAAQ;QAC3B,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjB,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC,cAAc,IAAI,QAAQ,CAAC;QAE5D,6CAA6C;QAC7C,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;I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WAAW,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Definition of the map property class\n */\nconst { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst { ConsoleUtils } = require('@fluid-experimental/property-common');\nconst _ = require('lodash');\nconst { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');\nconst { BaseProperty } = require('./baseProperty');\nconst { IndexedCollectionBaseProperty } = require('./indexedCollectionBaseProperty');\nconst { LazyLoadedProperties: Property } = require('./lazyLoadedProperties');\n\nconst PATH_TOKENS = BaseProperty.PATH_TOKENS;\n\n/**\n * typedef {property-properties.BaseProperty|string|number|boolean} property-properties.MapProperty~MapValueType\n *\n * The type of the values that are set/inserted into the map. Depending on the type of the map, these can either\n * be property objects or primitive values\n */\n\n/**\n * A MapProperty is a collection class that can contain an dictionary that maps from strings to properties.\n */\nexport class MapProperty extends IndexedCollectionBaseProperty {\n /**\n * @param {Object} in_params - Input parameters for property creation\n * @param {string|undefined} in_scope - The scope in which the map typeid is defined\n * @constructor\n * @protected\n * @extends property-properties.IndexedCollectionBaseProperty\n * @alias property-properties.MapProperty\n * @category Maps\n */\n constructor(in_params, in_scope) {\n super(in_params);\n\n this._scope = in_scope;\n this._contextKeyType = in_params.contextKeyType || 'string';\n\n /** Contains the actual entries of the map */\n this._dynamicChildren = {};\n }\n\n /**\n * Returns the full property type identifier for the ChangeSet including the enum type id\n * @param {boolean} [in_hideCollection=false] - If true the collection type (if applicable) will be omitted\n * @return {string} The typeid\n */\n getFullTypeid(in_hideCollection = false) {\n return in_hideCollection\n ? this._typeid\n : TypeIdHelper.createSerializationTypeId(this._typeid, 'map');\n }\n\n /**\n * Is this property a leaf node with regard to flattening?\n *\n * TODO: Which semantics should flattening have? It stops at primitive types and collections?\n *\n * @return {boolean} Is it a leaf with regard to flattening?\n */\n _isFlattenLeaf() {\n return true;\n }\n\n /**\n * Sets multiple values in a map.\n *\n * See {@link MapProperty.setValues}\n *\n * @param {object} in_values - to assign to the collection\n * @param {Boolean} in_typed - If the map's items have a typeid and a value then create the\n * properties with that typeid, else use the set's typeid (support polymorphic items).\n * @private\n */\n _setValuesInternal(in_values, in_typed) {\n if (this._containsPrimitiveTypes) {\n var that = this;\n _.each(in_values, function(value, key) {\n if (that.has(key)) {\n that.remove(key);\n }\n\n that.insert(key, value);\n });\n } else {\n var that = this;\n _.each(in_values, function(value, key) {\n var property = that.get(String(key), { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER });\n // if key exists in set replace its value else insert a new key/value\n if (property) {\n if (property instanceof Property.ValueProperty || property instanceof Property.StringProperty) {\n property.setValue(value);\n } else if (property instanceof BaseProperty && _.isObject(value)) {\n property._setValues(value, false, false);\n } else {\n throw new TypeError(MSG.SET_VALUES_PATH_INVALID + key);\n }\n } else {\n if (value instanceof BaseProperty) {\n that.insert(key, value);\n } else {\n if (in_typed) {\n that.insert(key, Property.PropertyFactory._createProperty(\n value.typeid || that._typeid, null, value.value, that._getScope()));\n } else {\n that.insert(key, Property.PropertyFactory._createProperty(\n that._typeid, null, value, that._getScope()));\n }\n }\n }\n });\n }\n }\n\n /**\n * Sets multiple values in a map.\n *\n * See {@link MapProperty.setValues}\n *\n * @param {object} in_values - to assign to the collection\n * @param {Bool} in_typed - Whether the values are typed/polymorphic.\n * @param {Bool} in_initial - Whether we are setting default/initial values or if the function is called directly\n * with the values to set.\n *\n * @override\n */\n _setValues(in_values, in_typed, in_initial) {\n if (in_initial) {\n this.clear();\n }\n\n this._setValuesInternal(in_values, in_typed);\n }\n\n /**\n * Sets multiple values in a map.\n *\n * @param {object} in_values - to assign to the collection\n * @throws If one of the path in in_values does not exist in this property\n * @throws If trying to set a value to a path that leads to a Property other than ValueProperty or StringProperty\n *\n * @override\n */\n setValues(in_values) {\n var checkoutView = this._getCheckoutView();\n if (checkoutView !== undefined) {\n checkoutView.pushNotificationDelayScope();\n this._setValues(in_values, false, false);\n checkoutView.popNotificationDelayScope();\n } else {\n this._setValues(in_values, false, false);\n }\n }\n\n /**\n * Returns an object with all the nested values contained in this property.\n *\n * @example\n * ```javascript\n * {\n * 'firstString': {\n * 'stringValue': 'test1'\n * },\n * 'secondString': {\n * 'stringValue': 'test2'\n * }\n * }\n */\n getValues() {\n var ids = this.getIds();\n var result = {};\n for (var i = 0; i < ids.length; i++) {\n var child = this.get(ids[i]);\n if (child.isPrimitiveType()) {\n result[ids[i]] = this.get(ids[i]).getValue();\n } else {\n result[ids[i]] = child.getValues();\n }\n }\n return result;\n }\n\n /**\n * Returns the path segment for a child\n *\n * @param {property-properties.BaseProperty} in_childNode - The child for which the path is returned\n *\n * @return {string} The path segment to resolve the child property under this property\n * @protected\n */\n _getPathSegmentForChildNode(in_childNode) {\n return '[' + PathHelper.quotePathSegmentIfNeeded(in_childNode._id) + ']';\n }\n\n /**\n * Resolves a direct child node based on the given path segment\n *\n * @param {String} in_segment - The path segment to resolve\n * @param {property-properties.PathHelper.TOKEN_TYPES} in_segmentType - The type of segment in the tokenized path\n *\n * @return {property-properties.BaseProperty|undefined} The child property that has been resolved\n * @protected\n */\n _resolvePathSegment(in_segment, in_segmentType) {\n return in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN\n ? this._dynamicChildren[in_segment]\n : AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(\n this,\n in_segment,\n in_segmentType);\n }\n\n /**\n * Inserts a property or value into the map\n *\n * Note: This will trigger an exception when this key already exists in the map. If you want to overwrite\n * existing entries you can use the set function.\n *\n * @param {string} in_key - The key under which the entry is added\n * @param {property-properties.Property} in_property - The property to insert\n * @throws If the property already exists\n * @throws If the property already has a parent\n * @throws If in_key is not a string\n * @throws If the property is a root property\n */\n insert(in_key, in_property) {\n ConsoleUtils.assert(_.isString(in_key), MSG.KEY_NOT_STRING + in_key);\n if (this._dynamicChildren[in_key] !== undefined) {\n throw new Error(MSG.PROPERTY_ALREADY_EXISTS + in_key);\n }\n if (in_property instanceof BaseProperty) {\n in_property._validateInsertIn(this);\n // Set the ID of the entry, to make sure it corresponds to the used key\n in_property._setId(in_key);\n\n // Insert the entry into the collection\n this._insert(in_key, in_property, true);\n } else {\n throw new TypeError(MSG.NONVALUE_MAP_INSERT_PROP);\n }\n }\n\n /**\n * Removes the entry with the given key from the map\n *\n * @param {string} in_key - The key of the entry to remove from the map\n * @throws If trying to remove an entry that does not exist\n * @return {*} the item removed\n */\n remove(in_key) {\n var item = this.get(in_key);\n this._removeByKey(in_key, true);\n return item;\n }\n\n /**\n * Sets the entry with the given key to the property passed in\n *\n * Note: this will overwrite an already existing value\n *\n * @param {string} in_key - The key under which the entry is stored\n * @param {property-properties.MapProperty~MapValueType} in_property - The property to store in the map\n * @throws If in_property is not a property\n * @throws If trying to insert a property that has a parent\n * @throws If in_key is not a string or a number\n */\n set(in_key, in_property) {\n this._checkIsNotReadOnly(true);\n if (this._dynamicChildren[in_key] !== in_property) {\n if (this._containsPrimitiveTypes === false && in_property.getParent() !== undefined) {\n throw new Error(MSG.INSERTED_ENTRY_WITH_PARENT);\n }\n if (this._dynamicChildren[in_key] !== undefined) {\n this._removeByKey(in_key, false);\n }\n // Set the ID of the entry, to make sure it corresponds to the used key\n if (this._containsPrimitiveTypes === false) {\n in_property._setId(in_key);\n }\n this._insert(in_key, in_property, false);\n\n // Make one final report\n this._reportDirtinessToView();\n }\n }\n\n /**\n * Returns an Object with all the entries of the map.\n * Contrary ot .getValues, for Property Maps, this will return the Property, not an object with their nested values.\n * WARNING: This is a direct access to the internal data-structure and the collection MUST NOT be modified. It is\n * read only for fast access and iteration. Insertion and deletion MUST be done via the insert and remove functions\n * of this class.\n *\n * @return {Object} The map with all entries in the map.\n */\n getEntriesReadOnly() {\n return this._dynamicChildren;\n }\n\n /**\n * Returns the collection entry with the given key\n *\n * @param {string|array<string>} in_ids - key of the entry to return or an array of keys\n * if an array is passed, the .get function will be performed on each id in sequence\n * for example .get(['position','x']) is equivalent to .get('position').get('x').\n * If .get resolves to a ReferenceProperty, it will return the property that the ReferenceProperty\n * refers to.\n * @param {Object} in_options - parameter object\n * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS]- -\n * How should this function behave during reference resolution?\n *\n * @return {property-properties.Property|*|undefined} The entry in the collection or undefined\n * if none could be found\n */\n get(in_ids, in_options) {\n if (_.isArray(in_ids)) {\n // Forward handling of arrays to the BaseProperty function\n return AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);\n } else {\n in_options = in_options || {};\n in_options.referenceResolutionMode =\n in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :\n in_options.referenceResolutionMode;\n\n var prop = this;\n switch (in_ids) {\n case PATH_TOKENS.ROOT: {\n prop = prop.getRoot();\n break;\n }\n case PATH_TOKENS.UP: {\n prop = prop.getParent();\n break;\n }\n case PATH_TOKENS.REF: {\n throw new Error(MSG.NO_GET_DEREFERENCE_ONLY);\n }\n default: {\n prop = prop._dynamicChildren[in_ids];\n break;\n }\n }\n\n // Handle automatic reference resolution\n if (in_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {\n if (prop instanceof Property.ReferenceProperty) {\n prop = prop.ref;\n }\n }\n\n return prop;\n }\n }\n\n /**\n * Checks whether an entry with the given name exists\n *\n * @param {string} in_id - Name of the property\n * @return {boolean} True if the property exists, otherwise false.\n */\n has(in_id) {\n return this._dynamicChildren[in_id] !== undefined;\n }\n\n /**\n * Returns all entries of the map as an array.\n *\n * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n *\n * @return {Array.<property-properties.BaseProperty | *>} Array with all entries of the map. This array\n * is a shallow copy which can be modified by the caller without effects on the map.\n */\n getAsArray() {\n return _.values(this._dynamicChildren);\n }\n\n /**\n * Returns all keys found in the map\n *\n * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n *\n * @return {Array.<string>} The keys\n */\n getIds() {\n return Object.keys(this._dynamicChildren);\n }\n\n /**\n * Get the scope to which this property belongs to.\n * @return {string|undefined} The guid representing the scope in which the\n * map belongs to. If there is a workspace scope return it, else return the scope of this map.\n * @override\n * @private\n */\n _getScope() {\n var scope = IndexedCollectionBaseProperty.prototype._getScope.call(this);\n\n return scope !== undefined ? scope : this._scope;\n }\n\n /**\n * Deletes all values from the Map\n */\n clear() {\n var that = this;\n this.getIds().forEach(function(id) {\n that.remove(id);\n });\n }\n}\n\nMapProperty.prototype._typeid = 'BaseProperty';\nMapProperty.prototype._context = 'map';\n"]}
|
|
1
|
+
{"version":3,"file":"mapProperty.js","sourceRoot":"","sources":["../../src/properties/mapProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAC3F,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,EAAE,6BAA6B,EAAE,GAAG,OAAO,CAAC,iCAAiC,CAAC,CAAC;AACrF,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAE7E,MAAM,WAAW,GAAG,YAAY,CAAC,WAAW,CAAC;AAE7C;;;;;GAKG;AAEH;;GAEG;AACH,MAAa,WAAY,SAAQ,6BAA6B;IAC7D;;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QAChB,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE;YACjC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAxZD,kCAwZC;AAED,WAAW,CAAC,SAAS,CAAC,OAAO,GAAG,cAAc,CAAC;AAC/C,WAAW,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Definition of the map property class\n */\nconst { PathHelper, TypeIdHelper } = require(\"@fluid-experimental/property-changeset\");\nconst { MSG } = require(\"@fluid-experimental/property-common\").constants;\nconst { ConsoleUtils } = require(\"@fluid-experimental/property-common\");\nconst _ = require(\"lodash\");\nconst { AbstractStaticCollectionProperty } = require(\"./abstractStaticCollectionProperty\");\nconst { BaseProperty } = require(\"./baseProperty\");\nconst { IndexedCollectionBaseProperty } = require(\"./indexedCollectionBaseProperty\");\nconst { LazyLoadedProperties: Property } = require(\"./lazyLoadedProperties\");\n\nconst PATH_TOKENS = BaseProperty.PATH_TOKENS;\n\n/**\n * typedef {property-properties.BaseProperty|string|number|boolean} property-properties.MapProperty~MapValueType\n *\n * The type of the values that are set/inserted into the map. Depending on the type of the map, these can either\n * be property objects or primitive values\n */\n\n/**\n * A MapProperty is a collection class that can contain an dictionary that maps from strings to properties.\n */\nexport class MapProperty extends IndexedCollectionBaseProperty {\n\t/**\n\t * @param {Object} in_params - Input parameters for property creation\n\t * @param {string|undefined} in_scope - The scope in which the map typeid is defined\n\t * @constructor\n\t * @protected\n\t * @extends property-properties.IndexedCollectionBaseProperty\n\t * @alias property-properties.MapProperty\n\t * @category Maps\n\t */\n\tconstructor(in_params, in_scope) {\n\t\tsuper(in_params);\n\n\t\tthis._scope = in_scope;\n\t\tthis._contextKeyType = in_params.contextKeyType || \"string\";\n\n\t\t/** Contains the actual entries of the map */\n\t\tthis._dynamicChildren = {};\n\t}\n\n\t/**\n\t * Returns the full property type identifier for the ChangeSet including the enum type id\n\t * @param {boolean} [in_hideCollection=false] - If true the collection type (if applicable) will be omitted\n\t * @return {string} The typeid\n\t */\n\tgetFullTypeid(in_hideCollection = false) {\n\t\treturn in_hideCollection\n\t\t\t? this._typeid\n\t\t\t: TypeIdHelper.createSerializationTypeId(this._typeid, \"map\");\n\t}\n\n\t/**\n\t * Is this property a leaf node with regard to flattening?\n\t *\n\t * TODO: Which semantics should flattening have? It stops at primitive types and collections?\n\t *\n\t * @return {boolean} Is it a leaf with regard to flattening?\n\t */\n\t_isFlattenLeaf() {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Sets multiple values in a map.\n\t *\n\t * See {@link MapProperty.setValues}\n\t *\n\t * @param {object} in_values - to assign to the collection\n\t * @param {Boolean} in_typed - If the map's items have a typeid and a value then create the\n\t * properties with that typeid, else use the set's typeid (support polymorphic items).\n\t * @private\n\t */\n\t_setValuesInternal(in_values, in_typed) {\n\t\tif (this._containsPrimitiveTypes) {\n\t\t\tvar that = this;\n\t\t\t_.each(in_values, function (value, key) {\n\t\t\t\tif (that.has(key)) {\n\t\t\t\t\tthat.remove(key);\n\t\t\t\t}\n\n\t\t\t\tthat.insert(key, value);\n\t\t\t});\n\t\t} else {\n\t\t\tvar that = this;\n\t\t\t_.each(in_values, function (value, key) {\n\t\t\t\tvar property = that.get(String(key), {\n\t\t\t\t\treferenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,\n\t\t\t\t});\n\t\t\t\t// if key exists in set replace its value else insert a new key/value\n\t\t\t\tif (property) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tproperty instanceof Property.ValueProperty ||\n\t\t\t\t\t\tproperty instanceof Property.StringProperty\n\t\t\t\t\t) {\n\t\t\t\t\t\tproperty.setValue(value);\n\t\t\t\t\t} else if (property instanceof BaseProperty && _.isObject(value)) {\n\t\t\t\t\t\tproperty._setValues(value, false, false);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow new TypeError(MSG.SET_VALUES_PATH_INVALID + key);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (value instanceof BaseProperty) {\n\t\t\t\t\t\tthat.insert(key, value);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (in_typed) {\n\t\t\t\t\t\t\tthat.insert(\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tProperty.PropertyFactory._createProperty(\n\t\t\t\t\t\t\t\t\tvalue.typeid || that._typeid,\n\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\tvalue.value,\n\t\t\t\t\t\t\t\t\tthat._getScope(),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthat.insert(\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tProperty.PropertyFactory._createProperty(\n\t\t\t\t\t\t\t\t\tthat._typeid,\n\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t\t\tthat._getScope(),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Sets multiple values in a map.\n\t *\n\t * See {@link MapProperty.setValues}\n\t *\n\t * @param {object} in_values - to assign to the collection\n\t * @param {Bool} in_typed - Whether the values are typed/polymorphic.\n\t * @param {Bool} in_initial - Whether we are setting default/initial values or if the function is called directly\n\t * with the values to set.\n\t *\n\t * @override\n\t */\n\t_setValues(in_values, in_typed, in_initial) {\n\t\tif (in_initial) {\n\t\t\tthis.clear();\n\t\t}\n\n\t\tthis._setValuesInternal(in_values, in_typed);\n\t}\n\n\t/**\n\t * Sets multiple values in a map.\n\t *\n\t * @param {object} in_values - to assign to the collection\n\t * @throws If one of the path in in_values does not exist in this property\n\t * @throws If trying to set a value to a path that leads to a Property other than ValueProperty or StringProperty\n\t *\n\t * @override\n\t */\n\tsetValues(in_values) {\n\t\tvar checkoutView = this._getCheckoutView();\n\t\tif (checkoutView !== undefined) {\n\t\t\tcheckoutView.pushNotificationDelayScope();\n\t\t\tthis._setValues(in_values, false, false);\n\t\t\tcheckoutView.popNotificationDelayScope();\n\t\t} else {\n\t\t\tthis._setValues(in_values, false, false);\n\t\t}\n\t}\n\n\t/**\n\t * Returns an object with all the nested values contained in this property.\n\t *\n\t * @example\n\t * ```javascript\n\t * {\n\t * 'firstString': {\n\t * 'stringValue': 'test1'\n\t * },\n\t * 'secondString': {\n\t * 'stringValue': 'test2'\n\t * }\n\t * }\n\t */\n\tgetValues() {\n\t\tvar ids = this.getIds();\n\t\tvar result = {};\n\t\tfor (var i = 0; i < ids.length; i++) {\n\t\t\tvar child = this.get(ids[i]);\n\t\t\tif (child.isPrimitiveType()) {\n\t\t\t\tresult[ids[i]] = this.get(ids[i]).getValue();\n\t\t\t} else {\n\t\t\t\tresult[ids[i]] = child.getValues();\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Returns the path segment for a child\n\t *\n\t * @param {property-properties.BaseProperty} in_childNode - The child for which the path is returned\n\t *\n\t * @return {string} The path segment to resolve the child property under this property\n\t * @protected\n\t */\n\t_getPathSegmentForChildNode(in_childNode) {\n\t\treturn \"[\" + PathHelper.quotePathSegmentIfNeeded(in_childNode._id) + \"]\";\n\t}\n\n\t/**\n\t * Resolves a direct child node based on the given path segment\n\t *\n\t * @param {String} in_segment - The path segment to resolve\n\t * @param {property-properties.PathHelper.TOKEN_TYPES} in_segmentType - The type of segment in the tokenized path\n\t *\n\t * @return {property-properties.BaseProperty|undefined} The child property that has been resolved\n\t * @protected\n\t */\n\t_resolvePathSegment(in_segment, in_segmentType) {\n\t\treturn in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN\n\t\t\t? this._dynamicChildren[in_segment]\n\t\t\t: AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(\n\t\t\t\t\tthis,\n\t\t\t\t\tin_segment,\n\t\t\t\t\tin_segmentType,\n\t\t\t );\n\t}\n\n\t/**\n\t * Inserts a property or value into the map\n\t *\n\t * Note: This will trigger an exception when this key already exists in the map. If you want to overwrite\n\t * existing entries you can use the set function.\n\t *\n\t * @param {string} in_key - The key under which the entry is added\n\t * @param {property-properties.Property} in_property - The property to insert\n\t * @throws If the property already exists\n\t * @throws If the property already has a parent\n\t * @throws If in_key is not a string\n\t * @throws If the property is a root property\n\t */\n\tinsert(in_key, in_property) {\n\t\tConsoleUtils.assert(_.isString(in_key), MSG.KEY_NOT_STRING + in_key);\n\t\tif (this._dynamicChildren[in_key] !== undefined) {\n\t\t\tthrow new Error(MSG.PROPERTY_ALREADY_EXISTS + in_key);\n\t\t}\n\t\tif (in_property instanceof BaseProperty) {\n\t\t\tin_property._validateInsertIn(this);\n\t\t\t// Set the ID of the entry, to make sure it corresponds to the used key\n\t\t\tin_property._setId(in_key);\n\n\t\t\t// Insert the entry into the collection\n\t\t\tthis._insert(in_key, in_property, true);\n\t\t} else {\n\t\t\tthrow new TypeError(MSG.NONVALUE_MAP_INSERT_PROP);\n\t\t}\n\t}\n\n\t/**\n\t * Removes the entry with the given key from the map\n\t *\n\t * @param {string} in_key - The key of the entry to remove from the map\n\t * @throws If trying to remove an entry that does not exist\n\t * @return {*} the item removed\n\t */\n\tremove(in_key) {\n\t\tvar item = this.get(in_key);\n\t\tthis._removeByKey(in_key, true);\n\t\treturn item;\n\t}\n\n\t/**\n\t * Sets the entry with the given key to the property passed in\n\t *\n\t * Note: this will overwrite an already existing value\n\t *\n\t * @param {string} in_key - The key under which the entry is stored\n\t * @param {property-properties.MapProperty~MapValueType} in_property - The property to store in the map\n\t * @throws If in_property is not a property\n\t * @throws If trying to insert a property that has a parent\n\t * @throws If in_key is not a string or a number\n\t */\n\tset(in_key, in_property) {\n\t\tthis._checkIsNotReadOnly(true);\n\t\tif (this._dynamicChildren[in_key] !== in_property) {\n\t\t\tif (this._containsPrimitiveTypes === false && in_property.getParent() !== undefined) {\n\t\t\t\tthrow new Error(MSG.INSERTED_ENTRY_WITH_PARENT);\n\t\t\t}\n\t\t\tif (this._dynamicChildren[in_key] !== undefined) {\n\t\t\t\tthis._removeByKey(in_key, false);\n\t\t\t}\n\t\t\t// Set the ID of the entry, to make sure it corresponds to the used key\n\t\t\tif (this._containsPrimitiveTypes === false) {\n\t\t\t\tin_property._setId(in_key);\n\t\t\t}\n\t\t\tthis._insert(in_key, in_property, false);\n\n\t\t\t// Make one final report\n\t\t\tthis._reportDirtinessToView();\n\t\t}\n\t}\n\n\t/**\n\t * Returns an Object with all the entries of the map.\n\t * Contrary ot .getValues, for Property Maps, this will return the Property, not an object with their nested values.\n\t * WARNING: This is a direct access to the internal data-structure and the collection MUST NOT be modified. It is\n\t * read only for fast access and iteration. Insertion and deletion MUST be done via the insert and remove functions\n\t * of this class.\n\t *\n\t * @return {Object} The map with all entries in the map.\n\t */\n\tgetEntriesReadOnly() {\n\t\treturn this._dynamicChildren;\n\t}\n\n\t/**\n\t * Returns the collection entry with the given key\n\t *\n\t * @param {string|array<string>} in_ids - key of the entry to return or an array of keys\n\t * if an array is passed, the .get function will be performed on each id in sequence\n\t * for example .get(['position','x']) is equivalent to .get('position').get('x').\n\t * If .get resolves to a ReferenceProperty, it will return the property that the ReferenceProperty\n\t * refers to.\n\t * @param {Object} in_options - parameter object\n\t * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS]- -\n\t * How should this function behave during reference resolution?\n\t *\n\t * @return {property-properties.Property|*|undefined} The entry in the collection or undefined\n\t * if none could be found\n\t */\n\tget(in_ids, in_options) {\n\t\tif (_.isArray(in_ids)) {\n\t\t\t// Forward handling of arrays to the BaseProperty function\n\t\t\treturn AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);\n\t\t} else {\n\t\t\tin_options = in_options || {};\n\t\t\tin_options.referenceResolutionMode =\n\t\t\t\tin_options.referenceResolutionMode === undefined\n\t\t\t\t\t? BaseProperty.REFERENCE_RESOLUTION.ALWAYS\n\t\t\t\t\t: in_options.referenceResolutionMode;\n\n\t\t\tvar prop = this;\n\t\t\tswitch (in_ids) {\n\t\t\t\tcase PATH_TOKENS.ROOT: {\n\t\t\t\t\tprop = prop.getRoot();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase PATH_TOKENS.UP: {\n\t\t\t\t\tprop = prop.getParent();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase PATH_TOKENS.REF: {\n\t\t\t\t\tthrow new Error(MSG.NO_GET_DEREFERENCE_ONLY);\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tprop = prop._dynamicChildren[in_ids];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Handle automatic reference resolution\n\t\t\tif (in_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {\n\t\t\t\tif (prop instanceof Property.ReferenceProperty) {\n\t\t\t\t\tprop = prop.ref;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn prop;\n\t\t}\n\t}\n\n\t/**\n\t * Checks whether an entry with the given name exists\n\t *\n\t * @param {string} in_id - Name of the property\n\t * @return {boolean} True if the property exists, otherwise false.\n\t */\n\thas(in_id) {\n\t\treturn this._dynamicChildren[in_id] !== undefined;\n\t}\n\n\t/**\n\t * Returns all entries of the map as an array.\n\t *\n\t * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n\t *\n\t * @return {Array.<property-properties.BaseProperty | *>} Array with all entries of the map. This array\n\t * is a shallow copy which can be modified by the caller without effects on the map.\n\t */\n\tgetAsArray() {\n\t\treturn _.values(this._dynamicChildren);\n\t}\n\n\t/**\n\t * Returns all keys found in the map\n\t *\n\t * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n\t *\n\t * @return {Array.<string>} The keys\n\t */\n\tgetIds() {\n\t\treturn Object.keys(this._dynamicChildren);\n\t}\n\n\t/**\n\t * Get the scope to which this property belongs to.\n\t * @return {string|undefined} The guid representing the scope in which the\n\t * map belongs to. If there is a workspace scope return it, else return the scope of this map.\n\t * @override\n\t * @private\n\t */\n\t_getScope() {\n\t\tvar scope = IndexedCollectionBaseProperty.prototype._getScope.call(this);\n\n\t\treturn scope !== undefined ? scope : this._scope;\n\t}\n\n\t/**\n\t * Deletes all values from the Map\n\t */\n\tclear() {\n\t\tvar that = this;\n\t\tthis.getIds().forEach(function (id) {\n\t\t\tthat.remove(id);\n\t\t});\n\t}\n}\n\nMapProperty.prototype._typeid = \"BaseProperty\";\nMapProperty.prototype._context = \"map\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namedNodeProperty.d.ts","sourceRoot":"","sources":["../../src/properties/namedNodeProperty.js"],"names":[],"mappings":"AAYA;;;GAGG;AACH;
|
|
1
|
+
{"version":3,"file":"namedNodeProperty.d.ts","sourceRoot":"","sources":["../../src/properties/namedNodeProperty.js"],"names":[],"mappings":"AAYA;;;GAGG;AACH;IACC;;;;;;;;;;OAUG;IACH,wBAEC;IAoBD;;;OAGG;IACH,YAAwC;CACxC"}
|
|
@@ -8,8 +8,8 @@ exports.NamedNodeProperty = void 0;
|
|
|
8
8
|
/**
|
|
9
9
|
* @fileoverview Definition of the named node property class
|
|
10
10
|
*/
|
|
11
|
-
const { NamedProperty } = require(
|
|
12
|
-
const { NodeProperty } = require(
|
|
11
|
+
const { NamedProperty } = require("./namedProperty");
|
|
12
|
+
const { NodeProperty } = require("./nodeProperty");
|
|
13
13
|
/**
|
|
14
14
|
* A NamedNodeProperty is a NodeProperty that has a GUID which unique identifies the property object.
|
|
15
15
|
* This makes it possible to store it in a set collection.
|
|
@@ -52,5 +52,5 @@ class NamedNodeProperty extends NodeProperty {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
exports.NamedNodeProperty = NamedNodeProperty;
|
|
55
|
-
NamedNodeProperty.prototype._typeid =
|
|
55
|
+
NamedNodeProperty.prototype._typeid = "NamedNodeProperty";
|
|
56
56
|
//# sourceMappingURL=namedNodeProperty.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namedNodeProperty.js","sourceRoot":"","sources":["../../src/properties/namedNodeProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AAEH,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACrD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,YAAY;
|
|
1
|
+
{"version":3,"file":"namedNodeProperty.js","sourceRoot":"","sources":["../../src/properties/namedNodeProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AAEH,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACrD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,YAAY;IAClD;;;;;;;;;;OAUG;IACH,YAAY,SAAS;QACpB,KAAK,CAAC,SAAS,CAAC,CAAC;QAGlB;;;;;;WAMG;QACH,UAAK,GAAG,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC;QAEtC;;;;;;WAMG;QACH,YAAO,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC;QAE1C;;;WAGG;QACH,WAAM,GAAG,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC;IAxBxC,CAAC;CAyBD;AAvCD,8CAuCC;AAED,iBAAiB,CAAC,SAAS,CAAC,OAAO,GAAG,mBAAmB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Definition of the named node property class\n */\n\nconst { NamedProperty } = require(\"./namedProperty\");\nconst { NodeProperty } = require(\"./nodeProperty\");\n\n/**\n * A NamedNodeProperty is a NodeProperty that has a GUID which unique identifies the property object.\n * This makes it possible to store it in a set collection.\n */\nexport class NamedNodeProperty extends NodeProperty {\n\t/**\n\t * @param {object} in_params - List of parameters\n\t * @param {string} in_params.id - id of the property (null, if the GUID should be used for the ID)\n\t * @param {string} in_params.typeid - The type identifier\n\t *\n\t * @constructor\n\t * @protected\n\t * @extends property-properties.NodeProperty\n\t * @alias property-properties.NamedNodeProperty\n\t * @category Other Collections\n\t */\n\tconstructor(in_params) {\n\t\tsuper(in_params);\n\t}\n\n\t/**\n\t * Returns a string identifying the property\n\t *\n\t * If an id has been explicitly set on this property we return that one, otherwise the GUID is used.\n\t *\n\t * @return {string} String identifying the property\n\t */\n\tgetId = NamedProperty.prototype.getId;\n\n\t/**\n\t * Returns the GUID of this named property\n\t * A Guid is a unique identifier for a branch, commit or repository,\n\t * similar to a URN. Most functions in the API will us a URN but the\n\t * Guid is used to traverse the commit graph.\n\t * @return {string} The GUID\n\t */\n\tgetGuid = NamedProperty.prototype.getGuid;\n\n\t/**\n\t * Return the URN for this named property\n\t * @return {string} The URN\n\t */\n\tgetUrn = NamedProperty.prototype.getUrn;\n}\n\nNamedNodeProperty.prototype._typeid = \"NamedNodeProperty\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namedProperty.d.ts","sourceRoot":"","sources":["../../src/properties/namedProperty.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH;
|
|
1
|
+
{"version":3,"file":"namedProperty.d.ts","sourceRoot":"","sources":["../../src/properties/namedProperty.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH;IACC;;;;;;;;;;OAUG;IACH,wBAEC;CAmCD"}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.NamedProperty = void 0;
|
|
11
|
-
const { ContainerProperty } = require(
|
|
12
|
-
const { BaseProperty } = require(
|
|
11
|
+
const { ContainerProperty } = require("./containerProperty");
|
|
12
|
+
const { BaseProperty } = require("./baseProperty");
|
|
13
13
|
/**
|
|
14
14
|
* A NamedProperty has a URN which uniquely identifies the property object. This makes it possible to store it in a
|
|
15
15
|
* set collection.
|
|
@@ -47,10 +47,12 @@ class NamedProperty extends ContainerProperty {
|
|
|
47
47
|
* @return {string} The GUID
|
|
48
48
|
*/
|
|
49
49
|
getGuid() {
|
|
50
|
-
var guid = this.get(
|
|
51
|
-
|
|
50
|
+
var guid = this.get("guid", {
|
|
51
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
52
|
+
});
|
|
53
|
+
return guid ? guid.getValue() : "";
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
exports.NamedProperty = NamedProperty;
|
|
55
|
-
NamedProperty.prototype._typeid =
|
|
57
|
+
NamedProperty.prototype._typeid = "NamedProperty";
|
|
56
58
|
//# sourceMappingURL=namedProperty.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namedProperty.js","sourceRoot":"","sources":["../../src/properties/namedProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;AAEH,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC7D,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAa,aAAc,SAAQ,iBAAiB;
|
|
1
|
+
{"version":3,"file":"namedProperty.js","sourceRoot":"","sources":["../../src/properties/namedProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;AAEH,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC7D,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAa,aAAc,SAAQ,iBAAiB;IACnD;;;;;;;;;;OAUG;IACH,YAAY,SAAS;QACpB,KAAK,CAAC,SAAS,CAAC,CAAC;IAClB,CAAC;IAED;;;;;;OAMG;IACH,KAAK;QACJ,OAAO,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;IACtD,CAAC;IAED;;;;;;OAMG;IACH,OAAO;QACN,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;YAC3B,uBAAuB,EAAE,YAAY,CAAC,oBAAoB,CAAC,KAAK;SAChE,CAAC,CAAC;QACH,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACpC,CAAC;CAUD;AAjDD,sCAiDC;AACD,aAAa,CAAC,SAAS,CAAC,OAAO,GAAG,eAAe,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Definition of the named property class\n */\n\nconst { ContainerProperty } = require(\"./containerProperty\");\nconst { BaseProperty } = require(\"./baseProperty\");\n\n/**\n * A NamedProperty has a URN which uniquely identifies the property object. This makes it possible to store it in a\n * set collection.\n */\nexport class NamedProperty extends ContainerProperty {\n\t/**\n\t * @param {object} in_params - List of parameters\n\t * @param {string} in_params.id - id of the property (null, if the GUID should be used for the ID)\n\t * @param {string} in_params.typeid - The type identifier\n\t *\n\t * @constructor\n\t * @protected\n\t * @extends property-properties.ContainerProperty\n\t * @alias property-properties.NamedProperty\n\t * @category Properties\n\t */\n\tconstructor(in_params) {\n\t\tsuper(in_params);\n\t}\n\n\t/**\n\t * Returns a string identifying the property\n\t *\n\t * If an id has been explicitly set on this property we return that one, otherwise the GUID is used.\n\t *\n\t * @return {string} String identifying the property\n\t */\n\tgetId() {\n\t\treturn this._id !== null ? this._id : this.getGuid();\n\t}\n\n\t/**\n\t * Returns the GUID of this named property\n\t * A Guid is a unique identifier for a branch, commit or repository,\n\t * similar to a URN. Most functions in the API will us a URN but the\n\t * Guid is used to traverse the commit graph.\n\t * @return {string} The GUID\n\t */\n\tgetGuid() {\n\t\tvar guid = this.get(\"guid\", {\n\t\t\treferenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,\n\t\t});\n\t\treturn guid ? guid.getValue() : \"\";\n\t}\n\n\t// THIS IS DISABLED FOR THE MOMENT, UNTIL WE BETTER UNDERSTAND HOW REFERENCES WORK IN FLUID\n\t/**\n\t * Return the URN for this named property\n\t * @return {string} The URN\n\t */\n\t/* NamedProperty.prototype.getUrn = function() {\n\n }; */\n}\nNamedProperty.prototype._typeid = \"NamedProperty\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeProperty.d.ts","sourceRoot":"","sources":["../../src/properties/nodeProperty.js"],"names":[],"mappings":"AAUA;;GAEG;AACH;
|
|
1
|
+
{"version":3,"file":"nodeProperty.d.ts","sourceRoot":"","sources":["../../src/properties/nodeProperty.js"],"names":[],"mappings":"AAUA;;GAEG;AACH;CA0BC"}
|
|
@@ -8,7 +8,7 @@ exports.NodeProperty = void 0;
|
|
|
8
8
|
/**
|
|
9
9
|
* @fileoverview This file contains the implementation of the NodeProperty class
|
|
10
10
|
*/
|
|
11
|
-
const { ContainerProperty } = require(
|
|
11
|
+
const { ContainerProperty } = require("./containerProperty");
|
|
12
12
|
/**
|
|
13
13
|
* A property object that allows to add child properties dynamically.
|
|
14
14
|
*/
|
|
@@ -29,12 +29,14 @@ class NodeProperty extends ContainerProperty {
|
|
|
29
29
|
/**
|
|
30
30
|
* @inheritdoc
|
|
31
31
|
*/
|
|
32
|
-
isDynamic() {
|
|
32
|
+
isDynamic() {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
33
35
|
/**
|
|
34
36
|
* @inheritdoc
|
|
35
37
|
*/
|
|
36
38
|
_validateInsert(in_id, in_property) { }
|
|
37
39
|
}
|
|
38
40
|
exports.NodeProperty = NodeProperty;
|
|
39
|
-
NodeProperty.prototype._typeid =
|
|
41
|
+
NodeProperty.prototype._typeid = "NodeProperty";
|
|
40
42
|
//# sourceMappingURL=nodeProperty.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeProperty.js","sourceRoot":"","sources":["../../src/properties/nodeProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAa,YAAa,SAAQ,iBAAiB;
|
|
1
|
+
{"version":3,"file":"nodeProperty.js","sourceRoot":"","sources":["../../src/properties/nodeProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;GAEG;AACH,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAa,YAAa,SAAQ,iBAAiB;IAClD;;;;;;;;OAQG;IACH,YAAY,SAAS;QACpB,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,SAAS;QACR,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,KAAK,EAAE,WAAW,IAAG,CAAC;CACtC;AA1BD,oCA0BC;AACD,YAAY,CAAC,SAAS,CAAC,OAAO,GAAG,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview This file contains the implementation of the NodeProperty class\n */\nconst { ContainerProperty } = require(\"./containerProperty\");\n\n/**\n * A property object that allows to add child properties dynamically.\n */\nexport class NodeProperty extends ContainerProperty {\n\t/**\n\t * @param {Object} in_params - Input parameters for property creation\n\t *\n\t * @constructor\n\t * @protected\n\t * @extends property-properties.ContainerProperty\n\t * @alias property-properties.NodeProperty\n\t * @category Other Collections\n\t */\n\tconstructor(in_params) {\n\t\tsuper(in_params);\n\t\tthis._dynamicChildren = {};\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\tisDynamic() {\n\t\treturn true;\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\t_validateInsert(in_id, in_property) {}\n}\nNodeProperty.prototype._typeid = \"NodeProperty\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitiveTypeCasts.d.ts","sourceRoot":"","sources":["../../src/properties/primitiveTypeCasts.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"primitiveTypeCasts.d.ts","sourceRoot":"","sources":["../../src/properties/primitiveTypeCasts.js"],"names":[],"mappings":";IAkDS,6DAWP;;;;IA8BM,4DAWN;;;;;;IA0CO,0CAEP;IAOQ,6CAER"}
|
|
@@ -8,9 +8,9 @@ exports._castFunctors = void 0;
|
|
|
8
8
|
/**
|
|
9
9
|
* @fileoverview Helper functions to cast a JavaScript type to a value that is compatible with a given primitive type
|
|
10
10
|
*/
|
|
11
|
-
const _ = require(
|
|
12
|
-
const { MSG } = require(
|
|
13
|
-
const { Int64, Uint64 } = require(
|
|
11
|
+
const _ = require("lodash");
|
|
12
|
+
const { MSG } = require("@fluid-experimental/property-common").constants;
|
|
13
|
+
const { Int64, Uint64 } = require("@fluid-experimental/property-common");
|
|
14
14
|
var castArrays = {
|
|
15
15
|
Uint32: new Uint32Array(1),
|
|
16
16
|
Uint16: new Uint16Array(1),
|
|
@@ -52,13 +52,13 @@ const _castFunctors = {
|
|
|
52
52
|
if (in_value instanceof Uint64) {
|
|
53
53
|
return in_value;
|
|
54
54
|
}
|
|
55
|
-
if (typeof in_value ===
|
|
55
|
+
if (typeof in_value === "string") {
|
|
56
56
|
return Uint64.fromString(in_value, in_radix);
|
|
57
57
|
}
|
|
58
|
-
if (typeof in_value ===
|
|
58
|
+
if (typeof in_value === "number") {
|
|
59
59
|
return Uint64.fromString(String(in_value), in_radix);
|
|
60
60
|
}
|
|
61
|
-
throw new Error(MSG.INT_64_NON_INT64_TYPE +
|
|
61
|
+
throw new Error(MSG.INT_64_NON_INT64_TYPE + " , value: " + in_value);
|
|
62
62
|
},
|
|
63
63
|
/**
|
|
64
64
|
* Casts the input value to a Uint32
|
|
@@ -93,13 +93,13 @@ const _castFunctors = {
|
|
|
93
93
|
if (in_value instanceof Int64) {
|
|
94
94
|
return in_value;
|
|
95
95
|
}
|
|
96
|
-
if (typeof in_value ===
|
|
96
|
+
if (typeof in_value === "string") {
|
|
97
97
|
return Int64.fromString(in_value, in_radix);
|
|
98
98
|
}
|
|
99
|
-
if (typeof in_value ===
|
|
99
|
+
if (typeof in_value === "number") {
|
|
100
100
|
return Int64.fromString(String(in_value), in_radix);
|
|
101
101
|
}
|
|
102
|
-
throw new Error(MSG.INT_64_NON_INT64_TYPE +
|
|
102
|
+
throw new Error(MSG.INT_64_NON_INT64_TYPE + " , value: " + in_value);
|
|
103
103
|
},
|
|
104
104
|
/**
|
|
105
105
|
* Casts the input value to a Int32
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitiveTypeCasts.js","sourceRoot":"","sources":["../../src/properties/primitiveTypeCasts.js"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH;;GAEG;AACH,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AAEzE,IAAI,UAAU,GAAG;
|
|
1
|
+
{"version":3,"file":"primitiveTypeCasts.js","sourceR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AS,EAAE,UAAU,CAAC,IAAI,CAAC;IACzD;;;;;OAKG;IACH,OAAO,EAAE,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC;IAC/D;;;;;OAKG;IACH,OAAO,EAAE,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC;IAC/D;;;;;OAKG;IACH,MAAM,EAAE,UAAU,QAAQ;QACzB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IACD;;;;;OAKG;IACH,OAAO,EAAE,UAAU,QAAQ;QAC1B,OAAO,CAAC,CAAC,QAAQ,CAAC;IACnB,CAAC;CACD,CAAC;AAEO,sCAAa","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper functions to cast a JavaScript type to a value that is compatible with a given primitive type\n */\nconst _ = require(\"lodash\");\nconst { MSG } = require(\"@fluid-experimental/property-common\").constants;\nconst { Int64, Uint64 } = require(\"@fluid-experimental/property-common\");\n\nvar castArrays = {\n\tUint32: new Uint32Array(1),\n\tUint16: new Uint16Array(1),\n\tUint8: new Uint8Array(1),\n\tInt32: new Int32Array(1),\n\tInt16: new Int16Array(1),\n\tInt8: new Int8Array(1),\n\tFloat32: new Float32Array(1),\n\tFloat64: new Float64Array(1),\n};\n\n/**\n * Performs a cast of a value by assigning it into the given data array and returning the resulting value. The\n * result is a native JavaScript datatype, that is compatible with the supplied typed array.\n *\n * @param {TypedArray} in_array - The data array to use for the cast\n * @param {number|string|boolean} in_value - The value to use in the cast\n * @return {number|string|boolean} The casted value\n * @private\n */\nvar _simpleCastFunctor = function (in_array, in_value) {\n\tin_array[0] = in_value;\n\treturn in_array[0];\n};\n\n/**\n * Helper functions to cast the input value to the given type\n * @protected\n * @alias property-properties._castFunctors\n */\nconst _castFunctors = {\n\t/**\n\t * Casts the input value to a Uint64\n\t * @param {number} in_value - The value to use in the cast\n\t * @param {number} [in_radix = 10] - An integer between 2 and 36 that represents the\n\t * radix (the base in mathematical numeral systems) of the above in_value if it is a string.\n\t * @return {number} The casted value\n\t * @protected\n\t */\n\tUint64: function (in_value, in_radix) {\n\t\tif (in_value instanceof Uint64) {\n\t\t\treturn in_value;\n\t\t}\n\t\tif (typeof in_value === \"string\") {\n\t\t\treturn Uint64.fromString(in_value, in_radix);\n\t\t}\n\t\tif (typeof in_value === \"number\") {\n\t\t\treturn Uint64.fromString(String(in_value), in_radix);\n\t\t}\n\t\tthrow new Error(MSG.INT_64_NON_INT64_TYPE + \" , value: \" + in_value);\n\t},\n\t/**\n\t * Casts the input value to a Uint32\n\t * @param {number} in_value - The value to use in the cast\n\t * @return {number} The casted value\n\t * @protected\n\t */\n\tUint32: _simpleCastFunctor.bind(undefined, castArrays.Uint32),\n\t/**\n\t * Casts the input value to a Uint16\n\t * @param {number} in_value - The value to use in the cast\n\t * @return {number} The casted value\n\t * @protected\n\t */\n\tUint16: _simpleCastFunctor.bind(undefined, castArrays.Uint16),\n\t/**\n\t * Casts the input value to a Uint8\n\t * @param {number} in_value - The value to use in the cast\n\t * @return {number} The casted value\n\t * @protected\n\t */\n\tUint8: _simpleCastFunctor.bind(undefined, castArrays.Uint8),\n\t/**\n\t * Casts the input value to a Int64\n\t * @param {number} in_value - The value to use in the cast\n\t * @param {number} [in_radix = 10] - An integer between 2 and 36 that represents the\n\t * radix (the base in mathematical numeral systems) of the above in_value if it is a string.\n\t * @return {number} The casted value\n\t * @protected\n\t */\n\tInt64: function (in_value, in_radix) {\n\t\tif (in_value instanceof Int64) {\n\t\t\treturn in_value;\n\t\t}\n\t\tif (typeof in_value === \"string\") {\n\t\t\treturn Int64.fromString(in_value, in_radix);\n\t\t}\n\t\tif (typeof in_value === \"number\") {\n\t\t\treturn Int64.fromString(String(in_value), in_radix);\n\t\t}\n\t\tthrow new Error(MSG.INT_64_NON_INT64_TYPE + \" , value: \" + in_value);\n\t},\n\t/**\n\t * Casts the input value to a Int32\n\t * @param {number} in_value - The value to use in the cast\n\t * @return {number} The casted value\n\t * @protected\n\t */\n\tInt32: _simpleCastFunctor.bind(undefined, castArrays.Int32),\n\t/**\n\t * Casts the input value to a Int16\n\t * @param {number} in_value - The value to use in the cast\n\t * @return {number} The casted value\n\t * @protected\n\t */\n\tInt16: _simpleCastFunctor.bind(undefined, castArrays.Int16),\n\t/**\n\t * Casts the input value to a Int8\n\t * @param {number} in_value - The value to use in the cast\n\t * @return {number} The casted value\n\t * @protected\n\t */\n\tInt8: _simpleCastFunctor.bind(undefined, castArrays.Int8),\n\t/**\n\t * Casts the input value to a Float32\n\t * @param {number} in_value - The value to use in the cast\n\t * @return {number} The casted value\n\t * @protected\n\t */\n\tFloat32: _simpleCastFunctor.bind(undefined, castArrays.Float32),\n\t/**\n\t * Casts the input value to a Float64\n\t * @param {number} in_value - The value to use in the cast\n\t * @return {number} The casted value\n\t * @protected\n\t */\n\tFloat64: _simpleCastFunctor.bind(undefined, castArrays.Float64),\n\t/**\n\t * Casts the input value to a String\n\t * @param {number} in_value - The value to use in the cast\n\t * @return {number} The casted value\n\t * @protected\n\t */\n\tString: function (in_value) {\n\t\treturn String(in_value);\n\t},\n\t/**\n\t * Casts the input value to a Boolean value\n\t * @param {boolean} in_value - The value to use in the cast\n\t * @return {boolean} The casted value\n\t * @protected\n\t */\n\tBoolean: function (in_value) {\n\t\treturn !!in_value;\n\t},\n};\n\nexport { _castFunctors };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"referenceArrayProperty.d.ts","sourceRoot":"","sources":["../../src/properties/referenceArrayProperty.js"],"names":[],"mappings":"AAgBA;;GAEG;AACH;
|
|
1
|
+
{"version":3,"file":"referenceArrayProperty.d.ts","sourceRoot":"","sources":["../../src/properties/referenceArrayProperty.js"],"names":[],"mappings":"AAgBA;;GAEG;AACH;IA+NC;;;;;;;;;;;OAWG;IACH,uEAJa,MAAM,MAAM,CAAC,CAcxB;IAvOF;;;;;;;OAOG;IACH,4BAFa,MAAM,CAIlB;IAoCD;;;;;;OAMG;IACH,8BAHW,MAAM,GACJ,OAAO,CAOnB;CA8KD"}
|
|
@@ -8,14 +8,14 @@ exports.ReferenceArrayProperty = void 0;
|
|
|
8
8
|
/**
|
|
9
9
|
* @fileoverview Definition of the reference array property class
|
|
10
10
|
*/
|
|
11
|
-
const { PathHelper, TypeIdHelper } = require(
|
|
12
|
-
const { MSG } = require(
|
|
13
|
-
const { UniversalDataArray, ConsoleUtils } = require(
|
|
14
|
-
const _ = require(
|
|
15
|
-
const { AbstractStaticCollectionProperty } = require(
|
|
16
|
-
const { BaseProperty } = require(
|
|
17
|
-
const { ReferenceProperty } = require(
|
|
18
|
-
const { ValueArrayProperty } = require(
|
|
11
|
+
const { 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 _ = require("lodash");
|
|
15
|
+
const { AbstractStaticCollectionProperty } = require("./abstractStaticCollectionProperty");
|
|
16
|
+
const { BaseProperty } = require("./baseProperty");
|
|
17
|
+
const { ReferenceProperty } = require("./referenceProperty");
|
|
18
|
+
const { ValueArrayProperty } = require("./valueArrayProperty");
|
|
19
19
|
/**
|
|
20
20
|
* An ArrayProperty which stores reference values
|
|
21
21
|
*/
|
|
@@ -60,16 +60,16 @@ class ReferenceArrayProperty extends ValueArrayProperty {
|
|
|
60
60
|
get(in_ids, in_options) {
|
|
61
61
|
in_options = in_options || {};
|
|
62
62
|
in_options.referenceResolutionMode =
|
|
63
|
-
in_options.referenceResolutionMode === undefined
|
|
64
|
-
|
|
63
|
+
in_options.referenceResolutionMode === undefined
|
|
64
|
+
? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
|
|
65
|
+
: in_options.referenceResolutionMode;
|
|
65
66
|
if (_.isArray(in_ids)) {
|
|
66
67
|
// Forward handling of arrays to the AbstractStaticCollectionProperty function
|
|
67
68
|
return AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);
|
|
68
69
|
}
|
|
69
70
|
else {
|
|
70
71
|
var value = this._dataArrayRef.getValue(in_ids);
|
|
71
|
-
if (value === undefined ||
|
|
72
|
-
value === '') {
|
|
72
|
+
if (value === undefined || value === "") {
|
|
73
73
|
return undefined;
|
|
74
74
|
}
|
|
75
75
|
return this.getParent().resolvePath(value, in_options);
|
|
@@ -83,8 +83,8 @@ class ReferenceArrayProperty extends ValueArrayProperty {
|
|
|
83
83
|
* @returns {boolean} True if the reference is valid, otherwise false.
|
|
84
84
|
*/
|
|
85
85
|
isReferenceValid(in_position) {
|
|
86
|
-
return ValueArrayProperty.prototype.get.call(this, in_position) ===
|
|
87
|
-
this.get(in_position) !== undefined;
|
|
86
|
+
return (ValueArrayProperty.prototype.get.call(this, in_position) === "" ||
|
|
87
|
+
this.get(in_position) !== undefined);
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
90
|
* Sets the range in the array to point to the given property objects or to be equal to the given paths
|
|
@@ -98,7 +98,7 @@ class ReferenceArrayProperty extends ValueArrayProperty {
|
|
|
98
98
|
* @throws If one of the items in in_array is defined, but is not a property or a string.
|
|
99
99
|
*/
|
|
100
100
|
setRange(in_offset, in_array) {
|
|
101
|
-
var arr = ReferenceArrayProperty._convertInputToPaths(in_array,
|
|
101
|
+
var arr = ReferenceArrayProperty._convertInputToPaths(in_array, "setRange");
|
|
102
102
|
ValueArrayProperty.prototype.setRange.call(this, in_offset, arr);
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
@@ -113,7 +113,7 @@ class ReferenceArrayProperty extends ValueArrayProperty {
|
|
|
113
113
|
* @throws If one of the items in in_array is defined, but is not a property or a string.
|
|
114
114
|
*/
|
|
115
115
|
insertRange(in_offset, in_array) {
|
|
116
|
-
var arr = ReferenceArrayProperty._convertInputToPaths(in_array,
|
|
116
|
+
var arr = ReferenceArrayProperty._convertInputToPaths(in_array, "insertRange");
|
|
117
117
|
ValueArrayProperty.prototype.insertRange.call(this, in_offset, arr);
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
@@ -176,9 +176,13 @@ class ReferenceArrayProperty extends ValueArrayProperty {
|
|
|
176
176
|
* @returns {Array<String>} an array containing the values removed (string paths)
|
|
177
177
|
*/
|
|
178
178
|
removeRange(in_offset, in_deleteCount) {
|
|
179
|
-
ConsoleUtils.assert(_.isNumber(in_offset), MSG.NOT_NUMBER +
|
|
180
|
-
ConsoleUtils.assert(_.isNumber(in_deleteCount), MSG.NOT_NUMBER +
|
|
181
|
-
ConsoleUtils.assert(in_offset + in_deleteCount < this.length + 1 && in_offset >= 0 && in_deleteCount > 0, MSG.REMOVE_OUT_OF_BOUNDS +
|
|
179
|
+
ConsoleUtils.assert(_.isNumber(in_offset), MSG.NOT_NUMBER + "in_offset, method: ArrayProperty.removeRange or .remove");
|
|
180
|
+
ConsoleUtils.assert(_.isNumber(in_deleteCount), MSG.NOT_NUMBER + "in_deleteCount, method: ArrayProperty.removeRange or .remove");
|
|
181
|
+
ConsoleUtils.assert(in_offset + in_deleteCount < this.length + 1 && in_offset >= 0 && in_deleteCount > 0, MSG.REMOVE_OUT_OF_BOUNDS +
|
|
182
|
+
"Cannot remove " +
|
|
183
|
+
in_deleteCount +
|
|
184
|
+
" items starting at index " +
|
|
185
|
+
in_offset);
|
|
182
186
|
var result = [];
|
|
183
187
|
for (var i = in_offset; i < in_offset + in_deleteCount; i++) {
|
|
184
188
|
result.push(this.getValue(i));
|
|
@@ -194,9 +198,11 @@ class ReferenceArrayProperty extends ValueArrayProperty {
|
|
|
194
198
|
_resolvePathSegment(in_segment, in_segmentType) {
|
|
195
199
|
// Array tokens are automatically resolved
|
|
196
200
|
return in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN
|
|
197
|
-
? this.get(in_segment, {
|
|
198
|
-
|
|
199
|
-
|
|
201
|
+
? this.get(in_segment, {
|
|
202
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
203
|
+
})
|
|
204
|
+
: // Everything else is handled by the implementation in the base property
|
|
205
|
+
AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);
|
|
200
206
|
}
|
|
201
207
|
/**
|
|
202
208
|
* Creates and initializes the data array
|
|
@@ -205,7 +211,7 @@ class ReferenceArrayProperty extends ValueArrayProperty {
|
|
|
205
211
|
_dataArrayCreate(in_length) {
|
|
206
212
|
this._dataArrayRef = new UniversalDataArray(in_length);
|
|
207
213
|
for (var i = 0; i < in_length; i++) {
|
|
208
|
-
this._dataArraySetValue(i,
|
|
214
|
+
this._dataArraySetValue(i, "");
|
|
209
215
|
}
|
|
210
216
|
}
|
|
211
217
|
}
|
|
@@ -224,7 +230,7 @@ exports.ReferenceArrayProperty = ReferenceArrayProperty;
|
|
|
224
230
|
*/
|
|
225
231
|
ReferenceArrayProperty._convertInputToPaths = function (in_array, in_callerName) {
|
|
226
232
|
if (!_.isArray(in_array)) {
|
|
227
|
-
throw new TypeError(MSG.IN_ARRAY_NOT_ARRAY +
|
|
233
|
+
throw new TypeError(MSG.IN_ARRAY_NOT_ARRAY + "ReferenceArrayProperty." + in_callerName);
|
|
228
234
|
}
|
|
229
235
|
var len = in_array.length;
|
|
230
236
|
var arr = new Array(len);
|
|
@@ -233,5 +239,5 @@ ReferenceArrayProperty._convertInputToPaths = function (in_array, in_callerName)
|
|
|
233
239
|
}
|
|
234
240
|
return arr;
|
|
235
241
|
};
|
|
236
|
-
ReferenceArrayProperty.prototype._typeid =
|
|
242
|
+
ReferenceArrayProperty.prototype._typeid = "Reference";
|
|
237
243
|
//# sourceMappingURL=referenceArrayProperty.js.map
|