@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/lib/propertyTemplate.js
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
* @fileoverview Declaration of the PropertyTemplate module.
|
|
7
7
|
* PropertyTemplate is used to describe a static property.
|
|
8
8
|
*/
|
|
9
|
-
const _ = require(
|
|
10
|
-
const { TypeIdHelper } = require(
|
|
11
|
-
const fastestJSONCopy = require(
|
|
9
|
+
const _ = require("lodash");
|
|
10
|
+
const { TypeIdHelper } = require("@fluid-experimental/property-changeset");
|
|
11
|
+
const fastestJSONCopy = require("fastest-json-copy");
|
|
12
12
|
const deepCopy = fastestJSONCopy.copy;
|
|
13
|
-
const { ConsoleUtils } = require(
|
|
14
|
-
const { MSG } = require(
|
|
13
|
+
const { ConsoleUtils } = require("@fluid-experimental/property-common");
|
|
14
|
+
const { MSG } = require("@fluid-experimental/property-common").constants;
|
|
15
15
|
export class PropertyTemplate {
|
|
16
16
|
/**
|
|
17
17
|
* Constructor for creating a PropertyTemplate based on the given parameters.
|
|
@@ -41,7 +41,7 @@ export class PropertyTemplate {
|
|
|
41
41
|
/** The type identifier of the property */
|
|
42
42
|
this.typeid = params.typeid;
|
|
43
43
|
/** Size of the property (if this is an array) */
|
|
44
|
-
if (params.context ===
|
|
44
|
+
if (params.context === "array") {
|
|
45
45
|
this.length = params.length !== undefined ? params.length : 0;
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
@@ -58,7 +58,7 @@ export class PropertyTemplate {
|
|
|
58
58
|
this.constants = params.constants;
|
|
59
59
|
/** Typeids of properties this property inherits from */
|
|
60
60
|
this.inherits = _.isString(params.inherits) ? [params.inherits] : params.inherits;
|
|
61
|
-
if (_.includes(this.inherits,
|
|
61
|
+
if (_.includes(this.inherits, "Enum")) {
|
|
62
62
|
this._enumDictionary = this._parseEnums(this.properties);
|
|
63
63
|
}
|
|
64
64
|
// check for inlined enums and parse them:
|
|
@@ -66,10 +66,10 @@ export class PropertyTemplate {
|
|
|
66
66
|
this._serializedParams = in_params;
|
|
67
67
|
}
|
|
68
68
|
hasNestedProperties() {
|
|
69
|
-
return
|
|
69
|
+
return this.properties && this.properties.length > 0;
|
|
70
70
|
}
|
|
71
71
|
hasNestedConstants() {
|
|
72
|
-
return
|
|
72
|
+
return this.constants && this.constants.length > 0;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Internal function to recursivly traverse a property template and create dictionaries for found inline enums
|
|
@@ -78,7 +78,7 @@ export class PropertyTemplate {
|
|
|
78
78
|
_digestNestedInlineEnumProperties(in_currentPropertyLevel) {
|
|
79
79
|
if (in_currentPropertyLevel.properties) {
|
|
80
80
|
for (var i = 0; i < in_currentPropertyLevel.properties.length; i++) {
|
|
81
|
-
if (in_currentPropertyLevel.properties[i].typeid ===
|
|
81
|
+
if (in_currentPropertyLevel.properties[i].typeid === "Enum") {
|
|
82
82
|
var dictionary = this._parseEnums(in_currentPropertyLevel.properties[i].properties);
|
|
83
83
|
in_currentPropertyLevel.properties[i]._enumDictionary = dictionary;
|
|
84
84
|
}
|
|
@@ -96,7 +96,11 @@ export class PropertyTemplate {
|
|
|
96
96
|
* @return {{}} a dictionary [value->enum] and [enum->value]
|
|
97
97
|
*/
|
|
98
98
|
_parseEnums(in_enumProperties) {
|
|
99
|
-
var enumDictionary = {
|
|
99
|
+
var enumDictionary = {
|
|
100
|
+
enumEntriesById: {},
|
|
101
|
+
enumEntriesByValue: {},
|
|
102
|
+
defaultValue: undefined,
|
|
103
|
+
};
|
|
100
104
|
var minValue;
|
|
101
105
|
if (in_enumProperties.length !== 0) {
|
|
102
106
|
minValue = in_enumProperties[0].value;
|
|
@@ -106,11 +110,19 @@ export class PropertyTemplate {
|
|
|
106
110
|
var value = enumEntry.value;
|
|
107
111
|
ConsoleUtils.assert(enumEntry.id, MSG.ENUM_TYPEID_MISSING);
|
|
108
112
|
ConsoleUtils.assert(!_.isNaN(enumEntry.value), MSG.ENUM_VALUE_NOT_NUMBER + value);
|
|
109
|
-
enumDictionary.enumEntriesById[enumEntry.id] = {
|
|
110
|
-
|
|
113
|
+
enumDictionary.enumEntriesById[enumEntry.id] = {
|
|
114
|
+
value: value,
|
|
115
|
+
annotation: enumEntry.annotation,
|
|
116
|
+
};
|
|
117
|
+
enumDictionary.enumEntriesByValue[value] = {
|
|
118
|
+
id: enumEntry.id,
|
|
119
|
+
annotation: enumEntry.annotation,
|
|
120
|
+
};
|
|
111
121
|
minValue = value < minValue ? value : minValue;
|
|
112
122
|
}
|
|
113
|
-
enumDictionary.defaultValue = enumDictionary.enumEntriesByValue.hasOwnProperty(0)
|
|
123
|
+
enumDictionary.defaultValue = enumDictionary.enumEntriesByValue.hasOwnProperty(0)
|
|
124
|
+
? 0
|
|
125
|
+
: minValue;
|
|
114
126
|
return enumDictionary;
|
|
115
127
|
}
|
|
116
128
|
/**
|
|
@@ -170,11 +182,12 @@ export class PropertyTemplate {
|
|
|
170
182
|
in_preserve_ = in_preserve_ === undefined ? false : in_preserve_;
|
|
171
183
|
var target, copyMembers;
|
|
172
184
|
var copyDirectlyIntoKey = false;
|
|
173
|
-
if (in_target_ &&
|
|
174
|
-
(in_key_
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
185
|
+
if (in_target_ &&
|
|
186
|
+
(in_key_ === undefined ||
|
|
187
|
+
(in_key_ &&
|
|
188
|
+
in_target_.hasOwnProperty(in_key_) &&
|
|
189
|
+
_.isObject(in_target_[in_key_]) &&
|
|
190
|
+
in_preserve_))) {
|
|
178
191
|
// If no key is given, we directly copy into the
|
|
179
192
|
// target object. Additionally, when a key is given, the member already exists
|
|
180
193
|
// in the target object and preserve is set, we also keep the target object.
|
|
@@ -184,8 +197,8 @@ export class PropertyTemplate {
|
|
|
184
197
|
if (_.isFunction(in_obj) ||
|
|
185
198
|
_.isDate(in_obj) ||
|
|
186
199
|
_.isRegExp(in_obj) ||
|
|
187
|
-
|
|
188
|
-
|
|
200
|
+
_.isObject(in_obj) !== _.isObject(target) ||
|
|
201
|
+
_.isArray(in_obj) !== _.isArray(target) ||
|
|
189
202
|
!_.isObject(target)) {
|
|
190
203
|
throw new TypeError(MSG.INVALID_TARGET_PROPERTY_TEMPLATE + this.typeid);
|
|
191
204
|
}
|
|
@@ -204,7 +217,7 @@ export class PropertyTemplate {
|
|
|
204
217
|
target = new Date(in_obj.getTime());
|
|
205
218
|
}
|
|
206
219
|
else if (_.isRegExp(in_obj)) {
|
|
207
|
-
target = new RegExp(in_obj.source, in_obj.toString().replace(/.*\//,
|
|
220
|
+
target = new RegExp(in_obj.source, in_obj.toString().replace(/.*\//, ""));
|
|
208
221
|
// For objects and arrays we create a new object/array
|
|
209
222
|
}
|
|
210
223
|
else if (_.isObject(in_obj)) {
|
|
@@ -228,12 +241,16 @@ export class PropertyTemplate {
|
|
|
228
241
|
this._canonicalForm(in_obj[key], target, key, in_preserve_);
|
|
229
242
|
}
|
|
230
243
|
// If context is array and length is absent set it to 0
|
|
231
|
-
if (_.includes(keys,
|
|
232
|
-
|
|
244
|
+
if (_.includes(keys, "context") &&
|
|
245
|
+
in_obj["context"] === "array" &&
|
|
246
|
+
!_.includes(keys, "length")) {
|
|
247
|
+
target["length"] = 0;
|
|
233
248
|
}
|
|
234
249
|
// If inherit value is present and is a single string convert it to single element array
|
|
235
|
-
if (_.includes(keys,
|
|
236
|
-
|
|
250
|
+
if (_.includes(keys, "inherits") &&
|
|
251
|
+
in_obj["inherits"] &&
|
|
252
|
+
!_.isObject(in_obj["inherits"])) {
|
|
253
|
+
target["inherits"] = [in_obj["inherits"]];
|
|
237
254
|
}
|
|
238
255
|
}
|
|
239
256
|
if (!in_key_) {
|
|
@@ -276,33 +293,33 @@ export class PropertyTemplate {
|
|
|
276
293
|
}
|
|
277
294
|
}
|
|
278
295
|
/**
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
296
|
+
* Determines if the argument is a template structure
|
|
297
|
+
*
|
|
298
|
+
* @param {object} in_param - Parameter to assess
|
|
299
|
+
*
|
|
300
|
+
* @return {Boolean} true if in_param is a template
|
|
301
|
+
*
|
|
302
|
+
* @public
|
|
303
|
+
*/
|
|
287
304
|
static isTemplate(in_param) {
|
|
288
|
-
if (in_param.typeid && in_param.typeid.indexOf(
|
|
305
|
+
if (in_param.typeid && in_param.typeid.indexOf(":") !== -1) {
|
|
289
306
|
return true;
|
|
290
307
|
}
|
|
291
308
|
return false;
|
|
292
309
|
}
|
|
293
310
|
/**
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
311
|
+
* Extracts typeids directly referred to in a template
|
|
312
|
+
*
|
|
313
|
+
* @param {object} template - Structure from which to extract dependencies
|
|
314
|
+
*
|
|
315
|
+
* @return {Array} List of typeids this template refers directly to
|
|
316
|
+
*
|
|
317
|
+
* @public
|
|
318
|
+
*/
|
|
302
319
|
static extractDependencies(template) {
|
|
303
320
|
var dependencies = {};
|
|
304
321
|
if (template.inherits) {
|
|
305
|
-
var inherits =
|
|
322
|
+
var inherits = typeof template.inherits === "string" ? [template.inherits] : template.inherits;
|
|
306
323
|
for (var i = 0; i < inherits.length; i++) {
|
|
307
324
|
var elem = TypeIdHelper.extractTypeId(inherits[i]);
|
|
308
325
|
dependencies[elem] = true;
|
|
@@ -339,7 +356,9 @@ export class PropertyTemplate {
|
|
|
339
356
|
var typeid = TypeIdHelper.extractTypeId(constant.typeid);
|
|
340
357
|
dependencies[typeid] = true;
|
|
341
358
|
}
|
|
342
|
-
else if (constant.context ===
|
|
359
|
+
else if (constant.context === "map" &&
|
|
360
|
+
constant.contextKeyType === "typeid" &&
|
|
361
|
+
constant.value) {
|
|
343
362
|
var keys = Object.keys(constant.value);
|
|
344
363
|
for (var k = 0; k < keys.length; k++) {
|
|
345
364
|
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,MAAM,OAAO,gBAAgB;IACzB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,SAAS,GAAG,EAAE;QACtB,IAAI,MAAM,GAAG,Q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C,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","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,MAAM,OAAO,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,SAAS,CAAC,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AAE,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","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"}
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* @fileoverview Declaration of the PropertyTemplateWrapper module.
|
|
7
7
|
* PropertyTemplateWrapper is used to wrap a property template and perform internal optimizations.
|
|
8
8
|
*/
|
|
9
|
-
const { MSG } = require(
|
|
10
|
-
const _ = require(
|
|
11
|
-
const { ContainerProperty } = require(
|
|
9
|
+
const { MSG } = require("@fluid-experimental/property-common").constants;
|
|
10
|
+
const _ = require("lodash");
|
|
11
|
+
const { ContainerProperty } = require("./properties/containerProperty");
|
|
12
12
|
const reservedTypesWithoutTemplates = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
BaseProperty: true,
|
|
14
|
+
ContainerProperty: true,
|
|
15
|
+
NodeProperty: true,
|
|
16
|
+
Enum: true,
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
* Utility function that validates if the typeid is a reserved type without a template.
|
|
@@ -95,7 +95,14 @@ export class PropertyTemplateWrapper {
|
|
|
95
95
|
setCreationType(in_typeid) {
|
|
96
96
|
// This function could be moved somewhere else, an enum could be made if this information is widely needed.
|
|
97
97
|
const isCreationType = (typeid) => {
|
|
98
|
-
const creationTypes = [
|
|
98
|
+
const creationTypes = [
|
|
99
|
+
"ContainerProperty",
|
|
100
|
+
"NodeProperty",
|
|
101
|
+
"Enum",
|
|
102
|
+
"BinaryProperty",
|
|
103
|
+
"Binary",
|
|
104
|
+
"RepositoryReferenceProperty",
|
|
105
|
+
];
|
|
99
106
|
return creationTypes.includes(typeid);
|
|
100
107
|
};
|
|
101
108
|
if (isCreationType(in_typeid)) {
|
|
@@ -104,7 +111,7 @@ export class PropertyTemplateWrapper {
|
|
|
104
111
|
this._objectCreationType = in_typeid;
|
|
105
112
|
}
|
|
106
113
|
else if (currentCreationType !== in_typeid) {
|
|
107
|
-
throw new Error(MSG.ONLY_ONE_CREATION_TYPE + currentCreationType +
|
|
114
|
+
throw new Error(MSG.ONLY_ONE_CREATION_TYPE + currentCreationType + ", " + in_typeid);
|
|
108
115
|
}
|
|
109
116
|
}
|
|
110
117
|
}
|
|
@@ -125,7 +132,7 @@ export class PropertyTemplateWrapper {
|
|
|
125
132
|
}
|
|
126
133
|
let parentTemplateIds = originalTemplate.inherits;
|
|
127
134
|
/* template.inherits can be a string, if so convert it to array of strings */
|
|
128
|
-
if (typeof parentTemplateIds ===
|
|
135
|
+
if (typeof parentTemplateIds === "string") {
|
|
129
136
|
parentTemplateIds = [parentTemplateIds];
|
|
130
137
|
}
|
|
131
138
|
/* Cloning the original template to avoid modifying it */
|
|
@@ -144,7 +151,7 @@ export class PropertyTemplateWrapper {
|
|
|
144
151
|
if (parentTemplateWrapper) {
|
|
145
152
|
const parentTemplate = parentTemplateWrapper.getCompiledTemplate(in_propertyFactory);
|
|
146
153
|
const parentCreationType = parentTemplateWrapper.getCreationType();
|
|
147
|
-
if (parentCreationType !==
|
|
154
|
+
if (parentCreationType !== "ContainerProperty") {
|
|
148
155
|
this.setCreationType(parentCreationType);
|
|
149
156
|
}
|
|
150
157
|
if (parentTemplate.inherits) {
|
|
@@ -156,7 +163,8 @@ export class PropertyTemplateWrapper {
|
|
|
156
163
|
for (let j = 0; j < parentProperties.length; ++j) {
|
|
157
164
|
const parentProperty = parentProperties[j];
|
|
158
165
|
/* Two parents has child property with same id */
|
|
159
|
-
if (parentsPropertiesById[parentProperty.id] ||
|
|
166
|
+
if (parentsPropertiesById[parentProperty.id] ||
|
|
167
|
+
parentsConstantsById[parentProperty.id]) {
|
|
160
168
|
throw new Error(MSG.OVERWRITING_ID + parentProperty.id);
|
|
161
169
|
}
|
|
162
170
|
parentsPropertiesById[parentProperty.id] = parentProperty;
|
|
@@ -168,7 +176,8 @@ export class PropertyTemplateWrapper {
|
|
|
168
176
|
for (let j = 0; j < parentConstants.length; ++j) {
|
|
169
177
|
const parentConstant = parentConstants[j];
|
|
170
178
|
/* Two parents has child property with same id */
|
|
171
|
-
if (parentsConstantsById[parentConstant.id] ||
|
|
179
|
+
if (parentsConstantsById[parentConstant.id] ||
|
|
180
|
+
parentsPropertiesById[parentConstant.id]) {
|
|
172
181
|
throw new Error(MSG.OVERWRITING_ID + parentConstant.id);
|
|
173
182
|
}
|
|
174
183
|
parentsConstantsById[parentConstant.id] = parentConstant;
|
|
@@ -179,7 +188,7 @@ export class PropertyTemplateWrapper {
|
|
|
179
188
|
}
|
|
180
189
|
}
|
|
181
190
|
if (this._objectCreationType === undefined) {
|
|
182
|
-
this.setCreationType(
|
|
191
|
+
this.setCreationType("ContainerProperty");
|
|
183
192
|
}
|
|
184
193
|
/* Merges properties from parents into the properties of the child */
|
|
185
194
|
const constructSubProperties = (in_template, in_parentsPropertiesById, fieldName) => {
|
|
@@ -206,8 +215,8 @@ export class PropertyTemplateWrapper {
|
|
|
206
215
|
template[fieldName] = properties;
|
|
207
216
|
}
|
|
208
217
|
};
|
|
209
|
-
constructSubProperties(template, parentsPropertiesById,
|
|
210
|
-
constructSubProperties(template, parentsConstantsById,
|
|
218
|
+
constructSubProperties(template, parentsPropertiesById, "properties");
|
|
219
|
+
constructSubProperties(template, parentsConstantsById, "constants");
|
|
211
220
|
if (typeInheritence.length > 0) {
|
|
212
221
|
template.inherits = typeInheritence;
|
|
213
222
|
}
|
|
@@ -229,15 +238,21 @@ export class PropertyTemplateWrapper {
|
|
|
229
238
|
}
|
|
230
239
|
else if (child[fieldName] !== parent[fieldName] &&
|
|
231
240
|
(child[fieldName] !== defaultValue || parent[fieldName] !== undefined)) {
|
|
232
|
-
throw new Error(MSG.OVERRIDEN_PROP_MUST_HAVE_SAME_FIELD_VALUES_AS_BASE_TYPE +
|
|
233
|
-
|
|
241
|
+
throw new Error(MSG.OVERRIDEN_PROP_MUST_HAVE_SAME_FIELD_VALUES_AS_BASE_TYPE +
|
|
242
|
+
fieldName +
|
|
243
|
+
" as the base type: " +
|
|
244
|
+
child.id +
|
|
245
|
+
": " +
|
|
246
|
+
child[fieldName] +
|
|
247
|
+
" != " +
|
|
248
|
+
parent[fieldName]);
|
|
234
249
|
}
|
|
235
250
|
};
|
|
236
|
-
mergeField(in_childProperty, in_parentProperty,
|
|
237
|
-
mergeField(in_childProperty, in_parentProperty,
|
|
238
|
-
mergeField(in_childProperty, in_parentProperty,
|
|
239
|
-
mergeField(in_childProperty, in_parentProperty,
|
|
240
|
-
mergeField(in_childProperty, in_parentProperty,
|
|
251
|
+
mergeField(in_childProperty, in_parentProperty, "context", "single");
|
|
252
|
+
mergeField(in_childProperty, in_parentProperty, "contextKeyType", "string");
|
|
253
|
+
mergeField(in_childProperty, in_parentProperty, "length", 0);
|
|
254
|
+
mergeField(in_childProperty, in_parentProperty, "optional", false);
|
|
255
|
+
mergeField(in_childProperty, in_parentProperty, "typeid", undefined);
|
|
241
256
|
if (in_parentProperty.typedValue !== undefined) {
|
|
242
257
|
if (in_childProperty.typedValue === undefined) {
|
|
243
258
|
in_childProperty.typedValue = in_parentProperty.typedValue;
|
|
@@ -277,8 +292,8 @@ export class PropertyTemplateWrapper {
|
|
|
277
292
|
child[fieldName] = properties;
|
|
278
293
|
}
|
|
279
294
|
};
|
|
280
|
-
mergeSubProperties(in_childProperty, in_parentProperty,
|
|
281
|
-
mergeSubProperties(in_childProperty, in_parentProperty,
|
|
295
|
+
mergeSubProperties(in_childProperty, in_parentProperty, "properties");
|
|
296
|
+
mergeSubProperties(in_childProperty, in_parentProperty, "constants");
|
|
282
297
|
}
|
|
283
298
|
}
|
|
284
299
|
//# sourceMappingURL=propertyTemplateWrapper.js.map
|