From c42d79b8b3c3af8c394b321aaf6275683854639b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rcio=20Barbosa?= <52362496+barbmarcio@users.noreply.github.com> Date: Thu, 5 Sep 2024 15:19:19 +0100 Subject: [PATCH] chore(deps): @topsort/sdk v0.3.1 This PR bumps the version of `@topsort/sdk` from 0.2.0 to 0.3.1 | File | Before (gzip) | After (gzip) | |:-------|:-------|:-------| | dist/ts.mjs | 10.77 kB (3.76 kB) | 11.15 kB (3.91 kB) | | dist/ts.js | 7.93 kB (3.33 kB) | 8.17 kB (3.46 kB) | The difference comes from: - Now the [TopsortClient](https://github.com/Topsort/topsort.js/blob/main/src/functions/topsort-client.ts#L8) class handles the function calls after receiving the config; - The APIClient now handles the [URL sanitization](https://github.com/Topsort/topsort.js/blob/main/src/lib/api-client.ts#L57); - We have improved the [error handling and response](https://github.com/Topsort/topsort.js/blob/main/src/lib/api-client.ts#L10), as most of our calls return status code 204 (No Content). Therefore, we wouldn't need to parse any response. Please feel free to check the diff [here](https://gist.github.com/barbmarcio/0af1f85b634522f0168cea6ad7f472bd) as well --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- src/detector.ts | 6 ++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index e58a1b5..d9ee341 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,6 @@ "vitest": "^2.0.5" }, "dependencies": { - "@topsort/sdk": "^0.2.0" + "@topsort/sdk": "^0.3.1" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index de0ab15..82e129f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: '@topsort/sdk': - specifier: ^0.2.0 - version: 0.2.0 + specifier: ^0.3.1 + version: 0.3.1 devDependencies: '@biomejs/biome': specifier: ^1.8.3 @@ -536,8 +536,8 @@ packages: '@rushstack/ts-command-line@4.19.1': resolution: {integrity: sha512-J7H768dgcpG60d7skZ5uSSwyCZs/S2HrWP1Ds8d1qYAyaaeJmpmmLr9BVw97RjFzmQPOYnoXcKA4GkqDCkduQg==} - '@topsort/sdk@0.2.0': - resolution: {integrity: sha512-NaiwGmoFWyawgjJJmM1pWqyBWy9tonOsYIz1jxQOqsT6mMOzAmqNj/cxuakcLY0R9txND/Hl1AersltprNoyAA==} + '@topsort/sdk@0.3.1': + resolution: {integrity: sha512-rXL2QlNtX+W6cwR/GGTsLCGpPyBWAltYaStMVMrTCVKnr90HmWc7bhDv6rZjf0A0OwCDLC2jNkagBDvk9N0hoQ==} '@types/argparse@1.0.38': resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==} @@ -2487,7 +2487,7 @@ snapshots: transitivePeerDependencies: - '@types/node' - '@topsort/sdk@0.2.0': {} + '@topsort/sdk@0.3.1': {} '@types/argparse@1.0.38': {} diff --git a/src/detector.ts b/src/detector.ts index 30a86ac..d525d4b 100644 --- a/src/detector.ts +++ b/src/detector.ts @@ -1,4 +1,4 @@ -import { type Config, Entity, TopsortEvent, reportEvent } from "@topsort/sdk"; +import { type Config, Entity, TopsortClient, Event as TopsortEvent } from "@topsort/sdk"; import { version } from "../package.json"; import { ProcessorResult, Queue } from "./queue"; import { truncateSet } from "./set"; @@ -138,9 +138,11 @@ async function processor(data: ProductEvent[]): Promise { host: window.TS.url, userAgent: `ts.js/${version}`, }; + const topsortClient = new TopsortClient(config); for (const entry of data) { promises.push( - reportEvent(config, getApiPayload(entry)) + topsortClient + .reportEvent(getApiPayload(entry)) .then((result) => { const q = result.retry ? r.retry : r.done; q.add(entry.id);