@opra/common 1.8.0 → 1.9.1
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/index.cjs +5 -5
- package/browser/index.mjs +5 -5
- package/cjs/document/data-type/enum-type.js +2 -2
- package/cjs/document/decorators/http-operation-entity-create.decorator.js +58 -0
- package/cjs/document/decorators/http-operation-entity-delete-many.decorator.js +41 -0
- package/cjs/document/decorators/http-operation-entity-delete.decorator.js +41 -0
- package/cjs/document/decorators/http-operation-entity-find-many.decorator.js +85 -0
- package/cjs/document/decorators/http-operation-entity-get.decorator.js +56 -0
- package/cjs/document/decorators/http-operation-entity-replace.decorator.js +56 -0
- package/cjs/document/decorators/http-operation-entity-update-many.decorator.js +50 -0
- package/cjs/document/decorators/http-operation-entity-update.decorator.js +66 -0
- package/cjs/document/decorators/http-operation-entity.decorator.js +86 -525
- package/cjs/document/http/http-parameter.js +1 -0
- package/cjs/document/index.js +9 -1
- package/cjs/filter/filter-rules.js +2 -1
- package/esm/document/data-type/enum-type.js +2 -2
- package/esm/document/decorators/http-operation-entity-create.decorator.js +56 -0
- package/esm/document/decorators/http-operation-entity-delete-many.decorator.js +39 -0
- package/esm/document/decorators/http-operation-entity-delete.decorator.js +39 -0
- package/esm/document/decorators/http-operation-entity-find-many.decorator.js +83 -0
- package/esm/document/decorators/http-operation-entity-get.decorator.js +54 -0
- package/esm/document/decorators/http-operation-entity-replace.decorator.js +54 -0
- package/esm/document/decorators/http-operation-entity-update-many.decorator.js +48 -0
- package/esm/document/decorators/http-operation-entity-update.decorator.js +64 -0
- package/esm/document/decorators/http-operation-entity.decorator.js +82 -525
- package/esm/document/http/http-parameter.js +1 -0
- package/esm/document/index.js +9 -1
- package/esm/filter/filter-rules.js +2 -1
- package/package.json +1 -1
- package/types/document/data-type/enum-type.d.ts +3 -3
- package/types/document/decorators/http-operation-entity-create.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-delete-many.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-delete.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-find-many.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-get.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-replace.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-update-many.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity-update.decorator.d.ts +1 -0
- package/types/document/decorators/http-operation-entity.decorator.d.ts +32 -4
- package/types/document/http/http-parameter.d.ts +3 -0
- package/types/document/index.d.ts +9 -1
- package/types/filter/ast/expressions/comparison-expression.d.ts +9 -0
- package/types/filter/filter-rules.d.ts +2 -1
|
@@ -108,8 +108,8 @@ function EnumTypeFactory(enumSource, ...args) {
|
|
|
108
108
|
const metadata = {
|
|
109
109
|
kind: index_js_2.OpraSchema.EnumType.Kind,
|
|
110
110
|
attributes,
|
|
111
|
-
base: options
|
|
112
|
-
name: options
|
|
111
|
+
base: options?.base,
|
|
112
|
+
name: options?.name,
|
|
113
113
|
description: options?.description,
|
|
114
114
|
};
|
|
115
115
|
Object.defineProperty(enumSource, constants_js_1.DATATYPE_METADATA, {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_js_1 = require("../../enums/index.js");
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
const index_js_2 = require("../data-type/extended-types/index.js");
|
|
6
|
+
const http_operation_js_1 = require("../http/http-operation.js");
|
|
7
|
+
const http_operation_decorator_js_1 = require("./http-operation.decorator.js");
|
|
8
|
+
const http_operation_entity_decorator_js_1 = require("./http-operation-entity.decorator.js");
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
http_operation_js_1.HttpOperation.Entity.Create = function (arg0, arg1) {
|
|
13
|
+
let args;
|
|
14
|
+
if (typeof arg0 === 'object' && !arg0[constants_js_1.DATATYPE_METADATA]) {
|
|
15
|
+
args = arg0;
|
|
16
|
+
}
|
|
17
|
+
else
|
|
18
|
+
args = { ...arg1, type: arg0 };
|
|
19
|
+
/** Initialize the decorator and the chain */
|
|
20
|
+
const decoratorChain = [];
|
|
21
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
...args,
|
|
24
|
+
composition: 'Entity.Create',
|
|
25
|
+
requestBody: {
|
|
26
|
+
immediateFetch: true,
|
|
27
|
+
...args.requestBody,
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
decorator
|
|
32
|
+
.QueryParam('projection', {
|
|
33
|
+
description: 'Determines fields projection',
|
|
34
|
+
type: new index_js_2.FieldPathType({
|
|
35
|
+
dataType: args.type,
|
|
36
|
+
allowSigns: 'each',
|
|
37
|
+
}),
|
|
38
|
+
isArray: true,
|
|
39
|
+
arraySeparator: ',',
|
|
40
|
+
})
|
|
41
|
+
.RequestContent(args.requestBody?.type || args.type)
|
|
42
|
+
.Response(index_js_1.HttpStatusCode.CREATED, {
|
|
43
|
+
description: 'Operation is successful. Returns OperationResult with "payload" field that contains the created resource.',
|
|
44
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
45
|
+
type: args.type,
|
|
46
|
+
partial: 'deep',
|
|
47
|
+
})
|
|
48
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
49
|
+
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
50
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
51
|
+
});
|
|
52
|
+
decoratorChain.push((operationMeta) => {
|
|
53
|
+
const compositionOptions = (operationMeta.compositionOptions =
|
|
54
|
+
operationMeta.compositionOptions || {});
|
|
55
|
+
compositionOptions.type = (0, http_operation_entity_decorator_js_1.getDataTypeName)(args.type);
|
|
56
|
+
});
|
|
57
|
+
return decorator;
|
|
58
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_js_1 = require("../../enums/index.js");
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
const http_operation_js_1 = require("../http/http-operation.js");
|
|
6
|
+
const http_operation_decorator_js_1 = require("./http-operation.decorator.js");
|
|
7
|
+
const http_operation_entity_decorator_js_1 = require("./http-operation-entity.decorator.js");
|
|
8
|
+
/**
|
|
9
|
+
* HttpOperation.Entity.DeleteMany
|
|
10
|
+
*/
|
|
11
|
+
http_operation_js_1.HttpOperation.Entity.DeleteMany = function (arg0, arg1) {
|
|
12
|
+
let args;
|
|
13
|
+
if (typeof arg0 === 'object' && !arg0[constants_js_1.DATATYPE_METADATA]) {
|
|
14
|
+
args = arg0;
|
|
15
|
+
}
|
|
16
|
+
else
|
|
17
|
+
args = { ...arg1, type: arg0 };
|
|
18
|
+
/** Initialize the decorator and the chain */
|
|
19
|
+
const decoratorChain = [];
|
|
20
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
21
|
+
method: 'DELETE',
|
|
22
|
+
...args,
|
|
23
|
+
composition: 'Entity.DeleteMany',
|
|
24
|
+
});
|
|
25
|
+
decorator
|
|
26
|
+
.Response(index_js_1.HttpStatusCode.OK, {
|
|
27
|
+
description: 'Operation is successful. Returns OperationResult with "affected" field.',
|
|
28
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
29
|
+
})
|
|
30
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
31
|
+
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
32
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
33
|
+
});
|
|
34
|
+
decoratorChain.push((operationMeta) => {
|
|
35
|
+
const compositionOptions = (operationMeta.compositionOptions =
|
|
36
|
+
operationMeta.compositionOptions || {});
|
|
37
|
+
compositionOptions.type = (0, http_operation_entity_decorator_js_1.getDataTypeName)(args.type);
|
|
38
|
+
});
|
|
39
|
+
decorator.Filter = (0, http_operation_entity_decorator_js_1.createFilterDecorator)(decorator, decoratorChain, args.type);
|
|
40
|
+
return decorator;
|
|
41
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_js_1 = require("../../enums/index.js");
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
const http_operation_js_1 = require("../http/http-operation.js");
|
|
6
|
+
const http_operation_decorator_js_1 = require("./http-operation.decorator.js");
|
|
7
|
+
const http_operation_entity_decorator_js_1 = require("./http-operation-entity.decorator.js");
|
|
8
|
+
/**
|
|
9
|
+
* HttpOperation.Entity.Delete
|
|
10
|
+
*/
|
|
11
|
+
http_operation_js_1.HttpOperation.Entity.Delete = function (arg0, arg1) {
|
|
12
|
+
let args;
|
|
13
|
+
if (typeof arg0 === 'object' && !arg0[constants_js_1.DATATYPE_METADATA]) {
|
|
14
|
+
args = arg0;
|
|
15
|
+
}
|
|
16
|
+
else
|
|
17
|
+
args = { ...arg1, type: arg0 };
|
|
18
|
+
/** Initialize the decorator and the chain */
|
|
19
|
+
const decoratorChain = [];
|
|
20
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
21
|
+
method: 'DELETE',
|
|
22
|
+
...args,
|
|
23
|
+
composition: 'Entity.Delete',
|
|
24
|
+
});
|
|
25
|
+
decorator
|
|
26
|
+
.Response(index_js_1.HttpStatusCode.OK, {
|
|
27
|
+
description: 'Operation is successful. Returns OperationResult with "affected" field.',
|
|
28
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
29
|
+
})
|
|
30
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
31
|
+
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
32
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
33
|
+
});
|
|
34
|
+
decoratorChain.push((operationMeta) => {
|
|
35
|
+
const compositionOptions = (operationMeta.compositionOptions =
|
|
36
|
+
operationMeta.compositionOptions || {});
|
|
37
|
+
compositionOptions.type = (0, http_operation_entity_decorator_js_1.getDataTypeName)(args.type);
|
|
38
|
+
});
|
|
39
|
+
decorator.KeyParam = (0, http_operation_entity_decorator_js_1.createKeyParamDecorator)(decorator, decoratorChain);
|
|
40
|
+
return decorator;
|
|
41
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_js_1 = require("../../enums/index.js");
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
const index_js_2 = require("../data-type/extended-types/index.js");
|
|
6
|
+
const index_js_3 = require("../data-type/primitive-types/index.js");
|
|
7
|
+
const http_operation_js_1 = require("../http/http-operation.js");
|
|
8
|
+
const http_operation_decorator_js_1 = require("./http-operation.decorator.js");
|
|
9
|
+
const http_operation_entity_decorator_js_1 = require("./http-operation-entity.decorator.js");
|
|
10
|
+
/**
|
|
11
|
+
* HttpOperation.Entity.FindMany
|
|
12
|
+
*/
|
|
13
|
+
http_operation_js_1.HttpOperation.Entity.FindMany = function (arg0, arg1) {
|
|
14
|
+
let args;
|
|
15
|
+
if (typeof arg0 === 'object' && !arg0[constants_js_1.DATATYPE_METADATA]) {
|
|
16
|
+
args = arg0;
|
|
17
|
+
}
|
|
18
|
+
else
|
|
19
|
+
args = { ...arg1, type: arg0 };
|
|
20
|
+
/** Initialize the decorator and the chain */
|
|
21
|
+
const decoratorChain = [];
|
|
22
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
23
|
+
method: 'GET',
|
|
24
|
+
...args,
|
|
25
|
+
composition: 'Entity.FindMany',
|
|
26
|
+
});
|
|
27
|
+
decorator
|
|
28
|
+
.Response(index_js_1.HttpStatusCode.OK, {
|
|
29
|
+
description: 'Operation is successful. Returns OperationResult with "payload" field that contains list of resources.',
|
|
30
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
31
|
+
type: args.type,
|
|
32
|
+
partial: 'deep',
|
|
33
|
+
isArray: true,
|
|
34
|
+
})
|
|
35
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
36
|
+
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
37
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
38
|
+
})
|
|
39
|
+
.QueryParam('limit', {
|
|
40
|
+
description: 'Determines number of returning instances',
|
|
41
|
+
type: new index_js_3.IntegerType({ minValue: 1, maxValue: args.maxLimit }),
|
|
42
|
+
})
|
|
43
|
+
.QueryParam('skip', {
|
|
44
|
+
description: 'Determines number of returning instances',
|
|
45
|
+
type: new index_js_3.IntegerType({ minValue: 1 }),
|
|
46
|
+
})
|
|
47
|
+
.QueryParam('count', {
|
|
48
|
+
description: 'Counts all matching instances if enabled',
|
|
49
|
+
type: Boolean,
|
|
50
|
+
})
|
|
51
|
+
.QueryParam('projection', {
|
|
52
|
+
description: 'Determines fields projection',
|
|
53
|
+
type: new index_js_2.FieldPathType({
|
|
54
|
+
dataType: args.type,
|
|
55
|
+
allowSigns: 'each',
|
|
56
|
+
}),
|
|
57
|
+
isArray: true,
|
|
58
|
+
arraySeparator: ',',
|
|
59
|
+
});
|
|
60
|
+
decoratorChain.push((operationMeta) => {
|
|
61
|
+
const compositionOptions = (operationMeta.compositionOptions =
|
|
62
|
+
operationMeta.compositionOptions || {});
|
|
63
|
+
compositionOptions.type = (0, http_operation_entity_decorator_js_1.getDataTypeName)(args.type);
|
|
64
|
+
if (args.defaultLimit)
|
|
65
|
+
compositionOptions.defaultLimit = args.defaultLimit;
|
|
66
|
+
if (args.defaultProjection)
|
|
67
|
+
compositionOptions.defaultProjection = args.defaultProjection;
|
|
68
|
+
if (args.maxLimit)
|
|
69
|
+
compositionOptions.maxLimit = args.maxLimit;
|
|
70
|
+
});
|
|
71
|
+
decorator.Filter = (0, http_operation_entity_decorator_js_1.createFilterDecorator)(decorator, decoratorChain, args.type);
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
decorator.DefaultSort = (...fields) => {
|
|
76
|
+
decoratorChain.push((operationMeta) => {
|
|
77
|
+
const compositionOptions = (operationMeta.compositionOptions =
|
|
78
|
+
operationMeta.compositionOptions || {});
|
|
79
|
+
compositionOptions.defaultSort = fields;
|
|
80
|
+
});
|
|
81
|
+
return decorator;
|
|
82
|
+
};
|
|
83
|
+
decorator.SortFields = (0, http_operation_entity_decorator_js_1.createSortFieldsDecorator)(decorator, decoratorChain);
|
|
84
|
+
return decorator;
|
|
85
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_js_1 = require("../../enums/index.js");
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
const index_js_2 = require("../data-type/extended-types/index.js");
|
|
6
|
+
const http_operation_js_1 = require("../http/http-operation.js");
|
|
7
|
+
const http_operation_decorator_js_1 = require("./http-operation.decorator.js");
|
|
8
|
+
const http_operation_entity_decorator_js_1 = require("./http-operation-entity.decorator.js");
|
|
9
|
+
/**
|
|
10
|
+
* HttpOperation.Entity.Get
|
|
11
|
+
*/
|
|
12
|
+
http_operation_js_1.HttpOperation.Entity.Get = function (arg0, arg1) {
|
|
13
|
+
let args;
|
|
14
|
+
if (typeof arg0 === 'object' && !arg0[constants_js_1.DATATYPE_METADATA]) {
|
|
15
|
+
args = arg0;
|
|
16
|
+
}
|
|
17
|
+
else
|
|
18
|
+
args = { ...arg1, type: arg0 };
|
|
19
|
+
/** Initialize the decorator and the chain */
|
|
20
|
+
const decoratorChain = [];
|
|
21
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
22
|
+
method: 'GET',
|
|
23
|
+
...args,
|
|
24
|
+
composition: 'Entity.Get',
|
|
25
|
+
});
|
|
26
|
+
decorator
|
|
27
|
+
.QueryParam('projection', {
|
|
28
|
+
description: 'Determines fields projection',
|
|
29
|
+
type: new index_js_2.FieldPathType({
|
|
30
|
+
dataType: args.type,
|
|
31
|
+
allowSigns: 'each',
|
|
32
|
+
}),
|
|
33
|
+
isArray: true,
|
|
34
|
+
arraySeparator: ',',
|
|
35
|
+
})
|
|
36
|
+
.Response(index_js_1.HttpStatusCode.OK, {
|
|
37
|
+
description: 'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',
|
|
38
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
39
|
+
type: args.type,
|
|
40
|
+
partial: 'deep',
|
|
41
|
+
})
|
|
42
|
+
.Response(index_js_1.HttpStatusCode.NO_CONTENT, {
|
|
43
|
+
description: 'Operation is successful but no resource found',
|
|
44
|
+
})
|
|
45
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
46
|
+
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
47
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
48
|
+
});
|
|
49
|
+
decoratorChain.push((operationMeta) => {
|
|
50
|
+
const compositionOptions = (operationMeta.compositionOptions =
|
|
51
|
+
operationMeta.compositionOptions || {});
|
|
52
|
+
compositionOptions.type = (0, http_operation_entity_decorator_js_1.getDataTypeName)(args.type);
|
|
53
|
+
});
|
|
54
|
+
decorator.KeyParam = (0, http_operation_entity_decorator_js_1.createKeyParamDecorator)(decorator, decoratorChain);
|
|
55
|
+
return decorator;
|
|
56
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_js_1 = require("../../enums/index.js");
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
const index_js_2 = require("../data-type/extended-types/index.js");
|
|
6
|
+
const http_operation_js_1 = require("../http/http-operation.js");
|
|
7
|
+
const http_operation_decorator_js_1 = require("./http-operation.decorator.js");
|
|
8
|
+
const http_operation_entity_decorator_js_1 = require("./http-operation-entity.decorator.js");
|
|
9
|
+
/**
|
|
10
|
+
* HttpOperation.Entity.Replace
|
|
11
|
+
*/
|
|
12
|
+
http_operation_js_1.HttpOperation.Entity.Replace = function (arg0, arg1) {
|
|
13
|
+
let args;
|
|
14
|
+
if (typeof arg0 === 'object' && !arg0[constants_js_1.DATATYPE_METADATA]) {
|
|
15
|
+
args = arg0;
|
|
16
|
+
}
|
|
17
|
+
else
|
|
18
|
+
args = { ...arg1, type: arg0 };
|
|
19
|
+
/** Initialize the decorator and the chain */
|
|
20
|
+
const decoratorChain = [];
|
|
21
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
...args,
|
|
24
|
+
composition: 'Entity.Replace',
|
|
25
|
+
});
|
|
26
|
+
decorator
|
|
27
|
+
.QueryParam('projection', {
|
|
28
|
+
description: 'Determines fields projection',
|
|
29
|
+
type: new index_js_2.FieldPathType({
|
|
30
|
+
dataType: args.type,
|
|
31
|
+
allowSigns: 'each',
|
|
32
|
+
}),
|
|
33
|
+
isArray: true,
|
|
34
|
+
arraySeparator: ',',
|
|
35
|
+
})
|
|
36
|
+
.Response(index_js_1.HttpStatusCode.OK, {
|
|
37
|
+
description: 'Operation is successful. Returns OperationResult with "payload" field that contains the resource asked for.',
|
|
38
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
39
|
+
type: args.type,
|
|
40
|
+
partial: 'deep',
|
|
41
|
+
})
|
|
42
|
+
.Response(index_js_1.HttpStatusCode.NO_CONTENT, {
|
|
43
|
+
description: 'Operation is successful but no resource found',
|
|
44
|
+
})
|
|
45
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
46
|
+
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
47
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
48
|
+
});
|
|
49
|
+
decoratorChain.push((operationMeta) => {
|
|
50
|
+
const compositionOptions = (operationMeta.compositionOptions =
|
|
51
|
+
operationMeta.compositionOptions || {});
|
|
52
|
+
compositionOptions.type = (0, http_operation_entity_decorator_js_1.getDataTypeName)(args.type);
|
|
53
|
+
});
|
|
54
|
+
decorator.KeyParam = (0, http_operation_entity_decorator_js_1.createKeyParamDecorator)(decorator, decoratorChain);
|
|
55
|
+
return decorator;
|
|
56
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_js_1 = require("../../enums/index.js");
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
const http_operation_js_1 = require("../http/http-operation.js");
|
|
6
|
+
const http_operation_decorator_js_1 = require("./http-operation.decorator.js");
|
|
7
|
+
const http_operation_entity_decorator_js_1 = require("./http-operation-entity.decorator.js");
|
|
8
|
+
/**
|
|
9
|
+
* HttpOperation.Entity.UpdateMany
|
|
10
|
+
*/
|
|
11
|
+
http_operation_js_1.HttpOperation.Entity.UpdateMany = function (arg0, arg1) {
|
|
12
|
+
let args;
|
|
13
|
+
if (typeof arg0 === 'object' && !arg0[constants_js_1.DATATYPE_METADATA]) {
|
|
14
|
+
args = arg0;
|
|
15
|
+
}
|
|
16
|
+
else
|
|
17
|
+
args = { ...arg1, type: arg0 };
|
|
18
|
+
/** Initialize the decorator and the chain */
|
|
19
|
+
const decoratorChain = [];
|
|
20
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
21
|
+
method: 'PATCH',
|
|
22
|
+
...args,
|
|
23
|
+
composition: 'Entity.UpdateMany',
|
|
24
|
+
requestBody: {
|
|
25
|
+
immediateFetch: true,
|
|
26
|
+
partial: 'deep',
|
|
27
|
+
allowPatchOperators: true,
|
|
28
|
+
keepKeyFields: true,
|
|
29
|
+
...args.requestBody,
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
decorator
|
|
34
|
+
.RequestContent(args.requestBody?.type || args.type)
|
|
35
|
+
.Response(index_js_1.HttpStatusCode.OK, {
|
|
36
|
+
description: 'Operation is successful. Returns OperationResult with "affected" field.',
|
|
37
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
38
|
+
})
|
|
39
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
40
|
+
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
41
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
42
|
+
});
|
|
43
|
+
decoratorChain.push((operationMeta) => {
|
|
44
|
+
const compositionOptions = (operationMeta.compositionOptions =
|
|
45
|
+
operationMeta.compositionOptions || {});
|
|
46
|
+
compositionOptions.type = (0, http_operation_entity_decorator_js_1.getDataTypeName)(args.type);
|
|
47
|
+
});
|
|
48
|
+
decorator.Filter = (0, http_operation_entity_decorator_js_1.createFilterDecorator)(decorator, decoratorChain, args.type);
|
|
49
|
+
return decorator;
|
|
50
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const index_js_1 = require("../../enums/index.js");
|
|
4
|
+
const constants_js_1 = require("../constants.js");
|
|
5
|
+
const index_js_2 = require("../data-type/extended-types/index.js");
|
|
6
|
+
const http_operation_js_1 = require("../http/http-operation.js");
|
|
7
|
+
const http_operation_decorator_js_1 = require("./http-operation.decorator.js");
|
|
8
|
+
const http_operation_entity_decorator_js_1 = require("./http-operation-entity.decorator.js");
|
|
9
|
+
/**
|
|
10
|
+
* HttpOperation.Entity.Update
|
|
11
|
+
*/
|
|
12
|
+
http_operation_js_1.HttpOperation.Entity.Update = function (arg0, arg1) {
|
|
13
|
+
let args;
|
|
14
|
+
if (typeof arg0 === 'object' && !arg0[constants_js_1.DATATYPE_METADATA]) {
|
|
15
|
+
args = arg0;
|
|
16
|
+
}
|
|
17
|
+
else
|
|
18
|
+
args = { ...arg1, type: arg0 };
|
|
19
|
+
/** Initialize the decorator and the chain */
|
|
20
|
+
const decoratorChain = [];
|
|
21
|
+
const decorator = (0, http_operation_decorator_js_1.HttpOperationDecoratorFactory)(decoratorChain, {
|
|
22
|
+
method: 'PATCH',
|
|
23
|
+
...args,
|
|
24
|
+
composition: 'Entity.Update',
|
|
25
|
+
requestBody: {
|
|
26
|
+
partial: 'deep',
|
|
27
|
+
immediateFetch: true,
|
|
28
|
+
allowPatchOperators: true,
|
|
29
|
+
keepKeyFields: true,
|
|
30
|
+
...args.requestBody,
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
decorator
|
|
35
|
+
.QueryParam('projection', {
|
|
36
|
+
description: 'Determines fields projection',
|
|
37
|
+
type: new index_js_2.FieldPathType({
|
|
38
|
+
dataType: args.type,
|
|
39
|
+
allowSigns: 'each',
|
|
40
|
+
}),
|
|
41
|
+
isArray: true,
|
|
42
|
+
arraySeparator: ',',
|
|
43
|
+
})
|
|
44
|
+
.RequestContent(args.requestBody?.type || args.type)
|
|
45
|
+
.Response(index_js_1.HttpStatusCode.OK, {
|
|
46
|
+
description: 'Operation is successful. Returns OperationResult with "payload" field that contains updated resource.',
|
|
47
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
48
|
+
type: args.type,
|
|
49
|
+
partial: 'deep',
|
|
50
|
+
})
|
|
51
|
+
.Response(index_js_1.HttpStatusCode.NO_CONTENT, {
|
|
52
|
+
description: 'Operation is successful but no resource found',
|
|
53
|
+
})
|
|
54
|
+
.Response(index_js_1.HttpStatusCode.UNPROCESSABLE_ENTITY, {
|
|
55
|
+
description: 'The request was well-formed but was unable to process operation due to one or many errors.',
|
|
56
|
+
contentType: index_js_1.MimeTypes.opra_response_json,
|
|
57
|
+
});
|
|
58
|
+
decoratorChain.push((operationMeta) => {
|
|
59
|
+
const compositionOptions = (operationMeta.compositionOptions =
|
|
60
|
+
operationMeta.compositionOptions || {});
|
|
61
|
+
compositionOptions.type = (0, http_operation_entity_decorator_js_1.getDataTypeName)(args.type);
|
|
62
|
+
});
|
|
63
|
+
decorator.KeyParam = (0, http_operation_entity_decorator_js_1.createKeyParamDecorator)(decorator, decoratorChain);
|
|
64
|
+
decorator.Filter = (0, http_operation_entity_decorator_js_1.createFilterDecorator)(decorator, decoratorChain, args.type);
|
|
65
|
+
return decorator;
|
|
66
|
+
};
|