Skip to content

Commit e92d1f7

Browse files
authored
Merge pull request #97 from multinet-app/workspace-fork
Workspace Fork
2 parents d87f795 + e690549 commit e92d1f7

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

.github/workflows/main.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,19 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Check out the repository
19-
uses: actions/checkout@master
19+
uses: actions/checkout@v3
2020
with:
2121
fetch-depth: 0
2222

2323
- name: Set up Node environment
24-
uses: actions/setup-node@v1
24+
uses: actions/setup-node@v3
2525
with:
26-
node-version: '10.x'
26+
node-version: lts/*
27+
cache: 'yarn'
2728

28-
- name: Restore node_modules cache
29-
uses: actions/cache@v1
30-
id: multinetjs-cache
31-
with:
32-
path: /home/runner/work/multinetjs/multinetjs/node_modules
33-
key: ${{ runner.os }}-${{ hashFiles('/home/runner/work/multinetjs/multinetjs/yarn.lock') }}-multinetjs-cache
3429

3530
- name: Install yarn packages
36-
if: steps.multinetjs-cache.outputs.cache-hit != 'true'
37-
run: yarn install
31+
run: yarn install --immutable
3832

3933
- name: Run linting test
4034
run: yarn lint

src/axios.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export interface MultinetAxiosInstance extends AxiosInstance {
5858
networkTables(workspace: string, network: string, type: TableType): AxiosPromise<Table[]>;
5959
createWorkspace(workspace: string): AxiosPromise<string>;
6060
deleteWorkspace(workspace: string): AxiosPromise<string>;
61+
forkWorkspace(workspace: string): AxiosPromise<Workspace>;
6162
renameWorkspace(workspace: string, name: string): AxiosPromise<Workspace>;
6263
uploadTable(workspace: string, table: string, options: TableUploadOptionsSpec, config?: AxiosRequestConfig): AxiosPromise<Array<{}>>;
6364
deleteTable(workspace: string, table: string): AxiosPromise<string>;
@@ -165,6 +166,10 @@ export function multinetAxiosInstance(config: AxiosRequestConfig): MultinetAxios
165166
});
166167
};
167168

169+
Proto.forkWorkspace = function(workspace: string): AxiosPromise<Workspace> {
170+
return this.post(`workspaces/${workspace}/fork/`);
171+
};
172+
168173
Proto.uploadTable = async function(workspace: string, table: string, options: TableUploadOptionsSpec): Promise<AxiosResponse<Array<{}>>> {
169174
const { data, edgeTable, columnTypes, fileType, delimiter, quoteChar } = options;
170175
const s3ffClient = new S3FileFieldClient({

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ class MultinetAPI {
224224
return (await this.axios.deleteWorkspace(workspace)).data;
225225
}
226226

227+
public async forkWorkspace(workspace: string): Promise<Workspace> {
228+
return (await this.axios.forkWorkspace(workspace)).data;
229+
}
230+
227231
public async renameWorkspace(workspace: string, name: string): Promise<Workspace> {
228232
return (await this.axios.renameWorkspace(workspace, name)).data;
229233
}

0 commit comments

Comments
 (0)