@event-driven-io/emmett 0.1.5 → 0.1.7
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/commandHandling/handleCommand.js.map +1 -1
- package/dist/commandHandling/handleCommand.mjs.map +1 -1
- package/dist/commandHandling/handleCommandWithDecider.js.map +1 -1
- package/dist/commandHandling/handleCommandWithDecider.mjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/testing/deciderSpecification.js +2 -1
- package/dist/testing/deciderSpecification.js.map +1 -1
- package/dist/testing/deciderSpecification.mjs +2 -1
- package/dist/testing/deciderSpecification.mjs.map +1 -1
- package/dist/testing/index.d.mts +1 -2
- package/dist/testing/index.d.ts +1 -2
- package/dist/testing/index.js +2 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/index.mjs +1 -0
- package/dist/testing/index.mjs.map +1 -1
- package/dist/typing/index.d.mts +3 -3
- package/dist/typing/index.d.ts +3 -3
- package/dist/utils/iterators.js.map +1 -1
- package/dist/utils/iterators.mjs.map +1 -1
- package/package.json +3 -37
- package/README.md +0 -62
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commandHandling/handleCommand.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/commandHandling/handleCommand.ts"],"names":[],"mappings":"AAIO,MAAM,iBACX,CACE,QACA,iBACA,kBAEF,OACE,YACA,IACA,WACG;AACH,QAAM,aAAa,cAAc,EAAE;AAEnC,QAAM,QAAQ,MAAM,WAAW,gBAAgB,YAAY;AAAA,IACzD;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,SAAS,OAAO,SAAS,gBAAgB,CAAC;AAEhD,MAAI,MAAM,QAAQ,MAAM;AACtB,WAAO,WAAW,eAAe,YAAY,GAAG,MAAM;AAAA;AACnD,WAAO,WAAW,eAAe,YAAY,MAAM;AAC1D","sourcesContent":["import type { EventStore } from '../eventStore';\nimport type { Event } from '../typing';\n\n// #region command-handler\nexport const CommandHandler =\n <State, StreamEvent extends Event>(\n evolve: (state: State, event: StreamEvent) => State,\n getInitialState: () => State,\n mapToStreamId: (id: string) => string,\n ) =>\n async (\n eventStore: EventStore,\n id: string,\n handle: (state: State) => StreamEvent | StreamEvent[],\n ) => {\n const streamName = mapToStreamId(id);\n\n const state = await eventStore.aggregateStream(streamName, {\n evolve,\n getInitialState,\n });\n\n const result = handle(state ?? getInitialState());\n\n if (Array.isArray(result))\n return eventStore.appendToStream(streamName, ...result);\n else return eventStore.appendToStream(streamName, result);\n };\n// #endregion command-handler\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commandHandling/handleCommand.ts"],"sourcesContent":["import type { EventStore } from '../eventStore';\nimport type { Event } from '../typing';\n\nexport const CommandHandler =\n <State, StreamEvent extends Event>(\n evolve: (state: State, event: StreamEvent) => State,\n getInitialState: () => State,\n mapToStreamId: (id: string) => string,\n ) =>\n async (\n eventStore: EventStore,\n id: string,\n handle: (state: State) => StreamEvent | StreamEvent[],\n ) => {\n const streamName = mapToStreamId(id);\n\n const state = await eventStore.aggregateStream(streamName, {\n evolve,\n getInitialState,\n });\n\n const result = handle(state ?? getInitialState());\n\n if (Array.isArray(result))\n return eventStore.appendToStream(streamName, ...result);\n else return eventStore.appendToStream(streamName, result);\n };\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/commandHandling/handleCommand.ts"],"sourcesContent":["import type { EventStore } from '../eventStore';\nimport type { Event } from '../typing';\n\n// #region command-handler\nexport const CommandHandler =\n <State, StreamEvent extends Event>(\n evolve: (state: State, event: StreamEvent) => State,\n getInitialState: () => State,\n mapToStreamId: (id: string) => string,\n ) =>\n async (\n eventStore: EventStore,\n id: string,\n handle: (state: State) => StreamEvent | StreamEvent[],\n ) => {\n const streamName = mapToStreamId(id);\n\n const state = await eventStore.aggregateStream(streamName, {\n evolve,\n getInitialState,\n });\n\n const result = handle(state ?? getInitialState());\n\n if (Array.isArray(result))\n return eventStore.appendToStream(streamName, ...result);\n else return eventStore.appendToStream(streamName, result);\n };\n// #endregion command-handler\n"],"mappings":"AAIO,MAAM,iBACX,CACE,QACA,iBACA,kBAEF,OACE,YACA,IACA,WACG;AACH,QAAM,aAAa,cAAc,EAAE;AAEnC,QAAM,QAAQ,MAAM,WAAW,gBAAgB,YAAY;AAAA,IACzD;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,SAAS,OAAO,SAAS,gBAAgB,CAAC;AAEhD,MAAI,MAAM,QAAQ,MAAM;AACtB,WAAO,WAAW,eAAe,YAAY,GAAG,MAAM;AAAA;AACnD,WAAO,WAAW,eAAe,YAAY,MAAM;AAC1D;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commandHandling/handleCommandWithDecider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/commandHandling/handleCommandWithDecider.ts"],"names":[],"mappings":"AAKO,MAAM,wBACX,CACE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF,GACA,kBAEF,OAAO,YAAwB,IAAY,YAAyB;AAClE,QAAM,aAAa,cAAc,EAAE;AAEnC,QAAM,QAAQ,MAAM,WAAW,gBAAgB,YAAY;AAAA,IACzD;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,SAAS,OAAO,SAAS,SAAS,gBAAgB,CAAC;AAEzD,MAAI,MAAM,QAAQ,MAAM;AACtB,WAAO,WAAW,eAAe,YAAY,GAAG,MAAM;AAAA;AACnD,WAAO,WAAW,eAAe,YAAY,MAAM;AAC1D","sourcesContent":["import type { EventStore } from '../eventStore';\nimport type { Command, Event } from '../typing';\nimport type { Decider } from '../typing/decider';\n\n// #region command-handler\nexport const DeciderCommandHandler =\n <State, CommandType extends Command, StreamEvent extends Event>(\n {\n decide,\n evolve,\n getInitialState,\n }: Decider<State, CommandType, StreamEvent>,\n mapToStreamId: (id: string) => string,\n ) =>\n async (eventStore: EventStore, id: string, command: CommandType) => {\n const streamName = mapToStreamId(id);\n\n const state = await eventStore.aggregateStream(streamName, {\n evolve,\n getInitialState,\n });\n\n const result = decide(command, state ?? getInitialState());\n\n if (Array.isArray(result))\n return eventStore.appendToStream(streamName, ...result);\n else return eventStore.appendToStream(streamName, result);\n };\n// #endregion command-handler\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commandHandling/handleCommandWithDecider.ts"],"sourcesContent":["import type { EventStore } from '../eventStore';\nimport type { Command, Event } from '../typing';\nimport type { Decider } from '../typing/decider';\n\nexport const DeciderCommandHandler =\n <State, CommandType extends Command, StreamEvent extends Event>(\n {\n decide,\n evolve,\n getInitialState,\n }: Decider<State, CommandType, StreamEvent>,\n mapToStreamId: (id: string) => string,\n ) =>\n async (eventStore: EventStore, id: string, command: CommandType) => {\n const streamName = mapToStreamId(id);\n\n const state = await eventStore.aggregateStream(streamName, {\n evolve,\n getInitialState,\n });\n\n const result = decide(command, state ?? getInitialState());\n\n if (Array.isArray(result))\n return eventStore.appendToStream(streamName, ...result);\n else return eventStore.appendToStream(streamName, result);\n };\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/commandHandling/handleCommandWithDecider.ts"],"sourcesContent":["import type { EventStore } from '../eventStore';\nimport type { Command, Event } from '../typing';\nimport type { Decider } from '../typing/decider';\n\n// #region command-handler\nexport const DeciderCommandHandler =\n <State, CommandType extends Command, StreamEvent extends Event>(\n {\n decide,\n evolve,\n getInitialState,\n }: Decider<State, CommandType, StreamEvent>,\n mapToStreamId: (id: string) => string,\n ) =>\n async (eventStore: EventStore, id: string, command: CommandType) => {\n const streamName = mapToStreamId(id);\n\n const state = await eventStore.aggregateStream(streamName, {\n evolve,\n getInitialState,\n });\n\n const result = decide(command, state ?? getInitialState());\n\n if (Array.isArray(result))\n return eventStore.appendToStream(streamName, ...result);\n else return eventStore.appendToStream(streamName, result);\n };\n// #endregion command-handler\n"],"mappings":"AAKO,MAAM,wBACX,CACE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF,GACA,kBAEF,OAAO,YAAwB,IAAY,YAAyB;AAClE,QAAM,aAAa,cAAc,EAAE;AAEnC,QAAM,QAAQ,MAAM,WAAW,gBAAgB,YAAY;AAAA,IACzD;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,SAAS,OAAO,SAAS,SAAS,gBAAgB,CAAC;AAEzD,MAAI,MAAM,QAAQ,MAAM;AACtB,WAAO,WAAW,eAAe,YAAY,GAAG,MAAM;AAAA;AACnD,WAAO,WAAW,eAAe,YAAY,MAAM;AAC1D;","names":[]}
|
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ export { CommandHandler } from './commandHandling/handleCommand.mjs';
|
|
|
2
2
|
export { DeciderCommandHandler } from './commandHandling/handleCommandWithDecider.mjs';
|
|
3
3
|
export { EventStore } from './eventStore/eventStore.mjs';
|
|
4
4
|
export { JSONParser, Mapper, MapperArgs, ParseError, ParseOptions, StringifyOptions } from './serialization/json/JSONParser.mjs';
|
|
5
|
+
export { DeciderSpecfication, DeciderSpecification } from './testing/deciderSpecification.mjs';
|
|
5
6
|
export { Brand, Command, Decider, DefaultCommandMetadata, Event, Flavour, Workflow, WorkflowCommand, WorkflowEvent, WorkflowOutput, accept, complete, error, ignore, publish, reply, schedule, send } from './typing/index.mjs';
|
|
6
7
|
export { sum } from './utils/iterators.mjs';
|
|
7
8
|
export { merge } from './utils/merge.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { CommandHandler } from './commandHandling/handleCommand.js';
|
|
|
2
2
|
export { DeciderCommandHandler } from './commandHandling/handleCommandWithDecider.js';
|
|
3
3
|
export { EventStore } from './eventStore/eventStore.js';
|
|
4
4
|
export { JSONParser, Mapper, MapperArgs, ParseError, ParseOptions, StringifyOptions } from './serialization/json/JSONParser.js';
|
|
5
|
+
export { DeciderSpecfication, DeciderSpecification } from './testing/deciderSpecification.js';
|
|
5
6
|
export { Brand, Command, Decider, DefaultCommandMetadata, Event, Flavour, Workflow, WorkflowCommand, WorkflowEvent, WorkflowOutput, accept, complete, error, ignore, publish, reply, schedule, send } from './typing/index.js';
|
|
6
7
|
export { sum } from './utils/iterators.js';
|
|
7
8
|
export { merge } from './utils/merge.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/testing/deciderSpecification.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY;AAWZ,MAAM,uBAAuB;AAAA,EAClC,KAAK,CAAwB,YAIc;AACzC;AACE,aAAO,CAAC,gBAAiC;AACvC,eAAO;AAAA,UACL,MAAM,CAAC,YAAqB;AAC1B,kBAAM,SAAS,MAAM;AACnB,oBAAM,iBAAiB,MAAM,QAAQ,WAAW,IAC5C,cACA,CAAC,WAAW;AAEhB,oBAAM,eAAe,eAAe;AAAA,gBAClC,QAAQ;AAAA,gBACR,QAAQ,aAAa;AAAA,cACvB;AAEA,qBAAO,QAAQ,OAAO,SAAS,YAAY;AAAA,YAC7C;AAEA,mBAAO;AAAA,cACL,MAAM,CAAC,mBAA0C;AAC/C,sBAAM,eAAe,OAAO;AAE5B,sBAAM,oBAAoB,MAAM,QAAQ,YAAY,IAChD,eACA,CAAC,YAAY;AAEjB,sBAAM,sBAAsB,MAAM,QAAQ,cAAc,IACpD,iBACA,CAAC,cAAc;AAEnB,uBAAO,UAAU,mBAAmB,mBAAmB;AAAA,cACzD;AAAA,cACA,YAAY,CAAQ,
|
|
1
|
+
{"version":3,"sources":["../../src/testing/deciderSpecification.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY;AAWZ,MAAM,uBAAuB;AAAA,EAClC,KAAK,CAAwB,YAIc;AACzC;AACE,aAAO,CAAC,gBAAiC;AACvC,eAAO;AAAA,UACL,MAAM,CAAC,YAAqB;AAC1B,kBAAM,SAAS,MAAM;AACnB,oBAAM,iBAAiB,MAAM,QAAQ,WAAW,IAC5C,cACA,CAAC,WAAW;AAEhB,oBAAM,eAAe,eAAe;AAAA,gBAClC,QAAQ;AAAA,gBACR,QAAQ,aAAa;AAAA,cACvB;AAEA,qBAAO,QAAQ,OAAO,SAAS,YAAY;AAAA,YAC7C;AAEA,mBAAO;AAAA,cACL,MAAM,CAAC,mBAA0C;AAC/C,sBAAM,eAAe,OAAO;AAE5B,sBAAM,oBAAoB,MAAM,QAAQ,YAAY,IAChD,eACA,CAAC,YAAY;AAEjB,sBAAM,sBAAsB,MAAM,QAAQ,cAAc,IACpD,iBACA,CAAC,cAAc;AAEnB,uBAAO,UAAU,mBAAmB,mBAAmB;AAAA,cACzD;AAAA,cACA,YAAY,CAAQ,UAA4C;AAC9D,oBAAI;AACF,yBAAO;AACP,yBAAO,KAAK,kCAAkC;AAAA,gBAChD,SAAS,OAAO;AACd,sBAAI;AAAO,2BAAO,GAAG,MAAM,KAAc,CAAC;AAAA,gBAC5C;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["import assert from 'assert';\n\nexport type DeciderSpecfication<Command, Event> = (\n givenEvents: Event | Event[],\n) => {\n when: (command: Command) => {\n then: (expectedEvents: Event | Event[]) => void;\n thenThrows: <Error>(assert: (error: Error) => boolean) => void;\n };\n};\n\nexport const DeciderSpecification = {\n for: <Command, Event, State>(decider: {\n decide: (command: Command, state: State) => Event | Event[];\n evolve: (state: State, event: Event) => State;\n initialState: () => State;\n }): DeciderSpecfication<Command, Event> => {\n {\n return (givenEvents: Event | Event[]) => {\n return {\n when: (command: Command) => {\n const handle = () => {\n const existingEvents = Array.isArray(givenEvents)\n ? givenEvents\n : [givenEvents];\n\n const currentState = existingEvents.reduce<State>(\n decider.evolve,\n decider.initialState(),\n );\n\n return decider.decide(command, currentState);\n };\n\n return {\n then: (expectedEvents: Event | Event[]): void => {\n const resultEvents = handle();\n\n const resultEventsArray = Array.isArray(resultEvents)\n ? resultEvents\n : [resultEvents];\n\n const expectedEventsArray = Array.isArray(expectedEvents)\n ? expectedEvents\n : [expectedEvents];\n\n assert.deepEqual(resultEventsArray, expectedEventsArray);\n },\n thenThrows: <Error>(check?: (error: Error) => boolean): void => {\n try {\n handle();\n assert.fail('Handler did not fail as expected');\n } catch (error) {\n if (check) assert.ok(check(error as Error));\n }\n },\n };\n },\n };\n };\n }\n },\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/testing/deciderSpecification.ts"],"sourcesContent":["import assert from 'assert';\n\nexport type DeciderSpecfication<Command, Event> = (\n givenEvents: Event | Event[],\n) => {\n when: (command: Command) => {\n then: (expectedEvents: Event | Event[]) => void;\n thenThrows: <Error>(assert: (error: Error) => boolean) => void;\n };\n};\n\nexport const DeciderSpecification = {\n for: <Command, Event, State>(decider: {\n decide: (command: Command, state: State) => Event | Event[];\n evolve: (state: State, event: Event) => State;\n initialState: () => State;\n }): DeciderSpecfication<Command, Event> => {\n {\n return (givenEvents: Event | Event[]) => {\n return {\n when: (command: Command) => {\n const handle = () => {\n const existingEvents = Array.isArray(givenEvents)\n ? givenEvents\n : [givenEvents];\n\n const currentState = existingEvents.reduce<State>(\n decider.evolve,\n decider.initialState(),\n );\n\n return decider.decide(command, currentState);\n };\n\n return {\n then: (expectedEvents: Event | Event[]): void => {\n const resultEvents = handle();\n\n const resultEventsArray = Array.isArray(resultEvents)\n ? resultEvents\n : [resultEvents];\n\n const expectedEventsArray = Array.isArray(expectedEvents)\n ? expectedEvents\n : [expectedEvents];\n\n assert.deepEqual(resultEventsArray, expectedEventsArray);\n },\n thenThrows: <Error>(check
|
|
1
|
+
{"version":3,"sources":["../../src/testing/deciderSpecification.ts"],"sourcesContent":["import assert from 'assert';\n\nexport type DeciderSpecfication<Command, Event> = (\n givenEvents: Event | Event[],\n) => {\n when: (command: Command) => {\n then: (expectedEvents: Event | Event[]) => void;\n thenThrows: <Error>(assert: (error: Error) => boolean) => void;\n };\n};\n\nexport const DeciderSpecification = {\n for: <Command, Event, State>(decider: {\n decide: (command: Command, state: State) => Event | Event[];\n evolve: (state: State, event: Event) => State;\n initialState: () => State;\n }): DeciderSpecfication<Command, Event> => {\n {\n return (givenEvents: Event | Event[]) => {\n return {\n when: (command: Command) => {\n const handle = () => {\n const existingEvents = Array.isArray(givenEvents)\n ? givenEvents\n : [givenEvents];\n\n const currentState = existingEvents.reduce<State>(\n decider.evolve,\n decider.initialState(),\n );\n\n return decider.decide(command, currentState);\n };\n\n return {\n then: (expectedEvents: Event | Event[]): void => {\n const resultEvents = handle();\n\n const resultEventsArray = Array.isArray(resultEvents)\n ? resultEvents\n : [resultEvents];\n\n const expectedEventsArray = Array.isArray(expectedEvents)\n ? expectedEvents\n : [expectedEvents];\n\n assert.deepEqual(resultEventsArray, expectedEventsArray);\n },\n thenThrows: <Error>(check?: (error: Error) => boolean): void => {\n try {\n handle();\n assert.fail('Handler did not fail as expected');\n } catch (error) {\n if (check) assert.ok(check(error as Error));\n }\n },\n };\n },\n };\n };\n }\n },\n};\n"],"mappings":"AAAA,OAAO,YAAY;AAWZ,MAAM,uBAAuB;AAAA,EAClC,KAAK,CAAwB,YAIc;AACzC;AACE,aAAO,CAAC,gBAAiC;AACvC,eAAO;AAAA,UACL,MAAM,CAAC,YAAqB;AAC1B,kBAAM,SAAS,MAAM;AACnB,oBAAM,iBAAiB,MAAM,QAAQ,WAAW,IAC5C,cACA,CAAC,WAAW;AAEhB,oBAAM,eAAe,eAAe;AAAA,gBAClC,QAAQ;AAAA,gBACR,QAAQ,aAAa;AAAA,cACvB;AAEA,qBAAO,QAAQ,OAAO,SAAS,YAAY;AAAA,YAC7C;AAEA,mBAAO;AAAA,cACL,MAAM,CAAC,mBAA0C;AAC/C,sBAAM,eAAe,OAAO;AAE5B,sBAAM,oBAAoB,MAAM,QAAQ,YAAY,IAChD,eACA,CAAC,YAAY;AAEjB,sBAAM,sBAAsB,MAAM,QAAQ,cAAc,IACpD,iBACA,CAAC,cAAc;AAEnB,uBAAO,UAAU,mBAAmB,mBAAmB;AAAA,cACzD;AAAA,cACA,YAAY,CAAQ,UAA4C;AAC9D,oBAAI;AACF,yBAAO;AACP,yBAAO,KAAK,kCAAkC;AAAA,gBAChD,SAAS,OAAO;AACd,sBAAI;AAAO,2BAAO,GAAG,MAAM,KAAc,CAAC;AAAA,gBAC5C;AAAA,cACF;AAAA,YACF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { }
|
|
1
|
+
export { DeciderSpecfication, DeciderSpecification } from './deciderSpecification.mjs';
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { }
|
|
1
|
+
export { DeciderSpecfication, DeciderSpecification } from './deciderSpecification.js';
|
package/dist/testing/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict"
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _deciderSpecification = require('./deciderSpecification'); _createStarExport(_deciderSpecification);
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc","sourcesContent":["export * from './deciderSpecification';\n"]}
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/testing/index.ts"],"sourcesContent":["export * from './deciderSpecification';\n"],"mappings":"AAAA,cAAc;","names":[]}
|
package/dist/typing/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
type DefaultCommandMetadata = {
|
|
2
|
-
now: Date;
|
|
3
|
-
};
|
|
4
1
|
type Command<CommandType extends string = string, CommandData extends Record<string, unknown> = Record<string, unknown>, CommandMetaData extends Record<string, unknown> = DefaultCommandMetadata> = Flavour<Readonly<{
|
|
5
2
|
type: CommandType;
|
|
6
3
|
data: Readonly<CommandData>;
|
|
7
4
|
metadata?: CommandMetaData | undefined;
|
|
8
5
|
}>, 'Command'>;
|
|
6
|
+
type DefaultCommandMetadata = {
|
|
7
|
+
now: Date;
|
|
8
|
+
};
|
|
9
9
|
|
|
10
10
|
type Event<EventType extends string = string, EventData extends Record<string, unknown> = Record<string, unknown>, EventMetaData extends Record<string, unknown> = Record<string, unknown>> = Flavour<Readonly<{
|
|
11
11
|
type: EventType;
|
package/dist/typing/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
type DefaultCommandMetadata = {
|
|
2
|
-
now: Date;
|
|
3
|
-
};
|
|
4
1
|
type Command<CommandType extends string = string, CommandData extends Record<string, unknown> = Record<string, unknown>, CommandMetaData extends Record<string, unknown> = DefaultCommandMetadata> = Flavour<Readonly<{
|
|
5
2
|
type: CommandType;
|
|
6
3
|
data: Readonly<CommandData>;
|
|
7
4
|
metadata?: CommandMetaData | undefined;
|
|
8
5
|
}>, 'Command'>;
|
|
6
|
+
type DefaultCommandMetadata = {
|
|
7
|
+
now: Date;
|
|
8
|
+
};
|
|
9
9
|
|
|
10
10
|
type Event<EventType extends string = string, EventData extends Record<string, unknown> = Record<string, unknown>, EventMetaData extends Record<string, unknown> = Record<string, unknown>> = Flavour<Readonly<{
|
|
11
11
|
type: EventType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/iterators.ts"],"names":["sum"],"mappings":"AAAO,MAAM,MAAM,CACjB,aACG;AACH,MAAI,OACF,MACAA,OAAM;AACR,KAAG;
|
|
1
|
+
{"version":3,"sources":["../../src/utils/iterators.ts"],"names":["sum"],"mappings":"AAAO,MAAM,MAAM,CACjB,aACG;AACH,MAAI,OACF,MACAA,OAAM;AACR,KAAG;AAED,KAAC,EAAE,OAAO,KAAK,IAAI,SAAS,KAAK;AACjC,IAAAA,QAAO,SAAS;AAAA,EAClB,SAAS,CAAC;AACV,SAAOA;AACT","sourcesContent":["export const sum = (\n iterator: Iterator<number, number, number> | Iterator<number>,\n) => {\n let value,\n done: boolean | undefined,\n sum = 0;\n do {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n ({ value, done } = iterator.next());\n sum += value || 0;\n } while (!done);\n return sum;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/iterators.ts"],"sourcesContent":["export const sum = (\n iterator: Iterator<number, number, number> | Iterator<number>,\n) => {\n let value,\n done,\n sum = 0;\n do {\n ({ value, done } = iterator.next());\n sum += value || 0;\n } while (!done);\n return sum;\n};\n"],"mappings":"AAAO,MAAM,MAAM,CACjB,aACG;AACH,MAAI,OACF,MACAA,OAAM;AACR,KAAG;
|
|
1
|
+
{"version":3,"sources":["../../src/utils/iterators.ts"],"sourcesContent":["export const sum = (\n iterator: Iterator<number, number, number> | Iterator<number>,\n) => {\n let value,\n done: boolean | undefined,\n sum = 0;\n do {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n ({ value, done } = iterator.next());\n sum += value || 0;\n } while (!done);\n return sum;\n};\n"],"mappings":"AAAO,MAAM,MAAM,CACjB,aACG;AACH,MAAI,OACF,MACAA,OAAM;AACR,KAAG;AAED,KAAC,EAAE,OAAO,KAAK,IAAI,SAAS,KAAK;AACjC,IAAAA,QAAO,SAAS;AAAA,EAClB,SAAS,CAAC;AACV,SAAOA;AACT;","names":["sum"]}
|
package/package.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@event-driven-io/emmett",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Emmett - Event Sourcing development made simple",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"setup": "cat .nvmrc | nvm install; nvm use",
|
|
7
6
|
"build": "tsup",
|
|
8
|
-
"build:ts": "tsc
|
|
7
|
+
"build:ts": "tsc",
|
|
9
8
|
"build:ts:watch": "tsc --watch",
|
|
10
|
-
"start": "ts-node -r tsconfig-paths/register ./src/index.ts",
|
|
11
9
|
"lint": "npm run lint:eslint && npm run lint:prettier",
|
|
12
10
|
"lint:prettier": "prettier --check \"**/**/!(*.d).{ts,json,md}\"",
|
|
13
11
|
"lint:eslint": "eslint **/*.ts",
|
|
@@ -21,10 +19,7 @@
|
|
|
21
19
|
"test:watch": "jest test --passWithNoTests",
|
|
22
20
|
"test:unit:watch": "jest unit --passWithNoTests --forceExit --watch",
|
|
23
21
|
"test:int:watch": "jest int --passWithNoTests --forceExit --watch",
|
|
24
|
-
"test:e2e:watch": "jest e2e --passWithNoTests --forceExit --watch"
|
|
25
|
-
"docs:dev": "vitepress dev docs",
|
|
26
|
-
"docs:build": "vitepress build docs",
|
|
27
|
-
"docs:preview": "vitepress preview docs"
|
|
22
|
+
"test:e2e:watch": "jest e2e --passWithNoTests --forceExit --watch"
|
|
28
23
|
},
|
|
29
24
|
"repository": {
|
|
30
25
|
"type": "git",
|
|
@@ -43,34 +38,5 @@
|
|
|
43
38
|
"types": "./dist/index.d.ts",
|
|
44
39
|
"files": [
|
|
45
40
|
"dist"
|
|
46
|
-
],
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"express": "4.18.2",
|
|
49
|
-
"express-async-errors": "3.1.1"
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@event-driven-io/emmett": "0.1.4",
|
|
53
|
-
"@faker-js/faker": "8.4.1",
|
|
54
|
-
"@types/jest": "29.5.0",
|
|
55
|
-
"@types/node": "20.11.17",
|
|
56
|
-
"@types/express": "4.17.21",
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "6.21.0",
|
|
58
|
-
"@typescript-eslint/parser": "6.21.0",
|
|
59
|
-
"eslint": "8.56.0",
|
|
60
|
-
"eslint-config-prettier": "9.1.0",
|
|
61
|
-
"eslint-plugin-prettier": "5.1.3",
|
|
62
|
-
"jest": "29.7.0",
|
|
63
|
-
"npm-run-all": "4.1.5",
|
|
64
|
-
"prettier": "3.2.5",
|
|
65
|
-
"supertest": "6.3.4",
|
|
66
|
-
"ts-jest": "29.1.2",
|
|
67
|
-
"ts-node": "10.9.2",
|
|
68
|
-
"tsconfig-paths": "4.2.0",
|
|
69
|
-
"tsup": "8.0.2",
|
|
70
|
-
"typescript": "5.3.3",
|
|
71
|
-
"vitepress": "1.0.0-rc.42"
|
|
72
|
-
},
|
|
73
|
-
"workspaces": [
|
|
74
|
-
"samples/*"
|
|
75
41
|
]
|
|
76
42
|
}
|
package/README.md
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
[<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" height="20px" />](https://www.linkedin.com/in/oskardudycz/) [](https://github.com/sponsors/oskardudycz/) [](https://event-driven.io/?utm_source=event_sourcing_nodejs) [](https://www.architecture-weekly.com/?utm_source=event_sourcing_nodejs)
|
|
2
|
-
|
|
3
|
-

|
|
4
|
-
|
|
5
|
-
# Emmett - vent Sourcing development made simple
|
|
6
|
-
|
|
7
|
-
Nowadays, storage is cheap, but the information is priceless.
|
|
8
|
-
|
|
9
|
-
Event Sourcing, contrary to the standard approach, keeps all the facts that happened in our system. To do that, it needs an event store: a database designed for its needs.
|
|
10
|
-
|
|
11
|
-
This project aims to experiment with an opinionated Event Sourcing framework based on my experience working on [Marten](martendb.io/) and [EventStoreDB](https://developers.eventstore.com/).
|
|
12
|
-
|
|
13
|
-
**Take your event-driven applications back to the future!**
|
|
14
|
-
|
|
15
|
-
## FAQ
|
|
16
|
-
|
|
17
|
-
### **Is it production-ready?**
|
|
18
|
-
|
|
19
|
-
Nope.
|
|
20
|
-
|
|
21
|
-
### **Will it be?**
|
|
22
|
-
|
|
23
|
-
Maybe.
|
|
24
|
-
|
|
25
|
-
### **Why Node.js?**
|
|
26
|
-
|
|
27
|
-
I like its minimalistic approach and flexibility, plus TypeScript is an excellent language with its shapeshifter capabilities. Plus, I've been asked if I could deliver such a store for Node.js.
|
|
28
|
-
|
|
29
|
-
### Why Emmeett?
|
|
30
|
-
|
|
31
|
-
[Because](https://en.m.wikipedia.org/wiki/Emmett_Brown).
|
|
32
|
-
|
|
33
|
-
### **What features it has?**
|
|
34
|
-
|
|
35
|
-
Currently, none, but that will change.
|
|
36
|
-
|
|
37
|
-
### **What features will it have?**
|
|
38
|
-
|
|
39
|
-
We'll see, but for sure, I'd like to have the following:
|
|
40
|
-
|
|
41
|
-
- atomicity of the stream append operations,
|
|
42
|
-
- reading your writes,
|
|
43
|
-
- subscriptions based on Postgres logical replications,
|
|
44
|
-
- Postgres partitioning,
|
|
45
|
-
- running it serverless or on the web with SQLite,
|
|
46
|
-
- streaming data through HTTP API (and enabling integration scenarios through it).
|
|
47
|
-
- defining event transformations and projections with WebAssembly,
|
|
48
|
-
- build-in read models based on the JSON capabilities of Postgres and SQLite.
|
|
49
|
-
|
|
50
|
-
### **Would it be a competitor to other stores?**
|
|
51
|
-
|
|
52
|
-
Probably not. For now, I'd like to have a safe playground to have fun and try out new ideas. Still, what I deliver, I expect to be safe to use on a small scale.
|
|
53
|
-
|
|
54
|
-
### **Why there's no license?**
|
|
55
|
-
|
|
56
|
-
Because I'm unsure when this will end, and I don't want to expose it as an MIT license from the beginning.
|
|
57
|
-
|
|
58
|
-
## Support
|
|
59
|
-
|
|
60
|
-
💖 If you'd like this initiative or want to use it potentially. Feel invited you **join** the group of my 👉 [Github Sponsors](https://github.com/sponsors/oskardudycz).
|
|
61
|
-
|
|
62
|
-
GitHub ⭐'s won't pay the bills, so any help is more than welcome!
|