@fjell/express-router 4.4.0 → 4.4.2

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/dist/index.cjs ADDED
@@ -0,0 +1,507 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const core = require('@fjell/core');
6
+ const lib = require('@fjell/lib');
7
+ const deepmerge = require('deepmerge');
8
+ const express = require('express');
9
+ const Logging = require('@fjell/logging');
10
+
11
+ const LibLogger = Logging.getLogger('@fjell/express-router');
12
+
13
+ function _define_property$2(obj, key, value) {
14
+ if (key in obj) {
15
+ Object.defineProperty(obj, key, {
16
+ value: value,
17
+ enumerable: true,
18
+ configurable: true,
19
+ writable: true
20
+ });
21
+ } else {
22
+ obj[key] = value;
23
+ }
24
+ return obj;
25
+ }
26
+ class ItemRouter {
27
+ getLk(res) {
28
+ return {
29
+ kt: this.keyType,
30
+ lk: res.locals[this.getPkParam()]
31
+ };
32
+ }
33
+ // this is meant to be consumed by children routers
34
+ getLKA(res) {
35
+ return [
36
+ this.getLk(res)
37
+ ];
38
+ }
39
+ getPk(res) {
40
+ return core.cPK(res.locals[this.getPkParam()], this.getPkType());
41
+ }
42
+ // Unless this is a contained router, the locations will always be an empty array.
43
+ /* eslint-disable */ getLocations(res) {
44
+ throw new Error('Method not implemented in an abstract router');
45
+ }
46
+ /* eslint-enable */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
47
+ getIk(res) {
48
+ throw new Error('Method not implemented in an abstract router');
49
+ }
50
+ /* istanbul ignore next */ configureItemActions() {
51
+ this.logger.debug('ARouter - No Item Actions Configured');
52
+ return {};
53
+ }
54
+ /* istanbul ignore next */ configureItemFacets() {
55
+ this.logger.debug('ARouter - No Item Facets Configured');
56
+ return {};
57
+ }
58
+ /* istanbul ignore next */ configureAllActions() {
59
+ this.logger.debug('ARouter - No All Actions Configured');
60
+ return {};
61
+ }
62
+ /* istanbul ignore next */ getRouter() {
63
+ const router = express.Router();
64
+ this.configure(router);
65
+ return router;
66
+ }
67
+ constructor(lib$1, keyType, options = {}){
68
+ _define_property$2(this, "lib", void 0);
69
+ _define_property$2(this, "keyType", void 0);
70
+ _define_property$2(this, "options", void 0);
71
+ _define_property$2(this, "childRouters", {});
72
+ _define_property$2(this, "logger", void 0);
73
+ _define_property$2(this, "itemActions", void 0);
74
+ _define_property$2(this, "itemFacets", void 0);
75
+ _define_property$2(this, "getPkType", ()=>{
76
+ return this.keyType;
77
+ });
78
+ _define_property$2(this, "getPkParam", ()=>{
79
+ return `${this.getPkType()}Pk`;
80
+ });
81
+ _define_property$2(this, "postItemAction", async (req, res)=>{
82
+ this.logger.default('Getting Item', {
83
+ query: req === null || req === void 0 ? void 0 : req.query,
84
+ params: req === null || req === void 0 ? void 0 : req.params,
85
+ locals: res === null || res === void 0 ? void 0 : res.locals
86
+ });
87
+ const ik = this.getIk(res);
88
+ const actionKey = req.path.substring(req.path.lastIndexOf('/') + 1);
89
+ if (!this.itemActions) {
90
+ this.logger.error('Item Actions are not configured');
91
+ res.status(500).json({
92
+ error: 'Item Actions are not configured'
93
+ });
94
+ return;
95
+ }
96
+ try {
97
+ const item = core.validatePK(await this.lib.get(ik), this.getPkType());
98
+ res.json(await this.itemActions[actionKey](req, res, item, req.params, req.body));
99
+ } catch (err) {
100
+ this.logger.error('Error in Item Action', {
101
+ message: err === null || err === void 0 ? void 0 : err.message,
102
+ stack: err === null || err === void 0 ? void 0 : err.stack
103
+ });
104
+ res.status(500).json(err);
105
+ }
106
+ });
107
+ _define_property$2(this, "getItemFacet", async (req, res)=>{
108
+ this.logger.default('Getting Item', {
109
+ query: req === null || req === void 0 ? void 0 : req.query,
110
+ params: req === null || req === void 0 ? void 0 : req.params,
111
+ locals: res === null || res === void 0 ? void 0 : res.locals
112
+ });
113
+ const ik = this.getIk(res);
114
+ const facetKey = req.path.substring(req.path.lastIndexOf('/') + 1);
115
+ if (!this.itemFacets) {
116
+ this.logger.error('Item Facets are not configured');
117
+ res.status(500).json({
118
+ error: 'Item Facets are not configured'
119
+ });
120
+ return;
121
+ }
122
+ try {
123
+ const item = core.validatePK(await this.lib.get(ik), this.getPkType());
124
+ await this.itemFacets[facetKey](req, res, item, req.params);
125
+ } catch (err) {
126
+ this.logger.error('Error in Item Facet', {
127
+ message: err === null || err === void 0 ? void 0 : err.message,
128
+ stack: err === null || err === void 0 ? void 0 : err.stack
129
+ });
130
+ res.status(500).json(err);
131
+ }
132
+ });
133
+ _define_property$2(this, "configure", (router)=>{
134
+ this.logger.default('Configuring Router', {
135
+ pkType: this.getPkType()
136
+ });
137
+ router.get('/', this.findItems);
138
+ router.post('/', this.createItem);
139
+ const allActions = this.configureAllActions();
140
+ this.logger.debug('All Actions supplied to Router', {
141
+ allActions
142
+ });
143
+ if (allActions) {
144
+ Object.keys(allActions).forEach((actionKey)=>{
145
+ this.logger.default('Configuring All Action', {
146
+ actionKey
147
+ });
148
+ // TODO: Ok, this is a bit of a hack, but we need to customize the types of the request handlers
149
+ router.post(`/${actionKey}`, ...allActions[actionKey]);
150
+ });
151
+ }
152
+ const itemRouter = express.Router();
153
+ itemRouter.get('/', this.getItem);
154
+ itemRouter.put('/', this.updateItem);
155
+ itemRouter.delete('/', this.deleteItem);
156
+ this.itemActions = this.configureItemActions();
157
+ this.logger.debug('Item Actions supplied to Router', {
158
+ itemActions: this.itemActions
159
+ });
160
+ if (this.itemActions) {
161
+ Object.keys(this.itemActions).forEach((actionKey)=>{
162
+ this.logger.default('Configuring Item Action', {
163
+ actionKey
164
+ });
165
+ // TODO: Ok, this is a bit of a hack, but we need to customize the types of the request handlers
166
+ itemRouter.post(`/${actionKey}`, this.postItemAction);
167
+ });
168
+ }
169
+ this.itemFacets = this.configureItemFacets();
170
+ this.logger.debug('Item Facets supplied to Router', {
171
+ itemFacets: this.itemFacets
172
+ });
173
+ if (this.itemFacets) {
174
+ Object.keys(this.itemFacets).forEach((facetKey)=>{
175
+ this.logger.default('Configuring Item Facet', {
176
+ facetKey
177
+ });
178
+ // TODO: Ok, this is a bit of a hack, but we need to customize the types of the request handlers
179
+ itemRouter.get(`/${facetKey}`, this.getItemFacet);
180
+ });
181
+ }
182
+ this.logger.default('Configuring Item Operations under PK Param', {
183
+ pkParam: this.getPkParam()
184
+ });
185
+ router.use(`/:${this.getPkParam()}`, this.validatePrimaryKeyValue, itemRouter);
186
+ if (this.childRouters) {
187
+ this.configureChildRouters(itemRouter, this.childRouters);
188
+ }
189
+ return router;
190
+ });
191
+ _define_property$2(this, "validatePrimaryKeyValue", (req, res, next)=>{
192
+ const pkParamValue = req.params[this.getPkParam()];
193
+ if (this.validatePKParam(pkParamValue)) {
194
+ res.locals[this.getPkParam()] = pkParamValue;
195
+ next();
196
+ } else {
197
+ this.logger.error('Invalid Primary Key', {
198
+ pkParamValue,
199
+ path: req === null || req === void 0 ? void 0 : req.path
200
+ });
201
+ res.status(500).json({
202
+ error: 'Invalid Primary Key',
203
+ path: req === null || req === void 0 ? void 0 : req.path
204
+ });
205
+ }
206
+ });
207
+ _define_property$2(this, "configureChildRouters", (router, childRouters)=>{
208
+ for(const path in childRouters){
209
+ this.logger.default('Configuring Child Router at Path', {
210
+ path
211
+ });
212
+ router.use(`/${path}`, childRouters[path]);
213
+ }
214
+ return router;
215
+ });
216
+ _define_property$2(this, "addChildRouter", (path, router)=>{
217
+ this.childRouters[path] = router;
218
+ });
219
+ /* istanbul ignore next */ // eslint-disable-next-line @typescript-eslint/no-unused-vars
220
+ _define_property$2(this, "createItem", async (req, res)=>{
221
+ throw new Error('Method not implemented in an abstract router');
222
+ });
223
+ // TODO: Probably a better way to do this, but this postCreate hook only needs the item.
224
+ /* istanbul ignore next */ _define_property$2(this, "postCreateItem", async (item)=>{
225
+ this.logger.default('Post Create Item', {
226
+ item
227
+ });
228
+ return item;
229
+ });
230
+ _define_property$2(this, "deleteItem", async (req, res)=>{
231
+ this.logger.default('Deleting Item', {
232
+ query: req.query,
233
+ params: req.params,
234
+ locals: res.locals
235
+ });
236
+ const ik = this.getIk(res);
237
+ const removedItem = await this.lib.remove(ik);
238
+ const item = core.validatePK(removedItem, this.getPkType());
239
+ res.json(item);
240
+ });
241
+ /* eslint-disable */ /* istanbul ignore next */ _define_property$2(this, "findItems", async (req, res)=>{
242
+ throw new Error('Method not implemented in an abstract router');
243
+ });
244
+ /* eslint-enable */ _define_property$2(this, "getItem", async (req, res)=>{
245
+ this.logger.default('Getting Item', {
246
+ query: req.query,
247
+ params: req.params,
248
+ locals: res.locals
249
+ });
250
+ const ik = this.getIk(res);
251
+ try {
252
+ // TODO: What error does validate PK throw, when can that fail?
253
+ const item = core.validatePK(await this.lib.get(ik), this.getPkType());
254
+ res.json(item);
255
+ } catch (err) {
256
+ if (err instanceof lib.NotFoundError) {
257
+ this.logger.error('Item Not Found', {
258
+ ik,
259
+ message: err === null || err === void 0 ? void 0 : err.message,
260
+ stack: err === null || err === void 0 ? void 0 : err.stack
261
+ });
262
+ res.status(404).json({
263
+ ik,
264
+ message: "Item Not Found"
265
+ });
266
+ } else {
267
+ this.logger.error('General Error', {
268
+ ik,
269
+ message: err === null || err === void 0 ? void 0 : err.message,
270
+ stack: err === null || err === void 0 ? void 0 : err.stack
271
+ });
272
+ res.status(500).json({
273
+ ik,
274
+ message: "General Error"
275
+ });
276
+ }
277
+ }
278
+ });
279
+ _define_property$2(this, "updateItem", async (req, res)=>{
280
+ this.logger.default('Updating Item', {
281
+ body: req === null || req === void 0 ? void 0 : req.body,
282
+ query: req === null || req === void 0 ? void 0 : req.query,
283
+ params: req === null || req === void 0 ? void 0 : req.params,
284
+ locals: res === null || res === void 0 ? void 0 : res.locals
285
+ });
286
+ const ik = this.getIk(res);
287
+ const itemToUpdate = this.convertDates(req.body);
288
+ const retItem = core.validatePK(await this.lib.update(ik, itemToUpdate), this.getPkType());
289
+ res.json(retItem);
290
+ });
291
+ _define_property$2(this, "convertDates", (item)=>{
292
+ const events = item.events;
293
+ this.logger.default('Converting Dates', {
294
+ item
295
+ });
296
+ if (events) {
297
+ Object.keys(events).forEach((key)=>{
298
+ Object.assign(events, {
299
+ [key]: deepmerge(events[key], {
300
+ at: events[key].at ? new Date(events[key].at) : null
301
+ })
302
+ });
303
+ });
304
+ }
305
+ Object.assign(item, {
306
+ events
307
+ });
308
+ return item;
309
+ });
310
+ // TODO: Maybe just simplify this and require that everything is a UUID?
311
+ /**
312
+ * This method might be an annoyance, but we need to capture a few cases where someone passes
313
+ * a PK parameter that has an odd string in it.
314
+ *
315
+ * @param pkParamValue The value of the primary key parameter
316
+ * @returns if the value is valid.
317
+ */ _define_property$2(this, "validatePKParam", (pkParamValue)=>{
318
+ let validPkParam = true;
319
+ if (pkParamValue.length <= 0) {
320
+ this.logger.error('Primary Key is an Empty String', {
321
+ pkParamValue
322
+ });
323
+ validPkParam = false;
324
+ } else if (pkParamValue === 'undefined') {
325
+ this.logger.error('Primary Key is the string \'undefined\'', {
326
+ pkParamValue
327
+ });
328
+ validPkParam = false;
329
+ }
330
+ return validPkParam;
331
+ });
332
+ this.lib = lib$1;
333
+ this.keyType = keyType;
334
+ this.options = options;
335
+ this.logger = LibLogger.get("ItemRouter", keyType);
336
+ }
337
+ }
338
+
339
+ function _define_property$1(obj, key, value) {
340
+ if (key in obj) {
341
+ Object.defineProperty(obj, key, {
342
+ value: value,
343
+ enumerable: true,
344
+ configurable: true,
345
+ writable: true
346
+ });
347
+ } else {
348
+ obj[key] = value;
349
+ }
350
+ return obj;
351
+ }
352
+ const logger$1 = LibLogger.get('CItemRouter');
353
+ class CItemRouter extends ItemRouter {
354
+ hasParent() {
355
+ return !!this.parentRoute;
356
+ }
357
+ getIk(res) {
358
+ const pri = this.getPk(res);
359
+ const loc = this.getLocations(res);
360
+ return {
361
+ kt: pri.kt,
362
+ pk: pri.pk,
363
+ loc
364
+ };
365
+ }
366
+ getLKA(res) {
367
+ /**
368
+ * A location key array is passed to a child router to provide contextfor the items it will
369
+ * be working with. It is always a concatenation of "My LKA" + "Parent LKA" which will
370
+ * bubble all the way up to the root Primary.
371
+ */ let lka = [
372
+ this.getLk(res)
373
+ ];
374
+ lka = lka.concat(this.parentRoute.getLKA(res));
375
+ return lka;
376
+ }
377
+ getLocations(res) {
378
+ return this.parentRoute.getLKA(res);
379
+ }
380
+ constructor(lib, type, parentRoute, options = {}){
381
+ super(lib, type, options), _define_property$1(this, "parentRoute", void 0), _define_property$1(this, "createItem", async (req, res)=>{
382
+ logger$1.trace('Creating Item 2', {
383
+ body: req === null || req === void 0 ? void 0 : req.body,
384
+ query: req === null || req === void 0 ? void 0 : req.query,
385
+ params: req === null || req === void 0 ? void 0 : req.params,
386
+ locals: res === null || res === void 0 ? void 0 : res.locals
387
+ });
388
+ const itemToCreate = this.convertDates(req.body);
389
+ let item = core.validatePK(await this.lib.create(itemToCreate, {
390
+ locations: this.getLocations(res)
391
+ }), this.getPkType());
392
+ item = await this.postCreateItem(item);
393
+ res.json(item);
394
+ }), _define_property$1(this, "findItems", async (req, res)=>{
395
+ logger$1.trace('Finding Items', {
396
+ query: req.query,
397
+ params: req.params,
398
+ locals: res.locals
399
+ });
400
+ const query = req.query;
401
+ const finder = query['finder'];
402
+ const finderParams = query['finderParams'];
403
+ const one = query['one'];
404
+ let items = [];
405
+ if (finder) {
406
+ // If finder is defined? Call a finder.
407
+ logger$1.trace('Finding Items with a finder', {
408
+ finder,
409
+ finderParams,
410
+ one
411
+ });
412
+ if (one === 'true') {
413
+ const item = await this.lib.findOne(finder, JSON.parse(finderParams), this.getLocations(res));
414
+ items = item ? [
415
+ item
416
+ ] : [];
417
+ } else {
418
+ items = await this.lib.find(finder, JSON.parse(finderParams), this.getLocations(res));
419
+ }
420
+ } else {
421
+ logger$1.trace('Finding Items with a query', {
422
+ query: req.query
423
+ });
424
+ // TODO: This is once of the more important places to perform some validaation and feedback
425
+ const itemQuery = core.paramsToQuery(req.query);
426
+ items = await this.lib.all(itemQuery, this.getLocations(res));
427
+ }
428
+ res.json(items.map((item)=>core.validatePK(item, this.getPkType())));
429
+ });
430
+ this.parentRoute = parentRoute;
431
+ }
432
+ }
433
+
434
+ function _define_property(obj, key, value) {
435
+ if (key in obj) {
436
+ Object.defineProperty(obj, key, {
437
+ value: value,
438
+ enumerable: true,
439
+ configurable: true,
440
+ writable: true
441
+ });
442
+ } else {
443
+ obj[key] = value;
444
+ }
445
+ return obj;
446
+ }
447
+ const logger = LibLogger.get('PItemRouter');
448
+ class PItemRouter extends ItemRouter {
449
+ getIk(res) {
450
+ const pri = this.getPk(res);
451
+ return pri;
452
+ }
453
+ constructor(lib, keyType, options = {}){
454
+ super(lib, keyType, options), _define_property(this, "createItem", async (req, res)=>{
455
+ logger.default('Creating Item 2', {
456
+ body: req.body,
457
+ query: req.query,
458
+ params: req.params,
459
+ locals: res.locals
460
+ });
461
+ const itemToCreate = this.convertDates(req.body);
462
+ let item = core.validatePK(await this.lib.create(itemToCreate), this.getPkType());
463
+ item = await this.postCreateItem(item);
464
+ res.json(item);
465
+ }), _define_property(this, "findItems", async (req, res)=>{
466
+ logger.default('Finding Items', {
467
+ query: req.query,
468
+ params: req.params,
469
+ locals: res.locals
470
+ });
471
+ let items = [];
472
+ const query = req.query;
473
+ const finder = query['finder'];
474
+ const finderParams = query['finderParams'];
475
+ const one = query['one'];
476
+ if (finder) {
477
+ // If finder is defined? Call a finder.
478
+ logger.default('Finding Items with a finder', {
479
+ finder,
480
+ finderParams,
481
+ one
482
+ });
483
+ if (one === 'true') {
484
+ const item = await this.lib.findOne(finder, JSON.parse(finderParams));
485
+ items = item ? [
486
+ item
487
+ ] : [];
488
+ } else {
489
+ items = await this.lib.find(finder, JSON.parse(finderParams));
490
+ }
491
+ } else {
492
+ logger.default('Finding Items with a query', {
493
+ query: req.query
494
+ });
495
+ // TODO: This is once of the more important places to perform some validaation and feedback
496
+ const itemQuery = core.paramsToQuery(req.query);
497
+ items = await this.lib.all(itemQuery);
498
+ }
499
+ res.json(items.map((item)=>core.validatePK(item, this.getPkType())));
500
+ });
501
+ }
502
+ }
503
+
504
+ exports.CItemRouter = CItemRouter;
505
+ exports.ItemRouter = ItemRouter;
506
+ exports.PItemRouter = PItemRouter;
507
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/logger.ts","../src/ItemRouter.ts","../src/CItemRouter.ts","../src/PItemRouter.ts"],"sourcesContent":["import Logging from '@fjell/logging';\n\nconst LibLogger = Logging.getLogger('@fjell/express-router');\n\nexport default LibLogger;\n","import {\n ComKey,\n cPK,\n Item,\n ItemEvent,\n ItemProperties,\n LocKey,\n LocKeyArray,\n PriKey,\n validatePK\n} from \"@fjell/core\";\nimport { NotFoundError, Operations } from \"@fjell/lib\";\nimport deepmerge from \"deepmerge\";\nimport { Request, RequestHandler, Response, Router } from \"express\";\nimport LibLogger from \"./logger\";\n\nexport type ItemRouterOptions = Record<string, never>;\n\n// TODO: body is in the request, it's not needed in the parameters\nexport type ActionMethod = <\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>(req: Request, res: Response, item: Item<S, L1, L2, L3, L4, L5>, params: any, body: any) =>\n Promise<Item<S, L1, L2, L3, L4, L5>>;\n\n// TODO: body is in the request, it's not needed in the parameters\nexport type AllActionMethods = Array<RequestHandler>;\n\n// TODO: body is in the request, it's not needed in the parameters\nexport type FacetMethod = <\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>(req: Request, res: Response, item: Item<S, L1, L2, L3, L4, L5>, params: any) =>\n Promise<any>;\n\nexport class ItemRouter<\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\n protected lib: Operations<Item<S, L1, L2, L3, L4, L5>, S, L1, L2, L3, L4, L5>;\n private keyType: S;\n protected options: ItemRouterOptions;\n private childRouters: Record<string, Router> = {};\n private logger;\n private itemActions: Record<string, ActionMethod> | undefined;\n private itemFacets: Record<string, FacetMethod> | undefined;\n\n constructor(\n lib: Operations<Item<S, L1, L2, L3, L4, L5>, S, L1, L2, L3, L4, L5>,\n keyType: S,\n options: ItemRouterOptions = {}\n ) {\n this.lib = lib;\n this.keyType = keyType;\n this.options = options;\n this.logger = LibLogger.get(\"ItemRouter\", keyType);\n }\n\n public getPkType = (): S => {\n return this.keyType;\n }\n\n protected getPkParam = (): string => {\n return `${this.getPkType()}Pk`;\n }\n\n protected getLk(res: Response): LocKey<S> {\n return { kt: this.keyType, lk: res.locals[this.getPkParam()] };\n }\n\n // this is meant to be consumed by children routers\n public getLKA(res: Response): LocKeyArray<S, L1, L2, L3, L4> {\n return [this.getLk(res)] as LocKeyArray<S, L1, L2, L3, L4>;\n }\n\n public getPk(res: Response): PriKey<S> {\n return cPK<S>(res.locals[this.getPkParam()], this.getPkType());\n }\n\n // Unless this is a contained router, the locations will always be an empty array.\n /* eslint-disable */\n protected getLocations(res: Response): LocKeyArray<L1, L2, L3, L4, L5> | [] {\n throw new Error('Method not implemented in an abstract router');\n }\n /* eslint-enable */\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected getIk(res: Response): PriKey<S> | ComKey<S, L1, L2, L3, L4, L5> {\n throw new Error('Method not implemented in an abstract router');\n }\n\n protected postItemAction = async (req: Request, res: Response) => {\n this.logger.default('Getting Item', { query: req?.query, params: req?.params, locals: res?.locals });\n const ik = this.getIk(res);\n const actionKey = req.path.substring(req.path.lastIndexOf('/') + 1);\n if (!this.itemActions) {\n this.logger.error('Item Actions are not configured');\n res.status(500).json({ error: 'Item Actions are not configured' });\n return;\n }\n try {\n const item =\n validatePK(await this.lib.get(ik), this.getPkType()) as Item<S, L1, L2, L3, L4, L5>;\n res.json(await this.itemActions[actionKey](req, res, item, req.params, req.body));\n } catch (err: any) {\n this.logger.error('Error in Item Action', { message: err?.message, stack: err?.stack });\n res.status(500).json(err);\n }\n }\n\n protected getItemFacet = async (req: Request, res: Response) => {\n this.logger.default('Getting Item', { query: req?.query, params: req?.params, locals: res?.locals });\n const ik = this.getIk(res);\n const facetKey = req.path.substring(req.path.lastIndexOf('/') + 1);\n if (!this.itemFacets) {\n this.logger.error('Item Facets are not configured');\n res.status(500).json({ error: 'Item Facets are not configured' });\n return;\n }\n try {\n const item =\n validatePK(await this.lib.get(ik), this.getPkType()) as Item<S, L1, L2, L3, L4, L5>;\n await this.itemFacets[facetKey](req, res, item, req.params);\n } catch (err: any) {\n this.logger.error('Error in Item Facet', { message: err?.message, stack: err?.stack });\n res.status(500).json(err);\n }\n }\n\n private configure = (router: Router) => {\n this.logger.default('Configuring Router', { pkType: this.getPkType() });\n router.get('/', this.findItems);\n router.post('/', this.createItem);\n\n const allActions = this.configureAllActions();\n this.logger.debug('All Actions supplied to Router', { allActions });\n if (allActions) {\n Object.keys(allActions).forEach((actionKey) => {\n this.logger.default('Configuring All Action', { actionKey });\n // TODO: Ok, this is a bit of a hack, but we need to customize the types of the request handlers\n router.post(`/${actionKey}`, ...allActions[actionKey]);\n });\n }\n\n const itemRouter = Router();\n itemRouter.get('/', this.getItem);\n itemRouter.put('/', this.updateItem);\n itemRouter.delete('/', this.deleteItem);\n\n this.itemActions = this.configureItemActions();\n this.logger.debug('Item Actions supplied to Router', { itemActions: this.itemActions });\n if (this.itemActions) {\n Object.keys(this.itemActions).forEach((actionKey) => {\n this.logger.default('Configuring Item Action', { actionKey });\n // TODO: Ok, this is a bit of a hack, but we need to customize the types of the request handlers\n itemRouter.post(`/${actionKey}`, this.postItemAction)\n });\n }\n\n this.itemFacets = this.configureItemFacets();\n this.logger.debug('Item Facets supplied to Router', { itemFacets: this.itemFacets });\n if (this.itemFacets) {\n Object.keys(this.itemFacets).forEach((facetKey) => {\n this.logger.default('Configuring Item Facet', { facetKey });\n // TODO: Ok, this is a bit of a hack, but we need to customize the types of the request handlers\n itemRouter.get(`/${facetKey}`, this.getItemFacet)\n });\n }\n\n this.logger.default('Configuring Item Operations under PK Param', { pkParam: this.getPkParam() });\n router.use(`/:${this.getPkParam()}`, this.validatePrimaryKeyValue, itemRouter);\n\n if (this.childRouters) {\n this.configureChildRouters(itemRouter, this.childRouters);\n }\n return router;\n }\n\n private validatePrimaryKeyValue = (req: Request, res: Response, next: any) => {\n const pkParamValue = req.params[this.getPkParam()];\n if (this.validatePKParam(pkParamValue)) {\n res.locals[this.getPkParam()] = pkParamValue;\n next();\n } else {\n this.logger.error('Invalid Primary Key', { pkParamValue, path: req?.path });\n res.status(500).json({ error: 'Invalid Primary Key', path: req?.path });\n }\n }\n\n private configureChildRouters = (router: Router, childRouters: Record<string, Router>) => {\n for (const path in childRouters) {\n this.logger.default('Configuring Child Router at Path', { path });\n\n router.use(`/${path}`, childRouters[path]);\n }\n return router;\n }\n\n public addChildRouter = (path: string, router: Router) => {\n this.childRouters[path] = router;\n }\n\n /* istanbul ignore next */\n protected configureItemActions(): Record<string, ActionMethod> {\n this.logger.debug('ARouter - No Item Actions Configured');\n return {};\n }\n\n /* istanbul ignore next */\n protected configureItemFacets(): Record<string, FacetMethod> {\n this.logger.debug('ARouter - No Item Facets Configured');\n return {};\n }\n\n /* istanbul ignore next */\n protected configureAllActions(): Record<string, AllActionMethods> {\n this.logger.debug('ARouter - No All Actions Configured');\n return {};\n }\n\n /* istanbul ignore next */\n public getRouter(): Router {\n const router = Router();\n this.configure(router);\n return router;\n }\n\n /* istanbul ignore next */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n protected createItem = async (req: Request, res: Response): Promise<void> => {\n throw new Error('Method not implemented in an abstract router');\n };\n\n // TODO: Probably a better way to do this, but this postCreate hook only needs the item.\n /* istanbul ignore next */\n public postCreateItem = async (item: Item<S, L1, L2, L3, L4, L5>): Promise<Item<S, L1, L2, L3, L4, L5>> => {\n this.logger.default('Post Create Item', { item });\n return item;\n };\n\n protected deleteItem = async (req: Request, res: Response): Promise<void> => {\n this.logger.default('Deleting Item', { query: req.query, params: req.params, locals: res.locals });\n const ik = this.getIk(res);\n const removedItem = await this.lib.remove(ik);\n const item = validatePK(removedItem, this.getPkType());\n res.json(item);\n };\n\n /* eslint-disable */\n /* istanbul ignore next */\n protected findItems = async (req: Request, res: Response): Promise<void> => {\n throw new Error('Method not implemented in an abstract router');\n };\n /* eslint-enable */\n\n protected getItem = async (req: Request, res: Response) => {\n this.logger.default('Getting Item', { query: req.query, params: req.params, locals: res.locals });\n const ik = this.getIk(res);\n try {\n // TODO: What error does validate PK throw, when can that fail?\n const item = validatePK(await this.lib.get(ik), this.getPkType());\n res.json(item);\n } catch (err: any) {\n if (err instanceof NotFoundError) {\n this.logger.error('Item Not Found', { ik, message: err?.message, stack: err?.stack });\n res.status(404).json({\n ik,\n message: \"Item Not Found\",\n });\n } else {\n this.logger.error('General Error', { ik, message: err?.message, stack: err?.stack });\n res.status(500).json({\n ik,\n message: \"General Error\",\n });\n }\n }\n }\n\n protected updateItem = async (req: Request, res: Response) => {\n this.logger.default('Updating Item',\n { body: req?.body, query: req?.query, params: req?.params, locals: res?.locals });\n const ik = this.getIk(res);\n const itemToUpdate = this.convertDates(req.body as ItemProperties<S, L1, L2, L3, L4, L5>);\n const retItem = validatePK(await this.lib.update(ik, itemToUpdate), this.getPkType());\n res.json(retItem);\n };\n\n public convertDates = (item: Item<S, L1, L2, L3, L4, L5> | ItemProperties<S, L1, L2, L3, L4, L5>):\n Item<S, L1, L2, L3, L4, L5> | ItemProperties<S, L1, L2, L3, L4, L5> => {\n const events = item.events as Record<string, ItemEvent>;\n this.logger.default('Converting Dates', { item });\n if (events) {\n Object.keys(events).forEach((key: string) => {\n Object.assign(events, {\n [key]: deepmerge(events[key], { at: events[key].at ? new Date(events[key].at) : null })\n });\n });\n }\n Object.assign(item, { events });\n return item;\n };\n\n // TODO: Maybe just simplify this and require that everything is a UUID?\n /**\n * This method might be an annoyance, but we need to capture a few cases where someone passes\n * a PK parameter that has an odd string in it.\n *\n * @param pkParamValue The value of the primary key parameter\n * @returns if the value is valid.\n */\n protected validatePKParam = (pkParamValue: string): boolean => {\n let validPkParam = true;\n if (pkParamValue.length <= 0) {\n this.logger.error('Primary Key is an Empty String', { pkParamValue });\n validPkParam = false;\n } else if (pkParamValue === 'undefined') {\n this.logger.error('Primary Key is the string \\'undefined\\'', { pkParamValue });\n validPkParam = false;\n }\n return validPkParam;\n }\n\n}\n","import {\n ComKey, Item, ItemQuery, LocKey, LocKeyArray, paramsToQuery, PriKey, QueryParams, validatePK\n} from \"@fjell/core\";\nimport { Request, Response } from \"express\";\nimport { ItemRouter, ItemRouterOptions } from \"@/ItemRouter\";\nimport LibLogger from \"@/logger\";\nimport { Contained } from \"@fjell/lib\";\n\nconst logger = LibLogger.get('CItemRouter');\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 private parentRoute: ItemRouter<L1, L2, L3, L4, L5, never>;\n\n constructor(\n lib: Contained.Operations<T, S, L1, L2, L3, L4, L5>,\n type: S,\n parentRoute: ItemRouter<L1, L2, L3, L4, L5, never>,\n options: ItemRouterOptions = {},\n ) {\n super(lib, type, options);\n this.parentRoute = 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 protected createItem = async (req: Request, res: Response) => {\n logger.trace('Creating Item 2',\n { body: req?.body, query: req?.query, params: req?.params, locals: res?.locals });\n const itemToCreate = this.convertDates(req.body as Item<S, L1, L2, L3, L4, L5>);\n let item =\n validatePK(await this.lib.create(\n itemToCreate, { locations: this.getLocations(res) }), this.getPkType()) as Item<S, L1, L2, L3, L4, L5>;\n item = await this.postCreateItem(item);\n res.json(item);\n };\n\n protected findItems = async (req: Request, res: Response) => {\n logger.trace('Finding Items', { query: req.query, params: req.params, locals: res.locals });\n\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 let items: Item<S, L1, L2, L3, L4, L5>[] = [];\n\n if (finder) {\n // If finder is defined? Call a finder.\n logger.trace('Finding Items with a finder', { finder, finderParams, one });\n\n if (one === 'true') {\n const item = await (this.lib as any).findOne(finder, JSON.parse(finderParams), this.getLocations(res));\n items = item ? [item] : [];\n } else {\n items = await this.lib.find(finder, JSON.parse(finderParams), this.getLocations(res));\n }\n } else {\n logger.trace('Finding Items with a query', { query: req.query });\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 items = await this.lib.all(itemQuery, this.getLocations(res));\n }\n\n res.json(items.map((item: Item<S, L1, L2, L3, L4, L5>) => validatePK(item, this.getPkType())));\n };\n\n}\n","import { Item, ItemQuery, paramsToQuery, PriKey, QueryParams, validatePK } from \"@fjell/core\";\nimport { Primary } from \"@fjell/lib\";\nimport { ItemRouter, ItemRouterOptions } from \"@/ItemRouter\";\nimport { Request, Response } from \"express\";\nimport LibLogger from \"@/logger\";\n\nconst logger = LibLogger.get('PItemRouter');\n\ninterface ParsedQuery {\n [key: string]: undefined | string | string[] | ParsedQuery | ParsedQuery[];\n}\n\nexport class PItemRouter<T extends Item<S>, S extends string> extends ItemRouter<S> {\n\n constructor(lib: Primary.Operations<T, S>, keyType: S, options: ItemRouterOptions = {}) {\n super(lib, keyType, options);\n }\n\n public getIk(res: Response): PriKey<S> {\n const pri = this.getPk(res) as PriKey<S>;\n return pri\n }\n\n public createItem = async (req: Request, res: Response) => {\n logger.default('Creating Item 2', { body: req.body, query: req.query, params: req.params, locals: res.locals });\n const itemToCreate = this.convertDates(req.body as Item<S>);\n let item =\n validatePK(await this.lib.create(itemToCreate), this.getPkType()) as Item<S>;\n item = await this.postCreateItem(item);\n res.json(item);\n };\n\n protected findItems = async (req: Request, res: Response) => {\n logger.default('Finding Items', { query: req.query, params: req.params, locals: res.locals });\n\n let items: Item<S>[] = [];\n\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 if (finder) {\n // If finder is defined? Call a finder.\n logger.default('Finding Items with a finder', { finder, finderParams, one });\n\n if (one === 'true') {\n const item = await (this.lib as any).findOne(finder, JSON.parse(finderParams));\n items = item ? [item] : [];\n } else {\n items = await this.lib.find(finder, JSON.parse(finderParams));\n }\n } else {\n logger.default('Finding Items with a query', { query: req.query });\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 items = await this.lib.all(itemQuery);\n }\n\n res.json(items.map((item: Item<S>) => validatePK(item, this.getPkType())));\n };\n\n}\n"],"names":["LibLogger","Logging","getLogger","ItemRouter","getLk","res","kt","keyType","lk","locals","getPkParam","getLKA","getPk","cPK","getPkType","getLocations","Error","getIk","logger","debug","router","Router","configure","lib","options","_define_property","childRouters","itemActions","itemFacets","postItemAction","req","default","query","params","ik","actionKey","path","substring","lastIndexOf","error","status","json","item","validatePK","get","body","err","message","stack","getItemFacet","facetKey","pkType","findItems","post","createItem","allActions","configureAllActions","Object","keys","forEach","itemRouter","getItem","put","updateItem","delete","deleteItem","configureItemActions","configureItemFacets","pkParam","use","validatePrimaryKeyValue","configureChildRouters","next","pkParamValue","validatePKParam","addChildRouter","postCreateItem","removedItem","remove","NotFoundError","itemToUpdate","convertDates","retItem","update","events","key","assign","deepmerge","at","Date","validPkParam","length","CItemRouter","hasParent","parentRoute","pri","loc","pk","lka","concat","type","trace","itemToCreate","create","locations","finder","finderParams","one","items","findOne","JSON","parse","find","itemQuery","paramsToQuery","all","map","PItemRouter"],"mappings":";;;;;;;;;;AAEA,MAAMA,SAAAA,GAAYC,OAAQC,CAAAA,SAAS,CAAC,uBAAA,CAAA;;;;;;;;;;;;;;;ACyC7B,MAAMC,UAAAA,CAAAA;AAoCDC,IAAAA,KAAAA,CAAMC,GAAa,EAAa;QACxC,OAAO;YAAEC,EAAI,EAAA,IAAI,CAACC,OAAO;AAAEC,YAAAA,EAAAA,EAAIH,IAAII,MAAM,CAAC,IAAI,CAACC,UAAU,EAAG;AAAC,SAAA;AAC/D;;AAGOC,IAAAA,MAAAA,CAAON,GAAa,EAAkC;QAC3D,OAAO;YAAC,IAAI,CAACD,KAAK,CAACC,GAAAA;AAAK,SAAA;AAC1B;AAEOO,IAAAA,KAAAA,CAAMP,GAAa,EAAa;QACrC,OAAOQ,QAAAA,CAAOR,GAAII,CAAAA,MAAM,CAAC,IAAI,CAACC,UAAU,EAAG,CAAA,EAAE,IAAI,CAACI,SAAS,EAAA,CAAA;AAC7D;;AAGA,yBACUC,YAAaV,CAAAA,GAAa,EAAwC;AAC1E,QAAA,MAAM,IAAIW,KAAM,CAAA,8CAAA,CAAA;AAClB;AACA;AAGUC,IAAAA,KAAAA,CAAMZ,GAAa,EAA6C;AACxE,QAAA,MAAM,IAAIW,KAAM,CAAA,8CAAA,CAAA;AAClB;+BAkHA,oBAA+D,GAAA;AAC7D,QAAA,IAAI,CAACE,MAAM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
3
3
  export { PItemRouter } from './PItemRouter.js';
4
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzsifQ==
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
4
+
5
+ const Logging = require('@fjell/logging');
6
+
7
+ const LibLogger = Logging.getLogger('@fjell/express-router');
8
+
9
+ exports.default = LibLogger;
10
+ //# sourceMappingURL=logger.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.cjs","sources":["../src/logger.ts"],"sourcesContent":["import Logging from '@fjell/logging';\n\nconst LibLogger = Logging.getLogger('@fjell/express-router');\n\nexport default LibLogger;\n"],"names":["LibLogger","Logging","getLogger"],"mappings":";;;;;;AAEMA,MAAAA,SAAAA,GAAYC,OAAQC,CAAAA,SAAS,CAAC,uBAAA;;;;"}
package/dist/logger.js CHANGED
@@ -3,4 +3,4 @@ import Logging from '@fjell/logging';
3
3
  const LibLogger = Logging.getLogger('@fjell/express-router');
4
4
 
5
5
  export { LibLogger as default };
6
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nZ2VyLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OyJ9
6
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sources":["../src/logger.ts"],"sourcesContent":["import Logging from '@fjell/logging';\n\nconst LibLogger = Logging.getLogger('@fjell/express-router');\n\nexport default LibLogger;\n"],"names":["LibLogger","Logging","getLogger"],"mappings":";;AAEMA,MAAAA,SAAAA,GAAYC,OAAQC,CAAAA,SAAS,CAAC,uBAAA;;;;"}