From 967645480f3d34d217e952b77f7c93629fe71e63 Mon Sep 17 00:00:00 2001 From: Steve Worley Date: Fri, 14 Nov 2025 13:28:25 +1000 Subject: [PATCH 1/3] chore: Update quant-ts-client to 4.3.0 --- package-lock.json | 8 ++++---- package.json | 2 +- src/utils/api.ts | 44 +++++++++----------------------------------- 3 files changed, 14 insertions(+), 40 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9fe3ac2..ddd3e73 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.3.0", "license": "MIT", "dependencies": { - "@quantcdn/quant-client": "^4.0.0", + "@quantcdn/quant-client": "^4.3.0", "axios": "^1.6.0", "chalk": "^5.3.0", "commander": "^11.1.0", @@ -1678,9 +1678,9 @@ } }, "node_modules/@quantcdn/quant-client": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@quantcdn/quant-client/-/quant-client-4.0.0.tgz", - "integrity": "sha512-rWaZbz7c63QzYkzOzQLGB3gtBeJe/mrF0Gbhf4r6C1OBNLPhDppiQw3LQ25rFXsvdf/JFTUUgM3M54vAKzm80Q==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@quantcdn/quant-client/-/quant-client-4.3.0.tgz", + "integrity": "sha512-czSXbL7koO4q/w/7ILnSqauVd4MU7hSXhFzd5HYgHx5riH6NdJftfU1vta/CcKgSeG+P3ixdg0hsba1ULeVKCg==", "license": "MIT", "dependencies": { "axios": "^1.6.1" diff --git a/package.json b/package.json index 1d08296..fe5b7a3 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "url": "https://github.com/quantcdn/quant-cloud-cli/issues" }, "dependencies": { - "@quantcdn/quant-client": "^4.0.0", + "@quantcdn/quant-client": "^4.3.0", "axios": "^1.6.0", "chalk": "^5.3.0", "commander": "^11.1.0", diff --git a/src/utils/api.ts b/src/utils/api.ts index c3a88fe..d788975 100644 --- a/src/utils/api.ts +++ b/src/utils/api.ts @@ -275,42 +275,16 @@ export class ApiClient { } try { - // NOTE: Using direct fetch() call as workaround - // The crawlersRun method is available in quant-ts-client commit fba13989a1f84e87fc16b431f77bb4d83b5970fa - // but that commit has build issues preventing npm install. - // Once the SDK is properly published with the crawlersRun method, replace this with: - // const response = await this.crawlersApi.crawlersRun(organizationId, projectName, crawlerId, payload); - const payload = urls ? { urls } : {}; - const response = await fetch( - `${this.baseUrl}/api/v2/organizations/${organizationId}/projects/${projectName}/crawlers/${crawlerId}/run`, - { - method: 'POST', - headers: { - 'Authorization': `Bearer ${this.token}`, - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }, - body: JSON.stringify(payload) - } - ); - - if (!response.ok) { - if (response.status === 404) { - throw new Error(`Crawler '${crawlerId}' not found in project '${projectName}'.`); - } else if (response.status === 403) { - throw new Error(`Access denied to run crawler '${crawlerId}'.`); - } else if (response.status === 401) { - throw new Error('Authentication expired. Please run `qc login` to re-authenticate.'); - } else { - const errorText = await response.text(); - throw new Error(`Failed to run crawler: ${response.status} ${errorText}`); - } - } - - return await response.json(); + const payload = urls && urls.length > 0 ? { urls } : {}; + const response = await this.crawlersApi.crawlersRun(organizationId, projectName, crawlerId, payload); + return response.data; } catch (error: any) { - if (error.message?.includes('Crawler') || error.message?.includes('Authentication')) { - throw error; // Re-throw our friendly errors + if (error.statusCode === 404 || error.response?.status === 404) { + throw new Error(`Crawler '${crawlerId}' not found in project '${projectName}'.`); + } else if (error.statusCode === 403 || error.response?.status === 403) { + throw new Error(`Access denied to run crawler '${crawlerId}'.`); + } else if (error.statusCode === 401 || error.response?.status === 401) { + throw new Error('Authentication expired. Please run `qc login` to re-authenticate.'); } else { throw new Error(`Failed to run crawler: ${error.message || 'Network error'}`); } From 6eb8f1df766908546b1fde6f4b4b8dd2504de0ad Mon Sep 17 00:00:00 2001 From: Steve Worley Date: Fri, 14 Nov 2025 13:37:14 +1000 Subject: [PATCH 2/3] Update docker image. --- docker-compose.test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.test.yml b/docker-compose.test.yml index fd6dc0d..6f27cf3 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -1,7 +1,7 @@ services: quant-mock-api: - image: ghcr.io/quantcdn/quant-mock-api:4.0.0 + image: ghcr.io/quantcdn/quant-mock-api:4.3.0 container_name: quant-mock-api-test ports: - "4010:4010" From 6bb17fac3c21d2eff96a59c284bf5a4bb129628d Mon Sep 17 00:00:00 2001 From: Steve Worley Date: Fri, 14 Nov 2025 13:39:48 +1000 Subject: [PATCH 3/3] chore: bump docker image version. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d2fda7b..593e218 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,7 +39,7 @@ jobs: services: mock-api: - image: ghcr.io/quantcdn/quant-mock-api:4.0.0 + image: ghcr.io/quantcdn/quant-mock-api:4.3.0 ports: - 4010:4010 options: >-