albatross 5.0.0 → 6.0.0
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/index.d.ts +1 -1
- package/lib/albatross.js +2 -6
- package/lib/collection.js +1 -1
- package/lib/grid.js +1 -1
- package/package.json +9 -9
package/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ type DeepReadonly<T> = T extends Date | RegExp | string | number | boolean | big
|
|
|
6
6
|
? T
|
|
7
7
|
: T extends {}
|
|
8
8
|
? { readonly [K in keyof T]: DeepReadonly<T[K]> }
|
|
9
|
-
:
|
|
9
|
+
: T
|
|
10
10
|
|
|
11
11
|
type SpecificProjection<T, TProjection> = Omit<T, 'projection'> & { projection: TProjection }
|
|
12
12
|
type WithoutProjection<T> = T & { fields?: undefined, projection?: undefined }
|
package/lib/albatross.js
CHANGED
|
@@ -72,17 +72,13 @@ export default class Albatross {
|
|
|
72
72
|
async transaction (fn) {
|
|
73
73
|
const session = this[kClient].startSession()
|
|
74
74
|
|
|
75
|
-
let result
|
|
76
|
-
|
|
77
75
|
try {
|
|
78
|
-
await session.withTransaction(async (...args) => {
|
|
79
|
-
|
|
76
|
+
return await session.withTransaction(async (...args) => {
|
|
77
|
+
return await fn(...args)
|
|
80
78
|
})
|
|
81
79
|
} finally {
|
|
82
80
|
session.endSession()
|
|
83
81
|
}
|
|
84
|
-
|
|
85
|
-
return result
|
|
86
82
|
}
|
|
87
83
|
|
|
88
84
|
async close (force) {
|
package/lib/collection.js
CHANGED
|
@@ -127,7 +127,7 @@ export default class Collection {
|
|
|
127
127
|
this[kDebug]('findOneAndUpdate(%o, %o)', filter, update)
|
|
128
128
|
const res = await db.collection(this.name).findOneAndUpdate(filter, update, opts)
|
|
129
129
|
this[kDebug]('reply OK')
|
|
130
|
-
return res
|
|
130
|
+
return res
|
|
131
131
|
} catch (err) {
|
|
132
132
|
this[kDebug]('reply ERR')
|
|
133
133
|
throw err
|
package/lib/grid.js
CHANGED
|
@@ -37,7 +37,7 @@ export default class Grid {
|
|
|
37
37
|
const upload = bucket.openUploadStream(opts.filename || '', opts)
|
|
38
38
|
|
|
39
39
|
upload.on('error', reject)
|
|
40
|
-
upload.on('finish', (
|
|
40
|
+
upload.on('finish', () => resolve(fileInfo(upload.gridFSFile)))
|
|
41
41
|
|
|
42
42
|
stream.pipe(upload)
|
|
43
43
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "albatross",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "LinusU/node-albatross",
|
|
6
6
|
"type": "module",
|
|
@@ -15,19 +15,19 @@
|
|
|
15
15
|
"tsc": "tsc --allowSyntheticDefaultImports --noEmit --allowJs --checkJs index.d.ts test/*.js"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"bson": "^
|
|
19
|
-
"debug": "^4.4.
|
|
20
|
-
"mongodb": "^
|
|
18
|
+
"bson": "^6.10.4",
|
|
19
|
+
"debug": "^4.4.3",
|
|
20
|
+
"mongodb": "^6.21.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/mocha": "^10.0.10",
|
|
24
|
-
"@types/node": "^16.
|
|
25
|
-
"get-stream": "^
|
|
24
|
+
"@types/node": "^16.18.126",
|
|
25
|
+
"get-stream": "^7.0.1",
|
|
26
26
|
"mocha": "^10.8.2",
|
|
27
|
-
"standard": "^17.
|
|
28
|
-
"typescript": "^5.
|
|
27
|
+
"standard": "^17.1.2",
|
|
28
|
+
"typescript": "^5.9.3"
|
|
29
29
|
},
|
|
30
30
|
"engines": {
|
|
31
|
-
"node": "^
|
|
31
|
+
"node": "^16.20.1 || >=18.0.0"
|
|
32
32
|
}
|
|
33
33
|
}
|