@opra/common 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (178) hide show
  1. package/browser.js +5835 -5538
  2. package/cjs/document/api-document.js +28 -12
  3. package/cjs/document/common/data-type-map.js +1 -1
  4. package/cjs/document/common/document-element.js +5 -1
  5. package/cjs/document/constants.js +1 -1
  6. package/cjs/document/data-type/api-field.js +7 -2
  7. package/cjs/document/data-type/complex-type-base.js +6 -1
  8. package/cjs/document/data-type/complex-type.js +8 -5
  9. package/cjs/document/data-type/data-type.js +2 -1
  10. package/cjs/document/data-type/enum-type.js +5 -2
  11. package/cjs/document/data-type/extended-types/base64.type.js +6 -1
  12. package/cjs/document/data-type/extended-types/date-string.type.js +11 -4
  13. package/cjs/document/data-type/extended-types/date-time-string.type.js +11 -4
  14. package/cjs/document/data-type/extended-types/date-time.type.js +11 -4
  15. package/cjs/document/data-type/extended-types/date.type.js +11 -4
  16. package/cjs/document/data-type/extended-types/email.type.js +25 -11
  17. package/cjs/document/data-type/extended-types/field-path.type.js +13 -7
  18. package/cjs/document/data-type/extended-types/filter.type.js +25 -20
  19. package/cjs/document/data-type/extended-types/object-id.type.js +6 -1
  20. package/cjs/document/data-type/extended-types/operation-result.type.js +20 -10
  21. package/cjs/document/data-type/extended-types/time.type.js +11 -4
  22. package/cjs/document/data-type/extended-types/url.type.js +7 -2
  23. package/cjs/document/data-type/extended-types/uuid.type.js +8 -2
  24. package/cjs/document/data-type/mapped-type.js +12 -5
  25. package/cjs/document/data-type/mixin-type.js +5 -1
  26. package/cjs/document/data-type/omit-type.js +1 -2
  27. package/cjs/document/data-type/partial-type.js +1 -2
  28. package/cjs/document/data-type/pick-type.js +1 -2
  29. package/cjs/document/data-type/primitive-types/any.type.js +2 -1
  30. package/cjs/document/data-type/primitive-types/bigint.type.js +6 -1
  31. package/cjs/document/data-type/primitive-types/boolean.type.js +6 -1
  32. package/cjs/document/data-type/primitive-types/integer.type.js +6 -1
  33. package/cjs/document/data-type/primitive-types/null.type.js +6 -1
  34. package/cjs/document/data-type/primitive-types/number.type.js +10 -3
  35. package/cjs/document/data-type/primitive-types/object.type.js +2 -1
  36. package/cjs/document/data-type/primitive-types/string.type.js +14 -5
  37. package/cjs/document/data-type/required-type.js +1 -2
  38. package/cjs/document/data-type/simple-type.js +16 -10
  39. package/cjs/document/data-type/utils/create-mapped-class.js +3 -3
  40. package/cjs/document/data-type/utils/get-is-inherited-predicate-fn.js +1 -2
  41. package/cjs/document/decorators/api-field-decorator.js +1 -2
  42. package/cjs/document/decorators/complex-type.decorator.js +1 -2
  43. package/cjs/document/decorators/http-controller.decorator.js +26 -2
  44. package/cjs/document/decorators/http-operation-entity.decorator.js +59 -34
  45. package/cjs/document/decorators/http-operation.decorator.js +12 -6
  46. package/cjs/document/decorators/simple-type.decorator.js +2 -3
  47. package/cjs/document/factory/api-document.factory.js +14 -6
  48. package/cjs/document/factory/data-type.factory.js +98 -57
  49. package/cjs/document/factory/http-api.factory.js +4 -2
  50. package/cjs/document/http/http-api.js +2 -2
  51. package/cjs/document/http/http-controller.js +25 -13
  52. package/cjs/document/http/http-media-type.js +4 -2
  53. package/cjs/document/http/http-operation-response.js +2 -1
  54. package/cjs/document/http/http-operation.js +28 -4
  55. package/cjs/document/http/http-parameter.js +3 -1
  56. package/cjs/document/http/http-status-range.js +6 -4
  57. package/cjs/document/index.js +5 -5
  58. package/cjs/document/utils/parse-regexp.util.js +1 -2
  59. package/cjs/document/utils/string-compare.util.js +1 -2
  60. package/cjs/exception/index.js +5 -5
  61. package/cjs/filter/antlr/OpraFilterParser.js +28 -82
  62. package/cjs/filter/ast/index.js +1 -1
  63. package/cjs/filter/build.js +22 -25
  64. package/cjs/filter/filter-rules.js +4 -2
  65. package/cjs/filter/opra-filter.ns.js +2 -2
  66. package/cjs/filter/parse.js +2 -5
  67. package/cjs/filter/utils.js +2 -3
  68. package/cjs/helpers/function-utils.js +1 -2
  69. package/cjs/helpers/get-stack-filename.js +2 -3
  70. package/cjs/helpers/mixin-utils.js +4 -4
  71. package/cjs/helpers/monkey-patches.js +4 -2
  72. package/cjs/helpers/object-utils.js +3 -4
  73. package/cjs/helpers/parse-fields-projection.js +4 -6
  74. package/cjs/helpers/responsive-map.js +5 -4
  75. package/cjs/helpers/type-guards.js +10 -11
  76. package/cjs/i18n/i18n.js +4 -3
  77. package/cjs/i18n/index.js +1 -1
  78. package/cjs/i18n/string-utils.js +2 -3
  79. package/cjs/i18n/translate.js +1 -2
  80. package/cjs/index.js +1 -1
  81. package/cjs/schema/type-guards.js +7 -8
  82. package/esm/document/api-document.js +27 -12
  83. package/esm/document/common/data-type-map.js +1 -1
  84. package/esm/document/common/document-element.js +4 -1
  85. package/esm/document/constants.js +1 -1
  86. package/esm/document/data-type/api-field.js +7 -2
  87. package/esm/document/data-type/complex-type-base.js +6 -1
  88. package/esm/document/data-type/complex-type.js +8 -5
  89. package/esm/document/data-type/data-type.js +2 -1
  90. package/esm/document/data-type/enum-type.js +5 -2
  91. package/esm/document/data-type/extended-types/base64.type.js +7 -2
  92. package/esm/document/data-type/extended-types/date-string.type.js +12 -5
  93. package/esm/document/data-type/extended-types/date-time-string.type.js +12 -5
  94. package/esm/document/data-type/extended-types/date-time.type.js +12 -5
  95. package/esm/document/data-type/extended-types/date.type.js +12 -5
  96. package/esm/document/data-type/extended-types/email.type.js +26 -12
  97. package/esm/document/data-type/extended-types/field-path.type.js +14 -8
  98. package/esm/document/data-type/extended-types/filter.type.js +26 -21
  99. package/esm/document/data-type/extended-types/object-id.type.js +7 -2
  100. package/esm/document/data-type/extended-types/operation-result.type.js +21 -11
  101. package/esm/document/data-type/extended-types/time.type.js +12 -5
  102. package/esm/document/data-type/extended-types/url.type.js +8 -3
  103. package/esm/document/data-type/extended-types/uuid.type.js +9 -3
  104. package/esm/document/data-type/mapped-type.js +12 -5
  105. package/esm/document/data-type/mixin-type.js +5 -1
  106. package/esm/document/data-type/primitive-types/any.type.js +3 -2
  107. package/esm/document/data-type/primitive-types/bigint.type.js +7 -2
  108. package/esm/document/data-type/primitive-types/boolean.type.js +7 -2
  109. package/esm/document/data-type/primitive-types/integer.type.js +7 -2
  110. package/esm/document/data-type/primitive-types/null.type.js +7 -2
  111. package/esm/document/data-type/primitive-types/number.type.js +11 -4
  112. package/esm/document/data-type/primitive-types/object.type.js +3 -2
  113. package/esm/document/data-type/primitive-types/string.type.js +15 -6
  114. package/esm/document/data-type/simple-type.js +16 -10
  115. package/esm/document/data-type/utils/create-mapped-class.js +2 -1
  116. package/esm/document/decorators/http-controller.decorator.js +25 -0
  117. package/esm/document/decorators/http-operation-entity.decorator.js +59 -34
  118. package/esm/document/decorators/http-operation.decorator.js +11 -4
  119. package/esm/document/factory/api-document.factory.js +14 -6
  120. package/esm/document/factory/data-type.factory.js +98 -57
  121. package/esm/document/factory/http-api.factory.js +4 -2
  122. package/esm/document/http/http-api.js +2 -2
  123. package/esm/document/http/http-controller.js +24 -13
  124. package/esm/document/http/http-media-type.js +4 -2
  125. package/esm/document/http/http-operation-response.js +2 -1
  126. package/esm/document/http/http-operation.js +27 -4
  127. package/esm/document/http/http-parameter.js +3 -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/filter/antlr/OpraFilterParser.js +28 -82
  132. package/esm/filter/ast/index.js +1 -1
  133. package/esm/filter/build.js +1 -3
  134. package/esm/filter/filter-rules.js +4 -2
  135. package/esm/filter/opra-filter.ns.js +2 -2
  136. package/esm/filter/parse.js +1 -3
  137. package/esm/helpers/mixin-utils.js +2 -1
  138. package/esm/helpers/monkey-patches.js +4 -2
  139. package/esm/helpers/parse-fields-projection.js +1 -3
  140. package/esm/helpers/responsive-map.js +5 -4
  141. package/esm/i18n/i18n.js +4 -3
  142. package/esm/i18n/index.js +1 -1
  143. package/esm/index.js +1 -1
  144. package/package.json +9 -8
  145. package/types/document/api-document.d.ts +4 -6
  146. package/types/document/common/document-element.d.ts +1 -0
  147. package/types/document/data-type/api-field.d.ts +2 -0
  148. package/types/document/data-type/complex-type.d.ts +1 -1
  149. package/types/document/data-type/data-type.d.ts +4 -2
  150. package/types/document/data-type/enum-type.d.ts +2 -2
  151. package/types/document/data-type/mapped-type.d.ts +3 -3
  152. package/types/document/data-type/mixin-type.d.ts +2 -2
  153. package/types/document/data-type/simple-type.d.ts +4 -2
  154. package/types/document/decorators/http-controller.decorator.d.ts +1 -0
  155. package/types/document/factory/api-document.factory.d.ts +1 -1
  156. package/types/document/factory/data-type.factory.d.ts +5 -0
  157. package/types/document/http/http-controller.d.ts +1 -0
  158. package/types/document/http/http-operation.d.ts +4 -2
  159. package/types/document/http/http-parameter.d.ts +3 -2
  160. package/types/document/http/http-status-range.d.ts +2 -1
  161. package/types/document/index.d.ts +5 -5
  162. package/types/exception/index.d.ts +5 -5
  163. package/types/filter/ast/index.d.ts +1 -1
  164. package/types/filter/opra-filter.ns.d.ts +2 -2
  165. package/types/helpers/type-guards.d.ts +0 -2
  166. package/types/i18n/i18n.d.ts +21 -19
  167. package/types/index.d.ts +1 -1
  168. package/types/schema/data-type/data-type.interface.d.ts +1 -1
  169. package/types/schema/data-type/mapped-type.interface.d.ts +2 -2
  170. package/types/schema/data-type/simple-type.interface.d.ts +4 -0
  171. package/types/schema/data-type-container.interface.d.ts +1 -1
  172. package/types/schema/document.interface.d.ts +14 -2
  173. package/types/schema/http/http-controller.interface.d.ts +2 -2
  174. package/types/schema/http/http-media-type.interface.d.ts +1 -1
  175. package/types/schema/http/http-operation-response.interface.d.ts +2 -2
  176. package/types/schema/http/http-operation.interface.d.ts +8 -4
  177. package/types/schema/http/http-parameter.interface.d.ts +5 -1
  178. package/types/schema/index.d.ts +1 -0
@@ -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 {};
@@ -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 {
@@ -5,7 +5,7 @@ import { DocumentInitContext } from '../common/document-init-context.js';
5
5
  import { DataTypeFactory } from './data-type.factory.js';
6
6
  import { HttpApiFactory } from './http-api.factory.js';
7
7
  export declare namespace ApiDocumentFactory {
8
- interface InitArguments extends PartialSome<StrictOmit<OpraSchema.ApiDocument, 'references' | 'types' | 'api'>, 'spec'> {
8
+ interface InitArguments extends PartialSome<StrictOmit<OpraSchema.ApiDocument, 'id' | 'references' | 'types' | 'api'>, 'spec'> {
9
9
  references?: Record<string, ReferenceThunk>;
10
10
  types?: DataTypeInitSources;
11
11
  api?: HttpApiFactory.InitArguments;
@@ -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
  }
@@ -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
  */
@@ -13,7 +13,7 @@ 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[];
@@ -26,7 +26,7 @@ export declare namespace HttpOperation {
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
+ keyParam?: boolean;
44
45
  deprecated?: boolean | string;
45
46
  required?: boolean;
46
47
  arraySeparator?: string;
47
- location: HttpParameterLocation;
48
+ location: OpraSchema.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,15 +1,16 @@
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
7
7
  */
8
8
  export interface Document extends DataTypeContainer {
9
9
  spec: SpecVersion;
10
+ id: string;
10
11
  url?: string;
11
12
  info?: DocumentInfo;
12
- references?: Record<string, string | Document>;
13
+ references?: Record<string, DocumentReference>;
13
14
  api?: HttpApi;
14
15
  }
15
16
  /**
@@ -39,6 +40,14 @@ export interface LicenseInfo {
39
40
  url?: string;
40
41
  content?: string;
41
42
  }
43
+ /**
44
+ * @interface DocumentReference
45
+ */
46
+ export interface DocumentReference extends Pick<Document, 'id' | 'url' | 'info'> {
47
+ }
48
+ /**
49
+ * @interface Api
50
+ */
42
51
  export interface Api extends DataTypeContainer {
43
52
  protocol: Protocol;
44
53
  /**
@@ -47,6 +56,9 @@ export interface Api extends DataTypeContainer {
47
56
  name: string;
48
57
  description?: string;
49
58
  }
59
+ /**
60
+ * @interface HttpApi
61
+ */
50
62
  export interface HttpApi extends Api {
51
63
  protocol: 'http';
52
64
  description?: string;
@@ -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
@@ -1,8 +1,8 @@
1
- import type { DataTypeContainer } from '../data-type-container.interface';
1
+ import type { DataTypeContainer } from '../data-type-container.interface.js';
2
2
  import type { HttpMethod } from '../types.js';
3
- import type { HttpOperationResponse } from './http-operation-response.interface';
4
- import type { HttpParameter } from './http-parameter.interface';
5
- import type { HttpRequestBody } from './http-request-body.interface';
3
+ import type { HttpOperationResponse } from './http-operation-response.interface.js';
4
+ import type { HttpParameter } from './http-parameter.interface.js';
5
+ import type { HttpRequestBody } from './http-request-body.interface.js';
6
6
  /**
7
7
  * @interface HttpOperation
8
8
  */
@@ -11,6 +11,10 @@ export interface HttpOperation extends DataTypeContainer {
11
11
  method: HttpMethod;
12
12
  description?: string;
13
13
  path?: string;
14
+ /**
15
+ * Determines if the `path` will be joined or merged to parent path.
16
+ */
17
+ mergePath?: boolean;
14
18
  parameters?: HttpParameter[];
15
19
  responses?: HttpOperationResponse[];
16
20
  requestBody?: HttpRequestBody;
@@ -1,5 +1,5 @@
1
1
  import { HttpParameterLocation } from '../types.js';
2
- import type { Value } from '../value.interface';
2
+ import type { Value } from '../value.interface.js';
3
3
  /**
4
4
  *
5
5
  * @interface HttpParameter
@@ -13,6 +13,10 @@ export interface HttpParameter extends Value {
13
13
  * Name of the parameter. RegExp pattern can be used matching parameter name
14
14
  */
15
15
  name: string | RegExp;
16
+ /**
17
+ * Determines if parameter is key
18
+ */
19
+ keyParam?: boolean;
16
20
  /**
17
21
  * Defines array separator
18
22
  */
@@ -26,6 +26,7 @@ export declare namespace OpraSchema {
26
26
  export import DocumentInfo = apiDocument_.DocumentInfo;
27
27
  export import ContactPerson = apiDocument_.ContactPerson;
28
28
  export import LicenseInfo = apiDocument_.LicenseInfo;
29
+ export import DocumentReference = apiDocument_.DocumentReference;
29
30
  export import HttpApi = apiDocument_.HttpApi;
30
31
  export import Api = apiDocument_.Api;
31
32
  export import HttpMethod = types_.HttpMethod;