@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.
Files changed (199) hide show
  1. package/browser/index.cjs +12 -0
  2. package/browser/index.mjs +12 -0
  3. package/cjs/document/api-document.js +11 -0
  4. package/cjs/document/common/api-base.js +1 -1
  5. package/cjs/document/common/document-element.js +2 -0
  6. package/cjs/document/data-type/api-field.js +8 -7
  7. package/cjs/document/data-type/complex-type-base.js +5 -3
  8. package/cjs/document/data-type/extended-types/date-string.type.js +2 -2
  9. package/cjs/document/data-type/extended-types/date-time-string.type.js +2 -2
  10. package/cjs/document/data-type/extended-types/date-time.type.js +2 -2
  11. package/cjs/document/data-type/extended-types/date.type.js +2 -2
  12. package/cjs/document/data-type/extended-types/email.type.js +2 -2
  13. package/cjs/document/data-type/extended-types/filter.type.js +1 -1
  14. package/cjs/document/data-type/extended-types/time.type.js +2 -2
  15. package/cjs/document/data-type/extended-types/url.type.js +2 -2
  16. package/cjs/document/data-type/omit-type.js +7 -2
  17. package/cjs/document/data-type/partial-type.js +7 -2
  18. package/cjs/document/data-type/pick-type.js +1 -2
  19. package/cjs/document/data-type/primitive-types/object.type.js +0 -3
  20. package/cjs/document/data-type/required-type.js +1 -2
  21. package/cjs/document/data-type/simple-type.js +1 -6
  22. package/cjs/document/data-type/utils/create-mapped-class.js +1 -2
  23. package/cjs/document/data-type/utils/get-is-inherited-predicate-fn.js +1 -2
  24. package/cjs/document/decorators/api-field-decorator.js +4 -6
  25. package/cjs/document/decorators/complex-type.decorator.js +1 -2
  26. package/cjs/document/decorators/http-controller.decorator.js +2 -3
  27. package/cjs/document/decorators/http-operation-entity.decorator.js +68 -74
  28. package/cjs/document/decorators/http-operation.decorator.js +4 -2
  29. package/cjs/document/decorators/simple-type.decorator.js +2 -3
  30. package/cjs/document/factory/api-document.factory.js +17 -8
  31. package/cjs/document/http/http-api.js +0 -1
  32. package/cjs/document/http/http-controller.js +4 -2
  33. package/cjs/document/http/http-media-type.js +17 -2
  34. package/cjs/document/http/http-multipart-field.js +0 -1
  35. package/cjs/document/http/http-operation-response.js +0 -1
  36. package/cjs/document/http/http-operation.js +12 -1
  37. package/cjs/document/http/http-parameter.js +2 -0
  38. package/cjs/document/http/http-request-body.js +0 -1
  39. package/cjs/document/http/http-status-range.js +5 -2
  40. package/cjs/document/utils/parse-regexp.util.js +1 -2
  41. package/cjs/document/utils/string-compare.util.js +1 -2
  42. package/cjs/exception/opra-exception.js +1 -0
  43. package/cjs/filter/build.js +21 -22
  44. package/cjs/filter/filter-rules.js +17 -16
  45. package/cjs/filter/parse.js +1 -2
  46. package/cjs/filter/utils.js +2 -3
  47. package/cjs/helpers/function-utils.js +1 -2
  48. package/cjs/helpers/get-stack-filename.js +2 -3
  49. package/cjs/helpers/index.js +1 -0
  50. package/cjs/helpers/mixin-utils.js +2 -3
  51. package/cjs/helpers/object-utils.js +5 -6
  52. package/cjs/helpers/parse-fields-projection.js +3 -3
  53. package/cjs/helpers/safe-json-stringify.js +16 -0
  54. package/cjs/helpers/type-guards.js +10 -11
  55. package/cjs/i18n/string-utils.js +2 -3
  56. package/cjs/i18n/translate.js +1 -2
  57. package/cjs/schema/index.js +2 -27
  58. package/cjs/schema/opra-schema.js +24 -0
  59. package/cjs/schema/type-guards.js +7 -8
  60. package/esm/document/api-document.js +11 -0
  61. package/esm/document/common/api-base.js +1 -1
  62. package/esm/document/common/document-element.js +2 -0
  63. package/esm/document/data-type/api-field.js +8 -7
  64. package/esm/document/data-type/complex-type-base.js +5 -3
  65. package/esm/document/data-type/extended-types/date-string.type.js +2 -2
  66. package/esm/document/data-type/extended-types/date-time-string.type.js +2 -2
  67. package/esm/document/data-type/extended-types/date-time.type.js +2 -2
  68. package/esm/document/data-type/extended-types/date.type.js +2 -2
  69. package/esm/document/data-type/extended-types/email.type.js +2 -2
  70. package/esm/document/data-type/extended-types/filter.type.js +1 -1
  71. package/esm/document/data-type/extended-types/time.type.js +2 -2
  72. package/esm/document/data-type/extended-types/url.type.js +2 -2
  73. package/esm/document/data-type/omit-type.js +6 -0
  74. package/esm/document/data-type/partial-type.js +6 -0
  75. package/esm/document/data-type/primitive-types/object.type.js +0 -3
  76. package/esm/document/data-type/simple-type.js +1 -6
  77. package/esm/document/decorators/api-field-decorator.js +1 -2
  78. package/esm/document/decorators/http-controller.decorator.js +1 -1
  79. package/esm/document/decorators/http-operation-entity.decorator.js +25 -31
  80. package/esm/document/decorators/http-operation.decorator.js +3 -0
  81. package/esm/document/factory/api-document.factory.js +17 -7
  82. package/esm/document/http/http-api.js +0 -1
  83. package/esm/document/http/http-controller.js +3 -2
  84. package/esm/document/http/http-media-type.js +16 -2
  85. package/esm/document/http/http-multipart-field.js +0 -1
  86. package/esm/document/http/http-operation-response.js +0 -1
  87. package/esm/document/http/http-operation.js +12 -1
  88. package/esm/document/http/http-parameter.js +2 -0
  89. package/esm/document/http/http-request-body.js +0 -1
  90. package/esm/document/http/http-status-range.js +5 -2
  91. package/esm/exception/opra-exception.js +1 -0
  92. package/esm/filter/filter-rules.js +10 -9
  93. package/esm/helpers/index.js +1 -0
  94. package/esm/helpers/object-utils.js +2 -2
  95. package/esm/helpers/safe-json-stringify.js +13 -0
  96. package/esm/package.json +3 -0
  97. package/esm/schema/index.js +2 -27
  98. package/esm/schema/opra-schema.js +21 -0
  99. package/package.json +47 -53
  100. package/types/document/api-document.d.ts +2 -1
  101. package/types/document/common/api-base.d.ts +2 -2
  102. package/types/document/common/data-type-map.d.ts +1 -1
  103. package/types/document/common/document-element.d.ts +1 -0
  104. package/types/document/common/document-node.d.ts +8 -8
  105. package/types/document/common/value.d.ts +1 -1
  106. package/types/document/data-type/api-field.d.ts +11 -1
  107. package/types/document/data-type/complex-type-base.d.ts +6 -7
  108. package/types/document/data-type/complex-type.d.ts +1 -1
  109. package/types/document/data-type/data-type.d.ts +3 -2
  110. package/types/document/data-type/enum-type.d.ts +2 -2
  111. package/types/document/data-type/extended-types/base64.type.d.ts +1 -1
  112. package/types/document/data-type/extended-types/date-string.type.d.ts +1 -1
  113. package/types/document/data-type/extended-types/date-time-string.type.d.ts +1 -1
  114. package/types/document/data-type/extended-types/date-time.type.d.ts +1 -1
  115. package/types/document/data-type/extended-types/date.type.d.ts +1 -1
  116. package/types/document/data-type/extended-types/email.type.d.ts +1 -1
  117. package/types/document/data-type/extended-types/field-path.type.d.ts +3 -3
  118. package/types/document/data-type/extended-types/filter.type.d.ts +3 -3
  119. package/types/document/data-type/extended-types/object-id.type.d.ts +1 -1
  120. package/types/document/data-type/extended-types/operation-result.type.d.ts +2 -2
  121. package/types/document/data-type/extended-types/time.type.d.ts +1 -1
  122. package/types/document/data-type/extended-types/url.type.d.ts +1 -1
  123. package/types/document/data-type/extended-types/uuid.type.d.ts +1 -1
  124. package/types/document/data-type/mapped-type.d.ts +3 -3
  125. package/types/document/data-type/mixin-type.d.ts +1 -1
  126. package/types/document/data-type/omit-type.d.ts +1 -7
  127. package/types/document/data-type/partial-type.d.ts +1 -7
  128. package/types/document/data-type/pick-type.d.ts +3 -3
  129. package/types/document/data-type/primitive-types/any.type.d.ts +1 -1
  130. package/types/document/data-type/primitive-types/bigint.type.d.ts +1 -1
  131. package/types/document/data-type/primitive-types/boolean.type.d.ts +1 -1
  132. package/types/document/data-type/primitive-types/integer.type.d.ts +1 -1
  133. package/types/document/data-type/primitive-types/null.type.d.ts +1 -1
  134. package/types/document/data-type/primitive-types/number.type.d.ts +1 -1
  135. package/types/document/data-type/primitive-types/string.type.d.ts +1 -1
  136. package/types/document/data-type/required-type.d.ts +8 -8
  137. package/types/document/data-type/simple-type.d.ts +2 -2
  138. package/types/document/data-type/utils/create-mapped-class.d.ts +2 -2
  139. package/types/document/decorators/api-field-decorator.d.ts +1 -1
  140. package/types/document/decorators/http-controller.decorator.d.ts +3 -3
  141. package/types/document/decorators/http-operation-entity.decorator.d.ts +5 -4
  142. package/types/document/decorators/http-operation.decorator.d.ts +1 -1
  143. package/types/document/factory/api-document.factory.d.ts +2 -1
  144. package/types/document/factory/data-type.factory.d.ts +1 -1
  145. package/types/document/factory/http-api.factory.d.ts +1 -1
  146. package/types/document/http/http-api.d.ts +2 -2
  147. package/types/document/http/http-controller.d.ts +1 -1
  148. package/types/document/http/http-media-type.d.ts +3 -2
  149. package/types/document/http/http-multipart-field.d.ts +1 -2
  150. package/types/document/http/http-operation-response.d.ts +1 -1
  151. package/types/document/http/http-operation.d.ts +6 -5
  152. package/types/document/http/http-parameter.d.ts +2 -2
  153. package/types/document/http/http-request-body.d.ts +1 -1
  154. package/types/document/http/http-status-range.d.ts +2 -1
  155. package/types/exception/http-errors/bad-request.error.d.ts +1 -1
  156. package/types/exception/http-errors/conflict.error.d.ts +1 -1
  157. package/types/exception/http-errors/failed-dependency.error.d.ts +1 -1
  158. package/types/exception/http-errors/forbidden.error.d.ts +1 -1
  159. package/types/exception/http-errors/internal-server.error.d.ts +1 -1
  160. package/types/exception/http-errors/method-not-allowed.error.d.ts +1 -1
  161. package/types/exception/http-errors/not-acceptable.error.d.ts +1 -1
  162. package/types/exception/http-errors/not-found.error.d.ts +1 -1
  163. package/types/exception/http-errors/permission.error.d.ts +1 -1
  164. package/types/exception/http-errors/unauthorized.error.d.ts +1 -1
  165. package/types/exception/http-errors/unprocessable-entity.error.d.ts +1 -1
  166. package/types/exception/opra-exception.d.ts +1 -1
  167. package/types/exception/opra-http-error.d.ts +1 -1
  168. package/types/filter/antlr/OpraFilterParser.d.ts +1 -1
  169. package/types/filter/ast/expressions/comparison-expression.d.ts +1 -1
  170. package/types/filter/errors.d.ts +3 -4
  171. package/types/filter/filter-rules.d.ts +5 -5
  172. package/types/filter/opra-error-listener.d.ts +1 -2
  173. package/types/helpers/function-utils.d.ts +1 -1
  174. package/types/helpers/index.d.ts +1 -0
  175. package/types/helpers/mixin-utils.d.ts +1 -1
  176. package/types/helpers/object-utils.d.ts +1 -1
  177. package/types/helpers/safe-json-stringify.d.ts +1 -0
  178. package/types/helpers/type-guards.d.ts +1 -3
  179. package/types/i18n/i18n.d.ts +2 -2
  180. package/types/i18n/translate.d.ts +1 -1
  181. package/types/index.d.cts +9 -0
  182. package/types/schema/{document.interface.d.ts → api-document.interface.d.ts} +4 -4
  183. package/types/schema/data-type/complex-type.interface.d.ts +1 -1
  184. package/types/schema/data-type/data-type.interface.d.ts +1 -1
  185. package/types/schema/data-type/enum-type.interface.d.ts +1 -1
  186. package/types/schema/data-type/mapped-type.interface.d.ts +3 -3
  187. package/types/schema/data-type/mixin-type.interface.d.ts +1 -1
  188. package/types/schema/data-type-container.interface.d.ts +1 -1
  189. package/types/schema/http/http-controller.interface.d.ts +2 -2
  190. package/types/schema/http/http-media-type.interface.d.ts +1 -1
  191. package/types/schema/http/http-operation-response.interface.d.ts +2 -2
  192. package/types/schema/http/http-operation.interface.d.ts +8 -4
  193. package/types/schema/http/http-parameter.interface.d.ts +2 -2
  194. package/types/schema/index.d.ts +2 -62
  195. package/types/schema/opra-schema.d.ts +21 -0
  196. package/types/schema/type-guards.d.ts +1 -1
  197. package/browser.js +0 -13393
  198. /package/cjs/schema/{document.interface.js → api-document.interface.js} +0 -0
  199. /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-alpha.9",
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.1-patch-1",
40
- "@browsery/highland": "^2.13.5",
41
- "@browsery/http-parser": "^0.5.8",
42
- "@browsery/i18next": "^23.11.5",
43
- "fast-tokenizer": "^1.3.0",
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.12.1",
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.4.1"
23
+ "valgen": "^5.9.0"
52
24
  },
53
- "devDependencies": {
54
- "@browsery/fs": "^0.4.0",
55
- "@browsery/stream": "^4.3.0",
56
- "@browsery/util": "^0.12.5",
57
- "@types/encodeurl": "^1.0.2",
58
- "@types/lodash.omit": "^4.5.9",
59
- "@types/validator": "^13.12.0",
60
- "path-browserify": "^1.0.1",
61
- "ts-gems": "^3.4.0"
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
- "umd/",
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,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 { DataType } from '../data-type/data-type.js';
4
4
  declare const kMap: unique symbol;
@@ -17,6 +17,7 @@ export declare const DocumentElement: DocumentElementConstructor;
17
17
  * @class DocumentElement
18
18
  */
19
19
  declare abstract class DocumentElementClass {
20
+ readonly id: string;
20
21
  readonly owner?: DocumentElement;
21
22
  readonly node: DocumentNode;
22
23
  }
@@ -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,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class Base64Type {
4
4
  constructor(attributes?: Partial<Base64Type>);
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class DateStringType {
4
4
  constructor(attributes?: Partial<DateStringType>);
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class DateTimeStringType {
4
4
  constructor(attributes?: Partial<DateTimeStringType>);
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class DateTimeType {
4
4
  constructor(attributes?: Partial<DateTimeType>);
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class DateType {
4
4
  constructor(attributes?: Partial<DateType>);
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class EmailType {
4
4
  constructor(attributes?: Partial<EmailType>);
@@ -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/data-type/complex-type.interface.js").ComplexType;
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/data-type/complex-type.interface.js").ComplexType;
13
+ dataType: string | import("../../../schema/opra-schema.js").ComplexType;
14
14
  rules: Record<string, FilterRules.Rule> | undefined;
15
15
  };
16
16
  }
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class ObjectIdType {
4
4
  constructor(attributes?: Partial<ObjectIdType>);
@@ -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,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class TimeType {
4
4
  constructor(attributes?: Partial<TimeType>);
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class UrlType {
4
4
  constructor(attributes?: Partial<UrlType>);
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class UuidType {
4
4
  constructor(attributes?: Partial<UuidType>);
@@ -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: string | Type, keys: string[], options?: DataType.Options): Type;
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<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'>;
16
+ export declare function PickType(baseType: string | Type, keys: string[], options?: DataType.Options): Type;
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class AnyType {
4
4
  constructor(properties?: Partial<AnyType>);
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  import { NumberType } from './number.type.js';
4
4
  export declare class BigintType extends NumberType {
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class BooleanType {
4
4
  constructor(properties?: Partial<BooleanType>);
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  import { NumberType } from './number.type.js';
4
4
  export declare class IntegerType extends NumberType {
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class NullType {
4
4
  constructor(properties?: Partial<NullType>);
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class NumberType {
4
4
  constructor(properties?: Partial<NumberType>);
@@ -1,4 +1,4 @@
1
- import { Validator } from 'valgen';
1
+ import { type Validator } from 'valgen';
2
2
  import { DECODER, ENCODER } from '../../constants.js';
3
3
  export declare class StringType {
4
4
  constructor(properties?: Partial<StringType>);
@@ -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,4 +1,4 @@
1
- import type { ApiField } from '../data-type/api-field';
1
+ import type { ApiField } from '../data-type/api-field.js';
2
2
  export interface ApiFieldDecorator {
3
3
  (options?: ApiField.Options): PropertyDecorator;
4
4
  }
@@ -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;