@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerSerializer.d.ts","sourceRoot":"","sources":["../src/containerSerializer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"containerSerializer.d.ts","sourceRoot":"","sources":["../src/containerSerializer.js"],"names":[],"mappings":"AA4DA;;;;;;GAMG;AACH,oCALW,mBAAmB,uBAElB,EAAE,CAmBb;AAED;;;;;;;;GAQG;AACH,qCAPW,EAAE,YACF,MAAM,GAAC,SAAS,6BAGf,EAAE,CAkFb;AACD;;;;;;GAMG;AACH,oFAJW,MAAM,GAAC,SAAS,uBAqC1B"}
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @namespace property-properties
|
|
7
7
|
*/
|
|
8
|
-
const { PathHelper } = require(
|
|
9
|
-
const { LazyLoadedProperties: Property } = require(
|
|
10
|
-
const { AbstractStaticCollectionProperty } = require(
|
|
8
|
+
const { PathHelper } = require("@fluid-experimental/property-changeset");
|
|
9
|
+
const { LazyLoadedProperties: Property } = require("./properties/lazyLoadedProperties");
|
|
10
|
+
const { AbstractStaticCollectionProperty, } = require("./properties/abstractStaticCollectionProperty");
|
|
11
11
|
var MSG = {
|
|
12
|
-
NOTHING_TO_DESERIALIZE:
|
|
12
|
+
NOTHING_TO_DESERIALIZE: "Repository deserialize(), no input given",
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Dummy property used to return the scope to the underlying properties
|
|
@@ -152,7 +152,7 @@ export function deserializeNonPrimitiveArrayElements(in_data, in_scope) {
|
|
|
152
152
|
var insertedPropertyInstances = [];
|
|
153
153
|
for (var i = 0; i < in_data.length; ++i) {
|
|
154
154
|
// reconstruct entity
|
|
155
|
-
var createdProperty = Property.PropertyFactory._createProperty(in_data[i][
|
|
155
|
+
var createdProperty = Property.PropertyFactory._createProperty(in_data[i]["typeid"], null, undefined, in_scope);
|
|
156
156
|
var id = createdProperty.getId();
|
|
157
157
|
// Create a scope property which captures the scope that was passed in as argument
|
|
158
158
|
// so that it can be picked up downstream by the respective deserialize functions
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerSerializer.js","sourceRoot":"","sources":["../src/containerSerializer.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,MAAM,EAAE,UAAU,EAAE,GAAG,OA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,CAAC;YAE/B,2CAA2C;YAC3C,sBAAsB,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC;SACtD;KACJ;IAED,OAAO,sBAAsB,CAAC;AAClC,CAAC;AACD;;;;;;GAMG;AACH,MAAM,UAAU,oCAAoC,CAAC,OAAO,EAAE,QAAQ;IAClE,IAAI,CAAC,OAAO,EAAE;QACV,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QACzC,OAAO,EAAE,CAAC;KACb;IAED,IAAI,yBAAyB,GAAG,EAAE,CAAC;IACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QACrC,qBAAqB;QACrB,IAAI,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC,eAAe,CAC1D,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QAErD,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,EAAE,CAAC;QAEjC,kFAAkF;QAClF,iFAAiF;QACjF,IAAI,aAAa,GAAG,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAE3D,aAAa,CAAC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QAE9C,eAAe,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAElE,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAE1B,2CAA2C;QAC3C,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;KACnD;IAED,OAAO,yBAAyB,CAAC;AACrC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @namespace property-properties\n */\n\nconst { PathHelper } = require('@fluid-experimental/property-changeset');\nconst { LazyLoadedProperties: Property } = require('./properties/lazyLoadedProperties');\nconst { AbstractStaticCollectionProperty } = require('./properties/abstractStaticCollectionProperty');\n\nvar MSG = {\n NOTHING_TO_DESERIALIZE: 'Repository deserialize(), no input given',\n};\n\n/**\n * Dummy property used to return the scope to the underlying properties\n */\nclass ScopeProperty extends AbstractStaticCollectionProperty {\n /**\n * @param {object} in_params - BaseProperty parameters\n * @param {string} in_params.scope - The scope to keep track of\n * @constructor\n */\n constructor(in_params) {\n // HACK: Normally, we would inherit from NodeProperty however, NodeProperty seems to not be available\n // at this point. There may be a bug with MR.\n super(in_params);\n this._scope = in_params.scope;\n }\n\n /**\n * @override\n */\n _getScope() {\n return this._scope;\n }\n\n /**\n * Remove a child property\n * This is an internal function, called internally by NodeProperty. Removing children dynamically by the user is\n * only allowed in the NodeProperty.\n *\n * @param {String} in_id - the id of the property to remove\n * @protected\n */\n _remove(in_id) {\n if (this._staticChildren[in_id] !== undefined) {\n this._staticChildren[in_id]._setParent(undefined);\n delete this._staticChildren[in_id];\n } else {\n throw new Error(MSG.REMOVING_NON_EXISTING_ID + in_id);\n }\n }\n}\n\n/**\n * Serialize the input document.\n * @param {Array<BaseProperty>} in_psets - Property set\n * @param {bool} in_dirtyOnly - Serialize dirty properties only\n * @return {{}} JSON data of the document\n * @alias property-properties.serialize\n */\nexport function serialize(in_psets, in_dirtyOnly) {\n in_dirtyOnly = in_dirtyOnly || false;\n\n var documentData = {};\n var rootTypeid;\n\n var keys = Object.keys(in_psets);\n for (var i = 0; i < keys.length; i++) {\n rootTypeid = in_psets[keys[i]].getTypeid();\n if (!documentData[rootTypeid]) {\n documentData[rootTypeid] = {};\n }\n documentData[rootTypeid][keys[i]] = in_psets[keys[i]].serialize(in_dirtyOnly);\n }\n\n return documentData;\n}\n\n/**\n * Deserialize the input document\n * @param {{}} in_data - The input JSON document data\n * @param {string|undefined} in_scope - The scope to construct the properties from\n * @param {property-properties.BaseProperty.PathFilteringOptions} [in_filteringOptions] - The options to selectively\n * create only a subset of a property. Creates all properties if undefined.\n * @return {{}} an object of guid : pset\n * @alias property-properties.deserialize\n */\nexport function deserialize(in_data, in_scope, in_filteringOptions) {\n if (!in_data) {\n console.warn(MSG.NOTHING_TO_DESERIALIZE);\n return {};\n }\n\n // From the given filtering options, keep only what is relevant for this property.\n let baseFilteringOptions;\n if (in_filteringOptions) {\n let pathCoverage = PathHelper.getPathCoverage(in_filteringOptions.basePath, in_filteringOptions.paths);\n switch (pathCoverage.coverageExtent) {\n case PathHelper.CoverageExtent.FULLY_COVERED:\n // No need for filtering options anymore, keep them undefined.\n break;\n case PathHelper.CoverageExtent.PARTLY_COVERED:\n baseFilteringOptions = {\n basePath: in_filteringOptions.basePath,\n paths: pathCoverage.pathList,\n };\n break;\n case PathHelper.CoverageExtent.UNCOVERED:\n // No need to create anything, it is outside the paths.\n return {};\n default:\n break;\n }\n }\n\n var deserializedProperties = {};\n var typeid, entity, classed;\n\n var dataKeys = Object.keys(in_data);\n for (var iData = 0; iData < dataKeys.length; iData++) {\n typeid = dataKeys[iData];\n classed = in_data[typeid];\n var classKeys = Object.keys(classed);\n for (var iClass = 0; iClass < classKeys.length; iClass++) {\n // reconstruct entity\n let filteringOptions = baseFilteringOptions && {\n basePath: PathHelper.getChildAbsolutePathCanonical(baseFilteringOptions.basePath, classKeys[iClass]),\n paths: baseFilteringOptions.paths,\n };\n // TODO: In theory this could throw when the entity can not be created because it is not included\n // in the paths. Make sure to handle this case when we'll add that validation.\n entity = Property.PropertyFactory._createProperty(typeid, null, undefined, in_scope, filteringOptions);\n\n // Store the id prior to calling entity.deserialize() since it is subject to change afterwards\n var id = entity.getId();\n\n // Create a scope property which captures the scope that was passed in as arguments\n // so that it can be picked up downstream by the respective deserialize functions\n var scopeProperty = new ScopeProperty({ scope: in_scope });\n\n scopeProperty._append(entity, false);\n\n entity.deserialize(classed[classKeys[iClass]], filteringOptions, false);\n\n scopeProperty._remove(id);\n\n entity._id = classKeys[iClass];\n\n // keep track of the reconstructed entities\n deserializedProperties[classKeys[iClass]] = entity;\n }\n }\n\n return deserializedProperties;\n}\n/**\n * Deserialize the input document assuming it contains elements of a non-primitive array.\n * @param {array<object>} in_data - The input JSON document data\n * @param {string|undefined} in_scope - The scope to construct the properties from\n * @return {array<BaseProperty>} An array of psets\n * @alias property-properties.deserializeNonPrimitiveArrayElements\n */\nexport function deserializeNonPrimitiveArrayElements(in_data, in_scope) {\n if (!in_data) {\n console.warn(MSG.NOTHING_TO_DESERIALIZE);\n return [];\n }\n\n var insertedPropertyInstances = [];\n for (var i = 0; i < in_data.length; ++i) {\n // reconstruct entity\n var createdProperty = Property.PropertyFactory._createProperty(\n in_data[i]['typeid'], null, undefined, in_scope);\n\n var id = createdProperty.getId();\n\n // Create a scope property which captures the scope that was passed in as argument\n // so that it can be picked up downstream by the respective deserialize functions\n var scopeProperty = new ScopeProperty({ scope: in_scope });\n\n scopeProperty._append(createdProperty, false);\n\n createdProperty._deserialize(in_data[i], false, undefined, false);\n\n scopeProperty._remove(id);\n\n // keep track of the reconstructed entities\n insertedPropertyInstances.push(createdProperty);\n }\n\n return insertedPropertyInstances;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"containerSerializer.js","sourceRoot":"","sources":["../src/containerSerializer.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACzE,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AACxF,MAAM,EACL,gCAAgC,GAChC,GAAG,OAAO,CAAC,+CAA+C,CAAC,CAAC;AAE7D,IAAI,GAAG,GAAG;IACT,sBAAsB,EAAE,0CAA0C;CAClE,CAAC;AAEF;;GAEG;AACH,MAAM,aAAc,SAAQ,gCAAgC;IAC3D;;;;OAIG;IACH,YAAY,SAAS;QACpB,qGAAqG;QACrG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,GAAG,EAAE,CAAC;IACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QACxC,qBAAqB;QACrB,IAAI,eAAe,GAAG,QAAQ,CAAC,eAAe,CAAC,eAAe,CAC7D,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EACpB,IAAI,EACJ,SAAS,EACT,QAAQ,CACR,CAAC;QAEF,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,EAAE,CAAC;QAEjC,kFAAkF;QAClF,iFAAiF;QACjF,IAAI,aAAa,GAAG,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QAE3D,aAAa,CAAC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QAE9C,eAAe,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAElE,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAE1B,2CAA2C;QAC3C,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;KAChD;IAED,OAAO,yBAAyB,CAAC;AAClC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @namespace property-properties\n */\n\nconst { PathHelper } = require(\"@fluid-experimental/property-changeset\");\nconst { LazyLoadedProperties: Property } = require(\"./properties/lazyLoadedProperties\");\nconst {\n\tAbstractStaticCollectionProperty,\n} = require(\"./properties/abstractStaticCollectionProperty\");\n\nvar MSG = {\n\tNOTHING_TO_DESERIALIZE: \"Repository deserialize(), no input given\",\n};\n\n/**\n * Dummy property used to return the scope to the underlying properties\n */\nclass ScopeProperty extends AbstractStaticCollectionProperty {\n\t/**\n\t * @param {object} in_params - BaseProperty parameters\n\t * @param {string} in_params.scope - The scope to keep track of\n\t * @constructor\n\t */\n\tconstructor(in_params) {\n\t\t// HACK: Normally, we would inherit from NodeProperty however, NodeProperty seems to not be available\n\t\t// at this point. There may be a bug with MR.\n\t\tsuper(in_params);\n\t\tthis._scope = in_params.scope;\n\t}\n\n\t/**\n\t * @override\n\t */\n\t_getScope() {\n\t\treturn this._scope;\n\t}\n\n\t/**\n\t * Remove a child property\n\t * This is an internal function, called internally by NodeProperty. Removing children dynamically by the user is\n\t * only allowed in the NodeProperty.\n\t *\n\t * @param {String} in_id - the id of the property to remove\n\t * @protected\n\t */\n\t_remove(in_id) {\n\t\tif (this._staticChildren[in_id] !== undefined) {\n\t\t\tthis._staticChildren[in_id]._setParent(undefined);\n\t\t\tdelete this._staticChildren[in_id];\n\t\t} else {\n\t\t\tthrow new Error(MSG.REMOVING_NON_EXISTING_ID + in_id);\n\t\t}\n\t}\n}\n\n/**\n * Serialize the input document.\n * @param {Array<BaseProperty>} in_psets - Property set\n * @param {bool} in_dirtyOnly - Serialize dirty properties only\n * @return {{}} JSON data of the document\n * @alias property-properties.serialize\n */\nexport function serialize(in_psets, in_dirtyOnly) {\n\tin_dirtyOnly = in_dirtyOnly || false;\n\n\tvar documentData = {};\n\tvar rootTypeid;\n\n\tvar keys = Object.keys(in_psets);\n\tfor (var i = 0; i < keys.length; i++) {\n\t\trootTypeid = in_psets[keys[i]].getTypeid();\n\t\tif (!documentData[rootTypeid]) {\n\t\t\tdocumentData[rootTypeid] = {};\n\t\t}\n\t\tdocumentData[rootTypeid][keys[i]] = in_psets[keys[i]].serialize(in_dirtyOnly);\n\t}\n\n\treturn documentData;\n}\n\n/**\n * Deserialize the input document\n * @param {{}} in_data - The input JSON document data\n * @param {string|undefined} in_scope - The scope to construct the properties from\n * @param {property-properties.BaseProperty.PathFilteringOptions} [in_filteringOptions] - The options to selectively\n * create only a subset of a property. Creates all properties if undefined.\n * @return {{}} an object of guid : pset\n * @alias property-properties.deserialize\n */\nexport function deserialize(in_data, in_scope, in_filteringOptions) {\n\tif (!in_data) {\n\t\tconsole.warn(MSG.NOTHING_TO_DESERIALIZE);\n\t\treturn {};\n\t}\n\n\t// From the given filtering options, keep only what is relevant for this property.\n\tlet baseFilteringOptions;\n\tif (in_filteringOptions) {\n\t\tlet pathCoverage = PathHelper.getPathCoverage(\n\t\t\tin_filteringOptions.basePath,\n\t\t\tin_filteringOptions.paths,\n\t\t);\n\t\tswitch (pathCoverage.coverageExtent) {\n\t\t\tcase PathHelper.CoverageExtent.FULLY_COVERED:\n\t\t\t\t// No need for filtering options anymore, keep them undefined.\n\t\t\t\tbreak;\n\t\t\tcase PathHelper.CoverageExtent.PARTLY_COVERED:\n\t\t\t\tbaseFilteringOptions = {\n\t\t\t\t\tbasePath: in_filteringOptions.basePath,\n\t\t\t\t\tpaths: pathCoverage.pathList,\n\t\t\t\t};\n\t\t\t\tbreak;\n\t\t\tcase PathHelper.CoverageExtent.UNCOVERED:\n\t\t\t\t// No need to create anything, it is outside the paths.\n\t\t\t\treturn {};\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tvar deserializedProperties = {};\n\tvar typeid, entity, classed;\n\n\tvar dataKeys = Object.keys(in_data);\n\tfor (var iData = 0; iData < dataKeys.length; iData++) {\n\t\ttypeid = dataKeys[iData];\n\t\tclassed = in_data[typeid];\n\t\tvar classKeys = Object.keys(classed);\n\t\tfor (var iClass = 0; iClass < classKeys.length; iClass++) {\n\t\t\t// reconstruct entity\n\t\t\tlet filteringOptions = baseFilteringOptions && {\n\t\t\t\tbasePath: PathHelper.getChildAbsolutePathCanonical(\n\t\t\t\t\tbaseFilteringOptions.basePath,\n\t\t\t\t\tclassKeys[iClass],\n\t\t\t\t),\n\t\t\t\tpaths: baseFilteringOptions.paths,\n\t\t\t};\n\t\t\t// TODO: In theory this could throw when the entity can not be created because it is not included\n\t\t\t// in the paths. Make sure to handle this case when we'll add that validation.\n\t\t\tentity = Property.PropertyFactory._createProperty(\n\t\t\t\ttypeid,\n\t\t\t\tnull,\n\t\t\t\tundefined,\n\t\t\t\tin_scope,\n\t\t\t\tfilteringOptions,\n\t\t\t);\n\n\t\t\t// Store the id prior to calling entity.deserialize() since it is subject to change afterwards\n\t\t\tvar id = entity.getId();\n\n\t\t\t// Create a scope property which captures the scope that was passed in as arguments\n\t\t\t// so that it can be picked up downstream by the respective deserialize functions\n\t\t\tvar scopeProperty = new ScopeProperty({ scope: in_scope });\n\n\t\t\tscopeProperty._append(entity, false);\n\n\t\t\tentity.deserialize(classed[classKeys[iClass]], filteringOptions, false);\n\n\t\t\tscopeProperty._remove(id);\n\n\t\t\tentity._id = classKeys[iClass];\n\n\t\t\t// keep track of the reconstructed entities\n\t\t\tdeserializedProperties[classKeys[iClass]] = entity;\n\t\t}\n\t}\n\n\treturn deserializedProperties;\n}\n/**\n * Deserialize the input document assuming it contains elements of a non-primitive array.\n * @param {array<object>} in_data - The input JSON document data\n * @param {string|undefined} in_scope - The scope to construct the properties from\n * @return {array<BaseProperty>} An array of psets\n * @alias property-properties.deserializeNonPrimitiveArrayElements\n */\nexport function deserializeNonPrimitiveArrayElements(in_data, in_scope) {\n\tif (!in_data) {\n\t\tconsole.warn(MSG.NOTHING_TO_DESERIALIZE);\n\t\treturn [];\n\t}\n\n\tvar insertedPropertyInstances = [];\n\tfor (var i = 0; i < in_data.length; ++i) {\n\t\t// reconstruct entity\n\t\tvar createdProperty = Property.PropertyFactory._createProperty(\n\t\t\tin_data[i][\"typeid\"],\n\t\t\tnull,\n\t\t\tundefined,\n\t\t\tin_scope,\n\t\t);\n\n\t\tvar id = createdProperty.getId();\n\n\t\t// Create a scope property which captures the scope that was passed in as argument\n\t\t// so that it can be picked up downstream by the respective deserialize functions\n\t\tvar scopeProperty = new ScopeProperty({ scope: in_scope });\n\n\t\tscopeProperty._append(createdProperty, false);\n\n\t\tcreatedProperty._deserialize(in_data[i], false, undefined, false);\n\n\t\tscopeProperty._remove(id);\n\n\t\t// keep track of the reconstructed entities\n\t\tinsertedPropertyInstances.push(createdProperty);\n\t}\n\n\treturn insertedPropertyInstances;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enableValidations.js","sourceRoot":"","sources":["../src/enableValidations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,IAAI,kBAAkB,GAAG;
|
|
1
|
+
{"version":3,"file":"enableValidations.js","sourceRoot":"","sources":["../src/enableValidations.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,IAAI,kBAAkB,GAAG;IAC/B,OAAO,EAAE,IAAI;CACb,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IACjD,kBAAkB,CAAC,OAAO,GAAG,OAAO,CAAC;AACtC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport let validationsEnabled = {\n\tenabled: true,\n};\n\n/**\n * Switch off validation to increase performance (but you risk modifying read only properties, creating cycles in\n * the tree, etc...)\n *\n * @param enabled - Are the validations enabled?\n */\nexport function enableValidations(enabled: boolean) {\n\tvalidationsEnabled.enabled = enabled;\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { PropertyFactory } from
|
|
6
|
-
import { PropertyUtils } from
|
|
7
|
-
import { BaseProperty } from
|
|
8
|
-
import { ContainerProperty } from
|
|
9
|
-
import { MapProperty } from
|
|
10
|
-
import { NodeProperty } from
|
|
11
|
-
import { ArrayProperty } from
|
|
12
|
-
import { SetProperty } from
|
|
13
|
-
import { StringProperty } from
|
|
14
|
-
import { ReferenceProperty } from
|
|
15
|
-
import { ReferenceArrayProperty } from
|
|
16
|
-
import { ReferenceMapProperty } from
|
|
17
|
-
import { EnumArrayProperty } from
|
|
18
|
-
import { EnumProperty } from
|
|
19
|
-
import { Int64Property, Uint64Property } from
|
|
20
|
-
import { ValueArrayProperty } from
|
|
21
|
-
import { ValueMapProperty } from
|
|
22
|
-
import { ValueProperty } from
|
|
23
|
-
import { enableValidations } from
|
|
5
|
+
import { PropertyFactory } from "./propertyFactory";
|
|
6
|
+
import { PropertyUtils } from "./propertyUtils";
|
|
7
|
+
import { BaseProperty } from "./properties/baseProperty";
|
|
8
|
+
import { ContainerProperty } from "./properties/containerProperty";
|
|
9
|
+
import { MapProperty } from "./properties/mapProperty";
|
|
10
|
+
import { NodeProperty } from "./properties/nodeProperty";
|
|
11
|
+
import { ArrayProperty } from "./properties/arrayProperty";
|
|
12
|
+
import { SetProperty } from "./properties/setProperty";
|
|
13
|
+
import { StringProperty } from "./properties/stringProperty";
|
|
14
|
+
import { ReferenceProperty } from "./properties/referenceProperty";
|
|
15
|
+
import { ReferenceArrayProperty } from "./properties/referenceArrayProperty";
|
|
16
|
+
import { ReferenceMapProperty } from "./properties/referenceMapProperty";
|
|
17
|
+
import { EnumArrayProperty } from "./properties/enumArrayProperty";
|
|
18
|
+
import { EnumProperty } from "./properties/enumProperty";
|
|
19
|
+
import { Int64Property, Uint64Property } from "./properties/intProperties";
|
|
20
|
+
import { ValueArrayProperty } from "./properties/valueArrayProperty";
|
|
21
|
+
import { ValueMapProperty } from "./properties/valueMapProperty";
|
|
22
|
+
import { ValueProperty } from "./properties/valueProperty";
|
|
23
|
+
import { enableValidations } from "./enableValidations";
|
|
24
24
|
export { PropertyFactory, PropertyUtils, BaseProperty, ContainerProperty, MapProperty, NodeProperty, ArrayProperty, SetProperty, StringProperty, ReferenceProperty, ReferenceMapProperty, ReferenceArrayProperty, Uint64Property, EnumArrayProperty, EnumProperty, Int64Property, ValueArrayProperty, ValueMapProperty, ValueProperty, enableValidations, };
|
|
25
25
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE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@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { PropertyFactory } from
|
|
6
|
-
import { PropertyUtils } from
|
|
7
|
-
import { BaseProperty } from
|
|
8
|
-
import { ContainerProperty } from
|
|
9
|
-
import { MapProperty } from
|
|
10
|
-
import { NodeProperty } from
|
|
11
|
-
import { ArrayProperty } from
|
|
12
|
-
import { SetProperty } from
|
|
13
|
-
import { StringProperty } from
|
|
14
|
-
import { ReferenceProperty } from
|
|
15
|
-
import { ReferenceArrayProperty } from
|
|
16
|
-
import { ReferenceMapProperty } from
|
|
17
|
-
import { EnumArrayProperty } from
|
|
18
|
-
import { EnumProperty } from
|
|
19
|
-
import { Int64Property, Uint64Property } from
|
|
20
|
-
import { ValueArrayProperty } from
|
|
21
|
-
import { ValueMapProperty } from
|
|
22
|
-
import { ValueProperty } from
|
|
23
|
-
import { enableValidations } from
|
|
5
|
+
import { PropertyFactory } from "./propertyFactory";
|
|
6
|
+
import { PropertyUtils } from "./propertyUtils";
|
|
7
|
+
import { BaseProperty } from "./properties/baseProperty";
|
|
8
|
+
import { ContainerProperty } from "./properties/containerProperty";
|
|
9
|
+
import { MapProperty } from "./properties/mapProperty";
|
|
10
|
+
import { NodeProperty } from "./properties/nodeProperty";
|
|
11
|
+
import { ArrayProperty } from "./properties/arrayProperty";
|
|
12
|
+
import { SetProperty } from "./properties/setProperty";
|
|
13
|
+
import { StringProperty } from "./properties/stringProperty";
|
|
14
|
+
import { ReferenceProperty } from "./properties/referenceProperty";
|
|
15
|
+
import { ReferenceArrayProperty } from "./properties/referenceArrayProperty";
|
|
16
|
+
import { ReferenceMapProperty } from "./properties/referenceMapProperty";
|
|
17
|
+
import { EnumArrayProperty } from "./properties/enumArrayProperty";
|
|
18
|
+
import { EnumProperty } from "./properties/enumProperty";
|
|
19
|
+
import { Int64Property, Uint64Property } from "./properties/intProperties";
|
|
20
|
+
import { ValueArrayProperty } from "./properties/valueArrayProperty";
|
|
21
|
+
import { ValueMapProperty } from "./properties/valueMapProperty";
|
|
22
|
+
import { ValueProperty } from "./properties/valueProperty";
|
|
23
|
+
import { enableValidations } from "./enableValidations";
|
|
24
24
|
export { PropertyFactory, PropertyUtils, BaseProperty, ContainerProperty, MapProperty, NodeProperty, ArrayProperty, SetProperty, StringProperty, ReferenceProperty, ReferenceMapProperty, ReferenceArrayProperty, Uint64Property, EnumArrayProperty, EnumProperty, Int64Property, ValueArrayProperty, ValueMapProperty, ValueProperty, enableValidations, };
|
|
25
25
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAA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BAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,GACjB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { PropertyFactory } from \"./propertyFactory\";\nimport { PropertyUtils } from \"./propertyUtils\";\nimport { BaseProperty } from \"./properties/baseProperty\";\nimport { ContainerProperty } from \"./properties/containerProperty\";\nimport { MapProperty } from \"./properties/mapProperty\";\nimport { NodeProperty } from \"./properties/nodeProperty\";\nimport { ArrayProperty } from \"./properties/arrayProperty\";\nimport { SetProperty } from \"./properties/setProperty\";\nimport { StringProperty } from \"./properties/stringProperty\";\nimport { ReferenceProperty } from \"./properties/referenceProperty\";\nimport { ReferenceArrayProperty } from \"./properties/referenceArrayProperty\";\nimport { ReferenceMapProperty } from \"./properties/referenceMapProperty\";\nimport { EnumArrayProperty } from \"./properties/enumArrayProperty\";\nimport { EnumProperty } from \"./properties/enumProperty\";\nimport { Int64Property, Uint64Property } from \"./properties/intProperties\";\nimport { ValueArrayProperty } from \"./properties/valueArrayProperty\";\nimport { ValueMapProperty } from \"./properties/valueMapProperty\";\nimport { ValueProperty } from \"./properties/valueProperty\";\nimport { enableValidations } from \"./enableValidations\";\n\nexport {\n\tPropertyFactory,\n\tPropertyUtils,\n\tBaseProperty,\n\tContainerProperty,\n\tMapProperty,\n\tNodeProperty,\n\tArrayProperty,\n\tSetProperty,\n\tStringProperty,\n\tReferenceProperty,\n\tReferenceMapProperty,\n\tReferenceArrayProperty,\n\tUint64Property,\n\tEnumArrayProperty,\n\tEnumProperty,\n\tInt64Property,\n\tValueArrayProperty,\n\tValueMapProperty,\n\tValueProperty,\n\tenableValidations,\n};\n"]}
|
|
@@ -128,16 +128,16 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
128
128
|
*/
|
|
129
129
|
protected _append(in_property: any, in_allowChildMerges: boolean): void;
|
|
130
130
|
/**
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
131
|
+
* Merge child properties
|
|
132
|
+
*
|
|
133
|
+
* This is an internal function that merges children of two properties. This is used for extending inherited
|
|
134
|
+
* properties.
|
|
135
|
+
*
|
|
136
|
+
* @param {property-properties.BaseProperty} in_property - The property to merge its children (nested properties)
|
|
137
|
+
* with.
|
|
138
|
+
*
|
|
139
|
+
* @protected
|
|
140
|
+
*/
|
|
141
141
|
protected _merge(in_property: any): void;
|
|
142
142
|
/**
|
|
143
143
|
* Traverses all static properties (properties declared in the template and not added dynamically) in the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractStaticCollectionProperty.d.ts","sourceRoot":"","sources":["../../src/properties/abstractStaticCollectionProperty.js"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH;
|
|
1
|
+
{"version":3,"file":"abstractStaticCollectionProperty.d.ts","sourceRoot":"","sources":["../../src/properties/abstractStaticCollectionProperty.js"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH;IACC;;;OAGG;IACH,wBAQC;IAHC,oBAAyB;IAE1B,sBAA2B;IA2E5B;;;;;;OAMG;IACH,YAJW,MAAM,GAAC,MAAM,YAMvB;IAaD;;;;;;OAMG;IACH,WAFY,MAAM,CAOjB;IAED;;;;;;;;;;;;;;;OAeG;IACH,iBAbW,MAAM,GAAC,MAAM,GAAC,MAAM,MAAM,GAAC,MAAM,CAAC,wBAqB5C;IAED;;;;;OAKG;IACH,0BAWC;IAWD;;;;OAIG;IACH,WAFY,MAAO,MAAM,CAAC,CAIzB;IAED;;;;;;;;;;;;OAYG;IACH,gBAcC;IAED;;;;;OAKG;IACH,WAHW,MAAM,GACL,OAAO,CAIlB;IAuGD;;;;;;;;OAQG;IACH,sBALW,MAAM,YACN,OAAO,cACP,OAAO,QAgCjB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,qBALW,MAAM,QAwBhB;IAED;;;;;;;;;;;;;;OAcG;IACH,yDARW,OAAO,QAiCjB;IAED;;;;;;;;;;OAUG;IACH,yCAMC;IAsED;;;;;;;;OAQG;IACH,sFAJW,MAAM,eAyBhB;IAyJD;;;;OAIG;IACH,0BAEC;IAED;;;OAGG;IACH,uCAMC;CACD"}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
const _ = require(
|
|
6
|
-
const { ConsoleUtils, constants } = require(
|
|
7
|
-
const { PathHelper, ChangeSet } = require(
|
|
8
|
-
const { BaseProperty } = require(
|
|
9
|
-
const { LazyLoadedProperties: Property } = require(
|
|
5
|
+
const _ = require("lodash");
|
|
6
|
+
const { ConsoleUtils, constants } = require("@fluid-experimental/property-common");
|
|
7
|
+
const { PathHelper, ChangeSet } = require("@fluid-experimental/property-changeset");
|
|
8
|
+
const { BaseProperty } = require("./baseProperty");
|
|
9
|
+
const { LazyLoadedProperties: Property } = require("./lazyLoadedProperties");
|
|
10
10
|
const { MSG, PROPERTY_PATH_DELIMITER } = constants;
|
|
11
11
|
const { BREAK_TRAVERSAL, PATH_TOKENS } = BaseProperty;
|
|
12
12
|
/**
|
|
@@ -45,11 +45,11 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
45
45
|
get(in_ids, in_options) {
|
|
46
46
|
in_options = _.isObject(in_options) ? in_options : {};
|
|
47
47
|
in_options.referenceResolutionMode =
|
|
48
|
-
in_options.referenceResolutionMode === undefined
|
|
49
|
-
|
|
48
|
+
in_options.referenceResolutionMode === undefined
|
|
49
|
+
? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
|
|
50
|
+
: in_options.referenceResolutionMode;
|
|
50
51
|
var prop = this;
|
|
51
|
-
if (typeof in_ids ===
|
|
52
|
-
typeof in_ids === 'number') {
|
|
52
|
+
if (typeof in_ids === "string" || typeof in_ids === "number") {
|
|
53
53
|
prop = this._get(in_ids);
|
|
54
54
|
if (in_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {
|
|
55
55
|
if (prop instanceof Property.ReferenceProperty) {
|
|
@@ -65,11 +65,12 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
65
65
|
continue;
|
|
66
66
|
}
|
|
67
67
|
if (mode === BaseProperty.REFERENCE_RESOLUTION.NO_LEAFS) {
|
|
68
|
-
mode =
|
|
69
|
-
|
|
68
|
+
mode =
|
|
69
|
+
i !== in_ids.length - 1
|
|
70
|
+
? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
|
|
71
|
+
: BaseProperty.REFERENCE_RESOLUTION.NEVER;
|
|
70
72
|
}
|
|
71
|
-
if (in_ids[i - 1] === PATH_TOKENS.REF ||
|
|
72
|
-
in_ids[i + 1] === PATH_TOKENS.REF) {
|
|
73
|
+
if (in_ids[i - 1] === PATH_TOKENS.REF || in_ids[i + 1] === PATH_TOKENS.REF) {
|
|
73
74
|
mode = BaseProperty.REFERENCE_RESOLUTION.NEVER;
|
|
74
75
|
}
|
|
75
76
|
prop = prop.get(in_ids[i], { referenceResolutionMode: mode });
|
|
@@ -126,7 +127,9 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
126
127
|
* @return {string} The GUID
|
|
127
128
|
*/
|
|
128
129
|
getGuid() {
|
|
129
|
-
var guid = this.get(
|
|
130
|
+
var guid = this.get("guid", {
|
|
131
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
132
|
+
});
|
|
130
133
|
return guid ? guid.value : undefined;
|
|
131
134
|
}
|
|
132
135
|
/**
|
|
@@ -147,7 +150,8 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
147
150
|
*/
|
|
148
151
|
getValue(in_ids, in_options) {
|
|
149
152
|
var property = this.get(in_ids, in_options);
|
|
150
|
-
ConsoleUtils.assert(
|
|
153
|
+
ConsoleUtils.assert(property instanceof Property.ValueProperty ||
|
|
154
|
+
property instanceof Property.StringProperty, MSG.GET_VALUE_NOT_A_VALUE + in_ids);
|
|
151
155
|
return property.getValue();
|
|
152
156
|
}
|
|
153
157
|
/**
|
|
@@ -162,7 +166,9 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
162
166
|
var res = {};
|
|
163
167
|
var ids = this.getIds();
|
|
164
168
|
for (var i = 0; i < ids.length; i++) {
|
|
165
|
-
res[ids[i]] = this.get(ids[i], {
|
|
169
|
+
res[ids[i]] = this.get(ids[i], {
|
|
170
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
171
|
+
});
|
|
166
172
|
}
|
|
167
173
|
return res;
|
|
168
174
|
}
|
|
@@ -203,7 +209,7 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
203
209
|
if (_.isUndefined(child)) {
|
|
204
210
|
result[ids[i]] = undefined;
|
|
205
211
|
}
|
|
206
|
-
else if (child._context ===
|
|
212
|
+
else if (child._context === "single" && child.isPrimitiveType()) {
|
|
207
213
|
result[ids[i]] = child.getValue();
|
|
208
214
|
}
|
|
209
215
|
else {
|
|
@@ -234,8 +240,9 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
234
240
|
resolvePath(in_path, in_options) {
|
|
235
241
|
in_options = in_options || {};
|
|
236
242
|
in_options.referenceResolutionMode =
|
|
237
|
-
in_options.referenceResolutionMode === undefined
|
|
238
|
-
|
|
243
|
+
in_options.referenceResolutionMode === undefined
|
|
244
|
+
? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
|
|
245
|
+
: in_options.referenceResolutionMode;
|
|
239
246
|
var node = this;
|
|
240
247
|
// Tokenize the path string
|
|
241
248
|
var tokenTypes = [];
|
|
@@ -265,8 +272,10 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
265
272
|
for (var i = iterationStart; i < pathArr.length && node; i++) {
|
|
266
273
|
if (tokenTypes[i] !== PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN) {
|
|
267
274
|
node = node._resolvePathSegment(pathArr[i], tokenTypes[i]);
|
|
268
|
-
if (in_options.referenceResolutionMode ===
|
|
269
|
-
|
|
275
|
+
if (in_options.referenceResolutionMode ===
|
|
276
|
+
BaseProperty.REFERENCE_RESOLUTION.ALWAYS ||
|
|
277
|
+
(in_options.referenceResolutionMode ===
|
|
278
|
+
BaseProperty.REFERENCE_RESOLUTION.NO_LEAFS &&
|
|
270
279
|
i !== pathArr.length - 1)) {
|
|
271
280
|
if (node instanceof Property.ReferenceProperty) {
|
|
272
281
|
if (tokenTypes[i + 1] !== PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN) {
|
|
@@ -306,7 +315,9 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
306
315
|
throw new Error(MSG.INVALID_PATH_TOKEN + in_segment);
|
|
307
316
|
}
|
|
308
317
|
return this.has(in_segment)
|
|
309
|
-
? this.get(in_segment, {
|
|
318
|
+
? this.get(in_segment, {
|
|
319
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
320
|
+
})
|
|
310
321
|
: undefined;
|
|
311
322
|
}
|
|
312
323
|
/**
|
|
@@ -325,8 +336,11 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
325
336
|
for (var i = 0; i < keys.length; i++) {
|
|
326
337
|
var propertyKey = keys[i];
|
|
327
338
|
var propertyValue = in_values[propertyKey];
|
|
328
|
-
var property = that.get(propertyKey, {
|
|
329
|
-
|
|
339
|
+
var property = that.get(propertyKey, {
|
|
340
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
341
|
+
});
|
|
342
|
+
if (property instanceof Property.ValueProperty ||
|
|
343
|
+
property instanceof Property.StringProperty) {
|
|
330
344
|
property.setValue(propertyValue);
|
|
331
345
|
}
|
|
332
346
|
else if (property instanceof BaseProperty && _.isObject(propertyValue)) {
|
|
@@ -334,7 +348,7 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
334
348
|
}
|
|
335
349
|
else if (property instanceof BaseProperty) {
|
|
336
350
|
const typeid = property.getTypeid();
|
|
337
|
-
throw new Error(MSG.SET_VALUES_PATH_PROPERTY + propertyKey +
|
|
351
|
+
throw new Error(MSG.SET_VALUES_PATH_PROPERTY + propertyKey + ", of type: " + typeid);
|
|
338
352
|
}
|
|
339
353
|
else if (property === undefined) {
|
|
340
354
|
throw new Error(MSG.SET_VALUES_PATH_INVALID + propertyKey);
|
|
@@ -399,8 +413,8 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
399
413
|
throw new Error(MSG.OVERWRITING_ID + id);
|
|
400
414
|
}
|
|
401
415
|
// if child is untyped then merge its properties
|
|
402
|
-
if (this._staticChildren[id].getTypeid() ===
|
|
403
|
-
this._staticChildren[id].getContext() ===
|
|
416
|
+
if (this._staticChildren[id].getTypeid() === "AbstractStaticCollectionProperty" &&
|
|
417
|
+
this._staticChildren[id].getContext() === "single") {
|
|
404
418
|
// if the property's type is different than the child type, throw error.
|
|
405
419
|
if (this._staticChildren[id].getTypeid() !== in_property.getTypeid()) {
|
|
406
420
|
throw new Error(MSG.OVERRIDDING_INHERITED_TYPES + id);
|
|
@@ -413,16 +427,16 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
413
427
|
}
|
|
414
428
|
}
|
|
415
429
|
/**
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
430
|
+
* Merge child properties
|
|
431
|
+
*
|
|
432
|
+
* This is an internal function that merges children of two properties. This is used for extending inherited
|
|
433
|
+
* properties.
|
|
434
|
+
*
|
|
435
|
+
* @param {property-properties.BaseProperty} in_property - The property to merge its children (nested properties)
|
|
436
|
+
* with.
|
|
437
|
+
*
|
|
438
|
+
* @protected
|
|
439
|
+
*/
|
|
426
440
|
_merge(in_property) {
|
|
427
441
|
var keys = Object.keys(in_property._staticChildren);
|
|
428
442
|
for (var i = 0; i < keys.length; i++) {
|
|
@@ -437,7 +451,7 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
437
451
|
var rtn = [];
|
|
438
452
|
var childKeys = _.keys(this._staticChildren);
|
|
439
453
|
for (var i = 0; i < childKeys.length; i++) {
|
|
440
|
-
if (
|
|
454
|
+
if (this._get(childKeys[i])._isDirty(flags) !== 0) {
|
|
441
455
|
rtn.push(childKeys[i]);
|
|
442
456
|
}
|
|
443
457
|
}
|
|
@@ -456,7 +470,7 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
456
470
|
*/
|
|
457
471
|
traverseDown(in_callback) {
|
|
458
472
|
ConsoleUtils.assert(_.isFunction(in_callback), MSG.CALLBACK_NOT_FCT);
|
|
459
|
-
return this._traverse(in_callback,
|
|
473
|
+
return this._traverse(in_callback, "");
|
|
460
474
|
}
|
|
461
475
|
/**
|
|
462
476
|
* Traverses all children in the child hierarchy
|
|
@@ -476,7 +490,8 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
476
490
|
childKeys = this._getIds();
|
|
477
491
|
for (i = 0; i < childKeys.length; i++) {
|
|
478
492
|
child = this._get(childKeys[i]);
|
|
479
|
-
childPath =
|
|
493
|
+
childPath =
|
|
494
|
+
in_pathFromTraversalStart + PathHelper.quotePathSegmentIfNeeded(child.getId());
|
|
480
495
|
result = in_callback(child, childPath);
|
|
481
496
|
if (result !== BREAK_TRAVERSAL) {
|
|
482
497
|
result = child._traverse(in_callback, childPath);
|
|
@@ -498,18 +513,18 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
498
513
|
* @protected
|
|
499
514
|
*/
|
|
500
515
|
_traverseStaticProperties(in_callback, in_pathFromTraversalStart) {
|
|
501
|
-
in_pathFromTraversalStart = in_pathFromTraversalStart ||
|
|
516
|
+
in_pathFromTraversalStart = in_pathFromTraversalStart || "";
|
|
502
517
|
var propertyKeys = _.keys(this._staticChildren);
|
|
503
518
|
for (var i = 0; i < propertyKeys.length; i++) {
|
|
504
519
|
var property = this._staticChildren[propertyKeys[i]];
|
|
505
520
|
var childPath = in_pathFromTraversalStart +
|
|
506
|
-
(in_pathFromTraversalStart.length !== 0 ? PROPERTY_PATH_DELIMITER :
|
|
521
|
+
(in_pathFromTraversalStart.length !== 0 ? PROPERTY_PATH_DELIMITER : "") +
|
|
507
522
|
PathHelper.quotePathSegmentIfNeeded(property.getId());
|
|
508
523
|
// We only recursively traverse ContainerProperties, since these are used to define the hierarchy within
|
|
509
524
|
// one template
|
|
510
|
-
if ((property.getTypeid() ===
|
|
511
|
-
property.getTypeid() ===
|
|
512
|
-
property.getContext() ===
|
|
525
|
+
if ((property.getTypeid() === "AbstractStaticCollectionProperty" ||
|
|
526
|
+
property.getTypeid() === "ContainerProperty") &&
|
|
527
|
+
property.getContext() === "single") {
|
|
513
528
|
property._traverseStaticProperties(in_callback, childPath);
|
|
514
529
|
}
|
|
515
530
|
in_callback(property, childPath);
|
|
@@ -533,15 +548,18 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
533
548
|
var serializedChildren = {};
|
|
534
549
|
var childrenType;
|
|
535
550
|
in_dirtyOnly = in_dirtyOnly || false;
|
|
536
|
-
in_dirtinessType =
|
|
537
|
-
|
|
551
|
+
in_dirtinessType =
|
|
552
|
+
in_dirtinessType === undefined
|
|
553
|
+
? BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE
|
|
554
|
+
: in_dirtinessType;
|
|
538
555
|
this._traverseStaticProperties(function (in_node, in_pathFromTraversalStart) {
|
|
539
556
|
if (in_dirtyOnly && !in_node._isDirty(in_dirtinessType)) {
|
|
540
557
|
return;
|
|
541
558
|
}
|
|
542
559
|
childrenType = in_node.getFullTypeid();
|
|
543
|
-
if (childrenType !==
|
|
544
|
-
childrenType !==
|
|
560
|
+
if (childrenType !== "AbstractStaticCollectionProperty" &&
|
|
561
|
+
childrenType !== "ContainerProperty") {
|
|
562
|
+
// we don't want to keep BaseProperties
|
|
545
563
|
// as they mostly behave as 'paths' to
|
|
546
564
|
// a ValueProperty.
|
|
547
565
|
var serialized = in_node._serialize(in_dirtyOnly, false, in_dirtinessType, in_includeReferencedRepositories);
|
|
@@ -555,7 +573,7 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
555
573
|
}
|
|
556
574
|
});
|
|
557
575
|
if (in_includeRootTypeid) {
|
|
558
|
-
serializedChildren[
|
|
576
|
+
serializedChildren["typeid"] = this.getFullTypeid();
|
|
559
577
|
}
|
|
560
578
|
return serializedChildren;
|
|
561
579
|
}
|
|
@@ -576,7 +594,7 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
576
594
|
this._traverseStaticProperties(function (in_node, in_pathFromTraversalStart) {
|
|
577
595
|
// We do not deserialize base properties, since the traverseStatic function
|
|
578
596
|
// already traverses recursively
|
|
579
|
-
if (in_node.getTypeid() ===
|
|
597
|
+
if (in_node.getTypeid() === "ContainerProperty" && in_node.getContext() === "single") {
|
|
580
598
|
return;
|
|
581
599
|
}
|
|
582
600
|
var typeid = in_node.getFullTypeid();
|
|
@@ -645,8 +663,7 @@ export class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
645
663
|
* @param {Object} in_constants - The list of typed values.
|
|
646
664
|
*/
|
|
647
665
|
_setConstants(in_constants) {
|
|
648
|
-
ConsoleUtils.assert(_.isObject(in_constants), MSG.ASSERTION_FAILED +
|
|
649
|
-
' setConstants parameter: in_constants must be an object.');
|
|
666
|
+
ConsoleUtils.assert(_.isObject(in_constants), MSG.ASSERTION_FAILED + " setConstants parameter: in_constants must be an object.");
|
|
650
667
|
this._constantChildren = in_constants;
|
|
651
668
|
}
|
|
652
669
|
}
|