@hubspot/local-dev-lib 5.4.0-beta.1 → 5.5.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,5 @@
1
1
  export const MIN_PORT_NUMBER = 1024;
2
2
  export const MAX_PORT_NUMBER = 65535;
3
+ // TODO: rename to PORT_MANAGER_SERVER_DEFAULT_PORT and update value to 4828
4
+ // on the next major version of @hubspot/local-dev-lib
3
5
  export const PORT_MANAGER_SERVER_PORT = 8080;
@@ -10,5 +10,6 @@ export declare const PLATFORM_VERSIONS: {
10
10
  v2025_2: string;
11
11
  v2026_03_beta: string;
12
12
  v2026_03: string;
13
+ v2026_09_beta: string;
13
14
  unstable: string;
14
15
  };
@@ -10,5 +10,6 @@ export const PLATFORM_VERSIONS = {
10
10
  v2025_2: '2025.2',
11
11
  v2026_03_beta: '2026.03-beta',
12
12
  v2026_03: '2026.03',
13
+ v2026_09_beta: '2026.09-beta',
13
14
  unstable: 'unstable',
14
15
  };
@@ -1,8 +1,7 @@
1
1
  import { RequestPortsData, ServerPortMap } from '../types/PortManager.js';
2
- export declare const BASE_URL = "http://localhost:8080";
3
2
  export declare function isPortManagerPortAvailable(): Promise<boolean>;
4
3
  export declare function isPortManagerServerRunning(): Promise<boolean>;
5
- export declare function startPortManagerServer(): Promise<void>;
4
+ export declare function startPortManagerServer(port?: number): Promise<void>;
6
5
  export declare function stopPortManagerServer(): Promise<void>;
7
6
  export declare function requestPorts(portData: Array<RequestPortsData>): Promise<{
8
7
  [instanceId: string]: number;
@@ -1,14 +1,12 @@
1
1
  import axios from 'axios';
2
2
  import { HEALTH_CHECK_PATH, PortManagerServer, SERVICE_HEALTHY, } from '../utils/PortManagerServer.js';
3
- import { PORT_MANAGER_SERVER_PORT } from '../constants/ports.js';
4
3
  import { logger } from './logger.js';
5
- export const BASE_URL = `http://localhost:${PORT_MANAGER_SERVER_PORT}`;
6
4
  export async function isPortManagerPortAvailable() {
7
5
  return PortManagerServer.portAvailable();
8
6
  }
9
7
  export async function isPortManagerServerRunning() {
10
8
  try {
11
- const { data } = await axios.get(`${BASE_URL}${HEALTH_CHECK_PATH}`);
9
+ const { data } = await axios.get(`${PortManagerServer.baseUrl}${HEALTH_CHECK_PATH}`);
12
10
  return data.status === SERVICE_HEALTHY;
13
11
  }
14
12
  catch (e) {
@@ -16,36 +14,36 @@ export async function isPortManagerServerRunning() {
16
14
  return false;
17
15
  }
18
16
  }
19
- export async function startPortManagerServer() {
17
+ export async function startPortManagerServer(port) {
20
18
  const isRunning = await isPortManagerServerRunning();
21
19
  if (!isRunning) {
22
- await PortManagerServer.init();
20
+ await PortManagerServer.init(port);
23
21
  }
24
22
  }
25
23
  export async function stopPortManagerServer() {
26
24
  const isRunning = await isPortManagerServerRunning();
27
25
  if (isRunning) {
28
- await axios.post(`${BASE_URL}/close`);
26
+ await axios.post(`${PortManagerServer.baseUrl}/close`);
29
27
  }
30
28
  }
31
29
  export async function requestPorts(portData) {
32
- const { data } = await axios.post(`${BASE_URL}/servers`, {
30
+ const { data } = await axios.post(`${PortManagerServer.baseUrl}/servers`, {
33
31
  portData: portData,
34
32
  });
35
33
  return data.ports;
36
34
  }
37
35
  export async function getActiveServers() {
38
- const { data } = await axios.get(`${BASE_URL}/servers`);
36
+ const { data } = await axios.get(`${PortManagerServer.baseUrl}/servers`);
39
37
  return data.servers;
40
38
  }
41
39
  export async function getServerPortByInstanceId(serverInstanceId) {
42
- const { data } = await axios.get(`${BASE_URL}/servers/${serverInstanceId}`);
40
+ const { data } = await axios.get(`${PortManagerServer.baseUrl}/servers/${serverInstanceId}`);
43
41
  return data.port;
44
42
  }
45
43
  export async function deleteServerInstance(serverInstanceId) {
46
- await axios.delete(`${BASE_URL}/servers/${serverInstanceId}`);
44
+ await axios.delete(`${PortManagerServer.baseUrl}/servers/${serverInstanceId}`);
47
45
  }
48
46
  export async function portManagerHasActiveServers() {
49
- const { data } = await axios.get(`${BASE_URL}/servers`);
47
+ const { data } = await axios.get(`${PortManagerServer.baseUrl}/servers`);
50
48
  return data.count > 0;
51
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/local-dev-lib",
3
- "version": "5.4.0-beta.1",
3
+ "version": "5.5.0-beta.0",
4
4
  "type": "module",
5
5
  "description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
6
6
  "files": [
@@ -1,14 +1,13 @@
1
- import { Express } from 'express';
2
- import { Server } from 'http';
3
- import { ServerPortMap } from '../types/PortManager.js';
4
1
  export declare const HEALTH_CHECK_PATH = "/port-manager-health-check";
5
2
  export declare const SERVICE_HEALTHY = "OK";
6
3
  declare class _PortManagerServer {
7
- app?: Express;
8
- server?: Server;
9
- serverPortMap: ServerPortMap;
4
+ private app?;
5
+ private server?;
6
+ private serverPortMap;
7
+ private port;
10
8
  constructor();
11
- init(): Promise<void>;
9
+ get baseUrl(): string;
10
+ init(port?: number): Promise<void>;
12
11
  private reset;
13
12
  portAvailable(): Promise<boolean>;
14
13
  private listen;
@@ -11,13 +11,21 @@ class _PortManagerServer {
11
11
  app;
12
12
  server;
13
13
  serverPortMap;
14
+ port;
14
15
  constructor() {
15
16
  this.serverPortMap = {};
17
+ this.port = PORT_MANAGER_SERVER_PORT;
16
18
  }
17
- async init() {
19
+ get baseUrl() {
20
+ return `http://localhost:${this.port}`;
21
+ }
22
+ async init(port) {
23
+ if (port) {
24
+ this.port = port;
25
+ }
18
26
  if (!(await this.portAvailable())) {
19
27
  throw new Error(i18n(`${i18nKey}.errors.portInUse`, {
20
- port: PORT_MANAGER_SERVER_PORT,
28
+ port: this.port,
21
29
  }));
22
30
  }
23
31
  if (this.app) {
@@ -34,15 +42,16 @@ class _PortManagerServer {
34
42
  this.app = undefined;
35
43
  this.server = undefined;
36
44
  this.serverPortMap = {};
45
+ this.port = PORT_MANAGER_SERVER_PORT;
37
46
  }
38
47
  async portAvailable() {
39
- return ((await detectPort(PORT_MANAGER_SERVER_PORT)) === PORT_MANAGER_SERVER_PORT);
48
+ return (await detectPort(this.port)) === this.port;
40
49
  }
41
50
  listen() {
42
51
  return new Promise((resolve, reject) => {
43
- const server = this.app.listen(PORT_MANAGER_SERVER_PORT, () => {
52
+ const server = this.app.listen(this.port, () => {
44
53
  logger.debug(i18n(`${i18nKey}.started`, {
45
- port: PORT_MANAGER_SERVER_PORT,
54
+ port: this.port,
46
55
  }));
47
56
  resolve(server);
48
57
  }).on('error', (err) => {