@opra/common 0.31.2 → 0.31.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser.js +10013 -9976
- package/cjs/document/data-type/builtin/any.type.js +2 -1
- package/cjs/document/data-type/builtin/approx-date.type.js +21 -0
- package/cjs/document/data-type/builtin/approx-datetime.type.js +24 -0
- package/cjs/document/data-type/builtin/base64.type.js +2 -1
- package/cjs/document/data-type/builtin/bigint.type.js +2 -1
- package/cjs/document/data-type/builtin/boolean.type.js +2 -1
- package/cjs/document/data-type/builtin/date.type.js +6 -11
- package/cjs/document/data-type/builtin/datetime.type.js +21 -0
- package/cjs/document/data-type/builtin/index.js +3 -1
- package/cjs/document/data-type/builtin/integer.type.js +2 -1
- package/cjs/document/data-type/builtin/null.type.js +2 -1
- package/cjs/document/data-type/builtin/number.type.js +2 -1
- package/cjs/document/data-type/builtin/object-id.type.js +2 -1
- package/cjs/document/data-type/builtin/object.type.js +2 -1
- package/cjs/document/data-type/builtin/string.type.js +2 -1
- package/cjs/document/data-type/builtin/time.type.js +7 -4
- package/cjs/document/data-type/builtin/uuid.type.js +2 -1
- package/cjs/document/data-type/complex-type-class.js +1 -1
- package/cjs/document/data-type/field-class.js +2 -3
- package/cjs/document/factory/api-document-factory.js +8 -9
- package/cjs/document/factory/type-document-factory.js +3 -6
- package/cjs/document/resource/action.js +3 -1
- package/cjs/document/resource/types/operation-result.type.js +2 -1
- package/cjs/document/type-document.js +1 -1
- package/cjs/exception/resource-errors/resource-not-found.error.js +4 -3
- package/esm/document/data-type/builtin/any.type.js +2 -1
- package/esm/document/data-type/builtin/approx-date.type.js +18 -0
- package/esm/document/data-type/builtin/approx-datetime.type.js +21 -0
- package/esm/document/data-type/builtin/base64.type.js +2 -1
- package/esm/document/data-type/builtin/bigint.type.js +2 -1
- package/esm/document/data-type/builtin/boolean.type.js +2 -1
- package/esm/document/data-type/builtin/date.type.js +6 -11
- package/esm/document/data-type/builtin/datetime.type.js +18 -0
- package/esm/document/data-type/builtin/index.js +3 -1
- package/esm/document/data-type/builtin/integer.type.js +2 -1
- package/esm/document/data-type/builtin/null.type.js +2 -1
- package/esm/document/data-type/builtin/number.type.js +2 -1
- package/esm/document/data-type/builtin/object-id.type.js +2 -1
- package/esm/document/data-type/builtin/object.type.js +2 -1
- package/esm/document/data-type/builtin/string.type.js +2 -1
- package/esm/document/data-type/builtin/time.type.js +8 -5
- package/esm/document/data-type/builtin/uuid.type.js +2 -1
- package/esm/document/data-type/complex-type-class.js +1 -1
- package/esm/document/data-type/field-class.js +2 -3
- package/esm/document/factory/api-document-factory.js +8 -9
- package/esm/document/factory/type-document-factory.js +4 -7
- package/esm/document/resource/action.js +3 -1
- package/esm/document/resource/types/operation-result.type.js +2 -1
- package/esm/document/type-document.js +1 -1
- package/esm/exception/resource-errors/resource-not-found.error.js +2 -1
- package/package.json +10 -9
- package/types/document/data-type/builtin/approx-date.type.d.ts +2 -0
- package/types/document/data-type/builtin/approx-datetime.type.d.ts +2 -0
- package/types/document/data-type/builtin/datetime.type.d.ts +2 -0
- package/types/document/data-type/builtin/index.d.ts +3 -1
- package/types/document/data-type/data-type.d.ts +2 -0
- package/types/document/data-type/field-class.d.ts +2 -1
- package/types/document/data-type/field.d.ts +1 -0
- package/types/schema/data-type/field.interface.d.ts +0 -4
- package/cjs/document/data-type/builtin/timestamp.type.js +0 -17
- package/esm/document/data-type/builtin/timestamp.type.js +0 -14
- package/types/document/data-type/builtin/timestamp.type.d.ts +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { isNumber } from 'valgen';
|
|
3
3
|
import { SimpleType } from '../simple-type.js';
|
|
4
|
-
|
|
4
|
+
let NumberType = class NumberType {
|
|
5
5
|
};
|
|
6
6
|
NumberType = __decorate([
|
|
7
7
|
SimpleType({
|
|
@@ -10,3 +10,4 @@ NumberType = __decorate([
|
|
|
10
10
|
encoder: isNumber()
|
|
11
11
|
})
|
|
12
12
|
], NumberType);
|
|
13
|
+
export { NumberType };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { isObjectId, isString, pipe } from 'valgen';
|
|
3
3
|
import { SimpleType } from '../simple-type.js';
|
|
4
|
-
|
|
4
|
+
let ObjectIdType = class ObjectIdType {
|
|
5
5
|
};
|
|
6
6
|
ObjectIdType = __decorate([
|
|
7
7
|
SimpleType({
|
|
@@ -10,3 +10,4 @@ ObjectIdType = __decorate([
|
|
|
10
10
|
encoder: pipe(isObjectId(), isString())
|
|
11
11
|
})
|
|
12
12
|
], ObjectIdType);
|
|
13
|
+
export { ObjectIdType };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { ComplexType } from '../complex-type.js';
|
|
3
|
-
|
|
3
|
+
let ObjectType = class ObjectType {
|
|
4
4
|
};
|
|
5
5
|
ObjectType = __decorate([
|
|
6
6
|
ComplexType({
|
|
@@ -10,3 +10,4 @@ ObjectType = __decorate([
|
|
|
10
10
|
ctor: Object
|
|
11
11
|
})
|
|
12
12
|
], ObjectType);
|
|
13
|
+
export { ObjectType };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { isString } from 'valgen';
|
|
3
3
|
import { SimpleType } from '../simple-type.js';
|
|
4
|
-
|
|
4
|
+
let StringType = class StringType {
|
|
5
5
|
};
|
|
6
6
|
StringType = __decorate([
|
|
7
7
|
SimpleType({
|
|
@@ -10,3 +10,4 @@ StringType = __decorate([
|
|
|
10
10
|
encoder: isString(),
|
|
11
11
|
})
|
|
12
12
|
], StringType);
|
|
13
|
+
export { StringType };
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { isMatches } from 'valgen';
|
|
3
3
|
import { SimpleType } from '../simple-type.js';
|
|
4
|
-
|
|
4
|
+
const TIME_PATTERN = /^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/;
|
|
5
|
+
let TimeType = class TimeType {
|
|
5
6
|
};
|
|
6
7
|
TimeType = __decorate([
|
|
7
8
|
SimpleType({
|
|
8
9
|
description: 'Time string in 24h format, for example, 18:23:00',
|
|
9
|
-
decoder:
|
|
10
|
-
|
|
10
|
+
decoder: isMatches(TIME_PATTERN, {
|
|
11
|
+
formatName: 'time',
|
|
11
12
|
onFail: () => '{{label}} is not a valid time'
|
|
12
13
|
}),
|
|
13
|
-
encoder:
|
|
14
|
+
encoder: isMatches(TIME_PATTERN, {
|
|
15
|
+
formatName: 'time',
|
|
14
16
|
onFail: () => '{{label}} is not a valid time'
|
|
15
17
|
})
|
|
16
18
|
})
|
|
17
19
|
], TimeType);
|
|
20
|
+
export { TimeType };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { isUUID } from 'valgen';
|
|
3
3
|
import { SimpleType } from '../simple-type.js';
|
|
4
|
-
|
|
4
|
+
let UuidType = class UuidType {
|
|
5
5
|
};
|
|
6
6
|
UuidType = __decorate([
|
|
7
7
|
SimpleType({
|
|
@@ -10,3 +10,4 @@ UuidType = __decorate([
|
|
|
10
10
|
encoder: isUUID()
|
|
11
11
|
})
|
|
12
12
|
], UuidType);
|
|
13
|
+
export { UuidType };
|
|
@@ -176,7 +176,7 @@ export class ComplexTypeClass extends DataType {
|
|
|
176
176
|
const omitOption = (options?.omit || []).map(x => x.toLowerCase());
|
|
177
177
|
const dedupedFieldNames = (options?.overwriteFields
|
|
178
178
|
? Array.from(new Set([...this.fields.keys(), ...options?.overwriteFields.keys()]))
|
|
179
|
-
: Array.from(this.fields.keys())).map(x => x.
|
|
179
|
+
: Array.from(this.fields.keys())).map(x => x.toLowerCase());
|
|
180
180
|
for (const nameLower of dedupedFieldNames) {
|
|
181
181
|
const overwriteField = options?.overwriteFields?.get(nameLower);
|
|
182
182
|
const field = this.fields.get(nameLower);
|
|
@@ -5,13 +5,13 @@ export class FieldClass {
|
|
|
5
5
|
this.owner = owner;
|
|
6
6
|
this.origin = init.origin || owner;
|
|
7
7
|
this.type = init.type;
|
|
8
|
+
this.designType = init.designType;
|
|
8
9
|
this.name = init.name;
|
|
9
10
|
this.description = init.description;
|
|
10
11
|
this.isArray = init.isArray;
|
|
11
12
|
this.default = init.default;
|
|
12
13
|
this.fixed = init.fixed;
|
|
13
14
|
this.required = init.required;
|
|
14
|
-
this.nullish = init.nullish;
|
|
15
15
|
this.readonly = init.readonly;
|
|
16
16
|
this.writeonly = init.writeonly;
|
|
17
17
|
this.exclusive = init.exclusive;
|
|
@@ -31,7 +31,6 @@ export class FieldClass {
|
|
|
31
31
|
default: this.default,
|
|
32
32
|
fixed: this.fixed,
|
|
33
33
|
required: this.required,
|
|
34
|
-
nullish: this.nullish,
|
|
35
34
|
readonly: this.readonly,
|
|
36
35
|
writeonly: this.writeonly,
|
|
37
36
|
exclusive: this.exclusive,
|
|
@@ -45,7 +44,7 @@ export class FieldClass {
|
|
|
45
44
|
return vg.isUndefined();
|
|
46
45
|
if (options?.operation === 'write' && this.readonly)
|
|
47
46
|
return vg.isUndefined();
|
|
48
|
-
let fn = this.type.generateCodec(codec, options);
|
|
47
|
+
let fn = this.type.generateCodec(codec, { ...options, designType: this.designType });
|
|
49
48
|
if (this.isArray)
|
|
50
49
|
fn = vg.isArray(fn);
|
|
51
50
|
return !options?.partial && this.required ? vg.required(fn) : vg.optional(fn);
|
|
@@ -67,19 +67,19 @@ export class ApiDocumentFactory extends TypeDocumentFactory {
|
|
|
67
67
|
if (!source)
|
|
68
68
|
return;
|
|
69
69
|
const output = {};
|
|
70
|
-
for (const [
|
|
70
|
+
for (const [endpointName, endpointSchema] of Object.entries(source)) {
|
|
71
71
|
/* istanbul ignore next */
|
|
72
|
-
if (!
|
|
72
|
+
if (!endpointSchema)
|
|
73
73
|
continue;
|
|
74
|
-
const
|
|
74
|
+
const outputEndpoint = output[endpointName] = { ...endpointSchema };
|
|
75
75
|
let parameters;
|
|
76
76
|
// Resolve lazy type
|
|
77
|
-
if (
|
|
78
|
-
|
|
77
|
+
if (endpointSchema.returnType) {
|
|
78
|
+
outputEndpoint.returnType = await this.importDataType(endpointSchema.returnType);
|
|
79
79
|
}
|
|
80
|
-
if (
|
|
81
|
-
parameters =
|
|
82
|
-
for (const [kP, oP] of Object.entries(
|
|
80
|
+
if (endpointSchema.parameters) {
|
|
81
|
+
parameters = outputEndpoint.parameters = {};
|
|
82
|
+
for (const [kP, oP] of Object.entries(endpointSchema.parameters)) {
|
|
83
83
|
if (oP.enum) {
|
|
84
84
|
oP.type = EnumType(oP.enum, { name: kP + 'Enum' });
|
|
85
85
|
}
|
|
@@ -89,7 +89,6 @@ export class ApiDocumentFactory extends TypeDocumentFactory {
|
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
output[kA] = { ...oA[kA], parameters };
|
|
93
92
|
}
|
|
94
93
|
return output;
|
|
95
94
|
};
|
|
@@ -2,14 +2,12 @@ import { validator } from 'valgen';
|
|
|
2
2
|
import { cloneObject, isConstructor, resolveThunk, ResponsiveMap } from '../../helpers/index.js';
|
|
3
3
|
import { OpraSchema } from '../../schema/index.js';
|
|
4
4
|
import { DATATYPE_METADATA } from '../constants.js';
|
|
5
|
-
import { AnyType, Base64Type, BigintType, BooleanType, DateType, IntegerType, NullType, NumberType, ObjectIdType, ObjectType, StringType,
|
|
5
|
+
import { AnyType, ApproxDatetimeType, ApproxDateType, Base64Type, BigintType, BooleanType, DatetimeType, DateType, IntegerType, NullType, NumberType, ObjectIdType, ObjectType, StringType, TimeType, UuidType } from '../data-type/builtin/index.js';
|
|
6
6
|
import { ComplexType } from '../data-type/complex-type.js';
|
|
7
7
|
import { EnumType } from '../data-type/enum-type.js';
|
|
8
8
|
import { MappedType } from '../data-type/mapped-type.js';
|
|
9
9
|
import { MixinType } from '../data-type/mixin-type.js';
|
|
10
10
|
import { SimpleType } from '../data-type/simple-type.js';
|
|
11
|
-
import { MetadataMode } from '../resource/enums/metadata-mode.enum.js';
|
|
12
|
-
import { OperationResult } from '../resource/types/operation-result.type.js';
|
|
13
11
|
import { TypeDocument } from '../type-document.js';
|
|
14
12
|
/**
|
|
15
13
|
* @class TypeDocumentFactory
|
|
@@ -96,10 +94,9 @@ export class TypeDocumentFactory {
|
|
|
96
94
|
}
|
|
97
95
|
},
|
|
98
96
|
types: [AnyType, Base64Type, BigintType, BooleanType,
|
|
99
|
-
DateType,
|
|
100
|
-
|
|
101
|
-
TimeType,
|
|
102
|
-
OperationResult, MetadataMode,
|
|
97
|
+
DateType, IntegerType, NullType, NumberType, ObjectIdType,
|
|
98
|
+
ObjectType, ApproxDateType, ApproxDatetimeType,
|
|
99
|
+
StringType, DatetimeType, TimeType, UuidType
|
|
103
100
|
]
|
|
104
101
|
};
|
|
105
102
|
const factory = new TypeDocumentFactory();
|
|
@@ -20,7 +20,9 @@ export class Action extends Endpoint {
|
|
|
20
20
|
exportSchema(options) {
|
|
21
21
|
const schema = super.exportSchema(options);
|
|
22
22
|
if (this.returnType)
|
|
23
|
-
schema.returnType = this.returnType.
|
|
23
|
+
schema.returnType = this.returnType.isAnonymous
|
|
24
|
+
? this.returnType.exportSchema(options)
|
|
25
|
+
: this.returnType.name;
|
|
24
26
|
if (this.returnMime)
|
|
25
27
|
schema.returnMime = this.returnMime;
|
|
26
28
|
return schema;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { ComplexType } from '../../data-type/complex-type.js';
|
|
3
3
|
import { ApiField } from '../../data-type/field.js';
|
|
4
|
-
|
|
4
|
+
let OperationResult = class OperationResult {
|
|
5
5
|
constructor(init) {
|
|
6
6
|
if (init)
|
|
7
7
|
Object.assign(this, init);
|
|
@@ -39,3 +39,4 @@ OperationResult = __decorate([
|
|
|
39
39
|
description: 'Operation result'
|
|
40
40
|
})
|
|
41
41
|
], OperationResult);
|
|
42
|
+
export { OperationResult };
|
|
@@ -20,7 +20,7 @@ export class TypeDocument extends DocumentBase {
|
|
|
20
20
|
this._designCtorMap.set(Number, 'number');
|
|
21
21
|
this._designCtorMap.set(Boolean, 'boolean');
|
|
22
22
|
this._designCtorMap.set(Object, 'any');
|
|
23
|
-
this._designCtorMap.set(Date, '
|
|
23
|
+
this._designCtorMap.set(Date, 'datetime');
|
|
24
24
|
this._designCtorMap.set(BigIntConstructor, 'bigint');
|
|
25
25
|
this._designCtorMap.set(ArrayBuffer, 'base64');
|
|
26
26
|
this._designCtorMap.set(SharedArrayBuffer, 'base64');
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HttpStatusCodes } from '../../http/index.js';
|
|
1
2
|
import { translate } from '../../i18n/index.js';
|
|
2
3
|
import { OpraException } from '../opra-exception.js';
|
|
3
4
|
/**
|
|
@@ -14,6 +15,6 @@ export class ResourceNotFoundError extends OpraException {
|
|
|
14
15
|
resource,
|
|
15
16
|
key: keyValue
|
|
16
17
|
}
|
|
17
|
-
}, cause,
|
|
18
|
+
}, cause, HttpStatusCodes.UNPROCESSABLE_ENTITY);
|
|
18
19
|
}
|
|
19
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/common",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.5",
|
|
4
4
|
"description": "Opra common package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,10 +26,11 @@
|
|
|
26
26
|
"check": "madge --circular src/**",
|
|
27
27
|
"test": "jest",
|
|
28
28
|
"cover": "jest --collect-coverage",
|
|
29
|
-
"clean": "npm run clean:src && npm run clean:dist && npm run clean:cover",
|
|
30
|
-
"clean:src": "ts-cleanup -s src --all
|
|
31
|
-
"clean:
|
|
32
|
-
"clean:
|
|
29
|
+
"clean": "npm run clean:src && npm run clean:test && npm run clean:dist && npm run clean:cover",
|
|
30
|
+
"clean:src": "ts-cleanup -s src --all",
|
|
31
|
+
"clean:test": "ts-cleanup -s test --all",
|
|
32
|
+
"clean:dist": "rimraf ../../build/client",
|
|
33
|
+
"clean:cover": "rimraf ../../coverage/client",
|
|
33
34
|
"antlr4": "java -jar ./tools/antlr4-4.12.1-SNAPSHOT-complete.jar -Dlanguage=TypeScript ./src/filter/antlr/OpraFilter.g4 -visitor"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|
|
@@ -45,15 +46,15 @@
|
|
|
45
46
|
"putil-varhelpers": "^1.6.5",
|
|
46
47
|
"reflect-metadata": "^0.1.13",
|
|
47
48
|
"uid": "^2.0.1",
|
|
48
|
-
"valgen": "^4.
|
|
49
|
+
"valgen": "^4.2.2"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@browsery/fs": "^0.4.0",
|
|
52
53
|
"@browsery/stream": "^0.6.0",
|
|
53
54
|
"@browsery/util": "^0.4.0",
|
|
54
|
-
"@types/encodeurl": "^1.0.
|
|
55
|
-
"@types/
|
|
56
|
-
"@types/
|
|
55
|
+
"@types/encodeurl": "^1.0.2",
|
|
56
|
+
"@types/lodash.omit": "^4.5.9",
|
|
57
|
+
"@types/validator": "^13.11.6",
|
|
57
58
|
"path-browserify": "^1.0.1",
|
|
58
59
|
"ts-gems": "^2.5.0"
|
|
59
60
|
},
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export * from './any.type.js';
|
|
2
|
+
export * from './approx-date.type.js';
|
|
3
|
+
export * from './approx-datetime.type.js';
|
|
2
4
|
export * from './base64.type.js';
|
|
3
5
|
export * from './bigint.type.js';
|
|
4
6
|
export * from './boolean.type.js';
|
|
5
7
|
export * from './date.type.js';
|
|
8
|
+
export * from './datetime.type.js';
|
|
6
9
|
export * from './uuid.type.js';
|
|
7
10
|
export * from './integer.type.js';
|
|
8
11
|
export * from './null.type.js';
|
|
@@ -11,4 +14,3 @@ export * from './object.type.js';
|
|
|
11
14
|
export * from './object-id.type.js';
|
|
12
15
|
export * from './string.type.js';
|
|
13
16
|
export * from './time.type.js';
|
|
14
|
-
export * from './timestamp.type.js';
|
|
@@ -30,6 +30,7 @@ export declare namespace DataType {
|
|
|
30
30
|
interface InitArguments {
|
|
31
31
|
name?: string;
|
|
32
32
|
description?: string;
|
|
33
|
+
example?: string | string[];
|
|
33
34
|
}
|
|
34
35
|
interface DecoratorOptions extends InitArguments {
|
|
35
36
|
}
|
|
@@ -45,5 +46,6 @@ export declare namespace DataType {
|
|
|
45
46
|
partial?: boolean;
|
|
46
47
|
operation?: 'read' | 'write';
|
|
47
48
|
overwriteFields?: ResponsiveMap<ApiField.InitArguments>;
|
|
49
|
+
designType?: Type;
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Type } from 'ts-gems';
|
|
1
2
|
import * as vg from 'valgen';
|
|
2
3
|
import type { OpraSchema } from '../../schema/index.js';
|
|
3
4
|
import type { ComplexType } from './complex-type.js';
|
|
@@ -8,12 +9,12 @@ export declare class FieldClass {
|
|
|
8
9
|
readonly origin?: ComplexType;
|
|
9
10
|
readonly type: DataType;
|
|
10
11
|
readonly name: string;
|
|
12
|
+
readonly designType?: Type;
|
|
11
13
|
description?: string;
|
|
12
14
|
isArray?: boolean;
|
|
13
15
|
default?: any;
|
|
14
16
|
fixed?: string | number | boolean;
|
|
15
17
|
required?: boolean;
|
|
16
|
-
nullish?: boolean;
|
|
17
18
|
readonly?: boolean;
|
|
18
19
|
writeonly?: boolean;
|
|
19
20
|
exclusive?: boolean;
|
|
@@ -28,6 +28,7 @@ export declare namespace ApiField {
|
|
|
28
28
|
interface InitArguments extends StrictOmit<OpraSchema.Field, 'type'> {
|
|
29
29
|
name: string;
|
|
30
30
|
type: DataType;
|
|
31
|
+
designType?: Type;
|
|
31
32
|
origin?: ComplexType;
|
|
32
33
|
}
|
|
33
34
|
interface DecoratorOptions extends Partial<StrictOmit<OpraSchema.Field, 'isArray' | 'type'>> {
|
|
@@ -25,10 +25,6 @@ export type Field = {
|
|
|
25
25
|
* Defines if field value required in create operation
|
|
26
26
|
*/
|
|
27
27
|
required?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Defines if field value be nullish (undefined, null or empty)
|
|
30
|
-
*/
|
|
31
|
-
nullish?: boolean;
|
|
32
28
|
/**
|
|
33
29
|
* Defines if the field is readonly
|
|
34
30
|
*/
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TimestampType = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const valgen_1 = require("valgen");
|
|
6
|
-
const simple_type_js_1 = require("../simple-type.js");
|
|
7
|
-
let TimestampType = exports.TimestampType = class TimestampType {
|
|
8
|
-
};
|
|
9
|
-
exports.TimestampType = TimestampType = tslib_1.__decorate([
|
|
10
|
-
(0, simple_type_js_1.SimpleType)({
|
|
11
|
-
description: 'Timestamp, for example, 2021-04-18T09:12:53',
|
|
12
|
-
decoder: (0, valgen_1.isDate)({
|
|
13
|
-
format: ['YYYY-MM-DDTHH:mm:ss', 'YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD', 'YYYY']
|
|
14
|
-
}),
|
|
15
|
-
encoder: (0, valgen_1.isDateString)({ format: 'YYYY-MM-DDTHH:mm:ss' })
|
|
16
|
-
})
|
|
17
|
-
], TimestampType);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { isDate, isDateString } from 'valgen';
|
|
3
|
-
import { SimpleType } from '../simple-type.js';
|
|
4
|
-
export let TimestampType = class TimestampType {
|
|
5
|
-
};
|
|
6
|
-
TimestampType = __decorate([
|
|
7
|
-
SimpleType({
|
|
8
|
-
description: 'Timestamp, for example, 2021-04-18T09:12:53',
|
|
9
|
-
decoder: isDate({
|
|
10
|
-
format: ['YYYY-MM-DDTHH:mm:ss', 'YYYY-MM-DD HH:mm:ss', 'YYYY-MM-DD', 'YYYY']
|
|
11
|
-
}),
|
|
12
|
-
encoder: isDateString({ format: 'YYYY-MM-DDTHH:mm:ss' })
|
|
13
|
-
})
|
|
14
|
-
], TimestampType);
|