json-rest-api 0.1.1 → 1.0.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/README.md +392 -130
- package/TODO.todo +113 -0
- package/api.js +628 -0
- package/docs/API.md +1306 -0
- package/docs/FIXES_APPLIED.md +59 -0
- package/docs/GUIDES.md +1792 -0
- package/docs/RESOURCES_IN_EXPRESS.md +456 -0
- package/docs/example-versioning.js +168 -0
- package/docs/example.js +195 -0
- package/index.js +58 -207
- package/package.json +15 -25
- package/plugins/API guide.md +364 -0
- package/plugins/api-registry.js +142 -0
- package/plugins/api-versioning.md +135 -0
- package/plugins/http.js +273 -0
- package/plugins/logging.js +255 -0
- package/plugins/memory.js +182 -0
- package/plugins/mysql.js +753 -0
- package/plugins/openapi.js +401 -0
- package/plugins/positioning.js +220 -0
- package/plugins/security.js +261 -0
- package/plugins/validation.js +173 -0
- package/plugins/versioning.js +288 -0
- package/resource-helper.js +79 -0
- package/schema.js +481 -0
- package/test-basic.js +107 -0
- package/.jshintrc +0 -48
- package/.npmignore +0 -15
- package/LICENSE +0 -20
- package/examples/client.js +0 -18
- package/examples/client2.js +0 -27
- package/examples/server.js +0 -23
- package/test.js +0 -101
|
@@ -0,0 +1,59 @@
|
|
|
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.
|