@opra/mongodb 1.0.0-alpha.29 → 1.0.0-alpha.30

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.
@@ -16,7 +16,7 @@ var MongoAdapter;
16
16
  MongoAdapter.prepareSort = prepare_sort_js_1.default;
17
17
  async function parseRequest(context) {
18
18
  const { operation } = context;
19
- if (operation.composition?.startsWith('Entity.') && operation.compositionOptions?.type) {
19
+ if (operation?.composition?.startsWith('Entity.') && operation.compositionOptions?.type) {
20
20
  const controller = operation.owner;
21
21
  switch (operation.composition) {
22
22
  case 'Entity.Create': {
@@ -18,7 +18,7 @@ class MongoCollectionService extends mongo_entity_service_js_1.MongoEntityServic
18
18
  */
19
19
  constructor(dataType, options) {
20
20
  super(dataType, options);
21
- this.defaultLimit = this.defaultLimit || options?.defaultLimit || 10;
21
+ this.defaultLimit = options?.defaultLimit || 10;
22
22
  }
23
23
  /**
24
24
  * Asserts the existence of a resource with the given ID.
@@ -21,7 +21,7 @@ class MongoSingletonService extends mongo_entity_service_js_1.MongoEntityService
21
21
  */
22
22
  constructor(dataType, options) {
23
23
  super(dataType, options);
24
- this._id = this._id || options?._id || new mongodb_1.ObjectId('655608925cad472b75fc6485');
24
+ this._id = options?._id || new mongodb_1.ObjectId('655608925cad472b75fc6485');
25
25
  }
26
26
  /**
27
27
  * Asserts the existence of a resource based on the given options.
@@ -12,7 +12,7 @@ export var MongoAdapter;
12
12
  MongoAdapter.prepareSort = _prepareSort;
13
13
  async function parseRequest(context) {
14
14
  const { operation } = context;
15
- if (operation.composition?.startsWith('Entity.') && operation.compositionOptions?.type) {
15
+ if (operation?.composition?.startsWith('Entity.') && operation.compositionOptions?.type) {
16
16
  const controller = operation.owner;
17
17
  switch (operation.composition) {
18
18
  case 'Entity.Create': {
@@ -15,7 +15,7 @@ export class MongoCollectionService extends MongoEntityService {
15
15
  */
16
16
  constructor(dataType, options) {
17
17
  super(dataType, options);
18
- this.defaultLimit = this.defaultLimit || options?.defaultLimit || 10;
18
+ this.defaultLimit = options?.defaultLimit || 10;
19
19
  }
20
20
  /**
21
21
  * Asserts the existence of a resource with the given ID.
@@ -18,7 +18,7 @@ export class MongoSingletonService extends MongoEntityService {
18
18
  */
19
19
  constructor(dataType, options) {
20
20
  super(dataType, options);
21
- this._id = this._id || options?._id || new ObjectId('655608925cad472b75fc6485');
21
+ this._id = options?._id || new ObjectId('655608925cad472b75fc6485');
22
22
  }
23
23
  /**
24
24
  * Asserts the existence of a resource based on the given options.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/mongodb",
3
- "version": "1.0.0-alpha.29",
3
+ "version": "1.0.0-alpha.30",
4
4
  "description": "Opra MongoDB adapter package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -29,6 +29,7 @@
29
29
  "dependencies": {
30
30
  "lodash.omit": "^4.5.0",
31
31
  "putil-isplainobject": "^1.1.5",
32
+ "tslib": "^2.6.3",
32
33
  "valgen": "^5.6.0"
33
34
  },
34
35
  "devDependencies": {
@@ -37,8 +38,8 @@
37
38
  "ts-gems": "^3.4.0"
38
39
  },
39
40
  "peerDependencies": {
40
- "@opra/common": "^1.0.0-alpha.29",
41
- "@opra/core": "^1.0.0-alpha.29",
41
+ "@opra/common": "^1.0.0-alpha.30",
42
+ "@opra/core": "^1.0.0-alpha.30",
42
43
  "mongodb": ">= 6.0.0"
43
44
  },
44
45
  "type": "module",
@@ -150,7 +150,7 @@ export interface MongoService {
150
150
  */
151
151
  export declare class MongoService<T extends mongodb.Document = mongodb.Document> extends ServiceBase {
152
152
  protected _dataType_: Type | string;
153
- protected _dataType: ComplexType;
153
+ protected _dataType?: ComplexType;
154
154
  protected _inputCodecs: Record<string, IsObject.Validator<T>>;
155
155
  protected _outputCodecs: Record<string, IsObject.Validator<T>>;
156
156
  /**