Commit 6ccc3e7
committed
feat(remotes): Add native remote CRUD operations based on OpenAPI spec
Implements full native support for TerminusDB remote operations following
the OpenAPI specification from cleodb/docs/openapi.yaml.
## Implementation Based on OpenAPI Spec:
### URL Structure:
- Path: /api/remote/{branch_path} where branch_path = org/db/repo/branch/name
- Uses branchBase('remote') to generate correct branch path
### API Methods:
- POST with {remote_name, remote_location} - Create remote
- GET with ?remote_name= query param - Get remote details
- PUT with {remote_name, remote_location} - Update remote
- DELETE with ?remote_name= query param - Delete remote
### Response Format:
- @type: 'api:RemoteResponse'
- api:status: 'api:success'
- api:remote_name: string (for GET)
- api:remote_url: string (for GET)
## Core Implementation:
**ConnectionConfig.js:**
- remoteURL(): Generates /api/remote/org/db/repo/branch/name
**WOQLClient.js:**
- createRemote(name, location): POST with JSON body
- getRemote(name): GET with query parameter
- updateRemote(name, location): PUT with JSON body
- deleteRemote(name): DELETE with query parameter
**Constants:**
- REMOTE, CREATE_REMOTE, GET_REMOTE, UPDATE_REMOTE, DELETE_REMOTE
## Features:
✅ Full parameter validation with meaningful error messages
✅ Proper URL encoding for remote names with special characters
✅ Context-aware (respects current org/db/repo/branch)
✅ Consistent with existing client patterns
✅ Backward compatible
✅ Follows OpenAPI specification exactly
## Testing:
**Unit Tests** (test/remoteOperations.spec.js):
- 28 comprehensive tests
- URL generation validation
- Parameter validation
- Mock API responses
- ✅ All 28 tests passing
**Integration Tests** (integration_tests/remote_operations.test.ts):
- 29 comprehensive tests
- Complete CRUD workflows
- Multiple remotes management
- Special characters and edge cases
- Note: Requires TerminusDB server with full remote API support
**Overall:**
- 178 total tests passing (150 existing + 28 new)
- 0 failures
- Backward compatible
## Documentation:
- REMOTE_OPERATIONS.md: User-facing API documentation
- REMOTE_OPERATIONS_IMPLEMENTATION.md: Technical implementation details
- Inline JSDoc comments for all methods
## OpenAPI Reference:
Source: /Users/hoijnet/Code/terminusdb/cleodb/docs/openapi.yaml
Lines 864-1013: Remote endpoint specifications
Fixes #248File tree
8 files changed
+1301
-13
lines changed- integration_tests
- lib
- test
8 files changed
+1301
-13
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
0 commit comments