Compare commits

...

5 Commits

Author SHA1 Message Date
Nicolas Dextraze
80f2e7e50f Merge branch 'release-22.10' 2023-01-30 16:17:53 -05:00
Nicolas Dextraze
9bbc961d52 version 22.10.0 2023-01-30 16:17:22 -05:00
Nicolas Dextraze
3a2e30281f Merge branch 'release-22.10' 2023-01-30 15:42:07 -05:00
Nicolas Dextraze
a48e4fa386 compatibility for 22.x 2023-01-30 15:37:10 -05:00
Nicolas Dextraze
c422057f5f start with release-21.10 code changes 2023-01-30 15:08:59 -05:00
41 changed files with 17717 additions and 18476 deletions

1
.gitignore vendored
View File

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

1
.nvmrc Normal file
View File

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

View File

@ -24,14 +24,22 @@ If you want to learn more about EventSourcing/EventModeling, you can join one of
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
- 22.10.x for ES 22.10 LTS
### 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`)
### 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`.*

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 +1,23 @@
-----BEGIN CERTIFICATE-----
MIIDzTCCArWgAwIBAgIRAJD0c8z8ITssb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m91cDEZMBcGA1UEAwwQZXZlbnRzdG9yZS5sb2Nh
bDAeFw0yMTA1MDYyMDAyMzZaFw0zMTA1MDQyMDAyMzZaMGIxCzAJBgNVBAYTAkNB
MQswCQYDVQQIDAJCQzESMBAGA1UEBwwJVmFuY291dmVyMRcwFQYDVQQKDA5BZGFw
dGVjaCBHcm91cDEZMBcGA1UEAwwQZXZlbnRzdG9yZS5sb2NhbDCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBANbNrVQ91TFVsrfFV39/1MjxM/UIP78FaX+S
kxAzcpAJKP9PbHLwFXxkl0Bam+3ekE6+hc3qT8o4ksOdzwz+dJbdZF8gblLda7vq
JnPjkAZuhojRLPfXvaJZbManEkB30+JIvb/XWhMf34+kvyZaOnKqidzNAuLAFQ+6
KCCXYnTUFimumr6AsrZvA9UzN3edrk1pqxMYNT+8MBOUnNfkdHX78aTzdWvq4+Ro
+58MT3NpqdI+1cY423JlG2qj8PAqPsgdE4XvmtqDtLndH+VflR1M1Rkn41cofgSh
lo7PE2SNn4hSv8m+1HJMfcegJEXKE3LIGHJtV6qT6S+pRtJd9mcCAwEAATANBgkq
hkiG9w0BAQsFAAOCAQEAlhKziHmYm81vrx+EHqIZXvmoUp3I1A9STvFqUdHrv9sa
8tKD7wW0owTVaxXBW3380ZFRpG3JVJFUgOyFIhi4IccWoqVsBCE0BBR96tlRXrKT
UZTAHLEk/SdLL+qfhKgY7F7+M9Wtf5HldiRfNoTqYn6YVXMJMgcwehhHho/fCHzj
tzOMfKFjGAq+n8cScLrTaW92JbbxjFPJJ7uQDH4OjAHx6pT885+RJf0rNqboAErA
lRLcEjtihslWKD7nelOlJE1egkum/m7MLVFpZPqEBp+x1zXdwacENwIhiRrQQhKi
8Qw36BuSCZ3CZK18kGyhtxl/uUP/wx7XXc1U0W2Wtw==
-----END CERTIFICATE-----

BIN
certs/eventstore.p12 Normal file

Binary file not shown.

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

@ -0,0 +1,24 @@
-----B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hyf27pPFJRegPB9ozm4P06MkvZMm4syxmoR1jJohm+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-----
MIIECDCCAvCgAwIBAgIQdipz5iGZgwtJYjBK4mjFijANBgkqhkiG9w0BA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oGBAOPIMM+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
MQswCQYDVQQGEwJVSzEYMBYGA1UEChMPRXZlbnQgU3RvcmUgTHRkMTkwNwYDVQQ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I9F3uqkpF5rcM1UGCc3maywXmLUd70NuTWM2G
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:
eventstore.db:
image: eventstore/eventstore:release-5.0.8
eventstore1:
image: eventstore/eventstore:22.10.0-buster-slim
environment:
- EVENTSTORE_WORKER_THREADS=5
- 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_DB=/var/lib/eventstore-data
- EVENTSTORE_INDEX=/var/lib/eventstore-index
- EVENTSTORE_LOG=/var/log/eventstore
- EVENTSTORE_CLUSTER_GOSSIP_PORT=2112
- EVENTSTORE_INT_TCP_PORT=1112
- EVENTSTORE_START_STANDARD_PROJECTIONS=True
- EVENTSTORE_ENABLE_EXTERNAL_TCP=true
- EVENTSTORE_EXT_TCP_PORT=1113
- EVENTSTORE_INT_HTTP_PORT=2112
- EVENTSTORE_EXT_HTTP_PORT=2113
- EVENTSTORE_DISCOVER_VIA_DNS=true
- EVENTSTORE_CLUSTER_DNS=eventstore.local
- EVENTSTORE_HTTP_PORT=2113
- EVENTSTORE_INT_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:
- "1112:1112"
- "1113:1113"
- "2112:2112"
- "2113:2113"
networks:
app_net:
aliases:
- eventstore.local
- cluster.tests.node-eventstore-client.local
- node1.tests.node-eventstore-client.local
ipv4_address: 192.168.33.10
volumes:
- type: volume
source: eventstore-volume-data
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
- eventstore1-data:/var/lib/eventstore
- ./certs:/etc/eventstore/certs:ro
eventstore.db2:
image: eventstore/eventstore:release-5.0.8
eventstore2:
image: eventstore/eventstore:22.10.0-buster-slim
environment:
- EVENTSTORE_WORKER_THREADS=5
- 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_DB=/var/lib/eventstore-data
- EVENTSTORE_INDEX=/var/lib/eventstore-index
- EVENTSTORE_LOG=/var/log/eventstore
- EVENTSTORE_CLUSTER_GOSSIP_PORT=2112
- EVENTSTORE_INT_TCP_PORT=1112
- EVENTSTORE_START_STANDARD_PROJECTIONS=True
- EVENTSTORE_ENABLE_EXTERNAL_TCP=true
- EVENTSTORE_EXT_TCP_PORT=1113
- EVENTSTORE_INT_HTTP_PORT=2112
- EVENTSTORE_EXT_HTTP_PORT=2113
- EVENTSTORE_DISCOVER_VIA_DNS=true
- EVENTSTORE_CLUSTER_DNS=eventstore.local
- EVENTSTORE_HTTP_PORT=2113
- EVENTSTORE_INT_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:
- "1113"
- "1112"
- "2112"
- "2113"
networks:
app_net:
aliases:
- eventstore.local
- cluster.tests.node-eventstore-client.local
- node2.tests.node-eventstore-client.local
ipv4_address: 192.168.33.11
volumes:
- type: volume
source: eventstore-volume-data2
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
- eventstore2-data:/var/lib/eventstore
- ./certs:/etc/eventstore/certs:ro
eventstore.db3:
image: eventstore/eventstore:release-5.0.8
eventstore3:
image: eventstore/eventstore:22.10.0-buster-slim
environment:
- EVENTSTORE_WORKER_THREADS=5
- 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_DB=/var/lib/eventstore-data
- EVENTSTORE_INDEX=/var/lib/eventstore-index
- EVENTSTORE_LOG=/var/log/eventstore
- EVENTSTORE_CLUSTER_GOSSIP_PORT=2112
- EVENTSTORE_INT_TCP_PORT=1112
- EVENTSTORE_START_STANDARD_PROJECTIONS=True
- EVENTSTORE_ENABLE_EXTERNAL_TCP=true
- EVENTSTORE_EXT_TCP_PORT=1113
- EVENTSTORE_INT_HTTP_PORT=2112
- EVENTSTORE_EXT_HTTP_PORT=2113
- EVENTSTORE_DISCOVER_VIA_DNS=true
- EVENTSTORE_CLUSTER_DNS=eventstore.local
- EVENTSTORE_HTTP_PORT=2113
- EVENTSTORE_INT_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:
- "1113"
- "1112"
- "2112"
- "2113"
networks:
app_net:
aliases:
- eventstore.local
- cluster.tests.node-eventstore-client.local
- node3.tests.node-eventstore-client.local
ipv4_address: 192.168.33.12
volumes:
- type: volume
source: eventstore-volume-data3
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
- eventstore3-data:/var/lib/eventstore-data
- ./certs:/etc/eventstore/certs:ro
nodejs:
image: node:14
working_dir: /var/code
working_dir: /var/build
volumes:
- .:/var/code
- /var/code/node_modules
- ./:/var/code:ro
- ./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"
networks:
- app_net
app_net:
ipv4_address: 192.168.33.5
volumes:
eventstore-volume-data:
eventstore-volume-index:
eventstore-volume-logs:
eventstore-volume-data2:
eventstore-volume-index2:
eventstore-volume-logs2:
eventstore-volume-data3:
eventstore-volume-index3:
eventstore-volume-logs3:
eventstore1-data:
eventstore2-data:
eventstore3-data:
networks:
app_net:

View File

@ -1,50 +1,50 @@
version: '3.4'
services:
eventstore.db:
image: eventstore/eventstore:release-5.0.8
eventstore:
image: eventstore/eventstore:22.10.0-buster-slim
environment:
- EVENTSTORE_CLUSTER_SIZE=1
- EVENTSTORE_RUN_PROJECTIONS=All
- EVENTSTORE_START_STANDARD_PROJECTIONS=True
- EVENTSTORE_DB=/var/lib/eventstore-data
- EVENTSTORE_INDEX=/var/lib/eventstore-index
- EVENTSTORE_LOG=/var/log/eventstore
- EVENTSTORE_ENABLE_EXTERNAL_TCP=true
- EVENTSTORE_EXT_TCP_PORT=1113
- EVENTSTORE_EXT_HTTP_PORT=2113
- EVENTSTORE_HTTP_PORT=2113
- EVENTSTORE_INT_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:
- "1113:1113"
- "2113:2113"
tmpfs:
- /var/log/eventstore
volumes:
- type: volume
source: eventstore-volume-data
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-data:/var/lib/eventstore
- ./certs:/etc/eventstore/certs:ro
networks:
app_net:
aliases:
- node1.tests.node-eventstore-client.local
ipv4_address: 192.168.33.10
nodejs:
image: node:14
working_dir: /var/code
working_dir: /var/build
volumes:
- .:/var/code
- /var/code/node_modules
- ./:/var/code:ro
- ./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"
networks:
- app_net
app_net:
ipv4_address: 192.168.33.5
volumes:
eventstore-volume-data:
eventstore-volume-index:
eventstore-volume-logs:
eventstore-data:
networks:
app_net:

9897
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,18 @@
{
"name": "node-eventstore-client",
"version": "0.2.17",
"version": "22.10.0",
"description": "A port of the EventStore .Net ClientAPI to Node.js",
"main": "index.js",
"types": "index.d.ts",
"engines": {
"node": ">=5.10"
"node": ">=14",
"npm": ">=6"
},
"engineStrict": true,
"scripts": {
"clean": "rm -f lib/dist.js",
"prebuild": "npm run clean",
"build": "webpack -o ./lib/dist.js",
"build": "webpack",
"pretest": "npm run build",
"test": "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: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:wait": "while [[ \"$(curl -s -o /dev/null -w ''%{http_code}'' 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: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 \"npm i && npm run build && EVENTSTORE_CONNECTION_TYPE=dns EVENTSTORE_HOST=192.168.33.10 npm run test-debug\"",
"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 \"EVENTSTORE_CONNECTION_TYPE=tcp EVENTSTORE_HOST=192.168.33.10 ./build-and-test.sh\"",
"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: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",
"gendocs": "rm -rf docs && jsdoc src -r -d docs"
},
@ -58,18 +59,18 @@
},
"homepage": "https://github.com/nicdex/node-eventstore-client#readme",
"dependencies": {
"@types/long": "^3.0.32",
"@types/node": ">=5.10",
"long": "^3.2.0",
"protobufjs": "^6.8.8",
"@types/node": ">=14",
"long": "^5.2.0",
"strict-event-emitter-types": "^1.2.0",
"uuid": "^3.0.1"
"uuid": "^9.0.0"
},
"devDependencies": {
"jest": "^26.4.2",
"jsdoc": "^3.6.3",
"jest": "^29.4.1",
"jsdoc": "^4.0.0",
"nodeunit": "^0.11.3",
"webpack": "^4.41.2",
"protobufjs": "^7.2.0",
"protobufjs-cli": "^1.1.0",
"webpack": "^5.75.0",
"webpack-cli": "^3.3.10"
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ StartTransactionOperation.prototype._createRequestDto = function() {
return new ClientMessage.TransactionStart({
eventStreamId: this._stream,
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:
return new InspectionResult(InspectionDecision.Retry, "NotHandled - TooBusy");
case ClientMessage.NotHandled.NotHandledReason.NotMaster:
var masterInfo = ClientMessage.NotHandled.MasterInfo.decode(message.additionalInfo);
return new InspectionResult(InspectionDecision.Reconnect, "NotHandled - NotMaster",
case ClientMessage.NotHandled.NotHandledReason.NotLeader:
var masterInfo = ClientMessage.NotHandled.LeaderInfo.decode(message.additionalInfo);
return new InspectionResult(InspectionDecision.Reconnect, "NotHandled - NotLeader",
{host: masterInfo.externalTcpAddress, port: masterInfo.externalTcpPort},
{host: masterInfo.externalSecureTcpAddress, port: masterInfo.externalSecureTcpPort});

View File

@ -32,7 +32,7 @@ TransactionalWriteOperation.prototype._createRequestDto = function() {
return new ClientMessage.TransactionWrite({
transactionId: this._transactionId,
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
: (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);
};
@ -109,12 +109,14 @@ ClusterDiscoverer.prototype._resolveDns = async function (clusterDns) {
* @returns {Promise.<ClusterInfo>}
*/
ClusterDiscoverer.prototype._clusterInfo = async function (candidate, timeout) {
var self = this;
return new Promise((resolve, reject) => {
const options = {
host: candidate.endPoint.host,
port: candidate.endPoint.port,
path: '/gossip?format=json',
timeout: timeout,
rejectUnauthorized: self._settings.rejectUnauthorized
};
if (candidate.hostHeader) {
options.headers = {

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
syntax = "proto3";
package EventStore.Client.Messages;
enum OperationResult
@ -13,114 +15,115 @@ enum OperationResult
}
message NewEvent {
required bytes event_id = 1;
required string event_type = 2;
required int32 data_content_type = 3;
required int32 metadata_content_type = 4;
required bytes data = 5;
optional bytes metadata = 6;
bytes event_id = 1;
string event_type = 2;
int32 data_content_type = 3;
int32 metadata_content_type = 4;
bytes data = 5;
bytes metadata = 6;
}
message EventRecord {
required string event_stream_id = 1;
required int64 event_number = 2;
required bytes event_id = 3;
required string event_type = 4;
required int32 data_content_type = 5;
required int32 metadata_content_type = 6;
required bytes data = 7;
optional bytes metadata = 8;
optional int64 created = 9;
optional int64 created_epoch = 10;
string event_stream_id = 1;
int64 event_number = 2;
bytes event_id = 3;
string event_type = 4;
int32 data_content_type = 5;
int32 metadata_content_type = 6;
bytes data = 7;
bytes metadata = 8;
int64 created = 9;
int64 created_epoch = 10;
}
message ResolvedIndexedEvent {
optional EventRecord event = 1;
optional EventRecord link = 2;
EventRecord event = 1;
EventRecord link = 2;
}
message ResolvedEvent {
optional EventRecord event = 1;
optional EventRecord link = 2;
required int64 commit_position = 3;
required int64 prepare_position = 4;
EventRecord event = 1;
EventRecord link = 2;
int64 commit_position = 3;
int64 prepare_position = 4;
}
message WriteEvents {
required string event_stream_id = 1;
required int64 expected_version = 2;
string event_stream_id = 1;
int64 expected_version = 2;
repeated NewEvent events = 3;
required bool require_master = 4;
bool require_leader = 4;
}
message WriteEventsCompleted {
required OperationResult result = 1;
optional string message = 2;
required int64 first_event_number = 3;
required int64 last_event_number = 4;
optional int64 prepare_position = 5;
optional int64 commit_position = 6;
optional int64 current_version = 7;
OperationResult result = 1;
string message = 2;
int64 first_event_number = 3;
int64 last_event_number = 4;
int64 prepare_position = 5;
int64 commit_position = 6;
int64 current_version = 7;
}
message DeleteStream {
required string event_stream_id = 1;
required int64 expected_version = 2;
required bool require_master = 3;
optional bool hard_delete = 4;
string event_stream_id = 1;
int64 expected_version = 2;
bool require_leader = 3;
bool hard_delete = 4;
}
message DeleteStreamCompleted {
required OperationResult result = 1;
optional string message = 2;
optional int64 prepare_position = 3;
optional int64 commit_position = 4;
OperationResult result = 1;
string message = 2;
int64 prepare_position = 3;
int64 commit_position = 4;
int64 current_version = 5;
}
message TransactionStart {
required string event_stream_id = 1;
required int64 expected_version = 2;
required bool require_master = 3;
string event_stream_id = 1;
int64 expected_version = 2;
bool require_leader = 3;
}
message TransactionStartCompleted {
required int64 transaction_id = 1;
required OperationResult result = 2;
optional string message = 3;
int64 transaction_id = 1;
OperationResult result = 2;
string message = 3;
}
message TransactionWrite {
required int64 transaction_id = 1;
int64 transaction_id = 1;
repeated NewEvent events = 2;
required bool require_master = 3;
bool require_leader = 3;
}
message TransactionWriteCompleted {
required int64 transaction_id = 1;
required OperationResult result = 2;
optional string message = 3;
int64 transaction_id = 1;
OperationResult result = 2;
string message = 3;
}
message TransactionCommit {
required int64 transaction_id = 1;
required bool require_master = 2;
int64 transaction_id = 1;
bool require_leader = 2;
}
message TransactionCommitCompleted {
required int64 transaction_id = 1;
required OperationResult result = 2;
optional string message = 3;
required int64 first_event_number = 4;
required int64 last_event_number = 5;
optional int64 prepare_position = 6;
optional int64 commit_position = 7;
int64 transaction_id = 1;
OperationResult result = 2;
string message = 3;
int64 first_event_number = 4;
int64 last_event_number = 5;
int64 prepare_position = 6;
int64 commit_position = 7;
}
message ReadEvent {
required string event_stream_id = 1;
required int64 event_number = 2;
required bool resolve_link_tos = 3;
required bool require_master = 4;
string event_stream_id = 1;
int64 event_number = 2;
bool resolve_link_tos = 3;
bool require_leader = 4;
}
message ReadEventCompleted {
@ -134,18 +137,18 @@ message ReadEventCompleted {
AccessDenied = 5;
}
required ReadEventResult result = 1;
required ResolvedIndexedEvent event = 2;
ReadEventResult result = 1;
ResolvedIndexedEvent event = 2;
optional string error = 3;
string error = 3;
}
message ReadStreamEvents {
required string event_stream_id = 1;
required int64 from_event_number = 2;
required int32 max_count = 3;
required bool resolve_link_tos = 4;
required bool require_master = 5;
string event_stream_id = 1;
int64 from_event_number = 2;
int32 max_count = 3;
bool resolve_link_tos = 4;
bool require_leader = 5;
}
message ReadStreamEventsCompleted {
@ -160,21 +163,21 @@ message ReadStreamEventsCompleted {
}
repeated ResolvedIndexedEvent events = 1;
required ReadStreamResult result = 2;
required int64 next_event_number = 3;
required int64 last_event_number = 4;
required bool is_end_of_stream = 5;
required int64 last_commit_position = 6;
ReadStreamResult result = 2;
int64 next_event_number = 3;
int64 last_event_number = 4;
bool is_end_of_stream = 5;
int64 last_commit_position = 6;
optional string error = 7;
string error = 7;
}
message ReadAllEvents {
required int64 commit_position = 1;
required int64 prepare_position = 2;
required int32 max_count = 3;
required bool resolve_link_tos = 4;
required bool require_master = 5;
int64 commit_position = 1;
int64 prepare_position = 2;
int32 max_count = 3;
bool resolve_link_tos = 4;
bool require_leader = 5;
}
message ReadAllEventsCompleted {
@ -186,57 +189,105 @@ message ReadAllEventsCompleted {
AccessDenied = 3;
}
required int64 commit_position = 1;
required int64 prepare_position = 2;
int64 commit_position = 1;
int64 prepare_position = 2;
repeated ResolvedEvent events = 3;
required int64 next_commit_position = 4;
required int64 next_prepare_position = 5;
int64 next_commit_position = 4;
int64 next_prepare_position = 5;
optional ReadAllResult result = 6 [default = Success];
optional string error = 7;
ReadAllResult result = 6;
string error = 7;
}
message Filter{
enum FilterContext {
StreamId = 0;
EventType = 1;
}
enum FilterType {
Regex = 0;
Prefix = 1;
}
FilterContext context = 1;
FilterType type = 2;
repeated string data = 3;
}
message FilteredReadAllEvents {
int64 commit_position = 1;
int64 prepare_position = 2;
int32 max_count = 3;
int32 max_search_window = 4;
bool resolve_link_tos = 5;
bool require_leader = 6;
Filter filter = 7;
}
message FilteredReadAllEventsCompleted {
enum FilteredReadAllResult {
Success = 0;
NotModified = 1;
Error = 2;
AccessDenied = 3;
}
int64 commit_position = 1;
int64 prepare_position = 2;
repeated ResolvedEvent events = 3;
int64 next_commit_position = 4;
int64 next_prepare_position = 5;
bool is_end_of_stream = 6;
FilteredReadAllResult result = 7;
string error = 8;
}
message CreatePersistentSubscription {
required string subscription_group_name = 1;
required string event_stream_id = 2;
required bool resolve_link_tos = 3;
required int64 start_from = 4;
required int32 message_timeout_milliseconds = 5;
required bool record_statistics = 6;
required int32 live_buffer_size = 7;
required int32 read_batch_size = 8;
required int32 buffer_size = 9;
required int32 max_retry_count = 10;
required bool prefer_round_robin = 11;
required int32 checkpoint_after_time = 12;
required int32 checkpoint_max_count = 13;
required int32 checkpoint_min_count = 14;
required int32 subscriber_max_count = 15;
optional string named_consumer_strategy = 16;
string subscription_group_name = 1;
string event_stream_id = 2;
bool resolve_link_tos = 3;
int64 start_from = 4;
int32 message_timeout_milliseconds = 5;
bool record_statistics = 6;
int32 live_buffer_size = 7;
int32 read_batch_size = 8;
int32 buffer_size = 9;
int32 max_retry_count = 10;
bool prefer_round_robin = 11;
int32 checkpoint_after_time = 12;
int32 checkpoint_max_count = 13;
int32 checkpoint_min_count = 14;
int32 subscriber_max_count = 15;
string named_consumer_strategy = 16;
}
message DeletePersistentSubscription {
required string subscription_group_name = 1;
required string event_stream_id = 2;
string subscription_group_name = 1;
string event_stream_id = 2;
}
message UpdatePersistentSubscription {
required string subscription_group_name = 1;
required string event_stream_id = 2;
required bool resolve_link_tos = 3;
required int64 start_from = 4;
required int32 message_timeout_milliseconds = 5;
required bool record_statistics = 6;
required int32 live_buffer_size = 7;
required int32 read_batch_size = 8;
required int32 buffer_size = 9;
required int32 max_retry_count = 10;
required bool prefer_round_robin = 11;
required int32 checkpoint_after_time = 12;
required int32 checkpoint_max_count = 13;
required int32 checkpoint_min_count = 14;
required int32 subscriber_max_count = 15;
optional string named_consumer_strategy = 16;
string subscription_group_name = 1;
string event_stream_id = 2;
bool resolve_link_tos = 3;
int64 start_from = 4;
int32 message_timeout_milliseconds = 5;
bool record_statistics = 6;
int32 live_buffer_size = 7;
int32 read_batch_size = 8;
int32 buffer_size = 9;
int32 max_retry_count = 10;
bool prefer_round_robin = 11;
int32 checkpoint_after_time = 12;
int32 checkpoint_max_count = 13;
int32 checkpoint_min_count = 14;
int32 subscriber_max_count = 15;
string named_consumer_strategy = 16;
}
message UpdatePersistentSubscriptionCompleted {
@ -246,8 +297,8 @@ message UpdatePersistentSubscriptionCompleted {
Fail = 2;
AccessDenied=3;
}
required UpdatePersistentSubscriptionResult result = 1 [default = Success];
optional string reason = 2;
UpdatePersistentSubscriptionResult result = 1;
string reason = 2;
}
message CreatePersistentSubscriptionCompleted {
@ -257,8 +308,8 @@ message CreatePersistentSubscriptionCompleted {
Fail = 2;
AccessDenied=3;
}
required CreatePersistentSubscriptionResult result = 1 [default = Success];
optional string reason = 2;
CreatePersistentSubscriptionResult result = 1;
string reason = 2;
}
message DeletePersistentSubscriptionCompleted {
@ -268,19 +319,19 @@ message DeletePersistentSubscriptionCompleted {
Fail = 2;
AccessDenied = 3;
}
required DeletePersistentSubscriptionResult result = 1 [default = Success];
optional string reason = 2;
DeletePersistentSubscriptionResult result = 1;
string reason = 2;
}
message ConnectToPersistentSubscription {
required string subscription_id = 1;
required string event_stream_id = 2;
required int32 allowed_in_flight_messages = 3;
string subscription_id = 1;
string event_stream_id = 2;
int32 allowed_in_flight_messages = 3;
}
message PersistentSubscriptionAckEvents {
required string subscription_id = 1;
string subscription_id = 1;
repeated bytes processed_event_ids = 2;
}
@ -293,34 +344,47 @@ message PersistentSubscriptionNakEvents {
Stop = 4;
}
required string subscription_id = 1;
string subscription_id = 1;
repeated bytes processed_event_ids = 2;
optional string message = 3;
required NakAction action = 4 [default = Unknown];
string message = 3;
NakAction action = 4;
}
message PersistentSubscriptionConfirmation {
required int64 last_commit_position = 1;
required string subscription_id = 2;
optional int64 last_event_number = 3;
int64 last_commit_position = 1;
string subscription_id = 2;
int64 last_event_number = 3;
}
message PersistentSubscriptionStreamEventAppeared {
required ResolvedIndexedEvent event = 1;
ResolvedIndexedEvent event = 1;
int32 retryCount = 2;
}
message SubscribeToStream {
required string event_stream_id = 1;
required bool resolve_link_tos = 2;
string event_stream_id = 1;
bool resolve_link_tos = 2;
}
message FilteredSubscribeToStream {
string event_stream_id = 1;
bool resolve_link_tos = 2;
Filter filter = 3;
int32 checkpoint_interval = 4;
}
message CheckpointReached {
int64 commit_position = 1;
int64 prepare_position = 2;
}
message SubscriptionConfirmation {
required int64 last_commit_position = 1;
optional int64 last_event_number = 2;
int64 last_commit_position = 1;
int64 last_event_number = 2;
}
message StreamEventAppeared {
required ResolvedEvent event = 1;
ResolvedEvent event = 1;
}
message UnsubscribeFromStream {
@ -336,7 +400,7 @@ message SubscriptionDropped {
SubscriberMaxCountReached=4;
}
optional SubscriptionDropReason reason = 1 [default = Unsubscribed];
SubscriptionDropReason reason = 1;
}
message NotHandled {
@ -344,42 +408,42 @@ message NotHandled {
enum NotHandledReason {
NotReady = 0;
TooBusy = 1;
NotMaster = 2;
NotLeader = 2;
IsReadOnly = 3;
}
required NotHandledReason reason = 1;
optional bytes additional_info = 2;
NotHandledReason reason = 1;
bytes additional_info = 2;
message MasterInfo {
required string external_tcp_address = 1;
required int32 external_tcp_port = 2;
required string external_http_address = 3;
required int32 external_http_port = 4;
optional string external_secure_tcp_address = 5;
optional int32 external_secure_tcp_port = 6;
message LeaderInfo {
string external_tcp_address = 1;
int32 external_tcp_port = 2;
string http_address = 3;
int32 http_port = 4;
string external_secure_tcp_address = 5;
int32 external_secure_tcp_port = 6;
}
}
message ScavengeDatabase {
}
message ScavengeDatabaseCompleted {
message ScavengeDatabaseResponse {
enum ScavengeResult {
Success = 0;
Started = 0;
InProgress = 1;
Failed = 2;
Unauthorized = 2;
}
required ScavengeResult result = 1;
optional string error = 2;
required int32 total_time_ms = 3;
required int64 total_space_saved = 4;
ScavengeResult result = 1;
string scavengeId = 2;
}
message IdentifyClient {
required int32 version = 1;
optional string connection_name = 2;
int32 version = 1;
string connection_name = 2;
}
message ClientIdentified {

View File

@ -15,9 +15,10 @@ function safeParseJson(json) {
}
}
function ProjectionsClient(log, operationTimeout) {
function ProjectionsClient(log, operationTimeout, rejectUnauthorized) {
this._log = log;
this._operationTimeout = operationTimeout;
this._rejectUnauthorized = typeof rejectUnauthorized === 'undefined' ? true : !!rejectUnauthorized;
}
ProjectionsClient.prototype.enable = function(httpEndPoint, name, userCredentials) {
@ -118,6 +119,9 @@ ProjectionsClient.prototype.request = function(method, _url, data, userCredentia
if (userCredentials) {
options.auth = [userCredentials.username, userCredentials.password].join(':');
}
if (!this._rejectUnauthorized) {
options.rejectUnauthorized = false;
}
var self = this;
return new Promise(function (resolve, reject) {
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 {string} httpEndPoint HTTP endpoint of an Event Store server.
* @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
*/
function ProjectionsManager(log, httpEndPoint, operationTimeout) {
function ProjectionsManager(log, httpEndPoint, operationTimeout, rejectUnauthorized) {
ensure.notNull(log, "log");
ensure.notNull(httpEndPoint, "httpEndPoint");
this._client = new ProjectionsClient(log, operationTimeout);
this._client = new ProjectionsClient(log, operationTimeout, rejectUnauthorized);
this._httpEndPoint = httpEndPoint;
}

View File

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

View File

@ -62,7 +62,7 @@ switch(evenstStoreType){
case 'dns':
module.exports['Connect to Cluster using dns discover'] = function (test) {
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);
conn.connect()
.catch(function(err) {
@ -83,7 +83,7 @@ switch(evenstStoreType){
module.exports['Connect To Cluster with bad dns discover'] = function (test) {
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);
conn.connect()
.catch(function (err) {
@ -91,6 +91,7 @@ switch(evenstStoreType){
});
conn.on('connected', function () {
test.ok(false, 'Should not be able to connect.');
conn.close();
});
conn.on('error', function (err) {
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();
}
var self = this;
this.conn.connectToPersistentSubscription(testStreamName, 'consumer-1', eventAppeared, subscriptionDropped)
this.conn.connectToPersistentSubscription(testStreamName, 'consumer-1', eventAppeared, subscriptionDropped, adminCredentials)
.then(function(subscription) {
test.ok(subscription, "Subscription is null.");
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 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 simpleProjection = "\
@ -21,7 +21,7 @@ fromStream('$stats-127.0.0.1:2113')\
module.exports = {
setUp: function(cb) {
this.projectionsManager = new client.ProjectionsManager(log, httpEndpoint, operationTimeout);
this.projectionsManager = new client.ProjectionsManager(log, httpEndpoint, operationTimeout, false);
cb();
},
'Create One Time Projection Happy Path': function(test) {