@opra/client 0.11.7 → 0.12.0

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 (83) hide show
  1. package/cjs/index.min.mjs +8445 -1
  2. package/esm/index.min.mjs +8292 -1
  3. package/package.json +11 -11
  4. package/typings/common/filter/antlr/OpraFilterLexer.d.ts +1 -1
  5. package/typings/common/filter/antlr/OpraFilterListener.d.ts +1 -1
  6. package/typings/common/filter/ast/expressions/arithmetic-expression.d.ts +1 -1
  7. package/typings/common/filter/ast/expressions/comparison-expression.d.ts +1 -1
  8. package/typings/common/filter/ast/expressions/logical-expression.d.ts +1 -1
  9. package/typings/common/filter/build.d.ts +3 -3
  10. package/typings/common/filter/errors.d.ts +2 -0
  11. package/typings/common/filter/filter-tree-visitor.d.ts +2 -1
  12. package/typings/common/helpers/responsive-map.d.ts +19 -5
  13. package/typings/common/http/enums/{http-headers.enum.d.ts → http-headers-codes.enum.d.ts} +1 -1
  14. package/typings/common/http/enums/{http-status.enum.d.ts → http-status-codes.enum.d.ts} +1 -1
  15. package/typings/common/http/http-headers.d.ts +70 -0
  16. package/typings/common/http/http-param-codec.d.ts +4 -0
  17. package/typings/common/http/http-params.d.ts +99 -0
  18. package/typings/common/http/http-request-node.d.ts +34 -0
  19. package/typings/common/http/http-request.d.ts +73 -31
  20. package/typings/common/http/http-response.d.ts +41 -0
  21. package/typings/common/http/index.d.ts +13 -2
  22. package/typings/common/http/interfaces/client-http-headers.interface.d.ts +1 -1
  23. package/typings/common/http/interfaces/server-http-headers.interface.d.ts +1 -1
  24. package/typings/common/http/multipart/batch-multipart.d.ts +1 -1
  25. package/typings/common/http/multipart/http-request-content.d.ts +1 -1
  26. package/typings/common/http/multipart/http-response-content.d.ts +1 -1
  27. package/typings/common/http/param-codec/boolean-codec.d.ts +5 -0
  28. package/typings/common/http/param-codec/date-codec.d.ts +16 -0
  29. package/typings/common/http/param-codec/filter-codec.d.ts +6 -0
  30. package/typings/common/http/param-codec/integer-codec.d.ts +9 -0
  31. package/typings/common/http/param-codec/number-codec.d.ts +12 -0
  32. package/typings/common/http/param-codec/string-codec.d.ts +14 -0
  33. package/typings/common/http/utils/encodeURIParam.d.ts +1 -0
  34. package/typings/common/i18n/i18n.d.ts +6 -6
  35. package/typings/common/schema/decorators/opr-collection-resource.decorator.d.ts +1 -1
  36. package/typings/common/schema/decorators/opr-complex-type.decorator.d.ts +1 -1
  37. package/typings/common/schema/decorators/opr-simple-type.decorator.d.ts +1 -1
  38. package/typings/common/schema/decorators/opr-singleton-resource.decorator.d.ts +1 -1
  39. package/typings/common/schema/implementation/data-type/complex-type.d.ts +1 -1
  40. package/typings/common/schema/implementation/data-type/union-type.d.ts +1 -1
  41. package/typings/common/schema/implementation/document-builder.d.ts +1 -1
  42. package/typings/common/schema/implementation/opra-document.d.ts +2 -2
  43. package/typings/common/schema/implementation/query/collection-count-query.d.ts +1 -1
  44. package/typings/common/schema/implementation/query/collection-create-query.d.ts +1 -1
  45. package/typings/common/schema/implementation/query/collection-delete-many-query.d.ts +1 -1
  46. package/typings/common/schema/implementation/query/collection-get-query.d.ts +1 -1
  47. package/typings/common/schema/implementation/query/collection-search-query.d.ts +1 -1
  48. package/typings/common/schema/implementation/query/collection-update-many-query.d.ts +1 -1
  49. package/typings/common/schema/implementation/query/collection-update-query.d.ts +1 -1
  50. package/typings/common/schema/implementation/query/field-get-query.d.ts +1 -1
  51. package/typings/common/schema/implementation/query/index.d.ts +4 -4
  52. package/typings/common/schema/implementation/query/singleton-get-query.d.ts +1 -1
  53. package/typings/common/schema/implementation/resource/collection-resource-info.d.ts +2 -0
  54. package/typings/common/schema/interfaces/data-type.metadata.d.ts +4 -4
  55. package/typings/common/schema/interfaces/resource.metadata.d.ts +9 -9
  56. package/typings/common/schema/types.d.ts +8 -8
  57. package/typings/common/url/opra-url-path-component.d.ts +1 -1
  58. package/typings/common/url/opra-url-path.d.ts +24 -18
  59. package/typings/common/url/opra-url-search-params.d.ts +3 -42
  60. package/typings/common/url/opra-url.d.ts +38 -28
  61. package/typings/http/http-client.d.ts +30 -13
  62. package/typings/http/http-collection-service.d.ts +67 -13
  63. package/typings/http/http-request-host.d.ts +18 -0
  64. package/typings/http/http-singleton-service.d.ts +24 -6
  65. package/typings/http/http-types.d.ts +44 -21
  66. package/typings/http/requests/batch-request.d.ts +0 -18
  67. package/typings/http/requests/collection-create-request.d.ts +5 -10
  68. package/typings/http/requests/collection-delete-many-request.d.ts +5 -9
  69. package/typings/http/requests/collection-delete-request.d.ts +5 -10
  70. package/typings/http/requests/collection-get-request.d.ts +5 -10
  71. package/typings/http/requests/collection-search-request.d.ts +5 -9
  72. package/typings/http/requests/collection-update-many-request.d.ts +5 -10
  73. package/typings/http/requests/collection-update-request.d.ts +5 -11
  74. package/typings/http/requests/singleton-create-request.d.ts +7 -0
  75. package/typings/http/requests/singleton-delete-request.d.ts +7 -0
  76. package/typings/http/requests/singleton-get-request.d.ts +7 -0
  77. package/typings/index.d.ts +3 -4
  78. package/typings/interfaces/http-options.interface.d.ts +1 -1
  79. package/typings/interfaces/http-request-config.interface.d.ts +1 -1
  80. package/typings/http/http-request.d.ts +0 -25
  81. package/typings/http/http-response.d.ts +0 -14
  82. package/typings/http/requests/http-singleton-get-request.d.ts +0 -11
  83. package/typings/http/utils/merge-raw-http-requests.util.d.ts +0 -2
@@ -0,0 +1,9 @@
1
+ import { NumberCodec, NumberFormatOptions } from './number-codec.js';
2
+ export interface IntegerFormatOptions extends NumberFormatOptions {
3
+ enum?: number[];
4
+ }
5
+ export declare class IntegerCodec extends NumberCodec {
6
+ enum?: number[];
7
+ constructor(options?: IntegerFormatOptions);
8
+ decode(value: string): number;
9
+ }
@@ -0,0 +1,12 @@
1
+ import { HttpParamCodec } from '../http-param-codec.js';
2
+ export interface NumberFormatOptions {
3
+ max?: number;
4
+ min?: number;
5
+ }
6
+ export declare class NumberCodec extends HttpParamCodec {
7
+ max?: number;
8
+ min?: number;
9
+ constructor(options?: NumberFormatOptions);
10
+ decode(value: string): number;
11
+ encode(value: any): string;
12
+ }
@@ -0,0 +1,14 @@
1
+ import { HttpParamCodec } from '../http-param-codec.js';
2
+ export interface StringFormatOptions {
3
+ maxLength?: number;
4
+ minLength?: number;
5
+ enum?: string[];
6
+ }
7
+ export declare class StringCodec extends HttpParamCodec {
8
+ maxLength?: number;
9
+ minLength?: number;
10
+ enum?: string[];
11
+ constructor(options?: StringFormatOptions);
12
+ decode(value: string): string;
13
+ encode(value: any): string;
14
+ }
@@ -0,0 +1 @@
1
+ export declare function encodeURIParam(v: string): string;
@@ -1,15 +1,15 @@
1
1
  import { FallbackLng, Formatter as I18nextFormatter, i18n, InitOptions as I18nextInitOptions, Resource as I18nextResource, TFunction as I18nextTFunction, TOptions } from '@browsery/i18next';
2
2
  import * as I18next from '@browsery/i18next';
3
3
  import { Type } from 'ts-gems';
4
- export declare type BaseI18n = Type<I18next.i18n>;
4
+ export type BaseI18n = Type<I18next.i18n>;
5
5
  export declare const BaseI18n: BaseI18n;
6
- export declare type DeepTranslateOptions = TOptions & {
6
+ export type DeepTranslateOptions = TOptions & {
7
7
  ignore?: (input: any, inst: i18n) => boolean;
8
8
  };
9
- export declare type InitCallback = I18next.Callback;
10
- export declare type TranslateFunction = I18nextTFunction;
11
- export declare type Formatter = I18nextFormatter;
12
- export declare type LanguageResource = I18nextResource;
9
+ export type InitCallback = I18next.Callback;
10
+ export type TranslateFunction = I18nextTFunction;
11
+ export type Formatter = I18nextFormatter;
12
+ export type LanguageResource = I18nextResource;
13
13
  export type { FallbackLng };
14
14
  export interface InitOptions extends I18nextInitOptions {
15
15
  resourceDirs?: string[];
@@ -2,7 +2,7 @@ import "reflect-metadata";
2
2
  import { PartialSome, StrictOmit } from 'ts-gems';
3
3
  import { CollectionResourceMetadata } from '../interfaces/resource.metadata.js';
4
4
  import { TypeThunkAsync } from '../types.js';
5
- export declare type CollectionResourceOptions = PartialSome<StrictOmit<CollectionResourceMetadata, 'name' | 'kind' | 'type' | 'instance' | 'create' | 'count' | 'get' | 'update' | 'updateMany' | 'delete' | 'deleteMany' | 'search'>, 'keyFields'> & {
5
+ export type CollectionResourceOptions = PartialSome<StrictOmit<CollectionResourceMetadata, 'name' | 'kind' | 'type' | 'instance' | 'create' | 'count' | 'get' | 'update' | 'updateMany' | 'delete' | 'deleteMany' | 'search'>, 'keyFields'> & {
6
6
  name?: string;
7
7
  };
8
8
  export declare function OprCollectionResource(entityFunc: TypeThunkAsync, options?: CollectionResourceOptions): (target: Function) => void;
@@ -1,6 +1,6 @@
1
1
  import { StrictOmit } from 'ts-gems';
2
2
  import { ComplexTypeMetadata } from '../interfaces/data-type.metadata.js';
3
- export declare type ComplexTypeDecoratorOptions = Partial<StrictOmit<ComplexTypeMetadata, 'name' | 'kind' | 'ctor' | 'fields' | 'extends'>> & {
3
+ export type ComplexTypeDecoratorOptions = Partial<StrictOmit<ComplexTypeMetadata, 'name' | 'kind' | 'ctor' | 'fields' | 'extends'>> & {
4
4
  name?: string;
5
5
  };
6
6
  export declare function OprComplexType(options?: ComplexTypeDecoratorOptions): ClassDecorator;
@@ -1,6 +1,6 @@
1
1
  import { StrictOmit } from 'ts-gems';
2
2
  import { SimpleTypeMetadata } from '../interfaces/data-type.metadata.js';
3
- export declare type SimpleTypeDecoratorOptions = Partial<StrictOmit<SimpleTypeMetadata, 'name' | 'kind'>> & {
3
+ export type SimpleTypeDecoratorOptions = Partial<StrictOmit<SimpleTypeMetadata, 'name' | 'kind'>> & {
4
4
  name?: string;
5
5
  };
6
6
  export declare function OprSimpleType(options?: SimpleTypeDecoratorOptions): ClassDecorator;
@@ -2,7 +2,7 @@ import "reflect-metadata";
2
2
  import { StrictOmit } from 'ts-gems';
3
3
  import { SingletonResourceMetadata } from '../interfaces/resource.metadata.js';
4
4
  import { TypeThunkAsync } from '../types.js';
5
- export declare type SingletonResourceOptions = StrictOmit<SingletonResourceMetadata, 'name' | 'kind' | 'type' | 'instance' | 'create' | 'get' | 'update' | 'delete'> & {
5
+ export type SingletonResourceOptions = StrictOmit<SingletonResourceMetadata, 'name' | 'kind' | 'type' | 'instance' | 'create' | 'get' | 'update' | 'delete'> & {
6
6
  name?: string;
7
7
  };
8
8
  export declare function OprSingletonResource(type: TypeThunkAsync | string, options?: SingletonResourceOptions): (target: Function) => void;
@@ -4,7 +4,7 @@ import { OpraSchema } from '../../opra-schema.definition.js';
4
4
  import { nodeInspectCustom } from '../../utils/inspect.util.js';
5
5
  import type { OpraDocument } from '../opra-document';
6
6
  import { DataType } from './data-type.js';
7
- export declare type ComplexTypeArgs = StrictOmit<OpraSchema.ComplexType, 'kind'>;
7
+ export type ComplexTypeArgs = StrictOmit<OpraSchema.ComplexType, 'kind'>;
8
8
  export declare class ComplexType extends DataType {
9
9
  protected _initialized: boolean;
10
10
  protected _metadata: OpraSchema.ComplexType;
@@ -3,7 +3,7 @@ import { OpraSchema } from '../../opra-schema.definition.js';
3
3
  import { nodeInspectCustom } from '../../utils/inspect.util.js';
4
4
  import type { OpraDocument } from '../opra-document';
5
5
  import { DataType } from './data-type.js';
6
- export declare type UnionTypeArgs = StrictOmit<OpraSchema.UnionType, 'kind'> & {
6
+ export type UnionTypeArgs = StrictOmit<OpraSchema.UnionType, 'kind'> & {
7
7
  types: DataType[];
8
8
  };
9
9
  export declare class UnionType extends DataType {
@@ -2,7 +2,7 @@ import { Type } from 'ts-gems';
2
2
  import { ResponsiveMap } from '../../helpers/responsive-map.js';
3
3
  import { OpraSchema } from '../opra-schema.definition.js';
4
4
  import { ThunkAsync } from '../types.js';
5
- export declare type DocumentBuilderArgs = Pick<OpraSchema.Document, 'info' | 'servers'>;
5
+ export type DocumentBuilderArgs = Pick<OpraSchema.Document, 'info' | 'servers'>;
6
6
  export declare class DocumentBuilder {
7
7
  protected _args: DocumentBuilderArgs;
8
8
  protected _dataTypes: ResponsiveMap<string, OpraSchema.DataType>;
@@ -11,11 +11,11 @@ import { DocumentBuilderArgs } from './document-builder.js';
11
11
  import { CollectionResourceInfo } from './resource/collection-resource-info.js';
12
12
  import { ResourceInfo } from './resource/resource-info.js';
13
13
  import { SingletonResourceInfo } from './resource/singleton-resource-info.js';
14
- export declare type OpraDocumentArgs = DocumentBuilderArgs & {
14
+ export type OpraDocumentArgs = DocumentBuilderArgs & {
15
15
  types?: ThunkAsync<Type>[] | Record<string, OpraSchema.DataType>;
16
16
  resources?: ThunkAsync<any>[] | Record<string, OpraSchema.Resource>;
17
17
  };
18
- declare type OpraDocumentMeta = Pick<OpraSchema.Document, 'info' | 'servers'>;
18
+ type OpraDocumentMeta = Pick<OpraSchema.Document, 'info' | 'servers'>;
19
19
  export declare namespace OpraDocument {
20
20
  }
21
21
  export declare class OpraDocument implements IResourceContainer {
@@ -1,6 +1,6 @@
1
1
  import { Expression } from '../../../filter/index.js';
2
2
  import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
3
- export declare type CollectionCountQueryOptions = {
3
+ export type CollectionCountQueryOptions = {
4
4
  filter?: string | Expression;
5
5
  };
6
6
  export declare class CollectionCountQuery {
@@ -1,5 +1,5 @@
1
1
  import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
2
- export declare type CollectionCreateQueryOptions = {
2
+ export type CollectionCreateQueryOptions = {
3
3
  pick?: string[];
4
4
  omit?: string[];
5
5
  include?: string[];
@@ -1,6 +1,6 @@
1
1
  import { Expression } from '../../../filter/index.js';
2
2
  import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
3
- export declare type CollectionDeleteManyQueryOptions = {
3
+ export type CollectionDeleteManyQueryOptions = {
4
4
  filter?: string | Expression;
5
5
  };
6
6
  export declare class CollectionDeleteManyQuery {
@@ -1,7 +1,7 @@
1
1
  import type { IChildFieldQuery } from '../../interfaces/child-field-query.interface.js';
2
2
  import type { CollectionResourceInfo } from '../resource/collection-resource-info.js';
3
3
  import type { FieldGetQuery } from './field-get-query.js';
4
- export declare type CollectionGetQueryOptions = {
4
+ export type CollectionGetQueryOptions = {
5
5
  pick?: string[];
6
6
  omit?: string[];
7
7
  include?: string[];
@@ -1,6 +1,6 @@
1
1
  import { Expression } from '../../../filter/index.js';
2
2
  import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
3
- export declare type CollectionSearchQueryOptions = {
3
+ export type CollectionSearchQueryOptions = {
4
4
  pick?: string[];
5
5
  omit?: string[];
6
6
  include?: string[];
@@ -1,6 +1,6 @@
1
1
  import { Expression } from '../../../filter/index.js';
2
2
  import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
3
- export declare type CollectionUpdateManyQueryOptions = {
3
+ export type CollectionUpdateManyQueryOptions = {
4
4
  filter?: string | Expression;
5
5
  };
6
6
  export declare class CollectionUpdateManyQuery {
@@ -1,5 +1,5 @@
1
1
  import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
2
- export declare type CollectionUpdateQueryOptions = {
2
+ export type CollectionUpdateQueryOptions = {
3
3
  pick?: string[];
4
4
  omit?: string[];
5
5
  include?: string[];
@@ -5,7 +5,7 @@ import type { CollectionResourceInfo } from '../resource/collection-resource-inf
5
5
  import type { SingletonResourceInfo } from '../resource/singleton-resource-info.js';
6
6
  import type { CollectionGetQuery } from './collection-get-query.js';
7
7
  import type { SingletonGetQuery } from './singleton-get-query.js';
8
- export declare type FieldGetQueryOptions = {
8
+ export type FieldGetQueryOptions = {
9
9
  pick?: string[];
10
10
  omit?: string[];
11
11
  include?: string[];
@@ -20,8 +20,8 @@ export * from './singleton-get-query.js';
20
20
  export * from './collection-search-query.js';
21
21
  export * from './collection-update-many-query.js';
22
22
  export * from './collection-update-query.js';
23
- export declare type CollectionQuery = CollectionCountQuery | CollectionCreateQuery | CollectionDeleteManyQuery | CollectionDeleteQuery | CollectionGetQuery | CollectionSearchQuery | CollectionUpdateManyQuery | CollectionUpdateQuery;
24
- export declare type FieldQuery = FieldGetQuery;
25
- export declare type SingletonQuery = SingletonGetQuery;
26
- export declare type OpraQuery = CollectionQuery | SingletonQuery | FieldQuery;
23
+ export type CollectionQuery = CollectionCountQuery | CollectionCreateQuery | CollectionDeleteManyQuery | CollectionDeleteQuery | CollectionGetQuery | CollectionSearchQuery | CollectionUpdateManyQuery | CollectionUpdateQuery;
24
+ export type FieldQuery = FieldGetQuery;
25
+ export type SingletonQuery = SingletonGetQuery;
26
+ export type OpraQuery = CollectionQuery | SingletonQuery | FieldQuery;
27
27
  export declare function isChildFieldQuery(query: any): query is IChildFieldQuery;
@@ -1,7 +1,7 @@
1
1
  import type { IChildFieldQuery } from '../../interfaces/child-field-query.interface.js';
2
2
  import type { SingletonResourceInfo } from '../resource/singleton-resource-info.js';
3
3
  import type { FieldGetQuery } from './field-get-query.js';
4
- export declare type SingletonGetQueryOptions = {
4
+ export type SingletonGetQueryOptions = {
5
5
  pick?: string[];
6
6
  omit?: string[];
7
7
  include?: string[];
@@ -6,6 +6,7 @@ export declare class CollectionResourceInfo extends ResourceInfo {
6
6
  readonly metadata: OpraSchema.CollectionResource;
7
7
  readonly dataType: ComplexType;
8
8
  constructor(document: OpraDocument, name: string, dataType: ComplexType, metadata: OpraSchema.CollectionResource);
9
+ get instance(): {} | undefined;
9
10
  get keyFields(): string[];
10
11
  get create(): OpraSchema.CreateMethodResolver | undefined;
11
12
  get count(): OpraSchema.MethodResolver | undefined;
@@ -15,5 +16,6 @@ export declare class CollectionResourceInfo extends ResourceInfo {
15
16
  get update(): OpraSchema.UpdateMethodResolver | undefined;
16
17
  get updateMany(): OpraSchema.UpdateManyMethodResolver | undefined;
17
18
  get search(): OpraSchema.SearchMethodResolver | undefined;
19
+ getHandler(method: string): Function;
18
20
  getSchema(jsonOnly?: boolean): OpraSchema.CollectionResource;
19
21
  }
@@ -1,18 +1,18 @@
1
1
  import { StrictOmit, Type } from 'ts-gems';
2
2
  import { OpraSchema } from '../opra-schema.definition.js';
3
3
  import { TypeThunkAsync } from '../types.js';
4
- export declare type SimpleTypeMetadata = OpraSchema.SimpleType & {
4
+ export type SimpleTypeMetadata = OpraSchema.SimpleType & {
5
5
  name: string;
6
6
  };
7
- export declare type ComplexTypeMetadata = StrictOmit<OpraSchema.ComplexType, 'fields' | 'extends'> & {
7
+ export type ComplexTypeMetadata = StrictOmit<OpraSchema.ComplexType, 'fields' | 'extends'> & {
8
8
  name: string;
9
9
  extends?: ComplexTypeExtendingMetadata[];
10
10
  fields?: Record<string, FieldMetadata>;
11
11
  };
12
- export declare type FieldMetadata = StrictOmit<OpraSchema.Field, 'type'> & {
12
+ export type FieldMetadata = StrictOmit<OpraSchema.Field, 'type'> & {
13
13
  type?: string | TypeThunkAsync | (string | TypeThunkAsync)[];
14
14
  };
15
- declare type ComplexTypeExtendingMetadata = StrictOmit<OpraSchema.ComplexTypeExtendingInfo, 'type'> & {
15
+ type ComplexTypeExtendingMetadata = StrictOmit<OpraSchema.ComplexTypeExtendingInfo, 'type'> & {
16
16
  type: string | Type;
17
17
  };
18
18
  export {};
@@ -1,18 +1,18 @@
1
1
  import { PartialSome, StrictOmit } from 'ts-gems';
2
2
  import { OpraSchema } from '../opra-schema.definition.js';
3
3
  import { TypeThunkAsync } from '../types.js';
4
- export declare type CollectionResourceMetadata = PartialSome<StrictOmit<OpraSchema.CollectionResource, 'type'>, 'keyFields'> & {
4
+ export type CollectionResourceMetadata = PartialSome<StrictOmit<OpraSchema.CollectionResource, 'type'>, 'keyFields'> & {
5
5
  type: TypeThunkAsync | string;
6
6
  name: string;
7
7
  };
8
- export declare type SingletonResourceMetadata = StrictOmit<OpraSchema.SingletonResource, 'type'> & {
8
+ export type SingletonResourceMetadata = StrictOmit<OpraSchema.SingletonResource, 'type'> & {
9
9
  type: TypeThunkAsync | string;
10
10
  name: string;
11
11
  };
12
- export declare type ICreateResolverMetadata = StrictOmit<OpraSchema.CreateMethodResolver, 'handler'>;
13
- export declare type IDeleteResolverMetadata = StrictOmit<OpraSchema.DeleteMethodResolver, 'handler'>;
14
- export declare type IDeleteManyResolverMetadata = StrictOmit<OpraSchema.DeleteManyMethodResolver, 'handler'>;
15
- export declare type IGetResolverMetadata = StrictOmit<OpraSchema.GetMethodResolver, 'handler'>;
16
- export declare type IUpdateResolverMetadata = StrictOmit<OpraSchema.UpdateMethodResolver, 'handler'>;
17
- export declare type IUpdateManyResolverMetadata = StrictOmit<OpraSchema.UpdateManyMethodResolver, 'handler'>;
18
- export declare type ISearchResolverMetadata = StrictOmit<OpraSchema.SearchMethodResolver, 'handler'>;
12
+ export type ICreateResolverMetadata = StrictOmit<OpraSchema.CreateMethodResolver, 'handler'>;
13
+ export type IDeleteResolverMetadata = StrictOmit<OpraSchema.DeleteMethodResolver, 'handler'>;
14
+ export type IDeleteManyResolverMetadata = StrictOmit<OpraSchema.DeleteManyMethodResolver, 'handler'>;
15
+ export type IGetResolverMetadata = StrictOmit<OpraSchema.GetMethodResolver, 'handler'>;
16
+ export type IUpdateResolverMetadata = StrictOmit<OpraSchema.UpdateMethodResolver, 'handler'>;
17
+ export type IUpdateManyResolverMetadata = StrictOmit<OpraSchema.UpdateManyMethodResolver, 'handler'>;
18
+ export type ISearchResolverMetadata = StrictOmit<OpraSchema.SearchMethodResolver, 'handler'>;
@@ -1,14 +1,14 @@
1
1
  import { Builtin, DeepPickWritable, Type } from 'ts-gems';
2
- export declare type PartialInput<T> = DeepNullablePartial<DeepPickWritable<T>>;
3
- export declare type PartialOutput<T> = DeepNullablePartial<T>;
4
- declare type DeepNullablePartial<T> = T extends Builtin ? T : T extends Promise<infer U> ? Promise<DeepNullablePartial<U>> : T extends (infer U)[] ? DeepNullablePartial<U>[] : {
2
+ export type PartialInput<T> = DeepNullablePartial<DeepPickWritable<T>>;
3
+ export type PartialOutput<T> = DeepNullablePartial<T>;
4
+ type DeepNullablePartial<T> = T extends Builtin ? T : T extends Promise<infer U> ? Promise<DeepNullablePartial<U>> : T extends (infer U)[] ? DeepNullablePartial<U>[] : {
5
5
  [P in keyof T]?: DeepNullablePartial<Exclude<T[P], undefined>> | null;
6
6
  };
7
- export declare type Thunk<T> = T | (() => T);
8
- export declare type ThunkAsync<T> = T | Promise<T> | (() => T) | (() => Promise<T>);
9
- export declare type TypeThunk<T = any> = Thunk<Type<T>>;
10
- export declare type TypeThunkAsync<T = any> = ThunkAsync<Type<T>>;
11
- export declare type Named<T> = T & {
7
+ export type Thunk<T> = T | (() => T);
8
+ export type ThunkAsync<T> = T | Promise<T> | (() => T) | (() => Promise<T>);
9
+ export type TypeThunk<T = any> = Thunk<Type<T>>;
10
+ export type TypeThunkAsync<T = any> = ThunkAsync<Type<T>>;
11
+ export type Named<T> = T & {
12
12
  name: string;
13
13
  };
14
14
  export {};
@@ -1,5 +1,5 @@
1
1
  declare const nodeInspectCustom: unique symbol;
2
- export declare type OpraURLPathComponentInit = {
2
+ export type OpraURLPathComponentInit = {
3
3
  resource: string;
4
4
  key?: any;
5
5
  typeCast?: string;
@@ -1,30 +1,36 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
1
+ import type { OpraURL } from './opra-url.js';
3
2
  import { OpraURLPathComponent, OpraURLPathComponentInit } from './opra-url-path-component.js';
4
3
  declare const nodeInspectCustom: unique symbol;
5
- export declare class OpraURLPath extends EventEmitter {
6
- private _entries;
7
- constructor(...components: (OpraURLPathComponent | OpraURLPathComponentInit)[]);
8
- constructor(init?: string | OpraURLPath | URL | OpraURLPathComponent | OpraURLPathComponentInit);
4
+ declare const kEntries: unique symbol;
5
+ declare const kOptions: unique symbol;
6
+ export interface OpraURLPathOptions {
7
+ onChange?: () => void;
8
+ }
9
+ export declare class OpraURLPath {
10
+ protected static kEntries: symbol;
11
+ protected static kOptions: symbol;
12
+ protected [kEntries]: OpraURLPathComponent[];
13
+ protected [kOptions]: OpraURLPathOptions;
14
+ constructor(init?: string | OpraURLPath | URL | OpraURLPathComponentInit | OpraURLPathComponentInit[], options?: OpraURLPathOptions);
9
15
  get size(): number;
10
- add(component: OpraURLPathComponent | {
11
- resource: string;
12
- key?: any;
13
- typeCast?: string;
14
- }): void;
15
- add(name: string, key?: any, typeCast?: string): void;
16
+ changed(): void;
16
17
  clear(): void;
17
18
  get(index: number): OpraURLPathComponent;
18
- join(pathString: string): this;
19
+ join(...source: (string | OpraURLPath | URL | OpraURL | OpraURLPathComponentInit)[]): this;
19
20
  entries(): IterableIterator<[OpraURLPathComponent, number]>;
20
- values(): IterableIterator<OpraURLPathComponent>;
21
- forEach(callback: (name: string, key: any, _this: this) => void): void;
21
+ forEach(callback: (component: OpraURLPathComponent, _this: this) => void): void;
22
22
  getResource(index: number): string | undefined;
23
23
  getKey(index: number): any;
24
+ pop(): OpraURLPathComponent | undefined;
25
+ shift(): OpraURLPathComponent | undefined;
26
+ slice(start: number, end?: number): OpraURLPath;
27
+ splice(start: number, deleteCount: number, join?: string | OpraURLPath | URL | OpraURL | OpraURLPathComponentInit | OpraURLPathComponentInit[]): void;
28
+ unshift(join: string | OpraURLPath | URL | OpraURL | OpraURLPathComponentInit | OpraURLPathComponentInit[]): void;
24
29
  toString(): string;
25
- [Symbol.iterator](): IterableIterator<[OpraURLPathComponent, number]>;
30
+ values(): IterableIterator<OpraURLPathComponent>;
31
+ protected _join(target: OpraURLPathComponent[], source: string | OpraURLPath | URL | OpraURL | OpraURLPathComponentInit | OpraURLPathComponentInit[]): void;
26
32
  [nodeInspectCustom](): OpraURLPathComponent[];
27
- protected _add(component: any, key?: any, typeCast?: string): void;
28
- protected _parse(v: string): void;
33
+ [Symbol.iterator](): IterableIterator<[OpraURLPathComponent, number]>;
34
+ get [Symbol.toStringTag](): string;
29
35
  }
30
36
  export {};
@@ -1,44 +1,5 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- import { StrictOmit } from 'ts-gems';
4
- import { ResponsiveMap } from '../helpers/index.js';
5
- import { Format } from './formats/format.js';
6
- declare const nodeInspectCustom: unique symbol;
7
- interface OpraURLSearchParamItem {
8
- name: string;
9
- format?: Format | string;
10
- array?: boolean | 'strict';
11
- arrayDelimiter?: string;
12
- minArrayItems?: number;
13
- maxArrayItems?: number;
14
- }
15
- export declare class OpraURLSearchParams extends EventEmitter {
16
- protected _params: ResponsiveMap<string, OpraURLSearchParamItem>;
17
- private _entries;
18
- private _size;
19
- constructor(init?: (string | URLSearchParams | OpraURLSearchParams));
20
- get size(): number;
21
- addAll(values: URLSearchParams | OpraURLSearchParams | Map<string, any> | Record<string, any>): void;
22
- append(name: string, value?: any): void;
23
- clear(): void;
24
- defineParam(name: string, options?: StrictOmit<OpraURLSearchParamItem, 'name'>): this;
25
- delete(name: string): void;
26
- entries(): IterableIterator<[string, any]>;
27
- forEach(callback: (value: any, name: string, _this: this) => void): void;
28
- get(name: string, index?: number): any | null;
29
- getAll(name: string): any[];
30
- has(name: string): boolean;
31
- keys(): IterableIterator<string>;
32
- set(name: string, value?: any): void;
33
- sort(compareFn?: (a: string, b: string) => number): void;
34
- values(): IterableIterator<any>;
35
- toString(): string;
36
- parse(input: string): void;
37
- toURLSearchParams(): URLSearchParams;
38
- [Symbol.iterator](): IterableIterator<[string, any]>;
1
+ import { HttpParams, HttpParamsInit, HttpParamsOptions } from '../http/http-params.js';
2
+ export declare class OpraURLSearchParams extends HttpParams {
3
+ constructor(init?: HttpParamsInit, options?: HttpParamsOptions);
39
4
  get [Symbol.toStringTag](): string;
40
- [nodeInspectCustom](): ResponsiveMap<string, any[]>;
41
- protected _delete(name: string): boolean;
42
- protected _add(name: string, value: any): boolean;
43
5
  }
44
- export {};
@@ -1,42 +1,52 @@
1
+ import type { HttpParamDefinition } from '../http/http-params.js';
1
2
  import { OpraURLPath } from './opra-url-path.js';
3
+ import { OpraURLPathComponentInit } from './opra-url-path-component.js';
2
4
  import { OpraURLSearchParams } from './opra-url-search-params.js';
3
5
  declare const nodeInspectCustom: unique symbol;
4
- declare const CONTEXT_KEY: unique symbol;
5
- declare const PATH_KEY: unique symbol;
6
- declare const SEARCHPARAMS_KEY: unique symbol;
6
+ declare const kContext: unique symbol;
7
+ declare const kPath: unique symbol;
8
+ declare const kSearchParams: unique symbol;
7
9
  export declare class OpraURL {
8
- protected [CONTEXT_KEY]: {
10
+ protected static kContext: symbol;
11
+ protected static kPath: symbol;
12
+ protected static kSearchParams: symbol;
13
+ protected [kContext]: {
9
14
  protocol: string;
10
15
  username: string;
11
- password: string;
16
+ pathname: string;
17
+ prefix: string;
12
18
  hostname: string;
13
- pathPrefix: string;
14
- port: number | null;
19
+ port: string;
15
20
  hash: string;
16
- pathname: string;
21
+ password: string;
17
22
  search: string;
23
+ address: string;
18
24
  needUpdate: boolean;
19
25
  };
20
- protected [PATH_KEY]: OpraURLPath;
21
- protected [SEARCHPARAMS_KEY]: OpraURLSearchParams;
22
- constructor(input?: string, pathPrefix?: string);
26
+ protected [kPath]: OpraURLPath;
27
+ protected [kSearchParams]: OpraURLSearchParams;
28
+ constructor(input?: string | URL | OpraURL, base?: string | URL | OpraURL);
29
+ constructor(input?: string | URL | OpraURL, options?: {
30
+ base?: string | URL | OpraURL;
31
+ params?: Record<string, HttpParamDefinition>;
32
+ });
23
33
  get address(): string;
34
+ get host(): string;
35
+ set host(v: string);
36
+ get hostname(): string;
37
+ set hostname(v: string);
24
38
  get href(): string;
39
+ get password(): string;
40
+ set password(v: string);
41
+ get port(): string;
42
+ set port(value: string);
43
+ get prefix(): string;
44
+ set prefix(value: string);
25
45
  get protocol(): string;
26
46
  set protocol(v: string);
27
47
  get username(): string;
28
48
  set username(v: string);
29
- get password(): string;
30
- set password(v: string);
31
- get host(): string;
32
- set host(v: string);
33
- get hostname(): string;
34
- set hostname(v: string);
35
- get port(): number | null;
36
- set port(v: number | null);
37
49
  get origin(): string;
38
- get pathPrefix(): string;
39
- set pathPrefix(v: string);
40
50
  get path(): OpraURLPath;
41
51
  get pathname(): string;
42
52
  set pathname(v: string);
@@ -45,18 +55,18 @@ export declare class OpraURL {
45
55
  set hash(v: string);
46
56
  get search(): string;
47
57
  set search(v: string);
48
- addPath(name: string, key?: any): this;
49
- addSearchParam(name: string, value?: any): this;
58
+ parse(input: string): void;
59
+ join(...source: (string | OpraURLPath | URL | OpraURL | OpraURLPathComponentInit)[]): this;
60
+ addParam(name: string, value?: any): this;
61
+ setParam(name: string, value?: any): this;
50
62
  setHost(v: string): this;
51
63
  setHostname(v: string): this;
52
64
  setProtocol(v: string): this;
53
- setPort(v: number | null): this;
65
+ setPort(v: string | number | null): this;
54
66
  setPrefix(v: string): this;
55
67
  setPathname(v: string): this;
56
68
  setHash(v: string): this;
57
69
  setSearch(v: string): this;
58
- setSearchParam(name: string, value?: any): this;
59
- parse(input: string): this;
60
70
  toString(): string;
61
71
  [nodeInspectCustom](): {
62
72
  protocol: string;
@@ -72,8 +82,8 @@ export declare class OpraURL {
72
82
  searchParams: OpraURLSearchParams;
73
83
  hash: string;
74
84
  };
75
- protected _invalidate(): void;
76
85
  protected _update(): void;
77
- protected _setPathname(v: string, inclSvcRoot?: boolean): void;
86
+ protected _setPathname(v: string, trimPrefix?: boolean): void;
87
+ protected _changed(): void;
78
88
  }
79
89
  export {};
@@ -1,26 +1,43 @@
1
- import { Type } from 'ts-gems';
2
- import { OpraDocument } from '../common';
1
+ import { Observable, Subscriber } from 'rxjs';
2
+ import { StrictOmit, Type } from 'ts-gems';
3
+ import { HttpHeaders, HttpHeadersInit, HttpParams, HttpParamsInit, HttpRequest, HttpResponse, HttpResponseInit, OpraDocument } from '../common';
3
4
  import { HttpCollectionService } from './http-collection-service.js';
4
- import { HttpRequest } from './http-request.js';
5
- import { HttpResponse } from './http-response.js';
6
5
  import { HttpSingletonService } from './http-singleton-service.js';
7
- import { HttpRequestDefaults, OpraHttpClientOptions, RawHttpRequest } from './http-types.js';
8
- import { BatchRequest } from './requests/batch-request.js';
9
- export declare class OpraHttpClient {
6
+ import { HttpEvent, HttpRequestDefaults, ObserveType } from './http-types.js';
7
+ export interface OpraHttpClientOptions {
8
+ /**
9
+ // * Opra Service Metadata Document
10
+ // */
11
+ document?: OpraDocument;
12
+ /**
13
+ *
14
+ */
15
+ defaults?: StrictOmit<HttpRequestDefaults, 'headers' | 'params'> & {
16
+ headers?: HttpHeadersInit;
17
+ params?: HttpParamsInit;
18
+ };
19
+ }
20
+ export declare abstract class OpraHttpClientBase<TResponseExt = never> {
10
21
  protected _serviceUrl: string;
11
22
  protected _metadata?: OpraDocument;
12
- defaults: HttpRequestDefaults;
23
+ defaults: StrictOmit<HttpRequestDefaults, 'headers' | 'params'> & {
24
+ headers: HttpHeaders;
25
+ params: HttpParams;
26
+ };
13
27
  constructor(serviceUrl: string, options?: OpraHttpClientOptions);
14
28
  get serviceUrl(): string;
15
29
  get initialized(): boolean;
16
30
  get metadata(): OpraDocument;
17
31
  init(forceRefresh?: boolean): Promise<void>;
18
- batch(requests: HttpRequest[]): BatchRequest;
19
- collection<T = any>(name: string | Type<T>): HttpCollectionService<T>;
20
- singleton<T = any>(name: string | Type<T>): HttpSingletonService<T>;
32
+ collection<TType = any>(name: string | Type<TType>): HttpCollectionService<TType, TResponseExt>;
33
+ singleton<TType = any>(name: string | Type<TType>): HttpSingletonService<TType, TResponseExt>;
21
34
  protected _resolveMetadata(): Promise<void>;
22
- protected _handleRequest<TResponse extends HttpResponse = HttpResponse>(req: RawHttpRequest): Promise<TResponse>;
23
- protected _fetch<TResponse extends HttpResponse = HttpResponse>(url: string, req: RequestInit): Promise<TResponse>;
35
+ protected _sendRequest<TBody>(observe: ObserveType, request: HttpRequest): Observable<HttpResponse<TBody> | TBody | HttpEvent>;
36
+ protected _fetch(url: string, init?: RequestInit): Promise<Response>;
37
+ protected _createResponse(init?: HttpResponseInit): HttpResponse;
38
+ protected _handleResponse(observe: ObserveType, subscriber: Subscriber<any>, request: HttpRequest, fetchResponse: Response): void;
24
39
  protected _assertMetadata(): void;
25
40
  static create<T extends OpraHttpClient>(this: Type<T>, serviceUrl: string, options?: OpraHttpClientOptions): Promise<T>;
26
41
  }
42
+ export declare class OpraHttpClient extends OpraHttpClientBase {
43
+ }