@oidcraft/drizzle 0.0.0-stage → 0.2.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 Florian Chiș
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 CHANGED
@@ -1,3 +1,34 @@
1
- # Temporary Holding Version
1
+ # @oidcraft/drizzle
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A [Drizzle](https://orm.drizzle.team) v1 storage adapter for `@oidcraft/provider`, on SQLite or Postgres.
4
+
5
+ ```sh
6
+ bun add @oidcraft/drizzle @oidcraft/adapter drizzle-orm
7
+ ```
8
+
9
+ ```ts
10
+ import { Database } from 'bun:sqlite'
11
+ import { staticKeyStore } from '@oidcraft/adapter'
12
+ import { drizzleAdapter, SQLITE_MIGRATIONS } from '@oidcraft/drizzle'
13
+ import { createProvider } from '@oidcraft/provider'
14
+ import { drizzle } from 'drizzle-orm/bun-sqlite'
15
+
16
+ const sqlite = new Database('oidcraft.sqlite')
17
+ for (const statement of SQLITE_MIGRATIONS.flatMap(migration => migration.statements)) sqlite.run(statement) // once, in your migration step
18
+ const adapter = drizzleAdapter({ db: drizzle({ client: sqlite }), keys: staticKeyStore(keys) })
19
+ const provider = createProvider({ issuer, adapter, interactionUrl })
20
+ ```
21
+
22
+ On Postgres, pass `tables: postgresTables(schema?)` beside a Postgres `db`; the schema is where a realm's
23
+ tables live.
24
+
25
+ The schema ships as migrations, `SQLITE_MIGRATIONS` and `POSTGRES_MIGRATIONS` — the same tables as
26
+ the other SQL adapters, so one database works with any of them — which you run with your own tooling
27
+ before you deploy. The adapter never
28
+ creates or alters a table at startup.
29
+
30
+ It returns a `FullAdapter`, so it satisfies every `@oidcraft/provider` entry point: brokering, local
31
+ accounts and realms included. It passes the shared suite in `@oidcraft/adapter/conformance`, on
32
+ SQLite and Postgres.
33
+
34
+ See the [storage guide](https://github.com/Fl0r14n/oidcraft/blob/main/apps/docs/guide/adapters.md).