Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ updates:
prefix: chore
prefix-development: chore

- package-ecosystem: docker
directory: "/docker"
schedule:
interval: weekly
open-pull-requests-limit: 10
assignees:
- thenativeweb/internal_dev
labels:
- Dependencies
commit-message:
prefix: chore

- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.github/
docker/
src/

.gitignore
.npmignore
biome.json
Expand Down
1 change: 1 addition & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM thenativeweb/eventsourcingdb:0.118.10
19 changes: 19 additions & 0 deletions src/getImageVersionFromDockerfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import fs from 'node:fs';
import path from 'node:path';

const versionRegex = /^FROM\sthenativeweb\/eventsourcingdb:(.+)$/m;

const getImageVersionFromDockerfile = (): string => {
const dockerfile = path.join(__dirname, '..', 'docker', 'Dockerfile');
const data = fs.readFileSync(dockerfile, 'utf-8');

const matches = data.match(versionRegex);

if (!matches) {
throw new Error('Failed to find image version in Dockerfile');
}

return matches[1];
};

export { getImageVersionFromDockerfile };
4 changes: 3 additions & 1 deletion src/observeEvents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { afterEach, beforeEach, suite, test } from 'node:test';
import type { Event } from './Event.js';
import type { EventCandidate } from './EventCandidate.js';
import { EventSourcingDbContainer } from './EventSourcingDbContainer.js';
import { getImageVersionFromDockerfile } from './getImageVersionFromDockerfile.js';

suite('observeEvents', { timeout: 30_000 }, () => {
let container: EventSourcingDbContainer;

beforeEach(async () => {
container = new EventSourcingDbContainer();
const imageVersion = getImageVersionFromDockerfile();
container = new EventSourcingDbContainer().withImageTag(imageVersion);
await container.start();
});

Expand Down
4 changes: 3 additions & 1 deletion src/ping.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import assert from 'node:assert/strict';
import { afterEach, beforeEach, suite, test } from 'node:test';
import { Client } from './Client.js';
import { EventSourcingDbContainer } from './EventSourcingDbContainer.js';
import { getImageVersionFromDockerfile } from './getImageVersionFromDockerfile.js';

suite('ping', { timeout: 30_000 }, () => {
let container: EventSourcingDbContainer;

beforeEach(async () => {
container = new EventSourcingDbContainer();
const imageVersion = getImageVersionFromDockerfile();
container = new EventSourcingDbContainer().withImageTag(imageVersion);
await container.start();
});

Expand Down
4 changes: 3 additions & 1 deletion src/readEventTypes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { afterEach, beforeEach, suite, test } from 'node:test';
import type { EventCandidate } from './EventCandidate.js';
import { EventSourcingDbContainer } from './EventSourcingDbContainer.js';
import type { EventType } from './EventType.js';
import { getImageVersionFromDockerfile } from './getImageVersionFromDockerfile.js';

suite('readEventTypes', { timeout: 20_000 }, () => {
let container: EventSourcingDbContainer;

beforeEach(async () => {
container = new EventSourcingDbContainer();
const imageVersion = getImageVersionFromDockerfile();
container = new EventSourcingDbContainer().withImageTag(imageVersion);
await container.start();
});

Expand Down
4 changes: 3 additions & 1 deletion src/readEvents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { afterEach, beforeEach, suite, test } from 'node:test';
import type { Event } from './Event.js';
import type { EventCandidate } from './EventCandidate.js';
import { EventSourcingDbContainer } from './EventSourcingDbContainer.js';
import { getImageVersionFromDockerfile } from './getImageVersionFromDockerfile.js';

suite('readEvents', { timeout: 30_000 }, () => {
let container: EventSourcingDbContainer;

beforeEach(async () => {
container = new EventSourcingDbContainer();
const imageVersion = getImageVersionFromDockerfile();
container = new EventSourcingDbContainer().withImageTag(imageVersion);
await container.start();
});

Expand Down
4 changes: 3 additions & 1 deletion src/readSubjects.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import assert from 'node:assert/strict';
import { afterEach, beforeEach, suite, test } from 'node:test';
import type { EventCandidate } from './EventCandidate.js';
import { EventSourcingDbContainer } from './EventSourcingDbContainer.js';
import { getImageVersionFromDockerfile } from './getImageVersionFromDockerfile.js';

suite('readSubjects', { timeout: 30_000 }, () => {
let container: EventSourcingDbContainer;

beforeEach(async () => {
container = new EventSourcingDbContainer();
const imageVersion = getImageVersionFromDockerfile();
container = new EventSourcingDbContainer().withImageTag(imageVersion);
await container.start();
});

Expand Down
4 changes: 3 additions & 1 deletion src/registerEventSchema.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import assert from 'node:assert/strict';
import { afterEach, beforeEach, suite, test } from 'node:test';
import { EventSourcingDbContainer } from './EventSourcingDbContainer.js';
import { getImageVersionFromDockerfile } from './getImageVersionFromDockerfile.js';

suite('registerEventSchema', { timeout: 30_000 }, () => {
let container: EventSourcingDbContainer;

beforeEach(async () => {
container = new EventSourcingDbContainer();
const imageVersion = getImageVersionFromDockerfile();
container = new EventSourcingDbContainer().withImageTag(imageVersion);
await container.start();
});

Expand Down
4 changes: 3 additions & 1 deletion src/runEventQlQuery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import assert from 'node:assert/strict';
import { afterEach, beforeEach, suite, test } from 'node:test';
import type { EventCandidate } from './EventCandidate.js';
import { EventSourcingDbContainer } from './EventSourcingDbContainer.js';
import { getImageVersionFromDockerfile } from './getImageVersionFromDockerfile.js';

suite('runEventQlQuery', { timeout: 30_000 }, () => {
let container: EventSourcingDbContainer;

beforeEach(async () => {
container = new EventSourcingDbContainer();
const imageVersion = getImageVersionFromDockerfile();
container = new EventSourcingDbContainer().withImageTag(imageVersion);
await container.start();
});

Expand Down
4 changes: 3 additions & 1 deletion src/verifyApiToken.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import assert from 'node:assert/strict';
import { afterEach, beforeEach, suite, test } from 'node:test';
import { Client } from './Client.js';
import { EventSourcingDbContainer } from './EventSourcingDbContainer.js';
import { getImageVersionFromDockerfile } from './getImageVersionFromDockerfile.js';

suite('verifyApiToken', { timeout: 30_000 }, () => {
let container: EventSourcingDbContainer;

beforeEach(async () => {
container = new EventSourcingDbContainer();
const imageVersion = getImageVersionFromDockerfile();
container = new EventSourcingDbContainer().withImageTag(imageVersion);
await container.start();
});

Expand Down
4 changes: 3 additions & 1 deletion src/writeEvents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import assert from 'node:assert/strict';
import { afterEach, beforeEach, suite, test } from 'node:test';
import type { EventCandidate } from './EventCandidate.js';
import { EventSourcingDbContainer } from './EventSourcingDbContainer.js';
import { getImageVersionFromDockerfile } from './getImageVersionFromDockerfile.js';
import { isSubjectOnEventId } from './isSubjectOnEventId.js';
import { isSubjectPristine } from './isSubjectPristine.js';

suite('writeEvents', { timeout: 30_000 }, () => {
let container: EventSourcingDbContainer;

beforeEach(async () => {
container = new EventSourcingDbContainer();
const imageVersion = getImageVersionFromDockerfile();
container = new EventSourcingDbContainer().withImageTag(imageVersion);
await container.start();
});

Expand Down