bosskit 0.2.0 → 0.2.1
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 +8 -12
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -372,23 +372,19 @@ await db.transaction(async (tx) => {
|
|
|
372
372
|
```
|
|
373
373
|
|
|
374
374
|
For `tx` to typecheck as `enqueue`'s `db` argument, the type you use for `Db`
|
|
375
|
-
(the parameter type of your `toBossDb` function) must be
|
|
376
|
-
`
|
|
377
|
-
|
|
378
|
-
|
|
375
|
+
(the parameter type of your `toBossDb` function) must not be the type
|
|
376
|
+
`drizzle(...)` returns. That is `PostgresJsDatabase<TSchema> & { $client }`, and
|
|
377
|
+
a transaction has no `$client`. Name the class instead (`NodePgDatabase` for
|
|
378
|
+
node-postgres, and so on):
|
|
379
379
|
|
|
380
380
|
```ts
|
|
381
|
-
import type {
|
|
382
|
-
import
|
|
381
|
+
import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
|
|
382
|
+
import * as schema from "./schema";
|
|
383
383
|
|
|
384
|
-
|
|
384
|
+
// Adds only a static brand over PgDatabase, so a transaction is assignable.
|
|
385
|
+
type Db = PostgresJsDatabase<typeof schema>;
|
|
385
386
|
```
|
|
386
387
|
|
|
387
|
-
Both type arguments matter: leaving the schema parameter at its default
|
|
388
|
-
(`Record<string, never>`) rejects a handle created with a schema, and the
|
|
389
|
-
first one names the driver. Swap `PostgresJsQueryResultHKT` for your driver's
|
|
390
|
-
equivalent (`NodePgQueryResultHKT`, and so on).
|
|
391
|
-
|
|
392
388
|
## Testing / contributing
|
|
393
389
|
|
|
394
390
|
Unit tests need no external services:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bosskit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Type-safe, user-scoped job queues for pg-boss, powered by Zod.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Kenny Williams",
|
|
@@ -12,18 +12,20 @@
|
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
14
|
"types": "./dist/index.d.ts",
|
|
15
|
-
"import": "./dist/index.js"
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"default": "./dist/index.js"
|
|
16
17
|
}
|
|
17
18
|
},
|
|
18
19
|
"scripts": {
|
|
19
20
|
"build": "tsup",
|
|
21
|
+
"check:exports": "node -e \"require('bosskit')\" && node --input-type=module -e \"import 'bosskit'\"",
|
|
20
22
|
"test": "vitest run",
|
|
21
23
|
"test:watch": "vitest",
|
|
22
24
|
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
23
25
|
"typecheck": "tsc --noEmit",
|
|
24
26
|
"check": "biome check .",
|
|
25
27
|
"check:fix": "biome check --write .",
|
|
26
|
-
"prepublishOnly": "pnpm check && pnpm typecheck && pnpm test && pnpm build"
|
|
28
|
+
"prepublishOnly": "pnpm check && pnpm typecheck && pnpm test && pnpm build && pnpm check:exports"
|
|
27
29
|
},
|
|
28
30
|
"homepage": "https://github.com/kennyjwilli/bosskit#readme",
|
|
29
31
|
"bugs": {
|