@eventualize/postgres-storage-adapter 1.0.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 (57) hide show
  1. package/dist/EvDbPostgresPrismaClientFactory.d.ts +3 -0
  2. package/dist/EvDbPostgresPrismaClientFactory.js +10 -0
  3. package/dist/EvDbPostgresPrismaClientFactory.js.map +1 -0
  4. package/dist/generated/prisma/browser.d.ts +19 -0
  5. package/dist/generated/prisma/browser.js +18 -0
  6. package/dist/generated/prisma/browser.js.map +1 -0
  7. package/dist/generated/prisma/client.d.ts +36 -0
  8. package/dist/generated/prisma/client.js +33 -0
  9. package/dist/generated/prisma/client.js.map +1 -0
  10. package/dist/generated/prisma/commonInputTypes.d.ts +378 -0
  11. package/dist/generated/prisma/commonInputTypes.js +11 -0
  12. package/dist/generated/prisma/commonInputTypes.js.map +1 -0
  13. package/dist/generated/prisma/enums.d.ts +1 -0
  14. package/dist/generated/prisma/enums.js +11 -0
  15. package/dist/generated/prisma/enums.js.map +1 -0
  16. package/dist/generated/prisma/internal/class.d.ts +148 -0
  17. package/dist/generated/prisma/internal/class.js +41 -0
  18. package/dist/generated/prisma/internal/class.js.map +1 -0
  19. package/dist/generated/prisma/internal/prismaNamespace.d.ts +759 -0
  20. package/dist/generated/prisma/internal/prismaNamespace.js +144 -0
  21. package/dist/generated/prisma/internal/prismaNamespace.js.map +1 -0
  22. package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +109 -0
  23. package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +115 -0
  24. package/dist/generated/prisma/internal/prismaNamespaceBrowser.js.map +1 -0
  25. package/dist/generated/prisma/models/events.d.ts +1178 -0
  26. package/dist/generated/prisma/models/events.js +2 -0
  27. package/dist/generated/prisma/models/events.js.map +1 -0
  28. package/dist/generated/prisma/models/outbox.d.ts +1261 -0
  29. package/dist/generated/prisma/models/outbox.js +2 -0
  30. package/dist/generated/prisma/models/outbox.js.map +1 -0
  31. package/dist/generated/prisma/models/snapshot.d.ts +1088 -0
  32. package/dist/generated/prisma/models/snapshot.js +2 -0
  33. package/dist/generated/prisma/models/snapshot.js.map +1 -0
  34. package/dist/generated/prisma/models.d.ts +4 -0
  35. package/dist/generated/prisma/models.js +2 -0
  36. package/dist/generated/prisma/models.js.map +1 -0
  37. package/package.json +31 -0
  38. package/prisma/migrations/20251211113311_change_outbox_payload_to_json/migration.sql +62 -0
  39. package/prisma/migrations/migration_lock.toml +3 -0
  40. package/prisma/schema.prisma +61 -0
  41. package/prisma.config.d.ts +3 -0
  42. package/prisma.config.js +14 -0
  43. package/prisma.config.js.map +1 -0
  44. package/prisma.config.ts +14 -0
  45. package/src/EvDbPostgresPrismaClientFactory.ts +12 -0
  46. package/src/generated/prisma/browser.ts +34 -0
  47. package/src/generated/prisma/client.ts +56 -0
  48. package/src/generated/prisma/commonInputTypes.ts +459 -0
  49. package/src/generated/prisma/enums.ts +15 -0
  50. package/src/generated/prisma/internal/class.ts +210 -0
  51. package/src/generated/prisma/internal/prismaNamespace.ts +1029 -0
  52. package/src/generated/prisma/internal/prismaNamespaceBrowser.ts +169 -0
  53. package/src/generated/prisma/models/events.ts +1339 -0
  54. package/src/generated/prisma/models/outbox.ts +1420 -0
  55. package/src/generated/prisma/models/snapshot.ts +1246 -0
  56. package/src/generated/prisma/models.ts +14 -0
  57. package/tsconfig.json +19 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=snapshot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../../../src/generated/prisma/models/snapshot.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export type * from './models/events.js';
2
+ export type * from './models/outbox.js';
3
+ export type * from './models/snapshot.js';
4
+ export type * from './commonInputTypes.js';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/generated/prisma/models.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@eventualize/postgres-storage-adapter",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ },
12
+ "./*": "./dist/*.js"
13
+ },
14
+ "scripts": {
15
+ "build": "tsc --build",
16
+ "clean": "rimraf dist",
17
+ "rebuild": "npm run clean && npm run build",
18
+ "test": "echo not tests implemented yet."
19
+ },
20
+ "license": "ISC",
21
+ "type": "module",
22
+ "dependencies": {
23
+ "@eventualize/relational-storage-adapter": "^1.0.0",
24
+ "@prisma/adapter-pg": "^7.1.0"
25
+ },
26
+ "devDependencies": {
27
+ "@prisma/client": "^7.1.0",
28
+ "dotenv": "^17.2.3",
29
+ "prisma": "^7.1.0"
30
+ }
31
+ }
@@ -0,0 +1,62 @@
1
+ -- CreateTable
2
+ CREATE TABLE "events" (
3
+ "id" UUID NOT NULL,
4
+ "stream_type" VARCHAR(150) NOT NULL,
5
+ "stream_id" VARCHAR(150) NOT NULL,
6
+ "offset" BIGINT NOT NULL,
7
+ "event_type" VARCHAR(150) NOT NULL,
8
+ "telemetry_context" JSON,
9
+ "captured_by" VARCHAR(150) NOT NULL,
10
+ "captured_at" TIMESTAMPTZ(6) NOT NULL,
11
+ "stored_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
12
+ "payload" JSON NOT NULL,
13
+
14
+ CONSTRAINT "events_pkey" PRIMARY KEY ("stream_type","stream_id","offset")
15
+ );
16
+
17
+ -- CreateTable
18
+ CREATE TABLE "outbox" (
19
+ "id" UUID NOT NULL,
20
+ "stream_type" VARCHAR(150) NOT NULL,
21
+ "stream_id" VARCHAR(150) NOT NULL,
22
+ "offset" BIGINT NOT NULL,
23
+ "event_type" VARCHAR(150) NOT NULL,
24
+ "channel" VARCHAR(150) NOT NULL,
25
+ "message_type" VARCHAR(150) NOT NULL,
26
+ "serialize_type" VARCHAR(150) NOT NULL,
27
+ "telemetry_context" BYTEA,
28
+ "captured_by" VARCHAR(150) NOT NULL,
29
+ "captured_at" TIMESTAMPTZ(6) NOT NULL,
30
+ "stored_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
31
+ "payload" JSON NOT NULL,
32
+
33
+ CONSTRAINT "outbox_pkey" PRIMARY KEY ("captured_at","stream_type","stream_id","offset","channel","message_type")
34
+ );
35
+
36
+ -- CreateTable
37
+ CREATE TABLE "snapshot" (
38
+ "id" UUID NOT NULL,
39
+ "stream_type" VARCHAR(150) NOT NULL,
40
+ "stream_id" VARCHAR(150) NOT NULL,
41
+ "view_name" VARCHAR(150) NOT NULL,
42
+ "offset" BIGINT NOT NULL,
43
+ "state" JSON NOT NULL,
44
+ "stored_at" TIMESTAMPTZ(6) NOT NULL DEFAULT CURRENT_TIMESTAMP,
45
+
46
+ CONSTRAINT "snapshot_pkey" PRIMARY KEY ("stream_type","stream_id","view_name","offset")
47
+ );
48
+
49
+ -- CreateIndex
50
+ CREATE INDEX "ix_event_7ae7ea3b165349e09b3fe6d66a69fd72" ON "events"("stream_type", "stream_id", "offset");
51
+
52
+ -- CreateIndex
53
+ CREATE INDEX "ix_event_stored_at_7ae7ea3b165349e09b3fe6d66a69fd72" ON "events"("stored_at");
54
+
55
+ -- CreateIndex
56
+ CREATE INDEX "ix_outbox_7ae7ea3b165349e09b3fe6d66a69fd72" ON "outbox"("stream_type", "stream_id", "offset", "channel", "message_type");
57
+
58
+ -- CreateIndex
59
+ CREATE INDEX "ix_storedat_outbox_captured_at_7ae7ea3b165349e09b3fe6d66a69fd72" ON "outbox"("stored_at", "channel", "message_type", "offset");
60
+
61
+ -- CreateIndex
62
+ CREATE INDEX "ix_snapshot_earlier_stored_at_7ae7ea3b165349e09b3fe6d66a69fd72" ON "snapshot"("stream_type", "stream_id", "view_name", "stored_at");
@@ -0,0 +1,3 @@
1
+ # Please do not edit this file manually
2
+ # It should be added in your version-control system (e.g., Git)
3
+ provider = "postgresql"
@@ -0,0 +1,61 @@
1
+ generator client {
2
+ provider = "prisma-client"
3
+ output = "../src/generated/prisma"
4
+ }
5
+
6
+ datasource db {
7
+ provider = "postgresql"
8
+ }
9
+
10
+ /// This table contains check constraints and requires additional setup for migrations. Visit https://pris.ly/d/check-constraints for more info.
11
+ model events {
12
+ id String @db.Uuid
13
+ stream_type String @db.VarChar(150)
14
+ stream_id String @db.VarChar(150)
15
+ offset BigInt
16
+ event_type String @db.VarChar(150)
17
+ telemetry_context Json? @db.Json
18
+ captured_by String @db.VarChar(150)
19
+ captured_at DateTime @db.Timestamptz(6)
20
+ stored_at DateTime @default(now()) @db.Timestamptz(6)
21
+ payload Json @db.Json
22
+
23
+ @@id([stream_type, stream_id, offset])
24
+ @@index([stream_type, stream_id, offset], map: "ix_event_7ae7ea3b165349e09b3fe6d66a69fd72")
25
+ @@index([stored_at], map: "ix_event_stored_at_7ae7ea3b165349e09b3fe6d66a69fd72")
26
+ }
27
+
28
+ /// This table contains check constraints and requires additional setup for migrations. Visit https://pris.ly/d/check-constraints for more info.
29
+ model outbox {
30
+ id String @db.Uuid
31
+ stream_type String @db.VarChar(150)
32
+ stream_id String @db.VarChar(150)
33
+ offset BigInt
34
+ event_type String @db.VarChar(150)
35
+ channel String @db.VarChar(150)
36
+ message_type String @db.VarChar(150)
37
+ serialize_type String @db.VarChar(150)
38
+ telemetry_context Bytes?
39
+ captured_by String @db.VarChar(150)
40
+ captured_at DateTime @db.Timestamptz(6)
41
+ stored_at DateTime @default(now()) @db.Timestamptz(6)
42
+ payload Json @db.Json
43
+
44
+ @@id([captured_at, stream_type, stream_id, offset, channel, message_type])
45
+ @@index([stream_type, stream_id, offset, channel, message_type], map: "ix_outbox_7ae7ea3b165349e09b3fe6d66a69fd72")
46
+ @@index([stored_at, channel, message_type, offset], map: "ix_storedat_outbox_captured_at_7ae7ea3b165349e09b3fe6d66a69fd72")
47
+ }
48
+
49
+ /// This table contains check constraints and requires additional setup for migrations. Visit https://pris.ly/d/check-constraints for more info.
50
+ model snapshot {
51
+ id String @db.Uuid
52
+ stream_type String @db.VarChar(150)
53
+ stream_id String @db.VarChar(150)
54
+ view_name String @db.VarChar(150)
55
+ offset BigInt
56
+ state Json @db.Json
57
+ stored_at DateTime @default(now()) @db.Timestamptz(6)
58
+
59
+ @@id([stream_type, stream_id, view_name, offset])
60
+ @@index([stream_type, stream_id, view_name, stored_at], map: "ix_snapshot_earlier_stored_at_7ae7ea3b165349e09b3fe6d66a69fd72")
61
+ }
@@ -0,0 +1,3 @@
1
+ import "dotenv/config";
2
+ declare const _default: import("@prisma/config").PrismaConfigInternal;
3
+ export default _default;
@@ -0,0 +1,14 @@
1
+ // This file was generated by Prisma and assumes you have installed the following:
2
+ // npm install --save-dev prisma dotenv
3
+ import "dotenv/config";
4
+ import { defineConfig, env } from "prisma/config";
5
+ export default defineConfig({
6
+ schema: "prisma/schema.prisma",
7
+ migrations: {
8
+ path: "prisma/migrations",
9
+ },
10
+ datasource: {
11
+ url: env("POSTGRES_URL"),
12
+ },
13
+ });
14
+ //# sourceMappingURL=prisma.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prisma.config.js","sourceRoot":"","sources":["prisma.config.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,uCAAuC;AACvC,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAElD,eAAe,YAAY,CAAC;IAC1B,MAAM,EAAE,sBAAsB;IAC9B,UAAU,EAAE;QACV,IAAI,EAAE,mBAAmB;KAC1B;IACD,UAAU,EAAE;QACV,GAAG,EAAE,GAAG,CAAC,cAAc,CAAC;KACzB;CACF,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ // This file was generated by Prisma and assumes you have installed the following:
2
+ // npm install --save-dev prisma dotenv
3
+ import "dotenv/config";
4
+ import { defineConfig, env } from "prisma/config";
5
+
6
+ export default defineConfig({
7
+ schema: "prisma/schema.prisma",
8
+ migrations: {
9
+ path: "prisma/migrations",
10
+ },
11
+ datasource: {
12
+ url: env("POSTGRES_URL"),
13
+ },
14
+ });
@@ -0,0 +1,12 @@
1
+ import { PrismaPg } from '@prisma/adapter-pg';
2
+
3
+
4
+ import { PrismaClient } from './generated/prisma/client.js';
5
+
6
+ export default class EvDbPostgresPrismaClientFactory {
7
+ public static create() {
8
+ const connectionString = `${process.env.POSTGRES_URL}`
9
+ const adapter = new PrismaPg({ connectionString })
10
+ return new PrismaClient({ adapter })
11
+ }
12
+ }
@@ -0,0 +1,34 @@
1
+
2
+ /* !!! This is code generated by Prisma. Do not edit directly. !!! */
3
+ /* eslint-disable */
4
+ // biome-ignore-all lint: generated file
5
+ // @ts-nocheck
6
+ /*
7
+ * This file should be your main import to use Prisma-related types and utilities in a browser.
8
+ * Use it to get access to models, enums, and input types.
9
+ *
10
+ * This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.
11
+ * See `client.ts` for the standard, server-side entry point.
12
+ *
13
+ * 🟢 You can import this file directly.
14
+ */
15
+
16
+ import * as Prisma from './internal/prismaNamespaceBrowser.js'
17
+ export { Prisma }
18
+ export * as $Enums from './enums.js'
19
+ export * from './enums.js';
20
+ /**
21
+ * Model events
22
+ * This table contains check constraints and requires additional setup for migrations. Visit https://pris.ly/d/check-constraints for more info.
23
+ */
24
+ export type events = Prisma.eventsModel
25
+ /**
26
+ * Model outbox
27
+ * This table contains check constraints and requires additional setup for migrations. Visit https://pris.ly/d/check-constraints for more info.
28
+ */
29
+ export type outbox = Prisma.outboxModel
30
+ /**
31
+ * Model snapshot
32
+ * This table contains check constraints and requires additional setup for migrations. Visit https://pris.ly/d/check-constraints for more info.
33
+ */
34
+ export type snapshot = Prisma.snapshotModel
@@ -0,0 +1,56 @@
1
+
2
+ /* !!! This is code generated by Prisma. Do not edit directly. !!! */
3
+ /* eslint-disable */
4
+ // biome-ignore-all lint: generated file
5
+ // @ts-nocheck
6
+ /*
7
+ * This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
8
+ * If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.
9
+ *
10
+ * 🟢 You can import this file directly.
11
+ */
12
+
13
+ import * as process from 'node:process'
14
+ import * as path from 'node:path'
15
+ import { fileURLToPath } from 'node:url'
16
+ globalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url))
17
+
18
+ import * as runtime from "@prisma/client/runtime/client"
19
+ import * as $Enums from "./enums.js"
20
+ import * as $Class from "./internal/class.js"
21
+ import * as Prisma from "./internal/prismaNamespace.js"
22
+
23
+ export * as $Enums from './enums.js'
24
+ export * from "./enums.js"
25
+ /**
26
+ * ## Prisma Client
27
+ *
28
+ * Type-safe database client for TypeScript
29
+ * @example
30
+ * ```
31
+ * const prisma = new PrismaClient()
32
+ * // Fetch zero or more Events
33
+ * const events = await prisma.events.findMany()
34
+ * ```
35
+ *
36
+ * Read more in our [docs](https://pris.ly/d/client).
37
+ */
38
+ export const PrismaClient = $Class.getPrismaClientClass()
39
+ export type PrismaClient<LogOpts extends Prisma.LogLevel = never, OmitOpts extends Prisma.PrismaClientOptions["omit"] = Prisma.PrismaClientOptions["omit"], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>
40
+ export { Prisma }
41
+
42
+ /**
43
+ * Model events
44
+ * This table contains check constraints and requires additional setup for migrations. Visit https://pris.ly/d/check-constraints for more info.
45
+ */
46
+ export type events = Prisma.eventsModel
47
+ /**
48
+ * Model outbox
49
+ * This table contains check constraints and requires additional setup for migrations. Visit https://pris.ly/d/check-constraints for more info.
50
+ */
51
+ export type outbox = Prisma.outboxModel
52
+ /**
53
+ * Model snapshot
54
+ * This table contains check constraints and requires additional setup for migrations. Visit https://pris.ly/d/check-constraints for more info.
55
+ */
56
+ export type snapshot = Prisma.snapshotModel