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
6 changes: 6 additions & 0 deletions .changeset/typescript-eslint-8-71-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@codeforbreakfast/eventsourcing-aggregates': patch
'@codeforbreakfast/eventsourcing-store': patch
---

Internal tidy-up for typescript-eslint 8.71.2, which now reports a schema constant that is only ever used for its type. The shared event store test suite and the command processing example declare their event types directly instead. Nothing you import changes.
94 changes: 64 additions & 30 deletions bun.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@
"@effect/rpc": "0.76.2",
"@effect/workflow": "0.19.1",
"@types/bun": "1.4.3",
"@typescript-eslint/eslint-plugin": "8.71.0",
"@typescript-eslint/parser": "8.71.0",
"@typescript-eslint/eslint-plugin": "8.71.2",
"@typescript-eslint/parser": "8.71.2",
"dependency-cruiser": "17.4.3",
"effect": "3.22.3",
"eslint": "10.11.0",
"eslint": "10.12.0",
"eslint-config-prettier": "10.1.8",
"@eslint-community/eslint-plugin-eslint-comments": "4.8.1",
"eslint-plugin-functional": "10.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/eslint-effect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"eslint": ">=8.40.0"
},
"devDependencies": {
"eslint": "10.11.0",
"@typescript-eslint/eslint-plugin": "8.71.0",
"eslint": "10.12.0",
"@typescript-eslint/eslint-plugin": "8.71.2",
"typescript": "5.9.3",
"effect": "3.22.3"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-aggregates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@codeforbreakfast/eventsourcing-store-inmemory": "workspace:*",
"effect": "3.22.3",
"typescript": "5.9.3",
"eslint": "10.11.0"
"eslint": "10.12.0"
},
"publishConfig": {
"access": "public"
Expand Down
15 changes: 3 additions & 12 deletions packages/eventsourcing-aggregates/src/lib/aggregate-load.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,9 @@ interface TestAggregateState {
readonly count: number;
}

const TestEventCreated = Schema.Struct({
type: Schema.Literal('TestCreated'),
data: Schema.Struct({ value: Schema.String }),
});

const TestEventIncremented = Schema.Struct({
type: Schema.Literal('TestIncremented'),
data: Schema.Struct({}),
});

const TestEvent = Schema.Union(TestEventCreated, TestEventIncremented);
type TestEvent = Schema.Schema.Type<typeof TestEvent>;
type TestEvent =
| { readonly type: 'TestCreated'; readonly data: { readonly value: string } }
| { readonly type: 'TestIncremented'; readonly data: Readonly<Record<string, never>> };

const applyTestEvent =
(state: Readonly<Option.Option<TestAggregateState>>) =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Effect, Layer, pipe, Schema, Context } from 'effect';
import { Effect, Layer, pipe, Context } from 'effect';
import type { ReadonlyDeep } from 'type-fest';
import {
CommandProcessingService,
Expand All @@ -20,24 +20,12 @@ import {
// ============================================================================

// Example: Define your domain-specific events
const UserCreated = Schema.Struct({
type: Schema.Literal('UserCreated'),
data: Schema.Struct({
name: Schema.String,
email: Schema.String,
}),
});

const UserUpdated = Schema.Struct({
type: Schema.Literal('UserUpdated'),
data: Schema.Struct({
name: Schema.String,
}),
});

// Example: Union of all user events
const UserEvent = Schema.Union(UserCreated, UserUpdated);
type UserEvent = typeof UserEvent.Type;
type UserEvent =
| {
readonly type: 'UserCreated';
readonly data: { readonly name: string; readonly email: string };
}
| { readonly type: 'UserUpdated'; readonly data: { readonly name: string } };

// Example: Create a domain-specific event store tag
const UserEventStore = Context.GenericTag<EventStore<UserEvent>, EventStore<UserEvent>>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,12 @@ const isUnknownError: (
) => error is Extract<CommandFailure['error'], { readonly _tag: 'UnknownError' }> =
Schema.is(UnknownErrorSchema);

const UserCreated = Schema.Struct({
type: Schema.Literal('UserCreated'),
data: Schema.Struct({
name: Schema.String,
email: Schema.String,
}),
});

const OrderCreated = Schema.Struct({
type: Schema.Literal('OrderCreated'),
data: Schema.Struct({
orderId: Schema.String,
}),
});

const TestEvent = Schema.Union(UserCreated, OrderCreated);
type TestEvent = typeof TestEvent.Type;
type TestEvent =
| {
readonly type: 'UserCreated';
readonly data: { readonly name: string; readonly email: string };
}
| { readonly type: 'OrderCreated'; readonly data: { readonly orderId: string } };

const TestEventStore = Context.GenericTag<EventStore<TestEvent>, EventStore<TestEvent>>(
'TestEventStore'
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-commands/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"@types/node": "24.19.2",
"effect": "3.22.3",
"typescript": "5.9.3",
"eslint": "10.11.0"
"eslint": "10.12.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-projections/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"@types/node": "24.19.2",
"effect": "3.22.3",
"typescript": "5.9.3",
"eslint": "10.11.0"
"eslint": "10.12.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"@types/node": "24.19.2",
"effect": "3.22.3",
"typescript": "5.9.3",
"eslint": "10.11.0"
"eslint": "10.12.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"@codeforbreakfast/bun-test-effect": "workspace:*",
"effect": "3.22.3",
"typescript": "5.9.3",
"eslint": "10.11.0"
"eslint": "10.12.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-store-filesystem/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@effect/platform-bun": "0.91.3",
"@types/node": "24.19.2",
"effect": "3.22.3",
"eslint": "10.11.0",
"eslint": "10.12.0",
"typescript": "5.9.3"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-store-inmemory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@types/node": "24.19.2",
"effect": "3.22.3",
"typescript": "5.9.3",
"eslint": "10.11.0"
"eslint": "10.12.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-store-postgres/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@effect/platform-bun": "0.91.3",
"@types/node": "24.19.2",
"effect": "3.22.3",
"eslint": "10.11.0",
"eslint": "10.12.0",
"typescript": "5.9.3"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@codeforbreakfast/bun-test-effect": "workspace:*",
"effect": "3.22.3",
"typescript": "5.9.3",
"eslint": "10.11.0"
"eslint": "10.12.0"
},
"publishConfig": {
"access": "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ const Id = {
export const newEventStreamId = () =>
pipe(`stream_${Id.randomPart()}`, Schema.decode(EventStreamId));

const FooEvent = Schema.Struct({ bar: Schema.String });
type FooEvent = typeof FooEvent.Type;
type FooEvent = { readonly bar: string };

const readStreamFromBeginning =
(streamId: Effect.Effect<EventStreamId, ParseResult.ParseError, never>) =>
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-testing-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@types/node": "24.19.2",
"effect": "3.22.3",
"typescript": "5.9.3",
"eslint": "10.11.0"
"eslint": "10.12.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-transport-inmemory/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@codeforbreakfast/bun-test-effect": "workspace:*",
"@types/node": "24.19.2",
"effect": "3.22.3",
"eslint": "10.11.0",
"eslint": "10.12.0",
"typescript": "5.9.3"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-transport-websocket/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"@types/node": "24.19.2",
"bun-types": "1.4.3",
"effect": "3.22.3",
"eslint": "10.11.0",
"eslint": "10.12.0",
"typescript": "5.9.3"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-transport/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@types/node": "24.19.2",
"effect": "3.22.3",
"typescript": "5.9.3",
"eslint": "10.11.0"
"eslint": "10.12.0"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion packages/eventsourcing-websocket/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@types/node": "24.19.2",
"effect": "3.22.3",
"typescript": "5.9.3",
"eslint": "10.11.0"
"eslint": "10.12.0"
},
"publishConfig": {
"access": "public"
Expand Down
Loading