diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3b4eb42..48472ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,25 +16,19 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repository - uses: actions/checkout@master + uses: actions/checkout@v3 with: fetch-depth: 0 - name: Set up Node environment - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: - node-version: '10.x' + node-version: lts/* + cache: 'yarn' - - name: Restore node_modules cache - uses: actions/cache@v1 - id: multinetjs-cache - with: - path: /home/runner/work/multinetjs/multinetjs/node_modules - key: ${{ runner.os }}-${{ hashFiles('/home/runner/work/multinetjs/multinetjs/yarn.lock') }}-multinetjs-cache - name: Install yarn packages - if: steps.multinetjs-cache.outputs.cache-hit != 'true' - run: yarn install + run: yarn install --immutable - name: Run linting test run: yarn lint diff --git a/src/axios.ts b/src/axios.ts index 1e00a5e..207e995 100644 --- a/src/axios.ts +++ b/src/axios.ts @@ -58,6 +58,7 @@ export interface MultinetAxiosInstance extends AxiosInstance { networkTables(workspace: string, network: string, type: TableType): AxiosPromise; createWorkspace(workspace: string): AxiosPromise; deleteWorkspace(workspace: string): AxiosPromise; + forkWorkspace(workspace: string): AxiosPromise; renameWorkspace(workspace: string, name: string): AxiosPromise; uploadTable(workspace: string, table: string, options: TableUploadOptionsSpec, config?: AxiosRequestConfig): AxiosPromise>; deleteTable(workspace: string, table: string): AxiosPromise; @@ -165,6 +166,10 @@ export function multinetAxiosInstance(config: AxiosRequestConfig): MultinetAxios }); }; + Proto.forkWorkspace = function(workspace: string): AxiosPromise { + return this.post(`workspaces/${workspace}/fork/`); + }; + Proto.uploadTable = async function(workspace: string, table: string, options: TableUploadOptionsSpec): Promise>> { const { data, edgeTable, columnTypes, fileType, delimiter, quoteChar } = options; const s3ffClient = new S3FileFieldClient({ diff --git a/src/index.ts b/src/index.ts index c5b5ed4..157bbc9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -224,6 +224,10 @@ class MultinetAPI { return (await this.axios.deleteWorkspace(workspace)).data; } + public async forkWorkspace(workspace: string): Promise { + return (await this.axios.forkWorkspace(workspace)).data; + } + public async renameWorkspace(workspace: string, name: string): Promise { return (await this.axios.renameWorkspace(workspace, name)).data; }