@opra/core 1.0.0-alpha.4 → 1.0.0-alpha.5
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/http/http-context.js
CHANGED
|
@@ -104,6 +104,7 @@ class HttpContext extends execution_context_js_1.ExecutionContext {
|
|
|
104
104
|
mediaType.type?.generateCodec('decode', {
|
|
105
105
|
partial: operation.requestBody?.partial,
|
|
106
106
|
projection: '*',
|
|
107
|
+
ignoreReadonlyFields: true,
|
|
107
108
|
}) || valgen_1.vg.isAny();
|
|
108
109
|
this.adapter[constants_js_1.kAssetCache].set(mediaType, 'decode', decode);
|
|
109
110
|
}
|
|
@@ -123,7 +123,7 @@ class HttpHandler {
|
|
|
123
123
|
const getDecoder = (prm) => {
|
|
124
124
|
let decode = this[constants_js_1.kAssetCache].get(prm, 'decode');
|
|
125
125
|
if (!decode) {
|
|
126
|
-
decode = prm.type?.generateCodec('decode') || valgen_1.vg.isAny();
|
|
126
|
+
decode = prm.type?.generateCodec('decode', { ignoreReadonlyFields: true }) || valgen_1.vg.isAny();
|
|
127
127
|
this[constants_js_1.kAssetCache].set(prm, 'decode', decode);
|
|
128
128
|
}
|
|
129
129
|
return decode;
|
|
@@ -283,7 +283,7 @@ class HttpHandler {
|
|
|
283
283
|
const operationResultType = document.node.getDataType(common_1.OperationResult);
|
|
284
284
|
let operationResultEncoder = this[constants_js_1.kAssetCache].get(operationResultType, 'encode');
|
|
285
285
|
if (!operationResultEncoder) {
|
|
286
|
-
operationResultEncoder = operationResultType.generateCodec('encode');
|
|
286
|
+
operationResultEncoder = operationResultType.generateCodec('encode', { ignoreWriteonlyFields: true });
|
|
287
287
|
this[constants_js_1.kAssetCache].set(operationResultType, 'encode', operationResultEncoder);
|
|
288
288
|
}
|
|
289
289
|
/** Validate response */
|
|
@@ -295,6 +295,7 @@ class HttpHandler {
|
|
|
295
295
|
encode = operationResponse.type.generateCodec('encode', {
|
|
296
296
|
partial: operationResponse.partial,
|
|
297
297
|
projection: '*',
|
|
298
|
+
ignoreWriteonlyFields: true,
|
|
298
299
|
});
|
|
299
300
|
if (operationResponse) {
|
|
300
301
|
if (operationResponse.isArray)
|
|
@@ -545,7 +546,7 @@ class HttpHandler {
|
|
|
545
546
|
const dt = document.node.getComplexType('OperationResult');
|
|
546
547
|
let encode = this[constants_js_1.kAssetCache].get(dt, 'encode');
|
|
547
548
|
if (!encode) {
|
|
548
|
-
encode = dt.generateCodec('encode');
|
|
549
|
+
encode = dt.generateCodec('encode', { ignoreWriteonlyFields: true });
|
|
549
550
|
this[constants_js_1.kAssetCache].set(dt, 'encode', encode);
|
|
550
551
|
}
|
|
551
552
|
const { i18n } = this.adapter;
|
package/esm/http/http-context.js
CHANGED
|
@@ -100,6 +100,7 @@ export class HttpContext extends ExecutionContext {
|
|
|
100
100
|
mediaType.type?.generateCodec('decode', {
|
|
101
101
|
partial: operation.requestBody?.partial,
|
|
102
102
|
projection: '*',
|
|
103
|
+
ignoreReadonlyFields: true,
|
|
103
104
|
}) || vg.isAny();
|
|
104
105
|
this.adapter[kAssetCache].set(mediaType, 'decode', decode);
|
|
105
106
|
}
|
|
@@ -119,7 +119,7 @@ export class HttpHandler {
|
|
|
119
119
|
const getDecoder = (prm) => {
|
|
120
120
|
let decode = this[kAssetCache].get(prm, 'decode');
|
|
121
121
|
if (!decode) {
|
|
122
|
-
decode = prm.type?.generateCodec('decode') || vg.isAny();
|
|
122
|
+
decode = prm.type?.generateCodec('decode', { ignoreReadonlyFields: true }) || vg.isAny();
|
|
123
123
|
this[kAssetCache].set(prm, 'decode', decode);
|
|
124
124
|
}
|
|
125
125
|
return decode;
|
|
@@ -279,7 +279,7 @@ export class HttpHandler {
|
|
|
279
279
|
const operationResultType = document.node.getDataType(OperationResult);
|
|
280
280
|
let operationResultEncoder = this[kAssetCache].get(operationResultType, 'encode');
|
|
281
281
|
if (!operationResultEncoder) {
|
|
282
|
-
operationResultEncoder = operationResultType.generateCodec('encode');
|
|
282
|
+
operationResultEncoder = operationResultType.generateCodec('encode', { ignoreWriteonlyFields: true });
|
|
283
283
|
this[kAssetCache].set(operationResultType, 'encode', operationResultEncoder);
|
|
284
284
|
}
|
|
285
285
|
/** Validate response */
|
|
@@ -291,6 +291,7 @@ export class HttpHandler {
|
|
|
291
291
|
encode = operationResponse.type.generateCodec('encode', {
|
|
292
292
|
partial: operationResponse.partial,
|
|
293
293
|
projection: '*',
|
|
294
|
+
ignoreWriteonlyFields: true,
|
|
294
295
|
});
|
|
295
296
|
if (operationResponse) {
|
|
296
297
|
if (operationResponse.isArray)
|
|
@@ -541,7 +542,7 @@ export class HttpHandler {
|
|
|
541
542
|
const dt = document.node.getComplexType('OperationResult');
|
|
542
543
|
let encode = this[kAssetCache].get(dt, 'encode');
|
|
543
544
|
if (!encode) {
|
|
544
|
-
encode = dt.generateCodec('encode');
|
|
545
|
+
encode = dt.generateCodec('encode', { ignoreWriteonlyFields: true });
|
|
545
546
|
this[kAssetCache].set(dt, 'encode', encode);
|
|
546
547
|
}
|
|
547
548
|
const { i18n } = this.adapter;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"BAD_REQUEST": "Bad request",
|
|
3
|
+
"FAILED_DEPENDENCY": "The request failed due to failure of a previous request",
|
|
4
|
+
"FORBIDDEN": "You are not authorized to perform this action",
|
|
5
|
+
"INTERNAL_SERVER_ERROR": "Internal server error",
|
|
6
|
+
"METHOD_NOT_ALLOWED": "Method not allowed",
|
|
7
|
+
"NOT_ACCEPTABLE": "Not acceptable",
|
|
8
|
+
"NOT_FOUND": "Not found",
|
|
9
|
+
"UNAUTHORIZED": "You have not been authenticated to perform this action",
|
|
10
|
+
"UNPROCESSABLE_ENTITY": "Unprocessable entity",
|
|
11
|
+
"REQUEST_VALIDATION": "Request validation failed",
|
|
12
|
+
"RESPONSE_VALIDATION": "Response validation failed",
|
|
13
|
+
"RESOURCE_NOT_AVAILABLE": "Resource is not available or you dont have access",
|
|
14
|
+
"RESOURCE_CONFLICT": "There is already an other {{resource}} resource with same field values ({{fields}})",
|
|
15
|
+
"OPERATION_FORBIDDEN": "The {{resource}} resource does not accept '{{operation}}' operations",
|
|
16
|
+
"ACTION_NOT_FOUND": "The {{resource}} resource doesn't have an action named '{{action}}'",
|
|
17
|
+
"UNKNOWN_FIELD": "Unknown field '{{field}}'",
|
|
18
|
+
"UNACCEPTED_SORT_FIELD": "Field '{{field}}' is not available for sort operation",
|
|
19
|
+
"UNACCEPTED_FILTER_FIELD": "Field '{{field}}' is not available for filter operation",
|
|
20
|
+
"UNACCEPTED_FILTER_OPERATION": "'{{operation}}' for field '{{field}}' is not available for filter operation"
|
|
21
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/core",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.5",
|
|
4
4
|
"description": "Opra schema package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@browsery/type-is": "^1.6.18-r2",
|
|
34
|
-
"@opra/common": "^1.0.0-alpha.
|
|
34
|
+
"@opra/common": "^1.0.0-alpha.5",
|
|
35
35
|
"@types/formidable": "^3.4.5",
|
|
36
36
|
"accepts": "^1.3.8",
|
|
37
37
|
"base64-stream": "^1.0.0",
|