@proxima-nexus/sdk-typescript 2.0.1 → 2.1.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/CHANGELOG.md +19 -0
- package/README.md +49 -7
- package/dist/enhanced/enhanced-event-api.d.ts +21 -0
- package/dist/enhanced/enhanced-event-api.js +58 -0
- package/dist/enhanced/enhanced-group-api.d.ts +26 -0
- package/dist/enhanced/enhanced-group-api.js +73 -0
- package/dist/enhanced/enhanced-user-api.d.ts +25 -0
- package/dist/enhanced/enhanced-user-api.js +71 -0
- package/dist/enhanced/errors.d.ts +40 -0
- package/dist/enhanced/errors.js +87 -0
- package/dist/enhanced/index.d.ts +34 -0
- package/dist/enhanced/index.js +64 -0
- package/dist/enhanced/types.d.ts +6 -0
- package/dist/enhanced/types.js +7 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +13 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,25 @@ All notable changes to the Proxima Nexus TypeScript SDK are documented in this f
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.1.0] - 2025-01-30
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Enhanced Client** (`EnhancedProximaNexusClient`) – Higher-level API that wraps the base client with:
|
|
13
|
+
- **Simplified method signatures** – No `RawAxiosRequestConfig`; `requesterUserId` instead of `xProximaNexusRequesterUserId`
|
|
14
|
+
- **Unwrapped return values** – Methods return `Promise<T>` (e.g. `UserDto`) instead of Axios response; no `.data` needed
|
|
15
|
+
- **Domain-focused methods** – e.g. `getUser`, `getFriends`, `sendFriendRequest`, `acceptFriendRequest`, `searchByDisplayName`, `searchByRadius`, `searchByBoundingBox`
|
|
16
|
+
- **Friend workflow** – `sendFriendRequest`, `acceptFriendRequest`, `declineFriendRequest`, `removeFriend`, `getFriends`, `getPendingFriendRequests`
|
|
17
|
+
- **Blocking** – `blockUser`, `unblockUser`, `getBlockedUsers`
|
|
18
|
+
- **Event attendee/role** – `addAttendee`, `removeAttendee`, `getAttendees`, `promoteToAdmin`, `demoteToAttendee`, `getAdmins`, `getOwner`
|
|
19
|
+
- **Group membership** – `joinGroup`, `leaveGroup`, `approveMember`, `rejectMember`, `removeMember`, `getMembers`, `getPendingMembers`, `promoteToAdmin`, `demoteToMember`, `getAdmins`, `getOwner`
|
|
20
|
+
- **Custom errors** – `NotFoundError`, `UnauthorizedError`, `ValidationError` (thrown instead of raw Axios errors when using the enhanced client)
|
|
21
|
+
- **Base client access** – `client.base` on `EnhancedProximaNexusClient` for direct access to `UserApi`, `EventApi`, `GroupApi` when needed
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- None; base client API is unchanged. Enhanced client is additive.
|
|
26
|
+
|
|
8
27
|
## [2.0.1] - 2025-01-29
|
|
9
28
|
|
|
10
29
|
### Changed
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
TypeScript SDK for the Proxima Nexus Data Plane API.
|
|
4
4
|
|
|
5
|
-
> **Note:**
|
|
5
|
+
> **Note:** Version 2.0.0 introduced breaking changes. See [CHANGELOG.md](./CHANGELOG.md) for migration details. Version 2.1.0 adds an **Enhanced Client** with a simplified, domain-driven API.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -10,21 +10,51 @@ TypeScript SDK for the Proxima Nexus Data Plane API.
|
|
|
10
10
|
npm install @proxima-nexus/sdk-typescript
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
## Client Options
|
|
14
|
+
|
|
15
|
+
The SDK provides two client options:
|
|
16
|
+
|
|
17
|
+
- **ProximaNexusClient** (base) – Direct mapping to the Data Plane API. Returns Axios promises; you use `.data` on responses.
|
|
18
|
+
- **EnhancedProximaNexusClient** – Higher-level API with simpler method names, unwrapped return values (no `.data`), and domain helpers (e.g. `getFriends`, `searchByDisplayName`). Use `client.base` when you need the raw APIs.
|
|
19
|
+
|
|
13
20
|
## Usage
|
|
14
21
|
|
|
15
|
-
### Basic Setup
|
|
22
|
+
### Basic Setup (Base Client)
|
|
16
23
|
|
|
17
24
|
```typescript
|
|
18
25
|
import { ProximaNexusClient } from '@proxima-nexus/sdk-typescript';
|
|
19
26
|
|
|
20
|
-
// Initialize client
|
|
21
27
|
const client = new ProximaNexusClient({
|
|
22
28
|
apiKey: process.env.PROXIMA_NEXUS_API_KEY!,
|
|
23
29
|
baseURL: 'https://api.proxima-nexus.com',
|
|
24
30
|
});
|
|
25
31
|
```
|
|
26
32
|
|
|
27
|
-
###
|
|
33
|
+
### Enhanced Client (Recommended for New Code)
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { EnhancedProximaNexusClient } from '@proxima-nexus/sdk-typescript';
|
|
37
|
+
|
|
38
|
+
const client = new EnhancedProximaNexusClient({
|
|
39
|
+
apiKey: process.env.PROXIMA_NEXUS_API_KEY!,
|
|
40
|
+
baseURL: 'https://api.proxima-nexus.com',
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Methods return unwrapped data (no .data)
|
|
44
|
+
const user = await client.users.getUser('user-123', 'requester-123'); // UserDto
|
|
45
|
+
const friends = await client.users.getFriends('user-123'); // UserEntityConnectionDto[]
|
|
46
|
+
const users = await client.users.searchByDisplayName('John', undefined, 10);
|
|
47
|
+
|
|
48
|
+
// Friend workflow
|
|
49
|
+
await client.users.sendFriendRequest('alice-id', 'bob-id');
|
|
50
|
+
await client.users.acceptFriendRequest('bob-id', 'alice-id');
|
|
51
|
+
await client.users.removeFriend('alice-id', 'bob-id');
|
|
52
|
+
|
|
53
|
+
// Access raw APIs when needed
|
|
54
|
+
const rawResponse = await client.base.users.get('user-123');
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### User Operations (Base Client)
|
|
28
58
|
|
|
29
59
|
```typescript
|
|
30
60
|
async function main() {
|
|
@@ -124,7 +154,7 @@ async function main() {
|
|
|
124
154
|
}
|
|
125
155
|
```
|
|
126
156
|
|
|
127
|
-
### Event Operations
|
|
157
|
+
### Event Operations (Base Client)
|
|
128
158
|
|
|
129
159
|
```typescript
|
|
130
160
|
async function main() {
|
|
@@ -219,7 +249,7 @@ async function main() {
|
|
|
219
249
|
}
|
|
220
250
|
```
|
|
221
251
|
|
|
222
|
-
### Group Operations
|
|
252
|
+
### Group Operations (Base Client)
|
|
223
253
|
|
|
224
254
|
```typescript
|
|
225
255
|
async function main() {
|
|
@@ -310,9 +340,21 @@ async function main() {
|
|
|
310
340
|
}
|
|
311
341
|
```
|
|
312
342
|
|
|
343
|
+
## Enhanced Client API Overview
|
|
344
|
+
|
|
345
|
+
The enhanced client exposes domain-focused methods:
|
|
346
|
+
|
|
347
|
+
**Users:** `getUser`, `getUsers`, `createUser`, `updateUser`, `deleteUser`, `searchByDisplayName`, `searchByRadius`, `searchByBoundingBox`, `sendFriendRequest`, `acceptFriendRequest`, `declineFriendRequest`, `removeFriend`, `getFriends`, `getPendingFriendRequests`, `blockUser`, `unblockUser`, `getBlockedUsers`, `getEvents`, `getGroups`
|
|
348
|
+
|
|
349
|
+
**Events:** `getEvent`, `getEvents`, `createEvent`, `updateEvent`, `deleteEvent`, `searchByDisplayName`, `searchByRadius`, `searchByBoundingBox`, `addAttendee`, `removeAttendee`, `getAttendees`, `promoteToAdmin`, `demoteToAttendee`, `getAdmins`, `getOwner`
|
|
350
|
+
|
|
351
|
+
**Groups:** `getGroup`, `getGroups`, `createGroup`, `updateGroup`, `deleteGroup`, `searchByDisplayName`, `searchByRadius`, `searchByBoundingBox`, `joinGroup`, `leaveGroup`, `approveMember`, `rejectMember`, `removeMember`, `getMembers`, `getPendingMembers`, `promoteToAdmin`, `demoteToMember`, `getAdmins`, `getOwner`, `getEvents`
|
|
352
|
+
|
|
353
|
+
Errors from the enhanced client are thrown as `NotFoundError`, `UnauthorizedError`, or `ValidationError` (see `src/enhanced/errors.ts`).
|
|
354
|
+
|
|
313
355
|
## Requester User ID
|
|
314
356
|
|
|
315
|
-
In version 2.0.0, the requester user ID is passed as a method parameter (`xProximaNexusRequesterUserId`) rather than in request bodies. This parameter is optional for most operations but required for operations that modify entities (create, update, delete) or when accessing non-public entities.
|
|
357
|
+
In version 2.0.0, the requester user ID is passed as a method parameter (`xProximaNexusRequesterUserId` / `requesterUserId`) rather than in request bodies. This parameter is optional for most operations but required for operations that modify entities (create, update, delete) or when accessing non-public entities.
|
|
316
358
|
|
|
317
359
|
## Configuration
|
|
318
360
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EventApi } from '../api/event-api';
|
|
2
|
+
import type { CreateEventDto, EntityConnectionDto, EventDto, UpdateEventDto, UserEntityConnectionDto } from '../models';
|
|
3
|
+
export declare class EnhancedEventApi {
|
|
4
|
+
private readonly api;
|
|
5
|
+
constructor(api: EventApi);
|
|
6
|
+
getEvent(eventId: string, requesterUserId?: string): Promise<EventDto>;
|
|
7
|
+
getEvents(eventIds: string[], requesterUserId?: string): Promise<EventDto[]>;
|
|
8
|
+
createEvent(creatorUserId: string, data: CreateEventDto): Promise<string>;
|
|
9
|
+
updateEvent(eventId: string, requesterUserId: string, data: UpdateEventDto): Promise<string>;
|
|
10
|
+
deleteEvent(eventId: string, requesterUserId: string): Promise<void>;
|
|
11
|
+
searchByDisplayName(displayName: string, requesterUserId?: string, limit?: number): Promise<EventDto[]>;
|
|
12
|
+
searchByRadius(latitude: number, longitude: number, radiusMeters: number, requesterUserId?: string, limit?: number): Promise<EventDto[]>;
|
|
13
|
+
searchByBoundingBox(minLat: number, maxLat: number, minLng: number, maxLng: number, requesterUserId?: string, limit?: number): Promise<EventDto[]>;
|
|
14
|
+
addAttendee(eventId: string, userId: string, requesterUserId: string): Promise<EntityConnectionDto>;
|
|
15
|
+
removeAttendee(eventId: string, userId: string, requesterUserId: string): Promise<void>;
|
|
16
|
+
getAttendees(eventId: string, requesterUserId?: string): Promise<UserEntityConnectionDto[]>;
|
|
17
|
+
promoteToAdmin(eventId: string, userId: string, requesterUserId: string): Promise<EntityConnectionDto>;
|
|
18
|
+
demoteToAttendee(eventId: string, userId: string, requesterUserId: string): Promise<EntityConnectionDto>;
|
|
19
|
+
getAdmins(eventId: string, requesterUserId?: string): Promise<UserEntityConnectionDto[]>;
|
|
20
|
+
getOwner(eventId: string, requesterUserId?: string): Promise<UserEntityConnectionDto | undefined>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnhancedEventApi = void 0;
|
|
4
|
+
const event_api_1 = require("../api/event-api");
|
|
5
|
+
const mutate_event_entity_connection_dto_1 = require("../models/mutate-event-entity-connection-dto");
|
|
6
|
+
const errors_1 = require("./errors");
|
|
7
|
+
class EnhancedEventApi {
|
|
8
|
+
constructor(api) {
|
|
9
|
+
this.api = api;
|
|
10
|
+
}
|
|
11
|
+
async getEvent(eventId, requesterUserId) {
|
|
12
|
+
return (0, errors_1.unwrap)(this.api.get(eventId, requesterUserId));
|
|
13
|
+
}
|
|
14
|
+
async getEvents(eventIds, requesterUserId) {
|
|
15
|
+
return (0, errors_1.unwrap)(this.api.getBatch({ eventIds }, requesterUserId));
|
|
16
|
+
}
|
|
17
|
+
async createEvent(creatorUserId, data) {
|
|
18
|
+
return (0, errors_1.unwrap)(this.api.create(creatorUserId, data));
|
|
19
|
+
}
|
|
20
|
+
async updateEvent(eventId, requesterUserId, data) {
|
|
21
|
+
return (0, errors_1.unwrap)(this.api.update(eventId, requesterUserId, data));
|
|
22
|
+
}
|
|
23
|
+
async deleteEvent(eventId, requesterUserId) {
|
|
24
|
+
return (0, errors_1.unwrap)(this.api.remove(eventId, requesterUserId));
|
|
25
|
+
}
|
|
26
|
+
async searchByDisplayName(displayName, requesterUserId, limit) {
|
|
27
|
+
return (0, errors_1.unwrap)(this.api.search(displayName, undefined, undefined, undefined, undefined, undefined, undefined, undefined, limit, requesterUserId));
|
|
28
|
+
}
|
|
29
|
+
async searchByRadius(latitude, longitude, radiusMeters, requesterUserId, limit) {
|
|
30
|
+
return (0, errors_1.unwrap)(this.api.search(undefined, latitude, longitude, radiusMeters, undefined, undefined, undefined, undefined, limit, requesterUserId));
|
|
31
|
+
}
|
|
32
|
+
async searchByBoundingBox(minLat, maxLat, minLng, maxLng, requesterUserId, limit) {
|
|
33
|
+
return (0, errors_1.unwrap)(this.api.search(undefined, undefined, undefined, undefined, minLat, maxLat, minLng, maxLng, limit, requesterUserId));
|
|
34
|
+
}
|
|
35
|
+
async addAttendee(eventId, userId, requesterUserId) {
|
|
36
|
+
return (0, errors_1.unwrap)(this.api.addConnection(eventId, userId, requesterUserId, { type: mutate_event_entity_connection_dto_1.MutateEventEntityConnectionDtoTypeEnum.attendee }));
|
|
37
|
+
}
|
|
38
|
+
async removeAttendee(eventId, userId, requesterUserId) {
|
|
39
|
+
return (0, errors_1.unwrap)(this.api.removeConnection(eventId, userId, requesterUserId, { type: mutate_event_entity_connection_dto_1.MutateEventEntityConnectionDtoTypeEnum.attendee }));
|
|
40
|
+
}
|
|
41
|
+
async getAttendees(eventId, requesterUserId) {
|
|
42
|
+
return (0, errors_1.unwrap)(this.api.getConnections(eventId, [event_api_1.EventControllerGetConnectionsTypeEnum.attendee], requesterUserId));
|
|
43
|
+
}
|
|
44
|
+
async promoteToAdmin(eventId, userId, requesterUserId) {
|
|
45
|
+
return (0, errors_1.unwrap)(this.api.addConnection(eventId, userId, requesterUserId, { type: mutate_event_entity_connection_dto_1.MutateEventEntityConnectionDtoTypeEnum.admin }));
|
|
46
|
+
}
|
|
47
|
+
async demoteToAttendee(eventId, userId, requesterUserId) {
|
|
48
|
+
return (0, errors_1.unwrap)(this.api.addConnection(eventId, userId, requesterUserId, { type: mutate_event_entity_connection_dto_1.MutateEventEntityConnectionDtoTypeEnum.attendee }));
|
|
49
|
+
}
|
|
50
|
+
async getAdmins(eventId, requesterUserId) {
|
|
51
|
+
return (0, errors_1.unwrap)(this.api.getConnections(eventId, [event_api_1.EventControllerGetConnectionsTypeEnum.admin], requesterUserId));
|
|
52
|
+
}
|
|
53
|
+
async getOwner(eventId, requesterUserId) {
|
|
54
|
+
const connections = await (0, errors_1.unwrap)(this.api.getConnections(eventId, [event_api_1.EventControllerGetConnectionsTypeEnum.owner], requesterUserId));
|
|
55
|
+
return connections[0];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.EnhancedEventApi = EnhancedEventApi;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { GroupApi } from '../api/group-api';
|
|
2
|
+
import type { CreateGroupDto, EntityConnectionDto, EventEntityConnectionDto, GroupDto, UpdateGroupDto, UserEntityConnectionDto } from '../models';
|
|
3
|
+
export declare class EnhancedGroupApi {
|
|
4
|
+
private readonly api;
|
|
5
|
+
constructor(api: GroupApi);
|
|
6
|
+
getGroup(groupId: string, requesterUserId?: string): Promise<GroupDto>;
|
|
7
|
+
getGroups(groupIds: string[], requesterUserId?: string): Promise<GroupDto[]>;
|
|
8
|
+
createGroup(creatorUserId: string, data: CreateGroupDto): Promise<string>;
|
|
9
|
+
updateGroup(groupId: string, requesterUserId: string, data: UpdateGroupDto): Promise<string>;
|
|
10
|
+
deleteGroup(groupId: string, requesterUserId: string): Promise<void>;
|
|
11
|
+
searchByDisplayName(displayName: string, requesterUserId?: string, limit?: number): Promise<GroupDto[]>;
|
|
12
|
+
searchByRadius(latitude: number, longitude: number, radiusMeters: number, requesterUserId?: string, limit?: number): Promise<GroupDto[]>;
|
|
13
|
+
searchByBoundingBox(minLat: number, maxLat: number, minLng: number, maxLng: number, requesterUserId?: string, limit?: number): Promise<GroupDto[]>;
|
|
14
|
+
joinGroup(groupId: string, userId: string): Promise<EntityConnectionDto>;
|
|
15
|
+
leaveGroup(groupId: string, userId: string): Promise<void>;
|
|
16
|
+
approveMember(groupId: string, userId: string, requesterUserId: string): Promise<EntityConnectionDto>;
|
|
17
|
+
rejectMember(groupId: string, userId: string, requesterUserId: string): Promise<void>;
|
|
18
|
+
removeMember(groupId: string, userId: string, requesterUserId: string): Promise<void>;
|
|
19
|
+
getMembers(groupId: string, requesterUserId?: string): Promise<UserEntityConnectionDto[]>;
|
|
20
|
+
getPendingMembers(groupId: string, requesterUserId?: string): Promise<UserEntityConnectionDto[]>;
|
|
21
|
+
promoteToAdmin(groupId: string, userId: string, requesterUserId: string): Promise<EntityConnectionDto>;
|
|
22
|
+
demoteToMember(groupId: string, userId: string, requesterUserId: string): Promise<EntityConnectionDto>;
|
|
23
|
+
getAdmins(groupId: string, requesterUserId?: string): Promise<UserEntityConnectionDto[]>;
|
|
24
|
+
getOwner(groupId: string, requesterUserId?: string): Promise<UserEntityConnectionDto | undefined>;
|
|
25
|
+
getEvents(groupId: string, requesterUserId?: string): Promise<EventEntityConnectionDto[]>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnhancedGroupApi = void 0;
|
|
4
|
+
const group_api_1 = require("../api/group-api");
|
|
5
|
+
const mutate_group_entity_connection_dto_1 = require("../models/mutate-group-entity-connection-dto");
|
|
6
|
+
const errors_1 = require("./errors");
|
|
7
|
+
class EnhancedGroupApi {
|
|
8
|
+
constructor(api) {
|
|
9
|
+
this.api = api;
|
|
10
|
+
}
|
|
11
|
+
async getGroup(groupId, requesterUserId) {
|
|
12
|
+
return (0, errors_1.unwrap)(this.api.get(groupId, requesterUserId));
|
|
13
|
+
}
|
|
14
|
+
async getGroups(groupIds, requesterUserId) {
|
|
15
|
+
return (0, errors_1.unwrap)(this.api.getBatch({ groupIds }, requesterUserId));
|
|
16
|
+
}
|
|
17
|
+
async createGroup(creatorUserId, data) {
|
|
18
|
+
return (0, errors_1.unwrap)(this.api.create(creatorUserId, data));
|
|
19
|
+
}
|
|
20
|
+
async updateGroup(groupId, requesterUserId, data) {
|
|
21
|
+
return (0, errors_1.unwrap)(this.api.update(groupId, requesterUserId, data));
|
|
22
|
+
}
|
|
23
|
+
async deleteGroup(groupId, requesterUserId) {
|
|
24
|
+
return (0, errors_1.unwrap)(this.api.remove(groupId, requesterUserId));
|
|
25
|
+
}
|
|
26
|
+
async searchByDisplayName(displayName, requesterUserId, limit) {
|
|
27
|
+
return (0, errors_1.unwrap)(this.api.search(displayName, undefined, undefined, undefined, undefined, undefined, undefined, undefined, limit, requesterUserId));
|
|
28
|
+
}
|
|
29
|
+
async searchByRadius(latitude, longitude, radiusMeters, requesterUserId, limit) {
|
|
30
|
+
return (0, errors_1.unwrap)(this.api.search(undefined, latitude, longitude, radiusMeters, undefined, undefined, undefined, undefined, limit, requesterUserId));
|
|
31
|
+
}
|
|
32
|
+
async searchByBoundingBox(minLat, maxLat, minLng, maxLng, requesterUserId, limit) {
|
|
33
|
+
return (0, errors_1.unwrap)(this.api.search(undefined, undefined, undefined, undefined, minLat, maxLat, minLng, maxLng, limit, requesterUserId));
|
|
34
|
+
}
|
|
35
|
+
async joinGroup(groupId, userId) {
|
|
36
|
+
return (0, errors_1.unwrap)(this.api.addConnection(groupId, userId, userId, { type: mutate_group_entity_connection_dto_1.MutateGroupEntityConnectionDtoTypeEnum.member }));
|
|
37
|
+
}
|
|
38
|
+
async leaveGroup(groupId, userId) {
|
|
39
|
+
return (0, errors_1.unwrap)(this.api.removeConnection(groupId, userId, userId, { type: mutate_group_entity_connection_dto_1.MutateGroupEntityConnectionDtoTypeEnum.member }));
|
|
40
|
+
}
|
|
41
|
+
async approveMember(groupId, userId, requesterUserId) {
|
|
42
|
+
return (0, errors_1.unwrap)(this.api.addConnection(groupId, userId, requesterUserId, { type: mutate_group_entity_connection_dto_1.MutateGroupEntityConnectionDtoTypeEnum.member }));
|
|
43
|
+
}
|
|
44
|
+
async rejectMember(groupId, userId, requesterUserId) {
|
|
45
|
+
return (0, errors_1.unwrap)(this.api.removeConnection(groupId, userId, requesterUserId, { type: mutate_group_entity_connection_dto_1.MutateGroupEntityConnectionDtoTypeEnum.member }));
|
|
46
|
+
}
|
|
47
|
+
async removeMember(groupId, userId, requesterUserId) {
|
|
48
|
+
return (0, errors_1.unwrap)(this.api.removeConnection(groupId, userId, requesterUserId, { type: mutate_group_entity_connection_dto_1.MutateGroupEntityConnectionDtoTypeEnum.member }));
|
|
49
|
+
}
|
|
50
|
+
async getMembers(groupId, requesterUserId) {
|
|
51
|
+
return (0, errors_1.unwrap)(this.api.getConnections(groupId, [group_api_1.GroupControllerGetConnectionsStateEnum.active], [group_api_1.GroupControllerGetConnectionsTypeEnum.member], requesterUserId));
|
|
52
|
+
}
|
|
53
|
+
async getPendingMembers(groupId, requesterUserId) {
|
|
54
|
+
return (0, errors_1.unwrap)(this.api.getConnections(groupId, [group_api_1.GroupControllerGetConnectionsStateEnum.requested], [group_api_1.GroupControllerGetConnectionsTypeEnum.member], requesterUserId));
|
|
55
|
+
}
|
|
56
|
+
async promoteToAdmin(groupId, userId, requesterUserId) {
|
|
57
|
+
return (0, errors_1.unwrap)(this.api.addConnection(groupId, userId, requesterUserId, { type: mutate_group_entity_connection_dto_1.MutateGroupEntityConnectionDtoTypeEnum.admin }));
|
|
58
|
+
}
|
|
59
|
+
async demoteToMember(groupId, userId, requesterUserId) {
|
|
60
|
+
return (0, errors_1.unwrap)(this.api.addConnection(groupId, userId, requesterUserId, { type: mutate_group_entity_connection_dto_1.MutateGroupEntityConnectionDtoTypeEnum.member }));
|
|
61
|
+
}
|
|
62
|
+
async getAdmins(groupId, requesterUserId) {
|
|
63
|
+
return (0, errors_1.unwrap)(this.api.getConnections(groupId, [group_api_1.GroupControllerGetConnectionsStateEnum.active], [group_api_1.GroupControllerGetConnectionsTypeEnum.admin], requesterUserId));
|
|
64
|
+
}
|
|
65
|
+
async getOwner(groupId, requesterUserId) {
|
|
66
|
+
const connections = await (0, errors_1.unwrap)(this.api.getConnections(groupId, [group_api_1.GroupControllerGetConnectionsStateEnum.active], [group_api_1.GroupControllerGetConnectionsTypeEnum.owner], requesterUserId));
|
|
67
|
+
return connections[0];
|
|
68
|
+
}
|
|
69
|
+
async getEvents(groupId, requesterUserId) {
|
|
70
|
+
return (0, errors_1.unwrap)(this.api.getEvents(groupId, requesterUserId));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.EnhancedGroupApi = EnhancedGroupApi;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { UserApi } from '../api/user-api';
|
|
2
|
+
import type { CreateUserDto, EntityConnectionDto, EventEntityConnectionDto, GroupEntityConnectionDto, MutateUserResponseDto, UpdateUserDto, UserDto, UserEntityConnectionDto } from '../models';
|
|
3
|
+
export declare class EnhancedUserApi {
|
|
4
|
+
private readonly api;
|
|
5
|
+
constructor(api: UserApi);
|
|
6
|
+
getUser(userId: string, requesterUserId?: string): Promise<UserDto>;
|
|
7
|
+
getUsers(userIds: string[], requesterUserId?: string): Promise<UserDto[]>;
|
|
8
|
+
createUser(data: CreateUserDto): Promise<MutateUserResponseDto>;
|
|
9
|
+
updateUser(userId: string, data: UpdateUserDto, requesterUserId?: string): Promise<MutateUserResponseDto>;
|
|
10
|
+
deleteUser(userId: string, requesterUserId?: string): Promise<void>;
|
|
11
|
+
searchByDisplayName(displayName: string, requesterUserId?: string, limit?: number): Promise<UserDto[]>;
|
|
12
|
+
searchByRadius(latitude: number, longitude: number, radiusMeters: number, requesterUserId?: string, limit?: number): Promise<UserDto[]>;
|
|
13
|
+
searchByBoundingBox(minLat: number, maxLat: number, minLng: number, maxLng: number, requesterUserId?: string, limit?: number): Promise<UserDto[]>;
|
|
14
|
+
sendFriendRequest(fromUserId: string, toUserId: string): Promise<EntityConnectionDto>;
|
|
15
|
+
acceptFriendRequest(userId: string, fromUserId: string): Promise<EntityConnectionDto>;
|
|
16
|
+
declineFriendRequest(userId: string, fromUserId: string): Promise<void>;
|
|
17
|
+
removeFriend(userId: string, friendUserId: string): Promise<void>;
|
|
18
|
+
getFriends(userId: string, requesterUserId?: string): Promise<UserEntityConnectionDto[]>;
|
|
19
|
+
getPendingFriendRequests(userId: string): Promise<UserEntityConnectionDto[]>;
|
|
20
|
+
blockUser(blockingUserId: string, blockedUserId: string): Promise<EntityConnectionDto>;
|
|
21
|
+
unblockUser(blockingUserId: string, blockedUserId: string): Promise<void>;
|
|
22
|
+
getBlockedUsers(userId: string): Promise<UserEntityConnectionDto[]>;
|
|
23
|
+
getEvents(userId: string, requesterUserId?: string): Promise<EventEntityConnectionDto[]>;
|
|
24
|
+
getGroups(userId: string, requesterUserId?: string): Promise<GroupEntityConnectionDto[]>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnhancedUserApi = void 0;
|
|
4
|
+
const user_api_1 = require("../api/user-api");
|
|
5
|
+
const mutate_user_connection_dto_1 = require("../models/mutate-user-connection-dto");
|
|
6
|
+
const errors_1 = require("./errors");
|
|
7
|
+
class EnhancedUserApi {
|
|
8
|
+
constructor(api) {
|
|
9
|
+
this.api = api;
|
|
10
|
+
}
|
|
11
|
+
async getUser(userId, requesterUserId) {
|
|
12
|
+
return (0, errors_1.unwrap)(this.api.get(userId, requesterUserId));
|
|
13
|
+
}
|
|
14
|
+
async getUsers(userIds, requesterUserId) {
|
|
15
|
+
return (0, errors_1.unwrap)(this.api.getBatch({ userIds }, requesterUserId));
|
|
16
|
+
}
|
|
17
|
+
async createUser(data) {
|
|
18
|
+
return (0, errors_1.unwrap)(this.api.create(data));
|
|
19
|
+
}
|
|
20
|
+
async updateUser(userId, data, requesterUserId) {
|
|
21
|
+
const requester = requesterUserId ?? userId;
|
|
22
|
+
return (0, errors_1.unwrap)(this.api.update(userId, requester, data));
|
|
23
|
+
}
|
|
24
|
+
async deleteUser(userId, requesterUserId) {
|
|
25
|
+
const requester = requesterUserId ?? userId;
|
|
26
|
+
return (0, errors_1.unwrap)(this.api.remove(userId, requester));
|
|
27
|
+
}
|
|
28
|
+
async searchByDisplayName(displayName, requesterUserId, limit) {
|
|
29
|
+
return (0, errors_1.unwrap)(this.api.search(displayName, undefined, undefined, undefined, undefined, undefined, undefined, undefined, limit, requesterUserId));
|
|
30
|
+
}
|
|
31
|
+
async searchByRadius(latitude, longitude, radiusMeters, requesterUserId, limit) {
|
|
32
|
+
return (0, errors_1.unwrap)(this.api.search(undefined, latitude, longitude, radiusMeters, undefined, undefined, undefined, undefined, limit, requesterUserId));
|
|
33
|
+
}
|
|
34
|
+
async searchByBoundingBox(minLat, maxLat, minLng, maxLng, requesterUserId, limit) {
|
|
35
|
+
return (0, errors_1.unwrap)(this.api.search(undefined, undefined, undefined, undefined, minLat, maxLat, minLng, maxLng, limit, requesterUserId));
|
|
36
|
+
}
|
|
37
|
+
async sendFriendRequest(fromUserId, toUserId) {
|
|
38
|
+
return (0, errors_1.unwrap)(this.api.putConnection(fromUserId, toUserId, fromUserId, { type: mutate_user_connection_dto_1.MutateUserConnectionDtoTypeEnum.friend }));
|
|
39
|
+
}
|
|
40
|
+
async acceptFriendRequest(userId, fromUserId) {
|
|
41
|
+
return (0, errors_1.unwrap)(this.api.putConnection(userId, fromUserId, userId, { type: mutate_user_connection_dto_1.MutateUserConnectionDtoTypeEnum.friend }));
|
|
42
|
+
}
|
|
43
|
+
async declineFriendRequest(userId, fromUserId) {
|
|
44
|
+
return (0, errors_1.unwrap)(this.api.deleteConnection(userId, fromUserId, user_api_1.UserControllerDeleteConnectionTypeEnum.friend, userId));
|
|
45
|
+
}
|
|
46
|
+
async removeFriend(userId, friendUserId) {
|
|
47
|
+
return (0, errors_1.unwrap)(this.api.deleteConnection(userId, friendUserId, user_api_1.UserControllerDeleteConnectionTypeEnum.friend, userId));
|
|
48
|
+
}
|
|
49
|
+
async getFriends(userId, requesterUserId) {
|
|
50
|
+
return (0, errors_1.unwrap)(this.api.getConnections(userId, [user_api_1.UserControllerGetConnectionsStateEnum.active], [user_api_1.UserControllerGetConnectionsTypeEnum.friend], requesterUserId ?? userId));
|
|
51
|
+
}
|
|
52
|
+
async getPendingFriendRequests(userId) {
|
|
53
|
+
return (0, errors_1.unwrap)(this.api.getConnections(userId, [user_api_1.UserControllerGetConnectionsStateEnum.requested], [user_api_1.UserControllerGetConnectionsTypeEnum.friend], userId));
|
|
54
|
+
}
|
|
55
|
+
async blockUser(blockingUserId, blockedUserId) {
|
|
56
|
+
return (0, errors_1.unwrap)(this.api.putConnection(blockingUserId, blockedUserId, blockingUserId, { type: mutate_user_connection_dto_1.MutateUserConnectionDtoTypeEnum.blocked }));
|
|
57
|
+
}
|
|
58
|
+
async unblockUser(blockingUserId, blockedUserId) {
|
|
59
|
+
return (0, errors_1.unwrap)(this.api.deleteConnection(blockingUserId, blockedUserId, user_api_1.UserControllerDeleteConnectionTypeEnum.blocked, blockingUserId));
|
|
60
|
+
}
|
|
61
|
+
async getBlockedUsers(userId) {
|
|
62
|
+
return (0, errors_1.unwrap)(this.api.getConnections(userId, [user_api_1.UserControllerGetConnectionsStateEnum.blocked], [user_api_1.UserControllerGetConnectionsTypeEnum.blocked], userId));
|
|
63
|
+
}
|
|
64
|
+
async getEvents(userId, requesterUserId) {
|
|
65
|
+
return (0, errors_1.unwrap)(this.api.getEvents(userId, requesterUserId));
|
|
66
|
+
}
|
|
67
|
+
async getGroups(userId, requesterUserId) {
|
|
68
|
+
return (0, errors_1.unwrap)(this.api.getGroups(userId, requesterUserId));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.EnhancedUserApi = EnhancedUserApi;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error classes for the enhanced SDK client.
|
|
3
|
+
* Axios errors are transformed into these domain-specific errors.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Base class for enhanced client errors.
|
|
7
|
+
*/
|
|
8
|
+
export declare class EnhancedClientError extends Error {
|
|
9
|
+
readonly statusCode?: number | undefined;
|
|
10
|
+
readonly cause?: unknown | undefined;
|
|
11
|
+
constructor(message: string, statusCode?: number | undefined, cause?: unknown | undefined);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Thrown when an entity is not found (HTTP 404).
|
|
15
|
+
*/
|
|
16
|
+
export declare class NotFoundError extends EnhancedClientError {
|
|
17
|
+
constructor(message?: string, statusCode?: number, cause?: unknown);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Thrown when the user lacks permission (HTTP 401 or 403).
|
|
21
|
+
*/
|
|
22
|
+
export declare class UnauthorizedError extends EnhancedClientError {
|
|
23
|
+
constructor(message?: string, statusCode?: number, cause?: unknown);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Thrown for invalid parameters or validation failures (HTTP 400 or 422).
|
|
27
|
+
*/
|
|
28
|
+
export declare class ValidationError extends EnhancedClientError {
|
|
29
|
+
constructor(message?: string, statusCode?: number, cause?: unknown);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Transforms an axios error into an enhanced client error.
|
|
33
|
+
*/
|
|
34
|
+
export declare function transformAxiosError(error: unknown): never;
|
|
35
|
+
/**
|
|
36
|
+
* Unwraps an axios response and transforms errors.
|
|
37
|
+
*/
|
|
38
|
+
export declare function unwrap<T>(promise: Promise<{
|
|
39
|
+
data: T;
|
|
40
|
+
}>): Promise<T>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Custom error classes for the enhanced SDK client.
|
|
4
|
+
* Axios errors are transformed into these domain-specific errors.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ValidationError = exports.UnauthorizedError = exports.NotFoundError = exports.EnhancedClientError = void 0;
|
|
8
|
+
exports.transformAxiosError = transformAxiosError;
|
|
9
|
+
exports.unwrap = unwrap;
|
|
10
|
+
/**
|
|
11
|
+
* Base class for enhanced client errors.
|
|
12
|
+
*/
|
|
13
|
+
class EnhancedClientError extends Error {
|
|
14
|
+
constructor(message, statusCode, cause) {
|
|
15
|
+
super(message);
|
|
16
|
+
this.statusCode = statusCode;
|
|
17
|
+
this.cause = cause;
|
|
18
|
+
this.name = this.constructor.name;
|
|
19
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.EnhancedClientError = EnhancedClientError;
|
|
23
|
+
/**
|
|
24
|
+
* Thrown when an entity is not found (HTTP 404).
|
|
25
|
+
*/
|
|
26
|
+
class NotFoundError extends EnhancedClientError {
|
|
27
|
+
constructor(message = 'Resource not found', statusCode = 404, cause) {
|
|
28
|
+
super(message, statusCode, cause);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.NotFoundError = NotFoundError;
|
|
32
|
+
/**
|
|
33
|
+
* Thrown when the user lacks permission (HTTP 401 or 403).
|
|
34
|
+
*/
|
|
35
|
+
class UnauthorizedError extends EnhancedClientError {
|
|
36
|
+
constructor(message = 'Unauthorized', statusCode = 401, cause) {
|
|
37
|
+
super(message, statusCode, cause);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
41
|
+
/**
|
|
42
|
+
* Thrown for invalid parameters or validation failures (HTTP 400 or 422).
|
|
43
|
+
*/
|
|
44
|
+
class ValidationError extends EnhancedClientError {
|
|
45
|
+
constructor(message = 'Validation failed', statusCode, cause) {
|
|
46
|
+
super(message, statusCode, cause);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.ValidationError = ValidationError;
|
|
50
|
+
/**
|
|
51
|
+
* Transforms an axios error into an enhanced client error.
|
|
52
|
+
*/
|
|
53
|
+
function transformAxiosError(error) {
|
|
54
|
+
if (error && typeof error === 'object' && 'isAxiosError' in error) {
|
|
55
|
+
const axiosError = error;
|
|
56
|
+
const status = axiosError.response?.status;
|
|
57
|
+
const message = typeof axiosError.response?.data === 'object' &&
|
|
58
|
+
axiosError.response?.data !== null &&
|
|
59
|
+
'message' in axiosError.response.data
|
|
60
|
+
? String(axiosError.response.data.message)
|
|
61
|
+
: axiosError.message ?? 'Request failed';
|
|
62
|
+
if (status === 404) {
|
|
63
|
+
throw new NotFoundError(message, status, error);
|
|
64
|
+
}
|
|
65
|
+
if (status === 401 || status === 403) {
|
|
66
|
+
throw new UnauthorizedError(message, status ?? 401, error);
|
|
67
|
+
}
|
|
68
|
+
if (status === 400 || status === 422) {
|
|
69
|
+
throw new ValidationError(message, status, error);
|
|
70
|
+
}
|
|
71
|
+
throw new EnhancedClientError(message, status, error);
|
|
72
|
+
}
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Unwraps an axios response and transforms errors.
|
|
77
|
+
*/
|
|
78
|
+
async function unwrap(promise) {
|
|
79
|
+
try {
|
|
80
|
+
const response = await promise;
|
|
81
|
+
return response.data;
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
transformAxiosError(error);
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { EnhancedUserApi } from './enhanced-user-api';
|
|
2
|
+
import { EnhancedEventApi } from './enhanced-event-api';
|
|
3
|
+
import { EnhancedGroupApi } from './enhanced-group-api';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the enhanced client (same shape as ProximaNexusClientConfig).
|
|
6
|
+
* Defined here to avoid circular dependency with main index.
|
|
7
|
+
*/
|
|
8
|
+
export interface EnhancedClientConfig {
|
|
9
|
+
baseURL?: string;
|
|
10
|
+
apiKey: string;
|
|
11
|
+
timeout?: number;
|
|
12
|
+
axiosConfig?: any;
|
|
13
|
+
}
|
|
14
|
+
export { EnhancedUserApi } from './enhanced-user-api';
|
|
15
|
+
export { EnhancedEventApi } from './enhanced-event-api';
|
|
16
|
+
export { EnhancedGroupApi } from './enhanced-group-api';
|
|
17
|
+
export { NotFoundError, UnauthorizedError, ValidationError, EnhancedClientError, transformAxiosError, unwrap, } from './errors';
|
|
18
|
+
export type { EnhancedClientError as EnhancedClientErrorType } from './errors';
|
|
19
|
+
export * from './types';
|
|
20
|
+
/**
|
|
21
|
+
* Enhanced Proxima Nexus client with a simplified, domain-driven API.
|
|
22
|
+
* Wraps the base APIs and provides cleaner method signatures and convenience methods.
|
|
23
|
+
* Use `client.base` to access the raw APIs when needed.
|
|
24
|
+
*
|
|
25
|
+
* Accepts either EnhancedClientConfig or a ProximaNexusClient instance for base.
|
|
26
|
+
*/
|
|
27
|
+
export declare class EnhancedProximaNexusClient {
|
|
28
|
+
readonly users: EnhancedUserApi;
|
|
29
|
+
readonly events: EnhancedEventApi;
|
|
30
|
+
readonly groups: EnhancedGroupApi;
|
|
31
|
+
readonly base: InstanceType<typeof import('../index').ProximaNexusClient>;
|
|
32
|
+
constructor(configOrBase: EnhancedClientConfig | InstanceType<typeof import('../index').ProximaNexusClient>);
|
|
33
|
+
}
|
|
34
|
+
export default EnhancedProximaNexusClient;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.EnhancedProximaNexusClient = exports.unwrap = exports.transformAxiosError = exports.EnhancedClientError = exports.ValidationError = exports.UnauthorizedError = exports.NotFoundError = exports.EnhancedGroupApi = exports.EnhancedEventApi = exports.EnhancedUserApi = void 0;
|
|
18
|
+
const enhanced_user_api_1 = require("./enhanced-user-api");
|
|
19
|
+
const enhanced_event_api_1 = require("./enhanced-event-api");
|
|
20
|
+
const enhanced_group_api_1 = require("./enhanced-group-api");
|
|
21
|
+
var enhanced_user_api_2 = require("./enhanced-user-api");
|
|
22
|
+
Object.defineProperty(exports, "EnhancedUserApi", { enumerable: true, get: function () { return enhanced_user_api_2.EnhancedUserApi; } });
|
|
23
|
+
var enhanced_event_api_2 = require("./enhanced-event-api");
|
|
24
|
+
Object.defineProperty(exports, "EnhancedEventApi", { enumerable: true, get: function () { return enhanced_event_api_2.EnhancedEventApi; } });
|
|
25
|
+
var enhanced_group_api_2 = require("./enhanced-group-api");
|
|
26
|
+
Object.defineProperty(exports, "EnhancedGroupApi", { enumerable: true, get: function () { return enhanced_group_api_2.EnhancedGroupApi; } });
|
|
27
|
+
var errors_1 = require("./errors");
|
|
28
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return errors_1.NotFoundError; } });
|
|
29
|
+
Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return errors_1.UnauthorizedError; } });
|
|
30
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_1.ValidationError; } });
|
|
31
|
+
Object.defineProperty(exports, "EnhancedClientError", { enumerable: true, get: function () { return errors_1.EnhancedClientError; } });
|
|
32
|
+
Object.defineProperty(exports, "transformAxiosError", { enumerable: true, get: function () { return errors_1.transformAxiosError; } });
|
|
33
|
+
Object.defineProperty(exports, "unwrap", { enumerable: true, get: function () { return errors_1.unwrap; } });
|
|
34
|
+
__exportStar(require("./types"), exports);
|
|
35
|
+
/**
|
|
36
|
+
* Enhanced Proxima Nexus client with a simplified, domain-driven API.
|
|
37
|
+
* Wraps the base APIs and provides cleaner method signatures and convenience methods.
|
|
38
|
+
* Use `client.base` to access the raw APIs when needed.
|
|
39
|
+
*
|
|
40
|
+
* Accepts either EnhancedClientConfig or a ProximaNexusClient instance for base.
|
|
41
|
+
*/
|
|
42
|
+
class EnhancedProximaNexusClient {
|
|
43
|
+
constructor(configOrBase) {
|
|
44
|
+
const isConfig = typeof configOrBase.apiKey === 'string';
|
|
45
|
+
if (isConfig) {
|
|
46
|
+
const config = configOrBase;
|
|
47
|
+
// Dynamic import to break cycle: main index will export EnhancedProximaNexusClient
|
|
48
|
+
// and we need ProximaNexusClient here. We construct base client from same config.
|
|
49
|
+
const { ProximaNexusClient } = require('../index');
|
|
50
|
+
this.base = new ProximaNexusClient(config);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.base = configOrBase;
|
|
54
|
+
}
|
|
55
|
+
const userApi = this.base.users;
|
|
56
|
+
const eventApi = this.base.events;
|
|
57
|
+
const groupApi = this.base.groups;
|
|
58
|
+
this.users = new enhanced_user_api_1.EnhancedUserApi(userApi);
|
|
59
|
+
this.events = new enhanced_event_api_1.EnhancedEventApi(eventApi);
|
|
60
|
+
this.groups = new enhanced_group_api_1.EnhancedGroupApi(groupApi);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.EnhancedProximaNexusClient = EnhancedProximaNexusClient;
|
|
64
|
+
exports.default = EnhancedProximaNexusClient;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types and interfaces for the enhanced SDK client.
|
|
3
|
+
* Re-exports model types for convenience; no additional interfaces needed
|
|
4
|
+
* as we use the existing DTOs from the base API.
|
|
5
|
+
*/
|
|
6
|
+
export type { CreateUserDto, UpdateUserDto, MutateUserResponseDto, CreateEventDto, UpdateEventDto, CreateGroupDto, UpdateGroupDto, UserDto, EventDto, GroupDto, EntityConnectionDto, UserEntityConnectionDto, EventEntityConnectionDto, GroupEntityConnectionDto, GetUsersDto, GetEventsDto, GetGroupsDto, } from '../models';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared types and interfaces for the enhanced SDK client.
|
|
4
|
+
* Re-exports model types for convenience; no additional interfaces needed
|
|
5
|
+
* as we use the existing DTOs from the base API.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/index.d.ts
CHANGED
|
@@ -36,3 +36,5 @@ export declare class ProximaNexusClient {
|
|
|
36
36
|
constructor(config: ProximaNexusClientConfig);
|
|
37
37
|
}
|
|
38
38
|
export default ProximaNexusClient;
|
|
39
|
+
export { EnhancedProximaNexusClient, EnhancedUserApi, EnhancedEventApi, EnhancedGroupApi, NotFoundError, UnauthorizedError, ValidationError, EnhancedClientError, transformAxiosError, unwrap, type EnhancedClientConfig, } from './enhanced';
|
|
40
|
+
export type { EnhancedClientError as EnhancedClientErrorType } from './enhanced';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ProximaNexusClient = exports.Configuration = exports.GroupApi = exports.EventApi = exports.UserApi = void 0;
|
|
17
|
+
exports.unwrap = exports.transformAxiosError = exports.EnhancedClientError = exports.ValidationError = exports.UnauthorizedError = exports.NotFoundError = exports.EnhancedGroupApi = exports.EnhancedEventApi = exports.EnhancedUserApi = exports.EnhancedProximaNexusClient = exports.ProximaNexusClient = exports.Configuration = exports.GroupApi = exports.EventApi = exports.UserApi = void 0;
|
|
18
18
|
const configuration_1 = require("./configuration");
|
|
19
19
|
Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_1.Configuration; } });
|
|
20
20
|
const user_api_1 = require("./api/user-api");
|
|
@@ -42,3 +42,15 @@ class ProximaNexusClient {
|
|
|
42
42
|
}
|
|
43
43
|
exports.ProximaNexusClient = ProximaNexusClient;
|
|
44
44
|
exports.default = ProximaNexusClient;
|
|
45
|
+
// Enhanced client (separate export path to avoid circular dependency in enhanced module)
|
|
46
|
+
var enhanced_1 = require("./enhanced");
|
|
47
|
+
Object.defineProperty(exports, "EnhancedProximaNexusClient", { enumerable: true, get: function () { return enhanced_1.EnhancedProximaNexusClient; } });
|
|
48
|
+
Object.defineProperty(exports, "EnhancedUserApi", { enumerable: true, get: function () { return enhanced_1.EnhancedUserApi; } });
|
|
49
|
+
Object.defineProperty(exports, "EnhancedEventApi", { enumerable: true, get: function () { return enhanced_1.EnhancedEventApi; } });
|
|
50
|
+
Object.defineProperty(exports, "EnhancedGroupApi", { enumerable: true, get: function () { return enhanced_1.EnhancedGroupApi; } });
|
|
51
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return enhanced_1.NotFoundError; } });
|
|
52
|
+
Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return enhanced_1.UnauthorizedError; } });
|
|
53
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return enhanced_1.ValidationError; } });
|
|
54
|
+
Object.defineProperty(exports, "EnhancedClientError", { enumerable: true, get: function () { return enhanced_1.EnhancedClientError; } });
|
|
55
|
+
Object.defineProperty(exports, "transformAxiosError", { enumerable: true, get: function () { return enhanced_1.transformAxiosError; } });
|
|
56
|
+
Object.defineProperty(exports, "unwrap", { enumerable: true, get: function () { return enhanced_1.unwrap; } });
|