@opensaas/stack-auth 0.1.7 → 0.4.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +217 -0
- package/CLAUDE.md +61 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/config/plugin.d.ts.map +1 -1
- package/dist/config/plugin.js +33 -1
- package/dist/config/plugin.js.map +1 -1
- package/dist/config/types.d.ts +38 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lists/index.d.ts +7 -7
- package/dist/lists/index.d.ts.map +1 -1
- package/dist/lists/index.js +4 -0
- package/dist/lists/index.js.map +1 -1
- package/dist/runtime/types.d.ts +26 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +6 -0
- package/dist/runtime/types.js.map +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +42 -9
- package/dist/server/index.js.map +1 -1
- package/dist/server/schema-converter.d.ts +2 -2
- package/dist/server/schema-converter.d.ts.map +1 -1
- package/dist/server/schema-converter.js +12 -1
- package/dist/server/schema-converter.js.map +1 -1
- package/dist/ui/components/ForgotPasswordForm.js +1 -1
- package/dist/ui/components/ForgotPasswordForm.js.map +1 -1
- package/dist/ui/components/SignInForm.d.ts.map +1 -1
- package/dist/ui/components/SignInForm.js +11 -1
- package/dist/ui/components/SignInForm.js.map +1 -1
- package/dist/ui/components/SignUpForm.d.ts.map +1 -1
- package/dist/ui/components/SignUpForm.js +11 -1
- package/dist/ui/components/SignUpForm.js.map +1 -1
- package/package.json +12 -13
- package/src/config/index.ts +1 -0
- package/src/config/plugin.ts +37 -2
- package/src/config/types.ts +42 -1
- package/src/index.ts +3 -0
- package/src/lists/index.ts +15 -7
- package/src/runtime/types.ts +27 -0
- package/src/server/index.ts +47 -9
- package/src/server/schema-converter.ts +27 -14
- package/src/ui/components/ForgotPasswordForm.tsx +1 -1
- package/src/ui/components/SignInForm.tsx +10 -1
- package/src/ui/components/SignUpForm.tsx +10 -1
- package/tests/config.test.ts +4 -13
- package/tsconfig.tsbuildinfo +1 -1
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,222 @@
|
|
|
1
1
|
# @opensaas/stack-auth
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#172](https://github.com/OpenSaasAU/stack/pull/172) [`929a2a9`](https://github.com/OpenSaasAU/stack/commit/929a2a9a2dfa80b1d973d259dd87828d644ea58d) Thanks [@list<Lists.User.TypeInfo>({](https://github.com/list<Lists.User.TypeInfo>({), [@list<Lists.User.TypeInfo>({](https://github.com/list<Lists.User.TypeInfo>({)! - Improve TypeScript type inference for field configs and list-level hooks by automatically passing TypeInfo from list level down
|
|
8
|
+
|
|
9
|
+
This change eliminates the need to manually specify type parameters on field builders when using features like virtual fields, and fixes a critical bug where list-level hooks weren't receiving properly typed parameters.
|
|
10
|
+
|
|
11
|
+
## Field Type Inference Improvements
|
|
12
|
+
|
|
13
|
+
Previously, users had to write `virtual<Lists.User.TypeInfo>({...})` to get proper type inference. Now TypeScript automatically infers the correct types from the list-level type parameter.
|
|
14
|
+
|
|
15
|
+
**Example:**
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
// Before
|
|
19
|
+
|
|
20
|
+
fields: {
|
|
21
|
+
displayName: virtual<Lists.User.TypeInfo>({
|
|
22
|
+
type: 'string',
|
|
23
|
+
hooks: {
|
|
24
|
+
resolveOutput: ({ item }) => `${item.name} (${item.email})`,
|
|
25
|
+
},
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
// After
|
|
31
|
+
|
|
32
|
+
fields: {
|
|
33
|
+
displayName: virtual({
|
|
34
|
+
type: 'string',
|
|
35
|
+
hooks: {
|
|
36
|
+
resolveOutput: ({ item }) => `${item.name} (${item.email})`,
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## List-Level Hooks Type Inference Fix
|
|
44
|
+
|
|
45
|
+
Fixed a critical type parameter mismatch where `Hooks<TTypeInfo>` was passing the entire TypeInfo object as the first parameter instead of properly destructuring it into three required parameters:
|
|
46
|
+
1. `TOutput` - The item type (what's stored in DB)
|
|
47
|
+
2. `TCreateInput` - Prisma create input type
|
|
48
|
+
3. `TUpdateInput` - Prisma update input type
|
|
49
|
+
|
|
50
|
+
**Impact:**
|
|
51
|
+
- `resolveInput` now receives proper Prisma input types (e.g., `PostCreateInput`, `PostUpdateInput`)
|
|
52
|
+
- `validateInput` has access to properly typed input data
|
|
53
|
+
- `beforeOperation` and `afterOperation` have correct item types
|
|
54
|
+
- All list-level hook callbacks now get full IntelliSense and type checking
|
|
55
|
+
|
|
56
|
+
**Example:**
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
Post: list<Lists.Post.TypeInfo>({
|
|
60
|
+
fields: { title: text(), content: text() },
|
|
61
|
+
hooks: {
|
|
62
|
+
resolveInput: async ({ operation, resolvedData }) => {
|
|
63
|
+
// ✅ resolvedData is now properly typed as PostCreateInput or PostUpdateInput
|
|
64
|
+
// ✅ Full autocomplete for title, content, etc.
|
|
65
|
+
if (operation === 'create') {
|
|
66
|
+
console.log(resolvedData.title) // TypeScript knows this is string | undefined
|
|
67
|
+
}
|
|
68
|
+
return resolvedData
|
|
69
|
+
},
|
|
70
|
+
beforeOperation: async ({ operation, item }) => {
|
|
71
|
+
// ✅ item is now properly typed as Post with all fields
|
|
72
|
+
if (operation === 'update' && item) {
|
|
73
|
+
console.log(item.title) // TypeScript knows this is string
|
|
74
|
+
console.log(item.createdAt) // TypeScript knows this is Date
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
})
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Breaking Changes
|
|
82
|
+
- Field types now accept full `TTypeInfo extends TypeInfo` instead of just `TItem`
|
|
83
|
+
- `FieldsWithItemType` utility replaced with `FieldsWithTypeInfo`
|
|
84
|
+
- All field builders updated to use new type signature
|
|
85
|
+
- List-level hooks now receive properly typed parameters (may reveal existing type errors)
|
|
86
|
+
|
|
87
|
+
## Benefits
|
|
88
|
+
- ✨ Cleaner code without manual type parameter repetition
|
|
89
|
+
- 🎯 Better type inference in both field-level and list-level hooks
|
|
90
|
+
- 🔄 Consistent type flow from list configuration down to individual fields
|
|
91
|
+
- 🛡️ Maintained full type safety with improved DX
|
|
92
|
+
- 💡 Full IntelliSense support in all hook callbacks
|
|
93
|
+
|
|
94
|
+
## 0.3.0
|
|
95
|
+
|
|
96
|
+
### Minor Changes
|
|
97
|
+
|
|
98
|
+
- [#133](https://github.com/OpenSaasAU/stack/pull/133) [`4ed7ba4`](https://github.com/OpenSaasAU/stack/commit/4ed7ba4ee4a08bacc76a40fc9f38a11fe0f00683) Thanks [@renovate](https://github.com/apps/renovate)! - Update to latest better-auth
|
|
99
|
+
|
|
100
|
+
## 0.2.0
|
|
101
|
+
|
|
102
|
+
### Minor Changes
|
|
103
|
+
|
|
104
|
+
- [#121](https://github.com/OpenSaasAU/stack/pull/121) [`3851a3c`](https://github.com/OpenSaasAU/stack/commit/3851a3cf72e78dc6f01a73c6fff97deca6fad043) Thanks [@borisno2](https://github.com/borisno2)! - Add strongly-typed session support via module augmentation
|
|
105
|
+
|
|
106
|
+
This change enables developers to define custom session types with full TypeScript autocomplete and type safety throughout their OpenSaas applications using the module augmentation pattern.
|
|
107
|
+
|
|
108
|
+
**Core Changes:**
|
|
109
|
+
- Converted `Session` from `type` to `interface` to enable module augmentation
|
|
110
|
+
- Updated all session references to properly handle `Session | null`
|
|
111
|
+
- Added comprehensive JSDoc documentation with module augmentation examples
|
|
112
|
+
- Updated `AccessControl`, `AccessContext`, and access control engine to support nullable sessions
|
|
113
|
+
- Added "Session Typing" section to core package documentation
|
|
114
|
+
|
|
115
|
+
**Auth Package:**
|
|
116
|
+
- Added "Session Type Safety" section to documentation
|
|
117
|
+
- Documented how Better Auth users can create session type declarations
|
|
118
|
+
- Provided step-by-step guide for matching sessionFields to TypeScript types
|
|
119
|
+
- Created `getSession()` helper pattern for transforming Better Auth sessions
|
|
120
|
+
|
|
121
|
+
**Developer Experience:**
|
|
122
|
+
|
|
123
|
+
Developers can now augment the `Session` interface to get autocomplete everywhere:
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
// types/session.d.ts
|
|
127
|
+
import '@opensaas/stack-core'
|
|
128
|
+
|
|
129
|
+
declare module '@opensaas/stack-core' {
|
|
130
|
+
interface Session {
|
|
131
|
+
userId?: string
|
|
132
|
+
email?: string
|
|
133
|
+
role?: 'admin' | 'user'
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
This provides autocomplete in:
|
|
139
|
+
- Access control functions
|
|
140
|
+
- Hooks (resolveInput, validateInput, etc.)
|
|
141
|
+
- Context object
|
|
142
|
+
- Server actions
|
|
143
|
+
|
|
144
|
+
**Benefits:**
|
|
145
|
+
- Zero boilerplate - module augmentation provides types everywhere automatically
|
|
146
|
+
- Full type safety for session properties
|
|
147
|
+
- Autocomplete in all contexts that use session
|
|
148
|
+
- Developer controls session shape (no assumptions about structure)
|
|
149
|
+
- Works with any auth provider (Better Auth, custom, etc.)
|
|
150
|
+
- Fully backward compatible - existing code continues to work
|
|
151
|
+
- Follows TypeScript best practices (similar to NextAuth.js pattern)
|
|
152
|
+
|
|
153
|
+
**Example:**
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
// Before: No autocomplete
|
|
157
|
+
const isAdmin: AccessControl = ({ session }) => {
|
|
158
|
+
return session?.role === 'admin' // ❌ 'role' is 'unknown'
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// After: Full autocomplete and type checking
|
|
162
|
+
const isAdmin: AccessControl = ({ session }) => {
|
|
163
|
+
return session?.role === 'admin' // ✅ Autocomplete + type checking
|
|
164
|
+
// ↑ Shows: userId, email, role
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Migration:**
|
|
169
|
+
|
|
170
|
+
No migration required - this is a fully backward compatible change. Existing projects continue to work with untyped sessions. Projects can opt-in to typed sessions by creating a `types/session.d.ts` file with module augmentation.
|
|
171
|
+
|
|
172
|
+
### Patch Changes
|
|
173
|
+
|
|
174
|
+
- [#107](https://github.com/OpenSaasAU/stack/pull/107) [`f4f3966`](https://github.com/OpenSaasAU/stack/commit/f4f3966faedba07d2cf412fab826d81e30c63a6c) Thanks [@borisno2](https://github.com/borisno2)! - Add strict typing for plugin runtime services
|
|
175
|
+
|
|
176
|
+
This change implements fully typed plugin runtime services, providing autocomplete and type safety for `context.plugins` throughout the codebase.
|
|
177
|
+
|
|
178
|
+
**Core Changes:**
|
|
179
|
+
- Extended `Plugin` type with optional `runtimeServiceTypes` metadata for type-safe code generation
|
|
180
|
+
- Converted `OpenSaasConfig` and `AccessContext` from `type` to `interface` to enable module augmentation
|
|
181
|
+
- Plugins can now declare their runtime service type information
|
|
182
|
+
|
|
183
|
+
**Auth Plugin:**
|
|
184
|
+
- Added `AuthRuntimeServices` interface defining runtime service types
|
|
185
|
+
- Exported runtime types from package
|
|
186
|
+
- Users now get full autocomplete for `context.plugins.auth.getUser()` and `context.plugins.auth.getCurrentUser()`
|
|
187
|
+
|
|
188
|
+
**RAG Plugin:**
|
|
189
|
+
- Added `RAGRuntimeServices` interface defining runtime service types
|
|
190
|
+
- Exported runtime types from package
|
|
191
|
+
- Users now get full autocomplete for `context.plugins.rag.generateEmbedding()` and `context.plugins.rag.generateEmbeddings()`
|
|
192
|
+
|
|
193
|
+
**CLI Generator:**
|
|
194
|
+
- Enhanced plugin types generator to import and use plugin runtime service types
|
|
195
|
+
- Generated `.opensaas/plugin-types.ts` now includes proper type imports
|
|
196
|
+
- `PluginServices` interface extends `Record<string, Record<string, any> | undefined>` for type compatibility
|
|
197
|
+
- Maintains backwards compatibility with plugins that don't provide type metadata
|
|
198
|
+
|
|
199
|
+
**UI Package:**
|
|
200
|
+
- Updated `AdminUI` props to accept contexts with typed plugin services
|
|
201
|
+
- Ensures compatibility between generated context types and UI components
|
|
202
|
+
|
|
203
|
+
**Benefits:**
|
|
204
|
+
- Full TypeScript autocomplete for all plugin runtime methods
|
|
205
|
+
- Compile-time type checking catches errors early
|
|
206
|
+
- Better IDE experience with hover documentation and jump-to-definition
|
|
207
|
+
- Backwards compatible - third-party plugins without type metadata continue to work
|
|
208
|
+
- Zero type errors in examples
|
|
209
|
+
|
|
210
|
+
**Example:**
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
const context = await getContext()
|
|
214
|
+
|
|
215
|
+
// Fully typed with autocomplete
|
|
216
|
+
context.plugins.auth.getUser('123') // (userId: string) => Promise<unknown>
|
|
217
|
+
context.plugins.rag.generateEmbedding('text') // (text: string, providerName?: string) => Promise<number[]>
|
|
218
|
+
```
|
|
219
|
+
|
|
3
220
|
## 0.1.7
|
|
4
221
|
|
|
5
222
|
### Patch Changes
|
package/CLAUDE.md
CHANGED
|
@@ -87,6 +87,67 @@ access: {
|
|
|
87
87
|
}
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
+
### Session Type Safety
|
|
91
|
+
|
|
92
|
+
To get autocomplete and type safety for session fields, use module augmentation:
|
|
93
|
+
|
|
94
|
+
**Step 1: Create session type declaration file**
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// types/session.d.ts
|
|
98
|
+
import '@opensaas/stack-core'
|
|
99
|
+
|
|
100
|
+
declare module '@opensaas/stack-core' {
|
|
101
|
+
interface Session {
|
|
102
|
+
userId: string
|
|
103
|
+
email: string
|
|
104
|
+
name: string
|
|
105
|
+
role: 'admin' | 'user'
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Step 2: Ensure fields match your sessionFields configuration**
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
authConfig({
|
|
114
|
+
sessionFields: ['userId', 'email', 'name', 'role'],
|
|
115
|
+
extendUserList: {
|
|
116
|
+
fields: {
|
|
117
|
+
role: select({
|
|
118
|
+
options: [
|
|
119
|
+
{ label: 'Admin', value: 'admin' },
|
|
120
|
+
{ label: 'User', value: 'user' },
|
|
121
|
+
],
|
|
122
|
+
defaultValue: 'user',
|
|
123
|
+
}),
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
})
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Result: Fully typed session everywhere**
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
const isAdmin: AccessControl = ({ session }) => {
|
|
133
|
+
return session?.role === 'admin' // ✅ Autocomplete and type checking
|
|
134
|
+
// ↑ Shows: userId, email, name, role
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const context = await getContext(session)
|
|
138
|
+
if (context.session?.email) {
|
|
139
|
+
// ✅ Type: string
|
|
140
|
+
// Send email...
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Important Notes:**
|
|
145
|
+
|
|
146
|
+
- Session type declaration must match your `sessionFields` configuration
|
|
147
|
+
- `userId` always maps to User's `id` field
|
|
148
|
+
- Add fields to `extendUserList` before including them in session
|
|
149
|
+
- The session type is independent of Better Auth's internal types
|
|
150
|
+
|
|
90
151
|
### Extending User List
|
|
91
152
|
|
|
92
153
|
Add custom fields to User:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EAIrB,MAAM,YAAY,CAAA;AAEnB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EAIrB,MAAM,YAAY,CAAA;AAEnB;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,oBAAoB,CAyD5E;AAED,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAA;AAChD,cAAc,YAAY,CAAA"}
|
package/dist/config/index.js
CHANGED
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAkB;IACpD,8BAA8B;IAC9B,MAAM,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE,OAAO;QACvD,CAAC,CAAC;YACE,OAAO,EAAE,IAAa;YACtB,iBAAiB,EAAG,MAAM,CAAC,gBAAwC,CAAC,iBAAiB,IAAI,CAAC;YAC1F,mBAAmB,EAChB,MAAM,CAAC,gBAAwC,CAAC,mBAAmB,IAAI,IAAI;SAC/E;QACH,CAAC,CAAC,EAAE,OAAO,EAAE,KAAc,EAAE,iBAAiB,EAAE,CAAC,EAAE,mBAAmB,EAAE,IAAI,EAAE,CAAA;IAEhF,8BAA8B;IAC9B,MAAM,iBAAiB,GAAG,MAAM,CAAC,iBAAiB,EAAE,OAAO;QACzD,CAAC,CAAC;YACE,OAAO,EAAE,IAAa;YACtB,YAAY,EAAG,MAAM,CAAC,iBAA6C,CAAC,YAAY,IAAI,IAAI;YACxF,eAAe,EACZ,MAAM,CAAC,iBAA6C,CAAC,eAAe,IAAI,KAAK;SACjF;QACH,CAAC,CAAC,EAAE,OAAO,EAAE,KAAc,EAAE,YAAY,EAAE,IA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A;IAED,0BAA0B;IAC1B,MAAM,aAAa,GAAG,MAAM,CAAC,aAAa,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IAEzE,OAAO;QACL,gBAAgB;QAChB,iBAAiB;QACjB,aAAa;QACb,eAAe,EAAE,MAAM,CAAC,eAAe,IAAI,EAAE;QAC7C,OAAO;QACP,aAAa;QACb,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,EAAE;QAC3C,SAAS,EACP,MAAM,CAAC,SAAS;YAChB,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;gBAC/B,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAA;gBAC/D,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,CAAA;gBACxB,OAAO,CAAC,GAAG,CAAC,YAAY,OAAO,EAAE,CAAC,CAAA;gBAClC,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAA;YAC9B,CAAC,CAAC;QACJ,iBAAiB,EAAE,MAAM,CAAC,iBAAiB,IAAI,EAAE;QACjD,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,CAAA;AACH,CAAC;AAGD,cAAc,YAAY,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/config/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAwB,MAAM,YAAY,CAAA;AAKlE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/config/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,UAAU,EAAwB,MAAM,YAAY,CAAA;AAKlE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CA6FrD"}
|
package/dist/config/plugin.js
CHANGED
|
@@ -27,6 +27,10 @@ export function authPlugin(config) {
|
|
|
27
27
|
return {
|
|
28
28
|
name: 'auth',
|
|
29
29
|
version: '0.1.0',
|
|
30
|
+
runtimeServiceTypes: {
|
|
31
|
+
import: "import type { AuthRuntimeServices } from '@opensaas/stack-auth'",
|
|
32
|
+
typeName: 'AuthRuntimeServices',
|
|
33
|
+
},
|
|
30
34
|
init: async (context) => {
|
|
31
35
|
// Get auth lists from base Better Auth schema
|
|
32
36
|
const authLists = getAuthLists(normalized.extendUserList);
|
|
@@ -34,7 +38,6 @@ export function authPlugin(config) {
|
|
|
34
38
|
for (const plugin of normalized.betterAuthPlugins) {
|
|
35
39
|
if (plugin && typeof plugin === 'object' && 'schema' in plugin) {
|
|
36
40
|
// Plugin has schema property - convert to OpenSaaS lists
|
|
37
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Plugin schema types are dynamic
|
|
38
41
|
const pluginSchema = plugin.schema;
|
|
39
42
|
const pluginLists = convertBetterAuthSchema(pluginSchema);
|
|
40
43
|
// Add or extend lists from plugin
|
|
@@ -75,6 +78,35 @@ export function authPlugin(config) {
|
|
|
75
78
|
// Access at runtime via: config._pluginData.auth
|
|
76
79
|
context.setPluginData('auth', normalized);
|
|
77
80
|
},
|
|
81
|
+
runtime: (context) => {
|
|
82
|
+
// Provide auth-related utilities at runtime
|
|
83
|
+
return {
|
|
84
|
+
/**
|
|
85
|
+
* Get user by ID
|
|
86
|
+
* Uses the access-controlled context to fetch user data
|
|
87
|
+
*/
|
|
88
|
+
getUser: async (userId) => {
|
|
89
|
+
// Use 'authUser' if custom User list name was provided, otherwise 'user'
|
|
90
|
+
const userListKey = 'user'; // TODO: Make this configurable based on list name
|
|
91
|
+
return await context.db[userListKey].findUnique({
|
|
92
|
+
where: { id: userId },
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
/**
|
|
96
|
+
* Get current user from session
|
|
97
|
+
* Extracts userId from session and fetches user data
|
|
98
|
+
*/
|
|
99
|
+
getCurrentUser: async () => {
|
|
100
|
+
if (!context.session?.userId) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
const userListKey = 'user';
|
|
104
|
+
return await context.db[userListKey].findUnique({
|
|
105
|
+
where: { id: context.session.userId },
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
},
|
|
78
110
|
};
|
|
79
111
|
}
|
|
80
112
|
//# sourceMappingURL=plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/config/plugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,UAAU,CAAC,MAAkB;IAC3C,MAAM,UAAU,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAA;IAE9C,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,OAAO;QAEhB,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACtB,8CAA8C;YAC9C,MAAM,SAAS,GAAG,YAAY,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;YAEzD,oDAAoD;YACpD,KAAK,MAAM,MAAM,IAAI,UAAU,CAAC,iBAAiB,EAAE,CAAC;gBAClD,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,QAAQ,IAAI,MAAM,EAAE,CAAC;oBAC/D,yDAAy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E,EAAE,EAAE,MAAM,EAAE;qBACtB,CAAC,CAAA;gBACJ,CAAC;gBAED;;;mBAGG;gBACH,cAAc,EAAE,KAAK,IAAI,EAAE;oBACzB,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;wBAC7B,OAAO,IAAI,CAAA;oBACb,CAAC;oBACD,MAAM,WAAW,GAAG,MAAM,CAAA;oBAC1B,OAAO,MAAM,OAAO,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC;wBAC9C,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE;qBACtC,CAAC,CAAA;gBACJ,CAAC;aACF,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/config/types.d.ts
CHANGED
|
@@ -161,15 +161,52 @@ export type AuthConfig = {
|
|
|
161
161
|
* ```
|
|
162
162
|
*/
|
|
163
163
|
betterAuthPlugins?: any[];
|
|
164
|
+
/**
|
|
165
|
+
* Rate limiting configuration
|
|
166
|
+
* Controls rate limiting for authentication endpoints
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```typescript
|
|
170
|
+
* // Disable rate limiting for testing
|
|
171
|
+
* rateLimit: {
|
|
172
|
+
* enabled: process.env.DISABLE_RATE_LIMITING !== 'true',
|
|
173
|
+
* }
|
|
174
|
+
*
|
|
175
|
+
* // Custom rate limits
|
|
176
|
+
* rateLimit: {
|
|
177
|
+
* enabled: true,
|
|
178
|
+
* window: 60, // 60 seconds
|
|
179
|
+
* max: 100, // 100 requests per window
|
|
180
|
+
* }
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
rateLimit?: {
|
|
184
|
+
enabled: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Time window in seconds
|
|
187
|
+
* @default 60
|
|
188
|
+
*/
|
|
189
|
+
window?: number;
|
|
190
|
+
/**
|
|
191
|
+
* Maximum requests per window
|
|
192
|
+
* @default 100
|
|
193
|
+
*/
|
|
194
|
+
max?: number;
|
|
195
|
+
};
|
|
164
196
|
};
|
|
165
197
|
/**
|
|
166
198
|
* Internal normalized auth configuration
|
|
167
199
|
* Used after parsing user config
|
|
168
200
|
*/
|
|
169
|
-
export type NormalizedAuthConfig = Required<Omit<AuthConfig, 'emailAndPassword' | 'emailVerification' | 'passwordReset' | 'betterAuthPlugins'>> & {
|
|
201
|
+
export type NormalizedAuthConfig = Required<Omit<AuthConfig, 'emailAndPassword' | 'emailVerification' | 'passwordReset' | 'betterAuthPlugins' | 'rateLimit'>> & {
|
|
170
202
|
emailAndPassword: Required<EmailPasswordConfig>;
|
|
171
203
|
emailVerification: Required<EmailVerificationConfig>;
|
|
172
204
|
passwordReset: Required<PasswordResetConfig>;
|
|
173
205
|
betterAuthPlugins: any[];
|
|
206
|
+
rateLimit?: {
|
|
207
|
+
enabled: boolean;
|
|
208
|
+
window?: number;
|
|
209
|
+
max?: number;
|
|
210
|
+
};
|
|
174
211
|
};
|
|
175
212
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAE7D;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAA;CACzC,CAAA;AAED;;GA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ACb,CAAA;CACF,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CACzC,IAAI,CACF,UAAU,EACV,kBAAkB,GAAG,mBAAmB,GAAG,eAAe,GAAG,mBAAmB,GAAG,WAAW,CAC/F,CACF,GAAG;IACF,gBAAgB,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAA;IAC/C,iBAAiB,EAAE,QAAQ,CAAC,uBAAuB,CAAC,CAAA;IACpD,aAAa,EAAE,QAAQ,CAAC,mBAAmB,CAAC,CAAA;IAE5C,iBAAiB,EAAE,GAAG,EAAE,CAAA;IACxB,SAAS,CAAC,EAAE;QACV,OAAO,EAAE,OAAO,CAAA;QAChB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,GAAG,CAAC,EAAE,MAAM,CAAA;KACb,CAAA;CACF,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export { normalizeAuthConfig } from './config/index.js';
|
|
|
31
31
|
export { authPlugin } from './config/plugin.js';
|
|
32
32
|
export type { AuthConfig, NormalizedAuthConfig } from './config/index.js';
|
|
33
33
|
export type * from './config/types.js';
|
|
34
|
+
export type { AuthRuntimeServices } from './runtime/types.js';
|
|
34
35
|
export { getAuthLists, createUserList, createSessionList, createAccountList, createVerificationList, } from './lists/index.js';
|
|
35
36
|
export type { ExtendUserListConfig } from './lists/index.js';
|
|
36
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACzE,mBAAmB,mBAAmB,CAAA;AAGtC,OAAO,EACL,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AACzE,mBAAmB,mBAAmB,CAAA;AAGtC,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAG7D,OAAO,EACL,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,iBAAiB;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,iBAAiB;AACjB,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAO/C,2CAA2C;AAC3C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,kBAAkB,CAAA"}
|
package/dist/lists/index.d.ts
CHANGED
|
@@ -12,35 +12,35 @@ export type ExtendUserListConfig = {
|
|
|
12
12
|
* Access control for the User list
|
|
13
13
|
* If not provided, defaults to basic access control (users can update their own records)
|
|
14
14
|
*/
|
|
15
|
-
access?: ListConfig['access'];
|
|
15
|
+
access?: ListConfig<any>['access'];
|
|
16
16
|
/**
|
|
17
17
|
* Hooks for the User list
|
|
18
18
|
*/
|
|
19
|
-
hooks?: ListConfig['hooks'];
|
|
19
|
+
hooks?: ListConfig<any>['hooks'];
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
22
|
* Create the base User list with better-auth required fields
|
|
23
23
|
* This matches the better-auth user schema
|
|
24
24
|
*/
|
|
25
|
-
export declare function createUserList(config?: ExtendUserListConfig): ListConfig
|
|
25
|
+
export declare function createUserList(config?: ExtendUserListConfig): ListConfig<any>;
|
|
26
26
|
/**
|
|
27
27
|
* Create the Session list for better-auth
|
|
28
28
|
* Stores active user sessions
|
|
29
29
|
*/
|
|
30
|
-
export declare function createSessionList(): ListConfig
|
|
30
|
+
export declare function createSessionList(): ListConfig<any>;
|
|
31
31
|
/**
|
|
32
32
|
* Create the Account list for better-auth
|
|
33
33
|
* Stores OAuth provider accounts and credentials
|
|
34
34
|
*/
|
|
35
|
-
export declare function createAccountList(): ListConfig
|
|
35
|
+
export declare function createAccountList(): ListConfig<any>;
|
|
36
36
|
/**
|
|
37
37
|
* Create the Verification list for better-auth
|
|
38
38
|
* Stores email verification tokens, password reset tokens, etc.
|
|
39
39
|
*/
|
|
40
|
-
export declare function createVerificationList(): ListConfig
|
|
40
|
+
export declare function createVerificationList(): ListConfig<any>;
|
|
41
41
|
/**
|
|
42
42
|
* Get all auth lists required by better-auth
|
|
43
43
|
* This is the main export used by withAuth()
|
|
44
44
|
*/
|
|
45
|
-
export declare function getAuthLists(userConfig?: ExtendUserListConfig): Record<string, ListConfig
|
|
45
|
+
export declare function getAuthLists(userConfig?: ExtendUserListConfig): Record<string, ListConfig<any>>;
|
|
46
46
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lists/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEnE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IACpC;;;OAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lists/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEnE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IACpC;;;OAGG;IAEH,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAA;IAClC;;OAEG;IAEH,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAA;CACjC,CAAA;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,CAAC,EAAE,oBAAoB,GAC5B,UAAU,CAAC,GAAG,CAAC,CAqDjB;AAED;;;GAGG;AAEH,wBAAgB,iBAAiB,IAAI,UAAU,CAAC,GAAG,CAAC,CA+CnD;AAED;;;GAGG;AAEH,wBAAgB,iBAAiB,IAAI,UAAU,CAAC,GAAG,CAAC,CA0DnD;AAED;;;GAGG;AAEH,wBAAgB,sBAAsB,IAAI,UAAU,CAAC,GAAG,CAAC,CA2BxD;AAED;;;GAGG;AAEH,wBAAgB,YAAY,CAAC,UAAU,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAO/F"}
|
package/dist/lists/index.js
CHANGED
|
@@ -62,6 +62,7 @@ export function createUserList(config) {
|
|
|
62
62
|
* Create the Session list for better-auth
|
|
63
63
|
* Stores active user sessions
|
|
64
64
|
*/
|
|
65
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ListConfig must accept any TypeInfo
|
|
65
66
|
export function createSessionList() {
|
|
66
67
|
return list({
|
|
67
68
|
fields: {
|
|
@@ -117,6 +118,7 @@ export function createSessionList() {
|
|
|
117
118
|
* Create the Account list for better-auth
|
|
118
119
|
* Stores OAuth provider accounts and credentials
|
|
119
120
|
*/
|
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ListConfig must accept any TypeInfo
|
|
120
122
|
export function createAccountList() {
|
|
121
123
|
return list({
|
|
122
124
|
fields: {
|
|
@@ -184,6 +186,7 @@ export function createAccountList() {
|
|
|
184
186
|
* Create the Verification list for better-auth
|
|
185
187
|
* Stores email verification tokens, password reset tokens, etc.
|
|
186
188
|
*/
|
|
189
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ListConfig must accept any TypeInfo
|
|
187
190
|
export function createVerificationList() {
|
|
188
191
|
return list({
|
|
189
192
|
fields: {
|
|
@@ -216,6 +219,7 @@ export function createVerificationList() {
|
|
|
216
219
|
* Get all auth lists required by better-auth
|
|
217
220
|
* This is the main export used by withAuth()
|
|
218
221
|
*/
|
|
222
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ListConfig must accept any TypeInfo
|
|
219
223
|
export function getAuthLists(userConfig) {
|
|
220
224
|
return {
|
|
221
225
|
User: createUserList(userConfig),
|
package/dist/lists/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lists/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lists/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAyBrF;;;GAGG;AACH,MAAM,UAAU,cAAc,CAC5B,MAA6B;IAE7B,OAAO,IAAI,CAAC;QACV,MAAM,EAAE;YACN,8BAA8B;YAC9B,IAAI,EAAE,IAAI,CAAC;gBACT,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;aACjC,CAAC;YACF,KAAK,EAAE,IAAI,CAAC;gBACV,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;gBAChC,SAAS,EAAE,QAAQ;aACpB,CAAC;YACF,aAAa,EAAE,QAAQ,CAAC;gBACtB,YAAY,EAAE,KAAK;aACpB,CAAC;YACF,KAAK,EAAE,IAAI,EAAE;YAEb,qCAAqC;YACrC,QAAQ,EAAE,YAAY,CAAC;gBACrB,GAAG,EAAE,cAAc;gBACnB,IAAI,EAAE,IAAI;aACX,CAAC;YACF,QAAQ,EAAE,YAAY,CAAC;gBACrB,GAAG,EAAE,cAAc;gBACnB,IAAI,EAAE,IAAI;aACX,CAAC;YAEF,iCAAiC;YACjC,GAAG,CAAC,MAAM,EAAE,MAAM,IAAI,EAAE,CAAC;SAC1B;QACD,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI;YACxB,SAAS,EAAE;gBACT,sDAAsD;gBACtD,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI;gBACjB,qCAAqC;gBACrC,MAAM,EAAE,GAA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GAAqG;AACrG,MAAM,UAAU,sBAAsB;IACpC,OAAO,IAAI,CAAC;QACV,MAAM,EAAE;YACN,mCAAmC;YACnC,UAAU,EAAE,IAAI,CAAC;gBACf,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;aACjC,CAAC;YACF,cAAc;YACd,KAAK,EAAE,IAAI,CAAC;gBACV,UAAU,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE;aACjC,CAAC;YACF,uBAAuB;YACvB,SAAS,EAAE,SAAS,EAAE;SACvB;QACD,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,mEAAmE;gBACnE,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;gBAClB,0CAA0C;gBAC1C,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;gBAClB,aAAa;gBACb,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK;gBACnB,0CAA0C;gBAC1C,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;aACnB;SACF;KACF,CAAC,CAAA;AACJ,CAAC;AAED;;;GAGG;AACH,qGAAqG;AACrG,MAAM,UAAU,YAAY,CAAC,UAAiC;IAC5D,OAAO;QACL,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC;QAChC,OAAO,EAAE,iBAAiB,EAAE;QAC5B,OAAO,EAAE,iBAAiB,EAAE;QAC5B,YAAY,EAAE,sBAAsB,EAAE;KACvC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for auth plugin runtime services
|
|
3
|
+
* These types are used for type-safe access to context.plugins.auth
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Runtime services provided by the auth plugin
|
|
7
|
+
* Available via context.plugins.auth
|
|
8
|
+
*/
|
|
9
|
+
export interface AuthRuntimeServices {
|
|
10
|
+
/**
|
|
11
|
+
* Get user by ID
|
|
12
|
+
* Uses the access-controlled context to fetch user data
|
|
13
|
+
*
|
|
14
|
+
* @param userId - The ID of the user to fetch
|
|
15
|
+
* @returns User object or null if not found or access denied
|
|
16
|
+
*/
|
|
17
|
+
getUser: (userId: string) => Promise<unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* Get current user from session
|
|
20
|
+
* Extracts userId from session and fetches user data
|
|
21
|
+
*
|
|
22
|
+
* @returns Current user object or null if not authenticated or not found
|
|
23
|
+
*/
|
|
24
|
+
getCurrentUser: () => Promise<unknown>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;OAMG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAE7C;;;;;OAKG;IACH,cAAc,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAkB,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAezF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CACxB,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,EACxD,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAkB,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAezF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CACxB,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,EACxD,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,iDAmIhD;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,EACnC,aAAa,EAAE,MAAM,EAAE,2CA0BxB;AAED,YAAY,EAAE,iBAAiB,EAAE,CAAA"}
|