Skip to content

Commit 0c54bb0

Browse files
author
pipedrive-bot
committed
Build 332 - version-patch
1 parent 36c406f commit 0c54bb0

3 files changed

Lines changed: 8 additions & 60 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ The file format of it is based on [Keep a Changelog](http://keepachangelog.com/e
77
For public Changelog covering all changes done to Pipedrive’s API, webhooks and app extensions platforms, see [public Changelog](https://pipedrive.readme.io/docs/changelog) with discussion area in [Developers Community](https://devcommunity.pipedrive.com/c/documentation/changelog/19).
88

99
## [Unreleased]
10+
### Fixed
11+
- Replaced dynamic imports, so now SSR is supported (ie.: NextJS with Turbopack)
1012

1113
## [33.4.1] - 2026-05-29
1214
### Fixed

src/versions/v1/base.ts

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import type { Configuration } from './configuration';
1818
// @ts-ignore
1919
import type { AxiosError, AxiosResponse, AxiosRequestConfig , InternalAxiosRequestConfig , AxiosInstance } from 'axios';
2020
import axios from 'axios';
21-
import { join, dirname } from 'path';
22-
import { existsSync } from 'fs';
21+
// eslint-disable-next-line @typescript-eslint/no-var-requires
22+
const _pkg = require('../../../package.json') as { version: string };
2323

2424
export const BASE_PATH = "https://api.pipedrive.com/v1".replace(/\/+$/, "");
2525

@@ -44,35 +44,8 @@ export interface RequestArgs {
4444
options: AxiosRequestConfig;
4545
}
4646

47-
const searchForPackageJson = (startPath: string): string | null => {
48-
const filePath = join(startPath, 'package.json');
49-
50-
if (existsSync(filePath)) {
51-
return filePath;
52-
}
53-
54-
const parentDir = dirname(startPath);
55-
56-
// Stop if we've reached the root directory
57-
if (parentDir.endsWith('/pipedrive') || parentDir === startPath) {
58-
return null;
59-
}
60-
61-
return searchForPackageJson(parentDir);
62-
};
63-
64-
6547
export const versionInterceptor = async (config:InternalAxiosRequestConfig) => {
66-
let version:string;
67-
try {
68-
const path = searchForPackageJson(__dirname);
69-
70-
version = path ? require(path).version : '22.x';
71-
} catch (error) {
72-
version = '22.x';
73-
}
74-
75-
config.headers['User-Agent'] = `Pipedrive-SDK-Javascript-${version}`;
48+
config.headers['User-Agent'] = `Pipedrive-SDK-Javascript-${_pkg.version}`;
7649
return config;
7750
}
7851

src/versions/v2/base.ts

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import type { Configuration } from './configuration';
1818
// @ts-ignore
1919
import type { AxiosError, AxiosResponse, AxiosRequestConfig , InternalAxiosRequestConfig , AxiosInstance } from 'axios';
2020
import axios from 'axios';
21-
import { join, dirname } from 'path';
22-
import { existsSync } from 'fs';
21+
// eslint-disable-next-line @typescript-eslint/no-var-requires
22+
const _pkg = require('../../../package.json') as { version: string };
2323

2424
export const BASE_PATH = "https://api.pipedrive.com/api/v2".replace(/\/+$/, "");
2525

@@ -44,35 +44,8 @@ export interface RequestArgs {
4444
options: AxiosRequestConfig;
4545
}
4646

47-
const searchForPackageJson = (startPath: string): string | null => {
48-
const filePath = join(startPath, 'package.json');
49-
50-
if (existsSync(filePath)) {
51-
return filePath;
52-
}
53-
54-
const parentDir = dirname(startPath);
55-
56-
// Stop if we've reached the root directory
57-
if (parentDir.endsWith('/pipedrive') || parentDir === startPath) {
58-
return null;
59-
}
60-
61-
return searchForPackageJson(parentDir);
62-
};
63-
64-
6547
export const versionInterceptor = async (config:InternalAxiosRequestConfig) => {
66-
let version:string;
67-
try {
68-
const path = searchForPackageJson(__dirname);
69-
70-
version = path ? require(path).version : '22.x';
71-
} catch (error) {
72-
version = '22.x';
73-
}
74-
75-
config.headers['User-Agent'] = `Pipedrive-SDK-Javascript-${version}`;
48+
config.headers['User-Agent'] = `Pipedrive-SDK-Javascript-${_pkg.version}`;
7649
return config;
7750
}
7851

0 commit comments

Comments
 (0)