dependency updates
Co-authored-by: Chris Eager <chris@signal.org>
This commit is contained in:
parent
c8a52a32b3
commit
54fda1be44
@ -1,34 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"overrides": [
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"semi": [2, "always"],
|
||||
"quotes": ["error", "single"],
|
||||
"no-unused-vars": "off",
|
||||
"prefer-const": ["error", {"destructuring": "all"}],
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
"argsIgnorePattern": "^_",
|
||||
"varsIgnorePattern": "^_",
|
||||
"caughtErrorsIgnorePattern": "^_"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -7,10 +7,10 @@
|
||||
import {afterAll, beforeAll, describe, expect, it, test} from 'vitest';
|
||||
import * as tus from 'tus-js-client';
|
||||
import {UploadOptions} from 'tus-js-client';
|
||||
import {unstable_dev, UnstableDevWorker} from 'wrangler';
|
||||
import {unstable_dev, Unstable_DevWorker} from 'wrangler';
|
||||
import {attachmentsPath, backupHeaderFor, backupsPath, headerFor, secret} from '../src/testutil';
|
||||
|
||||
let worker: UnstableDevWorker;
|
||||
let worker: Unstable_DevWorker;
|
||||
|
||||
beforeAll(async () => {
|
||||
worker = await unstable_dev('src/index.ts', {
|
||||
@ -31,7 +31,7 @@ async function tusClientUpload(name: string, pathPrefix: string, authHeader: str
|
||||
metadata: {'filename': name},
|
||||
headers: {'Authorization': authHeader},
|
||||
onError: reject,
|
||||
onSuccess: resolve,
|
||||
onSuccess: _payload => resolve(),
|
||||
uploadSize: blob.length,
|
||||
...options
|
||||
});
|
||||
|
||||
50
eslint.config.mjs
Normal file
50
eslint.config.mjs
Normal file
@ -0,0 +1,50 @@
|
||||
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
||||
import globals from "globals";
|
||||
import tsParser from "@typescript-eslint/parser";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import js from "@eslint/js";
|
||||
import { FlatCompat } from "@eslint/eslintrc";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
recommendedConfig: js.configs.recommended,
|
||||
allConfig: js.configs.all
|
||||
});
|
||||
|
||||
export default [
|
||||
...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
|
||||
{
|
||||
plugins: {
|
||||
"@typescript-eslint": typescriptEslint,
|
||||
},
|
||||
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.browser,
|
||||
},
|
||||
|
||||
parser: tsParser,
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module",
|
||||
},
|
||||
|
||||
rules: {
|
||||
semi: [2, "always"],
|
||||
quotes: ["error", "single"],
|
||||
"no-unused-vars": "off",
|
||||
|
||||
"prefer-const": ["error", {
|
||||
destructuring: "all",
|
||||
}],
|
||||
|
||||
"@typescript-eslint/no-unused-vars": ["warn", {
|
||||
argsIgnorePattern: "^_",
|
||||
varsIgnorePattern: "^_",
|
||||
caughtErrorsIgnorePattern: "^_",
|
||||
}],
|
||||
},
|
||||
},
|
||||
];
|
||||
5895
package-lock.json
generated
5895
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@ -3,14 +3,14 @@
|
||||
"version": "0.6.0",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@cloudflare/vitest-pool-workers": "^0.4.1",
|
||||
"@cloudflare/vitest-pool-workers": "^0.5.41",
|
||||
"@cloudflare/workers-types": "^4.20230419.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.12.0",
|
||||
"@typescript-eslint/parser": "^7.12.0",
|
||||
"eslint": "^8.40.0",
|
||||
"@typescript-eslint/eslint-plugin": "^8.19.1",
|
||||
"@typescript-eslint/parser": "^8.19.1",
|
||||
"eslint": "^9.17.0",
|
||||
"tus-js-client": "^4.1.0",
|
||||
"typescript": "^5.0.4",
|
||||
"vitest": "1.5.0",
|
||||
"vitest": "2.1.8",
|
||||
"vitest-environment-miniflare": "^2.14.0",
|
||||
"wrangler": "^3.1.2"
|
||||
},
|
||||
|
||||
@ -213,7 +213,6 @@ describe('Tus', () => {
|
||||
return await SELF.fetch(`http://localhost/upload/${attachmentsPath}/${name}`, {
|
||||
method: 'PATCH',
|
||||
headers: h,
|
||||
duplex: 'half',
|
||||
body: body
|
||||
});
|
||||
}
|
||||
@ -453,7 +452,7 @@ describe('Tus', () => {
|
||||
expect(response.headers.get('content-range')).toEqual(`bytes ${body.length - 99}-${body.length - 1}/${body.length}`);
|
||||
});
|
||||
|
||||
test.each([1, 2, 17])('handles reading chunks of length=%s', async (chunkSize: number) => {
|
||||
test.each([1, 2, 17])('handles reading chunks of length=%s', {timeout: 60000}, async (chunkSize: number) => {
|
||||
const bytes = new Uint8Array(100);
|
||||
crypto.getRandomValues(bytes);
|
||||
const body = Buffer.from(bytes).toString('base64');
|
||||
@ -468,7 +467,7 @@ describe('Tus', () => {
|
||||
actual += await response.text();
|
||||
}
|
||||
expect(actual).toEqual(body);
|
||||
}, {timeout: 60000});
|
||||
});
|
||||
|
||||
test.each(
|
||||
[0, 1, PART_SIZE - 1, PART_SIZE, PART_SIZE + 1]
|
||||
@ -517,7 +516,7 @@ describe('Tus', () => {
|
||||
// parameterized test of boundary conditions
|
||||
test.each(
|
||||
[0, 1, PART_SIZE - 1, PART_SIZE, PART_SIZE + 1, PART_SIZE * 10 + 1]
|
||||
)('upload(%s bytes)',
|
||||
)('upload(%s bytes)', {timeout: 60000},
|
||||
async (uploadSize) => {
|
||||
const create = await createRequest({uploadLength: uploadSize});
|
||||
expect(create.status).toBe(201);
|
||||
@ -532,7 +531,7 @@ describe('Tus', () => {
|
||||
|
||||
const expectedEtag = await s3Etag(body(uploadSize, {pattern: 'test'}));
|
||||
expect(get.headers.get('etag')).toBe(expectedEtag);
|
||||
}, {timeout: 60000});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@ -558,7 +557,6 @@ describe('completed object read operations', () => {
|
||||
'Content-Type': 'application/offset+octet-stream',
|
||||
[X_SIGNAL_CHECKSUM_SHA256]: digest
|
||||
},
|
||||
duplex: 'half',
|
||||
body: body(4, {pattern: 'test'})
|
||||
});
|
||||
const resp = await SELF.fetch(`http://localhost/${backupsPath}/subdir/a/b`, {
|
||||
|
||||
@ -125,7 +125,7 @@ export default {
|
||||
};
|
||||
|
||||
|
||||
async function getHandler(request: IRequest, env: Env, ctx: ExecutionContext): Promise<Response> {
|
||||
async function getHandler(request: IRequest, _env: Env, ctx: ExecutionContext): Promise<Response> {
|
||||
const requestId = request.key;
|
||||
|
||||
const bucket: R2Bucket = request.namespace.bucket;
|
||||
@ -172,7 +172,7 @@ async function getHandler(request: IRequest, env: Env, ctx: ExecutionContext): P
|
||||
}
|
||||
}
|
||||
|
||||
async function headHandler(request: IRequest, env: Env, ctx: ExecutionContext): Promise<Response> {
|
||||
async function headHandler(request: IRequest, _env: Env, _ctx: ExecutionContext): Promise<Response> {
|
||||
const requestId = request.key;
|
||||
|
||||
const bucket: R2Bucket = request.namespace.bucket;
|
||||
@ -246,7 +246,7 @@ async function optionsHandler(_request: IRequest, _env: Env): Promise<Response>
|
||||
}
|
||||
|
||||
// TUS protocol requests (POST/PATCH/HEAD) that get forwarded to a durable object
|
||||
async function uploadHandler(request: IRequest, env: Env): Promise<Response> {
|
||||
async function uploadHandler(request: IRequest, _env: Env): Promise<Response> {
|
||||
const requestId: string = request.key;
|
||||
|
||||
// The id of the DurableObject is derived from the authenticated upload id provided by the requester
|
||||
|
||||
@ -11,7 +11,7 @@ describe('uploadHandler', () => {
|
||||
const handler = env.ATTACHMENT_UPLOAD_HANDLER;
|
||||
|
||||
async function expectStateEmpty(stub: DurableObjectStub): Promise<void> {
|
||||
await runInDurableObject(stub, async (instance, state) => {
|
||||
await runInDurableObject(stub, async (_instance, state) => {
|
||||
expect((await state.storage.list()).size).toBe(0);
|
||||
});
|
||||
}
|
||||
@ -27,7 +27,7 @@ describe('uploadHandler', () => {
|
||||
'Upload-Length': '10'
|
||||
}
|
||||
});
|
||||
await runInDurableObject(stub, async (instance, state) => {
|
||||
await runInDurableObject(stub, async (_instance, state) => {
|
||||
expect(await state.storage.get('upload-info')).toMatchObject({uploadLength: 10});
|
||||
expect(await state.storage.get('upload-offset')).toBe(0);
|
||||
});
|
||||
@ -38,7 +38,7 @@ describe('uploadHandler', () => {
|
||||
it('cleans after unrecoverable failure', async () => {
|
||||
const id = handler.idFromName('test123');
|
||||
const stub = handler.get(id);
|
||||
await runInDurableObject(stub, async (instance, state) => {
|
||||
await runInDurableObject(stub, async (_instance, state) => {
|
||||
const storage = state.storage;
|
||||
|
||||
// invalid state: temp object should be length 5, is only length 1
|
||||
@ -61,7 +61,7 @@ describe('uploadHandler', () => {
|
||||
it('cleans after a bad multipart tx', async () => {
|
||||
const id = handler.idFromName('test123');
|
||||
const stub = handler.get(id);
|
||||
await runInDurableObject(stub, async (instance, state) => {
|
||||
await runInDurableObject(stub, async (_instance, state) => {
|
||||
const storage = state.storage;
|
||||
|
||||
// invalid state: we claim to have a part written but the transaction won't exist
|
||||
@ -91,7 +91,7 @@ describe('uploadHandler', () => {
|
||||
const tempkey = `temporary/${id.toString()}`;
|
||||
await r2.put(tempkey, '12345');
|
||||
const stub = handler.get(id);
|
||||
await runInDurableObject(stub, async (instance, state) => {
|
||||
await runInDurableObject(stub, async (_instance, state) => {
|
||||
const storage = state.storage;
|
||||
await storage.put('upload-info', {uploadLength: 10});
|
||||
await storage.put('upload-offset', 5);
|
||||
@ -125,7 +125,7 @@ describe('uploadHandler', () => {
|
||||
const part1 = await mp.uploadPart(1, partBody);
|
||||
await r2.put(tempkey, '12345');
|
||||
|
||||
runInDurableObject(stub, async (instance, state) => {
|
||||
await runInDurableObject(stub, async (_instance, state) => {
|
||||
const storage = state.storage;
|
||||
await storage.put('upload-offset', partBody.length + 5);
|
||||
await storage.put('upload-info', {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user