@fluid-experimental/property-properties 0.58.1001 → 0.58.2000-58133
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/dist/containerSerializer.d.ts.map +1 -1
- package/dist/containerSerializer.js +4 -10
- package/dist/containerSerializer.js.map +1 -1
- package/dist/enableValidations.d.ts.map +1 -1
- package/dist/enableValidations.js +1 -1
- package/dist/enableValidations.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
- package/dist/properties/abstractStaticCollectionProperty.js +1 -28
- package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/dist/properties/arrayProperty.d.ts.map +1 -1
- package/dist/properties/arrayProperty.js +26 -85
- package/dist/properties/arrayProperty.js.map +1 -1
- package/dist/properties/baseProperty.d.ts.map +1 -1
- package/dist/properties/baseProperty.js +9 -71
- package/dist/properties/baseProperty.js.map +1 -1
- package/dist/properties/boolProperty.d.ts.map +1 -1
- package/dist/properties/boolProperty.js +0 -1
- package/dist/properties/boolProperty.js.map +1 -1
- package/dist/properties/containerProperty.d.ts.map +1 -1
- package/dist/properties/containerProperty.js +4 -22
- package/dist/properties/containerProperty.js.map +1 -1
- package/dist/properties/enumArrayProperty.d.ts.map +1 -1
- package/dist/properties/enumArrayProperty.js +2 -14
- package/dist/properties/enumArrayProperty.js.map +1 -1
- package/dist/properties/enumProperty.d.ts.map +1 -1
- package/dist/properties/enumProperty.js +3 -10
- package/dist/properties/enumProperty.js.map +1 -1
- package/dist/properties/floatProperties.js +0 -2
- package/dist/properties/floatProperties.js.map +1 -1
- package/dist/properties/index.d.ts +7 -38
- package/dist/properties/index.d.ts.map +1 -1
- package/dist/properties/index.js +37 -68
- package/dist/properties/index.js.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
- package/dist/properties/indexedCollectionBaseProperty.js +6 -18
- package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/dist/properties/intProperties.d.ts.map +1 -1
- package/dist/properties/intProperties.js +3 -20
- 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 +4 -23
- package/dist/properties/mapProperty.js.map +1 -1
- package/dist/properties/namedNodeProperty.d.ts.map +1 -1
- package/dist/properties/namedNodeProperty.js.map +1 -1
- package/dist/properties/namedProperty.d.ts.map +1 -1
- package/dist/properties/namedProperty.js +0 -3
- package/dist/properties/namedProperty.js.map +1 -1
- package/dist/properties/nodeProperty.d.ts.map +1 -1
- package/dist/properties/nodeProperty.js +0 -3
- package/dist/properties/nodeProperty.js.map +1 -1
- package/dist/properties/primitiveTypeCasts.d.ts.map +1 -1
- package/dist/properties/primitiveTypeCasts.js +2 -2
- package/dist/properties/primitiveTypeCasts.js.map +1 -1
- package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
- package/dist/properties/referenceArrayProperty.js +3 -16
- package/dist/properties/referenceArrayProperty.js.map +1 -1
- package/dist/properties/referenceMapProperty.d.ts.map +1 -1
- package/dist/properties/referenceMapProperty.js +3 -13
- package/dist/properties/referenceMapProperty.js.map +1 -1
- package/dist/properties/referenceProperty.d.ts.map +1 -1
- package/dist/properties/referenceProperty.js +4 -12
- package/dist/properties/referenceProperty.js.map +1 -1
- package/dist/properties/setProperty.d.ts.map +1 -1
- package/dist/properties/setProperty.js +3 -22
- package/dist/properties/setProperty.js.map +1 -1
- package/dist/properties/stringProperty.d.ts.map +1 -1
- package/dist/properties/stringProperty.js +12 -48
- package/dist/properties/stringProperty.js.map +1 -1
- package/dist/properties/uintProperties.js +0 -3
- package/dist/properties/uintProperties.js.map +1 -1
- package/dist/properties/valueArrayProperty.d.ts.map +1 -1
- package/dist/properties/valueArrayProperty.js +3 -45
- package/dist/properties/valueArrayProperty.js.map +1 -1
- package/dist/properties/valueMapProperty.d.ts.map +1 -1
- package/dist/properties/valueMapProperty.js +4 -29
- package/dist/properties/valueMapProperty.js.map +1 -1
- package/dist/properties/valueProperty.d.ts.map +1 -1
- package/dist/properties/valueProperty.js +2 -14
- package/dist/properties/valueProperty.js.map +1 -1
- package/dist/propertyFactory.d.ts.map +1 -1
- package/dist/propertyFactory.js +35 -72
- package/dist/propertyFactory.js.map +1 -1
- package/dist/propertyTemplate.d.ts.map +1 -1
- package/dist/propertyTemplate.js +0 -14
- package/dist/propertyTemplate.js.map +1 -1
- package/dist/propertyTemplateWrapper.d.ts.map +1 -1
- package/dist/propertyTemplateWrapper.js +4 -12
- 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 +82 -82
- package/dist/test/properties/arrayProperty.spec.js.map +1 -1
- package/dist/test/properties/baseProperty.spec.js +53 -53
- package/dist/test/properties/baseProperty.spec.js.map +1 -1
- package/dist/test/properties/containerProperty.spec.js +25 -25
- package/dist/test/properties/containerProperty.spec.js.map +1 -1
- package/dist/test/properties/customArrayProperty.spec.js +35 -35
- package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumArrayProperty.spec.js +6 -6
- package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/enumProperty.spec.js +26 -26
- package/dist/test/properties/enumProperty.spec.js.map +1 -1
- package/dist/test/properties/float32.spec.js.map +1 -1
- package/dist/test/properties/int64ArrayProperty.spec.js +22 -22
- package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
- package/dist/test/properties/int64MapProperty.spec.js +28 -28
- package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
- package/dist/test/properties/int64Property.spec.js +11 -11
- package/dist/test/properties/int64Property.spec.js.map +1 -1
- package/dist/test/properties/isLeafNode.spec.js +25 -25
- package/dist/test/properties/isLeafNode.spec.js.map +1 -1
- package/dist/test/properties/mapProperty.spec.js +110 -110
- package/dist/test/properties/mapProperty.spec.js.map +1 -1
- package/dist/test/properties/namedNodeProperty.spec.js +5 -5
- package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
- package/dist/test/properties/nodeProperty.spec.js +160 -160
- package/dist/test/properties/nodeProperty.spec.js.map +1 -1
- package/dist/test/properties/referenceProperty.spec.js +21 -21
- package/dist/test/properties/referenceProperty.spec.js.map +1 -1
- package/dist/test/properties/relationshipProperty.spec.js +4 -4
- package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
- package/dist/test/properties/setProperty.spec.js +32 -32
- package/dist/test/properties/setProperty.spec.js.map +1 -1
- package/dist/test/properties/stringProperty.spec.js +38 -38
- package/dist/test/properties/stringProperty.spec.js.map +1 -1
- package/dist/test/properties/uint64Property.spec.js +3 -3
- package/dist/test/properties/uint64Property.spec.js.map +1 -1
- package/dist/test/properties/valueMapProperty.spec.js +28 -28
- package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
- package/dist/test/properties/valueProperty.spec.js +7 -7
- package/dist/test/properties/valueProperty.spec.js.map +1 -1
- package/dist/test/propertyFactory.spec.js +559 -560
- package/dist/test/propertyFactory.spec.js.map +1 -1
- package/dist/test/propertyTemplateWrapper.spec.js +38 -38
- package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
- package/dist/test/propertyUtils.spec.js +5 -5
- package/dist/test/propertyUtils.spec.js.map +1 -1
- package/dist/test/reversibleChangeset.spec.js +266 -266
- package/dist/test/reversibleChangeset.spec.js.map +1 -1
- package/dist/test/setup.js.map +1 -1
- package/dist/test/tsconfig.tsbuildinfo +145 -145
- package/dist/test/utils.spec.js +508 -517
- package/dist/test/utils.spec.js.map +1 -1
- package/dist/test/validation/badMissingSemverInTypeid.js +9 -9
- package/dist/test/validation/badMissingSemverInTypeid.js.map +1 -1
- package/dist/test/validation/badPrimitiveTypeid.js +5 -5
- package/dist/test/validation/badPrimitiveTypeid.js.map +1 -1
- package/dist/test/validation/goodColorId.js +42 -42
- package/dist/test/validation/goodColorId.js.map +1 -1
- package/dist/test/validation/goodColorPalette.js +2 -2
- package/dist/test/validation/goodColorPalette.js.map +1 -1
- package/dist/test/validation/goodPointId.js +9 -9
- package/dist/test/validation/goodPointId.js.map +1 -1
- package/dist/test/validation/reversibleChangeSetTestData.js +1 -1
- package/dist/test/validation/reversibleChangeSetTestData.js.map +1 -1
- package/lib/containerSerializer.js +4 -10
- package/lib/containerSerializer.js.map +1 -1
- package/lib/enableValidations.js +1 -1
- package/lib/enableValidations.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/properties/abstractStaticCollectionProperty.js +1 -28
- package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
- package/lib/properties/arrayProperty.js +26 -85
- package/lib/properties/arrayProperty.js.map +1 -1
- package/lib/properties/baseProperty.js +7 -69
- package/lib/properties/baseProperty.js.map +1 -1
- package/lib/properties/boolProperty.js +0 -1
- package/lib/properties/boolProperty.js.map +1 -1
- package/lib/properties/containerProperty.js +4 -22
- package/lib/properties/containerProperty.js.map +1 -1
- package/lib/properties/enumArrayProperty.js +2 -14
- package/lib/properties/enumArrayProperty.js.map +1 -1
- package/lib/properties/enumProperty.js +3 -10
- package/lib/properties/enumProperty.js.map +1 -1
- package/lib/properties/floatProperties.js +0 -2
- package/lib/properties/floatProperties.js.map +1 -1
- package/lib/properties/index.js +7 -38
- package/lib/properties/index.js.map +1 -1
- package/lib/properties/indexedCollectionBaseProperty.js +6 -18
- package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
- package/lib/properties/intProperties.js +3 -20
- package/lib/properties/intProperties.js.map +1 -1
- package/lib/properties/lazyLoadedProperties.js.map +1 -1
- package/lib/properties/mapProperty.js +4 -23
- package/lib/properties/mapProperty.js.map +1 -1
- package/lib/properties/namedNodeProperty.js.map +1 -1
- package/lib/properties/namedProperty.js +0 -3
- package/lib/properties/namedProperty.js.map +1 -1
- package/lib/properties/nodeProperty.js +0 -3
- package/lib/properties/nodeProperty.js.map +1 -1
- package/lib/properties/primitiveTypeCasts.js +2 -2
- package/lib/properties/primitiveTypeCasts.js.map +1 -1
- package/lib/properties/referenceArrayProperty.js +3 -16
- package/lib/properties/referenceArrayProperty.js.map +1 -1
- package/lib/properties/referenceMapProperty.js +3 -13
- package/lib/properties/referenceMapProperty.js.map +1 -1
- package/lib/properties/referenceProperty.js +4 -12
- package/lib/properties/referenceProperty.js.map +1 -1
- package/lib/properties/setProperty.js +3 -22
- package/lib/properties/setProperty.js.map +1 -1
- package/lib/properties/stringProperty.js +12 -48
- package/lib/properties/stringProperty.js.map +1 -1
- package/lib/properties/uintProperties.js +0 -3
- package/lib/properties/uintProperties.js.map +1 -1
- package/lib/properties/valueArrayProperty.js +3 -45
- package/lib/properties/valueArrayProperty.js.map +1 -1
- package/lib/properties/valueMapProperty.js +4 -29
- package/lib/properties/valueMapProperty.js.map +1 -1
- package/lib/properties/valueProperty.js +2 -14
- package/lib/properties/valueProperty.js.map +1 -1
- package/lib/propertyFactory.js +35 -72
- package/lib/propertyFactory.js.map +1 -1
- package/lib/propertyTemplate.js +0 -14
- package/lib/propertyTemplate.js.map +1 -1
- package/lib/propertyTemplateWrapper.js +4 -12
- package/lib/propertyTemplateWrapper.js.map +1 -1
- package/lib/propertyUtils.js.map +1 -1
- package/package.json +13 -6
package/lib/propertyFactory.js
CHANGED
|
@@ -10,9 +10,11 @@
|
|
|
10
10
|
const _ = require('lodash');
|
|
11
11
|
const fastestJSONCopy = require('fastest-json-copy');
|
|
12
12
|
const deepCopy = fastestJSONCopy.copy;
|
|
13
|
-
const { Collection, ConsoleUtils, EventEmitter, SortedCollection, constants, GuidUtils } = require('@fluid-experimental/property-common');
|
|
13
|
+
const { Collection, ConsoleUtils, EventEmitter, SortedCollection, constants, GuidUtils, } = require('@fluid-experimental/property-common');
|
|
14
14
|
const { MSG } = constants;
|
|
15
|
-
const { TypeIdHelper, TemplateValidator, PathHelper, ChangeSet } = require('@fluid-experimental/property-changeset');
|
|
15
|
+
const { TypeIdHelper, TemplateValidator, PathHelper, ChangeSet, } = require('@fluid-experimental/property-changeset');
|
|
16
|
+
const semver = require('semver');
|
|
17
|
+
const async = require('async');
|
|
16
18
|
const { PropertyTemplate } = require('./propertyTemplate');
|
|
17
19
|
const { PropertyTemplateWrapper } = require('./propertyTemplateWrapper');
|
|
18
20
|
// Include the property classes
|
|
@@ -24,8 +26,8 @@ const { ContainerProperty } = require('./properties/containerProperty');
|
|
|
24
26
|
const { ValueProperty } = require('./properties/valueProperty');
|
|
25
27
|
// Include all primitive properties –- will register at the end.
|
|
26
28
|
const { Uint8Property, Uint16Property, Uint32Property, } = require('./properties/uintProperties');
|
|
27
|
-
const { Float32Property, Float64Property } = require('./properties/floatProperties');
|
|
28
|
-
const { Int8Property, Int16Property, Int32Property, Int64Property, Uint64Property } = require('./properties/intProperties');
|
|
29
|
+
const { Float32Property, Float64Property, } = require('./properties/floatProperties');
|
|
30
|
+
const { Int8Property, Int16Property, Int32Property, Int64Property, Uint64Property, } = require('./properties/intProperties');
|
|
29
31
|
const { StringProperty } = require('./properties/stringProperty');
|
|
30
32
|
const { BoolProperty } = require('./properties/boolProperty');
|
|
31
33
|
const { ReferenceProperty } = require('./properties/referenceProperty');
|
|
@@ -41,9 +43,7 @@ const { Float32ArrayProperty, Float64ArrayProperty, Uint32ArrayProperty, Int32Ar
|
|
|
41
43
|
const { ReferenceMapProperty } = require('./properties/referenceMapProperty');
|
|
42
44
|
const { ReferenceArrayProperty } = require('./properties/referenceArrayProperty');
|
|
43
45
|
const { EnumArrayProperty } = require('./properties/enumArrayProperty');
|
|
44
|
-
const { Float64MapProperty, Float32MapProperty, Uint32MapProperty, Uint64MapProperty, Uint16MapProperty, Uint8MapProperty, Int32MapProperty, Int64MapProperty, Int16MapProperty, Int8MapProperty, StringMapProperty, BoolMapProperty } = require('./properties/valueMapProperty');
|
|
45
|
-
const semver = require('semver');
|
|
46
|
-
const async = require('async');
|
|
46
|
+
const { Float64MapProperty, Float32MapProperty, Uint32MapProperty, Uint64MapProperty, Uint16MapProperty, Uint8MapProperty, Int32MapProperty, Int64MapProperty, Int16MapProperty, Int8MapProperty, StringMapProperty, BoolMapProperty, } = require('./properties/valueMapProperty');
|
|
47
47
|
const { LazyLoadedProperties } = require('./properties/lazyLoadedProperties');
|
|
48
48
|
/**
|
|
49
49
|
* Creates an instance of the TemplateValidator
|
|
@@ -62,7 +62,7 @@ var _createTemplateValidator = function (skipSemver) {
|
|
|
62
62
|
};
|
|
63
63
|
var params = {
|
|
64
64
|
inheritsFrom: this.inheritsFrom.bind(this),
|
|
65
|
-
hasSchema: hasSchema.bind(this)
|
|
65
|
+
hasSchema: hasSchema.bind(this),
|
|
66
66
|
};
|
|
67
67
|
if (skipSemver) {
|
|
68
68
|
params.skipSemver = skipSemver;
|
|
@@ -277,7 +277,7 @@ class PropertyFactory {
|
|
|
277
277
|
// Structure containing results the process of retrieving property set schemas from store
|
|
278
278
|
this.templateRequestsResults = {
|
|
279
279
|
errors: {},
|
|
280
|
-
schemas: {}
|
|
280
|
+
schemas: {},
|
|
281
281
|
};
|
|
282
282
|
// Cache of inheritsFrom() request results
|
|
283
283
|
this._inheritanceCache = {};
|
|
@@ -294,7 +294,6 @@ class PropertyFactory {
|
|
|
294
294
|
this._forceInstantion = false;
|
|
295
295
|
this._init();
|
|
296
296
|
}
|
|
297
|
-
;
|
|
298
297
|
/**
|
|
299
298
|
* Add a listener for a given type of event.
|
|
300
299
|
*
|
|
@@ -307,7 +306,6 @@ class PropertyFactory {
|
|
|
307
306
|
addListener(eventName, eventListener) {
|
|
308
307
|
this._eventEmitter.addListener(eventName, eventListener);
|
|
309
308
|
}
|
|
310
|
-
;
|
|
311
309
|
/**
|
|
312
310
|
* Remove a listener for a given type of event. Iff a listener was removed,
|
|
313
311
|
* an event 'removeListener' will be emitted.
|
|
@@ -316,11 +314,10 @@ class PropertyFactory {
|
|
|
316
314
|
* listener was attached.
|
|
317
315
|
* @param {function} eventListener The function to remove from the list of functions
|
|
318
316
|
* @public
|
|
319
|
-
|
|
317
|
+
* */
|
|
320
318
|
removeListener(eventName, eventListener) {
|
|
321
319
|
this._eventEmitter.removeListener(eventName, eventListener);
|
|
322
320
|
}
|
|
323
|
-
;
|
|
324
321
|
/**
|
|
325
322
|
* Initialize the PropertyFactory by registering primitive types
|
|
326
323
|
*/
|
|
@@ -377,25 +374,24 @@ class PropertyFactory {
|
|
|
377
374
|
var NamedPropertyTemplate = {
|
|
378
375
|
typeid: 'NamedProperty',
|
|
379
376
|
properties: [
|
|
380
|
-
{ id: 'guid', typeid: 'String' }
|
|
381
|
-
]
|
|
377
|
+
{ id: 'guid', typeid: 'String' },
|
|
378
|
+
],
|
|
382
379
|
};
|
|
383
380
|
var NamedNodePropertyTemplate = {
|
|
384
381
|
typeid: 'NamedNodeProperty',
|
|
385
|
-
inherits: ['NodeProperty', 'NamedProperty']
|
|
382
|
+
inherits: ['NodeProperty', 'NamedProperty'],
|
|
386
383
|
};
|
|
387
384
|
var RelationshipPropertyTemplate = {
|
|
388
385
|
typeid: 'RelationshipProperty',
|
|
389
386
|
inherits: ['NodeProperty', 'NamedProperty'],
|
|
390
387
|
properties: [
|
|
391
|
-
{ id: 'to', typeid: 'Reference' }
|
|
392
|
-
]
|
|
388
|
+
{ id: 'to', typeid: 'Reference' },
|
|
389
|
+
],
|
|
393
390
|
};
|
|
394
391
|
this._registerTypeId(NamedPropertyTemplate.typeid, NamedPropertyTemplate);
|
|
395
392
|
this._registerTypeId(NamedNodePropertyTemplate.typeid, NamedNodePropertyTemplate);
|
|
396
393
|
this._registerTypeId(RelationshipPropertyTemplate.typeid, RelationshipPropertyTemplate);
|
|
397
394
|
}
|
|
398
|
-
;
|
|
399
395
|
/**
|
|
400
396
|
* Register a template which are used to instantiate properties. To find out more about templates,
|
|
401
397
|
* see https://docs.google.com/document/d/1-7kXkKTu3AZLjKyKl7XK2VuAJRSbUxo3ZuPA8bzWocs/edit
|
|
@@ -459,7 +455,6 @@ class PropertyFactory {
|
|
|
459
455
|
}
|
|
460
456
|
}
|
|
461
457
|
}
|
|
462
|
-
;
|
|
463
458
|
/**
|
|
464
459
|
* Recursively parses the object of the specified type and returns the created
|
|
465
460
|
* array of PropertySets Templates. It does the same thing as the registerFrom()
|
|
@@ -479,7 +474,6 @@ class PropertyFactory {
|
|
|
479
474
|
throw new Error(MSG.UNKNOWN_TYPE + in_fromType);
|
|
480
475
|
}
|
|
481
476
|
}
|
|
482
|
-
;
|
|
483
477
|
/**
|
|
484
478
|
* Recursively parses the object of the specified type and registers the created
|
|
485
479
|
* Property Sets Templates. It does the same work as the convertToTemplates()
|
|
@@ -498,7 +492,6 @@ class PropertyFactory {
|
|
|
498
492
|
this.register(psetsTemplates[i]);
|
|
499
493
|
}
|
|
500
494
|
}
|
|
501
|
-
;
|
|
502
495
|
/**
|
|
503
496
|
* Validate semver.
|
|
504
497
|
* Here we compare the incoming template with its previous/next version in the
|
|
@@ -562,7 +555,6 @@ class PropertyFactory {
|
|
|
562
555
|
' is valid but with the following warnings = ' + JSON.stringify(warnings, 0, 2));
|
|
563
556
|
}
|
|
564
557
|
}
|
|
565
|
-
;
|
|
566
558
|
/**
|
|
567
559
|
* Internal method used to register remote templates coming over the wire.
|
|
568
560
|
* @param {property-properties.PropertyTemplate|object} in_remoteTemplate - The remote template to register
|
|
@@ -619,7 +611,6 @@ class PropertyFactory {
|
|
|
619
611
|
throw new Error(MSG.UNVERSIONED_REMOTE_TEMPLATE + ' \n' + JSON.stringify(in_remoteTemplate, 0, 2));
|
|
620
612
|
}
|
|
621
613
|
}
|
|
622
|
-
;
|
|
623
614
|
/**
|
|
624
615
|
* Remove the scope from the remote templates collection
|
|
625
616
|
* @param {string} in_scope The scope to remove
|
|
@@ -637,14 +628,13 @@ class PropertyFactory {
|
|
|
637
628
|
this._remoteScopedAndVersionedTemplates.remove(in_scope);
|
|
638
629
|
}
|
|
639
630
|
}
|
|
640
|
-
;
|
|
641
631
|
/**
|
|
642
632
|
* Triggered when a template is registered.
|
|
643
633
|
* @event property-properties.PropertyFactory#registered
|
|
644
634
|
* @param {property-properties.Template} Template - The template being registered.
|
|
645
635
|
* @memberof property-properties.PropertyFactory
|
|
646
636
|
*
|
|
647
|
-
|
|
637
|
+
* */
|
|
648
638
|
/**
|
|
649
639
|
* Register a template or a primitive property
|
|
650
640
|
*
|
|
@@ -682,7 +672,6 @@ class PropertyFactory {
|
|
|
682
672
|
}
|
|
683
673
|
this._eventEmitter.emit('registered', in_templateOrProperty);
|
|
684
674
|
}
|
|
685
|
-
;
|
|
686
675
|
/**
|
|
687
676
|
* Validate a template
|
|
688
677
|
* Check that the template is syntactically correct as well as semantically correct.
|
|
@@ -705,7 +694,6 @@ class PropertyFactory {
|
|
|
705
694
|
validate(in_template) {
|
|
706
695
|
return this._templateValidator.validate(in_template);
|
|
707
696
|
}
|
|
708
|
-
;
|
|
709
697
|
/**
|
|
710
698
|
* Get a template or property object based on a typeid and a context
|
|
711
699
|
*
|
|
@@ -723,7 +711,6 @@ class PropertyFactory {
|
|
|
723
711
|
}
|
|
724
712
|
return templateOrProperty;
|
|
725
713
|
}
|
|
726
|
-
;
|
|
727
714
|
/**
|
|
728
715
|
* Get a template or property object based on a typeid and a context
|
|
729
716
|
*
|
|
@@ -758,7 +745,6 @@ class PropertyFactory {
|
|
|
758
745
|
}
|
|
759
746
|
return undefined;
|
|
760
747
|
}
|
|
761
|
-
;
|
|
762
748
|
/**
|
|
763
749
|
* Get template based on typeid
|
|
764
750
|
*
|
|
@@ -769,10 +755,10 @@ class PropertyFactory {
|
|
|
769
755
|
if (this._localPrimitivePropertiesAndTemplates.has(in_typeid) && !TypeIdHelper.isPrimitiveType(in_typeid)) {
|
|
770
756
|
return this._localPrimitivePropertiesAndTemplates.item(in_typeid).getPropertyTemplate();
|
|
771
757
|
}
|
|
772
|
-
else
|
|
758
|
+
else {
|
|
773
759
|
return undefined;
|
|
760
|
+
}
|
|
774
761
|
}
|
|
775
|
-
;
|
|
776
762
|
/**
|
|
777
763
|
* Get remote templates based on typeid
|
|
778
764
|
* @private
|
|
@@ -792,7 +778,6 @@ class PropertyFactory {
|
|
|
792
778
|
});
|
|
793
779
|
return templatesFound;
|
|
794
780
|
}
|
|
795
|
-
;
|
|
796
781
|
/**
|
|
797
782
|
* Create an instance of the given property typeid if there is a template registered for it.
|
|
798
783
|
* Otherwise, this method returns undefined. Searches also in scoped templates.
|
|
@@ -832,7 +817,7 @@ class PropertyFactory {
|
|
|
832
817
|
propertyDef = {};
|
|
833
818
|
this._createDefFromPropertyDeclaration({
|
|
834
819
|
typeid: in_typeid,
|
|
835
|
-
context: context || 'single'
|
|
820
|
+
context: context || 'single',
|
|
836
821
|
}, in_scope, propertyDef);
|
|
837
822
|
}
|
|
838
823
|
let property;
|
|
@@ -846,19 +831,18 @@ class PropertyFactory {
|
|
|
846
831
|
// default initialized property
|
|
847
832
|
if (in_initialProperties !== undefined) {
|
|
848
833
|
this._setInitialValue(property, {
|
|
849
|
-
value: in_initialProperties
|
|
834
|
+
value: in_initialProperties,
|
|
850
835
|
}, false);
|
|
851
836
|
}
|
|
852
837
|
}
|
|
853
838
|
else {
|
|
854
839
|
// Directly instantiate the property from the definition (without using) a precompield function
|
|
855
840
|
property = this._instantiatePropertyDef(propertyDef, in_scope, in_initialProperties && {
|
|
856
|
-
value: in_initialProperties
|
|
841
|
+
value: in_initialProperties,
|
|
857
842
|
});
|
|
858
843
|
}
|
|
859
844
|
return property;
|
|
860
845
|
}
|
|
861
|
-
;
|
|
862
846
|
/**
|
|
863
847
|
* Creates an instance of the property described in the property definition.
|
|
864
848
|
*
|
|
@@ -878,7 +862,7 @@ class PropertyFactory {
|
|
|
878
862
|
const creationStack = [{
|
|
879
863
|
id: undefined,
|
|
880
864
|
entry: propertyDef,
|
|
881
|
-
parent: undefined
|
|
865
|
+
parent: undefined,
|
|
882
866
|
}];
|
|
883
867
|
while (creationStack.length > 0) {
|
|
884
868
|
const currentEntry = creationStack.pop();
|
|
@@ -924,7 +908,7 @@ class PropertyFactory {
|
|
|
924
908
|
const parentStackEntry = {
|
|
925
909
|
signalChildrenFinished: true,
|
|
926
910
|
initialValue: currentEntry.entry.initialValue,
|
|
927
|
-
property
|
|
911
|
+
property,
|
|
928
912
|
};
|
|
929
913
|
creationStack.push(parentStackEntry);
|
|
930
914
|
for (let [id, child] of currentEntry.entry.children) {
|
|
@@ -933,7 +917,7 @@ class PropertyFactory {
|
|
|
933
917
|
id: id,
|
|
934
918
|
entry: child,
|
|
935
919
|
setGuid: currentEntry.entry.assignGuid && id ===
|
|
936
|
-
'guid'
|
|
920
|
+
'guid',
|
|
937
921
|
});
|
|
938
922
|
}
|
|
939
923
|
}
|
|
@@ -968,7 +952,7 @@ class PropertyFactory {
|
|
|
968
952
|
const creationStack = [{
|
|
969
953
|
id: null,
|
|
970
954
|
def: propertyDef,
|
|
971
|
-
parent: undefined
|
|
955
|
+
parent: undefined,
|
|
972
956
|
}];
|
|
973
957
|
let creationFunctionSource = "";
|
|
974
958
|
let currentParameterIndex = 0;
|
|
@@ -1008,7 +992,7 @@ class PropertyFactory {
|
|
|
1008
992
|
if (initialValue === undefined) {
|
|
1009
993
|
initialValue = {
|
|
1010
994
|
typed: false,
|
|
1011
|
-
value: filteredChangeSet
|
|
995
|
+
value: filteredChangeSet,
|
|
1012
996
|
};
|
|
1013
997
|
}
|
|
1014
998
|
else if (_.isObject(initialValue)) {
|
|
@@ -1022,7 +1006,7 @@ class PropertyFactory {
|
|
|
1022
1006
|
if (initialValue === undefined) {
|
|
1023
1007
|
initialValue = {
|
|
1024
1008
|
value: undefined,
|
|
1025
|
-
typed: false
|
|
1009
|
+
typed: false,
|
|
1026
1010
|
};
|
|
1027
1011
|
}
|
|
1028
1012
|
initialValue.value = filteredChangeSet;
|
|
@@ -1123,7 +1107,7 @@ class PropertyFactory {
|
|
|
1123
1107
|
def: child,
|
|
1124
1108
|
signalParent: false,
|
|
1125
1109
|
setGuid: currentEntry.def.assignGuid && id === 'guid',
|
|
1126
|
-
parentStackEntry
|
|
1110
|
+
parentStackEntry,
|
|
1127
1111
|
});
|
|
1128
1112
|
}
|
|
1129
1113
|
}
|
|
@@ -1207,7 +1191,6 @@ class PropertyFactory {
|
|
|
1207
1191
|
property._setValues(valueParsed.value, false, true);
|
|
1208
1192
|
}
|
|
1209
1193
|
}
|
|
1210
|
-
;
|
|
1211
1194
|
/**
|
|
1212
1195
|
* Create an instance of the given property typeid if there is a template registered for it.
|
|
1213
1196
|
* Otherwise, this method returns undefined.
|
|
@@ -1223,7 +1206,6 @@ class PropertyFactory {
|
|
|
1223
1206
|
create(in_typeid, in_context, in_initialProperties) {
|
|
1224
1207
|
return this._createProperty(in_typeid, in_context, in_initialProperties, null);
|
|
1225
1208
|
}
|
|
1226
|
-
;
|
|
1227
1209
|
/**
|
|
1228
1210
|
* Creates a constructor function for the given typeid and id. The function will inherit from the
|
|
1229
1211
|
* passed base constructor, but have the typeid and id assigned in its constructor. This way, we
|
|
@@ -1267,7 +1249,6 @@ class PropertyFactory {
|
|
|
1267
1249
|
this._typedPropertyConstructorCache[key] = propertyConstructorFunction;
|
|
1268
1250
|
return propertyConstructorFunction;
|
|
1269
1251
|
}
|
|
1270
|
-
;
|
|
1271
1252
|
/**
|
|
1272
1253
|
* Creates a property definition for a non-collection property with the entry and constructor function assigned
|
|
1273
1254
|
* Children will be added later by parseTemplate.
|
|
@@ -1285,7 +1266,7 @@ class PropertyFactory {
|
|
|
1285
1266
|
let ConstructorFunction;
|
|
1286
1267
|
const params = {
|
|
1287
1268
|
typeid: in_typeid,
|
|
1288
|
-
id: in_id
|
|
1269
|
+
id: in_id,
|
|
1289
1270
|
};
|
|
1290
1271
|
if (this.inheritsFrom(in_typeid, 'NamedProperty', { scope: in_scope })) {
|
|
1291
1272
|
params.id = in_id || null; // An id of NULL means that the GUID of the property is used if it is a named property
|
|
@@ -1316,7 +1297,6 @@ class PropertyFactory {
|
|
|
1316
1297
|
propertyDef.context = 'single';
|
|
1317
1298
|
propertyDef.typeid = in_typeid;
|
|
1318
1299
|
}
|
|
1319
|
-
;
|
|
1320
1300
|
/**
|
|
1321
1301
|
* Check whether a typeid is registered
|
|
1322
1302
|
* @param {string} in_typeid The type unique identifier
|
|
@@ -1327,7 +1307,6 @@ class PropertyFactory {
|
|
|
1327
1307
|
_isRegisteredTypeid(in_typeid, in_scope) {
|
|
1328
1308
|
return !!this._get(in_typeid, undefined, in_scope);
|
|
1329
1309
|
}
|
|
1330
|
-
;
|
|
1331
1310
|
/**
|
|
1332
1311
|
* Checks if there exists a registered template with a corresponding typeid
|
|
1333
1312
|
* example:example would match to example:example-1.0.0
|
|
@@ -1348,7 +1327,6 @@ class PropertyFactory {
|
|
|
1348
1327
|
}
|
|
1349
1328
|
return registered;
|
|
1350
1329
|
}
|
|
1351
|
-
;
|
|
1352
1330
|
/**
|
|
1353
1331
|
* Check whether the given typeid is a specialized constructor
|
|
1354
1332
|
* Specialized constructors are of Array or Map types
|
|
@@ -1359,7 +1337,6 @@ class PropertyFactory {
|
|
|
1359
1337
|
_isSpecializedConstructor(in_typeid) {
|
|
1360
1338
|
return this._localPrimitivePropertiesAndTemplates.item(in_typeid) instanceof Collection;
|
|
1361
1339
|
}
|
|
1362
|
-
;
|
|
1363
1340
|
/**
|
|
1364
1341
|
* Generate the typeid according to multiple settings
|
|
1365
1342
|
*
|
|
@@ -1392,7 +1369,6 @@ class PropertyFactory {
|
|
|
1392
1369
|
}
|
|
1393
1370
|
return typeid;
|
|
1394
1371
|
}
|
|
1395
|
-
;
|
|
1396
1372
|
/**
|
|
1397
1373
|
* Creates a propertyDef for the given properties entry
|
|
1398
1374
|
*
|
|
@@ -1505,7 +1481,6 @@ class PropertyFactory {
|
|
|
1505
1481
|
out_propertyDef.assignGuid = true;
|
|
1506
1482
|
}
|
|
1507
1483
|
}
|
|
1508
|
-
;
|
|
1509
1484
|
/**
|
|
1510
1485
|
* Method used to determine whether the given object is a property constructor
|
|
1511
1486
|
*
|
|
@@ -1518,7 +1493,6 @@ class PropertyFactory {
|
|
|
1518
1493
|
// overwritten in the derived classes (which it probably should be)
|
|
1519
1494
|
return (in_obj.constructor && in_obj.constructor === ContainerProperty.constructor);
|
|
1520
1495
|
}
|
|
1521
|
-
;
|
|
1522
1496
|
/**
|
|
1523
1497
|
* Checks whether the property has a typedValue and replaces the value and the typeid
|
|
1524
1498
|
* with the ones in the typedValue.
|
|
@@ -1533,7 +1507,7 @@ class PropertyFactory {
|
|
|
1533
1507
|
var res = {
|
|
1534
1508
|
typed: false,
|
|
1535
1509
|
value: in_property.value,
|
|
1536
|
-
typeid: in_property.typeid
|
|
1510
|
+
typeid: in_property.typeid,
|
|
1537
1511
|
};
|
|
1538
1512
|
if (in_property.typedValue) {
|
|
1539
1513
|
var typeid = in_property.typeid || 'ContainerProperty';
|
|
@@ -1559,7 +1533,6 @@ class PropertyFactory {
|
|
|
1559
1533
|
}
|
|
1560
1534
|
return res;
|
|
1561
1535
|
}
|
|
1562
|
-
;
|
|
1563
1536
|
/**
|
|
1564
1537
|
* Parse a given property template appending its property and constant objects to the given propertyDef
|
|
1565
1538
|
*
|
|
@@ -1590,7 +1563,7 @@ class PropertyFactory {
|
|
|
1590
1563
|
const newChildEntry = {
|
|
1591
1564
|
initialValue: valueParsed,
|
|
1592
1565
|
optional,
|
|
1593
|
-
allowChildMerges: in_allowChildMerges
|
|
1566
|
+
allowChildMerges: in_allowChildMerges,
|
|
1594
1567
|
};
|
|
1595
1568
|
propertyDef.children = propertyDef.children || [];
|
|
1596
1569
|
propertyDef.children.unshift([properties[i].id, newChildEntry]);
|
|
@@ -1598,7 +1571,7 @@ class PropertyFactory {
|
|
|
1598
1571
|
}
|
|
1599
1572
|
else if (!optional) {
|
|
1600
1573
|
const newChildEntry = {
|
|
1601
|
-
initialValue: undefined
|
|
1574
|
+
initialValue: undefined,
|
|
1602
1575
|
};
|
|
1603
1576
|
propertyDef.children = propertyDef.children || [];
|
|
1604
1577
|
propertyDef.children.unshift([properties[i].id, newChildEntry]);
|
|
@@ -1613,7 +1586,7 @@ class PropertyFactory {
|
|
|
1613
1586
|
const valueParsed = this._parseTypedValue(constants[i], in_scope, context);
|
|
1614
1587
|
const newChildEntry = {
|
|
1615
1588
|
initialValue: undefined,
|
|
1616
|
-
constant: true
|
|
1589
|
+
constant: true,
|
|
1617
1590
|
};
|
|
1618
1591
|
propertyDef.children = propertyDef.children || [];
|
|
1619
1592
|
propertyDef.children.unshift([constants[i].id, newChildEntry]);
|
|
@@ -1625,7 +1598,6 @@ class PropertyFactory {
|
|
|
1625
1598
|
}
|
|
1626
1599
|
}
|
|
1627
1600
|
}
|
|
1628
|
-
;
|
|
1629
1601
|
// private params:
|
|
1630
1602
|
// @param {string} [in_options.scope] - The scope in which the property typeid is defined
|
|
1631
1603
|
/**
|
|
@@ -1671,7 +1643,6 @@ class PropertyFactory {
|
|
|
1671
1643
|
return parents[in_baseTypeid] !== undefined;
|
|
1672
1644
|
}
|
|
1673
1645
|
}
|
|
1674
|
-
;
|
|
1675
1646
|
// private params:
|
|
1676
1647
|
// @param {string|undefined} [in_options.scope] - The scope in which the template was stored.
|
|
1677
1648
|
/**
|
|
@@ -1700,7 +1671,6 @@ class PropertyFactory {
|
|
|
1700
1671
|
this._getAllParentsForTemplateInternal(in_typeid, parents, !!in_options.includeBaseProperty, scope);
|
|
1701
1672
|
return _.keys(parents);
|
|
1702
1673
|
}
|
|
1703
|
-
;
|
|
1704
1674
|
/**
|
|
1705
1675
|
* Returns all the typeids the template inherits from (including all possible paths through multiple inheritance).
|
|
1706
1676
|
*
|
|
@@ -1741,7 +1711,6 @@ class PropertyFactory {
|
|
|
1741
1711
|
}
|
|
1742
1712
|
}
|
|
1743
1713
|
}
|
|
1744
|
-
;
|
|
1745
1714
|
/**
|
|
1746
1715
|
* Internal function used to clear and reinitialize the PropertyFactory
|
|
1747
1716
|
* @private
|
|
@@ -1754,7 +1723,6 @@ class PropertyFactory {
|
|
|
1754
1723
|
this._typedPropertyConstructorCache = {};
|
|
1755
1724
|
this._init();
|
|
1756
1725
|
}
|
|
1757
|
-
;
|
|
1758
1726
|
/**
|
|
1759
1727
|
* Reregisters a template (by overwriting the existing template).
|
|
1760
1728
|
*
|
|
@@ -1792,7 +1760,6 @@ class PropertyFactory {
|
|
|
1792
1760
|
// And repeat the registration
|
|
1793
1761
|
registerLocal.call(this, in_template);
|
|
1794
1762
|
}
|
|
1795
|
-
;
|
|
1796
1763
|
/**
|
|
1797
1764
|
* Initializes the schema store.
|
|
1798
1765
|
* @public
|
|
@@ -1803,7 +1770,7 @@ class PropertyFactory {
|
|
|
1803
1770
|
*
|
|
1804
1771
|
* @return {Promise} Return an empty promise when checkout resolve or reject with error.
|
|
1805
1772
|
*/
|
|
1806
|
-
initializeSchemaStore(in_options) {
|
|
1773
|
+
async initializeSchemaStore(in_options) {
|
|
1807
1774
|
// https://regex101.com/r/TlgGJp/2
|
|
1808
1775
|
var regexBaseUrl = /^(https?:)?\/\/((.[-a-zA-Z0-9@:%_+~#=.]{2,256}){1,2}\.[a-z]{2,6}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(:\d{1,5})?(\/[-a-zA-Z0-9@:%_+.~#?&/=]*)*$/; // eslint-disable-line max-len
|
|
1809
1776
|
if (!in_options || !in_options.getBearerToken || !_.isFunction(in_options.getBearerToken) || !in_options.url) {
|
|
@@ -1818,7 +1785,6 @@ class PropertyFactory {
|
|
|
1818
1785
|
this._templateStore = new ForgeSchemaStore(in_options);
|
|
1819
1786
|
return Promise.resolve();
|
|
1820
1787
|
}
|
|
1821
|
-
;
|
|
1822
1788
|
/**
|
|
1823
1789
|
* Pushes a template request task onto the template requests queue
|
|
1824
1790
|
*
|
|
@@ -1840,7 +1806,6 @@ class PropertyFactory {
|
|
|
1840
1806
|
throw new Error(MSG.INVALID_TEMPLATE_STORE);
|
|
1841
1807
|
}
|
|
1842
1808
|
}
|
|
1843
|
-
;
|
|
1844
1809
|
/**
|
|
1845
1810
|
* Tries to resolve dependencies after some calls to register() have been made
|
|
1846
1811
|
*
|
|
@@ -1861,7 +1826,7 @@ class PropertyFactory {
|
|
|
1861
1826
|
* }
|
|
1862
1827
|
*
|
|
1863
1828
|
*/
|
|
1864
|
-
resolveSchemas() {
|
|
1829
|
+
async resolveSchemas() {
|
|
1865
1830
|
// Only one queue at a time can be processed.
|
|
1866
1831
|
if (this.templateRequestsQueue !== undefined) {
|
|
1867
1832
|
return Promise.reject(new Error(MSG.DEPENDENCIES_RESOLUTION_IN_PROGRESS));
|
|
@@ -1959,7 +1924,6 @@ class PropertyFactory {
|
|
|
1959
1924
|
}
|
|
1960
1925
|
});
|
|
1961
1926
|
}
|
|
1962
|
-
;
|
|
1963
1927
|
/**
|
|
1964
1928
|
* Determines whether the given property is an instance of the property type corresponding to the given native
|
|
1965
1929
|
* property typeid and context.
|
|
@@ -1978,7 +1942,6 @@ class PropertyFactory {
|
|
|
1978
1942
|
}
|
|
1979
1943
|
return result;
|
|
1980
1944
|
}
|
|
1981
|
-
;
|
|
1982
1945
|
}
|
|
1983
1946
|
const PropertyFactorySingleton = new PropertyFactory();
|
|
1984
1947
|
export { PropertyFactorySingleton as PropertyFactory };
|