@js4cytoscape/ndex-client 0.5.0-alpha.9 → 0.6.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +339 -13
- package/dist/.tsbuildinfo +1 -0
- package/dist/index.d.mts +1906 -0
- package/dist/index.d.ts +1906 -0
- package/dist/index.global.js +9 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +80 -21
- package/src/CyNDEx.js.bak +178 -0
- package/src/NDEx.js +66 -13
- package/src/NDEx.js.bak +1107 -0
- package/src/index.ts +230 -0
- package/src/models/CX2Network.ts +423 -0
- package/src/services/AdminService.ts +10 -0
- package/src/services/CyNDExService.ts +338 -0
- package/src/services/FilesService.ts +234 -0
- package/src/services/HTTPService.ts +442 -0
- package/src/services/NetworkServiceV2.ts +427 -0
- package/src/services/NetworkServiceV3.ts +288 -0
- package/src/services/UnifiedNetworkService.ts +641 -0
- package/src/services/UserService.ts +233 -0
- package/src/services/WorkspaceService.ts +159 -0
- package/src/types/cytoscape.ts +81 -0
- package/src/types/index.ts +524 -0
- package/dist/ndexClient.common.js +0 -1057
- package/dist/ndexClient.js +0 -538
- package/src/index.js +0 -2
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1906 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Type definitions for CyNDEx (Cytoscape-NDEx Bridge) operations
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Configuration for CyNDEx service
|
|
8
|
+
*/
|
|
9
|
+
interface CyNDExConfig {
|
|
10
|
+
/** Port number for Cytoscape REST API (default: 1234) */
|
|
11
|
+
port?: number;
|
|
12
|
+
/** Base URL for Cytoscape REST API (default: 'http://127.0.0.1') */
|
|
13
|
+
cyRestBaseURL?: string;
|
|
14
|
+
/** NDEx server base URL (default: 'https://www.ndexbio.org') */
|
|
15
|
+
ndexBaseURL?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Authentication configuration for NDEx operations
|
|
19
|
+
* This is used as parameters passed to Cytoscape for NDEx authentication
|
|
20
|
+
*/
|
|
21
|
+
interface CyNDExAuthConfig {
|
|
22
|
+
type: 'basic' | 'oauth';
|
|
23
|
+
username?: string;
|
|
24
|
+
password?: string;
|
|
25
|
+
idToken?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Parameters for importing NDEx network to Cytoscape
|
|
29
|
+
*/
|
|
30
|
+
interface NDExImportParams {
|
|
31
|
+
serverUrl: string;
|
|
32
|
+
uuid: string;
|
|
33
|
+
accessKey?: string;
|
|
34
|
+
createView?: boolean;
|
|
35
|
+
username?: string;
|
|
36
|
+
password?: string;
|
|
37
|
+
idToken?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Parameters for exporting Cytoscape network to NDEx
|
|
41
|
+
*/
|
|
42
|
+
interface NDExExportParams {
|
|
43
|
+
serverUrl: string;
|
|
44
|
+
uuid?: string;
|
|
45
|
+
username?: string;
|
|
46
|
+
password?: string;
|
|
47
|
+
idToken?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Cytoscape network summary response
|
|
51
|
+
*/
|
|
52
|
+
interface CytoscapeNetworkSummary {
|
|
53
|
+
suid?: string;
|
|
54
|
+
title?: string;
|
|
55
|
+
name?: string;
|
|
56
|
+
nodeCount?: number;
|
|
57
|
+
edgeCount?: number;
|
|
58
|
+
selected?: boolean;
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* CyNDEx status response
|
|
63
|
+
*/
|
|
64
|
+
interface CyNDExStatusResponse {
|
|
65
|
+
version?: string;
|
|
66
|
+
status?: string;
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* CX2 import parameters for Cytoscape
|
|
71
|
+
*/
|
|
72
|
+
interface CX2ImportParams {
|
|
73
|
+
format: 'cx2';
|
|
74
|
+
collection?: string;
|
|
75
|
+
title?: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Core type definitions for NDEx Client Library
|
|
80
|
+
* Pragmatic TypeScript types allowing flexibility with any types where needed
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
interface BasicAuth {
|
|
84
|
+
type: 'basic';
|
|
85
|
+
username: string;
|
|
86
|
+
password: string;
|
|
87
|
+
}
|
|
88
|
+
interface OAuthAuth {
|
|
89
|
+
type: 'oauth';
|
|
90
|
+
idToken: string;
|
|
91
|
+
}
|
|
92
|
+
interface NDExAuthResponse {
|
|
93
|
+
token?: string;
|
|
94
|
+
userId?: string;
|
|
95
|
+
userName?: string;
|
|
96
|
+
isAdmin?: boolean;
|
|
97
|
+
permissions?: string[];
|
|
98
|
+
expirationTime?: number;
|
|
99
|
+
}
|
|
100
|
+
interface NDExUser {
|
|
101
|
+
externalId: string;
|
|
102
|
+
userName: string;
|
|
103
|
+
firstName?: string;
|
|
104
|
+
lastName?: string;
|
|
105
|
+
emailAddress?: string;
|
|
106
|
+
website?: string;
|
|
107
|
+
description?: string;
|
|
108
|
+
image?: string;
|
|
109
|
+
isIndividual?: boolean;
|
|
110
|
+
isVerified?: boolean;
|
|
111
|
+
creationTime?: number;
|
|
112
|
+
modificationTime?: number;
|
|
113
|
+
}
|
|
114
|
+
interface CX1MetaDataItem {
|
|
115
|
+
name: string;
|
|
116
|
+
elementCount: number;
|
|
117
|
+
version: string;
|
|
118
|
+
idCounter?: number;
|
|
119
|
+
[key: string]: any;
|
|
120
|
+
}
|
|
121
|
+
interface CX1MetaDataResponse {
|
|
122
|
+
metaData: CX1MetaDataItem[];
|
|
123
|
+
}
|
|
124
|
+
interface CX1NetworkProperty {
|
|
125
|
+
predicateString: string;
|
|
126
|
+
value: string;
|
|
127
|
+
dataType?: 'string' | 'integer' | 'double' | 'boolean' | 'list_of_string';
|
|
128
|
+
}
|
|
129
|
+
interface CX2NetworkProperties {
|
|
130
|
+
[key: string]: {
|
|
131
|
+
t: string;
|
|
132
|
+
v: any;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
declare enum NetworkIndexLevel {
|
|
136
|
+
NONE = "NONE",
|
|
137
|
+
BASIC = "BASIC",
|
|
138
|
+
FULL = "FULL"
|
|
139
|
+
}
|
|
140
|
+
interface NetworkSummaryV2 {
|
|
141
|
+
externalId: string;
|
|
142
|
+
name: string;
|
|
143
|
+
description?: string;
|
|
144
|
+
nodeCount: number;
|
|
145
|
+
edgeCount: number;
|
|
146
|
+
visibility: 'PUBLIC' | 'PRIVATE';
|
|
147
|
+
owner: string;
|
|
148
|
+
ownerUUID: string;
|
|
149
|
+
creationTime: number;
|
|
150
|
+
modificationTime: number;
|
|
151
|
+
version?: string;
|
|
152
|
+
properties?: CX1NetworkProperty[];
|
|
153
|
+
isReadOnly: boolean;
|
|
154
|
+
isValid: boolean;
|
|
155
|
+
warnings?: string[];
|
|
156
|
+
hasLayout: boolean;
|
|
157
|
+
hasSample: boolean;
|
|
158
|
+
updatedBy: string;
|
|
159
|
+
errorMessage?: string;
|
|
160
|
+
cxFormat?: string;
|
|
161
|
+
cxFileSize?: number;
|
|
162
|
+
cx2FileSize?: number;
|
|
163
|
+
isShowcase?: boolean;
|
|
164
|
+
isCompleted?: boolean;
|
|
165
|
+
doi?: string;
|
|
166
|
+
isCertified?: boolean;
|
|
167
|
+
indexLevel?: NetworkIndexLevel;
|
|
168
|
+
parentDirUUID?: string;
|
|
169
|
+
showInTrash?: boolean;
|
|
170
|
+
subnetworkIds?: string[];
|
|
171
|
+
reference?: string;
|
|
172
|
+
organism?: string;
|
|
173
|
+
disease?: string;
|
|
174
|
+
tissue?: string;
|
|
175
|
+
networkType?: string[];
|
|
176
|
+
rightsHolder?: string;
|
|
177
|
+
rights?: string;
|
|
178
|
+
sourceFormat?: string;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* NetworkSummaryV3 - Network summary for NDEx API v3
|
|
182
|
+
*
|
|
183
|
+
* Extends NetworkSummaryV2 but uses CX2-style properties format instead of CX1 format.
|
|
184
|
+
* The main difference is in how network properties are structured:
|
|
185
|
+
*
|
|
186
|
+
* | Aspect | NetworkSummaryV2 | NetworkSummaryV3 |
|
|
187
|
+
* |--------|------------------|------------------|
|
|
188
|
+
* | **Properties Format** | `CX1NetworkProperty[]` (array) | `CX2NetworkProperties` (object) |
|
|
189
|
+
* | **Structure** | CX1-style array of property objects | CX2-style key-value map |
|
|
190
|
+
* | **Example** | `[{predicateString: "name", value: "My Network"}]` | `{name: {t: "string", v: "My Network"}}` |
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```typescript
|
|
194
|
+
* // V2 properties format (array of objects)
|
|
195
|
+
* const v2Summary: NetworkSummaryV2 = {
|
|
196
|
+
* externalId: "12345",
|
|
197
|
+
* name: "Sample Network",
|
|
198
|
+
* properties: [
|
|
199
|
+
* { predicateString: "description", value: "A sample network", dataType: "string" },
|
|
200
|
+
* { predicateString: "nodeCount", value: "100", dataType: "integer" }
|
|
201
|
+
* ]
|
|
202
|
+
* };
|
|
203
|
+
*
|
|
204
|
+
* // V3 properties format (object map)
|
|
205
|
+
* const v3Summary: NetworkSummaryV3 = {
|
|
206
|
+
* externalId: "12345",
|
|
207
|
+
* name: "Sample Network",
|
|
208
|
+
* properties: {
|
|
209
|
+
* description: { t: "string", v: "A sample network" },
|
|
210
|
+
* nodeCount: { t: "integer", v: 100 }
|
|
211
|
+
* }
|
|
212
|
+
* };
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
interface NetworkSummaryV3 extends Omit<NetworkSummaryV2, 'properties'> {
|
|
216
|
+
properties?: CX2NetworkProperties;
|
|
217
|
+
}
|
|
218
|
+
interface NetworkPermission {
|
|
219
|
+
uuid: string;
|
|
220
|
+
permission: 'READ' | 'WRITE' | 'ADMIN';
|
|
221
|
+
memberUUID: string;
|
|
222
|
+
memberAccountName?: string;
|
|
223
|
+
resourceUUID: string;
|
|
224
|
+
}
|
|
225
|
+
interface CX2Network$1 {
|
|
226
|
+
CXVersion: string;
|
|
227
|
+
hasFragments: boolean;
|
|
228
|
+
metaData: CX2MetaData[];
|
|
229
|
+
attributeDeclarations?: CX2AttributeDeclarations;
|
|
230
|
+
networkAttributes?: CX2NetworkAttribute[];
|
|
231
|
+
nodes?: CX2Node[];
|
|
232
|
+
edges?: CX2Edge[];
|
|
233
|
+
nodeBypass?: CX2NodeBypass[];
|
|
234
|
+
edgeBypass?: CX2EdgeBypass[];
|
|
235
|
+
visualProperties?: CX2VisualProperty;
|
|
236
|
+
status?: CX2Status[];
|
|
237
|
+
}
|
|
238
|
+
interface CX2MetaData {
|
|
239
|
+
name: string;
|
|
240
|
+
elementCount?: number;
|
|
241
|
+
}
|
|
242
|
+
interface CX2AttributeDeclarations {
|
|
243
|
+
[aspectName: string]: {
|
|
244
|
+
[attributeName: string]: {
|
|
245
|
+
d: string;
|
|
246
|
+
a?: string;
|
|
247
|
+
v?: any;
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
interface CX2AttributeSpec {
|
|
252
|
+
d: string;
|
|
253
|
+
v?: any;
|
|
254
|
+
s?: boolean;
|
|
255
|
+
}
|
|
256
|
+
interface CX2NetworkAttribute {
|
|
257
|
+
[key: string]: any;
|
|
258
|
+
}
|
|
259
|
+
interface CX2Node {
|
|
260
|
+
id: number;
|
|
261
|
+
x?: number;
|
|
262
|
+
y?: number;
|
|
263
|
+
z?: number;
|
|
264
|
+
v?: Record<string, any>;
|
|
265
|
+
}
|
|
266
|
+
interface CX2Edge {
|
|
267
|
+
id: number;
|
|
268
|
+
s: number;
|
|
269
|
+
t: number;
|
|
270
|
+
v?: Record<string, any>;
|
|
271
|
+
}
|
|
272
|
+
interface CX1Edge {
|
|
273
|
+
[key: string]: any;
|
|
274
|
+
}
|
|
275
|
+
interface CX2NodeBypass {
|
|
276
|
+
id: number;
|
|
277
|
+
v: VisualPropertyTable;
|
|
278
|
+
}
|
|
279
|
+
interface CX2EdgeBypass {
|
|
280
|
+
id: number;
|
|
281
|
+
v: VisualPropertyTable;
|
|
282
|
+
}
|
|
283
|
+
/**
|
|
284
|
+
* Visual Property Mapping Types
|
|
285
|
+
*/
|
|
286
|
+
declare type VPMappingType = 'DISCRETE' | 'CONTINUOUS' | 'PASSTHROUGH';
|
|
287
|
+
/**
|
|
288
|
+
* Mapping Definition for visual property mappings
|
|
289
|
+
* Note: Using flexible typing for mapping definitions as they vary by type
|
|
290
|
+
*/
|
|
291
|
+
interface MappingDefinition {
|
|
292
|
+
mapppingList?: Array<Record<string, any>>;
|
|
293
|
+
[key: string]: any;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Visual Property Mapping structure
|
|
297
|
+
*/
|
|
298
|
+
interface VisualPropertyMapping {
|
|
299
|
+
type: VPMappingType;
|
|
300
|
+
definition: MappingDefinition;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Visual Property Table - holds visual property values
|
|
304
|
+
* Equivalent to server-side VisualPropertyTable class
|
|
305
|
+
*/
|
|
306
|
+
interface VisualPropertyTable {
|
|
307
|
+
[visualPropertyName: string]: any;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Table Column Visual Style - for individual visual properties
|
|
311
|
+
*/
|
|
312
|
+
interface TableColumnVisualStyle {
|
|
313
|
+
default?: any;
|
|
314
|
+
mapping?: VisualPropertyMapping;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Default Visual Properties structure
|
|
318
|
+
*/
|
|
319
|
+
interface DefaultVisualProperties {
|
|
320
|
+
edge?: VisualPropertyTable;
|
|
321
|
+
network?: Record<string, any>;
|
|
322
|
+
node?: VisualPropertyTable;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* CX2 Visual Property - Main visual properties aspect
|
|
326
|
+
* Equivalent to server-side CxVisualProperty class
|
|
327
|
+
*/
|
|
328
|
+
interface CX2VisualProperty {
|
|
329
|
+
default?: DefaultVisualProperties;
|
|
330
|
+
edgeMapping?: Record<string, VisualPropertyMapping>;
|
|
331
|
+
nodeMapping?: Record<string, VisualPropertyMapping>;
|
|
332
|
+
}
|
|
333
|
+
interface CX2Status {
|
|
334
|
+
error?: string;
|
|
335
|
+
success?: boolean;
|
|
336
|
+
}
|
|
337
|
+
interface SearchResult {
|
|
338
|
+
numFound: number;
|
|
339
|
+
start: number;
|
|
340
|
+
networks: NetworkSummaryV2[] | NetworkSummaryV3[];
|
|
341
|
+
}
|
|
342
|
+
interface SearchParameters {
|
|
343
|
+
searchString?: string;
|
|
344
|
+
accountName?: string;
|
|
345
|
+
permission?: string;
|
|
346
|
+
includeGroups?: boolean;
|
|
347
|
+
admin?: string;
|
|
348
|
+
start?: number;
|
|
349
|
+
size?: number;
|
|
350
|
+
source?: string;
|
|
351
|
+
}
|
|
352
|
+
interface ExportFormat {
|
|
353
|
+
format: 'CX' | 'CX2' | 'XGMML' | 'SIF' | 'GRAPHML';
|
|
354
|
+
version?: string;
|
|
355
|
+
}
|
|
356
|
+
interface ExportRequest {
|
|
357
|
+
networkUUID: string;
|
|
358
|
+
format: ExportFormat;
|
|
359
|
+
accesskey?: string;
|
|
360
|
+
}
|
|
361
|
+
interface Task {
|
|
362
|
+
externalId: string;
|
|
363
|
+
taskType: string;
|
|
364
|
+
status: 'submitted' | 'processing' | 'completed' | 'failed';
|
|
365
|
+
progress?: number;
|
|
366
|
+
message?: string;
|
|
367
|
+
resource?: string;
|
|
368
|
+
startTime?: number;
|
|
369
|
+
finishTime?: number;
|
|
370
|
+
attributes?: Record<string, any>;
|
|
371
|
+
}
|
|
372
|
+
interface NDExClientConfig {
|
|
373
|
+
baseURL?: string;
|
|
374
|
+
timeout?: number;
|
|
375
|
+
retries?: number;
|
|
376
|
+
retryDelay?: number;
|
|
377
|
+
debug?: boolean;
|
|
378
|
+
headers?: Record<string, string>;
|
|
379
|
+
auth?: BasicAuth | OAuthAuth;
|
|
380
|
+
}
|
|
381
|
+
interface APIResponse<T = any> {
|
|
382
|
+
data?: T;
|
|
383
|
+
errorCode?: string;
|
|
384
|
+
message?: string;
|
|
385
|
+
description?: string;
|
|
386
|
+
stackTrace?: string;
|
|
387
|
+
timeStamp?: number;
|
|
388
|
+
}
|
|
389
|
+
interface APIError {
|
|
390
|
+
errorCode: string;
|
|
391
|
+
message: string;
|
|
392
|
+
description?: string;
|
|
393
|
+
stackTrace?: string;
|
|
394
|
+
timeStamp?: number;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Base error class for all NDEx API errors
|
|
398
|
+
*/
|
|
399
|
+
declare class NDExError extends Error {
|
|
400
|
+
statusCode?: number;
|
|
401
|
+
errorCode?: string;
|
|
402
|
+
description?: string;
|
|
403
|
+
constructor(message: string, statusCode?: number, errorCode?: string, description?: string);
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Error thrown when network or request fails
|
|
407
|
+
*/
|
|
408
|
+
declare class NDExNetworkError extends NDExError {
|
|
409
|
+
originalError?: Error;
|
|
410
|
+
constructor(message: string, originalError?: Error);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Error thrown when authentication fails
|
|
414
|
+
*/
|
|
415
|
+
declare class NDExAuthError extends NDExError {
|
|
416
|
+
constructor(message?: string, statusCode?: number);
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Error thrown when requested resource is not found
|
|
420
|
+
*/
|
|
421
|
+
declare class NDExNotFoundError extends NDExError {
|
|
422
|
+
constructor(message?: string, statusCode?: number);
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Error thrown when request validation fails
|
|
426
|
+
*/
|
|
427
|
+
declare class NDExValidationError extends NDExError {
|
|
428
|
+
constructor(message: string, statusCode?: number);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Error thrown when server encounters an internal error
|
|
432
|
+
*/
|
|
433
|
+
declare class NDExServerError extends NDExError {
|
|
434
|
+
constructor(message?: string, statusCode?: number);
|
|
435
|
+
}
|
|
436
|
+
declare type UUID = string;
|
|
437
|
+
declare type Timestamp = number;
|
|
438
|
+
declare type NDExAny = any;
|
|
439
|
+
interface PaginationParams {
|
|
440
|
+
start?: number;
|
|
441
|
+
size?: number;
|
|
442
|
+
}
|
|
443
|
+
interface AccessParams {
|
|
444
|
+
accesskey?: string;
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* CyWeb workspace object structure
|
|
448
|
+
*/
|
|
449
|
+
interface CyWebWorkspace {
|
|
450
|
+
externalId?: string;
|
|
451
|
+
name: string;
|
|
452
|
+
description?: string;
|
|
453
|
+
networkIds?: string[];
|
|
454
|
+
[key: string]: any;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Network access key response structure
|
|
458
|
+
*/
|
|
459
|
+
interface AccessKeyResponse {
|
|
460
|
+
accessKey: string | null;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Valid actions for updating access keys
|
|
464
|
+
*/
|
|
465
|
+
declare type AccessKeyAction = 'enable' | 'disable';
|
|
466
|
+
/**
|
|
467
|
+
* NDEx object update status - returned from network creation and update operations
|
|
468
|
+
* Corresponds to server-side NdexObjectUpdateStatus class
|
|
469
|
+
*/
|
|
470
|
+
interface NDExObjectUpdateStatus {
|
|
471
|
+
uuid: string;
|
|
472
|
+
modificationTime: number;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* HTTPService - Core HTTP client for NDEx API communication
|
|
477
|
+
* Handles v2/v3 endpoint routing, authentication, and error handling
|
|
478
|
+
*
|
|
479
|
+
* @note User-Agent header is set to 'NDEx-JS-Client/${version}' but only works in Node.js.
|
|
480
|
+
* Browsers will ignore custom User-Agent headers for security reasons.
|
|
481
|
+
* @internal
|
|
482
|
+
*/
|
|
483
|
+
declare class HTTPService {
|
|
484
|
+
private axiosInstance;
|
|
485
|
+
private config;
|
|
486
|
+
constructor(config?: NDExClientConfig);
|
|
487
|
+
/**
|
|
488
|
+
* Get authentication headers based on config.auth
|
|
489
|
+
*/
|
|
490
|
+
private getAuthHeaders;
|
|
491
|
+
/**
|
|
492
|
+
* Build API endpoint URL with version routing
|
|
493
|
+
*/
|
|
494
|
+
private buildUrl;
|
|
495
|
+
/**
|
|
496
|
+
* Generic GET request with intelligent version routing
|
|
497
|
+
*/
|
|
498
|
+
get<T = any>(endpoint: string, config?: AxiosRequestConfig & {
|
|
499
|
+
version?: 'v2' | 'v3';
|
|
500
|
+
}): Promise<T>;
|
|
501
|
+
/**
|
|
502
|
+
* Generic POST request with intelligent version routing
|
|
503
|
+
*/
|
|
504
|
+
post<T = any>(endpoint: string, data?: any, config?: AxiosRequestConfig & {
|
|
505
|
+
version?: 'v2' | 'v3';
|
|
506
|
+
}): Promise<T>;
|
|
507
|
+
/**
|
|
508
|
+
* Generic PUT request with intelligent version routing
|
|
509
|
+
*/
|
|
510
|
+
put<T = any>(endpoint: string, data?: any, config?: AxiosRequestConfig & {
|
|
511
|
+
version?: 'v2' | 'v3';
|
|
512
|
+
}): Promise<T>;
|
|
513
|
+
/**
|
|
514
|
+
* Generic DELETE request with intelligent version routing
|
|
515
|
+
*/
|
|
516
|
+
delete<T = any>(endpoint: string, config?: AxiosRequestConfig & {
|
|
517
|
+
version?: 'v2' | 'v3';
|
|
518
|
+
}): Promise<T>;
|
|
519
|
+
uploadFile<T = any>(endpoint: string, file: File | Blob | Buffer | string, options?: {
|
|
520
|
+
contentType?: string;
|
|
521
|
+
onProgress?: (progress: number) => void;
|
|
522
|
+
version?: 'v2' | 'v3';
|
|
523
|
+
}): Promise<T>;
|
|
524
|
+
/**
|
|
525
|
+
* Setup axios interceptors for debugging and retry logic
|
|
526
|
+
*/
|
|
527
|
+
private setupInterceptors;
|
|
528
|
+
/**
|
|
529
|
+
* Handle successful API responses
|
|
530
|
+
*/
|
|
531
|
+
private handleResponse;
|
|
532
|
+
/**
|
|
533
|
+
* Handle API errors by throwing appropriate NDEx error types
|
|
534
|
+
*/
|
|
535
|
+
private handleError;
|
|
536
|
+
/**
|
|
537
|
+
* Throw appropriate NDEx error based on status code
|
|
538
|
+
*/
|
|
539
|
+
private throwNDExError;
|
|
540
|
+
/**
|
|
541
|
+
* Update client configuration
|
|
542
|
+
*/
|
|
543
|
+
updateConfig(newConfig: Partial<NDExClientConfig>): void;
|
|
544
|
+
/**
|
|
545
|
+
* Get current configuration
|
|
546
|
+
*/
|
|
547
|
+
getConfig(): NDExClientConfig;
|
|
548
|
+
/**
|
|
549
|
+
* Get current authentication type
|
|
550
|
+
* @returns The type of authentication configured ('basic' | 'oauth'), or undefined if no auth is configured
|
|
551
|
+
*/
|
|
552
|
+
getAuthType(): 'basic' | 'oauth' | undefined;
|
|
553
|
+
/**
|
|
554
|
+
* Get ID token from OAuth authentication
|
|
555
|
+
* @returns The ID token if OAuth auth is configured, undefined otherwise
|
|
556
|
+
*/
|
|
557
|
+
getIdToken(): string | undefined;
|
|
558
|
+
/**
|
|
559
|
+
* Set ID token for OAuth authentication
|
|
560
|
+
* Creates OAuth auth configuration if no auth is currently configured
|
|
561
|
+
* @param idToken - The ID token to set
|
|
562
|
+
*/
|
|
563
|
+
setIdToken(idToken: string): void;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* CX2Network - Modern representation of CX2 format networks
|
|
568
|
+
* Provides utilities for creating, manipulating, and validating CX2 networks
|
|
569
|
+
*/
|
|
570
|
+
declare class CX2Network implements CX2Network$1 {
|
|
571
|
+
CXVersion: string;
|
|
572
|
+
hasFragments: boolean;
|
|
573
|
+
metaData: CX2MetaData[];
|
|
574
|
+
attributeDeclarations?: CX2AttributeDeclarations;
|
|
575
|
+
networkAttributes?: CX2NetworkAttribute[];
|
|
576
|
+
nodes?: CX2Node[];
|
|
577
|
+
edges?: CX2Edge[];
|
|
578
|
+
nodeBypass?: CX2NodeBypass[];
|
|
579
|
+
edgeBypass?: CX2EdgeBypass[];
|
|
580
|
+
visualProperties?: CX2VisualProperty;
|
|
581
|
+
status?: any[];
|
|
582
|
+
constructor(data?: Partial<CX2Network$1>);
|
|
583
|
+
/**
|
|
584
|
+
* Create a new empty CX2Network
|
|
585
|
+
*/
|
|
586
|
+
static createEmpty(): CX2Network;
|
|
587
|
+
/**
|
|
588
|
+
* Create CX2Network from raw JSON data
|
|
589
|
+
*/
|
|
590
|
+
static fromJSON(json: string | object): CX2Network;
|
|
591
|
+
/**
|
|
592
|
+
* Create CX2Network from NetworkSummary (for compatibility)
|
|
593
|
+
*/
|
|
594
|
+
static fromNetworkSummary(summary: NetworkSummaryV3): CX2Network;
|
|
595
|
+
/**
|
|
596
|
+
* Add a node to the network
|
|
597
|
+
*/
|
|
598
|
+
addNode(id: number, attributes?: Record<string, any>): CX2Node;
|
|
599
|
+
/**
|
|
600
|
+
* Add an edge to the network
|
|
601
|
+
*/
|
|
602
|
+
addEdge(id: number, sourceId: number, targetId: number, attributes?: Record<string, any>): CX2Edge;
|
|
603
|
+
/**
|
|
604
|
+
* Add an individual node attribute
|
|
605
|
+
*/
|
|
606
|
+
addNodeAttribute(nodeId: number, attributeName: string, value: any): void;
|
|
607
|
+
/**
|
|
608
|
+
* Add edge attributes (bulk)
|
|
609
|
+
*/
|
|
610
|
+
addEdgeAttribute(edgeId: number, attributeName: string, value: any): void;
|
|
611
|
+
/**
|
|
612
|
+
* Set node coordinates
|
|
613
|
+
*/
|
|
614
|
+
setNodeCoordinates(nodeId: number, x: number, y: number, z?: number): void;
|
|
615
|
+
/**
|
|
616
|
+
* Get node by ID
|
|
617
|
+
*/
|
|
618
|
+
getNode(id: number): CX2Node | undefined;
|
|
619
|
+
/**
|
|
620
|
+
* Get edge by ID
|
|
621
|
+
*/
|
|
622
|
+
getEdge(id: number): CX2Edge | undefined;
|
|
623
|
+
/**
|
|
624
|
+
* Get all nodes
|
|
625
|
+
*/
|
|
626
|
+
getNodes(): CX2Node[];
|
|
627
|
+
/**
|
|
628
|
+
* Get all edges
|
|
629
|
+
*/
|
|
630
|
+
getEdges(): CX2Edge[];
|
|
631
|
+
/**
|
|
632
|
+
* Get node count
|
|
633
|
+
*/
|
|
634
|
+
getNodeCount(): number;
|
|
635
|
+
/**
|
|
636
|
+
* Get edge count
|
|
637
|
+
*/
|
|
638
|
+
getEdgeCount(): number;
|
|
639
|
+
/**
|
|
640
|
+
* Get network name from attributes
|
|
641
|
+
*/
|
|
642
|
+
getNetworkName(): string | undefined;
|
|
643
|
+
/**
|
|
644
|
+
* Set network name
|
|
645
|
+
*/
|
|
646
|
+
setNetworkName(name: string): void;
|
|
647
|
+
/**
|
|
648
|
+
* Get network attribute by key
|
|
649
|
+
*/
|
|
650
|
+
getNetworkAttribute(key: string): any;
|
|
651
|
+
/**
|
|
652
|
+
* Set network attribute
|
|
653
|
+
*/
|
|
654
|
+
setNetworkAttribute(key: string, value: any): void;
|
|
655
|
+
/**
|
|
656
|
+
* Validate the CX2 network structure
|
|
657
|
+
*/
|
|
658
|
+
validate(): {
|
|
659
|
+
isValid: boolean;
|
|
660
|
+
errors: string[];
|
|
661
|
+
};
|
|
662
|
+
/**
|
|
663
|
+
* Convert to JSON string
|
|
664
|
+
*/
|
|
665
|
+
toJSON(): string;
|
|
666
|
+
/**
|
|
667
|
+
* Create a deep copy of the network
|
|
668
|
+
*/
|
|
669
|
+
clone(): CX2Network;
|
|
670
|
+
/**
|
|
671
|
+
* Get basic statistics about the network
|
|
672
|
+
*/
|
|
673
|
+
getStatistics(): {
|
|
674
|
+
nodeCount: number;
|
|
675
|
+
edgeCount: number;
|
|
676
|
+
hasCoordinates: boolean;
|
|
677
|
+
hasVisualProperties: boolean;
|
|
678
|
+
};
|
|
679
|
+
/**
|
|
680
|
+
* Ensure required metadata is present
|
|
681
|
+
*/
|
|
682
|
+
private ensureRequiredMetadata;
|
|
683
|
+
/**
|
|
684
|
+
* Update node count in metadata
|
|
685
|
+
*/
|
|
686
|
+
private updateNodeCount;
|
|
687
|
+
/**
|
|
688
|
+
* Update edge count in metadata
|
|
689
|
+
*/
|
|
690
|
+
private updateEdgeCount;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* NetworkServiceV3 - NDEx API v3 network operations
|
|
695
|
+
* Handles modern v3 endpoints with native CX2 support
|
|
696
|
+
*/
|
|
697
|
+
declare class NetworkServiceV3 {
|
|
698
|
+
private http;
|
|
699
|
+
constructor(http: HTTPService);
|
|
700
|
+
/**
|
|
701
|
+
* Get network summary by UUID
|
|
702
|
+
*/
|
|
703
|
+
getNetworkSummary(networkUUID: string, options?: AccessParams): Promise<NetworkSummaryV3>;
|
|
704
|
+
/**
|
|
705
|
+
* Get raw network in CX2 format (native V3)
|
|
706
|
+
*
|
|
707
|
+
* Returns raw CX2 data which may contain fragmented aspects that need to be assembled
|
|
708
|
+
* into a complete CX2 network model for proper usage. The returned data follows the
|
|
709
|
+
* CX2 specification but may have aspects split across multiple fragments.
|
|
710
|
+
* For a fully assembled network object with utility methods, use getNetworkAsCX2Object() instead.
|
|
711
|
+
*
|
|
712
|
+
* @param networkUUID - The UUID of the network to retrieve
|
|
713
|
+
* @param options - Access options including optional access key
|
|
714
|
+
* @returns Promise resolving to raw CX2 network data that may be fragmented
|
|
715
|
+
*/
|
|
716
|
+
getRawCX2Network(networkUUID: string, options?: AccessParams): Promise<CX2Network$1>;
|
|
717
|
+
/**
|
|
718
|
+
* Create network DOI
|
|
719
|
+
*
|
|
720
|
+
* @param networkUUID - The UUID of the network to create a DOI for
|
|
721
|
+
* @param key - DOI creation key
|
|
722
|
+
* @param email - Email address for DOI registration
|
|
723
|
+
* @returns Promise resolving to a confirmation message string from the server
|
|
724
|
+
*/
|
|
725
|
+
createNetworkDOI(networkUUID: string, key: string, email: string): Promise<string>;
|
|
726
|
+
/**
|
|
727
|
+
* Get attributes of selected nodes
|
|
728
|
+
*
|
|
729
|
+
* Retrieves specific attributes for a set of nodes in a network. The server will return
|
|
730
|
+
* a 404 error if the network has no attributes on nodes.
|
|
731
|
+
*
|
|
732
|
+
* @param networkUUID - The UUID of the network
|
|
733
|
+
* @param nodeSelection - Object containing node IDs and attribute names to retrieve
|
|
734
|
+
* @param nodeSelection.ids - Array of node IDs (long numbers) to get attributes for
|
|
735
|
+
* @param nodeSelection.attributeNames - Array of attribute names to retrieve
|
|
736
|
+
* @param options - Access options including optional access key
|
|
737
|
+
* @returns Promise resolving to a JSON object where keys are stringified node IDs
|
|
738
|
+
* and values are the selected attributes for that node
|
|
739
|
+
* @throws {404} When the network has no attributes on nodes
|
|
740
|
+
*/
|
|
741
|
+
getAttributesOfSelectedNodes(networkUUID: string, nodeSelection: {
|
|
742
|
+
ids: number[];
|
|
743
|
+
attributeNames: string[];
|
|
744
|
+
}, options?: AccessParams): Promise<Record<string, any>>;
|
|
745
|
+
/**
|
|
746
|
+
* Get network summaries by UUIDs using V3 API (migrated from original NDEx.js)
|
|
747
|
+
*
|
|
748
|
+
* Retrieves network summaries for multiple networks in a single batch request using V3 API.
|
|
749
|
+
* Uses the V3 API batch endpoint with format parameter support.
|
|
750
|
+
*
|
|
751
|
+
* @param uuidList - Array of network UUIDs to retrieve summaries for
|
|
752
|
+
* @param accessKey - Optional access key for private networks
|
|
753
|
+
* @param format - Summary format ("FULL" by default, can be "BASIC" or other supported formats)
|
|
754
|
+
* @returns Promise resolving to array of V3 network summaries
|
|
755
|
+
*/
|
|
756
|
+
getNetworkSummariesV3ByUUIDs(uuidList: string[], accessKey?: string, format?: string): Promise<NetworkSummaryV3[]>;
|
|
757
|
+
/**
|
|
758
|
+
* Search networks with V3 enhanced features
|
|
759
|
+
*/
|
|
760
|
+
searchNetworks(searchParams?: SearchParameters): Promise<SearchResult>;
|
|
761
|
+
/**
|
|
762
|
+
* Get network as CX2Network object with utilities
|
|
763
|
+
*/
|
|
764
|
+
getNetworkAsCX2Object(networkUUID: string, options?: AccessParams): Promise<CX2Network>;
|
|
765
|
+
/**
|
|
766
|
+
* Create new network from CX2
|
|
767
|
+
*/
|
|
768
|
+
createNetworkFromCX2(cx2Data: CX2Network$1 | CX2Network, options?: {
|
|
769
|
+
visibility?: 'PUBLIC' | 'PRIVATE';
|
|
770
|
+
folderId?: string;
|
|
771
|
+
}): Promise<NDExObjectUpdateStatus>;
|
|
772
|
+
/**
|
|
773
|
+
* Update network with CX2 data
|
|
774
|
+
*/
|
|
775
|
+
updateNetworkCX2(networkUUID: string, cx2Data: CX2Network$1 | CX2Network): Promise<NDExObjectUpdateStatus>;
|
|
776
|
+
/**
|
|
777
|
+
* Upload network file (CX2, CX, or other formats)
|
|
778
|
+
*/
|
|
779
|
+
uploadNetworkFile(file: File | Blob | string, options?: {
|
|
780
|
+
filename?: string;
|
|
781
|
+
visibility?: 'PUBLIC' | 'PRIVATE';
|
|
782
|
+
name?: string;
|
|
783
|
+
onProgress?: (progress: number) => void;
|
|
784
|
+
}): Promise<{
|
|
785
|
+
uuid: string;
|
|
786
|
+
}>;
|
|
787
|
+
/**
|
|
788
|
+
* Get network metadata (V3 enhanced)
|
|
789
|
+
*/
|
|
790
|
+
getNetworkMetadata(networkUUID: string): Promise<any>;
|
|
791
|
+
/**
|
|
792
|
+
* Update network metadata
|
|
793
|
+
*/
|
|
794
|
+
updateNetworkMetadata(networkUUID: string, metadata: Record<string, any>): Promise<void>;
|
|
795
|
+
/**
|
|
796
|
+
* Get network aspect (specific CX2 aspect)
|
|
797
|
+
*/
|
|
798
|
+
getNetworkAspect(networkUUID: string, aspectName: string, options?: AccessParams): Promise<any>;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
/**
|
|
802
|
+
* NetworkServiceV2 - NDEx API v2 network operations
|
|
803
|
+
* Handles legacy v2 endpoints with modern TypeScript interface
|
|
804
|
+
*/
|
|
805
|
+
declare class NetworkServiceV2 {
|
|
806
|
+
private http;
|
|
807
|
+
constructor(http: HTTPService);
|
|
808
|
+
/**
|
|
809
|
+
* Get raw network in CX1 format
|
|
810
|
+
*
|
|
811
|
+
* Returns raw CX1 data as an array of aspects. This data may contain fragmented aspects
|
|
812
|
+
* that need to be assembled into a complete CX1 network model for proper usage.
|
|
813
|
+
* For a fully assembled network object, consider using getNetworkAsCX2Object() instead.
|
|
814
|
+
*
|
|
815
|
+
* @param networkUUID - The UUID of the network to retrieve
|
|
816
|
+
* @param options - Access options including optional access key
|
|
817
|
+
* @returns Promise resolving to raw CX1 data as an array of aspects
|
|
818
|
+
*/
|
|
819
|
+
getRawCX1Network(networkUUID: string, options?: AccessParams): Promise<any[]>;
|
|
820
|
+
/**
|
|
821
|
+
* Get network summary by UUID
|
|
822
|
+
*/
|
|
823
|
+
getNetworkSummary(networkUUID: string, options?: AccessParams): Promise<NetworkSummaryV2>;
|
|
824
|
+
/**
|
|
825
|
+
* Copy network
|
|
826
|
+
*
|
|
827
|
+
* Creates a copy of an existing network using the server's copy endpoint.
|
|
828
|
+
* The copied network will have the same content but will be assigned a new UUID
|
|
829
|
+
* and will be owned by the authenticated user.
|
|
830
|
+
*
|
|
831
|
+
* @param networkUUID - The UUID of the network to copy
|
|
832
|
+
* @returns Promise resolving to the URL of the cloned CX1 network
|
|
833
|
+
*/
|
|
834
|
+
copyNetwork(networkUUID: string): Promise<string>;
|
|
835
|
+
/**
|
|
836
|
+
* Search networks (migrated from original NDEx.js)
|
|
837
|
+
*
|
|
838
|
+
* Searches networks using POST request with search parameters in the request body.
|
|
839
|
+
* This implementation matches the original NDEx.js searchNetworks function.
|
|
840
|
+
*
|
|
841
|
+
* @param searchTerms - Search string to find networks
|
|
842
|
+
* @param start - Starting offset for pagination (optional)
|
|
843
|
+
* @param size - Maximum number of results to return (optional)
|
|
844
|
+
* @param optionalParameters - Additional search filters
|
|
845
|
+
* @param optionalParameters.permission - Filter by permission level
|
|
846
|
+
* @param optionalParameters.includeGroups - Whether to include group networks
|
|
847
|
+
* @param optionalParameters.accountName - Filter by account name
|
|
848
|
+
* @returns Promise resolving to search results
|
|
849
|
+
*/
|
|
850
|
+
searchNetworks(searchTerms: string, start?: number, size?: number, optionalParameters?: {
|
|
851
|
+
permission?: string;
|
|
852
|
+
includeGroups?: boolean;
|
|
853
|
+
accountName?: string;
|
|
854
|
+
}): Promise<any>;
|
|
855
|
+
/**
|
|
856
|
+
* Create new network from raw CX1 data
|
|
857
|
+
*
|
|
858
|
+
* Creates a new network in NDEx from raw CX1 network data. This method handles
|
|
859
|
+
* the server response parsing to extract the network UUID from the location header.
|
|
860
|
+
*
|
|
861
|
+
* @param rawCX - Raw CX1 network data as an array of aspects
|
|
862
|
+
* @param options - Optional options for network creation (visibility settings)
|
|
863
|
+
* @returns Promise resolving to the UUID string of the newly created network
|
|
864
|
+
*/
|
|
865
|
+
createNetworkFromRawCX1(rawCX: any[], options?: {
|
|
866
|
+
visibility?: 'PUBLIC' | 'PRIVATE';
|
|
867
|
+
}): Promise<string>;
|
|
868
|
+
/**
|
|
869
|
+
* Update network from raw CX1 data
|
|
870
|
+
*
|
|
871
|
+
* Updates an existing network in NDEx with new raw CX1 network data.
|
|
872
|
+
* This completely replaces the network content with the provided CX1 data.
|
|
873
|
+
* Uses the legacy v2 endpoint format from the original NDEx.js implementation.
|
|
874
|
+
*
|
|
875
|
+
* @param networkUUID - The UUID of the network to update
|
|
876
|
+
* @param rawCX - Raw CX1 network data as an array of aspects
|
|
877
|
+
* @returns Promise resolving when the update is complete
|
|
878
|
+
*/
|
|
879
|
+
updateNetworkFromRawCX1(networkUUID: string, rawCX: any[]): Promise<void>;
|
|
880
|
+
/**
|
|
881
|
+
* Delete network
|
|
882
|
+
*/
|
|
883
|
+
deleteNetwork(networkUUID: string): Promise<void>;
|
|
884
|
+
/**
|
|
885
|
+
* Get network summaries by UUIDs (migrated from original NDEx.js)
|
|
886
|
+
*
|
|
887
|
+
* Retrieves network summaries for multiple networks in a single batch request.
|
|
888
|
+
* Uses the V2 API batch endpoint for efficient bulk operations.
|
|
889
|
+
*
|
|
890
|
+
* @param uuidList - Array of network UUIDs to retrieve summaries for
|
|
891
|
+
* @param accessKey - Optional access key for private networks
|
|
892
|
+
* @returns Promise resolving to array of network summaries
|
|
893
|
+
*/
|
|
894
|
+
getNetworkSummariesByUUIDs(uuidList: string[], accessKey?: string): Promise<NetworkSummaryV2[]>;
|
|
895
|
+
/**
|
|
896
|
+
* Get user's networks
|
|
897
|
+
*/
|
|
898
|
+
getUserNetworks(accountName: string, options?: PaginationParams): Promise<NetworkSummaryV2[]>;
|
|
899
|
+
/**
|
|
900
|
+
* Set network system properties
|
|
901
|
+
*/
|
|
902
|
+
setNetworkSystemProperties(networkUUID: string, properties: Record<string, any>): Promise<void>;
|
|
903
|
+
/**
|
|
904
|
+
* Get network permissions
|
|
905
|
+
*/
|
|
906
|
+
getNetworkPermissions(networkUUID: string): Promise<NetworkPermission[]>;
|
|
907
|
+
/**
|
|
908
|
+
* Set network permissions
|
|
909
|
+
*/
|
|
910
|
+
setNetworkPermissions(networkUUID: string, permissions: NetworkPermission[]): Promise<void>;
|
|
911
|
+
/**
|
|
912
|
+
* Grant network permission to user
|
|
913
|
+
*/
|
|
914
|
+
grantNetworkPermission(networkUUID: string, userUUID: string, permission: 'READ' | 'WRITE' | 'ADMIN'): Promise<void>;
|
|
915
|
+
/**
|
|
916
|
+
* Revoke network permission from user
|
|
917
|
+
*/
|
|
918
|
+
revokeNetworkPermission(networkUUID: string, userUUID: string): Promise<void>;
|
|
919
|
+
/**
|
|
920
|
+
* Get network profile (additional metadata)
|
|
921
|
+
*/
|
|
922
|
+
getNetworkProfile(networkUUID: string): Promise<any>;
|
|
923
|
+
/**
|
|
924
|
+
* Set network profile
|
|
925
|
+
*/
|
|
926
|
+
setNetworkProfile(networkUUID: string, profile: any): Promise<void>;
|
|
927
|
+
/**
|
|
928
|
+
* Make network public
|
|
929
|
+
*/
|
|
930
|
+
makeNetworkPublic(networkUUID: string): Promise<void>;
|
|
931
|
+
/**
|
|
932
|
+
* Make network private
|
|
933
|
+
*/
|
|
934
|
+
makeNetworkPrivate(networkUUID: string): Promise<void>;
|
|
935
|
+
/**
|
|
936
|
+
* Get network sample (if available)
|
|
937
|
+
*/
|
|
938
|
+
getNetworkSample(networkUUID: string, options?: AccessParams): Promise<any[]>;
|
|
939
|
+
/**
|
|
940
|
+
* Get network metadata (migrated from original NDEx.js)
|
|
941
|
+
*
|
|
942
|
+
* Retrieves metadata information about network aspects including element counts,
|
|
943
|
+
* versions, and ID counters for each aspect in the network. This provides
|
|
944
|
+
* an overview of the network's structure and content organization.
|
|
945
|
+
*
|
|
946
|
+
* @param networkUUID - The UUID of the network to get metadata for
|
|
947
|
+
* @param accessKey - Optional access key for private networks
|
|
948
|
+
* @returns Promise resolving to metadata containing aspect information
|
|
949
|
+
* @example
|
|
950
|
+
* ```typescript
|
|
951
|
+
* const metadata = await networkService.getMetaData('network-uuid');
|
|
952
|
+
* // Returns: { metaData: [{ name: 'nodes', elementCount: 330, version: '1.0' }, ...] }
|
|
953
|
+
* ```
|
|
954
|
+
*/
|
|
955
|
+
getMetaData(networkUUID: string, accessKey?: string): Promise<CX1MetaDataResponse>;
|
|
956
|
+
/**
|
|
957
|
+
* Get network access key (migrated from original NDEx.js)
|
|
958
|
+
*
|
|
959
|
+
* Retrieves the current access key for a network. Access keys allow
|
|
960
|
+
* users to share private networks without requiring individual permissions.
|
|
961
|
+
*
|
|
962
|
+
* @param networkUUID - The UUID of the network to get access key for
|
|
963
|
+
* @returns Promise resolving to access key response object
|
|
964
|
+
*
|
|
965
|
+
* @example
|
|
966
|
+
* ```typescript
|
|
967
|
+
* const response = await networkService.getAccessKey('network-uuid');
|
|
968
|
+
* console.log(response.accessKey); // "acialdfeoa03430023" or null
|
|
969
|
+
* ```
|
|
970
|
+
*/
|
|
971
|
+
getAccessKey(networkUUID: string): Promise<AccessKeyResponse>;
|
|
972
|
+
/**
|
|
973
|
+
* Update network access key (migrated from original NDEx.js)
|
|
974
|
+
*
|
|
975
|
+
* Enables or disables the access key for a network. When enabled, creates
|
|
976
|
+
* a new access key that can be shared. When disabled, invalidates the
|
|
977
|
+
* current access key.
|
|
978
|
+
*
|
|
979
|
+
* @param networkUUID - The UUID of the network to update access key for
|
|
980
|
+
* @param action - Action to perform: 'enable' creates/updates key, 'disable' removes it
|
|
981
|
+
* @returns Promise resolving to access key response (accessKey will be null when disabled)
|
|
982
|
+
*
|
|
983
|
+
* @example
|
|
984
|
+
* ```typescript
|
|
985
|
+
* // Enable access key
|
|
986
|
+
* const enabled = await networkService.updateAccessKey('network-uuid', 'enable');
|
|
987
|
+
* console.log(enabled.accessKey); // "new-access-key-string"
|
|
988
|
+
*
|
|
989
|
+
* // Disable access key
|
|
990
|
+
* const disabled = await networkService.updateAccessKey('network-uuid', 'disable');
|
|
991
|
+
* console.log(disabled.accessKey); // null
|
|
992
|
+
* ```
|
|
993
|
+
*/
|
|
994
|
+
updateAccessKey(networkUUID: string, action: AccessKeyAction): Promise<AccessKeyResponse>;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* UnifiedNetworkService - Provides access to both V2/V3 network services
|
|
999
|
+
* Allows individual function calls to choose between v2 and v3 APIs
|
|
1000
|
+
*/
|
|
1001
|
+
declare class UnifiedNetworkService {
|
|
1002
|
+
private http;
|
|
1003
|
+
private v2Service;
|
|
1004
|
+
private v3Service;
|
|
1005
|
+
constructor(http: HTTPService);
|
|
1006
|
+
/**
|
|
1007
|
+
* Get network summary using specified API version
|
|
1008
|
+
*/
|
|
1009
|
+
getNetworkSummary(networkUUID: string, options?: AccessParams): Promise<NetworkSummaryV3>;
|
|
1010
|
+
/**
|
|
1011
|
+
* Search networks using specified API version
|
|
1012
|
+
* NOTE: This method is temporarily commented out as the V2 searchNetworks
|
|
1013
|
+
* signature has been migrated from NDEx.js and needs separate integration
|
|
1014
|
+
*/
|
|
1015
|
+
/**
|
|
1016
|
+
* Get network in CX1 format (V2 API)
|
|
1017
|
+
*/
|
|
1018
|
+
getRawCX1Network(networkUUID: string, options?: AccessParams): Promise<any[]>;
|
|
1019
|
+
/**
|
|
1020
|
+
* Get network in CX2 format (V3 API)
|
|
1021
|
+
*/
|
|
1022
|
+
getRawCX2Network(networkUUID: string, options?: AccessParams): Promise<CX2Network$1>;
|
|
1023
|
+
/**
|
|
1024
|
+
* Delete network
|
|
1025
|
+
*/
|
|
1026
|
+
deleteNetwork(networkUUID: string): Promise<void>;
|
|
1027
|
+
/**
|
|
1028
|
+
* Create network DOI
|
|
1029
|
+
*
|
|
1030
|
+
* @param networkUUID - The UUID of the network to create a DOI for
|
|
1031
|
+
* @param key - DOI creation key
|
|
1032
|
+
* @param email - Email address for DOI registration
|
|
1033
|
+
* @returns Promise resolving to a confirmation message string from the server
|
|
1034
|
+
*/
|
|
1035
|
+
createNetworkDOI(networkUUID: string, key: string, email: string): Promise<string>;
|
|
1036
|
+
/**
|
|
1037
|
+
* Get attributes of selected nodes
|
|
1038
|
+
*
|
|
1039
|
+
* Retrieves specific attributes for a set of nodes in a network. The server will return
|
|
1040
|
+
* a 404 error if the network has no attributes on nodes.
|
|
1041
|
+
*
|
|
1042
|
+
* @param networkUUID - The UUID of the network
|
|
1043
|
+
* @param nodeSelection - Object containing node IDs and attribute names to retrieve
|
|
1044
|
+
* @param nodeSelection.ids - Array of node IDs (long numbers) to get attributes for
|
|
1045
|
+
* @param nodeSelection.attributeNames - Array of attribute names to retrieve
|
|
1046
|
+
* @param options - Access options including optional access key
|
|
1047
|
+
* @returns Promise resolving to a JSON object where keys are stringified node IDs
|
|
1048
|
+
* and values are the selected attributes for that node
|
|
1049
|
+
* @throws {404} When the network has no attributes on nodes
|
|
1050
|
+
*/
|
|
1051
|
+
getAttributesOfSelectedNodes(networkUUID: string, nodeSelection: {
|
|
1052
|
+
ids: number[];
|
|
1053
|
+
attributeNames: string[];
|
|
1054
|
+
}, options?: AccessParams): Promise<Record<string, any>>;
|
|
1055
|
+
/**
|
|
1056
|
+
* Neighborhood query (migrated from original NDEx.js)
|
|
1057
|
+
*
|
|
1058
|
+
* Performs a neighborhood search within a network, returning nodes and edges
|
|
1059
|
+
* within the specified search depth from nodes matching the search terms.
|
|
1060
|
+
* Can return either raw CX1 or CX2 format based on outputCX2 parameter.
|
|
1061
|
+
*
|
|
1062
|
+
* @param networkUUID - The UUID of the network to search
|
|
1063
|
+
* @param searchTerms - Search string to find starting nodes
|
|
1064
|
+
* @param saveResult - Whether to save the query result as a new network
|
|
1065
|
+
* @param parameters - Additional query parameters
|
|
1066
|
+
* @param parameters.searchDepth - How many hops to search (default: 1)
|
|
1067
|
+
* @param parameters.edgeLimit - Maximum number of edges to return
|
|
1068
|
+
* @param parameters.errorWhenLimitIsOver - Throw error if edge limit exceeded
|
|
1069
|
+
* @param parameters.directOnly - Only include direct connections
|
|
1070
|
+
* @param parameters.nodeIds - Specific node IDs to start search from
|
|
1071
|
+
* @param outputCX2 - If true, return CX2 format via V3 API; if false, return CX1 format via V2 API
|
|
1072
|
+
* @returns Promise resolving to raw CX1 or CX2 network data
|
|
1073
|
+
*/
|
|
1074
|
+
neighborhoodQuery(networkUUID: string, searchTerms: string, saveResult?: boolean, parameters?: {
|
|
1075
|
+
searchDepth?: number;
|
|
1076
|
+
edgeLimit?: number;
|
|
1077
|
+
errorWhenLimitIsOver?: boolean;
|
|
1078
|
+
directOnly?: boolean;
|
|
1079
|
+
nodeIds?: number[];
|
|
1080
|
+
}, outputCX2?: boolean): Promise<any[] | CX2Network$1>;
|
|
1081
|
+
/**
|
|
1082
|
+
* Interconnect query (migrated from original NDEx.js)
|
|
1083
|
+
*
|
|
1084
|
+
* Finds connections between nodes matching the search terms within a network.
|
|
1085
|
+
* Returns the interconnected subnetwork as either raw CX1 or CX2 format.
|
|
1086
|
+
* Can return either raw CX1 or CX2 format based on outputCX2 parameter.
|
|
1087
|
+
*
|
|
1088
|
+
* @param networkUUID - The UUID of the network to search
|
|
1089
|
+
* @param searchTerms - Search string to find nodes to interconnect
|
|
1090
|
+
* @param saveResult - Whether to save the query result as a new network
|
|
1091
|
+
* @param parameters - Additional query parameters
|
|
1092
|
+
* @param parameters.edgeLimit - Maximum number of edges to return
|
|
1093
|
+
* @param parameters.errorWhenLimitIsOver - Throw error if edge limit exceeded
|
|
1094
|
+
* @param parameters.nodeIds - Specific node IDs to find connections between
|
|
1095
|
+
* @param outputCX2 - If true, return CX2 format via V3 API; if false, return CX1 format via V2 API
|
|
1096
|
+
* @returns Promise resolving to raw CX1 or CX2 network data
|
|
1097
|
+
*/
|
|
1098
|
+
interConnectQuery(networkUUID: string, searchTerms: string, saveResult?: boolean, parameters?: {
|
|
1099
|
+
edgeLimit?: number;
|
|
1100
|
+
errorWhenLimitIsOver?: boolean;
|
|
1101
|
+
nodeIds?: number[];
|
|
1102
|
+
}, outputCX2?: boolean): Promise<any[] | CX2Network$1>;
|
|
1103
|
+
/**
|
|
1104
|
+
* Get network permissions by UUIDs (migrated from original NDEx.js)
|
|
1105
|
+
*
|
|
1106
|
+
* Retrieves network permissions for multiple networks in a single batch request.
|
|
1107
|
+
* Uses the V2 API batch endpoint to efficiently get permission information.
|
|
1108
|
+
*
|
|
1109
|
+
* @param uuidList - Array of network UUIDs to retrieve permissions for
|
|
1110
|
+
* @returns Promise resolving to permission information for the specified networks
|
|
1111
|
+
*/
|
|
1112
|
+
getNetworkPermissionsByUUIDs(uuidList: string[]): Promise<any[]>;
|
|
1113
|
+
/**
|
|
1114
|
+
* Export networks (migrated from original NDEx.js)
|
|
1115
|
+
*
|
|
1116
|
+
* Creates an export job for networks using the V2 batch export endpoint.
|
|
1117
|
+
* This allows exporting multiple networks in various formats.
|
|
1118
|
+
*
|
|
1119
|
+
* @param exportJob - Export job configuration specifying networks and format
|
|
1120
|
+
* @returns Promise resolving to export job result
|
|
1121
|
+
*/
|
|
1122
|
+
exportNetworks(exportJob: any): Promise<any>;
|
|
1123
|
+
/**
|
|
1124
|
+
* Move networks to folder (migrated from original NDEx.js)
|
|
1125
|
+
*
|
|
1126
|
+
* Moves multiple networks to a specified folder using the V3 API.
|
|
1127
|
+
* This is a V3-specific feature for organizing networks in folders.
|
|
1128
|
+
*
|
|
1129
|
+
* @param networkIds - Array of network IDs to move
|
|
1130
|
+
* @param folderId - Target folder ID to move networks to
|
|
1131
|
+
* @returns Promise resolving when networks are moved
|
|
1132
|
+
*/
|
|
1133
|
+
moveNetworks(networkIds: string[], folderId: string): Promise<any>;
|
|
1134
|
+
/**
|
|
1135
|
+
* Set networks visibility (migrated from original NDEx.js)
|
|
1136
|
+
*
|
|
1137
|
+
* Changes visibility settings for multiple networks using the V3 API.
|
|
1138
|
+
* Requires proper file validation to ensure data integrity.
|
|
1139
|
+
*
|
|
1140
|
+
* @param files - Object containing files with their types (must have 'files' property)
|
|
1141
|
+
* @param visibility - Visibility setting (e.g., 'PUBLIC', 'PRIVATE')
|
|
1142
|
+
* @returns Promise resolving when visibility is updated
|
|
1143
|
+
*/
|
|
1144
|
+
setNetworksVisibility(files: {
|
|
1145
|
+
files: Record<string, 'NETWORK' | 'FOLDER' | 'SHORTCUT'>;
|
|
1146
|
+
}, visibility: string): Promise<any>;
|
|
1147
|
+
/**
|
|
1148
|
+
* Get random edges from network (migrated from original NDEx.js)
|
|
1149
|
+
*
|
|
1150
|
+
* Retrieves a random sample of edges from a network using the V3 API.
|
|
1151
|
+
* This is useful for previewing large networks or sampling edge data.
|
|
1152
|
+
*
|
|
1153
|
+
* @param networkUUID - The UUID of the network to get edges from
|
|
1154
|
+
* @param limit - Number of random edges to retrieve (must be greater than 0)
|
|
1155
|
+
* @param accessKey - Optional access key for private networks
|
|
1156
|
+
* @returns Promise resolving to array of CX2Edge objects
|
|
1157
|
+
* @throws Error if limit is less than or equal to 0
|
|
1158
|
+
*/
|
|
1159
|
+
getRandomEdges(networkUUID: string, limit: number, accessKey?: string): Promise<CX2Edge[]>;
|
|
1160
|
+
/**
|
|
1161
|
+
* Validate share data format (helper method for file operations)
|
|
1162
|
+
*
|
|
1163
|
+
* Validates the structure and content of file data used in sharing operations.
|
|
1164
|
+
* Ensures proper UUID format and valid file types.
|
|
1165
|
+
*
|
|
1166
|
+
* @param data - Data object to validate (must contain 'files' property)
|
|
1167
|
+
* @throws Error if validation fails
|
|
1168
|
+
*/
|
|
1169
|
+
private validateShareData;
|
|
1170
|
+
/**
|
|
1171
|
+
* Get aspect elements (migrated from original NDEx.js)
|
|
1172
|
+
*
|
|
1173
|
+
* Retrieves elements from a specific aspect of a network using the V3 API.
|
|
1174
|
+
* This function can be used to get nodes, edges, or other aspect data
|
|
1175
|
+
* with optional size limiting and access key support for private networks.
|
|
1176
|
+
*
|
|
1177
|
+
* @param networkUUID - The UUID of the network to get aspect elements from
|
|
1178
|
+
* @param aspectName - Name of the aspect to retrieve (e.g., 'nodes', 'edges', 'networkAttributes')
|
|
1179
|
+
* @param limit - Optional maximum number of elements to return
|
|
1180
|
+
* @param accessKey - Optional access key for private networks
|
|
1181
|
+
* @returns Promise resolving to array of aspect elements
|
|
1182
|
+
* @example
|
|
1183
|
+
* ```typescript
|
|
1184
|
+
* // Get first 100 nodes from a network
|
|
1185
|
+
* const nodes = await client.networks.getAspectElements('network-uuid', 'nodes', 100);
|
|
1186
|
+
*
|
|
1187
|
+
* // Get all edges from a network
|
|
1188
|
+
* const edges = await client.networks.getAspectElements('network-uuid', 'edges');
|
|
1189
|
+
* ```
|
|
1190
|
+
*/
|
|
1191
|
+
getAspectElements(networkUUID: string, aspectName: string, limit?: number, accessKey?: string): Promise<any[]>;
|
|
1192
|
+
/**
|
|
1193
|
+
* Get filtered edges (migrated from original NDEx.js)
|
|
1194
|
+
*
|
|
1195
|
+
* Retrieves edges from a network that match specific filtering criteria on a column value.
|
|
1196
|
+
* The function supports both CX1 and CX2 formats based on the format parameter, with CX2
|
|
1197
|
+
* being the default format used by the server.
|
|
1198
|
+
*
|
|
1199
|
+
* @param networkUUID - The UUID of the network to get filtered edges from
|
|
1200
|
+
* @param columnName - Name of the edge attribute column to filter on
|
|
1201
|
+
* @param valueString - Value to filter by (converted to string for comparison)
|
|
1202
|
+
* @param operator - Filtering operation: '>' | '<' | '=' | '!='
|
|
1203
|
+
* @param limit - Optional maximum number of edges to return (default: -1 = all matching edges)
|
|
1204
|
+
* @param order - Optional sort order for edges before applying limit: 'asc' | 'desc' (default: 'desc')
|
|
1205
|
+
* @param format - Optional output format: 'cx' | 'cx2' (default: 'cx2')
|
|
1206
|
+
* @param accessKey - Optional access key for private networks
|
|
1207
|
+
* @returns Promise resolving to array of edges in the specified format
|
|
1208
|
+
*
|
|
1209
|
+
* @example
|
|
1210
|
+
* ```typescript
|
|
1211
|
+
* // Get edges with weight > 0.5 in CX2 format (default)
|
|
1212
|
+
* const cx2Edges = await client.networks.getFilteredEdges(
|
|
1213
|
+
* 'network-uuid', 'weight', '0.5', '>'
|
|
1214
|
+
* );
|
|
1215
|
+
*
|
|
1216
|
+
* // Get top 10 edges with highest score in CX1 format
|
|
1217
|
+
* const cx1Edges = await client.networks.getFilteredEdges(
|
|
1218
|
+
* 'network-uuid', 'score', '0', '>', 10, 'desc', 'cx'
|
|
1219
|
+
* );
|
|
1220
|
+
*
|
|
1221
|
+
* // Get edges where interaction equals 'pp'
|
|
1222
|
+
* const ppEdges = await client.networks.getFilteredEdges(
|
|
1223
|
+
* 'network-uuid', 'interaction', 'pp', '=', undefined, undefined, 'cx2'
|
|
1224
|
+
* );
|
|
1225
|
+
* ```
|
|
1226
|
+
*/
|
|
1227
|
+
getFilteredEdges(networkUUID: string, columnName: string, valueString: string, operator: '>' | '<' | '=' | '!=', limit?: number, order?: 'asc' | 'desc', format?: 'cx' | 'cx2', accessKey?: string): Promise<CX2Edge[] | CX1Edge[]>;
|
|
1228
|
+
/**
|
|
1229
|
+
* Get CX2 metadata (migrated from original NDEx.js)
|
|
1230
|
+
*
|
|
1231
|
+
* Retrieves metadata information for all aspects in a CX2 network format.
|
|
1232
|
+
* This function provides aspect metadata including element counts for each
|
|
1233
|
+
* aspect in the network using the V3 API.
|
|
1234
|
+
*
|
|
1235
|
+
* @param networkUUID - The UUID of the network to get CX2 metadata for
|
|
1236
|
+
* @param accessKey - Optional access key for private networks
|
|
1237
|
+
* @returns Promise resolving to array of CX2MetaData objects
|
|
1238
|
+
*
|
|
1239
|
+
* @example
|
|
1240
|
+
* ```typescript
|
|
1241
|
+
* // Get CX2 metadata for a network
|
|
1242
|
+
* const metaData = await client.networks.getCX2MetaData('network-uuid');
|
|
1243
|
+
* console.log(metaData); // [{ name: 'nodes', elementCount: 100 }, { name: 'edges', elementCount: 150 }]
|
|
1244
|
+
*
|
|
1245
|
+
* // Get CX2 metadata for a private network
|
|
1246
|
+
* const privateMetaData = await client.networks.getCX2MetaData('private-network-uuid', 'access-key');
|
|
1247
|
+
* ```
|
|
1248
|
+
*/
|
|
1249
|
+
getCX2MetaData(networkUUID: string, accessKey?: string): Promise<CX2MetaData[]>;
|
|
1250
|
+
/**
|
|
1251
|
+
* Create network from raw CX2 data (migrated from original NDEx.js)
|
|
1252
|
+
*
|
|
1253
|
+
* Creates a new network on NDEx from raw CX2 data using the V3 API.
|
|
1254
|
+
* This function delegates to the NetworkServiceV3 implementation.
|
|
1255
|
+
*
|
|
1256
|
+
* @param cx2Data - Raw CX2 network data as an object or CX2Network instance
|
|
1257
|
+
* @param options - Creation options including visibility and folderId
|
|
1258
|
+
* @param options.visibility - Network visibility: 'PUBLIC' or 'PRIVATE' (default: 'PRIVATE')
|
|
1259
|
+
* @param options.folderId - UUID of the folder to create the network in. If omitted, network is created in user's home directory
|
|
1260
|
+
* @returns Promise resolving to NDExObjectUpdateStatus with uuid and modificationTime
|
|
1261
|
+
*
|
|
1262
|
+
* @example
|
|
1263
|
+
* ```typescript
|
|
1264
|
+
* // Create private network from raw CX2 data in user's home directory
|
|
1265
|
+
* const result = await client.networks.createNetworkFromRawCX2(cx2Data);
|
|
1266
|
+
* console.log(result.uuid); // "12345678-1234-1234-1234-123456789abc"
|
|
1267
|
+
*
|
|
1268
|
+
* // Create public network from raw CX2 data in a specific folder
|
|
1269
|
+
* const publicResult = await client.networks.createNetworkFromRawCX2(cx2Data, {
|
|
1270
|
+
* visibility: 'PUBLIC',
|
|
1271
|
+
* folderId: '87654321-4321-4321-4321-876543210fed'
|
|
1272
|
+
* });
|
|
1273
|
+
* console.log(publicResult.uuid);
|
|
1274
|
+
* ```
|
|
1275
|
+
*/
|
|
1276
|
+
createNetworkFromRawCX2(cx2Data: CX2Network$1 | CX2Network, options?: {
|
|
1277
|
+
visibility?: 'PUBLIC' | 'PRIVATE';
|
|
1278
|
+
folderId?: string;
|
|
1279
|
+
}): Promise<NDExObjectUpdateStatus>;
|
|
1280
|
+
/**
|
|
1281
|
+
* Update network from raw CX2 data (migrated from original NDEx.js)
|
|
1282
|
+
*
|
|
1283
|
+
* Updates an existing network with new raw CX2 data using the V3 API.
|
|
1284
|
+
* This function replaces the entire network content with the provided CX2 data.
|
|
1285
|
+
*
|
|
1286
|
+
* @param networkUUID - The UUID of the network to update
|
|
1287
|
+
* @param rawCX2 - Raw CX2 network data as an object or CX2Network instance
|
|
1288
|
+
* @returns Promise resolving when the network update is complete
|
|
1289
|
+
*
|
|
1290
|
+
* @example
|
|
1291
|
+
* ```typescript
|
|
1292
|
+
* // Update existing network with new CX2 data
|
|
1293
|
+
* await client.networks.updateNetworkFromRawCX2('network-uuid', updatedCx2Data);
|
|
1294
|
+
* ```
|
|
1295
|
+
*/
|
|
1296
|
+
updateNetworkFromRawCX2(networkUUID: string, rawCX2: CX2Network$1 | any): Promise<void>;
|
|
1297
|
+
/**
|
|
1298
|
+
* Access to underlying service instances for advanced usage
|
|
1299
|
+
*/
|
|
1300
|
+
get v2(): NetworkServiceV2;
|
|
1301
|
+
get v3(): NetworkServiceV3;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
interface ShareData {
|
|
1305
|
+
files: Record<string, 'NETWORK' | 'FOLDER' | 'SHORTCUT'>;
|
|
1306
|
+
}
|
|
1307
|
+
interface MemberData {
|
|
1308
|
+
members: Record<string, 'READ' | 'WRITE'>;
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* FilesService - NDEx file operations and task management
|
|
1312
|
+
* Handles file uploads, downloads, exports, and asynchronous task tracking
|
|
1313
|
+
*/
|
|
1314
|
+
declare class FilesService {
|
|
1315
|
+
private http;
|
|
1316
|
+
constructor(http: HTTPService);
|
|
1317
|
+
/**
|
|
1318
|
+
* Copy a file to a different location
|
|
1319
|
+
* @param fromUuid - Source file UUID
|
|
1320
|
+
* @param toPath - Target path
|
|
1321
|
+
* @param type - File type (NETWORK, FOLDER, SHORTCUT)
|
|
1322
|
+
* @param accessKey - Optional access key for protected files
|
|
1323
|
+
*/
|
|
1324
|
+
copyFile(fromUuid: string, toPath: string, type: string, accessKey?: string): Promise<any>;
|
|
1325
|
+
/** Get file count statistics for the current user */
|
|
1326
|
+
getCount(): Promise<any>;
|
|
1327
|
+
/** Get files in the trash for the current user */
|
|
1328
|
+
getTrash(): Promise<any>;
|
|
1329
|
+
/** Permanently delete all files in trash */
|
|
1330
|
+
emptyTrash(): Promise<any>;
|
|
1331
|
+
/**
|
|
1332
|
+
* Permanently delete a file from trash
|
|
1333
|
+
* @param fileId - File UUID to permanently delete
|
|
1334
|
+
*/
|
|
1335
|
+
permanentlyDeleteFile(fileId: string): Promise<any>;
|
|
1336
|
+
/**
|
|
1337
|
+
* Restore files from trash
|
|
1338
|
+
* @param networkIds - Array of network UUIDs to restore
|
|
1339
|
+
* @param folderIds - Array of folder UUIDs to restore
|
|
1340
|
+
* @param shortcutIds - Array of shortcut UUIDs to restore
|
|
1341
|
+
*/
|
|
1342
|
+
restoreFile(networkIds: string[], folderIds: string[], shortcutIds: string[]): Promise<any>;
|
|
1343
|
+
private _validateShareData;
|
|
1344
|
+
private _validateMemberData;
|
|
1345
|
+
updateMember(files: ShareData['files'], members: MemberData['members']): Promise<any>;
|
|
1346
|
+
listMembers(files: any): Promise<any>;
|
|
1347
|
+
transferOwnership(files: ShareData['files'], newOwner: string): Promise<any>;
|
|
1348
|
+
listShares(limit?: number): Promise<any>;
|
|
1349
|
+
share(files: ShareData['files']): Promise<any>;
|
|
1350
|
+
unshare(files: ShareData['files']): Promise<any>;
|
|
1351
|
+
getFolders(limit?: number): Promise<any>;
|
|
1352
|
+
createFolder(name: string, parentFolderId?: string): Promise<any>;
|
|
1353
|
+
getFolder(folderId: string, accessKey?: string): Promise<any>;
|
|
1354
|
+
updateFolder(folderId: string, name: string, parentFolderId?: string): Promise<any>;
|
|
1355
|
+
deleteFolder(folderId: string): Promise<any>;
|
|
1356
|
+
getFolderCount(folderId: string, accessKey?: string): Promise<any>;
|
|
1357
|
+
getFolderList(folderId: string, accessKey?: string, format?: string, type?: string): Promise<any>;
|
|
1358
|
+
getShortcuts(limit?: number): Promise<any>;
|
|
1359
|
+
createShortcut(name: string, parentFolderId?: string, targetId?: string, targetType?: string): Promise<any>;
|
|
1360
|
+
getShortcut(shortcutId: string, accessKey?: string): Promise<any>;
|
|
1361
|
+
updateShortcut(shortcutId: string, name: string, parentFolderId?: string, targetId?: string, targetType?: string): Promise<any>;
|
|
1362
|
+
deleteShortcut(shortcutId: string): Promise<any>;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
/**
|
|
1366
|
+
* WorkspaceService - NDEx CyWeb workspace operations
|
|
1367
|
+
*
|
|
1368
|
+
* Provides methods for managing CyWeb workspaces including creation, retrieval,
|
|
1369
|
+
* updates, and deletion of workspaces and their associated networks.
|
|
1370
|
+
* All workspace operations use the V3 API.
|
|
1371
|
+
*/
|
|
1372
|
+
declare class WorkspaceService {
|
|
1373
|
+
private http;
|
|
1374
|
+
constructor(http: HTTPService);
|
|
1375
|
+
/**
|
|
1376
|
+
* Create a new CyWeb workspace (migrated from original NDEx.js)
|
|
1377
|
+
*
|
|
1378
|
+
* Creates a new workspace with the specified workspace data.
|
|
1379
|
+
*
|
|
1380
|
+
* @param workspace - The workspace object to create
|
|
1381
|
+
* @returns Promise resolving to the response from the server (typically contains workspace location)
|
|
1382
|
+
*
|
|
1383
|
+
* @example
|
|
1384
|
+
* ```typescript
|
|
1385
|
+
* const workspaceData = {
|
|
1386
|
+
* name: "My Workspace",
|
|
1387
|
+
* description: "A sample workspace",
|
|
1388
|
+
* networkIds: []
|
|
1389
|
+
* };
|
|
1390
|
+
* const response = await client.workspace.createCyWebWorkspace(workspaceData);
|
|
1391
|
+
* ```
|
|
1392
|
+
*/
|
|
1393
|
+
createCyWebWorkspace(workspace: CyWebWorkspace): Promise<string>;
|
|
1394
|
+
/**
|
|
1395
|
+
* Get a CyWeb workspace by ID (migrated from original NDEx.js)
|
|
1396
|
+
*
|
|
1397
|
+
* Retrieves a workspace and its details by workspace ID.
|
|
1398
|
+
*
|
|
1399
|
+
* @param workspaceId - The UUID of the workspace to retrieve
|
|
1400
|
+
* @returns Promise resolving to the workspace object
|
|
1401
|
+
*
|
|
1402
|
+
* @example
|
|
1403
|
+
* ```typescript
|
|
1404
|
+
* const workspace = await client.workspace.getCyWebWorkspace('workspace-uuid');
|
|
1405
|
+
* console.log(workspace.name);
|
|
1406
|
+
* ```
|
|
1407
|
+
*/
|
|
1408
|
+
getCyWebWorkspace(workspaceId: string): Promise<CyWebWorkspace>;
|
|
1409
|
+
/**
|
|
1410
|
+
* Delete a CyWeb workspace (migrated from original NDEx.js)
|
|
1411
|
+
*
|
|
1412
|
+
* Deletes the specified workspace permanently.
|
|
1413
|
+
*
|
|
1414
|
+
* @param workspaceId - The UUID of the workspace to delete
|
|
1415
|
+
* @returns Promise resolving when the workspace is deleted
|
|
1416
|
+
*
|
|
1417
|
+
* @example
|
|
1418
|
+
* ```typescript
|
|
1419
|
+
* await client.workspace.deleteCyWebWorkspace('workspace-uuid');
|
|
1420
|
+
* ```
|
|
1421
|
+
*/
|
|
1422
|
+
deleteCyWebWorkspace(workspaceId: string): Promise<void>;
|
|
1423
|
+
/**
|
|
1424
|
+
* Update a CyWeb workspace (migrated from original NDEx.js)
|
|
1425
|
+
*
|
|
1426
|
+
* Updates a workspace with new data, replacing the entire workspace object.
|
|
1427
|
+
*
|
|
1428
|
+
* @param workspaceId - The UUID of the workspace to update
|
|
1429
|
+
* @param workspaceObj - The updated workspace object
|
|
1430
|
+
* @returns Promise resolving when the workspace is updated
|
|
1431
|
+
*
|
|
1432
|
+
* @example
|
|
1433
|
+
* ```typescript
|
|
1434
|
+
* const updatedWorkspace = {
|
|
1435
|
+
* name: "Updated Workspace Name",
|
|
1436
|
+
* description: "Updated description",
|
|
1437
|
+
* networkIds: ["network-uuid-1", "network-uuid-2"]
|
|
1438
|
+
* };
|
|
1439
|
+
* await client.workspace.updateCyWebWorkspace('workspace-uuid', updatedWorkspace);
|
|
1440
|
+
* ```
|
|
1441
|
+
*/
|
|
1442
|
+
updateCyWebWorkspace(workspaceId: string, workspaceObj: CyWebWorkspace): Promise<void>;
|
|
1443
|
+
/**
|
|
1444
|
+
* Update CyWeb workspace name (migrated from original NDEx.js)
|
|
1445
|
+
*
|
|
1446
|
+
* Updates only the name of a workspace.
|
|
1447
|
+
*
|
|
1448
|
+
* @param workspaceId - The UUID of the workspace to update
|
|
1449
|
+
* @param newName - The new name for the workspace
|
|
1450
|
+
* @returns Promise resolving when the workspace name is updated
|
|
1451
|
+
*
|
|
1452
|
+
* @example
|
|
1453
|
+
* ```typescript
|
|
1454
|
+
* await client.workspace.updateCyWebWorkspaceName('workspace-uuid', 'New Workspace Name');
|
|
1455
|
+
* ```
|
|
1456
|
+
*/
|
|
1457
|
+
updateCyWebWorkspaceName(workspaceId: string, newName: string): Promise<void>;
|
|
1458
|
+
/**
|
|
1459
|
+
* Update CyWeb workspace networks (migrated from original NDEx.js)
|
|
1460
|
+
*
|
|
1461
|
+
* Updates the list of network IDs associated with a workspace.
|
|
1462
|
+
*
|
|
1463
|
+
* @param workspaceId - The UUID of the workspace to update
|
|
1464
|
+
* @param networkIds - Array of network UUIDs to associate with the workspace
|
|
1465
|
+
* @returns Promise resolving when the workspace networks are updated
|
|
1466
|
+
*
|
|
1467
|
+
* @example
|
|
1468
|
+
* ```typescript
|
|
1469
|
+
* const networkIds = ['network-uuid-1', 'network-uuid-2', 'network-uuid-3'];
|
|
1470
|
+
* await client.workspace.updateCyWebWorkspaceNetworks('workspace-uuid', networkIds);
|
|
1471
|
+
* ```
|
|
1472
|
+
*/
|
|
1473
|
+
updateCyWebWorkspaceNetworks(workspaceId: string, networkIds: string[]): Promise<void>;
|
|
1474
|
+
/**
|
|
1475
|
+
* Get user's CyWeb workspaces (migrated from original NDEx.js)
|
|
1476
|
+
*
|
|
1477
|
+
* Retrieves all workspaces belonging to the currently authenticated user.
|
|
1478
|
+
* Requires authentication.
|
|
1479
|
+
*
|
|
1480
|
+
* @returns Promise resolving to array of workspace objects
|
|
1481
|
+
*
|
|
1482
|
+
* @example
|
|
1483
|
+
* ```typescript
|
|
1484
|
+
* const workspaces = await client.workspace.getUserCyWebWorkspaces();
|
|
1485
|
+
* workspaces.forEach(workspace => {
|
|
1486
|
+
* console.log(`Workspace: ${workspace.name}`);
|
|
1487
|
+
* });
|
|
1488
|
+
* ```
|
|
1489
|
+
*/
|
|
1490
|
+
getUserCyWebWorkspaces(): Promise<CyWebWorkspace[]>;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
/**
|
|
1494
|
+
* UserService - NDEx user-related operations
|
|
1495
|
+
* Handles authentication, user management, and user workspace operations
|
|
1496
|
+
*/
|
|
1497
|
+
declare class UserService {
|
|
1498
|
+
private http;
|
|
1499
|
+
constructor(http: HTTPService);
|
|
1500
|
+
/**
|
|
1501
|
+
* Get authenticated user (equivalent to getSignedInUser from legacy client)
|
|
1502
|
+
* Returns the current signed-in user object from NDEx server
|
|
1503
|
+
*
|
|
1504
|
+
* For basic authentication: Gets the current user using the /user endpoint
|
|
1505
|
+
* For OAuth authentication: Uses the /users/signin endpoint with ID token
|
|
1506
|
+
*
|
|
1507
|
+
* @returns The authenticated user object
|
|
1508
|
+
* @note When authenticating with OAuth ID token, if a user with matching email
|
|
1509
|
+
* doesn't exist on the server, this function will automatically create
|
|
1510
|
+
* that user and return the newly created user object.
|
|
1511
|
+
*/
|
|
1512
|
+
authenticate(): Promise<NDExUser>;
|
|
1513
|
+
/**
|
|
1514
|
+
* Get current user profile (equivalent to getSignedInUser from legacy client)
|
|
1515
|
+
* Returns the current signed-in user object from NDEx server
|
|
1516
|
+
*
|
|
1517
|
+
* Uses the /user endpoint with {valid: true} parameter for both basic and OAuth authentication.
|
|
1518
|
+
* Unlike authenticate(), this function will NOT automatically create a user account for OAuth.
|
|
1519
|
+
* If the OAuth ID token doesn't match an existing user, it will return an unauthorized error.
|
|
1520
|
+
*
|
|
1521
|
+
* @returns The current user object
|
|
1522
|
+
* @note This function requires existing authentication and will not create new users
|
|
1523
|
+
*/
|
|
1524
|
+
getCurrentUser(): Promise<NDExUser>;
|
|
1525
|
+
/**
|
|
1526
|
+
* Update current user profile
|
|
1527
|
+
* Uses the UUID from the userUpdate object and server validates against authenticated user
|
|
1528
|
+
*/
|
|
1529
|
+
updateCurrentUser(userUpdate: Partial<NDExUser>): Promise<void>;
|
|
1530
|
+
/**
|
|
1531
|
+
* Request password reset
|
|
1532
|
+
*/
|
|
1533
|
+
requestPasswordReset(email: string): Promise<void>;
|
|
1534
|
+
/**
|
|
1535
|
+
* Reset password with user UUID (server validates UUID matches authenticated user)
|
|
1536
|
+
* @param userUUID - User UUID (must match authenticated user)
|
|
1537
|
+
* @param newPassword - New password as plain text
|
|
1538
|
+
*/
|
|
1539
|
+
resetPassword(userUUID: string, newPassword: string): Promise<void>;
|
|
1540
|
+
/**
|
|
1541
|
+
* Get user by UUID
|
|
1542
|
+
*/
|
|
1543
|
+
getUser(userUUID: string): Promise<NDExUser>;
|
|
1544
|
+
/**
|
|
1545
|
+
* Get user by account name or email (matches server getUserByAccountNameOrAuthenticatUser)
|
|
1546
|
+
* @param searchBy - Search criteria - either by username OR by email, but not both
|
|
1547
|
+
* @returns User object matching the search criteria
|
|
1548
|
+
* @note If both username and email are provided, only username will be used
|
|
1549
|
+
*/
|
|
1550
|
+
getUserByNameOrEmail(searchBy: {
|
|
1551
|
+
username: string;
|
|
1552
|
+
} | {
|
|
1553
|
+
email: string;
|
|
1554
|
+
}): Promise<NDExUser>;
|
|
1555
|
+
/**
|
|
1556
|
+
* Get multiple users by their UUIDs (batch operation)
|
|
1557
|
+
* @param uuidList - Array of user UUIDs to fetch
|
|
1558
|
+
* @returns Array of user objects corresponding to the provided UUIDs
|
|
1559
|
+
*/
|
|
1560
|
+
getUsersByUUIDs(uuidList: string[]): Promise<NDExUser[]>;
|
|
1561
|
+
/**
|
|
1562
|
+
* Search users (equivalent to searchUsers from legacy client)
|
|
1563
|
+
* @param searchTerms - Search string to find users
|
|
1564
|
+
* @param start - Starting offset for pagination (optional)
|
|
1565
|
+
* @param size - Maximum number of results to return (optional)
|
|
1566
|
+
* @returns Array of users matching the search criteria
|
|
1567
|
+
*/
|
|
1568
|
+
searchUsers(searchTerms: string, start?: number, size?: number): Promise<NDExUser[]>;
|
|
1569
|
+
/**
|
|
1570
|
+
* Get networks for a user's account page (equivalent to getAccountPageNetworks from legacy client)
|
|
1571
|
+
*
|
|
1572
|
+
* @param userUUID - User UUID to get networks for
|
|
1573
|
+
* @param offset - Starting offset for pagination (optional)
|
|
1574
|
+
* @param limit - Maximum number of networks to return (optional)
|
|
1575
|
+
* @returns Array of V2 network summaries for the specified user
|
|
1576
|
+
* @note This function requires authentication. The auth attribute must be set in the client configuration.
|
|
1577
|
+
*/
|
|
1578
|
+
getAccountPageNetworks(userUUID: string, offset?: number, limit?: number): Promise<NetworkSummaryV2[]>;
|
|
1579
|
+
/**
|
|
1580
|
+
* Delete user account (server validates userid matches authenticated user)
|
|
1581
|
+
* @param userUUID - User UUID to delete (must match authenticated user)
|
|
1582
|
+
* @note This function requires authentication. The auth attribute must be set in the client configuration.
|
|
1583
|
+
* @note The userUUID parameter must be the UUID of the currently authenticated user. The server will validate this.
|
|
1584
|
+
*/
|
|
1585
|
+
deleteUserAccount(userUUID: string): Promise<void>;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
/**
|
|
1589
|
+
* AdminService - NDEx admin operations
|
|
1590
|
+
* Handles system administration and user management for admin users
|
|
1591
|
+
*/
|
|
1592
|
+
declare class AdminService {
|
|
1593
|
+
private http;
|
|
1594
|
+
constructor(http: HTTPService);
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1597
|
+
/**
|
|
1598
|
+
* CyNDEx Service - Cytoscape-NDEx Bridge
|
|
1599
|
+
*
|
|
1600
|
+
* Provides seamless integration between Cytoscape desktop application and NDEx,
|
|
1601
|
+
* enabling import/export of networks with support for CX and CX2 formats.
|
|
1602
|
+
*
|
|
1603
|
+
* This service communicates with Cytoscape via its REST API and handles NDEx
|
|
1604
|
+
* authentication parameters that are passed to Cytoscape for NDEx operations.
|
|
1605
|
+
*
|
|
1606
|
+
* @example
|
|
1607
|
+
* ```typescript
|
|
1608
|
+
* // Basic usage
|
|
1609
|
+
* const cyNDEx = new CyNDExService();
|
|
1610
|
+
*
|
|
1611
|
+
* // Configure NDEx server
|
|
1612
|
+
* cyNDEx.setNDExBaseURL('https://www.ndexbio.org');
|
|
1613
|
+
*
|
|
1614
|
+
* // Set authentication
|
|
1615
|
+
* cyNDEx.setBasicAuth('username', 'password');
|
|
1616
|
+
* // or
|
|
1617
|
+
* cyNDEx.setAuthToken('oauth-id-token');
|
|
1618
|
+
*
|
|
1619
|
+
* // Import network from NDEx to Cytoscape
|
|
1620
|
+
* await cyNDEx.postNDExNetworkToCytoscape('network-uuid', 'access-key');
|
|
1621
|
+
*
|
|
1622
|
+
* // Export network from Cytoscape to NDEx
|
|
1623
|
+
* await cyNDEx.postCytoscapeNetworkToNDEx('current');
|
|
1624
|
+
*
|
|
1625
|
+
* // Import CX2 data to Cytoscape
|
|
1626
|
+
* await cyNDEx.postCX2NetworkToCytoscape(cx2String, 'My Network', 'My Collection');
|
|
1627
|
+
* ```
|
|
1628
|
+
*/
|
|
1629
|
+
declare class CyNDExService {
|
|
1630
|
+
private _port;
|
|
1631
|
+
private cyRestBaseURL;
|
|
1632
|
+
private ndexBaseURL;
|
|
1633
|
+
private authConfig?;
|
|
1634
|
+
private axiosInstance;
|
|
1635
|
+
/**
|
|
1636
|
+
* Create a new CyNDEx service instance
|
|
1637
|
+
*
|
|
1638
|
+
* @param port - Port number for Cytoscape REST API (default: 1234)
|
|
1639
|
+
* @param config - Optional configuration object
|
|
1640
|
+
*/
|
|
1641
|
+
constructor(port?: number, config?: CyNDExConfig);
|
|
1642
|
+
/**
|
|
1643
|
+
* Get the port number for Cytoscape REST API
|
|
1644
|
+
*/
|
|
1645
|
+
get port(): number;
|
|
1646
|
+
/**
|
|
1647
|
+
* Get the base URL for Cytoscape REST API
|
|
1648
|
+
*/
|
|
1649
|
+
static get cyRestBaseURL(): string;
|
|
1650
|
+
/**
|
|
1651
|
+
* Set NDEx server base URL
|
|
1652
|
+
*
|
|
1653
|
+
* @param ndexBaseURL - Complete base URL for NDEx server (e.g., 'https://www.ndexbio.org')
|
|
1654
|
+
* Must include protocol (https:// or http://)
|
|
1655
|
+
*
|
|
1656
|
+
* @example
|
|
1657
|
+
* ```typescript
|
|
1658
|
+
* cyNDEx.setNDExBaseURL('https://www.ndexbio.org');
|
|
1659
|
+
* cyNDEx.setNDExBaseURL('https://test.ndexbio.org');
|
|
1660
|
+
* ```
|
|
1661
|
+
*/
|
|
1662
|
+
setNDExBaseURL(ndexBaseURL: string): void;
|
|
1663
|
+
/**
|
|
1664
|
+
* Get the current NDEx server base URL
|
|
1665
|
+
*
|
|
1666
|
+
* @returns Complete NDEx server base URL
|
|
1667
|
+
*/
|
|
1668
|
+
getNDExBaseURL(): string;
|
|
1669
|
+
/**
|
|
1670
|
+
* Set basic authentication credentials for NDEx operations
|
|
1671
|
+
*
|
|
1672
|
+
* @param username - NDEx username
|
|
1673
|
+
* @param password - NDEx password
|
|
1674
|
+
*/
|
|
1675
|
+
setBasicAuth(username: string, password: string): void;
|
|
1676
|
+
/**
|
|
1677
|
+
* Set OAuth ID token for NDEx operations
|
|
1678
|
+
*
|
|
1679
|
+
* @param idToken - OAuth ID token from authentication provider
|
|
1680
|
+
*/
|
|
1681
|
+
setAuthToken(idToken: string): void;
|
|
1682
|
+
/**
|
|
1683
|
+
* Clear authentication credentials
|
|
1684
|
+
*/
|
|
1685
|
+
clearAuth(): void;
|
|
1686
|
+
/**
|
|
1687
|
+
* Get the complete Cytoscape REST API URL
|
|
1688
|
+
*
|
|
1689
|
+
* @returns Complete URL for Cytoscape REST API
|
|
1690
|
+
*/
|
|
1691
|
+
cyRestURL(): string;
|
|
1692
|
+
/**
|
|
1693
|
+
* Get authorization fields for NDEx operations
|
|
1694
|
+
* These are passed as parameters to Cytoscape for NDEx authentication
|
|
1695
|
+
*
|
|
1696
|
+
* @private
|
|
1697
|
+
* @returns Authorization parameters object
|
|
1698
|
+
*/
|
|
1699
|
+
private getAuthFields;
|
|
1700
|
+
/**
|
|
1701
|
+
* Perform HTTP GET request to Cytoscape REST API
|
|
1702
|
+
*
|
|
1703
|
+
* @private
|
|
1704
|
+
* @param url - Endpoint URL (relative to base URL)
|
|
1705
|
+
* @returns Promise resolving to response data
|
|
1706
|
+
*/
|
|
1707
|
+
private _httpGet;
|
|
1708
|
+
/**
|
|
1709
|
+
* Perform HTTP POST request to Cytoscape REST API
|
|
1710
|
+
*
|
|
1711
|
+
* @private
|
|
1712
|
+
* @param url - Endpoint URL (relative to base URL)
|
|
1713
|
+
* @param params - Optional query parameters
|
|
1714
|
+
* @param data - Optional request body data
|
|
1715
|
+
* @returns Promise resolving to response data
|
|
1716
|
+
*/
|
|
1717
|
+
private _httpPost;
|
|
1718
|
+
/**
|
|
1719
|
+
* Perform HTTP PUT request to Cytoscape REST API
|
|
1720
|
+
*
|
|
1721
|
+
* @private
|
|
1722
|
+
* @param url - Endpoint URL (relative to base URL)
|
|
1723
|
+
* @param params - Optional query parameters
|
|
1724
|
+
* @param data - Optional request body data
|
|
1725
|
+
* @returns Promise resolving to response data
|
|
1726
|
+
*/
|
|
1727
|
+
private _httpPut;
|
|
1728
|
+
/**
|
|
1729
|
+
* Get CyNDEx plugin status from Cytoscape
|
|
1730
|
+
*
|
|
1731
|
+
* @returns Promise resolving to CyNDEx status information
|
|
1732
|
+
*/
|
|
1733
|
+
getCyNDExStatus(): Promise<CyNDExStatusResponse>;
|
|
1734
|
+
/**
|
|
1735
|
+
* Get network summary information from Cytoscape
|
|
1736
|
+
*
|
|
1737
|
+
* @param suid - Network SUID or 'current' for current network (default: 'current')
|
|
1738
|
+
* @returns Promise resolving to network summary
|
|
1739
|
+
*/
|
|
1740
|
+
getCytoscapeNetworkSummary(suid?: string): Promise<CytoscapeNetworkSummary>;
|
|
1741
|
+
/**
|
|
1742
|
+
* Import network from NDEx to Cytoscape
|
|
1743
|
+
*
|
|
1744
|
+
* @param uuid - NDEx network UUID
|
|
1745
|
+
* @param accessKey - Optional access key for private networks
|
|
1746
|
+
* @param createView - Whether to create a network view (default: undefined)
|
|
1747
|
+
* @returns Promise resolving to import result
|
|
1748
|
+
*/
|
|
1749
|
+
postNDExNetworkToCytoscape(uuid: string, accessKey?: string, createView?: boolean): Promise<any>;
|
|
1750
|
+
/**
|
|
1751
|
+
* Import CX network data to Cytoscape
|
|
1752
|
+
*
|
|
1753
|
+
* @param cx - CX format network data
|
|
1754
|
+
* @returns Promise resolving to import result
|
|
1755
|
+
*/
|
|
1756
|
+
postCXNetworkToCytoscape(cx: any): Promise<any>;
|
|
1757
|
+
/**
|
|
1758
|
+
* Import CX2 network data to Cytoscape
|
|
1759
|
+
*
|
|
1760
|
+
* @param cx2_string - CX2 format network data as string
|
|
1761
|
+
* @param title - Network title
|
|
1762
|
+
* @param collection_name - Collection name
|
|
1763
|
+
* @returns Promise resolving to import result
|
|
1764
|
+
*/
|
|
1765
|
+
postCX2NetworkToCytoscape(cx2_string: string, title: string, collection_name: string): Promise<any>;
|
|
1766
|
+
/**
|
|
1767
|
+
* Export network from Cytoscape to NDEx (create new network)
|
|
1768
|
+
*
|
|
1769
|
+
* @param suid - Network SUID or 'current' for current network (default: 'current')
|
|
1770
|
+
* @returns Promise resolving to export result
|
|
1771
|
+
*/
|
|
1772
|
+
postCytoscapeNetworkToNDEx(suid?: string): Promise<any>;
|
|
1773
|
+
/**
|
|
1774
|
+
* Update existing network in NDEx with data from Cytoscape
|
|
1775
|
+
*
|
|
1776
|
+
* @param suid - Network SUID or 'current' for current network (default: 'current')
|
|
1777
|
+
* @param uuid - Target NDEx network UUID to update
|
|
1778
|
+
* @returns Promise resolving to update result
|
|
1779
|
+
*/
|
|
1780
|
+
putCytoscapeNetworkInNDEx(suid: string, uuid: string): Promise<any>;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* NDExClient - Main client class for NDEx API operations
|
|
1785
|
+
*
|
|
1786
|
+
* Provides a unified interface for all NDEx operations with intelligent
|
|
1787
|
+
* version routing between v2 and v3 APIs.
|
|
1788
|
+
*
|
|
1789
|
+
* @example
|
|
1790
|
+
* ```typescript
|
|
1791
|
+
* // Basic usage
|
|
1792
|
+
* const client = new NDExClient({
|
|
1793
|
+
* baseURL: 'https://www.ndexbio.org',
|
|
1794
|
+
* debug: true
|
|
1795
|
+
* });
|
|
1796
|
+
*
|
|
1797
|
+
* // Authenticate
|
|
1798
|
+
* await client.user.authenticate({ username: 'user', password: 'pass' });
|
|
1799
|
+
*
|
|
1800
|
+
* // Search networks
|
|
1801
|
+
* const results = await client.networks.searchNetworks({ searchString: 'pathway' });
|
|
1802
|
+
*
|
|
1803
|
+
* // Get network as CX2
|
|
1804
|
+
* const network = await client.networks.getNetworkAsCX2Object('network-uuid');
|
|
1805
|
+
*
|
|
1806
|
+
* // User operations
|
|
1807
|
+
* const profile = await client.user.getCurrentUser();
|
|
1808
|
+
*
|
|
1809
|
+
* // Admin operations (requires admin privileges)
|
|
1810
|
+
* const stats = await client.admin.getSystemStats();
|
|
1811
|
+
* ```
|
|
1812
|
+
*/
|
|
1813
|
+
declare class NDExClient {
|
|
1814
|
+
private httpService;
|
|
1815
|
+
/** Network operations with intelligent v2/v3 routing */
|
|
1816
|
+
readonly networks: UnifiedNetworkService;
|
|
1817
|
+
/** File upload/download and task management */
|
|
1818
|
+
readonly files: FilesService;
|
|
1819
|
+
/** Workspace operations (deprecated - most functionality moved to other services) */
|
|
1820
|
+
readonly workspace: WorkspaceService;
|
|
1821
|
+
/** User authentication and management */
|
|
1822
|
+
readonly user: UserService;
|
|
1823
|
+
/** System administration operations */
|
|
1824
|
+
readonly admin: AdminService;
|
|
1825
|
+
constructor(config?: NDExClientConfig);
|
|
1826
|
+
/**
|
|
1827
|
+
* Clear authentication
|
|
1828
|
+
*/
|
|
1829
|
+
logout(): void;
|
|
1830
|
+
/**
|
|
1831
|
+
* Get server status information
|
|
1832
|
+
* Can be called by authenticated or anonymous users.
|
|
1833
|
+
* @param format - Optional format parameter. Use 'full' for detailed information including properties and importers/exporters
|
|
1834
|
+
* @returns Server status including network/user counts and optional server details
|
|
1835
|
+
*/
|
|
1836
|
+
getServerStatus(format?: 'full'): Promise<{
|
|
1837
|
+
message: string;
|
|
1838
|
+
properties?: {
|
|
1839
|
+
ServerVersion: string;
|
|
1840
|
+
Build: string;
|
|
1841
|
+
ServerResultLimit: string;
|
|
1842
|
+
ImporterExporters: Array<{
|
|
1843
|
+
importer: boolean;
|
|
1844
|
+
exporter: boolean;
|
|
1845
|
+
fileExtension: string;
|
|
1846
|
+
name: string;
|
|
1847
|
+
description: string;
|
|
1848
|
+
}>;
|
|
1849
|
+
};
|
|
1850
|
+
networkCount: number;
|
|
1851
|
+
userCount: number;
|
|
1852
|
+
groupCount?: number;
|
|
1853
|
+
}>;
|
|
1854
|
+
/**
|
|
1855
|
+
* Check if client has valid authentication information configured
|
|
1856
|
+
* @returns true if auth is a valid BasicAuth or OAuthAuth object, false otherwise
|
|
1857
|
+
*/
|
|
1858
|
+
hasAuthInfo(): boolean;
|
|
1859
|
+
/**
|
|
1860
|
+
* Update client configuration
|
|
1861
|
+
*/
|
|
1862
|
+
updateConfig(config: Partial<NDExClientConfig>): void;
|
|
1863
|
+
/**
|
|
1864
|
+
* Get current client configuration
|
|
1865
|
+
*/
|
|
1866
|
+
getConfig(): NDExClientConfig;
|
|
1867
|
+
/**
|
|
1868
|
+
* Access to low-level HTTP service for advanced usage
|
|
1869
|
+
*/
|
|
1870
|
+
get http(): HTTPService;
|
|
1871
|
+
/**
|
|
1872
|
+
* Access to version-specific network services for advanced usage
|
|
1873
|
+
*/
|
|
1874
|
+
get v2(): {
|
|
1875
|
+
networks: NetworkServiceV2;
|
|
1876
|
+
};
|
|
1877
|
+
get v3(): {
|
|
1878
|
+
networks: NetworkServiceV3;
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Library version string imported from package.json
|
|
1883
|
+
*
|
|
1884
|
+
* Provides programmatic access to the current library version for:
|
|
1885
|
+
* - Runtime version checking and validation
|
|
1886
|
+
* - Debugging and error reporting
|
|
1887
|
+
* - Logging and telemetry
|
|
1888
|
+
* - Version-dependent feature detection
|
|
1889
|
+
*
|
|
1890
|
+
* @example
|
|
1891
|
+
* ```typescript
|
|
1892
|
+
* import { NDExClient, version } from '@js4cytoscape/ndex-client';
|
|
1893
|
+
*
|
|
1894
|
+
* console.log(`Using NDEx Client v${version}`);
|
|
1895
|
+
*
|
|
1896
|
+
* // In error reports
|
|
1897
|
+
* const errorReport = {
|
|
1898
|
+
* error: err.message,
|
|
1899
|
+
* libraryVersion: version,
|
|
1900
|
+
* timestamp: new Date().toISOString()
|
|
1901
|
+
* };
|
|
1902
|
+
* ```
|
|
1903
|
+
*/
|
|
1904
|
+
declare const version: string;
|
|
1905
|
+
|
|
1906
|
+
export { type APIError, type APIResponse, type AccessKeyAction, type AccessKeyResponse, type AccessParams, AdminService, type BasicAuth, type CX1Edge, type CX1MetaDataItem, type CX1MetaDataResponse, type CX1NetworkProperty, type CX2AttributeDeclarations, type CX2AttributeSpec, type CX2Edge, type CX2EdgeBypass, type CX2ImportParams, type CX2MetaData, CX2Network, type CX2NetworkAttribute, type CX2NetworkProperties, type CX2Node, type CX2NodeBypass, type CX2Status, type CX2VisualProperty, CyNDExService as CyNDEx, type CyNDExAuthConfig, type CyNDExConfig, CyNDExService, type CyNDExStatusResponse, type CyWebWorkspace, type CytoscapeNetworkSummary, type DefaultVisualProperties, type ExportFormat, type ExportRequest, FilesService, type MappingDefinition, type NDExAny, NDExAuthError, type NDExAuthResponse, NDExClient, type NDExClientConfig, NDExError, type NDExExportParams, type NDExImportParams, NDExNetworkError, NDExNotFoundError, type NDExObjectUpdateStatus, NDExServerError, type NDExUser, NDExValidationError, NetworkIndexLevel, type NetworkPermission, NetworkServiceV2, NetworkServiceV3, type NetworkSummaryV2, type NetworkSummaryV3, type OAuthAuth, type PaginationParams, type SearchParameters, type SearchResult, type TableColumnVisualStyle, type Task, type Timestamp, type UUID, UnifiedNetworkService, UserService, type VPMappingType, type VisualPropertyMapping, type VisualPropertyTable, WorkspaceService, version };
|