@superfunctions/db 0.1.0 โ†’ 0.1.1

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.
Files changed (2) hide show
  1. package/README.md +12 -59
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,16 +1,6 @@
1
1
  # @superfunctions/db
2
2
 
3
- Shared database adapter system for Superfunctions libraries. Provides a unified interface for interacting with databases across multiple ORMs (Drizzle, Prisma, Kysely, MongoDB).
4
-
5
- ## Features
6
-
7
- - **๐Ÿ”Œ Multiple ORM Support**: Works with Drizzle, Prisma, Kysely, MongoDB
8
- - **๐ŸŽฏ Type Safe**: Full TypeScript support with strict types
9
- - **๐Ÿ”„ Unified Interface**: Single adapter interface across all ORMs
10
- - **๐Ÿ“ฆ Namespace Isolation**: Prevent table name conflicts between libraries
11
- - **โšก Progressive Enhancement**: Adapters declare capabilities, libraries adapt accordingly
12
- - **๐Ÿงช Testing Utilities**: Built-in memory adapter and testing tools
13
- - **๐Ÿ”ง Schema Management**: Version tracking and migration support
3
+ Shared database adapter system for Superfunctions libraries. Provides a unified interface for interacting with databases across multiple ORMs (Drizzle, Prisma, Kysely).
14
4
 
15
5
  ## Installation
16
6
 
@@ -21,7 +11,6 @@ npm install @superfunctions/db
21
11
  npm install drizzle-orm # For Drizzle
22
12
  npm install @prisma/client # For Prisma
23
13
  npm install kysely # For Kysely
24
- npm install mongodb # For MongoDB
25
14
  ```
26
15
 
27
16
  ## Quick Start
@@ -29,7 +18,7 @@ npm install mongodb # For MongoDB
29
18
  ### Using with a Library
30
19
 
31
20
  ```typescript
32
- import { SendFn } from '@superfunctions/sendFn';
21
+ import { AuthFn } from '@superfunctions/authFn';
33
22
  import { memoryAdapter } from '@superfunctions/db/adapters';
34
23
 
35
24
  // Create adapter
@@ -38,50 +27,19 @@ const adapter = memoryAdapter({
38
27
  });
39
28
 
40
29
  // Initialize library with adapter
41
- const sendFn = SendFn({
30
+ const authFn = AuthFn({
42
31
  database: adapter,
43
- namespace: 'sendFn'
32
+ namespace: 'authFn'
44
33
  });
45
34
 
46
35
  // Use the library
47
- await sendFn.sendEmail({
48
- to: 'user@example.com',
49
- subject: 'Hello',
50
- body: 'World'
36
+ await authFn.createUser({
37
+ email: 'user@example.com',
38
+ password: 'password',
39
+ name: 'John Doe',
51
40
  });
52
41
  ```
53
42
 
54
- ### Creating a Custom Adapter
55
-
56
- ```typescript
57
- import { createAdapterFactory } from '@superfunctions/db';
58
- import type { AdapterFactoryOptions } from '@superfunctions/db';
59
-
60
- export function myCustomAdapter(db: any, config: any) {
61
- return createAdapterFactory({
62
- config: {
63
- adapterId: 'my-custom',
64
- adapterName: 'My Custom Adapter',
65
- capabilities: {
66
- types: {
67
- json: true,
68
- dates: true,
69
- booleans: true,
70
- // ...
71
- },
72
- // ...
73
- },
74
- },
75
- adapter: (context) => ({
76
- async create(params) {
77
- // Implementation
78
- },
79
- // ... other methods
80
- }),
81
- });
82
- }
83
- ```
84
-
85
43
  ## Core Concepts
86
44
 
87
45
  ### Adapter Interface
@@ -149,12 +107,12 @@ const adapter = memoryAdapter({
149
107
  });
150
108
 
151
109
  // Library A
152
- const sendFn = SendFn({ database: adapter, namespace: 'sendFn' });
153
- // Tables: sendFn_email_log, sendFn_templates
110
+ const authFn = AuthFn({ database: adapter, namespace: 'authFn' });
111
+ // Tables: authFn_users, authFn_sessions, authFn_tokens
154
112
 
155
113
  // Library B
156
- const webFn = WebFn({ database: adapter, namespace: 'webFn' });
157
- // Tables: webFn_jobs, webFn_results
114
+ const fileFn = FileFn({ database: adapter, namespace: 'fileFn' });
115
+ // Tables: fileFn_files, fileFn_folders
158
116
 
159
117
  // No conflicts!
160
118
  ```
@@ -253,9 +211,6 @@ const adapter = kyselyAdapter({
253
211
  - Upsert (INSERT...ON CONFLICT)
254
212
  - Multi-dialect support
255
213
 
256
- ### MongoDB Adapter (Coming Soon)
257
-
258
- For MongoDB (planned for v1.1 or community contribution)
259
214
 
260
215
  ## Testing
261
216
 
@@ -337,5 +292,3 @@ Contributions welcome! See [Contributing Guide](../../CONTRIBUTING.md) for detai
337
292
  ## Related Packages
338
293
 
339
294
  - `@superfunctions/cli` - Schema management and migrations
340
- - `@superfunctions/sendFn` - Email functionality (example library)
341
- - `@superfunctions/webFn` - Web scraping (example library)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superfunctions/db",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Shared database adapter system for building useful backend libraries",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",