@proxima-nexus/sdk-typescript 2.0.0 → 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 CHANGED
@@ -5,6 +5,31 @@ 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
+
27
+ ## [2.0.1] - 2025-01-29
28
+
29
+ ### Changed
30
+
31
+ - Updated README.md to reflect version 2.0.0 API changes, including method renames, updated method signatures, and connection operation examples
32
+
8
33
  ## [2.0.0] - 2025-01-29
9
34
 
10
35
  ### Breaking Changes
package/README.md CHANGED
@@ -2,115 +2,147 @@
2
2
 
3
3
  TypeScript SDK for the Proxima Nexus Data Plane API.
4
4
 
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
+
5
7
  ## Installation
6
8
 
7
9
  ```bash
8
10
  npm install @proxima-nexus/sdk-typescript
9
11
  ```
10
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
+
11
20
  ## Usage
12
21
 
13
- ### Basic Setup
22
+ ### Basic Setup (Base Client)
14
23
 
15
24
  ```typescript
16
25
  import { ProximaNexusClient } from '@proxima-nexus/sdk-typescript';
17
26
 
18
- // Initialize client
19
27
  const client = new ProximaNexusClient({
20
28
  apiKey: process.env.PROXIMA_NEXUS_API_KEY!,
21
29
  baseURL: 'https://api.proxima-nexus.com',
22
30
  });
23
31
  ```
24
32
 
25
- ### User Operations
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)
26
58
 
27
59
  ```typescript
28
60
  async function main() {
29
61
  try {
30
62
  // Create a user
31
63
  const createResponse = await client.users.create({
32
- createUserDto: {
33
- userId: 'user-123',
34
- displayName: 'John Doe',
35
- requesterUserId: 'requester-123',
36
- visibility: 'public',
37
- gender: 'male',
38
- birthDate: '1990-01-01',
39
- location: {
40
- latitude: 40.7128,
41
- longitude: -74.006,
42
- name: 'New York, NY'
43
- }
44
- },
64
+ userId: 'user-123',
65
+ displayName: 'John Doe',
66
+ visibility: 'public',
67
+ gender: 'male',
68
+ birthDate: '1990-01-01',
69
+ location: {
70
+ latitude: 40.7128,
71
+ longitude: -74.006,
72
+ name: 'New York, NY'
73
+ }
45
74
  });
46
75
  console.log('Created user:', createResponse.data);
47
76
 
48
77
  // Search users
49
- const searchResponse = await client.users.search({
50
- displayName: 'John',
51
- latitude: 40.7128,
52
- longitude: -74.006,
53
- radius: 5000,
54
- limit: 10,
55
- });
78
+ const searchResponse = await client.users.search(
79
+ 'John', // displayName
80
+ 40.7128, // latitude
81
+ -74.006, // longitude
82
+ 5000, // radius
83
+ undefined, // minLatitude
84
+ undefined, // maxLatitude
85
+ undefined, // minLongitude
86
+ undefined, // maxLongitude
87
+ 10, // limit
88
+ 'requester-123' // xProximaNexusRequesterUserId (optional)
89
+ );
56
90
  console.log('Found users:', searchResponse.data);
57
91
 
58
92
  // Get user by ID
59
- const user = await client.users.findOne({
60
- userId: 'user-123',
61
- });
93
+ const user = await client.users.get('user-123', 'requester-123');
62
94
  console.log('User details:', user.data);
63
95
 
64
96
  // Update a user
65
- const updated = await client.users.update({
66
- userId: 'user-123',
67
- updateUserDto: {
68
- requesterUserId: 'requester-123',
97
+ const updated = await client.users.update(
98
+ 'user-123',
99
+ 'requester-123',
100
+ {
69
101
  displayName: 'John Smith',
70
102
  gender: 'male',
71
103
  birthDate: '1990-01-01',
72
- },
73
- });
104
+ }
105
+ );
74
106
  console.log('Updated user:', updated.data);
75
107
 
76
108
  // Delete a user
77
- await client.users.remove({
78
- userId: 'user-123',
79
- });
109
+ await client.users.remove('user-123', 'requester-123');
80
110
 
81
111
  // Get a batch of users
82
- const batchUsers = await client.users.getBatch({
83
- getUsersDto: {
84
- userIds: ['user-1', 'user-2', 'user-3'],
85
- },
86
- });
112
+ const batchUsers = await client.users.getBatch(
113
+ { userIds: ['user-1', 'user-2', 'user-3'] },
114
+ 'requester-123'
115
+ );
87
116
  console.log('Batch users:', batchUsers.data);
88
117
 
89
- // Friend operations
90
- const friends = await client.users.getFriends({
91
- userId: 'user-123',
92
- });
93
- console.log('Friends:', friends.data);
94
-
95
- await client.users.addFriend({
96
- userId: 'user-123',
97
- friendUserId: 'friend-456',
98
- });
99
-
100
- await client.users.removeFriend({
101
- userId: 'user-123',
102
- friendUserId: 'friend-456',
103
- });
118
+ // Connection operations
119
+ const connections = await client.users.getConnections(
120
+ 'user-123',
121
+ undefined, // state filter (optional)
122
+ undefined, // type filter (optional)
123
+ 'requester-123' // xProximaNexusRequesterUserId (optional)
124
+ );
125
+ console.log('Connections:', connections.data);
126
+
127
+ await client.users.putConnection(
128
+ 'user-123',
129
+ 'friend-456',
130
+ 'requester-123',
131
+ { type: 'friend' } // MutateUserConnectionDto
132
+ );
133
+
134
+ await client.users.deleteConnection(
135
+ 'user-123',
136
+ 'friend-456',
137
+ 'friend', // type: 'friend' | 'blocked'
138
+ 'requester-123'
139
+ );
104
140
 
105
141
  // Get user's groups and events
106
- const groups = await client.users.getGroups({
107
- userId: 'user-123',
108
- });
142
+ const groups = await client.users.getGroups('user-123', 'requester-123');
109
143
  console.log('User groups:', groups.data);
110
144
 
111
- const events = await client.users.getEvents({
112
- userId: 'user-123',
113
- });
145
+ const events = await client.users.getEvents('user-123', 'requester-123');
114
146
  console.log('User events:', events.data);
115
147
  } catch (error: any) {
116
148
  console.error('API Error:', error.message);
@@ -122,84 +154,91 @@ async function main() {
122
154
  }
123
155
  ```
124
156
 
125
- ### Event Operations
157
+ ### Event Operations (Base Client)
126
158
 
127
159
  ```typescript
128
160
  async function main() {
129
161
  try {
130
162
  // Create an event
131
163
  const event = await client.events.create({
132
- createEventDto: {
133
- eventId: 'event-123',
134
- displayName: 'Tech Meetup',
135
- requesterUserId: 'user-123',
136
- visibility: 'public',
137
- startTime: '2024-12-01T18:00:00Z',
138
- endTime: '2024-12-01T22:00:00Z',
139
- type: 'meetup',
140
- location: {
141
- latitude: 40.7128,
142
- longitude: -74.006,
143
- name: 'New York, NY'
144
- },
145
- description: 'Monthly tech meetup',
164
+ eventId: 'event-123',
165
+ displayName: 'Tech Meetup',
166
+ visibility: 'public',
167
+ startTime: '2024-12-01T18:00:00Z',
168
+ endTime: '2024-12-01T22:00:00Z',
169
+ type: 'meetup',
170
+ location: {
171
+ latitude: 40.7128,
172
+ longitude: -74.006,
173
+ name: 'New York, NY'
146
174
  },
175
+ description: 'Monthly tech meetup',
147
176
  });
148
177
  console.log('Created event:', event.data);
149
178
 
150
179
  // Search events
151
- const events = await client.events.search({
152
- displayName: 'Tech',
153
- latitude: 40.7128,
154
- longitude: -74.006,
155
- radius: 10000,
156
- limit: 50,
157
- });
180
+ const events = await client.events.search(
181
+ 'Tech', // displayName
182
+ 40.7128, // latitude
183
+ -74.006, // longitude
184
+ 10000, // radius
185
+ undefined, // minLatitude
186
+ undefined, // maxLatitude
187
+ undefined, // minLongitude
188
+ undefined, // maxLongitude
189
+ 50, // limit
190
+ 'user-123' // xProximaNexusRequesterUserId (optional)
191
+ );
158
192
  console.log('Found events:', events.data);
159
193
 
160
194
  // Get an event by ID
161
- const eventDetails = await client.events.findOne({
162
- eventId: 'event-123',
163
- });
195
+ const eventDetails = await client.events.get('event-123', 'user-123');
164
196
  console.log('Event details:', eventDetails.data);
165
197
 
166
198
  // Update an event
167
- const updatedEvent = await client.events.update({
168
- eventId: 'event-123',
169
- updateEventDto: {
170
- requesterUserId: 'user-123',
199
+ const updatedEvent = await client.events.update(
200
+ 'event-123',
201
+ 'user-123',
202
+ {
171
203
  displayName: 'Tech Meetup 2024',
172
204
  startTime: '2024-12-01T18:00:00Z',
173
205
  endTime: '2024-12-01T23:00:00Z',
174
206
  type: 'meetup',
175
- },
176
- });
207
+ }
208
+ );
177
209
  console.log('Updated event:', updatedEvent.data);
178
210
 
179
211
  // Delete an event
180
- await client.events.remove({
181
- eventId: 'event-123',
182
- requesterUserId: 'user-123',
183
- });
212
+ await client.events.remove('event-123', 'user-123');
184
213
 
185
214
  // Get a batch of events
186
- const batchEvents = await client.events.getBatch({
187
- getEventsDto: {
188
- eventIds: ['event-1', 'event-2', 'event-3'],
189
- },
190
- });
215
+ const batchEvents = await client.events.getBatch(
216
+ { eventIds: ['event-1', 'event-2', 'event-3'] },
217
+ 'user-123'
218
+ );
191
219
  console.log('Batch events:', batchEvents.data);
192
220
 
193
- // Attendee operations
194
- const attendees = await client.events.getAttendees({
195
- eventId: 'event-123',
196
- });
197
- console.log('Attendees:', attendees.data);
198
-
199
- await client.events.addAttendee({
200
- eventId: 'event-123',
201
- userId: 'user-456',
202
- });
221
+ // Connection operations
222
+ const connections = await client.events.getConnections(
223
+ 'event-123',
224
+ undefined, // type filter (optional)
225
+ 'user-123' // xProximaNexusRequesterUserId (optional)
226
+ );
227
+ console.log('Connections:', connections.data);
228
+
229
+ await client.events.addConnection(
230
+ 'event-123',
231
+ 'user-456',
232
+ 'user-123',
233
+ { type: 'attendee' } // MutateEventEntityConnectionDto
234
+ );
235
+
236
+ await client.events.removeConnection(
237
+ 'event-123',
238
+ 'user-456',
239
+ 'user-123',
240
+ { type: 'attendee' } // MutateEventEntityConnectionDto
241
+ );
203
242
  } catch (error: any) {
204
243
  console.error('API Error:', error.message);
205
244
  if (error.response) {
@@ -210,85 +249,86 @@ async function main() {
210
249
  }
211
250
  ```
212
251
 
213
- ### Group Operations
252
+ ### Group Operations (Base Client)
214
253
 
215
254
  ```typescript
216
255
  async function main() {
217
256
  try {
218
257
  // Create a group
219
258
  const group = await client.groups.create({
220
- createGroupDto: {
221
- groupId: 'group-123',
222
- displayName: 'Music Lovers',
223
- requesterUserId: 'user-123',
224
- visibility: 'public',
225
- type: 'club',
226
- description: 'A group for music enthusiasts',
227
- },
259
+ groupId: 'group-123',
260
+ displayName: 'Music Lovers',
261
+ visibility: 'public',
262
+ type: 'open', // enum: 'open' | 'request' | 'invite'
263
+ description: 'A group for music enthusiasts',
228
264
  });
229
265
  console.log('Created group:', group.data);
230
266
 
231
267
  // Search groups
232
- const groups = await client.groups.search({
233
- displayName: 'Music',
234
- latitude: 40.7128,
235
- longitude: -74.006,
236
- radius: 5000,
237
- limit: 100,
238
- });
268
+ const groups = await client.groups.search(
269
+ 'Music', // displayName
270
+ 40.7128, // latitude
271
+ -74.006, // longitude
272
+ 5000, // radius
273
+ undefined, // minLatitude
274
+ undefined, // maxLatitude
275
+ undefined, // minLongitude
276
+ undefined, // maxLongitude
277
+ 100, // limit
278
+ 'user-123' // xProximaNexusRequesterUserId (optional)
279
+ );
239
280
  console.log('Found groups:', groups.data);
240
281
 
241
282
  // Get a group by ID
242
- const groupDetails = await client.groups.findOne({
243
- groupId: 'group-123',
244
- });
283
+ const groupDetails = await client.groups.get('group-123', 'user-123');
245
284
  console.log('Group details:', groupDetails.data);
246
285
 
247
286
  // Update a group
248
- const updatedGroup = await client.groups.update({
249
- groupId: 'group-123',
250
- updateGroupDto: {
251
- requesterUserId: 'user-123',
287
+ const updatedGroup = await client.groups.update(
288
+ 'group-123',
289
+ 'user-123',
290
+ {
252
291
  displayName: 'Music Enthusiasts',
253
- type: 'club',
254
- },
255
- });
292
+ type: 'open',
293
+ }
294
+ );
256
295
  console.log('Updated group:', updatedGroup.data);
257
296
 
258
297
  // Delete a group
259
- await client.groups.remove({
260
- groupId: 'group-123',
261
- requesterUserId: 'user-123',
262
- });
298
+ await client.groups.remove('group-123', 'user-123');
263
299
 
264
300
  // Get a batch of groups
265
- const batchGroups = await client.groups.getBatch({
266
- getGroupsDto: {
267
- groupIds: ['group-1', 'group-2', 'group-3'],
268
- },
269
- });
301
+ const batchGroups = await client.groups.getBatch(
302
+ { groupIds: ['group-1', 'group-2', 'group-3'] },
303
+ 'user-123'
304
+ );
270
305
  console.log('Batch groups:', batchGroups.data);
271
306
 
272
- // Member operations
273
- const members = await client.groups.getMembers({
274
- groupId: 'group-123',
275
- });
276
- console.log('Members:', members.data);
277
-
278
- await client.groups.addMember({
279
- groupId: 'group-123',
280
- userId: 'user-456',
281
- });
282
-
283
- await client.groups.removeMember({
284
- groupId: 'group-123',
285
- userId: 'user-456',
286
- });
307
+ // Connection operations
308
+ const connections = await client.groups.getConnections(
309
+ 'group-123',
310
+ undefined, // state filter (optional)
311
+ undefined, // type filter (optional)
312
+ 'user-123' // xProximaNexusRequesterUserId (optional)
313
+ );
314
+ console.log('Connections:', connections.data);
315
+
316
+ await client.groups.addConnection(
317
+ 'group-123',
318
+ 'user-456',
319
+ 'user-123',
320
+ { type: 'member' } // MutateGroupEntityConnectionDto
321
+ );
322
+
323
+ await client.groups.removeConnection(
324
+ 'group-123',
325
+ 'user-456',
326
+ 'user-123',
327
+ { type: 'member' } // MutateGroupEntityConnectionDto
328
+ );
287
329
 
288
330
  // Get group's events
289
- const groupEvents = await client.groups.getEvents({
290
- groupId: 'group-123',
291
- });
331
+ const groupEvents = await client.groups.getEvents('group-123', 'user-123');
292
332
  console.log('Group events:', groupEvents.data);
293
333
  } catch (error: any) {
294
334
  console.error('API Error:', error.message);
@@ -300,6 +340,22 @@ async function main() {
300
340
  }
301
341
  ```
302
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
+
355
+ ## Requester User ID
356
+
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.
358
+
303
359
  ## Configuration
304
360
 
305
361
  The `ProximaNexusClientConfig` interface supports the following options:
@@ -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; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proxima-nexus/sdk-typescript",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "TypeScript SDK for Proxima Nexus Data Plane API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",