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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/package.json +1 -1
  2. package/cjs/document/data-type/decorators/api-field-decorator.js +0 -26
  3. package/cjs/document/data-type/decorators/complex-type.decorator.js +0 -33
  4. package/cjs/document/data-type/decorators/simple-type.decorator.js +0 -67
  5. package/cjs/document/http/decorators/http-controller.decorator.js +0 -117
  6. package/cjs/document/http/decorators/http-operation-entity.decorator.js +0 -461
  7. package/cjs/document/http/decorators/http-operation.decorator.js +0 -183
  8. package/cjs/helpers/is-url-string.js +0 -12
  9. package/cjs/http/opra-url-path.js +0 -266
  10. package/cjs/http/opra-url.js +0 -253
  11. package/esm/document/data-type/decorators/api-field-decorator.js +0 -22
  12. package/esm/document/data-type/decorators/complex-type.decorator.js +0 -28
  13. package/esm/document/data-type/decorators/simple-type.decorator.js +0 -61
  14. package/esm/document/http/decorators/http-controller.decorator.js +0 -112
  15. package/esm/document/http/decorators/http-operation-entity.decorator.js +0 -459
  16. package/esm/document/http/decorators/http-operation.decorator.js +0 -178
  17. package/esm/helpers/is-url-string.js +0 -7
  18. package/esm/http/opra-url-path.js +0 -260
  19. package/esm/http/opra-url.js +0 -249
  20. package/types/document/data-type/decorators/api-field-decorator.d.ts +0 -5
  21. package/types/document/data-type/decorators/complex-type.decorator.d.ts +0 -2
  22. package/types/document/data-type/decorators/simple-type.decorator.d.ts +0 -20
  23. package/types/document/http/decorators/http-controller.decorator.d.ts +0 -14
  24. package/types/document/http/decorators/http-operation-entity.decorator.d.ts +0 -100
  25. package/types/document/http/decorators/http-operation.decorator.d.ts +0 -30
  26. package/types/helpers/is-url-string.d.ts +0 -2
  27. package/types/http/opra-url-path.d.ts +0 -55
  28. package/types/http/opra-url.d.ts +0 -66
@@ -1,2 +0,0 @@
1
- import type { ComplexType } from '../complex-type';
2
- export declare function ComplexTypeDecorator(options?: ComplexType.Options): (target: Function) => void;
@@ -1,20 +0,0 @@
1
- import { OpraSchema } from '../../../schema/index.js';
2
- import type { SimpleType } from '../simple-type.js';
3
- export interface SimpleTypeDecorator extends ClassDecorator {
4
- Example(value: any, description?: string): SimpleTypeDecorator;
5
- }
6
- export interface SimpleTypeDecoratorFactory {
7
- /**
8
- * Class decorator method for SimpleType
9
- * @param options
10
- */
11
- (options?: SimpleType.Options): SimpleTypeDecorator;
12
- }
13
- export declare function SimpleTypeDecoratorFactory(options?: SimpleType.Options): SimpleTypeDecorator;
14
- export interface AttributeDecorator extends PropertyDecorator {
15
- Example(options?: Partial<OpraSchema.Attribute>): SimpleTypeDecorator;
16
- }
17
- export interface AttributeDecoratorFactory {
18
- (options?: Partial<OpraSchema.Attribute>): PropertyDecorator;
19
- }
20
- export declare function AttributeDecoratorFactory(options?: Partial<OpraSchema.Attribute>): PropertyDecorator;
@@ -1,14 +0,0 @@
1
- import { StrictOmit, Type, TypeThunkAsync } from 'ts-gems';
2
- import type { HttpController } from '../http-controller';
3
- import type { HttpParameter } from '../http-parameter.js';
4
- export interface HttpControllerDecorator<T extends HttpControllerDecorator<any> = HttpControllerDecorator<any>> extends ClassDecorator {
5
- Cookie(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | Type | false): T;
6
- Header(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync | false): T;
7
- QueryParam(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync | false): T;
8
- PathParam(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync | false): T;
9
- UseType(...type: TypeThunkAsync[]): T;
10
- }
11
- export interface HttpControllerDecoratorFactory {
12
- <T extends HttpController.Options>(options?: T): HttpControllerDecorator;
13
- }
14
- export declare function HttpControllerDecoratorFactory<O extends HttpController.Options>(options?: O): HttpControllerDecorator;
@@ -1,100 +0,0 @@
1
- import { StrictOmit, Type, TypeThunkAsync } from 'ts-gems';
2
- import { OpraFilter } from '../../../filter/index.js';
3
- import { OpraSchema } from '../../../schema/index.js';
4
- import type { HttpParameter } from '../http-parameter';
5
- import { HttpRequestBody } from '../http-request-body.js';
6
- import { HttpOperationDecorator } from './http-operation.decorator.js';
7
- /** Augmentation **/
8
- declare module '../http-operation' {
9
- /**
10
- * HttpOperationConstructor
11
- */
12
- interface HttpOperationStatic {
13
- Entity: HttpOperationEntity;
14
- }
15
- interface HttpOperationEntity {
16
- Create(type: Type | string, options?: StrictOmit<HttpOperation.Entity.CreateArgs, 'type'>): HttpOperation.Entity.CreateDecorator;
17
- Create(args: HttpOperation.Entity.CreateArgs): HttpOperation.Entity.CreateDecorator;
18
- Delete(type: Type | string, options?: StrictOmit<HttpOperation.Entity.DeleteArgs, 'type'>): HttpOperation.Entity.DeleteDecorator;
19
- Delete(args: HttpOperation.Entity.DeleteArgs): HttpOperation.Entity.DeleteDecorator;
20
- DeleteMany(type: Type | string, options?: StrictOmit<HttpOperation.Entity.DeleteManyArgs, 'type'>): HttpOperation.Entity.DeleteManyDecorator;
21
- DeleteMany(args: HttpOperation.Entity.DeleteManyArgs): HttpOperation.Entity.DeleteManyDecorator;
22
- FindMany(type: Type | string, options?: StrictOmit<HttpOperation.Entity.FindManyArgs, 'type'>): HttpOperation.Entity.FindManyDecorator;
23
- FindMany(args: HttpOperation.Entity.FindManyArgs): HttpOperation.Entity.FindManyDecorator;
24
- Get(type: Type | string, options?: StrictOmit<HttpOperation.Entity.GetArgs, 'type'>): HttpOperation.Entity.GetDecorator;
25
- Get(args: HttpOperation.Entity.GetArgs): HttpOperation.Entity.GetDecorator;
26
- Update(type: Type | string, options?: StrictOmit<HttpOperation.Entity.UpdateArgs, 'type'>): HttpOperation.Entity.UpdateDecorator;
27
- Update(args: HttpOperation.Entity.UpdateArgs): HttpOperation.Entity.UpdateDecorator;
28
- UpdateMany(type: Type | string, options?: StrictOmit<HttpOperation.Entity.UpdateManyArgs, 'type'>): HttpOperation.Entity.UpdateManyDecorator;
29
- UpdateMany(args: HttpOperation.Entity.UpdateManyArgs): HttpOperation.Entity.UpdateManyDecorator;
30
- }
31
- namespace HttpOperation {
32
- namespace Entity {
33
- /** Create */
34
- interface CreateDecorator extends HttpOperationDecorator {
35
- }
36
- interface CreateArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
37
- type: Type | string;
38
- requestBody?: Pick<HttpRequestBody.Options, 'description' | 'maxContentSize'> & {
39
- type?: Type | string;
40
- immediateFetch?: boolean;
41
- };
42
- }
43
- /** Delete */
44
- interface DeleteDecorator extends HttpOperationDecorator {
45
- KeyParam(name: string, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this;
46
- }
47
- interface DeleteArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
48
- type: Type | string;
49
- }
50
- /** DeleteMany */
51
- interface DeleteManyDecorator extends HttpOperationDecorator {
52
- Filter(field: OpraSchema.Field.QualifiedName, operators?: OpraFilter.ComparisonOperator[] | string, notes?: string): this;
53
- }
54
- interface DeleteManyArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
55
- type: Type | string;
56
- }
57
- /** FindMany */
58
- interface FindManyDecorator extends HttpOperationDecorator {
59
- SortFields(...fields: OpraSchema.Field.QualifiedName[]): FindManyDecorator;
60
- DefaultSort(...fields: OpraSchema.Field.QualifiedName[]): FindManyDecorator;
61
- Filter(field: OpraSchema.Field.QualifiedName, operators?: OpraFilter.ComparisonOperator[] | string, notes?: string): this;
62
- }
63
- interface FindManyArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
64
- type: Type | string;
65
- defaultLimit?: number;
66
- maxLimit?: number;
67
- }
68
- /** Get */
69
- interface GetDecorator extends HttpOperationDecorator {
70
- KeyParam(name: string, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this;
71
- }
72
- interface GetArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
73
- type: Type | string;
74
- }
75
- /** Update */
76
- interface UpdateDecorator extends HttpOperationDecorator {
77
- KeyParam(name: string, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this;
78
- Filter(field: OpraSchema.Field.QualifiedName, operators?: OpraFilter.ComparisonOperator[] | string, notes?: string): this;
79
- }
80
- interface UpdateArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
81
- type: Type | string;
82
- requestBody?: Pick<HttpRequestBody.Options, 'description' | 'maxContentSize'> & {
83
- type?: Type | string;
84
- immediateFetch?: boolean;
85
- };
86
- }
87
- /** UpdateMany */
88
- interface UpdateManyDecorator extends HttpOperationDecorator {
89
- Filter(field: OpraSchema.Field.QualifiedName, operators?: OpraFilter.ComparisonOperator[] | string, notes?: string): this;
90
- }
91
- interface UpdateManyArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
92
- type: Type | string;
93
- requestBody?: Pick<HttpRequestBody.Options, 'description' | 'maxContentSize'> & {
94
- type?: Type | string;
95
- immediateFetch?: boolean;
96
- };
97
- }
98
- }
99
- }
100
- }
@@ -1,30 +0,0 @@
1
- import { StrictOmit, Type, TypeThunkAsync } from 'ts-gems';
2
- import { HttpMediaType } from '../http-media-type.js';
3
- import { HttpMultipartField } from '../http-multipart-field.js';
4
- import type { HttpOperation } from '../http-operation';
5
- import type { HttpOperationResponse } from '../http-operation-response.js';
6
- import type { HttpParameter } from '../http-parameter';
7
- export interface HttpOperationDecorator {
8
- (target: Object, propertyKey: string): void;
9
- Cookie(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | Type): this;
10
- Header(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this;
11
- QueryParam(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this;
12
- PathParam(name: string | RegExp, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this;
13
- RequestContent(type: string | Type): this;
14
- RequestContent(options: HttpMediaType.Options): this;
15
- MultipartContent(options?: HttpMediaType.Options, subInit?: (content: MultipartContentScope) => void): this;
16
- Response(status: number | string | (number | string)[], options?: HttpOperationResponse.Options): this;
17
- UseType(...type: Type[]): this;
18
- }
19
- export interface MultipartContentScope {
20
- Field(fieldName: string | RegExp, options?: StrictOmit<HttpMultipartField.Options, 'fieldName' | 'fieldType'>): MultipartContentScope;
21
- File(fieldName: string | RegExp, options?: StrictOmit<HttpMultipartField.Options, 'fieldName' | 'fieldType'>): MultipartContentScope;
22
- }
23
- export interface HttpOperationDecoratorFactory {
24
- /**
25
- * Property decorator
26
- * @param decoratorChain
27
- * @param options
28
- */ <T extends HttpOperation.Options>(decoratorChain: Function[], options?: T): HttpOperationDecorator;
29
- }
30
- export declare function HttpOperationDecoratorFactory(decoratorChain: Function[], options?: HttpOperation.Options & Pick<HttpOperation.Metadata, 'composition' | 'compositionOptions'>): HttpOperationDecorator;
@@ -1,2 +0,0 @@
1
- export declare function isUrlString(url: string): boolean;
2
- export declare const isAbsoluteUrl: (urlString: string) => boolean;
@@ -1,55 +0,0 @@
1
- declare const nodeInspectCustom: unique symbol;
2
- declare const kLength: unique symbol;
3
- type ResourceKey = Record<string, string | number | boolean | null>;
4
- /**
5
- * @class OpraURLPath
6
- */
7
- export declare class OpraURLPath {
8
- protected [kLength]: number;
9
- [index: number]: OpraURLPathComponent;
10
- constructor(...init: (OpraURLPath.ComponentLike | null | undefined)[]);
11
- get length(): number;
12
- slice(start?: number, end?: number): OpraURLPath;
13
- resolve(...items: OpraURLPath.ComponentLike[]): this;
14
- join(...items: OpraURLPath.ComponentLike[]): OpraURLPath;
15
- isRelativeTo(basePath: string | OpraURLPath): boolean;
16
- forEach(callback: (component: OpraURLPathComponent, index: number, _this: this) => void): void;
17
- values(): IterableIterator<OpraURLPathComponent>;
18
- toString(): string;
19
- [nodeInspectCustom](): string;
20
- [Symbol.iterator](): IterableIterator<OpraURLPathComponent>;
21
- protected _resolve(items: OpraURLPath.ComponentLike | OpraURLPath.ComponentLike[], join?: boolean): void;
22
- static join(...items: OpraURLPath.ComponentLike[]): OpraURLPath;
23
- static resolve(...items: OpraURLPath.ComponentLike[]): OpraURLPath;
24
- static relative(source: string | OpraURLPath, basePath: string | OpraURLPath): OpraURLPath | undefined;
25
- }
26
- export declare namespace OpraURLPath {
27
- type ComponentLike = string | OpraURLPath | OpraURLPathComponent | OpraURLPathComponent.Initiator;
28
- }
29
- /**
30
- *
31
- * @class OpraURLPathComponent
32
- */
33
- export declare class OpraURLPathComponent {
34
- resource: string;
35
- key?: string | number | ResourceKey;
36
- args?: Record<string, any>;
37
- typeCast?: string;
38
- constructor(init: OpraURLPathComponent.Initiator);
39
- toString(): string;
40
- [nodeInspectCustom](): string;
41
- /**
42
- * Factory method.
43
- * @param input
44
- */
45
- static parse(input: string): OpraURLPathComponent;
46
- }
47
- export declare namespace OpraURLPathComponent {
48
- interface Initiator {
49
- resource: string;
50
- key?: string | number | ResourceKey;
51
- args?: Record<string, any>;
52
- typeCast?: string;
53
- }
54
- }
55
- export {};
@@ -1,66 +0,0 @@
1
- import { OpraURLPath } from './opra-url-path.js';
2
- declare const nodeInspectCustom: unique symbol;
3
- declare const kContext: unique symbol;
4
- declare const kPath: unique symbol;
5
- declare const kSearchParams: unique symbol;
6
- export declare class OpraURL {
7
- protected static kContext: symbol;
8
- protected static kPath: symbol;
9
- protected static kParams: symbol;
10
- protected [kPath]: OpraURLPath;
11
- protected [kSearchParams]: URLSearchParams;
12
- protected [kContext]: {
13
- protocol: string;
14
- username: string;
15
- pathname?: string;
16
- hostname: string;
17
- port: string;
18
- hash: string;
19
- password: string;
20
- address?: string;
21
- };
22
- constructor(input?: string | URL | OpraURL, base?: string | URL | OpraURL);
23
- get address(): string;
24
- get host(): string;
25
- set host(v: string);
26
- get hostname(): string;
27
- set hostname(v: string);
28
- get href(): string;
29
- get password(): string;
30
- set password(v: string);
31
- get port(): string;
32
- set port(value: string | number);
33
- get protocol(): string;
34
- set protocol(v: string);
35
- get username(): string;
36
- set username(v: string);
37
- get origin(): string;
38
- get path(): OpraURLPath;
39
- set path(path: OpraURLPath);
40
- get pathname(): string;
41
- set pathname(v: string);
42
- get hash(): string;
43
- set hash(v: string);
44
- get search(): string;
45
- set search(v: string);
46
- get searchParams(): URLSearchParams;
47
- set setSearchParams(v: URLSearchParams);
48
- invalidate(): void;
49
- join(...items: OpraURLPath.ComponentLike[]): this;
50
- resolve(...items: OpraURLPath.ComponentLike[]): OpraURL;
51
- toString(): string;
52
- protected _parse(input: string): void;
53
- [nodeInspectCustom](): {
54
- protocol: string;
55
- username: string;
56
- password: string;
57
- host: string;
58
- hostname: string;
59
- origin: string;
60
- path: OpraURLPath;
61
- pathname: string;
62
- search: string;
63
- hash: string;
64
- };
65
- }
66
- export {};