@opra/common 1.0.0-alpha.3 → 1.0.0-alpha.31

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 (187) hide show
  1. package/browser.js +6035 -5791
  2. package/cjs/document/api-document.js +11 -0
  3. package/cjs/document/common/api-base.js +1 -1
  4. package/cjs/document/common/document-element.js +4 -1
  5. package/cjs/document/data-type/api-field.js +12 -6
  6. package/cjs/document/data-type/complex-type-base.js +10 -3
  7. package/cjs/document/data-type/complex-type.js +6 -2
  8. package/cjs/document/data-type/data-type.js +2 -1
  9. package/cjs/document/data-type/enum-type.js +5 -2
  10. package/cjs/document/data-type/extended-types/base64.type.js +4 -0
  11. package/cjs/document/data-type/extended-types/date-string.type.js +6 -2
  12. package/cjs/document/data-type/extended-types/date-time-string.type.js +6 -2
  13. package/cjs/document/data-type/extended-types/date-time.type.js +6 -2
  14. package/cjs/document/data-type/extended-types/date.type.js +6 -2
  15. package/cjs/document/data-type/extended-types/email.type.js +6 -2
  16. package/cjs/document/data-type/extended-types/field-path.type.js +5 -3
  17. package/cjs/document/data-type/extended-types/filter.type.js +19 -17
  18. package/cjs/document/data-type/extended-types/object-id.type.js +4 -0
  19. package/cjs/document/data-type/extended-types/time.type.js +6 -2
  20. package/cjs/document/data-type/extended-types/url.type.js +6 -2
  21. package/cjs/document/data-type/extended-types/uuid.type.js +4 -0
  22. package/cjs/document/data-type/mapped-type.js +12 -5
  23. package/cjs/document/data-type/mixin-type.js +5 -1
  24. package/cjs/document/data-type/omit-type.js +7 -2
  25. package/cjs/document/data-type/partial-type.js +7 -2
  26. package/cjs/document/data-type/pick-type.js +1 -2
  27. package/cjs/document/data-type/primitive-types/bigint.type.js +4 -0
  28. package/cjs/document/data-type/primitive-types/boolean.type.js +4 -0
  29. package/cjs/document/data-type/primitive-types/integer.type.js +4 -0
  30. package/cjs/document/data-type/primitive-types/null.type.js +4 -0
  31. package/cjs/document/data-type/primitive-types/number.type.js +4 -0
  32. package/cjs/document/data-type/primitive-types/object.type.js +0 -3
  33. package/cjs/document/data-type/primitive-types/string.type.js +4 -0
  34. package/cjs/document/data-type/required-type.js +1 -2
  35. package/cjs/document/data-type/simple-type.js +17 -16
  36. package/cjs/document/data-type/utils/create-mapped-class.js +3 -3
  37. package/cjs/document/data-type/utils/get-is-inherited-predicate-fn.js +1 -2
  38. package/cjs/document/decorators/api-field-decorator.js +4 -6
  39. package/cjs/document/decorators/complex-type.decorator.js +1 -2
  40. package/cjs/document/decorators/http-controller.decorator.js +26 -2
  41. package/cjs/document/decorators/http-operation-entity.decorator.js +123 -93
  42. package/cjs/document/decorators/http-operation.decorator.js +12 -6
  43. package/cjs/document/decorators/simple-type.decorator.js +2 -3
  44. package/cjs/document/factory/api-document.factory.js +14 -11
  45. package/cjs/document/factory/data-type.factory.js +97 -56
  46. package/cjs/document/factory/http-api.factory.js +3 -1
  47. package/cjs/document/http/http-api.js +2 -3
  48. package/cjs/document/http/http-controller.js +26 -14
  49. package/cjs/document/http/http-media-type.js +21 -4
  50. package/cjs/document/http/http-operation-response.js +2 -2
  51. package/cjs/document/http/http-operation.js +28 -4
  52. package/cjs/document/http/http-parameter.js +4 -0
  53. package/cjs/document/http/http-request-body.js +0 -1
  54. package/cjs/document/http/http-status-range.js +6 -4
  55. package/cjs/document/index.js +5 -5
  56. package/cjs/document/utils/parse-regexp.util.js +1 -2
  57. package/cjs/document/utils/string-compare.util.js +1 -2
  58. package/cjs/exception/index.js +5 -5
  59. package/cjs/exception/opra-exception.js +1 -0
  60. package/cjs/filter/antlr/OpraFilterParser.js +28 -82
  61. package/cjs/filter/ast/index.js +1 -1
  62. package/cjs/filter/build.js +22 -25
  63. package/cjs/filter/filter-rules.js +4 -2
  64. package/cjs/filter/opra-filter.ns.js +2 -2
  65. package/cjs/filter/parse.js +2 -5
  66. package/cjs/filter/utils.js +2 -3
  67. package/cjs/helpers/function-utils.js +1 -2
  68. package/cjs/helpers/get-stack-filename.js +2 -3
  69. package/cjs/helpers/mixin-utils.js +4 -4
  70. package/cjs/helpers/monkey-patches.js +4 -2
  71. package/cjs/helpers/object-utils.js +5 -6
  72. package/cjs/helpers/parse-fields-projection.js +4 -6
  73. package/cjs/helpers/responsive-map.js +5 -4
  74. package/cjs/helpers/type-guards.js +10 -11
  75. package/cjs/i18n/i18n.js +4 -3
  76. package/cjs/i18n/index.js +1 -1
  77. package/cjs/i18n/string-utils.js +2 -3
  78. package/cjs/i18n/translate.js +1 -2
  79. package/cjs/index.js +1 -1
  80. package/cjs/schema/type-guards.js +7 -8
  81. package/esm/document/api-document.js +11 -0
  82. package/esm/document/common/api-base.js +1 -1
  83. package/esm/document/common/document-element.js +4 -1
  84. package/esm/document/data-type/api-field.js +12 -6
  85. package/esm/document/data-type/complex-type-base.js +10 -3
  86. package/esm/document/data-type/complex-type.js +6 -2
  87. package/esm/document/data-type/data-type.js +2 -1
  88. package/esm/document/data-type/enum-type.js +5 -2
  89. package/esm/document/data-type/extended-types/base64.type.js +4 -0
  90. package/esm/document/data-type/extended-types/date-string.type.js +6 -2
  91. package/esm/document/data-type/extended-types/date-time-string.type.js +6 -2
  92. package/esm/document/data-type/extended-types/date-time.type.js +6 -2
  93. package/esm/document/data-type/extended-types/date.type.js +6 -2
  94. package/esm/document/data-type/extended-types/email.type.js +6 -2
  95. package/esm/document/data-type/extended-types/field-path.type.js +5 -3
  96. package/esm/document/data-type/extended-types/filter.type.js +19 -17
  97. package/esm/document/data-type/extended-types/object-id.type.js +4 -0
  98. package/esm/document/data-type/extended-types/time.type.js +6 -2
  99. package/esm/document/data-type/extended-types/url.type.js +6 -2
  100. package/esm/document/data-type/extended-types/uuid.type.js +4 -0
  101. package/esm/document/data-type/mapped-type.js +12 -5
  102. package/esm/document/data-type/mixin-type.js +5 -1
  103. package/esm/document/data-type/omit-type.js +6 -0
  104. package/esm/document/data-type/partial-type.js +6 -0
  105. package/esm/document/data-type/primitive-types/bigint.type.js +4 -0
  106. package/esm/document/data-type/primitive-types/boolean.type.js +4 -0
  107. package/esm/document/data-type/primitive-types/integer.type.js +4 -0
  108. package/esm/document/data-type/primitive-types/null.type.js +4 -0
  109. package/esm/document/data-type/primitive-types/number.type.js +4 -0
  110. package/esm/document/data-type/primitive-types/object.type.js +0 -3
  111. package/esm/document/data-type/primitive-types/string.type.js +4 -0
  112. package/esm/document/data-type/simple-type.js +17 -16
  113. package/esm/document/data-type/utils/create-mapped-class.js +2 -1
  114. package/esm/document/decorators/api-field-decorator.js +1 -2
  115. package/esm/document/decorators/http-controller.decorator.js +25 -0
  116. package/esm/document/decorators/http-operation-entity.decorator.js +80 -50
  117. package/esm/document/decorators/http-operation.decorator.js +11 -4
  118. package/esm/document/factory/api-document.factory.js +14 -10
  119. package/esm/document/factory/data-type.factory.js +97 -56
  120. package/esm/document/factory/http-api.factory.js +3 -1
  121. package/esm/document/http/http-api.js +2 -3
  122. package/esm/document/http/http-controller.js +25 -14
  123. package/esm/document/http/http-media-type.js +20 -4
  124. package/esm/document/http/http-operation-response.js +2 -2
  125. package/esm/document/http/http-operation.js +27 -4
  126. package/esm/document/http/http-parameter.js +4 -0
  127. package/esm/document/http/http-request-body.js +0 -1
  128. package/esm/document/http/http-status-range.js +6 -4
  129. package/esm/document/index.js +5 -5
  130. package/esm/exception/index.js +5 -5
  131. package/esm/exception/opra-exception.js +1 -0
  132. package/esm/filter/antlr/OpraFilterParser.js +28 -82
  133. package/esm/filter/ast/index.js +1 -1
  134. package/esm/filter/build.js +1 -3
  135. package/esm/filter/filter-rules.js +4 -2
  136. package/esm/filter/opra-filter.ns.js +2 -2
  137. package/esm/filter/parse.js +1 -3
  138. package/esm/helpers/mixin-utils.js +2 -1
  139. package/esm/helpers/monkey-patches.js +4 -2
  140. package/esm/helpers/object-utils.js +2 -2
  141. package/esm/helpers/parse-fields-projection.js +1 -3
  142. package/esm/helpers/responsive-map.js +5 -4
  143. package/esm/i18n/i18n.js +4 -3
  144. package/esm/i18n/index.js +1 -1
  145. package/esm/index.js +1 -1
  146. package/package.json +12 -8
  147. package/types/document/api-document.d.ts +1 -0
  148. package/types/document/common/api-base.d.ts +1 -1
  149. package/types/document/common/document-element.d.ts +1 -0
  150. package/types/document/data-type/api-field.d.ts +12 -0
  151. package/types/document/data-type/complex-type-base.d.ts +1 -1
  152. package/types/document/data-type/complex-type.d.ts +1 -1
  153. package/types/document/data-type/data-type.d.ts +5 -2
  154. package/types/document/data-type/enum-type.d.ts +2 -2
  155. package/types/document/data-type/mapped-type.d.ts +3 -3
  156. package/types/document/data-type/mixin-type.d.ts +2 -2
  157. package/types/document/data-type/omit-type.d.ts +0 -6
  158. package/types/document/data-type/partial-type.d.ts +0 -6
  159. package/types/document/data-type/pick-type.d.ts +2 -2
  160. package/types/document/data-type/required-type.d.ts +7 -7
  161. package/types/document/data-type/simple-type.d.ts +4 -2
  162. package/types/document/decorators/http-controller.decorator.d.ts +1 -0
  163. package/types/document/decorators/http-operation-entity.decorator.d.ts +1 -0
  164. package/types/document/factory/data-type.factory.d.ts +5 -0
  165. package/types/document/http/http-api.d.ts +1 -1
  166. package/types/document/http/http-controller.d.ts +1 -0
  167. package/types/document/http/http-media-type.d.ts +2 -1
  168. package/types/document/http/http-operation.d.ts +5 -3
  169. package/types/document/http/http-parameter.d.ts +3 -2
  170. package/types/document/http/http-status-range.d.ts +2 -1
  171. package/types/document/index.d.ts +5 -5
  172. package/types/exception/index.d.ts +5 -5
  173. package/types/filter/ast/index.d.ts +1 -1
  174. package/types/filter/opra-filter.ns.d.ts +2 -2
  175. package/types/helpers/type-guards.d.ts +0 -2
  176. package/types/i18n/i18n.d.ts +21 -19
  177. package/types/index.d.ts +1 -1
  178. package/types/schema/data-type/data-type.interface.d.ts +1 -1
  179. package/types/schema/data-type/mapped-type.interface.d.ts +2 -2
  180. package/types/schema/data-type/simple-type.interface.d.ts +4 -0
  181. package/types/schema/data-type-container.interface.d.ts +1 -1
  182. package/types/schema/document.interface.d.ts +1 -1
  183. package/types/schema/http/http-controller.interface.d.ts +2 -2
  184. package/types/schema/http/http-media-type.interface.d.ts +1 -1
  185. package/types/schema/http/http-operation-response.interface.d.ts +2 -2
  186. package/types/schema/http/http-operation.interface.d.ts +8 -4
  187. package/types/schema/http/http-parameter.interface.d.ts +5 -1
@@ -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
  }
@@ -59,7 +64,14 @@ declare class ApiFieldClass extends DocumentElement {
59
64
  readonly exclusive?: boolean;
60
65
  readonly translatable?: boolean;
61
66
  readonly deprecated?: boolean | string;
67
+ readonly readonly?: boolean;
68
+ readonly writeonly?: boolean;
62
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;
63
75
  toJSON(): OpraSchema.Field;
64
76
  }
65
77
  export {};
@@ -74,7 +74,7 @@ declare abstract class ComplexTypeBaseClass extends DataType {
74
74
  }): IsObject.Schema;
75
75
  protected _generateFieldCodec(codec: 'encode' | 'decode', field: ApiField, context: StrictOmit<DataType.GenerateCodecOptions, 'projection'> & {
76
76
  currentPath: string;
77
- projection?: FieldsProjection;
77
+ projection?: FieldsProjection | '*';
78
78
  }): Validator;
79
79
  }
80
80
  export {};
@@ -71,7 +71,7 @@ declare abstract class ComplexTypeClass extends ComplexTypeBase {
71
71
  readonly kind: OpraSchema.ComplexType.Kind;
72
72
  readonly base?: ComplexType | MappedType | MixinType;
73
73
  readonly ctor?: Type;
74
- extendsFrom(baseType: DataType): boolean;
74
+ extendsFrom(baseType: DataType | string | Type | object): boolean;
75
75
  toJSON(): OpraSchema.ComplexType;
76
76
  }
77
77
  export {};
@@ -1,4 +1,4 @@
1
- import { StrictOmit } from 'ts-gems';
1
+ import { StrictOmit, Type } from 'ts-gems';
2
2
  import { 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';
@@ -23,6 +23,9 @@ export declare namespace DataType {
23
23
  caseInSensitive?: boolean;
24
24
  partial?: boolean | 'deep';
25
25
  projection?: string[] | FieldsProjection | '*';
26
+ ignoreReadonlyFields?: boolean;
27
+ ignoreWriteonlyFields?: boolean;
28
+ ignoreHiddenFields?: boolean;
26
29
  }
27
30
  }
28
31
  interface DataTypeStatic {
@@ -52,7 +55,7 @@ declare abstract class DataTypeClass extends DocumentElement {
52
55
  readonly examples?: OpraSchema.DataTypeExample[];
53
56
  abstract generateCodec(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions): Validator;
54
57
  get embedded(): any;
55
- abstract extendsFrom(baseType: DataType): boolean;
58
+ abstract extendsFrom(baseType: DataType | string | Type | object): boolean;
56
59
  toJSON(): OpraSchema.DataType;
57
60
  toString(): string;
58
61
  [nodeInspectCustom](): string;
@@ -1,5 +1,5 @@
1
1
  import 'reflect-metadata';
2
- import { Combine } from 'ts-gems';
2
+ import { Combine, Type } from 'ts-gems';
3
3
  import { Validator } from 'valgen';
4
4
  import { OpraSchema } from '../../schema/index.js';
5
5
  import type { DocumentElement } from '../common/document-element.js';
@@ -63,7 +63,7 @@ declare class EnumTypeClass extends DataType {
63
63
  readonly instance?: object;
64
64
  readonly attributes: Record<string | number, OpraSchema.EnumType.ValueInfo>;
65
65
  readonly ownAttributes: Record<string | number, OpraSchema.EnumType.ValueInfo>;
66
- extendsFrom(baseType: DataType): boolean;
66
+ extendsFrom(baseType: DataType | string | Type | object): boolean;
67
67
  generateCodec(): Validator;
68
68
  toJSON(): OpraSchema.EnumType;
69
69
  }
@@ -1,11 +1,11 @@
1
1
  import 'reflect-metadata';
2
2
  import { Combine, Type } from 'ts-gems';
3
- import type { Field } from '../../schema/data-type/field.interface';
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
- import type { DataType } from './data-type.js';
8
+ import { DataType } from './data-type.js';
9
9
  import type { MixinType } from './mixin-type';
10
10
  /**
11
11
  * @namespace MappedType
@@ -67,7 +67,7 @@ declare class MappedTypeClass extends ComplexTypeBase {
67
67
  readonly pick?: Field.Name[];
68
68
  readonly partial?: Field.Name[] | boolean;
69
69
  readonly required?: Field.Name[] | boolean;
70
- extendsFrom(baseType: DataType): boolean;
70
+ extendsFrom(baseType: DataType | string | Type | object): boolean;
71
71
  toJSON(): OpraSchema.MappedType;
72
72
  }
73
73
  export {};
@@ -4,7 +4,7 @@ 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';
6
6
  import { ComplexTypeBase } from './complex-type-base.js';
7
- import type { DataType } from './data-type.js';
7
+ import { DataType } from './data-type.js';
8
8
  import type { MappedType } from './mapped-type.js';
9
9
  /**
10
10
  * @namespace MixinType
@@ -76,7 +76,7 @@ export declare const MixinType: MixinTypeStatic;
76
76
  declare class MixinTypeClass extends ComplexTypeBase {
77
77
  readonly kind: OpraSchema.MixinType.Kind;
78
78
  readonly types: (ComplexType | MixinType | MappedType)[];
79
- extendsFrom(baseType: DataType): boolean;
79
+ extendsFrom(baseType: DataType | string | Type | object): boolean;
80
80
  toJSON(): OpraSchema.MixinType;
81
81
  }
82
82
  export {};
@@ -1,11 +1,5 @@
1
1
  import { 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
1
  import { 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
@@ -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,12 +1,5 @@
1
1
  import { 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;
@@ -14,7 +14,7 @@ export declare namespace SimpleType {
14
14
  kind: OpraSchema.SimpleType.Kind;
15
15
  }, DataType.Metadata, OpraSchema.SimpleType> {
16
16
  }
17
- interface Options extends DataType.Options {
17
+ interface Options extends Combine<Pick<OpraSchema.SimpleType, 'nameMappings'>, DataType.Options> {
18
18
  }
19
19
  interface InitArguments extends Combine<{
20
20
  kind: OpraSchema.SimpleType.Kind;
@@ -64,11 +64,13 @@ declare abstract class SimpleTypeClass extends DataType {
64
64
  readonly kind: OpraSchema.SimpleType.Kind;
65
65
  readonly base?: SimpleType;
66
66
  readonly attributes: Record<string, SimpleType.Attribute>;
67
+ readonly nameMappings: Record<string, string>;
67
68
  readonly ownAttributes: Record<string, SimpleType.Attribute>;
69
+ readonly ownNameMappings: Record<string, string>;
68
70
  protected _generateDecoder?: SimpleType.ValidatorGenerator;
69
71
  protected _generateEncoder?: SimpleType.ValidatorGenerator;
70
72
  properties?: any;
71
- extendsFrom(baseType: DataType): boolean;
73
+ extendsFrom(baseType: DataType | string | Type | object): boolean;
72
74
  generateCodec<T extends Record<string, any> | object = object>(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions | null, properties?: Partial<T>): Validator;
73
75
  toJSON(): OpraSchema.SimpleType;
74
76
  }
@@ -6,6 +6,7 @@ export interface HttpControllerDecorator<T extends HttpControllerDecorator<any>
6
6
  Header(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync | false): T;
7
7
  QueryParam(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync | false): T;
8
8
  PathParam(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync | false): T;
9
+ KeyParam(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync | false): T;
9
10
  UseType(...type: TypeThunkAsync[]): T;
10
11
  }
11
12
  export interface HttpControllerDecoratorFactory {
@@ -63,6 +63,7 @@ declare module '../http/http-operation' {
63
63
  interface FindManyArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
64
64
  type: Type | string;
65
65
  defaultLimit?: number;
66
+ defaultProjection?: string[];
66
67
  maxLimit?: number;
67
68
  }
68
69
  /** Get */
@@ -18,24 +18,29 @@ export declare namespace DataTypeFactory {
18
18
  type DataTypeSources = ThunkAsync<Type | EnumType.EnumObject | EnumType.EnumArray | object>[] | Record<string, OpraSchema.DataType>;
19
19
  type DataTypeThunk = Type | EnumType.EnumObject | EnumType.EnumArray | object;
20
20
  interface ComplexTypeInit extends Combine<{
21
+ _instance?: ComplexType;
21
22
  base?: string | ComplexTypeInit | MappedTypeInit | MixinTypeInit;
22
23
  fields?: Record<string, ApiFieldInit>;
23
24
  additionalFields?: boolean | string | DataTypeFactory.DataTypeInitArguments | ['error'] | ['error', string];
24
25
  }, ComplexType.InitArguments> {
25
26
  }
26
27
  interface EnumTypeInit extends Combine<{
28
+ _instance?: MappedType;
27
29
  base?: string | EnumTypeInit;
28
30
  }, EnumType.InitArguments> {
29
31
  }
30
32
  interface MappedTypeInit extends Combine<{
33
+ _instance?: MappedType;
31
34
  base: string | ComplexTypeInit | MappedTypeInit | MixinTypeInit;
32
35
  }, MappedType.InitArguments> {
33
36
  }
34
37
  interface MixinTypeInit extends Combine<{
38
+ _instance?: MixinType;
35
39
  types: (string | ComplexTypeInit | MappedTypeInit | MixinTypeInit)[];
36
40
  }, MixinType.InitArguments> {
37
41
  }
38
42
  interface SimpleTypeInit extends Combine<{
43
+ _instance?: SimpleType;
39
44
  base?: string | SimpleTypeInit;
40
45
  }, SimpleType.InitArguments> {
41
46
  }
@@ -9,8 +9,8 @@ import type { HttpOperation } from './http-operation.js';
9
9
  * @class HttpApi
10
10
  */
11
11
  export declare class HttpApi extends ApiBase {
12
- readonly owner: ApiDocument;
13
12
  protected _controllerReverseMap: WeakMap<Type, HttpController | null>;
13
+ readonly owner: ApiDocument;
14
14
  readonly protocol = "http";
15
15
  controllers: ResponsiveMap<HttpController>;
16
16
  url?: string;
@@ -76,6 +76,7 @@ declare class HttpControllerClass extends DocumentElement {
76
76
  findController(controller: Type): HttpController | undefined;
77
77
  findController(resourcePath: string): HttpController | undefined;
78
78
  findParameter(paramName: string, location?: OpraSchema.HttpParameterLocation): HttpParameter | undefined;
79
+ getFullUrl(): string;
79
80
  /**
80
81
  *
81
82
  */
@@ -1,4 +1,5 @@
1
1
  import { Combine, StrictOmit, Type } from 'ts-gems';
2
+ import { Validator } from 'valgen';
2
3
  import { OpraSchema } from '../../schema/index.js';
3
4
  import { DocumentElement } from '../common/document-element.js';
4
5
  import { DataType } from '../data-type/data-type.js';
@@ -52,8 +53,8 @@ declare class HttpMediaTypeClass extends DocumentElement {
52
53
  maxFiles?: number;
53
54
  maxFileSize?: number;
54
55
  maxTotalFileSize?: number;
55
- minFileSize?: number;
56
56
  findMultipartField(fieldName: string, fieldType?: OpraSchema.HttpMultipartFieldType): HttpMultipartField | undefined;
57
57
  toJSON(): OpraSchema.HttpMediaType;
58
+ generateCodec(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions): Validator;
58
59
  }
59
60
  export {};
@@ -13,20 +13,20 @@ import type { HttpRequestBody } from './http-request-body.js';
13
13
  * @namespace HttpOperation
14
14
  */
15
15
  export declare namespace HttpOperation {
16
- interface Metadata extends Pick<OpraSchema.HttpOperation, 'description' | 'path' | 'method' | 'composition' | 'compositionOptions'> {
16
+ interface Metadata extends Pick<OpraSchema.HttpOperation, 'description' | 'method' | 'path' | 'mergePath' | 'composition' | 'compositionOptions'> {
17
17
  types?: ThunkAsync<Type | EnumType.EnumObject | EnumType.EnumArray>[];
18
18
  parameters?: HttpParameter.Metadata[];
19
19
  responses?: HttpOperationResponse.Metadata[];
20
20
  requestBody?: HttpRequestBody.Metadata;
21
21
  immediateFetch?: boolean;
22
22
  }
23
- interface Options extends Partial<Pick<Metadata, 'path' | 'description' | 'method' | 'immediateFetch'>> {
23
+ interface Options extends Partial<Pick<Metadata, 'path' | 'mergePath' | 'description' | 'method' | 'immediateFetch'>> {
24
24
  requestBody?: HttpRequestBody.Options;
25
25
  }
26
26
  interface InitArguments extends Combine<{
27
27
  name: string;
28
28
  types?: DataType[];
29
- }, Pick<Metadata, 'description' | 'path' | 'method' | 'composition' | 'compositionOptions' | 'immediateFetch'>> {
29
+ }, Pick<Metadata, 'description' | 'method' | 'path' | 'mergePath' | 'composition' | 'compositionOptions' | 'immediateFetch'>> {
30
30
  }
31
31
  }
32
32
  /**
@@ -72,6 +72,7 @@ declare class HttpOperationClass extends DocumentElement {
72
72
  method: OpraSchema.HttpMethod;
73
73
  description?: string;
74
74
  path?: string;
75
+ mergePath?: boolean;
75
76
  types: DataTypeMap;
76
77
  parameters: HttpParameter[];
77
78
  responses: HttpOperationResponse[];
@@ -79,6 +80,7 @@ declare class HttpOperationClass extends DocumentElement {
79
80
  composition?: string;
80
81
  compositionOptions?: Record<string, any>;
81
82
  findParameter(paramName: string, location?: OpraSchema.HttpParameterLocation): HttpParameter | undefined;
83
+ getFullUrl(): string;
82
84
  toJSON(): OpraSchema.HttpOperation;
83
85
  }
84
86
  export {};
@@ -1,6 +1,5 @@
1
1
  import { Combine, StrictOmit, TypeThunkAsync } from 'ts-gems';
2
2
  import type { OpraSchema } from '../../schema/index.js';
3
- import { HttpParameterLocation } from '../../schema/types.js';
4
3
  import { DocumentElement } from '../common/document-element.js';
5
4
  import { Value } from '../common/value.js';
6
5
  import { DataType } from '../data-type/data-type.js';
@@ -12,6 +11,7 @@ export declare namespace HttpParameter {
12
11
  interface Metadata extends StrictOmit<OpraSchema.HttpParameter, 'type'> {
13
12
  name: string | RegExp;
14
13
  type?: string | TypeThunkAsync | EnumType.EnumObject | EnumType.EnumArray | object;
14
+ keyParam?: boolean;
15
15
  }
16
16
  interface Options extends Partial<StrictOmit<Metadata, 'type'>> {
17
17
  type?: string | TypeThunkAsync | object;
@@ -41,10 +41,11 @@ export declare const HttpParameter: HttpParameterStatic;
41
41
  */
42
42
  declare class HttpParameterClass extends Value {
43
43
  readonly owner: DocumentElement;
44
+ location: OpraSchema.HttpParameterLocation;
45
+ keyParam?: boolean;
44
46
  deprecated?: boolean | string;
45
47
  required?: boolean;
46
48
  arraySeparator?: string;
47
- location: HttpParameterLocation;
48
49
  toJSON(): OpraSchema.HttpParameter;
49
50
  }
50
51
  export {};
@@ -8,7 +8,8 @@ export declare class HttpStatusRange {
8
8
  constructor(value: string);
9
9
  constructor(start: number, end?: number);
10
10
  constructor(init: Pick<HttpStatusRange, 'start' | 'end'>);
11
- get distance(): number;
11
+ includes(statusCode: number): boolean;
12
+ intersects(start: number, end: number): boolean;
12
13
  toString(): string;
13
14
  toJSON(): OpraSchema.HttpStatusRange | number;
14
15
  }
@@ -2,36 +2,36 @@ import 'reflect-metadata';
2
2
  import * as DataTypeFactory_ from './factory/data-type.factory.js';
3
3
  import * as HttpApiFactory_ from './factory/http-api.factory.js';
4
4
  export * from './api-document.js';
5
- export * from './constants.js';
6
5
  export * from './common/api-base.js';
7
6
  export * from './common/data-type-map.js';
8
7
  export * from './common/document-element.js';
9
8
  export * from './common/document-init-context.js';
10
9
  export * from './common/document-node.js';
11
10
  export * from './common/opra-document-error.js';
11
+ export * from './constants.js';
12
+ export * from './data-type/api-field.js';
12
13
  export * from './data-type/complex-type.js';
13
14
  export * from './data-type/data-type.js';
14
15
  export * from './data-type/enum-type.js';
15
- export * from './data-type/api-field.js';
16
+ export * from './data-type/extended-types/index.js';
16
17
  export * from './data-type/mapped-type.js';
17
18
  export * from './data-type/mixin-type.js';
18
19
  export * from './data-type/omit-type.js';
19
20
  export * from './data-type/partial-type.js';
20
21
  export * from './data-type/pick-type.js';
22
+ export * from './data-type/primitive-types/index.js';
21
23
  export * from './data-type/required-type.js';
22
24
  export * from './data-type/simple-type.js';
23
- export * from './data-type/primitive-types/index.js';
24
- export * from './data-type/extended-types/index.js';
25
25
  export * from './decorators/http-operation-entity.decorator.js';
26
26
  export * from './factory/api-document.factory.js';
27
27
  export * from './http/http-api.js';
28
+ export * from './http/http-controller.js';
28
29
  export * from './http/http-media-type.js';
29
30
  export * from './http/http-multipart-field.js';
30
31
  export * from './http/http-operation.js';
31
32
  export * from './http/http-operation-response.js';
32
33
  export * from './http/http-parameter.js';
33
34
  export * from './http/http-request-body.js';
34
- export * from './http/http-controller.js';
35
35
  export * from './http/http-status-range.js';
36
36
  export declare namespace classes {
37
37
  export import HttpApiFactory = HttpApiFactory_.HttpApiFactory;
@@ -1,7 +1,4 @@
1
- export * from './opra-exception.js';
2
- export * from './opra-http-error.js';
3
1
  export * from './error-issue.js';
4
- export * from './issue-severity.enum.js';
5
2
  export * from './http-errors/bad-request.error.js';
6
3
  export * from './http-errors/conflict.error.js';
7
4
  export * from './http-errors/failed-dependency.error.js';
@@ -10,8 +7,11 @@ export * from './http-errors/internal-server.error.js';
10
7
  export * from './http-errors/method-not-allowed.error.js';
11
8
  export * from './http-errors/not-acceptable.error.js';
12
9
  export * from './http-errors/not-found.error.js';
13
- export * from './http-errors/unauthorized.error.js';
14
- export * from './http-errors/unprocessable-entity.error.js';
15
10
  export * from './http-errors/permission.error.js';
16
11
  export * from './http-errors/resource-conflict.error.js';
17
12
  export * from './http-errors/resource-not.available.error.js';
13
+ export * from './http-errors/unauthorized.error.js';
14
+ export * from './http-errors/unprocessable-entity.error.js';
15
+ export * from './issue-severity.enum.js';
16
+ export * from './opra-exception.js';
17
+ export * from './opra-http-error.js';
@@ -6,8 +6,8 @@ export * from './expressions/arithmetic-expression.js';
6
6
  export * from './expressions/array-expression.js';
7
7
  export * from './expressions/comparison-expression.js';
8
8
  export * from './expressions/logical-expression.js';
9
- export * from './expressions/parenthesized-expression.js';
10
9
  export * from './expressions/negative-expression.js';
10
+ export * from './expressions/parenthesized-expression.js';
11
11
  export * from './terms/boolean-literal.js';
12
12
  export * from './terms/date-literal.js';
13
13
  export * from './terms/null-literal.js';
@@ -1,5 +1,5 @@
1
1
  export * from './ast/index.js';
2
- export * from './parse.js';
3
2
  export * from './build.js';
4
- export * from './opra-error-listener.js';
5
3
  export * from './filter-tree-visitor.js';
4
+ export * from './opra-error-listener.js';
5
+ export * from './parse.js';
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference lib="dom" />
3
1
  import { Readable, Stream } from 'stream';
4
2
  import { Type } from 'ts-gems';
5
3
  export declare function isConstructor(fn: any): fn is Type;
@@ -1,26 +1,28 @@
1
- import { Type } from 'ts-gems';
2
- import { FallbackLng, Formatter as I18nextFormatter, i18n, InitOptions as I18nextInitOptions, Resource as I18nextResource, TFunction as I18nextTFunction, TOptions } from '@browsery/i18next';
1
+ import { FallbackLng as I18nextFallbackLng, Formatter as I18nextFormatter, i18n, InitOptions as I18nextInitOptions, Resource as I18nextResource, TFunction as I18nextTFunction, TOptions } from '@browsery/i18next';
3
2
  import * as I18next from '@browsery/i18next';
3
+ import { Type } from 'ts-gems';
4
4
  export interface BaseI18n extends Type<I18next.i18n> {
5
5
  }
6
- export declare const BaseI18n: BaseI18n;
7
- export type DeepTranslateOptions = TOptions & {
8
- ignore?: (input: any, inst: i18n) => boolean;
9
- };
10
- export type InitCallback = I18next.Callback;
11
- export type TranslateFunction = I18nextTFunction;
12
- export type Formatter = I18nextFormatter;
13
- export type LanguageResource = I18nextResource;
14
- export type { FallbackLng };
15
- export interface InitOptions extends I18nextInitOptions {
16
- resourceDirs?: string[];
6
+ export declare namespace I18n {
7
+ interface InitOptions extends I18nextInitOptions {
8
+ resourceDirs?: string[];
9
+ }
10
+ type DeepTranslateOptions = TOptions & {
11
+ ignore?: (input: any, inst: i18n) => boolean;
12
+ };
13
+ type InitCallback = I18next.Callback;
14
+ type TranslateFunction = I18nextTFunction;
15
+ type Formatter = I18nextFormatter;
16
+ type LanguageResource = I18nextResource;
17
+ type FallbackLng = I18nextFallbackLng;
17
18
  }
19
+ export declare const BaseI18n: BaseI18n;
18
20
  export declare class I18n extends BaseI18n {
19
- init(callback?: InitCallback): Promise<TranslateFunction>;
20
- init(options: InitOptions, callback?: InitCallback): Promise<TranslateFunction>;
21
- deep(input: any, options?: DeepTranslateOptions): any;
22
- createInstance(options: {} | undefined, callback: any): I18n;
23
- static createInstance(options?: InitOptions, callback?: InitCallback): I18n;
24
- protected _deepTranslate(input: any, objectStack: WeakMap<object, any>, options?: DeepTranslateOptions): any;
21
+ init(callback?: I18n.InitCallback): Promise<I18n.TranslateFunction>;
22
+ init(options: I18n.InitOptions, callback?: I18n.InitCallback): Promise<I18n.TranslateFunction>;
23
+ deep(input: any, options?: I18n.DeepTranslateOptions): any;
24
+ createInstance(options?: I18n.InitOptions, callback?: I18n.InitCallback): I18n;
25
+ static createInstance(options?: I18n.InitOptions, callback?: I18n.InitCallback): I18n;
26
+ protected _deepTranslate(input: any, objectStack: WeakMap<object, any>, options?: I18n.DeepTranslateOptions): any;
25
27
  static get defaultInstance(): I18n;
26
28
  }
package/types/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from './types.js';
2
1
  export * from './document/index.js';
3
2
  export * from './exception/index.js';
4
3
  export * from './filter/index.js';
@@ -6,4 +5,5 @@ export * from './helpers/index.js';
6
5
  export * from './http/index.js';
7
6
  export * from './i18n/index.js';
8
7
  export * from './schema/index.js';
8
+ export * from './types.js';
9
9
  export { uid } from 'uid';
@@ -1,7 +1,7 @@
1
1
  import type { ComplexType } from './complex-type.interface.js';
2
2
  import type { EnumType } from './enum-type.interface.js';
3
3
  import type { MappedType } from './mapped-type.interface.js';
4
- import type { MixinType } from './mixin-type.interface';
4
+ import type { MixinType } from './mixin-type.interface.js';
5
5
  import type { SimpleType } from './simple-type.interface.js';
6
6
  export type DataType = SimpleType | EnumType | ComplexType | MappedType | MixinType;
7
7
  export declare namespace DataType {
@@ -1,6 +1,6 @@
1
1
  import { StrictOmit } from 'ts-gems';
2
- import type { ComplexType } from './complex-type.interface';
3
- import type { DataType, DataTypeBase } from './data-type.interface';
2
+ import type { ComplexType } from './complex-type.interface.js';
3
+ import type { DataType, DataTypeBase } from './data-type.interface.js';
4
4
  import type { Field } from './field.interface.js';
5
5
  import type { MixinType } from './mixin-type.interface.js';
6
6
  export interface MappedType extends StrictOmit<DataTypeBase, 'kind'> {
@@ -9,6 +9,10 @@ export interface SimpleType extends StrictOmit<DataTypeBase, 'kind'> {
9
9
  base?: DataType.Name;
10
10
  attributes?: Record<string, Attribute>;
11
11
  properties?: Record<string, any>;
12
+ /**
13
+ * Naming alternatives across software languages
14
+ */
15
+ nameMappings?: Record<string, string>;
12
16
  }
13
17
  export declare namespace SimpleType {
14
18
  const Kind = "SimpleType";
@@ -1,4 +1,4 @@
1
- import type { DataType } from './data-type/data-type.interface';
1
+ import type { DataType } from './data-type/data-type.interface.js';
2
2
  /**
3
3
  * @interface DataTypeContainer
4
4
  */
@@ -1,6 +1,6 @@
1
1
  import type { SpecVersion } from './constants.js';
2
2
  import type { DataTypeContainer } from './data-type-container.interface.js';
3
- import type { HttpController } from './http/http-controller.interface';
3
+ import type { HttpController } from './http/http-controller.interface.js';
4
4
  export type Protocol = 'http' | 'ws' | 'rpc';
5
5
  /**
6
6
  * @interface Document
@@ -1,6 +1,6 @@
1
1
  import type { DataTypeContainer } from '../data-type-container.interface.js';
2
- import type { HttpOperation } from './http-operation.interface';
3
- import type { HttpParameter } from './http-parameter.interface';
2
+ import type { HttpOperation } from './http-operation.interface.js';
3
+ import type { HttpParameter } from './http-parameter.interface.js';
4
4
  /**
5
5
  *
6
6
  * @interface HttpController
@@ -1,4 +1,4 @@
1
- import type { DataType } from '../data-type/data-type.interface';
1
+ import type { DataType } from '../data-type/data-type.interface.js';
2
2
  import type { HttpMultipartField } from './http-multipart-field.interface.js';
3
3
  /**
4
4
  *
@@ -1,6 +1,6 @@
1
1
  import type { HttpMediaType } from './http-media-type.interface.js';
2
- import type { HttpParameter } from './http-parameter.interface';
3
- import type { HttpStatusRange } from './http-status-range.interface';
2
+ import type { HttpParameter } from './http-parameter.interface.js';
3
+ import type { HttpStatusRange } from './http-status-range.interface.js';
4
4
  /**
5
5
  *
6
6
  * @interface HttpOperationResponse