@opra/common 1.17.6 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/index.cjs +5 -5
- package/browser/index.mjs +5 -5
- package/cjs/document/data-type/api-field.js +11 -5
- package/cjs/document/data-type/complex-type-base.js +23 -12
- package/cjs/document/data-type/extended-types/base64.type.js +16 -3
- package/cjs/document/data-type/extended-types/date-time-tz.type.js +71 -0
- package/cjs/document/data-type/extended-types/date-time.type.js +13 -9
- package/cjs/document/data-type/extended-types/date.type.js +14 -9
- package/cjs/document/data-type/extended-types/index.js +2 -2
- package/cjs/document/data-type/extended-types/partial-date.type.js +85 -0
- package/cjs/document/data-type/omit-type.js +0 -6
- package/cjs/document/data-type/partial-type.js +0 -6
- package/cjs/document/data-type/simple-type.js +4 -0
- package/cjs/document/decorators/api-field-decorator.js +1 -0
- package/cjs/document/factory/api-document.factory.js +5 -25
- package/cjs/document/factory/data-type.factory.js +1 -0
- package/cjs/filter/filter-rules.js +1 -1
- package/esm/document/data-type/api-field.js +11 -5
- package/esm/document/data-type/complex-type-base.js +23 -12
- package/esm/document/data-type/extended-types/base64.type.js +17 -4
- package/esm/document/data-type/extended-types/date-time-tz.type.js +68 -0
- package/esm/document/data-type/extended-types/date-time.type.js +13 -9
- package/esm/document/data-type/extended-types/date.type.js +14 -9
- package/esm/document/data-type/extended-types/index.js +2 -2
- package/esm/document/data-type/extended-types/partial-date.type.js +82 -0
- package/esm/document/data-type/omit-type.js +0 -6
- package/esm/document/data-type/partial-type.js +0 -6
- package/esm/document/data-type/simple-type.js +4 -0
- package/esm/document/decorators/api-field-decorator.js +1 -0
- package/esm/document/factory/api-document.factory.js +4 -25
- package/esm/document/factory/data-type.factory.js +1 -0
- package/esm/filter/filter-rules.js +1 -1
- package/package.json +3 -3
- package/types/document/data-type/api-field.d.ts +8 -0
- package/types/document/data-type/data-type.d.ts +4 -4
- package/types/document/data-type/extended-types/base64.type.d.ts +2 -1
- package/types/document/data-type/extended-types/{date-string.type.d.ts → date-time-tz.type.d.ts} +2 -2
- package/types/document/data-type/extended-types/date-time.type.d.ts +1 -0
- package/types/document/data-type/extended-types/date.type.d.ts +1 -0
- package/types/document/data-type/extended-types/index.d.ts +2 -2
- package/types/document/data-type/extended-types/{date-time-string.type.d.ts → partial-date.type.d.ts} +2 -2
- package/types/document/data-type/omit-type.d.ts +9 -2
- package/types/document/data-type/partial-type.d.ts +7 -1
- package/types/document/data-type/simple-type.d.ts +3 -1
- package/types/document/factory/data-type.factory.d.ts +1 -0
- package/cjs/document/data-type/extended-types/date-string.type.js +0 -52
- package/cjs/document/data-type/extended-types/date-time-string.type.js +0 -55
- package/esm/document/data-type/extended-types/date-string.type.js +0 -49
- package/esm/document/data-type/extended-types/date-time-string.type.js +0 -52
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DateStringType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const valgen_1 = require("valgen");
|
|
6
|
-
const constants_js_1 = require("../../constants.js");
|
|
7
|
-
const simple_type_js_1 = require("../simple-type.js");
|
|
8
|
-
let DateStringType = class DateStringType {
|
|
9
|
-
constructor(attributes) {
|
|
10
|
-
if (attributes)
|
|
11
|
-
Object.assign(this, attributes);
|
|
12
|
-
}
|
|
13
|
-
[constants_js_1.DECODER](properties) {
|
|
14
|
-
const fn = valgen_1.vg.isDateString({ trim: 'date', coerce: true });
|
|
15
|
-
const x = [];
|
|
16
|
-
if (properties.minValue != null)
|
|
17
|
-
x.push(valgen_1.vg.isGte(properties.minValue));
|
|
18
|
-
if (properties.maxValue != null)
|
|
19
|
-
x.push(valgen_1.vg.isLte(properties.maxValue));
|
|
20
|
-
return x.length > 0 ? valgen_1.vg.pipe([fn, ...x], { returnIndex: 0 }) : fn;
|
|
21
|
-
}
|
|
22
|
-
[constants_js_1.ENCODER](properties) {
|
|
23
|
-
return this[constants_js_1.DECODER](properties);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
exports.DateStringType = DateStringType;
|
|
27
|
-
tslib_1.__decorate([
|
|
28
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
29
|
-
description: 'Minimum value',
|
|
30
|
-
}),
|
|
31
|
-
tslib_1.__metadata("design:type", String)
|
|
32
|
-
], DateStringType.prototype, "minValue", void 0);
|
|
33
|
-
tslib_1.__decorate([
|
|
34
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
35
|
-
description: 'Maximum value',
|
|
36
|
-
}),
|
|
37
|
-
tslib_1.__metadata("design:type", String)
|
|
38
|
-
], DateStringType.prototype, "maxValue", void 0);
|
|
39
|
-
exports.DateStringType = DateStringType = tslib_1.__decorate([
|
|
40
|
-
((0, simple_type_js_1.SimpleType)({
|
|
41
|
-
name: 'datestring',
|
|
42
|
-
description: 'Date string value',
|
|
43
|
-
nameMappings: {
|
|
44
|
-
js: 'string',
|
|
45
|
-
json: 'string',
|
|
46
|
-
},
|
|
47
|
-
})
|
|
48
|
-
.Example('2021-04-18', 'Full date value')
|
|
49
|
-
.Example('2021-04', 'Date value without day')
|
|
50
|
-
.Example('2021', 'Year only value')),
|
|
51
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
52
|
-
], DateStringType);
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DateTimeStringType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const valgen_1 = require("valgen");
|
|
6
|
-
const constants_js_1 = require("../../constants.js");
|
|
7
|
-
const simple_type_js_1 = require("../simple-type.js");
|
|
8
|
-
let DateTimeStringType = class DateTimeStringType {
|
|
9
|
-
constructor(attributes) {
|
|
10
|
-
if (attributes)
|
|
11
|
-
Object.assign(this, attributes);
|
|
12
|
-
}
|
|
13
|
-
[constants_js_1.DECODER](properties) {
|
|
14
|
-
const fn = valgen_1.vg.isDateString({ coerce: true });
|
|
15
|
-
const x = [];
|
|
16
|
-
if (properties.minValue != null)
|
|
17
|
-
x.push(valgen_1.vg.isGte(properties.minValue));
|
|
18
|
-
if (properties.maxValue != null)
|
|
19
|
-
x.push(valgen_1.vg.isLte(properties.maxValue));
|
|
20
|
-
return x.length > 0 ? valgen_1.vg.pipe([fn, ...x]) : fn;
|
|
21
|
-
}
|
|
22
|
-
[constants_js_1.ENCODER](properties) {
|
|
23
|
-
return this[constants_js_1.DECODER](properties);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
exports.DateTimeStringType = DateTimeStringType;
|
|
27
|
-
tslib_1.__decorate([
|
|
28
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
29
|
-
description: 'Minimum value',
|
|
30
|
-
}),
|
|
31
|
-
tslib_1.__metadata("design:type", String)
|
|
32
|
-
], DateTimeStringType.prototype, "minValue", void 0);
|
|
33
|
-
tslib_1.__decorate([
|
|
34
|
-
simple_type_js_1.SimpleType.Attribute({
|
|
35
|
-
description: 'Maximum value',
|
|
36
|
-
}),
|
|
37
|
-
tslib_1.__metadata("design:type", String)
|
|
38
|
-
], DateTimeStringType.prototype, "maxValue", void 0);
|
|
39
|
-
exports.DateTimeStringType = DateTimeStringType = tslib_1.__decorate([
|
|
40
|
-
((0, simple_type_js_1.SimpleType)({
|
|
41
|
-
name: 'datetimestring',
|
|
42
|
-
description: 'DateTime string value',
|
|
43
|
-
nameMappings: {
|
|
44
|
-
js: 'string',
|
|
45
|
-
json: 'string',
|
|
46
|
-
},
|
|
47
|
-
})
|
|
48
|
-
.Example('2021-04-18T22:30:15+01:00', 'Full date-time value with timezone')
|
|
49
|
-
.Example('2021-04-18T22:30:15', 'Full date-time value without timezone')
|
|
50
|
-
.Example('2021-04-18 22:30', 'Date-time value')
|
|
51
|
-
.Example('2021-04-18', 'Date value')
|
|
52
|
-
.Example('2021-04', 'Date value without day')
|
|
53
|
-
.Example('2021', 'Year only value')),
|
|
54
|
-
tslib_1.__metadata("design:paramtypes", [Object])
|
|
55
|
-
], DateTimeStringType);
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { vg } from 'valgen';
|
|
3
|
-
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
|
-
import { SimpleType } from '../simple-type.js';
|
|
5
|
-
let DateStringType = class DateStringType {
|
|
6
|
-
constructor(attributes) {
|
|
7
|
-
if (attributes)
|
|
8
|
-
Object.assign(this, attributes);
|
|
9
|
-
}
|
|
10
|
-
[DECODER](properties) {
|
|
11
|
-
const fn = vg.isDateString({ trim: 'date', coerce: true });
|
|
12
|
-
const x = [];
|
|
13
|
-
if (properties.minValue != null)
|
|
14
|
-
x.push(vg.isGte(properties.minValue));
|
|
15
|
-
if (properties.maxValue != null)
|
|
16
|
-
x.push(vg.isLte(properties.maxValue));
|
|
17
|
-
return x.length > 0 ? vg.pipe([fn, ...x], { returnIndex: 0 }) : fn;
|
|
18
|
-
}
|
|
19
|
-
[ENCODER](properties) {
|
|
20
|
-
return this[DECODER](properties);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
__decorate([
|
|
24
|
-
SimpleType.Attribute({
|
|
25
|
-
description: 'Minimum value',
|
|
26
|
-
}),
|
|
27
|
-
__metadata("design:type", String)
|
|
28
|
-
], DateStringType.prototype, "minValue", void 0);
|
|
29
|
-
__decorate([
|
|
30
|
-
SimpleType.Attribute({
|
|
31
|
-
description: 'Maximum value',
|
|
32
|
-
}),
|
|
33
|
-
__metadata("design:type", String)
|
|
34
|
-
], DateStringType.prototype, "maxValue", void 0);
|
|
35
|
-
DateStringType = __decorate([
|
|
36
|
-
(SimpleType({
|
|
37
|
-
name: 'datestring',
|
|
38
|
-
description: 'Date string value',
|
|
39
|
-
nameMappings: {
|
|
40
|
-
js: 'string',
|
|
41
|
-
json: 'string',
|
|
42
|
-
},
|
|
43
|
-
})
|
|
44
|
-
.Example('2021-04-18', 'Full date value')
|
|
45
|
-
.Example('2021-04', 'Date value without day')
|
|
46
|
-
.Example('2021', 'Year only value')),
|
|
47
|
-
__metadata("design:paramtypes", [Object])
|
|
48
|
-
], DateStringType);
|
|
49
|
-
export { DateStringType };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { vg } from 'valgen';
|
|
3
|
-
import { DECODER, ENCODER } from '../../constants.js';
|
|
4
|
-
import { SimpleType } from '../simple-type.js';
|
|
5
|
-
let DateTimeStringType = class DateTimeStringType {
|
|
6
|
-
constructor(attributes) {
|
|
7
|
-
if (attributes)
|
|
8
|
-
Object.assign(this, attributes);
|
|
9
|
-
}
|
|
10
|
-
[DECODER](properties) {
|
|
11
|
-
const fn = vg.isDateString({ coerce: true });
|
|
12
|
-
const x = [];
|
|
13
|
-
if (properties.minValue != null)
|
|
14
|
-
x.push(vg.isGte(properties.minValue));
|
|
15
|
-
if (properties.maxValue != null)
|
|
16
|
-
x.push(vg.isLte(properties.maxValue));
|
|
17
|
-
return x.length > 0 ? vg.pipe([fn, ...x]) : fn;
|
|
18
|
-
}
|
|
19
|
-
[ENCODER](properties) {
|
|
20
|
-
return this[DECODER](properties);
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
__decorate([
|
|
24
|
-
SimpleType.Attribute({
|
|
25
|
-
description: 'Minimum value',
|
|
26
|
-
}),
|
|
27
|
-
__metadata("design:type", String)
|
|
28
|
-
], DateTimeStringType.prototype, "minValue", void 0);
|
|
29
|
-
__decorate([
|
|
30
|
-
SimpleType.Attribute({
|
|
31
|
-
description: 'Maximum value',
|
|
32
|
-
}),
|
|
33
|
-
__metadata("design:type", String)
|
|
34
|
-
], DateTimeStringType.prototype, "maxValue", void 0);
|
|
35
|
-
DateTimeStringType = __decorate([
|
|
36
|
-
(SimpleType({
|
|
37
|
-
name: 'datetimestring',
|
|
38
|
-
description: 'DateTime string value',
|
|
39
|
-
nameMappings: {
|
|
40
|
-
js: 'string',
|
|
41
|
-
json: 'string',
|
|
42
|
-
},
|
|
43
|
-
})
|
|
44
|
-
.Example('2021-04-18T22:30:15+01:00', 'Full date-time value with timezone')
|
|
45
|
-
.Example('2021-04-18T22:30:15', 'Full date-time value without timezone')
|
|
46
|
-
.Example('2021-04-18 22:30', 'Date-time value')
|
|
47
|
-
.Example('2021-04-18', 'Date value')
|
|
48
|
-
.Example('2021-04', 'Date value without day')
|
|
49
|
-
.Example('2021', 'Year only value')),
|
|
50
|
-
__metadata("design:paramtypes", [Object])
|
|
51
|
-
], DateTimeStringType);
|
|
52
|
-
export { DateTimeStringType };
|