@opra/common 1.0.0-alpha.2 → 1.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser.js +155 -78
- 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 +1 -1
- package/cjs/document/data-type/complex-type.js +2 -3
- package/cjs/document/data-type/extended-types/base64.type.js +2 -1
- package/cjs/document/data-type/extended-types/date-string.type.js +6 -3
- package/cjs/document/data-type/extended-types/date-time-string.type.js +6 -3
- package/cjs/document/data-type/extended-types/date-time.type.js +6 -3
- package/cjs/document/data-type/extended-types/date.type.js +6 -3
- package/cjs/document/data-type/extended-types/email.type.js +20 -10
- package/cjs/document/data-type/extended-types/field-path.type.js +8 -4
- package/cjs/document/data-type/extended-types/filter.type.js +6 -3
- package/cjs/document/data-type/extended-types/object-id.type.js +2 -1
- package/cjs/document/data-type/extended-types/operation-result.type.js +20 -10
- package/cjs/document/data-type/extended-types/time.type.js +6 -3
- package/cjs/document/data-type/extended-types/url.type.js +2 -1
- package/cjs/document/data-type/extended-types/uuid.type.js +4 -2
- package/cjs/document/data-type/primitive-types/any.type.js +2 -1
- package/cjs/document/data-type/primitive-types/bigint.type.js +2 -1
- package/cjs/document/data-type/primitive-types/boolean.type.js +2 -1
- package/cjs/document/data-type/primitive-types/integer.type.js +2 -1
- package/cjs/document/data-type/primitive-types/null.type.js +2 -1
- package/cjs/document/data-type/primitive-types/number.type.js +6 -3
- package/cjs/document/data-type/primitive-types/object.type.js +2 -1
- package/cjs/document/data-type/primitive-types/string.type.js +10 -5
- package/cjs/document/factory/api-document.factory.js +5 -0
- package/cjs/document/factory/data-type.factory.js +1 -1
- 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 +1 -1
- package/esm/document/data-type/complex-type.js +2 -3
- package/esm/document/data-type/extended-types/base64.type.js +3 -2
- package/esm/document/data-type/extended-types/date-string.type.js +7 -4
- package/esm/document/data-type/extended-types/date-time-string.type.js +7 -4
- package/esm/document/data-type/extended-types/date-time.type.js +7 -4
- package/esm/document/data-type/extended-types/date.type.js +7 -4
- package/esm/document/data-type/extended-types/email.type.js +21 -11
- package/esm/document/data-type/extended-types/field-path.type.js +9 -5
- package/esm/document/data-type/extended-types/filter.type.js +7 -4
- package/esm/document/data-type/extended-types/object-id.type.js +3 -2
- package/esm/document/data-type/extended-types/operation-result.type.js +21 -11
- package/esm/document/data-type/extended-types/time.type.js +7 -4
- package/esm/document/data-type/extended-types/url.type.js +3 -2
- package/esm/document/data-type/extended-types/uuid.type.js +5 -3
- package/esm/document/data-type/primitive-types/any.type.js +3 -2
- package/esm/document/data-type/primitive-types/bigint.type.js +3 -2
- package/esm/document/data-type/primitive-types/boolean.type.js +3 -2
- package/esm/document/data-type/primitive-types/integer.type.js +3 -2
- package/esm/document/data-type/primitive-types/null.type.js +3 -2
- package/esm/document/data-type/primitive-types/number.type.js +7 -4
- package/esm/document/data-type/primitive-types/object.type.js +3 -2
- package/esm/document/data-type/primitive-types/string.type.js +11 -6
- package/esm/document/factory/api-document.factory.js +4 -0
- package/esm/document/factory/data-type.factory.js +1 -1
- package/esm/document/factory/http-api.factory.js +1 -1
- package/package.json +2 -2
- package/types/document/api-document.d.ts +3 -6
- package/types/document/factory/api-document.factory.d.ts +1 -1
- package/types/schema/document.interface.d.ts +13 -1
- package/types/schema/index.d.ts +1 -0
|
@@ -72,9 +72,8 @@ class ComplexTypeClass extends ComplexTypeBase {
|
|
|
72
72
|
});
|
|
73
73
|
if (this.additionalFields) {
|
|
74
74
|
if (this.additionalFields instanceof DataType) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
: this.additionalFields[1].toJSON();
|
|
75
|
+
const typeName = this.node.getDataTypeNameWithNs(this.additionalFields);
|
|
76
|
+
out.additionalFields = typeName ? typeName : this.additionalFields.toJSON();
|
|
78
77
|
}
|
|
79
78
|
else
|
|
80
79
|
out.additionalFields = this.additionalFields;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -17,6 +17,7 @@ let Base64Type = class Base64Type {
|
|
|
17
17
|
Base64Type = __decorate([
|
|
18
18
|
SimpleType({
|
|
19
19
|
description: 'A stream of bytes, base64 encoded',
|
|
20
|
-
})
|
|
20
|
+
}),
|
|
21
|
+
__metadata("design:paramtypes", [Object])
|
|
21
22
|
], Base64Type);
|
|
22
23
|
export { Base64Type };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -23,12 +23,14 @@ let DateStringType = class DateStringType {
|
|
|
23
23
|
__decorate([
|
|
24
24
|
SimpleType.Attribute({
|
|
25
25
|
description: 'Minimum value',
|
|
26
|
-
})
|
|
26
|
+
}),
|
|
27
|
+
__metadata("design:type", String)
|
|
27
28
|
], DateStringType.prototype, "minValue", void 0);
|
|
28
29
|
__decorate([
|
|
29
30
|
SimpleType.Attribute({
|
|
30
31
|
description: 'Maximum value',
|
|
31
|
-
})
|
|
32
|
+
}),
|
|
33
|
+
__metadata("design:type", String)
|
|
32
34
|
], DateStringType.prototype, "maxValue", void 0);
|
|
33
35
|
DateStringType = __decorate([
|
|
34
36
|
SimpleType({
|
|
@@ -36,6 +38,7 @@ DateStringType = __decorate([
|
|
|
36
38
|
})
|
|
37
39
|
.Example('2021-04-18', 'Full date value')
|
|
38
40
|
.Example('2021-04', 'Date value without day')
|
|
39
|
-
.Example('2021', 'Year only value')
|
|
41
|
+
.Example('2021', 'Year only value'),
|
|
42
|
+
__metadata("design:paramtypes", [Object])
|
|
40
43
|
], DateStringType);
|
|
41
44
|
export { DateStringType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -23,12 +23,14 @@ let DateTimeStringType = class DateTimeStringType {
|
|
|
23
23
|
__decorate([
|
|
24
24
|
SimpleType.Attribute({
|
|
25
25
|
description: 'Minimum value',
|
|
26
|
-
})
|
|
26
|
+
}),
|
|
27
|
+
__metadata("design:type", String)
|
|
27
28
|
], DateTimeStringType.prototype, "minValue", void 0);
|
|
28
29
|
__decorate([
|
|
29
30
|
SimpleType.Attribute({
|
|
30
31
|
description: 'Maximum value',
|
|
31
|
-
})
|
|
32
|
+
}),
|
|
33
|
+
__metadata("design:type", String)
|
|
32
34
|
], DateTimeStringType.prototype, "maxValue", void 0);
|
|
33
35
|
DateTimeStringType = __decorate([
|
|
34
36
|
SimpleType({
|
|
@@ -39,6 +41,7 @@ DateTimeStringType = __decorate([
|
|
|
39
41
|
.Example('2021-04-18 22:30', 'Date-time value')
|
|
40
42
|
.Example('2021-04-18', 'Date value')
|
|
41
43
|
.Example('2021-04', 'Date value without day')
|
|
42
|
-
.Example('2021', 'Year only value')
|
|
44
|
+
.Example('2021', 'Year only value'),
|
|
45
|
+
__metadata("design:paramtypes", [Object])
|
|
43
46
|
], DateTimeStringType);
|
|
44
47
|
export { DateTimeStringType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { isDateString, toString, vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -37,12 +37,14 @@ let DateTimeType = class DateTimeType {
|
|
|
37
37
|
__decorate([
|
|
38
38
|
SimpleType.Attribute({
|
|
39
39
|
description: 'Minimum value',
|
|
40
|
-
})
|
|
40
|
+
}),
|
|
41
|
+
__metadata("design:type", String)
|
|
41
42
|
], DateTimeType.prototype, "minValue", void 0);
|
|
42
43
|
__decorate([
|
|
43
44
|
SimpleType.Attribute({
|
|
44
45
|
description: 'Maximum value',
|
|
45
|
-
})
|
|
46
|
+
}),
|
|
47
|
+
__metadata("design:type", String)
|
|
46
48
|
], DateTimeType.prototype, "maxValue", void 0);
|
|
47
49
|
DateTimeType = __decorate([
|
|
48
50
|
SimpleType({
|
|
@@ -50,6 +52,7 @@ DateTimeType = __decorate([
|
|
|
50
52
|
})
|
|
51
53
|
.Example('2021-04-18T22:30:15')
|
|
52
54
|
.Example('2021-04-18 22:30:15')
|
|
53
|
-
.Example('2021-04-18 22:30')
|
|
55
|
+
.Example('2021-04-18 22:30'),
|
|
56
|
+
__metadata("design:paramtypes", [Object])
|
|
54
57
|
], DateTimeType);
|
|
55
58
|
export { DateTimeType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { isDateString, toString, vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -37,16 +37,19 @@ let DateType = class DateType {
|
|
|
37
37
|
__decorate([
|
|
38
38
|
SimpleType.Attribute({
|
|
39
39
|
description: 'Minimum value',
|
|
40
|
-
})
|
|
40
|
+
}),
|
|
41
|
+
__metadata("design:type", String)
|
|
41
42
|
], DateType.prototype, "minValue", void 0);
|
|
42
43
|
__decorate([
|
|
43
44
|
SimpleType.Attribute({
|
|
44
45
|
description: 'Maximum value',
|
|
45
|
-
})
|
|
46
|
+
}),
|
|
47
|
+
__metadata("design:type", String)
|
|
46
48
|
], DateType.prototype, "maxValue", void 0);
|
|
47
49
|
DateType = __decorate([
|
|
48
50
|
SimpleType({
|
|
49
51
|
description: 'A date without time',
|
|
50
|
-
}).Example('2021-04-18', 'Full date value')
|
|
52
|
+
}).Example('2021-04-18', 'Full date value'),
|
|
53
|
+
__metadata("design:paramtypes", [Object])
|
|
51
54
|
], DateType);
|
|
52
55
|
export { DateType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -18,60 +18,70 @@ __decorate([
|
|
|
18
18
|
SimpleType.Attribute({
|
|
19
19
|
description: 'If set to `true`, the validator will also match `Display Name <email-address>',
|
|
20
20
|
default: false,
|
|
21
|
-
})
|
|
21
|
+
}),
|
|
22
|
+
__metadata("design:type", Boolean)
|
|
22
23
|
], EmailType.prototype, "allowDisplayName", void 0);
|
|
23
24
|
__decorate([
|
|
24
25
|
SimpleType.Attribute({
|
|
25
26
|
description: 'If set to `true`, the validator will reject strings without the format `Display Name <email-address>',
|
|
26
27
|
default: false,
|
|
27
|
-
})
|
|
28
|
+
}),
|
|
29
|
+
__metadata("design:type", Boolean)
|
|
28
30
|
], EmailType.prototype, "requireDisplayName", void 0);
|
|
29
31
|
__decorate([
|
|
30
32
|
SimpleType.Attribute({
|
|
31
33
|
description: "If set to `false`, the validator will not allow any non-English UTF8 character in email address's local part",
|
|
32
34
|
default: true,
|
|
33
|
-
})
|
|
35
|
+
}),
|
|
36
|
+
__metadata("design:type", Boolean)
|
|
34
37
|
], EmailType.prototype, "utf8LocalPart", void 0);
|
|
35
38
|
__decorate([
|
|
36
39
|
SimpleType.Attribute({
|
|
37
40
|
description: 'If set to `true`, the validator will not check for the standard max length of an email',
|
|
38
41
|
default: false,
|
|
39
|
-
})
|
|
42
|
+
}),
|
|
43
|
+
__metadata("design:type", Boolean)
|
|
40
44
|
], EmailType.prototype, "ignoreMaxLength", void 0);
|
|
41
45
|
__decorate([
|
|
42
46
|
SimpleType.Attribute({
|
|
43
47
|
description: 'If set to `true`, the validator will allow IP addresses in the host part',
|
|
44
48
|
default: false,
|
|
45
|
-
})
|
|
49
|
+
}),
|
|
50
|
+
__metadata("design:type", Boolean)
|
|
46
51
|
], EmailType.prototype, "allowIpDomain", void 0);
|
|
47
52
|
__decorate([
|
|
48
53
|
SimpleType.Attribute({
|
|
49
54
|
description: 'If set to `true`, some additional validation will be enabled, ' +
|
|
50
55
|
'e.g. disallowing certain syntactically valid email addresses that are rejected by GMail.',
|
|
51
56
|
default: false,
|
|
52
|
-
})
|
|
57
|
+
}),
|
|
58
|
+
__metadata("design:type", Boolean)
|
|
53
59
|
], EmailType.prototype, "domainSpecificValidation", void 0);
|
|
54
60
|
__decorate([
|
|
55
61
|
SimpleType.Attribute({
|
|
56
62
|
description: 'If set to an array of strings and the part of the email after the @ symbol ' +
|
|
57
63
|
' one of the strings defined in it, the validation fails.',
|
|
58
|
-
})
|
|
64
|
+
}),
|
|
65
|
+
__metadata("design:type", Array)
|
|
59
66
|
], EmailType.prototype, "hostBlacklist", void 0);
|
|
60
67
|
__decorate([
|
|
61
68
|
SimpleType.Attribute({
|
|
62
69
|
description: 'If set to an array of strings and the part of the email after the @ symbol ' +
|
|
63
70
|
' matches none of the strings defined in it, the validation fails.',
|
|
64
|
-
})
|
|
71
|
+
}),
|
|
72
|
+
__metadata("design:type", Array)
|
|
65
73
|
], EmailType.prototype, "hostWhitelist", void 0);
|
|
66
74
|
__decorate([
|
|
67
75
|
SimpleType.Attribute({
|
|
68
76
|
description: 'If set to a string, then the validator will reject emails that include ' +
|
|
69
77
|
' any of the characters in the string, in the name part.',
|
|
70
|
-
})
|
|
78
|
+
}),
|
|
79
|
+
__metadata("design:type", String)
|
|
71
80
|
], EmailType.prototype, "blacklistedChars", void 0);
|
|
72
81
|
EmailType = __decorate([
|
|
73
82
|
SimpleType({
|
|
74
83
|
description: 'An email value',
|
|
75
|
-
}).Example('some.body@example.com')
|
|
84
|
+
}).Example('some.body@example.com'),
|
|
85
|
+
__metadata("design:paramtypes", [Object])
|
|
76
86
|
], EmailType);
|
|
77
87
|
export { EmailType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { toString, validator, vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -24,8 +24,9 @@ let FieldPathType = class FieldPathType {
|
|
|
24
24
|
const dataType = properties.dataType
|
|
25
25
|
? element.node.getComplexType(properties.dataType)
|
|
26
26
|
: element.node.getComplexType('object');
|
|
27
|
+
const typeName = dataType ? element.node.getDataTypeNameWithNs(dataType) : undefined;
|
|
27
28
|
return {
|
|
28
|
-
dataType:
|
|
29
|
+
dataType: typeName ? typeName : dataType.toJSON(),
|
|
29
30
|
allowSigns: properties.allowSigns,
|
|
30
31
|
};
|
|
31
32
|
}
|
|
@@ -33,18 +34,21 @@ let FieldPathType = class FieldPathType {
|
|
|
33
34
|
__decorate([
|
|
34
35
|
SimpleType.Attribute({
|
|
35
36
|
description: 'Data type which field belong to',
|
|
36
|
-
})
|
|
37
|
+
}),
|
|
38
|
+
__metadata("design:type", Object)
|
|
37
39
|
], FieldPathType.prototype, "dataType", void 0);
|
|
38
40
|
__decorate([
|
|
39
41
|
SimpleType.Attribute({
|
|
40
42
|
description: 'Determines if signs (+,-) are allowed. ' +
|
|
41
43
|
'If set "first" signs are allowed only beginning of the field path' +
|
|
42
44
|
'If set "each" signs are allowed at each field in the path',
|
|
43
|
-
})
|
|
45
|
+
}),
|
|
46
|
+
__metadata("design:type", String)
|
|
44
47
|
], FieldPathType.prototype, "allowSigns", void 0);
|
|
45
48
|
FieldPathType = __decorate([
|
|
46
49
|
SimpleType({
|
|
47
50
|
description: 'Field path',
|
|
48
|
-
})
|
|
51
|
+
}),
|
|
52
|
+
__metadata("design:paramtypes", [Object])
|
|
49
53
|
], FieldPathType);
|
|
50
54
|
export { FieldPathType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { validator } from 'valgen';
|
|
3
3
|
import { FilterRules } from '../../../filter/filter-rules.js';
|
|
4
4
|
import { OpraFilter } from '../../../filter/index.js';
|
|
@@ -32,18 +32,21 @@ let FilterType = class FilterType {
|
|
|
32
32
|
__decorate([
|
|
33
33
|
SimpleType.Attribute({
|
|
34
34
|
description: 'Data type which filtering fields belong to',
|
|
35
|
-
})
|
|
35
|
+
}),
|
|
36
|
+
__metadata("design:type", Object)
|
|
36
37
|
], FilterType.prototype, "dataType", void 0);
|
|
37
38
|
__decorate([
|
|
38
39
|
SimpleType.Attribute({
|
|
39
40
|
description: 'Stringified JSON object defines filtering rules',
|
|
40
41
|
format: 'string',
|
|
41
|
-
})
|
|
42
|
+
}),
|
|
43
|
+
__metadata("design:type", Object)
|
|
42
44
|
], FilterType.prototype, "rules", void 0);
|
|
43
45
|
FilterType = __decorate([
|
|
44
46
|
SimpleType({
|
|
45
47
|
description: 'A query filter',
|
|
46
|
-
})
|
|
48
|
+
}),
|
|
49
|
+
__metadata("design:paramtypes", [Object])
|
|
47
50
|
], FilterType);
|
|
48
51
|
export { FilterType };
|
|
49
52
|
const decodeFilter = (dataType, rules) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -17,6 +17,7 @@ let ObjectIdType = class ObjectIdType {
|
|
|
17
17
|
ObjectIdType = __decorate([
|
|
18
18
|
SimpleType({
|
|
19
19
|
description: 'A MongoDB ObjectID value',
|
|
20
|
-
})
|
|
20
|
+
}),
|
|
21
|
+
__metadata("design:paramtypes", [Object])
|
|
21
22
|
], ObjectIdType);
|
|
22
23
|
export { ObjectIdType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { ApiField } from '../api-field.js';
|
|
3
3
|
import { ComplexType } from '../complex-type.js';
|
|
4
4
|
let OperationResult = class OperationResult {
|
|
@@ -8,30 +8,38 @@ let OperationResult = class OperationResult {
|
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
__decorate([
|
|
11
|
-
ApiField()
|
|
11
|
+
ApiField(),
|
|
12
|
+
__metadata("design:type", Number)
|
|
12
13
|
], OperationResult.prototype, "affected", void 0);
|
|
13
14
|
__decorate([
|
|
14
|
-
ApiField()
|
|
15
|
+
ApiField(),
|
|
16
|
+
__metadata("design:type", Number)
|
|
15
17
|
], OperationResult.prototype, "totalMatches", void 0);
|
|
16
18
|
__decorate([
|
|
17
|
-
ApiField()
|
|
19
|
+
ApiField(),
|
|
20
|
+
__metadata("design:type", String)
|
|
18
21
|
], OperationResult.prototype, "context", void 0);
|
|
19
22
|
__decorate([
|
|
20
|
-
ApiField()
|
|
23
|
+
ApiField(),
|
|
24
|
+
__metadata("design:type", String)
|
|
21
25
|
], OperationResult.prototype, "type", void 0);
|
|
22
26
|
__decorate([
|
|
23
|
-
ApiField()
|
|
27
|
+
ApiField(),
|
|
28
|
+
__metadata("design:type", String)
|
|
24
29
|
], OperationResult.prototype, "message", void 0);
|
|
25
30
|
__decorate([
|
|
26
|
-
ApiField({ type: 'any' })
|
|
31
|
+
ApiField({ type: 'any' }),
|
|
32
|
+
__metadata("design:type", Object)
|
|
27
33
|
], OperationResult.prototype, "payload", void 0);
|
|
28
34
|
__decorate([
|
|
29
|
-
ApiField({ type: 'object' })
|
|
35
|
+
ApiField({ type: 'object' }),
|
|
36
|
+
__metadata("design:type", Array)
|
|
30
37
|
], OperationResult.prototype, "errors", void 0);
|
|
31
38
|
OperationResult = __decorate([
|
|
32
39
|
ComplexType({
|
|
33
40
|
description: 'Operation result',
|
|
34
|
-
})
|
|
41
|
+
}),
|
|
42
|
+
__metadata("design:paramtypes", [Object])
|
|
35
43
|
], OperationResult);
|
|
36
44
|
export { OperationResult };
|
|
37
45
|
(function (OperationResult) {
|
|
@@ -42,10 +50,12 @@ export { OperationResult };
|
|
|
42
50
|
}
|
|
43
51
|
};
|
|
44
52
|
__decorate([
|
|
45
|
-
ApiField({ type, required: true })
|
|
53
|
+
ApiField({ type, required: true }),
|
|
54
|
+
__metadata("design:type", Object)
|
|
46
55
|
], OperationResult_.prototype, "payload", void 0);
|
|
47
56
|
OperationResult_ = __decorate([
|
|
48
|
-
ComplexType({ embedded: true })
|
|
57
|
+
ComplexType({ embedded: true }),
|
|
58
|
+
__metadata("design:paramtypes", [Object])
|
|
49
59
|
], OperationResult_);
|
|
50
60
|
return OperationResult_;
|
|
51
61
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -27,18 +27,21 @@ let TimeType = class TimeType {
|
|
|
27
27
|
__decorate([
|
|
28
28
|
SimpleType.Attribute({
|
|
29
29
|
description: 'Minimum value',
|
|
30
|
-
})
|
|
30
|
+
}),
|
|
31
|
+
__metadata("design:type", String)
|
|
31
32
|
], TimeType.prototype, "minValue", void 0);
|
|
32
33
|
__decorate([
|
|
33
34
|
SimpleType.Attribute({
|
|
34
35
|
description: 'Maximum value',
|
|
35
|
-
})
|
|
36
|
+
}),
|
|
37
|
+
__metadata("design:type", String)
|
|
36
38
|
], TimeType.prototype, "maxValue", void 0);
|
|
37
39
|
TimeType = __decorate([
|
|
38
40
|
SimpleType({
|
|
39
41
|
description: 'Time string in 24h format',
|
|
40
42
|
})
|
|
41
43
|
.Example('18:23:00', 'Full time value')
|
|
42
|
-
.Example('18:23:00', 'Time value without seconds')
|
|
44
|
+
.Example('18:23:00', 'Time value without seconds'),
|
|
45
|
+
__metadata("design:paramtypes", [Object])
|
|
43
46
|
], TimeType);
|
|
44
47
|
export { TimeType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -17,6 +17,7 @@ let UrlType = class UrlType {
|
|
|
17
17
|
UrlType = __decorate([
|
|
18
18
|
SimpleType({
|
|
19
19
|
description: 'A Uniform Resource Identifier Reference (RFC 3986 icon) value',
|
|
20
|
-
}).Example('http://tempuri.org')
|
|
20
|
+
}).Example('http://tempuri.org'),
|
|
21
|
+
__metadata("design:paramtypes", [Object])
|
|
21
22
|
], UrlType);
|
|
22
23
|
export { UrlType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -17,11 +17,13 @@ let UuidType = class UuidType {
|
|
|
17
17
|
__decorate([
|
|
18
18
|
SimpleType.Attribute({
|
|
19
19
|
description: 'Version of the UUID',
|
|
20
|
-
})
|
|
20
|
+
}),
|
|
21
|
+
__metadata("design:type", Number)
|
|
21
22
|
], UuidType.prototype, "version", void 0);
|
|
22
23
|
UuidType = __decorate([
|
|
23
24
|
SimpleType({
|
|
24
25
|
description: 'A Universal Unique Identifier (UUID) value',
|
|
25
|
-
})
|
|
26
|
+
}),
|
|
27
|
+
__metadata("design:paramtypes", [Object])
|
|
26
28
|
], UuidType);
|
|
27
29
|
export { UuidType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { isAny } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -17,6 +17,7 @@ let AnyType = class AnyType {
|
|
|
17
17
|
AnyType = __decorate([
|
|
18
18
|
SimpleType({
|
|
19
19
|
description: 'Represents any value',
|
|
20
|
-
})
|
|
20
|
+
}),
|
|
21
|
+
__metadata("design:paramtypes", [Object])
|
|
21
22
|
], AnyType);
|
|
22
23
|
export { AnyType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { toBigint, vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -22,6 +22,7 @@ let BigintType = class BigintType extends NumberType {
|
|
|
22
22
|
BigintType = __decorate([
|
|
23
23
|
SimpleType({
|
|
24
24
|
description: 'BigInt number',
|
|
25
|
-
})
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:paramtypes", [Object])
|
|
26
27
|
], BigintType);
|
|
27
28
|
export { BigintType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { toBoolean } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -17,6 +17,7 @@ let BooleanType = class BooleanType {
|
|
|
17
17
|
BooleanType = __decorate([
|
|
18
18
|
SimpleType({
|
|
19
19
|
description: 'Simple true/false value',
|
|
20
|
-
})
|
|
20
|
+
}),
|
|
21
|
+
__metadata("design:paramtypes", [Object])
|
|
21
22
|
], BooleanType);
|
|
22
23
|
export { BooleanType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { toInteger, vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -22,6 +22,7 @@ let IntegerType = class IntegerType extends NumberType {
|
|
|
22
22
|
IntegerType = __decorate([
|
|
23
23
|
SimpleType({
|
|
24
24
|
description: 'An integer number',
|
|
25
|
-
})
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:paramtypes", [Object])
|
|
26
27
|
], IntegerType);
|
|
27
28
|
export { IntegerType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { isNull } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -17,6 +17,7 @@ let NullType = class NullType {
|
|
|
17
17
|
NullType = __decorate([
|
|
18
18
|
SimpleType({
|
|
19
19
|
description: 'A Null value',
|
|
20
|
-
})
|
|
20
|
+
}),
|
|
21
|
+
__metadata("design:paramtypes", [Object])
|
|
21
22
|
], NullType);
|
|
22
23
|
export { NullType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { toNumber, vg } from 'valgen';
|
|
3
3
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -22,16 +22,19 @@ let NumberType = class NumberType {
|
|
|
22
22
|
__decorate([
|
|
23
23
|
SimpleType.Attribute({
|
|
24
24
|
description: 'Determines the minimum value',
|
|
25
|
-
})
|
|
25
|
+
}),
|
|
26
|
+
__metadata("design:type", Number)
|
|
26
27
|
], NumberType.prototype, "minValue", void 0);
|
|
27
28
|
__decorate([
|
|
28
29
|
SimpleType.Attribute({
|
|
29
30
|
description: 'Determines the maximum value',
|
|
30
|
-
})
|
|
31
|
+
}),
|
|
32
|
+
__metadata("design:type", Number)
|
|
31
33
|
], NumberType.prototype, "maxValue", void 0);
|
|
32
34
|
NumberType = __decorate([
|
|
33
35
|
SimpleType({
|
|
34
36
|
description: 'Both Integer as well as Floating-Point numbers',
|
|
35
|
-
})
|
|
37
|
+
}),
|
|
38
|
+
__metadata("design:paramtypes", [Object])
|
|
36
39
|
], NumberType);
|
|
37
40
|
export { NumberType };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { DATATYPE_METADATA } from '../../constants.js';
|
|
3
3
|
import { ComplexType } from '../complex-type.js';
|
|
4
4
|
let ObjectType = class ObjectType {
|
|
@@ -12,7 +12,8 @@ ObjectType = __decorate([
|
|
|
12
12
|
name: 'object',
|
|
13
13
|
description: 'A non modelled object',
|
|
14
14
|
additionalFields: true,
|
|
15
|
-
})
|
|
15
|
+
}),
|
|
16
|
+
__metadata("design:paramtypes", [Object])
|
|
16
17
|
], ObjectType);
|
|
17
18
|
export { ObjectType };
|
|
18
19
|
const metadata = Reflect.getMetadata(DATATYPE_METADATA, ObjectType);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { toString, vg } from 'valgen';
|
|
3
3
|
import { DATATYPE_METADATA, DECODER, ENCODER } from '../../constants.js';
|
|
4
4
|
import { SimpleType } from '../simple-type.js';
|
|
@@ -30,26 +30,31 @@ let StringType = class StringType {
|
|
|
30
30
|
__decorate([
|
|
31
31
|
SimpleType.Attribute({
|
|
32
32
|
description: 'Regex pattern to be used for validation',
|
|
33
|
-
})
|
|
33
|
+
}),
|
|
34
|
+
__metadata("design:type", Object)
|
|
34
35
|
], StringType.prototype, "pattern", void 0);
|
|
35
36
|
__decorate([
|
|
36
37
|
SimpleType.Attribute({
|
|
37
38
|
description: 'Name of the pattern',
|
|
38
|
-
})
|
|
39
|
+
}),
|
|
40
|
+
__metadata("design:type", String)
|
|
39
41
|
], StringType.prototype, "patternName", void 0);
|
|
40
42
|
__decorate([
|
|
41
43
|
SimpleType.Attribute({
|
|
42
44
|
description: 'Minimum number of characters',
|
|
43
|
-
})
|
|
45
|
+
}),
|
|
46
|
+
__metadata("design:type", Number)
|
|
44
47
|
], StringType.prototype, "minLength", void 0);
|
|
45
48
|
__decorate([
|
|
46
49
|
SimpleType.Attribute({
|
|
47
50
|
description: 'Minimum number of characters',
|
|
48
|
-
})
|
|
51
|
+
}),
|
|
52
|
+
__metadata("design:type", Number)
|
|
49
53
|
], StringType.prototype, "maxLength", void 0);
|
|
50
54
|
StringType = __decorate([
|
|
51
55
|
SimpleType({
|
|
52
56
|
description: 'A sequence of characters',
|
|
53
|
-
})
|
|
57
|
+
}),
|
|
58
|
+
__metadata("design:paramtypes", [Object])
|
|
54
59
|
], StringType);
|
|
55
60
|
export { StringType };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import { asMutable } from 'ts-gems';
|
|
1
3
|
import { resolveThunk } from '../../helpers/index.js';
|
|
2
4
|
import { OpraSchema } from '../../schema/index.js';
|
|
3
5
|
import { ApiDocument } from '../api-document.js';
|
|
@@ -109,6 +111,8 @@ export class ApiDocumentFactory {
|
|
|
109
111
|
context.addError(`Unknown service protocol (${init.api.protocol})`);
|
|
110
112
|
});
|
|
111
113
|
}
|
|
114
|
+
const x = document.export();
|
|
115
|
+
asMutable(document).id = crypto.createHash('md5').update(JSON.stringify(x)).digest('base64url');
|
|
112
116
|
}
|
|
113
117
|
/**
|
|
114
118
|
*
|
|
@@ -287,7 +287,7 @@ export class DataTypeFactory {
|
|
|
287
287
|
const fieldMeta = typeof v === 'string' ? { type: v } : v;
|
|
288
288
|
if (fieldMeta.isArray && !fieldMeta.type)
|
|
289
289
|
return context.addError(`"type" must be defined explicitly for array fields`);
|
|
290
|
-
const t = await this._importDataTypeArgs(context, owner, fieldMeta.type);
|
|
290
|
+
const t = await this._importDataTypeArgs(context, owner, fieldMeta.type || 'any');
|
|
291
291
|
if (!t)
|
|
292
292
|
return;
|
|
293
293
|
initArgs.fields[k] = {
|