@event-driven-io/emmett 0.6.0 → 0.7.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.
Files changed (93) hide show
  1. package/dist/chunk-5BGN2FV4.js +1 -0
  2. package/dist/chunk-7D2LV2X5.js +5 -0
  3. package/dist/chunk-7D2LV2X5.js.map +1 -0
  4. package/dist/chunk-AWUWW7EJ.mjs +2 -0
  5. package/dist/chunk-AWUWW7EJ.mjs.map +1 -0
  6. package/dist/chunk-DOHUIBZQ.mjs +1 -0
  7. package/dist/chunk-HVU6UBXF.mjs +5 -0
  8. package/dist/chunk-HVU6UBXF.mjs.map +1 -0
  9. package/dist/chunk-JDYZZRJE.mjs +2 -0
  10. package/dist/chunk-JDYZZRJE.mjs.map +1 -0
  11. package/dist/chunk-MHB2JU4U.js +2 -0
  12. package/dist/chunk-MHB2JU4U.js.map +1 -0
  13. package/dist/chunk-S3PRXL2J.js +2 -0
  14. package/dist/chunk-S3PRXL2J.js.map +1 -0
  15. package/dist/chunk-YWRV75GA.mjs +1 -0
  16. package/dist/chunk-ZLASBJGR.js +1 -0
  17. package/dist/commandHandling/handleCommand.d.mts +1 -0
  18. package/dist/commandHandling/handleCommand.d.ts +1 -0
  19. package/dist/commandHandling/handleCommandWithDecider.d.mts +1 -0
  20. package/dist/commandHandling/handleCommandWithDecider.d.ts +1 -0
  21. package/dist/commandHandling/index.d.mts +1 -0
  22. package/dist/commandHandling/index.d.ts +1 -0
  23. package/dist/eventStore/eventStore.d.mts +1 -0
  24. package/dist/eventStore/eventStore.d.ts +1 -0
  25. package/dist/eventStore/expectedVersion.d.mts +1 -0
  26. package/dist/eventStore/expectedVersion.d.ts +1 -0
  27. package/dist/eventStore/inMemoryEventStore.d.mts +1 -0
  28. package/dist/eventStore/inMemoryEventStore.d.ts +1 -0
  29. package/dist/eventStore/index.d.mts +1 -0
  30. package/dist/eventStore/index.d.ts +1 -0
  31. package/dist/index.d.mts +2 -1
  32. package/dist/index.d.ts +2 -1
  33. package/dist/index.js +1 -1
  34. package/dist/index.mjs +1 -1
  35. package/dist/messageBus/index.d.mts +44 -0
  36. package/dist/messageBus/index.d.ts +44 -0
  37. package/dist/messageBus/index.js +2 -0
  38. package/dist/messageBus/index.js.map +1 -0
  39. package/dist/messageBus/index.mjs +2 -0
  40. package/dist/messageBus/index.mjs.map +1 -0
  41. package/dist/testing/assertions.js +1 -1
  42. package/dist/testing/assertions.mjs +1 -1
  43. package/dist/testing/features.d.mts +1 -0
  44. package/dist/testing/features.d.ts +1 -0
  45. package/dist/testing/features.js +1 -1
  46. package/dist/testing/features.mjs +1 -1
  47. package/dist/testing/index.d.mts +1 -0
  48. package/dist/testing/index.d.ts +1 -0
  49. package/dist/testing/index.js +1 -1
  50. package/dist/testing/index.mjs +1 -1
  51. package/dist/testing/shoppingCart.domain.d.mts +1 -0
  52. package/dist/testing/shoppingCart.domain.d.ts +1 -0
  53. package/dist/testing/shoppingCart.domain.js +1 -1
  54. package/dist/testing/shoppingCart.domain.mjs +1 -1
  55. package/dist/typing/command.d.mts +2 -1
  56. package/dist/typing/command.d.ts +2 -1
  57. package/dist/typing/command.js +1 -1
  58. package/dist/typing/command.mjs +1 -1
  59. package/dist/typing/decider.d.mts +1 -0
  60. package/dist/typing/decider.d.ts +1 -0
  61. package/dist/typing/deepReadonly.d.mts +15 -0
  62. package/dist/typing/deepReadonly.d.ts +15 -0
  63. package/dist/typing/deepReadonly.js +2 -0
  64. package/dist/typing/deepReadonly.mjs +2 -0
  65. package/dist/typing/event.d.mts +2 -1
  66. package/dist/typing/event.d.ts +2 -1
  67. package/dist/typing/event.js +1 -1
  68. package/dist/typing/event.mjs +1 -1
  69. package/dist/typing/index.d.mts +26 -5
  70. package/dist/typing/index.d.ts +26 -5
  71. package/dist/typing/index.js +1 -1
  72. package/dist/typing/index.mjs +1 -1
  73. package/dist/typing/workflow.d.mts +1 -0
  74. package/dist/typing/workflow.d.ts +1 -0
  75. package/dist/utils/index.js +1 -1
  76. package/dist/utils/index.mjs +1 -1
  77. package/package.json +1 -1
  78. package/dist/chunk-BARLLX6S.js +0 -1
  79. package/dist/chunk-C4CXU3PY.mjs +0 -1
  80. package/dist/chunk-DFPI5IXT.js +0 -5
  81. package/dist/chunk-DFPI5IXT.js.map +0 -1
  82. package/dist/chunk-IZWGWZ3P.mjs +0 -1
  83. package/dist/chunk-QSAFGRYV.js +0 -1
  84. package/dist/chunk-RWKXC5FZ.mjs +0 -5
  85. package/dist/chunk-RWKXC5FZ.mjs.map +0 -1
  86. package/dist/chunk-YKICRTHH.mjs +0 -1
  87. package/dist/chunk-Z7EDILIO.js +0 -1
  88. /package/dist/{chunk-BARLLX6S.js.map → chunk-5BGN2FV4.js.map} +0 -0
  89. /package/dist/{chunk-C4CXU3PY.mjs.map → chunk-DOHUIBZQ.mjs.map} +0 -0
  90. /package/dist/{chunk-IZWGWZ3P.mjs.map → chunk-YWRV75GA.mjs.map} +0 -0
  91. /package/dist/{chunk-QSAFGRYV.js.map → chunk-ZLASBJGR.js.map} +0 -0
  92. /package/dist/{chunk-Z7EDILIO.js.map → typing/deepReadonly.js.map} +0 -0
  93. /package/dist/{chunk-YKICRTHH.mjs.map → typing/deepReadonly.mjs.map} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";//# sourceMappingURL=chunk-5BGN2FV4.js.map
@@ -0,0 +1,5 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var u=(t,o)=>{let s=t,r=o;return Object.keys(r).every(n=>typeof r[n]=="object"?u(s[n],r[n]):r[n]===s[n])},e= exports.b =(t,o)=>{if(!u(t,o))throw Error(`subObj:
2
+ ${JSON.stringify(o)}
3
+ is not subset of
4
+ ${JSON.stringify(t)}`)};exports.a = u; exports.b = e;
5
+ //# sourceMappingURL=chunk-7D2LV2X5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/testing/assertions.ts"],"names":["isSubset","superObj","subObj","sup","sub","ele","assertMatches","actual","expected"],"mappings":"AAEO,IAAMA,EAAW,CAACC,EAAmBC,IAA6B,CACvE,IAAMC,EAAMF,EACNG,EAAMF,EAEZ,OAAO,OAAO,KAAKE,CAAG,EAAE,MAAOC,GACzB,OAAOD,EAAIC,CAAG,GAAK,SACdL,EAASG,EAAIE,CAAG,EAAGD,EAAIC,CAAG,CAAC,EAE7BD,EAAIC,CAAG,IAAMF,EAAIE,CAAG,CAC5B,CACH,EAEaC,EAAgB,CAACC,EAAiBC,IAAsB,CACnE,GAAI,CAACR,EAASO,EAAQC,CAAQ,EAC5B,MAAM,MACJ;AAAA,EAAY,KAAK,UAAUA,CAAQ,CAAC;AAAA;AAAA,EAAuB,KAAK,UAAUD,CAAM,CAAC,EACnF,CACJ","sourcesContent":["import type { DefaultRecord } from '../typing';\n\nexport const isSubset = (superObj: unknown, subObj: unknown): boolean => {\n const sup = superObj as DefaultRecord;\n const sub = subObj as DefaultRecord;\n\n return Object.keys(sub).every((ele: string) => {\n if (typeof sub[ele] == 'object') {\n return isSubset(sup[ele], sub[ele]);\n }\n return sub[ele] === sup[ele];\n });\n};\n\nexport const assertMatches = (actual: unknown, expected: unknown) => {\n if (!isSubset(actual, expected))\n throw Error(\n `subObj:\\n${JSON.stringify(expected)}\\nis not subset of\\n${JSON.stringify(actual)}`,\n );\n};\n"]}
@@ -0,0 +1,2 @@
1
+ var n=(e,t,a)=>({type:e,data:t,metadata:a});export{n as a};
2
+ //# sourceMappingURL=chunk-AWUWW7EJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/typing/event.ts"],"sourcesContent":["import type { DefaultRecord, Flavour } from './';\n\nexport type Event<\n EventType extends string = string,\n EventData extends DefaultRecord = DefaultRecord,\n EventMetaData extends DefaultRecord = DefaultRecord,\n> = Flavour<\n Readonly<{\n type: EventType;\n data: EventData;\n metadata?: EventMetaData;\n }>,\n 'Event'\n>;\n\nexport type EventTypeOf<T extends Event> = T['type'];\nexport type EventDataOf<T extends Event> = T['data'];\nexport type EventMetaDataOf<T extends Event> = T['metadata'];\n\nexport type CreateEventType<\n EventType extends string,\n EventData extends DefaultRecord,\n EventMetaData extends DefaultRecord | undefined,\n> = Readonly<{\n type: EventType;\n data: EventData;\n metadata?: EventMetaData;\n}>;\n\nexport const event = <EventType extends Event>(\n type: EventTypeOf<EventType>,\n data: EventDataOf<EventType>,\n metadata?: EventMetaDataOf<EventType>,\n): CreateEventType<\n EventTypeOf<EventType>,\n EventDataOf<EventType>,\n EventMetaDataOf<EventType>\n> => {\n return {\n type,\n data,\n metadata,\n };\n};\n"],"mappings":"AA6BO,IAAMA,EAAQ,CACnBC,EACAC,EACAC,KAMO,CACL,KAAAF,EACA,KAAAC,EACA,SAAAC,CACF","names":["event","type","data","metadata"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-DOHUIBZQ.mjs.map
@@ -0,0 +1,5 @@
1
+ var u=(t,o)=>{let s=t,r=o;return Object.keys(r).every(n=>typeof r[n]=="object"?u(s[n],r[n]):r[n]===s[n])},e=(t,o)=>{if(!u(t,o))throw Error(`subObj:
2
+ ${JSON.stringify(o)}
3
+ is not subset of
4
+ ${JSON.stringify(t)}`)};export{u as a,e as b};
5
+ //# sourceMappingURL=chunk-HVU6UBXF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/testing/assertions.ts"],"sourcesContent":["import type { DefaultRecord } from '../typing';\n\nexport const isSubset = (superObj: unknown, subObj: unknown): boolean => {\n const sup = superObj as DefaultRecord;\n const sub = subObj as DefaultRecord;\n\n return Object.keys(sub).every((ele: string) => {\n if (typeof sub[ele] == 'object') {\n return isSubset(sup[ele], sub[ele]);\n }\n return sub[ele] === sup[ele];\n });\n};\n\nexport const assertMatches = (actual: unknown, expected: unknown) => {\n if (!isSubset(actual, expected))\n throw Error(\n `subObj:\\n${JSON.stringify(expected)}\\nis not subset of\\n${JSON.stringify(actual)}`,\n );\n};\n"],"mappings":"AAEO,IAAMA,EAAW,CAACC,EAAmBC,IAA6B,CACvE,IAAMC,EAAMF,EACNG,EAAMF,EAEZ,OAAO,OAAO,KAAKE,CAAG,EAAE,MAAOC,GACzB,OAAOD,EAAIC,CAAG,GAAK,SACdL,EAASG,EAAIE,CAAG,EAAGD,EAAIC,CAAG,CAAC,EAE7BD,EAAIC,CAAG,IAAMF,EAAIE,CAAG,CAC5B,CACH,EAEaC,EAAgB,CAACC,EAAiBC,IAAsB,CACnE,GAAI,CAACR,EAASO,EAAQC,CAAQ,EAC5B,MAAM,MACJ;AAAA,EAAY,KAAK,UAAUA,CAAQ,CAAC;AAAA;AAAA,EAAuB,KAAK,UAAUD,CAAM,CAAC,EACnF,CACJ","names":["isSubset","superObj","subObj","sup","sub","ele","assertMatches","actual","expected"]}
@@ -0,0 +1,2 @@
1
+ var t=(a,e,m)=>({type:a,data:e,metadata:m});export{t as a};
2
+ //# sourceMappingURL=chunk-JDYZZRJE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/typing/command.ts"],"sourcesContent":["import type { DefaultRecord, Flavour } from './';\nexport type Command<\n CommandType extends string = string,\n CommandData extends DefaultRecord = DefaultRecord,\n CommandMetaData extends DefaultRecord = DefaultCommandMetadata,\n> = Flavour<\n Readonly<{\n type: CommandType;\n data: Readonly<CommandData>;\n metadata?: CommandMetaData | undefined;\n }>,\n 'Command'\n>;\n\nexport type CommandTypeOf<T extends Command> = T['type'];\nexport type CommandDataOf<T extends Command> = T['data'];\nexport type CommandMetaDataOf<T extends Command> = T['metadata'];\n\nexport type CreateCommandType<\n CommandType extends string,\n CommandData extends DefaultRecord,\n CommandMetaData extends DefaultRecord | undefined,\n> = Readonly<{\n type: CommandType;\n data: CommandData;\n metadata?: CommandMetaData;\n}>;\n\nexport const command = <CommandType extends Command>(\n type: CommandTypeOf<CommandType>,\n data: CommandDataOf<CommandType>,\n metadata?: CommandMetaDataOf<CommandType>,\n): CreateCommandType<\n CommandTypeOf<CommandType>,\n CommandDataOf<CommandType>,\n CommandMetaDataOf<CommandType>\n> => {\n return {\n type,\n data,\n metadata,\n };\n};\n\nexport type DefaultCommandMetadata = { now: Date };\n"],"mappings":"AA4BO,IAAMA,EAAU,CACrBC,EACAC,EACAC,KAMO,CACL,KAAAF,EACA,KAAAC,EACA,SAAAC,CACF","names":["command","type","data","metadata"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var t=(a,e,m)=>({type:a,data:e,metadata:m});exports.a = t;
2
+ //# sourceMappingURL=chunk-MHB2JU4U.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/typing/command.ts"],"names":["command","type","data","metadata"],"mappings":"AA4BO,IAAMA,EAAU,CACrBC,EACAC,EACAC,KAMO,CACL,KAAAF,EACA,KAAAC,EACA,SAAAC,CACF","sourcesContent":["import type { DefaultRecord, Flavour } from './';\nexport type Command<\n CommandType extends string = string,\n CommandData extends DefaultRecord = DefaultRecord,\n CommandMetaData extends DefaultRecord = DefaultCommandMetadata,\n> = Flavour<\n Readonly<{\n type: CommandType;\n data: Readonly<CommandData>;\n metadata?: CommandMetaData | undefined;\n }>,\n 'Command'\n>;\n\nexport type CommandTypeOf<T extends Command> = T['type'];\nexport type CommandDataOf<T extends Command> = T['data'];\nexport type CommandMetaDataOf<T extends Command> = T['metadata'];\n\nexport type CreateCommandType<\n CommandType extends string,\n CommandData extends DefaultRecord,\n CommandMetaData extends DefaultRecord | undefined,\n> = Readonly<{\n type: CommandType;\n data: CommandData;\n metadata?: CommandMetaData;\n}>;\n\nexport const command = <CommandType extends Command>(\n type: CommandTypeOf<CommandType>,\n data: CommandDataOf<CommandType>,\n metadata?: CommandMetaDataOf<CommandType>,\n): CreateCommandType<\n CommandTypeOf<CommandType>,\n CommandDataOf<CommandType>,\n CommandMetaDataOf<CommandType>\n> => {\n return {\n type,\n data,\n metadata,\n };\n};\n\nexport type DefaultCommandMetadata = { now: Date };\n"]}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var n=(e,t,a)=>({type:e,data:t,metadata:a});exports.a = n;
2
+ //# sourceMappingURL=chunk-S3PRXL2J.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/typing/event.ts"],"names":["event","type","data","metadata"],"mappings":"AA6BO,IAAMA,EAAQ,CACnBC,EACAC,EACAC,KAMO,CACL,KAAAF,EACA,KAAAC,EACA,SAAAC,CACF","sourcesContent":["import type { DefaultRecord, Flavour } from './';\n\nexport type Event<\n EventType extends string = string,\n EventData extends DefaultRecord = DefaultRecord,\n EventMetaData extends DefaultRecord = DefaultRecord,\n> = Flavour<\n Readonly<{\n type: EventType;\n data: EventData;\n metadata?: EventMetaData;\n }>,\n 'Event'\n>;\n\nexport type EventTypeOf<T extends Event> = T['type'];\nexport type EventDataOf<T extends Event> = T['data'];\nexport type EventMetaDataOf<T extends Event> = T['metadata'];\n\nexport type CreateEventType<\n EventType extends string,\n EventData extends DefaultRecord,\n EventMetaData extends DefaultRecord | undefined,\n> = Readonly<{\n type: EventType;\n data: EventData;\n metadata?: EventMetaData;\n}>;\n\nexport const event = <EventType extends Event>(\n type: EventTypeOf<EventType>,\n data: EventDataOf<EventType>,\n metadata?: EventMetaDataOf<EventType>,\n): CreateEventType<\n EventTypeOf<EventType>,\n EventDataOf<EventType>,\n EventMetaDataOf<EventType>\n> => {\n return {\n type,\n data,\n metadata,\n };\n};\n"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-YWRV75GA.mjs.map
@@ -0,0 +1 @@
1
+ "use strict";//# sourceMappingURL=chunk-ZLASBJGR.js.map
@@ -1,6 +1,7 @@
1
1
  import { D as DefaultStreamVersionType, d as AppendToStreamResult, E as EventStore, e as ExpectedStreamVersion } from '../eventStore-DLezSgsV.mjs';
2
2
  import { Event } from '../typing/index.mjs';
3
3
  import '../errors/index.mjs';
4
+ import '../typing/deepReadonly.mjs';
4
5
 
5
6
  type CommandHandlerResult<State, StreamVersion = DefaultStreamVersionType> = AppendToStreamResult<StreamVersion> & {
6
7
  newState: State;
@@ -1,6 +1,7 @@
1
1
  import { D as DefaultStreamVersionType, d as AppendToStreamResult, E as EventStore, e as ExpectedStreamVersion } from '../eventStore-N_YMFCDT.js';
2
2
  import { Event } from '../typing/index.js';
3
3
  import '../errors/index.js';
4
+ import '../typing/deepReadonly.js';
4
5
 
5
6
  type CommandHandlerResult<State, StreamVersion = DefaultStreamVersionType> = AppendToStreamResult<StreamVersion> & {
6
7
  newState: State;
@@ -2,6 +2,7 @@ import { CommandHandlerResult } from './handleCommand.mjs';
2
2
  import { E as EventStore, e as ExpectedStreamVersion } from '../eventStore-DLezSgsV.mjs';
3
3
  import { Command, Event, Decider } from '../typing/index.mjs';
4
4
  import '../errors/index.mjs';
5
+ import '../typing/deepReadonly.mjs';
5
6
 
6
7
  declare const DeciderCommandHandler: <State, CommandType extends Command, StreamEvent extends Event, StreamVersion = bigint>({ decide, evolve, getInitialState, }: Decider<State, CommandType, StreamEvent>, mapToStreamId?: (id: string) => string) => (eventStore: EventStore<StreamVersion>, id: string, command: CommandType, options?: {
7
8
  expectedStreamVersion?: ExpectedStreamVersion<StreamVersion>;
@@ -2,6 +2,7 @@ import { CommandHandlerResult } from './handleCommand.js';
2
2
  import { E as EventStore, e as ExpectedStreamVersion } from '../eventStore-N_YMFCDT.js';
3
3
  import { Command, Event, Decider } from '../typing/index.js';
4
4
  import '../errors/index.js';
5
+ import '../typing/deepReadonly.js';
5
6
 
6
7
  declare const DeciderCommandHandler: <State, CommandType extends Command, StreamEvent extends Event, StreamVersion = bigint>({ decide, evolve, getInitialState, }: Decider<State, CommandType, StreamEvent>, mapToStreamId?: (id: string) => string) => (eventStore: EventStore<StreamVersion>, id: string, command: CommandType, options?: {
7
8
  expectedStreamVersion?: ExpectedStreamVersion<StreamVersion>;
@@ -2,4 +2,5 @@ export { CommandHandler, CommandHandlerResult } from './handleCommand.mjs';
2
2
  export { DeciderCommandHandler } from './handleCommandWithDecider.mjs';
3
3
  import '../eventStore-DLezSgsV.mjs';
4
4
  import '../typing/index.mjs';
5
+ import '../typing/deepReadonly.mjs';
5
6
  import '../errors/index.mjs';
@@ -2,4 +2,5 @@ export { CommandHandler, CommandHandlerResult } from './handleCommand.js';
2
2
  export { DeciderCommandHandler } from './handleCommandWithDecider.js';
3
3
  import '../eventStore-N_YMFCDT.js';
4
4
  import '../typing/index.js';
5
+ import '../typing/deepReadonly.js';
5
6
  import '../errors/index.js';
@@ -1,3 +1,4 @@
1
1
  import '../typing/index.mjs';
2
2
  export { A as AggregateStreamOptions, b as AggregateStreamResult, c as AppendToStreamOptions, d as AppendToStreamResult, D as DefaultStreamVersionType, E as EventStore, R as ReadStreamOptions, a as ReadStreamResult } from '../eventStore-DLezSgsV.mjs';
3
+ import '../typing/deepReadonly.mjs';
3
4
  import '../errors/index.mjs';
@@ -1,3 +1,4 @@
1
1
  import '../typing/index.js';
2
2
  export { A as AggregateStreamOptions, b as AggregateStreamResult, c as AppendToStreamOptions, d as AppendToStreamResult, D as DefaultStreamVersionType, E as EventStore, R as ReadStreamOptions, a as ReadStreamResult } from '../eventStore-N_YMFCDT.js';
3
+ import '../typing/deepReadonly.js';
3
4
  import '../errors/index.js';
@@ -1,3 +1,4 @@
1
1
  import '../errors/index.mjs';
2
2
  import '../typing/index.mjs';
3
3
  export { e as ExpectedStreamVersion, g as ExpectedStreamVersionGeneral, f as ExpectedStreamVersionWithValue, j as ExpectedVersionConflictError, N as NO_CONCURRENCY_CHECK, h as STREAM_DOES_NOT_EXIST, S as STREAM_EXISTS, i as assertExpectedVersionMatchesCurrent, m as matchesExpectedVersion } from '../eventStore-DLezSgsV.mjs';
4
+ import '../typing/deepReadonly.mjs';
@@ -1,3 +1,4 @@
1
1
  import '../errors/index.js';
2
2
  import '../typing/index.js';
3
3
  export { e as ExpectedStreamVersion, g as ExpectedStreamVersionGeneral, f as ExpectedStreamVersionWithValue, j as ExpectedVersionConflictError, N as NO_CONCURRENCY_CHECK, h as STREAM_DOES_NOT_EXIST, S as STREAM_EXISTS, i as assertExpectedVersionMatchesCurrent, m as matchesExpectedVersion } from '../eventStore-N_YMFCDT.js';
4
+ import '../typing/deepReadonly.js';
@@ -1,6 +1,7 @@
1
1
  import { E as EventStore } from '../eventStore-DLezSgsV.mjs';
2
2
  import { Event } from '../typing/index.mjs';
3
3
  import '../errors/index.mjs';
4
+ import '../typing/deepReadonly.mjs';
4
5
 
5
6
  type EventMetadata = Readonly<{
6
7
  eventId: string;
@@ -1,6 +1,7 @@
1
1
  import { E as EventStore } from '../eventStore-N_YMFCDT.js';
2
2
  import { Event } from '../typing/index.js';
3
3
  import '../errors/index.js';
4
+ import '../typing/deepReadonly.js';
4
5
 
5
6
  type EventMetadata = Readonly<{
6
7
  eventId: string;
@@ -1,4 +1,5 @@
1
1
  export { A as AggregateStreamOptions, b as AggregateStreamResult, c as AppendToStreamOptions, d as AppendToStreamResult, D as DefaultStreamVersionType, E as EventStore, e as ExpectedStreamVersion, g as ExpectedStreamVersionGeneral, f as ExpectedStreamVersionWithValue, j as ExpectedVersionConflictError, N as NO_CONCURRENCY_CHECK, R as ReadStreamOptions, a as ReadStreamResult, h as STREAM_DOES_NOT_EXIST, S as STREAM_EXISTS, i as assertExpectedVersionMatchesCurrent, m as matchesExpectedVersion } from '../eventStore-DLezSgsV.mjs';
2
2
  export { EventEnvelope, EventHandler, EventMetadata, getInMemoryEventStore } from './inMemoryEventStore.mjs';
3
3
  import '../typing/index.mjs';
4
+ import '../typing/deepReadonly.mjs';
4
5
  import '../errors/index.mjs';
@@ -1,4 +1,5 @@
1
1
  export { A as AggregateStreamOptions, b as AggregateStreamResult, c as AppendToStreamOptions, d as AppendToStreamResult, D as DefaultStreamVersionType, E as EventStore, e as ExpectedStreamVersion, g as ExpectedStreamVersionGeneral, f as ExpectedStreamVersionWithValue, j as ExpectedVersionConflictError, N as NO_CONCURRENCY_CHECK, R as ReadStreamOptions, a as ReadStreamResult, h as STREAM_DOES_NOT_EXIST, S as STREAM_EXISTS, i as assertExpectedVersionMatchesCurrent, m as matchesExpectedVersion } from '../eventStore-N_YMFCDT.js';
2
2
  export { EventEnvelope, EventHandler, EventMetadata, getInMemoryEventStore } from './inMemoryEventStore.js';
3
3
  import '../typing/index.js';
4
+ import '../typing/deepReadonly.js';
4
5
  import '../errors/index.js';
package/dist/index.d.mts CHANGED
@@ -8,7 +8,8 @@ export { assertMatches, isSubset } from './testing/assertions.mjs';
8
8
  export { DeciderSpecfication, DeciderSpecification } from './testing/deciderSpecification.mjs';
9
9
  export { EventStoreFactory, testAggregateStream } from './testing/features.mjs';
10
10
  export { DiscountApplied, PricedProductItem, ProductItemAdded, ShoppingCart, ShoppingCartEvent, evolve, getInitialState } from './testing/shoppingCart.domain.mjs';
11
- export { Brand, Command, Decider, DefaultCommandMetadata, Event, Flavour, Workflow, WorkflowCommand, WorkflowEvent, WorkflowOutput, accept, complete, error, ignore, publish, reply, schedule, send } from './typing/index.mjs';
11
+ export { Brand, Command, CommandDataOf, CommandMetaDataOf, CommandTypeOf, CreateCommandType, CreateEventType, Decider, DefaultCommandMetadata, DefaultRecord, Event, EventDataOf, EventMetaDataOf, EventTypeOf, Flavour, Workflow, WorkflowCommand, WorkflowEvent, WorkflowOutput, accept, command, complete, error, event, ignore, publish, reply, schedule, send } from './typing/index.mjs';
12
12
  export { sum } from './utils/iterators.mjs';
13
13
  export { merge } from './utils/merge.mjs';
14
14
  export { ValidationErrors, assertNotEmptyString, assertPositiveNumber, assertUnsignedBigInt, isNumber, isString } from './validation/index.mjs';
15
+ export { DeepReadonly, Mutable } from './typing/deepReadonly.mjs';
package/dist/index.d.ts CHANGED
@@ -8,7 +8,8 @@ export { assertMatches, isSubset } from './testing/assertions.js';
8
8
  export { DeciderSpecfication, DeciderSpecification } from './testing/deciderSpecification.js';
9
9
  export { EventStoreFactory, testAggregateStream } from './testing/features.js';
10
10
  export { DiscountApplied, PricedProductItem, ProductItemAdded, ShoppingCart, ShoppingCartEvent, evolve, getInitialState } from './testing/shoppingCart.domain.js';
11
- export { Brand, Command, Decider, DefaultCommandMetadata, Event, Flavour, Workflow, WorkflowCommand, WorkflowEvent, WorkflowOutput, accept, complete, error, ignore, publish, reply, schedule, send } from './typing/index.js';
11
+ export { Brand, Command, CommandDataOf, CommandMetaDataOf, CommandTypeOf, CreateCommandType, CreateEventType, Decider, DefaultCommandMetadata, DefaultRecord, Event, EventDataOf, EventMetaDataOf, EventTypeOf, Flavour, Workflow, WorkflowCommand, WorkflowEvent, WorkflowOutput, accept, command, complete, error, event, ignore, publish, reply, schedule, send } from './typing/index.js';
12
12
  export { sum } from './utils/iterators.js';
13
13
  export { merge } from './utils/merge.js';
14
14
  export { ValidationErrors, assertNotEmptyString, assertPositiveNumber, assertUnsignedBigInt, isNumber, isString } from './validation/index.js';
15
+ export { DeepReadonly, Mutable } from './typing/deepReadonly.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-WIMBG2PX.js');var _chunkFE73T2NSjs = require('./chunk-FE73T2NS.js');var _chunk3JE5DUJ2js = require('./chunk-3JE5DUJ2.js');require('./chunk-LOJ6A4AJ.js');require('./chunk-AU2WZCER.js');var _chunkLYKEARRWjs = require('./chunk-LYKEARRW.js');require('./chunk-Z4Z6POJH.js');var _chunkDFPI5IXTjs = require('./chunk-DFPI5IXT.js');var _chunkO34VKX7Rjs = require('./chunk-O34VKX7R.js');var _chunk6WITJBGGjs = require('./chunk-6WITJBGG.js');var _chunk4PGUBQK3js = require('./chunk-4PGUBQK3.js');require('./chunk-Z7EDILIO.js');require('./chunk-7FJXUW3D.js');require('./chunk-BARLLX6S.js');var _chunk7EZVPMJ6js = require('./chunk-7EZVPMJ6.js');require('./chunk-QSAFGRYV.js');require('./chunk-F7QRI2VL.js');var _chunkU3WA3VIWjs = require('./chunk-U3WA3VIW.js');var _chunkOYAO7QEPjs = require('./chunk-OYAO7QEP.js');require('./chunk-2452BJTJ.js');var _chunkBM2H4NCZjs = require('./chunk-BM2H4NCZ.js');require('./chunk-IJGC6SHP.js');var _chunk46YIPCSNjs = require('./chunk-46YIPCSN.js');var _chunkUUCTMJK7js = require('./chunk-UUCTMJK7.js');exports.CommandHandler = _chunkOYAO7QEPjs.a; exports.ConcurrencyError = _chunkUUCTMJK7js.h; exports.DeciderCommandHandler = _chunkU3WA3VIWjs.a; exports.DeciderSpecification = _chunkO34VKX7Rjs.a; exports.EmmettError = _chunkUUCTMJK7js.g; exports.ExpectedVersionConflictError = _chunk46YIPCSNjs.f; exports.IllegalStateError = _chunkUUCTMJK7js.j; exports.JSONParser = _chunkLYKEARRWjs.b; exports.NO_CONCURRENCY_CHECK = _chunk46YIPCSNjs.c; exports.NotFoundError = _chunkUUCTMJK7js.k; exports.ParseError = _chunkLYKEARRWjs.a; exports.STREAM_DOES_NOT_EXIST = _chunk46YIPCSNjs.b; exports.STREAM_EXISTS = _chunk46YIPCSNjs.a; exports.ValidationError = _chunkUUCTMJK7js.i; exports.ValidationErrors = _chunkUUCTMJK7js.a; exports.accept = _chunk7EZVPMJ6js.h; exports.assertExpectedVersionMatchesCurrent = _chunk46YIPCSNjs.e; exports.assertMatches = _chunkDFPI5IXTjs.b; exports.assertNotEmptyString = _chunkUUCTMJK7js.d; exports.assertPositiveNumber = _chunkUUCTMJK7js.e; exports.assertUnsignedBigInt = _chunkUUCTMJK7js.f; exports.complete = _chunk7EZVPMJ6js.e; exports.error = _chunk7EZVPMJ6js.g; exports.evolve = _chunk4PGUBQK3js.a; exports.getInMemoryEventStore = _chunkBM2H4NCZjs.a; exports.getInitialState = _chunk4PGUBQK3js.b; exports.ignore = _chunk7EZVPMJ6js.f; exports.isNumber = _chunkUUCTMJK7js.b; exports.isString = _chunkUUCTMJK7js.c; exports.isSubset = _chunkDFPI5IXTjs.a; exports.matchesExpectedVersion = _chunk46YIPCSNjs.d; exports.merge = _chunk3JE5DUJ2js.a; exports.publish = _chunk7EZVPMJ6js.c; exports.reply = _chunk7EZVPMJ6js.a; exports.schedule = _chunk7EZVPMJ6js.d; exports.send = _chunk7EZVPMJ6js.b; exports.sum = _chunkFE73T2NSjs.a; exports.testAggregateStream = _chunk6WITJBGGjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-WIMBG2PX.js');var _chunk3JE5DUJ2js = require('./chunk-3JE5DUJ2.js');var _chunkFE73T2NSjs = require('./chunk-FE73T2NS.js');require('./chunk-LOJ6A4AJ.js');require('./chunk-AU2WZCER.js');var _chunkLYKEARRWjs = require('./chunk-LYKEARRW.js');require('./chunk-Z4Z6POJH.js');var _chunk7D2LV2X5js = require('./chunk-7D2LV2X5.js');var _chunkO34VKX7Rjs = require('./chunk-O34VKX7R.js');var _chunk6WITJBGGjs = require('./chunk-6WITJBGG.js');var _chunk4PGUBQK3js = require('./chunk-4PGUBQK3.js');require('./chunk-ZLASBJGR.js');var _chunkMHB2JU4Ujs = require('./chunk-MHB2JU4U.js');require('./chunk-7FJXUW3D.js');require('./chunk-5BGN2FV4.js');var _chunkS3PRXL2Jjs = require('./chunk-S3PRXL2J.js');var _chunk7EZVPMJ6js = require('./chunk-7EZVPMJ6.js');require('./chunk-F7QRI2VL.js');var _chunkU3WA3VIWjs = require('./chunk-U3WA3VIW.js');var _chunkOYAO7QEPjs = require('./chunk-OYAO7QEP.js');require('./chunk-2452BJTJ.js');var _chunkBM2H4NCZjs = require('./chunk-BM2H4NCZ.js');require('./chunk-IJGC6SHP.js');var _chunk46YIPCSNjs = require('./chunk-46YIPCSN.js');var _chunkUUCTMJK7js = require('./chunk-UUCTMJK7.js');exports.CommandHandler = _chunkOYAO7QEPjs.a; exports.ConcurrencyError = _chunkUUCTMJK7js.h; exports.DeciderCommandHandler = _chunkU3WA3VIWjs.a; exports.DeciderSpecification = _chunkO34VKX7Rjs.a; exports.EmmettError = _chunkUUCTMJK7js.g; exports.ExpectedVersionConflictError = _chunk46YIPCSNjs.f; exports.IllegalStateError = _chunkUUCTMJK7js.j; exports.JSONParser = _chunkLYKEARRWjs.b; exports.NO_CONCURRENCY_CHECK = _chunk46YIPCSNjs.c; exports.NotFoundError = _chunkUUCTMJK7js.k; exports.ParseError = _chunkLYKEARRWjs.a; exports.STREAM_DOES_NOT_EXIST = _chunk46YIPCSNjs.b; exports.STREAM_EXISTS = _chunk46YIPCSNjs.a; exports.ValidationError = _chunkUUCTMJK7js.i; exports.ValidationErrors = _chunkUUCTMJK7js.a; exports.accept = _chunk7EZVPMJ6js.h; exports.assertExpectedVersionMatchesCurrent = _chunk46YIPCSNjs.e; exports.assertMatches = _chunk7D2LV2X5js.b; exports.assertNotEmptyString = _chunkUUCTMJK7js.d; exports.assertPositiveNumber = _chunkUUCTMJK7js.e; exports.assertUnsignedBigInt = _chunkUUCTMJK7js.f; exports.command = _chunkMHB2JU4Ujs.a; exports.complete = _chunk7EZVPMJ6js.e; exports.error = _chunk7EZVPMJ6js.g; exports.event = _chunkS3PRXL2Jjs.a; exports.evolve = _chunk4PGUBQK3js.a; exports.getInMemoryEventStore = _chunkBM2H4NCZjs.a; exports.getInitialState = _chunk4PGUBQK3js.b; exports.ignore = _chunk7EZVPMJ6js.f; exports.isNumber = _chunkUUCTMJK7js.b; exports.isString = _chunkUUCTMJK7js.c; exports.isSubset = _chunk7D2LV2X5js.a; exports.matchesExpectedVersion = _chunk46YIPCSNjs.d; exports.merge = _chunk3JE5DUJ2js.a; exports.publish = _chunk7EZVPMJ6js.c; exports.reply = _chunk7EZVPMJ6js.a; exports.schedule = _chunk7EZVPMJ6js.d; exports.send = _chunk7EZVPMJ6js.b; exports.sum = _chunkFE73T2NSjs.a; exports.testAggregateStream = _chunk6WITJBGGjs.a;
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-PNOEBD4U.mjs";import{a as K}from"./chunk-OBA6MZMG.mjs";import{a as L}from"./chunk-YKFEDBH4.mjs";import"./chunk-DIW552TK.mjs";import"./chunk-7JLAVMM3.mjs";import{a as s,b as u}from"./chunk-PKL7KGJ3.mjs";import"./chunk-TDCMNVXU.mjs";import{a as v,b as w}from"./chunk-RWKXC5FZ.mjs";import{a as y}from"./chunk-32IWULJJ.mjs";import{a as J}from"./chunk-AMRL5G7K.mjs";import{a as H,b as I}from"./chunk-AYVR4VYR.mjs";import"./chunk-C4CXU3PY.mjs";import"./chunk-3LYVXI5R.mjs";import"./chunk-YKICRTHH.mjs";import{a as z,b as A,c as B,d as C,e as D,f as E,g as F,h as G}from"./chunk-ERDVHQZL.mjs";import"./chunk-IZWGWZ3P.mjs";import"./chunk-XLZS42HB.mjs";import{a as q}from"./chunk-O2ZUNWMO.mjs";import{a as n}from"./chunk-JJHE2RKT.mjs";import"./chunk-45ODDXOQ.mjs";import{a as l}from"./chunk-CTCSK4FW.mjs";import"./chunk-D24KLTN5.mjs";import{a as d,b as g,c as h,d as i,e as j,f as k}from"./chunk-UI6CV7VB.mjs";import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c}from"./chunk-YV6PB6LX.mjs";export{n as CommandHandler,x as ConcurrencyError,q as DeciderCommandHandler,y as DeciderSpecification,t as EmmettError,k as ExpectedVersionConflictError,b as IllegalStateError,u as JSONParser,h as NO_CONCURRENCY_CHECK,c as NotFoundError,s as ParseError,g as STREAM_DOES_NOT_EXIST,d as STREAM_EXISTS,a as ValidationError,o as ValidationErrors,G as accept,j as assertExpectedVersionMatchesCurrent,w as assertMatches,f as assertNotEmptyString,m as assertPositiveNumber,p as assertUnsignedBigInt,D as complete,F as error,H as evolve,l as getInMemoryEventStore,I as getInitialState,E as ignore,r as isNumber,e as isString,v as isSubset,i as matchesExpectedVersion,L as merge,B as publish,z as reply,C as schedule,A as send,K as sum,J as testAggregateStream};
1
+ import"./chunk-PNOEBD4U.mjs";import{a as N}from"./chunk-YKFEDBH4.mjs";import{a as M}from"./chunk-OBA6MZMG.mjs";import"./chunk-DIW552TK.mjs";import"./chunk-7JLAVMM3.mjs";import{a as s,b as u}from"./chunk-PKL7KGJ3.mjs";import"./chunk-TDCMNVXU.mjs";import{a as v,b as w}from"./chunk-HVU6UBXF.mjs";import{a as y}from"./chunk-32IWULJJ.mjs";import{a as L}from"./chunk-AMRL5G7K.mjs";import{a as J,b as K}from"./chunk-AYVR4VYR.mjs";import"./chunk-YWRV75GA.mjs";import{a as z}from"./chunk-JDYZZRJE.mjs";import"./chunk-3LYVXI5R.mjs";import"./chunk-DOHUIBZQ.mjs";import{a as A}from"./chunk-AWUWW7EJ.mjs";import{a as B,b as C,c as D,d as E,e as F,f as G,g as H,h as I}from"./chunk-ERDVHQZL.mjs";import"./chunk-XLZS42HB.mjs";import{a as q}from"./chunk-O2ZUNWMO.mjs";import{a as n}from"./chunk-JJHE2RKT.mjs";import"./chunk-45ODDXOQ.mjs";import{a as l}from"./chunk-CTCSK4FW.mjs";import"./chunk-D24KLTN5.mjs";import{a as d,b as g,c as h,d as i,e as j,f as k}from"./chunk-UI6CV7VB.mjs";import{a as o,b as r,c as e,d as f,e as m,f as p,g as t,h as x,i as a,j as b,k as c}from"./chunk-YV6PB6LX.mjs";export{n as CommandHandler,x as ConcurrencyError,q as DeciderCommandHandler,y as DeciderSpecification,t as EmmettError,k as ExpectedVersionConflictError,b as IllegalStateError,u as JSONParser,h as NO_CONCURRENCY_CHECK,c as NotFoundError,s as ParseError,g as STREAM_DOES_NOT_EXIST,d as STREAM_EXISTS,a as ValidationError,o as ValidationErrors,I as accept,j as assertExpectedVersionMatchesCurrent,w as assertMatches,f as assertNotEmptyString,m as assertPositiveNumber,p as assertUnsignedBigInt,z as command,F as complete,H as error,A as event,J as evolve,l as getInMemoryEventStore,K as getInitialState,G as ignore,r as isNumber,e as isString,v as isSubset,i as matchesExpectedVersion,N as merge,D as publish,B as reply,E as schedule,C as send,M as sum,L as testAggregateStream};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,44 @@
1
+ import { Command, Event, CommandTypeOf, EventTypeOf } from '../typing/index.mjs';
2
+ import '../typing/deepReadonly.mjs';
3
+
4
+ interface CommandSender {
5
+ send<CommandType extends Command = Command>(command: CommandType): Promise<void>;
6
+ }
7
+ interface EventsPublisher {
8
+ publish<EventType extends Event = Event>(event: EventType): Promise<void>;
9
+ }
10
+ type ScheduleOptions = {
11
+ afterInMs: number;
12
+ } | {
13
+ at: Date;
14
+ };
15
+ interface MessageScheduler<CommandOrEvent extends Command | Event> {
16
+ schedule<MessageType extends CommandOrEvent>(message: MessageType, when?: ScheduleOptions): void;
17
+ }
18
+ interface CommandBus extends CommandSender, MessageScheduler<Command> {
19
+ }
20
+ interface EventBus extends EventsPublisher, MessageScheduler<Event> {
21
+ }
22
+ interface MessageBus extends CommandBus, EventBus {
23
+ schedule<MessageType extends Command | Event>(message: MessageType, when?: ScheduleOptions): void;
24
+ }
25
+ type CommandHandler<CommandType extends Command = Command> = (command: CommandType) => Promise<void> | void;
26
+ interface CommandProcessor {
27
+ handle<CommandType extends Command>(commandHandler: CommandHandler<CommandType>, ...commandTypes: CommandTypeOf<CommandType>[]): void;
28
+ }
29
+ type EventHandler<EventType extends Event = Event> = (event: EventType) => Promise<void> | void;
30
+ interface EventProcessor {
31
+ subscribe<EventType extends Event>(eventHandler: EventHandler<EventType>, ...eventTypes: EventTypeOf<EventType>[]): void;
32
+ }
33
+ type ScheduledMessage = {
34
+ message: Event | Command;
35
+ options?: ScheduleOptions;
36
+ };
37
+ interface ScheduledMessageProcessor {
38
+ dequeue(): ScheduledMessage[];
39
+ }
40
+ type MessageHandler = CommandHandler | EventHandler;
41
+ type MessageProcessor = EventProcessor | CommandProcessor;
42
+ declare const getInMemoryMessageBus: () => MessageBus & MessageProcessor & ScheduledMessageProcessor;
43
+
44
+ export { type CommandBus, type CommandHandler, type CommandProcessor, type CommandSender, type EventBus, type EventHandler, type EventProcessor, type EventsPublisher, type MessageBus, type MessageHandler, type MessageProcessor, type MessageScheduler, type ScheduleOptions, type ScheduledMessage, type ScheduledMessageProcessor, getInMemoryMessageBus };
@@ -0,0 +1,44 @@
1
+ import { Command, Event, CommandTypeOf, EventTypeOf } from '../typing/index.js';
2
+ import '../typing/deepReadonly.js';
3
+
4
+ interface CommandSender {
5
+ send<CommandType extends Command = Command>(command: CommandType): Promise<void>;
6
+ }
7
+ interface EventsPublisher {
8
+ publish<EventType extends Event = Event>(event: EventType): Promise<void>;
9
+ }
10
+ type ScheduleOptions = {
11
+ afterInMs: number;
12
+ } | {
13
+ at: Date;
14
+ };
15
+ interface MessageScheduler<CommandOrEvent extends Command | Event> {
16
+ schedule<MessageType extends CommandOrEvent>(message: MessageType, when?: ScheduleOptions): void;
17
+ }
18
+ interface CommandBus extends CommandSender, MessageScheduler<Command> {
19
+ }
20
+ interface EventBus extends EventsPublisher, MessageScheduler<Event> {
21
+ }
22
+ interface MessageBus extends CommandBus, EventBus {
23
+ schedule<MessageType extends Command | Event>(message: MessageType, when?: ScheduleOptions): void;
24
+ }
25
+ type CommandHandler<CommandType extends Command = Command> = (command: CommandType) => Promise<void> | void;
26
+ interface CommandProcessor {
27
+ handle<CommandType extends Command>(commandHandler: CommandHandler<CommandType>, ...commandTypes: CommandTypeOf<CommandType>[]): void;
28
+ }
29
+ type EventHandler<EventType extends Event = Event> = (event: EventType) => Promise<void> | void;
30
+ interface EventProcessor {
31
+ subscribe<EventType extends Event>(eventHandler: EventHandler<EventType>, ...eventTypes: EventTypeOf<EventType>[]): void;
32
+ }
33
+ type ScheduledMessage = {
34
+ message: Event | Command;
35
+ options?: ScheduleOptions;
36
+ };
37
+ interface ScheduledMessageProcessor {
38
+ dequeue(): ScheduledMessage[];
39
+ }
40
+ type MessageHandler = CommandHandler | EventHandler;
41
+ type MessageProcessor = EventProcessor | CommandProcessor;
42
+ declare const getInMemoryMessageBus: () => MessageBus & MessageProcessor & ScheduledMessageProcessor;
43
+
44
+ export { type CommandBus, type CommandHandler, type CommandProcessor, type CommandSender, type EventBus, type EventHandler, type EventProcessor, type EventsPublisher, type MessageBus, type MessageHandler, type MessageProcessor, type MessageScheduler, type ScheduleOptions, type ScheduledMessage, type ScheduledMessageProcessor, getInMemoryMessageBus };
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }require('../chunk-ZLASBJGR.js');require('../chunk-MHB2JU4U.js');require('../chunk-7FJXUW3D.js');require('../chunk-5BGN2FV4.js');require('../chunk-S3PRXL2J.js');require('../chunk-7EZVPMJ6.js');var _chunkUUCTMJK7js = require('../chunk-UUCTMJK7.js');var p=()=>{let t=new Map,d=[];return{send:async e=>{let n=t.get(e.type);if(n===void 0||n.length===0)throw new (0, _chunkUUCTMJK7js.g)(`No handler registered for command ${e.type}!`);let s=n[0];await s(e)},publish:async e=>{let n=_nullishCoalesce(t.get(e.type), () => ([]));for(let s of n)await s(e)},schedule:(e,n)=>{d=[...d,{message:e,options:n}]},handle:(e,...n)=>{let s=[...t.keys()].filter(o=>n.includes(o));if(s.length>0)throw new (0, _chunkUUCTMJK7js.g)(`Cannot register handler for commands ${s.join(", ")} as they're already registered!`);for(let o of n)t.set(o,[e])},subscribe(e,...n){for(let s of n)t.has(s)||t.set(s,[]),t.set(s,[..._nullishCoalesce(t.get(s), () => ([])),e])},dequeue:()=>{let e=d;return d=[],e}}};exports.getInMemoryMessageBus = p;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/messageBus/index.ts"],"names":["getInMemoryMessageBus","allHandlers","pendingMessages","command","handlers","EmmettError","commandHandler","event","handler","message","when","commandTypes","alreadyRegistered","registered","commandType","eventHandler","eventTypes","eventType","pending"],"mappings":"uNAyEO,IAAMA,EAAwB,IAEN,CAC7B,IAAMC,EAAc,IAAI,IACpBC,EAAsC,CAAC,EAE3C,MAAO,CACL,KAAM,MACJC,GACkB,CAClB,IAAMC,EAAWH,EAAY,IAAIE,EAAQ,IAAI,EAE7C,GAAIC,IAAa,QAAaA,EAAS,SAAW,EAChD,MAAM,IAAIC,EACR,qCAAqCF,EAAQ,IAAI,GACnD,EAEF,IAAMG,EAAiBF,EAAS,CAAC,EAEjC,MAAME,EAAeH,CAAO,CAC9B,EAEA,QAAS,MACPI,GACkB,CAClB,IAAMH,EAAWH,EAAY,IAAIM,EAAM,IAAI,GAAK,CAAC,EAEjD,QAAWC,KAAWJ,EAGpB,MAFqBI,EAEFD,CAAK,CAE5B,EAEA,SAAU,CACRE,EACAC,IACS,CACTR,EAAkB,CAAC,GAAGA,EAAiB,CAAE,QAAAO,EAAS,QAASC,CAAK,CAAC,CACnE,EAEA,OAAQ,CACNJ,KACGK,IACM,CACT,IAAMC,EAAoB,CAAC,GAAGX,EAAY,KAAK,CAAC,EAAE,OAAQY,GACxDF,EAAa,SAASE,CAAU,CAClC,EAEA,GAAID,EAAkB,OAAS,EAC7B,MAAM,IAAIP,EACR,wCAAwCO,EAAkB,KAAK,IAAI,CAAC,iCACtE,EACF,QAAWE,KAAeH,EACxBV,EAAY,IAAIa,EAAa,CAACR,CAAgC,CAAC,CAEnE,EAEA,UACES,KACGC,EACG,CACN,QAAWC,KAAaD,EACjBf,EAAY,IAAIgB,CAAS,GAAGhB,EAAY,IAAIgB,EAAW,CAAC,CAAC,EAE9DhB,EAAY,IAAIgB,EAAW,CACzB,GAAIhB,EAAY,IAAIgB,CAAS,GAAK,CAAC,EACnCF,CACF,CAAC,CAEL,EAEA,QAAS,IAA0B,CACjC,IAAMG,EAAUhB,EAChB,OAAAA,EAAkB,CAAC,EACZgB,CACT,CACF,CACF","sourcesContent":["import { EmmettError } from '../errors';\nimport {\n type Command,\n type CommandTypeOf,\n type Event,\n type EventTypeOf,\n} from '../typing';\n\nexport interface CommandSender {\n send<CommandType extends Command = Command>(\n command: CommandType,\n ): Promise<void>;\n}\n\nexport interface EventsPublisher {\n publish<EventType extends Event = Event>(event: EventType): Promise<void>;\n}\n\nexport type ScheduleOptions = { afterInMs: number } | { at: Date };\n\nexport interface MessageScheduler<CommandOrEvent extends Command | Event> {\n schedule<MessageType extends CommandOrEvent>(\n message: MessageType,\n when?: ScheduleOptions,\n ): void;\n}\n\nexport interface CommandBus extends CommandSender, MessageScheduler<Command> {}\n\nexport interface EventBus extends EventsPublisher, MessageScheduler<Event> {}\n\nexport interface MessageBus extends CommandBus, EventBus {\n schedule<MessageType extends Command | Event>(\n message: MessageType,\n when?: ScheduleOptions,\n ): void;\n}\n\nexport type CommandHandler<CommandType extends Command = Command> = (\n command: CommandType,\n) => Promise<void> | void;\n\nexport interface CommandProcessor {\n handle<CommandType extends Command>(\n commandHandler: CommandHandler<CommandType>,\n ...commandTypes: CommandTypeOf<CommandType>[]\n ): void;\n}\n\nexport type EventHandler<EventType extends Event = Event> = (\n event: EventType,\n) => Promise<void> | void;\n\nexport interface EventProcessor {\n subscribe<EventType extends Event>(\n eventHandler: EventHandler<EventType>,\n ...eventTypes: EventTypeOf<EventType>[]\n ): void;\n}\n\nexport type ScheduledMessage = {\n message: Event | Command;\n options?: ScheduleOptions;\n};\n\nexport interface ScheduledMessageProcessor {\n dequeue(): ScheduledMessage[];\n}\n\nexport type MessageHandler = CommandHandler | EventHandler;\n\nexport type MessageProcessor = EventProcessor | CommandProcessor;\n\nexport const getInMemoryMessageBus = (): MessageBus &\n MessageProcessor &\n ScheduledMessageProcessor => {\n const allHandlers = new Map<string, MessageHandler[]>();\n let pendingMessages: ScheduledMessage[] = [];\n\n return {\n send: async <CommandType extends Command = Command>(\n command: CommandType,\n ): Promise<void> => {\n const handlers = allHandlers.get(command.type);\n\n if (handlers === undefined || handlers.length === 0)\n throw new EmmettError(\n `No handler registered for command ${command.type}!`,\n );\n\n const commandHandler = handlers[0] as CommandHandler<CommandType>;\n\n await commandHandler(command);\n },\n\n publish: async <EventType extends Event = Event>(\n event: EventType,\n ): Promise<void> => {\n const handlers = allHandlers.get(event.type) ?? [];\n\n for (const handler of handlers) {\n const eventHandler = handler as EventHandler<EventType>;\n\n await eventHandler(event);\n }\n },\n\n schedule: <MessageType extends Command | Event>(\n message: MessageType,\n when?: ScheduleOptions,\n ): void => {\n pendingMessages = [...pendingMessages, { message, options: when }];\n },\n\n handle: <CommandType extends Command>(\n commandHandler: CommandHandler<CommandType>,\n ...commandTypes: CommandTypeOf<CommandType>[]\n ): void => {\n const alreadyRegistered = [...allHandlers.keys()].filter((registered) =>\n commandTypes.includes(registered),\n );\n\n if (alreadyRegistered.length > 0)\n throw new EmmettError(\n `Cannot register handler for commands ${alreadyRegistered.join(', ')} as they're already registered!`,\n );\n for (const commandType of commandTypes) {\n allHandlers.set(commandType, [commandHandler as MessageHandler]);\n }\n },\n\n subscribe<EventType extends Event>(\n eventHandler: EventHandler<EventType>,\n ...eventTypes: EventTypeOf<EventType>[]\n ): void {\n for (const eventType of eventTypes) {\n if (!allHandlers.has(eventType)) allHandlers.set(eventType, []);\n\n allHandlers.set(eventType, [\n ...(allHandlers.get(eventType) ?? []),\n eventHandler as MessageHandler,\n ]);\n }\n },\n\n dequeue: (): ScheduledMessage[] => {\n const pending = pendingMessages;\n pendingMessages = [];\n return pending;\n },\n };\n};\n"]}
@@ -0,0 +1,2 @@
1
+ import"../chunk-YWRV75GA.mjs";import"../chunk-JDYZZRJE.mjs";import"../chunk-3LYVXI5R.mjs";import"../chunk-DOHUIBZQ.mjs";import"../chunk-AWUWW7EJ.mjs";import"../chunk-ERDVHQZL.mjs";import{g as a}from"../chunk-YV6PB6LX.mjs";var p=()=>{let t=new Map,d=[];return{send:async e=>{let n=t.get(e.type);if(n===void 0||n.length===0)throw new a(`No handler registered for command ${e.type}!`);let s=n[0];await s(e)},publish:async e=>{let n=t.get(e.type)??[];for(let s of n)await s(e)},schedule:(e,n)=>{d=[...d,{message:e,options:n}]},handle:(e,...n)=>{let s=[...t.keys()].filter(o=>n.includes(o));if(s.length>0)throw new a(`Cannot register handler for commands ${s.join(", ")} as they're already registered!`);for(let o of n)t.set(o,[e])},subscribe(e,...n){for(let s of n)t.has(s)||t.set(s,[]),t.set(s,[...t.get(s)??[],e])},dequeue:()=>{let e=d;return d=[],e}}};export{p as getInMemoryMessageBus};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/messageBus/index.ts"],"sourcesContent":["import { EmmettError } from '../errors';\nimport {\n type Command,\n type CommandTypeOf,\n type Event,\n type EventTypeOf,\n} from '../typing';\n\nexport interface CommandSender {\n send<CommandType extends Command = Command>(\n command: CommandType,\n ): Promise<void>;\n}\n\nexport interface EventsPublisher {\n publish<EventType extends Event = Event>(event: EventType): Promise<void>;\n}\n\nexport type ScheduleOptions = { afterInMs: number } | { at: Date };\n\nexport interface MessageScheduler<CommandOrEvent extends Command | Event> {\n schedule<MessageType extends CommandOrEvent>(\n message: MessageType,\n when?: ScheduleOptions,\n ): void;\n}\n\nexport interface CommandBus extends CommandSender, MessageScheduler<Command> {}\n\nexport interface EventBus extends EventsPublisher, MessageScheduler<Event> {}\n\nexport interface MessageBus extends CommandBus, EventBus {\n schedule<MessageType extends Command | Event>(\n message: MessageType,\n when?: ScheduleOptions,\n ): void;\n}\n\nexport type CommandHandler<CommandType extends Command = Command> = (\n command: CommandType,\n) => Promise<void> | void;\n\nexport interface CommandProcessor {\n handle<CommandType extends Command>(\n commandHandler: CommandHandler<CommandType>,\n ...commandTypes: CommandTypeOf<CommandType>[]\n ): void;\n}\n\nexport type EventHandler<EventType extends Event = Event> = (\n event: EventType,\n) => Promise<void> | void;\n\nexport interface EventProcessor {\n subscribe<EventType extends Event>(\n eventHandler: EventHandler<EventType>,\n ...eventTypes: EventTypeOf<EventType>[]\n ): void;\n}\n\nexport type ScheduledMessage = {\n message: Event | Command;\n options?: ScheduleOptions;\n};\n\nexport interface ScheduledMessageProcessor {\n dequeue(): ScheduledMessage[];\n}\n\nexport type MessageHandler = CommandHandler | EventHandler;\n\nexport type MessageProcessor = EventProcessor | CommandProcessor;\n\nexport const getInMemoryMessageBus = (): MessageBus &\n MessageProcessor &\n ScheduledMessageProcessor => {\n const allHandlers = new Map<string, MessageHandler[]>();\n let pendingMessages: ScheduledMessage[] = [];\n\n return {\n send: async <CommandType extends Command = Command>(\n command: CommandType,\n ): Promise<void> => {\n const handlers = allHandlers.get(command.type);\n\n if (handlers === undefined || handlers.length === 0)\n throw new EmmettError(\n `No handler registered for command ${command.type}!`,\n );\n\n const commandHandler = handlers[0] as CommandHandler<CommandType>;\n\n await commandHandler(command);\n },\n\n publish: async <EventType extends Event = Event>(\n event: EventType,\n ): Promise<void> => {\n const handlers = allHandlers.get(event.type) ?? [];\n\n for (const handler of handlers) {\n const eventHandler = handler as EventHandler<EventType>;\n\n await eventHandler(event);\n }\n },\n\n schedule: <MessageType extends Command | Event>(\n message: MessageType,\n when?: ScheduleOptions,\n ): void => {\n pendingMessages = [...pendingMessages, { message, options: when }];\n },\n\n handle: <CommandType extends Command>(\n commandHandler: CommandHandler<CommandType>,\n ...commandTypes: CommandTypeOf<CommandType>[]\n ): void => {\n const alreadyRegistered = [...allHandlers.keys()].filter((registered) =>\n commandTypes.includes(registered),\n );\n\n if (alreadyRegistered.length > 0)\n throw new EmmettError(\n `Cannot register handler for commands ${alreadyRegistered.join(', ')} as they're already registered!`,\n );\n for (const commandType of commandTypes) {\n allHandlers.set(commandType, [commandHandler as MessageHandler]);\n }\n },\n\n subscribe<EventType extends Event>(\n eventHandler: EventHandler<EventType>,\n ...eventTypes: EventTypeOf<EventType>[]\n ): void {\n for (const eventType of eventTypes) {\n if (!allHandlers.has(eventType)) allHandlers.set(eventType, []);\n\n allHandlers.set(eventType, [\n ...(allHandlers.get(eventType) ?? []),\n eventHandler as MessageHandler,\n ]);\n }\n },\n\n dequeue: (): ScheduledMessage[] => {\n const pending = pendingMessages;\n pendingMessages = [];\n return pending;\n },\n };\n};\n"],"mappings":"8NAyEO,IAAMA,EAAwB,IAEN,CAC7B,IAAMC,EAAc,IAAI,IACpBC,EAAsC,CAAC,EAE3C,MAAO,CACL,KAAM,MACJC,GACkB,CAClB,IAAMC,EAAWH,EAAY,IAAIE,EAAQ,IAAI,EAE7C,GAAIC,IAAa,QAAaA,EAAS,SAAW,EAChD,MAAM,IAAIC,EACR,qCAAqCF,EAAQ,IAAI,GACnD,EAEF,IAAMG,EAAiBF,EAAS,CAAC,EAEjC,MAAME,EAAeH,CAAO,CAC9B,EAEA,QAAS,MACPI,GACkB,CAClB,IAAMH,EAAWH,EAAY,IAAIM,EAAM,IAAI,GAAK,CAAC,EAEjD,QAAWC,KAAWJ,EAGpB,MAFqBI,EAEFD,CAAK,CAE5B,EAEA,SAAU,CACRE,EACAC,IACS,CACTR,EAAkB,CAAC,GAAGA,EAAiB,CAAE,QAAAO,EAAS,QAASC,CAAK,CAAC,CACnE,EAEA,OAAQ,CACNJ,KACGK,IACM,CACT,IAAMC,EAAoB,CAAC,GAAGX,EAAY,KAAK,CAAC,EAAE,OAAQY,GACxDF,EAAa,SAASE,CAAU,CAClC,EAEA,GAAID,EAAkB,OAAS,EAC7B,MAAM,IAAIP,EACR,wCAAwCO,EAAkB,KAAK,IAAI,CAAC,iCACtE,EACF,QAAWE,KAAeH,EACxBV,EAAY,IAAIa,EAAa,CAACR,CAAgC,CAAC,CAEnE,EAEA,UACES,KACGC,EACG,CACN,QAAWC,KAAaD,EACjBf,EAAY,IAAIgB,CAAS,GAAGhB,EAAY,IAAIgB,EAAW,CAAC,CAAC,EAE9DhB,EAAY,IAAIgB,EAAW,CACzB,GAAIhB,EAAY,IAAIgB,CAAS,GAAK,CAAC,EACnCF,CACF,CAAC,CAEL,EAEA,QAAS,IAA0B,CACjC,IAAMG,EAAUhB,EAChB,OAAAA,EAAkB,CAAC,EACZgB,CACT,CACF,CACF","names":["getInMemoryMessageBus","allHandlers","pendingMessages","command","handlers","EmmettError","commandHandler","event","handler","message","when","commandTypes","alreadyRegistered","registered","commandType","eventHandler","eventTypes","eventType","pending"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkDFPI5IXTjs = require('../chunk-DFPI5IXT.js');exports.assertMatches = _chunkDFPI5IXTjs.b; exports.isSubset = _chunkDFPI5IXTjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7D2LV2X5js = require('../chunk-7D2LV2X5.js');exports.assertMatches = _chunk7D2LV2X5js.b; exports.isSubset = _chunk7D2LV2X5js.a;
2
2
  //# sourceMappingURL=assertions.js.map
@@ -1,2 +1,2 @@
1
- import{a,b}from"../chunk-RWKXC5FZ.mjs";export{b as assertMatches,a as isSubset};
1
+ import{a,b}from"../chunk-HVU6UBXF.mjs";export{b as assertMatches,a as isSubset};
2
2
  //# sourceMappingURL=assertions.mjs.map
@@ -1,5 +1,6 @@
1
1
  import { E as EventStore } from '../eventStore-DLezSgsV.mjs';
2
2
  import '../typing/index.mjs';
3
+ import '../typing/deepReadonly.mjs';
3
4
  import '../errors/index.mjs';
4
5
 
5
6
  type TestOptions = {
@@ -1,5 +1,6 @@
1
1
  import { E as EventStore } from '../eventStore-N_YMFCDT.js';
2
2
  import '../typing/index.js';
3
+ import '../typing/deepReadonly.js';
3
4
  import '../errors/index.js';
4
5
 
5
6
  type TestOptions = {
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6WITJBGGjs = require('../chunk-6WITJBGG.js');require('../chunk-4PGUBQK3.js');require('../chunk-Z7EDILIO.js');require('../chunk-7FJXUW3D.js');require('../chunk-BARLLX6S.js');require('../chunk-7EZVPMJ6.js');require('../chunk-QSAFGRYV.js');exports.testAggregateStream = _chunk6WITJBGGjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6WITJBGGjs = require('../chunk-6WITJBGG.js');require('../chunk-4PGUBQK3.js');require('../chunk-ZLASBJGR.js');require('../chunk-MHB2JU4U.js');require('../chunk-7FJXUW3D.js');require('../chunk-5BGN2FV4.js');require('../chunk-S3PRXL2J.js');require('../chunk-7EZVPMJ6.js');exports.testAggregateStream = _chunk6WITJBGGjs.a;
2
2
  //# sourceMappingURL=features.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-AMRL5G7K.mjs";import"../chunk-AYVR4VYR.mjs";import"../chunk-C4CXU3PY.mjs";import"../chunk-3LYVXI5R.mjs";import"../chunk-YKICRTHH.mjs";import"../chunk-ERDVHQZL.mjs";import"../chunk-IZWGWZ3P.mjs";export{a as testAggregateStream};
1
+ import{a}from"../chunk-AMRL5G7K.mjs";import"../chunk-AYVR4VYR.mjs";import"../chunk-YWRV75GA.mjs";import"../chunk-JDYZZRJE.mjs";import"../chunk-3LYVXI5R.mjs";import"../chunk-DOHUIBZQ.mjs";import"../chunk-AWUWW7EJ.mjs";import"../chunk-ERDVHQZL.mjs";export{a as testAggregateStream};
2
2
  //# sourceMappingURL=features.mjs.map
@@ -4,4 +4,5 @@ export { EventStoreFactory, testAggregateStream } from './features.mjs';
4
4
  export { DiscountApplied, PricedProductItem, ProductItemAdded, ShoppingCart, ShoppingCartEvent, evolve, getInitialState } from './shoppingCart.domain.mjs';
5
5
  import '../eventStore-DLezSgsV.mjs';
6
6
  import '../typing/index.mjs';
7
+ import '../typing/deepReadonly.mjs';
7
8
  import '../errors/index.mjs';
@@ -4,4 +4,5 @@ export { EventStoreFactory, testAggregateStream } from './features.js';
4
4
  export { DiscountApplied, PricedProductItem, ProductItemAdded, ShoppingCart, ShoppingCartEvent, evolve, getInitialState } from './shoppingCart.domain.js';
5
5
  import '../eventStore-N_YMFCDT.js';
6
6
  import '../typing/index.js';
7
+ import '../typing/deepReadonly.js';
7
8
  import '../errors/index.js';
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-Z4Z6POJH.js');var _chunkDFPI5IXTjs = require('../chunk-DFPI5IXT.js');var _chunkO34VKX7Rjs = require('../chunk-O34VKX7R.js');var _chunk6WITJBGGjs = require('../chunk-6WITJBGG.js');var _chunk4PGUBQK3js = require('../chunk-4PGUBQK3.js');require('../chunk-Z7EDILIO.js');require('../chunk-7FJXUW3D.js');require('../chunk-BARLLX6S.js');require('../chunk-7EZVPMJ6.js');require('../chunk-QSAFGRYV.js');exports.DeciderSpecification = _chunkO34VKX7Rjs.a; exports.assertMatches = _chunkDFPI5IXTjs.b; exports.evolve = _chunk4PGUBQK3js.a; exports.getInitialState = _chunk4PGUBQK3js.b; exports.isSubset = _chunkDFPI5IXTjs.a; exports.testAggregateStream = _chunk6WITJBGGjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-Z4Z6POJH.js');var _chunk7D2LV2X5js = require('../chunk-7D2LV2X5.js');var _chunkO34VKX7Rjs = require('../chunk-O34VKX7R.js');var _chunk6WITJBGGjs = require('../chunk-6WITJBGG.js');var _chunk4PGUBQK3js = require('../chunk-4PGUBQK3.js');require('../chunk-ZLASBJGR.js');require('../chunk-MHB2JU4U.js');require('../chunk-7FJXUW3D.js');require('../chunk-5BGN2FV4.js');require('../chunk-S3PRXL2J.js');require('../chunk-7EZVPMJ6.js');exports.DeciderSpecification = _chunkO34VKX7Rjs.a; exports.assertMatches = _chunk7D2LV2X5js.b; exports.evolve = _chunk4PGUBQK3js.a; exports.getInitialState = _chunk4PGUBQK3js.b; exports.isSubset = _chunk7D2LV2X5js.a; exports.testAggregateStream = _chunk6WITJBGGjs.a;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import"../chunk-TDCMNVXU.mjs";import{a,b}from"../chunk-RWKXC5FZ.mjs";import{a as c}from"../chunk-32IWULJJ.mjs";import{a as f}from"../chunk-AMRL5G7K.mjs";import{a as d,b as e}from"../chunk-AYVR4VYR.mjs";import"../chunk-C4CXU3PY.mjs";import"../chunk-3LYVXI5R.mjs";import"../chunk-YKICRTHH.mjs";import"../chunk-ERDVHQZL.mjs";import"../chunk-IZWGWZ3P.mjs";export{c as DeciderSpecification,b as assertMatches,d as evolve,e as getInitialState,a as isSubset,f as testAggregateStream};
1
+ import"../chunk-TDCMNVXU.mjs";import{a,b}from"../chunk-HVU6UBXF.mjs";import{a as c}from"../chunk-32IWULJJ.mjs";import{a as f}from"../chunk-AMRL5G7K.mjs";import{a as d,b as e}from"../chunk-AYVR4VYR.mjs";import"../chunk-YWRV75GA.mjs";import"../chunk-JDYZZRJE.mjs";import"../chunk-3LYVXI5R.mjs";import"../chunk-DOHUIBZQ.mjs";import"../chunk-AWUWW7EJ.mjs";import"../chunk-ERDVHQZL.mjs";export{c as DeciderSpecification,b as assertMatches,d as evolve,e as getInitialState,a as isSubset,f as testAggregateStream};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,4 +1,5 @@
1
1
  import { Event } from '../typing/index.mjs';
2
+ import '../typing/deepReadonly.mjs';
2
3
 
3
4
  type PricedProductItem = {
4
5
  productId: string;
@@ -1,4 +1,5 @@
1
1
  import { Event } from '../typing/index.js';
2
+ import '../typing/deepReadonly.js';
2
3
 
3
4
  type PricedProductItem = {
4
5
  productId: string;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk4PGUBQK3js = require('../chunk-4PGUBQK3.js');require('../chunk-Z7EDILIO.js');require('../chunk-7FJXUW3D.js');require('../chunk-BARLLX6S.js');require('../chunk-7EZVPMJ6.js');require('../chunk-QSAFGRYV.js');exports.evolve = _chunk4PGUBQK3js.a; exports.getInitialState = _chunk4PGUBQK3js.b;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk4PGUBQK3js = require('../chunk-4PGUBQK3.js');require('../chunk-ZLASBJGR.js');require('../chunk-MHB2JU4U.js');require('../chunk-7FJXUW3D.js');require('../chunk-5BGN2FV4.js');require('../chunk-S3PRXL2J.js');require('../chunk-7EZVPMJ6.js');exports.evolve = _chunk4PGUBQK3js.a; exports.getInitialState = _chunk4PGUBQK3js.b;
2
2
  //# sourceMappingURL=shoppingCart.domain.js.map
@@ -1,2 +1,2 @@
1
- import{a,b}from"../chunk-AYVR4VYR.mjs";import"../chunk-C4CXU3PY.mjs";import"../chunk-3LYVXI5R.mjs";import"../chunk-YKICRTHH.mjs";import"../chunk-ERDVHQZL.mjs";import"../chunk-IZWGWZ3P.mjs";export{a as evolve,b as getInitialState};
1
+ import{a,b}from"../chunk-AYVR4VYR.mjs";import"../chunk-YWRV75GA.mjs";import"../chunk-JDYZZRJE.mjs";import"../chunk-3LYVXI5R.mjs";import"../chunk-DOHUIBZQ.mjs";import"../chunk-AWUWW7EJ.mjs";import"../chunk-ERDVHQZL.mjs";export{a as evolve,b as getInitialState};
2
2
  //# sourceMappingURL=shoppingCart.domain.mjs.map
@@ -1 +1,2 @@
1
- export { Command, DefaultCommandMetadata } from './index.mjs';
1
+ export { Command, CommandDataOf, CommandMetaDataOf, CommandTypeOf, CreateCommandType, DefaultCommandMetadata, command } from './index.mjs';
2
+ import './deepReadonly.mjs';
@@ -1 +1,2 @@
1
- export { Command, DefaultCommandMetadata } from './index.js';
1
+ export { Command, CommandDataOf, CommandMetaDataOf, CommandTypeOf, CreateCommandType, DefaultCommandMetadata, command } from './index.js';
2
+ import './deepReadonly.js';
@@ -1,2 +1,2 @@
1
- "use strict";require('../chunk-QSAFGRYV.js');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkMHB2JU4Ujs = require('../chunk-MHB2JU4U.js');exports.command = _chunkMHB2JU4Ujs.a;
2
2
  //# sourceMappingURL=command.js.map
@@ -1,2 +1,2 @@
1
- import"../chunk-IZWGWZ3P.mjs";
1
+ import{a}from"../chunk-JDYZZRJE.mjs";export{a as command};
2
2
  //# sourceMappingURL=command.mjs.map
@@ -1 +1,2 @@
1
1
  export { Decider } from './index.mjs';
2
+ import './deepReadonly.mjs';
@@ -1 +1,2 @@
1
1
  export { Decider } from './index.js';
2
+ import './deepReadonly.js';
@@ -0,0 +1,15 @@
1
+ type Primitive = undefined | null | boolean | string | number | bigint | symbol | Function;
2
+ type ImmutableTypes = Date | RegExp;
3
+ type DeepReadonly<T> = T extends Primitive | ImmutableTypes ? T : T extends Array<infer U> ? ReadonlyArray<DeepReadonly<U>> : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer M> ? ReadonlySet<DeepReadonly<M>> : T extends Promise<infer U> ? Promise<DeepReadonly<U>> : T extends object ? DeepReadonlyObject<T> : Readonly<T>;
4
+ type DeepReadonlyObject<T> = {
5
+ readonly [P in keyof T]: DeepReadonly<T[P]>;
6
+ };
7
+ type Mutable<T> = T extends Primitive ? T : T extends ReadonlyArray<infer U> ? MutableArray<U> : T extends ReadonlyMap<infer K, infer V> ? MutableMap<K, V> : T extends ReadonlySet<infer M> ? MutableSet<M> : T extends Function ? T : T extends object ? MutableObject<T> : unknown;
8
+ type MutableArray<T> = Array<Mutable<T>>;
9
+ type MutableMap<K, V> = Map<Mutable<K>, Mutable<V>>;
10
+ type MutableSet<T> = Set<Mutable<T>>;
11
+ type MutableObject<T> = {
12
+ -readonly [P in keyof T]: Mutable<T[P]>;
13
+ };
14
+
15
+ export type { DeepReadonly, Mutable };
@@ -0,0 +1,15 @@
1
+ type Primitive = undefined | null | boolean | string | number | bigint | symbol | Function;
2
+ type ImmutableTypes = Date | RegExp;
3
+ type DeepReadonly<T> = T extends Primitive | ImmutableTypes ? T : T extends Array<infer U> ? ReadonlyArray<DeepReadonly<U>> : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer M> ? ReadonlySet<DeepReadonly<M>> : T extends Promise<infer U> ? Promise<DeepReadonly<U>> : T extends object ? DeepReadonlyObject<T> : Readonly<T>;
4
+ type DeepReadonlyObject<T> = {
5
+ readonly [P in keyof T]: DeepReadonly<T[P]>;
6
+ };
7
+ type Mutable<T> = T extends Primitive ? T : T extends ReadonlyArray<infer U> ? MutableArray<U> : T extends ReadonlyMap<infer K, infer V> ? MutableMap<K, V> : T extends ReadonlySet<infer M> ? MutableSet<M> : T extends Function ? T : T extends object ? MutableObject<T> : unknown;
8
+ type MutableArray<T> = Array<Mutable<T>>;
9
+ type MutableMap<K, V> = Map<Mutable<K>, Mutable<V>>;
10
+ type MutableSet<T> = Set<Mutable<T>>;
11
+ type MutableObject<T> = {
12
+ -readonly [P in keyof T]: Mutable<T[P]>;
13
+ };
14
+
15
+ export type { DeepReadonly, Mutable };
@@ -0,0 +1,2 @@
1
+ "use strict";require('../chunk-5BGN2FV4.js');
2
+ //# sourceMappingURL=deepReadonly.js.map
@@ -0,0 +1,2 @@
1
+ import"../chunk-DOHUIBZQ.mjs";
2
+ //# sourceMappingURL=deepReadonly.mjs.map
@@ -1 +1,2 @@
1
- export { Event } from './index.mjs';
1
+ export { CreateEventType, Event, EventDataOf, EventMetaDataOf, EventTypeOf, event } from './index.mjs';
2
+ import './deepReadonly.mjs';
@@ -1 +1,2 @@
1
- export { Event } from './index.js';
1
+ export { CreateEventType, Event, EventDataOf, EventMetaDataOf, EventTypeOf, event } from './index.js';
2
+ import './deepReadonly.js';
@@ -1,2 +1,2 @@
1
- "use strict";require('../chunk-BARLLX6S.js');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkS3PRXL2Jjs = require('../chunk-S3PRXL2J.js');exports.event = _chunkS3PRXL2Jjs.a;
2
2
  //# sourceMappingURL=event.js.map
@@ -1,2 +1,2 @@
1
- import"../chunk-YKICRTHH.mjs";
1
+ import{a}from"../chunk-AWUWW7EJ.mjs";export{a as event};
2
2
  //# sourceMappingURL=event.mjs.map
@@ -1,17 +1,37 @@
1
- type Command<CommandType extends string = string, CommandData extends Record<string, unknown> = Record<string, unknown>, CommandMetaData extends Record<string, unknown> = DefaultCommandMetadata> = Flavour<Readonly<{
1
+ export { DeepReadonly, Mutable } from './deepReadonly.mjs';
2
+
3
+ type Command<CommandType extends string = string, CommandData extends DefaultRecord = DefaultRecord, CommandMetaData extends DefaultRecord = DefaultCommandMetadata> = Flavour<Readonly<{
2
4
  type: CommandType;
3
5
  data: Readonly<CommandData>;
4
6
  metadata?: CommandMetaData | undefined;
5
7
  }>, 'Command'>;
8
+ type CommandTypeOf<T extends Command> = T['type'];
9
+ type CommandDataOf<T extends Command> = T['data'];
10
+ type CommandMetaDataOf<T extends Command> = T['metadata'];
11
+ type CreateCommandType<CommandType extends string, CommandData extends DefaultRecord, CommandMetaData extends DefaultRecord | undefined> = Readonly<{
12
+ type: CommandType;
13
+ data: CommandData;
14
+ metadata?: CommandMetaData;
15
+ }>;
16
+ declare const command: <CommandType extends Command<string, DefaultRecord, DefaultCommandMetadata>>(type: CommandTypeOf<CommandType>, data: CommandDataOf<CommandType>, metadata?: CommandMetaDataOf<CommandType>) => CreateCommandType<CommandTypeOf<CommandType>, CommandDataOf<CommandType>, CommandMetaDataOf<CommandType>>;
6
17
  type DefaultCommandMetadata = {
7
18
  now: Date;
8
19
  };
9
20
 
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<{
21
+ type Event<EventType extends string = string, EventData extends DefaultRecord = DefaultRecord, EventMetaData extends DefaultRecord = DefaultRecord> = Flavour<Readonly<{
11
22
  type: EventType;
12
- data: Readonly<EventData>;
13
- metadata?: EventMetaData | undefined;
23
+ data: EventData;
24
+ metadata?: EventMetaData;
14
25
  }>, 'Event'>;
26
+ type EventTypeOf<T extends Event> = T['type'];
27
+ type EventDataOf<T extends Event> = T['data'];
28
+ type EventMetaDataOf<T extends Event> = T['metadata'];
29
+ type CreateEventType<EventType extends string, EventData extends DefaultRecord, EventMetaData extends DefaultRecord | undefined> = Readonly<{
30
+ type: EventType;
31
+ data: EventData;
32
+ metadata?: EventMetaData;
33
+ }>;
34
+ declare const event: <EventType extends Event<string, DefaultRecord, DefaultRecord>>(type: EventTypeOf<EventType>, data: EventDataOf<EventType>, metadata?: EventMetaDataOf<EventType>) => CreateEventType<EventTypeOf<EventType>, EventDataOf<EventType>, EventMetaDataOf<EventType>>;
15
35
 
16
36
  type Decider<State, CommandType extends Command, StreamEvent extends Event> = {
17
37
  decide: (command: CommandType, state: State) => StreamEvent | StreamEvent[];
@@ -77,5 +97,6 @@ type Brand<K, T> = K & {
77
97
  type Flavour<K, T> = K & {
78
98
  readonly __brand?: T;
79
99
  };
100
+ type DefaultRecord = Record<string, unknown>;
80
101
 
81
- export { type Brand, type Command, type Decider, type DefaultCommandMetadata, type Event, type Flavour, type Workflow, type WorkflowCommand, type WorkflowEvent, type WorkflowOutput, accept, complete, error, ignore, publish, reply, schedule, send };
102
+ export { type Brand, type Command, type CommandDataOf, type CommandMetaDataOf, type CommandTypeOf, type CreateCommandType, type CreateEventType, type Decider, type DefaultCommandMetadata, type DefaultRecord, type Event, type EventDataOf, type EventMetaDataOf, type EventTypeOf, type Flavour, type Workflow, type WorkflowCommand, type WorkflowEvent, type WorkflowOutput, accept, command, complete, error, event, ignore, publish, reply, schedule, send };
@@ -1,17 +1,37 @@
1
- type Command<CommandType extends string = string, CommandData extends Record<string, unknown> = Record<string, unknown>, CommandMetaData extends Record<string, unknown> = DefaultCommandMetadata> = Flavour<Readonly<{
1
+ export { DeepReadonly, Mutable } from './deepReadonly.js';
2
+
3
+ type Command<CommandType extends string = string, CommandData extends DefaultRecord = DefaultRecord, CommandMetaData extends DefaultRecord = DefaultCommandMetadata> = Flavour<Readonly<{
2
4
  type: CommandType;
3
5
  data: Readonly<CommandData>;
4
6
  metadata?: CommandMetaData | undefined;
5
7
  }>, 'Command'>;
8
+ type CommandTypeOf<T extends Command> = T['type'];
9
+ type CommandDataOf<T extends Command> = T['data'];
10
+ type CommandMetaDataOf<T extends Command> = T['metadata'];
11
+ type CreateCommandType<CommandType extends string, CommandData extends DefaultRecord, CommandMetaData extends DefaultRecord | undefined> = Readonly<{
12
+ type: CommandType;
13
+ data: CommandData;
14
+ metadata?: CommandMetaData;
15
+ }>;
16
+ declare const command: <CommandType extends Command<string, DefaultRecord, DefaultCommandMetadata>>(type: CommandTypeOf<CommandType>, data: CommandDataOf<CommandType>, metadata?: CommandMetaDataOf<CommandType>) => CreateCommandType<CommandTypeOf<CommandType>, CommandDataOf<CommandType>, CommandMetaDataOf<CommandType>>;
6
17
  type DefaultCommandMetadata = {
7
18
  now: Date;
8
19
  };
9
20
 
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<{
21
+ type Event<EventType extends string = string, EventData extends DefaultRecord = DefaultRecord, EventMetaData extends DefaultRecord = DefaultRecord> = Flavour<Readonly<{
11
22
  type: EventType;
12
- data: Readonly<EventData>;
13
- metadata?: EventMetaData | undefined;
23
+ data: EventData;
24
+ metadata?: EventMetaData;
14
25
  }>, 'Event'>;
26
+ type EventTypeOf<T extends Event> = T['type'];
27
+ type EventDataOf<T extends Event> = T['data'];
28
+ type EventMetaDataOf<T extends Event> = T['metadata'];
29
+ type CreateEventType<EventType extends string, EventData extends DefaultRecord, EventMetaData extends DefaultRecord | undefined> = Readonly<{
30
+ type: EventType;
31
+ data: EventData;
32
+ metadata?: EventMetaData;
33
+ }>;
34
+ declare const event: <EventType extends Event<string, DefaultRecord, DefaultRecord>>(type: EventTypeOf<EventType>, data: EventDataOf<EventType>, metadata?: EventMetaDataOf<EventType>) => CreateEventType<EventTypeOf<EventType>, EventDataOf<EventType>, EventMetaDataOf<EventType>>;
15
35
 
16
36
  type Decider<State, CommandType extends Command, StreamEvent extends Event> = {
17
37
  decide: (command: CommandType, state: State) => StreamEvent | StreamEvent[];
@@ -77,5 +97,6 @@ type Brand<K, T> = K & {
77
97
  type Flavour<K, T> = K & {
78
98
  readonly __brand?: T;
79
99
  };
100
+ type DefaultRecord = Record<string, unknown>;
80
101
 
81
- export { type Brand, type Command, type Decider, type DefaultCommandMetadata, type Event, type Flavour, type Workflow, type WorkflowCommand, type WorkflowEvent, type WorkflowOutput, accept, complete, error, ignore, publish, reply, schedule, send };
102
+ export { type Brand, type Command, type CommandDataOf, type CommandMetaDataOf, type CommandTypeOf, type CreateCommandType, type CreateEventType, type Decider, type DefaultCommandMetadata, type DefaultRecord, type Event, type EventDataOf, type EventMetaDataOf, type EventTypeOf, type Flavour, type Workflow, type WorkflowCommand, type WorkflowEvent, type WorkflowOutput, accept, command, complete, error, event, ignore, publish, reply, schedule, send };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-Z7EDILIO.js');require('../chunk-7FJXUW3D.js');require('../chunk-BARLLX6S.js');var _chunk7EZVPMJ6js = require('../chunk-7EZVPMJ6.js');require('../chunk-QSAFGRYV.js');exports.accept = _chunk7EZVPMJ6js.h; exports.complete = _chunk7EZVPMJ6js.e; exports.error = _chunk7EZVPMJ6js.g; exports.ignore = _chunk7EZVPMJ6js.f; exports.publish = _chunk7EZVPMJ6js.c; exports.reply = _chunk7EZVPMJ6js.a; exports.schedule = _chunk7EZVPMJ6js.d; exports.send = _chunk7EZVPMJ6js.b;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-ZLASBJGR.js');var _chunkMHB2JU4Ujs = require('../chunk-MHB2JU4U.js');require('../chunk-7FJXUW3D.js');require('../chunk-5BGN2FV4.js');var _chunkS3PRXL2Jjs = require('../chunk-S3PRXL2J.js');var _chunk7EZVPMJ6js = require('../chunk-7EZVPMJ6.js');exports.accept = _chunk7EZVPMJ6js.h; exports.command = _chunkMHB2JU4Ujs.a; exports.complete = _chunk7EZVPMJ6js.e; exports.error = _chunk7EZVPMJ6js.g; exports.event = _chunkS3PRXL2Jjs.a; exports.ignore = _chunk7EZVPMJ6js.f; exports.publish = _chunk7EZVPMJ6js.c; exports.reply = _chunk7EZVPMJ6js.a; exports.schedule = _chunk7EZVPMJ6js.d; exports.send = _chunk7EZVPMJ6js.b;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import"../chunk-C4CXU3PY.mjs";import"../chunk-3LYVXI5R.mjs";import"../chunk-YKICRTHH.mjs";import{a,b,c,d,e,f,g,h}from"../chunk-ERDVHQZL.mjs";import"../chunk-IZWGWZ3P.mjs";export{h as accept,e as complete,g as error,f as ignore,c as publish,a as reply,d as schedule,b as send};
1
+ import"../chunk-YWRV75GA.mjs";import{a}from"../chunk-JDYZZRJE.mjs";import"../chunk-3LYVXI5R.mjs";import"../chunk-DOHUIBZQ.mjs";import{a as b}from"../chunk-AWUWW7EJ.mjs";import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j}from"../chunk-ERDVHQZL.mjs";export{j as accept,a as command,g as complete,i as error,b as event,h as ignore,e as publish,c as reply,f as schedule,d as send};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1,2 @@
1
1
  export { Workflow, WorkflowCommand, WorkflowEvent, WorkflowOutput, accept, complete, error, ignore, publish, reply, schedule, send } from './index.mjs';
2
+ import './deepReadonly.mjs';
@@ -1 +1,2 @@
1
1
  export { Workflow, WorkflowCommand, WorkflowEvent, WorkflowOutput, accept, complete, error, ignore, publish, reply, schedule, send } from './index.js';
2
+ import './deepReadonly.js';
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWIMBG2PXjs = require('../chunk-WIMBG2PX.js');var _chunkFE73T2NSjs = require('../chunk-FE73T2NS.js');var _chunk3JE5DUJ2js = require('../chunk-3JE5DUJ2.js');exports.default = _chunkWIMBG2PXjs.a; exports.merge = _chunk3JE5DUJ2js.a; exports.sum = _chunkFE73T2NSjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWIMBG2PXjs = require('../chunk-WIMBG2PX.js');var _chunk3JE5DUJ2js = require('../chunk-3JE5DUJ2.js');var _chunkFE73T2NSjs = require('../chunk-FE73T2NS.js');exports.default = _chunkWIMBG2PXjs.a; exports.merge = _chunk3JE5DUJ2js.a; exports.sum = _chunkFE73T2NSjs.a;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import{a as c}from"../chunk-PNOEBD4U.mjs";import{a}from"../chunk-OBA6MZMG.mjs";import{a as b}from"../chunk-YKFEDBH4.mjs";export{c as default,b as merge,a as sum};
1
+ import{a as c}from"../chunk-PNOEBD4U.mjs";import{a as b}from"../chunk-YKFEDBH4.mjs";import{a}from"../chunk-OBA6MZMG.mjs";export{c as default,b as merge,a as sum};
2
2
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@event-driven-io/emmett",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Emmett - Event Sourcing development made simple",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -1 +0,0 @@
1
- "use strict";//# sourceMappingURL=chunk-BARLLX6S.js.map
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-C4CXU3PY.mjs.map
@@ -1,5 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var u=(s,o)=>{let t=s,r=o;return Object.keys(r).every(n=>typeof r[n]=="object"?u(t[n],r[n]):r[n]===t[n])},i= exports.b =(s,o)=>{if(!u(s,o))throw Error(`subObj:
2
- ${JSON.stringify(o)}
3
- is not subset of
4
- ${JSON.stringify(s)}`)};exports.a = u; exports.b = i;
5
- //# sourceMappingURL=chunk-DFPI5IXT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/testing/assertions.ts"],"names":["isSubset","superObj","subObj","sup","sub","ele","assertMatches","actual","expected"],"mappings":"AAAO,IAAMA,EAAW,CAACC,EAAmBC,IAA6B,CACvE,IAAMC,EAAMF,EACNG,EAAMF,EAEZ,OAAO,OAAO,KAAKE,CAAG,EAAE,MAAOC,GACzB,OAAOD,EAAIC,CAAG,GAAK,SACdL,EACLG,EAAIE,CAAG,EACPD,EAAIC,CAAG,CACT,EAEKD,EAAIC,CAAG,IAAMF,EAAIE,CAAG,CAC5B,CACH,EAEaC,EAAgB,CAACC,EAAiBC,IAAsB,CACnE,GAAI,CAACR,EAASO,EAAQC,CAAQ,EAC5B,MAAM,MACJ;AAAA,EAAY,KAAK,UAAUA,CAAQ,CAAC;AAAA;AAAA,EAAuB,KAAK,UAAUD,CAAM,CAAC,EACnF,CACJ","sourcesContent":["export const isSubset = (superObj: unknown, subObj: unknown): boolean => {\n const sup = superObj as Record<string, unknown>;\n const sub = subObj as Record<string, unknown>;\n\n return Object.keys(sub).every((ele: string) => {\n if (typeof sub[ele] == 'object') {\n return isSubset(\n sup[ele] as Record<string, unknown>,\n sub[ele] as Record<string, unknown>,\n );\n }\n return sub[ele] === sup[ele];\n });\n};\n\nexport const assertMatches = (actual: unknown, expected: unknown) => {\n if (!isSubset(actual, expected))\n throw Error(\n `subObj:\\n${JSON.stringify(expected)}\\nis not subset of\\n${JSON.stringify(actual)}`,\n );\n};\n"]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-IZWGWZ3P.mjs.map
@@ -1 +0,0 @@
1
- "use strict";//# sourceMappingURL=chunk-QSAFGRYV.js.map
@@ -1,5 +0,0 @@
1
- var u=(s,o)=>{let t=s,r=o;return Object.keys(r).every(n=>typeof r[n]=="object"?u(t[n],r[n]):r[n]===t[n])},i=(s,o)=>{if(!u(s,o))throw Error(`subObj:
2
- ${JSON.stringify(o)}
3
- is not subset of
4
- ${JSON.stringify(s)}`)};export{u as a,i as b};
5
- //# sourceMappingURL=chunk-RWKXC5FZ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/testing/assertions.ts"],"sourcesContent":["export const isSubset = (superObj: unknown, subObj: unknown): boolean => {\n const sup = superObj as Record<string, unknown>;\n const sub = subObj as Record<string, unknown>;\n\n return Object.keys(sub).every((ele: string) => {\n if (typeof sub[ele] == 'object') {\n return isSubset(\n sup[ele] as Record<string, unknown>,\n sub[ele] as Record<string, unknown>,\n );\n }\n return sub[ele] === sup[ele];\n });\n};\n\nexport const assertMatches = (actual: unknown, expected: unknown) => {\n if (!isSubset(actual, expected))\n throw Error(\n `subObj:\\n${JSON.stringify(expected)}\\nis not subset of\\n${JSON.stringify(actual)}`,\n );\n};\n"],"mappings":"AAAO,IAAMA,EAAW,CAACC,EAAmBC,IAA6B,CACvE,IAAMC,EAAMF,EACNG,EAAMF,EAEZ,OAAO,OAAO,KAAKE,CAAG,EAAE,MAAOC,GACzB,OAAOD,EAAIC,CAAG,GAAK,SACdL,EACLG,EAAIE,CAAG,EACPD,EAAIC,CAAG,CACT,EAEKD,EAAIC,CAAG,IAAMF,EAAIE,CAAG,CAC5B,CACH,EAEaC,EAAgB,CAACC,EAAiBC,IAAsB,CACnE,GAAI,CAACR,EAASO,EAAQC,CAAQ,EAC5B,MAAM,MACJ;AAAA,EAAY,KAAK,UAAUA,CAAQ,CAAC;AAAA;AAAA,EAAuB,KAAK,UAAUD,CAAM,CAAC,EACnF,CACJ","names":["isSubset","superObj","subObj","sup","sub","ele","assertMatches","actual","expected"]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-YKICRTHH.mjs.map
@@ -1 +0,0 @@
1
- "use strict";//# sourceMappingURL=chunk-Z7EDILIO.js.map