@accordproject/concerto-core 4.0.0-alpha.2 → 4.0.0-beta.3
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/astmodelmanager.d.ts +3 -3
- package/dist/astmodelmanager.js.map +1 -1
- package/dist/basemodelmanager.d.ts +72 -95
- package/dist/basemodelmanager.js +29 -20
- package/dist/basemodelmanager.js.map +1 -1
- package/dist/concerto-core.js +1 -1
- package/dist/concerto-core.js.LICENSE.txt +1 -1
- package/dist/datetimeutil.d.ts +8 -1
- package/dist/datetimeutil.js.map +1 -1
- package/dist/dcsconverter.d.ts +12 -2
- package/dist/dcsconverter.js.map +1 -1
- package/dist/decoratorextractor.d.ts +30 -23
- package/dist/decoratorextractor.js.map +1 -1
- package/dist/decoratormanager.d.ts +34 -76
- package/dist/decoratormanager.js +31 -14
- package/dist/decoratormanager.js.map +1 -1
- package/dist/decoratormodelhelper.d.ts +13 -0
- package/dist/{decoratormodel.js → decoratormodelhelper.js} +4 -3
- package/dist/decoratormodelhelper.js.map +1 -0
- package/dist/factory.d.ts +11 -28
- package/dist/factory.js.map +1 -1
- package/dist/globalize.d.ts +16 -13
- package/dist/globalize.js.map +1 -1
- package/dist/index.d.ts +1 -11
- package/dist/index.js +2 -8
- package/dist/index.js.map +1 -1
- package/dist/introspect/assetdeclaration.d.ts +4 -4
- package/dist/introspect/assetdeclaration.js +1 -1
- package/dist/introspect/assetdeclaration.js.map +1 -1
- package/dist/introspect/classdeclaration.d.ts +67 -25
- package/dist/introspect/classdeclaration.js +1 -1
- package/dist/introspect/classdeclaration.js.map +1 -1
- package/dist/introspect/conceptdeclaration.d.ts +9 -2
- package/dist/introspect/conceptdeclaration.js +1 -1
- package/dist/introspect/conceptdeclaration.js.map +1 -1
- package/dist/introspect/declaration.d.ts +37 -12
- package/dist/introspect/declaration.js.map +1 -1
- package/dist/introspect/decorated.d.ts +10 -12
- package/dist/introspect/decorated.js +1 -0
- package/dist/introspect/decorated.js.map +1 -1
- package/dist/introspect/decorator.d.ts +12 -14
- package/dist/introspect/decorator.js +1 -1
- package/dist/introspect/decorator.js.map +1 -1
- package/dist/introspect/decoratorfactory.d.ts +2 -5
- package/dist/introspect/decoratorfactory.js.map +1 -1
- package/dist/introspect/enumdeclaration.d.ts +14 -2
- package/dist/introspect/enumdeclaration.js +1 -1
- package/dist/introspect/enumdeclaration.js.map +1 -1
- package/dist/introspect/enumvaluedeclaration.d.ts +16 -2
- package/dist/introspect/enumvaluedeclaration.js +1 -1
- package/dist/introspect/enumvaluedeclaration.js.map +1 -1
- package/dist/introspect/eventdeclaration.d.ts +5 -5
- package/dist/introspect/eventdeclaration.js +1 -1
- package/dist/introspect/eventdeclaration.js.map +1 -1
- package/dist/introspect/field.d.ts +24 -12
- package/dist/introspect/field.js +1 -1
- package/dist/introspect/field.js.map +1 -1
- package/dist/introspect/identifieddeclaration.d.ts +9 -2
- package/dist/introspect/identifieddeclaration.js +1 -1
- package/dist/introspect/identifieddeclaration.js.map +1 -1
- package/dist/introspect/illegalmodelexception.d.ts +4 -6
- package/dist/introspect/illegalmodelexception.js +1 -1
- package/dist/introspect/illegalmodelexception.js.map +1 -1
- package/dist/introspect/introspector.d.ts +7 -9
- package/dist/introspect/introspector.js.map +1 -1
- package/dist/introspect/mapdeclaration.d.ts +11 -18
- package/dist/introspect/mapdeclaration.js +1 -1
- package/dist/introspect/mapdeclaration.js.map +1 -1
- package/dist/introspect/mapkeytype.d.ts +27 -13
- package/dist/introspect/mapkeytype.js.map +1 -1
- package/dist/introspect/mapvaluetype.d.ts +27 -13
- package/dist/introspect/mapvaluetype.js.map +1 -1
- package/dist/introspect/metamodel.d.ts +9 -4
- package/dist/introspect/metamodel.js.map +1 -1
- package/dist/introspect/modelfile.d.ts +61 -67
- package/dist/introspect/modelfile.js +4 -3
- package/dist/introspect/modelfile.js.map +1 -1
- package/dist/introspect/numbervalidator.d.ts +35 -6
- package/dist/introspect/numbervalidator.js.map +1 -1
- package/dist/introspect/participantdeclaration.d.ts +4 -4
- package/dist/introspect/participantdeclaration.js +1 -1
- package/dist/introspect/participantdeclaration.js.map +1 -1
- package/dist/introspect/property.d.ts +26 -20
- package/dist/introspect/property.js.map +1 -1
- package/dist/introspect/relationshipdeclaration.d.ts +21 -2
- package/dist/introspect/relationshipdeclaration.js +1 -1
- package/dist/introspect/relationshipdeclaration.js.map +1 -1
- package/dist/introspect/scalardeclaration.d.ts +50 -19
- package/dist/introspect/scalardeclaration.js.map +1 -1
- package/dist/introspect/stringvalidator.d.ts +23 -9
- package/dist/introspect/stringvalidator.js.map +1 -1
- package/dist/introspect/transactiondeclaration.d.ts +4 -4
- package/dist/introspect/transactiondeclaration.js +1 -1
- package/dist/introspect/transactiondeclaration.js.map +1 -1
- package/dist/introspect/validator.d.ts +9 -9
- package/dist/introspect/validator.js.map +1 -1
- package/dist/messages/en.json +18 -4
- package/dist/messages/pt.json +5 -0
- package/dist/metamodelexception.d.ts +4 -5
- package/dist/metamodelexception.js.map +1 -1
- package/dist/model/identifiable.d.ts +13 -11
- package/dist/model/identifiable.js.map +1 -1
- package/dist/model/relationship.d.ts +25 -14
- package/dist/model/relationship.js +3 -3
- package/dist/model/relationship.js.map +1 -1
- package/dist/model/resource.d.ts +32 -5
- package/dist/model/resource.js.map +1 -1
- package/dist/model/resourceid.d.ts +13 -13
- package/dist/model/resourceid.js.map +1 -1
- package/dist/model/typed.d.ts +18 -20
- package/dist/model/typed.js +2 -2
- package/dist/model/typed.js.map +1 -1
- package/dist/model/validatedresource.d.ts +18 -4
- package/dist/model/validatedresource.js.map +1 -1
- package/dist/modelloader.d.ts +11 -11
- package/dist/modelloader.js +48 -12
- package/dist/modelloader.js.map +1 -1
- package/dist/modelmanager.d.ts +5 -7
- package/dist/modelmanager.js +8 -6
- package/dist/modelmanager.js.map +1 -1
- package/dist/modelutil.d.ts +26 -33
- package/dist/modelutil.js.map +1 -1
- package/dist/rootmodel.json +1 -1
- package/dist/rootmodelhelper.d.ts +13 -0
- package/dist/{rootmodel.js → rootmodelhelper.js} +1 -2
- package/dist/rootmodelhelper.js.map +1 -0
- package/dist/securityexception.d.ts +4 -5
- package/dist/securityexception.js.map +1 -1
- package/dist/serializer/instancegenerator.d.ts +9 -9
- package/dist/serializer/instancegenerator.js +1 -1
- package/dist/serializer/instancegenerator.js.map +1 -1
- package/dist/serializer/jsongenerator.d.ts +14 -14
- package/dist/serializer/jsongenerator.js.map +1 -1
- package/dist/serializer/jsonpopulator.d.ts +44 -13
- package/dist/serializer/jsonpopulator.js +29 -22
- package/dist/serializer/jsonpopulator.js.map +1 -1
- package/dist/serializer/resourcevalidator.d.ts +88 -96
- package/dist/serializer/resourcevalidator.js +5 -5
- package/dist/serializer/resourcevalidator.js.map +1 -1
- package/dist/serializer/validationexception.d.ts +4 -5
- package/dist/serializer/validationexception.js.map +1 -1
- package/dist/serializer/valuegenerator.d.ts +153 -3
- package/dist/serializer/valuegenerator.js.map +1 -1
- package/dist/serializer.d.ts +8 -26
- package/dist/serializer.js +1 -1
- package/dist/serializer.js.map +1 -1
- package/dist/typenotfoundexception.d.ts +5 -7
- package/dist/typenotfoundexception.js +3 -1
- package/dist/typenotfoundexception.js.map +1 -1
- package/dist/types.d.ts +17 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/package.json +6 -5
- package/types/lib/dcsIndexWrapper.d.ts +16 -0
- package/types/lib/dcsconverter.d.ts +12 -0
- package/dist/decoratormodel.js.map +0 -1
- package/dist/rootmodel.d.ts +0 -5
- package/dist/rootmodel.js.map +0 -1
- /package/{dist → types/lib}/decoratormodel.d.ts +0 -0
|
@@ -1,4 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
import type Factory = require('../factory');
|
|
2
|
+
import type ModelManager = require('../modelmanager');
|
|
3
|
+
import type Declaration = require('../introspect/declaration');
|
|
4
|
+
import type ClassDeclaration = require('../introspect/classdeclaration');
|
|
5
|
+
import type RelationshipDeclaration = require('../introspect/relationshipdeclaration');
|
|
6
|
+
import type MapDeclaration = require('../introspect/mapdeclaration');
|
|
7
|
+
import type Resource = require('../model/resource');
|
|
8
|
+
import Field = require('../introspect/field');
|
|
9
|
+
type Stack<T> = {
|
|
10
|
+
push(value: T, expectedType?: unknown): void;
|
|
11
|
+
pop(expectedType?: unknown): T;
|
|
12
|
+
peek?(expectedType?: unknown): T;
|
|
13
|
+
stack: T[];
|
|
14
|
+
};
|
|
15
|
+
type JsonPopulatorParameters = {
|
|
16
|
+
jsonStack: Stack<String | {
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
$class: string;
|
|
19
|
+
} | {
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
$class: string;
|
|
22
|
+
}[]>;
|
|
23
|
+
resourceStack: Stack<Resource>;
|
|
24
|
+
path?: Stack<string>;
|
|
25
|
+
factory: Factory;
|
|
26
|
+
modelManager: ModelManager;
|
|
27
|
+
acceptResourcesForRelationships?: boolean;
|
|
28
|
+
utcOffset?: number;
|
|
29
|
+
strictQualifiedDateTimes?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type VisitorTarget = Declaration | Field | ClassDeclaration | MapDeclaration | RelationshipDeclaration;
|
|
2
32
|
/**
|
|
3
33
|
* Populates a Resource with data from a JSON object graph. The JSON objects
|
|
4
34
|
* should be the result of calling Serializer.toJSON and then JSON.parse.
|
|
@@ -12,6 +42,9 @@ export = JSONPopulator;
|
|
|
12
42
|
* @memberof module:concerto-core
|
|
13
43
|
*/
|
|
14
44
|
declare class JSONPopulator {
|
|
45
|
+
acceptResourcesForRelationships: boolean | undefined;
|
|
46
|
+
utcOffset: number;
|
|
47
|
+
strictQualifiedDateTimes: boolean;
|
|
15
48
|
/**
|
|
16
49
|
* Constructor.
|
|
17
50
|
* @param {boolean} [acceptResourcesForRelationships] Permit resources in the
|
|
@@ -21,10 +54,7 @@ declare class JSONPopulator {
|
|
|
21
54
|
* @param {boolean} [strictQualifiedDateTimes=true] - Only allow fully-qualified date-times with offsets.
|
|
22
55
|
|
|
23
56
|
*/
|
|
24
|
-
constructor(acceptResourcesForRelationships
|
|
25
|
-
acceptResourcesForRelationships: boolean | undefined;
|
|
26
|
-
utcOffset: number;
|
|
27
|
-
strictQualifiedDateTimes: boolean;
|
|
57
|
+
constructor(acceptResourcesForRelationships: any, ergo: any, utcOffset: any, strictQualifiedDateTimes: any);
|
|
28
58
|
/**
|
|
29
59
|
* Visitor design pattern
|
|
30
60
|
* @param {Object} thing - the object being visited
|
|
@@ -32,7 +62,7 @@ declare class JSONPopulator {
|
|
|
32
62
|
* @return {Object} the result of visiting or null
|
|
33
63
|
* @private
|
|
34
64
|
*/
|
|
35
|
-
|
|
65
|
+
visit(thing: VisitorTarget, parameters: JsonPopulatorParameters): any;
|
|
36
66
|
/**
|
|
37
67
|
* Visitor design pattern
|
|
38
68
|
* @param {ClassDeclaration} classDeclaration - the object being visited
|
|
@@ -40,7 +70,7 @@ declare class JSONPopulator {
|
|
|
40
70
|
* @return {Object} the result of visiting or null
|
|
41
71
|
* @private
|
|
42
72
|
*/
|
|
43
|
-
|
|
73
|
+
visitClassDeclaration(classDeclaration: ClassDeclaration, parameters: JsonPopulatorParameters): Resource;
|
|
44
74
|
/**
|
|
45
75
|
* Visitor design pattern
|
|
46
76
|
* @param {MapDeclaration} mapDeclaration - the object being visited
|
|
@@ -48,7 +78,7 @@ declare class JSONPopulator {
|
|
|
48
78
|
* @return {Object} the result of visiting or null
|
|
49
79
|
* @private
|
|
50
80
|
*/
|
|
51
|
-
|
|
81
|
+
visitMapDeclaration(mapDeclaration: MapDeclaration, parameters: JsonPopulatorParameters): Map<any, any>;
|
|
52
82
|
/**
|
|
53
83
|
* Visitor design pattern
|
|
54
84
|
* @param {MapDeclaration} mapDeclaration - the object being visited
|
|
@@ -58,7 +88,7 @@ declare class JSONPopulator {
|
|
|
58
88
|
* @return {Object} value - the key or value belonging to the Map Entry.
|
|
59
89
|
* @private
|
|
60
90
|
*/
|
|
61
|
-
|
|
91
|
+
processMapType(mapDeclaration: any, parameters: JsonPopulatorParameters, value: any, type: any): any;
|
|
62
92
|
/**
|
|
63
93
|
* Visitor design pattern
|
|
64
94
|
* @param {Field} field - the object being visited
|
|
@@ -66,7 +96,7 @@ declare class JSONPopulator {
|
|
|
66
96
|
* @return {Object} the result of visiting or null
|
|
67
97
|
* @private
|
|
68
98
|
*/
|
|
69
|
-
|
|
99
|
+
visitField(field: any, parameters: JsonPopulatorParameters): any;
|
|
70
100
|
/**
|
|
71
101
|
*
|
|
72
102
|
* @param {Field} field - the field of the item being converted
|
|
@@ -74,7 +104,7 @@ declare class JSONPopulator {
|
|
|
74
104
|
* @param {Object} parameters - the parameters
|
|
75
105
|
* @return {Object} - the populated object.
|
|
76
106
|
*/
|
|
77
|
-
convertItem(field:
|
|
107
|
+
convertItem(field: any, jsonItem: any, parameters: any): null;
|
|
78
108
|
/**
|
|
79
109
|
* Converts a primtive object to JSON text.
|
|
80
110
|
*
|
|
@@ -83,7 +113,7 @@ declare class JSONPopulator {
|
|
|
83
113
|
* @param {Object} parameters - the parameters
|
|
84
114
|
* @return {string} the text representation
|
|
85
115
|
*/
|
|
86
|
-
convertToObject(field:
|
|
116
|
+
convertToObject(field: any, json: any, parameters: JsonPopulatorParameters): any;
|
|
87
117
|
/**
|
|
88
118
|
* Visitor design pattern
|
|
89
119
|
* @param {RelationshipDeclaration} relationshipDeclaration - the object being visited
|
|
@@ -91,5 +121,6 @@ declare class JSONPopulator {
|
|
|
91
121
|
* @return {Object} the result of visiting or null
|
|
92
122
|
* @private
|
|
93
123
|
*/
|
|
94
|
-
|
|
124
|
+
visitRelationshipDeclaration(relationshipDeclaration: any, parameters: JsonPopulatorParameters): any;
|
|
95
125
|
}
|
|
126
|
+
export = JSONPopulator;
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* limitations under the License.
|
|
13
13
|
*/
|
|
14
14
|
'use strict';
|
|
15
|
+
const debug = require('debug')('concerto:JSONPopulator');
|
|
15
16
|
const { TypedStack } = require('@accordproject/concerto-util');
|
|
16
17
|
const Relationship = require('../model/relationship');
|
|
17
18
|
const Util = require('@accordproject/concerto-util').NullUtil;
|
|
@@ -95,7 +96,7 @@ class JSONPopulator {
|
|
|
95
96
|
this.utcOffset = utcOffset || 0; // Defaults to UTC
|
|
96
97
|
this.strictQualifiedDateTimes = strictQualifiedDateTimes !== undefined ? strictQualifiedDateTimes : true;
|
|
97
98
|
if (process.env.TZ) {
|
|
98
|
-
|
|
99
|
+
debug(`Environment variable 'TZ' is set to '${process.env.TZ}', this can cause unexpected behaviour when using unqualified date time formats.`);
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
/**
|
|
@@ -105,7 +106,7 @@ class JSONPopulator {
|
|
|
105
106
|
* @return {Object} the result of visiting or null
|
|
106
107
|
* @private
|
|
107
108
|
*/
|
|
108
|
-
visit(thing, parameters
|
|
109
|
+
visit(thing, parameters) {
|
|
109
110
|
parameters.path ?? (parameters.path = new TypedStack('$'));
|
|
110
111
|
if (thing.isClassDeclaration?.()) {
|
|
111
112
|
return this.visitClassDeclaration(thing, parameters);
|
|
@@ -142,11 +143,11 @@ class JSONPopulator {
|
|
|
142
143
|
properties.forEach((property) => {
|
|
143
144
|
let value = jsonObj[property];
|
|
144
145
|
if (value !== null) {
|
|
145
|
-
parameters.path
|
|
146
|
+
parameters.path?.push(`.${property}`);
|
|
146
147
|
parameters.jsonStack.push(value);
|
|
147
148
|
const classProperty = classDeclaration.getProperty(property);
|
|
148
149
|
resourceObj[property] = classProperty.accept(this, parameters);
|
|
149
|
-
parameters.path
|
|
150
|
+
parameters.path?.pop();
|
|
150
151
|
}
|
|
151
152
|
});
|
|
152
153
|
return resourceObj;
|
|
@@ -159,13 +160,13 @@ class JSONPopulator {
|
|
|
159
160
|
* @private
|
|
160
161
|
*/
|
|
161
162
|
visitMapDeclaration(mapDeclaration, parameters) {
|
|
162
|
-
|
|
163
|
+
const jsonObj = parameters.jsonStack.pop();
|
|
163
164
|
parameters.path ?? (parameters.path = new TypedStack('$'));
|
|
164
165
|
// Throws if Map contains reserved properties - a Map containing reserved Properties should not be serialized.
|
|
165
166
|
getAssignableProperties(jsonObj, mapDeclaration);
|
|
166
|
-
|
|
167
|
+
const objMap = new Map(Object.entries(jsonObj));
|
|
167
168
|
let map = new Map();
|
|
168
|
-
|
|
169
|
+
objMap.forEach((value, key) => {
|
|
169
170
|
if (key === '$class') {
|
|
170
171
|
map.set(key, value);
|
|
171
172
|
return;
|
|
@@ -210,7 +211,7 @@ class JSONPopulator {
|
|
|
210
211
|
parameters.resourceStack.push(subResource);
|
|
211
212
|
return decl.accept(this, parameters);
|
|
212
213
|
}
|
|
213
|
-
// otherwise its a scalar value, we only need to return the
|
|
214
|
+
// otherwise its a scalar value, we only need to return the primitive value of the scalar.
|
|
214
215
|
return value;
|
|
215
216
|
}
|
|
216
217
|
/**
|
|
@@ -226,11 +227,12 @@ class JSONPopulator {
|
|
|
226
227
|
let result = null;
|
|
227
228
|
if (field.isArray()) {
|
|
228
229
|
result = [];
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
const jsonArray = jsonObj;
|
|
231
|
+
for (let n = 0; n < jsonArray.length; n++) {
|
|
232
|
+
parameters.path?.push(`[${n}]`);
|
|
233
|
+
const jsonItem = jsonArray[n];
|
|
232
234
|
result.push(this.convertItem(field, jsonItem, parameters));
|
|
233
|
-
parameters.path
|
|
235
|
+
parameters.path?.pop();
|
|
234
236
|
}
|
|
235
237
|
}
|
|
236
238
|
else {
|
|
@@ -286,10 +288,10 @@ class JSONPopulator {
|
|
|
286
288
|
* @param {Object} parameters - the parameters
|
|
287
289
|
* @return {string} the text representation
|
|
288
290
|
*/
|
|
289
|
-
convertToObject(field, json, parameters
|
|
291
|
+
convertToObject(field, json, parameters) {
|
|
290
292
|
let result = null;
|
|
291
293
|
parameters.path ?? (parameters.path = new TypedStack('$'));
|
|
292
|
-
const path = parameters.path
|
|
294
|
+
const path = parameters.path?.stack.join('');
|
|
293
295
|
switch (field.getType()) {
|
|
294
296
|
case 'DateTime':
|
|
295
297
|
{
|
|
@@ -335,7 +337,7 @@ class JSONPopulator {
|
|
|
335
337
|
case 'Double':
|
|
336
338
|
{
|
|
337
339
|
if (typeof json === 'number') {
|
|
338
|
-
result =
|
|
340
|
+
result = result = json;
|
|
339
341
|
}
|
|
340
342
|
else {
|
|
341
343
|
throw new ValidationException(`Expected value at path \`${path}\` to be of type \`${field.getType()}\``);
|
|
@@ -386,8 +388,9 @@ class JSONPopulator {
|
|
|
386
388
|
let defaultType = ModelUtil.getShortName(typeFQN);
|
|
387
389
|
if (relationshipDeclaration.isArray()) {
|
|
388
390
|
result = [];
|
|
389
|
-
|
|
390
|
-
|
|
391
|
+
const jsonArray = jsonObj;
|
|
392
|
+
for (let n = 0; n < jsonArray.length; n++) {
|
|
393
|
+
let jsonItem = jsonArray[n];
|
|
391
394
|
if (typeof jsonItem === 'string') {
|
|
392
395
|
result.push(Relationship.fromURI(parameters.modelManager, jsonItem, defaultNamespace, defaultType));
|
|
393
396
|
}
|
|
@@ -413,22 +416,26 @@ class JSONPopulator {
|
|
|
413
416
|
if (typeof jsonObj === 'string') {
|
|
414
417
|
result = Relationship.fromURI(parameters.modelManager, jsonObj, defaultNamespace, defaultType);
|
|
415
418
|
}
|
|
416
|
-
else {
|
|
419
|
+
else if (typeof jsonObj === 'object' && jsonObj !== null) {
|
|
420
|
+
const jsonObjAsObject = jsonObj;
|
|
417
421
|
if (!this.acceptResourcesForRelationships) {
|
|
418
422
|
throw new Error('Invalid JSON data. Found a value that is not a string: ' + jsonObj + ' for relationship ' + relationshipDeclaration);
|
|
419
423
|
}
|
|
420
424
|
// this isn't a relationship, but it might be an object!
|
|
421
|
-
if (!
|
|
425
|
+
if (!jsonObjAsObject.$class) {
|
|
422
426
|
throw new Error('Invalid JSON data. Does not contain a $class type identifier: ' + jsonObj + ' for relationship ' + relationshipDeclaration);
|
|
423
427
|
}
|
|
424
|
-
const classDeclaration = parameters.modelManager.getType(
|
|
428
|
+
const classDeclaration = parameters.modelManager.getType(jsonObjAsObject.$class);
|
|
425
429
|
// create a new instance, using the identifier field name as the ID.
|
|
426
|
-
let subResource = parameters.factory.newResource(classDeclaration.getNamespace(), classDeclaration.getName(),
|
|
427
|
-
parameters.jsonStack.push(
|
|
430
|
+
let subResource = parameters.factory.newResource(classDeclaration.getNamespace(), classDeclaration.getName(), jsonObjAsObject[classDeclaration.getIdentifierFieldName()]);
|
|
431
|
+
parameters.jsonStack.push(jsonObjAsObject);
|
|
428
432
|
parameters.resourceStack.push(subResource);
|
|
429
433
|
classDeclaration.accept(this, parameters);
|
|
430
434
|
result = subResource;
|
|
431
435
|
}
|
|
436
|
+
else {
|
|
437
|
+
throw new Error('Invalid JSON data. Found a value that is not a string or object: ' + jsonObj + ' for relationship ' + relationshipDeclaration);
|
|
438
|
+
}
|
|
432
439
|
}
|
|
433
440
|
return result;
|
|
434
441
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonpopulator.js","sourceRoot":"","sources":["../../src/serializer/jsonpopulator.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,YAAY,CAAC;AAEb,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAC/D,MAAM,YAAY,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AACtD,MAAM,IAAI,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC,QAAQ,CAAC;AAC9D,MAAM,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAC1C,MAAM,mBAAmB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAC7D,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,MAAM,GAAG,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACxC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAClB,MAAM,aAAa,GAAG,OAAO,CAAC,4BAA4B,CAAC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+1,3 @@
|
|
|
1
|
-
export = ResourceValidator;
|
|
2
1
|
/**
|
|
3
2
|
* <p>
|
|
4
3
|
* Validates a Resource or Field against the models defined in the ModelManager.
|
|
@@ -18,80 +17,7 @@ export = ResourceValidator;
|
|
|
18
17
|
* @memberof module:concerto-core
|
|
19
18
|
*/
|
|
20
19
|
declare class ResourceValidator {
|
|
21
|
-
|
|
22
|
-
* Throw a new error for a model violation.
|
|
23
|
-
* @param {string} id - the identifier of this instance.
|
|
24
|
-
* @param {string} propName - the name of the field.
|
|
25
|
-
* @param {*} value - the value of the field.
|
|
26
|
-
* @param {Field} field - the field
|
|
27
|
-
* @throws {ValidationException} the exception
|
|
28
|
-
* @private
|
|
29
|
-
*/
|
|
30
|
-
private static reportFieldTypeViolation;
|
|
31
|
-
/**
|
|
32
|
-
* Throw a new error for a model violation.
|
|
33
|
-
* @param {string} id - the identifier of this instance.
|
|
34
|
-
* @param {ClassDeclaration} classDeclaration - the declaration of the class
|
|
35
|
-
* @param {Object} value - the value of the field.
|
|
36
|
-
* @private
|
|
37
|
-
*/
|
|
38
|
-
private static reportNotResouceViolation;
|
|
39
|
-
/**
|
|
40
|
-
* Throw a new error for a model violation.
|
|
41
|
-
* @param {string} id - the identifier of this instance.
|
|
42
|
-
* @param {RelationshipDeclaration} relationshipDeclaration - the declaration of the class
|
|
43
|
-
* @param {Object} value - the value of the field.
|
|
44
|
-
* @private
|
|
45
|
-
*/
|
|
46
|
-
private static reportNotRelationshipViolation;
|
|
47
|
-
/**
|
|
48
|
-
* Throw a new error for a missing, but required field.
|
|
49
|
-
* @param {string} id - the identifier of this instance.
|
|
50
|
-
* @param {Field} field - the field/
|
|
51
|
-
* @private
|
|
52
|
-
*/
|
|
53
|
-
private static reportMissingRequiredProperty;
|
|
54
|
-
/**
|
|
55
|
-
* Throw a new error for a missing, but required field.
|
|
56
|
-
* @param {string} id - the identifier of this instance.
|
|
57
|
-
* @param {Field} field - the field/
|
|
58
|
-
* @private
|
|
59
|
-
*/
|
|
60
|
-
private static reportEmptyIdentifier;
|
|
61
|
-
/**
|
|
62
|
-
* Throw a new error for a missing, but required field.
|
|
63
|
-
* @param {string} id - the identifier of this instance.
|
|
64
|
-
* @param {Field} field - the field
|
|
65
|
-
* @param {string} obj - the object value
|
|
66
|
-
* @private
|
|
67
|
-
*/
|
|
68
|
-
private static reportInvalidEnumValue;
|
|
69
|
-
/**
|
|
70
|
-
* Throw a validation exception for an abstract class
|
|
71
|
-
* @param {ClassDeclaration} classDeclaration - the class declaration
|
|
72
|
-
* @throws {ValidationException} the validation exception
|
|
73
|
-
* @private
|
|
74
|
-
*/
|
|
75
|
-
private static reportAbstractClass;
|
|
76
|
-
/**
|
|
77
|
-
* Throw a validation exception for an abstract class
|
|
78
|
-
* @param {string} resourceId - the id of the resouce being validated
|
|
79
|
-
* @param {string} propertyName - the name of the property that is not declared
|
|
80
|
-
* @param {string} fullyQualifiedTypeName - the fully qualified type being validated
|
|
81
|
-
* @throws {ValidationException} the validation exception
|
|
82
|
-
* @private
|
|
83
|
-
*/
|
|
84
|
-
private static reportUndeclaredField;
|
|
85
|
-
/**
|
|
86
|
-
* Throw a validation exception for an invalid field assignment
|
|
87
|
-
* @param {string} resourceId - the id of the resouce being validated
|
|
88
|
-
* @param {string} propName - the name of the property that is being assigned
|
|
89
|
-
* @param {*} obj - the Field
|
|
90
|
-
* @param {Field} field - the Field
|
|
91
|
-
* @throws {ValidationException} the validation exception
|
|
92
|
-
* @private
|
|
93
|
-
*/
|
|
94
|
-
private static reportInvalidFieldAssignment;
|
|
20
|
+
options: any;
|
|
95
21
|
/**
|
|
96
22
|
* ResourceValidator constructor
|
|
97
23
|
* @param {Object} options - the optional serialization options.
|
|
@@ -101,16 +27,7 @@ declare class ResourceValidator {
|
|
|
101
27
|
* are specified for relationship fields into relationships, false by default.
|
|
102
28
|
* @param {boolean} options.permitResourcesForRelationships - Permit resources in the
|
|
103
29
|
*/
|
|
104
|
-
constructor(options:
|
|
105
|
-
validate: boolean;
|
|
106
|
-
convertResourcesToRelationships: boolean;
|
|
107
|
-
permitResourcesForRelationships: boolean;
|
|
108
|
-
});
|
|
109
|
-
options: {
|
|
110
|
-
validate: boolean;
|
|
111
|
-
convertResourcesToRelationships: boolean;
|
|
112
|
-
permitResourcesForRelationships: boolean;
|
|
113
|
-
};
|
|
30
|
+
constructor(options: any);
|
|
114
31
|
/**
|
|
115
32
|
* Visitor design pattern.
|
|
116
33
|
*
|
|
@@ -119,7 +36,7 @@ declare class ResourceValidator {
|
|
|
119
36
|
* @return {Object} the result of visiting or null
|
|
120
37
|
* @private
|
|
121
38
|
*/
|
|
122
|
-
|
|
39
|
+
visit(thing: any, parameters: any): null | undefined;
|
|
123
40
|
/**
|
|
124
41
|
* Visitor design pattern
|
|
125
42
|
*
|
|
@@ -128,7 +45,7 @@ declare class ResourceValidator {
|
|
|
128
45
|
* @return {Object} the result of visiting or null
|
|
129
46
|
* @private
|
|
130
47
|
*/
|
|
131
|
-
|
|
48
|
+
visitEnumDeclaration(enumDeclaration: any, parameters: any): null;
|
|
132
49
|
/**
|
|
133
50
|
* Check a Type that is declared as a Map Type.
|
|
134
51
|
* @param {Object} type - the type in scope for validation, can be MapTypeKey or MapTypeValue
|
|
@@ -137,7 +54,7 @@ declare class ResourceValidator {
|
|
|
137
54
|
* @param {Map} mapDeclaration - the object being visited
|
|
138
55
|
* @private
|
|
139
56
|
*/
|
|
140
|
-
|
|
57
|
+
checkMapType(type: any, value: any, parameters: any, mapDeclaration: any): void;
|
|
141
58
|
/**
|
|
142
59
|
* Visitor design pattern
|
|
143
60
|
*
|
|
@@ -147,7 +64,7 @@ declare class ResourceValidator {
|
|
|
147
64
|
*
|
|
148
65
|
* @private
|
|
149
66
|
*/
|
|
150
|
-
|
|
67
|
+
visitMapDeclaration(mapDeclaration: any, parameters: any): null;
|
|
151
68
|
/**
|
|
152
69
|
* Visitor design pattern
|
|
153
70
|
* @param {ClassDeclaration} classDeclaration - the object being visited
|
|
@@ -155,7 +72,7 @@ declare class ResourceValidator {
|
|
|
155
72
|
* @return {Object} the result of visiting or null
|
|
156
73
|
* @private
|
|
157
74
|
*/
|
|
158
|
-
|
|
75
|
+
visitClassDeclaration(classDeclaration: any, parameters: any): null;
|
|
159
76
|
/**
|
|
160
77
|
* Visitor design pattern
|
|
161
78
|
* @param {Field} field - the object being visited
|
|
@@ -163,7 +80,7 @@ declare class ResourceValidator {
|
|
|
163
80
|
* @return {Object} the result of visiting or null
|
|
164
81
|
* @private
|
|
165
82
|
*/
|
|
166
|
-
|
|
83
|
+
visitField(field: any, parameters: any): null;
|
|
167
84
|
/**
|
|
168
85
|
* Check a Field that is declared as an Array.
|
|
169
86
|
* @param {Object} obj - the object being validated
|
|
@@ -171,7 +88,7 @@ declare class ResourceValidator {
|
|
|
171
88
|
* @param {Object} parameters - the parameter
|
|
172
89
|
* @private
|
|
173
90
|
*/
|
|
174
|
-
|
|
91
|
+
checkEnum(obj: any, field: any, parameters: any): void;
|
|
175
92
|
/**
|
|
176
93
|
* Check a Field that is declared as an Array.
|
|
177
94
|
* @param {Object} obj - the object being validated
|
|
@@ -179,7 +96,7 @@ declare class ResourceValidator {
|
|
|
179
96
|
* @param {Object} parameters - the parameter
|
|
180
97
|
* @private
|
|
181
98
|
*/
|
|
182
|
-
|
|
99
|
+
checkArray(obj: any, field: any, parameters: any): void;
|
|
183
100
|
/**
|
|
184
101
|
* Check a single (non-array) field.
|
|
185
102
|
* @param {Object} obj - the object being validated
|
|
@@ -187,7 +104,7 @@ declare class ResourceValidator {
|
|
|
187
104
|
* @param {Object} parameters - the parameter
|
|
188
105
|
* @private
|
|
189
106
|
*/
|
|
190
|
-
|
|
107
|
+
checkItem(obj: any, field: any, parameters: any): void;
|
|
191
108
|
/**
|
|
192
109
|
* Visitor design pattern
|
|
193
110
|
* @param {RelationshipDeclaration} relationshipDeclaration - the object being visited
|
|
@@ -195,7 +112,7 @@ declare class ResourceValidator {
|
|
|
195
112
|
* @return {Object} the result of visiting or null
|
|
196
113
|
* @private
|
|
197
114
|
*/
|
|
198
|
-
|
|
115
|
+
visitRelationshipDeclaration(relationshipDeclaration: any, parameters: any): null;
|
|
199
116
|
/**
|
|
200
117
|
* Check a single relationship
|
|
201
118
|
* @param {Object} parameters - the parameter
|
|
@@ -203,5 +120,80 @@ declare class ResourceValidator {
|
|
|
203
120
|
* @param {Object} obj - the object being validated
|
|
204
121
|
* @private
|
|
205
122
|
*/
|
|
206
|
-
|
|
123
|
+
checkRelationship(parameters: any, relationshipDeclaration: any, obj: any): void;
|
|
124
|
+
/**
|
|
125
|
+
* Throw a new error for a model violation.
|
|
126
|
+
* @param {string} id - the identifier of this instance.
|
|
127
|
+
* @param {string} propName - the name of the field.
|
|
128
|
+
* @param {*} value - the value of the field.
|
|
129
|
+
* @param {Field} field - the field
|
|
130
|
+
* @throws {ValidationException} the exception
|
|
131
|
+
* @private
|
|
132
|
+
*/
|
|
133
|
+
static reportFieldTypeViolation(id: any, propName: any, value: any, field: any): void;
|
|
134
|
+
/**
|
|
135
|
+
* Throw a new error for a model violation.
|
|
136
|
+
* @param {string} id - the identifier of this instance.
|
|
137
|
+
* @param {ClassDeclaration} classDeclaration - the declaration of the class
|
|
138
|
+
* @param {Object} value - the value of the field.
|
|
139
|
+
* @private
|
|
140
|
+
*/
|
|
141
|
+
static reportNotResouceViolation(id: any, classDeclaration: any, value: any): void;
|
|
142
|
+
/**
|
|
143
|
+
* Throw a new error for a model violation.
|
|
144
|
+
* @param {string} id - the identifier of this instance.
|
|
145
|
+
* @param {RelationshipDeclaration} relationshipDeclaration - the declaration of the class
|
|
146
|
+
* @param {Object} value - the value of the field.
|
|
147
|
+
* @private
|
|
148
|
+
*/
|
|
149
|
+
static reportNotRelationshipViolation(id: any, relationshipDeclaration: any, value: any): void;
|
|
150
|
+
/**
|
|
151
|
+
* Throw a new error for a missing, but required field.
|
|
152
|
+
* @param {string} id - the identifier of this instance.
|
|
153
|
+
* @param {Field} field - the field/
|
|
154
|
+
* @private
|
|
155
|
+
*/
|
|
156
|
+
static reportMissingRequiredProperty(id: any, field: any): void;
|
|
157
|
+
/**
|
|
158
|
+
* Throw a new error for a missing, but required field.
|
|
159
|
+
* @param {string} id - the identifier of this instance.
|
|
160
|
+
* @param {Field} field - the field/
|
|
161
|
+
* @private
|
|
162
|
+
*/
|
|
163
|
+
static reportEmptyIdentifier(id: any): void;
|
|
164
|
+
/**
|
|
165
|
+
* Throw a new error for a missing, but required field.
|
|
166
|
+
* @param {string} id - the identifier of this instance.
|
|
167
|
+
* @param {Field} field - the field
|
|
168
|
+
* @param {string} obj - the object value
|
|
169
|
+
* @private
|
|
170
|
+
*/
|
|
171
|
+
static reportInvalidEnumValue(id: any, field: any, obj: any): void;
|
|
172
|
+
/**
|
|
173
|
+
* Throw a validation exception for an abstract class
|
|
174
|
+
* @param {ClassDeclaration} classDeclaration - the class declaration
|
|
175
|
+
* @throws {ValidationException} the validation exception
|
|
176
|
+
* @private
|
|
177
|
+
*/
|
|
178
|
+
static reportAbstractClass(classDeclaration: any): void;
|
|
179
|
+
/**
|
|
180
|
+
* Throw a validation exception for an abstract class
|
|
181
|
+
* @param {string} resourceId - the id of the resource being validated
|
|
182
|
+
* @param {string} propertyName - the name of the property that is not declared
|
|
183
|
+
* @param {string} fullyQualifiedTypeName - the fully qualified type being validated
|
|
184
|
+
* @throws {ValidationException} the validation exception
|
|
185
|
+
* @private
|
|
186
|
+
*/
|
|
187
|
+
static reportUndeclaredField(resourceId: any, propertyName: any, fullyQualifiedTypeName: any): void;
|
|
188
|
+
/**
|
|
189
|
+
* Throw a validation exception for an invalid field assignment
|
|
190
|
+
* @param {string} resourceId - the id of the resource being validated
|
|
191
|
+
* @param {string} propName - the name of the property that is being assigned
|
|
192
|
+
* @param {*} obj - the Field
|
|
193
|
+
* @param {Field} field - the Field
|
|
194
|
+
* @throws {ValidationException} the validation exception
|
|
195
|
+
* @private
|
|
196
|
+
*/
|
|
197
|
+
static reportInvalidFieldAssignment(resourceId: any, propName: any, obj: any, field: any): void;
|
|
207
198
|
}
|
|
199
|
+
export = ResourceValidator;
|
|
@@ -186,7 +186,7 @@ class ResourceValidator {
|
|
|
186
186
|
*/
|
|
187
187
|
visitClassDeclaration(classDeclaration, parameters) {
|
|
188
188
|
const obj = parameters.stack.pop();
|
|
189
|
-
// are we dealing with a
|
|
189
|
+
// are we dealing with a Resource?
|
|
190
190
|
if (!((obj instanceof Resource))) {
|
|
191
191
|
ResourceValidator.reportNotResouceViolation(parameters.rootResourceIdentifier, classDeclaration, obj);
|
|
192
192
|
}
|
|
@@ -210,7 +210,7 @@ class ResourceValidator {
|
|
|
210
210
|
const field = toBeAssignedClassDeclaration.getProperty(propName);
|
|
211
211
|
if (!field) {
|
|
212
212
|
if (classDeclaration.isIdentified() &&
|
|
213
|
-
// Allow shadowing of the $
|
|
213
|
+
// Allow shadowing of the $identifier field to normalize lookup of the identifying field.
|
|
214
214
|
propName !== '$identifier') {
|
|
215
215
|
ResourceValidator.reportUndeclaredField(obj.getIdentifier(), propName, toBeAssignedClassDecName);
|
|
216
216
|
}
|
|
@@ -244,7 +244,7 @@ class ResourceValidator {
|
|
|
244
244
|
}
|
|
245
245
|
else {
|
|
246
246
|
if (!property.isOptional()) {
|
|
247
|
-
// Allow shadowing of the $
|
|
247
|
+
// Allow shadowing of the $identifier field to normalize lookup of the identifying field.
|
|
248
248
|
if (property.getName() === '$identifier' && identifierFieldName !== '$identifier') {
|
|
249
249
|
continue;
|
|
250
250
|
}
|
|
@@ -571,7 +571,7 @@ class ResourceValidator {
|
|
|
571
571
|
}
|
|
572
572
|
/**
|
|
573
573
|
* Throw a validation exception for an abstract class
|
|
574
|
-
* @param {string} resourceId - the id of the
|
|
574
|
+
* @param {string} resourceId - the id of the resource being validated
|
|
575
575
|
* @param {string} propertyName - the name of the property that is not declared
|
|
576
576
|
* @param {string} fullyQualifiedTypeName - the fully qualified type being validated
|
|
577
577
|
* @throws {ValidationException} the validation exception
|
|
@@ -587,7 +587,7 @@ class ResourceValidator {
|
|
|
587
587
|
}
|
|
588
588
|
/**
|
|
589
589
|
* Throw a validation exception for an invalid field assignment
|
|
590
|
-
* @param {string} resourceId - the id of the
|
|
590
|
+
* @param {string} resourceId - the id of the resource being validated
|
|
591
591
|
* @param {string} propName - the name of the property that is being assigned
|
|
592
592
|
* @param {*} obj - the Field
|
|
593
593
|
* @param {Field} field - the Field
|