Skip to content

Commit eca0c4e

Browse files
committed
upgrade the rest of packages
closes #155
1 parent a3dbce9 commit eca0c4e

5 files changed

Lines changed: 1655 additions & 1222 deletions

File tree

package.json

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,27 @@
1717
"node": ">= 18"
1818
},
1919
"dependencies": {
20-
"@aws-sdk/client-s3": "^3.758.0",
21-
"@aws-sdk/s3-request-presigner": "^3.758.0",
20+
"@aws-sdk/client-s3": "^3.782.0",
21+
"@aws-sdk/s3-request-presigner": "^3.782.0",
2222
"debug": "^4.4.0",
2323
"form-data": "^4.0.2",
2424
"got": "13",
25-
"into-stream": "^6.0.0",
26-
"is-stream": "^2.0.1",
27-
"p-map": "^4.0.0",
25+
"into-stream": "^8.0.1",
26+
"is-stream": "^4.0.1",
27+
"p-map": "^7.0.3",
2828
"tus-js-client": "^4.3.1",
2929
"type-fest": "^4.39.1",
3030
"zod": "^3.24.2"
3131
},
3232
"devDependencies": {
33-
"@babel/core": "^7.25.8",
34-
"@babel/eslint-parser": "^7.25.8",
35-
"@babel/eslint-plugin": "^7.25.7",
33+
"@babel/core": "^7.26.10",
34+
"@babel/eslint-parser": "^7.27.0",
35+
"@babel/eslint-plugin": "^7.27.0",
3636
"@types/debug": "^4.1.12",
3737
"@types/temp": "^0.9.4",
38-
"@typescript-eslint/eslint-plugin": "^8.26.1",
39-
"@typescript-eslint/parser": "^8.26.1",
40-
"@vitest/coverage-v8": "^2.1.3",
38+
"@typescript-eslint/eslint-plugin": "^8.29.1",
39+
"@typescript-eslint/parser": "^8.29.1",
40+
"@vitest/coverage-v8": "^3.1.1",
4141
"badge-maker": "^4.1.0",
4242
"eslint": "8",
4343
"eslint-config-prettier": "^8.10.0",
@@ -50,13 +50,13 @@
5050
"eslint-plugin-react": "^7.37.1",
5151
"eslint-plugin-react-hooks": "^4.6.2",
5252
"execa": "5.1.1",
53-
"nock": "^13.5.5",
53+
"nock": "^14.0.3",
5454
"npm-run-all": "^4.1.5",
55-
"p-retry": "^4.6.2",
56-
"prettier": "^3.3.3",
55+
"p-retry": "^6.2.1",
56+
"prettier": "^3.5.3",
5757
"temp": "^0.9.4",
58-
"typescript": "^5.7.2",
59-
"vitest": "^2.1.3"
58+
"typescript": "^5.8.3",
59+
"vitest": "^3.1.1"
6060
},
6161
"repository": {
6262
"type": "git",

src/Transloadit.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
import { createHmac, randomUUID } from 'crypto'
2-
import got, { RetryOptions, Headers, OptionsOfJSONResponseBody, Delays, RequestError, HTTPError } from 'got'
2+
import got, {
3+
RetryOptions,
4+
Headers,
5+
OptionsOfJSONResponseBody,
6+
Delays,
7+
RequestError,
8+
HTTPError,
9+
} from 'got'
310
import FormData from 'form-data'
411
import { constants, createReadStream } from 'fs'
512
import { access } from 'fs/promises'
613
import debug from 'debug'
7-
import intoStream from 'into-stream'
8-
import isStream from 'is-stream'
14+
import intoStream, { Input as IntoStreamInput } from 'into-stream'
15+
import { isReadableStream, isStream } from 'is-stream'
916
import * as assert from 'assert'
1017
import pMap from 'p-map'
1118
import type { Readable } from 'stream'
@@ -72,7 +79,7 @@ export interface CreateAssemblyOptions {
7279
[name: string]: string
7380
}
7481
uploads?: {
75-
[name: string]: Readable | intoStream.Input
82+
[name: string]: Readable | IntoStreamInput
7683
}
7784
waitForCompletion?: boolean
7885
chunkSize?: number
@@ -247,13 +254,13 @@ export class Transloadit {
247254
// Convert uploads to streams
248255
const streamsMap = Object.fromEntries(
249256
Object.entries(uploads).map(([label, value]) => {
250-
const isReadable = isStream.readable(value)
257+
const isReadable = isReadableStream(value)
251258
if (!isReadable && isStream(value)) {
252259
// https://github.com/transloadit/node-sdk/issues/92
253260
throw new Error(`Upload named "${label}" is not a Readable stream`)
254261
}
255262

256-
return [label, isStream.readable(value) ? value : intoStream(value)]
263+
return [label, isReadableStream(value) ? value : intoStream(value)]
257264
})
258265
)
259266

test/unit/mock-http.test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,6 @@ describe('Mocked API tests', () => {
137137
),
138138
expect.stringMatching(` at .+\\/test\\/unit\\/mock-http\\.test\\.ts:\\d+:\\d+`),
139139
expect.stringMatching(` at .+`),
140-
expect.stringMatching(` at .+`),
141-
expect.stringMatching(` at .+`),
142-
expect.stringMatching(` at .+`),
143-
expect.stringMatching(` at .+`),
144-
expect.stringMatching(` at .+`),
145140
expect.stringMatching(` code: 'INVALID_FILE_META_DATA',`),
146141
expect.stringMatching(` rawMessage: 'Invalid file metadata',`),
147142
expect.stringMatching(

test/unit/test-transloadit-client.test.ts

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Readable } from 'stream'
1+
import { PassThrough, Readable } from 'stream'
22
import FormData from 'form-data'
33
import got, { CancelableRequest } from 'got'
44

@@ -131,22 +131,14 @@ describe('Transloadit', () => {
131131
const client = new Transloadit({ authKey: 'foo_key', authSecret: 'foo_secret' })
132132

133133
const name = 'foo_name'
134-
// eslint-disable-next-line no-use-before-define
135-
const pause = vi.fn(() => mockStream)
136-
const mockStream = {
137-
pause,
138-
pipe: () => undefined,
139-
_read: () => undefined,
140-
_readableState: {},
141-
on: () => mockStream,
142-
readable: true,
143-
} as Partial<Readable> as Readable
134+
const mockStream = new PassThrough()
135+
const pauseSpy = vi.spyOn(mockStream, 'pause')
144136

145137
mockRemoteJson(client)
146138

147139
await client.createAssembly({ uploads: { [name]: mockStream } })
148140

149-
expect(pause).toHaveBeenCalled()
141+
expect(pauseSpy).toHaveBeenCalled()
150142
})
151143
})
152144

@@ -274,7 +266,9 @@ describe('Transloadit', () => {
274266

275267
await client.createAssembly()
276268

277-
expect(spy).toBeCalledWith(expect.objectContaining({ timeout: { request: 24 * 60 * 60 * 1000 } }))
269+
expect(spy).toBeCalledWith(
270+
expect.objectContaining({ timeout: { request: 24 * 60 * 60 * 1000 } })
271+
)
278272
})
279273

280274
describe('_calcSignature', () => {

0 commit comments

Comments
 (0)