@event-driven-io/emmett-testcontainers 0.20.2-alpha2 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,2 +1,93 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;var _dbclient = require('@eventstore/db-client');var _testcontainers = require('testcontainers');var s=2113,i= exports.EVENTSTOREDB_TCP_PORT =1113,l= exports.EVENTSTOREDB_TCP_PORTS =[i,s],_= exports.EVENTSTOREDB_IMAGE_NAME ="eventstore/eventstore",R= exports.EVENTSTOREDB_IMAGE_TAG ="23.10.1-bookworm-slim",p= exports.EVENTSTOREDB_ARM64_IMAGE_TAG ="23.10.1-alpha-arm64v8",O= exports.EVENTSTOREDB_DEFAULT_IMAGE =`${_}:${process.arch!=="arm64"?R:p}`,u= exports.defaultEventStoreDBContainerOptions ={disableProjections:!1,isSecure:!1,useFileStorage:!1,withoutReuse:!1},o= exports.EventStoreDBContainer = (_class =class extends _testcontainers.GenericContainer{__init() {this.tcpPorts=l}constructor(t=O,e=u){super(t);_class.prototype.__init.call(this);;let T={...e.disableProjections?{}:{EVENTSTORE_RUN_PROJECTIONS:"ALL"},...e.isSecure?{}:{EVENTSTORE_INSECURE:"true"},...e.useFileStorage?{EVENTSTORE_MEM_DB:"false",EVENTSTORE_DB:"/data/integration-tests"}:{},EVENTSTORE_CLUSTER_SIZE:"1",EVENTSTORE_START_STANDARD_PROJECTIONS:"true",EVENTSTORE_EXT_TCP_PORT:`${i}`,EVENTSTORE_HTTP_PORT:`${s}`,EVENTSTORE_ENABLE_EXTERNAL_TCP:"true",EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP:"true"};this.withEnvironment(T).withExposedPorts(...this.tcpPorts),e.withoutReuse||this.withReuse()}async start(){return new r(await super.start())}}, _class),r= exports.StartedEventStoreDBContainer =class extends _testcontainers.AbstractStartedContainer{constructor(t){super(t)}getConnectionString(){return`esdb://${this.getHost()}:${this.getMappedPort(2113)}?tls=false`}getClient(){return _dbclient.EventStoreDBClient.connectionString(this.getConnectionString())}};var E,f= exports.getEventStoreDBTestClient =async(n=!1)=>{let t;return n?(E||(E=await new o().start()),t=E.getConnectionString()):t="esdb://localhost:2113?tls=false",_dbclient.EventStoreDBClient.connectionString(t)};exports.EVENTSTOREDB_ARM64_IMAGE_TAG = p; exports.EVENTSTOREDB_DEFAULT_IMAGE = O; exports.EVENTSTOREDB_IMAGE_NAME = _; exports.EVENTSTOREDB_IMAGE_TAG = R; exports.EVENTSTOREDB_PORT = s; exports.EVENTSTOREDB_TCP_PORT = i; exports.EVENTSTOREDB_TCP_PORTS = l; exports.EventStoreDBContainer = o; exports.StartedEventStoreDBContainer = r; exports.defaultEventStoreDBContainerOptions = u; exports.getEventStoreDBTestClient = f;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;// src/eventStore/index.ts
2
+ var _dbclient = require('@eventstore/db-client');
3
+
4
+ // src/eventStore/eventStoreDBContainer.ts
5
+
6
+
7
+
8
+
9
+ var _testcontainers = require('testcontainers');
10
+ var EVENTSTOREDB_PORT = 2113;
11
+ var EVENTSTOREDB_TCP_PORT = 1113;
12
+ var EVENTSTOREDB_TCP_PORTS = [
13
+ EVENTSTOREDB_TCP_PORT,
14
+ EVENTSTOREDB_PORT
15
+ ];
16
+ var EVENTSTOREDB_IMAGE_NAME = "eventstore/eventstore";
17
+ var EVENTSTOREDB_IMAGE_TAG = "23.10.1-bookworm-slim";
18
+ var EVENTSTOREDB_ARM64_IMAGE_TAG = "23.10.1-alpha-arm64v8";
19
+ var EVENTSTOREDB_DEFAULT_IMAGE = `${EVENTSTOREDB_IMAGE_NAME}:${process.arch !== "arm64" ? EVENTSTOREDB_IMAGE_TAG : EVENTSTOREDB_ARM64_IMAGE_TAG}`;
20
+ var defaultEventStoreDBContainerOptions = {
21
+ disableProjections: false,
22
+ isSecure: false,
23
+ useFileStorage: false,
24
+ withoutReuse: false
25
+ };
26
+ var EventStoreDBContainer = (_class = class extends _testcontainers.GenericContainer {
27
+ __init() {this.tcpPorts = EVENTSTOREDB_TCP_PORTS}
28
+ constructor(image = EVENTSTOREDB_DEFAULT_IMAGE, options = defaultEventStoreDBContainerOptions) {
29
+ super(image);_class.prototype.__init.call(this);;
30
+ const environment = {
31
+ ...!options.disableProjections ? {
32
+ EVENTSTORE_RUN_PROJECTIONS: "ALL"
33
+ } : {},
34
+ ...!options.isSecure ? {
35
+ EVENTSTORE_INSECURE: "true"
36
+ } : {},
37
+ ...options.useFileStorage ? {
38
+ EVENTSTORE_MEM_DB: "false",
39
+ EVENTSTORE_DB: "/data/integration-tests"
40
+ } : {},
41
+ EVENTSTORE_CLUSTER_SIZE: "1",
42
+ EVENTSTORE_START_STANDARD_PROJECTIONS: "true",
43
+ EVENTSTORE_EXT_TCP_PORT: `${EVENTSTOREDB_TCP_PORT}`,
44
+ EVENTSTORE_HTTP_PORT: `${EVENTSTOREDB_PORT}`,
45
+ EVENTSTORE_ENABLE_EXTERNAL_TCP: "true",
46
+ EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP: "true"
47
+ };
48
+ this.withEnvironment(environment).withExposedPorts(...this.tcpPorts);
49
+ if (!options.withoutReuse) this.withReuse();
50
+ }
51
+ async start() {
52
+ return new StartedEventStoreDBContainer(await super.start());
53
+ }
54
+ }, _class);
55
+ var StartedEventStoreDBContainer = class extends _testcontainers.AbstractStartedContainer {
56
+ constructor(container) {
57
+ super(container);
58
+ }
59
+ getConnectionString() {
60
+ return `esdb://${this.getHost()}:${this.getMappedPort(2113)}?tls=false`;
61
+ }
62
+ getClient() {
63
+ return _dbclient.EventStoreDBClient.connectionString(this.getConnectionString());
64
+ }
65
+ };
66
+
67
+ // src/eventStore/index.ts
68
+ var esdbContainer;
69
+ var getEventStoreDBTestClient = async (useTestContainers = false) => {
70
+ let connectionString;
71
+ if (useTestContainers) {
72
+ if (!esdbContainer)
73
+ esdbContainer = await new EventStoreDBContainer().start();
74
+ connectionString = esdbContainer.getConnectionString();
75
+ } else {
76
+ connectionString = "esdb://localhost:2113?tls=false";
77
+ }
78
+ return _dbclient.EventStoreDBClient.connectionString(connectionString);
79
+ };
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+ exports.EVENTSTOREDB_ARM64_IMAGE_TAG = EVENTSTOREDB_ARM64_IMAGE_TAG; exports.EVENTSTOREDB_DEFAULT_IMAGE = EVENTSTOREDB_DEFAULT_IMAGE; exports.EVENTSTOREDB_IMAGE_NAME = EVENTSTOREDB_IMAGE_NAME; exports.EVENTSTOREDB_IMAGE_TAG = EVENTSTOREDB_IMAGE_TAG; exports.EVENTSTOREDB_PORT = EVENTSTOREDB_PORT; exports.EVENTSTOREDB_TCP_PORT = EVENTSTOREDB_TCP_PORT; exports.EVENTSTOREDB_TCP_PORTS = EVENTSTOREDB_TCP_PORTS; exports.EventStoreDBContainer = EventStoreDBContainer; exports.StartedEventStoreDBContainer = StartedEventStoreDBContainer; exports.defaultEventStoreDBContainerOptions = defaultEventStoreDBContainerOptions; exports.getEventStoreDBTestClient = getEventStoreDBTestClient;
2
93
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/eventStore/index.ts","../src/eventStore/eventStoreDBContainer.ts"],"names":["EVENTSTOREDB_PORT","EVENTSTOREDB_TCP_PORT","EVENTSTOREDB_TCP_PORTS","EVENTSTOREDB_IMAGE_NAME","EVENTSTOREDB_IMAGE_TAG","EVENTSTOREDB_ARM64_IMAGE_TAG","EVENTSTOREDB_DEFAULT_IMAGE"],"mappings":"AAAA,sIAAmC,gDCK5B,IAGMA,CAAAA,CAAoB,IAAA,CACpBC,CAAAA,iCAAwB,IAAA,CACxBC,CAAAA,kCAAyB,CACpCD,CAAAA,CACAD,CACF,CAAA,CACaG,CAAAA,mCAA0B,uBAAA,CAC1BC,CAAAA,kCAAyB,uBAAA,CACzBC,CAAAA,wCAA+B,uBAAA,CAE/BC,CAAAA,sCAA6B,CAAA,EAAA","file":"/home/runner/work/emmett/emmett/src/packages/emmett-testcontainers/dist/index.cjs","sourcesContent":["import { EventStoreDBClient } from '@eventstore/db-client';\nimport {\n EventStoreDBContainer,\n StartedEventStoreDBContainer,\n} from './eventStoreDBContainer';\n\nexport * from './eventStoreDBContainer';\n\nlet esdbContainer: StartedEventStoreDBContainer;\n\nexport const getEventStoreDBTestClient = async (\n useTestContainers = false,\n): Promise<EventStoreDBClient> => {\n let connectionString;\n\n if (useTestContainers) {\n if (!esdbContainer)\n esdbContainer = await new EventStoreDBContainer().start();\n\n connectionString = esdbContainer.getConnectionString();\n } else {\n // await compose.upAll();\n connectionString = 'esdb://localhost:2113?tls=false';\n }\n\n // That's how EventStoreDB client is setup\n // We're taking the connection string from container\n return EventStoreDBClient.connectionString(connectionString);\n};\n","import { EventStoreDBClient } from '@eventstore/db-client';\nimport {\n AbstractStartedContainer,\n GenericContainer,\n type StartedTestContainer,\n} from 'testcontainers';\nimport type { Environment } from 'testcontainers/build/types';\n\nexport const EVENTSTOREDB_PORT = 2113;\nexport const EVENTSTOREDB_TCP_PORT = 1113;\nexport const EVENTSTOREDB_TCP_PORTS = [\n EVENTSTOREDB_TCP_PORT,\n EVENTSTOREDB_PORT,\n];\nexport const EVENTSTOREDB_IMAGE_NAME = 'eventstore/eventstore';\nexport const EVENTSTOREDB_IMAGE_TAG = '23.10.1-bookworm-slim';\nexport const EVENTSTOREDB_ARM64_IMAGE_TAG = '23.10.1-alpha-arm64v8';\n\nexport const EVENTSTOREDB_DEFAULT_IMAGE = `${EVENTSTOREDB_IMAGE_NAME}:${process.arch !== 'arm64' ? EVENTSTOREDB_IMAGE_TAG : EVENTSTOREDB_ARM64_IMAGE_TAG}`;\n\nexport type EventStoreDBContainerOptions = {\n disableProjections?: boolean;\n isSecure?: boolean;\n useFileStorage?: boolean;\n withoutReuse?: boolean;\n};\n\nexport const defaultEventStoreDBContainerOptions: EventStoreDBContainerOptions =\n {\n disableProjections: false,\n isSecure: false,\n useFileStorage: false,\n withoutReuse: false,\n };\n\nexport class EventStoreDBContainer extends GenericContainer {\n private readonly tcpPorts = EVENTSTOREDB_TCP_PORTS;\n\n constructor(\n image = EVENTSTOREDB_DEFAULT_IMAGE,\n options: EventStoreDBContainerOptions = defaultEventStoreDBContainerOptions,\n ) {\n super(image);\n\n const environment: Environment = {\n ...(!options.disableProjections\n ? {\n EVENTSTORE_RUN_PROJECTIONS: 'ALL',\n }\n : {}),\n ...(!options.isSecure\n ? {\n EVENTSTORE_INSECURE: 'true',\n }\n : {}),\n ...(options.useFileStorage\n ? {\n EVENTSTORE_MEM_DB: 'false',\n EVENTSTORE_DB: '/data/integration-tests',\n }\n : {}),\n EVENTSTORE_CLUSTER_SIZE: '1',\n EVENTSTORE_START_STANDARD_PROJECTIONS: 'true',\n EVENTSTORE_EXT_TCP_PORT: `${EVENTSTOREDB_TCP_PORT}`,\n EVENTSTORE_HTTP_PORT: `${EVENTSTOREDB_PORT}`,\n EVENTSTORE_ENABLE_EXTERNAL_TCP: 'true',\n EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP: 'true',\n };\n\n this.withEnvironment(environment).withExposedPorts(...this.tcpPorts);\n\n if (!options.withoutReuse) this.withReuse();\n }\n\n async start(): Promise<StartedEventStoreDBContainer> {\n return new StartedEventStoreDBContainer(await super.start());\n }\n}\n\nexport class StartedEventStoreDBContainer extends AbstractStartedContainer {\n constructor(container: StartedTestContainer) {\n super(container);\n }\n\n getConnectionString(): string {\n return `esdb://${this.getHost()}:${this.getMappedPort(2113)}?tls=false`;\n }\n\n getClient(): EventStoreDBClient {\n return EventStoreDBClient.connectionString(this.getConnectionString());\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/emmett/emmett/src/packages/emmett-testcontainers/dist/index.cjs","../src/eventStore/index.ts","../src/eventStore/eventStoreDBContainer.ts"],"names":[],"mappings":"AAAA;ACAA,iDAAmC;ADEnC;AACA;AEHA;AACA;AACE;AACA;AAAA,gDAEK;AAGA,IAAM,kBAAA,EAAoB,IAAA;AAC1B,IAAM,sBAAA,EAAwB,IAAA;AAC9B,IAAM,uBAAA,EAAyB;AAAA,EACpC,qBAAA;AAAA,EACA;AACF,CAAA;AACO,IAAM,wBAAA,EAA0B,uBAAA;AAChC,IAAM,uBAAA,EAAyB,uBAAA;AAC/B,IAAM,6BAAA,EAA+B,uBAAA;AAErC,IAAM,2BAAA,EAA6B,CAAA,EAAA;AAS7B;AAEW,EAAA;AACV,EAAA;AACM,EAAA;AACF,EAAA;AAChB;AAEK;AACuB,iBAAA;AAGlB,EAAA;AAGG,IAAA;AAEsB,IAAA;AAClB,MAAA;AAEP,QAAA;AAED,MAAA;AAED,MAAA;AACuB,QAAA;AAEtB,MAAA;AAED,MAAA;AACqB,QAAA;AACJ,QAAA;AAEhB,MAAA;AACoB,MAAA;AACzB,MAAA;AAC4B,MAAA;AACH,MAAA;AACzB,MAAA;AACA,MAAA;AACF,IAAA;AAEqB,IAAA;AAEM,IAAA;AAC7B,EAAA;AAEqD,EAAA;AACxC,IAAA;AACb,EAAA;AACF;AAEa;AACkC,EAAA;AAC5B,IAAA;AACjB,EAAA;AAE8B,EAAA;AACE,IAAA;AAChC,EAAA;AAEgC,EAAA;AACJ,IAAA;AAC5B,EAAA;AACF;AF1BkC;AACA;AC1D9B;AAEqC;AAGnC,EAAA;AAEmB,EAAA;AAChB,IAAA;AACuB,MAAA;AAET,IAAA;AACd,EAAA;AAEc,IAAA;AACrB,EAAA;AAI0B,EAAA;AAC5B;ADmDkC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/emmett/emmett/src/packages/emmett-testcontainers/dist/index.cjs","sourcesContent":[null,"import { EventStoreDBClient } from '@eventstore/db-client';\nimport {\n EventStoreDBContainer,\n StartedEventStoreDBContainer,\n} from './eventStoreDBContainer';\n\nexport * from './eventStoreDBContainer';\n\nlet esdbContainer: StartedEventStoreDBContainer;\n\nexport const getEventStoreDBTestClient = async (\n useTestContainers = false,\n): Promise<EventStoreDBClient> => {\n let connectionString;\n\n if (useTestContainers) {\n if (!esdbContainer)\n esdbContainer = await new EventStoreDBContainer().start();\n\n connectionString = esdbContainer.getConnectionString();\n } else {\n // await compose.upAll();\n connectionString = 'esdb://localhost:2113?tls=false';\n }\n\n // That's how EventStoreDB client is setup\n // We're taking the connection string from container\n return EventStoreDBClient.connectionString(connectionString);\n};\n","import { EventStoreDBClient } from '@eventstore/db-client';\nimport {\n AbstractStartedContainer,\n GenericContainer,\n type StartedTestContainer,\n} from 'testcontainers';\nimport type { Environment } from 'testcontainers/build/types';\n\nexport const EVENTSTOREDB_PORT = 2113;\nexport const EVENTSTOREDB_TCP_PORT = 1113;\nexport const EVENTSTOREDB_TCP_PORTS = [\n EVENTSTOREDB_TCP_PORT,\n EVENTSTOREDB_PORT,\n];\nexport const EVENTSTOREDB_IMAGE_NAME = 'eventstore/eventstore';\nexport const EVENTSTOREDB_IMAGE_TAG = '23.10.1-bookworm-slim';\nexport const EVENTSTOREDB_ARM64_IMAGE_TAG = '23.10.1-alpha-arm64v8';\n\nexport const EVENTSTOREDB_DEFAULT_IMAGE = `${EVENTSTOREDB_IMAGE_NAME}:${process.arch !== 'arm64' ? EVENTSTOREDB_IMAGE_TAG : EVENTSTOREDB_ARM64_IMAGE_TAG}`;\n\nexport type EventStoreDBContainerOptions = {\n disableProjections?: boolean;\n isSecure?: boolean;\n useFileStorage?: boolean;\n withoutReuse?: boolean;\n};\n\nexport const defaultEventStoreDBContainerOptions: EventStoreDBContainerOptions =\n {\n disableProjections: false,\n isSecure: false,\n useFileStorage: false,\n withoutReuse: false,\n };\n\nexport class EventStoreDBContainer extends GenericContainer {\n private readonly tcpPorts = EVENTSTOREDB_TCP_PORTS;\n\n constructor(\n image = EVENTSTOREDB_DEFAULT_IMAGE,\n options: EventStoreDBContainerOptions = defaultEventStoreDBContainerOptions,\n ) {\n super(image);\n\n const environment: Environment = {\n ...(!options.disableProjections\n ? {\n EVENTSTORE_RUN_PROJECTIONS: 'ALL',\n }\n : {}),\n ...(!options.isSecure\n ? {\n EVENTSTORE_INSECURE: 'true',\n }\n : {}),\n ...(options.useFileStorage\n ? {\n EVENTSTORE_MEM_DB: 'false',\n EVENTSTORE_DB: '/data/integration-tests',\n }\n : {}),\n EVENTSTORE_CLUSTER_SIZE: '1',\n EVENTSTORE_START_STANDARD_PROJECTIONS: 'true',\n EVENTSTORE_EXT_TCP_PORT: `${EVENTSTOREDB_TCP_PORT}`,\n EVENTSTORE_HTTP_PORT: `${EVENTSTOREDB_PORT}`,\n EVENTSTORE_ENABLE_EXTERNAL_TCP: 'true',\n EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP: 'true',\n };\n\n this.withEnvironment(environment).withExposedPorts(...this.tcpPorts);\n\n if (!options.withoutReuse) this.withReuse();\n }\n\n async start(): Promise<StartedEventStoreDBContainer> {\n return new StartedEventStoreDBContainer(await super.start());\n }\n}\n\nexport class StartedEventStoreDBContainer extends AbstractStartedContainer {\n constructor(container: StartedTestContainer) {\n super(container);\n }\n\n getConnectionString(): string {\n return `esdb://${this.getHost()}:${this.getMappedPort(2113)}?tls=false`;\n }\n\n getClient(): EventStoreDBClient {\n return EventStoreDBClient.connectionString(this.getConnectionString());\n }\n}\n"]}
package/dist/index.js CHANGED
@@ -1,2 +1,93 @@
1
- import{EventStoreDBClient as C}from"@eventstore/db-client";import{EventStoreDBClient as a}from"@eventstore/db-client";import{AbstractStartedContainer as S,GenericContainer as c}from"testcontainers";var s=2113,i=1113,l=[i,s],_="eventstore/eventstore",R="23.10.1-bookworm-slim",p="23.10.1-alpha-arm64v8",O=`${_}:${process.arch!=="arm64"?R:p}`,u={disableProjections:!1,isSecure:!1,useFileStorage:!1,withoutReuse:!1},o=class extends c{tcpPorts=l;constructor(t=O,e=u){super(t);let T={...e.disableProjections?{}:{EVENTSTORE_RUN_PROJECTIONS:"ALL"},...e.isSecure?{}:{EVENTSTORE_INSECURE:"true"},...e.useFileStorage?{EVENTSTORE_MEM_DB:"false",EVENTSTORE_DB:"/data/integration-tests"}:{},EVENTSTORE_CLUSTER_SIZE:"1",EVENTSTORE_START_STANDARD_PROJECTIONS:"true",EVENTSTORE_EXT_TCP_PORT:`${i}`,EVENTSTORE_HTTP_PORT:`${s}`,EVENTSTORE_ENABLE_EXTERNAL_TCP:"true",EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP:"true"};this.withEnvironment(T).withExposedPorts(...this.tcpPorts),e.withoutReuse||this.withReuse()}async start(){return new r(await super.start())}},r=class extends S{constructor(t){super(t)}getConnectionString(){return`esdb://${this.getHost()}:${this.getMappedPort(2113)}?tls=false`}getClient(){return a.connectionString(this.getConnectionString())}};var E,f=async(n=!1)=>{let t;return n?(E||(E=await new o().start()),t=E.getConnectionString()):t="esdb://localhost:2113?tls=false",C.connectionString(t)};export{p as EVENTSTOREDB_ARM64_IMAGE_TAG,O as EVENTSTOREDB_DEFAULT_IMAGE,_ as EVENTSTOREDB_IMAGE_NAME,R as EVENTSTOREDB_IMAGE_TAG,s as EVENTSTOREDB_PORT,i as EVENTSTOREDB_TCP_PORT,l as EVENTSTOREDB_TCP_PORTS,o as EventStoreDBContainer,r as StartedEventStoreDBContainer,u as defaultEventStoreDBContainerOptions,f as getEventStoreDBTestClient};
1
+ // src/eventStore/index.ts
2
+ import { EventStoreDBClient as EventStoreDBClient2 } from "@eventstore/db-client";
3
+
4
+ // src/eventStore/eventStoreDBContainer.ts
5
+ import { EventStoreDBClient } from "@eventstore/db-client";
6
+ import {
7
+ AbstractStartedContainer,
8
+ GenericContainer
9
+ } from "testcontainers";
10
+ var EVENTSTOREDB_PORT = 2113;
11
+ var EVENTSTOREDB_TCP_PORT = 1113;
12
+ var EVENTSTOREDB_TCP_PORTS = [
13
+ EVENTSTOREDB_TCP_PORT,
14
+ EVENTSTOREDB_PORT
15
+ ];
16
+ var EVENTSTOREDB_IMAGE_NAME = "eventstore/eventstore";
17
+ var EVENTSTOREDB_IMAGE_TAG = "23.10.1-bookworm-slim";
18
+ var EVENTSTOREDB_ARM64_IMAGE_TAG = "23.10.1-alpha-arm64v8";
19
+ var EVENTSTOREDB_DEFAULT_IMAGE = `${EVENTSTOREDB_IMAGE_NAME}:${process.arch !== "arm64" ? EVENTSTOREDB_IMAGE_TAG : EVENTSTOREDB_ARM64_IMAGE_TAG}`;
20
+ var defaultEventStoreDBContainerOptions = {
21
+ disableProjections: false,
22
+ isSecure: false,
23
+ useFileStorage: false,
24
+ withoutReuse: false
25
+ };
26
+ var EventStoreDBContainer = class extends GenericContainer {
27
+ tcpPorts = EVENTSTOREDB_TCP_PORTS;
28
+ constructor(image = EVENTSTOREDB_DEFAULT_IMAGE, options = defaultEventStoreDBContainerOptions) {
29
+ super(image);
30
+ const environment = {
31
+ ...!options.disableProjections ? {
32
+ EVENTSTORE_RUN_PROJECTIONS: "ALL"
33
+ } : {},
34
+ ...!options.isSecure ? {
35
+ EVENTSTORE_INSECURE: "true"
36
+ } : {},
37
+ ...options.useFileStorage ? {
38
+ EVENTSTORE_MEM_DB: "false",
39
+ EVENTSTORE_DB: "/data/integration-tests"
40
+ } : {},
41
+ EVENTSTORE_CLUSTER_SIZE: "1",
42
+ EVENTSTORE_START_STANDARD_PROJECTIONS: "true",
43
+ EVENTSTORE_EXT_TCP_PORT: `${EVENTSTOREDB_TCP_PORT}`,
44
+ EVENTSTORE_HTTP_PORT: `${EVENTSTOREDB_PORT}`,
45
+ EVENTSTORE_ENABLE_EXTERNAL_TCP: "true",
46
+ EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP: "true"
47
+ };
48
+ this.withEnvironment(environment).withExposedPorts(...this.tcpPorts);
49
+ if (!options.withoutReuse) this.withReuse();
50
+ }
51
+ async start() {
52
+ return new StartedEventStoreDBContainer(await super.start());
53
+ }
54
+ };
55
+ var StartedEventStoreDBContainer = class extends AbstractStartedContainer {
56
+ constructor(container) {
57
+ super(container);
58
+ }
59
+ getConnectionString() {
60
+ return `esdb://${this.getHost()}:${this.getMappedPort(2113)}?tls=false`;
61
+ }
62
+ getClient() {
63
+ return EventStoreDBClient.connectionString(this.getConnectionString());
64
+ }
65
+ };
66
+
67
+ // src/eventStore/index.ts
68
+ var esdbContainer;
69
+ var getEventStoreDBTestClient = async (useTestContainers = false) => {
70
+ let connectionString;
71
+ if (useTestContainers) {
72
+ if (!esdbContainer)
73
+ esdbContainer = await new EventStoreDBContainer().start();
74
+ connectionString = esdbContainer.getConnectionString();
75
+ } else {
76
+ connectionString = "esdb://localhost:2113?tls=false";
77
+ }
78
+ return EventStoreDBClient2.connectionString(connectionString);
79
+ };
80
+ export {
81
+ EVENTSTOREDB_ARM64_IMAGE_TAG,
82
+ EVENTSTOREDB_DEFAULT_IMAGE,
83
+ EVENTSTOREDB_IMAGE_NAME,
84
+ EVENTSTOREDB_IMAGE_TAG,
85
+ EVENTSTOREDB_PORT,
86
+ EVENTSTOREDB_TCP_PORT,
87
+ EVENTSTOREDB_TCP_PORTS,
88
+ EventStoreDBContainer,
89
+ StartedEventStoreDBContainer,
90
+ defaultEventStoreDBContainerOptions,
91
+ getEventStoreDBTestClient
92
+ };
2
93
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/eventStore/index.ts","../src/eventStore/eventStoreDBContainer.ts"],"sourcesContent":["import { EventStoreDBClient } from '@eventstore/db-client';\nimport {\n EventStoreDBContainer,\n StartedEventStoreDBContainer,\n} from './eventStoreDBContainer';\n\nexport * from './eventStoreDBContainer';\n\nlet esdbContainer: StartedEventStoreDBContainer;\n\nexport const getEventStoreDBTestClient = async (\n useTestContainers = false,\n): Promise<EventStoreDBClient> => {\n let connectionString;\n\n if (useTestContainers) {\n if (!esdbContainer)\n esdbContainer = await new EventStoreDBContainer().start();\n\n connectionString = esdbContainer.getConnectionString();\n } else {\n // await compose.upAll();\n connectionString = 'esdb://localhost:2113?tls=false';\n }\n\n // That's how EventStoreDB client is setup\n // We're taking the connection string from container\n return EventStoreDBClient.connectionString(connectionString);\n};\n","import { EventStoreDBClient } from '@eventstore/db-client';\nimport {\n AbstractStartedContainer,\n GenericContainer,\n type StartedTestContainer,\n} from 'testcontainers';\nimport type { Environment } from 'testcontainers/build/types';\n\nexport const EVENTSTOREDB_PORT = 2113;\nexport const EVENTSTOREDB_TCP_PORT = 1113;\nexport const EVENTSTOREDB_TCP_PORTS = [\n EVENTSTOREDB_TCP_PORT,\n EVENTSTOREDB_PORT,\n];\nexport const EVENTSTOREDB_IMAGE_NAME = 'eventstore/eventstore';\nexport const EVENTSTOREDB_IMAGE_TAG = '23.10.1-bookworm-slim';\nexport const EVENTSTOREDB_ARM64_IMAGE_TAG = '23.10.1-alpha-arm64v8';\n\nexport const EVENTSTOREDB_DEFAULT_IMAGE = `${EVENTSTOREDB_IMAGE_NAME}:${process.arch !== 'arm64' ? EVENTSTOREDB_IMAGE_TAG : EVENTSTOREDB_ARM64_IMAGE_TAG}`;\n\nexport type EventStoreDBContainerOptions = {\n disableProjections?: boolean;\n isSecure?: boolean;\n useFileStorage?: boolean;\n withoutReuse?: boolean;\n};\n\nexport const defaultEventStoreDBContainerOptions: EventStoreDBContainerOptions =\n {\n disableProjections: false,\n isSecure: false,\n useFileStorage: false,\n withoutReuse: false,\n };\n\nexport class EventStoreDBContainer extends GenericContainer {\n private readonly tcpPorts = EVENTSTOREDB_TCP_PORTS;\n\n constructor(\n image = EVENTSTOREDB_DEFAULT_IMAGE,\n options: EventStoreDBContainerOptions = defaultEventStoreDBContainerOptions,\n ) {\n super(image);\n\n const environment: Environment = {\n ...(!options.disableProjections\n ? {\n EVENTSTORE_RUN_PROJECTIONS: 'ALL',\n }\n : {}),\n ...(!options.isSecure\n ? {\n EVENTSTORE_INSECURE: 'true',\n }\n : {}),\n ...(options.useFileStorage\n ? {\n EVENTSTORE_MEM_DB: 'false',\n EVENTSTORE_DB: '/data/integration-tests',\n }\n : {}),\n EVENTSTORE_CLUSTER_SIZE: '1',\n EVENTSTORE_START_STANDARD_PROJECTIONS: 'true',\n EVENTSTORE_EXT_TCP_PORT: `${EVENTSTOREDB_TCP_PORT}`,\n EVENTSTORE_HTTP_PORT: `${EVENTSTOREDB_PORT}`,\n EVENTSTORE_ENABLE_EXTERNAL_TCP: 'true',\n EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP: 'true',\n };\n\n this.withEnvironment(environment).withExposedPorts(...this.tcpPorts);\n\n if (!options.withoutReuse) this.withReuse();\n }\n\n async start(): Promise<StartedEventStoreDBContainer> {\n return new StartedEventStoreDBContainer(await super.start());\n }\n}\n\nexport class StartedEventStoreDBContainer extends AbstractStartedContainer {\n constructor(container: StartedTestContainer) {\n super(container);\n }\n\n getConnectionString(): string {\n return `esdb://${this.getHost()}:${this.getMappedPort(2113)}?tls=false`;\n }\n\n getClient(): EventStoreDBClient {\n return EventStoreDBClient.connectionString(this.getConnectionString());\n }\n}\n"],"mappings":"AAAA,OAAS,sBAAAA,MAA0B,wBCAnC,OAAS,sBAAAC,MAA0B,wBACnC,OACE,4BAAAC,EACA,oBAAAC,MAEK,iBAGA,IAAMC,EAAoB,KACpBC,EAAwB,KACxBC,EAAyB,CACpCD,EACAD,CACF,EACaG,EAA0B,wBAC1BC,EAAyB,wBACzBC,EAA+B,wBAE/BC,EAA6B,GAAGH,CAAuB,IAAI,QAAQ,OAAS,QAAUC,EAAyBC,CAA4B,GAS3IE,EACX,CACE,mBAAoB,GACpB,SAAU,GACV,eAAgB,GAChB,aAAc,EAChB,EAEWC,EAAN,cAAoCT,CAAiB,CACzC,SAAWG,EAE5B,YACEO,EAAQH,EACRI,EAAwCH,EACxC,CACA,MAAME,CAAK,EAEX,IAAME,EAA2B,CAC/B,GAAKD,EAAQ,mBAIT,CAAC,EAHD,CACE,2BAA4B,KAC9B,EAEJ,GAAKA,EAAQ,SAIT,CAAC,EAHD,CACE,oBAAqB,MACvB,EAEJ,GAAIA,EAAQ,eACR,CACE,kBAAmB,QACnB,cAAe,yBACjB,EACA,CAAC,EACL,wBAAyB,IACzB,sCAAuC,OACvC,wBAAyB,GAAGT,CAAqB,GACjD,qBAAsB,GAAGD,CAAiB,GAC1C,+BAAgC,OAChC,qCAAsC,MACxC,EAEA,KAAK,gBAAgBW,CAAW,EAAE,iBAAiB,GAAG,KAAK,QAAQ,EAE9DD,EAAQ,cAAc,KAAK,UAAU,CAC5C,CAEA,MAAM,OAA+C,CACnD,OAAO,IAAIE,EAA6B,MAAM,MAAM,MAAM,CAAC,CAC7D,CACF,EAEaA,EAAN,cAA2Cd,CAAyB,CACzE,YAAYe,EAAiC,CAC3C,MAAMA,CAAS,CACjB,CAEA,qBAA8B,CAC5B,MAAO,UAAU,KAAK,QAAQ,CAAC,IAAI,KAAK,cAAc,IAAI,CAAC,YAC7D,CAEA,WAAgC,CAC9B,OAAOhB,EAAmB,iBAAiB,KAAK,oBAAoB,CAAC,CACvE,CACF,EDnFA,IAAIiB,EAESC,EAA4B,MACvCC,EAAoB,KACY,CAChC,IAAIC,EAEJ,OAAID,GACGF,IACHA,EAAgB,MAAM,IAAII,EAAsB,EAAE,MAAM,GAE1DD,EAAmBH,EAAc,oBAAoB,GAGrDG,EAAmB,kCAKdE,EAAmB,iBAAiBF,CAAgB,CAC7D","names":["EventStoreDBClient","EventStoreDBClient","AbstractStartedContainer","GenericContainer","EVENTSTOREDB_PORT","EVENTSTOREDB_TCP_PORT","EVENTSTOREDB_TCP_PORTS","EVENTSTOREDB_IMAGE_NAME","EVENTSTOREDB_IMAGE_TAG","EVENTSTOREDB_ARM64_IMAGE_TAG","EVENTSTOREDB_DEFAULT_IMAGE","defaultEventStoreDBContainerOptions","EventStoreDBContainer","image","options","environment","StartedEventStoreDBContainer","container","esdbContainer","getEventStoreDBTestClient","useTestContainers","connectionString","EventStoreDBContainer","EventStoreDBClient"]}
1
+ {"version":3,"sources":["../src/eventStore/index.ts","../src/eventStore/eventStoreDBContainer.ts"],"sourcesContent":["import { EventStoreDBClient } from '@eventstore/db-client';\nimport {\n EventStoreDBContainer,\n StartedEventStoreDBContainer,\n} from './eventStoreDBContainer';\n\nexport * from './eventStoreDBContainer';\n\nlet esdbContainer: StartedEventStoreDBContainer;\n\nexport const getEventStoreDBTestClient = async (\n useTestContainers = false,\n): Promise<EventStoreDBClient> => {\n let connectionString;\n\n if (useTestContainers) {\n if (!esdbContainer)\n esdbContainer = await new EventStoreDBContainer().start();\n\n connectionString = esdbContainer.getConnectionString();\n } else {\n // await compose.upAll();\n connectionString = 'esdb://localhost:2113?tls=false';\n }\n\n // That's how EventStoreDB client is setup\n // We're taking the connection string from container\n return EventStoreDBClient.connectionString(connectionString);\n};\n","import { EventStoreDBClient } from '@eventstore/db-client';\nimport {\n AbstractStartedContainer,\n GenericContainer,\n type StartedTestContainer,\n} from 'testcontainers';\nimport type { Environment } from 'testcontainers/build/types';\n\nexport const EVENTSTOREDB_PORT = 2113;\nexport const EVENTSTOREDB_TCP_PORT = 1113;\nexport const EVENTSTOREDB_TCP_PORTS = [\n EVENTSTOREDB_TCP_PORT,\n EVENTSTOREDB_PORT,\n];\nexport const EVENTSTOREDB_IMAGE_NAME = 'eventstore/eventstore';\nexport const EVENTSTOREDB_IMAGE_TAG = '23.10.1-bookworm-slim';\nexport const EVENTSTOREDB_ARM64_IMAGE_TAG = '23.10.1-alpha-arm64v8';\n\nexport const EVENTSTOREDB_DEFAULT_IMAGE = `${EVENTSTOREDB_IMAGE_NAME}:${process.arch !== 'arm64' ? EVENTSTOREDB_IMAGE_TAG : EVENTSTOREDB_ARM64_IMAGE_TAG}`;\n\nexport type EventStoreDBContainerOptions = {\n disableProjections?: boolean;\n isSecure?: boolean;\n useFileStorage?: boolean;\n withoutReuse?: boolean;\n};\n\nexport const defaultEventStoreDBContainerOptions: EventStoreDBContainerOptions =\n {\n disableProjections: false,\n isSecure: false,\n useFileStorage: false,\n withoutReuse: false,\n };\n\nexport class EventStoreDBContainer extends GenericContainer {\n private readonly tcpPorts = EVENTSTOREDB_TCP_PORTS;\n\n constructor(\n image = EVENTSTOREDB_DEFAULT_IMAGE,\n options: EventStoreDBContainerOptions = defaultEventStoreDBContainerOptions,\n ) {\n super(image);\n\n const environment: Environment = {\n ...(!options.disableProjections\n ? {\n EVENTSTORE_RUN_PROJECTIONS: 'ALL',\n }\n : {}),\n ...(!options.isSecure\n ? {\n EVENTSTORE_INSECURE: 'true',\n }\n : {}),\n ...(options.useFileStorage\n ? {\n EVENTSTORE_MEM_DB: 'false',\n EVENTSTORE_DB: '/data/integration-tests',\n }\n : {}),\n EVENTSTORE_CLUSTER_SIZE: '1',\n EVENTSTORE_START_STANDARD_PROJECTIONS: 'true',\n EVENTSTORE_EXT_TCP_PORT: `${EVENTSTOREDB_TCP_PORT}`,\n EVENTSTORE_HTTP_PORT: `${EVENTSTOREDB_PORT}`,\n EVENTSTORE_ENABLE_EXTERNAL_TCP: 'true',\n EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP: 'true',\n };\n\n this.withEnvironment(environment).withExposedPorts(...this.tcpPorts);\n\n if (!options.withoutReuse) this.withReuse();\n }\n\n async start(): Promise<StartedEventStoreDBContainer> {\n return new StartedEventStoreDBContainer(await super.start());\n }\n}\n\nexport class StartedEventStoreDBContainer extends AbstractStartedContainer {\n constructor(container: StartedTestContainer) {\n super(container);\n }\n\n getConnectionString(): string {\n return `esdb://${this.getHost()}:${this.getMappedPort(2113)}?tls=false`;\n }\n\n getClient(): EventStoreDBClient {\n return EventStoreDBClient.connectionString(this.getConnectionString());\n }\n}\n"],"mappings":";AAAA,SAAS,sBAAAA,2BAA0B;;;ACAnC,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AAGA,IAAM,oBAAoB;AAC1B,IAAM,wBAAwB;AAC9B,IAAM,yBAAyB;AAAA,EACpC;AAAA,EACA;AACF;AACO,IAAM,0BAA0B;AAChC,IAAM,yBAAyB;AAC/B,IAAM,+BAA+B;AAErC,IAAM,6BAA6B,GAAG,uBAAuB,IAAI,QAAQ,SAAS,UAAU,yBAAyB,4BAA4B;AASjJ,IAAM,sCACX;AAAA,EACE,oBAAoB;AAAA,EACpB,UAAU;AAAA,EACV,gBAAgB;AAAA,EAChB,cAAc;AAChB;AAEK,IAAM,wBAAN,cAAoC,iBAAiB;AAAA,EACzC,WAAW;AAAA,EAE5B,YACE,QAAQ,4BACR,UAAwC,qCACxC;AACA,UAAM,KAAK;AAEX,UAAM,cAA2B;AAAA,MAC/B,GAAI,CAAC,QAAQ,qBACT;AAAA,QACE,4BAA4B;AAAA,MAC9B,IACA,CAAC;AAAA,MACL,GAAI,CAAC,QAAQ,WACT;AAAA,QACE,qBAAqB;AAAA,MACvB,IACA,CAAC;AAAA,MACL,GAAI,QAAQ,iBACR;AAAA,QACE,mBAAmB;AAAA,QACnB,eAAe;AAAA,MACjB,IACA,CAAC;AAAA,MACL,yBAAyB;AAAA,MACzB,uCAAuC;AAAA,MACvC,yBAAyB,GAAG,qBAAqB;AAAA,MACjD,sBAAsB,GAAG,iBAAiB;AAAA,MAC1C,gCAAgC;AAAA,MAChC,sCAAsC;AAAA,IACxC;AAEA,SAAK,gBAAgB,WAAW,EAAE,iBAAiB,GAAG,KAAK,QAAQ;AAEnE,QAAI,CAAC,QAAQ,aAAc,MAAK,UAAU;AAAA,EAC5C;AAAA,EAEA,MAAM,QAA+C;AACnD,WAAO,IAAI,6BAA6B,MAAM,MAAM,MAAM,CAAC;AAAA,EAC7D;AACF;AAEO,IAAM,+BAAN,cAA2C,yBAAyB;AAAA,EACzE,YAAY,WAAiC;AAC3C,UAAM,SAAS;AAAA,EACjB;AAAA,EAEA,sBAA8B;AAC5B,WAAO,UAAU,KAAK,QAAQ,CAAC,IAAI,KAAK,cAAc,IAAI,CAAC;AAAA,EAC7D;AAAA,EAEA,YAAgC;AAC9B,WAAO,mBAAmB,iBAAiB,KAAK,oBAAoB,CAAC;AAAA,EACvE;AACF;;;ADnFA,IAAI;AAEG,IAAM,4BAA4B,OACvC,oBAAoB,UACY;AAChC,MAAI;AAEJ,MAAI,mBAAmB;AACrB,QAAI,CAAC;AACH,sBAAgB,MAAM,IAAI,sBAAsB,EAAE,MAAM;AAE1D,uBAAmB,cAAc,oBAAoB;AAAA,EACvD,OAAO;AAEL,uBAAmB;AAAA,EACrB;AAIA,SAAOC,oBAAmB,iBAAiB,gBAAgB;AAC7D;","names":["EventStoreDBClient","EventStoreDBClient"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@event-driven-io/emmett-testcontainers",
3
- "version": "0.20.2-alpha2",
3
+ "version": "0.21.0",
4
4
  "type": "module",
5
5
  "description": "Emmett - TestContainers - Event Sourcing development made simple",
6
6
  "scripts": {
@@ -47,7 +47,7 @@
47
47
  "dist"
48
48
  ],
49
49
  "dependencies": {
50
- "@event-driven-io/emmett": "0.20.2-alpha2",
50
+ "@event-driven-io/emmett": "0.21.0",
51
51
  "testcontainers": "^10.12.0"
52
52
  },
53
53
  "devDependencies": {