@hubspot/local-dev-lib 5.4.0-beta.0 → 5.4.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.
@@ -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
  }
@@ -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 {
@@ -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": "5.4.0-beta.0",
3
+ "version": "5.4.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",