@aihu-plugin/drizzle 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Fellwork
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,123 @@
1
+ # @aihu-plugin/drizzle
2
+
3
+ > **Aihu** — agentic discovery and interaction, for human purpose.
4
+
5
+ Drizzle ORM data adapter for aihu — typed createResource fetchers and defineLoader helpers (Postgres / SQLite / libSQL).
6
+
7
+ Held-private workspace package. Not yet published to npm.
8
+
9
+ > **Status:** Held private — not yet published to npm. See [v1.1 roadmap](../../docs/roadmap/SUMMARY.md) for ratification gating (e.g. RFC #56 live-binding for `@aihu/plugin` enforcement).
10
+
11
+ <!-- BEGIN_HANDWRITTEN: prose -->
12
+ Server-only. Wraps a Drizzle query into the two data-access shapes aihu uses:
13
+
14
+ ```ts
15
+ import { drizzle } from 'drizzle-orm/libsql'
16
+ import { eq } from 'drizzle-orm'
17
+ import { createResource } from '@aihu-plugin/data'
18
+ import { defineRoute } from '@aihu/server'
19
+ import { createDrizzleResource, drizzleLoader } from '@aihu-plugin/drizzle'
20
+
21
+ const db = drizzle(client)
22
+
23
+ // 1. A createResource-compatible fetcher: (key: string) => Promise<T>
24
+ const fetchUser = createDrizzleResource(
25
+ db,
26
+ (db, id: number) => db.select().from(users).where(eq(users.id, id)),
27
+ { parseKey: Number },
28
+ )
29
+ const user = createResource(idSignal, fetchUser)
30
+
31
+ // 2. A defineLoader for SSR routes
32
+ const userLoader = drizzleLoader(db, (db, ctx) =>
33
+ db.select().from(users).where(eq(users.id, Number(ctx.params.id))),
34
+ )
35
+ export const userRoute = defineRoute('/users/:id', handler, { loader: userLoader })
36
+ ```
37
+
38
+ `drizzle-orm` and its drivers (`postgres`, `@libsql/client`) are **optional peer dependencies** referenced via `import type` only — importing this package never breaks when no Drizzle peer is installed. You supply the `db` handle; the adapter only awaits the query.
39
+ <!-- END_HANDWRITTEN: prose -->
40
+
41
+ ## Install
42
+
43
+ <!-- BEGIN_AUTOGEN: install -->
44
+ <!-- regenerate: bun scripts/sync-readme.ts (also runs in pre-commit + CI) -->
45
+
46
+ ```bash
47
+ npm install @aihu-plugin/drizzle
48
+ # or
49
+ bun add @aihu-plugin/drizzle
50
+ ```
51
+
52
+ <sub><i>Auto-generated against `@aihu-plugin/drizzle@0.1.0`.</i></sub>
53
+
54
+ <!-- END_AUTOGEN: install -->
55
+
56
+ ## Package facts
57
+
58
+ <!-- BEGIN_AUTOGEN: stats -->
59
+ <!-- regenerate: bun scripts/sync-readme.ts (also runs in pre-commit + CI) -->
60
+
61
+ | | |
62
+ |---|---|
63
+ | **Version** | `0.1.0` |
64
+ | **Tier** | E — Held private (unmapped tier) |
65
+ | **Published files** | 3 entries |
66
+ | **License** | MIT |
67
+
68
+ <sub><i>Auto-generated against `@aihu-plugin/drizzle@0.1.0`.</i></sub>
69
+
70
+ <!-- END_AUTOGEN: stats -->
71
+
72
+ ## Exports
73
+
74
+ <!-- BEGIN_AUTOGEN: exports -->
75
+ <!-- regenerate: bun scripts/sync-readme.ts (also runs in pre-commit + CI) -->
76
+
77
+ | Subpath | ESM | CJS |
78
+ |---|---|---|
79
+ | `.` | `./dist/index.js` | `—` |
80
+
81
+ <sub><i>Auto-generated against `@aihu-plugin/drizzle@0.1.0`.</i></sub>
82
+
83
+ <!-- END_AUTOGEN: exports -->
84
+
85
+ ## Dependencies
86
+
87
+ <!-- BEGIN_AUTOGEN: deps -->
88
+ <!-- regenerate: bun scripts/sync-readme.ts (also runs in pre-commit + CI) -->
89
+
90
+ **Dependencies:**
91
+
92
+ - `@aihu/server` — `workspace:*`
93
+
94
+ **Peer dependencies:**
95
+
96
+ - `drizzle-orm` — `>=0.29.0`
97
+
98
+ <sub><i>Auto-generated against `@aihu-plugin/drizzle@0.1.0`.</i></sub>
99
+
100
+ <!-- END_AUTOGEN: deps -->
101
+
102
+ ## See also
103
+
104
+ <!-- BEGIN_AUTOGEN: see-also -->
105
+ <!-- regenerate: bun scripts/sync-readme.ts (also runs in pre-commit + CI) -->
106
+
107
+ - [Aihu framework root](../../README.md)
108
+ - [v1.1 roadmap](../../docs/roadmap/SUMMARY.md)
109
+
110
+ <sub><i>Auto-generated against `@aihu-plugin/drizzle@0.1.0`.</i></sub>
111
+
112
+ <!-- END_AUTOGEN: see-also -->
113
+
114
+ ## License
115
+
116
+ <!-- BEGIN_AUTOGEN: license -->
117
+ <!-- regenerate: bun scripts/sync-readme.ts (also runs in pre-commit + CI) -->
118
+
119
+ MIT — see [LICENSE](../../LICENSE).
120
+
121
+ <sub><i>Auto-generated against `@aihu-plugin/drizzle@0.1.0`.</i></sub>
122
+
123
+ <!-- END_AUTOGEN: license -->
@@ -0,0 +1,121 @@
1
+ import { DefinedLoader, RouteContext, defineLoader } from "@aihu/server";
2
+ import { Plugin } from "@aihu/plugin";
3
+
4
+ //#region src/types.d.ts
5
+ /**
6
+ * @aihu-plugin/drizzle — shared types for the Drizzle ORM data adapter.
7
+ *
8
+ * Drizzle's own types (`drizzle-orm`, `postgres`, `@libsql/client`) are
9
+ * OPTIONAL peer dependencies. To keep this package importable when those peers
10
+ * are absent, we DO NOT statically import any `drizzle-orm` runtime value and
11
+ * we reference Drizzle types only through `import type` in the files that need
12
+ * them (see `query.ts`). The structural types below describe the minimal shape
13
+ * the adapter actually depends on, so consumers get useful typing whether or
14
+ * not `drizzle-orm` is installed.
15
+ */
16
+ /**
17
+ * The minimal "thenable" shape Drizzle query builders satisfy. A Drizzle query
18
+ * (e.g. `db.select().from(users).where(...)`) is a `PromiseLike` that resolves
19
+ * to a row array; awaiting it executes the SQL. We accept any `PromiseLike<T>`
20
+ * so prepared statements, `.execute()` results, and raw promises all work.
21
+ */
22
+ type DrizzleQuery<T> = PromiseLike<T>;
23
+ /**
24
+ * A query factory: given a Drizzle database handle and a key, returns either a
25
+ * Drizzle query (PromiseLike) or a plain Promise of the result. This is the
26
+ * single user-supplied function both `createDrizzleResource` and
27
+ * `drizzleLoader` are built from.
28
+ *
29
+ * @typeParam DB The Drizzle database handle type (kept generic — the adapter
30
+ * never inspects it, so any of the pg / sqlite / libsql handles
31
+ * fit without importing their concrete types).
32
+ * @typeParam K The key type. For `createResource` fetchers this is the cache
33
+ * key (a string); for loaders it is the loader context.
34
+ * @typeParam T The resolved row/result type.
35
+ */
36
+ type DrizzleQueryFn<DB, K, T> = (db: DB, key: K) => DrizzleQuery<T> | Promise<T>;
37
+ /**
38
+ * Options accepted by `createDrizzleResource`.
39
+ */
40
+ interface DrizzleResourceOptions {
41
+ /**
42
+ * Map the resolved key string into the typed key passed to the query fn.
43
+ * Defaults to identity (the raw cache-key string). Use this when your query
44
+ * needs a parsed value (e.g. `Number(key)`).
45
+ */
46
+ readonly parseKey?: (key: string) => unknown;
47
+ }
48
+ //#endregion
49
+ //#region src/query.d.ts
50
+ /**
51
+ * Build a `createResource`-compatible fetcher from a Drizzle query.
52
+ *
53
+ * The returned function has signature `(key: string) => Promise<T>` — exactly
54
+ * what `@aihu-plugin/data`'s `createResource(keySignal, fetcher, options?)`
55
+ * expects as its second argument.
56
+ *
57
+ * @param db A Drizzle database handle (pg / sqlite / libsql). Kept fully
58
+ * generic; the adapter never inspects it.
59
+ * @param queryFn `(db, key) => DrizzleQuery<T> | Promise<T>`. `key` is the
60
+ * parsed cache key (see `options.parseKey`; defaults to the raw
61
+ * string).
62
+ * @param options `parseKey` to transform the string cache key before it hits
63
+ * the query (e.g. `Number`).
64
+ *
65
+ * @example
66
+ * import { drizzle } from 'drizzle-orm/libsql'
67
+ * import { eq } from 'drizzle-orm'
68
+ * import { createResource } from '@aihu-plugin/data'
69
+ * import { createDrizzleResource } from '@aihu-plugin/drizzle'
70
+ *
71
+ * const db = drizzle(client)
72
+ * const fetchUser = createDrizzleResource(
73
+ * db,
74
+ * (db, id: number) => db.select().from(users).where(eq(users.id, id)),
75
+ * { parseKey: Number },
76
+ * )
77
+ * const user = createResource(idSignal, fetchUser)
78
+ */
79
+ declare function createDrizzleResource<DB, K, T>(db: DB, queryFn: DrizzleQueryFn<DB, K, T>, options?: DrizzleResourceOptions): (key: string) => Promise<T>;
80
+ /**
81
+ * Build a `defineLoader`-wrapped SSR loader from a Drizzle query.
82
+ *
83
+ * The query fn receives the Drizzle handle and the `@aihu/server` `RouteContext`
84
+ * (params, request, etc.), so loaders can read `ctx.params.id` directly. The
85
+ * result is a `DefinedLoader<T>` ready to pass to `defineRoute(..., { loader })`.
86
+ * Loader errors are caught by `@aihu/server`'s `runLoader` and surfaced as
87
+ * `ctx.loaderData.error` — this adapter does not swallow them.
88
+ *
89
+ * @example
90
+ * import { drizzle } from 'drizzle-orm/libsql'
91
+ * import { eq } from 'drizzle-orm'
92
+ * import { defineRoute } from '@aihu/server'
93
+ * import { drizzleLoader } from '@aihu-plugin/drizzle'
94
+ *
95
+ * const db = drizzle(client)
96
+ * const userLoader = drizzleLoader(db, (db, ctx) =>
97
+ * db.select().from(users).where(eq(users.id, Number(ctx.params.id))),
98
+ * )
99
+ * export const userRoute = defineRoute('/users/:id', handler, { loader: userLoader })
100
+ */
101
+ declare function drizzleLoader<DB, T>(db: DB, queryFn: DrizzleQueryFn<DB, RouteContext, T>): ReturnType<typeof defineLoader<T>>;
102
+ //#endregion
103
+ //#region src/index.d.ts
104
+ /**
105
+ * Plugin factory for `@aihu-plugin/drizzle`. Accepts optional configuration
106
+ * (reserved for v0.4+ when query-macro lowering is wired) and returns the
107
+ * configured plugin instance for `defineAihuConfig({ plugins: [drizzle()] })`.
108
+ *
109
+ * @example
110
+ * // aihu.config.ts
111
+ * import { drizzle } from '@aihu-plugin/drizzle'
112
+ * import { defineAihuConfig } from '@aihu/server'
113
+ *
114
+ * export default defineAihuConfig({
115
+ * plugins: [drizzle()],
116
+ * })
117
+ */
118
+ declare function drizzle(_config?: Record<string, never>): Plugin;
119
+ //#endregion
120
+ export { type DefinedLoader, type DrizzleQuery, type DrizzleQueryFn, type DrizzleResourceOptions, createDrizzleResource, drizzle, drizzleLoader };
121
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/query.ts","../src/index.ts"],"mappings":";;;;;;;;AAkBA;;;;;;;;;AAeA;;;;KAfY,YAAA,MAAkB,WAAA,CAAY,CAAA;;;;;;;;;;;;;;KAe9B,cAAA,cAA4B,EAAA,EAAI,EAAA,EAAI,GAAA,EAAK,CAAA,KAAM,YAAA,CAAa,CAAA,IAAK,OAAA,CAAQ,CAAA;;;;UAKpE,sBAAA;EALqE;AAKtF;;;;EALsF,SAW3E,QAAA,IAAY,GAAA;AAAA;;;;;;;;;;;;;;AANvB;;;;;;;;ACmCA;;;;;;;;;;iBAAgB,qBAAA,UAAA,CACd,EAAA,EAAI,EAAA,EACJ,OAAA,EAAS,cAAA,CAAe,EAAA,EAAI,CAAA,EAAG,CAAA,GAC/B,OAAA,GAAU,sBAAA,IACR,GAAA,aAAgB,OAAA,CAAQ,CAAA;;;;;;;;;;;;;;;;;;;;AA6B5B;;iBAAgB,aAAA,OAAA,CACd,EAAA,EAAI,EAAA,EACJ,OAAA,EAAS,cAAA,CAAe,EAAA,EAAI,YAAA,EAAc,CAAA,IACzC,UAAA,QAAkB,YAAA,CAAa,CAAA;;;;;;;;;;;;ADvElC;;;;;iBEYgB,OAAA,CAAQ,OAAA,GAAU,MAAA,kBAAwB,MAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import{defineLoader as e}from"@aihu/server";async function t(e,t,n){return await Promise.resolve(t(e,n))}function n(e,n,r){let i=r?.parseKey;return r=>t(e,n,i?i(r):r)}function r(n,r){return e(e=>t(n,r,e))}const i={name:`drizzle`,version:`0.1.0`,namespace:`drizzle`,serverOnly:!0,contributes:{},__aihu_plugin:!0};function a(e){return i}export{n as createDrizzleResource,a as drizzle,r as drizzleLoader};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/query.ts","../src/plugin.ts","../src/index.ts"],"sourcesContent":["/**\n * @aihu-plugin/drizzle — query adapters.\n *\n * Turns a Drizzle query into the two data-access shapes aihu uses:\n *\n * 1. `createDrizzleResource(db, queryFn)` → a `(key: string) => Promise<T>`\n * fetcher, drop-in for `@aihu-plugin/data`'s `createResource`.\n * 2. `drizzleLoader(db, queryFn)` → a `DefinedLoader<T>` for `@aihu/server`'s\n * `defineLoader` (parallel SSR loaders).\n *\n * SERVER-ONLY. A Drizzle `db` handle holds a live DB connection, so these run\n * exclusively in the SSR / loader tier — never in a browser bundle. This\n * package therefore carries NO `.size-limit.json` row (see\n * `.size-limit.README.md`, server-side classification).\n *\n * Optional-peer discipline: `drizzle-orm` and its drivers (`postgres`,\n * `@libsql/client`) are OPTIONAL peerDependencies. This module imports NO\n * `drizzle-orm` runtime value and references Drizzle types only via\n * `import type`, so `import('@aihu-plugin/drizzle')` succeeds even when no\n * Drizzle package is installed. The user supplies the `db` handle and query\n * fn; we only `await` the result.\n */\n\n// Type-only re-exports of the structural Drizzle shapes. These erase at build\n// time (verbatimModuleSyntax), so nothing from `drizzle-orm` is required at\n// runtime — the optional-peer guarantee.\nimport type { LoaderFn, RouteContext } from '@aihu/server'\nimport { defineLoader } from '@aihu/server'\nimport type { DrizzleQueryFn, DrizzleResourceOptions } from './types.ts'\n\n// Re-export DefinedLoader so consumers do not need a direct @aihu/server import\n// just to type the return of drizzleLoader.\nexport type { DefinedLoader } from '@aihu/server'\n\n/**\n * Run a user query fn against a Drizzle handle and normalize the result to a\n * real `Promise<T>`. A Drizzle query builder is a `PromiseLike`, not a true\n * `Promise`, so we wrap it in `Promise.resolve(...)` to give callers a value\n * `createResource`'s `fetcher: (key) => Promise<T>` contract guarantees.\n */\nasync function runQuery<DB, K, T>(db: DB, queryFn: DrizzleQueryFn<DB, K, T>, key: K): Promise<T> {\n return await Promise.resolve(queryFn(db, key))\n}\n\n/**\n * Build a `createResource`-compatible fetcher from a Drizzle query.\n *\n * The returned function has signature `(key: string) => Promise<T>` — exactly\n * what `@aihu-plugin/data`'s `createResource(keySignal, fetcher, options?)`\n * expects as its second argument.\n *\n * @param db A Drizzle database handle (pg / sqlite / libsql). Kept fully\n * generic; the adapter never inspects it.\n * @param queryFn `(db, key) => DrizzleQuery<T> | Promise<T>`. `key` is the\n * parsed cache key (see `options.parseKey`; defaults to the raw\n * string).\n * @param options `parseKey` to transform the string cache key before it hits\n * the query (e.g. `Number`).\n *\n * @example\n * import { drizzle } from 'drizzle-orm/libsql'\n * import { eq } from 'drizzle-orm'\n * import { createResource } from '@aihu-plugin/data'\n * import { createDrizzleResource } from '@aihu-plugin/drizzle'\n *\n * const db = drizzle(client)\n * const fetchUser = createDrizzleResource(\n * db,\n * (db, id: number) => db.select().from(users).where(eq(users.id, id)),\n * { parseKey: Number },\n * )\n * const user = createResource(idSignal, fetchUser)\n */\nexport function createDrizzleResource<DB, K, T>(\n db: DB,\n queryFn: DrizzleQueryFn<DB, K, T>,\n options?: DrizzleResourceOptions,\n): (key: string) => Promise<T> {\n const parseKey = options?.parseKey\n return (key: string): Promise<T> => {\n const typedKey = (parseKey ? parseKey(key) : key) as K\n return runQuery(db, queryFn, typedKey)\n }\n}\n\n/**\n * Build a `defineLoader`-wrapped SSR loader from a Drizzle query.\n *\n * The query fn receives the Drizzle handle and the `@aihu/server` `RouteContext`\n * (params, request, etc.), so loaders can read `ctx.params.id` directly. The\n * result is a `DefinedLoader<T>` ready to pass to `defineRoute(..., { loader })`.\n * Loader errors are caught by `@aihu/server`'s `runLoader` and surfaced as\n * `ctx.loaderData.error` — this adapter does not swallow them.\n *\n * @example\n * import { drizzle } from 'drizzle-orm/libsql'\n * import { eq } from 'drizzle-orm'\n * import { defineRoute } from '@aihu/server'\n * import { drizzleLoader } from '@aihu-plugin/drizzle'\n *\n * const db = drizzle(client)\n * const userLoader = drizzleLoader(db, (db, ctx) =>\n * db.select().from(users).where(eq(users.id, Number(ctx.params.id))),\n * )\n * export const userRoute = defineRoute('/users/:id', handler, { loader: userLoader })\n */\nexport function drizzleLoader<DB, T>(\n db: DB,\n queryFn: DrizzleQueryFn<DB, RouteContext, T>,\n): ReturnType<typeof defineLoader<T>> {\n const fn: LoaderFn<T> = (ctx: RouteContext) => runQuery(db, queryFn, ctx)\n return defineLoader<T>(fn)\n}\n","import type { Plugin } from '@aihu/plugin'\n\n/**\n * `@aihu-plugin/drizzle` plugin — registration shim.\n *\n * Registers the Drizzle adapter under the Plugin Contract (Plugin Contract Spec\n * §1.1, §3, §7.1). Like `@aihu-plugin/data`, this ships registration plumbing\n * ONLY — `contributes: {}` is a deliberate no-op. The adapter's value lives in\n * the runtime helper library (`createDrizzleResource` / `drizzleLoader`), NOT in\n * macro lowering: the compiler's macro-lowering dispatcher is a no-op until\n * v0.4, so there is no `$resource`-style macro to wire here yet.\n *\n * `serverOnly: true` marks this plugin's (future) contributions as server-bundle\n * only — a Drizzle `db` handle holds a live DB connection and must never reach a\n * browser bundle (Plugin Contract Spec §6.5 / Amendment 03).\n *\n * We construct the Plugin object directly (satisfying the `Plugin` type contract\n * via `__aihu_plugin: true`) rather than calling `definePlugin()`, keeping\n * `@aihu/plugin` a build/type-only dependency with zero runtime footprint — same\n * pattern as `@aihu-plugin/data`'s `dataPlugin`.\n *\n * Consumers register it via:\n * defineAihuConfig({ plugins: [drizzle()] })\n */\nexport const drizzlePlugin: Plugin = {\n name: 'drizzle',\n version: '0.1.0',\n namespace: 'drizzle',\n serverOnly: true,\n contributes: {}, // no-op until v0.4 lowers query macros\n __aihu_plugin: true,\n}\n","/**\n * @aihu-plugin/drizzle — Drizzle ORM data adapter for aihu.\n *\n * SERVER-ONLY. Produces typed data-access shapes from Drizzle queries:\n *\n * createDrizzleResource(db, queryFn, options?) → (key: string) => Promise<T>\n * A fetcher compatible with `@aihu-plugin/data`'s\n * `createResource(keySignal, fetcher, options?)`.\n *\n * drizzleLoader(db, queryFn) → DefinedLoader<T>\n * An SSR loader for `@aihu/server`'s `defineLoader` / `defineRoute`.\n *\n * Plugin registration (Plugin Contract Spec §3, §7.1):\n * drizzle() → Plugin — register in `defineAihuConfig({ plugins: [drizzle()] })`.\n *\n * Optional peers: `drizzle-orm` and its drivers (`postgres`, `@libsql/client`)\n * are OPTIONAL peerDependencies. This package imports NO `drizzle-orm` runtime\n * value (Drizzle types are referenced via `import type` only), so importing it\n * never breaks when the peers are absent. The caller supplies the `db` handle.\n *\n * NOT browser-eligible: a Drizzle `db` handle holds a live DB connection, so the\n * adapter runs only in the SSR / loader tier and carries NO `.size-limit.json`\n * row (see `.size-limit.README.md`, server-side classification).\n */\n\nexport type { DefinedLoader } from './query.ts'\nexport { createDrizzleResource, drizzleLoader } from './query.ts'\nexport type { DrizzleQuery, DrizzleQueryFn, DrizzleResourceOptions } from './types.ts'\n\n// ---------------------------------------------------------------------------\n// Plugin factory (Plugin Contract Spec §3)\n// ---------------------------------------------------------------------------\n\nimport type { Plugin } from '@aihu/plugin'\nimport { drizzlePlugin } from './plugin.ts'\n\n/**\n * Plugin factory for `@aihu-plugin/drizzle`. Accepts optional configuration\n * (reserved for v0.4+ when query-macro lowering is wired) and returns the\n * configured plugin instance for `defineAihuConfig({ plugins: [drizzle()] })`.\n *\n * @example\n * // aihu.config.ts\n * import { drizzle } from '@aihu-plugin/drizzle'\n * import { defineAihuConfig } from '@aihu/server'\n *\n * export default defineAihuConfig({\n * plugins: [drizzle()],\n * })\n */\nexport function drizzle(_config?: Record<string, never>): Plugin {\n return drizzlePlugin\n}\n"],"mappings":"4CAwCA,eAAe,EAAmB,EAAQ,EAAmC,EAAoB,CAC/F,OAAO,MAAM,QAAQ,QAAQ,EAAQ,EAAI,EAAI,CAAC,CAgChD,SAAgB,EACd,EACA,EACA,EAC6B,CAC7B,IAAM,EAAW,GAAS,SAC1B,MAAQ,IAEC,EAAS,EAAI,EADF,EAAW,EAAS,EAAI,CAAG,EACP,CAyB1C,SAAgB,EACd,EACA,EACoC,CAEpC,OAAO,EADkB,GAAsB,EAAS,EAAI,EAAS,EAAI,CAC/C,CCvF5B,MAAa,EAAwB,CACnC,KAAM,UACN,QAAS,QACT,UAAW,UACX,WAAY,GACZ,YAAa,EAAE,CACf,cAAe,GAChB,CCmBD,SAAgB,EAAQ,EAAyC,CAC/D,OAAO"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@aihu-plugin/drizzle",
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "sideEffects": false,
21
+ "scripts": {
22
+ "build": "rolldown -c",
23
+ "typecheck": "tsc --noEmit",
24
+ "prepublishOnly": "bun run build"
25
+ },
26
+ "dependencies": {
27
+ "@aihu/server": "0.2.0"
28
+ },
29
+ "devDependencies": {
30
+ "@aihu/plugin": "0.1.0",
31
+ "@aihu-plugin/data": "2.0.0"
32
+ },
33
+ "peerDependencies": {
34
+ "drizzle-orm": ">=0.29.0"
35
+ },
36
+ "peerDependenciesMeta": {
37
+ "drizzle-orm": {
38
+ "optional": true
39
+ }
40
+ },
41
+ "description": "Drizzle ORM data adapter for aihu — typed createResource fetchers and defineLoader helpers (Postgres / SQLite / libSQL).",
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/fellwork/aihu.git",
45
+ "directory": "packages/plugin-drizzle"
46
+ },
47
+ "homepage": "https://github.com/fellwork/aihu/tree/main/packages/plugin-drizzle#readme",
48
+ "bugs": "https://github.com/fellwork/aihu/issues",
49
+ "publishConfig": {
50
+ "access": "public"
51
+ }
52
+ }