@nxtedition/lib 21.6.3 → 21.7.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/couch.js +1 -1
- package/merge-ranges.js +7 -1
- package/package.json +1 -1
- package/s3.js +10 -11
package/couch.js
CHANGED
|
@@ -119,7 +119,7 @@ export function makeCouch(opts) {
|
|
|
119
119
|
* @param {string} [options.since=null] - The sequence number to start from.
|
|
120
120
|
* @param {number} [options.highWaterMark=128 * 1024] - Buffering.
|
|
121
121
|
* @param {object} [options.selector=null] - The selector to filter changes.
|
|
122
|
-
* @
|
|
122
|
+
* @return {AsyncGenerator<Array<{ id: string, seq?: string, doc?: Object, deleted?: boolean, changes: Array<{ rev: string }>}> & { lastSeq: string | null | 0 }}
|
|
123
123
|
*/
|
|
124
124
|
async function* changes({ client = defaultClient, signal = null, logger, ...options } = {}) {
|
|
125
125
|
const params = {}
|
package/merge-ranges.js
CHANGED
|
@@ -29,7 +29,13 @@ export default function mergeRanges(ranges) {
|
|
|
29
29
|
const range = ranges[n]
|
|
30
30
|
const top = stack[stack.length - 1]
|
|
31
31
|
|
|
32
|
-
if (
|
|
32
|
+
if (
|
|
33
|
+
!Array.isArray(range) ||
|
|
34
|
+
range.length !== 2 ||
|
|
35
|
+
!Number.isFinite(range[0]) ||
|
|
36
|
+
!Number.isFinite(range[1]) ||
|
|
37
|
+
range[0] > range[1]
|
|
38
|
+
) {
|
|
33
39
|
continue
|
|
34
40
|
}
|
|
35
41
|
|
package/package.json
CHANGED
package/s3.js
CHANGED
|
@@ -10,13 +10,13 @@ const QUEUE = new PQueue({ concurrency: 8 })
|
|
|
10
10
|
const MD5_HEX_EXPR = /^[A-F0-9]{32}$/i
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
13
|
+
* @import { Dispatcher } from 'undici'
|
|
14
|
+
* @import { S3ClientConfig, CreateMultipartUploadRequest } from '@aws-sdk/client-s3'
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
export class S3Client extends AWS.S3Client {
|
|
18
18
|
/**
|
|
19
|
-
* @param {S3ClientConfig} config
|
|
19
|
+
* @param {S3ClientConfig & { dispatcher?: Dispatcher }} config
|
|
20
20
|
*/
|
|
21
21
|
constructor(config) {
|
|
22
22
|
const { dispatcher, ...options } = config
|
|
@@ -79,12 +79,11 @@ class UndiciRequestHandler extends NodeHttpHandler {
|
|
|
79
79
|
* @param {Object} options.logger - The logger to use.
|
|
80
80
|
* @param {number} [options.partSize=16e6] - The size of each part in the multipart upload.
|
|
81
81
|
* @param {PQueue} [options.queue] - The queue to use for part uploads.
|
|
82
|
-
* @param {
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* @param {number} [options.params.ContentLength] - The length of the object.
|
|
82
|
+
* @param {CreateMultipartUploadRequest & {
|
|
83
|
+
* Body: Buffer | NodeJS.ReadStream,
|
|
84
|
+
* ContentMD5?: string,
|
|
85
|
+
* ContentLength?: number,
|
|
86
|
+
* }} options.params - The parameters for the upload.
|
|
88
87
|
* @returns {Promise<Object>} The result of the upload.
|
|
89
88
|
*/
|
|
90
89
|
export async function upload({
|
|
@@ -107,7 +106,7 @@ export async function upload({
|
|
|
107
106
|
throw new Error('Invalid params')
|
|
108
107
|
}
|
|
109
108
|
|
|
110
|
-
const { Body, Key, Bucket, ContentMD5, ContentLength } = params
|
|
109
|
+
const { Body, Key, Bucket, ContentMD5, ContentLength, ...createMultipartParams } = params
|
|
111
110
|
|
|
112
111
|
const size = ContentLength != null ? Number(ContentLength) : null
|
|
113
112
|
|
|
@@ -144,7 +143,7 @@ export async function upload({
|
|
|
144
143
|
}
|
|
145
144
|
|
|
146
145
|
const multipartUploadOutput = await s3.send(
|
|
147
|
-
new AWS.CreateMultipartUploadCommand({ Bucket, Key }),
|
|
146
|
+
new AWS.CreateMultipartUploadCommand({ ...createMultipartParams, Bucket, Key }),
|
|
148
147
|
{ abortSignal: uploader.signal },
|
|
149
148
|
)
|
|
150
149
|
uploader.signal.throwIfAborted()
|