@opra/mongodb 1.1.0 → 1.1.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/cjs/mongo-adapter.js
CHANGED
|
@@ -64,6 +64,16 @@ var MongoAdapter;
|
|
|
64
64
|
};
|
|
65
65
|
return { method: 'get', key, options };
|
|
66
66
|
}
|
|
67
|
+
case 'Entity.Replace': {
|
|
68
|
+
const data = await ctx.getBody();
|
|
69
|
+
const keyParam = operation.parameters.find(p => p.keyParam) || controller.parameters.find(p => p.keyParam);
|
|
70
|
+
const key = keyParam && ctx.pathParams[String(keyParam.name)];
|
|
71
|
+
const options = {
|
|
72
|
+
projection: ctx.queryParams.projection,
|
|
73
|
+
filter: ctx.queryParams.filter,
|
|
74
|
+
};
|
|
75
|
+
return { method: 'replace', key, data, options };
|
|
76
|
+
}
|
|
67
77
|
case 'Entity.Update': {
|
|
68
78
|
const data = await ctx.getBody();
|
|
69
79
|
const keyParam = operation.parameters.find(p => p.keyParam) || controller.parameters.find(p => p.keyParam);
|
|
@@ -319,7 +319,7 @@ class MongoEntityService extends mongo_service_js_1.MongoService {
|
|
|
319
319
|
const input = command.input;
|
|
320
320
|
(0, valgen_1.isNotNullish)(input, { label: 'input' });
|
|
321
321
|
(0, valgen_1.isNotNullish)(input._id, { label: 'input._id' });
|
|
322
|
-
const inputCodec = this._getInputCodec('
|
|
322
|
+
const inputCodec = this._getInputCodec('replace');
|
|
323
323
|
const document = inputCodec(input);
|
|
324
324
|
const { options } = command;
|
|
325
325
|
const filter = mongo_adapter_js_1.MongoAdapter.prepareFilter([
|
|
@@ -336,7 +336,7 @@ class MongoEntityService extends mongo_service_js_1.MongoService {
|
|
|
336
336
|
session: options?.session ?? this.getSession(),
|
|
337
337
|
projection: mongo_adapter_js_1.MongoAdapter.prepareProjection(this.dataType, options?.projection),
|
|
338
338
|
});
|
|
339
|
-
const outputCodec = this._getOutputCodec('
|
|
339
|
+
const outputCodec = this._getOutputCodec('replace');
|
|
340
340
|
if (out)
|
|
341
341
|
return outputCodec(out);
|
|
342
342
|
}
|
package/esm/mongo-adapter.js
CHANGED
|
@@ -60,6 +60,16 @@ export var MongoAdapter;
|
|
|
60
60
|
};
|
|
61
61
|
return { method: 'get', key, options };
|
|
62
62
|
}
|
|
63
|
+
case 'Entity.Replace': {
|
|
64
|
+
const data = await ctx.getBody();
|
|
65
|
+
const keyParam = operation.parameters.find(p => p.keyParam) || controller.parameters.find(p => p.keyParam);
|
|
66
|
+
const key = keyParam && ctx.pathParams[String(keyParam.name)];
|
|
67
|
+
const options = {
|
|
68
|
+
projection: ctx.queryParams.projection,
|
|
69
|
+
filter: ctx.queryParams.filter,
|
|
70
|
+
};
|
|
71
|
+
return { method: 'replace', key, data, options };
|
|
72
|
+
}
|
|
63
73
|
case 'Entity.Update': {
|
|
64
74
|
const data = await ctx.getBody();
|
|
65
75
|
const keyParam = operation.parameters.find(p => p.keyParam) || controller.parameters.find(p => p.keyParam);
|
|
@@ -315,7 +315,7 @@ export class MongoEntityService extends MongoService {
|
|
|
315
315
|
const input = command.input;
|
|
316
316
|
isNotNullish(input, { label: 'input' });
|
|
317
317
|
isNotNullish(input._id, { label: 'input._id' });
|
|
318
|
-
const inputCodec = this._getInputCodec('
|
|
318
|
+
const inputCodec = this._getInputCodec('replace');
|
|
319
319
|
const document = inputCodec(input);
|
|
320
320
|
const { options } = command;
|
|
321
321
|
const filter = MongoAdapter.prepareFilter([
|
|
@@ -332,7 +332,7 @@ export class MongoEntityService extends MongoService {
|
|
|
332
332
|
session: options?.session ?? this.getSession(),
|
|
333
333
|
projection: MongoAdapter.prepareProjection(this.dataType, options?.projection),
|
|
334
334
|
});
|
|
335
|
-
const outputCodec = this._getOutputCodec('
|
|
335
|
+
const outputCodec = this._getOutputCodec('replace');
|
|
336
336
|
if (out)
|
|
337
337
|
return outputCodec(out);
|
|
338
338
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/mongodb",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Opra MongoDB adapter package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"valgen": "^5.12.0"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@opra/common": "^1.1.
|
|
15
|
-
"@opra/core": "^1.1.
|
|
16
|
-
"@opra/http": "^1.1.
|
|
14
|
+
"@opra/common": "^1.1.1",
|
|
15
|
+
"@opra/core": "^1.1.1",
|
|
16
|
+
"@opra/http": "^1.1.1",
|
|
17
17
|
"mongodb": ">= 6.0.0"
|
|
18
18
|
},
|
|
19
19
|
"type": "module",
|
package/types/mongo-adapter.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare namespace MongoAdapter {
|
|
|
15
15
|
const prepareProjection: typeof _prepareProjection;
|
|
16
16
|
const prepareSort: typeof _prepareSort;
|
|
17
17
|
interface TransformedRequest {
|
|
18
|
-
method: 'create' | 'delete' | 'deleteMany' | 'get' | 'findMany' | 'update' | 'updateMany';
|
|
18
|
+
method: 'create' | 'delete' | 'deleteMany' | 'get' | 'findMany' | 'replace' | 'update' | 'updateMany';
|
|
19
19
|
key?: any;
|
|
20
20
|
data?: any;
|
|
21
21
|
options: any;
|