@opra/common 1.0.0-alpha.3 → 1.0.0-alpha.5
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/browser.js +253 -78
- package/cjs/document/data-type/api-field.js +4 -0
- package/cjs/document/data-type/complex-type-base.js +4 -0
- package/cjs/document/data-type/complex-type.js +2 -0
- package/cjs/document/data-type/enum-type.js +2 -0
- package/cjs/document/data-type/extended-types/base64.type.js +4 -0
- package/cjs/document/data-type/extended-types/date-string.type.js +4 -0
- package/cjs/document/data-type/extended-types/date-time-string.type.js +4 -0
- package/cjs/document/data-type/extended-types/date-time.type.js +4 -0
- package/cjs/document/data-type/extended-types/date.type.js +4 -0
- package/cjs/document/data-type/extended-types/email.type.js +4 -0
- package/cjs/document/data-type/extended-types/field-path.type.js +4 -0
- package/cjs/document/data-type/extended-types/filter.type.js +4 -0
- package/cjs/document/data-type/extended-types/object-id.type.js +4 -0
- package/cjs/document/data-type/extended-types/time.type.js +4 -0
- package/cjs/document/data-type/extended-types/url.type.js +4 -0
- package/cjs/document/data-type/extended-types/uuid.type.js +4 -0
- package/cjs/document/data-type/mapped-type.js +3 -0
- package/cjs/document/data-type/mixin-type.js +3 -0
- package/cjs/document/data-type/primitive-types/bigint.type.js +4 -0
- package/cjs/document/data-type/primitive-types/boolean.type.js +4 -0
- package/cjs/document/data-type/primitive-types/integer.type.js +4 -0
- package/cjs/document/data-type/primitive-types/null.type.js +4 -0
- package/cjs/document/data-type/primitive-types/number.type.js +4 -0
- package/cjs/document/data-type/primitive-types/string.type.js +4 -0
- package/cjs/document/data-type/simple-type.js +8 -1
- package/cjs/document/decorators/http-controller.decorator.js +25 -0
- package/cjs/document/decorators/http-operation-entity.decorator.js +55 -19
- package/cjs/document/factory/data-type.factory.js +61 -38
- package/cjs/document/http/http-api.js +2 -2
- package/cjs/document/http/http-controller.js +6 -6
- package/cjs/document/http/http-parameter.js +2 -0
- package/esm/document/data-type/api-field.js +4 -0
- package/esm/document/data-type/complex-type-base.js +4 -0
- package/esm/document/data-type/complex-type.js +2 -0
- package/esm/document/data-type/enum-type.js +2 -0
- package/esm/document/data-type/extended-types/base64.type.js +4 -0
- package/esm/document/data-type/extended-types/date-string.type.js +4 -0
- package/esm/document/data-type/extended-types/date-time-string.type.js +4 -0
- package/esm/document/data-type/extended-types/date-time.type.js +4 -0
- package/esm/document/data-type/extended-types/date.type.js +4 -0
- package/esm/document/data-type/extended-types/email.type.js +4 -0
- package/esm/document/data-type/extended-types/field-path.type.js +4 -0
- package/esm/document/data-type/extended-types/filter.type.js +4 -0
- package/esm/document/data-type/extended-types/object-id.type.js +4 -0
- package/esm/document/data-type/extended-types/time.type.js +4 -0
- package/esm/document/data-type/extended-types/url.type.js +4 -0
- package/esm/document/data-type/extended-types/uuid.type.js +4 -0
- package/esm/document/data-type/mapped-type.js +3 -0
- package/esm/document/data-type/mixin-type.js +3 -0
- package/esm/document/data-type/primitive-types/bigint.type.js +4 -0
- package/esm/document/data-type/primitive-types/boolean.type.js +4 -0
- package/esm/document/data-type/primitive-types/integer.type.js +4 -0
- package/esm/document/data-type/primitive-types/null.type.js +4 -0
- package/esm/document/data-type/primitive-types/number.type.js +4 -0
- package/esm/document/data-type/primitive-types/string.type.js +4 -0
- package/esm/document/data-type/simple-type.js +8 -1
- package/esm/document/decorators/http-controller.decorator.js +25 -0
- package/esm/document/decorators/http-operation-entity.decorator.js +55 -19
- package/esm/document/factory/data-type.factory.js +61 -38
- package/esm/document/http/http-api.js +2 -2
- package/esm/document/http/http-controller.js +6 -6
- package/esm/document/http/http-parameter.js +2 -0
- package/package.json +3 -3
- package/types/document/data-type/api-field.d.ts +2 -0
- package/types/document/data-type/complex-type.d.ts +1 -1
- package/types/document/data-type/data-type.d.ts +4 -2
- package/types/document/data-type/enum-type.d.ts +2 -2
- package/types/document/data-type/mapped-type.d.ts +2 -2
- package/types/document/data-type/mixin-type.d.ts +2 -2
- package/types/document/data-type/simple-type.d.ts +4 -2
- package/types/document/decorators/http-controller.decorator.d.ts +1 -0
- package/types/document/factory/data-type.factory.d.ts +5 -0
- package/types/document/http/http-parameter.d.ts +2 -0
- package/types/schema/data-type/simple-type.interface.d.ts +4 -0
- package/types/schema/http/http-parameter.interface.d.ts +4 -0
package/browser.js
CHANGED
|
@@ -1172,6 +1172,10 @@ var ComplexTypeBaseClass = class extends DataType {
|
|
|
1172
1172
|
const pickList = !!(projection && Object.values(projection).find((p) => !p.sign));
|
|
1173
1173
|
let fieldName;
|
|
1174
1174
|
for (const field of this.fields.values()) {
|
|
1175
|
+
if (context.ignoreReadonlyFields && field.readonly || context.ignoreWriteonlyFields && field.writeonly) {
|
|
1176
|
+
schema[field.name] = vg.isUndefined({ coerce: true });
|
|
1177
|
+
continue;
|
|
1178
|
+
}
|
|
1175
1179
|
fieldName = field.name;
|
|
1176
1180
|
let p;
|
|
1177
1181
|
if (projection !== "*") {
|
|
@@ -1230,6 +1234,8 @@ var ApiField = /* @__PURE__ */ __name(function(...args) {
|
|
|
1230
1234
|
_this.exclusive = initArgs.exclusive;
|
|
1231
1235
|
_this.translatable = initArgs.translatable;
|
|
1232
1236
|
_this.deprecated = initArgs.deprecated;
|
|
1237
|
+
_this.readonly = initArgs.readonly;
|
|
1238
|
+
_this.writeonly = initArgs.writeonly;
|
|
1233
1239
|
_this.examples = initArgs.examples;
|
|
1234
1240
|
}, "ApiField");
|
|
1235
1241
|
var ApiFieldClass = class extends DocumentElement {
|
|
@@ -1248,6 +1254,8 @@ var ApiFieldClass = class extends DocumentElement {
|
|
|
1248
1254
|
exclusive: this.exclusive,
|
|
1249
1255
|
translatable: this.translatable,
|
|
1250
1256
|
deprecated: this.deprecated,
|
|
1257
|
+
readonly: this.readonly,
|
|
1258
|
+
writeonly: this.writeonly,
|
|
1251
1259
|
examples: this.examples
|
|
1252
1260
|
});
|
|
1253
1261
|
}
|
|
@@ -1297,6 +1305,8 @@ var ComplexTypeClass = class extends ComplexTypeBase {
|
|
|
1297
1305
|
__name(this, "ComplexTypeClass");
|
|
1298
1306
|
}
|
|
1299
1307
|
extendsFrom(baseType) {
|
|
1308
|
+
if (!(baseType instanceof DataType))
|
|
1309
|
+
baseType = this.node.getDataType(baseType);
|
|
1300
1310
|
if (!(baseType instanceof ComplexTypeBase))
|
|
1301
1311
|
return false;
|
|
1302
1312
|
if (baseType === this)
|
|
@@ -1364,6 +1374,8 @@ var EnumTypeClass = class extends DataType {
|
|
|
1364
1374
|
__name(this, "EnumTypeClass");
|
|
1365
1375
|
}
|
|
1366
1376
|
extendsFrom(baseType) {
|
|
1377
|
+
if (!(baseType instanceof DataType))
|
|
1378
|
+
baseType = this.node.getDataType(baseType);
|
|
1367
1379
|
if (!(baseType instanceof EnumType2))
|
|
1368
1380
|
return false;
|
|
1369
1381
|
if (baseType === this)
|
|
@@ -1495,6 +1507,8 @@ var MappedTypeClass = class extends ComplexTypeBase {
|
|
|
1495
1507
|
__name(this, "MappedTypeClass");
|
|
1496
1508
|
}
|
|
1497
1509
|
extendsFrom(baseType) {
|
|
1510
|
+
if (!(baseType instanceof DataType))
|
|
1511
|
+
baseType = this.node.getDataType(baseType);
|
|
1498
1512
|
if (!(baseType instanceof ComplexTypeBase))
|
|
1499
1513
|
return false;
|
|
1500
1514
|
if (baseType === this)
|
|
@@ -1549,6 +1563,8 @@ var MixinTypeClass = class extends ComplexTypeBase {
|
|
|
1549
1563
|
__name(this, "MixinTypeClass");
|
|
1550
1564
|
}
|
|
1551
1565
|
extendsFrom(baseType) {
|
|
1566
|
+
if (!(baseType instanceof DataType))
|
|
1567
|
+
baseType = this.node.getDataType(baseType);
|
|
1552
1568
|
if (!(baseType instanceof ComplexTypeBase))
|
|
1553
1569
|
return false;
|
|
1554
1570
|
if (baseType === this)
|
|
@@ -1683,6 +1699,8 @@ var SimpleType2 = /* @__PURE__ */ __name(function(...args) {
|
|
|
1683
1699
|
_this.base = initArgs.base;
|
|
1684
1700
|
}
|
|
1685
1701
|
_this.properties = initArgs.properties;
|
|
1702
|
+
_this.ownNameMappings = { ...initArgs.nameMappings };
|
|
1703
|
+
_this.nameMappings = { ..._this.base?.nameMappings, ...initArgs.nameMappings };
|
|
1686
1704
|
_this.ownAttributes = cloneObject(initArgs.attributes || {});
|
|
1687
1705
|
_this.attributes = _this.base ? cloneObject(_this.base.attributes) : {};
|
|
1688
1706
|
if (_this.ownAttributes) {
|
|
@@ -1700,6 +1718,8 @@ var SimpleTypeClass = class extends DataType {
|
|
|
1700
1718
|
__name(this, "SimpleTypeClass");
|
|
1701
1719
|
}
|
|
1702
1720
|
extendsFrom(baseType) {
|
|
1721
|
+
if (!(baseType instanceof DataType))
|
|
1722
|
+
baseType = this.node.getDataType(baseType);
|
|
1703
1723
|
if (!(baseType instanceof SimpleType2))
|
|
1704
1724
|
return false;
|
|
1705
1725
|
if (baseType === this)
|
|
@@ -1742,12 +1762,15 @@ var SimpleTypeClass = class extends DataType {
|
|
|
1742
1762
|
return o;
|
|
1743
1763
|
}, {});
|
|
1744
1764
|
const baseName = this.base ? this.node.getDataTypeNameWithNs(this.base) : void 0;
|
|
1745
|
-
|
|
1765
|
+
const out = omitUndefined({
|
|
1746
1766
|
...DataType.prototype.toJSON.apply(this),
|
|
1747
1767
|
base: this.base ? baseName ? baseName : this.base.toJSON() : void 0,
|
|
1748
1768
|
attributes: attributes && Object.keys(attributes).length ? attributes : void 0,
|
|
1749
1769
|
properties: Object.keys(properties).length ? properties : void 0
|
|
1750
1770
|
});
|
|
1771
|
+
if (Object.keys(this.ownNameMappings).length)
|
|
1772
|
+
out.nameMappings = { ...this.ownNameMappings };
|
|
1773
|
+
return out;
|
|
1751
1774
|
}
|
|
1752
1775
|
};
|
|
1753
1776
|
SimpleType2.prototype = SimpleTypeClass.prototype;
|
|
@@ -1872,7 +1895,7 @@ var DataTypeFactory = class {
|
|
|
1872
1895
|
thunk = await resolveThunk(thunk);
|
|
1873
1896
|
const { importQueue, initArgsMap } = context;
|
|
1874
1897
|
const dataType = owner.node.findDataType(thunk);
|
|
1875
|
-
if (dataType)
|
|
1898
|
+
if (dataType instanceof DataType)
|
|
1876
1899
|
return dataType.name;
|
|
1877
1900
|
let metadata2;
|
|
1878
1901
|
let ctor;
|
|
@@ -1941,10 +1964,14 @@ var DataTypeFactory = class {
|
|
|
1941
1964
|
};
|
|
1942
1965
|
out[initializingSymbol] = true;
|
|
1943
1966
|
try {
|
|
1944
|
-
if (out.name
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1967
|
+
if (out.name) {
|
|
1968
|
+
if (importQueue?.has(out.name)) {
|
|
1969
|
+
initArgsMap?.set(metadata2.name, out);
|
|
1970
|
+
out._instance = { name: metadata2.name };
|
|
1971
|
+
out[kDataTypeMap] = owner.node[kDataTypeMap];
|
|
1972
|
+
} else
|
|
1973
|
+
return context.addError(`Data Type (${out.name}) must be explicitly added to type list in the document scope`);
|
|
1974
|
+
}
|
|
1948
1975
|
switch (out.kind) {
|
|
1949
1976
|
case OpraSchema.ComplexType.Kind:
|
|
1950
1977
|
out.ctor = ctor;
|
|
@@ -2055,6 +2082,7 @@ var DataTypeFactory = class {
|
|
|
2055
2082
|
initArgs.ctor = initArgs.ctor || baseArgs.ctor;
|
|
2056
2083
|
});
|
|
2057
2084
|
initArgs.properties = metadata2.properties;
|
|
2085
|
+
initArgs.nameMappings = metadata2.nameMappings;
|
|
2058
2086
|
if (!initArgs.properties && initArgs.ctor)
|
|
2059
2087
|
initArgs.properties = new initArgs.ctor();
|
|
2060
2088
|
if (metadata2.attributes)
|
|
@@ -2106,26 +2134,40 @@ var DataTypeFactory = class {
|
|
|
2106
2134
|
});
|
|
2107
2135
|
}
|
|
2108
2136
|
static _createDataType(context, owner, args) {
|
|
2137
|
+
let dataType = owner.node.findDataType(typeof args === "string" ? args : args.name || "");
|
|
2138
|
+
if (dataType instanceof DataType)
|
|
2139
|
+
return dataType;
|
|
2109
2140
|
const initArgs = typeof args === "string" ? context.initArgsMap?.get(args) : args;
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2141
|
+
if (initArgs) {
|
|
2142
|
+
const dataTypeMap = initArgs[kDataTypeMap];
|
|
2143
|
+
if (!dataTypeMap)
|
|
2144
|
+
delete initArgs._instance;
|
|
2145
|
+
dataType = initArgs._instance;
|
|
2146
|
+
if (dataType?.name && dataTypeMap) {
|
|
2147
|
+
dataTypeMap.set(dataType.name, dataType);
|
|
2148
|
+
}
|
|
2149
|
+
switch (initArgs?.kind) {
|
|
2150
|
+
case OpraSchema.ComplexType.Kind:
|
|
2151
|
+
return this._createComplexType(context, owner, initArgs);
|
|
2152
|
+
case OpraSchema.EnumType.Kind:
|
|
2153
|
+
return this._createEnumType(context, owner, initArgs);
|
|
2154
|
+
case OpraSchema.MappedType.Kind:
|
|
2155
|
+
return this._createMappedType(context, owner, initArgs);
|
|
2156
|
+
case OpraSchema.MixinType.Kind:
|
|
2157
|
+
return this._createMixinType(context, owner, initArgs);
|
|
2158
|
+
case OpraSchema.SimpleType.Kind:
|
|
2159
|
+
return this._createSimpleType(context, owner, initArgs);
|
|
2160
|
+
}
|
|
2121
2161
|
}
|
|
2122
2162
|
context.addError(`Unknown data type (${String(args)})`);
|
|
2123
2163
|
}
|
|
2124
2164
|
static _createComplexType(context, owner, args) {
|
|
2165
|
+
const dataType = args._instance || {};
|
|
2166
|
+
Object.setPrototypeOf(dataType, ComplexType2.prototype);
|
|
2125
2167
|
const initArgs = cloneObject(args);
|
|
2126
2168
|
if (args.base) {
|
|
2127
2169
|
context.enter(".base", () => {
|
|
2128
|
-
initArgs.base =
|
|
2170
|
+
initArgs.base = this._createDataType(context, owner, args.base);
|
|
2129
2171
|
});
|
|
2130
2172
|
}
|
|
2131
2173
|
if (args.additionalFields) {
|
|
@@ -2133,11 +2175,7 @@ var DataTypeFactory = class {
|
|
|
2133
2175
|
if (typeof args.additionalFields === "boolean" || Array.isArray(args.additionalFields))
|
|
2134
2176
|
initArgs.additionalFields = args.additionalFields;
|
|
2135
2177
|
else {
|
|
2136
|
-
|
|
2137
|
-
initArgs.additionalFields = owner.node.findDataType(args.additionalFields) || this._createDataType(context, owner, args.additionalFields);
|
|
2138
|
-
} else {
|
|
2139
|
-
initArgs.additionalFields = this._createDataType(context, owner, args.additionalFields);
|
|
2140
|
-
}
|
|
2178
|
+
initArgs.additionalFields = this._createDataType(context, owner, args.additionalFields);
|
|
2141
2179
|
}
|
|
2142
2180
|
});
|
|
2143
2181
|
}
|
|
@@ -2146,7 +2184,7 @@ var DataTypeFactory = class {
|
|
|
2146
2184
|
context.enter(".fields", () => {
|
|
2147
2185
|
for (const [k, v] of Object.entries(args.fields)) {
|
|
2148
2186
|
context.enter(`[${k}]`, () => {
|
|
2149
|
-
const type =
|
|
2187
|
+
const type = this._createDataType(context, owner, v.type);
|
|
2150
2188
|
if (type)
|
|
2151
2189
|
initArgs.fields[k] = {
|
|
2152
2190
|
...v,
|
|
@@ -2157,28 +2195,37 @@ var DataTypeFactory = class {
|
|
|
2157
2195
|
}
|
|
2158
2196
|
});
|
|
2159
2197
|
}
|
|
2160
|
-
|
|
2198
|
+
ComplexType2.apply(dataType, [owner, initArgs]);
|
|
2199
|
+
return dataType;
|
|
2161
2200
|
}
|
|
2162
2201
|
static _createEnumType(context, owner, args) {
|
|
2202
|
+
const dataType = args._instance || {};
|
|
2203
|
+
Object.setPrototypeOf(dataType, EnumType2.prototype);
|
|
2163
2204
|
const initArgs = cloneObject(args);
|
|
2164
2205
|
if (args.base) {
|
|
2165
2206
|
context.enter(".base", () => {
|
|
2166
|
-
initArgs.base =
|
|
2207
|
+
initArgs.base = this._createDataType(context, owner, args.base);
|
|
2167
2208
|
});
|
|
2168
2209
|
}
|
|
2169
2210
|
initArgs.attributes = args.attributes;
|
|
2170
|
-
|
|
2211
|
+
EnumType2.apply(dataType, [owner, initArgs]);
|
|
2212
|
+
return dataType;
|
|
2171
2213
|
}
|
|
2172
2214
|
static _createMappedType(context, owner, args) {
|
|
2215
|
+
const dataType = args._instance || {};
|
|
2216
|
+
Object.setPrototypeOf(dataType, MappedType2.prototype);
|
|
2173
2217
|
const initArgs = cloneObject(args);
|
|
2174
2218
|
if (args.base) {
|
|
2175
2219
|
context.enter(".base", () => {
|
|
2176
|
-
initArgs.base =
|
|
2220
|
+
initArgs.base = this._createDataType(context, owner, args.base);
|
|
2177
2221
|
});
|
|
2178
2222
|
}
|
|
2179
|
-
|
|
2223
|
+
MappedType2.apply(dataType, [owner, initArgs]);
|
|
2224
|
+
return dataType;
|
|
2180
2225
|
}
|
|
2181
2226
|
static _createMixinType(context, owner, args) {
|
|
2227
|
+
const dataType = args._instance || {};
|
|
2228
|
+
Object.setPrototypeOf(dataType, MixinType2.prototype);
|
|
2182
2229
|
const initArgs = cloneObject(args);
|
|
2183
2230
|
if (args.types) {
|
|
2184
2231
|
context.enter(".types", () => {
|
|
@@ -2186,7 +2233,7 @@ var DataTypeFactory = class {
|
|
|
2186
2233
|
let i = 0;
|
|
2187
2234
|
for (const t of args.types) {
|
|
2188
2235
|
context.enter(`[${i++}]`, () => {
|
|
2189
|
-
const base =
|
|
2236
|
+
const base = this._createDataType(context, owner, t);
|
|
2190
2237
|
if (!(base instanceof ComplexTypeBase))
|
|
2191
2238
|
throw new TypeError(`"${base?.kind}" can't be set as base for a "${initArgs.kind}"`);
|
|
2192
2239
|
initArgs.types.push(base);
|
|
@@ -2194,16 +2241,20 @@ var DataTypeFactory = class {
|
|
|
2194
2241
|
}
|
|
2195
2242
|
});
|
|
2196
2243
|
}
|
|
2197
|
-
|
|
2244
|
+
MixinType2.apply(dataType, [owner, initArgs]);
|
|
2245
|
+
return dataType;
|
|
2198
2246
|
}
|
|
2199
2247
|
static _createSimpleType(context, owner, args) {
|
|
2248
|
+
const dataType = args._instance || {};
|
|
2249
|
+
Object.setPrototypeOf(dataType, SimpleType2.prototype);
|
|
2200
2250
|
const initArgs = cloneObject(args);
|
|
2201
2251
|
if (args.base) {
|
|
2202
2252
|
context.enter(".base", () => {
|
|
2203
|
-
initArgs.base =
|
|
2253
|
+
initArgs.base = this._createDataType(context, owner, args.base);
|
|
2204
2254
|
});
|
|
2205
2255
|
}
|
|
2206
|
-
|
|
2256
|
+
SimpleType2.apply(dataType, [owner, initArgs]);
|
|
2257
|
+
return dataType;
|
|
2207
2258
|
}
|
|
2208
2259
|
};
|
|
2209
2260
|
function preferName(initArgs) {
|
|
@@ -2377,6 +2428,26 @@ function HttpControllerDecoratorFactory(options) {
|
|
|
2377
2428
|
});
|
|
2378
2429
|
return decorator;
|
|
2379
2430
|
};
|
|
2431
|
+
decorator.KeyParam = (name, arg1) => {
|
|
2432
|
+
decoratorChain.push((meta) => {
|
|
2433
|
+
if (!meta.path?.includes(":" + name))
|
|
2434
|
+
meta.path = (meta.path || "") + "@:" + name;
|
|
2435
|
+
const paramMeta = typeof arg1 === "string" || typeof arg1 === "function" ? {
|
|
2436
|
+
name,
|
|
2437
|
+
location: "path",
|
|
2438
|
+
type: arg1,
|
|
2439
|
+
keyParam: true
|
|
2440
|
+
} : {
|
|
2441
|
+
...arg1,
|
|
2442
|
+
name,
|
|
2443
|
+
location: "path",
|
|
2444
|
+
keyParam: true
|
|
2445
|
+
};
|
|
2446
|
+
meta.parameters = meta.parameters || [];
|
|
2447
|
+
meta.parameters.push(paramMeta);
|
|
2448
|
+
});
|
|
2449
|
+
return decorator;
|
|
2450
|
+
};
|
|
2380
2451
|
decorator.UseType = (...type) => {
|
|
2381
2452
|
decoratorChain.push((meta) => {
|
|
2382
2453
|
meta.types = meta.types || [];
|
|
@@ -2479,20 +2550,20 @@ var HttpControllerClass = class extends DocumentElement {
|
|
|
2479
2550
|
});
|
|
2480
2551
|
if (this.operations.size) {
|
|
2481
2552
|
out.operations = {};
|
|
2482
|
-
for (const
|
|
2483
|
-
out.operations[name] = v.toJSON();
|
|
2553
|
+
for (const v of this.operations.values()) {
|
|
2554
|
+
out.operations[v.name] = v.toJSON();
|
|
2484
2555
|
}
|
|
2485
2556
|
}
|
|
2486
2557
|
if (this.controllers.size) {
|
|
2487
2558
|
out.controllers = {};
|
|
2488
|
-
for (const
|
|
2489
|
-
out.controllers[name] = v.toJSON();
|
|
2559
|
+
for (const v of this.controllers.values()) {
|
|
2560
|
+
out.controllers[v.name] = v.toJSON();
|
|
2490
2561
|
}
|
|
2491
2562
|
}
|
|
2492
2563
|
if (this.types.size) {
|
|
2493
2564
|
out.types = {};
|
|
2494
|
-
for (const
|
|
2495
|
-
out.types[name] = v.toJSON();
|
|
2565
|
+
for (const v of this.types.values()) {
|
|
2566
|
+
out.types[v.name] = v.toJSON();
|
|
2496
2567
|
}
|
|
2497
2568
|
}
|
|
2498
2569
|
if (this.parameters.length) {
|
|
@@ -2541,8 +2612,8 @@ var HttpApi = class extends ApiBase {
|
|
|
2541
2612
|
url: this.url,
|
|
2542
2613
|
controllers: {}
|
|
2543
2614
|
};
|
|
2544
|
-
for (const
|
|
2545
|
-
out.controllers[name] = v.toJSON();
|
|
2615
|
+
for (const v of this.controllers.values()) {
|
|
2616
|
+
out.controllers[v.name] = v.toJSON();
|
|
2546
2617
|
}
|
|
2547
2618
|
return out;
|
|
2548
2619
|
}
|
|
@@ -3243,6 +3314,7 @@ var HttpParameter = /* @__PURE__ */ __name(function(owner, initArgs) {
|
|
|
3243
3314
|
_this.deprecated = initArgs.deprecated;
|
|
3244
3315
|
_this.required = initArgs.required;
|
|
3245
3316
|
_this.arraySeparator = initArgs.arraySeparator;
|
|
3317
|
+
_this.keyParam = initArgs.keyParam;
|
|
3246
3318
|
}, "HttpParameter");
|
|
3247
3319
|
var HttpParameterClass = class extends Value {
|
|
3248
3320
|
static {
|
|
@@ -3254,6 +3326,7 @@ var HttpParameterClass = class extends Value {
|
|
|
3254
3326
|
name: this.name,
|
|
3255
3327
|
location: this.location,
|
|
3256
3328
|
arraySeparator: this.arraySeparator,
|
|
3329
|
+
keyParam: this.keyParam,
|
|
3257
3330
|
required: this.required,
|
|
3258
3331
|
deprecated: this.deprecated
|
|
3259
3332
|
});
|
|
@@ -3845,7 +3918,11 @@ __decorate([
|
|
|
3845
3918
|
], NumberType.prototype, "maxValue", void 0);
|
|
3846
3919
|
NumberType = __decorate([
|
|
3847
3920
|
SimpleType2({
|
|
3848
|
-
description: "Both Integer as well as Floating-Point numbers"
|
|
3921
|
+
description: "Both Integer as well as Floating-Point numbers",
|
|
3922
|
+
nameMappings: {
|
|
3923
|
+
js: "number",
|
|
3924
|
+
json: "number"
|
|
3925
|
+
}
|
|
3849
3926
|
}),
|
|
3850
3927
|
__metadata("design:paramtypes", [Object])
|
|
3851
3928
|
], NumberType);
|
|
@@ -3872,7 +3949,11 @@ var BigintType = class BigintType2 extends NumberType {
|
|
|
3872
3949
|
};
|
|
3873
3950
|
BigintType = __decorate([
|
|
3874
3951
|
SimpleType2({
|
|
3875
|
-
description: "BigInt number"
|
|
3952
|
+
description: "BigInt number",
|
|
3953
|
+
nameMappings: {
|
|
3954
|
+
js: "bigint",
|
|
3955
|
+
json: "string"
|
|
3956
|
+
}
|
|
3876
3957
|
}),
|
|
3877
3958
|
__metadata("design:paramtypes", [Object])
|
|
3878
3959
|
], BigintType);
|
|
@@ -3896,7 +3977,11 @@ var BooleanType = class BooleanType2 {
|
|
|
3896
3977
|
};
|
|
3897
3978
|
BooleanType = __decorate([
|
|
3898
3979
|
SimpleType2({
|
|
3899
|
-
description: "Simple true/false value"
|
|
3980
|
+
description: "Simple true/false value",
|
|
3981
|
+
nameMappings: {
|
|
3982
|
+
js: "boolean",
|
|
3983
|
+
json: "boolean"
|
|
3984
|
+
}
|
|
3900
3985
|
}),
|
|
3901
3986
|
__metadata("design:paramtypes", [Object])
|
|
3902
3987
|
], BooleanType);
|
|
@@ -3924,7 +4009,11 @@ var IntegerType = class IntegerType2 extends NumberType {
|
|
|
3924
4009
|
};
|
|
3925
4010
|
IntegerType = __decorate([
|
|
3926
4011
|
SimpleType2({
|
|
3927
|
-
description: "An integer number"
|
|
4012
|
+
description: "An integer number",
|
|
4013
|
+
nameMappings: {
|
|
4014
|
+
js: "number",
|
|
4015
|
+
json: "number"
|
|
4016
|
+
}
|
|
3928
4017
|
}),
|
|
3929
4018
|
__metadata("design:paramtypes", [Object])
|
|
3930
4019
|
], IntegerType);
|
|
@@ -3948,7 +4037,11 @@ var NullType = class NullType2 {
|
|
|
3948
4037
|
};
|
|
3949
4038
|
NullType = __decorate([
|
|
3950
4039
|
SimpleType2({
|
|
3951
|
-
description: "A Null value"
|
|
4040
|
+
description: "A Null value",
|
|
4041
|
+
nameMappings: {
|
|
4042
|
+
js: "null",
|
|
4043
|
+
json: "null"
|
|
4044
|
+
}
|
|
3952
4045
|
}),
|
|
3953
4046
|
__metadata("design:paramtypes", [Object])
|
|
3954
4047
|
], NullType);
|
|
@@ -4030,7 +4123,11 @@ __decorate([
|
|
|
4030
4123
|
], StringType.prototype, "maxLength", void 0);
|
|
4031
4124
|
StringType = __decorate([
|
|
4032
4125
|
SimpleType2({
|
|
4033
|
-
description: "A sequence of characters"
|
|
4126
|
+
description: "A sequence of characters",
|
|
4127
|
+
nameMappings: {
|
|
4128
|
+
js: "string",
|
|
4129
|
+
json: "string"
|
|
4130
|
+
}
|
|
4034
4131
|
}),
|
|
4035
4132
|
__metadata("design:paramtypes", [Object])
|
|
4036
4133
|
], StringType);
|
|
@@ -4054,7 +4151,11 @@ var Base64Type = class Base64Type2 {
|
|
|
4054
4151
|
};
|
|
4055
4152
|
Base64Type = __decorate([
|
|
4056
4153
|
SimpleType2({
|
|
4057
|
-
description: "A stream of bytes, base64 encoded"
|
|
4154
|
+
description: "A stream of bytes, base64 encoded",
|
|
4155
|
+
nameMappings: {
|
|
4156
|
+
js: "string",
|
|
4157
|
+
json: "string"
|
|
4158
|
+
}
|
|
4058
4159
|
}),
|
|
4059
4160
|
__metadata("design:paramtypes", [Object])
|
|
4060
4161
|
], Base64Type);
|
|
@@ -4110,7 +4211,11 @@ __decorate([
|
|
|
4110
4211
|
], DateType.prototype, "maxValue", void 0);
|
|
4111
4212
|
DateType = __decorate([
|
|
4112
4213
|
SimpleType2({
|
|
4113
|
-
description: "A date without time"
|
|
4214
|
+
description: "A date without time",
|
|
4215
|
+
nameMappings: {
|
|
4216
|
+
js: "Date",
|
|
4217
|
+
json: "string"
|
|
4218
|
+
}
|
|
4114
4219
|
}).Example("2021-04-18", "Full date value"),
|
|
4115
4220
|
__metadata("design:paramtypes", [Object])
|
|
4116
4221
|
], DateType);
|
|
@@ -4152,7 +4257,11 @@ __decorate([
|
|
|
4152
4257
|
], DateStringType.prototype, "maxValue", void 0);
|
|
4153
4258
|
DateStringType = __decorate([
|
|
4154
4259
|
SimpleType2({
|
|
4155
|
-
description: "Date string value"
|
|
4260
|
+
description: "Date string value",
|
|
4261
|
+
nameMappings: {
|
|
4262
|
+
js: "string",
|
|
4263
|
+
json: "string"
|
|
4264
|
+
}
|
|
4156
4265
|
}).Example("2021-04-18", "Full date value").Example("2021-04", "Date value without day").Example("2021", "Year only value"),
|
|
4157
4266
|
__metadata("design:paramtypes", [Object])
|
|
4158
4267
|
], DateStringType);
|
|
@@ -4208,7 +4317,11 @@ __decorate([
|
|
|
4208
4317
|
], DateTimeType.prototype, "maxValue", void 0);
|
|
4209
4318
|
DateTimeType = __decorate([
|
|
4210
4319
|
SimpleType2({
|
|
4211
|
-
description: "A full datetime value"
|
|
4320
|
+
description: "A full datetime value",
|
|
4321
|
+
nameMappings: {
|
|
4322
|
+
js: "string",
|
|
4323
|
+
json: "string"
|
|
4324
|
+
}
|
|
4212
4325
|
}).Example("2021-04-18T22:30:15").Example("2021-04-18 22:30:15").Example("2021-04-18 22:30"),
|
|
4213
4326
|
__metadata("design:paramtypes", [Object])
|
|
4214
4327
|
], DateTimeType);
|
|
@@ -4250,7 +4363,11 @@ __decorate([
|
|
|
4250
4363
|
], DateTimeStringType.prototype, "maxValue", void 0);
|
|
4251
4364
|
DateTimeStringType = __decorate([
|
|
4252
4365
|
SimpleType2({
|
|
4253
|
-
description: "DateTime string value"
|
|
4366
|
+
description: "DateTime string value",
|
|
4367
|
+
nameMappings: {
|
|
4368
|
+
js: "string",
|
|
4369
|
+
json: "string"
|
|
4370
|
+
}
|
|
4254
4371
|
}).Example("2021-04-18T22:30:15+01:00", "Full date-time value with timezone").Example("2021-04-18T22:30:15", "Full date-time value without timezone").Example("2021-04-18 22:30", "Date-time value").Example("2021-04-18", "Date value").Example("2021-04", "Date value without day").Example("2021", "Year only value"),
|
|
4255
4372
|
__metadata("design:paramtypes", [Object])
|
|
4256
4373
|
], DateTimeStringType);
|
|
@@ -4334,7 +4451,11 @@ __decorate([
|
|
|
4334
4451
|
], EmailType.prototype, "blacklistedChars", void 0);
|
|
4335
4452
|
EmailType = __decorate([
|
|
4336
4453
|
SimpleType2({
|
|
4337
|
-
description: "An email value"
|
|
4454
|
+
description: "An email value",
|
|
4455
|
+
nameMappings: {
|
|
4456
|
+
js: "string",
|
|
4457
|
+
json: "string"
|
|
4458
|
+
}
|
|
4338
4459
|
}).Example("some.body@example.com"),
|
|
4339
4460
|
__metadata("design:paramtypes", [Object])
|
|
4340
4461
|
], EmailType);
|
|
@@ -4383,7 +4504,11 @@ __decorate([
|
|
|
4383
4504
|
], FieldPathType.prototype, "allowSigns", void 0);
|
|
4384
4505
|
FieldPathType = __decorate([
|
|
4385
4506
|
SimpleType2({
|
|
4386
|
-
description: "Field path"
|
|
4507
|
+
description: "Field path",
|
|
4508
|
+
nameMappings: {
|
|
4509
|
+
js: "string",
|
|
4510
|
+
json: "string"
|
|
4511
|
+
}
|
|
4387
4512
|
}),
|
|
4388
4513
|
__metadata("design:paramtypes", [Object])
|
|
4389
4514
|
], FieldPathType);
|
|
@@ -12302,7 +12427,11 @@ __decorate([
|
|
|
12302
12427
|
], FilterType.prototype, "rules", void 0);
|
|
12303
12428
|
FilterType = __decorate([
|
|
12304
12429
|
SimpleType2({
|
|
12305
|
-
description: "A query filter"
|
|
12430
|
+
description: "A query filter",
|
|
12431
|
+
nameMappings: {
|
|
12432
|
+
js: "object",
|
|
12433
|
+
json: "string"
|
|
12434
|
+
}
|
|
12306
12435
|
}),
|
|
12307
12436
|
__metadata("design:paramtypes", [Object])
|
|
12308
12437
|
], FilterType);
|
|
@@ -12348,7 +12477,11 @@ var ObjectIdType = class ObjectIdType2 {
|
|
|
12348
12477
|
};
|
|
12349
12478
|
ObjectIdType = __decorate([
|
|
12350
12479
|
SimpleType2({
|
|
12351
|
-
description: "A MongoDB ObjectID value"
|
|
12480
|
+
description: "A MongoDB ObjectID value",
|
|
12481
|
+
nameMappings: {
|
|
12482
|
+
js: "object",
|
|
12483
|
+
json: "string"
|
|
12484
|
+
}
|
|
12352
12485
|
}),
|
|
12353
12486
|
__metadata("design:paramtypes", [Object])
|
|
12354
12487
|
], ObjectIdType);
|
|
@@ -12462,7 +12595,11 @@ __decorate([
|
|
|
12462
12595
|
], TimeType.prototype, "maxValue", void 0);
|
|
12463
12596
|
TimeType = __decorate([
|
|
12464
12597
|
SimpleType2({
|
|
12465
|
-
description: "Time string in 24h format"
|
|
12598
|
+
description: "Time string in 24h format",
|
|
12599
|
+
nameMappings: {
|
|
12600
|
+
js: "string",
|
|
12601
|
+
json: "string"
|
|
12602
|
+
}
|
|
12466
12603
|
}).Example("18:23:00", "Full time value").Example("18:23:00", "Time value without seconds"),
|
|
12467
12604
|
__metadata("design:paramtypes", [Object])
|
|
12468
12605
|
], TimeType);
|
|
@@ -12486,7 +12623,11 @@ var UrlType = class UrlType2 {
|
|
|
12486
12623
|
};
|
|
12487
12624
|
UrlType = __decorate([
|
|
12488
12625
|
SimpleType2({
|
|
12489
|
-
description: "A Uniform Resource Identifier Reference (RFC 3986 icon) value"
|
|
12626
|
+
description: "A Uniform Resource Identifier Reference (RFC 3986 icon) value",
|
|
12627
|
+
nameMappings: {
|
|
12628
|
+
js: "string",
|
|
12629
|
+
json: "string"
|
|
12630
|
+
}
|
|
12490
12631
|
}).Example("http://tempuri.org"),
|
|
12491
12632
|
__metadata("design:paramtypes", [Object])
|
|
12492
12633
|
], UrlType);
|
|
@@ -12516,7 +12657,11 @@ __decorate([
|
|
|
12516
12657
|
], UuidType.prototype, "version", void 0);
|
|
12517
12658
|
UuidType = __decorate([
|
|
12518
12659
|
SimpleType2({
|
|
12519
|
-
description: "A Universal Unique Identifier (UUID) value"
|
|
12660
|
+
description: "A Universal Unique Identifier (UUID) value",
|
|
12661
|
+
nameMappings: {
|
|
12662
|
+
js: "string",
|
|
12663
|
+
json: "string"
|
|
12664
|
+
}
|
|
12520
12665
|
}),
|
|
12521
12666
|
__metadata("design:paramtypes", [Object])
|
|
12522
12667
|
], UuidType);
|
|
@@ -12531,8 +12676,8 @@ HttpOperation2.Entity.Create = function(arg0, arg1) {
|
|
|
12531
12676
|
args = { ...arg1, type: arg0 };
|
|
12532
12677
|
const decoratorChain = [];
|
|
12533
12678
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12534
|
-
description: args.description,
|
|
12535
12679
|
method: "POST",
|
|
12680
|
+
...args,
|
|
12536
12681
|
composition: "Entity.Create",
|
|
12537
12682
|
requestBody: {
|
|
12538
12683
|
immediateFetch: true,
|
|
@@ -12573,8 +12718,8 @@ HttpOperation2.Entity.Delete = function(arg0, arg1) {
|
|
|
12573
12718
|
args = { ...arg1, type: arg0 };
|
|
12574
12719
|
const decoratorChain = [];
|
|
12575
12720
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12576
|
-
description: args.description,
|
|
12577
12721
|
method: "DELETE",
|
|
12722
|
+
...args,
|
|
12578
12723
|
composition: "Entity.Delete"
|
|
12579
12724
|
}));
|
|
12580
12725
|
decorator.Response(HttpStatusCode.OK, {
|
|
@@ -12587,11 +12732,21 @@ HttpOperation2.Entity.Delete = function(arg0, arg1) {
|
|
|
12587
12732
|
if (typeof args.type === "function")
|
|
12588
12733
|
decorator.UseType(args.type);
|
|
12589
12734
|
decorator.KeyParam = (name, prmOptions) => {
|
|
12590
|
-
|
|
12735
|
+
const paramMeta = typeof prmOptions === "string" || typeof prmOptions === "function" ? {
|
|
12736
|
+
name,
|
|
12737
|
+
location: "path",
|
|
12738
|
+
type: prmOptions,
|
|
12739
|
+
keyParam: true
|
|
12740
|
+
} : {
|
|
12741
|
+
...prmOptions,
|
|
12742
|
+
name,
|
|
12743
|
+
location: "path",
|
|
12744
|
+
keyParam: true
|
|
12745
|
+
};
|
|
12746
|
+
decorator.PathParam(name, paramMeta);
|
|
12591
12747
|
decoratorChain.push((meta) => {
|
|
12592
|
-
|
|
12593
|
-
|
|
12594
|
-
meta.compositionOptions.keyParameter = name;
|
|
12748
|
+
if (!meta.path?.includes(":" + name))
|
|
12749
|
+
meta.path = (meta.path || "") + "@:" + name;
|
|
12595
12750
|
});
|
|
12596
12751
|
return decorator;
|
|
12597
12752
|
};
|
|
@@ -12612,8 +12767,8 @@ HttpOperation2.Entity.DeleteMany = function(arg0, arg1) {
|
|
|
12612
12767
|
const filterType = new FilterType({ dataType: args.type });
|
|
12613
12768
|
filterType.rules = {};
|
|
12614
12769
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12615
|
-
description: args.description,
|
|
12616
12770
|
method: "DELETE",
|
|
12771
|
+
...args,
|
|
12617
12772
|
composition: "Entity.DeleteMany"
|
|
12618
12773
|
}));
|
|
12619
12774
|
decorator.Response(HttpStatusCode.OK, {
|
|
@@ -12652,8 +12807,8 @@ HttpOperation2.Entity.FindMany = function(arg0, arg1) {
|
|
|
12652
12807
|
const filterType = new FilterType({ dataType: args.type });
|
|
12653
12808
|
filterType.rules = {};
|
|
12654
12809
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12655
|
-
description: args.description,
|
|
12656
12810
|
method: "GET",
|
|
12811
|
+
...args,
|
|
12657
12812
|
composition: "Entity.FindMany"
|
|
12658
12813
|
}));
|
|
12659
12814
|
decorator.Response(HttpStatusCode.OK, {
|
|
@@ -12731,8 +12886,8 @@ HttpOperation2.Entity.Get = function(arg0, arg1) {
|
|
|
12731
12886
|
args = { ...arg1, type: arg0 };
|
|
12732
12887
|
const decoratorChain = [];
|
|
12733
12888
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12734
|
-
description: args.description,
|
|
12735
12889
|
method: "GET",
|
|
12890
|
+
...args,
|
|
12736
12891
|
composition: "Entity.Get"
|
|
12737
12892
|
}));
|
|
12738
12893
|
decorator.QueryParam("projection", {
|
|
@@ -12757,11 +12912,21 @@ HttpOperation2.Entity.Get = function(arg0, arg1) {
|
|
|
12757
12912
|
if (typeof args.type === "function")
|
|
12758
12913
|
decorator.UseType(args.type);
|
|
12759
12914
|
decorator.KeyParam = (name, prmOptions) => {
|
|
12760
|
-
|
|
12915
|
+
const paramMeta = typeof prmOptions === "string" || typeof prmOptions === "function" ? {
|
|
12916
|
+
name,
|
|
12917
|
+
location: "path",
|
|
12918
|
+
type: prmOptions,
|
|
12919
|
+
keyParam: true
|
|
12920
|
+
} : {
|
|
12921
|
+
...prmOptions,
|
|
12922
|
+
name,
|
|
12923
|
+
location: "path",
|
|
12924
|
+
keyParam: true
|
|
12925
|
+
};
|
|
12926
|
+
decorator.PathParam(name, paramMeta);
|
|
12761
12927
|
decoratorChain.push((meta) => {
|
|
12762
|
-
|
|
12763
|
-
|
|
12764
|
-
meta.compositionOptions.keyParameter = name;
|
|
12928
|
+
if (!meta.path?.includes(":" + name))
|
|
12929
|
+
meta.path = (meta.path || "") + "@:" + name;
|
|
12765
12930
|
});
|
|
12766
12931
|
return decorator;
|
|
12767
12932
|
};
|
|
@@ -12782,8 +12947,8 @@ HttpOperation2.Entity.UpdateMany = function(arg0, arg1) {
|
|
|
12782
12947
|
filterType.rules = {};
|
|
12783
12948
|
const filterRules = new FilterRules();
|
|
12784
12949
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12785
|
-
description: args.description,
|
|
12786
12950
|
method: "PATCH",
|
|
12951
|
+
...args,
|
|
12787
12952
|
composition: "Entity.UpdateMany",
|
|
12788
12953
|
requestBody: {
|
|
12789
12954
|
immediateFetch: true,
|
|
@@ -12829,8 +12994,8 @@ HttpOperation2.Entity.Update = function(arg0, arg1) {
|
|
|
12829
12994
|
const filterType = new FilterType({ dataType: args.type });
|
|
12830
12995
|
filterType.rules = {};
|
|
12831
12996
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12832
|
-
description: args.description,
|
|
12833
12997
|
method: "PATCH",
|
|
12998
|
+
...args,
|
|
12834
12999
|
composition: "Entity.Update",
|
|
12835
13000
|
requestBody: {
|
|
12836
13001
|
partial: "deep",
|
|
@@ -12864,11 +13029,21 @@ HttpOperation2.Entity.Update = function(arg0, arg1) {
|
|
|
12864
13029
|
if (typeof args.type === "function")
|
|
12865
13030
|
decorator.UseType(args.type);
|
|
12866
13031
|
decorator.KeyParam = (name, prmOptions) => {
|
|
12867
|
-
|
|
13032
|
+
const paramMeta = typeof prmOptions === "string" || typeof prmOptions === "function" ? {
|
|
13033
|
+
name,
|
|
13034
|
+
location: "path",
|
|
13035
|
+
type: prmOptions,
|
|
13036
|
+
keyParam: true
|
|
13037
|
+
} : {
|
|
13038
|
+
...prmOptions,
|
|
13039
|
+
name,
|
|
13040
|
+
location: "path",
|
|
13041
|
+
keyParam: true
|
|
13042
|
+
};
|
|
13043
|
+
decorator.PathParam(name, paramMeta);
|
|
12868
13044
|
decoratorChain.push((meta) => {
|
|
12869
|
-
|
|
12870
|
-
|
|
12871
|
-
meta.compositionOptions.keyParameter = name;
|
|
13045
|
+
if (!meta.path?.includes(":" + name))
|
|
13046
|
+
meta.path = (meta.path || "") + "@:" + name;
|
|
12872
13047
|
});
|
|
12873
13048
|
return decorator;
|
|
12874
13049
|
};
|