@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.
- package/cjs/index.min.mjs +8445 -1
- package/esm/index.min.mjs +8292 -1
- package/package.json +11 -11
- package/typings/common/filter/antlr/OpraFilterLexer.d.ts +1 -1
- package/typings/common/filter/antlr/OpraFilterListener.d.ts +1 -1
- package/typings/common/filter/ast/expressions/arithmetic-expression.d.ts +1 -1
- package/typings/common/filter/ast/expressions/comparison-expression.d.ts +1 -1
- package/typings/common/filter/ast/expressions/logical-expression.d.ts +1 -1
- package/typings/common/filter/build.d.ts +3 -3
- package/typings/common/filter/errors.d.ts +2 -0
- package/typings/common/filter/filter-tree-visitor.d.ts +2 -1
- package/typings/common/helpers/responsive-map.d.ts +19 -5
- package/typings/common/http/enums/{http-headers.enum.d.ts → http-headers-codes.enum.d.ts} +1 -1
- package/typings/common/http/enums/{http-status.enum.d.ts → http-status-codes.enum.d.ts} +1 -1
- package/typings/common/http/http-headers.d.ts +70 -0
- package/typings/common/http/http-param-codec.d.ts +4 -0
- package/typings/common/http/http-params.d.ts +99 -0
- package/typings/common/http/http-request-node.d.ts +34 -0
- package/typings/common/http/http-request.d.ts +73 -31
- package/typings/common/http/http-response.d.ts +41 -0
- package/typings/common/http/index.d.ts +13 -2
- package/typings/common/http/interfaces/client-http-headers.interface.d.ts +1 -1
- package/typings/common/http/interfaces/server-http-headers.interface.d.ts +1 -1
- package/typings/common/http/multipart/batch-multipart.d.ts +1 -1
- package/typings/common/http/multipart/http-request-content.d.ts +1 -1
- package/typings/common/http/multipart/http-response-content.d.ts +1 -1
- package/typings/common/http/param-codec/boolean-codec.d.ts +5 -0
- package/typings/common/http/param-codec/date-codec.d.ts +16 -0
- package/typings/common/http/param-codec/filter-codec.d.ts +6 -0
- package/typings/common/http/param-codec/integer-codec.d.ts +9 -0
- package/typings/common/http/param-codec/number-codec.d.ts +12 -0
- package/typings/common/http/param-codec/string-codec.d.ts +14 -0
- package/typings/common/http/utils/encodeURIParam.d.ts +1 -0
- package/typings/common/i18n/i18n.d.ts +6 -6
- package/typings/common/schema/decorators/opr-collection-resource.decorator.d.ts +1 -1
- package/typings/common/schema/decorators/opr-complex-type.decorator.d.ts +1 -1
- package/typings/common/schema/decorators/opr-simple-type.decorator.d.ts +1 -1
- package/typings/common/schema/decorators/opr-singleton-resource.decorator.d.ts +1 -1
- package/typings/common/schema/implementation/data-type/complex-type.d.ts +1 -1
- package/typings/common/schema/implementation/data-type/union-type.d.ts +1 -1
- package/typings/common/schema/implementation/document-builder.d.ts +1 -1
- package/typings/common/schema/implementation/opra-document.d.ts +2 -2
- package/typings/common/schema/implementation/query/collection-count-query.d.ts +1 -1
- package/typings/common/schema/implementation/query/collection-create-query.d.ts +1 -1
- package/typings/common/schema/implementation/query/collection-delete-many-query.d.ts +1 -1
- package/typings/common/schema/implementation/query/collection-get-query.d.ts +1 -1
- package/typings/common/schema/implementation/query/collection-search-query.d.ts +1 -1
- package/typings/common/schema/implementation/query/collection-update-many-query.d.ts +1 -1
- package/typings/common/schema/implementation/query/collection-update-query.d.ts +1 -1
- package/typings/common/schema/implementation/query/field-get-query.d.ts +1 -1
- package/typings/common/schema/implementation/query/index.d.ts +4 -4
- package/typings/common/schema/implementation/query/singleton-get-query.d.ts +1 -1
- package/typings/common/schema/implementation/resource/collection-resource-info.d.ts +2 -0
- package/typings/common/schema/interfaces/data-type.metadata.d.ts +4 -4
- package/typings/common/schema/interfaces/resource.metadata.d.ts +9 -9
- package/typings/common/schema/types.d.ts +8 -8
- package/typings/common/url/opra-url-path-component.d.ts +1 -1
- package/typings/common/url/opra-url-path.d.ts +24 -18
- package/typings/common/url/opra-url-search-params.d.ts +3 -42
- package/typings/common/url/opra-url.d.ts +38 -28
- package/typings/http/http-client.d.ts +30 -13
- package/typings/http/http-collection-service.d.ts +67 -13
- package/typings/http/http-request-host.d.ts +18 -0
- package/typings/http/http-singleton-service.d.ts +24 -6
- package/typings/http/http-types.d.ts +44 -21
- package/typings/http/requests/batch-request.d.ts +0 -18
- package/typings/http/requests/collection-create-request.d.ts +5 -10
- package/typings/http/requests/collection-delete-many-request.d.ts +5 -9
- package/typings/http/requests/collection-delete-request.d.ts +5 -10
- package/typings/http/requests/collection-get-request.d.ts +5 -10
- package/typings/http/requests/collection-search-request.d.ts +5 -9
- package/typings/http/requests/collection-update-many-request.d.ts +5 -10
- package/typings/http/requests/collection-update-request.d.ts +5 -11
- package/typings/http/requests/singleton-create-request.d.ts +7 -0
- package/typings/http/requests/singleton-delete-request.d.ts +7 -0
- package/typings/http/requests/singleton-get-request.d.ts +7 -0
- package/typings/index.d.ts +3 -4
- package/typings/interfaces/http-options.interface.d.ts +1 -1
- package/typings/interfaces/http-request-config.interface.d.ts +1 -1
- package/typings/http/http-request.d.ts +0 -25
- package/typings/http/http-response.d.ts +0 -14
- package/typings/http/requests/http-singleton-get-request.d.ts +0 -11
- 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
|
|
4
|
+
export type BaseI18n = Type<I18next.i18n>;
|
|
5
5
|
export declare const BaseI18n: BaseI18n;
|
|
6
|
-
export
|
|
6
|
+
export type DeepTranslateOptions = TOptions & {
|
|
7
7
|
ignore?: (input: any, inst: i18n) => boolean;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
|
3
|
+
export type CollectionCountQueryOptions = {
|
|
4
4
|
filter?: string | Expression;
|
|
5
5
|
};
|
|
6
6
|
export declare class CollectionCountQuery {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Expression } from '../../../filter/index.js';
|
|
2
2
|
import { CollectionResourceInfo } from '../resource/collection-resource-info.js';
|
|
3
|
-
export
|
|
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
|
|
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
|
|
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
|
|
3
|
+
export type CollectionUpdateManyQueryOptions = {
|
|
4
4
|
filter?: string | Expression;
|
|
5
5
|
};
|
|
6
6
|
export declare class CollectionUpdateManyQuery {
|
|
@@ -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
|
|
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
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export
|
|
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
|
|
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
|
|
4
|
+
export type SimpleTypeMetadata = OpraSchema.SimpleType & {
|
|
5
5
|
name: string;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
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
|
|
12
|
+
export type FieldMetadata = StrictOmit<OpraSchema.Field, 'type'> & {
|
|
13
13
|
type?: string | TypeThunkAsync | (string | TypeThunkAsync)[];
|
|
14
14
|
};
|
|
15
|
-
|
|
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
|
|
4
|
+
export type CollectionResourceMetadata = PartialSome<StrictOmit<OpraSchema.CollectionResource, 'type'>, 'keyFields'> & {
|
|
5
5
|
type: TypeThunkAsync | string;
|
|
6
6
|
name: string;
|
|
7
7
|
};
|
|
8
|
-
export
|
|
8
|
+
export type SingletonResourceMetadata = StrictOmit<OpraSchema.SingletonResource, 'type'> & {
|
|
9
9
|
type: TypeThunkAsync | string;
|
|
10
10
|
name: string;
|
|
11
11
|
};
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
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
|
|
3
|
-
export
|
|
4
|
-
|
|
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
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
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,30 +1,36 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
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(
|
|
19
|
+
join(...source: (string | OpraURLPath | URL | OpraURL | OpraURLPathComponentInit)[]): this;
|
|
19
20
|
entries(): IterableIterator<[OpraURLPathComponent, number]>;
|
|
20
|
-
|
|
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
|
-
|
|
30
|
+
values(): IterableIterator<OpraURLPathComponent>;
|
|
31
|
+
protected _join(target: OpraURLPathComponent[], source: string | OpraURLPath | URL | OpraURL | OpraURLPathComponentInit | OpraURLPathComponentInit[]): void;
|
|
26
32
|
[nodeInspectCustom](): OpraURLPathComponent[];
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
[Symbol.iterator](): IterableIterator<[OpraURLPathComponent, number]>;
|
|
34
|
+
get [Symbol.toStringTag](): string;
|
|
29
35
|
}
|
|
30
36
|
export {};
|
|
@@ -1,44 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
5
|
-
declare const
|
|
6
|
-
declare const
|
|
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
|
|
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
|
-
|
|
16
|
+
pathname: string;
|
|
17
|
+
prefix: string;
|
|
12
18
|
hostname: string;
|
|
13
|
-
|
|
14
|
-
port: number | null;
|
|
19
|
+
port: string;
|
|
15
20
|
hash: string;
|
|
16
|
-
|
|
21
|
+
password: string;
|
|
17
22
|
search: string;
|
|
23
|
+
address: string;
|
|
18
24
|
needUpdate: boolean;
|
|
19
25
|
};
|
|
20
|
-
protected [
|
|
21
|
-
protected [
|
|
22
|
-
constructor(input?: 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
|
-
|
|
49
|
-
|
|
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,
|
|
86
|
+
protected _setPathname(v: string, trimPrefix?: boolean): void;
|
|
87
|
+
protected _changed(): void;
|
|
78
88
|
}
|
|
79
89
|
export {};
|
|
@@ -1,26 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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 {
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
19
|
-
|
|
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
|
|
23
|
-
protected _fetch
|
|
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
|
+
}
|