@odata2ts/odata2ts 0.23.0 → 0.24.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/CHANGELOG.md +14 -0
- package/README.md +74 -74
- package/lib/FactoryFunctionModel.d.ts +13 -13
- package/lib/FactoryFunctionModel.js +2 -2
- package/lib/FactoryFunctionModel.js.map +1 -1
- package/lib/NamingModel.d.ts +182 -182
- package/lib/NamingModel.js +11 -11
- package/lib/NamingModel.js.map +1 -1
- package/lib/OptionModel.d.ts +228 -223
- package/lib/OptionModel.js +23 -23
- package/lib/OptionModel.js.map +1 -1
- package/lib/app.d.ts +8 -8
- package/lib/app.js +63 -63
- package/lib/app.js.map +1 -1
- package/lib/cli.d.ts +3 -3
- package/lib/cli.js +153 -153
- package/lib/data-model/DataModel.d.ts +85 -85
- package/lib/data-model/DataModel.js +134 -134
- package/lib/data-model/DataModelDigestion.d.ts +44 -44
- package/lib/data-model/DataModelDigestion.js +274 -274
- package/lib/data-model/DataModelDigestion.js.map +1 -1
- package/lib/data-model/DataModelDigestionV2.d.ts +10 -10
- package/lib/data-model/DataModelDigestionV2.js +200 -200
- package/lib/data-model/DataModelDigestionV4.d.ts +3 -3
- package/lib/data-model/DataModelDigestionV4.js +195 -195
- package/lib/data-model/DataTypeModel.d.ts +102 -102
- package/lib/data-model/DataTypeModel.js +8 -8
- package/lib/data-model/DataTypeModel.js.map +1 -1
- package/lib/data-model/NamingHelper.d.ts +55 -55
- package/lib/data-model/NamingHelper.js +214 -214
- package/lib/data-model/ServiceConfigHelper.d.ts +21 -21
- package/lib/data-model/ServiceConfigHelper.js +113 -113
- package/lib/data-model/edmx/ODataEdmxModelBase.d.ts +80 -80
- package/lib/data-model/edmx/ODataEdmxModelBase.js +2 -2
- package/lib/data-model/edmx/ODataEdmxModelBase.js.map +1 -1
- package/lib/data-model/edmx/ODataEdmxModelV3.d.ts +63 -63
- package/lib/data-model/edmx/ODataEdmxModelV3.js +2 -2
- package/lib/data-model/edmx/ODataEdmxModelV4.d.ts +67 -67
- package/lib/data-model/edmx/ODataEdmxModelV4.js +2 -2
- package/lib/defaultConfig.d.ts +9 -9
- package/lib/defaultConfig.js +165 -164
- package/lib/defaultConfig.js.map +1 -1
- package/lib/evaluateConfig.d.ts +25 -25
- package/lib/evaluateConfig.js +82 -82
- package/lib/generator/ImportContainer.d.ts +16 -16
- package/lib/generator/ImportContainer.js +91 -91
- package/lib/generator/ImportContainer.js.map +1 -1
- package/lib/generator/ModelGenerator.d.ts +2 -2
- package/lib/generator/ModelGenerator.js +211 -183
- package/lib/generator/ModelGenerator.js.map +1 -1
- package/lib/generator/QueryObjectGenerator.d.ts +2 -2
- package/lib/generator/QueryObjectGenerator.js +239 -239
- package/lib/generator/ServiceGenerator.d.ts +8 -8
- package/lib/generator/ServiceGenerator.js +422 -422
- package/lib/generator/ServiceGenerator.js.map +1 -1
- package/lib/generator/index.d.ts +3 -3
- package/lib/generator/index.js +9 -9
- package/lib/index.d.ts +3 -3
- package/lib/index.js +6 -6
- package/lib/project/ProjectManager.d.ts +30 -30
- package/lib/project/ProjectManager.js +177 -175
- package/lib/project/ProjectManager.js.map +1 -1
- package/lib/project/formatter/BaseFormatter.d.ts +49 -49
- package/lib/project/formatter/BaseFormatter.js +30 -30
- package/lib/project/formatter/FileFormatter.d.ts +16 -16
- package/lib/project/formatter/FileFormatter.js +2 -2
- package/lib/project/formatter/NoopFormatter.d.ts +29 -29
- package/lib/project/formatter/NoopFormatter.js +42 -42
- package/lib/project/formatter/PrettierFormatter.d.ts +46 -46
- package/lib/project/formatter/PrettierFormatter.js +92 -92
- package/lib/project/formatter/index.d.ts +2 -2
- package/lib/project/formatter/index.js +14 -14
- package/lib/project/logger/logFilePath.d.ts +1 -1
- package/lib/project/logger/logFilePath.js +12 -12
- package/lib/run-cli.d.ts +2 -2
- package/lib/run-cli.js +6 -6
- package/package.json +27 -28
|
@@ -1,196 +1,196 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.digest = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const converter_runtime_1 = require("@odata2ts/converter-runtime");
|
|
6
|
-
const odata_core_1 = require("@odata2ts/odata-core");
|
|
7
|
-
const DataModelDigestion_1 = require("./DataModelDigestion");
|
|
8
|
-
const DataTypeModel_1 = require("./DataTypeModel");
|
|
9
|
-
const digest = (schema, options, namingHelper) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
10
|
-
const converters = yield (0, converter_runtime_1.loadConverters)(odata_core_1.ODataVersions.V2, options.converters);
|
|
11
|
-
const digester = new DigesterV4(schema, options, namingHelper, converters);
|
|
12
|
-
return digester.digest();
|
|
13
|
-
});
|
|
14
|
-
exports.digest = digest;
|
|
15
|
-
class DigesterV4 extends DataModelDigestion_1.Digester {
|
|
16
|
-
constructor(schema, options, namingHelper, converters) {
|
|
17
|
-
super(DataTypeModel_1.ODataVersion.V4, schema, options, namingHelper, converters);
|
|
18
|
-
}
|
|
19
|
-
getNavigationProps(entityType) {
|
|
20
|
-
return entityType.NavigationProperty || [];
|
|
21
|
-
}
|
|
22
|
-
digestEntityContainer() {
|
|
23
|
-
var _a, _b, _c, _d;
|
|
24
|
-
// functions & actions
|
|
25
|
-
this.addOperations(this.schema.Function, "Function" /* OperationTypes.Function */);
|
|
26
|
-
this.addOperations(this.schema.Action, "Action" /* OperationTypes.Action */);
|
|
27
|
-
if (this.schema.EntityContainer && this.schema.EntityContainer.length) {
|
|
28
|
-
const container = this.schema.EntityContainer[0];
|
|
29
|
-
(_a = container.ActionImport) === null || _a === void 0 ? void 0 : _a.forEach((actionImport) => {
|
|
30
|
-
const name = this.namingHelper.getActionName(actionImport.$.Name);
|
|
31
|
-
const operationName = this.namingHelper.getActionName(actionImport.$.Action);
|
|
32
|
-
this.dataModel.addAction(name, {
|
|
33
|
-
name: name,
|
|
34
|
-
odataName: actionImport.$.Name,
|
|
35
|
-
operation: this.getRootOperationType(operationName),
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
(_b = container.FunctionImport) === null || _b === void 0 ? void 0 : _b.forEach((funcImport) => {
|
|
39
|
-
const name = this.namingHelper.getFunctionName(funcImport.$.Name);
|
|
40
|
-
const operationName = this.namingHelper.getFunctionName(funcImport.$.Function);
|
|
41
|
-
this.dataModel.addFunction(name, {
|
|
42
|
-
name,
|
|
43
|
-
odataName: funcImport.$.Name,
|
|
44
|
-
operation: this.getRootOperationType(operationName),
|
|
45
|
-
entitySet: funcImport.$.EntitySet,
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
(_c = container.Singleton) === null || _c === void 0 ? void 0 : _c.forEach((singleton) => {
|
|
49
|
-
const name = singleton.$.Name;
|
|
50
|
-
const navPropBindings = singleton.NavigationPropertyBinding || [];
|
|
51
|
-
this.dataModel.addSingleton(name, {
|
|
52
|
-
name,
|
|
53
|
-
odataName: singleton.$.Name,
|
|
54
|
-
entityType: this.dataModel.getModel(this.namingHelper.getModelName(singleton.$.Type)),
|
|
55
|
-
navPropBinding: navPropBindings.map((binding) => ({
|
|
56
|
-
path: this.namingHelper.stripServicePrefix(binding.$.Path),
|
|
57
|
-
target: binding.$.Target,
|
|
58
|
-
})),
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
(_d = container.EntitySet) === null || _d === void 0 ? void 0 : _d.forEach((entitySet) => {
|
|
62
|
-
const name = entitySet.$.Name;
|
|
63
|
-
const navPropBindings = entitySet.NavigationPropertyBinding || [];
|
|
64
|
-
this.dataModel.addEntitySet(name, {
|
|
65
|
-
name,
|
|
66
|
-
odataName: entitySet.$.Name,
|
|
67
|
-
entityType: this.dataModel.getModel(this.namingHelper.getModelName(entitySet.$.EntityType)),
|
|
68
|
-
navPropBinding: navPropBindings.map((binding) => ({
|
|
69
|
-
path: this.namingHelper.stripServicePrefix(binding.$.Path),
|
|
70
|
-
target: binding.$.Target,
|
|
71
|
-
})),
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
mapODataType(type) {
|
|
77
|
-
switch (type) {
|
|
78
|
-
case odata_core_1.ODataTypesV4.Boolean:
|
|
79
|
-
return {
|
|
80
|
-
outputType: "boolean",
|
|
81
|
-
qPath: "QBooleanPath",
|
|
82
|
-
qCollection: "QBooleanCollection",
|
|
83
|
-
qParam: "QBooleanParam",
|
|
84
|
-
};
|
|
85
|
-
case odata_core_1.ODataTypesV4.Byte:
|
|
86
|
-
case odata_core_1.ODataTypesV4.SByte:
|
|
87
|
-
case odata_core_1.ODataTypesV4.Int16:
|
|
88
|
-
case odata_core_1.ODataTypesV4.Int32:
|
|
89
|
-
case odata_core_1.ODataTypesV4.Int64:
|
|
90
|
-
case odata_core_1.ODataTypesV4.Single:
|
|
91
|
-
case odata_core_1.ODataTypesV4.Double:
|
|
92
|
-
case odata_core_1.ODataTypesV4.Decimal:
|
|
93
|
-
return {
|
|
94
|
-
outputType: "number",
|
|
95
|
-
qPath: "QNumberPath",
|
|
96
|
-
qCollection: "QNumberCollection",
|
|
97
|
-
qParam: "QNumberParam",
|
|
98
|
-
};
|
|
99
|
-
case odata_core_1.ODataTypesV4.String:
|
|
100
|
-
return {
|
|
101
|
-
outputType: "string",
|
|
102
|
-
qPath: "QStringPath",
|
|
103
|
-
qCollection: "QStringCollection",
|
|
104
|
-
qParam: "QStringParam",
|
|
105
|
-
};
|
|
106
|
-
case odata_core_1.ODataTypesV4.Date:
|
|
107
|
-
return {
|
|
108
|
-
outputType: "string",
|
|
109
|
-
qPath: "QDatePath",
|
|
110
|
-
qCollection: "QDateCollection",
|
|
111
|
-
qParam: "QDateParam",
|
|
112
|
-
};
|
|
113
|
-
case odata_core_1.ODataTypesV4.TimeOfDay:
|
|
114
|
-
return {
|
|
115
|
-
outputType: "string",
|
|
116
|
-
qPath: "QTimeOfDayPath",
|
|
117
|
-
qCollection: "QTimeOfDayCollection",
|
|
118
|
-
qParam: "QTimeOfDayParam",
|
|
119
|
-
};
|
|
120
|
-
case odata_core_1.ODataTypesV4.DateTimeOffset:
|
|
121
|
-
return {
|
|
122
|
-
outputType: "string",
|
|
123
|
-
qPath: "QDateTimeOffsetPath",
|
|
124
|
-
qCollection: "QDateTimeOffsetCollection",
|
|
125
|
-
qParam: "QDateTimeOffsetParam",
|
|
126
|
-
};
|
|
127
|
-
case odata_core_1.ODataTypesV4.Binary:
|
|
128
|
-
return {
|
|
129
|
-
outputType: "string",
|
|
130
|
-
qPath: "QBinaryPath",
|
|
131
|
-
qCollection: "QBinaryCollection",
|
|
132
|
-
qParam: undefined,
|
|
133
|
-
};
|
|
134
|
-
case odata_core_1.ODataTypesV4.Guid:
|
|
135
|
-
return {
|
|
136
|
-
outputType: "string",
|
|
137
|
-
qPath: "QGuidPath",
|
|
138
|
-
qCollection: "QGuidCollection",
|
|
139
|
-
qParam: "QGuidParam",
|
|
140
|
-
};
|
|
141
|
-
default:
|
|
142
|
-
return {
|
|
143
|
-
outputType: "string",
|
|
144
|
-
qPath: "QStringPath",
|
|
145
|
-
qCollection: "QStringCollection",
|
|
146
|
-
qParam: undefined,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
addOperations(operations, type) {
|
|
151
|
-
if (!operations || !operations.length) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
operations.forEach((op) => {
|
|
155
|
-
var _a, _b, _c;
|
|
156
|
-
const params = (_b = (_a = op.Parameter) === null || _a === void 0 ? void 0 : _a.map(this.mapProp)) !== null && _b !== void 0 ? _b : [];
|
|
157
|
-
const returnType = (_c = op.ReturnType) === null || _c === void 0 ? void 0 : _c.map((rt) => {
|
|
158
|
-
return this.mapProp(Object.assign(Object.assign({}, rt), { $: Object.assign({ Name: "NO_NAME_BECAUSE_RETURN_TYPE" }, rt.$) }));
|
|
159
|
-
})[0];
|
|
160
|
-
const isBound = op.$.IsBound === "true";
|
|
161
|
-
if (isBound && !params.length) {
|
|
162
|
-
throw new Error(`IllegalState: Operation '${op.$.Name}' is bound, but has no parameters!`);
|
|
163
|
-
}
|
|
164
|
-
const bindingProp = isBound ? params.shift() : undefined;
|
|
165
|
-
const binding = bindingProp
|
|
166
|
-
? bindingProp.isCollection
|
|
167
|
-
? `Collection(${bindingProp.type})`
|
|
168
|
-
: bindingProp.type
|
|
169
|
-
: DigesterV4.ROOT_OPERATION;
|
|
170
|
-
const name = type === "Function" /* OperationTypes.Function */
|
|
171
|
-
? this.namingHelper.getFunctionName(op.$.Name)
|
|
172
|
-
: this.namingHelper.getActionName(op.$.Name);
|
|
173
|
-
const qName = type === "Function" /* OperationTypes.Function */
|
|
174
|
-
? this.namingHelper.getQFunctionName(op.$.Name)
|
|
175
|
-
: this.namingHelper.getQActionName(op.$.Name);
|
|
176
|
-
this.dataModel.addOperationType(binding, {
|
|
177
|
-
odataName: op.$.Name,
|
|
178
|
-
name,
|
|
179
|
-
qName,
|
|
180
|
-
paramsModelName: this.namingHelper.getOperationParamsModelName(op.$.Name),
|
|
181
|
-
type: type,
|
|
182
|
-
parameters: params,
|
|
183
|
-
returnType: returnType,
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
getRootOperationType(name) {
|
|
188
|
-
const rootOps = this.dataModel.getOperationTypeByBinding(DigesterV4.ROOT_OPERATION);
|
|
189
|
-
const rootOp = rootOps.find((op) => op.name === name);
|
|
190
|
-
if (!rootOp) {
|
|
191
|
-
throw new Error(`Couldn't find root operation with name [${name}]`);
|
|
192
|
-
}
|
|
193
|
-
return rootOp;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.digest = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const converter_runtime_1 = require("@odata2ts/converter-runtime");
|
|
6
|
+
const odata_core_1 = require("@odata2ts/odata-core");
|
|
7
|
+
const DataModelDigestion_1 = require("./DataModelDigestion");
|
|
8
|
+
const DataTypeModel_1 = require("./DataTypeModel");
|
|
9
|
+
const digest = (schema, options, namingHelper) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
10
|
+
const converters = yield (0, converter_runtime_1.loadConverters)(odata_core_1.ODataVersions.V2, options.converters);
|
|
11
|
+
const digester = new DigesterV4(schema, options, namingHelper, converters);
|
|
12
|
+
return digester.digest();
|
|
13
|
+
});
|
|
14
|
+
exports.digest = digest;
|
|
15
|
+
class DigesterV4 extends DataModelDigestion_1.Digester {
|
|
16
|
+
constructor(schema, options, namingHelper, converters) {
|
|
17
|
+
super(DataTypeModel_1.ODataVersion.V4, schema, options, namingHelper, converters);
|
|
18
|
+
}
|
|
19
|
+
getNavigationProps(entityType) {
|
|
20
|
+
return entityType.NavigationProperty || [];
|
|
21
|
+
}
|
|
22
|
+
digestEntityContainer() {
|
|
23
|
+
var _a, _b, _c, _d;
|
|
24
|
+
// functions & actions
|
|
25
|
+
this.addOperations(this.schema.Function, "Function" /* OperationTypes.Function */);
|
|
26
|
+
this.addOperations(this.schema.Action, "Action" /* OperationTypes.Action */);
|
|
27
|
+
if (this.schema.EntityContainer && this.schema.EntityContainer.length) {
|
|
28
|
+
const container = this.schema.EntityContainer[0];
|
|
29
|
+
(_a = container.ActionImport) === null || _a === void 0 ? void 0 : _a.forEach((actionImport) => {
|
|
30
|
+
const name = this.namingHelper.getActionName(actionImport.$.Name);
|
|
31
|
+
const operationName = this.namingHelper.getActionName(actionImport.$.Action);
|
|
32
|
+
this.dataModel.addAction(name, {
|
|
33
|
+
name: name,
|
|
34
|
+
odataName: actionImport.$.Name,
|
|
35
|
+
operation: this.getRootOperationType(operationName),
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
(_b = container.FunctionImport) === null || _b === void 0 ? void 0 : _b.forEach((funcImport) => {
|
|
39
|
+
const name = this.namingHelper.getFunctionName(funcImport.$.Name);
|
|
40
|
+
const operationName = this.namingHelper.getFunctionName(funcImport.$.Function);
|
|
41
|
+
this.dataModel.addFunction(name, {
|
|
42
|
+
name,
|
|
43
|
+
odataName: funcImport.$.Name,
|
|
44
|
+
operation: this.getRootOperationType(operationName),
|
|
45
|
+
entitySet: funcImport.$.EntitySet,
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
(_c = container.Singleton) === null || _c === void 0 ? void 0 : _c.forEach((singleton) => {
|
|
49
|
+
const name = singleton.$.Name;
|
|
50
|
+
const navPropBindings = singleton.NavigationPropertyBinding || [];
|
|
51
|
+
this.dataModel.addSingleton(name, {
|
|
52
|
+
name,
|
|
53
|
+
odataName: singleton.$.Name,
|
|
54
|
+
entityType: this.dataModel.getModel(this.namingHelper.getModelName(singleton.$.Type)),
|
|
55
|
+
navPropBinding: navPropBindings.map((binding) => ({
|
|
56
|
+
path: this.namingHelper.stripServicePrefix(binding.$.Path),
|
|
57
|
+
target: binding.$.Target,
|
|
58
|
+
})),
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
(_d = container.EntitySet) === null || _d === void 0 ? void 0 : _d.forEach((entitySet) => {
|
|
62
|
+
const name = entitySet.$.Name;
|
|
63
|
+
const navPropBindings = entitySet.NavigationPropertyBinding || [];
|
|
64
|
+
this.dataModel.addEntitySet(name, {
|
|
65
|
+
name,
|
|
66
|
+
odataName: entitySet.$.Name,
|
|
67
|
+
entityType: this.dataModel.getModel(this.namingHelper.getModelName(entitySet.$.EntityType)),
|
|
68
|
+
navPropBinding: navPropBindings.map((binding) => ({
|
|
69
|
+
path: this.namingHelper.stripServicePrefix(binding.$.Path),
|
|
70
|
+
target: binding.$.Target,
|
|
71
|
+
})),
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
mapODataType(type) {
|
|
77
|
+
switch (type) {
|
|
78
|
+
case odata_core_1.ODataTypesV4.Boolean:
|
|
79
|
+
return {
|
|
80
|
+
outputType: "boolean",
|
|
81
|
+
qPath: "QBooleanPath",
|
|
82
|
+
qCollection: "QBooleanCollection",
|
|
83
|
+
qParam: "QBooleanParam",
|
|
84
|
+
};
|
|
85
|
+
case odata_core_1.ODataTypesV4.Byte:
|
|
86
|
+
case odata_core_1.ODataTypesV4.SByte:
|
|
87
|
+
case odata_core_1.ODataTypesV4.Int16:
|
|
88
|
+
case odata_core_1.ODataTypesV4.Int32:
|
|
89
|
+
case odata_core_1.ODataTypesV4.Int64:
|
|
90
|
+
case odata_core_1.ODataTypesV4.Single:
|
|
91
|
+
case odata_core_1.ODataTypesV4.Double:
|
|
92
|
+
case odata_core_1.ODataTypesV4.Decimal:
|
|
93
|
+
return {
|
|
94
|
+
outputType: "number",
|
|
95
|
+
qPath: "QNumberPath",
|
|
96
|
+
qCollection: "QNumberCollection",
|
|
97
|
+
qParam: "QNumberParam",
|
|
98
|
+
};
|
|
99
|
+
case odata_core_1.ODataTypesV4.String:
|
|
100
|
+
return {
|
|
101
|
+
outputType: "string",
|
|
102
|
+
qPath: "QStringPath",
|
|
103
|
+
qCollection: "QStringCollection",
|
|
104
|
+
qParam: "QStringParam",
|
|
105
|
+
};
|
|
106
|
+
case odata_core_1.ODataTypesV4.Date:
|
|
107
|
+
return {
|
|
108
|
+
outputType: "string",
|
|
109
|
+
qPath: "QDatePath",
|
|
110
|
+
qCollection: "QDateCollection",
|
|
111
|
+
qParam: "QDateParam",
|
|
112
|
+
};
|
|
113
|
+
case odata_core_1.ODataTypesV4.TimeOfDay:
|
|
114
|
+
return {
|
|
115
|
+
outputType: "string",
|
|
116
|
+
qPath: "QTimeOfDayPath",
|
|
117
|
+
qCollection: "QTimeOfDayCollection",
|
|
118
|
+
qParam: "QTimeOfDayParam",
|
|
119
|
+
};
|
|
120
|
+
case odata_core_1.ODataTypesV4.DateTimeOffset:
|
|
121
|
+
return {
|
|
122
|
+
outputType: "string",
|
|
123
|
+
qPath: "QDateTimeOffsetPath",
|
|
124
|
+
qCollection: "QDateTimeOffsetCollection",
|
|
125
|
+
qParam: "QDateTimeOffsetParam",
|
|
126
|
+
};
|
|
127
|
+
case odata_core_1.ODataTypesV4.Binary:
|
|
128
|
+
return {
|
|
129
|
+
outputType: "string",
|
|
130
|
+
qPath: "QBinaryPath",
|
|
131
|
+
qCollection: "QBinaryCollection",
|
|
132
|
+
qParam: undefined,
|
|
133
|
+
};
|
|
134
|
+
case odata_core_1.ODataTypesV4.Guid:
|
|
135
|
+
return {
|
|
136
|
+
outputType: "string",
|
|
137
|
+
qPath: "QGuidPath",
|
|
138
|
+
qCollection: "QGuidCollection",
|
|
139
|
+
qParam: "QGuidParam",
|
|
140
|
+
};
|
|
141
|
+
default:
|
|
142
|
+
return {
|
|
143
|
+
outputType: "string",
|
|
144
|
+
qPath: "QStringPath",
|
|
145
|
+
qCollection: "QStringCollection",
|
|
146
|
+
qParam: undefined,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
addOperations(operations, type) {
|
|
151
|
+
if (!operations || !operations.length) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
operations.forEach((op) => {
|
|
155
|
+
var _a, _b, _c;
|
|
156
|
+
const params = (_b = (_a = op.Parameter) === null || _a === void 0 ? void 0 : _a.map(this.mapProp)) !== null && _b !== void 0 ? _b : [];
|
|
157
|
+
const returnType = (_c = op.ReturnType) === null || _c === void 0 ? void 0 : _c.map((rt) => {
|
|
158
|
+
return this.mapProp(Object.assign(Object.assign({}, rt), { $: Object.assign({ Name: "NO_NAME_BECAUSE_RETURN_TYPE" }, rt.$) }));
|
|
159
|
+
})[0];
|
|
160
|
+
const isBound = op.$.IsBound === "true";
|
|
161
|
+
if (isBound && !params.length) {
|
|
162
|
+
throw new Error(`IllegalState: Operation '${op.$.Name}' is bound, but has no parameters!`);
|
|
163
|
+
}
|
|
164
|
+
const bindingProp = isBound ? params.shift() : undefined;
|
|
165
|
+
const binding = bindingProp
|
|
166
|
+
? bindingProp.isCollection
|
|
167
|
+
? `Collection(${bindingProp.type})`
|
|
168
|
+
: bindingProp.type
|
|
169
|
+
: DigesterV4.ROOT_OPERATION;
|
|
170
|
+
const name = type === "Function" /* OperationTypes.Function */
|
|
171
|
+
? this.namingHelper.getFunctionName(op.$.Name)
|
|
172
|
+
: this.namingHelper.getActionName(op.$.Name);
|
|
173
|
+
const qName = type === "Function" /* OperationTypes.Function */
|
|
174
|
+
? this.namingHelper.getQFunctionName(op.$.Name)
|
|
175
|
+
: this.namingHelper.getQActionName(op.$.Name);
|
|
176
|
+
this.dataModel.addOperationType(binding, {
|
|
177
|
+
odataName: op.$.Name,
|
|
178
|
+
name,
|
|
179
|
+
qName,
|
|
180
|
+
paramsModelName: this.namingHelper.getOperationParamsModelName(op.$.Name),
|
|
181
|
+
type: type,
|
|
182
|
+
parameters: params,
|
|
183
|
+
returnType: returnType,
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
getRootOperationType(name) {
|
|
188
|
+
const rootOps = this.dataModel.getOperationTypeByBinding(DigesterV4.ROOT_OPERATION);
|
|
189
|
+
const rootOp = rootOps.find((op) => op.name === name);
|
|
190
|
+
if (!rootOp) {
|
|
191
|
+
throw new Error(`Couldn't find root operation with name [${name}]`);
|
|
192
|
+
}
|
|
193
|
+
return rootOp;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
196
|
//# sourceMappingURL=DataModelDigestionV4.js.map
|
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
import { ValueConverterImport } from "@odata2ts/converter-runtime";
|
|
2
|
-
export declare enum ODataVersion {
|
|
3
|
-
V2 = "2.0",
|
|
4
|
-
V4 = "4.0"
|
|
5
|
-
}
|
|
6
|
-
export declare const enum DataTypes {
|
|
7
|
-
PrimitiveType = "PrimitiveType",
|
|
8
|
-
EnumType = "EnumType",
|
|
9
|
-
ComplexType = "ComplexType",
|
|
10
|
-
ModelType = "ModelType"
|
|
11
|
-
}
|
|
12
|
-
export declare const enum OperationTypes {
|
|
13
|
-
Function = "Function",
|
|
14
|
-
Action = "Action"
|
|
15
|
-
}
|
|
16
|
-
export interface PropertyModel {
|
|
17
|
-
odataName: string;
|
|
18
|
-
name: string;
|
|
19
|
-
odataType: string;
|
|
20
|
-
type: string;
|
|
21
|
-
typeModule?: string;
|
|
22
|
-
qObject?: string;
|
|
23
|
-
qPath: string;
|
|
24
|
-
qParam?: string;
|
|
25
|
-
required: boolean;
|
|
26
|
-
isCollection: boolean;
|
|
27
|
-
dataType: DataTypes;
|
|
28
|
-
converters?: Array<ValueConverterImport>;
|
|
29
|
-
managed?: boolean;
|
|
30
|
-
}
|
|
31
|
-
export interface ModelType extends ComplexType {
|
|
32
|
-
idModelName: string;
|
|
33
|
-
qIdFunctionName: string;
|
|
34
|
-
generateId: boolean;
|
|
35
|
-
keyNames: Array<string>;
|
|
36
|
-
keys: Array<PropertyModel>;
|
|
37
|
-
getKeyUnion(): string;
|
|
38
|
-
}
|
|
39
|
-
export interface ComplexType {
|
|
40
|
-
odataName: string;
|
|
41
|
-
name: string;
|
|
42
|
-
editableName: string;
|
|
43
|
-
qName: string;
|
|
44
|
-
props: Array<PropertyModel>;
|
|
45
|
-
baseProps: Array<PropertyModel>;
|
|
46
|
-
baseClasses: Array<string>;
|
|
47
|
-
}
|
|
48
|
-
export interface EnumType {
|
|
49
|
-
odataName: string;
|
|
50
|
-
name: string;
|
|
51
|
-
members: Array<string>;
|
|
52
|
-
}
|
|
53
|
-
export interface OperationType {
|
|
54
|
-
odataName: string;
|
|
55
|
-
name: string;
|
|
56
|
-
paramsModelName: string;
|
|
57
|
-
qName: string;
|
|
58
|
-
type: OperationTypes;
|
|
59
|
-
parameters: Array<PropertyModel>;
|
|
60
|
-
returnType?: ReturnTypeModel;
|
|
61
|
-
usePost?: boolean;
|
|
62
|
-
}
|
|
63
|
-
export interface ReturnTypeModel extends PropertyModel {
|
|
64
|
-
}
|
|
65
|
-
export type EntityContainerModel = {
|
|
66
|
-
entitySets: {
|
|
67
|
-
[name: string]: EntitySetType;
|
|
68
|
-
};
|
|
69
|
-
singletons: {
|
|
70
|
-
[name: string]: SingletonType;
|
|
71
|
-
};
|
|
72
|
-
functions: {
|
|
73
|
-
[name: string]: FunctionImportType;
|
|
74
|
-
};
|
|
75
|
-
actions: {
|
|
76
|
-
[name: string]: ActionImportType;
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
export interface SingletonType {
|
|
80
|
-
odataName: string;
|
|
81
|
-
name: string;
|
|
82
|
-
entityType: ModelType;
|
|
83
|
-
navPropBinding?: Array<NavPropBindingType>;
|
|
84
|
-
}
|
|
85
|
-
export interface EntitySetType {
|
|
86
|
-
odataName: string;
|
|
87
|
-
name: string;
|
|
88
|
-
entityType: ModelType;
|
|
89
|
-
navPropBinding?: Array<NavPropBindingType>;
|
|
90
|
-
}
|
|
91
|
-
export interface NavPropBindingType {
|
|
92
|
-
path: string;
|
|
93
|
-
target: string;
|
|
94
|
-
}
|
|
95
|
-
export interface ActionImportType {
|
|
96
|
-
odataName: string;
|
|
97
|
-
name: string;
|
|
98
|
-
operation: OperationType;
|
|
99
|
-
}
|
|
100
|
-
export interface FunctionImportType extends ActionImportType {
|
|
101
|
-
entitySet: string;
|
|
102
|
-
}
|
|
1
|
+
import { ValueConverterImport } from "@odata2ts/converter-runtime";
|
|
2
|
+
export declare enum ODataVersion {
|
|
3
|
+
V2 = "2.0",
|
|
4
|
+
V4 = "4.0"
|
|
5
|
+
}
|
|
6
|
+
export declare const enum DataTypes {
|
|
7
|
+
PrimitiveType = "PrimitiveType",
|
|
8
|
+
EnumType = "EnumType",
|
|
9
|
+
ComplexType = "ComplexType",
|
|
10
|
+
ModelType = "ModelType"
|
|
11
|
+
}
|
|
12
|
+
export declare const enum OperationTypes {
|
|
13
|
+
Function = "Function",
|
|
14
|
+
Action = "Action"
|
|
15
|
+
}
|
|
16
|
+
export interface PropertyModel {
|
|
17
|
+
odataName: string;
|
|
18
|
+
name: string;
|
|
19
|
+
odataType: string;
|
|
20
|
+
type: string;
|
|
21
|
+
typeModule?: string;
|
|
22
|
+
qObject?: string;
|
|
23
|
+
qPath: string;
|
|
24
|
+
qParam?: string;
|
|
25
|
+
required: boolean;
|
|
26
|
+
isCollection: boolean;
|
|
27
|
+
dataType: DataTypes;
|
|
28
|
+
converters?: Array<ValueConverterImport>;
|
|
29
|
+
managed?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface ModelType extends ComplexType {
|
|
32
|
+
idModelName: string;
|
|
33
|
+
qIdFunctionName: string;
|
|
34
|
+
generateId: boolean;
|
|
35
|
+
keyNames: Array<string>;
|
|
36
|
+
keys: Array<PropertyModel>;
|
|
37
|
+
getKeyUnion(): string;
|
|
38
|
+
}
|
|
39
|
+
export interface ComplexType {
|
|
40
|
+
odataName: string;
|
|
41
|
+
name: string;
|
|
42
|
+
editableName: string;
|
|
43
|
+
qName: string;
|
|
44
|
+
props: Array<PropertyModel>;
|
|
45
|
+
baseProps: Array<PropertyModel>;
|
|
46
|
+
baseClasses: Array<string>;
|
|
47
|
+
}
|
|
48
|
+
export interface EnumType {
|
|
49
|
+
odataName: string;
|
|
50
|
+
name: string;
|
|
51
|
+
members: Array<string>;
|
|
52
|
+
}
|
|
53
|
+
export interface OperationType {
|
|
54
|
+
odataName: string;
|
|
55
|
+
name: string;
|
|
56
|
+
paramsModelName: string;
|
|
57
|
+
qName: string;
|
|
58
|
+
type: OperationTypes;
|
|
59
|
+
parameters: Array<PropertyModel>;
|
|
60
|
+
returnType?: ReturnTypeModel;
|
|
61
|
+
usePost?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface ReturnTypeModel extends PropertyModel {
|
|
64
|
+
}
|
|
65
|
+
export type EntityContainerModel = {
|
|
66
|
+
entitySets: {
|
|
67
|
+
[name: string]: EntitySetType;
|
|
68
|
+
};
|
|
69
|
+
singletons: {
|
|
70
|
+
[name: string]: SingletonType;
|
|
71
|
+
};
|
|
72
|
+
functions: {
|
|
73
|
+
[name: string]: FunctionImportType;
|
|
74
|
+
};
|
|
75
|
+
actions: {
|
|
76
|
+
[name: string]: ActionImportType;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export interface SingletonType {
|
|
80
|
+
odataName: string;
|
|
81
|
+
name: string;
|
|
82
|
+
entityType: ModelType;
|
|
83
|
+
navPropBinding?: Array<NavPropBindingType>;
|
|
84
|
+
}
|
|
85
|
+
export interface EntitySetType {
|
|
86
|
+
odataName: string;
|
|
87
|
+
name: string;
|
|
88
|
+
entityType: ModelType;
|
|
89
|
+
navPropBinding?: Array<NavPropBindingType>;
|
|
90
|
+
}
|
|
91
|
+
export interface NavPropBindingType {
|
|
92
|
+
path: string;
|
|
93
|
+
target: string;
|
|
94
|
+
}
|
|
95
|
+
export interface ActionImportType {
|
|
96
|
+
odataName: string;
|
|
97
|
+
name: string;
|
|
98
|
+
operation: OperationType;
|
|
99
|
+
}
|
|
100
|
+
export interface FunctionImportType extends ActionImportType {
|
|
101
|
+
entitySet: string;
|
|
102
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ODataVersion = void 0;
|
|
4
|
-
var ODataVersion;
|
|
5
|
-
(function (ODataVersion) {
|
|
6
|
-
ODataVersion["V2"] = "2.0";
|
|
7
|
-
ODataVersion["V4"] = "4.0";
|
|
8
|
-
})(ODataVersion
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ODataVersion = void 0;
|
|
4
|
+
var ODataVersion;
|
|
5
|
+
(function (ODataVersion) {
|
|
6
|
+
ODataVersion["V2"] = "2.0";
|
|
7
|
+
ODataVersion["V4"] = "4.0";
|
|
8
|
+
})(ODataVersion || (exports.ODataVersion = ODataVersion = {}));
|
|
9
9
|
//# sourceMappingURL=DataTypeModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataTypeModel.js","sourceRoot":"","sources":["../../src/data-model/DataTypeModel.ts"],"names":[],"mappings":";;;AAEA,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,0BAAU,CAAA;IACV,0BAAU,CAAA;AACZ,CAAC,EAHW,YAAY,
|
|
1
|
+
{"version":3,"file":"DataTypeModel.js","sourceRoot":"","sources":["../../src/data-model/DataTypeModel.ts"],"names":[],"mappings":";;;AAEA,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,0BAAU,CAAA;IACV,0BAAU,CAAA;AACZ,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB","sourcesContent":["import { ValueConverterImport } from \"@odata2ts/converter-runtime\";\r\n\r\nexport enum ODataVersion {\r\n V2 = \"2.0\",\r\n V4 = \"4.0\",\r\n}\r\n\r\nexport const enum DataTypes {\r\n PrimitiveType = \"PrimitiveType\",\r\n EnumType = \"EnumType\",\r\n ComplexType = \"ComplexType\",\r\n ModelType = \"ModelType\",\r\n}\r\n\r\nexport const enum OperationTypes {\r\n Function = \"Function\",\r\n Action = \"Action\",\r\n}\r\n\r\nexport interface PropertyModel {\r\n odataName: string;\r\n name: string;\r\n odataType: string;\r\n type: string;\r\n typeModule?: string;\r\n qObject?: string;\r\n qPath: string;\r\n qParam?: string;\r\n required: boolean;\r\n isCollection: boolean;\r\n dataType: DataTypes;\r\n converters?: Array<ValueConverterImport>;\r\n managed?: boolean;\r\n}\r\n\r\nexport interface ModelType extends ComplexType {\r\n idModelName: string;\r\n qIdFunctionName: string;\r\n generateId: boolean;\r\n keyNames: Array<string>;\r\n keys: Array<PropertyModel>;\r\n getKeyUnion(): string;\r\n}\r\n\r\nexport interface ComplexType {\r\n odataName: string;\r\n name: string;\r\n editableName: string;\r\n qName: string;\r\n props: Array<PropertyModel>;\r\n baseProps: Array<PropertyModel>;\r\n baseClasses: Array<string>;\r\n}\r\n\r\nexport interface EnumType {\r\n odataName: string;\r\n name: string;\r\n members: Array<string>;\r\n}\r\n\r\nexport interface OperationType {\r\n odataName: string;\r\n name: string;\r\n paramsModelName: string;\r\n qName: string;\r\n type: OperationTypes;\r\n parameters: Array<PropertyModel>;\r\n returnType?: ReturnTypeModel;\r\n usePost?: boolean;\r\n}\r\n\r\nexport interface ReturnTypeModel extends PropertyModel {}\r\n\r\nexport type EntityContainerModel = {\r\n entitySets: { [name: string]: EntitySetType };\r\n singletons: { [name: string]: SingletonType };\r\n functions: { [name: string]: FunctionImportType };\r\n actions: { [name: string]: ActionImportType };\r\n};\r\n\r\nexport interface SingletonType {\r\n odataName: string;\r\n name: string;\r\n entityType: ModelType;\r\n navPropBinding?: Array<NavPropBindingType>;\r\n}\r\n\r\nexport interface EntitySetType {\r\n odataName: string;\r\n name: string;\r\n entityType: ModelType;\r\n navPropBinding?: Array<NavPropBindingType>;\r\n}\r\n\r\nexport interface NavPropBindingType {\r\n path: string;\r\n target: string;\r\n}\r\n\r\nexport interface ActionImportType {\r\n odataName: string;\r\n name: string;\r\n operation: OperationType;\r\n}\r\n\r\nexport interface FunctionImportType extends ActionImportType {\r\n entitySet: string;\r\n}\r\n"]}
|