Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .eslintrc.json

This file was deleted.

19 changes: 19 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';
import globals from "globals";

export default tseslint.config(
{
ignores: ["**/types/", "**/dist/", "**/lib/"]
},
eslint.configs.recommended,
tseslint.configs.recommended,
{
files: ["examples/*.js"],
languageOptions: {
globals: {
...globals.node,
},
},
}
);
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,17 @@
},
"homepage": "https://github.com/cloudamqp/amqp-client.js#readme",
"devDependencies": {
"@types/node": "^20.5.3",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.1",
"@vitest/browser": "^0.34.2",
"@vitest/coverage-v8": "^0.34.2",
"eslint": "^8.47.0",
"playwright": "^1.37.1",
"rollup": "^3.28.1",
"rollup-plugin-sourcemaps": "^0.6.3",
"ts-node": "^10.9.1",
"typedoc": "^0.24.8",
"typescript": "^5.1.6",
"vitest": "^0.34.2"
"@types/node": "*",
"@vitest/browser": "*",
"@vitest/coverage-v8": "*",
"eslint": "*",
"typescript-eslint": "*",
"playwright": "*",
"rollup": "*",
"rollup-plugin-sourcemaps": "*",
"ts-node": "*",
"typedoc": "*",
"typescript": "*",
"vitest": "*"
}
}
9 changes: 5 additions & 4 deletions src/amqp-base-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,14 @@ export abstract class AMQPBaseClient {
const type = view.getUint8(i); i += 1
const channelId = view.getUint16(i); i += 2
const frameSize = view.getUint32(i); i += 4
let frameEnd = 0
try {
const frameEnd = view.getUint8(i + frameSize)
if (frameEnd !== 206)
throw (new AMQPError(`Invalid frame end ${frameEnd}, expected 206`, this))
} catch (e) {
frameEnd = view.getUint8(i + frameSize)
} catch {
throw (new AMQPError(`Frame end out of range, frameSize=${frameSize}, pos=${i}, byteLength=${view.byteLength}`, this))
}
if (frameEnd !== 206)
throw (new AMQPError(`Invalid frame end ${frameEnd}, expected 206`, this))

const channel = this.channels[channelId]
if (!channel) {
Expand Down
4 changes: 2 additions & 2 deletions src/amqp-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -831,13 +831,13 @@ export class AMQPChannel {
* Resolvs next RPC command
* @ignore
*/
resolveRPC(value?: unknown) : void { value }
resolveRPC(value?: unknown) : unknown | void { return value }

/**
* Reject next RPC command
* @ignore
*/
rejectRPC(err?: Error) : void { err }
rejectRPC(err?: Error) : Error | void { return err }

/**
* Deliver a message to a consumer
Expand Down
3 changes: 1 addition & 2 deletions src/amqp-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { AMQPProperties, Field } from './amqp-properties.js'
* Get methods returns the value read and how many bytes it used.
* @ignore
*/
export class AMQPView extends DataView {
export class AMQPView extends DataView<Uint8Array['buffer']> {
getUint64(byteOffset: number, littleEndian?: boolean) : number {
// split 64-bit number into two 32-bit (4-byte) parts
const left = this.getUint32(byteOffset, littleEndian)
Expand All @@ -16,7 +16,6 @@ export class AMQPView extends DataView {
const combined = littleEndian ? left + 2**32 * right : 2**32 * left + right

if (!Number.isSafeInteger(combined)) {
// eslint-disable-next-line no-console
console.warn(combined, 'exceeds MAX_SAFE_INTEGER. Precision may be lost')
}

Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"compilerOptions": {
"target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"module": "es2020", /* Specify what module code is generated. */
"moduleResolution": "node16",
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
"declarationMap": true, /* Create sourcemaps for d.ts files. */
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
Expand Down
Loading