@ontrails/drizzle 1.0.0-beta.15
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/.turbo/turbo-build.log +1 -0
- package/.turbo/turbo-lint.log +3 -0
- package/.turbo/turbo-typecheck.log +1 -0
- package/CHANGELOG.md +9 -0
- package/README.md +36 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime.d.ts +17 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +755 -0
- package/dist/runtime.js.map +1 -0
- package/dist/schema.d.ts +15 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +332 -0
- package/dist/schema.js.map +1 -0
- package/dist/types.d.ts +38 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +24 -0
- package/src/__tests__/drizzle.test.ts +997 -0
- package/src/index.ts +9 -0
- package/src/runtime.ts +1346 -0
- package/src/schema.ts +590 -0
- package/src/types.ts +65 -0
- package/tsconfig.json +9 -0
- package/tsconfig.tests.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ tsc -b
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ tsc --noEmit
|
package/CHANGELOG.md
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# @ontrails/drizzle
|
|
2
|
+
|
|
3
|
+
Drizzle connector for Trails stores. Use this package to bind a connector-agnostic `store(...)` definition from `@ontrails/store` to a concrete Drizzle runtime.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { store } from '@ontrails/store';
|
|
9
|
+
import { connectDrizzle } from '@ontrails/drizzle';
|
|
10
|
+
|
|
11
|
+
const definition = store({
|
|
12
|
+
gists: {
|
|
13
|
+
schema: gistSchema,
|
|
14
|
+
primaryKey: 'id',
|
|
15
|
+
generated: ['id', 'createdAt', 'updatedAt'],
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const db = connectDrizzle(definition, {
|
|
20
|
+
id: 'db.main',
|
|
21
|
+
url: ':memory:',
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
bun add @ontrails/store @ontrails/drizzle zod
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Migration
|
|
32
|
+
|
|
33
|
+
This package replaces the old `@ontrails/store/drizzle` subpath.
|
|
34
|
+
|
|
35
|
+
- Before: `import { connectDrizzle } from '@ontrails/store/drizzle'`
|
|
36
|
+
- After: `import { connectDrizzle } from '@ontrails/drizzle'`
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { connectDrizzle, connectReadOnlyDrizzle } from './runtime.js';
|
|
2
|
+
export type { DrizzleQueryContext, DrizzleStoreConnection, DrizzleStoreOptions, DrizzleStoreResource, DrizzleStoreSchema, ReadOnlyDrizzleStoreConnection, } from './types.js';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtE,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,8BAA8B,GAC/B,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AnyStoreDefinition } from '@ontrails/store';
|
|
2
|
+
import type { DrizzleStoreConnection, DrizzleStoreOptions, DrizzleStoreResource, ReadOnlyDrizzleStoreConnection } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Bind a store definition to a Drizzle-backed SQLite resource.
|
|
5
|
+
*
|
|
6
|
+
* The returned resource manages its own connection lifecycle. The `mock()`
|
|
7
|
+
* factory creates an in-memory SQLite database seeded with fixtures — callers
|
|
8
|
+
* who obtain a mock connection are responsible for calling `closeConnection()`
|
|
9
|
+
* when done, or letting the connection be garbage-collected (the underlying
|
|
10
|
+
* `Database` client is tracked via `WeakMap`).
|
|
11
|
+
*
|
|
12
|
+
* Note: the `search` field on `StoreTableInput` is not yet interpreted by
|
|
13
|
+
* this connector — it is reserved for future full-text search support.
|
|
14
|
+
*/
|
|
15
|
+
export declare const connectDrizzle: <const TStore extends AnyStoreDefinition>(definition: TStore, options: DrizzleStoreOptions<TStore>) => DrizzleStoreResource<TStore, DrizzleStoreConnection<TStore>, "readwrite">;
|
|
16
|
+
export declare const connectReadOnlyDrizzle: <const TStore extends AnyStoreDefinition>(definition: TStore, options: DrizzleStoreOptions<TStore>) => DrizzleStoreResource<TStore, ReadOnlyDrizzleStoreConnection<TStore>, "readonly">;
|
|
17
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,kBAAkB,EAcnB,MAAM,iBAAiB,CAAC;AAYzB,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EAEpB,8BAA8B,EAC/B,MAAM,YAAY,CAAC;AA+pCpB;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,CAAC,MAAM,SAAS,kBAAkB,EACpE,YAAY,MAAM,EAClB,SAAS,mBAAmB,CAAC,MAAM,CAAC,KACnC,oBAAoB,CACrB,MAAM,EACN,sBAAsB,CAAC,MAAM,CAAC,EAC9B,WAAW,CAqDZ,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,KAAK,CAAC,MAAM,SAAS,kBAAkB,EAC5E,YAAY,MAAM,EAClB,SAAS,mBAAmB,CAAC,MAAM,CAAC,KACnC,oBAAoB,CACrB,MAAM,EACN,8BAA8B,CAAC,MAAM,CAAC,EACtC,UAAU,CAoCX,CAAC"}
|