@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,23 +1,23 @@
|
|
|
1
1
|
export class PropertyTemplate {
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
* Determines if the argument is a template structure
|
|
4
|
+
*
|
|
5
|
+
* @param {object} in_param - Parameter to assess
|
|
6
|
+
*
|
|
7
|
+
* @return {Boolean} true if in_param is a template
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
11
|
public static isTemplate(in_param: object): boolean;
|
|
12
12
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
* Extracts typeids directly referred to in a template
|
|
14
|
+
*
|
|
15
|
+
* @param {object} template - Structure from which to extract dependencies
|
|
16
|
+
*
|
|
17
|
+
* @return {Array} List of typeids this template refers directly to
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
21
|
public static extractDependencies(template: object): any[];
|
|
22
22
|
/**
|
|
23
23
|
* Constructor for creating a PropertyTemplate based on the given parameters.
|
|
@@ -45,7 +45,7 @@ export class PropertyTemplate {
|
|
|
45
45
|
id: any;
|
|
46
46
|
/** The type identifier of the property */
|
|
47
47
|
typeid: any;
|
|
48
|
-
length:
|
|
48
|
+
length: any;
|
|
49
49
|
/** The context of the property */
|
|
50
50
|
context: any;
|
|
51
51
|
/** Array with sub-properties */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTemplate.d.ts","sourceRoot":"","sources":["../src/propertyTemplate.js"],"names":[],"mappings":"AAeA;
|
|
1
|
+
{"version":3,"file":"propertyTemplate.d.ts","sourceRoot":"","sources":["../src/propertyTemplate.js"],"names":[],"mappings":"AAeA;IAwTC;;;;;;;;OAQG;IACH,mCANW,MAAM,WAWhB;IAED;;;;;;;;OAQG;IACH,4CANW,MAAM,SAwFhB;IAlaD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,wBAoCC;IAlCA,qCAAqC;IACrC,QAAmB;IACnB,0CAA0C;IAC1C,YAA2B;IAI1B,YAA6D;IAM9D,kCAAkC;IAClC,aAA6B;IAE7B,gCAAgC;IAChC,gBAAmC;IAEnC,4BAA4B;IAC5B,gBAAyC;IAEzC,qCAAqC;IACrC,eAAiC;IAEjC,wDAAwD;IACxD,cAAiF;IAGhF,oBAAwD;IAIzD;YArDU,MAAM;cACN,MAAM;gBACN,MAAM;iBACN,MAAM;iBAEN,MAAM;oBAEN,MAAO,MAAM,CAAC;mBAEd,MAAO,MAAM,CAAC;kBAEd,MAAO,MAAM,CAAC;MA0CU;IAGnC,+BAEC;IAED,8BAEC;IAED;;;OAGG;IACH,2DAFW,EAAE,QAgBZ;IAED;;;;;OAKG;IACH,uCAFY,EAAE,CAiCb;IAED;;;;OAIG;IACH,kBAEC;IAED;;;;OAIG;IACH,gBAFY,OAAO,CAYlB;IAED;;;OAGG;IACH,cAFY,MAAM,CAWjB;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,yCARW,WAAY,YACZ,MAAM,iBACN,OAAO,OAoGjB;IAED;;;OAGG;IACH,aAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,sBAFY,MAAM,CAIjB;IAED;;;;;OAKG;IACH,2BAHY,MAAM,CAUjB;CA8GD"}
|
package/dist/propertyTemplate.js
CHANGED
|
@@ -9,12 +9,12 @@ exports.PropertyTemplate = void 0;
|
|
|
9
9
|
* @fileoverview Declaration of the PropertyTemplate module.
|
|
10
10
|
* PropertyTemplate is used to describe a static property.
|
|
11
11
|
*/
|
|
12
|
-
const _ = require(
|
|
13
|
-
const { TypeIdHelper } = require(
|
|
14
|
-
const fastestJSONCopy = require(
|
|
12
|
+
const _ = require("lodash");
|
|
13
|
+
const { TypeIdHelper } = require("@fluid-experimental/property-changeset");
|
|
14
|
+
const fastestJSONCopy = require("fastest-json-copy");
|
|
15
15
|
const deepCopy = fastestJSONCopy.copy;
|
|
16
|
-
const { ConsoleUtils } = require(
|
|
17
|
-
const { MSG } = require(
|
|
16
|
+
const { ConsoleUtils } = require("@fluid-experimental/property-common");
|
|
17
|
+
const { MSG } = require("@fluid-experimental/property-common").constants;
|
|
18
18
|
class PropertyTemplate {
|
|
19
19
|
/**
|
|
20
20
|
* Constructor for creating a PropertyTemplate based on the given parameters.
|
|
@@ -44,7 +44,7 @@ class PropertyTemplate {
|
|
|
44
44
|
/** The type identifier of the property */
|
|
45
45
|
this.typeid = params.typeid;
|
|
46
46
|
/** Size of the property (if this is an array) */
|
|
47
|
-
if (params.context ===
|
|
47
|
+
if (params.context === "array") {
|
|
48
48
|
this.length = params.length !== undefined ? params.length : 0;
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
@@ -61,7 +61,7 @@ class PropertyTemplate {
|
|
|
61
61
|
this.constants = params.constants;
|
|
62
62
|
/** Typeids of properties this property inherits from */
|
|
63
63
|
this.inherits = _.isString(params.inherits) ? [params.inherits] : params.inherits;
|
|
64
|
-
if (_.includes(this.inherits,
|
|
64
|
+
if (_.includes(this.inherits, "Enum")) {
|
|
65
65
|
this._enumDictionary = this._parseEnums(this.properties);
|
|
66
66
|
}
|
|
67
67
|
// check for inlined enums and parse them:
|
|
@@ -69,10 +69,10 @@ class PropertyTemplate {
|
|
|
69
69
|
this._serializedParams = in_params;
|
|
70
70
|
}
|
|
71
71
|
hasNestedProperties() {
|
|
72
|
-
return
|
|
72
|
+
return this.properties && this.properties.length > 0;
|
|
73
73
|
}
|
|
74
74
|
hasNestedConstants() {
|
|
75
|
-
return
|
|
75
|
+
return this.constants && this.constants.length > 0;
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* Internal function to recursivly traverse a property template and create dictionaries for found inline enums
|
|
@@ -81,7 +81,7 @@ class PropertyTemplate {
|
|
|
81
81
|
_digestNestedInlineEnumProperties(in_currentPropertyLevel) {
|
|
82
82
|
if (in_currentPropertyLevel.properties) {
|
|
83
83
|
for (var i = 0; i < in_currentPropertyLevel.properties.length; i++) {
|
|
84
|
-
if (in_currentPropertyLevel.properties[i].typeid ===
|
|
84
|
+
if (in_currentPropertyLevel.properties[i].typeid === "Enum") {
|
|
85
85
|
var dictionary = this._parseEnums(in_currentPropertyLevel.properties[i].properties);
|
|
86
86
|
in_currentPropertyLevel.properties[i]._enumDictionary = dictionary;
|
|
87
87
|
}
|
|
@@ -99,7 +99,11 @@ class PropertyTemplate {
|
|
|
99
99
|
* @return {{}} a dictionary [value->enum] and [enum->value]
|
|
100
100
|
*/
|
|
101
101
|
_parseEnums(in_enumProperties) {
|
|
102
|
-
var enumDictionary = {
|
|
102
|
+
var enumDictionary = {
|
|
103
|
+
enumEntriesById: {},
|
|
104
|
+
enumEntriesByValue: {},
|
|
105
|
+
defaultValue: undefined,
|
|
106
|
+
};
|
|
103
107
|
var minValue;
|
|
104
108
|
if (in_enumProperties.length !== 0) {
|
|
105
109
|
minValue = in_enumProperties[0].value;
|
|
@@ -109,11 +113,19 @@ class PropertyTemplate {
|
|
|
109
113
|
var value = enumEntry.value;
|
|
110
114
|
ConsoleUtils.assert(enumEntry.id, MSG.ENUM_TYPEID_MISSING);
|
|
111
115
|
ConsoleUtils.assert(!_.isNaN(enumEntry.value), MSG.ENUM_VALUE_NOT_NUMBER + value);
|
|
112
|
-
enumDictionary.enumEntriesById[enumEntry.id] = {
|
|
113
|
-
|
|
116
|
+
enumDictionary.enumEntriesById[enumEntry.id] = {
|
|
117
|
+
value: value,
|
|
118
|
+
annotation: enumEntry.annotation,
|
|
119
|
+
};
|
|
120
|
+
enumDictionary.enumEntriesByValue[value] = {
|
|
121
|
+
id: enumEntry.id,
|
|
122
|
+
annotation: enumEntry.annotation,
|
|
123
|
+
};
|
|
114
124
|
minValue = value < minValue ? value : minValue;
|
|
115
125
|
}
|
|
116
|
-
enumDictionary.defaultValue = enumDictionary.enumEntriesByValue.hasOwnProperty(0)
|
|
126
|
+
enumDictionary.defaultValue = enumDictionary.enumEntriesByValue.hasOwnProperty(0)
|
|
127
|
+
? 0
|
|
128
|
+
: minValue;
|
|
117
129
|
return enumDictionary;
|
|
118
130
|
}
|
|
119
131
|
/**
|
|
@@ -173,11 +185,12 @@ class PropertyTemplate {
|
|
|
173
185
|
in_preserve_ = in_preserve_ === undefined ? false : in_preserve_;
|
|
174
186
|
var target, copyMembers;
|
|
175
187
|
var copyDirectlyIntoKey = false;
|
|
176
|
-
if (in_target_ &&
|
|
177
|
-
(in_key_
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
188
|
+
if (in_target_ &&
|
|
189
|
+
(in_key_ === undefined ||
|
|
190
|
+
(in_key_ &&
|
|
191
|
+
in_target_.hasOwnProperty(in_key_) &&
|
|
192
|
+
_.isObject(in_target_[in_key_]) &&
|
|
193
|
+
in_preserve_))) {
|
|
181
194
|
// If no key is given, we directly copy into the
|
|
182
195
|
// target object. Additionally, when a key is given, the member already exists
|
|
183
196
|
// in the target object and preserve is set, we also keep the target object.
|
|
@@ -187,8 +200,8 @@ class PropertyTemplate {
|
|
|
187
200
|
if (_.isFunction(in_obj) ||
|
|
188
201
|
_.isDate(in_obj) ||
|
|
189
202
|
_.isRegExp(in_obj) ||
|
|
190
|
-
|
|
191
|
-
|
|
203
|
+
_.isObject(in_obj) !== _.isObject(target) ||
|
|
204
|
+
_.isArray(in_obj) !== _.isArray(target) ||
|
|
192
205
|
!_.isObject(target)) {
|
|
193
206
|
throw new TypeError(MSG.INVALID_TARGET_PROPERTY_TEMPLATE + this.typeid);
|
|
194
207
|
}
|
|
@@ -207,7 +220,7 @@ class PropertyTemplate {
|
|
|
207
220
|
target = new Date(in_obj.getTime());
|
|
208
221
|
}
|
|
209
222
|
else if (_.isRegExp(in_obj)) {
|
|
210
|
-
target = new RegExp(in_obj.source, in_obj.toString().replace(/.*\//,
|
|
223
|
+
target = new RegExp(in_obj.source, in_obj.toString().replace(/.*\//, ""));
|
|
211
224
|
// For objects and arrays we create a new object/array
|
|
212
225
|
}
|
|
213
226
|
else if (_.isObject(in_obj)) {
|
|
@@ -231,12 +244,16 @@ class PropertyTemplate {
|
|
|
231
244
|
this._canonicalForm(in_obj[key], target, key, in_preserve_);
|
|
232
245
|
}
|
|
233
246
|
// If context is array and length is absent set it to 0
|
|
234
|
-
if (_.includes(keys,
|
|
235
|
-
|
|
247
|
+
if (_.includes(keys, "context") &&
|
|
248
|
+
in_obj["context"] === "array" &&
|
|
249
|
+
!_.includes(keys, "length")) {
|
|
250
|
+
target["length"] = 0;
|
|
236
251
|
}
|
|
237
252
|
// If inherit value is present and is a single string convert it to single element array
|
|
238
|
-
if (_.includes(keys,
|
|
239
|
-
|
|
253
|
+
if (_.includes(keys, "inherits") &&
|
|
254
|
+
in_obj["inherits"] &&
|
|
255
|
+
!_.isObject(in_obj["inherits"])) {
|
|
256
|
+
target["inherits"] = [in_obj["inherits"]];
|
|
240
257
|
}
|
|
241
258
|
}
|
|
242
259
|
if (!in_key_) {
|
|
@@ -279,33 +296,33 @@ class PropertyTemplate {
|
|
|
279
296
|
}
|
|
280
297
|
}
|
|
281
298
|
/**
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
299
|
+
* Determines if the argument is a template structure
|
|
300
|
+
*
|
|
301
|
+
* @param {object} in_param - Parameter to assess
|
|
302
|
+
*
|
|
303
|
+
* @return {Boolean} true if in_param is a template
|
|
304
|
+
*
|
|
305
|
+
* @public
|
|
306
|
+
*/
|
|
290
307
|
static isTemplate(in_param) {
|
|
291
|
-
if (in_param.typeid && in_param.typeid.indexOf(
|
|
308
|
+
if (in_param.typeid && in_param.typeid.indexOf(":") !== -1) {
|
|
292
309
|
return true;
|
|
293
310
|
}
|
|
294
311
|
return false;
|
|
295
312
|
}
|
|
296
313
|
/**
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
314
|
+
* Extracts typeids directly referred to in a template
|
|
315
|
+
*
|
|
316
|
+
* @param {object} template - Structure from which to extract dependencies
|
|
317
|
+
*
|
|
318
|
+
* @return {Array} List of typeids this template refers directly to
|
|
319
|
+
*
|
|
320
|
+
* @public
|
|
321
|
+
*/
|
|
305
322
|
static extractDependencies(template) {
|
|
306
323
|
var dependencies = {};
|
|
307
324
|
if (template.inherits) {
|
|
308
|
-
var inherits =
|
|
325
|
+
var inherits = typeof template.inherits === "string" ? [template.inherits] : template.inherits;
|
|
309
326
|
for (var i = 0; i < inherits.length; i++) {
|
|
310
327
|
var elem = TypeIdHelper.extractTypeId(inherits[i]);
|
|
311
328
|
dependencies[elem] = true;
|
|
@@ -342,7 +359,9 @@ class PropertyTemplate {
|
|
|
342
359
|
var typeid = TypeIdHelper.extractTypeId(constant.typeid);
|
|
343
360
|
dependencies[typeid] = true;
|
|
344
361
|
}
|
|
345
|
-
else if (constant.context ===
|
|
362
|
+
else if (constant.context === "map" &&
|
|
363
|
+
constant.contextKeyType === "typeid" &&
|
|
364
|
+
constant.value) {
|
|
346
365
|
var keys = Object.keys(constant.value);
|
|
347
366
|
for (var k = 0; k < keys.length; k++) {
|
|
348
367
|
var typeid = TypeIdHelper.extractTypeId(keys[k]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTemplate.js","sourceRoot":"","sources":["../src/propertyTemplate.js"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH;;;GAGG;AACH,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AAC3E,MAAM,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACrD,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC;AACtC,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AAEzE,MAAa,gBAAgB;IACzB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,SAAS,GAAG,EAAE;QACtB,IAAI,MAAM,GAAG,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AC,CAAC;4BACxC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;yBAC1C;wBACD,cAAc;qBACjB;yBAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE;wBACnC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;wBAChD,WAAW;qBACd;yBAAM;wBACH,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;wBAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;4BAClC,IAAI,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;4BACjD,IAAI,MAAM,EAAE;gCACR,YAAY,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;6BAC/B;yBACJ;qBACJ;iBACJ;aACJ;SACJ;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACrC,CAAC;CACJ;AAxYD,4CAwYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Declaration of the PropertyTemplate module.\n * PropertyTemplate is used to describe a static property.\n */\nconst _ = require('lodash');\nconst { TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst fastestJSONCopy = require('fastest-json-copy');\nconst deepCopy = fastestJSONCopy.copy;\nconst { ConsoleUtils } = require('@fluid-experimental/property-common');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\n\nexport class PropertyTemplate {\n /**\n * Constructor for creating a PropertyTemplate based on the given parameters.\n * @param {object} in_params - List of parameters\n * @param {string} in_params.id - id of the property\n * @param {string} in_params.name - Name of the property\n * @param {string} in_params.typeid - The type identifier\n * @param {number=} [in_params.length=1] - The length of the property. Only valid if\n * the property is an array, otherwise the length defaults to 1\n * @param {string} in_params.context - The type of property this template represents\n * i.e. array, hash, etc.\n * @param {Array.<object>} in_params.properties - List of property templates that\n * are used to define children properties\n * @param {Array.<object>} in_params.constants - List of property templates that\n * are used to define constant properties and their values\n * @param {Array.<string>} in_params.inherits - List of property template typeids that this\n * PropertyTemplate inherits from\n *\n * @constructor\n * @protected\n * @category Properties\n */\n constructor(in_params = {}) {\n let params = deepCopy(in_params);\n /** The identifier of the property */\n this.id = params.id;\n /** The type identifier of the property */\n this.typeid = params.typeid;\n\n /** Size of the property (if this is an array) */\n if (params.context === 'array') {\n this.length = params.length !== undefined ? params.length : 0;\n } else {\n this.length = 1;\n }\n ConsoleUtils.assert(_.isNumber(this.length), MSG.LENGTH_MUST_BE_NUMBER + this.length);\n\n /** The context of the property */\n this.context = params.context;\n\n /** Array with sub-properties */\n this.properties = params.properties;\n\n /** The annotation object */\n this.annotation = params.annotation || {};\n\n /** Array with constant properties */\n this.constants = params.constants;\n\n /** Typeids of properties this property inherits from */\n this.inherits = _.isString(params.inherits) ? [params.inherits] : params.inherits;\n\n if (_.includes(this.inherits, 'Enum')) {\n this._enumDictionary = this._parseEnums(this.properties);\n }\n // check for inlined enums and parse them:\n this._digestNestedInlineEnumProperties(this);\n this._serializedParams = in_params;\n }\n\n hasNestedProperties() {\n return (this.properties && this.properties.length > 0);\n }\n\n hasNestedConstants() {\n return (this.constants && this.constants.length > 0);\n }\n\n /**\n * Internal function to recursivly traverse a property template and create dictionaries for found inline enums\n * @param {{}} in_currentPropertyLevel - The current level in the template hierarchie\n */\n _digestNestedInlineEnumProperties(in_currentPropertyLevel) {\n if (in_currentPropertyLevel.properties) {\n for (var i = 0; i < in_currentPropertyLevel.properties.length; i++) {\n if (in_currentPropertyLevel.properties[i].typeid === 'Enum') {\n var dictionary = this._parseEnums(in_currentPropertyLevel.properties[i].properties);\n in_currentPropertyLevel.properties[i]._enumDictionary = dictionary;\n } else if (in_currentPropertyLevel.properties[i].properties) {\n // call self\n this._digestNestedInlineEnumProperties(in_currentPropertyLevel.properties[i]);\n }\n }\n }\n }\n\n /**\n * read the enum types list of a template and create a dictionary [value->enum] and [enum->value] for it\n * to efficiently lookup enums/values when setting/getting them from the property\n * @param {Array} in_enumProperties - the list of enums and their values and annotations\n * @return {{}} a dictionary [value->enum] and [enum->value]\n */\n _parseEnums(in_enumProperties) {\n var enumDictionary = { enumEntriesById: {}, enumEntriesByValue: {}, defaultValue: undefined };\n var minValue;\n if (in_enumProperties.length !== 0) {\n minValue = in_enumProperties[0].value;\n }\n for (var i = 0; i < in_enumProperties.length; i++) {\n var enumEntry = in_enumProperties[i];\n var value = enumEntry.value;\n ConsoleUtils.assert(enumEntry.id, MSG.ENUM_TYPEID_MISSING);\n ConsoleUtils.assert(!_.isNaN(enumEntry.value), MSG.ENUM_VALUE_NOT_NUMBER + value);\n enumDictionary.enumEntriesById[enumEntry.id] = { value: value, annotation: enumEntry.annotation };\n enumDictionary.enumEntriesByValue[value] = { id: enumEntry.id, annotation: enumEntry.annotation };\n minValue = value < minValue ? value : minValue;\n }\n\n enumDictionary.defaultValue = enumDictionary.enumEntriesByValue.hasOwnProperty(0) ? 0 : minValue;\n\n return enumDictionary;\n }\n\n /**\n * Clones the PropertyTemplate\n *\n * @return {property-properties.PropertyTemplate} The cloned template\n */\n clone() {\n return new PropertyTemplate(deepCopy(this._serializedParams));\n }\n\n /**\n * Method used to check whether the template is versioned.\n * A versioned template is of the form `xxxx-1.0.0`\n * @return {boolean} Returns true if the template is versioned, false otherwise\n */\n _isVersioned() {\n var splitTypeId = TypeIdHelper.extractVersion(this.typeid);\n\n if (!splitTypeId.version) {\n return false;\n }\n\n var version = splitTypeId.version;\n\n return /^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/.test(version);\n }\n\n /**\n * Return the version number of the template.\n * @return {string} The version string is returned.\n */\n getVersion() {\n if (this._isVersioned()) {\n var splitTypeId = TypeIdHelper.extractVersion(this.typeid);\n var version = splitTypeId.version;\n return version;\n } else {\n console.warn(MSG.TEMPLATE_NOT_VERSIONED, this.typeid);\n return undefined;\n }\n }\n\n /**\n * Canonical representation of a PropertyTemplate.\n * This is similar to a deep copy but with adjustments so that the target is in\n * canonical form for a template property i.e. a) if array length\n * is not specified it is set to 0 in the target, b) string value\n * for 'inherits' property is converted to single-value array\n * Deep copy an object.\n *\n * @param {*} in_obj - The object to create a canonical copy of.\n * @param {Object|Array} [in_target_] - Copy into this object.\n * @param {string} [in_key_] - Key in in_target_ at which to place the copied object.\n * @param {boolean} [in_preserve_ = false] - Do not overwrite structs / arrays in an existing object\n *\n * @return {*} in_target_ if specified, new object containing canonical copy of @obj\n * otherwise.\n * @return {string} The version string is returned.\n */\n _canonicalForm(in_obj, in_target_, in_key_, in_preserve_) {\n in_preserve_ = in_preserve_ === undefined ? false : in_preserve_;\n\n var target, copyMembers;\n var copyDirectlyIntoKey = false;\n if (in_target_ && (in_key_ === undefined ||\n (in_key_ &&\n in_target_.hasOwnProperty(in_key_) &&\n _.isObject(in_target_[in_key_]) &&\n in_preserve_))) {\n // If no key is given, we directly copy into the\n // target object. Additionally, when a key is given, the member already exists\n // in the target object and preserve is set, we also keep the target object.\n // This is only possible if the target is already an\n // object.\n target = in_key_ ? in_target_[in_key_] : in_target_;\n\n if (_.isFunction(in_obj) ||\n _.isDate(in_obj) ||\n _.isRegExp(in_obj) ||\n (_.isObject(in_obj) !== _.isObject(target)) ||\n (_.isArray(in_obj) !== _.isArray(target)) ||\n !_.isObject(target)) {\n throw new TypeError(\n MSG.INVALID_TARGET_PROPERTY_TEMPLATE + this.typeid,\n );\n }\n copyMembers = true;\n copyDirectlyIntoKey = true;\n } else {\n // If no existing target object, we create a new object.\n\n // literals are directly assigned to the target\n if (!in_obj || !_.isObject(in_obj) || _.isFunction(in_obj)) {\n target = in_obj;\n // Special case handlers for dates and regexps\n // (https://github.com/jashkenas/underscore/pull/595)\n } else if (_.isDate(in_obj)) {\n target = new Date(in_obj.getTime());\n } else if (_.isRegExp(in_obj)) {\n target = new RegExp(in_obj.source, in_obj.toString().replace(/.*\\//, ''));\n // For objects and arrays we create a new object/array\n } else if (_.isObject(in_obj)) {\n target = _.isArray(in_obj) ? [] : {};\n copyMembers = true;\n } else {\n throw new TypeError(\n MSG.MISSING_CASE_IN_TEMPLATE_SERIALIZATION + this.typeid,\n );\n }\n }\n\n // If this is either an object or an array, we have to do a 'normalized' deep copy\n // and recursively copy all members. Normalized means the target will be a normalized\n // representation of the input property with respect to the canonical representation\n // of a template i.e. : if array length is not specified it is set to 0.\n // Other rules will follow\n if (copyMembers) {\n var keys = _.keys(in_obj);\n var l = keys.length;\n for (var i = 0; i < l; i++) {\n var key = keys[i];\n this._canonicalForm(in_obj[key], target, key, in_preserve_);\n }\n\n // If context is array and length is absent set it to 0\n if (_.includes(keys, 'context') && in_obj['context'] === 'array' && !_.includes(keys, 'length')) {\n target['length'] = 0;\n }\n\n // If inherit value is present and is a single string convert it to single element array\n if (_.includes(keys, 'inherits') && in_obj['inherits'] && !_.isObject(in_obj['inherits'])) {\n target['inherits'] = [in_obj['inherits']];\n }\n }\n\n if (!in_key_) {\n // If you don't give a path, then we return the original or copied object\n return target;\n } else if (!copyDirectlyIntoKey) {\n // If you give a path, we use the path as a key.\n in_target_[in_key_] = target;\n }\n\n return in_target_;\n }\n\n /**\n * Return the serialized parameters passed in the constructor\n * @return {object} Serialized parameters\n */\n serialize() {\n return deepCopy(this._serializedParams);\n }\n\n /**\n * Return the serialized parameters passed in the constructor, in a template canonical form\n * @return {object} canonical serialized parameters\n */\n serializeCanonical() {\n return PropertyTemplate.prototype._canonicalForm(this._serializedParams);\n }\n\n /**\n * Return the typeid of the template without the version number\n * i.e. autodesk.core:color instead of autodesk.core:color-1.0.0\n * @return {string} The typeid without the version is returned.\n * If the template is not versioned, the typeid is return.\n */\n getTypeidWithoutVersion() {\n if (this._isVersioned()) {\n var splitTypeId = TypeIdHelper.extractVersion(this.typeid);\n return splitTypeId.typeidWithoutVersion;\n } else {\n return this.typeid;\n }\n }\n\n /**\n * Determines if the argument is a template structure\n *\n * @param {object} in_param - Parameter to assess\n *\n * @return {Boolean} true if in_param is a template\n *\n * @public\n */\n static isTemplate(in_param) {\n if (in_param.typeid && in_param.typeid.indexOf(':') !== -1) {\n return true;\n }\n return false;\n }\n\n /**\n * Extracts typeids directly referred to in a template\n *\n * @param {object} template - Structure from which to extract dependencies\n *\n * @return {Array} List of typeids this template refers directly to\n *\n * @public\n */\n static extractDependencies(template) {\n var dependencies = {};\n\n if (template.inherits) {\n var inherits = (typeof template.inherits === 'string') ? [template.inherits] : template.inherits;\n for (var i = 0; i < inherits.length; i++) {\n var elem = TypeIdHelper.extractTypeId(inherits[i]);\n dependencies[elem] = true;\n }\n }\n\n if (template.properties) {\n var properties = template.properties;\n for (var i = 0; i < properties.length; i++) {\n var property = properties[i];\n if (PropertyTemplate.isTemplate(property)) {\n var typeid = TypeIdHelper.extractTypeId(property.typeid);\n dependencies[typeid] = true;\n\n if (property.typedValue) {\n for (var t = 0; t < property.typedValue.length; t++) {\n var typedValue = property.typedValue[t];\n dependencies[typedValue.typeid] = true;\n }\n }\n } else if (property.properties) {\n var deps = PropertyTemplate.extractDependencies(property);\n for (var j = 0; j < deps.length; j++) {\n var typeid = TypeIdHelper.extractTypeId(deps[j]);\n dependencies[typeid] = true;\n }\n }\n }\n }\n\n if (template.constants) {\n var constants = template.constants;\n for (var i = 0; i < constants.length; i++) {\n var constant = constants[i];\n if (PropertyTemplate.isTemplate(constant)) {\n var typeid = TypeIdHelper.extractTypeId(constant.typeid);\n dependencies[typeid] = true;\n } else if (constant.context === 'map' && constant.contextKeyType === 'typeid' && constant.value) {\n var keys = Object.keys(constant.value);\n for (var k = 0; k < keys.length; k++) {\n var typeid = TypeIdHelper.extractTypeId(keys[k]);\n dependencies[typeid] = true;\n }\n }\n\n // Search for typeid hidden in typedValue\n // the context could be inherited and therefore missing, so we have to try them all.\n if (constant.typedValue) {\n // for arrays\n if (_.isArray(constant.typedValue)) {\n for (var t = 0; t < constant.typedValue.length; t++) {\n var typedValue = constant.typedValue[t];\n dependencies[typedValue.typeid] = true;\n }\n // for singles\n } else if (constant.typedValue.typeid) {\n dependencies[constant.typedValue.typeid] = true;\n // for maps\n } else {\n var keys = Object.keys(constant.typedValue);\n for (var k = 0; k < keys.length; k++) {\n var typeid = constant.typedValue[keys[k]].typeid;\n if (typeid) {\n dependencies[typeid] = true;\n }\n }\n }\n }\n }\n }\n\n return Object.keys(dependencies);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"propertyTemplate.js","sourceRoot":"","sources":["../src/propertyTemplate.js"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH;;;GAGG;AACH,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AAC3E,MAAM,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACrD,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC;AACtC,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AAEzE,MAAa,gBAAgB;IAC5B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,SAAS,GAAG,EAAE;QACzB,IAAI,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;QACjC,qCAAqC;QACrC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACpB,0CAA0C;QAC1C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAE5B,iDAAiD;QACjD,IAAI,MAAM,CAAC,OAAO,KAAK,OAAO,EAAE;YAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,KAAK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GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;4BACrC,IAAI,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;4BACjD,IAAI,MAAM,EAAE;gCACX,YAAY,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;6BAC5B;yBACD;qBACD;iBACD;aACD;SACD;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;CACD;AApaD,4CAoaC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Declaration of the PropertyTemplate module.\n * PropertyTemplate is used to describe a static property.\n */\nconst _ = require(\"lodash\");\nconst { TypeIdHelper } = require(\"@fluid-experimental/property-changeset\");\nconst fastestJSONCopy = require(\"fastest-json-copy\");\nconst deepCopy = fastestJSONCopy.copy;\nconst { ConsoleUtils } = require(\"@fluid-experimental/property-common\");\nconst { MSG } = require(\"@fluid-experimental/property-common\").constants;\n\nexport class PropertyTemplate {\n\t/**\n\t * Constructor for creating a PropertyTemplate based on the given parameters.\n\t * @param {object} in_params - List of parameters\n\t * @param {string} in_params.id - id of the property\n\t * @param {string} in_params.name - Name of the property\n\t * @param {string} in_params.typeid - The type identifier\n\t * @param {number=} [in_params.length=1] - The length of the property. Only valid if\n\t * the property is an array, otherwise the length defaults to 1\n\t * @param {string} in_params.context - The type of property this template represents\n\t * i.e. array, hash, etc.\n\t * @param {Array.<object>} in_params.properties - List of property templates that\n\t * are used to define children properties\n\t * @param {Array.<object>} in_params.constants - List of property templates that\n\t * are used to define constant properties and their values\n\t * @param {Array.<string>} in_params.inherits - List of property template typeids that this\n\t * PropertyTemplate inherits from\n\t *\n\t * @constructor\n\t * @protected\n\t * @category Properties\n\t */\n\tconstructor(in_params = {}) {\n\t\tlet params = deepCopy(in_params);\n\t\t/** The identifier of the property */\n\t\tthis.id = params.id;\n\t\t/** The type identifier of the property */\n\t\tthis.typeid = params.typeid;\n\n\t\t/** Size of the property (if this is an array) */\n\t\tif (params.context === \"array\") {\n\t\t\tthis.length = params.length !== undefined ? params.length : 0;\n\t\t} else {\n\t\t\tthis.length = 1;\n\t\t}\n\t\tConsoleUtils.assert(_.isNumber(this.length), MSG.LENGTH_MUST_BE_NUMBER + this.length);\n\n\t\t/** The context of the property */\n\t\tthis.context = params.context;\n\n\t\t/** Array with sub-properties */\n\t\tthis.properties = params.properties;\n\n\t\t/** The annotation object */\n\t\tthis.annotation = params.annotation || {};\n\n\t\t/** Array with constant properties */\n\t\tthis.constants = params.constants;\n\n\t\t/** Typeids of properties this property inherits from */\n\t\tthis.inherits = _.isString(params.inherits) ? [params.inherits] : params.inherits;\n\n\t\tif (_.includes(this.inherits, \"Enum\")) {\n\t\t\tthis._enumDictionary = this._parseEnums(this.properties);\n\t\t}\n\t\t// check for inlined enums and parse them:\n\t\tthis._digestNestedInlineEnumProperties(this);\n\t\tthis._serializedParams = in_params;\n\t}\n\n\thasNestedProperties() {\n\t\treturn this.properties && this.properties.length > 0;\n\t}\n\n\thasNestedConstants() {\n\t\treturn this.constants && this.constants.length > 0;\n\t}\n\n\t/**\n\t * Internal function to recursivly traverse a property template and create dictionaries for found inline enums\n\t * @param {{}} in_currentPropertyLevel - The current level in the template hierarchie\n\t */\n\t_digestNestedInlineEnumProperties(in_currentPropertyLevel) {\n\t\tif (in_currentPropertyLevel.properties) {\n\t\t\tfor (var i = 0; i < in_currentPropertyLevel.properties.length; i++) {\n\t\t\t\tif (in_currentPropertyLevel.properties[i].typeid === \"Enum\") {\n\t\t\t\t\tvar dictionary = this._parseEnums(\n\t\t\t\t\t\tin_currentPropertyLevel.properties[i].properties,\n\t\t\t\t\t);\n\t\t\t\t\tin_currentPropertyLevel.properties[i]._enumDictionary = dictionary;\n\t\t\t\t} else if (in_currentPropertyLevel.properties[i].properties) {\n\t\t\t\t\t// call self\n\t\t\t\t\tthis._digestNestedInlineEnumProperties(in_currentPropertyLevel.properties[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * read the enum types list of a template and create a dictionary [value->enum] and [enum->value] for it\n\t * to efficiently lookup enums/values when setting/getting them from the property\n\t * @param {Array} in_enumProperties - the list of enums and their values and annotations\n\t * @return {{}} a dictionary [value->enum] and [enum->value]\n\t */\n\t_parseEnums(in_enumProperties) {\n\t\tvar enumDictionary = {\n\t\t\tenumEntriesById: {},\n\t\t\tenumEntriesByValue: {},\n\t\t\tdefaultValue: undefined,\n\t\t};\n\t\tvar minValue;\n\t\tif (in_enumProperties.length !== 0) {\n\t\t\tminValue = in_enumProperties[0].value;\n\t\t}\n\t\tfor (var i = 0; i < in_enumProperties.length; i++) {\n\t\t\tvar enumEntry = in_enumProperties[i];\n\t\t\tvar value = enumEntry.value;\n\t\t\tConsoleUtils.assert(enumEntry.id, MSG.ENUM_TYPEID_MISSING);\n\t\t\tConsoleUtils.assert(!_.isNaN(enumEntry.value), MSG.ENUM_VALUE_NOT_NUMBER + value);\n\t\t\tenumDictionary.enumEntriesById[enumEntry.id] = {\n\t\t\t\tvalue: value,\n\t\t\t\tannotation: enumEntry.annotation,\n\t\t\t};\n\t\t\tenumDictionary.enumEntriesByValue[value] = {\n\t\t\t\tid: enumEntry.id,\n\t\t\t\tannotation: enumEntry.annotation,\n\t\t\t};\n\t\t\tminValue = value < minValue ? value : minValue;\n\t\t}\n\n\t\tenumDictionary.defaultValue = enumDictionary.enumEntriesByValue.hasOwnProperty(0)\n\t\t\t? 0\n\t\t\t: minValue;\n\n\t\treturn enumDictionary;\n\t}\n\n\t/**\n\t * Clones the PropertyTemplate\n\t *\n\t * @return {property-properties.PropertyTemplate} The cloned template\n\t */\n\tclone() {\n\t\treturn new PropertyTemplate(deepCopy(this._serializedParams));\n\t}\n\n\t/**\n\t * Method used to check whether the template is versioned.\n\t * A versioned template is of the form `xxxx-1.0.0`\n\t * @return {boolean} Returns true if the template is versioned, false otherwise\n\t */\n\t_isVersioned() {\n\t\tvar splitTypeId = TypeIdHelper.extractVersion(this.typeid);\n\n\t\tif (!splitTypeId.version) {\n\t\t\treturn false;\n\t\t}\n\n\t\tvar version = splitTypeId.version;\n\n\t\treturn /^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/.test(version);\n\t}\n\n\t/**\n\t * Return the version number of the template.\n\t * @return {string} The version string is returned.\n\t */\n\tgetVersion() {\n\t\tif (this._isVersioned()) {\n\t\t\tvar splitTypeId = TypeIdHelper.extractVersion(this.typeid);\n\t\t\tvar version = splitTypeId.version;\n\t\t\treturn version;\n\t\t} else {\n\t\t\tconsole.warn(MSG.TEMPLATE_NOT_VERSIONED, this.typeid);\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Canonical representation of a PropertyTemplate.\n\t * This is similar to a deep copy but with adjustments so that the target is in\n\t * canonical form for a template property i.e. a) if array length\n\t * is not specified it is set to 0 in the target, b) string value\n\t * for 'inherits' property is converted to single-value array\n\t * Deep copy an object.\n\t *\n\t * @param {*} in_obj - The object to create a canonical copy of.\n\t * @param {Object|Array} [in_target_] - Copy into this object.\n\t * @param {string} [in_key_] - Key in in_target_ at which to place the copied object.\n\t * @param {boolean} [in_preserve_ = false] - Do not overwrite structs / arrays in an existing object\n\t *\n\t * @return {*} in_target_ if specified, new object containing canonical copy of @obj\n\t * otherwise.\n\t * @return {string} The version string is returned.\n\t */\n\t_canonicalForm(in_obj, in_target_, in_key_, in_preserve_) {\n\t\tin_preserve_ = in_preserve_ === undefined ? false : in_preserve_;\n\n\t\tvar target, copyMembers;\n\t\tvar copyDirectlyIntoKey = false;\n\t\tif (\n\t\t\tin_target_ &&\n\t\t\t(in_key_ === undefined ||\n\t\t\t\t(in_key_ &&\n\t\t\t\t\tin_target_.hasOwnProperty(in_key_) &&\n\t\t\t\t\t_.isObject(in_target_[in_key_]) &&\n\t\t\t\t\tin_preserve_))\n\t\t) {\n\t\t\t// If no key is given, we directly copy into the\n\t\t\t// target object. Additionally, when a key is given, the member already exists\n\t\t\t// in the target object and preserve is set, we also keep the target object.\n\t\t\t// This is only possible if the target is already an\n\t\t\t// object.\n\t\t\ttarget = in_key_ ? in_target_[in_key_] : in_target_;\n\n\t\t\tif (\n\t\t\t\t_.isFunction(in_obj) ||\n\t\t\t\t_.isDate(in_obj) ||\n\t\t\t\t_.isRegExp(in_obj) ||\n\t\t\t\t_.isObject(in_obj) !== _.isObject(target) ||\n\t\t\t\t_.isArray(in_obj) !== _.isArray(target) ||\n\t\t\t\t!_.isObject(target)\n\t\t\t) {\n\t\t\t\tthrow new TypeError(MSG.INVALID_TARGET_PROPERTY_TEMPLATE + this.typeid);\n\t\t\t}\n\t\t\tcopyMembers = true;\n\t\t\tcopyDirectlyIntoKey = true;\n\t\t} else {\n\t\t\t// If no existing target object, we create a new object.\n\n\t\t\t// literals are directly assigned to the target\n\t\t\tif (!in_obj || !_.isObject(in_obj) || _.isFunction(in_obj)) {\n\t\t\t\ttarget = in_obj;\n\t\t\t\t// Special case handlers for dates and regexps\n\t\t\t\t// (https://github.com/jashkenas/underscore/pull/595)\n\t\t\t} else if (_.isDate(in_obj)) {\n\t\t\t\ttarget = new Date(in_obj.getTime());\n\t\t\t} else if (_.isRegExp(in_obj)) {\n\t\t\t\ttarget = new RegExp(in_obj.source, in_obj.toString().replace(/.*\\//, \"\"));\n\t\t\t\t// For objects and arrays we create a new object/array\n\t\t\t} else if (_.isObject(in_obj)) {\n\t\t\t\ttarget = _.isArray(in_obj) ? [] : {};\n\t\t\t\tcopyMembers = true;\n\t\t\t} else {\n\t\t\t\tthrow new TypeError(MSG.MISSING_CASE_IN_TEMPLATE_SERIALIZATION + this.typeid);\n\t\t\t}\n\t\t}\n\n\t\t// If this is either an object or an array, we have to do a 'normalized' deep copy\n\t\t// and recursively copy all members. Normalized means the target will be a normalized\n\t\t// representation of the input property with respect to the canonical representation\n\t\t// of a template i.e. : if array length is not specified it is set to 0.\n\t\t// Other rules will follow\n\t\tif (copyMembers) {\n\t\t\tvar keys = _.keys(in_obj);\n\t\t\tvar l = keys.length;\n\t\t\tfor (var i = 0; i < l; i++) {\n\t\t\t\tvar key = keys[i];\n\t\t\t\tthis._canonicalForm(in_obj[key], target, key, in_preserve_);\n\t\t\t}\n\n\t\t\t// If context is array and length is absent set it to 0\n\t\t\tif (\n\t\t\t\t_.includes(keys, \"context\") &&\n\t\t\t\tin_obj[\"context\"] === \"array\" &&\n\t\t\t\t!_.includes(keys, \"length\")\n\t\t\t) {\n\t\t\t\ttarget[\"length\"] = 0;\n\t\t\t}\n\n\t\t\t// If inherit value is present and is a single string convert it to single element array\n\t\t\tif (\n\t\t\t\t_.includes(keys, \"inherits\") &&\n\t\t\t\tin_obj[\"inherits\"] &&\n\t\t\t\t!_.isObject(in_obj[\"inherits\"])\n\t\t\t) {\n\t\t\t\ttarget[\"inherits\"] = [in_obj[\"inherits\"]];\n\t\t\t}\n\t\t}\n\n\t\tif (!in_key_) {\n\t\t\t// If you don't give a path, then we return the original or copied object\n\t\t\treturn target;\n\t\t} else if (!copyDirectlyIntoKey) {\n\t\t\t// If you give a path, we use the path as a key.\n\t\t\tin_target_[in_key_] = target;\n\t\t}\n\n\t\treturn in_target_;\n\t}\n\n\t/**\n\t * Return the serialized parameters passed in the constructor\n\t * @return {object} Serialized parameters\n\t */\n\tserialize() {\n\t\treturn deepCopy(this._serializedParams);\n\t}\n\n\t/**\n\t * Return the serialized parameters passed in the constructor, in a template canonical form\n\t * @return {object} canonical serialized parameters\n\t */\n\tserializeCanonical() {\n\t\treturn PropertyTemplate.prototype._canonicalForm(this._serializedParams);\n\t}\n\n\t/**\n\t * Return the typeid of the template without the version number\n\t * i.e. autodesk.core:color instead of autodesk.core:color-1.0.0\n\t * @return {string} The typeid without the version is returned.\n\t * If the template is not versioned, the typeid is return.\n\t */\n\tgetTypeidWithoutVersion() {\n\t\tif (this._isVersioned()) {\n\t\t\tvar splitTypeId = TypeIdHelper.extractVersion(this.typeid);\n\t\t\treturn splitTypeId.typeidWithoutVersion;\n\t\t} else {\n\t\t\treturn this.typeid;\n\t\t}\n\t}\n\n\t/**\n\t * Determines if the argument is a template structure\n\t *\n\t * @param {object} in_param - Parameter to assess\n\t *\n\t * @return {Boolean} true if in_param is a template\n\t *\n\t * @public\n\t */\n\tstatic isTemplate(in_param) {\n\t\tif (in_param.typeid && in_param.typeid.indexOf(\":\") !== -1) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Extracts typeids directly referred to in a template\n\t *\n\t * @param {object} template - Structure from which to extract dependencies\n\t *\n\t * @return {Array} List of typeids this template refers directly to\n\t *\n\t * @public\n\t */\n\tstatic extractDependencies(template) {\n\t\tvar dependencies = {};\n\n\t\tif (template.inherits) {\n\t\t\tvar inherits =\n\t\t\t\ttypeof template.inherits === \"string\" ? [template.inherits] : template.inherits;\n\t\t\tfor (var i = 0; i < inherits.length; i++) {\n\t\t\t\tvar elem = TypeIdHelper.extractTypeId(inherits[i]);\n\t\t\t\tdependencies[elem] = true;\n\t\t\t}\n\t\t}\n\n\t\tif (template.properties) {\n\t\t\tvar properties = template.properties;\n\t\t\tfor (var i = 0; i < properties.length; i++) {\n\t\t\t\tvar property = properties[i];\n\t\t\t\tif (PropertyTemplate.isTemplate(property)) {\n\t\t\t\t\tvar typeid = TypeIdHelper.extractTypeId(property.typeid);\n\t\t\t\t\tdependencies[typeid] = true;\n\n\t\t\t\t\tif (property.typedValue) {\n\t\t\t\t\t\tfor (var t = 0; t < property.typedValue.length; t++) {\n\t\t\t\t\t\t\tvar typedValue = property.typedValue[t];\n\t\t\t\t\t\t\tdependencies[typedValue.typeid] = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (property.properties) {\n\t\t\t\t\tvar deps = PropertyTemplate.extractDependencies(property);\n\t\t\t\t\tfor (var j = 0; j < deps.length; j++) {\n\t\t\t\t\t\tvar typeid = TypeIdHelper.extractTypeId(deps[j]);\n\t\t\t\t\t\tdependencies[typeid] = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (template.constants) {\n\t\t\tvar constants = template.constants;\n\t\t\tfor (var i = 0; i < constants.length; i++) {\n\t\t\t\tvar constant = constants[i];\n\t\t\t\tif (PropertyTemplate.isTemplate(constant)) {\n\t\t\t\t\tvar typeid = TypeIdHelper.extractTypeId(constant.typeid);\n\t\t\t\t\tdependencies[typeid] = true;\n\t\t\t\t} else if (\n\t\t\t\t\tconstant.context === \"map\" &&\n\t\t\t\t\tconstant.contextKeyType === \"typeid\" &&\n\t\t\t\t\tconstant.value\n\t\t\t\t) {\n\t\t\t\t\tvar keys = Object.keys(constant.value);\n\t\t\t\t\tfor (var k = 0; k < keys.length; k++) {\n\t\t\t\t\t\tvar typeid = TypeIdHelper.extractTypeId(keys[k]);\n\t\t\t\t\t\tdependencies[typeid] = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Search for typeid hidden in typedValue\n\t\t\t\t// the context could be inherited and therefore missing, so we have to try them all.\n\t\t\t\tif (constant.typedValue) {\n\t\t\t\t\t// for arrays\n\t\t\t\t\tif (_.isArray(constant.typedValue)) {\n\t\t\t\t\t\tfor (var t = 0; t < constant.typedValue.length; t++) {\n\t\t\t\t\t\t\tvar typedValue = constant.typedValue[t];\n\t\t\t\t\t\t\tdependencies[typedValue.typeid] = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// for singles\n\t\t\t\t\t} else if (constant.typedValue.typeid) {\n\t\t\t\t\t\tdependencies[constant.typedValue.typeid] = true;\n\t\t\t\t\t\t// for maps\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar keys = Object.keys(constant.typedValue);\n\t\t\t\t\t\tfor (var k = 0; k < keys.length; k++) {\n\t\t\t\t\t\t\tvar typeid = constant.typedValue[keys[k]].typeid;\n\t\t\t\t\t\t\tif (typeid) {\n\t\t\t\t\t\t\t\tdependencies[typeid] = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn Object.keys(dependencies);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyTemplateWrapper.d.ts","sourceRoot":"","sources":["../src/propertyTemplateWrapper.js"],"names":[],"mappings":"AA4BA;
|
|
1
|
+
{"version":3,"file":"propertyTemplateWrapper.d.ts","sourceRoot":"","sources":["../src/propertyTemplateWrapper.js"],"names":[],"mappings":"AA4BA;IACC;;;;;;;;;OASG;IACH,2DAPW,MAAM,EAsBhB;IAdA,oDAAoD;IACpD,oCAA0C;IAE1C;;;OAGG;IACH,+BAA0C;IAG1C,4BAAoC;IAGpC,eAAsB;IAGvB;;;;OAIG;IACH,gCAEC;IAED;;;;;;;OAOG;IACH,uDAKC;IAED;;;;OAIG;IACH,uBAHY,OAAO,CAKlB;IAED;;;;OAIG;IACH,mBAHY,MAAM,CAKjB;IAED;;;;;;OAMG;IACH,2BAHW,MAAM,QA2BhB;IAED;;;;;;;OAOG;IACH,6DAkIC;IAED;;;;;;OAMG;IACH,iCAJW,MAAM,qBACN,MAAM,QA+EhB;CACD"}
|
|
@@ -9,14 +9,14 @@ exports.PropertyTemplateWrapper = void 0;
|
|
|
9
9
|
* @fileoverview Declaration of the PropertyTemplateWrapper module.
|
|
10
10
|
* PropertyTemplateWrapper is used to wrap a property template and perform internal optimizations.
|
|
11
11
|
*/
|
|
12
|
-
const { MSG } = require(
|
|
13
|
-
const _ = require(
|
|
14
|
-
const { ContainerProperty } = require(
|
|
12
|
+
const { MSG } = require("@fluid-experimental/property-common").constants;
|
|
13
|
+
const _ = require("lodash");
|
|
14
|
+
const { ContainerProperty } = require("./properties/containerProperty");
|
|
15
15
|
const reservedTypesWithoutTemplates = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
BaseProperty: true,
|
|
17
|
+
ContainerProperty: true,
|
|
18
|
+
NodeProperty: true,
|
|
19
|
+
Enum: true,
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
22
|
* Utility function that validates if the typeid is a reserved type without a template.
|
|
@@ -98,7 +98,14 @@ class PropertyTemplateWrapper {
|
|
|
98
98
|
setCreationType(in_typeid) {
|
|
99
99
|
// This function could be moved somewhere else, an enum could be made if this information is widely needed.
|
|
100
100
|
const isCreationType = (typeid) => {
|
|
101
|
-
const creationTypes = [
|
|
101
|
+
const creationTypes = [
|
|
102
|
+
"ContainerProperty",
|
|
103
|
+
"NodeProperty",
|
|
104
|
+
"Enum",
|
|
105
|
+
"BinaryProperty",
|
|
106
|
+
"Binary",
|
|
107
|
+
"RepositoryReferenceProperty",
|
|
108
|
+
];
|
|
102
109
|
return creationTypes.includes(typeid);
|
|
103
110
|
};
|
|
104
111
|
if (isCreationType(in_typeid)) {
|
|
@@ -107,7 +114,7 @@ class PropertyTemplateWrapper {
|
|
|
107
114
|
this._objectCreationType = in_typeid;
|
|
108
115
|
}
|
|
109
116
|
else if (currentCreationType !== in_typeid) {
|
|
110
|
-
throw new Error(MSG.ONLY_ONE_CREATION_TYPE + currentCreationType +
|
|
117
|
+
throw new Error(MSG.ONLY_ONE_CREATION_TYPE + currentCreationType + ", " + in_typeid);
|
|
111
118
|
}
|
|
112
119
|
}
|
|
113
120
|
}
|
|
@@ -128,7 +135,7 @@ class PropertyTemplateWrapper {
|
|
|
128
135
|
}
|
|
129
136
|
let parentTemplateIds = originalTemplate.inherits;
|
|
130
137
|
/* template.inherits can be a string, if so convert it to array of strings */
|
|
131
|
-
if (typeof parentTemplateIds ===
|
|
138
|
+
if (typeof parentTemplateIds === "string") {
|
|
132
139
|
parentTemplateIds = [parentTemplateIds];
|
|
133
140
|
}
|
|
134
141
|
/* Cloning the original template to avoid modifying it */
|
|
@@ -147,7 +154,7 @@ class PropertyTemplateWrapper {
|
|
|
147
154
|
if (parentTemplateWrapper) {
|
|
148
155
|
const parentTemplate = parentTemplateWrapper.getCompiledTemplate(in_propertyFactory);
|
|
149
156
|
const parentCreationType = parentTemplateWrapper.getCreationType();
|
|
150
|
-
if (parentCreationType !==
|
|
157
|
+
if (parentCreationType !== "ContainerProperty") {
|
|
151
158
|
this.setCreationType(parentCreationType);
|
|
152
159
|
}
|
|
153
160
|
if (parentTemplate.inherits) {
|
|
@@ -159,7 +166,8 @@ class PropertyTemplateWrapper {
|
|
|
159
166
|
for (let j = 0; j < parentProperties.length; ++j) {
|
|
160
167
|
const parentProperty = parentProperties[j];
|
|
161
168
|
/* Two parents has child property with same id */
|
|
162
|
-
if (parentsPropertiesById[parentProperty.id] ||
|
|
169
|
+
if (parentsPropertiesById[parentProperty.id] ||
|
|
170
|
+
parentsConstantsById[parentProperty.id]) {
|
|
163
171
|
throw new Error(MSG.OVERWRITING_ID + parentProperty.id);
|
|
164
172
|
}
|
|
165
173
|
parentsPropertiesById[parentProperty.id] = parentProperty;
|
|
@@ -171,7 +179,8 @@ class PropertyTemplateWrapper {
|
|
|
171
179
|
for (let j = 0; j < parentConstants.length; ++j) {
|
|
172
180
|
const parentConstant = parentConstants[j];
|
|
173
181
|
/* Two parents has child property with same id */
|
|
174
|
-
if (parentsConstantsById[parentConstant.id] ||
|
|
182
|
+
if (parentsConstantsById[parentConstant.id] ||
|
|
183
|
+
parentsPropertiesById[parentConstant.id]) {
|
|
175
184
|
throw new Error(MSG.OVERWRITING_ID + parentConstant.id);
|
|
176
185
|
}
|
|
177
186
|
parentsConstantsById[parentConstant.id] = parentConstant;
|
|
@@ -182,7 +191,7 @@ class PropertyTemplateWrapper {
|
|
|
182
191
|
}
|
|
183
192
|
}
|
|
184
193
|
if (this._objectCreationType === undefined) {
|
|
185
|
-
this.setCreationType(
|
|
194
|
+
this.setCreationType("ContainerProperty");
|
|
186
195
|
}
|
|
187
196
|
/* Merges properties from parents into the properties of the child */
|
|
188
197
|
const constructSubProperties = (in_template, in_parentsPropertiesById, fieldName) => {
|
|
@@ -209,8 +218,8 @@ class PropertyTemplateWrapper {
|
|
|
209
218
|
template[fieldName] = properties;
|
|
210
219
|
}
|
|
211
220
|
};
|
|
212
|
-
constructSubProperties(template, parentsPropertiesById,
|
|
213
|
-
constructSubProperties(template, parentsConstantsById,
|
|
221
|
+
constructSubProperties(template, parentsPropertiesById, "properties");
|
|
222
|
+
constructSubProperties(template, parentsConstantsById, "constants");
|
|
214
223
|
if (typeInheritence.length > 0) {
|
|
215
224
|
template.inherits = typeInheritence;
|
|
216
225
|
}
|
|
@@ -232,15 +241,21 @@ class PropertyTemplateWrapper {
|
|
|
232
241
|
}
|
|
233
242
|
else if (child[fieldName] !== parent[fieldName] &&
|
|
234
243
|
(child[fieldName] !== defaultValue || parent[fieldName] !== undefined)) {
|
|
235
|
-
throw new Error(MSG.OVERRIDEN_PROP_MUST_HAVE_SAME_FIELD_VALUES_AS_BASE_TYPE +
|
|
236
|
-
|
|
244
|
+
throw new Error(MSG.OVERRIDEN_PROP_MUST_HAVE_SAME_FIELD_VALUES_AS_BASE_TYPE +
|
|
245
|
+
fieldName +
|
|
246
|
+
" as the base type: " +
|
|
247
|
+
child.id +
|
|
248
|
+
": " +
|
|
249
|
+
child[fieldName] +
|
|
250
|
+
" != " +
|
|
251
|
+
parent[fieldName]);
|
|
237
252
|
}
|
|
238
253
|
};
|
|
239
|
-
mergeField(in_childProperty, in_parentProperty,
|
|
240
|
-
mergeField(in_childProperty, in_parentProperty,
|
|
241
|
-
mergeField(in_childProperty, in_parentProperty,
|
|
242
|
-
mergeField(in_childProperty, in_parentProperty,
|
|
243
|
-
mergeField(in_childProperty, in_parentProperty,
|
|
254
|
+
mergeField(in_childProperty, in_parentProperty, "context", "single");
|
|
255
|
+
mergeField(in_childProperty, in_parentProperty, "contextKeyType", "string");
|
|
256
|
+
mergeField(in_childProperty, in_parentProperty, "length", 0);
|
|
257
|
+
mergeField(in_childProperty, in_parentProperty, "optional", false);
|
|
258
|
+
mergeField(in_childProperty, in_parentProperty, "typeid", undefined);
|
|
244
259
|
if (in_parentProperty.typedValue !== undefined) {
|
|
245
260
|
if (in_childProperty.typedValue === undefined) {
|
|
246
261
|
in_childProperty.typedValue = in_parentProperty.typedValue;
|
|
@@ -280,8 +295,8 @@ class PropertyTemplateWrapper {
|
|
|
280
295
|
child[fieldName] = properties;
|
|
281
296
|
}
|
|
282
297
|
};
|
|
283
|
-
mergeSubProperties(in_childProperty, in_parentProperty,
|
|
284
|
-
mergeSubProperties(in_childProperty, in_parentProperty,
|
|
298
|
+
mergeSubProperties(in_childProperty, in_parentProperty, "properties");
|
|
299
|
+
mergeSubProperties(in_childProperty, in_parentProperty, "constants");
|
|
285
300
|
}
|
|
286
301
|
}
|
|
287
302
|
exports.PropertyTemplateWrapper = PropertyTemplateWrapper;
|