@opra/common 1.0.0-alpha.9 → 1.0.0-beta.2
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 +12 -0
- package/browser/index.mjs +12 -0
- package/cjs/document/api-document.js +11 -0
- package/cjs/document/common/api-base.js +1 -1
- package/cjs/document/common/document-element.js +2 -0
- package/cjs/document/data-type/api-field.js +8 -7
- package/cjs/document/data-type/complex-type-base.js +5 -3
- package/cjs/document/data-type/extended-types/date-string.type.js +2 -2
- package/cjs/document/data-type/extended-types/date-time-string.type.js +2 -2
- package/cjs/document/data-type/extended-types/date-time.type.js +2 -2
- package/cjs/document/data-type/extended-types/date.type.js +2 -2
- package/cjs/document/data-type/extended-types/email.type.js +2 -2
- package/cjs/document/data-type/extended-types/filter.type.js +1 -1
- package/cjs/document/data-type/extended-types/time.type.js +2 -2
- package/cjs/document/data-type/extended-types/url.type.js +2 -2
- package/cjs/document/data-type/omit-type.js +7 -2
- package/cjs/document/data-type/partial-type.js +7 -2
- package/cjs/document/data-type/pick-type.js +1 -2
- package/cjs/document/data-type/primitive-types/object.type.js +0 -3
- package/cjs/document/data-type/required-type.js +1 -2
- package/cjs/document/data-type/simple-type.js +1 -6
- package/cjs/document/data-type/utils/create-mapped-class.js +1 -2
- package/cjs/document/data-type/utils/get-is-inherited-predicate-fn.js +1 -2
- package/cjs/document/decorators/api-field-decorator.js +4 -6
- package/cjs/document/decorators/complex-type.decorator.js +1 -2
- package/cjs/document/decorators/http-controller.decorator.js +2 -3
- package/cjs/document/decorators/http-operation-entity.decorator.js +68 -74
- package/cjs/document/decorators/http-operation.decorator.js +4 -2
- package/cjs/document/decorators/simple-type.decorator.js +2 -3
- package/cjs/document/factory/api-document.factory.js +17 -8
- package/cjs/document/http/http-api.js +0 -1
- package/cjs/document/http/http-controller.js +4 -2
- package/cjs/document/http/http-media-type.js +17 -2
- package/cjs/document/http/http-multipart-field.js +0 -1
- package/cjs/document/http/http-operation-response.js +0 -1
- package/cjs/document/http/http-operation.js +12 -1
- package/cjs/document/http/http-parameter.js +2 -0
- package/cjs/document/http/http-request-body.js +0 -1
- package/cjs/document/http/http-status-range.js +5 -2
- package/cjs/document/utils/parse-regexp.util.js +1 -2
- package/cjs/document/utils/string-compare.util.js +1 -2
- package/cjs/exception/opra-exception.js +1 -0
- package/cjs/filter/build.js +21 -22
- package/cjs/filter/filter-rules.js +17 -16
- package/cjs/filter/parse.js +1 -2
- package/cjs/filter/utils.js +2 -3
- package/cjs/helpers/function-utils.js +1 -2
- package/cjs/helpers/get-stack-filename.js +2 -3
- package/cjs/helpers/index.js +1 -0
- package/cjs/helpers/mixin-utils.js +2 -3
- package/cjs/helpers/object-utils.js +5 -6
- package/cjs/helpers/parse-fields-projection.js +3 -3
- package/cjs/helpers/safe-json-stringify.js +16 -0
- package/cjs/helpers/type-guards.js +10 -11
- package/cjs/i18n/string-utils.js +2 -3
- package/cjs/i18n/translate.js +1 -2
- package/cjs/schema/index.js +2 -27
- package/cjs/schema/opra-schema.js +24 -0
- package/cjs/schema/type-guards.js +7 -8
- package/esm/document/api-document.js +11 -0
- package/esm/document/common/api-base.js +1 -1
- package/esm/document/common/document-element.js +2 -0
- package/esm/document/data-type/api-field.js +8 -7
- package/esm/document/data-type/complex-type-base.js +5 -3
- package/esm/document/data-type/extended-types/date-string.type.js +2 -2
- package/esm/document/data-type/extended-types/date-time-string.type.js +2 -2
- package/esm/document/data-type/extended-types/date-time.type.js +2 -2
- package/esm/document/data-type/extended-types/date.type.js +2 -2
- package/esm/document/data-type/extended-types/email.type.js +2 -2
- package/esm/document/data-type/extended-types/filter.type.js +1 -1
- package/esm/document/data-type/extended-types/time.type.js +2 -2
- package/esm/document/data-type/extended-types/url.type.js +2 -2
- package/esm/document/data-type/omit-type.js +6 -0
- package/esm/document/data-type/partial-type.js +6 -0
- package/esm/document/data-type/primitive-types/object.type.js +0 -3
- package/esm/document/data-type/simple-type.js +1 -6
- package/esm/document/decorators/api-field-decorator.js +1 -2
- package/esm/document/decorators/http-controller.decorator.js +1 -1
- package/esm/document/decorators/http-operation-entity.decorator.js +25 -31
- package/esm/document/decorators/http-operation.decorator.js +3 -0
- package/esm/document/factory/api-document.factory.js +17 -7
- package/esm/document/http/http-api.js +0 -1
- package/esm/document/http/http-controller.js +3 -2
- package/esm/document/http/http-media-type.js +16 -2
- package/esm/document/http/http-multipart-field.js +0 -1
- package/esm/document/http/http-operation-response.js +0 -1
- package/esm/document/http/http-operation.js +12 -1
- package/esm/document/http/http-parameter.js +2 -0
- package/esm/document/http/http-request-body.js +0 -1
- package/esm/document/http/http-status-range.js +5 -2
- package/esm/exception/opra-exception.js +1 -0
- package/esm/filter/filter-rules.js +10 -9
- package/esm/helpers/index.js +1 -0
- package/esm/helpers/object-utils.js +2 -2
- package/esm/helpers/safe-json-stringify.js +13 -0
- package/esm/package.json +3 -0
- package/esm/schema/index.js +2 -27
- package/esm/schema/opra-schema.js +21 -0
- package/package.json +47 -53
- package/types/document/api-document.d.ts +2 -1
- package/types/document/common/api-base.d.ts +2 -2
- package/types/document/common/data-type-map.d.ts +1 -1
- package/types/document/common/document-element.d.ts +1 -0
- package/types/document/common/document-node.d.ts +8 -8
- package/types/document/common/value.d.ts +1 -1
- package/types/document/data-type/api-field.d.ts +11 -1
- package/types/document/data-type/complex-type-base.d.ts +6 -7
- package/types/document/data-type/complex-type.d.ts +1 -1
- package/types/document/data-type/data-type.d.ts +3 -2
- package/types/document/data-type/enum-type.d.ts +2 -2
- package/types/document/data-type/extended-types/base64.type.d.ts +1 -1
- package/types/document/data-type/extended-types/date-string.type.d.ts +1 -1
- package/types/document/data-type/extended-types/date-time-string.type.d.ts +1 -1
- package/types/document/data-type/extended-types/date-time.type.d.ts +1 -1
- package/types/document/data-type/extended-types/date.type.d.ts +1 -1
- package/types/document/data-type/extended-types/email.type.d.ts +1 -1
- package/types/document/data-type/extended-types/field-path.type.d.ts +3 -3
- package/types/document/data-type/extended-types/filter.type.d.ts +3 -3
- package/types/document/data-type/extended-types/object-id.type.d.ts +1 -1
- package/types/document/data-type/extended-types/operation-result.type.d.ts +2 -2
- package/types/document/data-type/extended-types/time.type.d.ts +1 -1
- package/types/document/data-type/extended-types/url.type.d.ts +1 -1
- package/types/document/data-type/extended-types/uuid.type.d.ts +1 -1
- package/types/document/data-type/mapped-type.d.ts +3 -3
- package/types/document/data-type/mixin-type.d.ts +1 -1
- package/types/document/data-type/omit-type.d.ts +1 -7
- package/types/document/data-type/partial-type.d.ts +1 -7
- package/types/document/data-type/pick-type.d.ts +3 -3
- package/types/document/data-type/primitive-types/any.type.d.ts +1 -1
- package/types/document/data-type/primitive-types/bigint.type.d.ts +1 -1
- package/types/document/data-type/primitive-types/boolean.type.d.ts +1 -1
- package/types/document/data-type/primitive-types/integer.type.d.ts +1 -1
- package/types/document/data-type/primitive-types/null.type.d.ts +1 -1
- package/types/document/data-type/primitive-types/number.type.d.ts +1 -1
- package/types/document/data-type/primitive-types/string.type.d.ts +1 -1
- package/types/document/data-type/required-type.d.ts +8 -8
- package/types/document/data-type/simple-type.d.ts +2 -2
- package/types/document/data-type/utils/create-mapped-class.d.ts +2 -2
- package/types/document/decorators/api-field-decorator.d.ts +1 -1
- package/types/document/decorators/http-controller.decorator.d.ts +3 -3
- package/types/document/decorators/http-operation-entity.decorator.d.ts +5 -4
- package/types/document/decorators/http-operation.decorator.d.ts +1 -1
- package/types/document/factory/api-document.factory.d.ts +2 -1
- package/types/document/factory/data-type.factory.d.ts +1 -1
- package/types/document/factory/http-api.factory.d.ts +1 -1
- package/types/document/http/http-api.d.ts +2 -2
- package/types/document/http/http-controller.d.ts +1 -1
- package/types/document/http/http-media-type.d.ts +3 -2
- package/types/document/http/http-multipart-field.d.ts +1 -2
- package/types/document/http/http-operation-response.d.ts +1 -1
- package/types/document/http/http-operation.d.ts +6 -5
- package/types/document/http/http-parameter.d.ts +2 -2
- package/types/document/http/http-request-body.d.ts +1 -1
- package/types/document/http/http-status-range.d.ts +2 -1
- package/types/exception/http-errors/bad-request.error.d.ts +1 -1
- package/types/exception/http-errors/conflict.error.d.ts +1 -1
- package/types/exception/http-errors/failed-dependency.error.d.ts +1 -1
- package/types/exception/http-errors/forbidden.error.d.ts +1 -1
- package/types/exception/http-errors/internal-server.error.d.ts +1 -1
- package/types/exception/http-errors/method-not-allowed.error.d.ts +1 -1
- package/types/exception/http-errors/not-acceptable.error.d.ts +1 -1
- package/types/exception/http-errors/not-found.error.d.ts +1 -1
- package/types/exception/http-errors/permission.error.d.ts +1 -1
- package/types/exception/http-errors/unauthorized.error.d.ts +1 -1
- package/types/exception/http-errors/unprocessable-entity.error.d.ts +1 -1
- package/types/exception/opra-exception.d.ts +1 -1
- package/types/exception/opra-http-error.d.ts +1 -1
- package/types/filter/antlr/OpraFilterParser.d.ts +1 -1
- package/types/filter/ast/expressions/comparison-expression.d.ts +1 -1
- package/types/filter/errors.d.ts +3 -4
- package/types/filter/filter-rules.d.ts +5 -5
- package/types/filter/opra-error-listener.d.ts +1 -2
- package/types/helpers/function-utils.d.ts +1 -1
- package/types/helpers/index.d.ts +1 -0
- package/types/helpers/mixin-utils.d.ts +1 -1
- package/types/helpers/object-utils.d.ts +1 -1
- package/types/helpers/safe-json-stringify.d.ts +1 -0
- package/types/helpers/type-guards.d.ts +1 -3
- package/types/i18n/i18n.d.ts +2 -2
- package/types/i18n/translate.d.ts +1 -1
- package/types/index.d.cts +9 -0
- package/types/schema/{document.interface.d.ts → api-document.interface.d.ts} +4 -4
- package/types/schema/data-type/complex-type.interface.d.ts +1 -1
- package/types/schema/data-type/data-type.interface.d.ts +1 -1
- package/types/schema/data-type/enum-type.interface.d.ts +1 -1
- package/types/schema/data-type/mapped-type.interface.d.ts +3 -3
- package/types/schema/data-type/mixin-type.interface.d.ts +1 -1
- package/types/schema/data-type-container.interface.d.ts +1 -1
- package/types/schema/http/http-controller.interface.d.ts +2 -2
- package/types/schema/http/http-media-type.interface.d.ts +1 -1
- package/types/schema/http/http-operation-response.interface.d.ts +2 -2
- package/types/schema/http/http-operation.interface.d.ts +8 -4
- package/types/schema/http/http-parameter.interface.d.ts +2 -2
- package/types/schema/index.d.ts +2 -62
- package/types/schema/opra-schema.d.ts +21 -0
- package/types/schema/type-guards.d.ts +1 -1
- package/browser.js +0 -13393
- /package/cjs/schema/{document.interface.js → api-document.interface.js} +0 -0
- /package/esm/schema/{document.interface.js → api-document.interface.js} +0 -0
package/package.json
CHANGED
|
@@ -1,81 +1,75 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/common",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"description": "Opra common package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/panates/opra.git",
|
|
10
|
-
"directory": "packages/common"
|
|
11
|
-
},
|
|
12
|
-
"type": "module",
|
|
13
|
-
"module": "./esm/index.js",
|
|
14
|
-
"main": "./cjs/index.js",
|
|
15
|
-
"browser": "./browser.js",
|
|
16
|
-
"types": "./types/index.d.ts",
|
|
17
|
-
"scripts": {
|
|
18
|
-
"compile": "tsc",
|
|
19
|
-
"prebuild": "npm run check && npm run lint && npm run clean",
|
|
20
|
-
"build": "npm run build:cjs && npm run build:esm && npm run build:browser",
|
|
21
|
-
"build:cjs": "tsc -b tsconfig-build-cjs.json",
|
|
22
|
-
"build:esm": "tsc -b tsconfig-build-esm.json",
|
|
23
|
-
"build:browser": "node esbuild.mjs",
|
|
24
|
-
"postbuild": "cp package.json ../../LICENSE ../../build/common && cp ../../package.cjs.json ../../build/common/cjs/package.json",
|
|
25
|
-
"lint": "eslint . --max-warnings=0",
|
|
26
|
-
"lint:fix": "eslint . --max-warnings=0 --fix",
|
|
27
|
-
"format": "prettier . --write --log-level=warn",
|
|
28
|
-
"check": "madge --circular src/**",
|
|
29
|
-
"test": "jest --passWithNoTests",
|
|
30
|
-
"cover": "jest --passWithNoTests --collect-coverage",
|
|
31
|
-
"clean": "npm run clean:src && npm run clean:test && npm run clean:dist && npm run clean:cover",
|
|
32
|
-
"clean:src": "ts-cleanup -s src --all",
|
|
33
|
-
"clean:test": "ts-cleanup -s test --all",
|
|
34
|
-
"clean:dist": "rimraf ../../build/client",
|
|
35
|
-
"clean:cover": "rimraf ../../coverage/client",
|
|
36
|
-
"antlr4": "java -jar ./tools/antlr4-4.12.1-SNAPSHOT-complete.jar -Dlanguage=TypeScript ./src/filter/antlr/OpraFilter.g4 -visitor"
|
|
37
|
-
},
|
|
38
7
|
"dependencies": {
|
|
39
|
-
"@browsery/antlr4": "^4.13.
|
|
40
|
-
"@browsery/highland": "^2.13.
|
|
41
|
-
"@browsery/http-parser": "^0.5.
|
|
42
|
-
"@browsery/i18next": "^23.
|
|
43
|
-
"
|
|
8
|
+
"@browsery/antlr4": "^4.13.3-r1",
|
|
9
|
+
"@browsery/highland": "^2.13.6-r2",
|
|
10
|
+
"@browsery/http-parser": "^0.5.9-r1",
|
|
11
|
+
"@browsery/i18next": "^23.12.3-r1",
|
|
12
|
+
"@browsery/type-is": "^1.6.18-r5",
|
|
13
|
+
"fast-tokenizer": "^1.7.0",
|
|
44
14
|
"lodash.omit": "^4.5.0",
|
|
45
15
|
"putil-isplainobject": "^1.1.5",
|
|
46
|
-
"putil-merge": "^3.
|
|
16
|
+
"putil-merge": "^3.13.0",
|
|
47
17
|
"putil-promisify": "^1.10.1",
|
|
48
18
|
"putil-varhelpers": "^1.6.5",
|
|
49
19
|
"reflect-metadata": "^0.2.2",
|
|
20
|
+
"super-fast-md5": "^1.0.3",
|
|
21
|
+
"tslib": "^2.7.0",
|
|
50
22
|
"uid": "^2.0.1",
|
|
51
|
-
"valgen": "^5.
|
|
23
|
+
"valgen": "^5.9.0"
|
|
52
24
|
},
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
25
|
+
"type": "module",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"browser": {
|
|
29
|
+
"import": {
|
|
30
|
+
"types": "./types/index.d.ts",
|
|
31
|
+
"default": "./browser/index.mjs"
|
|
32
|
+
},
|
|
33
|
+
"require": {
|
|
34
|
+
"types": "./types/index.d.cts",
|
|
35
|
+
"default": "./browser/index.cjs"
|
|
36
|
+
},
|
|
37
|
+
"default": "./browser/index.mjs"
|
|
38
|
+
},
|
|
39
|
+
"import": {
|
|
40
|
+
"types": "./types/index.d.ts",
|
|
41
|
+
"default": "./esm/index.js"
|
|
42
|
+
},
|
|
43
|
+
"require": {
|
|
44
|
+
"types": "./types/index.d.cts",
|
|
45
|
+
"default": "./cjs/index.js"
|
|
46
|
+
},
|
|
47
|
+
"default": "./esm/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./package.json": "./package.json"
|
|
50
|
+
},
|
|
51
|
+
"main": "./cjs/index.js",
|
|
52
|
+
"module": "./esm/index.js",
|
|
53
|
+
"types": "./types/index.d.ts",
|
|
54
|
+
"repository": {
|
|
55
|
+
"type": "git",
|
|
56
|
+
"url": "https://github.com/panates/opra.git",
|
|
57
|
+
"directory": "packages/common"
|
|
62
58
|
},
|
|
63
59
|
"engines": {
|
|
64
60
|
"node": ">=16.0",
|
|
65
61
|
"npm": ">=7.0.0"
|
|
66
62
|
},
|
|
67
63
|
"files": [
|
|
68
|
-
"bin/",
|
|
69
64
|
"cjs/",
|
|
70
65
|
"esm/",
|
|
71
|
-
"
|
|
66
|
+
"browser/",
|
|
72
67
|
"types/",
|
|
73
68
|
"LICENSE",
|
|
74
|
-
"README.md"
|
|
75
|
-
"browser.js"
|
|
69
|
+
"README.md"
|
|
76
70
|
],
|
|
77
71
|
"keywords": [
|
|
78
72
|
"opra",
|
|
79
73
|
"common"
|
|
80
74
|
]
|
|
81
|
-
}
|
|
75
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Type } from 'ts-gems';
|
|
1
|
+
import type { Type } from 'ts-gems';
|
|
2
2
|
import { ResponsiveMap } from '../helpers/index.js';
|
|
3
3
|
import { OpraSchema } from '../schema/index.js';
|
|
4
4
|
import { DataTypeMap } from './common/data-type-map.js';
|
|
@@ -31,5 +31,6 @@ export declare class ApiDocument extends DocumentElement {
|
|
|
31
31
|
* Export as Opra schema definition object
|
|
32
32
|
*/
|
|
33
33
|
export(): OpraSchema.ApiDocument;
|
|
34
|
+
invalidate(): void;
|
|
34
35
|
protected _findDataType(nameOrCtor: string | Type | Function | EnumType.EnumArray | EnumType.EnumObject, visitedRefs?: WeakMap<ApiDocument, boolean>): DataType | undefined;
|
|
35
36
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OpraSchema } from '../../schema/index.js';
|
|
2
|
-
import type { ApiDocument } from '../api-document';
|
|
2
|
+
import type { ApiDocument } from '../api-document.js';
|
|
3
3
|
import { DocumentElement } from './document-element.js';
|
|
4
4
|
import type { DocumentInitContext } from './document-init-context';
|
|
5
5
|
export declare namespace ApiBase {
|
|
@@ -7,8 +7,8 @@ export declare namespace ApiBase {
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
export declare abstract class ApiBase extends DocumentElement {
|
|
10
|
-
readonly owner: ApiDocument | ApiBase;
|
|
11
10
|
abstract readonly protocol: OpraSchema.Protocol;
|
|
11
|
+
readonly owner: ApiDocument | ApiBase;
|
|
12
12
|
name: string;
|
|
13
13
|
description?: string;
|
|
14
14
|
protected constructor(owner: ApiDocument | ApiBase);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Type } from 'ts-gems';
|
|
1
|
+
import type { Type } from 'ts-gems';
|
|
2
2
|
import type { ApiDocument } from '../api-document.js';
|
|
3
3
|
import { kDataTypeMap } from '../constants.js';
|
|
4
|
-
import type { ComplexType } from '../data-type/complex-type';
|
|
5
|
-
import type { DataType } from '../data-type/data-type';
|
|
6
|
-
import type { EnumType } from '../data-type/enum-type';
|
|
7
|
-
import type { MappedType } from '../data-type/mapped-type';
|
|
8
|
-
import type { MixinType } from '../data-type/mixin-type';
|
|
9
|
-
import type { SimpleType } from '../data-type/simple-type';
|
|
4
|
+
import type { ComplexType } from '../data-type/complex-type.js';
|
|
5
|
+
import type { DataType } from '../data-type/data-type.js';
|
|
6
|
+
import type { EnumType } from '../data-type/enum-type.js';
|
|
7
|
+
import type { MappedType } from '../data-type/mapped-type.js';
|
|
8
|
+
import type { MixinType } from '../data-type/mixin-type.js';
|
|
9
|
+
import type { SimpleType } from '../data-type/simple-type.js';
|
|
10
10
|
import type { DataTypeMap } from './data-type-map.js';
|
|
11
|
-
import type { DocumentElement } from './document-element';
|
|
11
|
+
import type { DocumentElement } from './document-element.js';
|
|
12
12
|
/**
|
|
13
13
|
* @class DocumentNode
|
|
14
14
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Combine, StrictOmit, TypeThunkAsync } from 'ts-gems';
|
|
1
|
+
import type { Combine, StrictOmit, TypeThunkAsync } from 'ts-gems';
|
|
2
2
|
import type { OpraSchema } from '../../schema/index.js';
|
|
3
3
|
import { DataType } from '../data-type/data-type.js';
|
|
4
4
|
import type { EnumType } from '../data-type/enum-type.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Combine, TypeThunkAsync } from 'ts-gems';
|
|
1
|
+
import type { Combine, TypeThunkAsync } from 'ts-gems';
|
|
2
2
|
import { OpraSchema } from '../../schema/index.js';
|
|
3
3
|
import { DocumentElement } from '../common/document-element.js';
|
|
4
4
|
import { ApiFieldDecorator } from '../decorators/api-field-decorator.js';
|
|
@@ -14,6 +14,11 @@ export declare namespace ApiField {
|
|
|
14
14
|
interface Metadata extends Combine<{
|
|
15
15
|
type?: string | OpraSchema.DataType | TypeThunkAsync | EnumType.EnumObject | EnumType.EnumArray | object;
|
|
16
16
|
}, OpraSchema.Field> {
|
|
17
|
+
/**
|
|
18
|
+
* If set true, field will be available for server side only and
|
|
19
|
+
* will be removed while encoding to send to the client
|
|
20
|
+
*/
|
|
21
|
+
hidden?: boolean;
|
|
17
22
|
}
|
|
18
23
|
interface Options extends Partial<Metadata> {
|
|
19
24
|
}
|
|
@@ -62,6 +67,11 @@ declare class ApiFieldClass extends DocumentElement {
|
|
|
62
67
|
readonly readonly?: boolean;
|
|
63
68
|
readonly writeonly?: boolean;
|
|
64
69
|
readonly examples?: any[] | Record<string, any>;
|
|
70
|
+
/**
|
|
71
|
+
* If set true, field will be available for server side only and
|
|
72
|
+
* will be removed while encoding to send to the client
|
|
73
|
+
*/
|
|
74
|
+
readonly hidden?: boolean;
|
|
65
75
|
toJSON(): OpraSchema.Field;
|
|
66
76
|
}
|
|
67
77
|
export {};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { StrictOmit, Type } from 'ts-gems';
|
|
2
|
-
import { IsObject, Validator } from 'valgen';
|
|
1
|
+
import { type StrictOmit, type Type } from 'ts-gems';
|
|
2
|
+
import { type IsObject, type Validator } from 'valgen';
|
|
3
3
|
import { FieldsProjection, ResponsiveMap } from '../../helpers/index.js';
|
|
4
4
|
import { OpraSchema } from '../../schema/index.js';
|
|
5
5
|
import type { DocumentElement } from '../common/document-element.js';
|
|
6
6
|
import { DocumentInitContext } from '../common/document-init-context.js';
|
|
7
|
-
import type { ApiField } from './api-field';
|
|
8
|
-
import type { ComplexType } from './complex-type';
|
|
7
|
+
import type { ApiField } from './api-field.js';
|
|
8
|
+
import type { ComplexType } from './complex-type.js';
|
|
9
9
|
import { DataType } from './data-type.js';
|
|
10
|
-
import Field = OpraSchema.Field;
|
|
11
10
|
export declare const FIELD_PATH_PATTERN: RegExp;
|
|
12
11
|
/**
|
|
13
12
|
* Type definition of class constructor for ComplexTypeBase
|
|
@@ -43,7 +42,7 @@ declare abstract class ComplexTypeBaseClass extends DataType {
|
|
|
43
42
|
readonly ctor?: Type;
|
|
44
43
|
readonly fields: ResponsiveMap<ApiField>;
|
|
45
44
|
readonly additionalFields?: boolean | DataType | ['error'] | ['error', string];
|
|
46
|
-
readonly keyField?: Field.Name;
|
|
45
|
+
readonly keyField?: OpraSchema.Field.Name;
|
|
47
46
|
/**
|
|
48
47
|
*
|
|
49
48
|
*/
|
|
@@ -74,7 +73,7 @@ declare abstract class ComplexTypeBaseClass extends DataType {
|
|
|
74
73
|
}): IsObject.Schema;
|
|
75
74
|
protected _generateFieldCodec(codec: 'encode' | 'decode', field: ApiField, context: StrictOmit<DataType.GenerateCodecOptions, 'projection'> & {
|
|
76
75
|
currentPath: string;
|
|
77
|
-
projection?: FieldsProjection;
|
|
76
|
+
projection?: FieldsProjection | '*';
|
|
78
77
|
}): Validator;
|
|
79
78
|
}
|
|
80
79
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { Combine, Type, TypeThunkAsync } from 'ts-gems';
|
|
2
|
+
import type { Combine, Type, TypeThunkAsync } from 'ts-gems';
|
|
3
3
|
import { OpraSchema } from '../../schema/index.js';
|
|
4
4
|
import type { DocumentElement } from '../common/document-element.js';
|
|
5
5
|
import { DocumentInitContext } from '../common/document-init-context.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StrictOmit, Type } from 'ts-gems';
|
|
2
|
-
import { ValidationOptions, Validator } from 'valgen';
|
|
1
|
+
import { type StrictOmit, type Type } from 'ts-gems';
|
|
2
|
+
import type { ValidationOptions, Validator } from 'valgen';
|
|
3
3
|
import { FieldsProjection } from '../../helpers/index.js';
|
|
4
4
|
import type { DataTypeBase } from '../../schema/data-type/data-type.interface.js';
|
|
5
5
|
import { OpraSchema } from '../../schema/index.js';
|
|
@@ -25,6 +25,7 @@ export declare namespace DataType {
|
|
|
25
25
|
projection?: string[] | FieldsProjection | '*';
|
|
26
26
|
ignoreReadonlyFields?: boolean;
|
|
27
27
|
ignoreWriteonlyFields?: boolean;
|
|
28
|
+
ignoreHiddenFields?: boolean;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
interface DataTypeStatic {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { Combine, Type } from 'ts-gems';
|
|
3
|
-
import { Validator } from 'valgen';
|
|
2
|
+
import { type Combine, type Type } from 'ts-gems';
|
|
3
|
+
import { type Validator } from 'valgen';
|
|
4
4
|
import { OpraSchema } from '../../schema/index.js';
|
|
5
5
|
import type { DocumentElement } from '../common/document-element.js';
|
|
6
6
|
import { DataType } from './data-type.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Type } from 'ts-gems';
|
|
2
|
-
import { Validator } from 'valgen';
|
|
1
|
+
import type { Type } from 'ts-gems';
|
|
2
|
+
import { type Validator } from 'valgen';
|
|
3
3
|
import { DocumentElement } from '../../common/document-element.js';
|
|
4
4
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
5
5
|
export declare class FieldPathType {
|
|
@@ -9,7 +9,7 @@ export declare class FieldPathType {
|
|
|
9
9
|
[DECODER](properties: Partial<this>, element: DocumentElement): Validator;
|
|
10
10
|
[ENCODER](properties: Partial<this>, element: DocumentElement): Validator;
|
|
11
11
|
toJSON(properties: Partial<FieldPathType>, element: DocumentElement): {
|
|
12
|
-
dataType: string | import("../../../schema/
|
|
12
|
+
dataType: string | import("../../../schema/opra-schema.js").ComplexType;
|
|
13
13
|
allowSigns: "first" | "each" | undefined;
|
|
14
14
|
};
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Type } from 'ts-gems';
|
|
2
|
-
import { Validator } from 'valgen';
|
|
1
|
+
import type { Type } from 'ts-gems';
|
|
2
|
+
import { type Validator } from 'valgen';
|
|
3
3
|
import { FilterRules } from '../../../filter/filter-rules.js';
|
|
4
4
|
import type { DocumentElement } from '../../common/document-element.js';
|
|
5
5
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
@@ -10,7 +10,7 @@ export declare class FilterType {
|
|
|
10
10
|
protected [DECODER](properties: Partial<this>, element: DocumentElement): Validator;
|
|
11
11
|
protected [ENCODER](): Validator;
|
|
12
12
|
toJSON(properties: Partial<FilterType>, element: DocumentElement): {
|
|
13
|
-
dataType: string | import("../../../schema/
|
|
13
|
+
dataType: string | import("../../../schema/opra-schema.js").ComplexType;
|
|
14
14
|
rules: Record<string, FilterRules.Rule> | undefined;
|
|
15
15
|
};
|
|
16
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DeepPartial, Type } from 'ts-gems';
|
|
2
|
-
import { ErrorIssue } from '../../../exception/index.js';
|
|
1
|
+
import type { DeepPartial, Type } from 'ts-gems';
|
|
2
|
+
import type { ErrorIssue } from '../../../exception/index.js';
|
|
3
3
|
export declare class OperationResult<TPayload = any> {
|
|
4
4
|
constructor(init?: DeepPartial<OperationResult>);
|
|
5
5
|
affected?: number;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { Combine, Type } from 'ts-gems';
|
|
3
|
-
import type { Field } from '../../schema/data-type/field.interface';
|
|
2
|
+
import { type Combine, type Type } from 'ts-gems';
|
|
3
|
+
import type { Field } from '../../schema/data-type/field.interface.js';
|
|
4
4
|
import { OpraSchema } from '../../schema/index.js';
|
|
5
5
|
import { DocumentElement } from '../common/document-element.js';
|
|
6
6
|
import type { ComplexType } from './complex-type.js';
|
|
7
7
|
import { ComplexTypeBase } from './complex-type-base.js';
|
|
8
8
|
import { DataType } from './data-type.js';
|
|
9
|
-
import type { MixinType } from './mixin-type';
|
|
9
|
+
import type { MixinType } from './mixin-type.js';
|
|
10
10
|
/**
|
|
11
11
|
* @namespace MappedType
|
|
12
12
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { Class, Combine, Type } from 'ts-gems';
|
|
2
|
+
import type { Class, Combine, Type } from 'ts-gems';
|
|
3
3
|
import { OpraSchema } from '../../schema/index.js';
|
|
4
4
|
import type { DocumentElement } from '../common/document-element.js';
|
|
5
5
|
import type { ComplexType } from './complex-type.js';
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { Class, Type } from 'ts-gems';
|
|
1
|
+
import type { Class, Type } from 'ts-gems';
|
|
2
2
|
import type { DataType } from './data-type.js';
|
|
3
|
-
/**
|
|
4
|
-
* Create a new MappedType that omits given fields from base type
|
|
5
|
-
* @param baseType
|
|
6
|
-
* @param keys
|
|
7
|
-
* @param options
|
|
8
|
-
*/
|
|
9
3
|
export declare function OmitType(baseType: string | Type, keys: string[], options?: DataType.Options): Type;
|
|
10
4
|
/**
|
|
11
5
|
* Create a new MappedType that omits given fields from base type
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import { Class, PartialSome, Type } from 'ts-gems';
|
|
1
|
+
import type { Class, PartialSome, Type } from 'ts-gems';
|
|
2
2
|
import type { DataType } from './data-type.js';
|
|
3
|
-
/**
|
|
4
|
-
* Create a new MappedType that marks given or all fields as optional
|
|
5
|
-
* @param baseType
|
|
6
|
-
* @param keys
|
|
7
|
-
* @param options
|
|
8
|
-
*/
|
|
9
3
|
export declare function PartialType(baseType: string | Type, keys: string[], options?: DataType.Options): Type;
|
|
10
4
|
/**
|
|
11
5
|
* Create a new MappedType that marks given or all fields as optional
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Class, Type } from 'ts-gems';
|
|
1
|
+
import type { Class, Type } from 'ts-gems';
|
|
2
2
|
import type { DataType } from './data-type.js';
|
|
3
3
|
/**
|
|
4
4
|
* Create a new MappedType that picks given fields from base type
|
|
@@ -6,11 +6,11 @@ import type { DataType } from './data-type.js';
|
|
|
6
6
|
* @param keys
|
|
7
7
|
* @param options
|
|
8
8
|
*/
|
|
9
|
-
export declare function PickType(baseType:
|
|
9
|
+
export declare function PickType<Args extends any[], Instance, Static, K extends keyof Instance>(baseType: Class<Args, Instance, Static>, keys: readonly K[], options?: DataType.Options): Class<Args, Pick<Instance, K>> & Omit<Pick<Static, keyof typeof baseType>, 'prototype' | 'constructor'>;
|
|
10
10
|
/**
|
|
11
11
|
* Create a new MappedType that picks given fields from base type
|
|
12
12
|
* @param baseType
|
|
13
13
|
* @param keys
|
|
14
14
|
* @param options
|
|
15
15
|
*/
|
|
16
|
-
export declare function PickType
|
|
16
|
+
export declare function PickType(baseType: string | Type, keys: string[], options?: DataType.Options): Type;
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import { Class, RequiredSome, Type } from 'ts-gems';
|
|
1
|
+
import type { Class, RequiredSome, Type } from 'ts-gems';
|
|
2
2
|
import type { DataType } from './data-type.js';
|
|
3
|
-
/**
|
|
4
|
-
* Create a new MappedType that marks given or all fields as required
|
|
5
|
-
* @param baseType
|
|
6
|
-
* @param keys
|
|
7
|
-
* @param options
|
|
8
|
-
*/
|
|
9
|
-
export declare function RequiredType(baseType: string | Type, keys?: string[] | true, options?: DataType.Options): Type;
|
|
10
3
|
/**
|
|
11
4
|
* Create a new MappedType that marks given fields as baseType
|
|
12
5
|
* @param baseType
|
|
@@ -20,3 +13,10 @@ export declare function RequiredType<Args extends any[], Instance, Static, K ext
|
|
|
20
13
|
* @param options
|
|
21
14
|
*/
|
|
22
15
|
export declare function RequiredType<Args extends any[], Instance, Static>(baseType: Class<Args, Instance, Static>, options?: DataType.Options): Class<Args, Required<Instance>> & Omit<Pick<Static, keyof typeof baseType>, 'prototype' | 'constructor'>;
|
|
16
|
+
/**
|
|
17
|
+
* Create a new MappedType that marks given or all fields as required
|
|
18
|
+
* @param baseType
|
|
19
|
+
* @param keys
|
|
20
|
+
* @param options
|
|
21
|
+
*/
|
|
22
|
+
export declare function RequiredType(baseType: string | Type, keys?: string[] | true, options?: DataType.Options): Type;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { Combine, Type } from 'ts-gems';
|
|
3
|
-
import { Validator } from 'valgen';
|
|
2
|
+
import type { Combine, Type } from 'ts-gems';
|
|
3
|
+
import { type Validator } from 'valgen';
|
|
4
4
|
import { OpraSchema } from '../../schema/index.js';
|
|
5
5
|
import type { DocumentElement } from '../common/document-element';
|
|
6
6
|
import { DocumentInitContext } from '../common/document-init-context.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Type } from 'ts-gems';
|
|
2
|
-
import type { DataType } from '../data-type';
|
|
1
|
+
import type { Type } from 'ts-gems';
|
|
2
|
+
import type { DataType } from '../data-type.js';
|
|
3
3
|
export declare function createMappedClass(source: string | Type, config: any, options?: DataType.Options): any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { StrictOmit, Type, TypeThunkAsync } from 'ts-gems';
|
|
2
|
-
import type { HttpController } from '../http/http-controller';
|
|
3
|
-
import type { HttpParameter } from '../http/http-parameter';
|
|
1
|
+
import type { StrictOmit, Type, TypeThunkAsync } from 'ts-gems';
|
|
2
|
+
import type { HttpController } from '../http/http-controller.js';
|
|
3
|
+
import type { HttpParameter } from '../http/http-parameter.js';
|
|
4
4
|
export interface HttpControllerDecorator<T extends HttpControllerDecorator<any> = HttpControllerDecorator<any>> extends ClassDecorator {
|
|
5
5
|
Cookie(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | Type | false): T;
|
|
6
6
|
Header(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync | false): T;
|