Skip to content

Commit

Permalink
fix: remove types for compatibility with lower versions
Browse files Browse the repository at this point in the history
  • Loading branch information
barbmarcio committed Aug 5, 2024
1 parent c668a89 commit d7d09f4
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 17 deletions.
13 changes: 9 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ The format is loosely based on [Keep a Changelog](https://keepachangelog.com/en/
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
We follow the format used by [Open Telemetry](https://github.com/open-telemetry/opentelemetry-python/blob/main/CHANGELOG.md).

## Version 0.2.1 (2024-08-05)

- Add support for Typescript with lower versions ([#37](https://github.com/Topsort/topsort.js/pull/37))
- Add support for optional timeout on Config ([#11](https://github.com/Topsort/topsort.js/pull/11))

## Version 0.2.0 (2024-07-29)

- Adding `userAgent: string` as part of Config for requests ([#21](https://github.com/Topsort/topsort.js/pull/21))
- Adding `retry: boolean` as part of `reportEvent` response ([#20](https://github.com/Topsort/topsort.js/pull/20))
- Add `userAgent: string` as part of Config for requests ([#21](https://github.com/Topsort/topsort.js/pull/21))
- Add `retry: boolean` as part of `reportEvent` response ([#20](https://github.com/Topsort/topsort.js/pull/20))

## Version 0.1.0 (2024-07-19)

### Added

- Initial release of the SDK ([#1](https://github.com/Topsort/topsort.js/pull/1))
- Pulling `reportEvent` from [Analytics.js](https://github.com/Topsort/analytics.js)
- Added function `createAuction`
- Pull `reportEvent` from [Analytics.js](https://github.com/Topsort/analytics.js)
- Add function `createAuction`

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ yarn add @topsort/sdk --save
To create an auction, use the `createAuction` function. Example:

```js
import { type TopsortAuction, createAuction } from "@topsort/sdk";
import { TopsortAuction, createAuction } from "@topsort/sdk";

const auctionDetails: TopsortAuction = {
auctions: [
Expand Down Expand Up @@ -121,7 +121,7 @@ createAuction(config, auctionDetails)
To report an event, use the reportEvent function. Here is an example:

```js
import { type TopsortEvent, reportEvent } from "@topsort/sdk";
import { TopsortEvent, reportEvent } from "@topsort/sdk";

const event: TopsortEvent = {
impressions: [
Expand Down
7 changes: 6 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
"lineWidth": 100
},
"linter": {
"enabled": true
"enabled": true,
"rules": {
"style": {
"useImportType": "off"
}
}
},
"vcs": {
"enabled": true,
Expand Down
4 changes: 2 additions & 2 deletions src/functions/auctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { apis, baseURL } from "../constants/apis.constant";
import APIClient from "../lib/api-client";
import AppError from "../lib/app-error";
import { withValidation } from "../lib/with-validation";
import type { AuctionResult, TopsortAuction } from "../types/auctions";
import type { Config } from "../types/shared";
import { AuctionResult, TopsortAuction } from "../types/auctions";
import { Config } from "../types/shared";

async function handler(config: Config, body: TopsortAuction): Promise<AuctionResult> {
let url: URL;
Expand Down
4 changes: 2 additions & 2 deletions src/functions/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { apis, baseURL } from "../constants/apis.constant";
import APIClient from "../lib/api-client";
import AppError from "../lib/app-error";
import { withValidation } from "../lib/with-validation";
import type { EventResult, TopsortEvent } from "../types/events";
import type { Config } from "../types/shared";
import { EventResult, TopsortEvent } from "../types/events";
import { Config } from "../types/shared";

/**
* Reports an event to the Topsort API.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/api-client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { version } from "../../package.json";
import { baseURL } from "../constants/apis.constant";
import type { Config } from "../types/shared";
import { Config } from "../types/shared";
import AppError from "./app-error";

class APIClient {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/validate-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Config } from "../types/shared";
import { Config } from "../types/shared";
import AppError from "./app-error";

export function validateConfig(config: Config): void {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/with-validation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Config } from "../types/shared";
import { Config } from "../types/shared";
import { validateConfig } from "./validate-config";

export function withValidation<T extends Config, U, Args extends unknown[]>(
Expand Down
2 changes: 1 addition & 1 deletion test/auctions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
returnStatus,
} from "../src/constants/handlers.constant";
import AppError from "../src/lib/app-error";
import type { TopsortAuction } from "../src/types/auctions";
import { TopsortAuction } from "../src/types/auctions";

describe("createAuction", () => {
beforeAll(() => mswServer.listen());
Expand Down
2 changes: 1 addition & 1 deletion test/events.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { afterEach, beforeAll, describe, expect, it } from "bun:test";
import { type TopsortEvent, reportEvent } from "../src";
import { TopsortEvent, reportEvent } from "../src";
import { apis, baseURL } from "../src/constants/apis.constant";
import { mswServer, returnError, returnStatus } from "../src/constants/handlers.constant";
import AppError from "../src/lib/app-error";
Expand Down
2 changes: 1 addition & 1 deletion test/validate-config.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from "bun:test";
import AppError from "../src/lib/app-error";
import { validateConfig } from "../src/lib/validate-config";
import type { Config } from "../src/types/shared";
import { Config } from "../src/types/shared";

describe("validateConfig", () => {
it("should throw an error if apiKey is missing", () => {
Expand Down

0 comments on commit d7d09f4

Please sign in to comment.