json-rest-api 1.0.0 → 1.0.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.
Files changed (67) hide show
  1. package/.claude/settings.local.json +16 -0
  2. package/LICENSE +674 -0
  3. package/README.md +655 -309
  4. package/RELATIONSHIPS.md +1013 -0
  5. package/TODO_rest-api-plugin-extras.js +142 -0
  6. package/connectors_ideas/express-plugin.js +120 -0
  7. package/connectors_ideas/fastify.js +219 -0
  8. package/connectors_ideas/http-plugin.js +138 -0
  9. package/connectors_ideas/koa-plugin.js +113 -0
  10. package/docs/fileUploads.md +722 -0
  11. package/docs/mini-guides/file-uploads-complete.md +159 -0
  12. package/examples/.gitkeep +0 -0
  13. package/examples/express-example.js +262 -0
  14. package/examples/express-plugin.js +366 -0
  15. package/examples/file-upload-example.js +205 -0
  16. package/examples/filename-strategies.js +140 -0
  17. package/examples/knex-basic.js +66 -0
  18. package/index.js +31 -56
  19. package/lib/payload-validators.js +685 -0
  20. package/lib/rest-api-errors.js +58 -0
  21. package/package.json +41 -14
  22. package/payloadValdators.js +686 -0
  23. package/plugins/core/connectors/express-plugin.js +449 -0
  24. package/plugins/core/connectors/http-plugin.js +450 -0
  25. package/plugins/core/file-handling-plugin.js +338 -0
  26. package/plugins/core/lib/busboy-detector.js +167 -0
  27. package/plugins/core/lib/formidable-detector.js +130 -0
  28. package/plugins/core/rest-api-knex-plugin.js +200 -0
  29. package/plugins/core/rest-api-plugin.js +1419 -0
  30. package/plugins/storage/local-storage.js +218 -0
  31. package/plugins/storage/s3-storage.js +125 -0
  32. package/test-examples/package-lock.json +906 -0
  33. package/test-examples/package.json +15 -0
  34. package/test-examples/test-basic-api.js +11 -0
  35. package/test-examples/test-books-resource.js +116 -0
  36. package/test-examples/test-complete-file-upload.js +140 -0
  37. package/test-examples/test-debug.js +28 -0
  38. package/test-examples/test-express-plugin.js +177 -0
  39. package/test-examples/test-express-simple.js +28 -0
  40. package/test-examples/test-express-with-import.js +71 -0
  41. package/test-examples/test-file-upload.js +132 -0
  42. package/test-examples/test-http-plugin.js +159 -0
  43. package/test-examples/test-programmatic-api.js +188 -0
  44. package/test-examples/test-rest-api-plugin.js +13 -0
  45. package/TODO.todo +0 -113
  46. package/api.js +0 -628
  47. package/docs/API.md +0 -1306
  48. package/docs/FIXES_APPLIED.md +0 -59
  49. package/docs/GUIDES.md +0 -1792
  50. package/docs/RESOURCES_IN_EXPRESS.md +0 -456
  51. package/docs/example-versioning.js +0 -168
  52. package/docs/example.js +0 -195
  53. package/plugins/API guide.md +0 -364
  54. package/plugins/api-registry.js +0 -142
  55. package/plugins/api-versioning.md +0 -135
  56. package/plugins/http.js +0 -273
  57. package/plugins/logging.js +0 -255
  58. package/plugins/memory.js +0 -182
  59. package/plugins/mysql.js +0 -753
  60. package/plugins/openapi.js +0 -401
  61. package/plugins/positioning.js +0 -220
  62. package/plugins/security.js +0 -261
  63. package/plugins/validation.js +0 -173
  64. package/plugins/versioning.js +0 -288
  65. package/resource-helper.js +0 -79
  66. package/schema.js +0 -481
  67. package/test-basic.js +0 -107
@@ -1,59 +0,0 @@
1
- # Fixes Applied to jsonrestapi
2
-
3
- ## Critical Fixes
4
-
5
- 1. **HTTPPlugin Logic in createApi** (Critical)
6
- - Fixed backwards logic: `if (options.http !== false)` → `if (options.http)`
7
- - Now properly adds HTTPPlugin only when http options are provided
8
- - This was preventing the first example in GUIDES.md from working
9
-
10
- 2. **Positioning Logic** (Important)
11
- - Fixed condition in memory.js and mysql.js
12
- - Changed from `data[options.beforeIdField]` to `data[options.beforeIdField] !== undefined`
13
- - Now correctly handles `beforeId: 0` which should place item at beginning
14
-
15
- 3. **Missing Exports** (Important)
16
- - Added ApiRegistryPlugin export to index.js
17
- - Added missing imports in createApi function
18
-
19
- 4. **Package Name** (Critical)
20
- - Fixed incorrect package name: `circular-json-es` → `circular-json-es6`
21
- - Updated imports to use correct export names: `stringify`/`parse` instead of `serialize`/`deserialize`
22
-
23
- 5. **Route Middleware Implementation**
24
- - Fixed incorrect implementation in http.js
25
- - Changed from trying to splice into router methods to storing middleware for later application
26
-
27
- 6. **MySQL Schema Sync Error Handling**
28
- - Added try-catch wrapper around schema sync
29
- - Now provides better error messages when sync fails
30
-
31
- 7. **Removed Unused EventEmitter**
32
- - Removed EventEmitter inheritance from Api class as it wasn't being used
33
- - Simplified the code and reduced dependencies
34
-
35
- 8. **Added Missing Methods**
36
- - Added `Api.getVersions()` static method
37
- - Added `createSearchSchema()` instance method
38
-
39
- ## Test Results
40
-
41
- Created and ran basic functionality test (`test-basic.js`) which confirms:
42
- - ✓ API creation with memory storage
43
- - ✓ Schema registration
44
- - ✓ Insert operations
45
- - ✓ Query operations with filtering
46
- - ✓ Get by ID
47
- - ✓ Update operations
48
- - ✓ Delete operations
49
-
50
- All core CRUD operations are working correctly with the JSON:API format.
51
-
52
- ## Remaining Considerations
53
-
54
- 1. **Plugin Dependencies**: Some plugins may depend on others (e.g., PositioningPlugin might need specific storage)
55
- 2. **Route-specific Middleware**: The implementation needs testing with actual Express routes
56
- 3. **Version History**: The versioning plugin's history tracking needs database testing
57
- 4. **Options Consistency**: Some options handling could be more consistent across plugins
58
-
59
- The library is now functional and the critical issues that would prevent basic usage have been resolved.