@btravstack/prisma 0.14.0 → 0.15.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/dist/index.cjs +9 -8
- package/dist/index.mjs +9 -8
- package/package.json +9 -10
package/dist/index.cjs
CHANGED
|
@@ -6,8 +6,8 @@ let _prisma_adapter_pg = require("@prisma/adapter-pg");
|
|
|
6
6
|
let unthrown = require("unthrown");
|
|
7
7
|
//#region src/instrument.ts
|
|
8
8
|
/**
|
|
9
|
-
* Every query,
|
|
10
|
-
* line if it failed.
|
|
9
|
+
* Every query, handed to the graph's observers: a count of how it came out, and
|
|
10
|
+
* a log line if it failed.
|
|
11
11
|
*
|
|
12
12
|
* **This is why a generated client can be instrumented at all.** Prisma's
|
|
13
13
|
* `$extends` takes a `query` component, and `$allModels.$allOperations`
|
|
@@ -16,10 +16,11 @@ let unthrown = require("unthrown");
|
|
|
16
16
|
* revision of this package claimed instrumentation was impossible for that
|
|
17
17
|
* reason; it was wrong, and this is the mechanism it missed.
|
|
18
18
|
*
|
|
19
|
-
* **It deliberately opens no span.** `@
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
19
|
+
* **It deliberately opens no span.** Prisma's own `@prisma/instrumentation`,
|
|
20
|
+
* which this package offers to `Instrumentations` and
|
|
21
|
+
* `@btravstack/observability/otel` enables, traces at the ENGINE level — the
|
|
22
|
+
* real SQL, the connection acquisition, the serialisation — all of it below
|
|
23
|
+
* what a client-level wrapper can see. Emitting a span here as well would put two
|
|
23
24
|
* spans on every query for strictly less information. What this wrapper keeps
|
|
24
25
|
* is the pair Prisma's instrumentation does not do at all: a metric, and an
|
|
25
26
|
* error line correlated with the ambient unit.
|
|
@@ -143,7 +144,7 @@ const prismaDatabase = (name) => ({ client }) => {
|
|
|
143
144
|
inject: { logger: _btravstack_core.Logger },
|
|
144
145
|
sync: ({ logger }) => () => loadPrismaInstrumentation(logger)
|
|
145
146
|
});
|
|
146
|
-
const
|
|
147
|
+
const database = (0, _btravstack_di.Module)(name)({
|
|
147
148
|
needs: [_btravstack_config.Env, _btravstack_core.Logger],
|
|
148
149
|
provides: [
|
|
149
150
|
config,
|
|
@@ -161,7 +162,7 @@ const prismaDatabase = (name) => ({ client }) => {
|
|
|
161
162
|
_btravstack_core.Instrumentations
|
|
162
163
|
]
|
|
163
164
|
});
|
|
164
|
-
return Object.assign(
|
|
165
|
+
return Object.assign(database, { port: DatabasePort });
|
|
165
166
|
};
|
|
166
167
|
//#endregion
|
|
167
168
|
exports.prismaDatabase = prismaDatabase;
|
package/dist/index.mjs
CHANGED
|
@@ -5,8 +5,8 @@ import { PrismaPg } from "@prisma/adapter-pg";
|
|
|
5
5
|
import { fromPromise, fromSafePromise } from "unthrown";
|
|
6
6
|
//#region src/instrument.ts
|
|
7
7
|
/**
|
|
8
|
-
* Every query,
|
|
9
|
-
* line if it failed.
|
|
8
|
+
* Every query, handed to the graph's observers: a count of how it came out, and
|
|
9
|
+
* a log line if it failed.
|
|
10
10
|
*
|
|
11
11
|
* **This is why a generated client can be instrumented at all.** Prisma's
|
|
12
12
|
* `$extends` takes a `query` component, and `$allModels.$allOperations`
|
|
@@ -15,10 +15,11 @@ import { fromPromise, fromSafePromise } from "unthrown";
|
|
|
15
15
|
* revision of this package claimed instrumentation was impossible for that
|
|
16
16
|
* reason; it was wrong, and this is the mechanism it missed.
|
|
17
17
|
*
|
|
18
|
-
* **It deliberately opens no span.** `@
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* **It deliberately opens no span.** Prisma's own `@prisma/instrumentation`,
|
|
19
|
+
* which this package offers to `Instrumentations` and
|
|
20
|
+
* `@btravstack/observability/otel` enables, traces at the ENGINE level — the
|
|
21
|
+
* real SQL, the connection acquisition, the serialisation — all of it below
|
|
22
|
+
* what a client-level wrapper can see. Emitting a span here as well would put two
|
|
22
23
|
* spans on every query for strictly less information. What this wrapper keeps
|
|
23
24
|
* is the pair Prisma's instrumentation does not do at all: a metric, and an
|
|
24
25
|
* error line correlated with the ambient unit.
|
|
@@ -142,7 +143,7 @@ const prismaDatabase = (name) => ({ client }) => {
|
|
|
142
143
|
inject: { logger: Logger },
|
|
143
144
|
sync: ({ logger }) => () => loadPrismaInstrumentation(logger)
|
|
144
145
|
});
|
|
145
|
-
const
|
|
146
|
+
const database = Module(name)({
|
|
146
147
|
needs: [Env, Logger],
|
|
147
148
|
provides: [
|
|
148
149
|
config,
|
|
@@ -160,7 +161,7 @@ const prismaDatabase = (name) => ({ client }) => {
|
|
|
160
161
|
Instrumentations
|
|
161
162
|
]
|
|
162
163
|
});
|
|
163
|
-
return Object.assign(
|
|
164
|
+
return Object.assign(database, { port: DatabasePort });
|
|
164
165
|
};
|
|
165
166
|
//#endregion
|
|
166
167
|
export { prismaDatabase };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btravstack/prisma",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "The Prisma starter for @btravstack/core: DATABASE_URL through Config, the Postgres driver adapter, and a client whose pool is the application scope's",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"database",
|
|
@@ -53,6 +53,9 @@
|
|
|
53
53
|
"./package.json": "./package.json"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
+
"@btravstack/config": "0.15.0",
|
|
57
|
+
"@btravstack/core": "0.15.0",
|
|
58
|
+
"@btravstack/di": "0.15.0",
|
|
56
59
|
"@btravstack/tsconfig": "0.4.0",
|
|
57
60
|
"@prisma/adapter-pg": "7.10.0",
|
|
58
61
|
"@prisma/client": "7.10.0",
|
|
@@ -63,19 +66,16 @@
|
|
|
63
66
|
"tsdown": "0.23.0",
|
|
64
67
|
"typescript": "7.0.2",
|
|
65
68
|
"unthrown": "5.8.0",
|
|
66
|
-
"vitest": "4.1.11"
|
|
67
|
-
"@btravstack/config": "0.14.0",
|
|
68
|
-
"@btravstack/core": "0.14.0",
|
|
69
|
-
"@btravstack/di": "0.14.0"
|
|
69
|
+
"vitest": "4.1.11"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
+
"@btravstack/config": "^0.15.0",
|
|
73
|
+
"@btravstack/core": "^0.15.0",
|
|
74
|
+
"@btravstack/di": "^0.15.0",
|
|
72
75
|
"@prisma/adapter-pg": "^7.0.0",
|
|
73
76
|
"@prisma/client": "^7.10.0",
|
|
74
77
|
"@prisma/instrumentation": "^7.0.0",
|
|
75
|
-
"unthrown": "^5.0.0"
|
|
76
|
-
"@btravstack/config": "^0.14.0",
|
|
77
|
-
"@btravstack/core": "^0.14.0",
|
|
78
|
-
"@btravstack/di": "^0.14.0"
|
|
78
|
+
"unthrown": "^5.0.0"
|
|
79
79
|
},
|
|
80
80
|
"peerDependenciesMeta": {
|
|
81
81
|
"@prisma/client": {
|
|
@@ -92,7 +92,6 @@
|
|
|
92
92
|
"build": "tsdown src/index.ts src/rls.ts --format cjs,esm --dts --clean",
|
|
93
93
|
"dev": "tsdown src/index.ts src/rls.ts --format cjs,esm --dts --watch",
|
|
94
94
|
"test": "vitest run --coverage",
|
|
95
|
-
"test:types": "tsc -p tsconfig.test-d.json --noEmit",
|
|
96
95
|
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.test-d.json"
|
|
97
96
|
}
|
|
98
97
|
}
|