@hubspot/local-dev-lib 0.7.8-experimental.0 → 0.7.9-experimental.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.
package/api/projects.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { HubSpotPromise, QueryParams } from '../types/Http.js';
2
- import { Project, FetchProjectResponse, UploadProjectResponse, ProjectSettings, FetchPlatformVersionResponse, WarnLogsResponse, UploadIRResponse, Release, FetchListReleasesResponse } from '../types/Project.js';
2
+ import { Project, FetchProjectResponse, UploadProjectResponse, ProjectSettings, FetchPlatformVersionResponse, WarnLogsResponse, UploadIRResponse, Release, FetchListReleasesResponse, AutoReleaseResponse, AutoReleaseStatusResponse } from '../types/Project.js';
3
3
  import { Build, FetchProjectBuildsResponse } from '../types/Build.js';
4
4
  import { ComponentStructureResponse, ProjectComponentsMetadata } from '../types/ComponentStructure.js';
5
5
  import { Deploy, ProjectDeployResponse, ProjectDeployResponseV1, ProjectDeletionResponse } from '../types/Deploy.js';
@@ -42,6 +42,8 @@ export declare function fetchDeployWarnLogs(accountId: number, projectName: stri
42
42
  export declare function createRelease(accountId: number, projectName: string, buildId: number): HubSpotPromise<Release>;
43
43
  export declare function listReleases(accountId: number, projectName: string, params?: QueryParams): HubSpotPromise<FetchListReleasesResponse>;
44
44
  export declare function getReleaseInfo(accountId: number, projectName: string, releaseTag: string): HubSpotPromise<Release>;
45
+ export declare function triggerAutoRelease(accountId: number, projectId: number, buildId: number, targetPortalId: number): HubSpotPromise<AutoReleaseResponse>;
46
+ export declare function getAutoReleaseStatus(accountId: number, projectId: number, targetPortalId: number, expectedReleaseTag: string, appId: number): HubSpotPromise<AutoReleaseStatusResponse>;
45
47
  /**
46
48
  * @deprecated
47
49
  */
package/api/projects.js CHANGED
@@ -232,6 +232,27 @@ export function getReleaseInfo(accountId, projectName, releaseTag) {
232
232
  url: `${PROJECTS_API_PATH}/${encodeURIComponent(projectName)}/releases/${encodeURIComponent(releaseTag)}`,
233
233
  });
234
234
  }
235
+ export function triggerAutoRelease(accountId, projectId, buildId, targetPortalId) {
236
+ return http.post(accountId, {
237
+ url: `${PROJECTS_DEPLOY_API_PATH}/auto-release`,
238
+ data: {
239
+ projectId,
240
+ buildId,
241
+ targetPortalId,
242
+ },
243
+ });
244
+ }
245
+ export function getAutoReleaseStatus(accountId, projectId, targetPortalId, expectedReleaseTag, appId) {
246
+ return http.get(accountId, {
247
+ url: `${PROJECTS_DEPLOY_API_PATH}/auto-release/status`,
248
+ params: {
249
+ projectId,
250
+ targetPortalId,
251
+ expectedReleaseTag,
252
+ appId,
253
+ },
254
+ });
255
+ }
235
256
  /**
236
257
  * @deprecated
237
258
  */
@@ -16,6 +16,7 @@ export function createSandbox(accountId, name, type) {
16
16
  export function deleteSandbox(parentAccountId, sandboxAccountId) {
17
17
  return http.delete(parentAccountId, {
18
18
  url: `${SANDBOX_API_PATH}/${sandboxAccountId}`,
19
+ timeout: SANDBOX_TIMEOUT,
19
20
  });
20
21
  }
21
22
  export function getSandboxUsageLimits(parentAccountId) {
@@ -27,6 +28,7 @@ export function createV2Sandbox(accountId, name, type, syncObjectRecords) {
27
28
  return http.post(accountId, {
28
29
  url: `${SANDBOX_API_PATH_V2}/sandboxes`,
29
30
  data: { name, type, syncObjectRecords },
31
+ timeout: SANDBOX_TIMEOUT,
30
32
  });
31
33
  }
32
34
  export function getSandboxPersonalAccessKey(accountId, sandboxId) {
@@ -36,12 +36,15 @@ export function getHsSettingsFileIfExists() {
36
36
  }
37
37
  }
38
38
  export function writeHsSettingsFile(settingsFile) {
39
+ const existingFilePath = getHsSettingsFilePath();
39
40
  const dir = getCwd();
40
- const hsFolderPath = path.join(dir, HS_FOLDER);
41
+ const hsFolderPath = existingFilePath
42
+ ? path.dirname(existingFilePath)
43
+ : path.join(dir, HS_FOLDER);
41
44
  const isFirstScaffold = !fs.existsSync(hsFolderPath);
42
45
  try {
43
46
  fs.mkdirSync(hsFolderPath, { recursive: true });
44
- fs.writeFileSync(path.join(dir, HS_FOLDER, HS_SETTINGS_FILENAME), JSON.stringify(settingsFile, null, 2), 'utf8');
47
+ fs.writeFileSync(path.join(hsFolderPath, HS_SETTINGS_FILENAME), JSON.stringify(settingsFile, null, 2), 'utf8');
45
48
  if (isFirstScaffold) {
46
49
  fs.writeFileSync(path.join(hsFolderPath, HS_README_FILENAME), HS_README_CONTENTS, 'utf8');
47
50
  }
@@ -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
  };
@@ -19,7 +19,7 @@ export function createEndpoint(endpointMethod, filename) {
19
19
  }
20
20
  export function createConfig({ endpointPath, endpointMethod, functionFile, }) {
21
21
  return {
22
- runtime: 'nodejs18.x',
22
+ runtime: 'nodejs20.x',
23
23
  version: '1.0',
24
24
  environment: {},
25
25
  secrets: [],
package/lib/github.js CHANGED
@@ -96,7 +96,7 @@ export async function fetchGitHubRepoContentFromDownloadUrl(dest, downloadUrl) {
96
96
  const resp = await fetchRepoFileByDownloadUrl(downloadUrl);
97
97
  const contentType = resp.headers['content-type'];
98
98
  let fileContents;
99
- if (contentType.startsWith('text')) {
99
+ if (typeof contentType === 'string' && contentType.startsWith('text')) {
100
100
  fileContents = Buffer.from(resp.data).toString('utf8');
101
101
  }
102
102
  else {
@@ -1,8 +1,8 @@
1
1
  import { RequestPortsData, ServerPortMap } from '../types/PortManager.js';
2
- export declare const BASE_URL = "http://localhost:8080";
2
+ export declare function isPortAvailable(port: number): Promise<boolean>;
3
3
  export declare function isPortManagerPortAvailable(): Promise<boolean>;
4
4
  export declare function isPortManagerServerRunning(): Promise<boolean>;
5
- export declare function startPortManagerServer(): Promise<void>;
5
+ export declare function startPortManagerServer(port?: number): Promise<void>;
6
6
  export declare function stopPortManagerServer(): Promise<void>;
7
7
  export declare function requestPorts(portData: Array<RequestPortsData>): Promise<{
8
8
  [instanceId: string]: number;
@@ -1,14 +1,16 @@
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';
3
+ import { detectPort } from '../utils/detectPort.js';
4
4
  import { logger } from './logger.js';
5
- export const BASE_URL = `http://localhost:${PORT_MANAGER_SERVER_PORT}`;
5
+ export async function isPortAvailable(port) {
6
+ return (await detectPort(port)) === port;
7
+ }
6
8
  export async function isPortManagerPortAvailable() {
7
9
  return PortManagerServer.portAvailable();
8
10
  }
9
11
  export async function isPortManagerServerRunning() {
10
12
  try {
11
- const { data } = await axios.get(`${BASE_URL}${HEALTH_CHECK_PATH}`);
13
+ const { data } = await axios.get(`${PortManagerServer.baseUrl}${HEALTH_CHECK_PATH}`);
12
14
  return data.status === SERVICE_HEALTHY;
13
15
  }
14
16
  catch (e) {
@@ -16,36 +18,36 @@ export async function isPortManagerServerRunning() {
16
18
  return false;
17
19
  }
18
20
  }
19
- export async function startPortManagerServer() {
21
+ export async function startPortManagerServer(port) {
20
22
  const isRunning = await isPortManagerServerRunning();
21
23
  if (!isRunning) {
22
- await PortManagerServer.init();
24
+ await PortManagerServer.init(port);
23
25
  }
24
26
  }
25
27
  export async function stopPortManagerServer() {
26
28
  const isRunning = await isPortManagerServerRunning();
27
29
  if (isRunning) {
28
- await axios.post(`${BASE_URL}/close`);
30
+ await axios.post(`${PortManagerServer.baseUrl}/close`);
29
31
  }
30
32
  }
31
33
  export async function requestPorts(portData) {
32
- const { data } = await axios.post(`${BASE_URL}/servers`, {
34
+ const { data } = await axios.post(`${PortManagerServer.baseUrl}/servers`, {
33
35
  portData: portData,
34
36
  });
35
37
  return data.ports;
36
38
  }
37
39
  export async function getActiveServers() {
38
- const { data } = await axios.get(`${BASE_URL}/servers`);
40
+ const { data } = await axios.get(`${PortManagerServer.baseUrl}/servers`);
39
41
  return data.servers;
40
42
  }
41
43
  export async function getServerPortByInstanceId(serverInstanceId) {
42
- const { data } = await axios.get(`${BASE_URL}/servers/${serverInstanceId}`);
44
+ const { data } = await axios.get(`${PortManagerServer.baseUrl}/servers/${serverInstanceId}`);
43
45
  return data.port;
44
46
  }
45
47
  export async function deleteServerInstance(serverInstanceId) {
46
- await axios.delete(`${BASE_URL}/servers/${serverInstanceId}`);
48
+ await axios.delete(`${PortManagerServer.baseUrl}/servers/${serverInstanceId}`);
47
49
  }
48
50
  export async function portManagerHasActiveServers() {
49
- const { data } = await axios.get(`${BASE_URL}/servers`);
51
+ const { data } = await axios.get(`${PortManagerServer.baseUrl}/servers`);
50
52
  return data.count > 0;
51
53
  }
@@ -101,7 +101,13 @@ export class HubSpotHttpError extends Error {
101
101
  return;
102
102
  }
103
103
  generatedContext.accountId = cause.config?.params?.portalId;
104
- generatedContext.payload = JSON.stringify(cause.config?.data);
104
+ // Axios serializes request bodies before the error fires, so `config.data`
105
+ // is often already a JSON string. Avoid re-stringifying so debug output is
106
+ // readable instead of escape-soup.
107
+ generatedContext.payload =
108
+ typeof cause.config?.data === 'string'
109
+ ? cause.config.data
110
+ : JSON.stringify(cause.config?.data);
105
111
  // This will just be the url path
106
112
  generatedContext.request = cause.config?.url;
107
113
  // Allow the provided context to override the generated context
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/local-dev-lib",
3
- "version": "0.7.8-experimental.0",
3
+ "version": "0.7.9-experimental.0",
4
4
  "type": "module",
5
5
  "description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
6
6
  "files": [
@@ -71,13 +71,13 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "address": "2.0.2",
74
- "axios": "1.12.0",
74
+ "axios": "1.15.2",
75
75
  "chalk": "5.6.2",
76
76
  "chokidar": "3.6.0",
77
77
  "content-disposition": "0.5.4",
78
78
  "cors": "2.8.5",
79
79
  "debounce": "1.2.1",
80
- "express": "4.21.2",
80
+ "express": "4.22.1",
81
81
  "extract-zip": "2.0.1",
82
82
  "findup-sync": "5.0.0",
83
83
  "form-data": "^4.0.4",
@@ -69,3 +69,12 @@ export type FetchListReleasesResponse = {
69
69
  };
70
70
  };
71
71
  };
72
+ export type AutoReleaseResponse = {
73
+ releaseTag: string;
74
+ status: string;
75
+ appId: number;
76
+ };
77
+ export type AutoReleaseStatusResponse = {
78
+ status: 'PENDING' | 'COMPLETE';
79
+ currentReleaseTag?: string;
80
+ };
@@ -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) => {