diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b5a584..75998c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 2.4.1 + +* fixed entrypoint +* fixed configuration validation + ## 2.4.0 * added new custom metric fields diff --git a/package.json b/package.json index 3d836f0..e2a839a 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "pirsch-sdk", - "version": "2.4.0", - "description": "JavaScript client SDK for Pirsch.", - "main": "index.js", - "types": "index.d.ts", + "version": "2.4.1", + "description": "TypeScript/JavaScript client SDK for Pirsch.", + "main": "dist/index.js", + "types": "dist/index.d.ts", "scripts": { "build": "rm -rf dist && tsc", "watch": "tsc --watch", diff --git a/src/common.ts b/src/common.ts index ef3cbe1..8be5ac7 100644 --- a/src/common.ts +++ b/src/common.ts @@ -8,8 +8,8 @@ import { } from "./constants"; export abstract class PirschCommon { - protected assertOauthCredentials({ clientId, clientSecret }: { clientId: string; clientSecret: string }) { - if (clientId.length !== PIRSCH_CLIENT_ID_LENGTH) { + protected assertOauthCredentials({ clientId, clientSecret }: { clientId?: string; clientSecret: string }) { + if (clientId?.length !== PIRSCH_CLIENT_ID_LENGTH) { throw new Error(`Invalid Client ID, should be of length '${PIRSCH_CLIENT_ID_LENGTH}'!`); } diff --git a/src/core.ts b/src/core.ts index a4ddeb5..b7afe04 100644 --- a/src/core.ts +++ b/src/core.ts @@ -86,7 +86,7 @@ export abstract class PirschCoreClient extends PirschCommon { this.assertAccessTokenCredentials({ accessToken }); this.accessToken = accessToken; this.accessMode = "access-token"; - } else if ("clientId" in configuration && "clientSecret" in configuration) { + } else if ("clientId" in configuration || "clientSecret" in configuration) { const { clientId, clientSecret } = configuration; this.assertOauthCredentials({ clientId, clientSecret }); this.clientId = clientId; diff --git a/src/types.ts b/src/types.ts index b82ed52..d42c2e7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -25,7 +25,7 @@ export interface PirschOAuthClientConfig extends PirschClientConfigBase { /** * The OAuth client ID */ - clientId: string; + clientId?: string; /** * The OAuth client secret */