@beignet/provider-db-drizzle 0.0.21 → 0.0.23
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/CHANGELOG.md +13 -0
- package/README.md +145 -13
- package/dist/mysql/index.d.ts +40 -1
- package/dist/mysql/index.d.ts.map +1 -1
- package/dist/mysql/index.js +75 -1
- package/dist/mysql/index.js.map +1 -1
- package/dist/postgres/index.d.ts +36 -1
- package/dist/postgres/index.d.ts.map +1 -1
- package/dist/postgres/index.js +71 -1
- package/dist/postgres/index.js.map +1 -1
- package/dist/shared/audit-core.d.ts +33 -0
- package/dist/shared/audit-core.d.ts.map +1 -0
- package/dist/shared/audit-core.js +85 -0
- package/dist/shared/audit-core.js.map +1 -0
- package/dist/shared/health.d.ts +10 -0
- package/dist/shared/health.d.ts.map +1 -0
- package/dist/shared/health.js +14 -0
- package/dist/shared/health.js.map +1 -0
- package/dist/sqlite/index.d.ts +36 -2
- package/dist/sqlite/index.d.ts.map +1 -1
- package/dist/sqlite/index.js +71 -1
- package/dist/sqlite/index.js.map +1 -1
- package/package.json +2 -2
- package/src/mysql/index.ts +121 -1
- package/src/postgres/index.ts +117 -1
- package/src/shared/audit-core.ts +134 -0
- package/src/shared/health.ts +25 -0
- package/src/sqlite/index.ts +117 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @beignet/provider-db-drizzle
|
|
2
2
|
|
|
3
|
+
## 0.0.23
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 02f09fb: Add Drizzle audit log setup statements and `AuditLogPort` factories for SQLite, Postgres, and MySQL.
|
|
8
|
+
|
|
9
|
+
## 0.0.22
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Add app-owned readiness helpers, first-party provider health checks, generated `/api/ready` routes, and doctor readiness hints.
|
|
14
|
+
- Normalize provider README setup guidance across first-party provider packages.
|
|
15
|
+
|
|
3
16
|
## 0.0.21
|
|
4
17
|
|
|
5
18
|
## 0.0.20
|
package/README.md
CHANGED
|
@@ -22,8 +22,8 @@ workflow.
|
|
|
22
22
|
- Factory-based provider creation with your schema at the call site.
|
|
23
23
|
- Full TypeScript inference from your Drizzle schema.
|
|
24
24
|
- One subpath per backend — SQLite (libSQL/Turso), Postgres (node-postgres),
|
|
25
|
-
and MySQL (`mysql2`) — with the same provider, Unit of Work,
|
|
26
|
-
idempotency surface.
|
|
25
|
+
and MySQL (`mysql2`) — with the same provider, Unit of Work, audit log,
|
|
26
|
+
outbox, and idempotency surface.
|
|
27
27
|
- Keeps runtime provider wiring separate from Drizzle CLI configuration.
|
|
28
28
|
- Provides a Unit of Work helper that can build transaction-scoped repositories,
|
|
29
29
|
audit logs, outbox recorders, and other app-owned ports from one Drizzle
|
|
@@ -62,6 +62,16 @@ bun add @beignet/provider-db-drizzle @beignet/core drizzle-orm pg
|
|
|
62
62
|
bun add @beignet/provider-db-drizzle @beignet/core drizzle-orm mysql2
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
+
`beignet doctor --strict` checks the provider variant an app registers:
|
|
66
|
+
|
|
67
|
+
- SQLite requires `SQLITE_DB_URL` unless the app passes a client directly.
|
|
68
|
+
`SQLITE_DB_AUTH_TOKEN` is optional for hosted libSQL/Turso.
|
|
69
|
+
- Postgres requires `POSTGRES_DB_URL`.
|
|
70
|
+
- MySQL requires `MYSQL_DB_URL`.
|
|
71
|
+
|
|
72
|
+
Doctor also checks standard Drizzle config, schema exports, database scripts,
|
|
73
|
+
seed/reset entrypoints, and provider registration drift in generated apps.
|
|
74
|
+
|
|
65
75
|
## Setup
|
|
66
76
|
|
|
67
77
|
### 1. Define your schema
|
|
@@ -301,6 +311,24 @@ infrastructure code and one-off advanced Drizzle features. The older
|
|
|
301
311
|
`ctx.ports.db.db` spelling is still available as a backwards-compatible alias.
|
|
302
312
|
Do not make either spelling the normal dependency for application use cases.
|
|
303
313
|
|
|
314
|
+
## Installed ports
|
|
315
|
+
|
|
316
|
+
Each backend provider contributes `ctx.ports.db`, the standard Beignet `DbPort`
|
|
317
|
+
with a Drizzle escape hatch. Database-backed app repositories, UOW, outbox, and
|
|
318
|
+
idempotency ports are app-owned wiring layered on top of that provider. The
|
|
319
|
+
port also exposes `checkHealth()` for app-owned readiness endpoints:
|
|
320
|
+
|
|
321
|
+
```ts
|
|
322
|
+
const health = await ctx.ports.db.checkHealth();
|
|
323
|
+
|
|
324
|
+
if (!health.ok) {
|
|
325
|
+
return Response.json({ ok: false, database: health }, { status: 503 });
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
`checkHealth()` runs a cheap `select 1` through the underlying client or pool.
|
|
330
|
+
It does not run migrations, create tables, or mutate schema.
|
|
331
|
+
|
|
304
332
|
## Devtools
|
|
305
333
|
|
|
306
334
|
When `@beignet/devtools` is registered before this provider, Drizzle query
|
|
@@ -318,6 +346,28 @@ export const providers = [
|
|
|
318
346
|
];
|
|
319
347
|
```
|
|
320
348
|
|
|
349
|
+
## Failure behavior
|
|
350
|
+
|
|
351
|
+
Env-backed providers throw during startup when their required database URL is
|
|
352
|
+
missing or the driver cannot create the connection/client. Runtime query errors
|
|
353
|
+
come from Drizzle and the selected driver. Unit of Work rolls back the database
|
|
354
|
+
transaction when the callback throws; if post-commit event publishing fails, the
|
|
355
|
+
database transaction has already committed, so use the outbox for durable
|
|
356
|
+
follow-up work.
|
|
357
|
+
|
|
358
|
+
## Local and tests
|
|
359
|
+
|
|
360
|
+
Generated SQLite apps include database reset helpers for isolated repository
|
|
361
|
+
and route tests. Use repository fakes for pure use-case tests, and use the
|
|
362
|
+
Drizzle provider with an isolated database when testing SQL mapping,
|
|
363
|
+
transactions, outbox rows, idempotency rows, or migration assumptions.
|
|
364
|
+
|
|
365
|
+
## Deployment notes
|
|
366
|
+
|
|
367
|
+
Run migrations before booting code that depends on new schema. Keep repository
|
|
368
|
+
interfaces app-owned so switching SQLite, Postgres, or MySQL changes infra
|
|
369
|
+
wiring instead of contracts, use cases, policies, or routes.
|
|
370
|
+
|
|
321
371
|
## Unit of work
|
|
322
372
|
|
|
323
373
|
Use `createDrizzleSqliteUnitOfWork(...)` when a use case needs a real database
|
|
@@ -413,6 +463,8 @@ import {
|
|
|
413
463
|
drainOutbox,
|
|
414
464
|
} from "@beignet/core/outbox";
|
|
415
465
|
import {
|
|
466
|
+
createDrizzleSqliteAuditLogPort,
|
|
467
|
+
createDrizzleSqliteAuditLogSetupStatements,
|
|
416
468
|
createDrizzleSqliteIdempotencyPort,
|
|
417
469
|
createDrizzleSqliteIdempotencySetupStatements,
|
|
418
470
|
createDrizzleSqliteOutboxPort,
|
|
@@ -421,10 +473,14 @@ import {
|
|
|
421
473
|
} from "@beignet/provider-db-drizzle/sqlite";
|
|
422
474
|
```
|
|
423
475
|
|
|
424
|
-
Add Beignet's outbox and idempotency tables to your app-owned migration
|
|
425
|
-
bootstrap flow:
|
|
476
|
+
Add Beignet's audit, outbox, and idempotency tables to your app-owned migration
|
|
477
|
+
or bootstrap flow:
|
|
426
478
|
|
|
427
479
|
```ts
|
|
480
|
+
for (const statement of createDrizzleSqliteAuditLogSetupStatements()) {
|
|
481
|
+
await client.execute(statement);
|
|
482
|
+
}
|
|
483
|
+
|
|
428
484
|
for (const statement of createDrizzleSqliteIdempotencySetupStatements()) {
|
|
429
485
|
await client.execute(statement);
|
|
430
486
|
}
|
|
@@ -440,11 +496,13 @@ Then expose transaction-scoped outbox-backed event recording:
|
|
|
440
496
|
uow: createDrizzleSqliteUnitOfWork({
|
|
441
497
|
db: ports.db.drizzle,
|
|
442
498
|
createTransactionPorts: (tx) => {
|
|
499
|
+
const audit = createDrizzleSqliteAuditLogPort(tx);
|
|
443
500
|
const idempotency = createDrizzleSqliteIdempotencyPort(tx);
|
|
444
501
|
const outbox = createDrizzleSqliteOutboxPort(tx);
|
|
445
502
|
|
|
446
503
|
return {
|
|
447
504
|
...createRepositories(tx),
|
|
505
|
+
audit,
|
|
448
506
|
events: createOutboxEventRecorder(outbox),
|
|
449
507
|
idempotency,
|
|
450
508
|
outbox,
|
|
@@ -459,11 +517,47 @@ feature history repositories, and durable idempotency records. Root ports are
|
|
|
459
517
|
still useful for reads and background work, but they do not participate in the
|
|
460
518
|
current transaction unless you rebuild them from `tx`.
|
|
461
519
|
|
|
520
|
+
Use `createDrizzleSqliteAuditLogPort(...)` at the root app port for ordinary
|
|
521
|
+
audit writes, and rebuild it from `tx` when audit rows must commit atomically
|
|
522
|
+
with the business write.
|
|
523
|
+
|
|
462
524
|
Use `createDrizzleSqliteIdempotencyPort(...)` at the root app port for ordinary
|
|
463
525
|
retry-safe commands, and rebuild it from `tx` when the idempotency reservation,
|
|
464
526
|
business write, audit row, outbox records, and replay result must commit
|
|
465
527
|
together.
|
|
466
528
|
|
|
529
|
+
## Durable audit log
|
|
530
|
+
|
|
531
|
+
Use `createDrizzleSqliteAuditLogPort(...)` when `AuditLogPort` should write
|
|
532
|
+
through SQL instead of an in-memory test adapter:
|
|
533
|
+
|
|
534
|
+
```ts
|
|
535
|
+
import { createAmbientAuditLog } from "@beignet/core/server";
|
|
536
|
+
import { createInstrumentedAuditLog } from "@beignet/core/ports";
|
|
537
|
+
import {
|
|
538
|
+
createDrizzleSqliteAuditLogPort,
|
|
539
|
+
createDrizzleSqliteAuditLogSetupStatements,
|
|
540
|
+
} from "@beignet/provider-db-drizzle/sqlite";
|
|
541
|
+
|
|
542
|
+
for (const statement of createDrizzleSqliteAuditLogSetupStatements()) {
|
|
543
|
+
await client.execute(statement);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
const audit = createAmbientAuditLog(
|
|
547
|
+
createInstrumentedAuditLog({
|
|
548
|
+
audit: createDrizzleSqliteAuditLogPort(db),
|
|
549
|
+
instrumentation: ports,
|
|
550
|
+
}),
|
|
551
|
+
);
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
The default table is `audit_log`; pass `tableName` to both setup and port
|
|
555
|
+
creation if your app uses a different table name. The adapter normalizes audit
|
|
556
|
+
entries, applies Beignet's default metadata redaction, stores metadata as JSON
|
|
557
|
+
text, and accepts either a root database or transaction client. Pass `redact`
|
|
558
|
+
for a final app-owned redaction step, or `createId` in runtimes without
|
|
559
|
+
`globalThis.crypto.randomUUID()`.
|
|
560
|
+
|
|
467
561
|
## Durable idempotency
|
|
468
562
|
|
|
469
563
|
Use `createDrizzleSqliteIdempotencyPort(...)` when `runIdempotently(...)` needs
|
|
@@ -667,6 +761,8 @@ uow: createDrizzlePostgresUnitOfWork({
|
|
|
667
761
|
|
|
668
762
|
```ts
|
|
669
763
|
import {
|
|
764
|
+
createDrizzlePostgresAuditLogPort,
|
|
765
|
+
createDrizzlePostgresAuditLogSetupStatements,
|
|
670
766
|
createDrizzlePostgresIdempotencyPort,
|
|
671
767
|
createDrizzlePostgresIdempotencySetupStatements,
|
|
672
768
|
createDrizzlePostgresOutboxPort,
|
|
@@ -681,6 +777,10 @@ for (const statement of createDrizzlePostgresIdempotencySetupStatements()) {
|
|
|
681
777
|
await pool.query(statement);
|
|
682
778
|
}
|
|
683
779
|
|
|
780
|
+
for (const statement of createDrizzlePostgresAuditLogSetupStatements()) {
|
|
781
|
+
await pool.query(statement);
|
|
782
|
+
}
|
|
783
|
+
|
|
684
784
|
for (const statement of createDrizzlePostgresOutboxSetupStatements()) {
|
|
685
785
|
await pool.query(statement);
|
|
686
786
|
}
|
|
@@ -690,11 +790,13 @@ Then build transaction-scoped ports exactly as in the SQLite walkthrough:
|
|
|
690
790
|
|
|
691
791
|
```ts
|
|
692
792
|
createTransactionPorts: (tx) => {
|
|
793
|
+
const audit = createDrizzlePostgresAuditLogPort(tx);
|
|
693
794
|
const idempotency = createDrizzlePostgresIdempotencyPort(tx);
|
|
694
795
|
const outbox = createDrizzlePostgresOutboxPort(tx);
|
|
695
796
|
|
|
696
797
|
return {
|
|
697
798
|
...createRepositories(tx),
|
|
799
|
+
audit,
|
|
698
800
|
events: createOutboxEventRecorder(outbox),
|
|
699
801
|
idempotency,
|
|
700
802
|
outbox,
|
|
@@ -702,10 +804,10 @@ createTransactionPorts: (tx) => {
|
|
|
702
804
|
},
|
|
703
805
|
```
|
|
704
806
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
`DrizzlePostgresIdempotencyMutationError` when `complete(...)` or
|
|
708
|
-
does not match an in-progress reservation.
|
|
807
|
+
The audit, outbox, and idempotency factories accept a root database or
|
|
808
|
+
transaction client plus the same options as the SQLite ports. The idempotency
|
|
809
|
+
port throws `DrizzlePostgresIdempotencyMutationError` when `complete(...)` or
|
|
810
|
+
`fail(...)` does not match an in-progress reservation.
|
|
709
811
|
|
|
710
812
|
## MySQL
|
|
711
813
|
|
|
@@ -782,12 +884,14 @@ hatch.
|
|
|
782
884
|
Type repository factories with `DrizzleMysqlDatabase<TSchema>`;
|
|
783
885
|
`DrizzleMysqlTransaction` is the transaction client type.
|
|
784
886
|
|
|
785
|
-
### Unit of work, outbox, and idempotency
|
|
887
|
+
### Unit of work, audit log, outbox, and idempotency
|
|
786
888
|
|
|
787
889
|
The factories mirror the Postgres section with `Mysql` naming:
|
|
788
890
|
|
|
789
891
|
```ts
|
|
790
892
|
import {
|
|
893
|
+
createDrizzleMysqlAuditLogPort,
|
|
894
|
+
createDrizzleMysqlAuditLogSetupStatements,
|
|
791
895
|
createDrizzleMysqlIdempotencyPort,
|
|
792
896
|
createDrizzleMysqlIdempotencySetupStatements,
|
|
793
897
|
createDrizzleMysqlOutboxPort,
|
|
@@ -799,6 +903,10 @@ import {
|
|
|
799
903
|
Run the setup statements through your app-owned migration or bootstrap flow:
|
|
800
904
|
|
|
801
905
|
```ts
|
|
906
|
+
for (const statement of createDrizzleMysqlAuditLogSetupStatements()) {
|
|
907
|
+
await pool.query(statement);
|
|
908
|
+
}
|
|
909
|
+
|
|
802
910
|
for (const statement of createDrizzleMysqlIdempotencySetupStatements()) {
|
|
803
911
|
await pool.query(statement);
|
|
804
912
|
}
|
|
@@ -823,10 +931,11 @@ namespaces, keys, and scope values short.
|
|
|
823
931
|
These choices are deliberate and shared across the three backends:
|
|
824
932
|
|
|
825
933
|
- **ISO-8601 text timestamps.** All three dialects store outbox and
|
|
826
|
-
idempotency timestamps as ISO-8601 UTC strings in
|
|
827
|
-
retry timing, lease expiry,
|
|
828
|
-
|
|
829
|
-
may move the Postgres ports to
|
|
934
|
+
idempotency timestamps, plus audit `occurred_at`, as ISO-8601 UTC strings in
|
|
935
|
+
text columns. This keeps retry timing, lease expiry, replay semantics, and
|
|
936
|
+
audit ordering identical across backends, and lexicographic ordering matches
|
|
937
|
+
chronological ordering. A later release may move the Postgres ports to
|
|
938
|
+
`timestamptz`.
|
|
830
939
|
- **MySQL key length limits.** SQLite and Postgres use unbounded text columns
|
|
831
940
|
for idempotency keys; MySQL needs bounded `varchar` columns for its unique
|
|
832
941
|
index, so over-length keys fail loudly rather than truncating silently.
|
|
@@ -930,6 +1039,9 @@ await db.delete(schema.todos).where(eq(schema.todos.id, "1"));
|
|
|
930
1039
|
// Access the underlying libSQL client for advanced operations:
|
|
931
1040
|
const client = ctx.ports.db.client;
|
|
932
1041
|
const result = await client.execute("SELECT * FROM todos WHERE id = ?", ["1"]);
|
|
1042
|
+
|
|
1043
|
+
// Use this from readiness routes:
|
|
1044
|
+
const health = await ctx.ports.db.checkHealth();
|
|
933
1045
|
```
|
|
934
1046
|
|
|
935
1047
|
## Key design principles
|
|
@@ -976,12 +1088,15 @@ interface DbPort<TSchema extends Record<string, any> = any> {
|
|
|
976
1088
|
drizzle: LibSQLDatabase<TSchema>;
|
|
977
1089
|
db: LibSQLDatabase<TSchema>;
|
|
978
1090
|
client: Client;
|
|
1091
|
+
checkHealth(): Promise<DbHealth>;
|
|
979
1092
|
}
|
|
980
1093
|
```
|
|
981
1094
|
|
|
982
1095
|
- `drizzle`: The typed Drizzle database instance for ORM operations
|
|
983
1096
|
- `db`: Backwards-compatible alias for `drizzle`
|
|
984
1097
|
- `client`: The underlying libSQL client for advanced operations not covered by Drizzle
|
|
1098
|
+
- `checkHealth`: A cheap `select 1` dependency check for app-owned readiness
|
|
1099
|
+
endpoints
|
|
985
1100
|
|
|
986
1101
|
### `createDrizzleSqliteProvider<TSchema>(options)`
|
|
987
1102
|
|
|
@@ -1030,6 +1145,23 @@ Returns SQL setup statements for the app-owned outbox table and indexes. Run
|
|
|
1030
1145
|
these through your migration/bootstrap flow or translate them into your normal
|
|
1031
1146
|
Drizzle migrations.
|
|
1032
1147
|
|
|
1148
|
+
### `createDrizzleSqliteAuditLogPort<TSchema>(db, options?)`
|
|
1149
|
+
|
|
1150
|
+
Factory function to create a SQL-backed `AuditLogPort` from a root Drizzle
|
|
1151
|
+
database or transaction client.
|
|
1152
|
+
|
|
1153
|
+
**Parameters:**
|
|
1154
|
+
- `db` (required): A `DrizzleSqliteDatabase<TSchema>` root database or transaction
|
|
1155
|
+
- `options.tableName` (optional): Audit log table name, defaults to `"audit_log"`
|
|
1156
|
+
- `options.redact` (optional): Final app-owned redaction hook
|
|
1157
|
+
- `options.createId` (optional): Audit row ID factory
|
|
1158
|
+
|
|
1159
|
+
### `createDrizzleSqliteAuditLogSetupStatements(options?)`
|
|
1160
|
+
|
|
1161
|
+
Returns SQL setup statements for the app-owned audit log table and indexes.
|
|
1162
|
+
Run these through your migration/bootstrap flow or translate them into your
|
|
1163
|
+
normal Drizzle migrations.
|
|
1164
|
+
|
|
1033
1165
|
### `createDrizzleSqliteIdempotencyPort<TSchema>(db, options?)`
|
|
1034
1166
|
|
|
1035
1167
|
Factory function to create a SQL-backed `IdempotencyPort` from a root Drizzle
|
package/dist/mysql/index.d.ts
CHANGED
|
@@ -28,12 +28,14 @@
|
|
|
28
28
|
*/
|
|
29
29
|
import type { IdempotencyPort } from "@beignet/core/idempotency";
|
|
30
30
|
import type { OutboxPort } from "@beignet/core/outbox";
|
|
31
|
-
import { type BufferedDomainEventRecorder, type EventBusPort, type UnitOfWorkPort } from "@beignet/core/ports";
|
|
31
|
+
import { type AuditLogPort, type BufferedDomainEventRecorder, type EventBusPort, type UnitOfWorkPort } from "@beignet/core/ports";
|
|
32
32
|
import { type ExtractTablesWithRelations } from "drizzle-orm";
|
|
33
33
|
import type { MySqlDatabase, MySqlQueryResultHKT, MySqlTransaction, MySqlTransactionConfig, PreparedQueryHKTBase } from "drizzle-orm/mysql-core";
|
|
34
34
|
import { type MySql2Database } from "drizzle-orm/mysql2";
|
|
35
35
|
import type { Pool, PoolOptions } from "mysql2/promise";
|
|
36
36
|
import { z } from "zod";
|
|
37
|
+
import { type DrizzleAuditLogCoreOptions } from "../shared/audit-core.js";
|
|
38
|
+
import { type DbHealth } from "../shared/health.js";
|
|
37
39
|
/**
|
|
38
40
|
* Typed database port interface.
|
|
39
41
|
* Exposes a typed Drizzle database instance for your schema.
|
|
@@ -57,7 +59,15 @@ export interface DbPort<TSchema extends Record<string, unknown> = Record<string,
|
|
|
57
59
|
* Use this for advanced operations not covered by Drizzle ORM.
|
|
58
60
|
*/
|
|
59
61
|
pool: Pool;
|
|
62
|
+
/**
|
|
63
|
+
* Check whether the underlying database pool can run a cheap read query.
|
|
64
|
+
*
|
|
65
|
+
* Intended for app-owned readiness endpoints. This does not run migrations
|
|
66
|
+
* or mutate schema.
|
|
67
|
+
*/
|
|
68
|
+
checkHealth(): Promise<DbHealth>;
|
|
60
69
|
}
|
|
70
|
+
export type { DbHealth };
|
|
61
71
|
/**
|
|
62
72
|
* Drizzle database or transaction client accepted by repository factories.
|
|
63
73
|
*
|
|
@@ -101,6 +111,17 @@ export interface DrizzleMysqlUnitOfWorkOptions<TSchema extends Record<string, un
|
|
|
101
111
|
* decides which transaction-scoped ports to create.
|
|
102
112
|
*/
|
|
103
113
|
export declare function createDrizzleMysqlUnitOfWork<TSchema extends Record<string, unknown>, TxPorts>(options: DrizzleMysqlUnitOfWorkOptions<TSchema, TxPorts>): UnitOfWorkPort<TxPorts>;
|
|
114
|
+
/**
|
|
115
|
+
* Options for a Drizzle MySQL-backed audit log port.
|
|
116
|
+
*/
|
|
117
|
+
export interface DrizzleMysqlAuditLogOptions extends DrizzleAuditLogCoreOptions {
|
|
118
|
+
/**
|
|
119
|
+
* Table that stores audit log entries.
|
|
120
|
+
*
|
|
121
|
+
* Default: "audit_log".
|
|
122
|
+
*/
|
|
123
|
+
tableName?: string;
|
|
124
|
+
}
|
|
104
125
|
/**
|
|
105
126
|
* Options for a Drizzle MySQL-backed outbox port.
|
|
106
127
|
*/
|
|
@@ -116,6 +137,24 @@ export interface DrizzleMysqlOutboxOptions {
|
|
|
116
137
|
*/
|
|
117
138
|
now?: () => Date;
|
|
118
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Create idempotent SQL statements for the Drizzle MySQL audit log table.
|
|
142
|
+
*
|
|
143
|
+
* Run these during migrations or local setup before using
|
|
144
|
+
* `createDrizzleMysqlAuditLogPort(...)`.
|
|
145
|
+
*
|
|
146
|
+
* Indexes are declared inline because MySQL has no
|
|
147
|
+
* `CREATE INDEX IF NOT EXISTS`; the whole shape stays idempotent under
|
|
148
|
+
* `CREATE TABLE IF NOT EXISTS`.
|
|
149
|
+
*/
|
|
150
|
+
export declare function createDrizzleMysqlAuditLogSetupStatements(options?: DrizzleMysqlAuditLogOptions): readonly string[];
|
|
151
|
+
/**
|
|
152
|
+
* Create a Beignet audit log port backed by a Drizzle MySQL database.
|
|
153
|
+
*
|
|
154
|
+
* The port accepts both the root Drizzle database and transaction clients, so
|
|
155
|
+
* applications can rebuild audit logging inside Unit of Work transaction ports.
|
|
156
|
+
*/
|
|
157
|
+
export declare function createDrizzleMysqlAuditLogPort<TSchema extends Record<string, unknown>>(db: DrizzleMysqlDatabase<TSchema>, adapterOptions?: DrizzleMysqlAuditLogOptions): AuditLogPort;
|
|
119
158
|
/**
|
|
120
159
|
* Create idempotent SQL statements for the Drizzle MySQL outbox table.
|
|
121
160
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mysql/index.ts"],"names":[],"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,QAAQ,CAAC;IAEpB;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAEhC;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvC,QAAQ,SAAS,MAAM,GAAG,IAAI,EAC9B,OAAO,EAAE,2BAA2B,CAAC,OAAO,EAAE,QAAQ,CAAC;;qEA8DxD"}
|
package/dist/mysql/index.js
CHANGED
|
@@ -32,10 +32,21 @@ import { sql } from "drizzle-orm";
|
|
|
32
32
|
import { drizzle } from "drizzle-orm/mysql2";
|
|
33
33
|
import * as mysql from "mysql2/promise";
|
|
34
34
|
import { z } from "zod";
|
|
35
|
+
import { createAuditLogInsertQuery, createAuditLogSqlRow, } from "../shared/audit-core.js";
|
|
36
|
+
import { dbHealthError, dbHealthOk } from "../shared/health.js";
|
|
35
37
|
import { createIdempotencyPortCore, formatIdempotencyMutationErrorMessage, } from "../shared/idempotency-core.js";
|
|
36
38
|
import { quoteIdentifier } from "../shared/identifiers.js";
|
|
37
39
|
import { createDbQueryLogger } from "../shared/instrumentation.js";
|
|
38
40
|
import { createOutboxPortCore, } from "../shared/outbox-core.js";
|
|
41
|
+
async function checkMysqlHealth(pool) {
|
|
42
|
+
try {
|
|
43
|
+
await pool.query("select 1");
|
|
44
|
+
return dbHealthOk("mysql");
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
return dbHealthError("mysql", error);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
39
50
|
/**
|
|
40
51
|
* Create a Unit of Work port backed by Drizzle's MySQL transaction API.
|
|
41
52
|
*
|
|
@@ -145,6 +156,64 @@ function createMysqlExecutor(db, table) {
|
|
|
145
156
|
},
|
|
146
157
|
};
|
|
147
158
|
}
|
|
159
|
+
/**
|
|
160
|
+
* Create idempotent SQL statements for the Drizzle MySQL audit log table.
|
|
161
|
+
*
|
|
162
|
+
* Run these during migrations or local setup before using
|
|
163
|
+
* `createDrizzleMysqlAuditLogPort(...)`.
|
|
164
|
+
*
|
|
165
|
+
* Indexes are declared inline because MySQL has no
|
|
166
|
+
* `CREATE INDEX IF NOT EXISTS`; the whole shape stays idempotent under
|
|
167
|
+
* `CREATE TABLE IF NOT EXISTS`.
|
|
168
|
+
*/
|
|
169
|
+
export function createDrizzleMysqlAuditLogSetupStatements(options = {}) {
|
|
170
|
+
const tableName = options.tableName ?? "audit_log";
|
|
171
|
+
const table = quoteIdentifier(tableName, "`");
|
|
172
|
+
const indexPrefix = tableName.replaceAll(/[^A-Za-z0-9_]/g, "_");
|
|
173
|
+
return [
|
|
174
|
+
`CREATE TABLE IF NOT EXISTS ${table} (
|
|
175
|
+
id varchar(255) NOT NULL PRIMARY KEY,
|
|
176
|
+
action varchar(255) NOT NULL,
|
|
177
|
+
actor_type varchar(32) NOT NULL,
|
|
178
|
+
actor_id varchar(255),
|
|
179
|
+
actor_display_name varchar(255),
|
|
180
|
+
tenant_id varchar(255),
|
|
181
|
+
tenant_slug varchar(255),
|
|
182
|
+
resource_type varchar(255),
|
|
183
|
+
resource_id varchar(255),
|
|
184
|
+
resource_name varchar(255),
|
|
185
|
+
outcome varchar(16) NOT NULL DEFAULT 'success',
|
|
186
|
+
request_id varchar(255),
|
|
187
|
+
trace_id varchar(255),
|
|
188
|
+
message longtext,
|
|
189
|
+
metadata longtext,
|
|
190
|
+
actor_metadata longtext,
|
|
191
|
+
tenant_metadata longtext,
|
|
192
|
+
resource_metadata longtext,
|
|
193
|
+
occurred_at varchar(32) NOT NULL,
|
|
194
|
+
INDEX ${quoteIdentifier(`${indexPrefix}_action_idx`, "`")} (action),
|
|
195
|
+
INDEX ${quoteIdentifier(`${indexPrefix}_actor_idx`, "`")} (actor_type, actor_id),
|
|
196
|
+
INDEX ${quoteIdentifier(`${indexPrefix}_occurred_at_idx`, "`")} (occurred_at),
|
|
197
|
+
INDEX ${quoteIdentifier(`${indexPrefix}_request_idx`, "`")} (request_id),
|
|
198
|
+
INDEX ${quoteIdentifier(`${indexPrefix}_resource_idx`, "`")} (resource_type, resource_id),
|
|
199
|
+
INDEX ${quoteIdentifier(`${indexPrefix}_tenant_idx`, "`")} (tenant_id)
|
|
200
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin`,
|
|
201
|
+
];
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Create a Beignet audit log port backed by a Drizzle MySQL database.
|
|
205
|
+
*
|
|
206
|
+
* The port accepts both the root Drizzle database and transaction clients, so
|
|
207
|
+
* applications can rebuild audit logging inside Unit of Work transaction ports.
|
|
208
|
+
*/
|
|
209
|
+
export function createDrizzleMysqlAuditLogPort(db, adapterOptions = {}) {
|
|
210
|
+
const table = sql.raw(quoteIdentifier(adapterOptions.tableName ?? "audit_log", "`"));
|
|
211
|
+
return {
|
|
212
|
+
async record(input) {
|
|
213
|
+
await db.execute(createAuditLogInsertQuery(table, createAuditLogSqlRow(input, adapterOptions)));
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
}
|
|
148
217
|
/**
|
|
149
218
|
* Create idempotent SQL statements for the Drizzle MySQL outbox table.
|
|
150
219
|
*
|
|
@@ -328,7 +397,12 @@ export function createDrizzleMysqlProvider(options) {
|
|
|
328
397
|
? drizzle(pool, { schema, logger, mode })
|
|
329
398
|
: drizzle(pool, { schema, mode });
|
|
330
399
|
// 3. Build a typed DbPort
|
|
331
|
-
const dbPort = {
|
|
400
|
+
const dbPort = {
|
|
401
|
+
drizzle: db,
|
|
402
|
+
db,
|
|
403
|
+
pool,
|
|
404
|
+
checkHealth: () => checkMysqlHealth(pool),
|
|
405
|
+
};
|
|
332
406
|
return {
|
|
333
407
|
ports: { [portName]: dbPort },
|
|
334
408
|
async stop() {
|
package/dist/mysql/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mysql/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mysql/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,EAGL,yBAAyB,GAI1B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,6BAA6B,GAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAA6C,GAAG,EAAE,MAAM,aAAa,CAAC;AAQ7E,OAAO,EAAE,OAAO,EAAuB,MAAM,oBAAoB,CAAC;AAElE,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,yBAAyB,EACzB,oBAAoB,GAErB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAiB,aAAa,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EACL,yBAAyB,EACzB,qCAAqC,GAEtC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,oBAAoB,GAGrB,MAAM,0BAA0B,CAAC;AA+DlC,KAAK,UAAU,gBAAgB,CAAC,IAAU;IACxC,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC7B,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;AACH,CAAC;AAoCD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AAM,eAAe,GAAG,6BAA6B,CAAC,KAAK,EAAE;gBAC3D,YAAY,EAAE,eAAe;gBAC7B,OAAO,EAAE,IAAI;aACd,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG,mBAAmB,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;YAE9D,sEAAsE;YACtE,qCAAqC;YACrC,MAAM,EAAE,GAA4B,MAAM;gBACxC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;gBACzC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;YAEpC,0BAA0B;YAC1B,MAAM,MAAM,GAAoB;gBAC9B,OAAO,EAAE,EAAE;gBACX,EAAE;gBACF,IAAI;gBACJ,WAAW,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC;aAC1C,CAAC;YAEF,OAAO;gBACL,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAuC;gBAClE,KAAK,CAAC,IAAI;oBACR,gDAAgD;oBAChD,IAAI,CAAC;wBACH,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;oBAC1B,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,yDAAyD;wBACzD,OAAO,CAAC,KAAK,CACX,2DAA2D,EAC3D,KAAK,CACN,CAAC;oBACJ,CAAC;gBACH,CAAC;aACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
package/dist/postgres/index.d.ts
CHANGED
|
@@ -28,12 +28,14 @@
|
|
|
28
28
|
*/
|
|
29
29
|
import type { IdempotencyPort } from "@beignet/core/idempotency";
|
|
30
30
|
import type { OutboxPort } from "@beignet/core/outbox";
|
|
31
|
-
import { type BufferedDomainEventRecorder, type EventBusPort, type UnitOfWorkPort } from "@beignet/core/ports";
|
|
31
|
+
import { type AuditLogPort, type BufferedDomainEventRecorder, type EventBusPort, type UnitOfWorkPort } from "@beignet/core/ports";
|
|
32
32
|
import { type ExtractTablesWithRelations } from "drizzle-orm";
|
|
33
33
|
import { type NodePgDatabase } from "drizzle-orm/node-postgres";
|
|
34
34
|
import { type PgDatabase, type PgQueryResultHKT, PgTransaction, type PgTransactionConfig } from "drizzle-orm/pg-core";
|
|
35
35
|
import { type Pool, type PoolConfig } from "pg";
|
|
36
36
|
import { z } from "zod";
|
|
37
|
+
import { type DrizzleAuditLogCoreOptions } from "../shared/audit-core.js";
|
|
38
|
+
import { type DbHealth } from "../shared/health.js";
|
|
37
39
|
/**
|
|
38
40
|
* Typed database port interface.
|
|
39
41
|
* Exposes a typed Drizzle database instance for your schema.
|
|
@@ -57,7 +59,15 @@ export interface DbPort<TSchema extends Record<string, unknown> = Record<string,
|
|
|
57
59
|
* Use this for advanced operations not covered by Drizzle ORM.
|
|
58
60
|
*/
|
|
59
61
|
pool: Pool;
|
|
62
|
+
/**
|
|
63
|
+
* Check whether the underlying database pool can run a cheap read query.
|
|
64
|
+
*
|
|
65
|
+
* Intended for app-owned readiness endpoints. This does not run migrations
|
|
66
|
+
* or mutate schema.
|
|
67
|
+
*/
|
|
68
|
+
checkHealth(): Promise<DbHealth>;
|
|
60
69
|
}
|
|
70
|
+
export type { DbHealth };
|
|
61
71
|
/**
|
|
62
72
|
* Drizzle database or transaction client accepted by repository factories.
|
|
63
73
|
*
|
|
@@ -102,6 +112,31 @@ export interface DrizzlePostgresUnitOfWorkOptions<TSchema extends Record<string,
|
|
|
102
112
|
* decides which transaction-scoped ports to create.
|
|
103
113
|
*/
|
|
104
114
|
export declare function createDrizzlePostgresUnitOfWork<TSchema extends Record<string, unknown>, TxPorts>(options: DrizzlePostgresUnitOfWorkOptions<TSchema, TxPorts>): UnitOfWorkPort<TxPorts>;
|
|
115
|
+
/**
|
|
116
|
+
* Options for a Drizzle Postgres-backed audit log port.
|
|
117
|
+
*/
|
|
118
|
+
export interface DrizzlePostgresAuditLogOptions extends DrizzleAuditLogCoreOptions {
|
|
119
|
+
/**
|
|
120
|
+
* Table that stores audit log entries.
|
|
121
|
+
*
|
|
122
|
+
* Default: "audit_log".
|
|
123
|
+
*/
|
|
124
|
+
tableName?: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Create idempotent SQL statements for the Drizzle Postgres audit log table.
|
|
128
|
+
*
|
|
129
|
+
* Run these during migrations or local setup before using
|
|
130
|
+
* `createDrizzlePostgresAuditLogPort(...)`.
|
|
131
|
+
*/
|
|
132
|
+
export declare function createDrizzlePostgresAuditLogSetupStatements(options?: DrizzlePostgresAuditLogOptions): readonly string[];
|
|
133
|
+
/**
|
|
134
|
+
* Create a Beignet audit log port backed by a Drizzle Postgres database.
|
|
135
|
+
*
|
|
136
|
+
* The port accepts both the root Drizzle database and transaction clients, so
|
|
137
|
+
* applications can rebuild audit logging inside Unit of Work transaction ports.
|
|
138
|
+
*/
|
|
139
|
+
export declare function createDrizzlePostgresAuditLogPort<TSchema extends Record<string, unknown>>(db: DrizzlePostgresDatabase<TSchema>, adapterOptions?: DrizzlePostgresAuditLogOptions): AuditLogPort;
|
|
105
140
|
/**
|
|
106
141
|
* Options for a Drizzle Postgres-backed outbox port.
|
|
107
142
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/postgres/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,KAAK,2BAA2B,EAEhC,KAAK,YAAY,EAEjB,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAAE,KAAK,0BAA0B,EAAiB,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAW,KAAK,cAAc,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