@opra/common 0.23.2 → 0.24.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/browser.js +298 -205
- package/cjs/document/constants.js +4 -2
- package/cjs/document/data-type/api-field.js +3 -3
- package/cjs/document/data-type/complex-type.js +2 -2
- package/cjs/document/data-type/enum-type.js +5 -5
- package/cjs/document/data-type/mapped-type.js +9 -9
- package/cjs/document/data-type/simple-type.js +2 -2
- package/cjs/document/data-type/union-type.js +2 -2
- package/cjs/document/factory/create-document.js +3 -3
- package/cjs/document/factory/factory.js +6 -6
- package/cjs/document/factory/import-resource-class.js +4 -4
- package/cjs/document/factory/import-type-class.js +4 -4
- package/cjs/document/factory/process-resources.js +12 -12
- package/cjs/document/index.js +3 -2
- package/cjs/document/resource/action.js +9 -0
- package/cjs/document/resource/collection-class.js +174 -0
- package/cjs/document/resource/collection-decorator.js +60 -0
- package/cjs/document/resource/collection.js +7 -212
- package/cjs/document/resource/resource-decorator.js +16 -0
- package/cjs/document/resource/resource.js +11 -2
- package/cjs/document/resource/singleton-class.js +53 -0
- package/cjs/document/resource/singleton-decorator.js +53 -0
- package/cjs/document/resource/singleton.js +7 -85
- package/cjs/document/resource/storage-class.js +24 -0
- package/cjs/document/resource/storage-decorator.js +51 -0
- package/cjs/document/resource/storage.js +7 -53
- package/cjs/document/utils/generate-codec.js +5 -5
- package/cjs/exception/resource-errors/resource-not-found.error.js +1 -1
- package/cjs/helpers/mixin-utils.js +2 -2
- package/cjs/schema/opra-schema.ns.js +0 -1
- package/cjs/schema/type-guards.js +3 -3
- package/esm/document/constants.js +3 -1
- package/esm/document/data-type/api-field.js +4 -4
- package/esm/document/data-type/complex-type.js +3 -3
- package/esm/document/data-type/enum-type.js +6 -6
- package/esm/document/data-type/mapped-type.js +10 -10
- package/esm/document/data-type/simple-type.js +3 -3
- package/esm/document/data-type/union-type.js +3 -3
- package/esm/document/factory/create-document.js +3 -3
- package/esm/document/factory/factory.js +7 -7
- package/esm/document/factory/import-resource-class.js +5 -5
- package/esm/document/factory/import-type-class.js +5 -5
- package/esm/document/factory/process-resources.js +9 -9
- package/esm/document/index.js +3 -2
- package/esm/document/resource/action.js +5 -0
- package/esm/document/resource/collection-class.js +169 -0
- package/esm/document/resource/collection-decorator.js +55 -0
- package/esm/document/resource/collection.js +6 -211
- package/esm/document/resource/resource-decorator.js +13 -0
- package/esm/document/resource/resource.js +11 -2
- package/esm/document/resource/singleton-class.js +49 -0
- package/esm/document/resource/singleton-decorator.js +48 -0
- package/esm/document/resource/singleton.js +6 -84
- package/esm/document/resource/storage-class.js +20 -0
- package/esm/document/resource/storage-decorator.js +46 -0
- package/esm/document/resource/storage.js +6 -52
- package/esm/document/utils/generate-codec.js +3 -3
- package/esm/exception/resource-errors/resource-not-found.error.js +1 -1
- package/esm/helpers/mixin-utils.js +2 -2
- package/esm/schema/opra-schema.ns.js +0 -1
- package/esm/schema/type-guards.js +1 -1
- package/package.json +1 -1
- package/types/document/api-document.d.ts +1 -1
- package/types/document/constants.d.ts +3 -1
- package/types/document/data-type/mapped-type.d.ts +2 -2
- package/types/document/factory/factory.d.ts +7 -7
- package/types/document/factory/process-resources.d.ts +2 -2
- package/types/document/index.d.ts +3 -2
- package/types/document/interfaces/{collection-resource.interface.d.ts → collection.interface.d.ts} +1 -1
- package/types/document/interfaces/{singleton-resource.interface.d.ts → singleton.interface.d.ts} +1 -1
- package/types/document/interfaces/{storage-resource.interface.d.ts → storage.interface.d.ts} +1 -1
- package/types/document/resource/action.d.ts +4 -0
- package/types/document/resource/collection-class.d.ts +24 -0
- package/types/document/resource/collection-decorator.d.ts +30 -0
- package/types/document/resource/collection.d.ts +12 -39
- package/types/document/resource/resource-decorator.d.ts +5 -0
- package/types/document/resource/resource.d.ts +8 -0
- package/types/document/resource/singleton-class.d.ts +20 -0
- package/types/document/resource/singleton-decorator.d.ts +25 -0
- package/types/document/resource/singleton.d.ts +10 -29
- package/types/document/resource/storage-class.d.ts +12 -0
- package/types/document/resource/storage-decorator.d.ts +22 -0
- package/types/document/resource/storage.d.ts +9 -20
- package/types/document/utils/generate-codec.d.ts +1 -1
- package/types/helpers/mixin-utils.d.ts +1 -1
- package/types/schema/document.interface.d.ts +1 -1
- package/types/schema/opra-schema.ns.d.ts +0 -1
- package/types/schema/resource/collection.interface.d.ts +18 -19
- package/types/schema/resource/container.interface.d.ts +4 -2
- package/types/schema/resource/resource.interface.d.ts +14 -0
- package/types/schema/resource/singleton.interface.d.ts +8 -8
- package/types/schema/resource/storage.interface.d.ts +7 -8
- package/types/schema/type-guards.d.ts +1 -1
- package/cjs/schema/resource/operation.interface.js +0 -2
- package/esm/schema/resource/operation.interface.js +0 -1
- package/types/schema/resource/operation.interface.d.ts +0 -3
- /package/cjs/document/interfaces/{collection-resource.interface.js → collection.interface.js} +0 -0
- /package/cjs/document/interfaces/{singleton-resource.interface.js → singleton.interface.js} +0 -0
- /package/cjs/document/interfaces/{storage-resource.interface.js → storage.interface.js} +0 -0
- /package/esm/document/interfaces/{collection-resource.interface.js → collection.interface.js} +0 -0
- /package/esm/document/interfaces/{singleton-resource.interface.js → singleton.interface.js} +0 -0
- /package/esm/document/interfaces/{storage-resource.interface.js → storage.interface.js} +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { OpraFilter } from '../../filter/index.js';
|
|
2
2
|
import type { DataType } from '../data-type/data-type.interface.js';
|
|
3
3
|
import type { Field } from '../data-type/field.interface';
|
|
4
|
-
import type {
|
|
5
|
-
import type { ResourceBase } from './resource.interface.js';
|
|
4
|
+
import type { Endpoint, ResourceBase } from './resource.interface.js';
|
|
6
5
|
export interface Collection extends ResourceBase {
|
|
7
6
|
kind: Collection.Kind;
|
|
8
7
|
type: DataType.Name;
|
|
@@ -12,40 +11,40 @@ export interface Collection extends ResourceBase {
|
|
|
12
11
|
export declare namespace Collection {
|
|
13
12
|
const Kind = "Collection";
|
|
14
13
|
type Kind = 'Collection';
|
|
15
|
-
type
|
|
16
|
-
type
|
|
17
|
-
type
|
|
18
|
-
type
|
|
19
|
-
type
|
|
14
|
+
type CreateEndpoint = Endpoint & _EndpointInput & _EndpointResponse;
|
|
15
|
+
type DeleteEndpoint = Endpoint;
|
|
16
|
+
type DeleteManyEndpoint = Endpoint & _EndpointFilter;
|
|
17
|
+
type GetEndpoint = Endpoint & _EndpointResponse;
|
|
18
|
+
type FindManyEndpoint = Endpoint & _EndpointFilter & _EndpointResponse & {
|
|
20
19
|
sortFields?: string[];
|
|
21
20
|
defaultSort?: string[];
|
|
22
21
|
};
|
|
23
|
-
type
|
|
24
|
-
type
|
|
22
|
+
type UpdateEndpoint = Endpoint & _EndpointInput & _EndpointResponse;
|
|
23
|
+
type UpdateManyEndpoint = Endpoint & _EndpointInput & _EndpointFilter;
|
|
25
24
|
interface Operations {
|
|
26
|
-
create?:
|
|
27
|
-
delete?:
|
|
28
|
-
get?:
|
|
29
|
-
update?:
|
|
30
|
-
deleteMany?:
|
|
31
|
-
findMany?:
|
|
32
|
-
updateMany?:
|
|
25
|
+
create?: CreateEndpoint;
|
|
26
|
+
delete?: DeleteEndpoint;
|
|
27
|
+
get?: GetEndpoint;
|
|
28
|
+
update?: UpdateEndpoint;
|
|
29
|
+
deleteMany?: DeleteManyEndpoint;
|
|
30
|
+
findMany?: FindManyEndpoint;
|
|
31
|
+
updateMany?: UpdateManyEndpoint;
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
|
-
interface
|
|
34
|
+
interface _EndpointFilter {
|
|
36
35
|
filters?: {
|
|
37
36
|
field: Field.QualifiedName;
|
|
38
37
|
operators?: OpraFilter.ComparisonOperator[];
|
|
39
38
|
}[];
|
|
40
39
|
}
|
|
41
|
-
interface
|
|
40
|
+
interface _EndpointInput {
|
|
42
41
|
input?: {
|
|
43
42
|
maxContentSize?: number | string;
|
|
44
43
|
pick?: Field.QualifiedName[];
|
|
45
44
|
omit?: Field.QualifiedName[];
|
|
46
45
|
};
|
|
47
46
|
}
|
|
48
|
-
interface
|
|
47
|
+
interface _EndpointResponse {
|
|
49
48
|
response?: {
|
|
50
49
|
pick?: Field.QualifiedName[];
|
|
51
50
|
omit?: Field.QualifiedName[];
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DataType } from '../data-type/data-type.interface.js';
|
|
2
|
+
import type { Resource, ResourceBase } from './resource.interface';
|
|
2
3
|
export interface Container extends ResourceBase {
|
|
3
4
|
kind: Container.Kind;
|
|
4
|
-
|
|
5
|
+
types?: Record<DataType.Name, DataType>;
|
|
6
|
+
resources?: Record<Resource.Name, Resource>;
|
|
5
7
|
}
|
|
6
8
|
export declare namespace Container {
|
|
7
9
|
const Kind = "Container";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Field } from '../data-type/field.interface.js';
|
|
1
2
|
import type { Collection } from './collection.interface.js';
|
|
2
3
|
import type { Container } from './container.interface.js';
|
|
3
4
|
import type { Singleton } from './singleton.interface.js';
|
|
@@ -10,4 +11,17 @@ export declare namespace Resource {
|
|
|
10
11
|
export interface ResourceBase {
|
|
11
12
|
kind: string;
|
|
12
13
|
description?: string;
|
|
14
|
+
actions?: Record<Action.Name, Action>;
|
|
15
|
+
}
|
|
16
|
+
export interface Endpoint {
|
|
17
|
+
description?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface Action {
|
|
20
|
+
parameters?: Record<Action.ParameterName, Action.Parameter>;
|
|
21
|
+
}
|
|
22
|
+
export declare namespace Action {
|
|
23
|
+
type Name = string;
|
|
24
|
+
type ParameterName = string;
|
|
25
|
+
interface Parameter extends Pick<Field, 'type' | 'description' | 'isArray' | 'default' | 'required' | 'deprecated' | 'examples'> {
|
|
26
|
+
}
|
|
13
27
|
}
|
|
@@ -9,14 +9,14 @@ export interface Singleton extends ResourceBase {
|
|
|
9
9
|
export declare namespace Singleton {
|
|
10
10
|
const Kind = "Singleton";
|
|
11
11
|
type Kind = 'Singleton';
|
|
12
|
-
type
|
|
13
|
-
type
|
|
14
|
-
type
|
|
15
|
-
type
|
|
12
|
+
type CreateEndpoint = Collection.CreateEndpoint;
|
|
13
|
+
type DeleteEndpoint = Collection.DeleteEndpoint;
|
|
14
|
+
type GetEndpoint = Collection.GetEndpoint;
|
|
15
|
+
type UpdateEndpoint = Collection.UpdateEndpoint;
|
|
16
16
|
interface Operations {
|
|
17
|
-
create?:
|
|
18
|
-
delete?:
|
|
19
|
-
get?:
|
|
20
|
-
update?:
|
|
17
|
+
create?: CreateEndpoint;
|
|
18
|
+
delete?: DeleteEndpoint;
|
|
19
|
+
get?: GetEndpoint;
|
|
20
|
+
update?: UpdateEndpoint;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ResourceBase } from './resource.interface.js';
|
|
1
|
+
import type { Endpoint, ResourceBase } from './resource.interface.js';
|
|
3
2
|
export interface Storage extends ResourceBase {
|
|
4
3
|
kind: Storage.Kind;
|
|
5
4
|
operations: Storage.Operations;
|
|
@@ -7,9 +6,9 @@ export interface Storage extends ResourceBase {
|
|
|
7
6
|
export declare namespace Storage {
|
|
8
7
|
const Kind = "Storage";
|
|
9
8
|
type Kind = 'Storage';
|
|
10
|
-
type
|
|
11
|
-
type
|
|
12
|
-
type
|
|
9
|
+
type DeleteEndpoint = Endpoint;
|
|
10
|
+
type GetEndpoint = Endpoint;
|
|
11
|
+
type PostEndpoint = Endpoint & {
|
|
13
12
|
/**
|
|
14
13
|
* the minium size of uploaded file
|
|
15
14
|
*
|
|
@@ -48,8 +47,8 @@ export declare namespace Storage {
|
|
|
48
47
|
maxFieldsSize?: number | undefined;
|
|
49
48
|
};
|
|
50
49
|
interface Operations {
|
|
51
|
-
delete?:
|
|
52
|
-
get?:
|
|
53
|
-
post?:
|
|
50
|
+
delete?: DeleteEndpoint;
|
|
51
|
+
get?: GetEndpoint;
|
|
52
|
+
post?: PostEndpoint;
|
|
54
53
|
}
|
|
55
54
|
}
|
|
@@ -14,7 +14,7 @@ export declare function isSimpleType(obj: any): obj is SimpleType;
|
|
|
14
14
|
export declare function isUnionType(obj: any): obj is UnionType;
|
|
15
15
|
export declare function isMappedType(obj: any): obj is MappedType;
|
|
16
16
|
export declare function isEnumType(obj: any): obj is EnumType;
|
|
17
|
-
export declare function
|
|
17
|
+
export declare function isSource(obj: any): obj is Resource;
|
|
18
18
|
export declare function isCollection(obj: any): obj is Collection;
|
|
19
19
|
export declare function isSingleton(obj: any): obj is Singleton;
|
|
20
20
|
export declare function isStorage(obj: any): obj is Singleton;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
/package/cjs/document/interfaces/{collection-resource.interface.js → collection.interface.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/esm/document/interfaces/{collection-resource.interface.js → collection.interface.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|