@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
package/README.md
CHANGED
|
@@ -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"}
|
|
@@ -8,11 +8,11 @@ exports.deserializeNonPrimitiveArrayElements = exports.deserialize = exports.ser
|
|
|
8
8
|
/**
|
|
9
9
|
* @namespace property-properties
|
|
10
10
|
*/
|
|
11
|
-
const { PathHelper } = require(
|
|
12
|
-
const { LazyLoadedProperties: Property } = require(
|
|
13
|
-
const { AbstractStaticCollectionProperty } = require(
|
|
11
|
+
const { PathHelper } = require("@fluid-experimental/property-changeset");
|
|
12
|
+
const { LazyLoadedProperties: Property } = require("./properties/lazyLoadedProperties");
|
|
13
|
+
const { AbstractStaticCollectionProperty, } = require("./properties/abstractStaticCollectionProperty");
|
|
14
14
|
var MSG = {
|
|
15
|
-
NOTHING_TO_DESERIALIZE:
|
|
15
|
+
NOTHING_TO_DESERIALIZE: "Repository deserialize(), no input given",
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Dummy property used to return the scope to the underlying properties
|
|
@@ -157,7 +157,7 @@ function deserializeNonPrimitiveArrayElements(in_data, in_scope) {
|
|
|
157
157
|
var insertedPropertyInstances = [];
|
|
158
158
|
for (var i = 0; i < in_data.length; ++i) {
|
|
159
159
|
// reconstruct entity
|
|
160
|
-
var createdProperty = Property.PropertyFactory._createProperty(in_data[i][
|
|
160
|
+
var createdProperty = Property.PropertyFactory._createProperty(in_data[i]["typeid"], null, undefined, in_scope);
|
|
161
161
|
var id = createdProperty.getId();
|
|
162
162
|
// Create a scope property which captures the scope that was passed in as argument
|
|
163
163
|
// 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;;;GA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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;;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QACb,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QACzC,OAAO,EAAE,CAAC;KACV;IAED,IAAI,yBAAyB,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;AAjCD,oFAiCC","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;;;AAEQ,QAAA,kBAAkB,GAAG;
|
|
1
|
+
{"version":3,"file":"enableValidations.js","sourceRoot":"","sources":["../src/enableValidations.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEQ,QAAA,kBAAkB,GAAG;IAC/B,OAAO,EAAE,IAAI;CACb,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,OAAgB;IACjD,0BAAkB,CAAC,OAAO,GAAG,OAAO,CAAC;AACtC,CAAC;AAFD,8CAEC","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/dist/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/dist/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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,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,iBAAiB,GACjB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAoD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uDAAoD;AAqBnD,gGArBQ,iCAAe,OAqBR;AApBhB,mDAAgD;AAqB/C,8FArBQ,6BAAa,OAqBR;AApBd,4DAAyD;AAqBxD,6FArBQ,2BAAY,OAqBR;AApBb,sEAAmE;AAqBlE,kGArBQ,qCAAiB,OAqBR;AApBlB,0DAAuD;AAqBtD,4FArBQ,yBAAW,OAqBR;AApBZ,4DAAyD;AAqBxD,6FArBQ,2BAAY,OAqBR;AApBb,8DAA2D;AAqB1D,8FArBQ,6BAAa,OAqBR;AApBd,0DAAuD;AAqBtD,4FArBQ,yBAAW,OAqBR;AApBZ,gEAA6D;AAqB5D,+FArBQ,+BAAc,OAqBR;AApBf,sEAAmE;AAqBlE,kGArBQ,qCAAiB,OAqBR;AApBlB,gFAA6E;AAsB5E,uGAtBQ,+CAAsB,OAsBR;AArBvB,4EAAyE;AAoBxE,qGApBQ,2CAAoB,OAoBR;AAnBrB,sEAAmE;AAsBlE,kGAtBQ,qCAAiB,OAsBR;AArBlB,4DAAyD;AAsBxD,6FAtBQ,2BAAY,OAsBR;AArBb,8DAA2E;AAsB1E,8FAtBQ,6BAAa,OAsBR;AAHb,+FAnBuB,8BAAc,OAmBvB;AAlBf,wEAAqE;AAsBpE,mGAtBQ,uCAAkB,OAsBR;AArBnB,oEAAiE;AAsBhE,iGAtBQ,mCAAgB,OAsBR;AArBjB,8DAA2D;AAsB1D,8FAtBQ,6BAAa,OAsBR;AArBd,2DAAwD;AAsBvD,kGAtBQ,qCAAiB,OAsBR","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"}
|
|
@@ -5,11 +5,11 @@ exports.AbstractStaticCollectionProperty = void 0;
|
|
|
5
5
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
6
6
|
* Licensed under the MIT License.
|
|
7
7
|
*/
|
|
8
|
-
const _ = require(
|
|
9
|
-
const { ConsoleUtils, constants } = require(
|
|
10
|
-
const { PathHelper, ChangeSet } = require(
|
|
11
|
-
const { BaseProperty } = require(
|
|
12
|
-
const { LazyLoadedProperties: Property } = require(
|
|
8
|
+
const _ = require("lodash");
|
|
9
|
+
const { ConsoleUtils, constants } = require("@fluid-experimental/property-common");
|
|
10
|
+
const { PathHelper, ChangeSet } = require("@fluid-experimental/property-changeset");
|
|
11
|
+
const { BaseProperty } = require("./baseProperty");
|
|
12
|
+
const { LazyLoadedProperties: Property } = require("./lazyLoadedProperties");
|
|
13
13
|
const { MSG, PROPERTY_PATH_DELIMITER } = constants;
|
|
14
14
|
const { BREAK_TRAVERSAL, PATH_TOKENS } = BaseProperty;
|
|
15
15
|
/**
|
|
@@ -48,11 +48,11 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
48
48
|
get(in_ids, in_options) {
|
|
49
49
|
in_options = _.isObject(in_options) ? in_options : {};
|
|
50
50
|
in_options.referenceResolutionMode =
|
|
51
|
-
in_options.referenceResolutionMode === undefined
|
|
52
|
-
|
|
51
|
+
in_options.referenceResolutionMode === undefined
|
|
52
|
+
? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
|
|
53
|
+
: in_options.referenceResolutionMode;
|
|
53
54
|
var prop = this;
|
|
54
|
-
if (typeof in_ids ===
|
|
55
|
-
typeof in_ids === 'number') {
|
|
55
|
+
if (typeof in_ids === "string" || typeof in_ids === "number") {
|
|
56
56
|
prop = this._get(in_ids);
|
|
57
57
|
if (in_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {
|
|
58
58
|
if (prop instanceof Property.ReferenceProperty) {
|
|
@@ -68,11 +68,12 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
68
68
|
continue;
|
|
69
69
|
}
|
|
70
70
|
if (mode === BaseProperty.REFERENCE_RESOLUTION.NO_LEAFS) {
|
|
71
|
-
mode =
|
|
72
|
-
|
|
71
|
+
mode =
|
|
72
|
+
i !== in_ids.length - 1
|
|
73
|
+
? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
|
|
74
|
+
: BaseProperty.REFERENCE_RESOLUTION.NEVER;
|
|
73
75
|
}
|
|
74
|
-
if (in_ids[i - 1] === PATH_TOKENS.REF ||
|
|
75
|
-
in_ids[i + 1] === PATH_TOKENS.REF) {
|
|
76
|
+
if (in_ids[i - 1] === PATH_TOKENS.REF || in_ids[i + 1] === PATH_TOKENS.REF) {
|
|
76
77
|
mode = BaseProperty.REFERENCE_RESOLUTION.NEVER;
|
|
77
78
|
}
|
|
78
79
|
prop = prop.get(in_ids[i], { referenceResolutionMode: mode });
|
|
@@ -129,7 +130,9 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
129
130
|
* @return {string} The GUID
|
|
130
131
|
*/
|
|
131
132
|
getGuid() {
|
|
132
|
-
var guid = this.get(
|
|
133
|
+
var guid = this.get("guid", {
|
|
134
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
135
|
+
});
|
|
133
136
|
return guid ? guid.value : undefined;
|
|
134
137
|
}
|
|
135
138
|
/**
|
|
@@ -150,7 +153,8 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
150
153
|
*/
|
|
151
154
|
getValue(in_ids, in_options) {
|
|
152
155
|
var property = this.get(in_ids, in_options);
|
|
153
|
-
ConsoleUtils.assert(
|
|
156
|
+
ConsoleUtils.assert(property instanceof Property.ValueProperty ||
|
|
157
|
+
property instanceof Property.StringProperty, MSG.GET_VALUE_NOT_A_VALUE + in_ids);
|
|
154
158
|
return property.getValue();
|
|
155
159
|
}
|
|
156
160
|
/**
|
|
@@ -165,7 +169,9 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
165
169
|
var res = {};
|
|
166
170
|
var ids = this.getIds();
|
|
167
171
|
for (var i = 0; i < ids.length; i++) {
|
|
168
|
-
res[ids[i]] = this.get(ids[i], {
|
|
172
|
+
res[ids[i]] = this.get(ids[i], {
|
|
173
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
174
|
+
});
|
|
169
175
|
}
|
|
170
176
|
return res;
|
|
171
177
|
}
|
|
@@ -206,7 +212,7 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
206
212
|
if (_.isUndefined(child)) {
|
|
207
213
|
result[ids[i]] = undefined;
|
|
208
214
|
}
|
|
209
|
-
else if (child._context ===
|
|
215
|
+
else if (child._context === "single" && child.isPrimitiveType()) {
|
|
210
216
|
result[ids[i]] = child.getValue();
|
|
211
217
|
}
|
|
212
218
|
else {
|
|
@@ -237,8 +243,9 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
237
243
|
resolvePath(in_path, in_options) {
|
|
238
244
|
in_options = in_options || {};
|
|
239
245
|
in_options.referenceResolutionMode =
|
|
240
|
-
in_options.referenceResolutionMode === undefined
|
|
241
|
-
|
|
246
|
+
in_options.referenceResolutionMode === undefined
|
|
247
|
+
? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
|
|
248
|
+
: in_options.referenceResolutionMode;
|
|
242
249
|
var node = this;
|
|
243
250
|
// Tokenize the path string
|
|
244
251
|
var tokenTypes = [];
|
|
@@ -268,8 +275,10 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
268
275
|
for (var i = iterationStart; i < pathArr.length && node; i++) {
|
|
269
276
|
if (tokenTypes[i] !== PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN) {
|
|
270
277
|
node = node._resolvePathSegment(pathArr[i], tokenTypes[i]);
|
|
271
|
-
if (in_options.referenceResolutionMode ===
|
|
272
|
-
|
|
278
|
+
if (in_options.referenceResolutionMode ===
|
|
279
|
+
BaseProperty.REFERENCE_RESOLUTION.ALWAYS ||
|
|
280
|
+
(in_options.referenceResolutionMode ===
|
|
281
|
+
BaseProperty.REFERENCE_RESOLUTION.NO_LEAFS &&
|
|
273
282
|
i !== pathArr.length - 1)) {
|
|
274
283
|
if (node instanceof Property.ReferenceProperty) {
|
|
275
284
|
if (tokenTypes[i + 1] !== PathHelper.TOKEN_TYPES.DEREFERENCE_TOKEN) {
|
|
@@ -309,7 +318,9 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
309
318
|
throw new Error(MSG.INVALID_PATH_TOKEN + in_segment);
|
|
310
319
|
}
|
|
311
320
|
return this.has(in_segment)
|
|
312
|
-
? this.get(in_segment, {
|
|
321
|
+
? this.get(in_segment, {
|
|
322
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
323
|
+
})
|
|
313
324
|
: undefined;
|
|
314
325
|
}
|
|
315
326
|
/**
|
|
@@ -328,8 +339,11 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
328
339
|
for (var i = 0; i < keys.length; i++) {
|
|
329
340
|
var propertyKey = keys[i];
|
|
330
341
|
var propertyValue = in_values[propertyKey];
|
|
331
|
-
var property = that.get(propertyKey, {
|
|
332
|
-
|
|
342
|
+
var property = that.get(propertyKey, {
|
|
343
|
+
referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
|
|
344
|
+
});
|
|
345
|
+
if (property instanceof Property.ValueProperty ||
|
|
346
|
+
property instanceof Property.StringProperty) {
|
|
333
347
|
property.setValue(propertyValue);
|
|
334
348
|
}
|
|
335
349
|
else if (property instanceof BaseProperty && _.isObject(propertyValue)) {
|
|
@@ -337,7 +351,7 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
337
351
|
}
|
|
338
352
|
else if (property instanceof BaseProperty) {
|
|
339
353
|
const typeid = property.getTypeid();
|
|
340
|
-
throw new Error(MSG.SET_VALUES_PATH_PROPERTY + propertyKey +
|
|
354
|
+
throw new Error(MSG.SET_VALUES_PATH_PROPERTY + propertyKey + ", of type: " + typeid);
|
|
341
355
|
}
|
|
342
356
|
else if (property === undefined) {
|
|
343
357
|
throw new Error(MSG.SET_VALUES_PATH_INVALID + propertyKey);
|
|
@@ -402,8 +416,8 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
402
416
|
throw new Error(MSG.OVERWRITING_ID + id);
|
|
403
417
|
}
|
|
404
418
|
// if child is untyped then merge its properties
|
|
405
|
-
if (this._staticChildren[id].getTypeid() ===
|
|
406
|
-
this._staticChildren[id].getContext() ===
|
|
419
|
+
if (this._staticChildren[id].getTypeid() === "AbstractStaticCollectionProperty" &&
|
|
420
|
+
this._staticChildren[id].getContext() === "single") {
|
|
407
421
|
// if the property's type is different than the child type, throw error.
|
|
408
422
|
if (this._staticChildren[id].getTypeid() !== in_property.getTypeid()) {
|
|
409
423
|
throw new Error(MSG.OVERRIDDING_INHERITED_TYPES + id);
|
|
@@ -416,16 +430,16 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
416
430
|
}
|
|
417
431
|
}
|
|
418
432
|
/**
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
433
|
+
* Merge child properties
|
|
434
|
+
*
|
|
435
|
+
* This is an internal function that merges children of two properties. This is used for extending inherited
|
|
436
|
+
* properties.
|
|
437
|
+
*
|
|
438
|
+
* @param {property-properties.BaseProperty} in_property - The property to merge its children (nested properties)
|
|
439
|
+
* with.
|
|
440
|
+
*
|
|
441
|
+
* @protected
|
|
442
|
+
*/
|
|
429
443
|
_merge(in_property) {
|
|
430
444
|
var keys = Object.keys(in_property._staticChildren);
|
|
431
445
|
for (var i = 0; i < keys.length; i++) {
|
|
@@ -440,7 +454,7 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
440
454
|
var rtn = [];
|
|
441
455
|
var childKeys = _.keys(this._staticChildren);
|
|
442
456
|
for (var i = 0; i < childKeys.length; i++) {
|
|
443
|
-
if (
|
|
457
|
+
if (this._get(childKeys[i])._isDirty(flags) !== 0) {
|
|
444
458
|
rtn.push(childKeys[i]);
|
|
445
459
|
}
|
|
446
460
|
}
|
|
@@ -459,7 +473,7 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
459
473
|
*/
|
|
460
474
|
traverseDown(in_callback) {
|
|
461
475
|
ConsoleUtils.assert(_.isFunction(in_callback), MSG.CALLBACK_NOT_FCT);
|
|
462
|
-
return this._traverse(in_callback,
|
|
476
|
+
return this._traverse(in_callback, "");
|
|
463
477
|
}
|
|
464
478
|
/**
|
|
465
479
|
* Traverses all children in the child hierarchy
|
|
@@ -479,7 +493,8 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
479
493
|
childKeys = this._getIds();
|
|
480
494
|
for (i = 0; i < childKeys.length; i++) {
|
|
481
495
|
child = this._get(childKeys[i]);
|
|
482
|
-
childPath =
|
|
496
|
+
childPath =
|
|
497
|
+
in_pathFromTraversalStart + PathHelper.quotePathSegmentIfNeeded(child.getId());
|
|
483
498
|
result = in_callback(child, childPath);
|
|
484
499
|
if (result !== BREAK_TRAVERSAL) {
|
|
485
500
|
result = child._traverse(in_callback, childPath);
|
|
@@ -501,18 +516,18 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
501
516
|
* @protected
|
|
502
517
|
*/
|
|
503
518
|
_traverseStaticProperties(in_callback, in_pathFromTraversalStart) {
|
|
504
|
-
in_pathFromTraversalStart = in_pathFromTraversalStart ||
|
|
519
|
+
in_pathFromTraversalStart = in_pathFromTraversalStart || "";
|
|
505
520
|
var propertyKeys = _.keys(this._staticChildren);
|
|
506
521
|
for (var i = 0; i < propertyKeys.length; i++) {
|
|
507
522
|
var property = this._staticChildren[propertyKeys[i]];
|
|
508
523
|
var childPath = in_pathFromTraversalStart +
|
|
509
|
-
(in_pathFromTraversalStart.length !== 0 ? PROPERTY_PATH_DELIMITER :
|
|
524
|
+
(in_pathFromTraversalStart.length !== 0 ? PROPERTY_PATH_DELIMITER : "") +
|
|
510
525
|
PathHelper.quotePathSegmentIfNeeded(property.getId());
|
|
511
526
|
// We only recursively traverse ContainerProperties, since these are used to define the hierarchy within
|
|
512
527
|
// one template
|
|
513
|
-
if ((property.getTypeid() ===
|
|
514
|
-
property.getTypeid() ===
|
|
515
|
-
property.getContext() ===
|
|
528
|
+
if ((property.getTypeid() === "AbstractStaticCollectionProperty" ||
|
|
529
|
+
property.getTypeid() === "ContainerProperty") &&
|
|
530
|
+
property.getContext() === "single") {
|
|
516
531
|
property._traverseStaticProperties(in_callback, childPath);
|
|
517
532
|
}
|
|
518
533
|
in_callback(property, childPath);
|
|
@@ -536,15 +551,18 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
536
551
|
var serializedChildren = {};
|
|
537
552
|
var childrenType;
|
|
538
553
|
in_dirtyOnly = in_dirtyOnly || false;
|
|
539
|
-
in_dirtinessType =
|
|
540
|
-
|
|
554
|
+
in_dirtinessType =
|
|
555
|
+
in_dirtinessType === undefined
|
|
556
|
+
? BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE
|
|
557
|
+
: in_dirtinessType;
|
|
541
558
|
this._traverseStaticProperties(function (in_node, in_pathFromTraversalStart) {
|
|
542
559
|
if (in_dirtyOnly && !in_node._isDirty(in_dirtinessType)) {
|
|
543
560
|
return;
|
|
544
561
|
}
|
|
545
562
|
childrenType = in_node.getFullTypeid();
|
|
546
|
-
if (childrenType !==
|
|
547
|
-
childrenType !==
|
|
563
|
+
if (childrenType !== "AbstractStaticCollectionProperty" &&
|
|
564
|
+
childrenType !== "ContainerProperty") {
|
|
565
|
+
// we don't want to keep BaseProperties
|
|
548
566
|
// as they mostly behave as 'paths' to
|
|
549
567
|
// a ValueProperty.
|
|
550
568
|
var serialized = in_node._serialize(in_dirtyOnly, false, in_dirtinessType, in_includeReferencedRepositories);
|
|
@@ -558,7 +576,7 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
558
576
|
}
|
|
559
577
|
});
|
|
560
578
|
if (in_includeRootTypeid) {
|
|
561
|
-
serializedChildren[
|
|
579
|
+
serializedChildren["typeid"] = this.getFullTypeid();
|
|
562
580
|
}
|
|
563
581
|
return serializedChildren;
|
|
564
582
|
}
|
|
@@ -579,7 +597,7 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
579
597
|
this._traverseStaticProperties(function (in_node, in_pathFromTraversalStart) {
|
|
580
598
|
// We do not deserialize base properties, since the traverseStatic function
|
|
581
599
|
// already traverses recursively
|
|
582
|
-
if (in_node.getTypeid() ===
|
|
600
|
+
if (in_node.getTypeid() === "ContainerProperty" && in_node.getContext() === "single") {
|
|
583
601
|
return;
|
|
584
602
|
}
|
|
585
603
|
var typeid = in_node.getFullTypeid();
|
|
@@ -648,8 +666,7 @@ class AbstractStaticCollectionProperty extends BaseProperty {
|
|
|
648
666
|
* @param {Object} in_constants - The list of typed values.
|
|
649
667
|
*/
|
|
650
668
|
_setConstants(in_constants) {
|
|
651
|
-
ConsoleUtils.assert(_.isObject(in_constants), MSG.ASSERTION_FAILED +
|
|
652
|
-
' setConstants parameter: in_constants must be an object.');
|
|
669
|
+
ConsoleUtils.assert(_.isObject(in_constants), MSG.ASSERTION_FAILED + " setConstants parameter: in_constants must be an object.");
|
|
653
670
|
this._constantChildren = in_constants;
|
|
654
671
|
}
|
|
655
672
|
}
|