@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.mjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import U from'axios';/* NDEx Client Library - Modern TypeScript implementation */
|
|
2
|
+
var A=(r=>(r.NONE="NONE",r.BASIC="BASIC",r.FULL="FULL",r))(A||{}),p=class extends Error{constructor(t,r,s,n){super(t);this.statusCode=r;this.errorCode=s;this.description=n;this.name="NDExError";}},k=class extends p{constructor(t,r){super(t,void 0,"NETWORK_ERROR");this.originalError=r;this.name="NDExNetworkError";}},N=class extends p{constructor(e="Authentication failed",t=401){super(e,t,"AUTH_ERROR"),this.name="NDExAuthError";}},C=class extends p{constructor(e="Resource not found",t=404){super(e,t,"NOT_FOUND"),this.name="NDExNotFoundError";}},P=class extends p{constructor(e,t=400){super(e,t,"VALIDATION_ERROR"),this.name="NDExValidationError";}},x=class extends p{constructor(e="Internal server error",t=500){super(e,t,"SERVER_ERROR"),this.name="NDExServerError";}};var g=class a{constructor(e){this.CXVersion="2.0";this.hasFragments=false;this.metaData=[];e&&Object.assign(this,e),this.ensureRequiredMetadata();}static createEmpty(){let e=new a;return e.nodes=[],e.edges=[],e.metaData=[{name:"nodes",elementCount:0},{name:"edges",elementCount:0}],e}static fromJSON(e){let t=typeof e=="string"?JSON.parse(e):e;return new a(t)}static fromNetworkSummary(e){let t=a.createEmpty();return t.networkAttributes=[{name:e.name},...e.description?[{description:e.description}]:[],...e.version?[{version:e.version}]:[]],e.properties&&Object.entries(e.properties).forEach(([r,s])=>{t.networkAttributes?.push({[r]:s.v});}),t}addNode(e,t){this.nodes||(this.nodes=[]);let r={id:e};return t&&(r.v=t),this.nodes.push(r),this.updateNodeCount(),r}addEdge(e,t,r,s){this.edges||(this.edges=[]);let n={id:e,s:t,t:r};return s&&(n.v=s),this.edges.push(n),this.updateEdgeCount(),n}addNodeAttribute(e,t,r){let s=this.nodes.find(n=>n.id===e);s&&(s.v||(s.v={}),s.v[t]=r);}addEdgeAttribute(e,t,r){let s=this.edges.find(n=>n.id===e);s&&(s.v||(s.v={}),s.v[t]=r);}setNodeCoordinates(e,t,r,s){this.nodes||(this.nodes=[]);let n=this.nodes.find(i=>i.id===e);n||(n={id:e},this.nodes.push(n),this.updateNodeCount()),n.x=t,n.y=r,s!==void 0&&(n.z=s);}getNode(e){return this.nodes?.find(t=>t.id===e)}getEdge(e){return this.edges?.find(t=>t.id===e)}getNodes(){return this.nodes||[]}getEdges(){return this.edges||[]}getNodeCount(){return this.nodes?.length||0}getEdgeCount(){return this.edges?.length||0}getNetworkName(){return this.networkAttributes?.find(e=>"name"in e)?.name}setNetworkName(e){this.networkAttributes||(this.networkAttributes=[]),this.networkAttributes=this.networkAttributes.filter(t=>!("name"in t)),this.networkAttributes.push({name:e});}getNetworkAttribute(e){return this.networkAttributes?.find(t=>e in t)?.[e]}setNetworkAttribute(e,t){this.networkAttributes||(this.networkAttributes=[]),this.networkAttributes=this.networkAttributes.filter(r=>!(e in r)),this.networkAttributes.push({[e]:t});}validate(){let e=[];return this.CXVersion||e.push("CXVersion is required"),this.hasFragments===void 0&&e.push("hasFragments is required"),(!this.metaData||this.metaData.length===0)&&e.push("metaData is required and must not be empty"),this.metaData?.forEach((t,r)=>{t.name||e.push(`metaData[${r}] is missing required 'name' field`);}),this.nodes&&this.nodes.forEach((t,r)=>{(t.id===void 0||t.id===null)&&e.push(`nodes[${r}] is missing required 'id' field`);}),this.edges&&this.edges.forEach((t,r)=>{if((t.id===void 0||t.id===null)&&e.push(`edges[${r}] is missing required 'id' field`),(t.s===void 0||t.s===null)&&e.push(`edges[${r}] is missing required 's' (source) field`),(t.t===void 0||t.t===null)&&e.push(`edges[${r}] is missing required 't' (target) field`),this.nodes&&t.s!==void 0&&t.t!==void 0){let s=this.nodes.some(i=>i.id===t.s),n=this.nodes.some(i=>i.id===t.t);s||e.push(`edges[${r}] references non-existent source node ${t.s}`),n||e.push(`edges[${r}] references non-existent target node ${t.t}`);}}),{isValid:e.length===0,errors:e}}toJSON(){return JSON.stringify(this,null,2)}clone(){return new a(JSON.parse(this.toJSON()))}getStatistics(){return {nodeCount:this.getNodeCount(),edgeCount:this.getEdgeCount(),hasCoordinates:!!(this.nodes&&this.nodes.some(e=>e.x!==void 0||e.y!==void 0||e.z!==void 0)),hasVisualProperties:!!(this.visualProperties&&(this.visualProperties.default||this.visualProperties.edgeMapping||this.visualProperties.nodeMapping))}}ensureRequiredMetadata(){this.metaData||(this.metaData=[]),this.nodes&&!this.metaData.find(e=>e.name==="nodes")&&this.metaData.push({name:"nodes",elementCount:this.nodes.length}),this.edges&&!this.metaData.find(e=>e.name==="edges")&&this.metaData.push({name:"edges",elementCount:this.edges.length});}updateNodeCount(){let e=this.metaData?.find(t=>t.name==="nodes");e&&(e.elementCount=this.nodes?.length||0);}updateEdgeCount(){let e=this.metaData?.find(t=>t.name==="edges");e&&(e.elementCount=this.edges?.length||0);}};var m=class{constructor(e){this.http=e;}async getRawCX1Network(e,t={}){let r=new URLSearchParams;t.accesskey&&r.append("accesskey",t.accesskey);let s=`network/${e}${r.toString()?`?${r.toString()}`:""}`;return this.http.get(s,{version:"v2",headers:{Accept:"application/json"}})}async getNetworkSummary(e,t={}){let r=new URLSearchParams;t.accesskey&&r.append("accesskey",t.accesskey);let s=`network/${e}/summary${r.toString()?`?${r.toString()}`:""}`;return this.http.get(s,{version:"v2"})}async copyNetwork(e){let t=`network/${e}/copy`;return this.http.post(t,{},{version:"v2"})}async searchNetworks(e,t,r,s){let n={};t!==void 0&&(n.start=t.toString()),r!==void 0&&(n.limit=r.toString());let i={searchString:e};return s!==void 0&&(s.permission!==void 0&&(i.permission=s.permission),s.includeGroups!==void 0&&(i.includeGroups=s.includeGroups),s.accountName!==void 0&&(i.accountName=s.accountName)),this.http.post("search/network",i,{version:"v2",params:n})}async createNetworkFromRawCX1(e,t={}){let n=(await this.http.post("network",e,{version:"v2",params:t})).split("/");return n[n.length-1]}async updateNetworkFromRawCX1(e,t){let r=`network/${e}`;return this.http.put(r,t,{version:"v2"})}async deleteNetwork(e){let t=`network/${e}`;return this.http.delete(t,{version:"v2"})}async getNetworkSummariesByUUIDs(e,t){let r=t?{accesskey:t}:void 0;return this.http.post("batch/network/summary",e,{version:"v2",params:r})}async getUserNetworks(e,t={}){let r=new URLSearchParams;t.start!==void 0&&r.append("start",t.start.toString()),t.size!==void 0&&r.append("size",t.size.toString());let s=`user/${e}/networks${r.toString()?`?${r.toString()}`:""}`;return this.http.get(s,{version:"v2"})}async setNetworkSystemProperties(e,t){let r=`networks/${e}/systemproperty`;return this.http.put(r,t,{version:"v2"})}async getNetworkPermissions(e){let t=`networks/${e}/permission`;return this.http.get(t,{version:"v2"})}async setNetworkPermissions(e,t){let r=`networks/${e}/permission`;return this.http.put(r,t,{version:"v2"})}async grantNetworkPermission(e,t,r){let s=`networks/${e}/permission`,n={memberUUID:t,permission:r};return this.http.post(s,n,{version:"v2"})}async revokeNetworkPermission(e,t){let r=`networks/${e}/permission`;return this.http.delete(r,{version:"v2",data:{memberUUID:t}})}async getNetworkProfile(e){let t=`networks/${e}/profile`;return this.http.get(t,{version:"v2"})}async setNetworkProfile(e,t){let r=`networks/${e}/profile`;return this.http.put(r,t,{version:"v2"})}async makeNetworkPublic(e){let t=`networks/${e}/systemproperty`,r={visibility:"PUBLIC"};return this.http.put(t,r,{version:"v2"})}async makeNetworkPrivate(e){let t=`networks/${e}/systemproperty`,r={visibility:"PRIVATE"};return this.http.put(t,r,{version:"v2"})}async getNetworkSample(e,t={}){let r=new URLSearchParams;t.accesskey&&r.append("accesskey",t.accesskey);let s=`networks/${e}/sample${r.toString()?`?${r.toString()}`:""}`;return this.http.get(s,{version:"v2"})}async getMetaData(e,t){let r=new URLSearchParams;t!==void 0&&r.append("accesskey",t);let s=`network/${e}/aspect${r.toString()?`?${r.toString()}`:""}`;return this.http.get(s,{version:"v2"})}async getAccessKey(e){let t=`networks/${e}/accesskey`;return this.http.get(t,{version:"v2"})}async updateAccessKey(e,t){let r=`networks/${e}/accesskey`;return this.http.put(r,{action:t},{version:"v2"})}};var h=class{constructor(e){this.http=e;}async getNetworkSummary(e,t={}){let r=new URLSearchParams;t.accesskey&&r.append("accesskey",t.accesskey);let s=`networks/${e}/summary${r.toString()?`?${r.toString()}`:""}`;return this.http.get(s,{version:"v3"})}async getRawCX2Network(e,t={}){let r=new URLSearchParams;t.accesskey&&r.append("accesskey",t.accesskey);let s=`networks/${e}${r.toString()?`?${r.toString()}`:""}`;return this.http.get(s,{version:"v3"})}async createNetworkDOI(e,t,r){let s=new URLSearchParams;s.append("key",t),s.append("email",r);let n=`networks/${e}/DOI?${s.toString()}`;return this.http.get(n,{version:"v3"})}async getAttributesOfSelectedNodes(e,t,r={}){let s=new URLSearchParams;r.accesskey&&s.append("accesskey",r.accesskey);let n={ids:t.ids,attributeNames:t.attributeNames},i=`search/networks/${e}/nodes${s.toString()?`?${s.toString()}`:""}`;return this.http.post(i,n,{version:"v3"})}async getNetworkSummariesV3ByUUIDs(e,t,r){let s={format:r===void 0?"FULL":r};return t!=null&&(s.accesskey=t),this.http.post("batch/networks/summary",e,{version:"v3",params:s})}async searchNetworks(e={}){let t=new URLSearchParams;e.searchString&&t.append("searchString",e.searchString),e.accountName&&t.append("accountName",e.accountName),e.permission&&t.append("permission",e.permission),e.includeGroups!==void 0&&t.append("includeGroups",e.includeGroups.toString()),e.admin&&t.append("admin",e.admin),e.start!==void 0&&t.append("start",e.start.toString()),e.size!==void 0&&t.append("size",e.size.toString()),e.source&&t.append("source",e.source);let r=`search/network${t.toString()?`?${t.toString()}`:""}`;return this.http.get(r,{version:"v3"})}async getNetworkAsCX2Object(e,t={}){let r=await this.getRawCX2Network(e,t);return new g(r)}async createNetworkFromCX2(e,t={}){let r="networks",s=e instanceof g?JSON.parse(e.toJSON()):e;return this.http.post(r,s,{version:"v3",params:t})}async updateNetworkCX2(e,t){let r=`networks/${e}`,s=t instanceof g?JSON.parse(t.toJSON()):t;return this.http.put(r,s,{version:"v3"})}async uploadNetworkFile(e,t={}){return this.http.uploadFile("networks/upload",e,{version:"v3",...t})}async getNetworkMetadata(e){let t=`networks/${e}/metadata`;return this.http.get(t,{version:"v3"})}async updateNetworkMetadata(e,t){let r=`networks/${e}/metadata`;return this.http.put(r,t,{version:"v3"})}async getNetworkAspect(e,t,r={}){let s=new URLSearchParams;r.accesskey&&s.append("accesskey",r.accesskey);let n=`networks/${e}/aspects/${t}${s.toString()?`?${s.toString()}`:""}`;return this.http.get(n,{version:"v3"})}};var f=class{constructor(e){this.http=e;this.v2Service=new m(e),this.v3Service=new h(e);}async getNetworkSummary(e,t={}){return this.v3Service.getNetworkSummary(e,t)}async getRawCX1Network(e,t={}){return this.v2Service.getRawCX1Network(e,t)}async getRawCX2Network(e,t={}){return this.v3Service.getRawCX2Network(e,t)}async deleteNetwork(e){return this.v2Service.deleteNetwork(e)}async createNetworkDOI(e,t,r){return this.v3Service.createNetworkDOI(e,t,r)}async getAttributesOfSelectedNodes(e,t,r={}){return this.v3Service.getAttributesOfSelectedNodes(e,t,r)}async neighborhoodQuery(e,t,r,s,n=false){let i={};r!==void 0&&r===true&&(i.save="true");let o={searchString:t,searchDepth:1};if(s!==void 0&&(s.searchDepth!==void 0&&(o.searchDepth=s.searchDepth),s.edgeLimit!==void 0&&(o.edgeLimit=s.edgeLimit),s.errorWhenLimitIsOver!==void 0&&(o.errorWhenLimitIsOver=s.errorWhenLimitIsOver),s.directOnly!==void 0&&(o.directOnly=s.directOnly),s.nodeIds!=null&&(o.nodeIds=s.nodeIds)),n){let c=`search/network/${e}/query`;return this.http.post(c,o,{version:"v3",params:i})}let d=`search/network/${e}/query`;return this.http.post(d,o,{version:"v2",params:i})}async interConnectQuery(e,t,r,s,n=false){let i={};r!==void 0&&r===true&&(i.save="true");let o={searchString:t};if(s!==void 0&&(s.edgeLimit!==void 0&&(o.edgeLimit=s.edgeLimit),s.errorWhenLimitIsOver!==void 0&&(o.errorWhenLimitIsOver=s.errorWhenLimitIsOver),s.nodeIds!=null&&(o.nodeIds=s.nodeIds)),n){let c=`search/networks/${e}/interconnectquery`;return this.http.post(c,o,{version:"v3",params:i})}let d=`search/network/${e}/interconnectquery`;return this.http.post(d,o,{version:"v2",params:i})}async getNetworkPermissionsByUUIDs(e){return this.http.post("batch/network/permission",e,{version:"v2"})}async exportNetworks(e){return this.http.post("batch/network/export",e,{version:"v2"})}async moveNetworks(e,t){if(!Array.isArray(e))throw new Error("Invalid networkIds - must be an array");let r="batch/networks/move",s={targetFolder:t,networks:e};return this.http.post(r,s,{version:"v3"})}async setNetworksVisibility(e,t){this.validateShareData(e);let r="batch/networks/visibility",s={items:e,visibility:t};return this.http.post(r,s,{version:"v3"})}async getRandomEdges(e,t,r){if(t<=0)throw new Error("Value of parameter limit has to be greater than 0.");let s={size:t.toString(),method:"random"};r!==void 0&&(s.accesskey=r);let n=`networks/${e}/aspects/edges`;return this.http.get(n,{version:"v3",params:s})}validateShareData(e){if(typeof e!="object"||e===null||e.files===void 0)throw new Error('Data must be an object with a "files" property');if(typeof e.files!="object"||e.files===null)throw new Error('The "files" property must be an object');let t=["NETWORK","FOLDER","SHORTCUT"];for(let[r,s]of Object.entries(e.files)){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(r))throw new Error(`Invalid UUID format: ${r}`);if(!t.includes(s))throw new Error(`Invalid file type for ${r}: ${s}. Must be one of: ${t.join(", ")}`)}}async getAspectElements(e,t,r,s){let n={};r!==void 0&&(n.size=r.toString()),s!==void 0&&(n.accesskey=s);let i=`networks/${e}/aspects/${t}`;return this.http.get(i,{version:"v3",params:n})}async getFilteredEdges(e,t,r,s,n,i,o,d){let c={};n!==void 0&&(c.size=n.toString()),i!==void 0&&(c.order=i),d!==void 0&&(c.accesskey=d),o!==void 0&&(c.format=o);let u={name:t,value:r,operator:s},b=`search/networks/${e}/edges`;return this.http.post(b,u,{version:"v3",params:c})}async getCX2MetaData(e,t){let r={};t!==void 0&&(r.accesskey=t);let s=`networks/${e}/aspects`;return this.http.get(s,{version:"v3",params:r})}async createNetworkFromRawCX2(e,t={}){return this.v3.createNetworkFromCX2(e,t)}async updateNetworkFromRawCX2(e,t){let r=`networks/${e}`;return this.http.put(r,t,{version:"v3"})}get v2(){return this.v2Service}get v3(){return this.v3Service}};var y=class{constructor(e){this.http=e;}copyFile(e,t,r,s){let n={};return s!==void 0&&(n.accesskey=s),this.http.post("files/copy",{from_uuid:e,type:r,to_path:t},{params:n,version:"v3"})}getCount(){return this.http.get("files/count",{version:"v3"})}getTrash(){return this.http.get("files/trash",{version:"v3"})}emptyTrash(){return this.http.delete("files/trash",{version:"v3"})}permanentlyDeleteFile(e){return this.http.delete(`files/trash/${e}`,{version:"v3"})}restoreFile(e,t,r){return this.http.post("files/trash/restore",{networks:e,folders:t,shortcuts:r},{version:"v3"})}_validateShareData(e){if(typeof e!="object"||e===null||e.files===void 0)throw new Error('Data must be an object with a "files" property');if(typeof e.files!="object"||e.files===null)throw new Error('The "files" property must be an object');let t=["NETWORK","FOLDER","SHORTCUT"];for(let[r,s]of Object.entries(e.files)){if(!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(r))throw new Error(`Invalid UUID format: ${r}`);if(!t.includes(s))throw new Error(`Invalid file type for ${r}: ${s}. Must be one of: ${t.join(", ")}`)}}_validateMemberData(e){if(typeof e!="object"||e===null||e.members===void 0)throw new Error('Data must be an object with a "members" property');let t=["READ","WRITE"];for(let[r,s]of Object.entries(e.members)){if(!t.includes(s))throw new Error(`Invalid permission for ${r}: ${s}. Must be one of: ${t.join(", ")}`);if(typeof r!="string"||!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(r))throw new Error(`Invalid UUID format: ${r}`)}}updateMember(e,t){return this._validateShareData({files:e}),this._validateMemberData({members:t}),this.http.post("files/sharing/members",{files:e,members:t},{version:"v3"})}listMembers(e){return this.http.get("files/sharing/members/list",{params:e,version:"v3"})}transferOwnership(e,t){return this._validateShareData({files:e}),this.http.post("files/sharing/transfer_ownership",{files:e,new_owner:t},{version:"v3"})}listShares(e){let t={};return e!==void 0&&(t.limit=e),this.http.post("files/sharing/list",t,{version:"v3"})}share(e){return this._validateShareData({files:e}),this.http.post("files/sharing/share",{files:e},{version:"v3"})}unshare(e){return this._validateShareData({files:e}),this.http.post("files/sharing/unshare",{files:e},{version:"v3"})}getFolders(e){let t={};return e!==void 0&&(t.limit=e),this.http.get("files/folders",{params:t,version:"v3"})}createFolder(e,t){return this.http.post("files/folders",{name:e,parent:t},{version:"v3"})}getFolder(e,t){let r={};return t!==void 0&&(r.accesskey=t),this.http.get(`files/folders/${e}`,{params:r,version:"v3"})}updateFolder(e,t,r){return this.http.put(`files/folders/${e}`,{name:t,parent:r},{version:"v3"})}deleteFolder(e){return this.http.delete(`files/folders/${e}`,{version:"v3"})}getFolderCount(e,t){let r={};return t!==void 0&&(r.accesskey=t),this.http.get(`files/folders/${e}/count`,{params:r,version:"v3"})}getFolderList(e,t,r,s){let n={};return t!==void 0&&(n.accesskey=t),r!==void 0&&(n.format=r),s!==void 0&&(n.type=s),this.http.get(`files/folders/${e}/list`,{params:n,version:"v3"})}getShortcuts(e){let t={};return e!==void 0&&(t.limit=e),this.http.get("files/shortcuts",{params:t,version:"v3"})}createShortcut(e,t,r,s){return this.http.post("files/shortcuts",{name:e,parent:t,target:r,targetType:s},{version:"v3"})}getShortcut(e,t){let r={};return t!==void 0&&(r.accesskey=t),this.http.get(`files/shortcuts/${e}`,{params:r,version:"v3"})}updateShortcut(e,t,r,s,n){return this.http.put(`files/shortcuts/${e}`,{name:t,parent:r,target:s,targetType:n},{version:"v3"})}deleteShortcut(e){return this.http.delete(`files/shortcuts/${e}`,{version:"v3"})}};var l=class{constructor(e){this.http=e;}async createCyWebWorkspace(e){return this.http.post("workspaces",e,{version:"v3"})}async getCyWebWorkspace(e){let t=`workspaces/${e}`;return this.http.get(t,{version:"v3"})}async deleteCyWebWorkspace(e){let t=`workspaces/${e}`;return this.http.delete(t,{version:"v3"})}async updateCyWebWorkspace(e,t){let r=`workspaces/${e}`;return this.http.put(r,t,{version:"v3"})}async updateCyWebWorkspaceName(e,t){let r=`workspaces/${e}/name`;return this.http.put(r,{name:t},{version:"v3"})}async updateCyWebWorkspaceNetworks(e,t){let r=`workspaces/${e}/networkids`;return this.http.put(r,t,{version:"v3"})}async getUserCyWebWorkspaces(){let t=`users/${(await this.http.get("user",{params:{valid:true}})).externalId}/workspaces`;return this.http.get(t,{version:"v3"})}};var v=class{constructor(e){this.http=e;}async authenticate(){let e=this.http.getAuthType();if(!e)throw new Error("Authentication parameters are missing in NDEx client.");if(e==="basic"){let t="user",r={valid:true};return this.http.get(t,{params:r})}else if(e==="oauth"){let t=this.http.getIdToken();if(!t)throw new Error("OAuth ID token is missing.");let r="users/signin",s={idToken:t};return this.http.post(r,s,{version:"v3"})}throw new Error(`Unsupported authentication type: ${e}`)}async getCurrentUser(){if(!this.http.getAuthType())throw new Error("Authentication parameters are missing in NDEx client.");let t="user",r={valid:true};return this.http.get(t,{params:r})}async updateCurrentUser(e){if(!e.externalId)throw new Error("User uuid is required in userUpdate object");let t=`user/${e.externalId}`;return this.http.put(t,e)}async requestPasswordReset(e){return this.http.post("user/forgot-password",{email:e})}async resetPassword(e,t){let r=`user/${e}/password`,s={headers:{"Content-Type":"text/plain"}};return this.http.put(r,t,s)}async getUser(e){let t=`user/${e}`;return this.http.get(t)}async getUserByNameOrEmail(e){let t=new URLSearchParams;"username"in e?t.append("username",e.username):"email"in e&&t.append("email",e.email);let r=`user?${t.toString()}`;return this.http.get(r)}async getUsersByUUIDs(e){return this.http.post("batch/user",e)}async searchUsers(e,t,r){let s={};t!==void 0&&(s.start=t.toString()),r!==void 0&&(s.limit=r.toString());let n={searchString:e};return this.http.post("search/user",n,{params:s})}async getAccountPageNetworks(e,t,r){let s={};t!==void 0&&(s.offset=t.toString()),r!==void 0&&(s.limit=r.toString());let n=`user/${e}/networksummary`;return this.http.get(n,{params:s})}async deleteUserAccount(e){let t=`user/${e}`;return this.http.delete(t)}};var w=class{constructor(e){this.http=e;}};var S=class{constructor(e=1234,t){this._port=e,this.cyRestBaseURL=t?.cyRestBaseURL||"http://127.0.0.1",this.ndexBaseURL=t?.ndexBaseURL||"https://www.ndexbio.org",this.axiosInstance=U.create({baseURL:this.cyRestURL(),timeout:3e4,headers:{"Content-Type":"application/json"}});}get port(){return this._port}static get cyRestBaseURL(){return "http://127.0.0.1"}setNDExBaseURL(e){e?.trim()&&(this.ndexBaseURL=e.trim());}getNDExBaseURL(){return this.ndexBaseURL}setBasicAuth(e,t){e?.trim()&&t&&(this.authConfig={type:"basic",username:e.trim(),password:t});}setAuthToken(e){e?.trim()&&(this.authConfig={type:"oauth",idToken:e.trim()});}clearAuth(){this.authConfig=void 0;}cyRestURL(){return `${this.cyRestBaseURL}:${this._port}`}getAuthFields(){if(!this.authConfig)return {};switch(this.authConfig.type){case "basic":return {username:this.authConfig.username,password:this.authConfig.password};case "oauth":return {idToken:this.authConfig.idToken};default:return {}}}async _httpGet(e){return (await this.axiosInstance.get(e)).data}async _httpPost(e,t,r){return (await this.axiosInstance.post(e,r,{params:t})).data}async _httpPut(e,t,r){return (await this.axiosInstance.put(e,r,{params:t})).data}async getCyNDExStatus(){return this._httpGet("/cyndex2/v1")}async getCytoscapeNetworkSummary(e="current"){return this._httpGet(`/cyndex2/v1/networks/${e}`)}async postNDExNetworkToCytoscape(e,t,r){let s={serverUrl:`${this.ndexBaseURL}/v2`,uuid:e,accessKey:t,createView:r,...this.getAuthFields()};return this._httpPost("/cyndex2/v1/networks",void 0,s)}async postCXNetworkToCytoscape(e){return this._httpPost("/cyndex2/v1/networks/cx",void 0,e)}async postCX2NetworkToCytoscape(e,t,r){let s={format:"cx2",collection:r,title:t};return this._httpPost("/v1/networks",s,e)}async postCytoscapeNetworkToNDEx(e="current"){let t={serverUrl:`${this.ndexBaseURL}/v2`,...this.getAuthFields()};return this._httpPost(`/cyndex2/v1/networks/${e}`,void 0,t)}async putCytoscapeNetworkInNDEx(e="current",t){let r={serverUrl:`${this.ndexBaseURL}/v2`,uuid:t,...this.getAuthFields()};return this._httpPut(`/cyndex2/v1/networks/${e}`,void 0,r)}};var E="0.6.0-alpha.2";var R=class{constructor(e={}){this.config={baseURL:"https://www.ndexbio.org",timeout:3e4,retries:3,retryDelay:1e3,debug:false,...e};let t={"Content-Type":"application/json",...this.config.headers,...this.getAuthHeaders()};typeof window>"u"&&(t["User-Agent"]=`NDEx-JS-Client/${E}`),this.axiosInstance=U.create({baseURL:this.config.baseURL,timeout:this.config.timeout,headers:t}),this.setupInterceptors();}getAuthHeaders(){return this.config.auth?this.config.auth.type==="basic"?{Authorization:`Basic ${btoa(`${this.config.auth.username}:${this.config.auth.password}`)}`}:this.config.auth.type==="oauth"?{Authorization:`Bearer ${this.config.auth.idToken}`}:{}:{}}buildUrl(e,t="v2"){let r=e.startsWith("/")?e.slice(1):e;return `/${t}/${r}`}async get(e,t){let{version:r,...s}=t||{},n=this.buildUrl(e,r);try{let i=await this.axiosInstance.get(n,s);return this.handleResponse(i)}catch(i){this.handleError(i);}}async post(e,t,r){let{version:s,...n}=r||{},i=this.buildUrl(e,s);try{let o=await this.axiosInstance.post(i,t,n);return this.handleResponse(o)}catch(o){this.handleError(o);}}async put(e,t,r){let{version:s,...n}=r||{},i=this.buildUrl(e,s);try{let o=await this.axiosInstance.put(i,t,n);return this.handleResponse(o)}catch(o){this.handleError(o);}}async delete(e,t){let{version:r,...s}=t||{},n=this.buildUrl(e,r);try{let i=await this.axiosInstance.delete(n,s);return this.handleResponse(i)}catch(i){this.handleError(i);}}async uploadFile(e,t,r={}){let{version:s,onProgress:n,contentType:i,...o}=r,d=this.buildUrl(e,s),c=new FormData;if(t instanceof File)c.append("file",t,t.name);else if(t instanceof Blob)c.append("file",t,"file.cx2");else if(typeof t=="string"){let u=new Blob([t],{type:i||"application/json"});c.append("file",u,"file.cx2");}else c.append("file",t,"file.cx2");try{let u=await this.axiosInstance.post(d,c,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:n?b=>{let T=Math.round(b.loaded*100/(b.total||1));n(T);}:void 0,...o});return this.handleResponse(u)}catch(u){this.handleError(u);}}setupInterceptors(){this.axiosInstance.interceptors.request.use(e=>(this.config.debug&&console.log("NDEx API Request:",{method:e.method?.toUpperCase(),url:e.url,headers:e.headers}),e),e=>(this.config.debug&&console.error("NDEx API Request Error:",e),Promise.reject(e))),this.axiosInstance.interceptors.response.use(e=>(this.config.debug&&console.log("NDEx API Response:",{status:e.status,url:e.config.url,data:e.data}),e),e=>(this.config.debug&&console.error("NDEx API Response Error:",e.response?.data||e.message),Promise.reject(e)));}handleResponse(e){return e.data&&typeof e.data=="object"&&"errorCode"in e.data&&this.throwNDExError(e.data.message||"Unknown error occurred",e.status,e.data.errorCode||"UNKNOWN_ERROR",e.data.description),e.data&&typeof e.data=="object"&&"data"in e.data?e.data.data:e.data}handleError(e){if(e.response){let t=e.response.data?.message||e.message,r=e.response.data?.errorCode||`HTTP_${e.response.status}`,s=e.response.data?.description;this.throwNDExError(t,e.response.status,r,s);}else throw e.request?new k("Network error - no response received",e):new p(e.message||"Unknown error occurred",void 0,"CLIENT_ERROR",e.toString())}throwNDExError(e,t,r,s){switch(t){case 400:throw new P(e,t);case 401:case 403:throw new N(e,t);case 404:throw new C(e,t);case 500:case 502:case 503:case 504:throw new x(e,t);default:throw new p(e,t,r,s)}}updateConfig(e){if(this.config={...this.config,...e},e.baseURL&&(this.axiosInstance.defaults.baseURL=e.baseURL),e.timeout&&(this.axiosInstance.defaults.timeout=e.timeout),e.headers&&Object.assign(this.axiosInstance.defaults.headers,e.headers),"auth"in e){let t=this.getAuthHeaders();delete this.axiosInstance.defaults.headers.common.Authorization,Object.assign(this.axiosInstance.defaults.headers.common,t);}}getConfig(){return {...this.config}}getAuthType(){return this.config.auth?.type}getIdToken(){return this.config.auth?.type==="oauth"?this.config.auth.idToken:void 0}setIdToken(e){this.updateConfig({auth:{type:"oauth",idToken:e}});}};var D=class{constructor(e={}){this.httpService=new R(e),this.networks=new f(this.httpService),this.files=new y(this.httpService),this.workspace=new l(this.httpService),this.user=new v(this.httpService),this.admin=new w(this.httpService);}logout(){this.httpService.updateConfig({auth:void 0});}async getServerStatus(e){let t=new URLSearchParams;e&&t.append("format",e);let r=`admin/status${t.toString()?`?${t.toString()}`:""}`;return this.httpService.get(r)}hasAuthInfo(){let e=this.httpService.getConfig().auth;return e?e.type==="basic"?!!e.username&&!!e.password:e.type==="oauth"?!!e.idToken:false:false}updateConfig(e){this.httpService.updateConfig(e);}getConfig(){return this.httpService.getConfig()}get http(){return this.httpService}get v2(){return {networks:this.networks.v2}}get v3(){return {networks:this.networks.v3}}},le=E;
|
|
3
|
+
export{w as AdminService,g as CX2Network,S as CyNDEx,S as CyNDExService,y as FilesService,N as NDExAuthError,D as NDExClient,p as NDExError,k as NDExNetworkError,C as NDExNotFoundError,x as NDExServerError,P as NDExValidationError,A as NetworkIndexLevel,m as NetworkServiceV2,h as NetworkServiceV3,f as UnifiedNetworkService,v as UserService,l as WorkspaceService,le as version};//# sourceMappingURL=index.mjs.map
|
|
4
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/index.ts","../src/models/CX2Network.ts","../src/services/NetworkServiceV2.ts","../src/services/NetworkServiceV3.ts","../src/services/UnifiedNetworkService.ts","../src/services/FilesService.ts","../src/services/WorkspaceService.ts","../src/services/UserService.ts","../src/services/AdminService.ts","../src/services/CyNDExService.ts","../package.json","../src/services/HTTPService.ts","../src/index.ts"],"names":["NetworkIndexLevel","NDExError","message","statusCode","errorCode","description","NDExNetworkError","originalError","NDExAuthError","NDExNotFoundError","NDExValidationError","NDExServerError","CX2Network","_CX2Network","data","network","json","summary","key","value","id","attributes","node","sourceId","targetId","edge","nodeId","attributeName","edgeId","e","x","y","z","n","attr","name","errors","meta","index","sourceExists","targetExists","m","nodesMeta","edgesMeta","NetworkServiceV2","http","networkUUID","options","params","endpoint","searchTerms","start","size","optionalParameters","rawCX","uuidr","uuidList","accessKey","accountName","properties","permissions","userUUID","permission","permissionData","profile","action","NetworkServiceV3","email","nodeSelection","format","searchParams","cx2Data","file","metadata","aspectName","UnifiedNetworkService","saveResult","parameters","outputCX2","exportJob","networkIds","folderId","files","visibility","limit","validValues","uuid","fileType","columnName","valueString","operator","order","rawCX2","FilesService","fromUuid","toPath","type","fileId","folderIds","shortcutIds","members","newOwner","parentFolderId","targetType","shortcutId","WorkspaceService","workspace","workspaceId","workspaceObj","newName","UserService","authType","idToken","userUpdate","newPassword","config","searchBy","offset","AdminService","CyNDExService","port","axios","ndexBaseURL","username","password","url","suid","createView","importParams","cx","cx2_string","title","collection_name","saveParams","version","HTTPService","headers","cleanEndpoint","axiosConfig","response","error","onProgress","contentType","formData","blob","progressEvent","progress","newConfig","authHeaders","NDExClient","auth"],"mappings":";AA4EO,IAAKA,OACVA,CAAAA,CAAA,IAAA,CAAO,MAAA,CACPA,CAAAA,CAAA,MAAQ,OAAA,CACRA,CAAAA,CAAA,IAAA,CAAO,MAAA,CAHGA,OAAA,EAAA,CAAA,CA0UCC,CAAAA,CAAN,cAAwB,KAAM,CACnC,YACEC,CAAAA,CACOC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACP,CACA,KAAA,CAAMH,CAAO,EAJN,IAAA,CAAA,UAAA,CAAAC,CAAAA,CACA,eAAAC,CAAAA,CACA,IAAA,CAAA,WAAA,CAAAC,CAAAA,CAGP,IAAA,CAAK,KAAO,YACd,CACF,EAKaC,CAAAA,CAAN,cAA+BL,CAAU,CAC9C,WAAA,CAAYC,CAAAA,CAAwBK,CAAAA,CAAuB,CACzD,KAAA,CAAML,CAAAA,CAAS,OAAW,eAAe,CAAA,CADP,mBAAAK,CAAAA,CAElC,IAAA,CAAK,IAAA,CAAO,mBACd,CACF,CAAA,CAKaC,CAAAA,CAAN,cAA4BP,CAAU,CAC3C,YAAYC,CAAAA,CAAkB,uBAAA,CAAyBC,CAAAA,CAAqB,GAAA,CAAK,CAC/E,KAAA,CAAMD,CAAAA,CAASC,EAAY,YAAY,CAAA,CACvC,KAAK,IAAA,CAAO,gBACd,CACF,CAAA,CAKaM,EAAN,cAAgCR,CAAU,CAC/C,WAAA,CAAYC,CAAAA,CAAkB,qBAAsBC,CAAAA,CAAqB,GAAA,CAAK,CAC5E,KAAA,CAAMD,EAASC,CAAAA,CAAY,WAAW,CAAA,CACtC,IAAA,CAAK,KAAO,oBACd,CACF,CAAA,CAKaO,CAAAA,CAAN,cAAkCT,CAAU,CACjD,YAAYC,CAAAA,CAAiBC,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AA,EACFrB,CAAAA,CAAO,OAAO,QAAA,CAAUqB,CAAM,EAGhC,IAAMpB,CAAAA,CAAW,CAAA,YAAA,EAAeD,CAAAA,CAAO,UAAS,CAAI,CAAA,CAAA,EAAIA,EAAO,QAAA,EAAU,GAAK,EAAE,CAAA,CAAA,CAChF,OAAO,IAAA,CAAK,YAAY,GAAA,CAAIC,CAAQ,CACtC,CAMA,WAAA,EAAuB,CACrB,IAAMqG,CAAAA,CAAO,IAAA,CAAK,WAAA,CAAY,WAAU,CAAE,IAAA,CAC1C,OAAKA,CAAAA,CAGDA,CAAAA,CAAK,OAAS,OAAA,CACT,CAAC,CAAEA,CAAAA,CAAmB,UAAY,CAAC,CAAEA,EAAmB,QAAA,CAI7DA,CAAAA,CAAK,OAAS,OAAA,CACT,CAAC,CAAEA,CAAAA,CAAmB,QAGxB,KAAA,CAZW,KAapB,CAKA,YAAA,CAAanC,CAAAA,CAAyC,CACpD,IAAA,CAAK,WAAA,CAAY,YAAA,CAAaA,CAAM,EACtC,CAKA,SAAA,EAA8B,CAC5B,OAAO,IAAA,CAAK,YAAY,SAAA,EAC1B,CAMA,IAAI,MAAoB,CACtB,OAAO,KAAK,WACd,CAKA,IAAI,EAAA,EAAK,CACP,OAAO,CACL,SAAU,IAAA,CAAK,QAAA,CAAS,EAC1B,CACF,CAEA,IAAI,EAAA,EAAK,CACP,OAAO,CACL,SAAU,IAAA,CAAK,QAAA,CAAS,EAC1B,CACF,CAEF,EA+BamB,EAAAA,CAAUA","file":"index.mjs","sourcesContent":["/**\n * Core type definitions for NDEx Client Library\n * Pragmatic TypeScript types allowing flexibility with any types where needed\n */\n\n// Export Cytoscape-related types\nexport * from './cytoscape';\n\n// ============================================================================\n// Authentication Types\n// ============================================================================\n\nexport interface BasicAuth {\n type: 'basic';\n username: string;\n password: string;\n}\n\nexport interface OAuthAuth {\n type: 'oauth';\n idToken: string; // ID token from OAuth provider\n}\n\nexport interface NDExAuthResponse {\n token?: string;\n userId?: string;\n userName?: string;\n isAdmin?: boolean;\n permissions?: string[];\n expirationTime?: number;\n}\n\nexport interface NDExUser {\n externalId: string;\n userName: string;\n firstName?: string;\n lastName?: string;\n emailAddress?: string;\n website?: string;\n description?: string;\n image?: string;\n isIndividual?: boolean;\n isVerified?: boolean;\n creationTime?: number;\n modificationTime?: number;\n}\n\n// ============================================================================\n// Network Types\n// ============================================================================\n\nexport interface CX1MetaDataItem {\n name: string;\n elementCount: number;\n version: string;\n idCounter?: number;\n [key: string]: any; // Allow any additional properties\n}\n\nexport interface CX1MetaDataResponse {\n metaData: CX1MetaDataItem[];\n}\n\nexport interface CX1NetworkProperty {\n predicateString: string;\n value: string;\n dataType?: 'string' | 'integer' | 'double' | 'boolean' | 'list_of_string';\n}\n\nexport interface CX2NetworkProperties {\n [key: string]: {\n t: string; // type\n v: any; // value\n };\n}\n\nexport enum NetworkIndexLevel {\n NONE = 'NONE',\n BASIC = 'BASIC',\n FULL = 'FULL'\n}\n\nexport interface NetworkSummaryV2 {\n externalId: string;\n name: string;\n description?: string;\n nodeCount: number;\n edgeCount: number;\n visibility: 'PUBLIC' | 'PRIVATE';\n owner: string;\n ownerUUID: string;\n creationTime: number;\n modificationTime: number;\n version?: string;\n properties?: CX1NetworkProperty[]; // V2 uses CX1 array format\n isReadOnly: boolean;\n isValid: boolean;\n warnings?: string[];\n hasLayout: boolean;\n hasSample: boolean;\n \n // Additional attributes for both V2 and V3\n updatedBy: string; // username who modified this network last\n errorMessage?: string;\n cxFormat?: string;\n cxFileSize?: number; // File size in bytes\n cx2FileSize?: number; // File size in bytes\n isShowcase?: boolean;\n isCompleted?: boolean;\n doi?: string;\n isCertified?: boolean;\n indexLevel?: NetworkIndexLevel;\n parentDirUUID?: string;\n showInTrash?: boolean;\n subnetworkIds?: string[];\n reference?: string;\n organism?: string;\n disease?: string;\n tissue?: string;\n networkType?: string[];\n rightsHolder?: string;\n rights?: string;\n sourceFormat?: string;\n}\n\n/**\n * NetworkSummaryV3 - Network summary for NDEx API v3\n * \n * Extends NetworkSummaryV2 but uses CX2-style properties format instead of CX1 format.\n * The main difference is in how network properties are structured:\n * \n * | Aspect | NetworkSummaryV2 | NetworkSummaryV3 |\n * |--------|------------------|------------------|\n * | **Properties Format** | `CX1NetworkProperty[]` (array) | `CX2NetworkProperties` (object) |\n * | **Structure** | CX1-style array of property objects | CX2-style key-value map |\n * | **Example** | `[{predicateString: \"name\", value: \"My Network\"}]` | `{name: {t: \"string\", v: \"My Network\"}}` |\n * \n * @example\n * ```typescript\n * // V2 properties format (array of objects)\n * const v2Summary: NetworkSummaryV2 = {\n * externalId: \"12345\",\n * name: \"Sample Network\",\n * properties: [\n * { predicateString: \"description\", value: \"A sample network\", dataType: \"string\" },\n * { predicateString: \"nodeCount\", value: \"100\", dataType: \"integer\" }\n * ]\n * };\n * \n * // V3 properties format (object map)\n * const v3Summary: NetworkSummaryV3 = {\n * externalId: \"12345\", \n * name: \"Sample Network\",\n * properties: {\n * description: { t: \"string\", v: \"A sample network\" },\n * nodeCount: { t: \"integer\", v: 100 }\n * }\n * };\n * ```\n */\nexport interface NetworkSummaryV3 extends Omit<NetworkSummaryV2, 'properties'> {\n properties?: CX2NetworkProperties; // V3 uses CX2 object/map format\n // V3-specific additional attributes can be added here as needed\n}\n\n\nexport interface NetworkPermission {\n uuid: string;\n permission: 'READ' | 'WRITE' | 'ADMIN';\n memberUUID: string;\n memberAccountName?: string;\n resourceUUID: string;\n}\n\n// NetworkSet interface removed - deprecated in NDEx v3, replaced by folders with network shortcuts\n\n// ============================================================================\n// CX2 Network Types\n// ============================================================================\n\nexport interface CX2Network {\n CXVersion: string;\n hasFragments: boolean;\n metaData: CX2MetaData[];\n attributeDeclarations?: CX2AttributeDeclarations;\n networkAttributes?: CX2NetworkAttribute[];\n nodes?: CX2Node[];\n edges?: CX2Edge[];\n nodeBypass?: CX2NodeBypass[];\n edgeBypass?: CX2EdgeBypass[];\n visualProperties?: CX2VisualProperty;\n status?: CX2Status[];\n}\n\nexport interface CX2MetaData {\n name: string;\n elementCount?: number;\n}\n\nexport interface CX2AttributeDeclarations {\n [aspectName: string]: {\n [attributeName: string]: {\n d: string; // datatype\n a?: string; // alias\n v?: any; // default value\n };\n };\n}\n\nexport interface CX2AttributeSpec {\n d: string; // data type\n v?: any; // default value\n s?: boolean; // is single\n}\n\nexport interface CX2NetworkAttribute {\n [key: string]: any;\n}\n\nexport interface CX2Node {\n id: number;\n x?: number; // x coordinate\n y?: number; // y coordinate \n z?: number; // z coordinate (optional)\n v?: Record<string, any>; // attributes\n}\n\nexport interface CX2Edge {\n id: number;\n s: number; // source node id\n t: number; // target node id\n v?: Record<string, any>; // attributes\n}\n\nexport interface CX1Edge {\n // CX1 edge structure varies - can be any array structure\n [key: string]: any;\n}\n\nexport interface CX2NodeBypass {\n id: number; // node id\n v: VisualPropertyTable; // visual properties\n}\n\nexport interface CX2EdgeBypass {\n id: number; // edge id\n v: VisualPropertyTable; // visual properties\n}\n\n// ============================================================================\n// CX2 Visual Property Types - Based on server-side CxVisualProperty class\n// ============================================================================\n\n/**\n * Visual Property Mapping Types\n */\nexport type VPMappingType = 'DISCRETE' | 'CONTINUOUS' | 'PASSTHROUGH';\n\n/**\n * Mapping Definition for visual property mappings\n * Note: Using flexible typing for mapping definitions as they vary by type\n */\nexport interface MappingDefinition {\n mapppingList?: Array<Record<string, any>>; // Note: server has typo \"mapppingList\"\n [key: string]: any; // Allow other mapping definition properties\n}\n\n/**\n * Visual Property Mapping structure\n */\nexport interface VisualPropertyMapping {\n type: VPMappingType;\n definition: MappingDefinition;\n}\n\n/**\n * Visual Property Table - holds visual property values\n * Equivalent to server-side VisualPropertyTable class\n */\nexport interface VisualPropertyTable {\n [visualPropertyName: string]: any; // Maps visual property names to their values\n}\n\n/**\n * Table Column Visual Style - for individual visual properties\n */\nexport interface TableColumnVisualStyle {\n default?: any; // Default value for the visual property\n mapping?: VisualPropertyMapping; // Optional mapping definition\n}\n\n/**\n * Default Visual Properties structure\n */\nexport interface DefaultVisualProperties {\n edge?: VisualPropertyTable; // Default edge visual properties\n network?: Record<string, any>; // Default network visual properties \n node?: VisualPropertyTable; // Default node visual properties\n}\n\n/**\n * CX2 Visual Property - Main visual properties aspect\n * Equivalent to server-side CxVisualProperty class\n */\nexport interface CX2VisualProperty {\n default?: DefaultVisualProperties; // Default visual properties\n edgeMapping?: Record<string, VisualPropertyMapping>; // Edge visual property mappings\n nodeMapping?: Record<string, VisualPropertyMapping>; // Node visual property mappings\n}\n\nexport interface CX2Status {\n error?: string;\n success?: boolean;\n}\n\n// ============================================================================\n// Search Types\n// ============================================================================\n\nexport interface SearchResult {\n numFound: number;\n start: number;\n networks: NetworkSummaryV2[] | NetworkSummaryV3[];\n}\n\nexport interface SearchParameters {\n searchString?: string;\n accountName?: string;\n permission?: string;\n includeGroups?: boolean;\n admin?: string;\n start?: number;\n size?: number;\n source?: string;\n}\n\n// ============================================================================\n// File/Export Types\n// ============================================================================\n\nexport interface ExportFormat {\n format: 'CX' | 'CX2' | 'XGMML' | 'SIF' | 'GRAPHML';\n version?: string;\n}\n\nexport interface ExportRequest {\n networkUUID: string;\n format: ExportFormat;\n accesskey?: string;\n}\n\n// ============================================================================\n// Task/Status Types\n// ============================================================================\n\nexport interface Task {\n externalId: string;\n taskType: string;\n status: 'submitted' | 'processing' | 'completed' | 'failed';\n progress?: number;\n message?: string;\n resource?: string;\n startTime?: number;\n finishTime?: number;\n attributes?: Record<string, any>;\n}\n\n// ============================================================================\n// API Configuration Types\n// ============================================================================\n\nexport interface NDExClientConfig {\n baseURL?: string;\n timeout?: number;\n retries?: number;\n retryDelay?: number;\n debug?: boolean;\n headers?: Record<string, string>;\n auth?: BasicAuth | OAuthAuth; // Simplified to 2 authentication options\n}\n\nexport interface APIResponse<T = any> {\n data?: T;\n errorCode?: string;\n message?: string;\n description?: string;\n stackTrace?: string;\n timeStamp?: number;\n}\n\nexport interface APIError {\n errorCode: string;\n message: string;\n description?: string;\n stackTrace?: string;\n timeStamp?: number;\n}\n\n// ============================================================================\n// Service Types\n// ============================================================================\n\n\n/**\n * Base error class for all NDEx API errors\n */\nexport class NDExError extends Error {\n constructor(\n message: string,\n public statusCode?: number,\n public errorCode?: string,\n public description?: string\n ) {\n super(message);\n this.name = 'NDExError';\n }\n}\n\n/**\n * Error thrown when network or request fails\n */\nexport class NDExNetworkError extends NDExError {\n constructor(message: string, public originalError?: Error) {\n super(message, undefined, 'NETWORK_ERROR');\n this.name = 'NDExNetworkError';\n }\n}\n\n/**\n * Error thrown when authentication fails\n */\nexport class NDExAuthError extends NDExError {\n constructor(message: string = 'Authentication failed', statusCode: number = 401) {\n super(message, statusCode, 'AUTH_ERROR');\n this.name = 'NDExAuthError';\n }\n}\n\n/**\n * Error thrown when requested resource is not found\n */\nexport class NDExNotFoundError extends NDExError {\n constructor(message: string = 'Resource not found', statusCode: number = 404) {\n super(message, statusCode, 'NOT_FOUND');\n this.name = 'NDExNotFoundError';\n }\n}\n\n/**\n * Error thrown when request validation fails\n */\nexport class NDExValidationError extends NDExError {\n constructor(message: string, statusCode: number = 400) {\n super(message, statusCode, 'VALIDATION_ERROR');\n this.name = 'NDExValidationError';\n }\n}\n\n/**\n * Error thrown when server encounters an internal error\n */\nexport class NDExServerError extends NDExError {\n constructor(message: string = 'Internal server error', statusCode: number = 500) {\n super(message, statusCode, 'SERVER_ERROR');\n this.name = 'NDExServerError';\n }\n}\n\n// ============================================================================\n// Utility Types\n// ============================================================================\n\nexport type UUID = string;\nexport type Timestamp = number;\n\n// Allow flexible typing for gradual migration\nexport type NDExAny = any;\n\n// Common parameter types\nexport interface PaginationParams {\n start?: number;\n size?: number;\n}\n\nexport interface AccessParams {\n accesskey?: string;\n}\n\n// ============================================================================\n// Workspace Types\n// ============================================================================\n\n/**\n * CyWeb workspace object structure\n */\nexport interface CyWebWorkspace {\n externalId?: string;\n name: string;\n description?: string;\n networkIds?: string[];\n [key: string]: any; // Allow additional properties\n}\n\n/**\n * Network access key response structure\n */\nexport interface AccessKeyResponse {\n accessKey: string | null;\n}\n\n/**\n * Valid actions for updating access keys\n */\nexport type AccessKeyAction = 'enable' | 'disable';\n\n/**\n * NDEx object update status - returned from network creation and update operations\n * Corresponds to server-side NdexObjectUpdateStatus class\n */\nexport interface NDExObjectUpdateStatus {\n uuid: string;\n modificationTime: number; // Timestamp in milliseconds\n}\n\n","import { \n CX2Network as CX2NetworkType,\n CX2MetaData,\n CX2Node,\n CX2Edge,\n CX2AttributeDeclarations,\n CX2NetworkAttribute,\n CX2NodeBypass,\n CX2EdgeBypass,\n CX2VisualProperty,\n NetworkSummaryV3\n} from '../types';\n\n/**\n * CX2Network - Modern representation of CX2 format networks\n * Provides utilities for creating, manipulating, and validating CX2 networks\n */\nexport class CX2Network implements CX2NetworkType {\n CXVersion: string = '2.0';\n hasFragments: boolean = false;\n metaData: CX2MetaData[] = [];\n attributeDeclarations?: CX2AttributeDeclarations;\n networkAttributes?: CX2NetworkAttribute[];\n nodes?: CX2Node[];\n edges?: CX2Edge[];\n nodeBypass?: CX2NodeBypass[];\n edgeBypass?: CX2EdgeBypass[];\n visualProperties?: CX2VisualProperty;\n status?: any[];\n\n constructor(data?: Partial<CX2NetworkType>) {\n if (data) {\n Object.assign(this, data);\n }\n \n // Ensure required metadata is present\n this.ensureRequiredMetadata();\n }\n\n /**\n * Create a new empty CX2Network\n */\n static createEmpty(): CX2Network {\n const network = new CX2Network();\n network.nodes = [];\n network.edges = [];\n network.metaData = [\n {\n name: 'nodes',\n elementCount: 0\n },\n {\n name: 'edges',\n elementCount: 0\n },\n ];\n return network;\n }\n\n /**\n * Create CX2Network from raw JSON data\n */\n static fromJSON(json: string | object): CX2Network {\n const data = typeof json === 'string' ? JSON.parse(json) : json;\n return new CX2Network(data);\n }\n\n /**\n * Create CX2Network from NetworkSummary (for compatibility)\n */\n static fromNetworkSummary(summary: NetworkSummaryV3): CX2Network {\n const network = CX2Network.createEmpty();\n \n network.networkAttributes = [\n { name: summary.name },\n ...(summary.description ? [{ description: summary.description }] : []),\n ...(summary.version ? [{ version: summary.version }] : []),\n ];\n\n // Add properties as network attributes\n if (summary.properties) {\n Object.entries(summary.properties).forEach(([key, value]) => {\n network.networkAttributes?.push({\n [key]: (value as { t: string; v: any }).v\n });\n });\n }\n\n return network;\n }\n\n /**\n * Add a node to the network\n */\n addNode(id: number, attributes?: Record<string, any>): CX2Node {\n if (!this.nodes) {\n this.nodes = [];\n }\n\n const node: CX2Node = { id };\n if (attributes) {\n node.v = attributes;\n }\n\n this.nodes.push(node);\n this.updateNodeCount();\n return node;\n }\n\n /**\n * Add an edge to the network\n */\n addEdge(id: number, sourceId: number, targetId: number, attributes?: Record<string, any>): CX2Edge {\n if (!this.edges) {\n this.edges = [];\n }\n\n const edge: CX2Edge = {\n id,\n s: sourceId,\n t: targetId,\n };\n\n if (attributes) {\n edge.v = attributes;\n }\n\n this.edges.push(edge);\n this.updateEdgeCount();\n return edge;\n }\n\n /**\n * Add an individual node attribute\n */\n addNodeAttribute(nodeId: number, attributeName: string, value: any): void {\n\n //find the nodes with the given ID\n const node = this.nodes.find(n => n.id === nodeId);\n //set the node attribute\n if (node) {\n if (!node.v) {\n node.v = {};\n }\n node.v[attributeName] = value;\n }\n\n }\n\n /**\n * Add edge attributes (bulk)\n */\n addEdgeAttribute(edgeId: number, attributeName: string, value: any): void {\n //similar to addNodeAttribute\n const edge = this.edges.find(e => e.id === edgeId);\n if (edge) {\n if (!edge.v) {\n edge.v = {};\n }\n edge.v[attributeName] = value;\n }\n\n \n }\n\n /**\n * Set node coordinates\n */\n setNodeCoordinates(nodeId: number, x: number, y: number, z?: number): void {\n if (!this.nodes) {\n this.nodes = [];\n }\n\n // Find the node and update its coordinates directly\n let node = this.nodes.find(n => n.id === nodeId);\n \n if (!node) {\n // Create new node if it doesn't exist\n node = { id: nodeId };\n this.nodes.push(node);\n this.updateNodeCount();\n }\n\n // Set coordinates directly on the node\n node.x = x;\n node.y = y;\n if (z !== undefined) {\n node.z = z;\n }\n }\n\n /**\n * Get node by ID\n */\n getNode(id: number): CX2Node | undefined {\n return this.nodes?.find(node => node.id === id);\n }\n\n /**\n * Get edge by ID\n */\n getEdge(id: number): CX2Edge | undefined {\n return this.edges?.find(edge => edge.id === id);\n }\n\n /**\n * Get all nodes\n */\n getNodes(): CX2Node[] {\n return this.nodes || [];\n }\n\n /**\n * Get all edges\n */\n getEdges(): CX2Edge[] {\n return this.edges || [];\n }\n\n /**\n * Get node count\n */\n getNodeCount(): number {\n return this.nodes?.length || 0;\n }\n\n /**\n * Get edge count\n */\n getEdgeCount(): number {\n return this.edges?.length || 0;\n }\n\n /**\n * Get network name from attributes\n */\n getNetworkName(): string | undefined {\n return this.networkAttributes?.find(attr => 'name' in attr)?.name;\n }\n\n /**\n * Set network name\n */\n setNetworkName(name: string): void {\n if (!this.networkAttributes) {\n this.networkAttributes = [];\n }\n\n // Remove existing name attribute\n this.networkAttributes = this.networkAttributes.filter(attr => !('name' in attr));\n \n // Add new name\n this.networkAttributes.push({ name });\n }\n\n /**\n * Get network attribute by key\n */\n getNetworkAttribute(key: string): any {\n return this.networkAttributes?.find(attr => key in attr)?.[key];\n }\n\n /**\n * Set network attribute\n */\n setNetworkAttribute(key: string, value: any): void {\n if (!this.networkAttributes) {\n this.networkAttributes = [];\n }\n\n // Remove existing attribute with same key\n this.networkAttributes = this.networkAttributes.filter(attr => !(key in attr));\n \n // Add new attribute\n this.networkAttributes.push({ [key]: value });\n }\n\n /**\n * Validate the CX2 network structure\n */\n validate(): { isValid: boolean; errors: string[] } {\n const errors: string[] = [];\n\n // Check required fields\n if (!this.CXVersion) {\n errors.push('CXVersion is required');\n }\n\n if (this.hasFragments === undefined) {\n errors.push('hasFragments is required');\n }\n\n if (!this.metaData || this.metaData.length === 0) {\n errors.push('metaData is required and must not be empty');\n }\n\n // Validate metadata\n this.metaData?.forEach((meta, index) => {\n if (!meta.name) {\n errors.push(`metaData[${index}] is missing required 'name' field`);\n }\n });\n\n // Validate nodes\n if (this.nodes) {\n this.nodes.forEach((node, index) => {\n if (node.id === undefined || node.id === null) {\n errors.push(`nodes[${index}] is missing required 'id' field`);\n }\n });\n }\n\n // Validate edges\n if (this.edges) {\n this.edges.forEach((edge, index) => {\n if (edge.id === undefined || edge.id === null) {\n errors.push(`edges[${index}] is missing required 'id' field`);\n }\n if (edge.s === undefined || edge.s === null) {\n errors.push(`edges[${index}] is missing required 's' (source) field`);\n }\n if (edge.t === undefined || edge.t === null) {\n errors.push(`edges[${index}] is missing required 't' (target) field`);\n }\n\n // Check if source and target nodes exist\n if (this.nodes && edge.s !== undefined && edge.t !== undefined) {\n const sourceExists = this.nodes.some(node => node.id === edge.s);\n const targetExists = this.nodes.some(node => node.id === edge.t);\n \n if (!sourceExists) {\n errors.push(`edges[${index}] references non-existent source node ${edge.s}`);\n }\n if (!targetExists) {\n errors.push(`edges[${index}] references non-existent target node ${edge.t}`);\n }\n }\n });\n }\n\n return {\n isValid: errors.length === 0,\n errors,\n };\n }\n\n /**\n * Convert to JSON string\n */\n toJSON(): string {\n return JSON.stringify(this, null, 2);\n }\n\n /**\n * Create a deep copy of the network\n */\n clone(): CX2Network {\n return new CX2Network(JSON.parse(this.toJSON()));\n }\n\n /**\n * Get basic statistics about the network\n */\n getStatistics() {\n return {\n nodeCount: this.getNodeCount(),\n edgeCount: this.getEdgeCount(),\n hasCoordinates: Boolean(this.nodes && this.nodes.some(node => \n node.x !== undefined || node.y !== undefined || node.z !== undefined\n )),\n hasVisualProperties: Boolean(this.visualProperties && (\n this.visualProperties.default || \n this.visualProperties.edgeMapping || \n this.visualProperties.nodeMapping\n ))\n };\n }\n\n /**\n * Ensure required metadata is present\n */\n private ensureRequiredMetadata(): void {\n if (!this.metaData) {\n this.metaData = [];\n }\n\n // Ensure nodes metadata exists\n if (this.nodes && !this.metaData.find(m => m.name === 'nodes')) {\n this.metaData.push({\n name: 'nodes',\n elementCount: this.nodes.length\n });\n }\n\n // Ensure edges metadata exists \n if (this.edges && !this.metaData.find(m => m.name === 'edges')) {\n this.metaData.push({\n name: 'edges',\n elementCount: this.edges.length\n });\n }\n }\n\n /**\n * Update node count in metadata\n */\n private updateNodeCount(): void {\n const nodesMeta = this.metaData?.find(m => m.name === 'nodes');\n if (nodesMeta) {\n nodesMeta.elementCount = this.nodes?.length || 0;\n }\n }\n\n /**\n * Update edge count in metadata\n */\n private updateEdgeCount(): void {\n const edgesMeta = this.metaData?.find(m => m.name === 'edges');\n if (edgesMeta) {\n edgesMeta.elementCount = this.edges?.length || 0;\n }\n }\n}\n","import { HTTPService } from './HTTPService';\nimport { \n NetworkSummaryV2, \n NetworkPermission, \n PaginationParams,\n AccessParams,\n CX1MetaDataResponse,\n AccessKeyResponse,\n AccessKeyAction\n} from '../types';\n\n/**\n * NetworkServiceV2 - NDEx API v2 network operations\n * Handles legacy v2 endpoints with modern TypeScript interface\n */\nexport class NetworkServiceV2 {\n constructor(private http: HTTPService) {}\n\n /**\n * Get raw network in CX1 format\n * \n * Returns raw CX1 data as an array of aspects. This data may contain fragmented aspects\n * that need to be assembled into a complete CX1 network model for proper usage.\n * For a fully assembled network object, consider using getNetworkAsCX2Object() instead.\n * \n * @param networkUUID - The UUID of the network to retrieve\n * @param options - Access options including optional access key\n * @returns Promise resolving to raw CX1 data as an array of aspects\n */\n async getRawCX1Network(\n networkUUID: string, \n options: AccessParams = {}\n ): Promise<any[]> {\n const params = new URLSearchParams();\n if (options.accesskey) {\n params.append('accesskey', options.accesskey);\n }\n\n const endpoint = `network/${networkUUID}${params.toString() ? `?${params.toString()}` : ''}`;\n return this.http.get<any[]>(endpoint, { \n version: 'v2',\n headers: { 'Accept': 'application/json' }\n });\n }\n\n /**\n * Get network summary by UUID\n */\n async getNetworkSummary(\n networkUUID: string, \n options: AccessParams = {}\n ): Promise<NetworkSummaryV2> {\n const params = new URLSearchParams();\n if (options.accesskey) {\n params.append('accesskey', options.accesskey);\n }\n\n const endpoint = `network/${networkUUID}/summary${params.toString() ? `?${params.toString()}` : ''}`;\n return this.http.get<NetworkSummaryV2>(endpoint, { version: 'v2' });\n }\n\n /**\n * Copy network\n * \n * Creates a copy of an existing network using the server's copy endpoint.\n * The copied network will have the same content but will be assigned a new UUID\n * and will be owned by the authenticated user.\n * \n * @param networkUUID - The UUID of the network to copy\n * @returns Promise resolving to the URL of the cloned CX1 network\n */\n async copyNetwork(networkUUID: string): Promise<string> {\n const endpoint = `network/${networkUUID}/copy`;\n return this.http.post<string>(endpoint, {}, { \n version: 'v2'\n });\n }\n\n\n /**\n * Search networks (migrated from original NDEx.js)\n * \n * Searches networks using POST request with search parameters in the request body.\n * This implementation matches the original NDEx.js searchNetworks function.\n * \n * @param searchTerms - Search string to find networks\n * @param start - Starting offset for pagination (optional)\n * @param size - Maximum number of results to return (optional)\n * @param optionalParameters - Additional search filters\n * @param optionalParameters.permission - Filter by permission level\n * @param optionalParameters.includeGroups - Whether to include group networks\n * @param optionalParameters.accountName - Filter by account name\n * @returns Promise resolving to search results\n */\n async searchNetworks(\n searchTerms: string,\n start?: number,\n size?: number,\n optionalParameters?: {\n permission?: string;\n includeGroups?: boolean;\n accountName?: string;\n }\n ): Promise<any> {\n const params: Record<string, string> = {};\n\n if (start !== undefined) {\n params.start = start.toString();\n }\n if (size !== undefined) {\n params.limit = size.toString();\n }\n\n const data: Record<string, any> = { searchString: searchTerms };\n\n if (optionalParameters !== undefined) {\n if (optionalParameters.permission !== undefined) {\n data.permission = optionalParameters.permission;\n }\n if (optionalParameters.includeGroups !== undefined) {\n data.includeGroups = optionalParameters.includeGroups;\n }\n if (optionalParameters.accountName !== undefined) {\n data.accountName = optionalParameters.accountName;\n }\n }\n\n const endpoint = 'search/network';\n return this.http.post<any>(endpoint, data, { \n version: 'v2',\n params \n });\n }\n\n \n\n /**\n * Create new network from raw CX1 data\n * \n * Creates a new network in NDEx from raw CX1 network data. This method handles\n * the server response parsing to extract the network UUID from the location header.\n * \n * @param rawCX - Raw CX1 network data as an array of aspects\n * @param options - Optional options for network creation (visibility settings)\n * @returns Promise resolving to the UUID string of the newly created network\n */\n async createNetworkFromRawCX1(\n rawCX: any[],\n options: { visibility?: 'PUBLIC' | 'PRIVATE' } = {}\n ): Promise<string> {\n const endpoint = 'network';\n const response = await this.http.post<string>(endpoint, rawCX, { \n version: 'v2',\n params: options\n });\n\n // Extract UUID from response URL (e.g., \"/v2/network/12345\" -> \"12345\")\n const uuidr = response.split('/');\n const uuid = uuidr[uuidr.length - 1];\n \n return uuid;\n }\n\n\n /**\n * Update network from raw CX1 data\n * \n * Updates an existing network in NDEx with new raw CX1 network data.\n * This completely replaces the network content with the provided CX1 data.\n * Uses the legacy v2 endpoint format from the original NDEx.js implementation.\n * \n * @param networkUUID - The UUID of the network to update\n * @param rawCX - Raw CX1 network data as an array of aspects\n * @returns Promise resolving when the update is complete\n */\n async updateNetworkFromRawCX1(\n networkUUID: string,\n rawCX: any[]\n ): Promise<void> {\n const endpoint = `network/${networkUUID}`;\n return this.http.put<void>(endpoint, rawCX, { version: 'v2' });\n }\n\n /**\n * Delete network\n */\n async deleteNetwork(networkUUID: string): Promise<void> {\n const endpoint = `network/${networkUUID}`;\n return this.http.delete<void>(endpoint, { version: 'v2' });\n }\n\n /**\n * Get network summaries by UUIDs (migrated from original NDEx.js)\n * \n * Retrieves network summaries for multiple networks in a single batch request.\n * Uses the V2 API batch endpoint for efficient bulk operations.\n * \n * @param uuidList - Array of network UUIDs to retrieve summaries for\n * @param accessKey - Optional access key for private networks\n * @returns Promise resolving to array of network summaries\n */\n async getNetworkSummariesByUUIDs(\n uuidList: string[], \n accessKey?: string\n ): Promise<NetworkSummaryV2[]> {\n const params = accessKey ? { accesskey: accessKey } : undefined;\n\n const endpoint = 'batch/network/summary';\n return this.http.post<NetworkSummaryV2[]>(endpoint, uuidList, { \n version: 'v2',\n params \n });\n }\n\n// The following functions need to be either reviewed or removed.\n\n\n /**\n * Get user's networks\n */\n async getUserNetworks(\n accountName: string, \n options: PaginationParams = {}\n ): Promise<NetworkSummaryV2[]> {\n const params = new URLSearchParams();\n if (options.start !== undefined) {\n params.append('start', options.start.toString());\n }\n if (options.size !== undefined) {\n params.append('size', options.size.toString());\n }\n\n const endpoint = `user/${accountName}/networks${params.toString() ? `?${params.toString()}` : ''}`;\n return this.http.get<NetworkSummaryV2[]>(endpoint, { version: 'v2' });\n }\n\n\n /**\n * Set network system properties\n */\n async setNetworkSystemProperties(\n networkUUID: string, \n properties: Record<string, any>\n ): Promise<void> {\n const endpoint = `networks/${networkUUID}/systemproperty`;\n return this.http.put<void>(endpoint, properties, { version: 'v2' });\n }\n\n /**\n * Get network permissions\n */\n async getNetworkPermissions(networkUUID: string): Promise<NetworkPermission[]> {\n const endpoint = `networks/${networkUUID}/permission`;\n return this.http.get<NetworkPermission[]>(endpoint, { version: 'v2' });\n }\n\n /**\n * Set network permissions\n */\n async setNetworkPermissions(\n networkUUID: string, \n permissions: NetworkPermission[]\n ): Promise<void> {\n const endpoint = `networks/${networkUUID}/permission`;\n return this.http.put<void>(endpoint, permissions, { version: 'v2' });\n }\n\n /**\n * Grant network permission to user\n */\n async grantNetworkPermission(\n networkUUID: string, \n userUUID: string, \n permission: 'READ' | 'WRITE' | 'ADMIN'\n ): Promise<void> {\n const endpoint = `networks/${networkUUID}/permission`;\n const permissionData = {\n memberUUID: userUUID,\n permission: permission\n };\n return this.http.post<void>(endpoint, permissionData, { version: 'v2' });\n }\n\n /**\n * Revoke network permission from user\n */\n async revokeNetworkPermission(\n networkUUID: string, \n userUUID: string\n ): Promise<void> {\n const endpoint = `networks/${networkUUID}/permission`;\n return this.http.delete<void>(endpoint, { \n version: 'v2',\n data: { memberUUID: userUUID }\n });\n }\n\n /**\n * Get network profile (additional metadata)\n */\n async getNetworkProfile(networkUUID: string): Promise<any> {\n const endpoint = `networks/${networkUUID}/profile`;\n return this.http.get<any>(endpoint, { version: 'v2' });\n }\n\n /**\n * Set network profile\n */\n async setNetworkProfile(\n networkUUID: string, \n profile: any\n ): Promise<void> {\n const endpoint = `networks/${networkUUID}/profile`;\n return this.http.put<void>(endpoint, profile, { version: 'v2' });\n }\n\n /**\n * Make network public\n */\n async makeNetworkPublic(networkUUID: string): Promise<void> {\n const endpoint = `networks/${networkUUID}/systemproperty`;\n const properties = { visibility: 'PUBLIC' };\n return this.http.put<void>(endpoint, properties, { version: 'v2' });\n }\n\n /**\n * Make network private\n */\n async makeNetworkPrivate(networkUUID: string): Promise<void> {\n const endpoint = `networks/${networkUUID}/systemproperty`;\n const properties = { visibility: 'PRIVATE' };\n return this.http.put<void>(endpoint, properties, { version: 'v2' });\n }\n\n /**\n * Get network sample (if available)\n */\n async getNetworkSample(\n networkUUID: string, \n options: AccessParams = {}\n ): Promise<any[]> {\n const params = new URLSearchParams();\n if (options.accesskey) {\n params.append('accesskey', options.accesskey);\n }\n\n const endpoint = `networks/${networkUUID}/sample${params.toString() ? `?${params.toString()}` : ''}`;\n return this.http.get<any[]>(endpoint, { version: 'v2' });\n }\n\n /**\n * Get network metadata (migrated from original NDEx.js)\n * \n * Retrieves metadata information about network aspects including element counts,\n * versions, and ID counters for each aspect in the network. This provides\n * an overview of the network's structure and content organization.\n * \n * @param networkUUID - The UUID of the network to get metadata for\n * @param accessKey - Optional access key for private networks\n * @returns Promise resolving to metadata containing aspect information\n * @example\n * ```typescript\n * const metadata = await networkService.getMetaData('network-uuid');\n * // Returns: { metaData: [{ name: 'nodes', elementCount: 330, version: '1.0' }, ...] }\n * ```\n */\n async getMetaData(\n networkUUID: string, \n accessKey?: string\n ): Promise<CX1MetaDataResponse> {\n const params = new URLSearchParams();\n if (accessKey !== undefined) {\n params.append('accesskey', accessKey);\n }\n\n const endpoint = `network/${networkUUID}/aspect${params.toString() ? `?${params.toString()}` : ''}`;\n return this.http.get<CX1MetaDataResponse>(endpoint, { version: 'v2' });\n }\n\n /**\n * Get network access key (migrated from original NDEx.js)\n * \n * Retrieves the current access key for a network. Access keys allow\n * users to share private networks without requiring individual permissions.\n * \n * @param networkUUID - The UUID of the network to get access key for\n * @returns Promise resolving to access key response object\n * \n * @example\n * ```typescript\n * const response = await networkService.getAccessKey('network-uuid');\n * console.log(response.accessKey); // \"acialdfeoa03430023\" or null\n * ```\n */\n async getAccessKey(networkUUID: string): Promise<AccessKeyResponse> {\n const endpoint = `networks/${networkUUID}/accesskey`;\n return this.http.get<AccessKeyResponse>(endpoint, { version: 'v2' });\n }\n\n /**\n * Update network access key (migrated from original NDEx.js)\n * \n * Enables or disables the access key for a network. When enabled, creates\n * a new access key that can be shared. When disabled, invalidates the\n * current access key.\n * \n * @param networkUUID - The UUID of the network to update access key for\n * @param action - Action to perform: 'enable' creates/updates key, 'disable' removes it\n * @returns Promise resolving to access key response (accessKey will be null when disabled)\n * \n * @example\n * ```typescript\n * // Enable access key\n * const enabled = await networkService.updateAccessKey('network-uuid', 'enable');\n * console.log(enabled.accessKey); // \"new-access-key-string\"\n * \n * // Disable access key \n * const disabled = await networkService.updateAccessKey('network-uuid', 'disable');\n * console.log(disabled.accessKey); // null\n * ```\n */\n async updateAccessKey(networkUUID: string, action: AccessKeyAction): Promise<AccessKeyResponse> {\n const endpoint = `networks/${networkUUID}/accesskey`;\n return this.http.put<AccessKeyResponse>(endpoint, { action }, { version: 'v2' });\n }\n\n}\n","import { HTTPService } from './HTTPService';\nimport { \n NetworkSummaryV3, \n SearchResult, \n SearchParameters, \n PaginationParams,\n AccessParams,\n CX2Network as CX2NetworkType,\n NDExObjectUpdateStatus\n} from '../types';\nimport { CX2Network } from '../models/CX2Network';\n\n/**\n * NetworkServiceV3 - NDEx API v3 network operations\n * Handles modern v3 endpoints with native CX2 support\n */\nexport class NetworkServiceV3 {\n constructor(private http: HTTPService) {}\n\n /**\n * Get network summary by UUID\n */\n async getNetworkSummary(\n networkUUID: string, \n options: AccessParams = {}\n ): Promise<NetworkSummaryV3> {\n const params = new URLSearchParams();\n if (options.accesskey) {\n params.append('accesskey', options.accesskey);\n }\n\n const endpoint = `networks/${networkUUID}/summary${params.toString() ? `?${params.toString()}` : ''}`;\n return this.http.get<NetworkSummaryV3>(endpoint, { version: 'v3' });\n }\n\n\n /**\n * Get raw network in CX2 format (native V3)\n * \n * Returns raw CX2 data which may contain fragmented aspects that need to be assembled\n * into a complete CX2 network model for proper usage. The returned data follows the\n * CX2 specification but may have aspects split across multiple fragments.\n * For a fully assembled network object with utility methods, use getNetworkAsCX2Object() instead.\n * \n * @param networkUUID - The UUID of the network to retrieve\n * @param options - Access options including optional access key \n * @returns Promise resolving to raw CX2 network data that may be fragmented\n */\n async getRawCX2Network(\n networkUUID: string, \n options: AccessParams = {}\n ): Promise<CX2NetworkType> {\n const params = new URLSearchParams();\n if (options.accesskey) {\n params.append('accesskey', options.accesskey);\n }\n\n const endpoint = `networks/${networkUUID}${params.toString() ? `?${params.toString()}` : ''}`;\n return this.http.get<CX2NetworkType>(endpoint, { version: 'v3' });\n }\n\n\n /**\n * Create network DOI\n * \n * @param networkUUID - The UUID of the network to create a DOI for\n * @param key - DOI creation key\n * @param email - Email address for DOI registration\n * @returns Promise resolving to a confirmation message string from the server\n */\n async createNetworkDOI(\n networkUUID: string, \n key: string, \n email: string\n ): Promise<string> {\n const params = new URLSearchParams();\n params.append('key', key);\n params.append('email', email);\n\n const endpoint = `networks/${networkUUID}/DOI?${params.toString()}`;\n return this.http.get<string>(endpoint, { version: 'v3' });\n }\n\n /**\n * Get attributes of selected nodes\n * \n * Retrieves specific attributes for a set of nodes in a network. The server will return\n * a 404 error if the network has no attributes on nodes.\n * \n * @param networkUUID - The UUID of the network\n * @param nodeSelection - Object containing node IDs and attribute names to retrieve\n * @param nodeSelection.ids - Array of node IDs (long numbers) to get attributes for\n * @param nodeSelection.attributeNames - Array of attribute names to retrieve\n * @param options - Access options including optional access key\n * @returns Promise resolving to a JSON object where keys are stringified node IDs\n * and values are the selected attributes for that node\n * @throws {404} When the network has no attributes on nodes\n */\n async getAttributesOfSelectedNodes(\n networkUUID: string,\n nodeSelection: { ids: number[]; attributeNames: string[] },\n options: AccessParams = {}\n ): Promise<Record<string, any>> {\n const params = new URLSearchParams();\n if (options.accesskey) {\n params.append('accesskey', options.accesskey);\n }\n\n const data = {\n ids: nodeSelection.ids,\n attributeNames: nodeSelection.attributeNames\n };\n\n const endpoint = `search/networks/${networkUUID}/nodes${params.toString() ? `?${params.toString()}` : ''}`;\n return this.http.post<Record<string, any>>(endpoint, data, { version: 'v3' });\n }\n\n /**\n * Get network summaries by UUIDs using V3 API (migrated from original NDEx.js)\n * \n * Retrieves network summaries for multiple networks in a single batch request using V3 API.\n * Uses the V3 API batch endpoint with format parameter support.\n * \n * @param uuidList - Array of network UUIDs to retrieve summaries for\n * @param accessKey - Optional access key for private networks\n * @param format - Summary format (\"FULL\" by default, can be \"BASIC\" or other supported formats)\n * @returns Promise resolving to array of V3 network summaries\n */\n async getNetworkSummariesV3ByUUIDs(\n uuidList: string[], \n accessKey?: string,\n format?: string\n ): Promise<NetworkSummaryV3[]> {\n const params: Record<string, string> = { \n format: format === undefined ? 'FULL' : format \n };\n\n if (accessKey != null) {\n params.accesskey = accessKey;\n }\n\n const endpoint = 'batch/networks/summary';\n return this.http.post<NetworkSummaryV3[]>(endpoint, uuidList, { \n version: 'v3',\n params \n });\n }\n\n\n\n// following functions need to be reviewed or removed.\n\n /**\n * Search networks with V3 enhanced features\n */\n async searchNetworks(searchParams: SearchParameters = {}): Promise<SearchResult> {\n const params = new URLSearchParams();\n \n if (searchParams.searchString) {\n params.append('searchString', searchParams.searchString);\n }\n if (searchParams.accountName) {\n params.append('accountName', searchParams.accountName);\n }\n if (searchParams.permission) {\n params.append('permission', searchParams.permission);\n }\n if (searchParams.includeGroups !== undefined) {\n params.append('includeGroups', searchParams.includeGroups.toString());\n }\n if (searchParams.admin) {\n params.append('admin', searchParams.admin);\n }\n if (searchParams.start !== undefined) {\n params.append('start', searchParams.start.toString());\n }\n if (searchParams.size !== undefined) {\n params.append('size', searchParams.size.toString());\n }\n if (searchParams.source) {\n params.append('source', searchParams.source);\n }\n\n const endpoint = `search/network${params.toString() ? `?${params.toString()}` : ''}`;\n return this.http.get<SearchResult>(endpoint, { version: 'v3' });\n }\n /**\n * Get network as CX2Network object with utilities\n */\n async getNetworkAsCX2Object(\n networkUUID: string, \n options: AccessParams = {}\n ): Promise<CX2Network> {\n const cx2Data = await this.getRawCX2Network(networkUUID, options);\n return new CX2Network(cx2Data);\n }\n\n /**\n * Create new network from CX2\n */\n async createNetworkFromCX2(\n cx2Data: CX2NetworkType | CX2Network, \n options: { visibility?: 'PUBLIC' | 'PRIVATE'; folderId?: string } = {}\n ): Promise<NDExObjectUpdateStatus> {\n const endpoint = 'networks';\n \n // Convert CX2Network object to plain object if needed\n const data = cx2Data instanceof CX2Network ? JSON.parse(cx2Data.toJSON()) : cx2Data;\n \n return this.http.post<NDExObjectUpdateStatus>(endpoint, data, { \n version: 'v3',\n params: options\n });\n }\n\n /**\n * Update network with CX2 data\n */\n async updateNetworkCX2(\n networkUUID: string, \n cx2Data: CX2NetworkType | CX2Network\n ): Promise<NDExObjectUpdateStatus> {\n const endpoint = `networks/${networkUUID}`;\n \n // Convert CX2Network object to plain object if needed\n const data = cx2Data instanceof CX2Network ? JSON.parse(cx2Data.toJSON()) : cx2Data;\n \n return this.http.put<NDExObjectUpdateStatus>(endpoint, data, { version: 'v3' });\n }\n\n /**\n * Upload network file (CX2, CX, or other formats)\n */\n async uploadNetworkFile(\n file: File | Blob | string,\n options: {\n filename?: string;\n visibility?: 'PUBLIC' | 'PRIVATE';\n name?: string;\n onProgress?: (progress: number) => void;\n } = {}\n ): Promise<{ uuid: string }> {\n return this.http.uploadFile<{ uuid: string }>('networks/upload', file, {\n version: 'v3',\n ...options,\n });\n }\n\n /**\n * Get network metadata (V3 enhanced)\n */\n async getNetworkMetadata(networkUUID: string): Promise<any> {\n const endpoint = `networks/${networkUUID}/metadata`;\n return this.http.get<any>(endpoint, { version: 'v3' });\n }\n\n /**\n * Update network metadata\n */\n async updateNetworkMetadata(\n networkUUID: string, \n metadata: Record<string, any>\n ): Promise<void> {\n const endpoint = `networks/${networkUUID}/metadata`;\n return this.http.put<void>(endpoint, metadata, { version: 'v3' });\n }\n\n \n\n /**\n * Get network aspect (specific CX2 aspect)\n */\n async getNetworkAspect(\n networkUUID: string, \n aspectName: string,\n options: AccessParams = {}\n ): Promise<any> {\n const params = new URLSearchParams();\n if (options.accesskey) {\n params.append('accesskey', options.accesskey);\n }\n\n const endpoint = `networks/${networkUUID}/aspects/${aspectName}${params.toString() ? `?${params.toString()}` : ''}`;\n return this.http.get<any>(endpoint, { version: 'v3' });\n }\n\n\n}\n","import { HTTPService } from './HTTPService';\nimport { NetworkServiceV2 } from './NetworkServiceV2';\nimport { NetworkServiceV3 } from './NetworkServiceV3';\nimport { \n NetworkSummaryV3,\n PaginationParams,\n AccessParams,\n CX2Network as CX2NetworkType,\n CX2Edge,\n CX1Edge,\n CX2MetaData,\n NetworkPermission,\n NDExObjectUpdateStatus\n} from '../types';\nimport { CX2Network } from '../models/CX2Network';\n\n/**\n * UnifiedNetworkService - Provides access to both V2/V3 network services\n * Allows individual function calls to choose between v2 and v3 APIs\n */\nexport class UnifiedNetworkService {\n private v2Service: NetworkServiceV2;\n private v3Service: NetworkServiceV3;\n\n constructor(private http: HTTPService) {\n this.v2Service = new NetworkServiceV2(http);\n this.v3Service = new NetworkServiceV3(http);\n }\n\n /**\n * Get network summary using specified API version\n */\n async getNetworkSummary(\n networkUUID: string, \n options: AccessParams = {}\n ): Promise<NetworkSummaryV3> {\n return this.v3Service.getNetworkSummary(networkUUID, options);\n }\n\n /**\n * Search networks using specified API version\n * NOTE: This method is temporarily commented out as the V2 searchNetworks \n * signature has been migrated from NDEx.js and needs separate integration\n */\n // async searchNetworks(\n // searchParams: SearchParameters & { useV3?: boolean } = {}\n // ): Promise<SearchResult> {\n // const { useV3, ...params } = searchParams;\n // \n // if (useV3) {\n // return this.v3Service.searchNetworks(params);\n // }\n // \n // return this.v2Service.searchNetworks(params);\n // }\n\n\n /**\n * Get network in CX1 format (V2 API)\n */\n async getRawCX1Network(\n networkUUID: string,\n options: AccessParams = {}\n ): Promise<any[]> {\n return this.v2Service.getRawCX1Network(networkUUID, options);\n }\n\n /**\n * Get network in CX2 format (V3 API)\n */\n async getRawCX2Network(\n networkUUID: string,\n options: AccessParams = {}\n ): Promise<CX2NetworkType> {\n return this.v3Service.getRawCX2Network(networkUUID, options);\n }\n\n \n \n /**\n * Delete network\n */\n async deleteNetwork(networkUUID: string): Promise<void> {\n return this.v2Service.deleteNetwork(networkUUID);\n }\n\n\n /**\n * Create network DOI\n * \n * @param networkUUID - The UUID of the network to create a DOI for\n * @param key - DOI creation key\n * @param email - Email address for DOI registration\n * @returns Promise resolving to a confirmation message string from the server\n */\n async createNetworkDOI(\n networkUUID: string, \n key: string, \n email: string\n ): Promise<string> {\n return this.v3Service.createNetworkDOI(networkUUID, key, email);\n }\n\n /**\n * Get attributes of selected nodes\n * \n * Retrieves specific attributes for a set of nodes in a network. The server will return\n * a 404 error if the network has no attributes on nodes.\n * \n * @param networkUUID - The UUID of the network\n * @param nodeSelection - Object containing node IDs and attribute names to retrieve\n * @param nodeSelection.ids - Array of node IDs (long numbers) to get attributes for\n * @param nodeSelection.attributeNames - Array of attribute names to retrieve\n * @param options - Access options including optional access key\n * @returns Promise resolving to a JSON object where keys are stringified node IDs\n * and values are the selected attributes for that node\n * @throws {404} When the network has no attributes on nodes\n */\n async getAttributesOfSelectedNodes(\n networkUUID: string,\n nodeSelection: { ids: number[]; attributeNames: string[] },\n options: AccessParams = {}\n ): Promise<Record<string, any>> {\n return this.v3Service.getAttributesOfSelectedNodes(networkUUID, nodeSelection, options);\n }\n\n /**\n * Neighborhood query (migrated from original NDEx.js)\n * \n * Performs a neighborhood search within a network, returning nodes and edges\n * within the specified search depth from nodes matching the search terms.\n * Can return either raw CX1 or CX2 format based on outputCX2 parameter.\n * \n * @param networkUUID - The UUID of the network to search\n * @param searchTerms - Search string to find starting nodes\n * @param saveResult - Whether to save the query result as a new network\n * @param parameters - Additional query parameters\n * @param parameters.searchDepth - How many hops to search (default: 1)\n * @param parameters.edgeLimit - Maximum number of edges to return\n * @param parameters.errorWhenLimitIsOver - Throw error if edge limit exceeded\n * @param parameters.directOnly - Only include direct connections\n * @param parameters.nodeIds - Specific node IDs to start search from\n * @param outputCX2 - If true, return CX2 format via V3 API; if false, return CX1 format via V2 API\n * @returns Promise resolving to raw CX1 or CX2 network data\n */\n async neighborhoodQuery(\n networkUUID: string,\n searchTerms: string,\n saveResult?: boolean,\n parameters?: {\n searchDepth?: number;\n edgeLimit?: number;\n errorWhenLimitIsOver?: boolean;\n directOnly?: boolean;\n nodeIds?: number[];\n },\n outputCX2: boolean = false\n ): Promise<any[] | CX2NetworkType> {\n const params: Record<string, string> = {};\n\n if (saveResult !== undefined && saveResult === true) {\n params.save = 'true';\n }\n\n const data: Record<string, any> = {\n searchString: searchTerms,\n searchDepth: 1\n };\n\n if (parameters !== undefined) {\n if (parameters.searchDepth !== undefined) {\n data.searchDepth = parameters.searchDepth;\n }\n if (parameters.edgeLimit !== undefined) {\n data.edgeLimit = parameters.edgeLimit;\n }\n if (parameters.errorWhenLimitIsOver !== undefined) {\n data.errorWhenLimitIsOver = parameters.errorWhenLimitIsOver;\n }\n if (parameters.directOnly !== undefined) {\n data.directOnly = parameters.directOnly;\n }\n if (parameters.nodeIds != null) {\n data.nodeIds = parameters.nodeIds;\n }\n }\n\n if (outputCX2) {\n const endpoint = `search/network/${networkUUID}/query`;\n return this.http.post<CX2NetworkType>(endpoint, data, { \n version: 'v3',\n params \n });\n }\n\n const endpoint = `search/network/${networkUUID}/query`;\n return this.http.post<any[]>(endpoint, data, { \n version: 'v2',\n params \n });\n }\n\n /**\n * Interconnect query (migrated from original NDEx.js)\n * \n * Finds connections between nodes matching the search terms within a network.\n * Returns the interconnected subnetwork as either raw CX1 or CX2 format.\n * Can return either raw CX1 or CX2 format based on outputCX2 parameter.\n * \n * @param networkUUID - The UUID of the network to search\n * @param searchTerms - Search string to find nodes to interconnect\n * @param saveResult - Whether to save the query result as a new network\n * @param parameters - Additional query parameters\n * @param parameters.edgeLimit - Maximum number of edges to return\n * @param parameters.errorWhenLimitIsOver - Throw error if edge limit exceeded\n * @param parameters.nodeIds - Specific node IDs to find connections between\n * @param outputCX2 - If true, return CX2 format via V3 API; if false, return CX1 format via V2 API\n * @returns Promise resolving to raw CX1 or CX2 network data\n */\n async interConnectQuery(\n networkUUID: string,\n searchTerms: string,\n saveResult?: boolean,\n parameters?: {\n edgeLimit?: number;\n errorWhenLimitIsOver?: boolean;\n nodeIds?: number[];\n },\n outputCX2: boolean = false\n ): Promise<any[] | CX2NetworkType> {\n const params: Record<string, string> = {};\n\n if (saveResult !== undefined && saveResult === true) {\n params.save = 'true';\n }\n\n const data: Record<string, any> = { searchString: searchTerms };\n\n if (parameters !== undefined) {\n if (parameters.edgeLimit !== undefined) {\n data.edgeLimit = parameters.edgeLimit;\n }\n if (parameters.errorWhenLimitIsOver !== undefined) {\n data.errorWhenLimitIsOver = parameters.errorWhenLimitIsOver;\n }\n if (parameters.nodeIds != null) {\n data.nodeIds = parameters.nodeIds;\n }\n }\n\n if (outputCX2) {\n const endpoint = `search/networks/${networkUUID}/interconnectquery`;\n return this.http.post<CX2NetworkType>(endpoint, data, { \n version: 'v3',\n params \n });\n }\n\n const endpoint = `search/network/${networkUUID}/interconnectquery`;\n return this.http.post<any[]>(endpoint, data, { \n version: 'v2',\n params \n });\n }\n\n /**\n * Get network permissions by UUIDs (migrated from original NDEx.js)\n * \n * Retrieves network permissions for multiple networks in a single batch request.\n * Uses the V2 API batch endpoint to efficiently get permission information.\n * \n * @param uuidList - Array of network UUIDs to retrieve permissions for\n * @returns Promise resolving to permission information for the specified networks\n */\n async getNetworkPermissionsByUUIDs(uuidList: string[]): Promise<any[]> {\n const endpoint = 'batch/network/permission';\n return this.http.post<any[]>(endpoint, uuidList, { version: 'v2' });\n }\n\n /**\n * Export networks (migrated from original NDEx.js)\n * \n * Creates an export job for networks using the V2 batch export endpoint.\n * This allows exporting multiple networks in various formats.\n * \n * @param exportJob - Export job configuration specifying networks and format\n * @returns Promise resolving to export job result\n */\n async exportNetworks(exportJob: any): Promise<any> {\n const endpoint = 'batch/network/export';\n return this.http.post<any>(endpoint, exportJob, { version: 'v2' });\n }\n\n /**\n * Move networks to folder (migrated from original NDEx.js)\n * \n * Moves multiple networks to a specified folder using the V3 API.\n * This is a V3-specific feature for organizing networks in folders.\n * \n * @param networkIds - Array of network IDs to move\n * @param folderId - Target folder ID to move networks to\n * @returns Promise resolving when networks are moved\n */\n async moveNetworks(networkIds: string[], folderId: string): Promise<any> {\n if (!Array.isArray(networkIds)) {\n throw new Error('Invalid networkIds - must be an array');\n }\n\n const endpoint = 'batch/networks/move';\n const data = {\n targetFolder: folderId,\n networks: networkIds\n };\n\n return this.http.post<any>(endpoint, data, { version: 'v3' });\n }\n\n /**\n * Set networks visibility (migrated from original NDEx.js)\n * \n * Changes visibility settings for multiple networks using the V3 API.\n * Requires proper file validation to ensure data integrity.\n * \n * @param files - Object containing files with their types (must have 'files' property)\n * @param visibility - Visibility setting (e.g., 'PUBLIC', 'PRIVATE')\n * @returns Promise resolving when visibility is updated\n */\n async setNetworksVisibility(\n files: { files: Record<string, 'NETWORK' | 'FOLDER' | 'SHORTCUT'> },\n visibility: string\n ): Promise<any> {\n this.validateShareData(files);\n\n const endpoint = 'batch/networks/visibility';\n const data = {\n items: files,\n visibility: visibility\n };\n\n return this.http.post<any>(endpoint, data, { version: 'v3' });\n }\n\n /**\n * Get random edges from network (migrated from original NDEx.js)\n * \n * Retrieves a random sample of edges from a network using the V3 API.\n * This is useful for previewing large networks or sampling edge data.\n * \n * @param networkUUID - The UUID of the network to get edges from\n * @param limit - Number of random edges to retrieve (must be greater than 0)\n * @param accessKey - Optional access key for private networks\n * @returns Promise resolving to array of CX2Edge objects\n * @throws Error if limit is less than or equal to 0\n */\n async getRandomEdges(\n networkUUID: string, \n limit: number, \n accessKey?: string\n ): Promise<CX2Edge[]> {\n if (limit <= 0) {\n throw new Error(\"Value of parameter limit has to be greater than 0.\");\n }\n\n const params: Record<string, string> = {\n size: limit.toString(),\n method: \"random\"\n };\n\n if (accessKey !== undefined) {\n params.accesskey = accessKey;\n }\n\n const endpoint = `networks/${networkUUID}/aspects/edges`;\n return this.http.get<CX2Edge[]>(endpoint, { \n version: 'v3',\n params \n });\n }\n\n /**\n * Validate share data format (helper method for file operations)\n * \n * Validates the structure and content of file data used in sharing operations.\n * Ensures proper UUID format and valid file types.\n * \n * @param data - Data object to validate (must contain 'files' property)\n * @throws Error if validation fails\n */\n private validateShareData(data: any): void {\n // Check if data is an object and has files property\n if (typeof data !== 'object' || data === null || data.files === undefined) {\n throw new Error('Data must be an object with a \"files\" property');\n }\n \n // Check if files is an object\n if (typeof data.files !== 'object' || data.files === null) {\n throw new Error('The \"files\" property must be an object');\n }\n \n // Check each key-value pair in files\n const validValues = ['NETWORK', 'FOLDER', 'SHORTCUT'];\n \n for (const [uuid, fileType] of Object.entries(data.files)) {\n // Validate UUID format (basic validation)\n if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(uuid)) {\n throw new Error(`Invalid UUID format: ${uuid}`);\n }\n \n // Validate file type\n if (!validValues.includes(fileType as string)) {\n throw new Error(`Invalid file type for ${uuid}: ${fileType}. Must be one of: ${validValues.join(', ')}`);\n }\n }\n }\n\n /**\n * Get aspect elements (migrated from original NDEx.js)\n * \n * Retrieves elements from a specific aspect of a network using the V3 API.\n * This function can be used to get nodes, edges, or other aspect data\n * with optional size limiting and access key support for private networks.\n * \n * @param networkUUID - The UUID of the network to get aspect elements from\n * @param aspectName - Name of the aspect to retrieve (e.g., 'nodes', 'edges', 'networkAttributes')\n * @param limit - Optional maximum number of elements to return\n * @param accessKey - Optional access key for private networks\n * @returns Promise resolving to array of aspect elements\n * @example\n * ```typescript\n * // Get first 100 nodes from a network\n * const nodes = await client.networks.getAspectElements('network-uuid', 'nodes', 100);\n * \n * // Get all edges from a network\n * const edges = await client.networks.getAspectElements('network-uuid', 'edges');\n * ```\n */\n async getAspectElements(\n networkUUID: string,\n aspectName: string,\n limit?: number,\n accessKey?: string\n ): Promise<any[]> {\n const params: Record<string, string> = {};\n\n if (limit !== undefined) {\n params.size = limit.toString();\n }\n\n if (accessKey !== undefined) {\n params.accesskey = accessKey;\n }\n\n const endpoint = `networks/${networkUUID}/aspects/${aspectName}`;\n return this.http.get<any[]>(endpoint, { \n version: 'v3',\n params \n });\n }\n\n /**\n * Get filtered edges (migrated from original NDEx.js)\n * \n * Retrieves edges from a network that match specific filtering criteria on a column value.\n * The function supports both CX1 and CX2 formats based on the format parameter, with CX2 \n * being the default format used by the server.\n * \n * @param networkUUID - The UUID of the network to get filtered edges from\n * @param columnName - Name of the edge attribute column to filter on\n * @param valueString - Value to filter by (converted to string for comparison)\n * @param operator - Filtering operation: '>' | '<' | '=' | '!='\n * @param limit - Optional maximum number of edges to return (default: -1 = all matching edges)\n * @param order - Optional sort order for edges before applying limit: 'asc' | 'desc' (default: 'desc')\n * @param format - Optional output format: 'cx' | 'cx2' (default: 'cx2')\n * @param accessKey - Optional access key for private networks\n * @returns Promise resolving to array of edges in the specified format\n * \n * @example\n * ```typescript\n * // Get edges with weight > 0.5 in CX2 format (default)\n * const cx2Edges = await client.networks.getFilteredEdges(\n * 'network-uuid', 'weight', '0.5', '>'\n * );\n * \n * // Get top 10 edges with highest score in CX1 format\n * const cx1Edges = await client.networks.getFilteredEdges(\n * 'network-uuid', 'score', '0', '>', 10, 'desc', 'cx'\n * );\n * \n * // Get edges where interaction equals 'pp'\n * const ppEdges = await client.networks.getFilteredEdges(\n * 'network-uuid', 'interaction', 'pp', '=', undefined, undefined, 'cx2'\n * );\n * ```\n */\n async getFilteredEdges(\n networkUUID: string,\n columnName: string,\n valueString: string,\n operator: '>' | '<' | '=' | '!=',\n limit?: number,\n order?: 'asc' | 'desc',\n format?: 'cx' | 'cx2',\n accessKey?: string\n ): Promise<CX2Edge[] | CX1Edge[]> {\n const params: Record<string, string> = {};\n\n if (limit !== undefined) {\n params.size = limit.toString();\n }\n\n if (order !== undefined) {\n params.order = order;\n }\n\n if (accessKey !== undefined) {\n params.accesskey = accessKey;\n }\n\n if (format !== undefined) {\n params.format = format;\n }\n\n const data = {\n name: columnName,\n value: valueString,\n operator: operator\n };\n\n const endpoint = `search/networks/${networkUUID}/edges`;\n return this.http.post<CX2Edge[] | CX1Edge[]>(endpoint, data, { \n version: 'v3',\n params \n });\n }\n\n /**\n * Get CX2 metadata (migrated from original NDEx.js)\n * \n * Retrieves metadata information for all aspects in a CX2 network format.\n * This function provides aspect metadata including element counts for each\n * aspect in the network using the V3 API.\n * \n * @param networkUUID - The UUID of the network to get CX2 metadata for\n * @param accessKey - Optional access key for private networks\n * @returns Promise resolving to array of CX2MetaData objects\n * \n * @example\n * ```typescript\n * // Get CX2 metadata for a network\n * const metaData = await client.networks.getCX2MetaData('network-uuid');\n * console.log(metaData); // [{ name: 'nodes', elementCount: 100 }, { name: 'edges', elementCount: 150 }]\n * \n * // Get CX2 metadata for a private network\n * const privateMetaData = await client.networks.getCX2MetaData('private-network-uuid', 'access-key');\n * ```\n */\n async getCX2MetaData(\n networkUUID: string,\n accessKey?: string\n ): Promise<CX2MetaData[]> {\n const params: Record<string, string> = {};\n\n if (accessKey !== undefined) {\n params.accesskey = accessKey;\n }\n\n const endpoint = `networks/${networkUUID}/aspects`;\n return this.http.get<CX2MetaData[]>(endpoint, { \n version: 'v3',\n params \n });\n }\n\n /**\n * Create network from raw CX2 data (migrated from original NDEx.js)\n * \n * Creates a new network on NDEx from raw CX2 data using the V3 API.\n * This function delegates to the NetworkServiceV3 implementation.\n * \n * @param cx2Data - Raw CX2 network data as an object or CX2Network instance\n * @param options - Creation options including visibility and folderId\n * @param options.visibility - Network visibility: 'PUBLIC' or 'PRIVATE' (default: 'PRIVATE')\n * @param options.folderId - UUID of the folder to create the network in. If omitted, network is created in user's home directory\n * @returns Promise resolving to NDExObjectUpdateStatus with uuid and modificationTime\n * \n * @example\n * ```typescript\n * // Create private network from raw CX2 data in user's home directory\n * const result = await client.networks.createNetworkFromRawCX2(cx2Data);\n * console.log(result.uuid); // \"12345678-1234-1234-1234-123456789abc\"\n * \n * // Create public network from raw CX2 data in a specific folder\n * const publicResult = await client.networks.createNetworkFromRawCX2(cx2Data, { \n * visibility: 'PUBLIC', \n * folderId: '87654321-4321-4321-4321-876543210fed'\n * });\n * console.log(publicResult.uuid);\n * ```\n */\n async createNetworkFromRawCX2(\n cx2Data: CX2NetworkType | CX2Network,\n options: { visibility?: 'PUBLIC' | 'PRIVATE'; folderId?: string } = {}\n ): Promise<NDExObjectUpdateStatus> {\n return this.v3.createNetworkFromCX2(cx2Data, options);\n }\n\n /**\n * Update network from raw CX2 data (migrated from original NDEx.js)\n * \n * Updates an existing network with new raw CX2 data using the V3 API.\n * This function replaces the entire network content with the provided CX2 data.\n * \n * @param networkUUID - The UUID of the network to update\n * @param rawCX2 - Raw CX2 network data as an object or CX2Network instance\n * @returns Promise resolving when the network update is complete\n * \n * @example\n * ```typescript\n * // Update existing network with new CX2 data\n * await client.networks.updateNetworkFromRawCX2('network-uuid', updatedCx2Data);\n * ```\n */\n async updateNetworkFromRawCX2(\n networkUUID: string,\n rawCX2: CX2NetworkType | any\n ): Promise<void> {\n const endpoint = `networks/${networkUUID}`;\n return this.http.put<void>(endpoint, rawCX2, { version: 'v3' });\n }\n\n /**\n * Access to underlying service instances for advanced usage\n */\n get v2(): NetworkServiceV2 {\n return this.v2Service;\n }\n\n get v3(): NetworkServiceV3 {\n return this.v3Service;\n }\n}\n","import { HTTPService } from './HTTPService';\n\n// Type definitions for better type safety\ninterface ShareData {\n files: Record<string, 'NETWORK' | 'FOLDER' | 'SHORTCUT'>;\n}\n\ninterface MemberData {\n members: Record<string, 'READ' | 'WRITE'>;\n}\n\ninterface UpdateMemberRequest {\n files: ShareData['files'];\n members: MemberData['members'];\n}\n\ninterface TransferOwnershipRequest {\n files: ShareData['files'];\n new_owner: string;\n}\n\n/**\n * FilesService - NDEx file operations and task management\n * Handles file uploads, downloads, exports, and asynchronous task tracking\n */\nexport class FilesService {\n constructor(private http: HTTPService) {}\n\n /**\n * Copy a file to a different location\n * @param fromUuid - Source file UUID\n * @param toPath - Target path\n * @param type - File type (NETWORK, FOLDER, SHORTCUT)\n * @param accessKey - Optional access key for protected files\n */\n copyFile(fromUuid: string, toPath: string, type: string, accessKey?: string): Promise<any> {\n let parameters: Record<string, any> = {};\n\n if (accessKey !== undefined) {\n parameters['accesskey'] = accessKey;\n }\n return this.http.post('files/copy', {from_uuid: fromUuid, type: type, to_path: toPath}, {params: parameters, version: 'v3'});\n }\n\n /** Get file count statistics for the current user */\n getCount(): Promise<any> {\n return this.http.get('files/count', {version: 'v3'});\n }\n\n /** Get files in the trash for the current user */\n getTrash(): Promise<any> {\n return this.http.get('files/trash', {version: 'v3'});\n }\n\n /** Permanently delete all files in trash */\n emptyTrash(): Promise<any> {\n return this.http.delete('files/trash', {version: 'v3'});\n }\n\n /**\n * Permanently delete a file from trash\n * @param fileId - File UUID to permanently delete\n */\n permanentlyDeleteFile(fileId: string): Promise<any> {\n return this.http.delete(`files/trash/${fileId}`, { version: 'v3' });\n }\n\n /**\n * Restore files from trash\n * @param networkIds - Array of network UUIDs to restore\n * @param folderIds - Array of folder UUIDs to restore \n * @param shortcutIds - Array of shortcut UUIDs to restore\n */\n restoreFile(networkIds: string[], folderIds: string[], shortcutIds: string[]): Promise<any> {\n return this.http.post('files/trash/restore', {networks: networkIds, folders: folderIds, shortcuts: shortcutIds}, {version: 'v3'});\n }\n\n private _validateShareData(data: any): void {\n // Check if data is an object and has files property\n if (typeof data !== 'object' || data === null || data.files === undefined) {\n throw new Error('Data must be an object with a \"files\" property');\n }\n \n // Check if files is an object\n if (typeof data.files !== 'object' || data.files === null) {\n throw new Error('The \"files\" property must be an object');\n }\n \n // Check each key-value pair in files\n const validValues = ['NETWORK', 'FOLDER', 'SHORTCUT'];\n \n for (const [uuid, fileType] of Object.entries(data.files)) {\n // Validate UUID format (basic validation)\n if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(uuid)) {\n throw new Error(`Invalid UUID format: ${uuid}`);\n }\n \n // Validate file type\n if (!validValues.includes(fileType as string)) {\n throw new Error(`Invalid file type for ${uuid}: ${fileType}. Must be one of: ${validValues.join(', ')}`);\n }\n }\n }\n\n private _validateMemberData(data: any): void {\n if (typeof data !== 'object' || data === null || data.members === undefined) {\n throw new Error('Data must be an object with a \"members\" property');\n }\n const validValues = ['READ', 'WRITE'];\n for (const [uuid, permission] of Object.entries(data.members)) {\n if (!validValues.includes(permission as string)) {\n throw new Error(`Invalid permission for ${uuid}: ${permission}. Must be one of: ${validValues.join(', ')}`);\n }\n if (typeof uuid !== 'string' || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(uuid)) {\n throw new Error(`Invalid UUID format: ${uuid}`);\n }\n }\n }\n\n updateMember(files: ShareData['files'], members: MemberData['members']): Promise<any> {\n this._validateShareData({ files });\n this._validateMemberData({ members });\n return this.http.post('files/sharing/members', { files, members }, { version: 'v3' });\n }\n\n listMembers(files: any): Promise<any> {\n return this.http.get('files/sharing/members/list', {params: files, version: 'v3'});\n }\n\n transferOwnership(files: ShareData['files'], newOwner: string): Promise<any> {\n this._validateShareData({ files });\n return this.http.post('files/sharing/transfer_ownership', { files, new_owner: newOwner }, { version: 'v3' });\n }\n\n listShares(limit?: number): Promise<any> {\n const parameters: Record<string, any> = {};\n if (limit !== undefined) {\n parameters['limit'] = limit;\n }\n return this.http.post('files/sharing/list', parameters, { version: 'v3' });\n }\n \n share(files: ShareData['files']): Promise<any> {\n this._validateShareData({ files });\n return this.http.post('files/sharing/share', { files }, { version: 'v3' });\n }\n\n unshare(files: ShareData['files']): Promise<any> {\n this._validateShareData({ files });\n return this.http.post('files/sharing/unshare', { files }, { version: 'v3' });\n }\n\n // Folder operations\n getFolders(limit?: number): Promise<any> {\n let parameters: Record<string, any> = {};\n\n if (limit !== undefined) {\n parameters['limit'] = limit;\n }\n return this.http.get('files/folders', {params: parameters, version: 'v3'});\n }\n \n createFolder(name: string, parentFolderId?: string): Promise<any> {\n return this.http.post('files/folders', { name: name, parent: parentFolderId }, { version: 'v3' });\n }\n\n getFolder(folderId: string, accessKey?: string): Promise<any> {\n const parameters: Record<string, any> = {};\n if (accessKey !== undefined) {\n parameters['accesskey'] = accessKey;\n }\n return this.http.get(`files/folders/${folderId}`, { params: parameters, version: 'v3' });\n }\n\n updateFolder(folderId: string, name: string, parentFolderId?: string): Promise<any> {\n return this.http.put(`files/folders/${folderId}`, { name: name, parent: parentFolderId }, { version: 'v3' });\n }\n\n deleteFolder(folderId: string): Promise<any> {\n return this.http.delete(`files/folders/${folderId}`, { version: 'v3' });\n }\n\n getFolderCount(folderId: string, accessKey?: string): Promise<any> {\n const parameters: Record<string, any> = {};\n if (accessKey !== undefined) {\n parameters['accesskey'] = accessKey;\n }\n return this.http.get(`files/folders/${folderId}/count`, { params: parameters, version: 'v3' });\n }\n\n getFolderList(folderId: string, accessKey?: string, format?: string, type?: string): Promise<any> {\n const parameters: Record<string, any> = {};\n if (accessKey !== undefined) {\n parameters['accesskey'] = accessKey;\n }\n if (format !== undefined) {\n parameters['format'] = format;\n }\n if (type !== undefined) {\n parameters['type'] = type;\n }\n return this.http.get(`files/folders/${folderId}/list`, { params: parameters, version: 'v3' });\n }\n\n // Shortcut operations\n getShortcuts(limit?: number): Promise<any> {\n let parameters: Record<string, any> = {};\n\n if (limit !== undefined) {\n parameters['limit'] = limit;\n }\n return this.http.get('files/shortcuts', {params: parameters, version: 'v3'});\n }\n\n createShortcut(name: string, parentFolderId?: string, targetId?: string, targetType?: string): Promise<any> {\n return this.http.post('files/shortcuts', { name: name, parent: parentFolderId, target: targetId, targetType }, { version: 'v3' });\n }\n\n getShortcut(shortcutId: string, accessKey?: string): Promise<any> {\n const parameters: Record<string, any> = {};\n if (accessKey !== undefined) {\n parameters['accesskey'] = accessKey;\n }\n return this.http.get(`files/shortcuts/${shortcutId}`, { params: parameters, version: 'v3' });\n }\n \n updateShortcut(shortcutId: string, name: string, parentFolderId?: string, targetId?: string, targetType?: string): Promise<any> {\n return this.http.put(`files/shortcuts/${shortcutId}`, { name: name, parent: parentFolderId, target: targetId, targetType }, { version: 'v3' });\n }\n\n deleteShortcut(shortcutId: string): Promise<any> {\n return this.http.delete(`files/shortcuts/${shortcutId}`, { version: 'v3' });\n }\n}\n","import { HTTPService } from './HTTPService';\nimport { CyWebWorkspace } from '../types';\n\n/**\n * WorkspaceService - NDEx CyWeb workspace operations\n * \n * Provides methods for managing CyWeb workspaces including creation, retrieval,\n * updates, and deletion of workspaces and their associated networks.\n * All workspace operations use the V3 API.\n */\nexport class WorkspaceService {\n constructor(private http: HTTPService) {}\n\n /**\n * Create a new CyWeb workspace (migrated from original NDEx.js)\n * \n * Creates a new workspace with the specified workspace data.\n * \n * @param workspace - The workspace object to create\n * @returns Promise resolving to the response from the server (typically contains workspace location)\n * \n * @example\n * ```typescript\n * const workspaceData = {\n * name: \"My Workspace\",\n * description: \"A sample workspace\",\n * networkIds: []\n * };\n * const response = await client.workspace.createCyWebWorkspace(workspaceData);\n * ```\n */\n async createCyWebWorkspace(workspace: CyWebWorkspace): Promise<string> {\n const endpoint = 'workspaces';\n return this.http.post<string>(endpoint, workspace, { version: 'v3' });\n }\n\n /**\n * Get a CyWeb workspace by ID (migrated from original NDEx.js)\n * \n * Retrieves a workspace and its details by workspace ID.\n * \n * @param workspaceId - The UUID of the workspace to retrieve\n * @returns Promise resolving to the workspace object\n * \n * @example\n * ```typescript\n * const workspace = await client.workspace.getCyWebWorkspace('workspace-uuid');\n * console.log(workspace.name);\n * ```\n */\n async getCyWebWorkspace(workspaceId: string): Promise<CyWebWorkspace> {\n const endpoint = `workspaces/${workspaceId}`;\n return this.http.get<CyWebWorkspace>(endpoint, { version: 'v3' });\n }\n\n /**\n * Delete a CyWeb workspace (migrated from original NDEx.js)\n * \n * Deletes the specified workspace permanently.\n * \n * @param workspaceId - The UUID of the workspace to delete\n * @returns Promise resolving when the workspace is deleted\n * \n * @example\n * ```typescript\n * await client.workspace.deleteCyWebWorkspace('workspace-uuid');\n * ```\n */\n async deleteCyWebWorkspace(workspaceId: string): Promise<void> {\n const endpoint = `workspaces/${workspaceId}`;\n return this.http.delete<void>(endpoint, { version: 'v3' });\n }\n\n /**\n * Update a CyWeb workspace (migrated from original NDEx.js)\n * \n * Updates a workspace with new data, replacing the entire workspace object.\n * \n * @param workspaceId - The UUID of the workspace to update\n * @param workspaceObj - The updated workspace object\n * @returns Promise resolving when the workspace is updated\n * \n * @example\n * ```typescript\n * const updatedWorkspace = {\n * name: \"Updated Workspace Name\",\n * description: \"Updated description\",\n * networkIds: [\"network-uuid-1\", \"network-uuid-2\"]\n * };\n * await client.workspace.updateCyWebWorkspace('workspace-uuid', updatedWorkspace);\n * ```\n */\n async updateCyWebWorkspace(workspaceId: string, workspaceObj: CyWebWorkspace): Promise<void> {\n const endpoint = `workspaces/${workspaceId}`;\n return this.http.put<void>(endpoint, workspaceObj, { version: 'v3' });\n }\n\n /**\n * Update CyWeb workspace name (migrated from original NDEx.js)\n * \n * Updates only the name of a workspace.\n * \n * @param workspaceId - The UUID of the workspace to update\n * @param newName - The new name for the workspace\n * @returns Promise resolving when the workspace name is updated\n * \n * @example\n * ```typescript\n * await client.workspace.updateCyWebWorkspaceName('workspace-uuid', 'New Workspace Name');\n * ```\n */\n async updateCyWebWorkspaceName(workspaceId: string, newName: string): Promise<void> {\n const endpoint = `workspaces/${workspaceId}/name`;\n return this.http.put<void>(endpoint, { name: newName }, { version: 'v3' });\n }\n\n /**\n * Update CyWeb workspace networks (migrated from original NDEx.js)\n * \n * Updates the list of network IDs associated with a workspace.\n * \n * @param workspaceId - The UUID of the workspace to update\n * @param networkIds - Array of network UUIDs to associate with the workspace\n * @returns Promise resolving when the workspace networks are updated\n * \n * @example\n * ```typescript\n * const networkIds = ['network-uuid-1', 'network-uuid-2', 'network-uuid-3'];\n * await client.workspace.updateCyWebWorkspaceNetworks('workspace-uuid', networkIds);\n * ```\n */\n async updateCyWebWorkspaceNetworks(workspaceId: string, networkIds: string[]): Promise<void> {\n const endpoint = `workspaces/${workspaceId}/networkids`;\n return this.http.put<void>(endpoint, networkIds, { version: 'v3' });\n }\n\n /**\n * Get user's CyWeb workspaces (migrated from original NDEx.js)\n * \n * Retrieves all workspaces belonging to the currently authenticated user.\n * Requires authentication.\n * \n * @returns Promise resolving to array of workspace objects\n * \n * @example\n * ```typescript\n * const workspaces = await client.workspace.getUserCyWebWorkspaces();\n * workspaces.forEach(workspace => {\n * console.log(`Workspace: ${workspace.name}`);\n * });\n * ```\n */\n async getUserCyWebWorkspaces(): Promise<CyWebWorkspace[]> {\n // First get the current user to get their externalId\n const user = await this.http.get<any>('user', { params: { valid: true } });\n const endpoint = `users/${user.externalId}/workspaces`;\n return this.http.get<CyWebWorkspace[]>(endpoint, { version: 'v3' });\n }\n}\n","import { HTTPService } from './HTTPService';\nimport { \n NDExUser,\n PaginationParams,\n NetworkSummaryV2\n} from '../types';\n\n/**\n * UserService - NDEx user-related operations\n * Handles authentication, user management, and user workspace operations\n */\nexport class UserService {\n constructor(private http: HTTPService) {}\n\n // ============================================================================\n // Authentication Methods\n // ============================================================================\n\n /**\n * Get authenticated user (equivalent to getSignedInUser from legacy client)\n * Returns the current signed-in user object from NDEx server\n * \n * For basic authentication: Gets the current user using the /user endpoint\n * For OAuth authentication: Uses the /users/signin endpoint with ID token\n * \n * @returns The authenticated user object\n * @note When authenticating with OAuth ID token, if a user with matching email \n * doesn't exist on the server, this function will automatically create \n * that user and return the newly created user object.\n */\n async authenticate(): Promise<NDExUser> {\n const authType = this.http.getAuthType();\n if (!authType) {\n throw new Error('Authentication parameters are missing in NDEx client.');\n }\n \n if (authType === 'basic') {\n // For basic auth, use the standard user endpoint with valid parameter\n const endpoint = 'user';\n const params = { valid: true };\n return this.http.get<NDExUser>(endpoint, { params });\n } else if (authType === 'oauth') {\n // For OAuth, use the signin endpoint with ID token (v3 API)\n const idToken = this.http.getIdToken();\n if (!idToken) {\n throw new Error('OAuth ID token is missing.');\n }\n \n const endpoint = 'users/signin';\n const data = { idToken };\n return this.http.post<NDExUser>(endpoint, data, { version: 'v3' });\n }\n \n throw new Error(`Unsupported authentication type: ${authType}`);\n }\n\n /**\n * Get current user profile (equivalent to getSignedInUser from legacy client)\n * Returns the current signed-in user object from NDEx server\n * \n * Uses the /user endpoint with {valid: true} parameter for both basic and OAuth authentication.\n * Unlike authenticate(), this function will NOT automatically create a user account for OAuth.\n * If the OAuth ID token doesn't match an existing user, it will return an unauthorized error.\n * \n * @returns The current user object\n * @note This function requires existing authentication and will not create new users\n */\n async getCurrentUser(): Promise<NDExUser> {\n const authType = this.http.getAuthType();\n if (!authType) {\n throw new Error('Authentication parameters are missing in NDEx client.');\n }\n \n const endpoint = 'user';\n const params = { valid: true };\n return this.http.get<NDExUser>(endpoint, { params });\n }\n\n /**\n * Update current user profile\n * Uses the UUID from the userUpdate object and server validates against authenticated user\n */\n async updateCurrentUser(userUpdate: Partial<NDExUser>): Promise<void> {\n if (!userUpdate.externalId) {\n throw new Error('User uuid is required in userUpdate object');\n }\n\n const endpoint = `user/${userUpdate.externalId}`;\n return this.http.put<void>(endpoint, userUpdate);\n }\n\n\n /**\n * Request password reset\n */\n async requestPasswordReset(email: string): Promise<void> {\n const endpoint = 'user/forgot-password';\n return this.http.post<void>(endpoint, { email });\n }\n\n /**\n * Reset password with user UUID (server validates UUID matches authenticated user)\n * @param userUUID - User UUID (must match authenticated user)\n * @param newPassword - New password as plain text\n */\n async resetPassword(userUUID: string, newPassword: string): Promise<void> {\n const endpoint = `user/${userUUID}/password`;\n const config: any = {\n headers: {\n 'Content-Type': 'text/plain' // Send password as plain text\n }\n };\n \n return this.http.put<void>(endpoint, newPassword, config);\n }\n\n // ============================================================================\n // User Management Methods\n // ============================================================================\n\n /**\n * Get user by UUID\n */\n async getUser(userUUID: string): Promise<NDExUser> {\n const endpoint = `user/${userUUID}`;\n return this.http.get<NDExUser>(endpoint);\n }\n\n /**\n * Get user by account name or email (matches server getUserByAccountNameOrAuthenticatUser)\n * @param searchBy - Search criteria - either by username OR by email, but not both\n * @returns User object matching the search criteria\n * @note If both username and email are provided, only username will be used\n */\n async getUserByNameOrEmail(searchBy: \n | { username: string }\n | { email: string }\n ): Promise<NDExUser> {\n const params = new URLSearchParams();\n \n if ('username' in searchBy) {\n params.append('username', searchBy.username);\n } else if ('email' in searchBy) {\n params.append('email', searchBy.email);\n }\n\n const endpoint = `user?${params.toString()}`;\n return this.http.get<NDExUser>(endpoint);\n }\n\n /**\n * Get multiple users by their UUIDs (batch operation)\n * @param uuidList - Array of user UUIDs to fetch\n * @returns Array of user objects corresponding to the provided UUIDs\n */\n async getUsersByUUIDs(uuidList: string[]): Promise<NDExUser[]> {\n const endpoint = 'batch/user';\n return this.http.post<NDExUser[]>(endpoint, uuidList);\n }\n\n /**\n * Search users (equivalent to searchUsers from legacy client)\n * @param searchTerms - Search string to find users\n * @param start - Starting offset for pagination (optional)\n * @param size - Maximum number of results to return (optional)\n * @returns Array of users matching the search criteria\n */\n async searchUsers(\n searchTerms: string, \n start?: number, \n size?: number\n ): Promise<NDExUser[]> {\n const params: Record<string, string> = {};\n \n if (start !== undefined) {\n params.start = start.toString();\n }\n if (size !== undefined) {\n params.limit = size.toString();\n }\n\n const data = { searchString: searchTerms };\n const endpoint = 'search/user';\n \n return this.http.post<NDExUser[]>(endpoint, data, { params });\n }\n\n\n // ============================================================================\n // User Network Methods\n // ============================================================================\n\n /**\n * Get networks for a user's account page (equivalent to getAccountPageNetworks from legacy client)\n * \n * @param userUUID - User UUID to get networks for\n * @param offset - Starting offset for pagination (optional)\n * @param limit - Maximum number of networks to return (optional)\n * @returns Array of V2 network summaries for the specified user\n * @note This function requires authentication. The auth attribute must be set in the client configuration.\n */\n async getAccountPageNetworks(\n userUUID: string,\n offset?: number, \n limit?: number\n ): Promise<NetworkSummaryV2[]> {\n // Build parameters for the network summary request\n const params: Record<string, string> = {};\n if (offset !== undefined) {\n params.offset = offset.toString();\n }\n if (limit !== undefined) {\n params.limit = limit.toString();\n }\n\n // Get network summaries for the user\n const endpoint = `user/${userUUID}/networksummary`;\n return this.http.get<NetworkSummaryV2[]>(endpoint, { params });\n }\n\n\n\n /**\n * Delete user account (server validates userid matches authenticated user)\n * @param userUUID - User UUID to delete (must match authenticated user)\n * @note This function requires authentication. The auth attribute must be set in the client configuration.\n * @note The userUUID parameter must be the UUID of the currently authenticated user. The server will validate this.\n */\n async deleteUserAccount(userUUID: string): Promise<void> {\n const endpoint = `user/${userUUID}`;\n return this.http.delete<void>(endpoint);\n }\n}\n","import { HTTPService } from './HTTPService';\n\n/**\n * AdminService - NDEx admin operations\n * Handles system administration and user management for admin users\n */\nexport class AdminService {\n constructor(private http: HTTPService) {}\n\n}\n","import axios, { AxiosInstance } from 'axios';\nimport {\n CyNDExConfig,\n CyNDExAuthConfig,\n NDExImportParams,\n NDExExportParams,\n CytoscapeNetworkSummary,\n CyNDExStatusResponse,\n CX2ImportParams\n} from '../types/cytoscape';\n\n/**\n * CyNDEx Service - Cytoscape-NDEx Bridge\n * \n * Provides seamless integration between Cytoscape desktop application and NDEx,\n * enabling import/export of networks with support for CX and CX2 formats.\n * \n * This service communicates with Cytoscape via its REST API and handles NDEx\n * authentication parameters that are passed to Cytoscape for NDEx operations.\n * \n * @example\n * ```typescript\n * // Basic usage\n * const cyNDEx = new CyNDExService();\n * \n * // Configure NDEx server\n * cyNDEx.setNDExBaseURL('https://www.ndexbio.org');\n * \n * // Set authentication\n * cyNDEx.setBasicAuth('username', 'password');\n * // or\n * cyNDEx.setAuthToken('oauth-id-token');\n * \n * // Import network from NDEx to Cytoscape\n * await cyNDEx.postNDExNetworkToCytoscape('network-uuid', 'access-key');\n * \n * // Export network from Cytoscape to NDEx\n * await cyNDEx.postCytoscapeNetworkToNDEx('current');\n * \n * // Import CX2 data to Cytoscape\n * await cyNDEx.postCX2NetworkToCytoscape(cx2String, 'My Network', 'My Collection');\n * ```\n */\nexport class CyNDExService {\n private _port: number;\n private cyRestBaseURL: string;\n private ndexBaseURL: string;\n private authConfig?: CyNDExAuthConfig;\n private axiosInstance: AxiosInstance;\n\n /**\n * Create a new CyNDEx service instance\n * \n * @param port - Port number for Cytoscape REST API (default: 1234)\n * @param config - Optional configuration object\n */\n constructor(port: number = 1234, config?: CyNDExConfig) {\n this._port = port;\n this.cyRestBaseURL = config?.cyRestBaseURL || 'http://127.0.0.1';\n this.ndexBaseURL = config?.ndexBaseURL || 'https://www.ndexbio.org';\n\n // Create axios instance for Cytoscape REST API calls\n this.axiosInstance = axios.create({\n baseURL: this.cyRestURL(),\n timeout: 30000,\n headers: {\n 'Content-Type': 'application/json'\n }\n });\n }\n\n /**\n * Get the port number for Cytoscape REST API\n */\n get port(): number {\n return this._port;\n }\n\n /**\n * Get the base URL for Cytoscape REST API\n */\n static get cyRestBaseURL(): string {\n return 'http://127.0.0.1';\n }\n\n /**\n * Set NDEx server base URL\n * \n * @param ndexBaseURL - Complete base URL for NDEx server (e.g., 'https://www.ndexbio.org')\n * Must include protocol (https:// or http://)\n * \n * @example\n * ```typescript\n * cyNDEx.setNDExBaseURL('https://www.ndexbio.org');\n * cyNDEx.setNDExBaseURL('https://test.ndexbio.org');\n * ```\n */\n setNDExBaseURL(ndexBaseURL: string): void {\n if (ndexBaseURL?.trim()) {\n this.ndexBaseURL = ndexBaseURL.trim();\n }\n }\n\n /**\n * Get the current NDEx server base URL\n * \n * @returns Complete NDEx server base URL\n */\n getNDExBaseURL(): string {\n return this.ndexBaseURL;\n }\n\n\n /**\n * Set basic authentication credentials for NDEx operations\n * \n * @param username - NDEx username\n * @param password - NDEx password\n */\n setBasicAuth(username: string, password: string): void {\n if (username?.trim() && password) {\n this.authConfig = {\n type: 'basic',\n username: username.trim(),\n password: password\n };\n }\n }\n\n /**\n * Set OAuth ID token for NDEx operations\n * \n * @param idToken - OAuth ID token from authentication provider\n */\n setAuthToken(idToken: string): void {\n if (idToken?.trim()) {\n this.authConfig = {\n type: 'oauth',\n idToken: idToken.trim()\n };\n }\n }\n\n /**\n * Clear authentication credentials\n */\n clearAuth(): void {\n this.authConfig = undefined;\n }\n\n /**\n * Get the complete Cytoscape REST API URL\n * \n * @returns Complete URL for Cytoscape REST API\n */\n cyRestURL(): string {\n return `${this.cyRestBaseURL}:${this._port}`;\n }\n\n /**\n * Get authorization fields for NDEx operations\n * These are passed as parameters to Cytoscape for NDEx authentication\n * \n * @private\n * @returns Authorization parameters object\n */\n private getAuthFields(): Record<string, string> {\n if (!this.authConfig) return {};\n\n switch (this.authConfig.type) {\n case 'basic':\n return {\n username: this.authConfig.username!,\n password: this.authConfig.password!\n };\n case 'oauth':\n return {\n idToken: this.authConfig.idToken!\n };\n default:\n return {};\n }\n }\n\n /**\n * Perform HTTP GET request to Cytoscape REST API\n * \n * @private\n * @param url - Endpoint URL (relative to base URL)\n * @returns Promise resolving to response data\n */\n private async _httpGet<T = any>(url: string): Promise<T> {\n const response = await this.axiosInstance.get<T>(url);\n return response.data;\n }\n\n /**\n * Perform HTTP POST request to Cytoscape REST API\n * \n * @private\n * @param url - Endpoint URL (relative to base URL)\n * @param params - Optional query parameters\n * @param data - Optional request body data\n * @returns Promise resolving to response data\n */\n private async _httpPost<T = any>(url: string, params?: any, data?: any): Promise<T> {\n const response = await this.axiosInstance.post<T>(url, data, { params });\n return response.data;\n }\n\n /**\n * Perform HTTP PUT request to Cytoscape REST API\n * \n * @private\n * @param url - Endpoint URL (relative to base URL)\n * @param params - Optional query parameters\n * @param data - Optional request body data\n * @returns Promise resolving to response data\n */\n private async _httpPut<T = any>(url: string, params?: any, data?: any): Promise<T> {\n const response = await this.axiosInstance.put<T>(url, data, { params });\n return response.data;\n }\n\n // =============================================================================\n // Public API Methods - Maintain exact same signatures as original CyNDEx.js\n // =============================================================================\n\n /**\n * Get CyNDEx plugin status from Cytoscape\n * \n * @returns Promise resolving to CyNDEx status information\n */\n async getCyNDExStatus(): Promise<CyNDExStatusResponse> {\n return this._httpGet<CyNDExStatusResponse>('/cyndex2/v1');\n }\n\n /**\n * Get network summary information from Cytoscape\n * \n * @param suid - Network SUID or 'current' for current network (default: 'current')\n * @returns Promise resolving to network summary\n */\n async getCytoscapeNetworkSummary(suid: string = 'current'): Promise<CytoscapeNetworkSummary> {\n return this._httpGet<CytoscapeNetworkSummary>(`/cyndex2/v1/networks/${suid}`);\n }\n\n /**\n * Import network from NDEx to Cytoscape\n * \n * @param uuid - NDEx network UUID\n * @param accessKey - Optional access key for private networks\n * @param createView - Whether to create a network view (default: undefined)\n * @returns Promise resolving to import result\n */\n async postNDExNetworkToCytoscape(\n uuid: string, \n accessKey?: string, \n createView?: boolean\n ): Promise<any> {\n const importParams: NDExImportParams = {\n serverUrl: `${this.ndexBaseURL}/v2`,\n uuid: uuid,\n accessKey: accessKey,\n createView: createView,\n ...this.getAuthFields()\n };\n\n return this._httpPost('/cyndex2/v1/networks', undefined, importParams);\n }\n\n /**\n * Import CX network data to Cytoscape\n * \n * @param cx - CX format network data\n * @returns Promise resolving to import result\n */\n async postCXNetworkToCytoscape(cx: any): Promise<any> {\n return this._httpPost('/cyndex2/v1/networks/cx', undefined, cx);\n }\n\n /**\n * Import CX2 network data to Cytoscape\n * \n * @param cx2_string - CX2 format network data as string\n * @param title - Network title\n * @param collection_name - Collection name\n * @returns Promise resolving to import result\n */\n async postCX2NetworkToCytoscape(\n cx2_string: string, \n title: string, \n collection_name: string\n ): Promise<any> {\n const params: CX2ImportParams = {\n format: 'cx2',\n collection: collection_name,\n title: title\n };\n\n return this._httpPost('/v1/networks', params, cx2_string);\n }\n\n /**\n * Export network from Cytoscape to NDEx (create new network)\n * \n * @param suid - Network SUID or 'current' for current network (default: 'current')\n * @returns Promise resolving to export result\n */\n async postCytoscapeNetworkToNDEx(suid: string = 'current'): Promise<any> {\n const saveParams: NDExExportParams = {\n serverUrl: `${this.ndexBaseURL}/v2`,\n ...this.getAuthFields()\n };\n\n return this._httpPost(`/cyndex2/v1/networks/${suid}`, undefined, saveParams);\n }\n\n /**\n * Update existing network in NDEx with data from Cytoscape\n * \n * @param suid - Network SUID or 'current' for current network (default: 'current')\n * @param uuid - Target NDEx network UUID to update\n * @returns Promise resolving to update result\n */\n async putCytoscapeNetworkInNDEx(suid: string = 'current', uuid: string): Promise<any> {\n const saveParams: NDExExportParams = {\n serverUrl: `${this.ndexBaseURL}/v2`,\n uuid: uuid,\n ...this.getAuthFields()\n };\n\n return this._httpPut(`/cyndex2/v1/networks/${suid}`, undefined, saveParams);\n }\n}\n\n// Export both as named export and default for backward compatibility\nexport default CyNDExService;","{\n \"name\": \"@js4cytoscape/ndex-client\",\n \"version\": \"0.6.0-alpha.2\",\n \"description\": \"NDEx client library - Modern TypeScript implementation\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/cytoscape/js4cytoscape.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/cytoscape/js4cytoscape/issues\"\n },\n \"homepage\": \"https://github.com/cytoscape/js4cytoscape\",\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"umd\": \"./dist/index.umd.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n }\n },\n \"files\": [\n \"dist\",\n \"src\",\n \"README.md\",\n \"LICENSE\"\n ],\n \"scripts\": {\n \"dev\": \"tsup --watch\",\n \"build\": \"tsup\",\n \"build:docs\": \"typedoc\",\n \"docs:api\": \"npm run build:docs\",\n \"docs:site\": \"cd docs-root/guide && npm install && npm run build\",\n \"docs:serve\": \"cd docs-root/guide && npm run start\",\n \"docs:build\": \"npm run docs:api && npm run docs:site\",\n \"docs:clean\": \"rimraf docs-root/api docs-root/guide/build\",\n \"test\": \"npm run test:unit\",\n \"test:unit\": \"jest --config jest.unit.config.js\",\n \"test:integration\": \"jest --config jest.integration.config.js\",\n \"test:all\": \"npm run test:unit && npm run test:integration\",\n \"test:watch\": \"npm run test:unit -- --watch\",\n \"test:coverage\": \"npm run test:unit -- --coverage\",\n \"test:ci\": \"npm run test:all -- --coverage\",\n \"debug:integration\": \"node --inspect-brk ./node_modules/.bin/jest --config jest.integration.config.js --runInBand --no-cache\",\n \"debug:unit\": \"node --inspect-brk ./node_modules/.bin/jest --config jest.unit.config.js --runInBand --no-cache\",\n \"debug:client\": \"node --inspect-brk debug-response.js\",\n \"lint\": \"eslint src __tests__ --ext .ts,.js --fix\",\n \"format\": \"prettier --write \\\"src/**/*.{ts,js}\\\" \\\"__tests__/**/*.{ts,js}\\\"\",\n \"type-check\": \"tsc --noEmit\",\n \"clean\": \"rimraf dist coverage\",\n \"prepare\": \"npm run build\",\n \"changeset\": \"changeset\",\n \"release\": \"changeset publish\"\n },\n \"author\": \"Jing Chen\",\n \"license\": \"MIT\",\n \"engines\": {\n \"node\": \">=16.0.0\"\n },\n \"keywords\": [\n \"ndex\",\n \"network\",\n \"cytoscape\",\n \"bioinformatics\",\n \"graph\",\n \"cx2\",\n \"typescript\"\n ],\n \"dependencies\": {\n \"axios\": \"^1.11.0\"\n },\n \"devDependencies\": {\n \"@changesets/cli\": \"^2.27.1\",\n \"@types/jest\": \"^29.5.12\",\n \"@types/node\": \"^20.11.25\",\n \"@typescript-eslint/eslint-plugin\": \"^7.1.1\",\n \"@typescript-eslint/parser\": \"^7.1.1\",\n \"eslint\": \"^8.57.0\",\n \"eslint-config-prettier\": \"^9.1.0\",\n \"eslint-plugin-prettier\": \"^5.1.3\",\n \"glob\": \"^7.2.0\",\n \"jest\": \"^29.7.0\",\n \"jest-environment-jsdom\": \"^29.7.0\",\n \"nock\": \"^13.5.4\",\n \"prettier\": \"^3.2.5\",\n \"rimraf\": \"^5.0.5\",\n \"ts-jest\": \"^29.1.2\",\n \"tsup\": \"^8.0.2\",\n \"typedoc\": \"^0.28.12\",\n \"typedoc-material-theme\": \"^1.4.0\",\n \"typedoc-plugin-markdown\": \"^4.8.1\",\n \"typescript\": \"^5.4.2\"\n },\n \"peerDependencies\": {\n \"cytoscape\": \"^3.0.0\"\n },\n \"peerDependenciesMeta\": {\n \"cytoscape\": {\n \"optional\": true\n }\n }\n}\n","import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';\nimport { \n NDExClientConfig, \n APIResponse, \n APIError, \n BasicAuth, \n OAuthAuth,\n NDExError,\n NDExNetworkError,\n NDExAuthError,\n NDExNotFoundError,\n NDExValidationError,\n NDExServerError\n} from '../types';\nimport { version } from '../../package.json';\n\n/**\n * HTTPService - Core HTTP client for NDEx API communication\n * Handles v2/v3 endpoint routing, authentication, and error handling\n * \n * @note User-Agent header is set to 'NDEx-JS-Client/${version}' but only works in Node.js.\n * Browsers will ignore custom User-Agent headers for security reasons.\n * @internal\n */\nexport class HTTPService {\n private axiosInstance: AxiosInstance;\n private config: NDExClientConfig;\n\n constructor(config: NDExClientConfig = {}) {\n this.config = {\n baseURL: 'https://www.ndexbio.org',\n timeout: 30000,\n retries: 3,\n retryDelay: 1000,\n debug: false,\n ...config,\n };\n\n // Create headers object\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n ...this.config.headers,\n ...this.getAuthHeaders(),\n };\n\n // Only set User-Agent in Node.js environments (not in browsers)\n if (typeof window === 'undefined') {\n headers['User-Agent'] = `NDEx-JS-Client/${version}`;\n }\n\n this.axiosInstance = axios.create({\n baseURL: this.config.baseURL,\n timeout: this.config.timeout,\n headers,\n });\n\n this.setupInterceptors();\n }\n\n /**\n * Get authentication headers based on config.auth\n */\n private getAuthHeaders(): Record<string, string> {\n if (!this.config.auth) {\n return {};\n }\n\n if (this.config.auth.type === 'basic') {\n // Basic authentication: encode username:password in base64\n const credentials = btoa(`${this.config.auth.username}:${this.config.auth.password}`);\n return {\n 'Authorization': `Basic ${credentials}`,\n };\n } else if (this.config.auth.type === 'oauth') {\n // OAuth Bearer token\n return {\n 'Authorization': `Bearer ${this.config.auth.idToken}`,\n };\n }\n\n return {};\n }\n\n /**\n * Build API endpoint URL with version routing\n */\n private buildUrl(endpoint: string, version: 'v2' | 'v3' = 'v2'): string {\n const cleanEndpoint = endpoint.startsWith('/') ? endpoint.slice(1) : endpoint;\n return `/${version}/${cleanEndpoint}`;\n }\n\n /**\n * Generic GET request with intelligent version routing\n */\n async get<T = any>(\n endpoint: string,\n config?: AxiosRequestConfig & { version?: 'v2' | 'v3' }\n ): Promise<T> {\n const { version, ...axiosConfig } = config || {};\n const url = this.buildUrl(endpoint, version);\n\n try {\n const response = await this.axiosInstance.get<APIResponse<T>>(url, axiosConfig);\n return this.handleResponse<T>(response);\n } catch (error) {\n this.handleError(error);\n }\n }\n\n /**\n * Generic POST request with intelligent version routing\n */\n async post<T = any>(\n endpoint: string,\n data?: any,\n config?: AxiosRequestConfig & { version?: 'v2' | 'v3' }\n ): Promise<T> {\n const { version, ...axiosConfig } = config || {};\n const url = this.buildUrl(endpoint, version);\n\n try {\n const response = await this.axiosInstance.post<APIResponse<T>>(url, data, axiosConfig);\n return this.handleResponse<T>(response);\n } catch (error) {\n this.handleError(error);\n }\n }\n\n /**\n * Generic PUT request with intelligent version routing\n */\n async put<T = any>(\n endpoint: string,\n data?: any,\n config?: AxiosRequestConfig & { version?: 'v2' | 'v3' }\n ): Promise<T> {\n const { version, ...axiosConfig } = config || {};\n const url = this.buildUrl(endpoint, version);\n\n try {\n const response = await this.axiosInstance.put<APIResponse<T>>(url, data, axiosConfig);\n return this.handleResponse<T>(response);\n } catch (error) {\n this.handleError(error);\n }\n }\n\n /**\n * Generic DELETE request with intelligent version routing\n */\n async delete<T = any>(\n endpoint: string,\n config?: AxiosRequestConfig & { version?: 'v2' | 'v3' }\n ): Promise<T> {\n const { version, ...axiosConfig } = config || {};\n const url = this.buildUrl(endpoint, version);\n\n try {\n const response = await this.axiosInstance.delete<APIResponse<T>>(url, axiosConfig);\n return this.handleResponse<T>(response);\n } catch (error) {\n this.handleError(error);\n }\n }\n\n\n /*\n * Upload a file to the NDEx API with progress tracking support\n * \n * This method handles file uploads using multipart/form-data encoding and supports\n * various input types for maximum flexibility across different environments.\n * \n * @template T - The expected response type from the API\n * @param endpoint - API endpoint path (e.g., 'networks' for network upload)\n * @param file - File data to upload. Supports multiple input types:\n * - `File` (browser): HTML5 File object from file input or drag-and-drop\n * - `Blob` (browser): Binary data as Blob object\n * - `Buffer` (Node.js): Binary data as Buffer for server-side uploads\n * - `string`: Text content that will be converted to Blob (useful for CX/CX2 JSON)\n * @param options - Upload configuration options\n *\n * @param options.contentType - MIME type for string content (default: 'application/json')\n * @param options.onProgress - Progress callback that receives percentage (0-100)\n * Called periodically during upload with current progress\n * @param options.version - API version to use ('v2' or 'v3', defaults to 'v2')\n * \n * @returns Promise resolving to upload result\n * \n * @example\n * ```typescript\n * // Upload a File object from file input (browser)\n * const fileInput = document.getElementById('file') as HTMLInputElement;\n * const file = fileInput.files[0];\n * const result = await httpService.uploadFile('networks', file, {\n * filename: 'my-network.cx2',\n * onProgress: (progress) => console.log(`Upload: ${progress}%`),\n * version: 'v3'\n * });\n * \n * // Upload CX2 network data as string\n * const cx2Data = JSON.stringify({ CXVersion: '2.0', networks: [...] });\n * const result = await httpService.uploadFile('networks', cx2Data, {\n * filename: 'network.cx2',\n * contentType: 'application/json',\n * version: 'v3'\n * });\n * \n * // Upload with progress tracking\n * const result = await httpService.uploadFile('networks', file, {\n * onProgress: (progress) => {\n * progressBar.style.width = `${progress}%`;\n * console.log(`Uploading: ${progress}%`);\n * }\n * });\n * ```\n * \n * @throws Will throw NDExError on network errors,\n * server errors, or invalid file data\n * \n * @note The Content-Type header is automatically set to 'multipart/form-data'\n * and Axios will handle the boundary parameter automatically\n */\n async uploadFile<T = any>(\n endpoint: string,\n file: File | Blob | Buffer | string,\n options: {\n contentType?: string;\n onProgress?: (progress: number) => void;\n version?: 'v2' | 'v3';\n } = {}\n ): Promise<T> {\n const { version, onProgress, contentType, ...config } = options;\n const url = this.buildUrl(endpoint, version);\n\n const formData = new FormData();\n \n if (file instanceof File) {\n formData.append('file', file, file.name);\n } else if (file instanceof Blob) {\n formData.append('file', file, 'file.cx2');\n } else if (typeof file === 'string') {\n const blob = new Blob([file], { type: contentType || 'application/json' });\n formData.append('file', blob,'file.cx2');\n } else {\n // Buffer (Node.js environment)\n formData.append('file', file as any, 'file.cx2');\n }\n\n try {\n const response = await this.axiosInstance.post<APIResponse<T>>(url, formData, {\n headers: {\n 'Content-Type': 'multipart/form-data',\n },\n onUploadProgress: onProgress ? (progressEvent) => {\n const progress = Math.round((progressEvent.loaded * 100) / (progressEvent.total || 1));\n onProgress(progress);\n } : undefined,\n ...config,\n });\n\n return this.handleResponse<T>(response);\n } catch (error) {\n this.handleError(error);\n }\n }\n\n /**\n * Setup axios interceptors for debugging and retry logic\n */\n private setupInterceptors(): void {\n // Request interceptor for debugging\n this.axiosInstance.interceptors.request.use(\n (config) => {\n if (this.config.debug) {\n console.log('NDEx API Request:', {\n method: config.method?.toUpperCase(),\n url: config.url,\n headers: config.headers,\n });\n }\n return config;\n },\n (error) => {\n if (this.config.debug) {\n console.error('NDEx API Request Error:', error);\n }\n return Promise.reject(error);\n }\n );\n\n // Response interceptor for debugging\n this.axiosInstance.interceptors.response.use(\n (response) => {\n if (this.config.debug) {\n console.log('NDEx API Response:', {\n status: response.status,\n url: response.config.url,\n data: response.data,\n });\n }\n return response;\n },\n (error) => {\n if (this.config.debug) {\n console.error('NDEx API Response Error:', error.response?.data || error.message);\n }\n return Promise.reject(error);\n }\n );\n }\n\n /**\n * Handle successful API responses\n */\n private handleResponse<T>(response: AxiosResponse<any>): T {\n // Handle different response formats from NDEx API\n if (response.data && typeof response.data === 'object') {\n if ('errorCode' in response.data) {\n // NDEx error format - throw appropriate error\n this.throwNDExError(\n response.data.message || 'Unknown error occurred',\n response.status,\n response.data.errorCode || 'UNKNOWN_ERROR',\n response.data.description\n );\n }\n }\n\n // Handle wrapped vs direct responses\n const data = response.data && typeof response.data === 'object' && 'data' in response.data \n ? response.data.data \n : response.data;\n\n return data as T;\n }\n\n /**\n * Handle API errors by throwing appropriate NDEx error types\n */\n private handleError(error: any): never {\n if (error.response) {\n // Server responded with error status\n const message = error.response.data?.message || error.message;\n const errorCode = error.response.data?.errorCode || `HTTP_${error.response.status}`;\n const description = error.response.data?.description;\n \n this.throwNDExError(message, error.response.status, errorCode, description);\n } else if (error.request) {\n // Request made but no response received\n throw new NDExNetworkError('Network error - no response received', error);\n } else {\n // Something else happened\n throw new NDExError(error.message || 'Unknown error occurred', undefined, 'CLIENT_ERROR', error.toString());\n }\n }\n\n /**\n * Throw appropriate NDEx error based on status code\n */\n private throwNDExError(message: string, statusCode: number, errorCode: string, description?: string): never {\n switch (statusCode) {\n case 400:\n throw new NDExValidationError(message, statusCode);\n case 401:\n case 403:\n throw new NDExAuthError(message, statusCode);\n case 404:\n throw new NDExNotFoundError(message, statusCode);\n case 500:\n case 502:\n case 503:\n case 504:\n throw new NDExServerError(message, statusCode);\n default:\n throw new NDExError(message, statusCode, errorCode, description);\n }\n }\n\n /**\n * Update client configuration\n */\n updateConfig(newConfig: Partial<NDExClientConfig>): void {\n this.config = { ...this.config, ...newConfig };\n \n if (newConfig.baseURL) {\n this.axiosInstance.defaults.baseURL = newConfig.baseURL;\n }\n \n if (newConfig.timeout) {\n this.axiosInstance.defaults.timeout = newConfig.timeout;\n }\n\n if (newConfig.headers) {\n Object.assign(this.axiosInstance.defaults.headers, newConfig.headers);\n }\n\n // Update auth headers if auth config changed\n if ('auth' in newConfig) {\n const authHeaders = this.getAuthHeaders();\n \n // Clear existing authorization header first\n delete this.axiosInstance.defaults.headers.common['Authorization'];\n \n // Set new auth headers\n Object.assign(this.axiosInstance.defaults.headers.common, authHeaders);\n }\n }\n\n /**\n * Get current configuration\n */\n getConfig(): NDExClientConfig {\n return { ...this.config };\n }\n\n /**\n * Get current authentication type\n * @returns The type of authentication configured ('basic' | 'oauth'), or undefined if no auth is configured\n */\n getAuthType(): 'basic' | 'oauth' | undefined {\n return this.config.auth?.type;\n }\n\n /**\n * Get ID token from OAuth authentication\n * @returns The ID token if OAuth auth is configured, undefined otherwise\n */\n getIdToken(): string | undefined {\n return this.config.auth?.type === 'oauth' ? this.config.auth.idToken : undefined;\n }\n\n /**\n * Set ID token for OAuth authentication\n * Creates OAuth auth configuration if no auth is currently configured\n * @param idToken - The ID token to set\n */\n setIdToken(idToken: string): void {\n this.updateConfig({\n auth: { type: 'oauth', idToken }\n });\n }\n}\n","/**\n * NDEx Client Library - Modern TypeScript Implementation\n * \n * A comprehensive, modern TypeScript client for the NDEx (Network Data Exchange) API.\n * Supports both v2 and v3 APIs with intelligent version routing, native CX2 format support,\n * and provides a clean, type-safe interface for network operations.\n */\n\n// Core Types\nexport * from './types';\n\n// Models\nexport { CX2Network } from './models/CX2Network';\n\n// Core Services\nexport { NetworkServiceV2 } from './services/NetworkServiceV2';\nexport { NetworkServiceV3 } from './services/NetworkServiceV3';\nexport { UnifiedNetworkService } from './services/UnifiedNetworkService';\nexport { FilesService } from './services/FilesService';\nexport { WorkspaceService } from './services/WorkspaceService';\nexport { UserService } from './services/UserService';\nexport { AdminService } from './services/AdminService';\nexport { CyNDExService } from './services/CyNDExService';\n\n// Backward compatibility alias\nexport { CyNDExService as CyNDEx } from './services/CyNDExService';\n\n// Legacy compatibility exports - temporarily commented out for test setup\n// TODO: Fix ES module compatibility for NDEx.js and CyNDEx.js\n// export { default as NDEx } from './NDEx.js';\n// export { default as CyNDEx } from './CyNDEx.js';\n\n// Main Client Class\nimport { HTTPService } from './services/HTTPService';\nimport { UnifiedNetworkService } from './services/UnifiedNetworkService';\nimport { FilesService } from './services/FilesService';\nimport { WorkspaceService } from './services/WorkspaceService';\nimport { UserService } from './services/UserService';\nimport { AdminService } from './services/AdminService';\nimport { NDExClientConfig, BasicAuth, OAuthAuth } from './types';\n\n/**\n * NDExClient - Main client class for NDEx API operations\n * \n * Provides a unified interface for all NDEx operations with intelligent\n * version routing between v2 and v3 APIs.\n * \n * @example\n * ```typescript\n * // Basic usage\n * const client = new NDExClient({\n * baseURL: 'https://www.ndexbio.org',\n * debug: true\n * });\n * \n * // Authenticate\n * await client.user.authenticate({ username: 'user', password: 'pass' });\n * \n * // Search networks\n * const results = await client.networks.searchNetworks({ searchString: 'pathway' });\n * \n * // Get network as CX2\n * const network = await client.networks.getNetworkAsCX2Object('network-uuid');\n * \n * // User operations\n * const profile = await client.user.getCurrentUser();\n * \n * // Admin operations (requires admin privileges)\n * const stats = await client.admin.getSystemStats();\n * ```\n */\nexport class NDExClient {\n private httpService: HTTPService;\n \n /** Network operations with intelligent v2/v3 routing */\n public readonly networks: UnifiedNetworkService;\n \n /** File upload/download and task management */\n public readonly files: FilesService;\n \n /** Workspace operations (deprecated - most functionality moved to other services) */\n public readonly workspace: WorkspaceService;\n \n /** User authentication and management */\n public readonly user: UserService;\n \n /** System administration operations */\n public readonly admin: AdminService;\n\n constructor(config: NDExClientConfig = {}) {\n this.httpService = new HTTPService(config);\n this.networks = new UnifiedNetworkService(this.httpService);\n this.files = new FilesService(this.httpService);\n this.workspace = new WorkspaceService(this.httpService);\n this.user = new UserService(this.httpService);\n this.admin = new AdminService(this.httpService);\n }\n\n\n /**\n * Clear authentication\n */\n logout(): void {\n this.httpService.updateConfig({ auth: undefined });\n }\n\n /**\n * Get server status information\n * Can be called by authenticated or anonymous users.\n * @param format - Optional format parameter. Use 'full' for detailed information including properties and importers/exporters\n * @returns Server status including network/user counts and optional server details\n */\n async getServerStatus(format?: 'full'): Promise<{\n message: string;\n properties?: {\n ServerVersion: string;\n Build: string;\n ServerResultLimit: string;\n ImporterExporters: Array<{\n importer: boolean;\n exporter: boolean;\n fileExtension: string;\n name: string;\n description: string;\n }>;\n };\n networkCount: number;\n userCount: number;\n groupCount?: number;\n }> {\n const params = new URLSearchParams();\n if (format) {\n params.append('format', format);\n }\n\n const endpoint = `admin/status${params.toString() ? `?${params.toString()}` : ''}`;\n return this.httpService.get(endpoint);\n }\n\n /**\n * Check if client has valid authentication information configured\n * @returns true if auth is a valid BasicAuth or OAuthAuth object, false otherwise\n */\n hasAuthInfo(): boolean {\n const auth = this.httpService.getConfig().auth;\n if (!auth) return false;\n \n // Check for BasicAuth structure\n if (auth.type === 'basic') {\n return !!(auth as BasicAuth).username && !!(auth as BasicAuth).password;\n }\n \n // Check for OAuthAuth structure \n if (auth.type === 'oauth') {\n return !!(auth as OAuthAuth).idToken;\n }\n \n return false;\n }\n\n /**\n * Update client configuration\n */\n updateConfig(config: Partial<NDExClientConfig>): void {\n this.httpService.updateConfig(config);\n }\n\n /**\n * Get current client configuration\n */\n getConfig(): NDExClientConfig {\n return this.httpService.getConfig();\n }\n\n\n /**\n * Access to low-level HTTP service for advanced usage\n */\n get http(): HTTPService {\n return this.httpService;\n }\n\n /**\n * Access to version-specific network services for advanced usage\n */\n get v2() {\n return {\n networks: this.networks.v2,\n };\n }\n\n get v3() {\n return {\n networks: this.networks.v3,\n };\n }\n\n}\n\n// Main export - New modern client (named export for better tree-shaking)\n// Users should import as: import { NDExClient } from '@js4cytoscape/ndex-client'\n\n// Version information - imported from package.json to ensure consistency\nimport { version as packageVersion } from '../package.json';\n\n/**\n * Library version string imported from package.json\n * \n * Provides programmatic access to the current library version for:\n * - Runtime version checking and validation\n * - Debugging and error reporting\n * - Logging and telemetry\n * - Version-dependent feature detection\n * \n * @example\n * ```typescript\n * import { NDExClient, version } from '@js4cytoscape/ndex-client';\n * \n * console.log(`Using NDEx Client v${version}`);\n * \n * // In error reports\n * const errorReport = {\n * error: err.message,\n * libraryVersion: version,\n * timestamp: new Date().toISOString()\n * };\n * ```\n */\nexport const version = packageVersion;\n\n"]}
|