Thanks to visit codestin.com
Credit goes to github.com

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
28 changes: 14 additions & 14 deletions .github/workflows/release-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,56 +33,56 @@ jobs:
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/dynamodb-event-storage-adapter/package.json
package: ./packages/event-storage-adapter-dynamodb/package.json
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/inmemory-event-storage-adapter/package.json
package: ./packages/event-storage-adapter-in-memory/package.json
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/redux-event-storage-adapter/package.json
package: ./packages/event-storage-adapter-redux/package.json
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/json-schema-event/package.json
package: ./packages/event-type-json-schema/package.json
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/zod-event/package.json
package: ./packages/event-type-zod/package.json
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/json-schema-command/package.json
package: ./packages/command-json-schema/package.json
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/event-bridge-message-bus-adapter/package.json
package: ./packages/message-bus-adapter-event-bridge/package.json
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/event-bridge-s3-message-bus-adapter/package.json
package: ./packages/message-bus-adapter-event-bridge-s3/package.json
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/in-memory-message-bus-adapter/package.json
package: ./packages/message-bus-adapter-in-memory/package.json
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/sqs-message-queue-adapter/package.json
package: ./packages/message-queue-adapter-sqs/package.json
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/in-memory-message-queue-adapter/package.json
package: ./packages/message-queue-adapter-in-memory/package.json
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/test-tools/package.json
package: ./packages/lib-test-tools/package.json
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/react-visualizer/package.json
package: ./packages/lib-react-visualizer/package.json
- uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./packages/dam/package.json
package: ./packages/lib-dam/package.json
28 changes: 14 additions & 14 deletions castore.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -38,59 +38,59 @@
"name": "🫀 Core"
},
{
"path": "packages/dynamodb-event-storage-adapter",
"path": "packages/event-storage-adapter-dynamodb",
"name": "🔌 DynamoDB"
},
{
"path": "packages/redux-event-storage-adapter",
"path": "packages/event-storage-adapter-redux",
"name": "🔌 Redux"
},
{
"path": "packages/inmemory-event-storage-adapter",
"path": "packages/event-storage-adapter-in-memory",
"name": "🔌 InMemory"
},
{
"path": "packages/json-schema-event",
"path": "packages/event-type-json-schema",
"name": "📆 Json Schema Event"
},
{
"path": "packages/zod-event",
"path": "packages/event-type-zod",
"name": "📆 Zod Event"
},
{
"path": "packages/json-schema-command",
"path": "packages/command-json-schema",
"name": "👮‍♀️ Json Schema Command"
},
{
"path": "packages/event-bridge-message-bus-adapter",
"path": "packages/message-bus-adapter-event-bridge",
"name": "🚌 EventBridge"
},
{
"path": "packages/event-bridge-s3-message-bus-adapter",
"path": "packages/message-bus-adapter-event-bridge-s3",
"name": "🚌 EventBridge + S3"
},
{
"path": "packages/in-memory-message-bus-adapter",
"path": "packages/message-bus-adapter-in-memory",
"name": "🚌 InMemory"
},
{
"path": "packages/sqs-message-queue-adapter",
"path": "packages/message-queue-adapter-sqs",
"name": "📨 SQS"
},
{
"path": "packages/in-memory-message-queue-adapter",
"path": "packages/message-queue-adapter-in-memory",
"name": "📨 InMemory"
},
{
"path": "packages/test-tools",
"path": "packages/lib-test-tools",
"name": "🔨 Test Tools"
},
{
"path": "packages/react-visualizer",
"path": "packages/lib-react-visualizer",
"name": "🔨 React Visualizer"
},
{
"path": "packages/dam",
"path": "packages/lib-dam",
"name": "🔨 Dam"
},
{
Expand Down
6 changes: 3 additions & 3 deletions demo/blueprint/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"dependencies": {
"@babel/runtime": "^7.18.3",
"@castore/json-schema-command": "workspace:"
"@castore/command-json-schema": "workspace:"
},
"devDependencies": {
"@babel/cli": "^7.17.6",
Expand All @@ -37,7 +37,7 @@
"@babel/preset-env": "^7.16.11",
"@babel/preset-typescript": "^7.16.7",
"@castore/core": "workspace:",
"@castore/json-schema-event": "workspace:",
"@castore/event-type-json-schema": "workspace:",
"@types/node": "^17.0.29",
"babel-plugin-module-resolver": "^4.1.0",
"concurrently": "^7.1.0",
Expand Down Expand Up @@ -68,7 +68,7 @@
},
"peerDependencies": {
"@castore/core": "*",
"@castore/json-schema-event": "*",
"@castore/event-type-json-schema": "*",
"json-schema-to-ts": "^2.0.0"
}
}
2 changes: 1 addition & 1 deletion demo/blueprint/src/commands/catchPokemon.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { JSONSchemaCommand } from '@castore/command-json-schema';
import { EventStore, tuple } from '@castore/core';
import { JSONSchemaCommand } from '@castore/json-schema-command';

import { pokemonsEventStore } from '~/pokemons';
import { trainersEventStore } from '~/trainers';
Expand Down
2 changes: 1 addition & 1 deletion demo/blueprint/src/commands/levelUpPokemon.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { JSONSchemaCommand } from '@castore/command-json-schema';
import { tuple } from '@castore/core';
import { JSONSchemaCommand } from '@castore/json-schema-command';

import { pokemonsEventStore } from '~/pokemons';

Expand Down
2 changes: 1 addition & 1 deletion demo/blueprint/src/commands/startPokemonGame.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { JSONSchemaCommand } from '@castore/command-json-schema';
import { tuple } from '@castore/core';
import { JSONSchemaCommand } from '@castore/json-schema-command';

import { trainersEventStore } from '~/trainers';

Expand Down
2 changes: 1 addition & 1 deletion demo/blueprint/src/commands/wildPokemonAppear.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { JSONSchemaCommand } from '@castore/command-json-schema';
import { tuple } from '@castore/core';
import { JSONSchemaCommand } from '@castore/json-schema-command';

import { pokemonsEventStore } from '~/pokemons';

Expand Down
2 changes: 1 addition & 1 deletion demo/blueprint/src/pokemons/events.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JSONSchemaEventType } from '@castore/json-schema-event';
import { JSONSchemaEventType } from '@castore/event-type-json-schema';

export const appearedEvent = new JSONSchemaEventType({
type: 'APPEARED',
Expand Down
2 changes: 1 addition & 1 deletion demo/blueprint/src/trainers/events.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JSONSchemaEventType } from '@castore/json-schema-event';
import { JSONSchemaEventType } from '@castore/event-type-json-schema';

export const gameStartedEvent = new JSONSchemaEventType({
type: 'GAME_STARTED',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import MockDate from 'mockdate';

import { EventStoreEventDetails } from '@castore/core';
import { catchPokemonCommand } from '@castore/demo-blueprint';
import { mockEventStore } from '@castore/test-tools';
import { mockEventStore } from '@castore/lib-test-tools';

import { pokemonsEventStore } from '~/libs/eventStores/pokemons';
import { trainersEventStore } from '~/libs/eventStores/trainers';
Expand Down
2 changes: 1 addition & 1 deletion demo/implementation/libs/eventStores/pokemons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { pokemonsEventStore as $pokemonsEventStore } from '@castore/demo-blueprint';
import { LegacyDynamoDBEventStorageAdapter } from '@castore/dynamodb-event-storage-adapter';
import { LegacyDynamoDBEventStorageAdapter } from '@castore/event-storage-adapter-dynamodb';

import { dynamoDBClient } from './client';

Expand Down
2 changes: 1 addition & 1 deletion demo/implementation/libs/eventStores/trainers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { trainersEventStore as $trainersEventStore } from '@castore/demo-blueprint';
import { LegacyDynamoDBEventStorageAdapter } from '@castore/dynamodb-event-storage-adapter';
import { LegacyDynamoDBEventStorageAdapter } from '@castore/event-storage-adapter-dynamodb';

import { dynamoDBClient } from './client';

Expand Down
4 changes: 2 additions & 2 deletions demo/implementation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
"@aws-sdk/client-dynamodb": "^3.2.0",
"@castore/core": "workspace:",
"@castore/demo-blueprint": "workspace:",
"@castore/dynamodb-event-storage-adapter": "workspace:",
"@castore/event-storage-adapter-dynamodb": "workspace:",
"@middy/core": "^3.0.4",
"@middy/validator": "^3.0.4",
"source-map-support": "^0.5.19"
},
"devDependencies": {
"@castore/test-tools": "workspace:",
"@castore/lib-test-tools": "workspace:",
"@serverless/typescript": "^3.0.0",
"@types/aws-lambda": "^8.10.82",
"@types/http-errors": "^1.8.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
EVENT_TABLE_PK,
EVENT_TABLE_SK,
EVENT_TABLE_TIMESTAMP_KEY,
} from '@castore/dynamodb-event-storage-adapter';
} from '@castore/event-storage-adapter-dynamodb';

import { DynamoDBKeyType } from './keyType';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
EVENT_TABLE_PK,
EVENT_TABLE_SK,
EVENT_TABLE_TIMESTAMP_KEY,
} from '@castore/dynamodb-event-storage-adapter';
} from '@castore/event-storage-adapter-dynamodb';

import { DynamoDBKeyType } from './keyType';

Expand Down
4 changes: 2 additions & 2 deletions demo/implementation/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
{ "path": "../blueprint/tsconfig.build.json" },
{ "path": "../../packages/core/tsconfig.build.json" },
{
"path": "../../packages/dynamodb-event-storage-adapter/tsconfig.build.json"
"path": "../../packages/event-storage-adapter-dynamodb/tsconfig.build.json"
},
{ "path": "../../packages/test-tools/tsconfig.build.json" }
{ "path": "../../packages/lib-test-tools/tsconfig.build.json" }
],
"ts-node": {
"files": true,
Expand Down
4 changes: 2 additions & 2 deletions demo/visualization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
]
},
"dependencies": {
"@castore/command-json-schema": "workspace:",
"@castore/core": "workspace:",
"@castore/demo-blueprint": "workspace:",
"@castore/json-schema-command": "workspace:",
"@castore/react-visualizer": "workspace:",
"@castore/lib-react-visualizer": "workspace:",
"@mui/material": "^5.6.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion demo/visualization/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
catchPokemonCommand,
levelUpPokemonCommand,
} from '@castore/demo-blueprint';
import { Visualizer } from '@castore/react-visualizer';
import { Visualizer } from '@castore/lib-react-visualizer';

import './index.css';

Expand Down
6 changes: 3 additions & 3 deletions docs/docs/1-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ Here is an example of working `package.json`:
{
...
"dependencies": {
"@castore/core": "1.3.1",
"@castore/dynamodb-event-storage-adapter": "1.3.1"
"@castore/core": "2.0.0",
"@castore/event-storage-adapter-dynamodb": "2.0.0"
...
},
"devDependencies": {
"@castore/test-tools": "1.3.1"
"@castore/lib-test-tools": "2.0.0"
...
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/2-event-sourcing/3-event-stores.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ const { aggregate } = await pokemonsEventStore.getExistingAggregate(
`OptionsObj` contains the following properties:

- <code>prevAggregate <i>(?Aggregate)</i></code>: The aggregate at the current version, i.e. before having pushed the event. Can be useful in some cases like when using the <a href="../../reacting-to-events/connected-event-store">ConnectedEventStore class</a>
- <code>force <i>(?boolean)</i></code>: To force push the event even if one already exists for the corresponding <code>aggregateId</code> and <code>version</code>. Any existing event will be overridden, so use with extra care, mainly in <a href="https://www.npmjs.com/package/@castore/dam">data migrations</a>.
- <code>force <i>(?boolean)</i></code>: To force push the event even if one already exists for the corresponding <code>aggregateId</code> and <code>version</code>. Any existing event will be overridden, so use with extra care, mainly in <a href="https://www.npmjs.com/package/@castore/lib-dam">data migrations</a>.

`ResponseObj` contains the following properties:

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/2-event-sourcing/5-pushing-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Fetching and pushing events non-simultaneously exposes your application to [race

![Command Retry](../../assets/docSchemas/commandRetry.png)

Finally, Command handlers should be, as much as possible, [pure functions](https://en.wikipedia.org/wiki/Pure_function). If they depend on impure functions like functions with unpredictable outputs (e.g. id generation), mutating effects, side effects or state dependency (e.g. external data fetching), you should pass them through the additional context arguments rather than directly importing and using them. This will make them easier to test and to re-use in different contexts, such as in the [React Visualizer](https://www.npmjs.com/package/@castore/react-visualizer).
Finally, Command handlers should be, as much as possible, [pure functions](https://en.wikipedia.org/wiki/Pure_function). If they depend on impure functions like functions with unpredictable outputs (e.g. id generation), mutating effects, side effects or state dependency (e.g. external data fetching), you should pass them through the additional context arguments rather than directly importing and using them. This will make them easier to test and to re-use in different contexts, such as in the [React Visualizer](https://www.npmjs.com/package/@castore/lib-react-visualizer).

<details>
<summary>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/2-event-sourcing/6-joining-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ Like the `pushEvent` API, event groups are designed to throw an `EventAlreadyExi

:::info

☝️ Also, be aware of technical constraints of your event storage solution. For instance, the [`DynamoDBEventStorageAdapter`](https://www.npmjs.com/package/@castore/dynamodb-event-storage-adapter)'s implementation is based on [DynamoDB transactions](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transaction-apis.html), which means that the event stores tables must be in the same region, and that a group cannot contain more than 100 events.
☝️ Also, be aware of technical constraints of your event storage solution. For instance, the [`DynamoDBEventStorageAdapter`](https://www.npmjs.com/package/@castore/event-storage-adapter-dynamodb)'s implementation is based on [DynamoDB transactions](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/transaction-apis.html), which means that the event stores tables must be in the same region, and that a group cannot contain more than 100 events.

:::
2 changes: 1 addition & 1 deletion docs/docs/3-reacting-to-events/2-message-queues.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ The adapter packages will also expose useful generics to type the arguments of y
import type {
SQSMessageQueueMessage,
SQSMessageQueueMessageBody,
} from '@castore/sqs-message-queue-adapter';
} from '@castore/message-queue-adapter-sqs';

const appMessagesWorker = async ({ Records }: SQSMessageQueueMessage) => {
Records.forEach(({ body }) => {
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/3-reacting-to-events/3-message-buses.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ You can code your own `MessageBusAdapter` (simply implement the `MessageChannelA
The adapter packages will also expose useful generics to type the arguments of your bus listeners. For instance:

```ts
import type { EventBridgeMessageBusMessage } from '@castore/event-bridge-message-bus-adapter';
import type { EventBridgeMessageBusMessage } from '@castore/message-bus-adapter-event-bridge';

const pokemonMessagesListener = async (
// 👇 Specify that you only listen to the pokemonsEventStore messages
Expand Down
Loading