@fjell/express-router 4.4.53 → 4.4.55
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/MIGRATION_v3.md +255 -0
- package/README.md +26 -0
- package/dist/CItemRouter.d.ts.map +1 -1
- package/dist/CItemRouter.js +35 -30
- package/dist/CItemRouter.js.map +2 -2
- package/dist/Instance.d.ts +3 -3
- package/dist/Instance.d.ts.map +1 -1
- package/dist/Instance.js.map +2 -2
- package/dist/InstanceFactory.d.ts +1 -1
- package/dist/InstanceFactory.d.ts.map +1 -1
- package/dist/InstanceFactory.js.map +2 -2
- package/dist/ItemRouter.d.ts +11 -1
- package/dist/ItemRouter.d.ts.map +1 -1
- package/dist/ItemRouter.js +143 -158
- package/dist/ItemRouter.js.map +3 -3
- package/dist/PItemRouter.d.ts.map +1 -1
- package/dist/PItemRouter.js +36 -44
- package/dist/PItemRouter.js.map +2 -2
- package/dist/createApp.d.ts +13 -0
- package/dist/createApp.d.ts.map +1 -0
- package/dist/createApp.js +27 -0
- package/dist/createApp.js.map +7 -0
- package/dist/errorHandler.d.ts +52 -0
- package/dist/errorHandler.d.ts.map +1 -0
- package/dist/errorHandler.js +220 -0
- package/dist/errorHandler.js.map +7 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +2 -2
- package/dist/types.d.ts +20 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +5 -5
- package/dist/Operations.d.ts +0 -2
- package/dist/Operations.d.ts.map +0 -1
- package/dist/Operations.js +0 -1
- /package/dist/{Operations.js.map → types.js.map} +0 -0
package/MIGRATION_v3.md
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# Migration Guide: v2.x to v3.0
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Version 3.0 of `@fjell/express-router` adopts the standardized Operations interface from `@fjell/core`. This provides a unified interface across all Fjell packages and enables better type safety and cross-package compatibility.
|
|
6
|
+
|
|
7
|
+
## Breaking Changes
|
|
8
|
+
|
|
9
|
+
### Operations Interface
|
|
10
|
+
|
|
11
|
+
The router now works directly with the `Operations` interface from `@fjell/core`, which is implemented by `@fjell/lib`, `@fjell/cache`, and other Fjell packages.
|
|
12
|
+
|
|
13
|
+
**Good News**: This is a non-breaking change for most users since `@fjell/lib` already implements the core Operations interface.
|
|
14
|
+
|
|
15
|
+
## What You Need to Do
|
|
16
|
+
|
|
17
|
+
### Step 1: Update Dependencies
|
|
18
|
+
|
|
19
|
+
Update to the latest versions of Fjell packages:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @fjell/core@latest @fjell/lib@latest @fjell/express-router@latest
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Step 2: Verify Your Code (Usually No Changes Needed)
|
|
26
|
+
|
|
27
|
+
Your existing code should continue to work without modifications:
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// This continues to work in v3.0
|
|
31
|
+
import { PItemRouter, CItemRouter } from '@fjell/express-router';
|
|
32
|
+
import { createLibrary } from '@fjell/lib';
|
|
33
|
+
import { createRegistry } from '@fjell/registry';
|
|
34
|
+
|
|
35
|
+
const registry = createRegistry();
|
|
36
|
+
const library = createLibrary(
|
|
37
|
+
registry,
|
|
38
|
+
{ keyType: 'user' },
|
|
39
|
+
userOperations,
|
|
40
|
+
userOptions
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const userRouter = new PItemRouter(library, 'user');
|
|
44
|
+
app.use('/api/users', userRouter.getRouter());
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Step 3: Optional - Use Type Imports from Core
|
|
48
|
+
|
|
49
|
+
You can now import types directly from `@fjell/core` if needed:
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { Operations, OperationParams, AffectedKeys } from '@fjell/core';
|
|
53
|
+
import type { Item } from '@fjell/core';
|
|
54
|
+
|
|
55
|
+
// Your Operations implementation
|
|
56
|
+
const myOperations: Operations<Item<'user'>, 'user'> = {
|
|
57
|
+
// ... implementation
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Benefits of v3.0
|
|
62
|
+
|
|
63
|
+
### 1. Unified Interface
|
|
64
|
+
|
|
65
|
+
Works with any package that implements `@fjell/core` Operations:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
import { PItemRouter } from '@fjell/express-router';
|
|
69
|
+
import { createLibrary } from '@fjell/lib';
|
|
70
|
+
import { createCache } from '@fjell/cache';
|
|
71
|
+
|
|
72
|
+
// Works with @fjell/lib
|
|
73
|
+
const library = createLibrary(registry, { keyType: 'user' }, ops, opts);
|
|
74
|
+
const libRouter = new PItemRouter(library, 'user');
|
|
75
|
+
|
|
76
|
+
// Works with @fjell/cache
|
|
77
|
+
const cache = createCache(library);
|
|
78
|
+
const cacheRouter = new PItemRouter(cache as any, 'user');
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2. Better Type Safety
|
|
82
|
+
|
|
83
|
+
Enhanced TypeScript support with explicit method types from core:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import type { GetMethod, CreateMethod } from '@fjell/core';
|
|
87
|
+
|
|
88
|
+
// Core types are available for advanced use cases
|
|
89
|
+
const getHandler: GetMethod<User, 'user'> = async (key) => {
|
|
90
|
+
// Handler implementation
|
|
91
|
+
};
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 3. Consistent API
|
|
95
|
+
|
|
96
|
+
Same routing behavior across all Operations implementations:
|
|
97
|
+
|
|
98
|
+
- `GET /items` → `operations.all()`
|
|
99
|
+
- `GET /items/:id` → `operations.get(key)`
|
|
100
|
+
- `POST /items` → `operations.create(item)`
|
|
101
|
+
- `PUT /items/:id` → `operations.update(key, item)`
|
|
102
|
+
- `DELETE /items/:id` → `operations.remove(key)`
|
|
103
|
+
- `POST /items/:id/action` → `operations.action(key, action, params)`
|
|
104
|
+
- `GET /items/:id/facet` → `operations.facet(key, facet, params)`
|
|
105
|
+
- `POST /items/action` → `operations.allAction(action, params)`
|
|
106
|
+
- `GET /items/facet` → `operations.allFacet(facet, params)`
|
|
107
|
+
|
|
108
|
+
### 4. Cross-Package Compatibility
|
|
109
|
+
|
|
110
|
+
Works seamlessly with all Fjell packages:
|
|
111
|
+
|
|
112
|
+
- `@fjell/lib` - Server-side operations
|
|
113
|
+
- `@fjell/cache` - Caching layer
|
|
114
|
+
- `@fjell/client-api` - HTTP client
|
|
115
|
+
- `@fjell/providers` - React UI components
|
|
116
|
+
|
|
117
|
+
## What Hasn't Changed
|
|
118
|
+
|
|
119
|
+
- Router creation API remains the same
|
|
120
|
+
- Route configuration is identical
|
|
121
|
+
- Router-level handlers work as before
|
|
122
|
+
- Middleware integration unchanged
|
|
123
|
+
- Error handling unchanged
|
|
124
|
+
- All existing options and configurations continue to work
|
|
125
|
+
|
|
126
|
+
## Examples
|
|
127
|
+
|
|
128
|
+
### Basic Router (No Changes Required)
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import express from 'express';
|
|
132
|
+
import { PItemRouter } from '@fjell/express-router';
|
|
133
|
+
import { createLibrary } from '@fjell/lib';
|
|
134
|
+
import { createRegistry } from '@fjell/registry';
|
|
135
|
+
|
|
136
|
+
const app = express();
|
|
137
|
+
const registry = createRegistry();
|
|
138
|
+
|
|
139
|
+
// Create library
|
|
140
|
+
const userLibrary = createLibrary(
|
|
141
|
+
registry,
|
|
142
|
+
{ keyType: 'user' },
|
|
143
|
+
userOperations,
|
|
144
|
+
userOptions
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
// Create router (same as v2.x)
|
|
148
|
+
const userRouter = new PItemRouter(userLibrary, 'user');
|
|
149
|
+
app.use('/api/users', userRouter.getRouter());
|
|
150
|
+
|
|
151
|
+
app.listen(3000);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Nested Routers (No Changes Required)
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
// Parent router
|
|
158
|
+
const organizationRouter = new PItemRouter(orgLibrary, 'organization');
|
|
159
|
+
|
|
160
|
+
// Child router
|
|
161
|
+
const departmentRouter = new CItemRouter(
|
|
162
|
+
deptLibrary,
|
|
163
|
+
'department',
|
|
164
|
+
organizationRouter
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
// Mount routers (same as v2.x)
|
|
168
|
+
app.use('/api/organizations', organizationRouter.getRouter());
|
|
169
|
+
app.use(
|
|
170
|
+
'/api/organizations/:organizationPk/departments',
|
|
171
|
+
departmentRouter.getRouter()
|
|
172
|
+
);
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Router-Level Handlers (No Changes Required)
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
const userRouter = new PItemRouter(userLibrary, 'user', {
|
|
179
|
+
actions: {
|
|
180
|
+
activate: async (ik, params, { req, res }) => {
|
|
181
|
+
// Handler implementation (same as v2.x)
|
|
182
|
+
const user = await userLibrary.operations.get(ik);
|
|
183
|
+
await activateUser(user);
|
|
184
|
+
res.json({ success: true });
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
facets: {
|
|
188
|
+
profile: async (ik, params, { req, res }) => {
|
|
189
|
+
// Handler implementation (same as v2.x)
|
|
190
|
+
const user = await userLibrary.operations.get(ik);
|
|
191
|
+
const profile = await getProfile(user);
|
|
192
|
+
res.json(profile);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Troubleshooting
|
|
199
|
+
|
|
200
|
+
### Type Errors
|
|
201
|
+
|
|
202
|
+
If you encounter type errors after upgrading:
|
|
203
|
+
|
|
204
|
+
1. Ensure all Fjell packages are updated to their latest versions
|
|
205
|
+
2. Check that `@fjell/core` is installed
|
|
206
|
+
3. Clear your TypeScript cache: `rm -rf node_modules/.cache`
|
|
207
|
+
4. Rebuild: `npm run build`
|
|
208
|
+
|
|
209
|
+
### Import Errors
|
|
210
|
+
|
|
211
|
+
If you have import errors:
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
// If this fails:
|
|
215
|
+
import type { Operations } from '@fjell/express-router';
|
|
216
|
+
|
|
217
|
+
// Use this instead:
|
|
218
|
+
import type { Operations } from '@fjell/core';
|
|
219
|
+
// or
|
|
220
|
+
import type { Operations } from '@fjell/lib';
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Runtime Errors
|
|
224
|
+
|
|
225
|
+
If your Operations object doesn't work with the router:
|
|
226
|
+
|
|
227
|
+
1. Verify it implements all required methods from `@fjell/core` Operations
|
|
228
|
+
2. Check that method signatures match the core interface
|
|
229
|
+
3. Ensure return types are correct (e.g., `action` and `allAction` return `[result, affectedKeys]`)
|
|
230
|
+
|
|
231
|
+
## Migration Checklist
|
|
232
|
+
|
|
233
|
+
- [ ] Update `@fjell/core` to latest version
|
|
234
|
+
- [ ] Update `@fjell/lib` to latest version
|
|
235
|
+
- [ ] Update `@fjell/express-router` to v3.0+
|
|
236
|
+
- [ ] Update other Fjell packages to latest versions
|
|
237
|
+
- [ ] Run `npm install`
|
|
238
|
+
- [ ] Run tests: `npm test`
|
|
239
|
+
- [ ] Run build: `npm run build`
|
|
240
|
+
- [ ] Verify application starts correctly
|
|
241
|
+
- [ ] Test API endpoints work as expected
|
|
242
|
+
|
|
243
|
+
## Need Help?
|
|
244
|
+
|
|
245
|
+
- **Documentation**: [README.md](./README.md)
|
|
246
|
+
- **Examples**: [examples/](./examples/)
|
|
247
|
+
- **Issues**: [GitHub Issues](https://github.com/getfjell/express-router/issues)
|
|
248
|
+
- **Discussions**: [GitHub Discussions](https://github.com/getfjell/express-router/discussions)
|
|
249
|
+
|
|
250
|
+
## Summary
|
|
251
|
+
|
|
252
|
+
Version 3.0 is a **seamless upgrade** for most users. The router now uses the standardized Operations interface from `@fjell/core`, providing better type safety and cross-package compatibility, but your existing code should continue to work without modifications.
|
|
253
|
+
|
|
254
|
+
Simply update your dependencies and you're ready to go! 🎉
|
|
255
|
+
|
package/README.md
CHANGED
|
@@ -4,6 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
Fjell Express Router provides a powerful abstraction layer for creating Express.js REST APIs that automatically handle CRUD operations for complex, hierarchical data models. Built on the Fjell framework, it enables rapid development of enterprise-grade APIs with built-in support for nested resources, business logic integration, and type-safe operations.
|
|
6
6
|
|
|
7
|
+
## 🎉 Version 3.0 - Core Operations Integration
|
|
8
|
+
|
|
9
|
+
**Version 3.0** introduces seamless integration with `@fjell/core` Operations interface, providing:
|
|
10
|
+
|
|
11
|
+
- **Unified Interface**: Works directly with the standardized Operations interface from `@fjell/core`
|
|
12
|
+
- **Better Type Safety**: Enhanced TypeScript support with explicit method types
|
|
13
|
+
- **Cross-Package Compatibility**: Compatible with all Fjell packages (@fjell/lib, @fjell/cache, @fjell/client-api)
|
|
14
|
+
- **Automatic REST API**: Generate complete REST endpoints from any Operations implementation
|
|
15
|
+
- **Consistent Routing**: Same routing behavior across all Operations sources
|
|
16
|
+
|
|
17
|
+
### What Changed in v3.0
|
|
18
|
+
|
|
19
|
+
The router now works with any Operations implementation from the Fjell ecosystem:
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { createOperationsRouter } from '@fjell/express-router';
|
|
23
|
+
import { createLibrary } from '@fjell/lib';
|
|
24
|
+
|
|
25
|
+
// Works with @fjell/lib Operations
|
|
26
|
+
const library = createLibrary(registry, { keyType: 'user' }, userOperations, userOptions);
|
|
27
|
+
const router = new PItemRouter(library, 'user');
|
|
28
|
+
app.use('/api/users', router.getRouter());
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Migration is seamless** - existing code continues to work without changes. See [MIGRATION_v3.md](./MIGRATION_v3.md) for details.
|
|
32
|
+
|
|
7
33
|
## Features
|
|
8
34
|
|
|
9
35
|
- **Automatic CRUD Routes**: Generate complete REST endpoints with minimal configuration
|
|
@@ -1 +1 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AE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,EAClD,OAAO,GAAE,iBAAiB,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAM;IAKjD,SAAS,IAAI,OAAO;IAIpB,KAAK,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;IAMnD,MAAM,CAAC,GAAG,EAAE,QAAQ,GAAG,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;IAWrD,YAAY,CAAC,GAAG,EAAE,QAAQ,GAAG,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;IAI5D,UAAU,GAAU,KAAK,OAAO,EAAE,KAAK,QAAQ,mBAyBpD;IAEF,SAAS,CAAC,SAAS,GAAU,KAAK,OAAO,EAAE,KAAK,QAAQ,mBAmDtD;CAEH"}
|
package/dist/CItemRouter.js
CHANGED
|
@@ -36,17 +36,12 @@ class CItemRouter extends ItemRouter {
|
|
|
36
36
|
item = await this.postCreateItem(item);
|
|
37
37
|
this.logger.default("Created Item %j", item);
|
|
38
38
|
res.status(201).json(item);
|
|
39
|
-
} catch (
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
res.status(
|
|
43
|
-
message: "Item Not Found"
|
|
44
|
-
});
|
|
39
|
+
} catch (error) {
|
|
40
|
+
this.logger.error("Error in createItem", { error });
|
|
41
|
+
if (error.name === "CreateValidationError" || error.name === "ValidationError" || error.name === "SequelizeValidationError" || error.message && (error.message.includes("validation") || error.message.includes("required") || error.message.includes("cannot be null") || error.message.includes("notNull Violation"))) {
|
|
42
|
+
res.status(400).json({ message: "Validation Error" });
|
|
45
43
|
} else {
|
|
46
|
-
|
|
47
|
-
res.status(500).json({
|
|
48
|
-
message: "General Error"
|
|
49
|
-
});
|
|
44
|
+
res.status(500).json({ message: "General Error" });
|
|
50
45
|
}
|
|
51
46
|
}
|
|
52
47
|
};
|
|
@@ -56,34 +51,44 @@ class CItemRouter extends ItemRouter {
|
|
|
56
51
|
const finder = query["finder"];
|
|
57
52
|
const finderParams = query["finderParams"];
|
|
58
53
|
const one = query["one"];
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
54
|
+
try {
|
|
55
|
+
let items = [];
|
|
56
|
+
if (finder) {
|
|
57
|
+
this.logger.default("Finding Items with Finder", { finder, finderParams, one });
|
|
58
|
+
let parsedParams;
|
|
59
|
+
try {
|
|
60
|
+
parsedParams = finderParams ? JSON.parse(finderParams) : {};
|
|
61
|
+
} catch (parseError) {
|
|
62
|
+
res.status(400).json({
|
|
63
|
+
error: "Invalid JSON in finderParams",
|
|
64
|
+
message: parseError.message
|
|
65
|
+
});
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
64
68
|
if (one === "true") {
|
|
65
69
|
const item = await this.lib.findOne(finder, parsedParams, this.getLocations(res));
|
|
66
70
|
items = item ? [item] : [];
|
|
67
71
|
} else {
|
|
68
72
|
items = await libOperations.find(finder, parsedParams, this.getLocations(res));
|
|
69
73
|
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
} else {
|
|
75
|
+
const itemQuery = paramsToQuery(req.query);
|
|
76
|
+
const locations = this.getLocations(res);
|
|
77
|
+
this.logger.debug("Finding Items with Query: %j", itemQuery);
|
|
78
|
+
this.logger.debug("Location keys being passed: %j", locations);
|
|
79
|
+
items = await libOperations.all(itemQuery, locations);
|
|
80
|
+
this.logger.debug("Found %d Items with Query", items.length);
|
|
81
|
+
}
|
|
82
|
+
const validatedItems = items.map((item) => validatePK(item, this.getPkType()));
|
|
83
|
+
res.json(validatedItems);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
this.logger.error("Error in findItems", { error });
|
|
86
|
+
if (error instanceof NotFoundError || error?.name === "NotFoundError") {
|
|
87
|
+
res.status(404).json({ error: error.message || "Parent item not found" });
|
|
88
|
+
} else {
|
|
89
|
+
res.status(500).json({ error: error.message || "Internal server error" });
|
|
77
90
|
}
|
|
78
|
-
} else {
|
|
79
|
-
const itemQuery = paramsToQuery(req.query);
|
|
80
|
-
const locations = this.getLocations(res);
|
|
81
|
-
this.logger.debug("Finding Items with Query: %j", itemQuery);
|
|
82
|
-
this.logger.debug("Location keys being passed: %j", locations);
|
|
83
|
-
items = await libOperations.all(itemQuery, locations);
|
|
84
|
-
this.logger.debug("Found %d Items with Query", items.length);
|
|
85
91
|
}
|
|
86
|
-
res.json(items.map((item) => validatePK(item, this.getPkType())));
|
|
87
92
|
};
|
|
88
93
|
}
|
|
89
94
|
export {
|
package/dist/CItemRouter.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/CItemRouter.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n ComKey, Item, ItemQuery, LocKey, LocKeyArray, paramsToQuery, PriKey, QueryParams, validatePK\n} from \"@fjell/core\";\nimport { Library, NotFoundError } from \"@fjell/lib\";\nimport { Request, Response } from \"express\";\nimport { ItemRouter, ItemRouterOptions } from \"./ItemRouter.js\";\n\ninterface ParsedQuery {\n [key: string]: undefined | string | string[] | ParsedQuery | ParsedQuery[];\n}\n\nexport class CItemRouter<\n T extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> extends ItemRouter<S, L1, L2, L3, L4, L5> {\n\n constructor(\n lib: Library<T, S, L1, L2, L3, L4, L5>,\n type: S,\n parentRoute: ItemRouter<L1, L2, L3, L4, L5, never>,\n options: ItemRouterOptions<S, L1, L2, L3, L4, L5> = {},\n ) {\n super(lib as any, type, options, parentRoute);\n }\n\n public hasParent(): boolean {\n return !!this.parentRoute;\n }\n\n public getIk(res: Response): ComKey<S, L1, L2, L3, L4, L5> {\n const pri = this.getPk(res) as PriKey<S>;\n const loc = this.getLocations(res) as LocKeyArray<L1, L2, L3, L4, L5>;\n return { kt: pri.kt, pk: pri.pk, loc }\n }\n\n public getLKA(res: Response): LocKeyArray<S, L1, L2, L3, L4> {\n /**\n * A location key array is passed to a child router to provide contextfor the items it will\n * be working with. It is always a concatenation of \"My LKA\" + \"Parent LKA\" which will\n * bubble all the way up to the root Primary.\n */\n let lka: LocKey<S | L1 | L2 | L3 | L4>[] = [this.getLk(res)];\n lka = lka.concat(this.parentRoute!.getLKA(res) as LocKey<S | L1 | L2 | L3 | L4>[]);\n return lka as LocKeyArray<S, L1, L2, L3, L4>;\n }\n\n public getLocations(res: Response): LocKeyArray<L1, L2, L3, L4, L5> {\n return this.parentRoute!.getLKA(res) as LocKeyArray<L1, L2, L3, L4, L5>;\n }\n\n public createItem = async (req: Request, res: Response) => {\n const libOperations = this.lib.operations;\n this.logger.default('Creating Item', { body: req?.body, query: req?.query, params: req?.params, locals: res?.locals });\n try {\n const itemToCreate = this.convertDates(req.body as Item<S, L1, L2, L3, L4, L5>);\n let item = validatePK(await libOperations.create(\n itemToCreate, { locations: this.getLocations(res) }), this.getPkType()) as Item<S, L1, L2, L3, L4, L5>;\n item = await this.postCreateItem(item);\n this.logger.default('Created Item %j', item);\n res.status(201).json(item);\n } catch (
|
|
5
|
-
"mappings": "AAAA;AAAA,EACgD;AAAA,EAAoC;AAAA,OAC7E;AACP,SAAkB,qBAAqB;AAEvC,SAAS,kBAAqC;AAMvC,MAAM,oBAQH,WAAkC;AAAA,EAE1C,YACE,KACA,MACA,aACA,UAAoD,CAAC,GACrD;AACA,UAAM,KAAY,MAAM,SAAS,WAAW;AAAA,EAC9C;AAAA,EAEO,YAAqB;AAC1B,WAAO,CAAC,CAAC,KAAK;AAAA,EAChB;AAAA,EAEO,MAAM,KAA8C;AACzD,UAAM,MAAM,KAAK,MAAM,GAAG;AAC1B,UAAM,MAAM,KAAK,aAAa,GAAG;AACjC,WAAO,EAAE,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI;AAAA,EACvC;AAAA,EAEO,OAAO,KAA+C;AAM3D,QAAI,MAAuC,CAAC,KAAK,MAAM,GAAG,CAAC;AAC3D,UAAM,IAAI,OAAO,KAAK,YAAa,OAAO,GAAG,CAAoC;AACjF,WAAO;AAAA,EACT;AAAA,EAEO,aAAa,KAAgD;AAClE,WAAO,KAAK,YAAa,OAAO,GAAG;AAAA,EACrC;AAAA,EAEO,aAAa,OAAO,KAAc,QAAkB;AACzD,UAAM,gBAAgB,KAAK,IAAI;AAC/B,SAAK,OAAO,QAAQ,iBAAiB,EAAE,MAAM,KAAK,MAAM,OAAO,KAAK,OAAO,QAAQ,KAAK,QAAQ,QAAQ,KAAK,OAAO,CAAC;
|
|
4
|
+
"sourcesContent": ["import {\n ComKey, Item, ItemQuery, LocKey, LocKeyArray, paramsToQuery, PriKey, QueryParams, validatePK\n} from \"@fjell/core\";\nimport { Library, NotFoundError } from \"@fjell/lib\";\nimport { Request, Response } from \"express\";\nimport { ItemRouter, ItemRouterOptions } from \"./ItemRouter.js\";\n\ninterface ParsedQuery {\n [key: string]: undefined | string | string[] | ParsedQuery | ParsedQuery[];\n}\n\nexport class CItemRouter<\n T extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> extends ItemRouter<S, L1, L2, L3, L4, L5> {\n\n constructor(\n lib: Library<T, S, L1, L2, L3, L4, L5>,\n type: S,\n parentRoute: ItemRouter<L1, L2, L3, L4, L5, never>,\n options: ItemRouterOptions<S, L1, L2, L3, L4, L5> = {},\n ) {\n super(lib as any, type, options, parentRoute);\n }\n\n public hasParent(): boolean {\n return !!this.parentRoute;\n }\n\n public getIk(res: Response): ComKey<S, L1, L2, L3, L4, L5> {\n const pri = this.getPk(res) as PriKey<S>;\n const loc = this.getLocations(res) as LocKeyArray<L1, L2, L3, L4, L5>;\n return { kt: pri.kt, pk: pri.pk, loc }\n }\n\n public getLKA(res: Response): LocKeyArray<S, L1, L2, L3, L4> {\n /**\n * A location key array is passed to a child router to provide contextfor the items it will\n * be working with. It is always a concatenation of \"My LKA\" + \"Parent LKA\" which will\n * bubble all the way up to the root Primary.\n */\n let lka: LocKey<S | L1 | L2 | L3 | L4>[] = [this.getLk(res)];\n lka = lka.concat(this.parentRoute!.getLKA(res) as LocKey<S | L1 | L2 | L3 | L4>[]);\n return lka as LocKeyArray<S, L1, L2, L3, L4>;\n }\n\n public getLocations(res: Response): LocKeyArray<L1, L2, L3, L4, L5> {\n return this.parentRoute!.getLKA(res) as LocKeyArray<L1, L2, L3, L4, L5>;\n }\n\n public createItem = async (req: Request, res: Response) => {\n const libOperations = this.lib.operations;\n this.logger.default('Creating Item', { body: req?.body, query: req?.query, params: req?.params, locals: res?.locals });\n \n try {\n const itemToCreate = this.convertDates(req.body as Item<S, L1, L2, L3, L4, L5>);\n let item = validatePK(await libOperations.create(\n itemToCreate, { locations: this.getLocations(res) }), this.getPkType()) as Item<S, L1, L2, L3, L4, L5>;\n item = await this.postCreateItem(item);\n this.logger.default('Created Item %j', item);\n res.status(201).json(item);\n } catch (error: any) {\n this.logger.error('Error in createItem', { error });\n // Check for validation errors\n if (error.name === 'CreateValidationError' || error.name === 'ValidationError' ||\n error.name === 'SequelizeValidationError' ||\n (error.message && (error.message.includes('validation') ||\n error.message.includes('required') ||\n error.message.includes('cannot be null') ||\n error.message.includes('notNull Violation')))) {\n res.status(400).json({ message: \"Validation Error\" });\n } else {\n res.status(500).json({ message: \"General Error\" });\n }\n }\n };\n\n protected findItems = async (req: Request, res: Response) => {\n const libOperations = this.lib.operations;\n const query: ParsedQuery = req.query as unknown as ParsedQuery;\n const finder = query['finder'] as string;\n const finderParams = query['finderParams'] as string;\n const one = query['one'] as string;\n\n try {\n let items: Item<S, L1, L2, L3, L4, L5>[] = [];\n\n if (finder) {\n // If finder is defined? Call a finder.\n this.logger.default('Finding Items with Finder', { finder, finderParams, one });\n\n let parsedParams: any;\n try {\n parsedParams = finderParams ? JSON.parse(finderParams) : {};\n } catch (parseError: any) {\n res.status(400).json({\n error: 'Invalid JSON in finderParams',\n message: parseError.message\n });\n return;\n }\n\n if (one === 'true') {\n const item = await (this.lib as any).findOne(finder, parsedParams, this.getLocations(res));\n items = item ? [item] : [];\n } else {\n items = await libOperations.find(finder, parsedParams, this.getLocations(res));\n }\n } else {\n // TODO: This is once of the more important places to perform some validaation and feedback\n const itemQuery: ItemQuery = paramsToQuery(req.query as QueryParams);\n const locations = this.getLocations(res);\n this.logger.debug('Finding Items with Query: %j', itemQuery);\n this.logger.debug('Location keys being passed: %j', locations);\n items = await libOperations.all(itemQuery, locations);\n this.logger.debug('Found %d Items with Query', items.length);\n }\n\n const validatedItems = items.map((item: Item<S, L1, L2, L3, L4, L5>) => validatePK(item, this.getPkType()));\n res.json(validatedItems);\n } catch (error: any) {\n this.logger.error('Error in findItems', { error });\n if (error instanceof NotFoundError || error?.name === 'NotFoundError') {\n res.status(404).json({ error: error.message || 'Parent item not found' });\n } else {\n res.status(500).json({ error: error.message || 'Internal server error' });\n }\n }\n };\n\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACgD;AAAA,EAAoC;AAAA,OAC7E;AACP,SAAkB,qBAAqB;AAEvC,SAAS,kBAAqC;AAMvC,MAAM,oBAQH,WAAkC;AAAA,EAE1C,YACE,KACA,MACA,aACA,UAAoD,CAAC,GACrD;AACA,UAAM,KAAY,MAAM,SAAS,WAAW;AAAA,EAC9C;AAAA,EAEO,YAAqB;AAC1B,WAAO,CAAC,CAAC,KAAK;AAAA,EAChB;AAAA,EAEO,MAAM,KAA8C;AACzD,UAAM,MAAM,KAAK,MAAM,GAAG;AAC1B,UAAM,MAAM,KAAK,aAAa,GAAG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,MAAM,sBAAsB,EAAE,MAAM,CAAC;AACjD,UAAI,iBAAiB,iBAAiB,OAAO,SAAS,iBAAiB;AACrE,YAAI,OAAO,GAAG,EAAE,KAAK,EAAE,OAAO,MAAM,WAAW,wBAAwB,CAAC;AAAA,MAC1E,OAAO;AACL,YAAI,OAAO,GAAG,EAAE,KAAK,EAAE,OAAO,MAAM,WAAW,wBAAwB,CAAC;AAAA,MAC1E;AAAA,IACF;AAAA,EACF;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/Instance.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Item } from "@fjell/core";
|
|
2
|
-
import { Instance as BaseInstance,
|
|
3
|
-
import type { Operations } from "
|
|
1
|
+
import { Coordinate, Item } from "@fjell/core";
|
|
2
|
+
import { Instance as BaseInstance, Registry } from "@fjell/registry";
|
|
3
|
+
import type { Operations } from "@fjell/lib";
|
|
4
4
|
import { Options } from "@fjell/lib";
|
|
5
5
|
import { ItemRouter } from "./ItemRouter.js";
|
|
6
6
|
/**
|
package/dist/Instance.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Instance.d.ts","sourceRoot":"","sources":["../src/Instance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Instance.d.ts","sourceRoot":"","sources":["../src/Instance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAwC,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3G,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAI7C;;;;;;;;;;;;GAYG;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UAAU,QAAQ,EAClB,YAAY,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAC7C,QAAQ,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EACzC,YAAY,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAChD,UAAU,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,KAC1C,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAIrC,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,UAAU,GAAG,KAAG,QAAQ,IAAI,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAQhG,CAAA"}
|
package/dist/Instance.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/Instance.ts"],
|
|
4
|
-
"sourcesContent": ["import LibLogger from \"./logger.js\";\nimport { Item } from \"@fjell/core\";\nimport { Instance as BaseInstance,
|
|
5
|
-
"mappings": "AAAA,OAAO,eAAe;AAEtB,
|
|
4
|
+
"sourcesContent": ["import LibLogger from \"./logger.js\";\nimport { Coordinate, Item } from \"@fjell/core\";\nimport { Instance as BaseInstance, createInstance as createBaseInstance, Registry } from \"@fjell/registry\";\nimport type { Operations } from \"@fjell/lib\";\nimport { Options } from \"@fjell/lib\";\nimport { ItemRouter } from \"./ItemRouter.js\";\n\nconst logger = LibLogger.get(\"Instance\");\n\n/**\n * The Express Router Instance interface represents a router model instance that extends the base Instance\n * from @fjell/registry and adds express router operations for handling HTTP requests.\n *\n * The interface extends the base Instance (which provides coordinate and registry) with:\n * - router: Provides methods for routing HTTP requests and handling CRUD operations\n * - operations: Provides methods for interacting with the data model (get, find, all, etc.)\n * - options: Provides hooks, validators, finders, actions, and facets\n *\n * @template V - The type of the data model item, extending Item\n * @template S - The string literal type representing the model's key type\n * @template L1-L5 - Optional string literal types for location hierarchy levels\n */\nexport interface Instance<\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> extends BaseInstance<S, L1, L2, L3, L4, L5> {\n /** The router object that provides methods for handling HTTP requests */\n router: ItemRouter<S, L1, L2, L3, L4, L5>;\n /** The operations object that provides methods for interacting with the data model */\n operations: Operations<V, S, L1, L2, L3, L4, L5>;\n /** The options object that provides hooks, validators, finders, actions, and facets */\n options: Options<V, S, L1, L2, L3, L4, L5>;\n /** The data model item type (for type safety) */\n readonly itemType?: V;\n}\n\nexport const createInstance = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n registry: Registry,\n coordinate: Coordinate<S, L1, L2, L3, L4, L5>,\n router: ItemRouter<S, L1, L2, L3, L4, L5>,\n operations: Operations<V, S, L1, L2, L3, L4, L5>,\n options?: Options<V, S, L1, L2, L3, L4, L5>,\n ): Instance<V, S, L1, L2, L3, L4, L5> => {\n logger.debug(\"createInstance\", { coordinate, router, registry, operations, options });\n const baseInstance = createBaseInstance(registry, coordinate);\n return { ...baseInstance, router, operations, options: options || {} as Options<V, S, L1, L2, L3, L4, L5> };\n}\n\nexport const isInstance = (instance: any): instance is Instance<any, any, any, any, any, any, any> => {\n return instance != null &&\n typeof instance === 'object' &&\n instance.coordinate != null &&\n instance.router != null &&\n instance.registry != null &&\n instance.operations != null &&\n instance.options != null;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,eAAe;AAEtB,SAAmC,kBAAkB,0BAAoC;AAKzF,MAAM,SAAS,UAAU,IAAI,UAAU;AAkChC,MAAM,iBAAiB,CAS1B,UACA,YACA,QACA,YACA,YACuC;AACzC,SAAO,MAAM,kBAAkB,EAAE,YAAY,QAAQ,UAAU,YAAY,QAAQ,CAAC;AACpF,QAAM,eAAe,mBAAmB,UAAU,UAAU;AAC5D,SAAO,EAAE,GAAG,cAAc,QAAQ,YAAY,SAAS,WAAW,CAAC,EAAuC;AAC5G;AAEO,MAAM,aAAa,CAAC,aAA2E;AACpG,SAAO,YAAY,QACjB,OAAO,aAAa,YACpB,SAAS,cAAc,QACvB,SAAS,UAAU,QACnB,SAAS,YAAY,QACrB,SAAS,cAAc,QACvB,SAAS,WAAW;AACxB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Item } from "@fjell/core";
|
|
2
2
|
import { ItemRouter } from "./ItemRouter.js";
|
|
3
3
|
import { InstanceFactory as BaseInstanceFactory } from "@fjell/registry";
|
|
4
|
-
import type { Operations } from "
|
|
4
|
+
import type { Operations } from "@fjell/lib";
|
|
5
5
|
import { Options } from "@fjell/lib";
|
|
6
6
|
export type InstanceFactory<V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> = (router: ItemRouter<S, L1, L2, L3, L4, L5>, operations: Operations<V, S, L1, L2, L3, L4, L5>, options?: Options<V, S, L1, L2, L3, L4, L5>) => BaseInstanceFactory<S, L1, L2, L3, L4, L5> & {
|
|
7
7
|
readonly _itemType?: V;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstanceFactory.d.ts","sourceRoot":"","sources":["../src/InstanceFactory.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"InstanceFactory.d.ts","sourceRoot":"","sources":["../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E,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EACrC,CAAC,SAAS,MAAM,EAChB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EAEvB,QAAQ,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EACzC,YAAY,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAChD,UAAU,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,KAC1C,mBAAmB,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAM7C,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/InstanceFactory.ts"],
|
|
4
|
-
"sourcesContent": ["import { Item } from \"@fjell/core\";\nimport { ItemRouter } from \"./ItemRouter.js\";\nimport { InstanceFactory as BaseInstanceFactory, Registry, RegistryHub } from \"@fjell/registry\";\nimport type { Operations } from \"
|
|
5
|
-
"mappings": "AAKA,SAAS,sBAAgC;
|
|
4
|
+
"sourcesContent": ["import { Coordinate, Item } from \"@fjell/core\";\nimport { ItemRouter } from \"./ItemRouter.js\";\nimport { InstanceFactory as BaseInstanceFactory, Registry, RegistryHub } from \"@fjell/registry\";\nimport type { Operations } from \"@fjell/lib\";\nimport { Options } from \"@fjell/lib\";\nimport { createInstance, Instance } from \"./Instance.js\";\nimport LibLogger from \"./logger.js\";\n\nconst logger = LibLogger.get(\"InstanceFactory\");\n\nexport type InstanceFactory<\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n> = (\n router: ItemRouter<S, L1, L2, L3, L4, L5>,\n operations: Operations<V, S, L1, L2, L3, L4, L5>,\n options?: Options<V, S, L1, L2, L3, L4, L5>\n) => BaseInstanceFactory<S, L1, L2, L3, L4, L5> & { readonly _itemType?: V };\n\n/**\n * Factory function for creating express-router instances\n */\nexport const createInstanceFactory = <\n V extends Item<S, L1, L2, L3, L4, L5>,\n S extends string,\n L1 extends string = never,\n L2 extends string = never,\n L3 extends string = never,\n L4 extends string = never,\n L5 extends string = never\n>(\n router: ItemRouter<S, L1, L2, L3, L4, L5>,\n operations: Operations<V, S, L1, L2, L3, L4, L5>,\n options?: Options<V, S, L1, L2, L3, L4, L5>\n ): BaseInstanceFactory<S, L1, L2, L3, L4, L5> => {\n return (coordinate: Coordinate<S, L1, L2, L3, L4, L5>, context: { registry: Registry, registryHub?: RegistryHub }) => {\n logger.debug(\"Creating express-router instance\", { coordinate, registry: context.registry, router, operations, options });\n\n return createInstance(context.registry, coordinate, router, operations, options) as Instance<V, S, L1, L2, L3, L4, L5>;\n };\n};\n"],
|
|
5
|
+
"mappings": "AAKA,SAAS,sBAAgC;AACzC,OAAO,eAAe;AAEtB,MAAM,SAAS,UAAU,IAAI,iBAAiB;AAmBvC,MAAM,wBAAwB,CASjC,QACA,YACA,YAC+C;AACjD,SAAO,CAAC,YAA+C,YAA+D;AACpH,WAAO,MAAM,oCAAoC,EAAE,YAAY,UAAU,QAAQ,UAAU,QAAQ,YAAY,QAAQ,CAAC;AAExH,WAAO,eAAe,QAAQ,UAAU,YAAY,QAAQ,YAAY,OAAO;AAAA,EACjF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/ItemRouter.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComKey, Item, LocKey, LocKeyArray, PriKey } from "@fjell/core";
|
|
2
2
|
import { Instance } from "./Instance.js";
|
|
3
|
-
import { Request, Response, Router } from "express";
|
|
3
|
+
import { NextFunction, Request, Response, Router } from "express";
|
|
4
|
+
import { ErrorHandlerOptions } from "./errorHandler.js";
|
|
4
5
|
/**
|
|
5
6
|
* Router-level action method signature - aligned with library ActionMethod pattern
|
|
6
7
|
* Takes the resolved item key, action parameters, and HTTP context
|
|
@@ -62,6 +63,10 @@ export type ItemRouterOptions<S extends string = string, L1 extends string = nev
|
|
|
62
63
|
* The key in the Record is the facet name, method receives parameters and optional locations
|
|
63
64
|
*/
|
|
64
65
|
allFacets?: Record<string, RouterAllFacetMethod<L1, L2, L3, L4, L5>>;
|
|
66
|
+
/**
|
|
67
|
+
* Error handler configuration
|
|
68
|
+
*/
|
|
69
|
+
errorHandler?: ErrorHandlerOptions;
|
|
65
70
|
};
|
|
66
71
|
export declare class ItemRouter<S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> {
|
|
67
72
|
protected lib: Instance<Item<S, L1, L2, L3, L4, L5>, S, L1, L2, L3, L4, L5>;
|
|
@@ -70,7 +75,12 @@ export declare class ItemRouter<S extends string, L1 extends string = never, L2
|
|
|
70
75
|
private childRouters;
|
|
71
76
|
protected logger: import("@fjell/logging").Logger;
|
|
72
77
|
protected parentRoute?: ItemRouter<L1, L2, L3, L4, L5, never>;
|
|
78
|
+
protected errorHandler: (err: any, req: Request, res: Response, next: NextFunction) => void;
|
|
73
79
|
constructor(lib: Instance<Item<S, L1, L2, L3, L4, L5>, S, L1, L2, L3, L4, L5>, keyType: S, options?: ItemRouterOptions<S, L1, L2, L3, L4, L5>, parentRoute?: ItemRouter<L1, L2, L3, L4, L5, never>);
|
|
80
|
+
/**
|
|
81
|
+
* Wrap async route handlers to catch errors and pass to error handler
|
|
82
|
+
*/
|
|
83
|
+
protected wrapAsync(fn: (req: Request, res: Response, next: NextFunction) => Promise<any>): (req: Request, res: Response, next: NextFunction) => void;
|
|
74
84
|
getPkType: () => S;
|
|
75
85
|
protected getPkParam: () => string;
|
|
76
86
|
protected getLk(res: Response): LocKey<S>;
|
package/dist/ItemRouter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemRouter.d.ts","sourceRoot":"","sources":["../src/ItemRouter.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ItemRouter.d.ts","sourceRoot":"","sources":["../src/ItemRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,MAAM,EAEN,IAAI,EAEJ,MAAM,EACN,WAAW,EACX,MAAM,EAEP,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAElE,OAAO,EAAsB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE5E;;;GAGG;AACH,MAAM,WAAW,kBAAkB,CACjC,CAAC,SAAS,MAAM,EAChB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK,EACzB,EAAE,SAAS,MAAM,GAAG,KAAK;IAEzB,CACE,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAC7C,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC,EACxG,OAAO,EAAE;QAAE,GAAG,EAAE,OAAO,CAAC;QAAC,GAAG,EA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