Skip to content

Commit 7d6bd34

Browse files
committed
Rename dubug namespace
1 parent 3f9f6aa commit 7d6bd34

File tree

10 files changed

+18
-30
lines changed

10 files changed

+18
-30
lines changed

Diff for: packages/db-client/src/Client/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ export class Client {
525525
return [
526526
// Server is unavailable to take request
527527
error instanceof UnavailableError ||
528-
// Server has cancelled a long running request
528+
// Server has cancelled a long-running request
529529
error instanceof CancelledError,
530530
];
531531
};

Diff for: packages/db-client/src/utils/CommandError.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,9 @@ export type CommandError =
436436
export const convertToCommandError = (error: Error): CommandError | Error => {
437437
if (isCommandError(error) || !isServiceError(error)) return error;
438438

439-
const exeption = error.metadata?.getMap()["exception"]?.toString();
439+
const exception = error.metadata?.getMap()["exception"]?.toString();
440440

441-
switch (exeption) {
441+
switch (exception) {
442442
case ErrorType.NOT_LEADER:
443443
return new NotLeaderError(error);
444444
case ErrorType.STREAM_NOT_FOUND:
@@ -492,7 +492,7 @@ export const convertToCommandError = (error: Error): CommandError | Error => {
492492
}
493493
}
494494

495-
// This is a temporary workaround for a bug in node js. Must be removed when the bug is fixed.
495+
// This is a temporary workaround for a bug in Node.js. Must be removed when the bug is fixed.
496496
// https://github.com/grpc/grpc-node/issues/2502
497497
// and https://github.com/nodejs/node/issues/49147
498498
if (error.details.includes("write after end")) {

Diff for: packages/db-client/src/utils/debug.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ createDebug.formatters.h = function ({ Authorization, ...rest }) {
1313
return createDebug.formatters.O.call(this, headers);
1414
};
1515

16-
const base = createDebug("esdb");
16+
const base = createDebug("kdb");
1717
const command = base.extend("command");
1818
const command_grpc = command.extend("grpc");
1919
const connection = base.extend("connection");

Diff for: packages/opentelemetry/src/instrumentation.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ export class Instrumentation extends InstrumentationBase {
110110
return (moduleExports: typeof kdb) => {
111111
this._diag.debug("un-patching");
112112

113-
this._unwrap(
114-
moduleExports.KurrentDBClient.prototype,
115-
"appendToStream"
116-
);
113+
this._unwrap(moduleExports.KurrentDBClient.prototype, "appendToStream");
117114
this._unwrap(
118115
moduleExports.KurrentDBClient.prototype,
119116
"subscribeToStream"
@@ -237,11 +234,9 @@ export class Instrumentation extends InstrumentationBase {
237234
const subscriptionId = subscription.id;
238235

239236
const attributes: Attributes = {
240-
[KurrentDBAttributes.KURRENT_DB_STREAM]:
241-
resolvedEvent?.event?.streamId,
237+
[KurrentDBAttributes.KURRENT_DB_STREAM]: resolvedEvent?.event?.streamId,
242238
[KurrentDBAttributes.KURRENT_DB_EVENT_ID]: resolvedEvent?.event?.id,
243-
[KurrentDBAttributes.KURRENT_DB_EVENT_TYPE]:
244-
resolvedEvent?.event?.type,
239+
[KurrentDBAttributes.KURRENT_DB_EVENT_TYPE]: resolvedEvent?.event?.type,
245240
[KurrentDBAttributes.KURRENT_DB_SUBSCRIPTION_ID]: subscriptionId,
246241
[KurrentDBAttributes.SERVER_ADDRESS]: hostname,
247242
[KurrentDBAttributes.SERVER_PORT]: port,

Diff for: packages/test/src/connection/deadline/deadline-effects.test.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { createTestCluster, jsonTestEvents } from "@test-utils";
2-
import {
3-
KurrentDBClient,
4-
DeadlineExceededError,
5-
} from "@eventstore/db-client";
2+
import { KurrentDBClient, DeadlineExceededError } from "@eventstore/db-client";
63

74
describe("deadline", () => {
85
const cluster = createTestCluster();

Diff for: packages/test/src/extra/write-after-end.test.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ const neverEndingEvents: Array<EventData> = (function* neverEndingEvents() {
3535
const isArray = Array.isArray;
3636
Array.isArray = (arg): arg is never[] => {
3737
if (isArray(arg)) return true;
38-
if (arg === neverEndingEvents) return true;
39-
return false;
38+
return arg === neverEndingEvents;
4039
};
4140

41+
jest.retryTimes(5, { logErrorsBeforeRetry: true });
42+
4243
describe("write after end", () => {
4344
test("Should not write after end", async () => {
44-
// We are going to do a huge append, so tell eventstore not to reject it
45+
// We are going to do a huge append, so tell KurrentDB not to reject it
4546
const node = createTestNode().setOption(
4647
"EVENTSTORE_MAX_APPEND_SIZE",
4748
10_000_000
@@ -101,7 +102,7 @@ describe("write after end", () => {
101102
new Promise((resolve) => {
102103
const writeOnLoop = (): Promise<never> =>
103104
client
104-
.appendToStream(STREAM_NAME, jsonTestEvents(30_000))
105+
.appendToStream(STREAM_NAME, jsonTestEvents(5000))
105106
.then(writeOnLoop);
106107

107108
writeOnLoop().catch((e) => {

Diff for: packages/test/src/opentelemetry/instrumentation.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ describe("instrumentation", () => {
106106
const expectedAttributes = {
107107
[KurrentDBAttributes.KURRENT_DB_STREAM]: STREAM,
108108
[KurrentDBAttributes.SERVER_ADDRESS]: node.endpoints[0].address,
109-
[KurrentDBAttributes.SERVER_PORT]:
110-
node.endpoints[0].port.toString(),
109+
[KurrentDBAttributes.SERVER_PORT]: node.endpoints[0].port.toString(),
111110
[KurrentDBAttributes.DATABASE_SYSTEM]: moduleName,
112111
[KurrentDBAttributes.DATABASE_OPERATION]: "appendToStream",
113112
};

Diff for: packages/test/src/streams/setStreamMetadata.test.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import { createTestNode, jsonTestEvents } from "@test-utils";
2-
import {
3-
KurrentDBClient,
4-
StreamMetadata,
5-
START,
6-
} from "@eventstore/db-client";
2+
import { KurrentDBClient, StreamMetadata, START } from "@eventstore/db-client";
73

84
describe("setStreamMetadata", () => {
95
const node = createTestNode();

Diff for: packages/test/src/utils/Cluster.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import type { EndPoint, Certificate } from "@eventstore/db-client";
1212
import { testDebug } from "./debug";
1313
import { dockerImages } from "./dockerImages";
1414

15-
const rmdir = promisify(fs.rmdir);
15+
const rmdir = promisify(fs.rm);
1616
const mkdir = promisify(fs.mkdir);
1717
const readFile = promisify(fs.readFile);
1818
const writeFile = promisify(fs.writeFile);

Diff for: packages/test/src/utils/debug.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import createDebug from "debug";
22

3-
export const testDebug = createDebug("esdb").extend("tests");
3+
export const testDebug = createDebug("kdb").extend("tests");

0 commit comments

Comments
 (0)