@neuralforge/model-hub 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +20 -0
- package/src/auth.ts +7 -0
- package/src/cache.ts +8 -0
- package/src/client.ts +22 -0
- package/src/download.ts +6 -0
- package/src/index.ts +7 -0
- package/src/upload.ts +6 -0
- package/tests/client.test.ts +13 -0
- package/tsconfig.json +7 -0
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@neuralforge/model-hub",
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "Model hub SDK",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"test": "vitest",
|
|
10
|
+
"lint": "eslint src/"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"typescript": "^5.4.0",
|
|
14
|
+
"node-fetch": "^3.3.0"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"vitest": "^1.6.0",
|
|
18
|
+
"eslint": "^8.57.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/auth.ts
ADDED
package/src/cache.ts
ADDED
package/src/client.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hub API client
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export interface HubConfig {
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
token?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class HubClient {
|
|
11
|
+
private config: HubConfig;
|
|
12
|
+
|
|
13
|
+
constructor(config: HubConfig) {
|
|
14
|
+
this.config = config;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async listModels(query?: string): Promise<string[]> { return []; }
|
|
18
|
+
async getModel(id: string): Promise<any> { return null; }
|
|
19
|
+
async downloadModel(id: string, outDir: string): Promise<string> { return outDir; }
|
|
20
|
+
async uploadModel(path: string, repoId: string): Promise<void> {}
|
|
21
|
+
}
|
|
22
|
+
|
package/src/download.ts
ADDED
package/src/index.ts
ADDED
package/src/upload.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { HubClient } from '../src';
|
|
3
|
+
|
|
4
|
+
describe('HubClient', () => {
|
|
5
|
+
it('should be defined', () => {
|
|
6
|
+
expect(HubClient).toBeDefined();
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('should initialize correctly', () => {
|
|
10
|
+
const instance = new HubClient();
|
|
11
|
+
expect(instance).toBeInstanceOf(HubClient);
|
|
12
|
+
});
|
|
13
|
+
});
|