@opra/common 1.0.0-alpha.2 → 1.0.0-alpha.4
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 +336 -136
- package/cjs/document/api-document.js +18 -12
- package/cjs/document/common/data-type-map.js +1 -1
- package/cjs/document/constants.js +1 -1
- package/cjs/document/data-type/api-field.js +5 -1
- package/cjs/document/data-type/complex-type-base.js +4 -0
- package/cjs/document/data-type/complex-type.js +4 -3
- package/cjs/document/data-type/enum-type.js +2 -0
- package/cjs/document/data-type/extended-types/base64.type.js +6 -1
- package/cjs/document/data-type/extended-types/date-string.type.js +10 -3
- package/cjs/document/data-type/extended-types/date-time-string.type.js +10 -3
- package/cjs/document/data-type/extended-types/date-time.type.js +10 -3
- package/cjs/document/data-type/extended-types/date.type.js +10 -3
- package/cjs/document/data-type/extended-types/email.type.js +24 -10
- package/cjs/document/data-type/extended-types/field-path.type.js +12 -4
- package/cjs/document/data-type/extended-types/filter.type.js +10 -3
- package/cjs/document/data-type/extended-types/object-id.type.js +6 -1
- package/cjs/document/data-type/extended-types/operation-result.type.js +20 -10
- package/cjs/document/data-type/extended-types/time.type.js +10 -3
- package/cjs/document/data-type/extended-types/url.type.js +6 -1
- package/cjs/document/data-type/extended-types/uuid.type.js +8 -2
- 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/any.type.js +2 -1
- package/cjs/document/data-type/primitive-types/bigint.type.js +6 -1
- package/cjs/document/data-type/primitive-types/boolean.type.js +6 -1
- package/cjs/document/data-type/primitive-types/integer.type.js +6 -1
- package/cjs/document/data-type/primitive-types/null.type.js +6 -1
- package/cjs/document/data-type/primitive-types/number.type.js +10 -3
- package/cjs/document/data-type/primitive-types/object.type.js +2 -1
- package/cjs/document/data-type/primitive-types/string.type.js +14 -5
- package/cjs/document/data-type/simple-type.js +8 -1
- package/cjs/document/decorators/http-operation-entity.decorator.js +7 -7
- package/cjs/document/factory/api-document.factory.js +5 -0
- package/cjs/document/factory/data-type.factory.js +62 -39
- package/cjs/document/factory/http-api.factory.js +1 -1
- package/esm/document/api-document.js +18 -12
- package/esm/document/common/data-type-map.js +1 -1
- package/esm/document/constants.js +1 -1
- package/esm/document/data-type/api-field.js +5 -1
- package/esm/document/data-type/complex-type-base.js +4 -0
- package/esm/document/data-type/complex-type.js +4 -3
- package/esm/document/data-type/enum-type.js +2 -0
- package/esm/document/data-type/extended-types/base64.type.js +7 -2
- package/esm/document/data-type/extended-types/date-string.type.js +11 -4
- package/esm/document/data-type/extended-types/date-time-string.type.js +11 -4
- package/esm/document/data-type/extended-types/date-time.type.js +11 -4
- package/esm/document/data-type/extended-types/date.type.js +11 -4
- package/esm/document/data-type/extended-types/email.type.js +25 -11
- package/esm/document/data-type/extended-types/field-path.type.js +13 -5
- package/esm/document/data-type/extended-types/filter.type.js +11 -4
- package/esm/document/data-type/extended-types/object-id.type.js +7 -2
- package/esm/document/data-type/extended-types/operation-result.type.js +21 -11
- package/esm/document/data-type/extended-types/time.type.js +11 -4
- package/esm/document/data-type/extended-types/url.type.js +7 -2
- package/esm/document/data-type/extended-types/uuid.type.js +9 -3
- 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/any.type.js +3 -2
- package/esm/document/data-type/primitive-types/bigint.type.js +7 -2
- package/esm/document/data-type/primitive-types/boolean.type.js +7 -2
- package/esm/document/data-type/primitive-types/integer.type.js +7 -2
- package/esm/document/data-type/primitive-types/null.type.js +7 -2
- package/esm/document/data-type/primitive-types/number.type.js +11 -4
- package/esm/document/data-type/primitive-types/object.type.js +3 -2
- package/esm/document/data-type/primitive-types/string.type.js +15 -6
- package/esm/document/data-type/simple-type.js +8 -1
- package/esm/document/decorators/http-operation-entity.decorator.js +7 -7
- package/esm/document/factory/api-document.factory.js +4 -0
- package/esm/document/factory/data-type.factory.js +62 -39
- package/esm/document/factory/http-api.factory.js +1 -1
- package/package.json +4 -4
- package/types/document/api-document.d.ts +3 -6
- 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/factory/api-document.factory.d.ts +1 -1
- package/types/document/factory/data-type.factory.d.ts +5 -0
- package/types/schema/data-type/simple-type.interface.d.ts +4 -0
- package/types/schema/document.interface.d.ts +13 -1
- package/types/schema/index.d.ts +1 -0
package/browser.js
CHANGED
|
@@ -147,7 +147,7 @@ var DECODER = Symbol.for("opra.type.decoder");
|
|
|
147
147
|
var ENCODER = Symbol("opra.type.encoder");
|
|
148
148
|
var DECORATOR = Symbol.for("DECORATOR");
|
|
149
149
|
var BUILTIN = Symbol.for("BUILTIN");
|
|
150
|
-
var NAMESPACE_PATTERN = /([a-z$_]\w+)(
|
|
150
|
+
var NAMESPACE_PATTERN = /([a-z$_]\w+):(.+)/i;
|
|
151
151
|
var CLASS_NAME_PATTERN = /^[a-z][\w_]*$/i;
|
|
152
152
|
var EXTRACT_TYPENAME_PATTERN = /^(.*)Type(\d*)$/;
|
|
153
153
|
var kDataTypeMap = Symbol.for("kDataTypeMap");
|
|
@@ -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 {
|
|
@@ -1239,7 +1245,7 @@ var ApiFieldClass = class extends DocumentElement {
|
|
|
1239
1245
|
toJSON() {
|
|
1240
1246
|
const typeName = this.type ? this.node.getDataTypeNameWithNs(this.type) : void 0;
|
|
1241
1247
|
return omitUndefined({
|
|
1242
|
-
type:
|
|
1248
|
+
type: typeName ? typeName : this.type?.toJSON(),
|
|
1243
1249
|
description: this.description,
|
|
1244
1250
|
isArray: this.isArray,
|
|
1245
1251
|
default: this.default,
|
|
@@ -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)
|
|
@@ -1312,7 +1322,8 @@ var ComplexTypeClass = class extends ComplexTypeBase {
|
|
|
1312
1322
|
});
|
|
1313
1323
|
if (this.additionalFields) {
|
|
1314
1324
|
if (this.additionalFields instanceof DataType) {
|
|
1315
|
-
|
|
1325
|
+
const typeName = this.node.getDataTypeNameWithNs(this.additionalFields);
|
|
1326
|
+
out.additionalFields = typeName ? typeName : this.additionalFields.toJSON();
|
|
1316
1327
|
} else
|
|
1317
1328
|
out.additionalFields = this.additionalFields;
|
|
1318
1329
|
}
|
|
@@ -1363,6 +1374,8 @@ var EnumTypeClass = class extends DataType {
|
|
|
1363
1374
|
__name(this, "EnumTypeClass");
|
|
1364
1375
|
}
|
|
1365
1376
|
extendsFrom(baseType) {
|
|
1377
|
+
if (!(baseType instanceof DataType))
|
|
1378
|
+
baseType = this.node.getDataType(baseType);
|
|
1366
1379
|
if (!(baseType instanceof EnumType2))
|
|
1367
1380
|
return false;
|
|
1368
1381
|
if (baseType === this)
|
|
@@ -1494,6 +1507,8 @@ var MappedTypeClass = class extends ComplexTypeBase {
|
|
|
1494
1507
|
__name(this, "MappedTypeClass");
|
|
1495
1508
|
}
|
|
1496
1509
|
extendsFrom(baseType) {
|
|
1510
|
+
if (!(baseType instanceof DataType))
|
|
1511
|
+
baseType = this.node.getDataType(baseType);
|
|
1497
1512
|
if (!(baseType instanceof ComplexTypeBase))
|
|
1498
1513
|
return false;
|
|
1499
1514
|
if (baseType === this)
|
|
@@ -1548,6 +1563,8 @@ var MixinTypeClass = class extends ComplexTypeBase {
|
|
|
1548
1563
|
__name(this, "MixinTypeClass");
|
|
1549
1564
|
}
|
|
1550
1565
|
extendsFrom(baseType) {
|
|
1566
|
+
if (!(baseType instanceof DataType))
|
|
1567
|
+
baseType = this.node.getDataType(baseType);
|
|
1551
1568
|
if (!(baseType instanceof ComplexTypeBase))
|
|
1552
1569
|
return false;
|
|
1553
1570
|
if (baseType === this)
|
|
@@ -1682,6 +1699,8 @@ var SimpleType2 = /* @__PURE__ */ __name(function(...args) {
|
|
|
1682
1699
|
_this.base = initArgs.base;
|
|
1683
1700
|
}
|
|
1684
1701
|
_this.properties = initArgs.properties;
|
|
1702
|
+
_this.ownNameMappings = { ...initArgs.nameMappings };
|
|
1703
|
+
_this.nameMappings = { ..._this.base?.nameMappings, ...initArgs.nameMappings };
|
|
1685
1704
|
_this.ownAttributes = cloneObject(initArgs.attributes || {});
|
|
1686
1705
|
_this.attributes = _this.base ? cloneObject(_this.base.attributes) : {};
|
|
1687
1706
|
if (_this.ownAttributes) {
|
|
@@ -1699,6 +1718,8 @@ var SimpleTypeClass = class extends DataType {
|
|
|
1699
1718
|
__name(this, "SimpleTypeClass");
|
|
1700
1719
|
}
|
|
1701
1720
|
extendsFrom(baseType) {
|
|
1721
|
+
if (!(baseType instanceof DataType))
|
|
1722
|
+
baseType = this.node.getDataType(baseType);
|
|
1702
1723
|
if (!(baseType instanceof SimpleType2))
|
|
1703
1724
|
return false;
|
|
1704
1725
|
if (baseType === this)
|
|
@@ -1741,12 +1762,15 @@ var SimpleTypeClass = class extends DataType {
|
|
|
1741
1762
|
return o;
|
|
1742
1763
|
}, {});
|
|
1743
1764
|
const baseName = this.base ? this.node.getDataTypeNameWithNs(this.base) : void 0;
|
|
1744
|
-
|
|
1765
|
+
const out = omitUndefined({
|
|
1745
1766
|
...DataType.prototype.toJSON.apply(this),
|
|
1746
1767
|
base: this.base ? baseName ? baseName : this.base.toJSON() : void 0,
|
|
1747
1768
|
attributes: attributes && Object.keys(attributes).length ? attributes : void 0,
|
|
1748
1769
|
properties: Object.keys(properties).length ? properties : void 0
|
|
1749
1770
|
});
|
|
1771
|
+
if (Object.keys(this.ownNameMappings).length)
|
|
1772
|
+
out.nameMappings = { ...this.ownNameMappings };
|
|
1773
|
+
return out;
|
|
1750
1774
|
}
|
|
1751
1775
|
};
|
|
1752
1776
|
SimpleType2.prototype = SimpleTypeClass.prototype;
|
|
@@ -1871,7 +1895,7 @@ var DataTypeFactory = class {
|
|
|
1871
1895
|
thunk = await resolveThunk(thunk);
|
|
1872
1896
|
const { importQueue, initArgsMap } = context;
|
|
1873
1897
|
const dataType = owner.node.findDataType(thunk);
|
|
1874
|
-
if (dataType)
|
|
1898
|
+
if (dataType instanceof DataType)
|
|
1875
1899
|
return dataType.name;
|
|
1876
1900
|
let metadata2;
|
|
1877
1901
|
let ctor;
|
|
@@ -1940,10 +1964,14 @@ var DataTypeFactory = class {
|
|
|
1940
1964
|
};
|
|
1941
1965
|
out[initializingSymbol] = true;
|
|
1942
1966
|
try {
|
|
1943
|
-
if (out.name
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
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
|
+
}
|
|
1947
1975
|
switch (out.kind) {
|
|
1948
1976
|
case OpraSchema.ComplexType.Kind:
|
|
1949
1977
|
out.ctor = ctor;
|
|
@@ -2013,7 +2041,7 @@ var DataTypeFactory = class {
|
|
|
2013
2041
|
const fieldMeta = typeof v === "string" ? { type: v } : v;
|
|
2014
2042
|
if (fieldMeta.isArray && !fieldMeta.type)
|
|
2015
2043
|
return context.addError(`"type" must be defined explicitly for array fields`);
|
|
2016
|
-
const t = await this._importDataTypeArgs(context, owner, fieldMeta.type);
|
|
2044
|
+
const t = await this._importDataTypeArgs(context, owner, fieldMeta.type || "any");
|
|
2017
2045
|
if (!t)
|
|
2018
2046
|
return;
|
|
2019
2047
|
initArgs.fields[k] = {
|
|
@@ -2054,6 +2082,7 @@ var DataTypeFactory = class {
|
|
|
2054
2082
|
initArgs.ctor = initArgs.ctor || baseArgs.ctor;
|
|
2055
2083
|
});
|
|
2056
2084
|
initArgs.properties = metadata2.properties;
|
|
2085
|
+
initArgs.nameMappings = metadata2.nameMappings;
|
|
2057
2086
|
if (!initArgs.properties && initArgs.ctor)
|
|
2058
2087
|
initArgs.properties = new initArgs.ctor();
|
|
2059
2088
|
if (metadata2.attributes)
|
|
@@ -2105,26 +2134,40 @@ var DataTypeFactory = class {
|
|
|
2105
2134
|
});
|
|
2106
2135
|
}
|
|
2107
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;
|
|
2108
2140
|
const initArgs = typeof args === "string" ? context.initArgsMap?.get(args) : args;
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
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
|
+
}
|
|
2120
2161
|
}
|
|
2121
2162
|
context.addError(`Unknown data type (${String(args)})`);
|
|
2122
2163
|
}
|
|
2123
2164
|
static _createComplexType(context, owner, args) {
|
|
2165
|
+
const dataType = args._instance || {};
|
|
2166
|
+
Object.setPrototypeOf(dataType, ComplexType2.prototype);
|
|
2124
2167
|
const initArgs = cloneObject(args);
|
|
2125
2168
|
if (args.base) {
|
|
2126
2169
|
context.enter(".base", () => {
|
|
2127
|
-
initArgs.base =
|
|
2170
|
+
initArgs.base = this._createDataType(context, owner, args.base);
|
|
2128
2171
|
});
|
|
2129
2172
|
}
|
|
2130
2173
|
if (args.additionalFields) {
|
|
@@ -2132,11 +2175,7 @@ var DataTypeFactory = class {
|
|
|
2132
2175
|
if (typeof args.additionalFields === "boolean" || Array.isArray(args.additionalFields))
|
|
2133
2176
|
initArgs.additionalFields = args.additionalFields;
|
|
2134
2177
|
else {
|
|
2135
|
-
|
|
2136
|
-
initArgs.additionalFields = owner.node.findDataType(args.additionalFields) || this._createDataType(context, owner, args.additionalFields);
|
|
2137
|
-
} else {
|
|
2138
|
-
initArgs.additionalFields = this._createDataType(context, owner, args.additionalFields);
|
|
2139
|
-
}
|
|
2178
|
+
initArgs.additionalFields = this._createDataType(context, owner, args.additionalFields);
|
|
2140
2179
|
}
|
|
2141
2180
|
});
|
|
2142
2181
|
}
|
|
@@ -2145,7 +2184,7 @@ var DataTypeFactory = class {
|
|
|
2145
2184
|
context.enter(".fields", () => {
|
|
2146
2185
|
for (const [k, v] of Object.entries(args.fields)) {
|
|
2147
2186
|
context.enter(`[${k}]`, () => {
|
|
2148
|
-
const type =
|
|
2187
|
+
const type = this._createDataType(context, owner, v.type);
|
|
2149
2188
|
if (type)
|
|
2150
2189
|
initArgs.fields[k] = {
|
|
2151
2190
|
...v,
|
|
@@ -2156,28 +2195,37 @@ var DataTypeFactory = class {
|
|
|
2156
2195
|
}
|
|
2157
2196
|
});
|
|
2158
2197
|
}
|
|
2159
|
-
|
|
2198
|
+
ComplexType2.apply(dataType, [owner, initArgs]);
|
|
2199
|
+
return dataType;
|
|
2160
2200
|
}
|
|
2161
2201
|
static _createEnumType(context, owner, args) {
|
|
2202
|
+
const dataType = args._instance || {};
|
|
2203
|
+
Object.setPrototypeOf(dataType, EnumType2.prototype);
|
|
2162
2204
|
const initArgs = cloneObject(args);
|
|
2163
2205
|
if (args.base) {
|
|
2164
2206
|
context.enter(".base", () => {
|
|
2165
|
-
initArgs.base =
|
|
2207
|
+
initArgs.base = this._createDataType(context, owner, args.base);
|
|
2166
2208
|
});
|
|
2167
2209
|
}
|
|
2168
2210
|
initArgs.attributes = args.attributes;
|
|
2169
|
-
|
|
2211
|
+
EnumType2.apply(dataType, [owner, initArgs]);
|
|
2212
|
+
return dataType;
|
|
2170
2213
|
}
|
|
2171
2214
|
static _createMappedType(context, owner, args) {
|
|
2215
|
+
const dataType = args._instance || {};
|
|
2216
|
+
Object.setPrototypeOf(dataType, MappedType2.prototype);
|
|
2172
2217
|
const initArgs = cloneObject(args);
|
|
2173
2218
|
if (args.base) {
|
|
2174
2219
|
context.enter(".base", () => {
|
|
2175
|
-
initArgs.base =
|
|
2220
|
+
initArgs.base = this._createDataType(context, owner, args.base);
|
|
2176
2221
|
});
|
|
2177
2222
|
}
|
|
2178
|
-
|
|
2223
|
+
MappedType2.apply(dataType, [owner, initArgs]);
|
|
2224
|
+
return dataType;
|
|
2179
2225
|
}
|
|
2180
2226
|
static _createMixinType(context, owner, args) {
|
|
2227
|
+
const dataType = args._instance || {};
|
|
2228
|
+
Object.setPrototypeOf(dataType, MixinType2.prototype);
|
|
2181
2229
|
const initArgs = cloneObject(args);
|
|
2182
2230
|
if (args.types) {
|
|
2183
2231
|
context.enter(".types", () => {
|
|
@@ -2185,7 +2233,7 @@ var DataTypeFactory = class {
|
|
|
2185
2233
|
let i = 0;
|
|
2186
2234
|
for (const t of args.types) {
|
|
2187
2235
|
context.enter(`[${i++}]`, () => {
|
|
2188
|
-
const base =
|
|
2236
|
+
const base = this._createDataType(context, owner, t);
|
|
2189
2237
|
if (!(base instanceof ComplexTypeBase))
|
|
2190
2238
|
throw new TypeError(`"${base?.kind}" can't be set as base for a "${initArgs.kind}"`);
|
|
2191
2239
|
initArgs.types.push(base);
|
|
@@ -2193,16 +2241,20 @@ var DataTypeFactory = class {
|
|
|
2193
2241
|
}
|
|
2194
2242
|
});
|
|
2195
2243
|
}
|
|
2196
|
-
|
|
2244
|
+
MixinType2.apply(dataType, [owner, initArgs]);
|
|
2245
|
+
return dataType;
|
|
2197
2246
|
}
|
|
2198
2247
|
static _createSimpleType(context, owner, args) {
|
|
2248
|
+
const dataType = args._instance || {};
|
|
2249
|
+
Object.setPrototypeOf(dataType, SimpleType2.prototype);
|
|
2199
2250
|
const initArgs = cloneObject(args);
|
|
2200
2251
|
if (args.base) {
|
|
2201
2252
|
context.enter(".base", () => {
|
|
2202
|
-
initArgs.base =
|
|
2253
|
+
initArgs.base = this._createDataType(context, owner, args.base);
|
|
2203
2254
|
});
|
|
2204
2255
|
}
|
|
2205
|
-
|
|
2256
|
+
SimpleType2.apply(dataType, [owner, initArgs]);
|
|
2257
|
+
return dataType;
|
|
2206
2258
|
}
|
|
2207
2259
|
};
|
|
2208
2260
|
function preferName(initArgs) {
|
|
@@ -2259,7 +2311,7 @@ var DataTypeMap = class {
|
|
|
2259
2311
|
}
|
|
2260
2312
|
get(nameOrCtor) {
|
|
2261
2313
|
let name = typeof nameOrCtor === "string" ? nameOrCtor : this[kCtorMap2].get(nameOrCtor);
|
|
2262
|
-
if (!name) {
|
|
2314
|
+
if (!name && typeof nameOrCtor === "function") {
|
|
2263
2315
|
const metadata2 = Reflect.getMetadata(DATATYPE_METADATA, nameOrCtor);
|
|
2264
2316
|
name = metadata2?.name;
|
|
2265
2317
|
}
|
|
@@ -3472,7 +3524,7 @@ var HttpApiFactory = class {
|
|
|
3472
3524
|
});
|
|
3473
3525
|
}
|
|
3474
3526
|
if (metadata2.requestBody) {
|
|
3475
|
-
await context.
|
|
3527
|
+
await context.enterAsync(".requestBody", async () => {
|
|
3476
3528
|
const requestBody = new HttpRequestBody(operation);
|
|
3477
3529
|
await this._initHttpRequestBody(context, requestBody, metadata2.requestBody);
|
|
3478
3530
|
operation.requestBody = requestBody;
|
|
@@ -3600,18 +3652,29 @@ var ApiDocument = class extends DocumentElement {
|
|
|
3600
3652
|
if (dt)
|
|
3601
3653
|
return this[kTypeNSMap].get(dt);
|
|
3602
3654
|
}
|
|
3655
|
+
findDocument(id) {
|
|
3656
|
+
if (this.id === id)
|
|
3657
|
+
return this;
|
|
3658
|
+
for (const doc of this.references.values()) {
|
|
3659
|
+
if (doc.id === id)
|
|
3660
|
+
return doc;
|
|
3661
|
+
const d = doc.findDocument(id);
|
|
3662
|
+
if (d)
|
|
3663
|
+
return d;
|
|
3664
|
+
}
|
|
3665
|
+
}
|
|
3603
3666
|
toJSON() {
|
|
3604
3667
|
return this.export();
|
|
3605
3668
|
}
|
|
3606
3669
|
/**
|
|
3607
3670
|
* Export as Opra schema definition object
|
|
3608
3671
|
*/
|
|
3609
|
-
export(
|
|
3672
|
+
export() {
|
|
3610
3673
|
const out = omitUndefined({
|
|
3611
3674
|
spec: OpraSchema.SpecVersion,
|
|
3675
|
+
id: this.id,
|
|
3612
3676
|
url: this.url,
|
|
3613
3677
|
info: cloneObject(this.info, true)
|
|
3614
|
-
// api: this.api ? this.api.toJSON() : undefined,
|
|
3615
3678
|
});
|
|
3616
3679
|
if (this.references.size) {
|
|
3617
3680
|
let i = 0;
|
|
@@ -3619,15 +3682,11 @@ var ApiDocument = class extends DocumentElement {
|
|
|
3619
3682
|
for (const [ns, doc] of this.references.entries()) {
|
|
3620
3683
|
if (doc[BUILTIN])
|
|
3621
3684
|
continue;
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
} else if (options?.references === "relative-url")
|
|
3628
|
-
references[ns] = `/$schema?ns=${ns}`;
|
|
3629
|
-
else
|
|
3630
|
-
references[ns] = doc.export(options);
|
|
3685
|
+
references[ns] = {
|
|
3686
|
+
id: doc.id,
|
|
3687
|
+
url: doc.url,
|
|
3688
|
+
info: cloneObject(doc.info, true)
|
|
3689
|
+
};
|
|
3631
3690
|
i++;
|
|
3632
3691
|
}
|
|
3633
3692
|
if (i)
|
|
@@ -3769,6 +3828,10 @@ function __decorate(decorators, target, key, desc) {
|
|
|
3769
3828
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
3770
3829
|
}
|
|
3771
3830
|
__name(__decorate, "__decorate");
|
|
3831
|
+
function __metadata(metadataKey, metadataValue) {
|
|
3832
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
3833
|
+
}
|
|
3834
|
+
__name(__metadata, "__metadata");
|
|
3772
3835
|
|
|
3773
3836
|
// ../../build/common/esm/document/data-type/primitive-types/any.type.js
|
|
3774
3837
|
import { isAny as isAny2 } from "valgen";
|
|
@@ -3790,7 +3853,8 @@ var AnyType = class AnyType2 {
|
|
|
3790
3853
|
AnyType = __decorate([
|
|
3791
3854
|
SimpleType2({
|
|
3792
3855
|
description: "Represents any value"
|
|
3793
|
-
})
|
|
3856
|
+
}),
|
|
3857
|
+
__metadata("design:paramtypes", [Object])
|
|
3794
3858
|
], AnyType);
|
|
3795
3859
|
|
|
3796
3860
|
// ../../build/common/esm/document/data-type/primitive-types/bigint.type.js
|
|
@@ -3821,17 +3885,24 @@ var NumberType = class NumberType2 {
|
|
|
3821
3885
|
__decorate([
|
|
3822
3886
|
SimpleType2.Attribute({
|
|
3823
3887
|
description: "Determines the minimum value"
|
|
3824
|
-
})
|
|
3888
|
+
}),
|
|
3889
|
+
__metadata("design:type", Number)
|
|
3825
3890
|
], NumberType.prototype, "minValue", void 0);
|
|
3826
3891
|
__decorate([
|
|
3827
3892
|
SimpleType2.Attribute({
|
|
3828
3893
|
description: "Determines the maximum value"
|
|
3829
|
-
})
|
|
3894
|
+
}),
|
|
3895
|
+
__metadata("design:type", Number)
|
|
3830
3896
|
], NumberType.prototype, "maxValue", void 0);
|
|
3831
3897
|
NumberType = __decorate([
|
|
3832
3898
|
SimpleType2({
|
|
3833
|
-
description: "Both Integer as well as Floating-Point numbers"
|
|
3834
|
-
|
|
3899
|
+
description: "Both Integer as well as Floating-Point numbers",
|
|
3900
|
+
nameMappings: {
|
|
3901
|
+
js: "number",
|
|
3902
|
+
json: "number"
|
|
3903
|
+
}
|
|
3904
|
+
}),
|
|
3905
|
+
__metadata("design:paramtypes", [Object])
|
|
3835
3906
|
], NumberType);
|
|
3836
3907
|
|
|
3837
3908
|
// ../../build/common/esm/document/data-type/primitive-types/bigint.type.js
|
|
@@ -3856,8 +3927,13 @@ var BigintType = class BigintType2 extends NumberType {
|
|
|
3856
3927
|
};
|
|
3857
3928
|
BigintType = __decorate([
|
|
3858
3929
|
SimpleType2({
|
|
3859
|
-
description: "BigInt number"
|
|
3860
|
-
|
|
3930
|
+
description: "BigInt number",
|
|
3931
|
+
nameMappings: {
|
|
3932
|
+
js: "bigint",
|
|
3933
|
+
json: "string"
|
|
3934
|
+
}
|
|
3935
|
+
}),
|
|
3936
|
+
__metadata("design:paramtypes", [Object])
|
|
3861
3937
|
], BigintType);
|
|
3862
3938
|
|
|
3863
3939
|
// ../../build/common/esm/document/data-type/primitive-types/boolean.type.js
|
|
@@ -3879,8 +3955,13 @@ var BooleanType = class BooleanType2 {
|
|
|
3879
3955
|
};
|
|
3880
3956
|
BooleanType = __decorate([
|
|
3881
3957
|
SimpleType2({
|
|
3882
|
-
description: "Simple true/false value"
|
|
3883
|
-
|
|
3958
|
+
description: "Simple true/false value",
|
|
3959
|
+
nameMappings: {
|
|
3960
|
+
js: "boolean",
|
|
3961
|
+
json: "boolean"
|
|
3962
|
+
}
|
|
3963
|
+
}),
|
|
3964
|
+
__metadata("design:paramtypes", [Object])
|
|
3884
3965
|
], BooleanType);
|
|
3885
3966
|
|
|
3886
3967
|
// ../../build/common/esm/document/data-type/primitive-types/integer.type.js
|
|
@@ -3906,8 +3987,13 @@ var IntegerType = class IntegerType2 extends NumberType {
|
|
|
3906
3987
|
};
|
|
3907
3988
|
IntegerType = __decorate([
|
|
3908
3989
|
SimpleType2({
|
|
3909
|
-
description: "An integer number"
|
|
3910
|
-
|
|
3990
|
+
description: "An integer number",
|
|
3991
|
+
nameMappings: {
|
|
3992
|
+
js: "number",
|
|
3993
|
+
json: "number"
|
|
3994
|
+
}
|
|
3995
|
+
}),
|
|
3996
|
+
__metadata("design:paramtypes", [Object])
|
|
3911
3997
|
], IntegerType);
|
|
3912
3998
|
|
|
3913
3999
|
// ../../build/common/esm/document/data-type/primitive-types/null.type.js
|
|
@@ -3929,8 +4015,13 @@ var NullType = class NullType2 {
|
|
|
3929
4015
|
};
|
|
3930
4016
|
NullType = __decorate([
|
|
3931
4017
|
SimpleType2({
|
|
3932
|
-
description: "A Null value"
|
|
3933
|
-
|
|
4018
|
+
description: "A Null value",
|
|
4019
|
+
nameMappings: {
|
|
4020
|
+
js: "null",
|
|
4021
|
+
json: "null"
|
|
4022
|
+
}
|
|
4023
|
+
}),
|
|
4024
|
+
__metadata("design:paramtypes", [Object])
|
|
3934
4025
|
], NullType);
|
|
3935
4026
|
|
|
3936
4027
|
// ../../build/common/esm/document/data-type/primitive-types/object.type.js
|
|
@@ -3948,7 +4039,8 @@ ObjectType = __decorate([
|
|
|
3948
4039
|
name: "object",
|
|
3949
4040
|
description: "A non modelled object",
|
|
3950
4041
|
additionalFields: true
|
|
3951
|
-
})
|
|
4042
|
+
}),
|
|
4043
|
+
__metadata("design:paramtypes", [Object])
|
|
3952
4044
|
], ObjectType);
|
|
3953
4045
|
var metadata = Reflect.getMetadata(DATATYPE_METADATA, ObjectType);
|
|
3954
4046
|
metadata.ctor = Object;
|
|
@@ -3986,27 +4078,36 @@ var StringType = class StringType2 {
|
|
|
3986
4078
|
__decorate([
|
|
3987
4079
|
SimpleType2.Attribute({
|
|
3988
4080
|
description: "Regex pattern to be used for validation"
|
|
3989
|
-
})
|
|
4081
|
+
}),
|
|
4082
|
+
__metadata("design:type", Object)
|
|
3990
4083
|
], StringType.prototype, "pattern", void 0);
|
|
3991
4084
|
__decorate([
|
|
3992
4085
|
SimpleType2.Attribute({
|
|
3993
4086
|
description: "Name of the pattern"
|
|
3994
|
-
})
|
|
4087
|
+
}),
|
|
4088
|
+
__metadata("design:type", String)
|
|
3995
4089
|
], StringType.prototype, "patternName", void 0);
|
|
3996
4090
|
__decorate([
|
|
3997
4091
|
SimpleType2.Attribute({
|
|
3998
4092
|
description: "Minimum number of characters"
|
|
3999
|
-
})
|
|
4093
|
+
}),
|
|
4094
|
+
__metadata("design:type", Number)
|
|
4000
4095
|
], StringType.prototype, "minLength", void 0);
|
|
4001
4096
|
__decorate([
|
|
4002
4097
|
SimpleType2.Attribute({
|
|
4003
4098
|
description: "Minimum number of characters"
|
|
4004
|
-
})
|
|
4099
|
+
}),
|
|
4100
|
+
__metadata("design:type", Number)
|
|
4005
4101
|
], StringType.prototype, "maxLength", void 0);
|
|
4006
4102
|
StringType = __decorate([
|
|
4007
4103
|
SimpleType2({
|
|
4008
|
-
description: "A sequence of characters"
|
|
4009
|
-
|
|
4104
|
+
description: "A sequence of characters",
|
|
4105
|
+
nameMappings: {
|
|
4106
|
+
js: "string",
|
|
4107
|
+
json: "string"
|
|
4108
|
+
}
|
|
4109
|
+
}),
|
|
4110
|
+
__metadata("design:paramtypes", [Object])
|
|
4010
4111
|
], StringType);
|
|
4011
4112
|
|
|
4012
4113
|
// ../../build/common/esm/document/data-type/extended-types/base64.type.js
|
|
@@ -4028,8 +4129,13 @@ var Base64Type = class Base64Type2 {
|
|
|
4028
4129
|
};
|
|
4029
4130
|
Base64Type = __decorate([
|
|
4030
4131
|
SimpleType2({
|
|
4031
|
-
description: "A stream of bytes, base64 encoded"
|
|
4032
|
-
|
|
4132
|
+
description: "A stream of bytes, base64 encoded",
|
|
4133
|
+
nameMappings: {
|
|
4134
|
+
js: "string",
|
|
4135
|
+
json: "string"
|
|
4136
|
+
}
|
|
4137
|
+
}),
|
|
4138
|
+
__metadata("design:paramtypes", [Object])
|
|
4033
4139
|
], Base64Type);
|
|
4034
4140
|
|
|
4035
4141
|
// ../../build/common/esm/document/data-type/extended-types/date.type.js
|
|
@@ -4072,17 +4178,24 @@ var DateType = class DateType2 {
|
|
|
4072
4178
|
__decorate([
|
|
4073
4179
|
SimpleType2.Attribute({
|
|
4074
4180
|
description: "Minimum value"
|
|
4075
|
-
})
|
|
4181
|
+
}),
|
|
4182
|
+
__metadata("design:type", String)
|
|
4076
4183
|
], DateType.prototype, "minValue", void 0);
|
|
4077
4184
|
__decorate([
|
|
4078
4185
|
SimpleType2.Attribute({
|
|
4079
4186
|
description: "Maximum value"
|
|
4080
|
-
})
|
|
4187
|
+
}),
|
|
4188
|
+
__metadata("design:type", String)
|
|
4081
4189
|
], DateType.prototype, "maxValue", void 0);
|
|
4082
4190
|
DateType = __decorate([
|
|
4083
4191
|
SimpleType2({
|
|
4084
|
-
description: "A date without time"
|
|
4085
|
-
|
|
4192
|
+
description: "A date without time",
|
|
4193
|
+
nameMappings: {
|
|
4194
|
+
js: "Date",
|
|
4195
|
+
json: "string"
|
|
4196
|
+
}
|
|
4197
|
+
}).Example("2021-04-18", "Full date value"),
|
|
4198
|
+
__metadata("design:paramtypes", [Object])
|
|
4086
4199
|
], DateType);
|
|
4087
4200
|
|
|
4088
4201
|
// ../../build/common/esm/document/data-type/extended-types/date-string.type.js
|
|
@@ -4111,17 +4224,24 @@ var DateStringType = class DateStringType2 {
|
|
|
4111
4224
|
__decorate([
|
|
4112
4225
|
SimpleType2.Attribute({
|
|
4113
4226
|
description: "Minimum value"
|
|
4114
|
-
})
|
|
4227
|
+
}),
|
|
4228
|
+
__metadata("design:type", String)
|
|
4115
4229
|
], DateStringType.prototype, "minValue", void 0);
|
|
4116
4230
|
__decorate([
|
|
4117
4231
|
SimpleType2.Attribute({
|
|
4118
4232
|
description: "Maximum value"
|
|
4119
|
-
})
|
|
4233
|
+
}),
|
|
4234
|
+
__metadata("design:type", String)
|
|
4120
4235
|
], DateStringType.prototype, "maxValue", void 0);
|
|
4121
4236
|
DateStringType = __decorate([
|
|
4122
4237
|
SimpleType2({
|
|
4123
|
-
description: "Date string value"
|
|
4124
|
-
|
|
4238
|
+
description: "Date string value",
|
|
4239
|
+
nameMappings: {
|
|
4240
|
+
js: "string",
|
|
4241
|
+
json: "string"
|
|
4242
|
+
}
|
|
4243
|
+
}).Example("2021-04-18", "Full date value").Example("2021-04", "Date value without day").Example("2021", "Year only value"),
|
|
4244
|
+
__metadata("design:paramtypes", [Object])
|
|
4125
4245
|
], DateStringType);
|
|
4126
4246
|
|
|
4127
4247
|
// ../../build/common/esm/document/data-type/extended-types/date-time.type.js
|
|
@@ -4164,17 +4284,24 @@ var DateTimeType = class DateTimeType2 {
|
|
|
4164
4284
|
__decorate([
|
|
4165
4285
|
SimpleType2.Attribute({
|
|
4166
4286
|
description: "Minimum value"
|
|
4167
|
-
})
|
|
4287
|
+
}),
|
|
4288
|
+
__metadata("design:type", String)
|
|
4168
4289
|
], DateTimeType.prototype, "minValue", void 0);
|
|
4169
4290
|
__decorate([
|
|
4170
4291
|
SimpleType2.Attribute({
|
|
4171
4292
|
description: "Maximum value"
|
|
4172
|
-
})
|
|
4293
|
+
}),
|
|
4294
|
+
__metadata("design:type", String)
|
|
4173
4295
|
], DateTimeType.prototype, "maxValue", void 0);
|
|
4174
4296
|
DateTimeType = __decorate([
|
|
4175
4297
|
SimpleType2({
|
|
4176
|
-
description: "A full datetime value"
|
|
4177
|
-
|
|
4298
|
+
description: "A full datetime value",
|
|
4299
|
+
nameMappings: {
|
|
4300
|
+
js: "string",
|
|
4301
|
+
json: "string"
|
|
4302
|
+
}
|
|
4303
|
+
}).Example("2021-04-18T22:30:15").Example("2021-04-18 22:30:15").Example("2021-04-18 22:30"),
|
|
4304
|
+
__metadata("design:paramtypes", [Object])
|
|
4178
4305
|
], DateTimeType);
|
|
4179
4306
|
|
|
4180
4307
|
// ../../build/common/esm/document/data-type/extended-types/date-time-string.type.js
|
|
@@ -4203,17 +4330,24 @@ var DateTimeStringType = class DateTimeStringType2 {
|
|
|
4203
4330
|
__decorate([
|
|
4204
4331
|
SimpleType2.Attribute({
|
|
4205
4332
|
description: "Minimum value"
|
|
4206
|
-
})
|
|
4333
|
+
}),
|
|
4334
|
+
__metadata("design:type", String)
|
|
4207
4335
|
], DateTimeStringType.prototype, "minValue", void 0);
|
|
4208
4336
|
__decorate([
|
|
4209
4337
|
SimpleType2.Attribute({
|
|
4210
4338
|
description: "Maximum value"
|
|
4211
|
-
})
|
|
4339
|
+
}),
|
|
4340
|
+
__metadata("design:type", String)
|
|
4212
4341
|
], DateTimeStringType.prototype, "maxValue", void 0);
|
|
4213
4342
|
DateTimeStringType = __decorate([
|
|
4214
4343
|
SimpleType2({
|
|
4215
|
-
description: "DateTime string value"
|
|
4216
|
-
|
|
4344
|
+
description: "DateTime string value",
|
|
4345
|
+
nameMappings: {
|
|
4346
|
+
js: "string",
|
|
4347
|
+
json: "string"
|
|
4348
|
+
}
|
|
4349
|
+
}).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"),
|
|
4350
|
+
__metadata("design:paramtypes", [Object])
|
|
4217
4351
|
], DateTimeStringType);
|
|
4218
4352
|
|
|
4219
4353
|
// ../../build/common/esm/document/data-type/extended-types/email.type.js
|
|
@@ -4237,57 +4371,71 @@ __decorate([
|
|
|
4237
4371
|
SimpleType2.Attribute({
|
|
4238
4372
|
description: "If set to `true`, the validator will also match `Display Name <email-address>",
|
|
4239
4373
|
default: false
|
|
4240
|
-
})
|
|
4374
|
+
}),
|
|
4375
|
+
__metadata("design:type", Boolean)
|
|
4241
4376
|
], EmailType.prototype, "allowDisplayName", void 0);
|
|
4242
4377
|
__decorate([
|
|
4243
4378
|
SimpleType2.Attribute({
|
|
4244
4379
|
description: "If set to `true`, the validator will reject strings without the format `Display Name <email-address>",
|
|
4245
4380
|
default: false
|
|
4246
|
-
})
|
|
4381
|
+
}),
|
|
4382
|
+
__metadata("design:type", Boolean)
|
|
4247
4383
|
], EmailType.prototype, "requireDisplayName", void 0);
|
|
4248
4384
|
__decorate([
|
|
4249
4385
|
SimpleType2.Attribute({
|
|
4250
4386
|
description: "If set to `false`, the validator will not allow any non-English UTF8 character in email address's local part",
|
|
4251
4387
|
default: true
|
|
4252
|
-
})
|
|
4388
|
+
}),
|
|
4389
|
+
__metadata("design:type", Boolean)
|
|
4253
4390
|
], EmailType.prototype, "utf8LocalPart", void 0);
|
|
4254
4391
|
__decorate([
|
|
4255
4392
|
SimpleType2.Attribute({
|
|
4256
4393
|
description: "If set to `true`, the validator will not check for the standard max length of an email",
|
|
4257
4394
|
default: false
|
|
4258
|
-
})
|
|
4395
|
+
}),
|
|
4396
|
+
__metadata("design:type", Boolean)
|
|
4259
4397
|
], EmailType.prototype, "ignoreMaxLength", void 0);
|
|
4260
4398
|
__decorate([
|
|
4261
4399
|
SimpleType2.Attribute({
|
|
4262
4400
|
description: "If set to `true`, the validator will allow IP addresses in the host part",
|
|
4263
4401
|
default: false
|
|
4264
|
-
})
|
|
4402
|
+
}),
|
|
4403
|
+
__metadata("design:type", Boolean)
|
|
4265
4404
|
], EmailType.prototype, "allowIpDomain", void 0);
|
|
4266
4405
|
__decorate([
|
|
4267
4406
|
SimpleType2.Attribute({
|
|
4268
4407
|
description: "If set to `true`, some additional validation will be enabled, e.g. disallowing certain syntactically valid email addresses that are rejected by GMail.",
|
|
4269
4408
|
default: false
|
|
4270
|
-
})
|
|
4409
|
+
}),
|
|
4410
|
+
__metadata("design:type", Boolean)
|
|
4271
4411
|
], EmailType.prototype, "domainSpecificValidation", void 0);
|
|
4272
4412
|
__decorate([
|
|
4273
4413
|
SimpleType2.Attribute({
|
|
4274
4414
|
description: "If set to an array of strings and the part of the email after the @ symbol one of the strings defined in it, the validation fails."
|
|
4275
|
-
})
|
|
4415
|
+
}),
|
|
4416
|
+
__metadata("design:type", Array)
|
|
4276
4417
|
], EmailType.prototype, "hostBlacklist", void 0);
|
|
4277
4418
|
__decorate([
|
|
4278
4419
|
SimpleType2.Attribute({
|
|
4279
4420
|
description: "If set to an array of strings and the part of the email after the @ symbol matches none of the strings defined in it, the validation fails."
|
|
4280
|
-
})
|
|
4421
|
+
}),
|
|
4422
|
+
__metadata("design:type", Array)
|
|
4281
4423
|
], EmailType.prototype, "hostWhitelist", void 0);
|
|
4282
4424
|
__decorate([
|
|
4283
4425
|
SimpleType2.Attribute({
|
|
4284
4426
|
description: "If set to a string, then the validator will reject emails that include any of the characters in the string, in the name part."
|
|
4285
|
-
})
|
|
4427
|
+
}),
|
|
4428
|
+
__metadata("design:type", String)
|
|
4286
4429
|
], EmailType.prototype, "blacklistedChars", void 0);
|
|
4287
4430
|
EmailType = __decorate([
|
|
4288
4431
|
SimpleType2({
|
|
4289
|
-
description: "An email value"
|
|
4290
|
-
|
|
4432
|
+
description: "An email value",
|
|
4433
|
+
nameMappings: {
|
|
4434
|
+
js: "string",
|
|
4435
|
+
json: "string"
|
|
4436
|
+
}
|
|
4437
|
+
}).Example("some.body@example.com"),
|
|
4438
|
+
__metadata("design:paramtypes", [Object])
|
|
4291
4439
|
], EmailType);
|
|
4292
4440
|
|
|
4293
4441
|
// ../../build/common/esm/document/data-type/extended-types/field-path.type.js
|
|
@@ -4313,8 +4461,9 @@ var FieldPathType = class FieldPathType2 {
|
|
|
4313
4461
|
}
|
|
4314
4462
|
toJSON(properties, element) {
|
|
4315
4463
|
const dataType = properties.dataType ? element.node.getComplexType(properties.dataType) : element.node.getComplexType("object");
|
|
4464
|
+
const typeName = dataType ? element.node.getDataTypeNameWithNs(dataType) : void 0;
|
|
4316
4465
|
return {
|
|
4317
|
-
dataType:
|
|
4466
|
+
dataType: typeName ? typeName : dataType.toJSON(),
|
|
4318
4467
|
allowSigns: properties.allowSigns
|
|
4319
4468
|
};
|
|
4320
4469
|
}
|
|
@@ -4322,17 +4471,24 @@ var FieldPathType = class FieldPathType2 {
|
|
|
4322
4471
|
__decorate([
|
|
4323
4472
|
SimpleType2.Attribute({
|
|
4324
4473
|
description: "Data type which field belong to"
|
|
4325
|
-
})
|
|
4474
|
+
}),
|
|
4475
|
+
__metadata("design:type", Object)
|
|
4326
4476
|
], FieldPathType.prototype, "dataType", void 0);
|
|
4327
4477
|
__decorate([
|
|
4328
4478
|
SimpleType2.Attribute({
|
|
4329
4479
|
description: 'Determines if signs (+,-) are allowed. If set "first" signs are allowed only beginning of the field pathIf set "each" signs are allowed at each field in the path'
|
|
4330
|
-
})
|
|
4480
|
+
}),
|
|
4481
|
+
__metadata("design:type", String)
|
|
4331
4482
|
], FieldPathType.prototype, "allowSigns", void 0);
|
|
4332
4483
|
FieldPathType = __decorate([
|
|
4333
4484
|
SimpleType2({
|
|
4334
|
-
description: "Field path"
|
|
4335
|
-
|
|
4485
|
+
description: "Field path",
|
|
4486
|
+
nameMappings: {
|
|
4487
|
+
js: "string",
|
|
4488
|
+
json: "string"
|
|
4489
|
+
}
|
|
4490
|
+
}),
|
|
4491
|
+
__metadata("design:paramtypes", [Object])
|
|
4336
4492
|
], FieldPathType);
|
|
4337
4493
|
|
|
4338
4494
|
// ../../build/common/esm/document/data-type/extended-types/filter.type.js
|
|
@@ -12237,18 +12393,25 @@ var FilterType = class FilterType2 {
|
|
|
12237
12393
|
__decorate([
|
|
12238
12394
|
SimpleType2.Attribute({
|
|
12239
12395
|
description: "Data type which filtering fields belong to"
|
|
12240
|
-
})
|
|
12396
|
+
}),
|
|
12397
|
+
__metadata("design:type", Object)
|
|
12241
12398
|
], FilterType.prototype, "dataType", void 0);
|
|
12242
12399
|
__decorate([
|
|
12243
12400
|
SimpleType2.Attribute({
|
|
12244
12401
|
description: "Stringified JSON object defines filtering rules",
|
|
12245
12402
|
format: "string"
|
|
12246
|
-
})
|
|
12403
|
+
}),
|
|
12404
|
+
__metadata("design:type", Object)
|
|
12247
12405
|
], FilterType.prototype, "rules", void 0);
|
|
12248
12406
|
FilterType = __decorate([
|
|
12249
12407
|
SimpleType2({
|
|
12250
|
-
description: "A query filter"
|
|
12251
|
-
|
|
12408
|
+
description: "A query filter",
|
|
12409
|
+
nameMappings: {
|
|
12410
|
+
js: "object",
|
|
12411
|
+
json: "string"
|
|
12412
|
+
}
|
|
12413
|
+
}),
|
|
12414
|
+
__metadata("design:paramtypes", [Object])
|
|
12252
12415
|
], FilterType);
|
|
12253
12416
|
var decodeFilter = /* @__PURE__ */ __name((dataType, rules) => {
|
|
12254
12417
|
return validator3("decodeFilter", function(input, context, _this) {
|
|
@@ -12292,8 +12455,13 @@ var ObjectIdType = class ObjectIdType2 {
|
|
|
12292
12455
|
};
|
|
12293
12456
|
ObjectIdType = __decorate([
|
|
12294
12457
|
SimpleType2({
|
|
12295
|
-
description: "A MongoDB ObjectID value"
|
|
12296
|
-
|
|
12458
|
+
description: "A MongoDB ObjectID value",
|
|
12459
|
+
nameMappings: {
|
|
12460
|
+
js: "object",
|
|
12461
|
+
json: "string"
|
|
12462
|
+
}
|
|
12463
|
+
}),
|
|
12464
|
+
__metadata("design:paramtypes", [Object])
|
|
12297
12465
|
], ObjectIdType);
|
|
12298
12466
|
|
|
12299
12467
|
// ../../build/common/esm/document/data-type/extended-types/operation-result.type.js
|
|
@@ -12307,30 +12475,38 @@ var OperationResult = class OperationResult2 {
|
|
|
12307
12475
|
}
|
|
12308
12476
|
};
|
|
12309
12477
|
__decorate([
|
|
12310
|
-
ApiField()
|
|
12478
|
+
ApiField(),
|
|
12479
|
+
__metadata("design:type", Number)
|
|
12311
12480
|
], OperationResult.prototype, "affected", void 0);
|
|
12312
12481
|
__decorate([
|
|
12313
|
-
ApiField()
|
|
12482
|
+
ApiField(),
|
|
12483
|
+
__metadata("design:type", Number)
|
|
12314
12484
|
], OperationResult.prototype, "totalMatches", void 0);
|
|
12315
12485
|
__decorate([
|
|
12316
|
-
ApiField()
|
|
12486
|
+
ApiField(),
|
|
12487
|
+
__metadata("design:type", String)
|
|
12317
12488
|
], OperationResult.prototype, "context", void 0);
|
|
12318
12489
|
__decorate([
|
|
12319
|
-
ApiField()
|
|
12490
|
+
ApiField(),
|
|
12491
|
+
__metadata("design:type", String)
|
|
12320
12492
|
], OperationResult.prototype, "type", void 0);
|
|
12321
12493
|
__decorate([
|
|
12322
|
-
ApiField()
|
|
12494
|
+
ApiField(),
|
|
12495
|
+
__metadata("design:type", String)
|
|
12323
12496
|
], OperationResult.prototype, "message", void 0);
|
|
12324
12497
|
__decorate([
|
|
12325
|
-
ApiField({ type: "any" })
|
|
12498
|
+
ApiField({ type: "any" }),
|
|
12499
|
+
__metadata("design:type", Object)
|
|
12326
12500
|
], OperationResult.prototype, "payload", void 0);
|
|
12327
12501
|
__decorate([
|
|
12328
|
-
ApiField({ type: "object" })
|
|
12502
|
+
ApiField({ type: "object" }),
|
|
12503
|
+
__metadata("design:type", Array)
|
|
12329
12504
|
], OperationResult.prototype, "errors", void 0);
|
|
12330
12505
|
OperationResult = __decorate([
|
|
12331
12506
|
ComplexType2({
|
|
12332
12507
|
description: "Operation result"
|
|
12333
|
-
})
|
|
12508
|
+
}),
|
|
12509
|
+
__metadata("design:paramtypes", [Object])
|
|
12334
12510
|
], OperationResult);
|
|
12335
12511
|
(function(OperationResult3) {
|
|
12336
12512
|
function forPayload(type) {
|
|
@@ -12343,10 +12519,12 @@ OperationResult = __decorate([
|
|
|
12343
12519
|
}
|
|
12344
12520
|
};
|
|
12345
12521
|
__decorate([
|
|
12346
|
-
ApiField({ type, required: true })
|
|
12522
|
+
ApiField({ type, required: true }),
|
|
12523
|
+
__metadata("design:type", Object)
|
|
12347
12524
|
], OperationResult_.prototype, "payload", void 0);
|
|
12348
12525
|
OperationResult_ = __decorate([
|
|
12349
|
-
ComplexType2({ embedded: true })
|
|
12526
|
+
ComplexType2({ embedded: true }),
|
|
12527
|
+
__metadata("design:paramtypes", [Object])
|
|
12350
12528
|
], OperationResult_);
|
|
12351
12529
|
return OperationResult_;
|
|
12352
12530
|
}
|
|
@@ -12384,17 +12562,24 @@ var TimeType = class TimeType2 {
|
|
|
12384
12562
|
__decorate([
|
|
12385
12563
|
SimpleType2.Attribute({
|
|
12386
12564
|
description: "Minimum value"
|
|
12387
|
-
})
|
|
12565
|
+
}),
|
|
12566
|
+
__metadata("design:type", String)
|
|
12388
12567
|
], TimeType.prototype, "minValue", void 0);
|
|
12389
12568
|
__decorate([
|
|
12390
12569
|
SimpleType2.Attribute({
|
|
12391
12570
|
description: "Maximum value"
|
|
12392
|
-
})
|
|
12571
|
+
}),
|
|
12572
|
+
__metadata("design:type", String)
|
|
12393
12573
|
], TimeType.prototype, "maxValue", void 0);
|
|
12394
12574
|
TimeType = __decorate([
|
|
12395
12575
|
SimpleType2({
|
|
12396
|
-
description: "Time string in 24h format"
|
|
12397
|
-
|
|
12576
|
+
description: "Time string in 24h format",
|
|
12577
|
+
nameMappings: {
|
|
12578
|
+
js: "string",
|
|
12579
|
+
json: "string"
|
|
12580
|
+
}
|
|
12581
|
+
}).Example("18:23:00", "Full time value").Example("18:23:00", "Time value without seconds"),
|
|
12582
|
+
__metadata("design:paramtypes", [Object])
|
|
12398
12583
|
], TimeType);
|
|
12399
12584
|
|
|
12400
12585
|
// ../../build/common/esm/document/data-type/extended-types/url.type.js
|
|
@@ -12416,8 +12601,13 @@ var UrlType = class UrlType2 {
|
|
|
12416
12601
|
};
|
|
12417
12602
|
UrlType = __decorate([
|
|
12418
12603
|
SimpleType2({
|
|
12419
|
-
description: "A Uniform Resource Identifier Reference (RFC 3986 icon) value"
|
|
12420
|
-
|
|
12604
|
+
description: "A Uniform Resource Identifier Reference (RFC 3986 icon) value",
|
|
12605
|
+
nameMappings: {
|
|
12606
|
+
js: "string",
|
|
12607
|
+
json: "string"
|
|
12608
|
+
}
|
|
12609
|
+
}).Example("http://tempuri.org"),
|
|
12610
|
+
__metadata("design:paramtypes", [Object])
|
|
12421
12611
|
], UrlType);
|
|
12422
12612
|
|
|
12423
12613
|
// ../../build/common/esm/document/data-type/extended-types/uuid.type.js
|
|
@@ -12440,12 +12630,18 @@ var UuidType = class UuidType2 {
|
|
|
12440
12630
|
__decorate([
|
|
12441
12631
|
SimpleType2.Attribute({
|
|
12442
12632
|
description: "Version of the UUID"
|
|
12443
|
-
})
|
|
12633
|
+
}),
|
|
12634
|
+
__metadata("design:type", Number)
|
|
12444
12635
|
], UuidType.prototype, "version", void 0);
|
|
12445
12636
|
UuidType = __decorate([
|
|
12446
12637
|
SimpleType2({
|
|
12447
|
-
description: "A Universal Unique Identifier (UUID) value"
|
|
12448
|
-
|
|
12638
|
+
description: "A Universal Unique Identifier (UUID) value",
|
|
12639
|
+
nameMappings: {
|
|
12640
|
+
js: "string",
|
|
12641
|
+
json: "string"
|
|
12642
|
+
}
|
|
12643
|
+
}),
|
|
12644
|
+
__metadata("design:paramtypes", [Object])
|
|
12449
12645
|
], UuidType);
|
|
12450
12646
|
|
|
12451
12647
|
// ../../build/common/esm/document/decorators/http-operation-entity.decorator.js
|
|
@@ -12458,8 +12654,8 @@ HttpOperation2.Entity.Create = function(arg0, arg1) {
|
|
|
12458
12654
|
args = { ...arg1, type: arg0 };
|
|
12459
12655
|
const decoratorChain = [];
|
|
12460
12656
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12461
|
-
description: args.description,
|
|
12462
12657
|
method: "POST",
|
|
12658
|
+
...args,
|
|
12463
12659
|
composition: "Entity.Create",
|
|
12464
12660
|
requestBody: {
|
|
12465
12661
|
immediateFetch: true,
|
|
@@ -12500,8 +12696,8 @@ HttpOperation2.Entity.Delete = function(arg0, arg1) {
|
|
|
12500
12696
|
args = { ...arg1, type: arg0 };
|
|
12501
12697
|
const decoratorChain = [];
|
|
12502
12698
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12503
|
-
description: args.description,
|
|
12504
12699
|
method: "DELETE",
|
|
12700
|
+
...args,
|
|
12505
12701
|
composition: "Entity.Delete"
|
|
12506
12702
|
}));
|
|
12507
12703
|
decorator.Response(HttpStatusCode.OK, {
|
|
@@ -12539,8 +12735,8 @@ HttpOperation2.Entity.DeleteMany = function(arg0, arg1) {
|
|
|
12539
12735
|
const filterType = new FilterType({ dataType: args.type });
|
|
12540
12736
|
filterType.rules = {};
|
|
12541
12737
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12542
|
-
description: args.description,
|
|
12543
12738
|
method: "DELETE",
|
|
12739
|
+
...args,
|
|
12544
12740
|
composition: "Entity.DeleteMany"
|
|
12545
12741
|
}));
|
|
12546
12742
|
decorator.Response(HttpStatusCode.OK, {
|
|
@@ -12579,8 +12775,8 @@ HttpOperation2.Entity.FindMany = function(arg0, arg1) {
|
|
|
12579
12775
|
const filterType = new FilterType({ dataType: args.type });
|
|
12580
12776
|
filterType.rules = {};
|
|
12581
12777
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12582
|
-
description: args.description,
|
|
12583
12778
|
method: "GET",
|
|
12779
|
+
...args,
|
|
12584
12780
|
composition: "Entity.FindMany"
|
|
12585
12781
|
}));
|
|
12586
12782
|
decorator.Response(HttpStatusCode.OK, {
|
|
@@ -12658,8 +12854,8 @@ HttpOperation2.Entity.Get = function(arg0, arg1) {
|
|
|
12658
12854
|
args = { ...arg1, type: arg0 };
|
|
12659
12855
|
const decoratorChain = [];
|
|
12660
12856
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12661
|
-
description: args.description,
|
|
12662
12857
|
method: "GET",
|
|
12858
|
+
...args,
|
|
12663
12859
|
composition: "Entity.Get"
|
|
12664
12860
|
}));
|
|
12665
12861
|
decorator.QueryParam("projection", {
|
|
@@ -12709,8 +12905,8 @@ HttpOperation2.Entity.UpdateMany = function(arg0, arg1) {
|
|
|
12709
12905
|
filterType.rules = {};
|
|
12710
12906
|
const filterRules = new FilterRules();
|
|
12711
12907
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12712
|
-
description: args.description,
|
|
12713
12908
|
method: "PATCH",
|
|
12909
|
+
...args,
|
|
12714
12910
|
composition: "Entity.UpdateMany",
|
|
12715
12911
|
requestBody: {
|
|
12716
12912
|
immediateFetch: true,
|
|
@@ -12756,8 +12952,8 @@ HttpOperation2.Entity.Update = function(arg0, arg1) {
|
|
|
12756
12952
|
const filterType = new FilterType({ dataType: args.type });
|
|
12757
12953
|
filterType.rules = {};
|
|
12758
12954
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, omitUndefined({
|
|
12759
|
-
description: args.description,
|
|
12760
12955
|
method: "PATCH",
|
|
12956
|
+
...args,
|
|
12761
12957
|
composition: "Entity.Update",
|
|
12762
12958
|
requestBody: {
|
|
12763
12959
|
partial: "deep",
|
|
@@ -12825,6 +13021,8 @@ function getDataTypeName(typ) {
|
|
|
12825
13021
|
__name(getDataTypeName, "getDataTypeName");
|
|
12826
13022
|
|
|
12827
13023
|
// ../../build/common/esm/document/factory/api-document.factory.js
|
|
13024
|
+
import crypto from "node:crypto";
|
|
13025
|
+
import { asMutable as asMutable15 } from "ts-gems";
|
|
12828
13026
|
var OPRA_SPEC_URL = "https://oprajs.com/spec/v" + OpraSchema.SpecVersion;
|
|
12829
13027
|
var ApiDocumentFactory = class _ApiDocumentFactory {
|
|
12830
13028
|
static {
|
|
@@ -12920,6 +13118,8 @@ var ApiDocumentFactory = class _ApiDocumentFactory {
|
|
|
12920
13118
|
context.addError(`Unknown service protocol (${init.api.protocol})`);
|
|
12921
13119
|
});
|
|
12922
13120
|
}
|
|
13121
|
+
const x = document.export();
|
|
13122
|
+
asMutable15(document).id = crypto.createHash("md5").update(JSON.stringify(x)).digest("base64url");
|
|
12923
13123
|
}
|
|
12924
13124
|
/**
|
|
12925
13125
|
*
|