@event-driven-io/emmett-postgresql 0.12.1 → 0.14.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 (144) hide show
  1. package/dist/chunk-2452BJTJ.js +1 -0
  2. package/dist/chunk-45ODDXOQ.mjs +1 -0
  3. package/dist/chunk-7PVUE3OV.mjs +2 -0
  4. package/dist/chunk-7PVUE3OV.mjs.map +1 -0
  5. package/dist/chunk-BBOP347O.mjs +2 -0
  6. package/dist/chunk-BBOP347O.mjs.map +1 -0
  7. package/dist/{chunk-5U7HYDY6.mjs → chunk-COTRMVOL.mjs} +8 -8
  8. package/dist/chunk-COTRMVOL.mjs.map +1 -0
  9. package/dist/chunk-D5T7G7UL.mjs +4 -0
  10. package/dist/chunk-D5T7G7UL.mjs.map +1 -0
  11. package/dist/chunk-E56AUXA3.mjs +2 -0
  12. package/dist/chunk-E56AUXA3.mjs.map +1 -0
  13. package/dist/{chunk-Z67RDRQW.js → chunk-EEYVFO3G.js} +12 -12
  14. package/dist/chunk-EEYVFO3G.js.map +1 -0
  15. package/dist/chunk-EMFXYVCK.js +2 -0
  16. package/dist/chunk-EMFXYVCK.js.map +1 -0
  17. package/dist/chunk-ICKSIW7K.js +2 -0
  18. package/dist/chunk-ICKSIW7K.js.map +1 -0
  19. package/dist/{chunk-GQQPVQW3.js → chunk-KADY7IHM.js} +4 -4
  20. package/dist/chunk-KADY7IHM.js.map +1 -0
  21. package/dist/{chunk-TMR7LHTX.js → chunk-P36ZOB2E.js} +3 -3
  22. package/dist/chunk-P36ZOB2E.js.map +1 -0
  23. package/dist/chunk-QHCLGPQG.mjs +2 -0
  24. package/dist/chunk-QHCLGPQG.mjs.map +1 -0
  25. package/dist/chunk-S6NGBYJW.js +2 -0
  26. package/dist/chunk-S6NGBYJW.js.map +1 -0
  27. package/dist/{chunk-DRZRZGSJ.mjs → chunk-UWD6GOZC.mjs} +2 -2
  28. package/dist/chunk-UWD6GOZC.mjs.map +1 -0
  29. package/dist/chunk-XQZVOI6W.js +2 -0
  30. package/dist/chunk-XQZVOI6W.js.map +1 -0
  31. package/dist/eventStore/index.d.mts +2 -2
  32. package/dist/eventStore/index.d.ts +2 -2
  33. package/dist/eventStore/index.js +1 -1
  34. package/dist/eventStore/index.mjs +1 -1
  35. package/dist/eventStore/postgreSQLEventStore.d.mts +3 -6
  36. package/dist/eventStore/postgreSQLEventStore.d.ts +3 -6
  37. package/dist/eventStore/postgreSQLEventStore.js +1 -1
  38. package/dist/eventStore/postgreSQLEventStore.mjs +1 -1
  39. package/dist/eventStore/projections/index.d.mts +3 -0
  40. package/dist/eventStore/projections/index.d.ts +3 -0
  41. package/dist/eventStore/projections/index.js +2 -0
  42. package/dist/eventStore/projections/index.mjs +2 -0
  43. package/dist/eventStore/projections/pongo.d.mts +17 -0
  44. package/dist/eventStore/projections/pongo.d.ts +17 -0
  45. package/dist/eventStore/projections/pongo.js +2 -0
  46. package/dist/eventStore/projections/pongo.js.map +1 -0
  47. package/dist/eventStore/projections/pongo.mjs +2 -0
  48. package/dist/eventStore/projections/pongo.mjs.map +1 -0
  49. package/dist/eventStore/schema/appendToStream.d.mts +7 -6
  50. package/dist/eventStore/schema/appendToStream.d.ts +7 -6
  51. package/dist/eventStore/schema/appendToStream.js +1 -1
  52. package/dist/eventStore/schema/appendToStream.mjs +1 -1
  53. package/dist/eventStore/schema/index.d.mts +1 -1
  54. package/dist/eventStore/schema/index.d.ts +1 -1
  55. package/dist/eventStore/schema/index.js +1 -1
  56. package/dist/eventStore/schema/index.mjs +1 -1
  57. package/dist/eventStore/schema/readStream.js +1 -1
  58. package/dist/eventStore/schema/readStream.mjs +1 -1
  59. package/dist/eventStore/schema/tables.d.mts +12 -13
  60. package/dist/eventStore/schema/tables.d.ts +12 -13
  61. package/dist/eventStore/schema/tables.js +1 -1
  62. package/dist/eventStore/schema/tables.mjs +1 -1
  63. package/dist/index.d.mts +3 -6
  64. package/dist/index.d.ts +3 -6
  65. package/dist/index.js +1 -1
  66. package/dist/index.mjs +1 -1
  67. package/dist/postgreSQLEventStore-B7GlXfis.d.mts +28 -0
  68. package/dist/postgreSQLEventStore-B7GlXfis.d.ts +28 -0
  69. package/package.json +5 -3
  70. package/dist/chunk-4ZQCCOS3.js +0 -12
  71. package/dist/chunk-4ZQCCOS3.js.map +0 -1
  72. package/dist/chunk-5U7HYDY6.mjs.map +0 -1
  73. package/dist/chunk-7K6TUMXZ.mjs +0 -4
  74. package/dist/chunk-7K6TUMXZ.mjs.map +0 -1
  75. package/dist/chunk-C6E7NEXU.js +0 -2
  76. package/dist/chunk-C6E7NEXU.js.map +0 -1
  77. package/dist/chunk-DRZRZGSJ.mjs.map +0 -1
  78. package/dist/chunk-FYXDBZNT.mjs +0 -12
  79. package/dist/chunk-FYXDBZNT.mjs.map +0 -1
  80. package/dist/chunk-GB5VCDBF.js +0 -2
  81. package/dist/chunk-GB5VCDBF.js.map +0 -1
  82. package/dist/chunk-GQQPVQW3.js.map +0 -1
  83. package/dist/chunk-GR4YFDV5.mjs +0 -1
  84. package/dist/chunk-HIATDE4Q.mjs +0 -1
  85. package/dist/chunk-HIATDE4Q.mjs.map +0 -1
  86. package/dist/chunk-HUB7W7J3.js +0 -1
  87. package/dist/chunk-HZQ46ED2.mjs +0 -2
  88. package/dist/chunk-HZQ46ED2.mjs.map +0 -1
  89. package/dist/chunk-IX2XL3S5.mjs +0 -2
  90. package/dist/chunk-IX2XL3S5.mjs.map +0 -1
  91. package/dist/chunk-IZW7N6BP.js +0 -2
  92. package/dist/chunk-IZW7N6BP.js.map +0 -1
  93. package/dist/chunk-MERDQHBQ.js +0 -1
  94. package/dist/chunk-MERDQHBQ.js.map +0 -1
  95. package/dist/chunk-MLVVMWHF.mjs +0 -2
  96. package/dist/chunk-MLVVMWHF.mjs.map +0 -1
  97. package/dist/chunk-N4I2XRJV.js +0 -2
  98. package/dist/chunk-N4I2XRJV.js.map +0 -1
  99. package/dist/chunk-QQC5YC26.mjs +0 -2
  100. package/dist/chunk-QQC5YC26.mjs.map +0 -1
  101. package/dist/chunk-TMR7LHTX.js.map +0 -1
  102. package/dist/chunk-VP4QNFWT.js +0 -2
  103. package/dist/chunk-VP4QNFWT.js.map +0 -1
  104. package/dist/chunk-YCS26XB2.mjs +0 -2
  105. package/dist/chunk-YCS26XB2.mjs.map +0 -1
  106. package/dist/chunk-Z67RDRQW.js.map +0 -1
  107. package/dist/connections/client.d.mts +0 -9
  108. package/dist/connections/client.d.ts +0 -9
  109. package/dist/connections/client.js +0 -2
  110. package/dist/connections/client.js.map +0 -1
  111. package/dist/connections/client.mjs +0 -2
  112. package/dist/connections/client.mjs.map +0 -1
  113. package/dist/connections/index.d.mts +0 -3
  114. package/dist/connections/index.d.ts +0 -3
  115. package/dist/connections/index.js +0 -2
  116. package/dist/connections/index.mjs +0 -2
  117. package/dist/connections/pool.d.mts +0 -7
  118. package/dist/connections/pool.d.ts +0 -7
  119. package/dist/connections/pool.js +0 -2
  120. package/dist/connections/pool.js.map +0 -1
  121. package/dist/connections/pool.mjs +0 -2
  122. package/dist/connections/pool.mjs.map +0 -1
  123. package/dist/execute/index.d.mts +0 -22
  124. package/dist/execute/index.d.ts +0 -22
  125. package/dist/execute/index.js +0 -2
  126. package/dist/execute/index.js.map +0 -1
  127. package/dist/execute/index.mjs +0 -2
  128. package/dist/execute/index.mjs.map +0 -1
  129. package/dist/sql/index.d.mts +0 -14
  130. package/dist/sql/index.d.ts +0 -14
  131. package/dist/sql/index.js +0 -2
  132. package/dist/sql/index.js.map +0 -1
  133. package/dist/sql/index.mjs +0 -2
  134. package/dist/sql/index.mjs.map +0 -1
  135. package/dist/sql/schema.d.mts +0 -2
  136. package/dist/sql/schema.d.ts +0 -2
  137. package/dist/sql/schema.js +0 -2
  138. package/dist/sql/schema.js.map +0 -1
  139. package/dist/sql/schema.mjs +0 -2
  140. package/dist/sql/schema.mjs.map +0 -1
  141. /package/dist/{chunk-HUB7W7J3.js.map → chunk-2452BJTJ.js.map} +0 -0
  142. /package/dist/{chunk-GR4YFDV5.mjs.map → chunk-45ODDXOQ.mjs.map} +0 -0
  143. /package/dist/{connections → eventStore/projections}/index.js.map +0 -0
  144. /package/dist/{connections → eventStore/projections}/index.mjs.map +0 -0
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var n=class extends Error{constructor(t){super(`Cannot parse! ${t}`)}},i= exports.a ={stringify:(t,e)=>JSON.stringify(_optionalChain([e, 'optionalAccess', _ => _.map])?e.map(t):t,(r,a)=>typeof a=="bigint"?a.toString():a),parse:(t,e)=>{let r=JSON.parse(t,_optionalChain([e, 'optionalAccess', _2 => _2.reviver]));if(_optionalChain([e, 'optionalAccess', _3 => _3.typeCheck])&&!_optionalChain([e, 'optionalAccess', _4 => _4.typeCheck, 'call', _5 => _5(r)]))throw new n(t);return _optionalChain([e, 'optionalAccess', _6 => _6.map])?e.map(r):r}};var g=(t,e,r)=>({type:t,data:e,metadata:r});var l=(t=>(t.NOT_A_NONEMPTY_STRING="NOT_A_NONEMPTY_STRING",t.NOT_A_POSITIVE_NUMBER="NOT_A_POSITIVE_NUMBER",t.NOT_AN_UNSIGNED_BIGINT="NOT_AN_UNSIGNED_BIGINT",t))(l||{}),c=t=>typeof t=="number"&&t===t,m=t=>typeof t=="string";var s=class d extends Error{constructor(e){let r=e&&typeof e=="object"&&"errorCode"in e?e.errorCode:c(e)?e:500,a=e&&typeof e=="object"&&"message"in e?e.message:m(e)?e:`Error with status code '${r}' ocurred during Emmett processing`;super(a),this.errorCode=r,Object.setPrototypeOf(this,d.prototype)}},o=class f extends s{constructor(e,r,a){super({errorCode:412,message:_nullishCoalesce(a, () => (`Expected version ${r.toString()} does not match current ${_optionalChain([e, 'optionalAccess', _7 => _7.toString, 'call', _8 => _8()])}`))}),this.current=e,this.expected=r,Object.setPrototypeOf(this,f.prototype)}};var y="STREAM_EXISTS",u= exports.d ="STREAM_DOES_NOT_EXIST",p= exports.e ="NO_CONCURRENCY_CHECK";var w=class h extends o{constructor(e,r){super(_optionalChain([e, 'optionalAccess', _9 => _9.toString, 'call', _10 => _10()]),_optionalChain([r, 'optionalAccess', _11 => _11.toString, 'call', _12 => _12()])),Object.setPrototypeOf(this,h.prototype)}};var _asyncretry = require('async-retry'); var _asyncretry2 = _interopRequireDefault(_asyncretry);var _webstreamspolyfill = require('web-streams-polyfill');var _uuid = require('uuid');exports.a = i; exports.b = g; exports.c = y; exports.d = u; exports.e = p; exports.f = w;
2
+ //# sourceMappingURL=chunk-XQZVOI6W.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../emmett/src/serialization/json/JSONParser.ts","../../emmett/src/typing/event.ts","../../emmett/src/validation/index.ts","../../emmett/src/errors/index.ts","../../emmett/src/eventStore/expectedVersion.ts","../../emmett/src/streaming/restream.ts","../../emmett/src/eventStore/inMemoryEventStore.ts"],"names":["ParseError","text","JSONParser","value","options","_","v","parsed","event","type","data","metadata","ValidationErrors","isNumber","val","isString","EmmettError","_EmmettError","errorCode","message","ConcurrencyError","_ConcurrencyError","current","expected","STREAM_EXISTS","STREAM_DOES_NOT_EXIST","NO_CONCURRENCY_CHECK","ExpectedVersionConflictError","_ExpectedVersionConflictError","retry","TransformStream","randomUUID"],"mappings":"AAAO,IAAMA,EAAN,cAAyB,KAAM,CACpC,YAAYC,EAAc,CACxB,MAAM,iBAAiBA,CAAI,EAAE,CAC/B,CACF,EA0BaC,EAAa,CACxB,UAAW,CACTC,EACAC,IAEO,KAAK,UACVA,GAAS,IAAMA,EAAQ,IAAID,CAA6B,EAAIA,EAG5D,CAACE,EAAGC,IAAO,OAAOA,GAAM,SAAWA,EAAE,SAAS,EAAIA,CACpD,EAEF,MAAO,CACLL,EACAG,IACmB,CACnB,IAAMG,EAAkB,KAAK,MAAMN,EAAMG,GAAS,OAAO,EAEzD,GAAIA,GAAS,WAAa,CAACA,GAAS,UAAcG,CAAM,EACtD,MAAM,IAAIP,EAAWC,CAAI,EAE3B,OAAOG,GAAS,IACZA,EAAQ,IAAIG,CAA8B,EACzCA,CACP,CACF,EC1BO,IAAMC,EAAQ,CACnBC,EACAC,EACAC,KAMO,CACL,KAAAF,EACA,KAAAC,EACA,SAAAC,CACF,GCxCK,IAAWC,GAAAA,IAChBA,EAAA,sBAAwB,wBACxBA,EAAA,sBAAwB,wBACxBA,EAAA,uBAAyB,yBAHTA,IAAAA,GAAA,CAAA,CAAA,EAMLC,EAAYC,GACvB,OAAOA,GAAQ,UAAYA,IAAQA,EAExBC,EAAYD,GACvB,OAAOA,GAAQ,SCLV,IAcME,EAAN,MAAMC,UAAoB,KAAM,CAC9B,UAEP,YACEb,EACA,CACA,IAAMc,EACJd,GAAW,OAAOA,GAAY,UAAY,cAAeA,EACrDA,EAAQ,UACRS,EAAST,CAAO,EACdA,EACA,IACFe,EACJf,GAAW,OAAOA,GAAY,UAAY,YAAaA,EACnDA,EAAQ,QACRW,EAASX,CAAO,EACdA,EACA,2BAA2Bc,CAAS,qCAE5C,MAAMC,CAAO,EACb,KAAK,UAAYD,EAGjB,OAAO,eAAe,KAAMD,EAAY,SAAS,CACnD,CACF,EAEaG,EAAN,MAAMC,UAAyBL,CAAY,CAChD,YACSM,EACAC,EACPJ,EACA,CACA,MAAM,CACJ,UAAW,IACX,QACEA,GACA,oBAAoBI,EAAS,SAAS,CAAC,2BAA2BD,GAAS,SAAS,CAAC,EACzF,CAAC,EATM,KAAA,QAAAA,EACA,KAAA,SAAAC,EAWP,OAAO,eAAe,KAAMF,EAAiB,SAAS,CACxD,CACF,EC/CO,IAAMG,EAAgB,gBAChBC,EACX,wBACWC,EACX,uBAJK,IAiCMC,EAAN,MAAMC,UAEHR,CAAiB,CACzB,YACEE,EACAC,EACA,CACA,MAAMD,GAAS,SAAS,EAAGC,GAAU,SAAS,CAAC,EAG/C,OAAO,eAAe,KAAMK,EAA6B,SAAS,CACpE,CACF,EC9DA,OAAOC,MAAW,cAClB,OAGE,mBAAAC,MAEK,uBCNP,OAAS,MAAMC,OAAkB","sourcesContent":["export class ParseError extends Error {\n constructor(text: string) {\n super(`Cannot parse! ${text}`);\n }\n}\n\nexport type Mapper<From, To = From> =\n | ((value: unknown) => To)\n | ((value: Partial<From>) => To)\n | ((value: From) => To)\n | ((value: Partial<To>) => To)\n | ((value: To) => To)\n | ((value: Partial<To | From>) => To)\n | ((value: To | From) => To);\n\nexport type MapperArgs<From, To = From> = Partial<From> &\n From &\n Partial<To> &\n To;\n\nexport type ParseOptions<From, To = From> = {\n reviver?: (key: string, value: unknown) => unknown;\n map?: Mapper<From, To>;\n typeCheck?: <To>(value: unknown) => value is To;\n};\n\nexport type StringifyOptions<From, To = From> = {\n map?: Mapper<From, To>;\n};\n\nexport const JSONParser = {\n stringify: <From, To = From>(\n value: From,\n options?: StringifyOptions<From, To>,\n ) => {\n return JSON.stringify(\n options?.map ? options.map(value as MapperArgs<From, To>) : value,\n //TODO: Consider adding support to DateTime and adding specific format to mark that's a bigint\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n (_, v) => (typeof v === 'bigint' ? v.toString() : v),\n );\n },\n parse: <From, To = From>(\n text: string,\n options?: ParseOptions<From, To>,\n ): To | undefined => {\n const parsed: unknown = JSON.parse(text, options?.reviver);\n\n if (options?.typeCheck && !options?.typeCheck<To>(parsed))\n throw new ParseError(text);\n\n return options?.map\n ? options.map(parsed as MapperArgs<From, To>)\n : (parsed as To | undefined);\n },\n};\n","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\nexport type ReadEvent<\n EventType extends Event = Event,\n EventMetaDataType extends EventMetaDataOf<EventType> &\n ReadEventMetadata = EventMetaDataOf<EventType> & ReadEventMetadata,\n> = CreateEventType<\n EventTypeOf<EventType>,\n EventDataOf<EventType>,\n EventMetaDataType\n> &\n EventType & { metadata: EventMetaDataType };\n\nexport type ReadEventMetadata = Readonly<{\n eventId: string;\n streamPosition: bigint;\n streamName: string;\n}>;\n\nexport type ReadEventMetadataWithGlobalPosition = ReadEventMetadata & {\n globalPosition: bigint;\n};\n","import { ValidationError } from '../errors';\n\nexport const enum ValidationErrors {\n NOT_A_NONEMPTY_STRING = 'NOT_A_NONEMPTY_STRING',\n NOT_A_POSITIVE_NUMBER = 'NOT_A_POSITIVE_NUMBER',\n NOT_AN_UNSIGNED_BIGINT = 'NOT_AN_UNSIGNED_BIGINT',\n}\n\nexport const isNumber = (val: unknown): val is number =>\n typeof val === 'number' && val === val;\n\nexport const isString = (val: unknown): val is string =>\n typeof val === 'string';\n\nexport const assertNotEmptyString = (value: unknown): string => {\n if (!isString(value) || value.length === 0) {\n throw new ValidationError(ValidationErrors.NOT_A_NONEMPTY_STRING);\n }\n return value;\n};\n\nexport const assertPositiveNumber = (value: unknown): number => {\n if (!isNumber(value) || value <= 0) {\n throw new ValidationError(ValidationErrors.NOT_A_POSITIVE_NUMBER);\n }\n return value;\n};\n\nexport const assertUnsignedBigInt = (value: string): bigint => {\n const number = BigInt(value);\n if (number < 0) {\n throw new ValidationError(ValidationErrors.NOT_AN_UNSIGNED_BIGINT);\n }\n return number;\n};\n\nexport * from './dates';\n","import { isNumber, isString } from '../validation';\n\nexport type ErrorConstructor<ErrorType extends Error> = new (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...args: any[]\n) => ErrorType;\n\nexport const isErrorConstructor = <ErrorType extends Error>(\n // eslint-disable-next-line @typescript-eslint/ban-types\n expect: Function,\n): expect is ErrorConstructor<ErrorType> => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return (\n typeof expect === 'function' &&\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n expect.prototype &&\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n expect.prototype.constructor === expect\n );\n};\n\nexport class EmmettError extends Error {\n public errorCode: number;\n\n constructor(\n options?: { errorCode: number; message?: string } | string | number,\n ) {\n const errorCode =\n options && typeof options === 'object' && 'errorCode' in options\n ? options.errorCode\n : isNumber(options)\n ? options\n : 500;\n const message =\n options && typeof options === 'object' && 'message' in options\n ? options.message\n : isString(options)\n ? options\n : `Error with status code '${errorCode}' ocurred during Emmett processing`;\n\n super(message);\n this.errorCode = errorCode;\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, EmmettError.prototype);\n }\n}\n\nexport class ConcurrencyError extends EmmettError {\n constructor(\n public current: string | undefined,\n public expected: string,\n message?: string,\n ) {\n super({\n errorCode: 412,\n message:\n message ??\n `Expected version ${expected.toString()} does not match current ${current?.toString()}`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, ConcurrencyError.prototype);\n }\n}\n\nexport class ValidationError extends EmmettError {\n constructor(message?: string) {\n super({\n errorCode: 400,\n message: message ?? `Validation Error ocurred during Emmett processing`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n\nexport class IllegalStateError extends EmmettError {\n constructor(message?: string) {\n super({\n errorCode: 403,\n message: message ?? `Illegal State ocurred during Emmett processing`,\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, IllegalStateError.prototype);\n }\n}\n\nexport class NotFoundError extends EmmettError {\n constructor(options?: { id: string; type: string; message?: string }) {\n super({\n errorCode: 404,\n message:\n options?.message ??\n (options?.id\n ? options.type\n ? `${options.type} with ${options.id} was not found during Emmett processing`\n : `State with ${options.id} was not found during Emmett processing`\n : options?.type\n ? `${options.type} was not found during Emmett processing`\n : 'State was not found during Emmett processing'),\n });\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, NotFoundError.prototype);\n }\n}\n","import { ConcurrencyError } from '../errors';\nimport type { Flavour } from '../typing';\nimport type { DefaultStreamVersionType } from './eventStore';\n\nexport type ExpectedStreamVersion<VersionType = DefaultStreamVersionType> =\n | ExpectedStreamVersionWithValue<VersionType>\n | ExpectedStreamVersionGeneral;\n\nexport type ExpectedStreamVersionWithValue<\n VersionType = DefaultStreamVersionType,\n> = Flavour<VersionType, 'StreamVersion'>;\n\nexport type ExpectedStreamVersionGeneral = Flavour<\n 'STREAM_EXISTS' | 'STREAM_DOES_NOT_EXIST' | 'NO_CONCURRENCY_CHECK',\n 'StreamVersion'\n>;\n\nexport const STREAM_EXISTS = 'STREAM_EXISTS' as ExpectedStreamVersionGeneral;\nexport const STREAM_DOES_NOT_EXIST =\n 'STREAM_DOES_NOT_EXIST' as ExpectedStreamVersionGeneral;\nexport const NO_CONCURRENCY_CHECK =\n 'NO_CONCURRENCY_CHECK' as ExpectedStreamVersionGeneral;\n\nexport const matchesExpectedVersion = <\n StreamVersion = DefaultStreamVersionType,\n>(\n current: StreamVersion | undefined,\n expected: ExpectedStreamVersion<StreamVersion>,\n): boolean => {\n if (expected === NO_CONCURRENCY_CHECK) return true;\n\n if (expected == STREAM_DOES_NOT_EXIST) return current === undefined;\n\n if (expected == STREAM_EXISTS) return current !== undefined;\n\n return current === expected;\n};\n\nexport const assertExpectedVersionMatchesCurrent = <\n StreamVersion = DefaultStreamVersionType,\n>(\n current: StreamVersion | undefined,\n expected: ExpectedStreamVersion<StreamVersion> | undefined,\n): void => {\n expected ??= NO_CONCURRENCY_CHECK;\n\n if (!matchesExpectedVersion(current, expected))\n throw new ExpectedVersionConflictError(current, expected);\n};\n\nexport class ExpectedVersionConflictError<\n VersionType = DefaultStreamVersionType,\n> extends ConcurrencyError {\n constructor(\n current: VersionType | undefined,\n expected: ExpectedStreamVersion<VersionType>,\n ) {\n super(current?.toString(), expected?.toString());\n\n // 👇️ because we are extending a built-in class\n Object.setPrototypeOf(this, ExpectedVersionConflictError.prototype);\n }\n}\n","import retry from 'async-retry';\nimport {\n ReadableStream,\n ReadableStreamDefaultReader,\n TransformStream,\n TransformStreamDefaultController,\n} from 'web-streams-polyfill';\nimport type { Decoder } from './decoders';\nimport { DefaultDecoder } from './decoders/composite';\n\nexport const restream = <\n Source = unknown,\n Transformed = Source,\n StreamType = object,\n>(\n createSourceStream: () => ReadableStream<StreamType>,\n transform: (input: Source) => Transformed = (source) =>\n source as unknown as Transformed,\n retryOptions: retry.Options = { forever: true, minTimeout: 25 },\n decoder: Decoder<StreamType, Source> = new DefaultDecoder<Source>(),\n): ReadableStream<Transformed> =>\n new TransformStream<Source, Transformed>({\n start(controller) {\n retry(\n () => onRestream(createSourceStream, controller, transform, decoder),\n retryOptions,\n ).catch((error) => {\n controller.error(error);\n });\n },\n }).readable;\n\nconst onRestream = async <StreamType, Source, Transformed = Source>(\n createSourceStream: () => ReadableStream<StreamType>,\n controller: TransformStreamDefaultController<Transformed>,\n transform: (input: Source) => Transformed,\n decoder: Decoder<StreamType, Source>,\n): Promise<void> => {\n const sourceStream = createSourceStream();\n const reader = sourceStream.getReader();\n try {\n let done: boolean;\n\n do {\n done = await restreamChunk(reader, controller, transform, decoder);\n } while (!done);\n } finally {\n reader.releaseLock();\n }\n};\n\nconst restreamChunk = async <StreamType, Source, Transformed = Source>(\n reader: ReadableStreamDefaultReader<StreamType>,\n controller: TransformStreamDefaultController<Transformed>,\n transform: (input: Source) => Transformed,\n decoder: Decoder<StreamType, Source>,\n): Promise<boolean> => {\n const { done: isDone, value } = await reader.read();\n\n if (value) decoder.addToBuffer(value);\n\n if (!isDone && !decoder.hasCompleteMessage()) return false;\n\n decodeAndTransform(decoder, transform, controller);\n\n if (isDone) {\n controller.terminate();\n }\n\n return isDone;\n};\n\nconst decodeAndTransform = <StreamType, Source, Transformed = Source>(\n decoder: Decoder<StreamType, Source>,\n transform: (input: Source) => Transformed,\n controller: TransformStreamDefaultController<Transformed>,\n) => {\n try {\n const decoded = decoder.decode();\n if (!decoded) return;\n\n const transformed = transform(decoded);\n controller.enqueue(transformed);\n } catch (error) {\n controller.error(new Error(`Decoding error: ${error?.toString()}`));\n }\n};\n","import { v4 as randomUUID } from 'uuid';\nimport type {\n Event,\n ReadEvent,\n ReadEventMetadataWithGlobalPosition,\n} from '../typing';\nimport {\n type AggregateStreamOptions,\n type AggregateStreamResult,\n type AppendToStreamOptions,\n type AppendToStreamResult,\n type DefaultStreamVersionType,\n type EventStore,\n type ReadStreamOptions,\n type ReadStreamResult,\n} from './eventStore';\nimport { assertExpectedVersionMatchesCurrent } from './expectedVersion';\n\nexport type EventHandler<E extends Event = Event> = (\n eventEnvelope: ReadEvent<E>,\n) => void;\n\nexport const getInMemoryEventStore = (): EventStore<\n DefaultStreamVersionType,\n ReadEventMetadataWithGlobalPosition\n> => {\n const streams = new Map<string, ReadEvent[]>();\n\n const getAllEventsCount = () => {\n return Array.from<ReadEvent[]>(streams.values())\n .map((s) => s.length)\n .reduce((p, c) => p + c, 0);\n };\n\n return {\n async aggregateStream<State, EventType extends Event>(\n streamName: string,\n options: AggregateStreamOptions<State, EventType>,\n ): Promise<AggregateStreamResult<State> | null> {\n const { evolve, initialState, read } = options;\n\n const result = await this.readStream<EventType>(streamName, read);\n\n if (!result) return null;\n\n const events = result?.events ?? [];\n\n return {\n currentStreamVersion: BigInt(events.length),\n state: events.reduce(evolve, initialState()),\n };\n },\n\n readStream: <EventType extends Event>(\n streamName: string,\n options?: ReadStreamOptions,\n ): Promise<\n ReadStreamResult<\n EventType,\n DefaultStreamVersionType,\n ReadEventMetadataWithGlobalPosition\n >\n > => {\n const events = streams.get(streamName);\n const currentStreamVersion = events ? BigInt(events.length) : undefined;\n\n assertExpectedVersionMatchesCurrent(\n currentStreamVersion,\n options?.expectedStreamVersion,\n );\n\n const from = Number(options && 'from' in options ? options.from : 0);\n const to = Number(\n options && 'to' in options\n ? options.to\n : options && 'maxCount' in options && options.maxCount\n ? options.from + options.maxCount\n : events?.length ?? 1,\n );\n\n const resultEvents =\n events && events.length > 0\n ? events\n .map(\n (e) =>\n e as ReadEvent<\n EventType,\n ReadEventMetadataWithGlobalPosition\n >,\n )\n .slice(from, to)\n : [];\n\n const result: ReadStreamResult<\n EventType,\n DefaultStreamVersionType,\n ReadEventMetadataWithGlobalPosition\n > =\n events && events.length > 0\n ? {\n currentStreamVersion: currentStreamVersion!,\n events: resultEvents,\n }\n : null;\n\n return Promise.resolve(result);\n },\n\n appendToStream: <EventType extends Event>(\n streamName: string,\n events: EventType[],\n options?: AppendToStreamOptions,\n ): Promise<AppendToStreamResult> => {\n const currentEvents = streams.get(streamName) ?? [];\n const currentStreamVersion =\n currentEvents.length > 0 ? BigInt(currentEvents.length) : undefined;\n\n assertExpectedVersionMatchesCurrent(\n currentStreamVersion,\n options?.expectedStreamVersion,\n );\n\n const eventEnvelopes: ReadEvent<\n EventType,\n ReadEventMetadataWithGlobalPosition\n >[] = events.map((event, index) => {\n return {\n ...event,\n metadata: {\n ...(event.metadata ?? {}),\n streamName,\n eventId: randomUUID(),\n streamPosition: BigInt(currentEvents.length + index + 1),\n globalPosition: BigInt(getAllEventsCount() + index + 1),\n },\n };\n });\n\n const positionOfLastEventInTheStream = BigInt(\n eventEnvelopes.slice(-1)[0]!.metadata.streamPosition,\n );\n\n streams.set(streamName, [...currentEvents, ...eventEnvelopes]);\n\n const result: AppendToStreamResult = {\n nextExpectedStreamVersion: positionOfLastEventInTheStream,\n };\n\n return Promise.resolve(result);\n },\n };\n};\n"]}
@@ -1,4 +1,4 @@
1
- export { getPostgreSQLEventStore } from './postgreSQLEventStore.mjs';
1
+ export { P as PostgresEventStore, a as PostgresEventStoreOptions, c as PostgresProjectionHandler, d as ProjectionDefintion, b as ProjectionHandlerContext, e as defaultProjectionOptions, g as getPostgreSQLEventStore, h as handleProjections, i as inlineProjection, p as projection } from '../postgreSQLEventStore-B7GlXfis.mjs';
2
2
  export { createEventStoreSchema, schemaSQL } from './schema/index.mjs';
3
3
  export { appendEventsSQL, appendToStream } from './schema/appendToStream.mjs';
4
4
  export { readStream } from './schema/readStream.mjs';
@@ -6,4 +6,4 @@ export { addDefaultPartition, addEventsPartitions, addModuleForAllTenantsSQL, ad
6
6
  export { defaultTag, emmettPrefix, eventsTable, globalNames, globalTag, streamsTable } from './schema/typing.mjs';
7
7
  import '@event-driven-io/emmett';
8
8
  import 'pg';
9
- import '../sql/index.mjs';
9
+ import '@event-driven-io/dumbo';
@@ -1,4 +1,4 @@
1
- export { getPostgreSQLEventStore } from './postgreSQLEventStore.js';
1
+ export { P as PostgresEventStore, a as PostgresEventStoreOptions, c as PostgresProjectionHandler, d as ProjectionDefintion, b as ProjectionHandlerContext, e as defaultProjectionOptions, g as getPostgreSQLEventStore, h as handleProjections, i as inlineProjection, p as projection } from '../postgreSQLEventStore-B7GlXfis.js';
2
2
  export { createEventStoreSchema, schemaSQL } from './schema/index.js';
3
3
  export { appendEventsSQL, appendToStream } from './schema/appendToStream.js';
4
4
  export { readStream } from './schema/readStream.js';
@@ -6,4 +6,4 @@ export { addDefaultPartition, addEventsPartitions, addModuleForAllTenantsSQL, ad
6
6
  export { defaultTag, emmettPrefix, eventsTable, globalNames, globalTag, streamsTable } from './schema/typing.js';
7
7
  import '@event-driven-io/emmett';
8
8
  import 'pg';
9
- import '../sql/index.js';
9
+ import '@event-driven-io/dumbo';
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-MERDQHBQ.js');var _chunkGB5VCDBFjs = require('../chunk-GB5VCDBF.js');var _chunkN4I2XRJVjs = require('../chunk-N4I2XRJV.js');var _chunkGQQPVQW3js = require('../chunk-GQQPVQW3.js');var _chunkTMR7LHTXjs = require('../chunk-TMR7LHTX.js');var _chunkZ67RDRQWjs = require('../chunk-Z67RDRQW.js');var _chunkSS2LQM3Bjs = require('../chunk-SS2LQM3B.js');require('../chunk-4ZQCCOS3.js');require('../chunk-IZW7N6BP.js');exports.addDefaultPartition = _chunkZ67RDRQWjs.k; exports.addEventsPartitions = _chunkZ67RDRQWjs.f; exports.addModuleForAllTenantsSQL = _chunkZ67RDRQWjs.i; exports.addModuleSQL = _chunkZ67RDRQWjs.g; exports.addTablePartitions = _chunkZ67RDRQWjs.e; exports.addTenantForAllModulesSQL = _chunkZ67RDRQWjs.j; exports.addTenantSQL = _chunkZ67RDRQWjs.h; exports.appendEventsSQL = _chunkGQQPVQW3js.a; exports.appendToStream = _chunkGQQPVQW3js.b; exports.createEventStoreSchema = _chunkN4I2XRJVjs.b; exports.defaultTag = _chunkSS2LQM3Bjs.c; exports.emmettPrefix = _chunkSS2LQM3Bjs.a; exports.eventsTable = _chunkSS2LQM3Bjs.f; exports.eventsTableSQL = _chunkZ67RDRQWjs.b; exports.getPostgreSQLEventStore = _chunkGB5VCDBFjs.a; exports.globalNames = _chunkSS2LQM3Bjs.d; exports.globalTag = _chunkSS2LQM3Bjs.b; exports.readStream = _chunkTMR7LHTXjs.a; exports.sanitizeNameSQL = _chunkZ67RDRQWjs.d; exports.schemaSQL = _chunkN4I2XRJVjs.a; exports.streamsTable = _chunkSS2LQM3Bjs.e; exports.streamsTableSQL = _chunkZ67RDRQWjs.a; exports.subscriptionsTableSQL = _chunkZ67RDRQWjs.c;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-2452BJTJ.js');var _chunkICKSIW7Kjs = require('../chunk-ICKSIW7K.js');var _chunkS6NGBYJWjs = require('../chunk-S6NGBYJW.js');var _chunkEMFXYVCKjs = require('../chunk-EMFXYVCK.js');var _chunkEEYVFO3Gjs = require('../chunk-EEYVFO3G.js');var _chunkKADY7IHMjs = require('../chunk-KADY7IHM.js');var _chunkP36ZOB2Ejs = require('../chunk-P36ZOB2E.js');var _chunkSS2LQM3Bjs = require('../chunk-SS2LQM3B.js');require('../chunk-XQZVOI6W.js');exports.addDefaultPartition = _chunkEEYVFO3Gjs.k; exports.addEventsPartitions = _chunkEEYVFO3Gjs.f; exports.addModuleForAllTenantsSQL = _chunkEEYVFO3Gjs.i; exports.addModuleSQL = _chunkEEYVFO3Gjs.g; exports.addTablePartitions = _chunkEEYVFO3Gjs.e; exports.addTenantForAllModulesSQL = _chunkEEYVFO3Gjs.j; exports.addTenantSQL = _chunkEEYVFO3Gjs.h; exports.appendEventsSQL = _chunkKADY7IHMjs.a; exports.appendToStream = _chunkKADY7IHMjs.b; exports.createEventStoreSchema = _chunkEMFXYVCKjs.b; exports.defaultProjectionOptions = _chunkS6NGBYJWjs.a; exports.defaultTag = _chunkSS2LQM3Bjs.c; exports.emmettPrefix = _chunkSS2LQM3Bjs.a; exports.eventsTable = _chunkSS2LQM3Bjs.f; exports.eventsTableSQL = _chunkEEYVFO3Gjs.b; exports.getPostgreSQLEventStore = _chunkICKSIW7Kjs.a; exports.globalNames = _chunkSS2LQM3Bjs.d; exports.globalTag = _chunkSS2LQM3Bjs.b; exports.handleProjections = _chunkS6NGBYJWjs.b; exports.inlineProjection = _chunkS6NGBYJWjs.d; exports.projection = _chunkS6NGBYJWjs.c; exports.readStream = _chunkP36ZOB2Ejs.a; exports.sanitizeNameSQL = _chunkEEYVFO3Gjs.d; exports.schemaSQL = _chunkEMFXYVCKjs.a; exports.streamsTable = _chunkSS2LQM3Bjs.e; exports.streamsTableSQL = _chunkEEYVFO3Gjs.a; exports.subscriptionsTableSQL = _chunkEEYVFO3Gjs.c;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import"../chunk-HIATDE4Q.mjs";import{a as w}from"../chunk-YCS26XB2.mjs";import{a as u,b as v}from"../chunk-HZQ46ED2.mjs";import{a as g,b as h}from"../chunk-5U7HYDY6.mjs";import{a as t}from"../chunk-7K6TUMXZ.mjs";import{a as i,b as j,c as k,d as l,e as m,f as n,g as o,h as p,i as q,j as r,k as s}from"../chunk-DRZRZGSJ.mjs";import{a,b,c,d,e,f}from"../chunk-ABNBEUC6.mjs";import"../chunk-FYXDBZNT.mjs";import"../chunk-MLVVMWHF.mjs";export{s as addDefaultPartition,n as addEventsPartitions,q as addModuleForAllTenantsSQL,o as addModuleSQL,m as addTablePartitions,r as addTenantForAllModulesSQL,p as addTenantSQL,g as appendEventsSQL,h as appendToStream,v as createEventStoreSchema,c as defaultTag,a as emmettPrefix,f as eventsTable,j as eventsTableSQL,w as getPostgreSQLEventStore,d as globalNames,b as globalTag,t as readStream,l as sanitizeNameSQL,u as schemaSQL,e as streamsTable,i as streamsTableSQL,k as subscriptionsTableSQL};
1
+ import"../chunk-45ODDXOQ.mjs";import{a as A}from"../chunk-7PVUE3OV.mjs";import{a,b,c,d}from"../chunk-BBOP347O.mjs";import{a as y,b as z}from"../chunk-QHCLGPQG.mjs";import{a as m,b as n,c as o,d as p,e as q,f as r,g as s,h as t,i as u,j as v,k as w}from"../chunk-UWD6GOZC.mjs";import{a as k,b as l}from"../chunk-COTRMVOL.mjs";import{a as x}from"../chunk-D5T7G7UL.mjs";import{a as e,b as f,c as g,d as h,e as i,f as j}from"../chunk-ABNBEUC6.mjs";import"../chunk-E56AUXA3.mjs";export{w as addDefaultPartition,r as addEventsPartitions,u as addModuleForAllTenantsSQL,s as addModuleSQL,q as addTablePartitions,v as addTenantForAllModulesSQL,t as addTenantSQL,k as appendEventsSQL,l as appendToStream,z as createEventStoreSchema,a as defaultProjectionOptions,g as defaultTag,e as emmettPrefix,j as eventsTable,n as eventsTableSQL,A as getPostgreSQLEventStore,h as globalNames,f as globalTag,b as handleProjections,d as inlineProjection,c as projection,x as readStream,p as sanitizeNameSQL,y as schemaSQL,i as streamsTable,m as streamsTableSQL,o as subscriptionsTableSQL};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,6 +1,3 @@
1
- import { EventStore, DefaultStreamVersionType, ReadEventMetadataWithGlobalPosition } from '@event-driven-io/emmett';
2
- import pg from 'pg';
3
-
4
- declare const getPostgreSQLEventStore: (pool: pg.Pool) => EventStore<DefaultStreamVersionType, ReadEventMetadataWithGlobalPosition>;
5
-
6
- export { getPostgreSQLEventStore };
1
+ import '@event-driven-io/emmett';
2
+ export { P as PostgresEventStore, a as PostgresEventStoreOptions, g as getPostgreSQLEventStore } from '../postgreSQLEventStore-B7GlXfis.mjs';
3
+ import 'pg';
@@ -1,6 +1,3 @@
1
- import { EventStore, DefaultStreamVersionType, ReadEventMetadataWithGlobalPosition } from '@event-driven-io/emmett';
2
- import pg from 'pg';
3
-
4
- declare const getPostgreSQLEventStore: (pool: pg.Pool) => EventStore<DefaultStreamVersionType, ReadEventMetadataWithGlobalPosition>;
5
-
6
- export { getPostgreSQLEventStore };
1
+ import '@event-driven-io/emmett';
2
+ export { P as PostgresEventStore, a as PostgresEventStoreOptions, g as getPostgreSQLEventStore } from '../postgreSQLEventStore-B7GlXfis.js';
3
+ import 'pg';
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGB5VCDBFjs = require('../chunk-GB5VCDBF.js');require('../chunk-N4I2XRJV.js');require('../chunk-GQQPVQW3.js');require('../chunk-TMR7LHTX.js');require('../chunk-Z67RDRQW.js');require('../chunk-SS2LQM3B.js');require('../chunk-4ZQCCOS3.js');require('../chunk-IZW7N6BP.js');exports.getPostgreSQLEventStore = _chunkGB5VCDBFjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkICKSIW7Kjs = require('../chunk-ICKSIW7K.js');require('../chunk-S6NGBYJW.js');require('../chunk-EMFXYVCK.js');require('../chunk-EEYVFO3G.js');require('../chunk-KADY7IHM.js');require('../chunk-P36ZOB2E.js');require('../chunk-SS2LQM3B.js');require('../chunk-XQZVOI6W.js');exports.getPostgreSQLEventStore = _chunkICKSIW7Kjs.a;
2
2
  //# sourceMappingURL=postgreSQLEventStore.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-YCS26XB2.mjs";import"../chunk-HZQ46ED2.mjs";import"../chunk-5U7HYDY6.mjs";import"../chunk-7K6TUMXZ.mjs";import"../chunk-DRZRZGSJ.mjs";import"../chunk-ABNBEUC6.mjs";import"../chunk-FYXDBZNT.mjs";import"../chunk-MLVVMWHF.mjs";export{a as getPostgreSQLEventStore};
1
+ import{a}from"../chunk-7PVUE3OV.mjs";import"../chunk-BBOP347O.mjs";import"../chunk-QHCLGPQG.mjs";import"../chunk-UWD6GOZC.mjs";import"../chunk-COTRMVOL.mjs";import"../chunk-D5T7G7UL.mjs";import"../chunk-ABNBEUC6.mjs";import"../chunk-E56AUXA3.mjs";export{a as getPostgreSQLEventStore};
2
2
  //# sourceMappingURL=postgreSQLEventStore.mjs.map
@@ -0,0 +1,3 @@
1
+ import '@event-driven-io/emmett';
2
+ import 'pg';
3
+ export { c as PostgresProjectionHandler, d as ProjectionDefintion, b as ProjectionHandlerContext, e as defaultProjectionOptions, h as handleProjections, i as inlineProjection, p as projection } from '../../postgreSQLEventStore-B7GlXfis.mjs';
@@ -0,0 +1,3 @@
1
+ import '@event-driven-io/emmett';
2
+ import 'pg';
3
+ export { c as PostgresProjectionHandler, d as ProjectionDefintion, b as ProjectionHandlerContext, e as defaultProjectionOptions, h as handleProjections, i as inlineProjection, p as projection } from '../../postgreSQLEventStore-B7GlXfis.js';
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkS6NGBYJWjs = require('../../chunk-S6NGBYJW.js');require('../../chunk-XQZVOI6W.js');exports.defaultProjectionOptions = _chunkS6NGBYJWjs.a; exports.handleProjections = _chunkS6NGBYJWjs.b; exports.inlineProjection = _chunkS6NGBYJWjs.d; exports.projection = _chunkS6NGBYJWjs.c;
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ import{a,b,c,d}from"../../chunk-BBOP347O.mjs";import"../../chunk-E56AUXA3.mjs";export{a as defaultProjectionOptions,b as handleProjections,d as inlineProjection,c as projection};
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,17 @@
1
+ import { Event, ReadEvent, EventTypeOf } from '@event-driven-io/emmett';
2
+ import { PongoDocument, PongoClient } from '@event-driven-io/pongo';
3
+ import pg from 'pg';
4
+ import { d as ProjectionDefintion } from '../../postgreSQLEventStore-B7GlXfis.mjs';
5
+
6
+ type PongoProjectionOptions<EventType extends Event> = {
7
+ documentId: (event: ReadEvent<EventType>) => string;
8
+ eventHandler: PongoProjectionHandler<EventType>;
9
+ eventTypes: EventTypeOf<EventType>[];
10
+ };
11
+ type PongoProjectionHandler<EventType extends Event = Event> = (documentId: (event: ReadEvent<EventType>) => string, connectionString: string, client: pg.PoolClient, events: ReadEvent<EventType>[]) => Promise<void> | void;
12
+ type PongoDocumentEvolve<Document extends PongoDocument, EventType extends Event> = ((document: Document | null, event: ReadEvent<EventType>) => Document | null) | ((document: Document | null, event: ReadEvent<EventType>) => Promise<Document | null>);
13
+ declare const pongoProjection: <EventType extends Event>(handle: (pongo: PongoClient, events: ReadEvent<EventType>[]) => Promise<void>, ...canHandle: EventTypeOf<EventType>[]) => ProjectionDefintion;
14
+ declare const pongoMultiStreamProjection: <Document extends PongoDocument, EventType extends Event>(collectionName: string, getDocumentId: (event: ReadEvent<EventType>) => string, evolve: PongoDocumentEvolve<Document, EventType>, ...canHandle: EventTypeOf<EventType>[]) => ProjectionDefintion;
15
+ declare const pongoSingleProjection: <Document extends PongoDocument, EventType extends Event>(collectionName: string, evolve: PongoDocumentEvolve<Document, EventType>, ...canHandle: EventTypeOf<EventType>[]) => ProjectionDefintion;
16
+
17
+ export { type PongoDocumentEvolve, type PongoProjectionHandler, type PongoProjectionOptions, pongoMultiStreamProjection, pongoProjection, pongoSingleProjection };
@@ -0,0 +1,17 @@
1
+ import { Event, ReadEvent, EventTypeOf } from '@event-driven-io/emmett';
2
+ import { PongoDocument, PongoClient } from '@event-driven-io/pongo';
3
+ import pg from 'pg';
4
+ import { d as ProjectionDefintion } from '../../postgreSQLEventStore-B7GlXfis.js';
5
+
6
+ type PongoProjectionOptions<EventType extends Event> = {
7
+ documentId: (event: ReadEvent<EventType>) => string;
8
+ eventHandler: PongoProjectionHandler<EventType>;
9
+ eventTypes: EventTypeOf<EventType>[];
10
+ };
11
+ type PongoProjectionHandler<EventType extends Event = Event> = (documentId: (event: ReadEvent<EventType>) => string, connectionString: string, client: pg.PoolClient, events: ReadEvent<EventType>[]) => Promise<void> | void;
12
+ type PongoDocumentEvolve<Document extends PongoDocument, EventType extends Event> = ((document: Document | null, event: ReadEvent<EventType>) => Document | null) | ((document: Document | null, event: ReadEvent<EventType>) => Promise<Document | null>);
13
+ declare const pongoProjection: <EventType extends Event>(handle: (pongo: PongoClient, events: ReadEvent<EventType>[]) => Promise<void>, ...canHandle: EventTypeOf<EventType>[]) => ProjectionDefintion;
14
+ declare const pongoMultiStreamProjection: <Document extends PongoDocument, EventType extends Event>(collectionName: string, getDocumentId: (event: ReadEvent<EventType>) => string, evolve: PongoDocumentEvolve<Document, EventType>, ...canHandle: EventTypeOf<EventType>[]) => ProjectionDefintion;
15
+ declare const pongoSingleProjection: <Document extends PongoDocument, EventType extends Event>(collectionName: string, evolve: PongoDocumentEvolve<Document, EventType>, ...canHandle: EventTypeOf<EventType>[]) => ProjectionDefintion;
16
+
17
+ export { type PongoDocumentEvolve, type PongoProjectionHandler, type PongoProjectionOptions, pongoMultiStreamProjection, pongoProjection, pongoSingleProjection };
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkS6NGBYJWjs = require('../../chunk-S6NGBYJW.js');require('../../chunk-XQZVOI6W.js');var _pongo = require('@event-driven-io/pongo');require('pg');var m=(e,...n)=>_chunkS6NGBYJWjs.d.call(void 0, {canHandle:n,handle:async(t,o)=>{let{connectionString:v,client:i}=o,p=_pongo.pongoClient.call(void 0, v,{client:i});await e(p,t)}}),d= exports.pongoMultiStreamProjection =(e,n,t,...o)=>m(async(v,i)=>{let p=v.db().collection(e);for(let c of i)await p.handle(n(c),async r=>await t(r,c))},...o),P= exports.pongoSingleProjection =(e,n,...t)=>d(e,o=>o.metadata.streamName,n,...t);exports.pongoMultiStreamProjection = d; exports.pongoProjection = m; exports.pongoSingleProjection = P;
2
+ //# sourceMappingURL=pongo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/eventStore/projections/pongo.ts"],"names":["pongoClient","pongoProjection","handle","canHandle","inlineProjection","events","context","connectionString","client","pongo","pongoMultiStreamProjection","collectionName","getDocumentId","evolve","collection","event","document","pongoSingleProjection"],"mappings":"4EAKA,OACE,eAAAA,MAGK,yBACP,MAAe,KA6BR,IAAMC,EAAkB,CAC7BC,KACGC,IAEHC,EAA4B,CAC1B,UAAAD,EACA,OAAQ,MAAOE,EAAQC,IAAY,CACjC,GAAM,CAAE,iBAAAC,EAAkB,OAAAC,CAAO,EAAIF,EAC/BG,EAAQT,EAAYO,EAAkB,CAAE,OAAAC,CAAO,CAAC,EACtD,MAAMN,EAAOO,EAAOJ,CAAM,CAC5B,CACF,CAAC,EAEUK,EAA6B,CAIxCC,EACAC,EACAC,KACGV,IAEHF,EACE,MAAOQ,EAAOJ,IAAW,CACvB,IAAMS,EAAaL,EAAM,GAAG,EAAE,WAAqBE,CAAc,EAEjE,QAAWI,KAASV,EAClB,MAAMS,EAAW,OAAOF,EAAcG,CAAK,EAAG,MAAOC,GAC5C,MAAMH,EAAOG,EAAUD,CAAK,CACpC,CAEL,EACA,GAAGZ,CACL,EAEWc,EAAwB,CAInCN,EACAE,KACGV,IAEHO,EACEC,EACCI,GAAUA,EAAM,SAAS,WAC1BF,EACA,GAAGV,CACL","sourcesContent":["import {\n type Event,\n type EventTypeOf,\n type ReadEvent,\n} from '@event-driven-io/emmett';\nimport {\n pongoClient,\n type PongoClient,\n type PongoDocument,\n} from '@event-driven-io/pongo';\nimport pg from 'pg';\nimport { inlineProjection, type ProjectionDefintion } from './';\n\nexport type PongoProjectionOptions<EventType extends Event> = {\n documentId: (event: ReadEvent<EventType>) => string;\n eventHandler: PongoProjectionHandler<EventType>;\n eventTypes: EventTypeOf<EventType>[];\n};\n\nexport type PongoProjectionHandler<EventType extends Event = Event> = (\n documentId: (event: ReadEvent<EventType>) => string,\n connectionString: string,\n client: pg.PoolClient,\n events: ReadEvent<EventType>[],\n) => Promise<void> | void;\n\nexport type PongoDocumentEvolve<\n Document extends PongoDocument,\n EventType extends Event,\n> =\n | ((\n document: Document | null,\n event: ReadEvent<EventType>,\n ) => Document | null)\n | ((\n document: Document | null,\n event: ReadEvent<EventType>,\n ) => Promise<Document | null>);\n\nexport const pongoProjection = <EventType extends Event>(\n handle: (pongo: PongoClient, events: ReadEvent<EventType>[]) => Promise<void>,\n ...canHandle: EventTypeOf<EventType>[]\n): ProjectionDefintion =>\n inlineProjection<EventType>({\n canHandle,\n handle: async (events, context) => {\n const { connectionString, client } = context;\n const pongo = pongoClient(connectionString, { client });\n await handle(pongo, events);\n },\n });\n\nexport const pongoMultiStreamProjection = <\n Document extends PongoDocument,\n EventType extends Event,\n>(\n collectionName: string,\n getDocumentId: (event: ReadEvent<EventType>) => string,\n evolve: PongoDocumentEvolve<Document, EventType>,\n ...canHandle: EventTypeOf<EventType>[]\n): ProjectionDefintion =>\n pongoProjection(\n async (pongo, events) => {\n const collection = pongo.db().collection<Document>(collectionName);\n\n for (const event of events) {\n await collection.handle(getDocumentId(event), async (document) => {\n return await evolve(document, event);\n });\n }\n },\n ...canHandle,\n );\n\nexport const pongoSingleProjection = <\n Document extends PongoDocument,\n EventType extends Event,\n>(\n collectionName: string,\n evolve: PongoDocumentEvolve<Document, EventType>,\n ...canHandle: EventTypeOf<EventType>[]\n): ProjectionDefintion =>\n pongoMultiStreamProjection(\n collectionName,\n (event) => event.metadata.streamName,\n evolve,\n ...canHandle,\n );\n"]}
@@ -0,0 +1,2 @@
1
+ import{d as E}from"../../chunk-BBOP347O.mjs";import"../../chunk-E56AUXA3.mjs";import{pongoClient as y}from"@event-driven-io/pongo";import"pg";var m=(e,...n)=>E({canHandle:n,handle:async(t,o)=>{let{connectionString:v,client:i}=o,p=y(v,{client:i});await e(p,t)}}),d=(e,n,t,...o)=>m(async(v,i)=>{let p=v.db().collection(e);for(let c of i)await p.handle(n(c),async r=>await t(r,c))},...o),P=(e,n,...t)=>d(e,o=>o.metadata.streamName,n,...t);export{d as pongoMultiStreamProjection,m as pongoProjection,P as pongoSingleProjection};
2
+ //# sourceMappingURL=pongo.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/eventStore/projections/pongo.ts"],"sourcesContent":["import {\n type Event,\n type EventTypeOf,\n type ReadEvent,\n} from '@event-driven-io/emmett';\nimport {\n pongoClient,\n type PongoClient,\n type PongoDocument,\n} from '@event-driven-io/pongo';\nimport pg from 'pg';\nimport { inlineProjection, type ProjectionDefintion } from './';\n\nexport type PongoProjectionOptions<EventType extends Event> = {\n documentId: (event: ReadEvent<EventType>) => string;\n eventHandler: PongoProjectionHandler<EventType>;\n eventTypes: EventTypeOf<EventType>[];\n};\n\nexport type PongoProjectionHandler<EventType extends Event = Event> = (\n documentId: (event: ReadEvent<EventType>) => string,\n connectionString: string,\n client: pg.PoolClient,\n events: ReadEvent<EventType>[],\n) => Promise<void> | void;\n\nexport type PongoDocumentEvolve<\n Document extends PongoDocument,\n EventType extends Event,\n> =\n | ((\n document: Document | null,\n event: ReadEvent<EventType>,\n ) => Document | null)\n | ((\n document: Document | null,\n event: ReadEvent<EventType>,\n ) => Promise<Document | null>);\n\nexport const pongoProjection = <EventType extends Event>(\n handle: (pongo: PongoClient, events: ReadEvent<EventType>[]) => Promise<void>,\n ...canHandle: EventTypeOf<EventType>[]\n): ProjectionDefintion =>\n inlineProjection<EventType>({\n canHandle,\n handle: async (events, context) => {\n const { connectionString, client } = context;\n const pongo = pongoClient(connectionString, { client });\n await handle(pongo, events);\n },\n });\n\nexport const pongoMultiStreamProjection = <\n Document extends PongoDocument,\n EventType extends Event,\n>(\n collectionName: string,\n getDocumentId: (event: ReadEvent<EventType>) => string,\n evolve: PongoDocumentEvolve<Document, EventType>,\n ...canHandle: EventTypeOf<EventType>[]\n): ProjectionDefintion =>\n pongoProjection(\n async (pongo, events) => {\n const collection = pongo.db().collection<Document>(collectionName);\n\n for (const event of events) {\n await collection.handle(getDocumentId(event), async (document) => {\n return await evolve(document, event);\n });\n }\n },\n ...canHandle,\n );\n\nexport const pongoSingleProjection = <\n Document extends PongoDocument,\n EventType extends Event,\n>(\n collectionName: string,\n evolve: PongoDocumentEvolve<Document, EventType>,\n ...canHandle: EventTypeOf<EventType>[]\n): ProjectionDefintion =>\n pongoMultiStreamProjection(\n collectionName,\n (event) => event.metadata.streamName,\n evolve,\n ...canHandle,\n );\n"],"mappings":"8EAKA,OACE,eAAAA,MAGK,yBACP,MAAe,KA6BR,IAAMC,EAAkB,CAC7BC,KACGC,IAEHC,EAA4B,CAC1B,UAAAD,EACA,OAAQ,MAAOE,EAAQC,IAAY,CACjC,GAAM,CAAE,iBAAAC,EAAkB,OAAAC,CAAO,EAAIF,EAC/BG,EAAQC,EAAYH,EAAkB,CAAE,OAAAC,CAAO,CAAC,EACtD,MAAMN,EAAOO,EAAOJ,CAAM,CAC5B,CACF,CAAC,EAEUM,EAA6B,CAIxCC,EACAC,EACAC,KACGX,IAEHF,EACE,MAAOQ,EAAOJ,IAAW,CACvB,IAAMU,EAAaN,EAAM,GAAG,EAAE,WAAqBG,CAAc,EAEjE,QAAWI,KAASX,EAClB,MAAMU,EAAW,OAAOF,EAAcG,CAAK,EAAG,MAAOC,GAC5C,MAAMH,EAAOG,EAAUD,CAAK,CACpC,CAEL,EACA,GAAGb,CACL,EAEWe,EAAwB,CAInCN,EACAE,KACGX,IAEHQ,EACEC,EACCI,GAAUA,EAAM,SAAS,WAC1BF,EACA,GAAGX,CACL","names":["pongoClient","pongoProjection","handle","canHandle","inlineProjection","events","context","connectionString","client","pongo","pongoClient","pongoMultiStreamProjection","collectionName","getDocumentId","evolve","collection","event","document","pongoSingleProjection"]}
@@ -1,8 +1,8 @@
1
- import { SQL } from '../../sql/index.mjs';
2
- import { Event, AppendToStreamOptions } from '@event-driven-io/emmett';
1
+ import * as _event_driven_io_dumbo from '@event-driven-io/dumbo';
2
+ import { Event, AppendToStreamOptions, ReadEvent } from '@event-driven-io/emmett';
3
3
  import pg from 'pg';
4
4
 
5
- declare const appendEventsSQL: SQL;
5
+ declare const appendEventsSQL: _event_driven_io_dumbo.SQL;
6
6
  type AppendEventResult = {
7
7
  success: true;
8
8
  nextStreamPosition: bigint;
@@ -11,8 +11,9 @@ type AppendEventResult = {
11
11
  } | {
12
12
  success: false;
13
13
  };
14
- declare const appendToStream: (pool: pg.Pool, streamName: string, streamType: string, events: Event[], options?: AppendToStreamOptions & {
15
- partition?: string;
16
- }) => Promise<AppendEventResult>;
14
+ declare const appendToStream: (pool: pg.Pool, streamName: string, streamType: string, events: Event[], options?: (AppendToStreamOptions & {
15
+ partition?: string | undefined;
16
+ preCommitHook?: ((client: pg.PoolClient, events: ReadEvent[]) => Promise<void>) | undefined;
17
+ }) | undefined) => Promise<AppendEventResult>;
17
18
 
18
19
  export { appendEventsSQL, appendToStream };
@@ -1,8 +1,8 @@
1
- import { SQL } from '../../sql/index.js';
2
- import { Event, AppendToStreamOptions } from '@event-driven-io/emmett';
1
+ import * as _event_driven_io_dumbo from '@event-driven-io/dumbo';
2
+ import { Event, AppendToStreamOptions, ReadEvent } from '@event-driven-io/emmett';
3
3
  import pg from 'pg';
4
4
 
5
- declare const appendEventsSQL: SQL;
5
+ declare const appendEventsSQL: _event_driven_io_dumbo.SQL;
6
6
  type AppendEventResult = {
7
7
  success: true;
8
8
  nextStreamPosition: bigint;
@@ -11,8 +11,9 @@ type AppendEventResult = {
11
11
  } | {
12
12
  success: false;
13
13
  };
14
- declare const appendToStream: (pool: pg.Pool, streamName: string, streamType: string, events: Event[], options?: AppendToStreamOptions & {
15
- partition?: string;
16
- }) => Promise<AppendEventResult>;
14
+ declare const appendToStream: (pool: pg.Pool, streamName: string, streamType: string, events: Event[], options?: (AppendToStreamOptions & {
15
+ partition?: string | undefined;
16
+ preCommitHook?: ((client: pg.PoolClient, events: ReadEvent[]) => Promise<void>) | undefined;
17
+ }) | undefined) => Promise<AppendEventResult>;
17
18
 
18
19
  export { appendEventsSQL, appendToStream };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGQQPVQW3js = require('../../chunk-GQQPVQW3.js');require('../../chunk-SS2LQM3B.js');require('../../chunk-4ZQCCOS3.js');require('../../chunk-IZW7N6BP.js');exports.appendEventsSQL = _chunkGQQPVQW3js.a; exports.appendToStream = _chunkGQQPVQW3js.b;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkKADY7IHMjs = require('../../chunk-KADY7IHM.js');require('../../chunk-SS2LQM3B.js');require('../../chunk-XQZVOI6W.js');exports.appendEventsSQL = _chunkKADY7IHMjs.a; exports.appendToStream = _chunkKADY7IHMjs.b;
2
2
  //# sourceMappingURL=appendToStream.js.map
@@ -1,2 +1,2 @@
1
- import{a,b}from"../../chunk-5U7HYDY6.mjs";import"../../chunk-ABNBEUC6.mjs";import"../../chunk-FYXDBZNT.mjs";import"../../chunk-MLVVMWHF.mjs";export{a as appendEventsSQL,b as appendToStream};
1
+ import{a,b}from"../../chunk-COTRMVOL.mjs";import"../../chunk-ABNBEUC6.mjs";import"../../chunk-E56AUXA3.mjs";export{a as appendEventsSQL,b as appendToStream};
2
2
  //# sourceMappingURL=appendToStream.mjs.map
@@ -1,5 +1,5 @@
1
+ import { SQL } from '@event-driven-io/dumbo';
1
2
  import pg from 'pg';
2
- import { SQL } from '../../sql/index.mjs';
3
3
  export { appendEventsSQL, appendToStream } from './appendToStream.mjs';
4
4
  export { readStream } from './readStream.mjs';
5
5
  export { addDefaultPartition, addEventsPartitions, addModuleForAllTenantsSQL, addModuleSQL, addTablePartitions, addTenantForAllModulesSQL, addTenantSQL, eventsTableSQL, sanitizeNameSQL, streamsTableSQL, subscriptionsTableSQL } from './tables.mjs';
@@ -1,5 +1,5 @@
1
+ import { SQL } from '@event-driven-io/dumbo';
1
2
  import pg from 'pg';
2
- import { SQL } from '../../sql/index.js';
3
3
  export { appendEventsSQL, appendToStream } from './appendToStream.js';
4
4
  export { readStream } from './readStream.js';
5
5
  export { addDefaultPartition, addEventsPartitions, addModuleForAllTenantsSQL, addModuleSQL, addTablePartitions, addTenantForAllModulesSQL, addTenantSQL, eventsTableSQL, sanitizeNameSQL, streamsTableSQL, subscriptionsTableSQL } from './tables.js';
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkN4I2XRJVjs = require('../../chunk-N4I2XRJV.js');var _chunkGQQPVQW3js = require('../../chunk-GQQPVQW3.js');var _chunkTMR7LHTXjs = require('../../chunk-TMR7LHTX.js');var _chunkZ67RDRQWjs = require('../../chunk-Z67RDRQW.js');var _chunkSS2LQM3Bjs = require('../../chunk-SS2LQM3B.js');require('../../chunk-4ZQCCOS3.js');require('../../chunk-IZW7N6BP.js');exports.addDefaultPartition = _chunkZ67RDRQWjs.k; exports.addEventsPartitions = _chunkZ67RDRQWjs.f; exports.addModuleForAllTenantsSQL = _chunkZ67RDRQWjs.i; exports.addModuleSQL = _chunkZ67RDRQWjs.g; exports.addTablePartitions = _chunkZ67RDRQWjs.e; exports.addTenantForAllModulesSQL = _chunkZ67RDRQWjs.j; exports.addTenantSQL = _chunkZ67RDRQWjs.h; exports.appendEventsSQL = _chunkGQQPVQW3js.a; exports.appendToStream = _chunkGQQPVQW3js.b; exports.createEventStoreSchema = _chunkN4I2XRJVjs.b; exports.defaultTag = _chunkSS2LQM3Bjs.c; exports.emmettPrefix = _chunkSS2LQM3Bjs.a; exports.eventsTable = _chunkSS2LQM3Bjs.f; exports.eventsTableSQL = _chunkZ67RDRQWjs.b; exports.globalNames = _chunkSS2LQM3Bjs.d; exports.globalTag = _chunkSS2LQM3Bjs.b; exports.readStream = _chunkTMR7LHTXjs.a; exports.sanitizeNameSQL = _chunkZ67RDRQWjs.d; exports.schemaSQL = _chunkN4I2XRJVjs.a; exports.streamsTable = _chunkSS2LQM3Bjs.e; exports.streamsTableSQL = _chunkZ67RDRQWjs.a; exports.subscriptionsTableSQL = _chunkZ67RDRQWjs.c;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEMFXYVCKjs = require('../../chunk-EMFXYVCK.js');var _chunkEEYVFO3Gjs = require('../../chunk-EEYVFO3G.js');var _chunkKADY7IHMjs = require('../../chunk-KADY7IHM.js');var _chunkP36ZOB2Ejs = require('../../chunk-P36ZOB2E.js');var _chunkSS2LQM3Bjs = require('../../chunk-SS2LQM3B.js');require('../../chunk-XQZVOI6W.js');exports.addDefaultPartition = _chunkEEYVFO3Gjs.k; exports.addEventsPartitions = _chunkEEYVFO3Gjs.f; exports.addModuleForAllTenantsSQL = _chunkEEYVFO3Gjs.i; exports.addModuleSQL = _chunkEEYVFO3Gjs.g; exports.addTablePartitions = _chunkEEYVFO3Gjs.e; exports.addTenantForAllModulesSQL = _chunkEEYVFO3Gjs.j; exports.addTenantSQL = _chunkEEYVFO3Gjs.h; exports.appendEventsSQL = _chunkKADY7IHMjs.a; exports.appendToStream = _chunkKADY7IHMjs.b; exports.createEventStoreSchema = _chunkEMFXYVCKjs.b; exports.defaultTag = _chunkSS2LQM3Bjs.c; exports.emmettPrefix = _chunkSS2LQM3Bjs.a; exports.eventsTable = _chunkSS2LQM3Bjs.f; exports.eventsTableSQL = _chunkEEYVFO3Gjs.b; exports.globalNames = _chunkSS2LQM3Bjs.d; exports.globalTag = _chunkSS2LQM3Bjs.b; exports.readStream = _chunkP36ZOB2Ejs.a; exports.sanitizeNameSQL = _chunkEEYVFO3Gjs.d; exports.schemaSQL = _chunkEMFXYVCKjs.a; exports.streamsTable = _chunkSS2LQM3Bjs.e; exports.streamsTableSQL = _chunkEEYVFO3Gjs.a; exports.subscriptionsTableSQL = _chunkEEYVFO3Gjs.c;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import{a as u,b as v}from"../../chunk-HZQ46ED2.mjs";import{a as g,b as h}from"../../chunk-5U7HYDY6.mjs";import{a as t}from"../../chunk-7K6TUMXZ.mjs";import{a as i,b as j,c as k,d as l,e as m,f as n,g as o,h as p,i as q,j as r,k as s}from"../../chunk-DRZRZGSJ.mjs";import{a,b,c,d,e,f}from"../../chunk-ABNBEUC6.mjs";import"../../chunk-FYXDBZNT.mjs";import"../../chunk-MLVVMWHF.mjs";export{s as addDefaultPartition,n as addEventsPartitions,q as addModuleForAllTenantsSQL,o as addModuleSQL,m as addTablePartitions,r as addTenantForAllModulesSQL,p as addTenantSQL,g as appendEventsSQL,h as appendToStream,v as createEventStoreSchema,c as defaultTag,a as emmettPrefix,f as eventsTable,j as eventsTableSQL,d as globalNames,b as globalTag,t as readStream,l as sanitizeNameSQL,u as schemaSQL,e as streamsTable,i as streamsTableSQL,k as subscriptionsTableSQL};
1
+ import{a as u,b as v}from"../../chunk-QHCLGPQG.mjs";import{a as i,b as j,c as k,d as l,e as m,f as n,g as o,h as p,i as q,j as r,k as s}from"../../chunk-UWD6GOZC.mjs";import{a as g,b as h}from"../../chunk-COTRMVOL.mjs";import{a as t}from"../../chunk-D5T7G7UL.mjs";import{a,b,c,d,e,f}from"../../chunk-ABNBEUC6.mjs";import"../../chunk-E56AUXA3.mjs";export{s as addDefaultPartition,n as addEventsPartitions,q as addModuleForAllTenantsSQL,o as addModuleSQL,m as addTablePartitions,r as addTenantForAllModulesSQL,p as addTenantSQL,g as appendEventsSQL,h as appendToStream,v as createEventStoreSchema,c as defaultTag,a as emmettPrefix,f as eventsTable,j as eventsTableSQL,d as globalNames,b as globalTag,t as readStream,l as sanitizeNameSQL,u as schemaSQL,e as streamsTable,i as streamsTableSQL,k as subscriptionsTableSQL};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTMR7LHTXjs = require('../../chunk-TMR7LHTX.js');require('../../chunk-SS2LQM3B.js');require('../../chunk-4ZQCCOS3.js');require('../../chunk-IZW7N6BP.js');exports.readStream = _chunkTMR7LHTXjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkP36ZOB2Ejs = require('../../chunk-P36ZOB2E.js');require('../../chunk-SS2LQM3B.js');require('../../chunk-XQZVOI6W.js');exports.readStream = _chunkP36ZOB2Ejs.a;
2
2
  //# sourceMappingURL=readStream.js.map
@@ -1,2 +1,2 @@
1
- import{a}from"../../chunk-7K6TUMXZ.mjs";import"../../chunk-ABNBEUC6.mjs";import"../../chunk-FYXDBZNT.mjs";import"../../chunk-MLVVMWHF.mjs";export{a as readStream};
1
+ import{a}from"../../chunk-D5T7G7UL.mjs";import"../../chunk-ABNBEUC6.mjs";import"../../chunk-E56AUXA3.mjs";export{a as readStream};
2
2
  //# sourceMappingURL=readStream.mjs.map
@@ -1,16 +1,15 @@
1
- import { SQL } from '../../sql/index.mjs';
2
- import 'pg';
1
+ import * as _event_driven_io_dumbo from '@event-driven-io/dumbo';
3
2
 
4
- declare const streamsTableSQL: SQL;
5
- declare const eventsTableSQL: SQL;
6
- declare const subscriptionsTableSQL: SQL;
7
- declare const sanitizeNameSQL: SQL;
8
- declare const addTablePartitions: SQL;
9
- declare const addEventsPartitions: SQL;
10
- declare const addModuleSQL: SQL;
11
- declare const addTenantSQL: SQL;
12
- declare const addModuleForAllTenantsSQL: SQL;
13
- declare const addTenantForAllModulesSQL: SQL;
14
- declare const addDefaultPartition: SQL;
3
+ declare const streamsTableSQL: _event_driven_io_dumbo.SQL;
4
+ declare const eventsTableSQL: _event_driven_io_dumbo.SQL;
5
+ declare const subscriptionsTableSQL: _event_driven_io_dumbo.SQL;
6
+ declare const sanitizeNameSQL: _event_driven_io_dumbo.SQL;
7
+ declare const addTablePartitions: _event_driven_io_dumbo.SQL;
8
+ declare const addEventsPartitions: _event_driven_io_dumbo.SQL;
9
+ declare const addModuleSQL: _event_driven_io_dumbo.SQL;
10
+ declare const addTenantSQL: _event_driven_io_dumbo.SQL;
11
+ declare const addModuleForAllTenantsSQL: _event_driven_io_dumbo.SQL;
12
+ declare const addTenantForAllModulesSQL: _event_driven_io_dumbo.SQL;
13
+ declare const addDefaultPartition: _event_driven_io_dumbo.SQL;
15
14
 
16
15
  export { addDefaultPartition, addEventsPartitions, addModuleForAllTenantsSQL, addModuleSQL, addTablePartitions, addTenantForAllModulesSQL, addTenantSQL, eventsTableSQL, sanitizeNameSQL, streamsTableSQL, subscriptionsTableSQL };
@@ -1,16 +1,15 @@
1
- import { SQL } from '../../sql/index.js';
2
- import 'pg';
1
+ import * as _event_driven_io_dumbo from '@event-driven-io/dumbo';
3
2
 
4
- declare const streamsTableSQL: SQL;
5
- declare const eventsTableSQL: SQL;
6
- declare const subscriptionsTableSQL: SQL;
7
- declare const sanitizeNameSQL: SQL;
8
- declare const addTablePartitions: SQL;
9
- declare const addEventsPartitions: SQL;
10
- declare const addModuleSQL: SQL;
11
- declare const addTenantSQL: SQL;
12
- declare const addModuleForAllTenantsSQL: SQL;
13
- declare const addTenantForAllModulesSQL: SQL;
14
- declare const addDefaultPartition: SQL;
3
+ declare const streamsTableSQL: _event_driven_io_dumbo.SQL;
4
+ declare const eventsTableSQL: _event_driven_io_dumbo.SQL;
5
+ declare const subscriptionsTableSQL: _event_driven_io_dumbo.SQL;
6
+ declare const sanitizeNameSQL: _event_driven_io_dumbo.SQL;
7
+ declare const addTablePartitions: _event_driven_io_dumbo.SQL;
8
+ declare const addEventsPartitions: _event_driven_io_dumbo.SQL;
9
+ declare const addModuleSQL: _event_driven_io_dumbo.SQL;
10
+ declare const addTenantSQL: _event_driven_io_dumbo.SQL;
11
+ declare const addModuleForAllTenantsSQL: _event_driven_io_dumbo.SQL;
12
+ declare const addTenantForAllModulesSQL: _event_driven_io_dumbo.SQL;
13
+ declare const addDefaultPartition: _event_driven_io_dumbo.SQL;
15
14
 
16
15
  export { addDefaultPartition, addEventsPartitions, addModuleForAllTenantsSQL, addModuleSQL, addTablePartitions, addTenantForAllModulesSQL, addTenantSQL, eventsTableSQL, sanitizeNameSQL, streamsTableSQL, subscriptionsTableSQL };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkZ67RDRQWjs = require('../../chunk-Z67RDRQW.js');require('../../chunk-SS2LQM3B.js');require('../../chunk-4ZQCCOS3.js');require('../../chunk-IZW7N6BP.js');exports.addDefaultPartition = _chunkZ67RDRQWjs.k; exports.addEventsPartitions = _chunkZ67RDRQWjs.f; exports.addModuleForAllTenantsSQL = _chunkZ67RDRQWjs.i; exports.addModuleSQL = _chunkZ67RDRQWjs.g; exports.addTablePartitions = _chunkZ67RDRQWjs.e; exports.addTenantForAllModulesSQL = _chunkZ67RDRQWjs.j; exports.addTenantSQL = _chunkZ67RDRQWjs.h; exports.eventsTableSQL = _chunkZ67RDRQWjs.b; exports.sanitizeNameSQL = _chunkZ67RDRQWjs.d; exports.streamsTableSQL = _chunkZ67RDRQWjs.a; exports.subscriptionsTableSQL = _chunkZ67RDRQWjs.c;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEEYVFO3Gjs = require('../../chunk-EEYVFO3G.js');require('../../chunk-SS2LQM3B.js');exports.addDefaultPartition = _chunkEEYVFO3Gjs.k; exports.addEventsPartitions = _chunkEEYVFO3Gjs.f; exports.addModuleForAllTenantsSQL = _chunkEEYVFO3Gjs.i; exports.addModuleSQL = _chunkEEYVFO3Gjs.g; exports.addTablePartitions = _chunkEEYVFO3Gjs.e; exports.addTenantForAllModulesSQL = _chunkEEYVFO3Gjs.j; exports.addTenantSQL = _chunkEEYVFO3Gjs.h; exports.eventsTableSQL = _chunkEEYVFO3Gjs.b; exports.sanitizeNameSQL = _chunkEEYVFO3Gjs.d; exports.streamsTableSQL = _chunkEEYVFO3Gjs.a; exports.subscriptionsTableSQL = _chunkEEYVFO3Gjs.c;
2
2
  //# sourceMappingURL=tables.js.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k}from"../../chunk-DRZRZGSJ.mjs";import"../../chunk-ABNBEUC6.mjs";import"../../chunk-FYXDBZNT.mjs";import"../../chunk-MLVVMWHF.mjs";export{k as addDefaultPartition,f as addEventsPartitions,i as addModuleForAllTenantsSQL,g as addModuleSQL,e as addTablePartitions,j as addTenantForAllModulesSQL,h as addTenantSQL,b as eventsTableSQL,d as sanitizeNameSQL,a as streamsTableSQL,c as subscriptionsTableSQL};
1
+ import{a,b,c,d,e,f,g,h,i,j,k}from"../../chunk-UWD6GOZC.mjs";import"../../chunk-ABNBEUC6.mjs";export{k as addDefaultPartition,f as addEventsPartitions,i as addModuleForAllTenantsSQL,g as addModuleSQL,e as addTablePartitions,j as addTenantForAllModulesSQL,h as addTenantSQL,b as eventsTableSQL,d as sanitizeNameSQL,a as streamsTableSQL,c as subscriptionsTableSQL};
2
2
  //# sourceMappingURL=tables.mjs.map
package/dist/index.d.mts CHANGED
@@ -1,12 +1,9 @@
1
- export { PostgresClient, postgresClient } from './connections/client.mjs';
2
- export { endAllPools, endPool, getPool } from './connections/pool.mjs';
3
- export { getPostgreSQLEventStore } from './eventStore/postgreSQLEventStore.mjs';
1
+ export { P as PostgresEventStore, a as PostgresEventStoreOptions, c as PostgresProjectionHandler, d as ProjectionDefintion, b as ProjectionHandlerContext, e as defaultProjectionOptions, g as getPostgreSQLEventStore, h as handleProjections, i as inlineProjection, p as projection } from './postgreSQLEventStore-B7GlXfis.mjs';
4
2
  export { createEventStoreSchema, schemaSQL } from './eventStore/schema/index.mjs';
5
- export { ExistsSQLQueryResult, execute, executeInTransaction, executeSQL, executeSQLBatchInTransaction, executeSQLInTransaction, exists, first, firstOrNull, mapRow, single, singleOrNull } from './execute/index.mjs';
6
- export { SQL, functionExists, functionExistsSQL, rawSQL, sql, tableExists, tableExistsSQL } from './sql/index.mjs';
7
3
  export { appendEventsSQL, appendToStream } from './eventStore/schema/appendToStream.mjs';
8
4
  export { readStream } from './eventStore/schema/readStream.mjs';
9
5
  export { addDefaultPartition, addEventsPartitions, addModuleForAllTenantsSQL, addModuleSQL, addTablePartitions, addTenantForAllModulesSQL, addTenantSQL, eventsTableSQL, sanitizeNameSQL, streamsTableSQL, subscriptionsTableSQL } from './eventStore/schema/tables.mjs';
10
6
  export { defaultTag, emmettPrefix, eventsTable, globalNames, globalTag, streamsTable } from './eventStore/schema/typing.mjs';
11
- import 'pg';
12
7
  import '@event-driven-io/emmett';
8
+ import 'pg';
9
+ import '@event-driven-io/dumbo';
package/dist/index.d.ts CHANGED
@@ -1,12 +1,9 @@
1
- export { PostgresClient, postgresClient } from './connections/client.js';
2
- export { endAllPools, endPool, getPool } from './connections/pool.js';
3
- export { getPostgreSQLEventStore } from './eventStore/postgreSQLEventStore.js';
1
+ export { P as PostgresEventStore, a as PostgresEventStoreOptions, c as PostgresProjectionHandler, d as ProjectionDefintion, b as ProjectionHandlerContext, e as defaultProjectionOptions, g as getPostgreSQLEventStore, h as handleProjections, i as inlineProjection, p as projection } from './postgreSQLEventStore-B7GlXfis.js';
4
2
  export { createEventStoreSchema, schemaSQL } from './eventStore/schema/index.js';
5
- export { ExistsSQLQueryResult, execute, executeInTransaction, executeSQL, executeSQLBatchInTransaction, executeSQLInTransaction, exists, first, firstOrNull, mapRow, single, singleOrNull } from './execute/index.js';
6
- export { SQL, functionExists, functionExistsSQL, rawSQL, sql, tableExists, tableExistsSQL } from './sql/index.js';
7
3
  export { appendEventsSQL, appendToStream } from './eventStore/schema/appendToStream.js';
8
4
  export { readStream } from './eventStore/schema/readStream.js';
9
5
  export { addDefaultPartition, addEventsPartitions, addModuleForAllTenantsSQL, addModuleSQL, addTablePartitions, addTenantForAllModulesSQL, addTenantSQL, eventsTableSQL, sanitizeNameSQL, streamsTableSQL, subscriptionsTableSQL } from './eventStore/schema/tables.js';
10
6
  export { defaultTag, emmettPrefix, eventsTable, globalNames, globalTag, streamsTable } from './eventStore/schema/typing.js';
11
- import 'pg';
12
7
  import '@event-driven-io/emmett';
8
+ import 'pg';
9
+ import '@event-driven-io/dumbo';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-HUB7W7J3.js');var _chunkC6E7NEXUjs = require('./chunk-C6E7NEXU.js');var _chunkVP4QNFWTjs = require('./chunk-VP4QNFWT.js');require('./chunk-MERDQHBQ.js');var _chunkGB5VCDBFjs = require('./chunk-GB5VCDBF.js');var _chunkN4I2XRJVjs = require('./chunk-N4I2XRJV.js');var _chunkGQQPVQW3js = require('./chunk-GQQPVQW3.js');var _chunkTMR7LHTXjs = require('./chunk-TMR7LHTX.js');var _chunkZ67RDRQWjs = require('./chunk-Z67RDRQW.js');var _chunkSS2LQM3Bjs = require('./chunk-SS2LQM3B.js');var _chunk4ZQCCOS3js = require('./chunk-4ZQCCOS3.js');var _chunkIZW7N6BPjs = require('./chunk-IZW7N6BP.js');exports.addDefaultPartition = _chunkZ67RDRQWjs.k; exports.addEventsPartitions = _chunkZ67RDRQWjs.f; exports.addModuleForAllTenantsSQL = _chunkZ67RDRQWjs.i; exports.addModuleSQL = _chunkZ67RDRQWjs.g; exports.addTablePartitions = _chunkZ67RDRQWjs.e; exports.addTenantForAllModulesSQL = _chunkZ67RDRQWjs.j; exports.addTenantSQL = _chunkZ67RDRQWjs.h; exports.appendEventsSQL = _chunkGQQPVQW3js.a; exports.appendToStream = _chunkGQQPVQW3js.b; exports.createEventStoreSchema = _chunkN4I2XRJVjs.b; exports.defaultTag = _chunkSS2LQM3Bjs.c; exports.emmettPrefix = _chunkSS2LQM3Bjs.a; exports.endAllPools = _chunkVP4QNFWTjs.c; exports.endPool = _chunkVP4QNFWTjs.b; exports.eventsTable = _chunkSS2LQM3Bjs.f; exports.eventsTableSQL = _chunkZ67RDRQWjs.b; exports.execute = _chunkIZW7N6BPjs.g; exports.executeInTransaction = _chunkIZW7N6BPjs.h; exports.executeSQL = _chunkIZW7N6BPjs.i; exports.executeSQLBatchInTransaction = _chunkIZW7N6BPjs.k; exports.executeSQLInTransaction = _chunkIZW7N6BPjs.j; exports.exists = _chunkIZW7N6BPjs.q; exports.first = _chunkIZW7N6BPjs.m; exports.firstOrNull = _chunkIZW7N6BPjs.l; exports.functionExists = _chunk4ZQCCOS3js.d; exports.functionExistsSQL = _chunk4ZQCCOS3js.c; exports.getPool = _chunkVP4QNFWTjs.a; exports.getPostgreSQLEventStore = _chunkGB5VCDBFjs.a; exports.globalNames = _chunkSS2LQM3Bjs.d; exports.globalTag = _chunkSS2LQM3Bjs.b; exports.mapRow = _chunkIZW7N6BPjs.p; exports.postgresClient = _chunkC6E7NEXUjs.a; exports.rawSQL = _chunk4ZQCCOS3js.f; exports.readStream = _chunkTMR7LHTXjs.a; exports.sanitizeNameSQL = _chunkZ67RDRQWjs.d; exports.schemaSQL = _chunkN4I2XRJVjs.a; exports.single = _chunkIZW7N6BPjs.o; exports.singleOrNull = _chunkIZW7N6BPjs.n; exports.sql = _chunk4ZQCCOS3js.e; exports.streamsTable = _chunkSS2LQM3Bjs.e; exports.streamsTableSQL = _chunkZ67RDRQWjs.a; exports.subscriptionsTableSQL = _chunkZ67RDRQWjs.c; exports.tableExists = _chunk4ZQCCOS3js.b; exports.tableExistsSQL = _chunk4ZQCCOS3js.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-2452BJTJ.js');var _chunkICKSIW7Kjs = require('./chunk-ICKSIW7K.js');var _chunkS6NGBYJWjs = require('./chunk-S6NGBYJW.js');var _chunkEMFXYVCKjs = require('./chunk-EMFXYVCK.js');var _chunkEEYVFO3Gjs = require('./chunk-EEYVFO3G.js');var _chunkKADY7IHMjs = require('./chunk-KADY7IHM.js');var _chunkP36ZOB2Ejs = require('./chunk-P36ZOB2E.js');var _chunkSS2LQM3Bjs = require('./chunk-SS2LQM3B.js');require('./chunk-XQZVOI6W.js');exports.addDefaultPartition = _chunkEEYVFO3Gjs.k; exports.addEventsPartitions = _chunkEEYVFO3Gjs.f; exports.addModuleForAllTenantsSQL = _chunkEEYVFO3Gjs.i; exports.addModuleSQL = _chunkEEYVFO3Gjs.g; exports.addTablePartitions = _chunkEEYVFO3Gjs.e; exports.addTenantForAllModulesSQL = _chunkEEYVFO3Gjs.j; exports.addTenantSQL = _chunkEEYVFO3Gjs.h; exports.appendEventsSQL = _chunkKADY7IHMjs.a; exports.appendToStream = _chunkKADY7IHMjs.b; exports.createEventStoreSchema = _chunkEMFXYVCKjs.b; exports.defaultProjectionOptions = _chunkS6NGBYJWjs.a; exports.defaultTag = _chunkSS2LQM3Bjs.c; exports.emmettPrefix = _chunkSS2LQM3Bjs.a; exports.eventsTable = _chunkSS2LQM3Bjs.f; exports.eventsTableSQL = _chunkEEYVFO3Gjs.b; exports.getPostgreSQLEventStore = _chunkICKSIW7Kjs.a; exports.globalNames = _chunkSS2LQM3Bjs.d; exports.globalTag = _chunkSS2LQM3Bjs.b; exports.handleProjections = _chunkS6NGBYJWjs.b; exports.inlineProjection = _chunkS6NGBYJWjs.d; exports.projection = _chunkS6NGBYJWjs.c; exports.readStream = _chunkP36ZOB2Ejs.a; exports.sanitizeNameSQL = _chunkEEYVFO3Gjs.d; exports.schemaSQL = _chunkEMFXYVCKjs.a; exports.streamsTable = _chunkSS2LQM3Bjs.e; exports.streamsTableSQL = _chunkEEYVFO3Gjs.a; exports.subscriptionsTableSQL = _chunkEEYVFO3Gjs.c;
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-GR4YFDV5.mjs";import{a as f}from"./chunk-QQC5YC26.mjs";import{a as o,b as r,c as e}from"./chunk-IX2XL3S5.mjs";import"./chunk-HIATDE4Q.mjs";import{a as R}from"./chunk-YCS26XB2.mjs";import{a as P,b as Q}from"./chunk-HZQ46ED2.mjs";import{a as B,b as C}from"./chunk-5U7HYDY6.mjs";import{a as O}from"./chunk-7K6TUMXZ.mjs";import{a as D,b as E,c as F,d as G,e as H,f as I,g as J,h as K,i as L,j as M,k as N}from"./chunk-DRZRZGSJ.mjs";import{a as u,b as v,c as w,d as y,e as z,f as A}from"./chunk-ABNBEUC6.mjs";import{a as j,b as k,c as l,d as n,e as q,f as s}from"./chunk-FYXDBZNT.mjs";import{g as m,h as p,i as t,j as x,k as a,l as b,m as c,n as d,o as g,p as h,q as i}from"./chunk-MLVVMWHF.mjs";export{N as addDefaultPartition,I as addEventsPartitions,L as addModuleForAllTenantsSQL,J as addModuleSQL,H as addTablePartitions,M as addTenantForAllModulesSQL,K as addTenantSQL,B as appendEventsSQL,C as appendToStream,Q as createEventStoreSchema,w as defaultTag,u as emmettPrefix,e as endAllPools,r as endPool,A as eventsTable,E as eventsTableSQL,m as execute,p as executeInTransaction,t as executeSQL,a as executeSQLBatchInTransaction,x as executeSQLInTransaction,i as exists,c as first,b as firstOrNull,n as functionExists,l as functionExistsSQL,o as getPool,R as getPostgreSQLEventStore,y as globalNames,v as globalTag,h as mapRow,f as postgresClient,s as rawSQL,O as readStream,G as sanitizeNameSQL,P as schemaSQL,g as single,d as singleOrNull,q as sql,z as streamsTable,D as streamsTableSQL,F as subscriptionsTableSQL,k as tableExists,j as tableExistsSQL};
1
+ import"./chunk-45ODDXOQ.mjs";import{a as A}from"./chunk-7PVUE3OV.mjs";import{a as o,b as r,c as e,d as f}from"./chunk-BBOP347O.mjs";import{a as y,b as z}from"./chunk-QHCLGPQG.mjs";import{a as g,b as h,c as i,d as j,e as k,f as l,g as n,h as q,i as s,j as u,k as v}from"./chunk-UWD6GOZC.mjs";import{a as c,b as d}from"./chunk-COTRMVOL.mjs";import{a as w}from"./chunk-D5T7G7UL.mjs";import{a as m,b as p,c as t,d as x,e as a,f as b}from"./chunk-ABNBEUC6.mjs";import"./chunk-E56AUXA3.mjs";export{v as addDefaultPartition,l as addEventsPartitions,s as addModuleForAllTenantsSQL,n as addModuleSQL,k as addTablePartitions,u as addTenantForAllModulesSQL,q as addTenantSQL,c as appendEventsSQL,d as appendToStream,z as createEventStoreSchema,o as defaultProjectionOptions,t as defaultTag,m as emmettPrefix,b as eventsTable,h as eventsTableSQL,A as getPostgreSQLEventStore,x as globalNames,p as globalTag,r as handleProjections,f as inlineProjection,e as projection,w as readStream,j as sanitizeNameSQL,y as schemaSQL,a as streamsTable,g as streamsTableSQL,i as subscriptionsTableSQL};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,28 @@
1
+ import { Event, ReadEvent, EventTypeOf, EventStore, DefaultStreamVersionType, ReadEventMetadataWithGlobalPosition } from '@event-driven-io/emmett';
2
+ import pg from 'pg';
3
+
4
+ type ProjectionHandlerContext = {
5
+ connectionString: string;
6
+ client: pg.PoolClient;
7
+ };
8
+ type PostgresProjectionHandler<EventType extends Event = Event> = (events: ReadEvent<EventType>[], context: ProjectionHandlerContext) => Promise<void> | void;
9
+ type ProjectionDefintion<EventType extends Event = Event> = {
10
+ type: 'inline';
11
+ name?: string;
12
+ canHandle: EventTypeOf<EventType>[];
13
+ handle: PostgresProjectionHandler<EventType>;
14
+ };
15
+ declare const defaultProjectionOptions: PostgresEventStoreOptions;
16
+ declare const handleProjections: <EventType extends Event = Event>(allProjections: ProjectionDefintion<EventType>[], connectionString: string, client: pg.PoolClient, events: ReadEvent<EventType>[]) => Promise<void>;
17
+ declare const projection: <EventType extends Event>(definition: ProjectionDefintion<EventType>) => ProjectionDefintion;
18
+ declare const inlineProjection: <EventType extends Event>(definition: Omit<ProjectionDefintion<EventType>, 'type'>) => ProjectionDefintion;
19
+
20
+ interface PostgresEventStore extends EventStore<DefaultStreamVersionType, ReadEventMetadataWithGlobalPosition> {
21
+ close(): Promise<void>;
22
+ }
23
+ type PostgresEventStoreOptions = {
24
+ projections: ProjectionDefintion[];
25
+ };
26
+ declare const getPostgreSQLEventStore: (connectionString: string, options?: PostgresEventStoreOptions) => PostgresEventStore;
27
+
28
+ export { type PostgresEventStore as P, type PostgresEventStoreOptions as a, type ProjectionHandlerContext as b, type PostgresProjectionHandler as c, type ProjectionDefintion as d, defaultProjectionOptions as e, getPostgreSQLEventStore as g, handleProjections as h, inlineProjection as i, projection as p };
@@ -0,0 +1,28 @@
1
+ import { Event, ReadEvent, EventTypeOf, EventStore, DefaultStreamVersionType, ReadEventMetadataWithGlobalPosition } from '@event-driven-io/emmett';
2
+ import pg from 'pg';
3
+
4
+ type ProjectionHandlerContext = {
5
+ connectionString: string;
6
+ client: pg.PoolClient;
7
+ };
8
+ type PostgresProjectionHandler<EventType extends Event = Event> = (events: ReadEvent<EventType>[], context: ProjectionHandlerContext) => Promise<void> | void;
9
+ type ProjectionDefintion<EventType extends Event = Event> = {
10
+ type: 'inline';
11
+ name?: string;
12
+ canHandle: EventTypeOf<EventType>[];
13
+ handle: PostgresProjectionHandler<EventType>;
14
+ };
15
+ declare const defaultProjectionOptions: PostgresEventStoreOptions;
16
+ declare const handleProjections: <EventType extends Event = Event>(allProjections: ProjectionDefintion<EventType>[], connectionString: string, client: pg.PoolClient, events: ReadEvent<EventType>[]) => Promise<void>;
17
+ declare const projection: <EventType extends Event>(definition: ProjectionDefintion<EventType>) => ProjectionDefintion;
18
+ declare const inlineProjection: <EventType extends Event>(definition: Omit<ProjectionDefintion<EventType>, 'type'>) => ProjectionDefintion;
19
+
20
+ interface PostgresEventStore extends EventStore<DefaultStreamVersionType, ReadEventMetadataWithGlobalPosition> {
21
+ close(): Promise<void>;
22
+ }
23
+ type PostgresEventStoreOptions = {
24
+ projections: ProjectionDefintion[];
25
+ };
26
+ declare const getPostgreSQLEventStore: (connectionString: string, options?: PostgresEventStoreOptions) => PostgresEventStore;
27
+
28
+ export { type PostgresEventStore as P, type PostgresEventStoreOptions as a, type ProjectionHandlerContext as b, type PostgresProjectionHandler as c, type ProjectionDefintion as d, defaultProjectionOptions as e, getPostgreSQLEventStore as g, handleProjections as h, inlineProjection as i, projection as p };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@event-driven-io/emmett-postgresql",
3
- "version": "0.12.1",
3
+ "version": "0.14.0",
4
4
  "description": "Emmett - PostgreSQL - Event Sourcing development made simple",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -52,10 +52,12 @@
52
52
  "@event-driven-io/emmett-testcontainers": "^0.5.0"
53
53
  },
54
54
  "peerDependencies": {
55
- "@event-driven-io/emmett": "0.12.1",
55
+ "@event-driven-io/emmett": "0.14.0",
56
56
  "@types/pg": "^8.11.6",
57
57
  "@types/pg-format": "^1.0.5",
58
58
  "pg": "^8.12.0",
59
- "pg-format": "^1.0.4"
59
+ "pg-format": "^1.0.4",
60
+ "@event-driven-io/pongo": "0.7.0",
61
+ "@event-driven-io/dumbo": "0.4.1"
60
62
  }
61
63
  }