@opra/mongodb 1.22.4 → 1.22.6
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/package.json +5 -5
- package/services/mongo-collection-service.d.ts +13 -1
- package/services/mongo-collection-service.js +13 -0
- package/services/mongo-nested-service.d.ts +13 -1
- package/services/mongo-nested-service.js +13 -0
- package/services/mongo-singleton-service.d.ts +13 -1
- package/services/mongo-singleton-service.js +13 -0
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/mongodb",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.6",
|
|
4
4
|
"description": "Opra MongoDB adapter package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@jsopen/objects": "^2.0.2",
|
|
9
9
|
"tslib": "^2.8.1",
|
|
10
|
-
"valgen": "^5.
|
|
10
|
+
"valgen": "^5.19.3"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@opra/common": "^1.22.
|
|
14
|
-
"@opra/core": "^1.22.
|
|
15
|
-
"@opra/http": "^1.22.
|
|
13
|
+
"@opra/common": "^1.22.6",
|
|
14
|
+
"@opra/core": "^1.22.6",
|
|
15
|
+
"@opra/http": "^1.22.6",
|
|
16
16
|
"mongodb": "^7.0.0"
|
|
17
17
|
},
|
|
18
18
|
"exports": {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ExecutionContext, ServiceBase } from '@opra/core';
|
|
1
2
|
import mongodb, { type UpdateFilter } from 'mongodb';
|
|
2
|
-
import type { PartialDTO, RequiredSome, Type } from 'ts-gems';
|
|
3
|
+
import type { Nullish, PartialDTO, RequiredSome, Type } from 'ts-gems';
|
|
3
4
|
import { MongoAdapter } from '../adapter/mongo-adapter.js';
|
|
4
5
|
import type { MongoPatchDTO } from '../types.js';
|
|
5
6
|
import { MongoEntityService } from './mongo-entity-service.js';
|
|
@@ -37,6 +38,17 @@ export declare class MongoCollectionService<T extends mongodb.Document> extends
|
|
|
37
38
|
* @constructor
|
|
38
39
|
*/
|
|
39
40
|
constructor(dataType: Type | string, options?: MongoCollectionService.Options);
|
|
41
|
+
/**
|
|
42
|
+
* Create a copy of this instance with given properties and context applied.
|
|
43
|
+
*
|
|
44
|
+
* @param {C | ServiceBase} context - The execution context or service base to associate with this instance.
|
|
45
|
+
* @param {Nullish<P>} [overwriteProperties] - An optional object containing properties to overwrite in the current instance.
|
|
46
|
+
* @param {Partial<C>} [overwriteContext] - An optional partial context to apply and potentially overwrite parts of the provided execution context.
|
|
47
|
+
* @return {this & Required<P>} The current instance with the specified properties and context applied.
|
|
48
|
+
* @template P
|
|
49
|
+
* @template C
|
|
50
|
+
*/
|
|
51
|
+
for<C extends ExecutionContext, P extends Partial<this>>(context: C | ServiceBase, overwriteProperties?: Nullish<P>, overwriteContext?: Partial<C>): this & Required<P>;
|
|
40
52
|
/**
|
|
41
53
|
* Asserts the existence of a resource with the given ID.
|
|
42
54
|
* Throws a ResourceNotFoundError if the resource does not exist.
|
|
@@ -23,6 +23,19 @@ export class MongoCollectionService extends MongoEntityService {
|
|
|
23
23
|
super(dataType, options);
|
|
24
24
|
this.defaultLimit = options?.defaultLimit || 10;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Create a copy of this instance with given properties and context applied.
|
|
28
|
+
*
|
|
29
|
+
* @param {C | ServiceBase} context - The execution context or service base to associate with this instance.
|
|
30
|
+
* @param {Nullish<P>} [overwriteProperties] - An optional object containing properties to overwrite in the current instance.
|
|
31
|
+
* @param {Partial<C>} [overwriteContext] - An optional partial context to apply and potentially overwrite parts of the provided execution context.
|
|
32
|
+
* @return {this & Required<P>} The current instance with the specified properties and context applied.
|
|
33
|
+
* @template P
|
|
34
|
+
* @template C
|
|
35
|
+
*/
|
|
36
|
+
for(context, overwriteProperties, overwriteContext) {
|
|
37
|
+
return super.for(context, overwriteProperties, overwriteContext);
|
|
38
|
+
}
|
|
26
39
|
/**
|
|
27
40
|
* Asserts the existence of a resource with the given ID.
|
|
28
41
|
* Throws a ResourceNotFoundError if the resource does not exist.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComplexType } from '@opra/common';
|
|
2
|
+
import { ExecutionContext, ServiceBase } from '@opra/core';
|
|
2
3
|
import mongodb from 'mongodb';
|
|
3
|
-
import type { DTO, PartialDTO, RequiredSome, StrictOmit, Type } from 'ts-gems';
|
|
4
|
+
import type { DTO, Nullish, PartialDTO, RequiredSome, StrictOmit, Type } from 'ts-gems';
|
|
4
5
|
import { MongoAdapter } from '../adapter/mongo-adapter.js';
|
|
5
6
|
import type { MongoPatchDTO } from '../types.js';
|
|
6
7
|
import type { MongoEntityService } from './mongo-entity-service.js';
|
|
@@ -128,6 +129,17 @@ export declare class MongoNestedService<T extends mongodb.Document> extends Mong
|
|
|
128
129
|
* @throws {NotAcceptableError} If the data type is not a ComplexType.
|
|
129
130
|
*/
|
|
130
131
|
get dataType(): ComplexType;
|
|
132
|
+
/**
|
|
133
|
+
* Create a copy of this instance with given properties and context applied.
|
|
134
|
+
*
|
|
135
|
+
* @param {C | ServiceBase} context - The execution context or service base to associate with this instance.
|
|
136
|
+
* @param {Nullish<P>} [overwriteProperties] - An optional object containing properties to overwrite in the current instance.
|
|
137
|
+
* @param {Partial<C>} [overwriteContext] - An optional partial context to apply and potentially overwrite parts of the provided execution context.
|
|
138
|
+
* @return {this & Required<P>} The current instance with the specified properties and context applied.
|
|
139
|
+
* @template P
|
|
140
|
+
* @template C
|
|
141
|
+
*/
|
|
142
|
+
for<C extends ExecutionContext, P extends Partial<this>>(context: C | ServiceBase, overwriteProperties?: Nullish<P>, overwriteContext?: Partial<C>): this & Required<P>;
|
|
131
143
|
/**
|
|
132
144
|
* Asserts whether a resource with the specified parentId and id exists.
|
|
133
145
|
* Throws a ResourceNotFoundError if the resource does not exist.
|
|
@@ -61,6 +61,19 @@ export class MongoNestedService extends MongoService {
|
|
|
61
61
|
throw new NotAcceptableError(`Data type "${t.name}" is not a ComplexType`);
|
|
62
62
|
return t;
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Create a copy of this instance with given properties and context applied.
|
|
66
|
+
*
|
|
67
|
+
* @param {C | ServiceBase} context - The execution context or service base to associate with this instance.
|
|
68
|
+
* @param {Nullish<P>} [overwriteProperties] - An optional object containing properties to overwrite in the current instance.
|
|
69
|
+
* @param {Partial<C>} [overwriteContext] - An optional partial context to apply and potentially overwrite parts of the provided execution context.
|
|
70
|
+
* @return {this & Required<P>} The current instance with the specified properties and context applied.
|
|
71
|
+
* @template P
|
|
72
|
+
* @template C
|
|
73
|
+
*/
|
|
74
|
+
for(context, overwriteProperties, overwriteContext) {
|
|
75
|
+
return super.for(context, overwriteProperties, overwriteContext);
|
|
76
|
+
}
|
|
64
77
|
/**
|
|
65
78
|
* Asserts whether a resource with the specified parentId and id exists.
|
|
66
79
|
* Throws a ResourceNotFoundError if the resource does not exist.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ExecutionContext, ServiceBase } from '@opra/core';
|
|
1
2
|
import mongodb, { type UpdateFilter } from 'mongodb';
|
|
2
|
-
import type { PartialDTO, RequiredSome, Type } from 'ts-gems';
|
|
3
|
+
import type { Nullish, PartialDTO, RequiredSome, Type } from 'ts-gems';
|
|
3
4
|
import { MongoAdapter } from '../adapter/mongo-adapter.js';
|
|
4
5
|
import type { MongoPatchDTO } from '../types.js';
|
|
5
6
|
import { MongoEntityService } from './mongo-entity-service.js';
|
|
@@ -38,6 +39,17 @@ export declare class MongoSingletonService<T extends mongodb.Document> extends M
|
|
|
38
39
|
* @constructor
|
|
39
40
|
*/
|
|
40
41
|
constructor(dataType: Type | string, options?: MongoSingletonService.Options);
|
|
42
|
+
/**
|
|
43
|
+
* Create a copy of this instance with given properties and context applied.
|
|
44
|
+
*
|
|
45
|
+
* @param {C | ServiceBase} context - The execution context or service base to associate with this instance.
|
|
46
|
+
* @param {Nullish<P>} [overwriteProperties] - An optional object containing properties to overwrite in the current instance.
|
|
47
|
+
* @param {Partial<C>} [overwriteContext] - An optional partial context to apply and potentially overwrite parts of the provided execution context.
|
|
48
|
+
* @return {this & Required<P>} The current instance with the specified properties and context applied.
|
|
49
|
+
* @template P
|
|
50
|
+
* @template C
|
|
51
|
+
*/
|
|
52
|
+
for<C extends ExecutionContext, P extends Partial<this>>(context: C | ServiceBase, overwriteProperties?: Nullish<P>, overwriteContext?: Partial<C>): this & Required<P>;
|
|
41
53
|
/**
|
|
42
54
|
* Asserts the existence of a resource based on the given options.
|
|
43
55
|
*
|
|
@@ -26,6 +26,19 @@ export class MongoSingletonService extends MongoEntityService {
|
|
|
26
26
|
super(dataType, options);
|
|
27
27
|
this._id = options?._id || new ObjectId('655608925cad472b75fc6485');
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Create a copy of this instance with given properties and context applied.
|
|
31
|
+
*
|
|
32
|
+
* @param {C | ServiceBase} context - The execution context or service base to associate with this instance.
|
|
33
|
+
* @param {Nullish<P>} [overwriteProperties] - An optional object containing properties to overwrite in the current instance.
|
|
34
|
+
* @param {Partial<C>} [overwriteContext] - An optional partial context to apply and potentially overwrite parts of the provided execution context.
|
|
35
|
+
* @return {this & Required<P>} The current instance with the specified properties and context applied.
|
|
36
|
+
* @template P
|
|
37
|
+
* @template C
|
|
38
|
+
*/
|
|
39
|
+
for(context, overwriteProperties, overwriteContext) {
|
|
40
|
+
return super.for(context, overwriteProperties, overwriteContext);
|
|
41
|
+
}
|
|
29
42
|
/**
|
|
30
43
|
* Asserts the existence of a resource based on the given options.
|
|
31
44
|
*
|