Skip to content

Commit 3dceccb

Browse files
committed
Clean up
1 parent 1da39c3 commit 3dceccb

22 files changed

+243
-204
lines changed

Diff for: CONTRIBUTING.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Development is done on the `master` branch. We attempt to do our best to ensure
1010
**Repository Setup:**
1111
1. Clone the repository:
1212
```bash
13-
$ git clone [email protected]:Kurrent/Kurrent-Client-NodeJS.git
13+
$ git clone [email protected]:EventStore/Kurrent-Client-NodeJS.git
1414
$ cd Kurrent-Client-NodeJS
1515
```
1616
2. Install all necessary dependencies:
@@ -70,7 +70,7 @@ $ npm run test:debug // debug all tests
7070
$ npm run test:debug ReadAll // only the ReadAll tests
7171
```
7272

73-
Specific docker images can be specified via the enviroment variable `KURRENT_IMAGE`.
73+
Specific docker images can be specified via the environment variable `KURRENT_IMAGE`.
7474

7575
```shell script
7676
$ npx cross-env KURRENT_IMAGE=77d63f3f0ab3 jest
@@ -81,8 +81,8 @@ See [Jest] documentation for more options.
8181
### Debugging
8282

8383
This project uses the [debug] module internally to log information about connections, options and GRPC requests.
84-
To see all the internal logs, set the DEBUG environment variable to `esdb:*` when launching your app.
85-
Logs can be further filtered with glob patterns, for example, only connection logs: `esdb:connection`, everything but grpc logs: `esdb:*,-*:grpc`.
84+
To see all the internal logs, set the DEBUG environment variable to `kdb:*` when launching your app.
85+
Logs can be further filtered with glob patterns, for example, only connection logs: `kdb:connection`, everything but grpc logs: `kdb:*,-*:grpc`.
8686

8787
You can set a few environment variables that will further change the behavior of the debug logging:
8888

@@ -103,4 +103,4 @@ See the Node.js documentation for [`util.inspect()`] for the complete list.
103103
[jest]: https://jestjs.io/
104104
[debug]: https://github.com/visionmedia/debug
105105
[`util.inspect()`]: https://nodejs.org/api/util.html#util_util_inspect_object_options
106-
[kurrent-client-nodejs]: https://github.com/Kurrent/Kurrent-Client-NodeJS
106+
[kurrent-client-nodejs]: https://github.com/EventStore/Kurrent-Client-NodeJS

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ Refer to our [Contribution Guidelines]
3333
[discord-kurrent]: https://discord.gg/Phn9pmCw3t
3434
[discord-ddd-cqrs-es]: https://discord.com/invite/sEZGSHNNbH
3535
[license-badge]: https://img.shields.io/npm/l/@kurrent/db-client.svg
36-
[license-badge-url]: https://github.com/Kurrent/Kurrent-Client-NodeJS/blob/master/LICENSE
37-
[contribution guidelines]: https://github.com/Kurrent/Kurrent-Client-NodeJS/blob/master/CONTRIBUTING.md
36+
[license-badge-url]: https://github.com/EventStore/Kurrent-Client-NodeJS/blob/master/LICENSE
37+
[contribution guidelines]: https://github.com/EventStore/Kurrent-Client-NodeJS/blob/master/CONTRIBUTING.md

Diff for: packages/db-client/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ Refer to our [Contribution Guidelines]
193193
[discord-ddd-cqrs-es]: https://discord.com/invite/sEZGSHNNbH
194194
[npm-badge]: https://img.shields.io/npm/v/@kurrent/db-client.svg
195195
[npm-badge-url]: https://www.npmjs.com/package/@kurrent/db-client
196-
[ci-badge]: https://github.com/Kurrent/Kurrent-Client-NodeJS/workflows/CI/badge.svg?branch=master
197-
[ci-badge-url]: https://github.com/Kurrent/Kurrent-Client-NodeJS/actions
196+
[ci-badge]: https://github.com/EventStore/Kurrent-Client-NodeJS/workflows/CI/badge.svg?branch=master
197+
[ci-badge-url]: https://github.com/EventStore/Kurrent-Client-NodeJS/actions
198198
[license-badge]: https://img.shields.io/npm/l/@kurrent/db-client.svg
199-
[license-badge-url]: https://github.com/Kurrent/Kurrent-Client-NodeJS/blob/master/LICENSE
200-
[contribution guidelines]: https://github.com/Kurrent/Kurrent-Client-NodeJS/blob/master/CONTRIBUTING.md
199+
[license-badge-url]: https://github.com/EventStore/Kurrent-Client-NodeJS/blob/master/LICENSE
200+
[contribution guidelines]: https://github.com/EventStore/Kurrent-Client-NodeJS/blob/master/CONTRIBUTING.md
201201
[Kurrent docs]: https://developers.eventstore.com/server/v24.6/quick-start/installation

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

+14-3
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,33 @@ const parseProtocol = (
8686
options: ConnectionOptions
8787
): ConnectionOptions => {
8888
let nextPosition = position;
89-
const expected = "esdb:// or esdb+discover://";
89+
const expected =
90+
"kurrent://, kurrent+discover://, kdb://, or kdb+discover://";
9091
const match = connectionString
9192
.substring(position)
9293
.match(/^(?<protocol>[^:]+):\/\//);
9394

9495
if (match && match.groups?.protocol) {
9596
nextPosition += match[0].length;
9697

98+
if (match.groups.protocol.startsWith("esdb")) {
99+
console.warn(
100+
`The 'esdb' protocol is deprecated. Please use 'kurrent' or 'kdb' instead.`
101+
);
102+
}
103+
97104
switch (match.groups.protocol) {
98-
case "esdb": {
105+
case "esdb":
106+
case "kurrent":
107+
case "kdb": {
99108
return parseCredentials(connectionString, nextPosition, {
100109
...options,
101110
dnsDiscover: false,
102111
});
103112
}
104-
case "esdb+discover": {
113+
case "esdb+discover":
114+
case "kurrent+discover":
115+
case "kdb+discover": {
105116
return parseCredentials(connectionString, nextPosition, {
106117
...options,
107118
dnsDiscover: true,

Diff for: packages/opentelemetry/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ Refer to our [contribution guidelines][contributing-guidelines].
6767
[Discord-ddd-cqrs-es]: https://discord.com/invite/sEZGSHNNbH
6868
[contributing-guidelines]: https://github.com/prisma/prisma/blob/main/CONTRIBUTING.md
6969
[license-badge]: https://img.shields.io/npm/l/@kurrent/db-client.svg
70-
[license-badge-url]: https://github.com/Kurrent/Kurrent-Client-NodeJS/blob/master/LICENSE
71-
[ci-badge-url]: https://github.com/Kurrent/Kurrent-Client-NodeJS/actions
72-
[Kurrent-Client-NodeJS]: https://github.com/Kurrent/Kurrent-Client-NodeJS
73-
[ci-badge]: https://github.com/Kurrent/Kurrent-Client-NodeJS/workflows/CI/badge.svg?branch=master
74-
[ci-badge-url]: https://github.com/Kurrent/Kurrent-Client-NodeJS/actions
70+
[license-badge-url]: https://github.com/EventStore/Kurrent-Client-NodeJS/blob/master/LICENSE
71+
[ci-badge-url]: https://github.com/EventStore/Kurrent-Client-NodeJS/actions
72+
[Kurrent-Client-NodeJS]: https://github.com/EventStore/Kurrent-Client-NodeJS
73+
[ci-badge]: https://github.com/EventStore/Kurrent-Client-NodeJS/workflows/CI/badge.svg?branch=master
74+
[ci-badge-url]: https://github.com/EventStore/Kurrent-Client-NodeJS/actions

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const db = "db";
33
const server = "server";
44
const streams = "streams";
55

6-
export const KurrentDBAttributes = {
6+
export const KurrentAttributes = {
77
DATABASE_USER: `${db}.user`,
88
DATABASE_SYSTEM: `${db}.system`,
99
DATABASE_OPERATION: `${db}.operation`,

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

+32-30
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import type {
3333
} from "@kurrent/db-client";
3434
import type { ReadResp as StreamsReadResp } from "@kurrent/db-client/generated/streams_pb";
3535
import type { ReadResp as PersistentReadResp } from "@kurrent/db-client/generated/persistent_pb";
36-
import { KurrentDBAttributes } from "./attributes";
36+
import { KurrentAttributes } from "./attributes";
3737
import type { PersistentSubscriptionImpl } from "@kurrent/db-client/src/persistentSubscription/utils/PersistentSubscriptionImpl";
3838
import type { Subscription } from "@kurrent/db-client/src/streams/utils/Subscription";
3939
import { INSTRUMENTATION_NAME, INSTRUMENTATION_VERSION } from "./version";
@@ -144,19 +144,19 @@ export class Instrumentation extends InstrumentationBase {
144144
const { hostname, port } = Instrumentation.getServerAddress(uri);
145145

146146
const attributes: Attributes = {
147-
[KurrentDBAttributes.KURRENT_DB_STREAM]: streamName,
148-
[KurrentDBAttributes.SERVER_ADDRESS]: hostname,
149-
[KurrentDBAttributes.SERVER_PORT]: port,
150-
[KurrentDBAttributes.DATABASE_SYSTEM]: INSTRUMENTATION_NAME,
151-
[KurrentDBAttributes.DATABASE_OPERATION]: operation,
147+
[KurrentAttributes.KURRENT_DB_STREAM]: streamName,
148+
[KurrentAttributes.SERVER_ADDRESS]: hostname,
149+
[KurrentAttributes.SERVER_PORT]: port,
150+
[KurrentAttributes.DATABASE_SYSTEM]: INSTRUMENTATION_NAME,
151+
[KurrentAttributes.DATABASE_OPERATION]: operation,
152152
};
153153

154154
if (options?.credentials) {
155-
attributes[KurrentDBAttributes.DATABASE_USER] =
155+
attributes[KurrentAttributes.DATABASE_USER] =
156156
options.credentials.username;
157157
}
158158

159-
const span = tracer.startSpan(KurrentDBAttributes.STREAM_APPEND, {
159+
const span = tracer.startSpan(KurrentAttributes.STREAM_APPEND, {
160160
kind: SpanKind.CLIENT,
161161
attributes,
162162
});
@@ -230,31 +230,33 @@ export class Instrumentation extends InstrumentationBase {
230230
const subscriptionId = subscription.id;
231231

232232
const attributes: Attributes = {
233-
[KurrentDBAttributes.KURRENT_DB_STREAM]: resolvedEvent?.event?.streamId,
234-
[KurrentDBAttributes.KURRENT_DB_EVENT_ID]: resolvedEvent?.event?.id,
235-
[KurrentDBAttributes.KURRENT_DB_EVENT_TYPE]: resolvedEvent?.event?.type,
236-
[KurrentDBAttributes.KURRENT_DB_SUBSCRIPTION_ID]: subscriptionId,
237-
[KurrentDBAttributes.SERVER_ADDRESS]: hostname,
238-
[KurrentDBAttributes.SERVER_PORT]: port,
239-
[KurrentDBAttributes.DATABASE_SYSTEM]: INSTRUMENTATION_NAME,
240-
[KurrentDBAttributes.DATABASE_OPERATION]: operation,
241-
[KurrentDBAttributes.DATABASE_USER]: options?.credentials?.username,
233+
[KurrentAttributes.KURRENT_DB_STREAM]: resolvedEvent?.event?.streamId,
234+
[KurrentAttributes.KURRENT_DB_EVENT_ID]: resolvedEvent?.event?.id,
235+
[KurrentAttributes.KURRENT_DB_EVENT_TYPE]: resolvedEvent?.event?.type,
236+
[KurrentAttributes.KURRENT_DB_SUBSCRIPTION_ID]: subscriptionId,
237+
[KurrentAttributes.SERVER_ADDRESS]: hostname,
238+
[KurrentAttributes.SERVER_PORT]: port,
239+
[KurrentAttributes.DATABASE_SYSTEM]: INSTRUMENTATION_NAME,
240+
[KurrentAttributes.DATABASE_OPERATION]: operation,
241+
[KurrentAttributes.DATABASE_USER]: options?.credentials?.username,
242242
};
243243

244-
return context.with(parentContext, () => {
245-
const span = tracer.startSpan(spanName, {
244+
const span = tracer.startSpan(
245+
spanName,
246+
{
246247
attributes,
247248
kind: SpanKind.CONSUMER,
248-
});
249+
},
250+
parentContext
251+
);
249252

250-
try {
251-
return resolved;
252-
} catch (error) {
253-
throw Instrumentation.handleError(error, span);
254-
} finally {
255-
span.end();
256-
}
257-
});
253+
try {
254+
return resolved;
255+
} catch (error) {
256+
throw Instrumentation.handleError(error, span);
257+
} finally {
258+
span.end();
259+
}
258260
};
259261
}
260262

@@ -291,7 +293,7 @@ export class Instrumentation extends InstrumentationBase {
291293

292294
this.resolveUri().then((uri) =>
293295
Instrumentation.applySubscriptionInstrumentation(
294-
KurrentDBAttributes.STREAM_SUBSCRIBE,
296+
KurrentAttributes.STREAM_SUBSCRIBE,
295297
subscription,
296298
uri,
297299
operation,
@@ -338,7 +340,7 @@ export class Instrumentation extends InstrumentationBase {
338340

339341
this.resolveUri().then((uri) =>
340342
Instrumentation.applySubscriptionInstrumentation(
341-
KurrentDBAttributes.STREAM_SUBSCRIBE,
343+
KurrentAttributes.STREAM_SUBSCRIBE,
342344
subscription,
343345
uri,
344346
operation,

Diff for: packages/test/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ Refer to our [contribution guidelines][contributing-guidelines].
2424
[discord-ddd-cqrs-es]: https://discord.com/invite/sEZGSHNNbH
2525
[contributing-guidelines]: https://github.com/prisma/prisma/blob/main/CONTRIBUTING.md
2626
[license-badge]: https://img.shields.io/npm/l/@kurrent/db-client.svg
27-
[license-badge-url]: https://github.com/Kurrent/Kurrent-Client-NodeJS/blob/master/LICENSE
27+
[license-badge-url]: https://github.com/EventStore/Kurrent-Client-NodeJS/blob/master/LICENSE
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`connection string parser Should throw on invalid strings esbd+discovery://localhost 1`] = `"Unexpected \\"esbd+discovery://\\" at position 0, expected esdb:// or esdb+discover://."`;
3+
exports[`connection string parser Should throw on invalid strings esbd+discovery://localhost 1`] = `"Unexpected \\"esbd+discovery://\\" at position 0, expected esdb://, esdb+discover://, kurrent://, kurrent+discover://, kdb://, or kdb+discover://."`;
44

5-
exports[`connection string parser Should throw on invalid strings esdb://host1,host2:200:300?throwOnAppendFailure=false 1`] = `"Unexpected \\":300\\" at position 22, expected , or ?key=value."`;
5+
exports[`connection string parser Should throw on invalid strings https://console.eventstore.cloud/ 1`] = `"Unexpected \\"https://\\" at position 0, expected esdb://, esdb+discover://, kurrent://, kurrent+discover://, kdb://, or kdb+discover://."`;
66

7-
exports[`connection string parser Should throw on invalid strings esdb://host1;host2;host3?throwOnAppendFailure=false 1`] = `"Unexpected \\";\\" at position 12, expected ?key=value."`;
7+
exports[`connection string parser Should throw on invalid strings kurrent://host1,host2:200:300?throwOnAppendFailure=false 1`] = `"Unexpected \\":300\\" at position 25, expected , or ?key=value."`;
88

9-
exports[`connection string parser Should throw on invalid strings esdb://localhost/&throwOnAppendFailure=false 1`] = `"Unexpected \\"&\\" at position 17, expected ?key=value."`;
9+
exports[`connection string parser Should throw on invalid strings kurrent://host1;host2;host3?throwOnAppendFailure=false 1`] = `"Unexpected \\";\\" at position 15, expected ?key=value."`;
1010

11-
exports[`connection string parser Should throw on invalid strings esdb://localhost?keepAliveInterval=XXIV 1`] = `"Unexpected \\"XXIV\\" at position 35, expected Integer."`;
11+
exports[`connection string parser Should throw on invalid strings kurrent://localhost/&throwOnAppendFailure=false 1`] = `"Unexpected \\"&\\" at position 20, expected ?key=value."`;
1212

13-
exports[`connection string parser Should throw on invalid strings esdb://localhost?keepAliveTimeout=please 1`] = `"Unexpected \\"please\\" at position 34, expected Integer."`;
13+
exports[`connection string parser Should throw on invalid strings kurrent://localhost?keepAliveInterval=XXIV 1`] = `"Unexpected \\"XXIV\\" at position 38, expected Integer."`;
1414

15-
exports[`connection string parser Should throw on invalid strings esdb://localhost?throwOnAppendFailure=false&nodePreference=any 1`] = `"Unexpected \\"any\\" at position 59, expected leader or follower or read_only_replica or random."`;
15+
exports[`connection string parser Should throw on invalid strings kurrent://localhost?keepAliveTimeout=please 1`] = `"Unexpected \\"please\\" at position 37, expected Integer."`;
1616

17-
exports[`connection string parser Should throw on invalid strings esdb://localhost?throwOnAppendFailure=false?nodePreference=follower 1`] = `"Unexpected \\"?\\" at position 43, expected &key=value."`;
17+
exports[`connection string parser Should throw on invalid strings kurrent://localhost?throwOnAppendFailure=false&nodePreference=any 1`] = `"Unexpected \\"any\\" at position 62, expected leader or follower or read_only_replica or random."`;
1818

19-
exports[`connection string parser Should throw on invalid strings esdb://localhost?throwOnAppendFailure=if you feel like it 1`] = `"Unexpected \\"if you feel like it\\" at position 38, expected true or false."`;
19+
exports[`connection string parser Should throw on invalid strings kurrent://localhost?throwOnAppendFailure=false?nodePreference=follower 1`] = `"Unexpected \\"?\\" at position 46, expected &key=value."`;
2020

21-
exports[`connection string parser Should throw on invalid strings esdb://localhost?throwOnAppendFailure=sometimes 1`] = `"Unexpected \\"sometimes\\" at position 38, expected true or false."`;
21+
exports[`connection string parser Should throw on invalid strings kurrent://localhost?throwOnAppendFailure=if you feel like it 1`] = `"Unexpected \\"if you feel like it\\" at position 41, expected true or false."`;
2222

23-
exports[`connection string parser Should throw on invalid strings esdb://my:great@username:UyeXx8$^PsOo4jG88FlCauR1Coz25q@host?nodePreference=follower&throwOnAppendFailure=false 1`] = `"Unexpected \\"UyeXx8\\" at position 25, expected port number."`;
23+
exports[`connection string parser Should throw on invalid strings kurrent://localhost?throwOnAppendFailure=sometimes 1`] = `"Unexpected \\"sometimes\\" at position 41, expected true or false."`;
2424

25-
exports[`connection string parser Should throw on invalid strings esdb://throwOnAppendFailure=false 1`] = `"Unexpected \\"=\\" at position 27, expected ?key=value."`;
25+
exports[`connection string parser Should throw on invalid strings kurrent://my:great@username:UyeXx8$^PsOo4jG88FlCauR1Coz25q@host?nodePreference=follower&throwOnAppendFailure=false 1`] = `"Unexpected \\"UyeXx8\\" at position 28, expected port number."`;
2626

27-
exports[`connection string parser Should throw on invalid strings https://console.eventstore.cloud/ 1`] = `"Unexpected \\"https://\\" at position 0, expected esdb:// or esdb+discover://."`;
27+
exports[`connection string parser Should throw on invalid strings kurrent://throwOnAppendFailure=false 1`] = `"Unexpected \\"=\\" at position 30, expected ?key=value."`;
2828

29-
exports[`connection string parser Should throw on invalid strings localhost 1`] = `"Unexpected \\"l\\" at position 0, expected esdb:// or esdb+discover://."`;
29+
exports[`connection string parser Should throw on invalid strings localhost 1`] = `"Unexpected \\"l\\" at position 0, expected esdb://, esdb+discover://, kurrent://, kurrent+discover://, kdb://, or kdb+discover://."`;
3030

3131
exports[`connection string parser Should warn on unknown and unsupported keys esdb://localhost?catchOnAppendFailure=true&throwOnAppendFailure=false 1`] = `
3232
Array [
33+
Array [
34+
"The 'esdb' protocol is deprecated. Please use 'kurrent' or 'kdb' instead.",
35+
],
3336
Array [
3437
"Unknown option key \\"catchOnAppendFailure\\", setting will be ignored.
3538
esdb://localhost?catchOnAppendFailure=true&throwOnAppendFailure=false
@@ -38,30 +41,40 @@ esdb://localhost?catchOnAppendFailure=true&throwOnAppendFailure=false
3841
]
3942
`;
4043

41-
exports[`connection string parser Should warn on unknown and unsupported keys esdb://localhost?someNonsense=follower&doTheThing=true 1`] = `
44+
exports[`connection string parser Should warn on unknown and unsupported keys kurrent://localhost?catchOnAppendFailure=true&throwOnAppendFailure=false 1`] = `
45+
Array [
46+
Array [
47+
"Unknown option key \\"catchOnAppendFailure\\", setting will be ignored.
48+
kurrent://localhost?catchOnAppendFailure=true&throwOnAppendFailure=false
49+
^^^^^^^^^^^^^^^^^^^^",
50+
],
51+
]
52+
`;
53+
54+
exports[`connection string parser Should warn on unknown and unsupported keys kurrent://localhost?someNonsense=follower&doTheThing=true 1`] = `
4255
Array [
4356
Array [
4457
"Unknown option key \\"someNonsense\\", setting will be ignored.
45-
esdb://localhost?someNonsense=follower&doTheThing=true
46-
^^^^^^^^^^^^",
58+
kurrent://localhost?someNonsense=follower&doTheThing=true
59+
^^^^^^^^^^^^",
4760
],
4861
Array [
4962
"Unknown option key \\"doTheThing\\", setting will be ignored.
50-
esdb://localhost?someNonsense=follower&doTheThing=true
51-
^^^^^^^^^^",
63+
kurrent://localhost?someNonsense=follower&doTheThing=true
64+
^^^^^^^^^^",
5265
],
5366
]
5467
`;
5568

56-
exports[`connection string parser Should warn on unknown and unsupported keys esdb://localhost?tlsVerifyCert=false 1`] = `
69+
exports[`connection string parser Should warn on unknown and unsupported keys kurrent://localhost?tlsVerifyCert=false 1`] = `
5770
Array [
5871
Array [
5972
"\\"tlsVerifyCert\\" is not currently supported by this client, and will have no effect.
6073
Consider either:
6174
Passing \\"tlsCAFile\\" in the connection string.
6275
Setting NODE_EXTRA_CA_CERTS https://nodejs.org/api/cli.html#cli_node_extra_ca_certs_file
63-
esdb://localhost?tlsVerifyCert=false
64-
^^^^^^^^^^^^^^^^^^^",
76+
kurrent://localhost?tlsVerifyCert=false
77+
^^^^^^^^^^^^^^^^^^^",
6578
],
6679
]
6780
`;

Diff for: packages/test/src/connection/connectionName.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe("connectionName", () => {
1313

1414
test("connection string", async () => {
1515
const CONNECTION_NAME = "my great connection";
16-
const client = KurrentDBClient.connectionString`esdb://host?connectionName=${CONNECTION_NAME}`;
16+
const client = KurrentDBClient.connectionString`kurrent://host?connectionName=${CONNECTION_NAME}`;
1717

1818
expect(client.connectionName).toBe(CONNECTION_NAME);
1919
});

0 commit comments

Comments
 (0)