@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 +92 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +92 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,93 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class
|
|
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
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/eventStore/index.ts","../src/eventStore/eventStoreDBContainer.ts"],"names":[
|
|
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
|
-
|
|
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,
|
|
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.
|
|
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.
|
|
50
|
+
"@event-driven-io/emmett": "0.21.0",
|
|
51
51
|
"testcontainers": "^10.12.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|