start with release-21.10 code changes

This commit is contained in:
Nicolas Dextraze 2023-01-30 15:08:46 -05:00
parent 6159cd56b8
commit c422057f5f
41 changed files with 8003 additions and 8831 deletions

1
.gitignore vendored
View File

@ -34,6 +34,7 @@ node_modules
# InteliJ # InteliJ
.idea/workspace.xml .idea/workspace.xml
.idea/shelf
.vscode .vscode
lib/ lib/

1
.nvmrc Normal file
View File

@ -0,0 +1 @@
v14.21.2

View File

@ -24,14 +24,23 @@ If you want to learn more about EventSourcing/EventModeling, you can join one of
Install using `npm install node-eventstore-client` Install using `npm install node-eventstore-client`
Versions to install to match EventStore versions:
- 0.1.x for ES prior to 3.9.4
- 0.2.x for ES from 3.9.4 to 5.x
- 20.10.x for ES 20.10 LTS
- 21.10.x for ES 21.10 LTS
*I am working on making version match LTS and latest release of EventStore so that TCP protocol matches*
### Dependencies ### Dependencies
- Node.js >= 4.0 - Node.js >= 14
- Modules: [long](https://www.npmjs.org/package/long), [protobufjs](https://www.npmjs.org/package/protobufjs), [uuid](https://www.npmjs.org/package/uuid), [strict-event-emitter-types](https://www.npmjs.com/package/strict-event-emitter-types) (installed via `npm install`) - Modules: [long](https://www.npmjs.org/package/long), [protobufjs](https://www.npmjs.org/package/protobufjs), [uuid](https://www.npmjs.org/package/uuid), [strict-event-emitter-types](https://www.npmjs.com/package/strict-event-emitter-types) (installed via `npm install`)
### Install and run an Eventstore on localhost ### Install and run an Eventstore on localhost
See https://eventstore.org/docs/introduction/4.1.0/ See https://eventstore.com
*Note: If you are using a version of EventStore prior to 3.9.4, you need to use version 0.1.x of this package `npm install node-eventstore-client@^0.1`.* *Note: If you are using a version of EventStore prior to 3.9.4, you need to use version 0.1.x of this package `npm install node-eventstore-client@^0.1`.*

11
build-and-test.sh Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -e
if [[ -d /var/code/src ]]; then
cp -R /var/code/{src,test,*.js,*.json} .
fi
npm i
npm run build
npm run test-debug

23
certs/ca/ca.crt Normal file
View File

@ -0,0 +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p12 Normal file

Binary file not shown.

24
certs/node1/node1.crt Normal file
View File

@ -0,0 +1,24 @@
-----BEGIN CERTIFICATE-----
MIIECDCCAvCgAwIBAgIQI83qjs8Vn2iLbeUZbTPRcTANBgkqhkiG9w0BAQsFADBi
MQswCQYDVQQGEwJVSzEYMBYGA1UEChMPRXZlbnQgU3RvcmUgTHRkMTkwNwYDVQQD
EzBFdmVudFN0b3JlREIgQ0EgOTBmNDczY2NmYzIxM2IyYzZjNDkzMzhmMWUxOTk5
MWEwHhcNMjMwMTMwMTUyMzM0WhcNMjQwMTMwMTUyMzM0WjAcMRowGAYDVQQDExFl
dmVudHN0b3JlZGItbm9kZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
AL3CBeNLxZDvUA4WMRACrM+kxvrlD8ahs9MOFfAJHCNLoNR4mWAvh+BUDHsG7E56
4I5Y7XbC0cCIIER3/QB6Jz80kcJ4y745d9RCbYSqTeUnptrLdcXDNiwbI3bAjyuJ
tEqg+iPjrz2E6bSlZ4GSxKSTC95Dm80UUU/CG6+H1FesN8JP+ruYey4S5bYASy6o
z1NtYaPDGqSqDGvLhuWQNKoJAAc4g1R/UcVFbuI2asnCkFGjDF7gcRKkHpw0DNhN
TMQWMdQ2+I8it5UwNzYpsCZj/le5a54mNZqNYj52nEpURDsdJy4BXJy5dUwADZHz
ffN+ciWEToQz2hZmnliIG98CAwEAAaOB/zCB/DAOBgNVHQ8BAf8EBAMCBaAwHQYD
VR0lBBYwFAYIKwYBBQUHAwIGCCsGAQUFBwMBMAwGA1UdEwEB/wQCMAAwKQYDVR0O
BCIEIFRmt7SsPXFStSAcZDS9OCP03JyevPMV6/1R0Utg8UA3MCsGA1UdIwQkMCKA
IP975meSb3EpXKsmjV4K0GeRTl5WfR72K/cfk267NzMeMGUGA1UdEQReMFyCKmNs
dXN0ZXIudGVzdHMubm9kZS1ldmVudHN0b3JlLWNsaWVudC5sb2NhbIIobm9kZTEu
dGVzdHMubm9kZS1ldmVudHN0b3JlLWNsaWVudC5sb2NhbIcEwKghCjANBgkqhkiG
9w0BAQsFAAOCAQEATHxhyf27pPFJRegPB9ozm4P06MkvZMm4syxmoR1jJohm+7Xp
7jd9ENATFApZNxV+/MYGgryML9Y+Md/Bd1fttP8j0MUR5euJX8zehrnCufaIw2If
/a9YalJ2/a+WElAgTHM1sCpdvL+WwsQ6IjWPVfGIu7VIotQXIqllZUjMd3rFI4Ip
9CkMgXbZzls8OhWH1FnPkFFjolqITwcgSmn3NWbQkl6qFYFjAZ8pFcjhdNay7yZx
+Pe9gEPbi6iyP50xb0LQtJXQQvFhwmDQbR5v0xiBI6ONK8mha3fQkxmV1wMPJdvQ
TOva/iFP4qmjyewyzOd752DN6r4qFlpb39Hpmw==
-----END CERTIFICATE-----

27
certs/node1/node1.key Normal file
View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAvcIF40vFkO9QDhYxEAKsz6TG+uUPxqGz0w4V8AkcI0ug1HiZ
YC+H4FQMewbsTnrgjljtdsLRwIggRHf9AHonPzSRwnjLvjl31EJthKpN5Sem2st1
xcM2LBsjdsCPK4m0SqD6I+OvPYTptKVngZLEpJML3kObzRRRT8Ibr4fUV6w3wk/6
u5h7LhLltgBLLqjPU21ho8MapKoMa8uG5ZA0qgkABziDVH9RxUVu4jZqycKQUaMM
XuBxEqQenDQM2E1MxBYx1Db4jyK3lTA3NimwJmP+V7lrniY1mo1iPnacSlREOx0n
LgFcnLl1TAANkfN9835yJYROhDPaFmaeWIgb3wIDAQABAoIBAFO5a8eiAwWz0Wql
t/gMdhsX5QOGVbOaXTFeIafLHTMlh0y3+VRLJHSCIQ+XOmRWKwYjjoK76rg8V6Be
IK85Nl/Y3gckLSE9UfXBaXkDe2MEX8ZhxxD+1MQZJUicJY9cLsROyo9TQlqubj9a
S5UMIN9MUgw7YF7X/Bho2LZWBAa6Hz3LSyndwArvqZeUf8ovmJnWEUvJB8amVhwB
DoYqyNjiqIEJYWRfCeGfLEOmotmwCfYeJFyr84r3wfS6qmaesKM8Nbz8eSSNg7n3
5LcAL2Bv3hvsMmUEZQl3J41AtBVsU5DgbTf6/seuKvfVOcqVp9AtZp2rg3xY4pNI
7gN4wiECgYEA1lBh13LdjM0rOg9096ee2hQKjFvwVki0xzZigmf94CXoAJ19qwOe
J0WXfk1g5GP1bg5pdVhKdS+LEIqet9ipaall5hWotaYJdyOtWiQan9wRRa3sk6pl
K29LBF+XzZWAKE7C2371rVyMXViHzv056wasw0RSgxd6HBi1mOpcveMCgYEA4qrj
Ha24Qh+/b883FaMphYrl8H8nMgAdGmi7HiLnJx6jzPzalsBI5+qnDY8/oqeAie66
k8c6uRKOsEFrsbK/w3+21rGuZb9t9PupDONFOW9D94744HDFu0Clnr5S2ABKM9D6
hUL2qQedAqZx5CNWbpM/wdV0OBKhveIb9OyjytUCgYA21jCC0ThRK7owy/2w1Kn3
wQMF8Qxo94eSJZ9FINi7/tcDOUkLdgyEnfDqd2AgcFc/Rt7DEMlUfMrHe8Cq5/xJ
NfgFzGrzt71aR722f+B0IPomax9KlWH3oC2Au/j6uJMnPSfsw+qW5kRgKiPt2at1
MKsJ97RpKJutDsGAlA8Q4wKBgQCUyjBD7yEg5s43iwJRxcUf0EmYUR9dhw2TpGQQ
KEEsQMStbt3eT2KMOlBmaj4Pe3y5DmiTURiPHEtmD8ut3fRbVJ6k2AXu7HY1dm1F
9HogdZVcEBH24pAplwog5jZja+1Jjkik6YwY8NJ0RuZEJ544/5e+mWus0y4xAxfu
8teh8QKBgQDQm6vKAsldQStgj9gwRiTAUrMPTriVQTUd4/8lof+RoIJWM7CARLos
9MYkAefv4MgjvwWNn8RbFjN91NBX4qpCjgm62P25npFSKQAK+JQlvj7MbSw54jyx
2/uj4JEMM1rOocJr9tvYAeC2nnZMOuhesLVy+SHF9TJ2WtalDOTZ1A==
-----END RSA PRIVATE KEY-----

24
certs/node2/node2.crt Normal file
View File

@ -0,0 +1,24 @@
-----BEGIN CERTIFICATE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HzdgDetEaqp78Ax/G29OUK9NWdXk2hwhmkpZgSLV3g7OlfNve
6pmuEpcBAoGBAOPIMM+uYQJmRIapXZADQOc7VkF55sSjh3h25tjS8iHIEGQ9gb8n
h4iNUDC73NN9Yfw6/vKrwcpIq5nQKRRUQ+NJFxurtN6XBBlYNf336tg6S/65oe3W
R3m35/w72qcct1aOASDafuxdoEV/kbflpao57PxRZAXGdMPJANDckujXAoGBAP5j
x4NZvYI73oL2OI/2CJytA5uksfsh0ymusNKRaBhqLwFIE1Ud/CHj5eG1Bo9ox8Yl
e5AdkMmSSYFIe3B/P1apFI22/GKc1on2mFXKRY8zAMVLGbsLJarQz4xIX36bafUh
1O9JM1d6PWDITAzoptIJDF7U41jxbbGMic6gIbBhAoGAMOUkNTCFenJhe1aX0vYf
1IMUPPHh64v+5IkBfMGrYD0F576cP2BI47MR56Qr/uoHQpGXcJgV/UokK9xXNRnx
iLSD1VjCdpWMN7SLwnyZWNkKvx8x90/r/+DOV4KxqPWtFVNeQqMkY7ClWsXLjeIp
8aSFjpQaGHNFVVGsbykqD/kCgYEA3BZ/eoidiJs7e5qCfSqjcMnPIU1wHpG5G4rj
uInMwbK8UCOHdlCm3rtJG+l+b3x7ulabfKfXqE1EAvIuubmdluBZw/HYkYiXpG0Q
hsilPasms4qyDD0srYhSyE+lLuhO16IZk5yFKt27VIx2H4T5LyZc6X7N4xmdicrJ
P1cTToECgYEAlW2xWDl90suSAw1Tv23BVEX6ol/UColtGY8VDIHsXPDBYImtGiFt
MibOuyzWsvPw0HZDzWw9otU0735clhK34v+E1WyPFvOAo18orcCS4A6Fi42tp5oG
sNVxiYJFFUn+nnHUoGZNuKlB5PZR1Wxus6wXY2rZdoQ6QsBD0XjquCE=
-----END RSA PRIVATE KEY-----

24
certs/node3/node3.crt Normal file
View File

@ -0,0 +1,24 @@
-----BEGIN CERTIFICATE-----
MIIECDCCAvCgAwIBAgIQecOoexYVeIUtLwNQp179vzANBgkqhkiG9w0BAQsFADBi
MQswCQ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Ygr2err08DbQfMxyEhG
yHmaBFzEyI/rm8jRn3K5DMV6cDCB3jTn5eud3oVVAZwTsLcR3mB2UpSJ7lAJgRFs
5pfFFgHKCQ4YQcFIkNtMeda7KpVv4YxoltJMSISDGvo4fcNhCH62H6/PDJFBi/e9
L4vB7eZHaO//8UQQxV24VSDLDBP1MQ4ucLZEVam9HQj4qK+DiwDlH6WmQs22FqqE
i7aLjEEu9Ko2zG7hzTp1jxDfyPw5iByax1JdXw==
-----END CERTIFICATE-----

27
certs/node3/node3.key Normal file
View File

@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA3yJehZmOPE6okktMeYc7Lz2VuTakGj9xruo9n9YL4jnYDguD
Dnz87u1X9EcXJqhfyVLaEBUyVF9OhSqPsgsBUF4Xe3zbtbSq21u/7B2fG8haqmrU
d21XnGAshRdvKJBIj3tOCfvMMk6+bjWwdXTGw9YqWuK2WIMHJeUYw5pvNXnfLFrV
zRxTZs/mfudz3BYo4fTc5TrioKPowlN2Lfml4oOFoBxG0aavlmCBQI/if0ZTMnUU
BMCRyssw6OiHW/Urpq6o5Bnx/6ez7dtDgb3qtnHDCtLMj+V5QVji7+XOMtSUS4sA
smq4+sHpGLDNPBsE5pNgbqaBY5FY8G6mOmPrtwIDAQABAoIBADk571QEVd5RrhoX
Bb4FWMB84vFleiDhNJ7PpI5hrxqOC0NO4IXOuG/unygfM2jOtgJEJXkKdqX8635r
s/7No8Cg4RTiqNapR0iK92XvEudlMxuR2nvmpxmL8N8Ra4jTuEhUL2eQFIaye1R4
oJD/Khr/yk0U5/87W5H0d61y5iKobF87QbI9xxkBGGQygsvoEni4sHchN1se/Ha8
y9nb6B/9sYU8lfSSaRhS/sqpH/ppnptWr1hwxj6jxI21uMB+cWN+rs8j1F0Zizex
+TTDqhyuYoqh1x2J9UFCjipiKVnA1563eFmtQZk2nrNdjvN6K9qWa0iF8IgTGvdh
m+9NNEECgYEA6sYqugSzeVCqBqHKAQKESsO6XOQjwkDZQhgeDG8Sal5RArlNsup6
hh/ZONPCL/6zxz5oKEyxzsTg4tJI9F3uqkpF5rcM1UGCc3maywXmLUd70NuTWM2G
hz+R4IhKyuQsFhWzFRBh10rorSvjIflkKiviZp+lNiDp1UnY0pOhxWUCgYEA807M
i60fuTTZsvGKhExORHUOnfs3USst1zHODDAaQYyjUYJP7ix/azf1ciHeeNCZ9rzF
9xBlDKChRSvKPnU0K07C49a+WI4rdgw8zS+8dqKdvaczPas0InPzXs+oW/O6I86I
ANEanw9fgrAPEL4/8TLMLhjTV3msdrJ04KzVWOsCgYEAtc9Ax01cr1YIVZp1FNMe
H8fzSnxiNMyDcuu6WWaqnDTuB234/dUXjUacsaVLfF+CWYm6n3rFN5q/jOfMF3Gm
obli6IhZJ8zTeRlzBkZLOkVhXRytvtdqltJj5b2mLfkFKxUi2e0V1+PqzDBwdJ7t
MrtJWK/JAWH7s3C8uFYbsQECgYEAsxD2d4H1zA/6fLlKEa47GCTymhCumJ1nwm4U
UGICoOWJuU5n10mGiXmIufP1UQNtnOs342p8hDugFVFyKl+GAq2Xv6lnM7OGhv3g
rb6JPOLXpyHsE2HyH70oi0nXhb0t7HZvH/LFXfUpfPxoShFK7BBPt0lsGYAiDsWu
QUDST/sCgYAVljJlvlEx8C8HmBrSeeh+Zec9t9HDjl04jNAwenY4x5hD1l1u2ij5
OJqVodZd1s/To7Dm9Xc6w7r6c9x8xsok4Kc3izc/KQXlxPvRnxF76J4KsMw8kEU1
LnQN+igffijohdln2Q8cQnEZylM1N4e+sNat5ufEzTk7MBn1676aHA==
-----END RSA PRIVATE KEY-----

View File

@ -1,143 +1,130 @@
version: '3.4' version: '3.7'
services: services:
eventstore.db: eventstore1:
image: eventstore/eventstore:release-5.0.8 image: eventstore/eventstore:21.10.9-buster-slim
environment: environment:
- EVENTSTORE_WORKER_THREADS=5
- EVENTSTORE_CLUSTER_SIZE=3 - EVENTSTORE_CLUSTER_SIZE=3
- EVENTSTORE_CLUSTER_DNS=cluster.tests.node-eventstore-client.local
- EVENTSTORE_ADVERTISE_HOST_TO_CLIENT_AS=node1.tests.node-eventstore-client.local
- EVENTSTORE_ADVERTISE_HTTP_PORT_TO_CLIENT_AS=2113
- EVENTSTORE_ADVERTISE_TCP_PORT_TO_CLIENT_AS=1113
# - EVENTSTORE_DISCOVER_VIA_DNS=False
# - EVENTSTORE_GOSSIP_SEED=192.168.33.10:2113,192.168.33.11:2113,192.168.33.12:2113
- EVENTSTORE_RUN_PROJECTIONS=All - EVENTSTORE_RUN_PROJECTIONS=All
- EVENTSTORE_DB=/var/lib/eventstore-data - EVENTSTORE_START_STANDARD_PROJECTIONS=True
- EVENTSTORE_INDEX=/var/lib/eventstore-index - EVENTSTORE_ENABLE_EXTERNAL_TCP=true
- EVENTSTORE_LOG=/var/log/eventstore
- EVENTSTORE_CLUSTER_GOSSIP_PORT=2112
- EVENTSTORE_INT_TCP_PORT=1112
- EVENTSTORE_EXT_TCP_PORT=1113 - EVENTSTORE_EXT_TCP_PORT=1113
- EVENTSTORE_INT_HTTP_PORT=2112 - EVENTSTORE_HTTP_PORT=2113
- EVENTSTORE_EXT_HTTP_PORT=2113
- EVENTSTORE_DISCOVER_VIA_DNS=true
- EVENTSTORE_CLUSTER_DNS=eventstore.local
- EVENTSTORE_INT_IP=192.168.33.10 - EVENTSTORE_INT_IP=192.168.33.10
- EVENTSTORE_EXT_IP=192.168.33.10 - EVENTSTORE_EXT_IP=192.168.33.10
- EVENTSTORE_CERTIFICATE_FILE=/etc/eventstore/certs/node1/node1.crt
- EVENTSTORE_CERTIFICATE_PRIVATE_KEY_FILE=/etc/eventstore/certs/node1/node1.key
- EVENTSTORE_TRUSTED_ROOT_CERTIFICATES_PATH=/etc/eventstore/certs/ca
expose:
- "1112"
- "1113"
- "2113"
ports: ports:
- "1112:1112" - "1112:1112"
- "1113:1113" - "1113:1113"
- "2112:2112"
- "2113:2113" - "2113:2113"
networks: networks:
app_net: app_net:
aliases: aliases:
- eventstore.local - cluster.tests.node-eventstore-client.local
- node1.tests.node-eventstore-client.local
ipv4_address: 192.168.33.10 ipv4_address: 192.168.33.10
volumes: volumes:
- type: volume - eventstore1-data:/var/lib/eventstore
source: eventstore-volume-data - ./certs:/etc/eventstore/certs:ro
target: /var/lib/eventstore-data
- type: volume
source: eventstore-volume-index
target: /var/lib/eventstore-index
- type: volume
source: eventstore-volume-logs
target: /var/log/eventstore
eventstore.db2: eventstore2:
image: eventstore/eventstore:release-5.0.8 image: eventstore/eventstore:21.10.9-buster-slim
environment: environment:
- EVENTSTORE_WORKER_THREADS=5
- EVENTSTORE_CLUSTER_SIZE=3 - EVENTSTORE_CLUSTER_SIZE=3
- EVENTSTORE_CLUSTER_DNS=cluster.tests.node-eventstore-client.local
- EVENTSTORE_ADVERTISE_HOST_TO_CLIENT_AS=node2.tests.node-eventstore-client.local
- EVENTSTORE_ADVERTISE_HTTP_PORT_TO_CLIENT_AS=2113
- EVENTSTORE_ADVERTISE_TCP_PORT_TO_CLIENT_AS=1113
# - EVENTSTORE_DISCOVER_VIA_DNS=False
# - EVENTSTORE_GOSSIP_SEED=192.168.33.10:2113,192.168.33.11:2113,192.168.33.12:2113
- EVENTSTORE_RUN_PROJECTIONS=All - EVENTSTORE_RUN_PROJECTIONS=All
- EVENTSTORE_DB=/var/lib/eventstore-data - EVENTSTORE_START_STANDARD_PROJECTIONS=True
- EVENTSTORE_INDEX=/var/lib/eventstore-index - EVENTSTORE_ENABLE_EXTERNAL_TCP=true
- EVENTSTORE_LOG=/var/log/eventstore
- EVENTSTORE_CLUSTER_GOSSIP_PORT=2112
- EVENTSTORE_INT_TCP_PORT=1112
- EVENTSTORE_EXT_TCP_PORT=1113 - EVENTSTORE_EXT_TCP_PORT=1113
- EVENTSTORE_INT_HTTP_PORT=2112 - EVENTSTORE_HTTP_PORT=2113
- EVENTSTORE_EXT_HTTP_PORT=2113
- EVENTSTORE_DISCOVER_VIA_DNS=true
- EVENTSTORE_CLUSTER_DNS=eventstore.local
- EVENTSTORE_INT_IP=192.168.33.11 - EVENTSTORE_INT_IP=192.168.33.11
- EVENTSTORE_EXT_IP=192.168.33.11 - EVENTSTORE_EXT_IP=192.168.33.11
- EVENTSTORE_CERTIFICATE_FILE=/etc/eventstore/certs/node2/node2.crt
- EVENTSTORE_CERTIFICATE_PRIVATE_KEY_FILE=/etc/eventstore/certs/node2/node2.key
- EVENTSTORE_TRUSTED_ROOT_CERTIFICATES_PATH=/etc/eventstore/certs/ca
expose: expose:
- "1113" - "1113"
- "1112" - "1112"
- "2112"
- "2113" - "2113"
networks: networks:
app_net: app_net:
aliases: aliases:
- eventstore.local - cluster.tests.node-eventstore-client.local
- node2.tests.node-eventstore-client.local
ipv4_address: 192.168.33.11 ipv4_address: 192.168.33.11
volumes: volumes:
- type: volume - eventstore2-data:/var/lib/eventstore
source: eventstore-volume-data2 - ./certs:/etc/eventstore/certs:ro
target: /var/lib/eventstore-data
- type: volume
source: eventstore-volume-index2
target: /var/lib/eventstore-index
- type: volume
source: eventstore-volume-logs2
target: /var/log/eventstore
eventstore.db3: eventstore3:
image: eventstore/eventstore:release-5.0.8 image: eventstore/eventstore:21.10.9-buster-slim
environment: environment:
- EVENTSTORE_WORKER_THREADS=5
- EVENTSTORE_CLUSTER_SIZE=3 - EVENTSTORE_CLUSTER_SIZE=3
- EVENTSTORE_CLUSTER_DNS=cluster.tests.node-eventstore-client.local
- EVENTSTORE_ADVERTISE_HOST_TO_CLIENT_AS=node3.tests.node-eventstore-client.local
- EVENTSTORE_ADVERTISE_HTTP_PORT_TO_CLIENT_AS=2113
- EVENTSTORE_ADVERTISE_TCP_PORT_TO_CLIENT_AS=1113
# - EVENTSTORE_DISCOVER_VIA_DNS=False
# - EVENTSTORE_GOSSIP_SEED=192.168.33.10:2113,192.168.33.11:2113,192.168.33.12:2113
- EVENTSTORE_RUN_PROJECTIONS=All - EVENTSTORE_RUN_PROJECTIONS=All
- EVENTSTORE_DB=/var/lib/eventstore-data - EVENTSTORE_START_STANDARD_PROJECTIONS=True
- EVENTSTORE_INDEX=/var/lib/eventstore-index - EVENTSTORE_ENABLE_EXTERNAL_TCP=true
- EVENTSTORE_LOG=/var/log/eventstore
- EVENTSTORE_CLUSTER_GOSSIP_PORT=2112
- EVENTSTORE_INT_TCP_PORT=1112
- EVENTSTORE_EXT_TCP_PORT=1113 - EVENTSTORE_EXT_TCP_PORT=1113
- EVENTSTORE_INT_HTTP_PORT=2112 - EVENTSTORE_HTTP_PORT=2113
- EVENTSTORE_EXT_HTTP_PORT=2113
- EVENTSTORE_DISCOVER_VIA_DNS=true
- EVENTSTORE_CLUSTER_DNS=eventstore.local
- EVENTSTORE_INT_IP=192.168.33.12 - EVENTSTORE_INT_IP=192.168.33.12
- EVENTSTORE_EXT_IP=192.168.33.12 - EVENTSTORE_EXT_IP=192.168.33.12
- EVENTSTORE_CERTIFICATE_FILE=/etc/eventstore/certs/node3/node3.crt
- EVENTSTORE_CERTIFICATE_PRIVATE_KEY_FILE=/etc/eventstore/certs/node3/node3.key
- EVENTSTORE_TRUSTED_ROOT_CERTIFICATES_PATH=/etc/eventstore/certs/ca
expose: expose:
- "1113" - "1113"
- "1112" - "1112"
- "2112"
- "2113" - "2113"
networks: networks:
app_net: app_net:
aliases: aliases:
- eventstore.local - cluster.tests.node-eventstore-client.local
- node3.tests.node-eventstore-client.local
ipv4_address: 192.168.33.12 ipv4_address: 192.168.33.12
volumes: volumes:
- type: volume - eventstore3-data:/var/lib/eventstore-data
source: eventstore-volume-data3 - ./certs:/etc/eventstore/certs:ro
target: /var/lib/eventstore-data
- type: volume
source: eventstore-volume-index3
target: /var/lib/eventstore-index
- type: volume
source: eventstore-volume-logs3
target: /var/log/eventstore
nodejs: nodejs:
image: node:14 image: node:14
working_dir: /var/code working_dir: /var/build
volumes: volumes:
- .:/var/code - ./:/var/code:ro
- /var/code/node_modules - ./build-and-test.sh:/var/build/build-and-test.sh:ro
- ./certs:/var/certs:ro
environment:
- NODE_EXTRA_CA_CERTS=/var/certs/ca/ca.crt
command: bash -c "tail -f /dev/null" command: bash -c "tail -f /dev/null"
networks: networks:
- app_net app_net:
ipv4_address: 192.168.33.5
volumes: volumes:
eventstore-volume-data: eventstore1-data:
eventstore-volume-index: eventstore2-data:
eventstore-volume-logs: eventstore3-data:
eventstore-volume-data2:
eventstore-volume-index2:
eventstore-volume-logs2:
eventstore-volume-data3:
eventstore-volume-index3:
eventstore-volume-logs3:
networks: networks:
app_net: app_net:

View File

@ -1,50 +1,50 @@
version: '3.4' version: '3.4'
services: services:
eventstore.db: eventstore:
image: eventstore/eventstore:release-5.0.8 image: eventstore/eventstore:21.10.9-buster-slim
environment: environment:
- EVENTSTORE_CLUSTER_SIZE=1 - EVENTSTORE_CLUSTER_SIZE=1
- EVENTSTORE_RUN_PROJECTIONS=All - EVENTSTORE_RUN_PROJECTIONS=All
- EVENTSTORE_START_STANDARD_PROJECTIONS=True - EVENTSTORE_START_STANDARD_PROJECTIONS=True
- EVENTSTORE_DB=/var/lib/eventstore-data - EVENTSTORE_ENABLE_EXTERNAL_TCP=true
- EVENTSTORE_INDEX=/var/lib/eventstore-index
- EVENTSTORE_LOG=/var/log/eventstore
- EVENTSTORE_EXT_TCP_PORT=1113 - EVENTSTORE_EXT_TCP_PORT=1113
- EVENTSTORE_EXT_HTTP_PORT=2113 - EVENTSTORE_HTTP_PORT=2113
- EVENTSTORE_INT_IP=192.168.33.10 - EVENTSTORE_INT_IP=192.168.33.10
- EVENTSTORE_EXT_IP=192.168.33.10 - EVENTSTORE_EXT_IP=192.168.33.10
- EVENTSTORE_CERTIFICATE_FILE=/etc/eventstore/certs/node1/node1.crt
- EVENTSTORE_CERTIFICATE_PRIVATE_KEY_FILE=/etc/eventstore/certs/node1/node1.key
- EVENTSTORE_TRUSTED_ROOT_CERTIFICATES_PATH=/etc/eventstore/certs/ca
ports: ports:
- "1113:1113" - "1113:1113"
- "2113:2113" - "2113:2113"
tmpfs:
- /var/log/eventstore
volumes: volumes:
- type: volume - eventstore-data:/var/lib/eventstore
source: eventstore-volume-data - ./certs:/etc/eventstore/certs:ro
target: /var/lib/eventstore-data
- type: volume
source: eventstore-volume-index
target: /var/lib/eventstore-index
- type: volume
source: eventstore-volume-logs
target: /var/log/eventstore
networks: networks:
app_net: app_net:
aliases:
- node1.tests.node-eventstore-client.local
ipv4_address: 192.168.33.10 ipv4_address: 192.168.33.10
nodejs: nodejs:
image: node:14 image: node:14
working_dir: /var/code working_dir: /var/build
volumes: volumes:
- .:/var/code - ./:/var/code:ro
- /var/code/node_modules - ./build-and-test.sh:/var/build/build-and-test.sh:ro
- ./certs:/var/certs:ro
environment:
- NODE_EXTRA_CA_CERTS=/var/certs/ca/ca.crt
command: bash -c "tail -f /dev/null" command: bash -c "tail -f /dev/null"
networks: networks:
- app_net app_net:
ipv4_address: 192.168.33.5
volumes: volumes:
eventstore-volume-data: eventstore-data:
eventstore-volume-index:
eventstore-volume-logs:
networks: networks:
app_net: app_net:

9971
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,18 @@
{ {
"name": "node-eventstore-client", "name": "node-eventstore-client",
"version": "0.2.17", "version": "21.10.0",
"description": "A port of the EventStore .Net ClientAPI to Node.js", "description": "A port of the EventStore .Net ClientAPI to Node.js",
"main": "index.js", "main": "index.js",
"types": "index.d.ts", "types": "index.d.ts",
"engines": { "engines": {
"node": ">=5.10" "node": ">=14",
"npm": ">=6"
}, },
"engineStrict": true, "engineStrict": true,
"scripts": { "scripts": {
"clean": "rm -f lib/dist.js", "clean": "rm -f lib/dist.js",
"prebuild": "npm run clean", "prebuild": "npm run clean",
"build": "webpack -o ./lib/dist.js", "build": "webpack",
"pretest": "npm run build", "pretest": "npm run build",
"test": "nodeunit", "test": "nodeunit",
"test-debug": "TESTS_VERBOSE_LOGGING=1 nodeunit", "test-debug": "TESTS_VERBOSE_LOGGING=1 nodeunit",
@ -23,10 +24,10 @@
"compose:cluster:start": "docker-compose -f docker-compose-cluster.yaml up --build -d", "compose:cluster:start": "docker-compose -f docker-compose-cluster.yaml up --build -d",
"compose:single:stop": "docker-compose -f docker-compose-single.yaml down -v --remove-orphans", "compose:single:stop": "docker-compose -f docker-compose-single.yaml down -v --remove-orphans",
"compose:cluster:stop": "docker-compose -f docker-compose-cluster.yaml down -v --remove-orphans", "compose:cluster:stop": "docker-compose -f docker-compose-cluster.yaml down -v --remove-orphans",
"compose:wait": "while [[ \"$(curl -s -o /dev/null -w ''%{http_code}'' localhost:2113/ping)\" != \"200\" ]]; do sleep 5; done", "compose:wait": "while [ \"$(curl -s -o /dev/null -w ''%{http_code}'' -k https://localhost:2113/ping)\" != \"200\" ]; do sleep 5; done",
"compose:single:test": "docker-compose -f docker-compose-single.yaml exec nodejs bash -c \"npm i && npm run build && EVENTSTORE_CONNECTION_TYPE=tcp EVENTSTORE_HOST=192.168.33.10 npm run test-debug\"", "compose:single:test": "docker-compose -f docker-compose-single.yaml exec nodejs bash -c \"EVENTSTORE_CONNECTION_TYPE=tcp EVENTSTORE_HOST=192.168.33.10 ./build-and-test.sh\"",
"compose:cluster:test": "docker-compose -f docker-compose-cluster.yaml exec nodejs bash -c \"npm i && npm run build && EVENTSTORE_CONNECTION_TYPE=gossip EVENTSTORE_HOST=192.168.33.10 EVENTSTORE_HOST_1=192.168.33.10 EVENTSTORE_HOST_2=192.168.33.11 EVENTSTORE_HOST_3=192.168.33.12 npm run test-debug\"", "compose:gossip:test": "docker-compose -f docker-compose-cluster.yaml exec nodejs bash -c \"EVENTSTORE_CONNECTION_TYPE=gossip EVENTSTORE_HOST=192.168.33.10 EVENTSTORE_HOST_1=192.168.33.10 EVENTSTORE_HOST_2=192.168.33.11 EVENTSTORE_HOST_3=192.168.33.12 ./build-and-test.sh\"",
"compose:gossip:test": "docker-compose -f docker-compose-cluster.yaml exec nodejs bash -c \"npm i && npm run build && EVENTSTORE_CONNECTION_TYPE=dns EVENTSTORE_HOST=192.168.33.10 npm run test-debug\"", "compose:cluster:test": "docker-compose -f docker-compose-cluster.yaml exec nodejs bash -c \"EVENTSTORE_CONNECTION_TYPE=dns EVENTSTORE_HOST=cluster.tests.node-eventstore-client.local ./build-and-test.sh\"",
"prepublishOnly": "npm run build && npm run gendocs", "prepublishOnly": "npm run build && npm run gendocs",
"gendocs": "rm -rf docs && jsdoc src -r -d docs" "gendocs": "rm -rf docs && jsdoc src -r -d docs"
}, },
@ -58,18 +59,18 @@
}, },
"homepage": "https://github.com/nicdex/node-eventstore-client#readme", "homepage": "https://github.com/nicdex/node-eventstore-client#readme",
"dependencies": { "dependencies": {
"@types/long": "^3.0.32", "@types/node": ">=14",
"@types/node": ">=5.10", "long": "^5.2.0",
"long": "^3.2.0", "protobufjs": "^7.1.2",
"protobufjs": "^6.8.8", "protobufjs-cli": "^1.0.2",
"strict-event-emitter-types": "^1.2.0", "strict-event-emitter-types": "^1.2.0",
"uuid": "^3.0.1" "uuid": "^9.0.0"
}, },
"devDependencies": { "devDependencies": {
"jest": "^26.4.2", "jest": "^29.4.1",
"jsdoc": "^3.6.3", "jsdoc": "^4.0.0",
"nodeunit": "^0.11.3", "nodeunit": "^0.11.3",
"webpack": "^4.41.2", "webpack": "^5.75.0",
"webpack-cli": "^3.3.10" "webpack-cli": "^3.3.10"
} }
} }

View File

@ -37,7 +37,7 @@ AppendToStreamOperation.prototype._createRequestDto = function() {
eventStreamId: this._stream, eventStreamId: this._stream,
expectedVersion: this._expectedVersion, expectedVersion: this._expectedVersion,
events: dtos, events: dtos,
requireMaster: this._requireMaster}); requireLeader: this._requireMaster});
}; };
AppendToStreamOperation.prototype._inspectResponse = function(response) { AppendToStreamOperation.prototype._inspectResponse = function(response) {

View File

@ -24,7 +24,7 @@ util.inherits(CommitTransactionOperation, OperationBase);
CommitTransactionOperation.prototype._createRequestDto = function() { CommitTransactionOperation.prototype._createRequestDto = function() {
return new ClientMessage.TransactionCommit({ return new ClientMessage.TransactionCommit({
transactionId: this._transactionId, transactionId: this._transactionId,
requireMaster: this._requireMaster requireLeader: this._requireMaster
}); });
}; };

View File

@ -27,7 +27,7 @@ DeleteStreamOperation.prototype._createRequestDto = function() {
return new ClientMessage.DeleteStream({ return new ClientMessage.DeleteStream({
eventStreamId: this._stream, eventStreamId: this._stream,
expectedVersion: this._expectedVersion, expectedVersion: this._expectedVersion,
requireMaster: this._requireMaster, requireLeader: this._requireMaster,
hardDelete: this._hardDelete hardDelete: this._hardDelete
}); });
}; };

View File

@ -117,9 +117,9 @@ OperationBase.prototype._inspectNotHandled = function(pkg)
case ClientMessage.NotHandled.NotHandledReason.TooBusy: case ClientMessage.NotHandled.NotHandledReason.TooBusy:
return new InspectionResult(InspectionDecision.Retry, "NotHandled - TooBusy"); return new InspectionResult(InspectionDecision.Retry, "NotHandled - TooBusy");
case ClientMessage.NotHandled.NotHandledReason.NotMaster: case ClientMessage.NotHandled.NotHandledReason.NotLeader:
var masterInfo = ClientMessage.NotHandled.MasterInfo.decode(message.additionalInfo); var masterInfo = ClientMessage.NotHandled.LeaderInfo.decode(message.additionalInfo);
return new InspectionResult(InspectionDecision.Reconnect, "NotHandled - NotMaster", return new InspectionResult(InspectionDecision.Reconnect, "NotHandled - NotLeader",
{host: masterInfo.externalTcpAddress, port: masterInfo.externalTcpPort}, {host: masterInfo.externalTcpAddress, port: masterInfo.externalTcpPort},
{host: masterInfo.externalSecureTcpAddress, port: masterInfo.externalSecureTcpPort}); {host: masterInfo.externalSecureTcpAddress, port: masterInfo.externalSecureTcpPort});

View File

@ -29,7 +29,7 @@ ReadAllEventsBackwardOperation.prototype._createRequestDto = function() {
preparePosition: this._position.preparePosition, preparePosition: this._position.preparePosition,
maxCount: this._maxCount, maxCount: this._maxCount,
resolveLinkTos: this._resolveLinkTos, resolveLinkTos: this._resolveLinkTos,
requireMaster: this._requireMaster requireLeader: this._requireMaster
}); });
}; };

View File

@ -29,7 +29,7 @@ ReadAllEventsForwardOperation.prototype._createRequestDto = function() {
preparePosition: this._position.preparePosition, preparePosition: this._position.preparePosition,
maxCount: this._maxCount, maxCount: this._maxCount,
resolveLinkTos: this._resolveLinkTos, resolveLinkTos: this._resolveLinkTos,
requireMaster: this._requireMaster requireLeader: this._requireMaster
}); });
}; };

View File

@ -25,7 +25,7 @@ ReadEventOperation.prototype._createRequestDto = function() {
eventStreamId: this._stream, eventStreamId: this._stream,
eventNumber: this._eventNumber, eventNumber: this._eventNumber,
resolveLinkTos: this._resolveLinkTos, resolveLinkTos: this._resolveLinkTos,
requireMaster: this._requireMaster requireLeader: this._requireMaster
}); });
}; };

View File

@ -31,7 +31,7 @@ ReadStreamEventsBackwardOperation.prototype._createRequestDto = function() {
fromEventNumber: this._fromEventNumber, fromEventNumber: this._fromEventNumber,
maxCount: this._maxCount, maxCount: this._maxCount,
resolveLinkTos: this._resolveLinkTos, resolveLinkTos: this._resolveLinkTos,
requireMaster: this._requireMaster requireLeader: this._requireMaster
}); });
}; };

View File

@ -31,7 +31,7 @@ ReadStreamEventsForwardOperation.prototype._createRequestDto = function() {
fromEventNumber: this._fromEventNumber, fromEventNumber: this._fromEventNumber,
maxCount: this._maxCount, maxCount: this._maxCount,
resolveLinkTos: this._resolveLinkTos, resolveLinkTos: this._resolveLinkTos,
requireMaster: this._requireMaster requireLeader: this._requireMaster
}); });
}; };

View File

@ -25,7 +25,7 @@ StartTransactionOperation.prototype._createRequestDto = function() {
return new ClientMessage.TransactionStart({ return new ClientMessage.TransactionStart({
eventStreamId: this._stream, eventStreamId: this._stream,
expectedVersion: this._expectedVersion, expectedVersion: this._expectedVersion,
requireMaster: this._requireMaster requireLeader: this._requireMaster
}); });
}; };

View File

@ -137,9 +137,9 @@ SubscriptionOperation.prototype.inspectPackage = function(pkg) {
case ClientMessage.NotHandled.NotHandledReason.TooBusy: case ClientMessage.NotHandled.NotHandledReason.TooBusy:
return new InspectionResult(InspectionDecision.Retry, "NotHandled - TooBusy"); return new InspectionResult(InspectionDecision.Retry, "NotHandled - TooBusy");
case ClientMessage.NotHandled.NotHandledReason.NotMaster: case ClientMessage.NotHandled.NotHandledReason.NotLeader:
var masterInfo = ClientMessage.NotHandled.MasterInfo.decode(message.additionalInfo); var masterInfo = ClientMessage.NotHandled.LeaderInfo.decode(message.additionalInfo);
return new InspectionResult(InspectionDecision.Reconnect, "NotHandled - NotMaster", return new InspectionResult(InspectionDecision.Reconnect, "NotHandled - NotLeader",
{host: masterInfo.externalTcpAddress, port: masterInfo.externalTcpPort}, {host: masterInfo.externalTcpAddress, port: masterInfo.externalTcpPort},
{host: masterInfo.externalSecureTcpAddress, port: masterInfo.externalSecureTcpPort}); {host: masterInfo.externalSecureTcpAddress, port: masterInfo.externalSecureTcpPort});

View File

@ -32,7 +32,7 @@ TransactionalWriteOperation.prototype._createRequestDto = function() {
return new ClientMessage.TransactionWrite({ return new ClientMessage.TransactionWrite({
transactionId: this._transactionId, transactionId: this._transactionId,
events: dtos, events: dtos,
requireMaster: this._requireMaster requireLeader: this._requireMaster
}); });
}; };

View File

@ -78,7 +78,7 @@ ClusterDiscoverer.prototype._getGossipCandidates = async function (managerExtern
this._settings.seeds && this._settings.seeds.length > 0 this._settings.seeds && this._settings.seeds.length > 0
? this._settings.seeds ? this._settings.seeds
: (await this._resolveDns(this._settings.clusterDns)).map( : (await this._resolveDns(this._settings.clusterDns)).map(
(address) => new GossipSeed({ host: address, port: managerExternalHttpPort }, undefined) (address) => new GossipSeed({ host: address, port: managerExternalHttpPort }, address, this._settings.clusterDns)
); );
return shuffle(gossipSeeds); return shuffle(gossipSeeds);
}; };
@ -109,12 +109,14 @@ ClusterDiscoverer.prototype._resolveDns = async function (clusterDns) {
* @returns {Promise.<ClusterInfo>} * @returns {Promise.<ClusterInfo>}
*/ */
ClusterDiscoverer.prototype._clusterInfo = async function (candidate, timeout) { ClusterDiscoverer.prototype._clusterInfo = async function (candidate, timeout) {
var self = this;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const options = { const options = {
host: candidate.endPoint.host, host: candidate.endPoint.host,
port: candidate.endPoint.port, port: candidate.endPoint.port,
path: '/gossip?format=json', path: '/gossip?format=json',
timeout: timeout, timeout: timeout,
rejectUnauthorized: self._settings.rejectUnauthorized
}; };
if (candidate.hostHeader) { if (candidate.hostHeader) {
options.headers = { options.headers = {

View File

@ -2,16 +2,21 @@ const MemberInfo = require('./memberInfo.js');
const VNodeStates = Object.freeze({ const VNodeStates = Object.freeze({
Initializing: 0, Initializing: 0,
Unknown: 1, DiscoverLeader: 1,
PreReplica: 2, Unknown: 2,
CatchingUp: 3, PreReplica: 3,
Clone: 4, CatchingUp: 4,
Slave: 5, Clone: 5,
PreMaster: 6, Follower: 6,
Master: 7, PreLeader: 7,
Manager: 8, Leader: 8,
ShuttingDown: 9, Manager: 9,
Shutdown: 10 ShuttingDown: 10,
Shutdown: 11,
ReadOnlyLeaderless: 12,
PreReadOnlyReplica: 13,
ReadOnlyReplica: 14,
ResigningLeader: 15,
}); });
function ClusterInfo(members) { function ClusterInfo(members) {

View File

@ -6,6 +6,7 @@ var ensure = require('./common/utils/ensure');
const util = require('util'); const util = require('util');
const http = require('http'); const http = require('http');
const https = require('https');
const dns = require('dns'); const dns = require('dns');
const dnsService = { const dnsService = {
@ -95,13 +96,14 @@ function createFromClusterDns(connectionSettings, clusterDns, externalGossipPort
managerExternalHttpPort: externalGossipPort, managerExternalHttpPort: externalGossipPort,
maxDiscoverAttempts: mergedSettings.maxDiscoverAttempts, maxDiscoverAttempts: mergedSettings.maxDiscoverAttempts,
discoverDelay: mergedSettings.discoverDelay, discoverDelay: mergedSettings.discoverDelay,
gossipTimeout: mergedSettings.gossipTimeout gossipTimeout: mergedSettings.gossipTimeout,
rejectUnauthorized: connectionSettings.useSslConnection ? connectionSettings.validateServer : undefined
}; };
var endPointDiscoverer = new ClusterDiscoverer( var endPointDiscoverer = new ClusterDiscoverer(
mergedSettings.log, mergedSettings.log,
clusterSettings, clusterSettings,
dnsService, dnsService,
http connectionSettings.useSslConnection ? https : http
); );
return new EventStoreNodeConnection(mergedSettings, clusterSettings, endPointDiscoverer, connectionName); return new EventStoreNodeConnection(mergedSettings, clusterSettings, endPointDiscoverer, connectionName);
} }
@ -116,13 +118,14 @@ function createFromGossipSeeds(connectionSettings, gossipSeeds, connectionName)
externalGossipPort: 0, externalGossipPort: 0,
maxDiscoverAttempts: mergedSettings.maxDiscoverAttempts, maxDiscoverAttempts: mergedSettings.maxDiscoverAttempts,
discoverDelay: mergedSettings.discoverDelay, discoverDelay: mergedSettings.discoverDelay,
gossipTimeout: mergedSettings.gossipTimeout gossipTimeout: mergedSettings.gossipTimeout,
rejectUnauthorized: connectionSettings.useSslConnection ? connectionSettings.validateServer : undefined
}; };
var endPointDiscoverer = new ClusterDiscoverer( var endPointDiscoverer = new ClusterDiscoverer(
mergedSettings.log, mergedSettings.log,
clusterSettings, clusterSettings,
dnsService, dnsService,
http connectionSettings.useSslConnection ? https : http
); );
return new EventStoreNodeConnection(mergedSettings, clusterSettings, endPointDiscoverer, connectionName); return new EventStoreNodeConnection(mergedSettings, clusterSettings, endPointDiscoverer, connectionName);
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
syntax = "proto2";
package EventStore.Client.Messages; package EventStore.Client.Messages;
enum OperationResult enum OperationResult
@ -50,7 +52,7 @@ message WriteEvents {
required string event_stream_id = 1; required string event_stream_id = 1;
required int64 expected_version = 2; required int64 expected_version = 2;
repeated NewEvent events = 3; repeated NewEvent events = 3;
required bool require_master = 4; required bool require_leader = 4;
} }
message WriteEventsCompleted { message WriteEventsCompleted {
@ -66,7 +68,7 @@ message WriteEventsCompleted {
message DeleteStream { message DeleteStream {
required string event_stream_id = 1; required string event_stream_id = 1;
required int64 expected_version = 2; required int64 expected_version = 2;
required bool require_master = 3; required bool require_leader = 3;
optional bool hard_delete = 4; optional bool hard_delete = 4;
} }
@ -75,12 +77,13 @@ message DeleteStreamCompleted {
optional string message = 2; optional string message = 2;
optional int64 prepare_position = 3; optional int64 prepare_position = 3;
optional int64 commit_position = 4; optional int64 commit_position = 4;
optional int64 current_version = 5;
} }
message TransactionStart { message TransactionStart {
required string event_stream_id = 1; required string event_stream_id = 1;
required int64 expected_version = 2; required int64 expected_version = 2;
required bool require_master = 3; required bool require_leader = 3;
} }
message TransactionStartCompleted { message TransactionStartCompleted {
@ -92,7 +95,7 @@ message TransactionStartCompleted {
message TransactionWrite { message TransactionWrite {
required int64 transaction_id = 1; required int64 transaction_id = 1;
repeated NewEvent events = 2; repeated NewEvent events = 2;
required bool require_master = 3; required bool require_leader = 3;
} }
message TransactionWriteCompleted { message TransactionWriteCompleted {
@ -103,7 +106,7 @@ message TransactionWriteCompleted {
message TransactionCommit { message TransactionCommit {
required int64 transaction_id = 1; required int64 transaction_id = 1;
required bool require_master = 2; required bool require_leader = 2;
} }
message TransactionCommitCompleted { message TransactionCommitCompleted {
@ -120,7 +123,7 @@ message ReadEvent {
required string event_stream_id = 1; required string event_stream_id = 1;
required int64 event_number = 2; required int64 event_number = 2;
required bool resolve_link_tos = 3; required bool resolve_link_tos = 3;
required bool require_master = 4; required bool require_leader = 4;
} }
message ReadEventCompleted { message ReadEventCompleted {
@ -145,7 +148,7 @@ message ReadStreamEvents {
required int64 from_event_number = 2; required int64 from_event_number = 2;
required int32 max_count = 3; required int32 max_count = 3;
required bool resolve_link_tos = 4; required bool resolve_link_tos = 4;
required bool require_master = 5; required bool require_leader = 5;
} }
message ReadStreamEventsCompleted { message ReadStreamEventsCompleted {
@ -174,7 +177,7 @@ message ReadAllEvents {
required int64 prepare_position = 2; required int64 prepare_position = 2;
required int32 max_count = 3; required int32 max_count = 3;
required bool resolve_link_tos = 4; required bool resolve_link_tos = 4;
required bool require_master = 5; required bool require_leader = 5;
} }
message ReadAllEventsCompleted { message ReadAllEventsCompleted {
@ -196,6 +199,54 @@ message ReadAllEventsCompleted {
optional string error = 7; optional string error = 7;
} }
message Filter{
enum FilterContext {
StreamId = 0;
EventType = 1;
}
enum FilterType {
Regex = 0;
Prefix = 1;
}
required FilterContext context = 1;
required FilterType type = 2;
repeated string data = 3;
}
message FilteredReadAllEvents {
required int64 commit_position = 1;
required int64 prepare_position = 2;
required int32 max_count = 3;
optional int32 max_search_window = 4;
required bool resolve_link_tos = 5;
required bool require_leader = 6;
required Filter filter = 7;
}
message FilteredReadAllEventsCompleted {
enum FilteredReadAllResult {
Success = 0;
NotModified = 1;
Error = 2;
AccessDenied = 3;
}
required int64 commit_position = 1;
required int64 prepare_position = 2;
repeated ResolvedEvent events = 3;
required int64 next_commit_position = 4;
required int64 next_prepare_position = 5;
required bool is_end_of_stream = 6;
optional FilteredReadAllResult result = 7 [default = Success];
optional string error = 8;
}
message CreatePersistentSubscription { message CreatePersistentSubscription {
required string subscription_group_name = 1; required string subscription_group_name = 1;
required string event_stream_id = 2; required string event_stream_id = 2;
@ -307,6 +358,7 @@ message PersistentSubscriptionConfirmation {
message PersistentSubscriptionStreamEventAppeared { message PersistentSubscriptionStreamEventAppeared {
required ResolvedIndexedEvent event = 1; required ResolvedIndexedEvent event = 1;
optional int32 retryCount = 2;
} }
message SubscribeToStream { message SubscribeToStream {
@ -314,6 +366,18 @@ message SubscribeToStream {
required bool resolve_link_tos = 2; required bool resolve_link_tos = 2;
} }
message FilteredSubscribeToStream {
required string event_stream_id = 1;
required bool resolve_link_tos = 2;
required Filter filter = 3;
required int32 checkpoint_interval = 4;
}
message CheckpointReached {
required int64 commit_position = 1;
required int64 prepare_position = 2;
}
message SubscriptionConfirmation { message SubscriptionConfirmation {
required int64 last_commit_position = 1; required int64 last_commit_position = 1;
optional int64 last_event_number = 2; optional int64 last_event_number = 2;
@ -344,17 +408,18 @@ message NotHandled {
enum NotHandledReason { enum NotHandledReason {
NotReady = 0; NotReady = 0;
TooBusy = 1; TooBusy = 1;
NotMaster = 2; NotLeader = 2;
IsReadOnly = 3;
} }
required NotHandledReason reason = 1; required NotHandledReason reason = 1;
optional bytes additional_info = 2; optional bytes additional_info = 2;
message MasterInfo { message LeaderInfo {
required string external_tcp_address = 1; optional string external_tcp_address = 1;
required int32 external_tcp_port = 2; optional int32 external_tcp_port = 2;
required string external_http_address = 3; required string http_address = 3;
required int32 external_http_port = 4; required int32 http_port = 4;
optional string external_secure_tcp_address = 5; optional string external_secure_tcp_address = 5;
optional int32 external_secure_tcp_port = 6; optional int32 external_secure_tcp_port = 6;
} }
@ -363,18 +428,17 @@ message NotHandled {
message ScavengeDatabase { message ScavengeDatabase {
} }
message ScavengeDatabaseCompleted { message ScavengeDatabaseResponse {
enum ScavengeResult { enum ScavengeResult {
Success = 0; Started = 0;
InProgress = 1; InProgress = 1;
Failed = 2; Unauthorized = 2;
} }
required ScavengeResult result = 1; required ScavengeResult result = 1;
optional string error = 2; optional string scavengeId = 2;
required int32 total_time_ms = 3;
required int64 total_space_saved = 4;
} }
message IdentifyClient { message IdentifyClient {

View File

@ -15,9 +15,10 @@ function safeParseJson(json) {
} }
} }
function ProjectionsClient(log, operationTimeout) { function ProjectionsClient(log, operationTimeout, rejectUnauthorized) {
this._log = log; this._log = log;
this._operationTimeout = operationTimeout; this._operationTimeout = operationTimeout;
this._rejectUnauthorized = typeof rejectUnauthorized === 'undefined' ? true : !!rejectUnauthorized;
} }
ProjectionsClient.prototype.enable = function(httpEndPoint, name, userCredentials) { ProjectionsClient.prototype.enable = function(httpEndPoint, name, userCredentials) {
@ -118,6 +119,9 @@ ProjectionsClient.prototype.request = function(method, _url, data, userCredentia
if (userCredentials) { if (userCredentials) {
options.auth = [userCredentials.username, userCredentials.password].join(':'); options.auth = [userCredentials.username, userCredentials.password].join(':');
} }
if (!this._rejectUnauthorized) {
options.rejectUnauthorized = false;
}
var self = this; var self = this;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
const timeout = setTimeout(function () { const timeout = setTimeout(function () {

View File

@ -6,12 +6,13 @@ const ProjectionsClient = require('./projectionsClient');
* @param {Logger} log Instance of Logger to use for logging. * @param {Logger} log Instance of Logger to use for logging.
* @param {string} httpEndPoint HTTP endpoint of an Event Store server. * @param {string} httpEndPoint HTTP endpoint of an Event Store server.
* @param {number} operationTimeout Operation timeout in milliseconds. * @param {number} operationTimeout Operation timeout in milliseconds.
* @param {boolean} [rejectUnauthorized] Reject authorized SSL certs (if using SSL) - set to false is using self-signed certs
* @constructor * @constructor
*/ */
function ProjectionsManager(log, httpEndPoint, operationTimeout) { function ProjectionsManager(log, httpEndPoint, operationTimeout, rejectUnauthorized) {
ensure.notNull(log, "log"); ensure.notNull(log, "log");
ensure.notNull(httpEndPoint, "httpEndPoint"); ensure.notNull(httpEndPoint, "httpEndPoint");
this._client = new ProjectionsClient(log, operationTimeout); this._client = new ProjectionsClient(log, operationTimeout, rejectUnauthorized);
this._httpEndPoint = httpEndPoint; this._httpEndPoint = httpEndPoint;
} }

View File

@ -12,6 +12,8 @@ protobufJS.configure();
var settings = { var settings = {
log: new NoopLogger(), log: new NoopLogger(),
useSslConnection: true,
validateServer: false
}; };
if (process.env.TESTS_VERBOSE_LOGGING === '1') { if (process.env.TESTS_VERBOSE_LOGGING === '1') {
settings.verboseLogging = true; settings.verboseLogging = true;
@ -53,7 +55,7 @@ function setUpWithGossipSeeds(cb) {
} }
function setUpWithDns(cb) { function setUpWithDns(cb) {
var clusterDns = 'discover://eventstore.local:2113'; var clusterDns = 'discover://' + process.env.EVENTSTORE_HOST + ':2113';
this.log = settings.log; this.log = settings.log;
this.testStreamName = 'test-' + uuid.v4(); this.testStreamName = 'test-' + uuid.v4();
var connected = false; var connected = false;

View File

@ -62,7 +62,7 @@ switch(evenstStoreType){
case 'dns': case 'dns':
module.exports['Connect to Cluster using dns discover'] = function (test) { module.exports['Connect to Cluster using dns discover'] = function (test) {
test.expect(1); test.expect(1);
var clusterDns = 'discover://eventstore.local:2113'; var clusterDns = 'discover://' + process.env.EVENTSTORE_HOST + ':2113';
var conn = client.EventStoreConnection.create(testBase.settings(), clusterDns); var conn = client.EventStoreConnection.create(testBase.settings(), clusterDns);
conn.connect() conn.connect()
.catch(function(err) { .catch(function(err) {
@ -83,7 +83,7 @@ switch(evenstStoreType){
module.exports['Connect To Cluster with bad dns discover'] = function (test) { module.exports['Connect To Cluster with bad dns discover'] = function (test) {
test.expect(3); test.expect(3);
var clusterDns = 'discover://eventstore-bad.local:2113'; var clusterDns = 'discover://abc.def.com:2113';
var conn = client.EventStoreConnection.create(testBase.settings({maxDiscoverAttempts: 1}), clusterDns); var conn = client.EventStoreConnection.create(testBase.settings({maxDiscoverAttempts: 1}), clusterDns);
conn.connect() conn.connect()
.catch(function (err) { .catch(function (err) {
@ -91,6 +91,7 @@ switch(evenstStoreType){
}); });
conn.on('connected', function () { conn.on('connected', function () {
test.ok(false, 'Should not be able to connect.'); test.ok(false, 'Should not be able to connect.');
conn.close();
}); });
conn.on('error', function (err) { conn.on('error', function (err) {
test.ok(err.message.indexOf('Failed to discover candidate in 1 attempts') === 0, 'Wrong expected reason.'); test.ok(err.message.indexOf('Failed to discover candidate in 1 attempts') === 0, 'Wrong expected reason.');

View File

@ -41,7 +41,7 @@ module.exports = {
done(); done();
} }
var self = this; var self = this;
this.conn.connectToPersistentSubscription(testStreamName, 'consumer-1', eventAppeared, subscriptionDropped) this.conn.connectToPersistentSubscription(testStreamName, 'consumer-1', eventAppeared, subscriptionDropped, adminCredentials)
.then(function(subscription) { .then(function(subscription) {
test.ok(subscription, "Subscription is null."); test.ok(subscription, "Subscription is null.");
return self.conn.appendToStream(testStreamName, client.expectedVersion.any, [createRandomEvent(), createRandomEvent()]); return self.conn.appendToStream(testStreamName, client.expectedVersion.any, [createRandomEvent(), createRandomEvent()]);

View File

@ -2,7 +2,7 @@ const client = require('../lib/dist');
const userCredentials = new client.UserCredentials('admin', 'changeit'); const userCredentials = new client.UserCredentials('admin', 'changeit');
const log = new client.NoopLogger(); const log = new client.NoopLogger();
const httpEndpoint = `http://${process.env.EVENTSTORE_HOST || "localhost"}:2113`; const httpEndpoint = `https://${process.env.EVENTSTORE_HOST || "localhost"}:2113`;
const operationTimeout = 5000; const operationTimeout = 5000;
const simpleProjection = "\ const simpleProjection = "\
@ -21,7 +21,7 @@ fromStream('$stats-127.0.0.1:2113')\
module.exports = { module.exports = {
setUp: function(cb) { setUp: function(cb) {
this.projectionsManager = new client.ProjectionsManager(log, httpEndpoint, operationTimeout); this.projectionsManager = new client.ProjectionsManager(log, httpEndpoint, operationTimeout, false);
cb(); cb();
}, },
'Create One Time Projection Happy Path': function(test) { 'Create One Time Projection Happy Path': function(test) {