Skip to content

Commit fb4b2ae

Browse files
chefsalecursoragentrtb-12claude
authored
feat: align mero-js with core namespace model (#28)
* feat: add namespace and group APIs to AdminApiClient Namespaces: - listNamespaces() -- GET /admin-api/namespaces - getNamespaceIdentity(id) -- GET /admin-api/namespaces/:id/identity - listNamespacesForApplication(appId) -- GET /admin-api/namespaces/for-application/:appId Groups: - listGroups() -- GET /admin-api/groups - createGroup(request) -- POST /admin-api/groups - getGroupInfo(id) -- GET /admin-api/groups/:id - deleteGroup(id) -- DELETE /admin-api/groups/:id - listGroupMembers(id) -- GET /admin-api/groups/:id/members - listGroupContexts(id) -- GET /admin-api/groups/:id/contexts - createGroupInvitation(id) -- POST /admin-api/groups/:id/invite - joinGroup(request) -- POST /admin-api/groups/join - joinGroupContext(id, request) -- POST /admin-api/groups/:id/join-context Made-with: Cursor * feat: add serviceName to CreateContextRequest and Context types Made-with: Cursor * docs: add Admin API section to README (namespaces, groups, contexts, services) Made-with: Cursor * fix: add missing unwrap() to namespace/group GET methods Cursor bot review found new GET methods were returning the raw { data: T } envelope instead of unwrapping the inner payload. Fix response types to represent the unwrapped shape and add unwrap() calls consistent with the existing pattern. Exceptions (intentional): - getNamespaceIdentity: server has no data wrapper - listGroupMembers: data has sibling selfIdentity field Made-with: Cursor * refactor: rename joinGroupContext to joinContext (route: /contexts/:id/join) Made-with: Cursor * refactor: remove inviteToContext, simplify joinContext to group-membership only Made-with: Cursor * feat(admin-api): align AdminApiClient with redesigned core routes (#29) Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Sandi Fatic <chefsale@users.noreply.github.com> * feat: align all types with core namespace model, add comprehensive tests - Fix all admin-api request/response types to match core's actual structs (namespaces, groups, contexts, TEE, invitations, capabilities as u32 bitmask) - Add missing endpoints: listPackages, listPackageVersions - Add requester field to all mutation request types - Remove stale subscribeNamespace (route doesn't exist in core) - Remove stale protocol field from CreateContextRequest - Add 65 new unit tests covering all new/updated APIs (173 total) - Rewrite E2E tests to use namespace -> group -> context flow - Deprecate executorPublicKey in RPC (removed from core JSON-RPC) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: restrict push trigger to master only Prevents redundant CI runs on feature branches that already have pull_request checks. Eliminates cancelled push checks on PRs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Sandi Fatic <chefsale@users.noreply.github.com> Co-authored-by: rtb-12 <ronit_c@me.iitr.ac.in> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0a5a766 commit fb4b2ae

10 files changed

Lines changed: 12303 additions & 531 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: CI
33
on:
44
push:
55
branches:
6-
- '**'
6+
- master
77
pull_request:
88
branches:
99
- master

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,45 @@ See the `examples/` directory for complete usage examples:
422422
423423
**Note**: Run `npm run build` before running the examples, as they import from the built library.
424424
425+
## Admin API
426+
427+
The `AdminApiClient` provides methods for managing Calimero node resources:
428+
429+
### Namespaces (application instances)
430+
```typescript
431+
const namespaces = await admin.listNamespaces();
432+
const identity = await admin.getNamespaceIdentity(namespaceId);
433+
const appNamespaces = await admin.listNamespacesForApplication(appId);
434+
```
435+
436+
### Groups (governance boundaries)
437+
```typescript
438+
const groups = await admin.listGroups();
439+
const group = await admin.createGroup({ applicationId: '...' });
440+
const info = await admin.getGroupInfo(groupId);
441+
const members = await admin.listGroupMembers(groupId);
442+
const contexts = await admin.listGroupContexts(groupId);
443+
```
444+
445+
### Contexts (WASM execution instances)
446+
```typescript
447+
// Single-service app
448+
const ctx = await admin.createContext({ applicationId: '...' });
449+
450+
// Multi-service app -- specify which service to run
451+
const ctx = await admin.createContext({
452+
applicationId: '...',
453+
serviceName: 'chat',
454+
});
455+
```
456+
457+
### Cloud (TEE High Availability)
458+
```typescript
459+
import { CloudClient } from 'mero-js';
460+
const cloud = new CloudClient();
461+
cloud.enableHA({ groupId, contextId, redirectUrl });
462+
```
463+
425464
## Development
426465
427466
```bash

0 commit comments

Comments
 (0)