@stablemates/workhorse-prisma 0.9.0 → 0.11.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.
package/README.md CHANGED
@@ -13,12 +13,19 @@ The Prisma ORM provider for enqueuing Workhorse tasks through Prisma transaction
13
13
  npm install @stablemates/workhorse @stablemates/workhorse-prisma @prisma/client
14
14
  ```
15
15
 
16
+ Install the Workhorse schema with [Workhorse core](https://workhorse.run/docs/installation) before
17
+ the first enqueue. If the schema is missing, the queue refuses the enqueue.
18
+
19
+ The adapter supports Prisma Client 6 and 7. Prisma 7 requires a driver adapter, such as
20
+ `@prisma/adapter-pg`, in the `PrismaClient` constructor.
21
+
16
22
  ## Enqueue in a transaction
17
23
 
18
24
  ```ts
19
25
  import { PrismaClient } from "@prisma/client";
20
26
  import { createPrismaAdapter } from "@stablemates/workhorse-prisma";
21
27
 
28
+ // On Prisma 7: new PrismaClient({ adapter: new PrismaPg({ connectionString }) })
22
29
  const prisma = new PrismaClient();
23
30
  const workhorse = createPrismaAdapter(prisma, { close: () => prisma.$disconnect() });
24
31
 
@@ -32,11 +39,12 @@ await prisma.$transaction(async (tx) => {
32
39
 
33
40
  The adapter never disconnects a caller-owned Prisma client unless `close` is configured.
34
41
  [Workhorse core](https://workhorse.run/docs/installation) owns schema installation and changes.
35
- A process that runs workers passes a `pg` pool as `pool`. Workers take their heartbeat and
36
- `LISTEN/NOTIFY` connections from it, and refuse to start without it unless `sharedHeartbeats` is
37
- set. Database errors
42
+ A process that runs workers passes a `pg` pool with a maximum size (`max`) of at least 3 as `pool`.
43
+ Workers take their heartbeat and `LISTEN/NOTIFY` connections from it. Without that pool,
44
+ `createWorker()` throws an error that names the step. Database errors
38
45
  become `PrismaQueryError`, with the original error in `cause` and a nested PostgreSQL code copied to
39
- `code` when Prisma exposes one.
46
+ `code` when Prisma exposes one. On Prisma 7, the code comes from the error that the driver adapter
47
+ reported.
40
48
 
41
49
  ## Next
42
50
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAGhC,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,eAAe,CAAC,CAAC,GAAG,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACnF;AAED,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;CAAG;AAEvE,qBAAa,gBAAiB,SAAQ,UAAU;gBAClC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAI9C;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,cAAc,EACxB,cAAc,CAAC,EAAE,2BAA2B,GAC3C,SAAS,CAOX;AAED,yDAAyD;AACzD,wBAAgB,mBAAmB,CAAC,YAAY,SAAS,cAAc,GAAG,cAAc,EACtF,QAAQ,EAAE,cAAc,EACxB,OAAO,GAAE,oBAAyB,GACjC,gBAAgB,CAAC,YAAY,CAAC,CAMhC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAGhC,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,eAAe,CAAC,CAAC,GAAG,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CACnF;AAED,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;CAAG;AAEvE,qBAAa,gBAAiB,SAAQ,UAAU;gBAClC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAI9C;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,cAAc,EACxB,cAAc,CAAC,EAAE,2BAA2B,GAC3C,SAAS,CAOX;AAED,yDAAyD;AACzD,wBAAgB,mBAAmB,CAAC,YAAY,SAAS,cAAc,GAAG,cAAc,EACtF,QAAQ,EAAE,cAAc,EACxB,OAAO,GAAE,oBAAyB,GACjC,gBAAgB,CAAC,YAAY,CAAC,CAOhC"}
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ export function createPrismaAdapter(database, options = {}) {
19
19
  database,
20
20
  toQueryable: prismaQueryable,
21
21
  ...options,
22
+ provider: "Prisma",
22
23
  });
23
24
  }
24
25
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,GAKX,MAAM,wBAAwB,CAAC;AAUhC,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAC9C,YAAY,SAAiB,EAAE,KAAc;QAC3C,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,yFAAyF;AACzF,MAAM,UAAU,eAAe,CAC7B,QAAwB,EACxB,cAA4C;IAE5C,OAAO,uBAAuB,CAAC;QAC7B,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,CAC7B,QAAQ,CAAC,eAAe,CAAmB,SAAS,EAAE,GAAG,MAAM,CAAC;QAClE,SAAS,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC;QACvE,cAAc;KACf,CAAC,CAAC;AACL,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,mBAAmB,CACjC,QAAwB,EACxB,UAAgC,EAAE;IAElC,OAAO,qBAAqB,CAA+B;QACzD,QAAQ;QACR,WAAW,EAAE,eAAe;QAC5B,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,GAKX,MAAM,wBAAwB,CAAC;AAUhC,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IAC9C,YAAY,SAAiB,EAAE,KAAc;QAC3C,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED,yFAAyF;AACzF,MAAM,UAAU,eAAe,CAC7B,QAAwB,EACxB,cAA4C;IAE5C,OAAO,uBAAuB,CAAC;QAC7B,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,CAC7B,QAAQ,CAAC,eAAe,CAAmB,SAAS,EAAE,GAAG,MAAM,CAAC;QAClE,SAAS,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC;QACvE,cAAc;KACf,CAAC,CAAC;AACL,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,mBAAmB,CACjC,QAAwB,EACxB,UAAgC,EAAE;IAElC,OAAO,qBAAqB,CAA+B;QACzD,QAAQ;QACR,WAAW,EAAE,eAAe;QAC5B,GAAG,OAAO;QACV,QAAQ,EAAE,QAAQ;KACnB,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stablemates/workhorse-prisma",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Public beta Prisma ORM provider for Workhorse",
5
5
  "homepage": "https://workhorse.run",
6
6
  "bugs": {
@@ -35,11 +35,11 @@
35
35
  "@types/pg": "^8.23.1",
36
36
  "pg": "^8.23.1",
37
37
  "prisma": "6.19.3",
38
- "@stablemates/workhorse": "0.9.0"
38
+ "@stablemates/workhorse": "0.11.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@prisma/client": ">=6 <7",
42
- "@stablemates/workhorse": ">=0.9.0 <0.10.0"
41
+ "@prisma/client": ">=6 <8",
42
+ "@stablemates/workhorse": ">=0.11.0 <0.12.0"
43
43
  },
44
44
  "engines": {
45
45
  "node": ">=22"