@hubspot/local-dev-lib 3.4.1 → 3.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.
@@ -0,0 +1,3 @@
1
+ import { FireAlarm } from '../types/FireAlarm';
2
+ import { HubSpotPromise } from '../types/Http';
3
+ export declare function fetchFireAlarms(accountId: number): HubSpotPromise<Array<FireAlarm>>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchFireAlarms = void 0;
4
+ const http_1 = require("../http");
5
+ const FIREALARM_API_AUTH_PATH = 'firealarm/v4/alarm';
6
+ function fetchFireAlarms(accountId) {
7
+ return http_1.http.get(accountId, {
8
+ url: `${FIREALARM_API_AUTH_PATH}/hubspot-cli/${accountId}`,
9
+ });
10
+ }
11
+ exports.fetchFireAlarms = fetchFireAlarms;
package/api/github.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { GithubReleaseData, GithubRepoFile, RepoPath } from '../types/Github';
3
4
  import { HubSpotPromise } from '../types/Http';
4
5
  declare global {
package/api/projects.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { HubSpotPromise, QueryParams } from '../types/Http';
3
- import { Project, FetchProjectResponse, UploadProjectResponse, ProjectSettings, FetchPlatformVersionResponse, WarnLogsResponse, UploadIRResponse } from '../types/Project';
4
+ import { Project, FetchProjectResponse, UploadProjectResponse, ProjectSettings, FetchPlatformVersionResponse, WarnLogsResponse, UploadIRResponse, ListAppsResponse, BeginMigrationResponse, FinishMigrationResponse } from '../types/Project';
4
5
  import { Build, FetchProjectBuildsResponse } from '../types/Build';
5
6
  import { ComponentStructureResponse, ProjectComponentsMetadata } from '../types/ComponentStructure';
6
7
  import { Deploy, ProjectDeployResponse } from '../types/Deploy';
@@ -27,8 +28,11 @@ export declare function deleteFileFromBuild(accountId: number, projectName: stri
27
28
  export declare function cancelStagedBuild(accountId: number, projectName: string): HubSpotPromise<void>;
28
29
  export declare function fetchBuildWarnLogs(accountId: number, projectName: string, buildId: number): HubSpotPromise<WarnLogsResponse>;
29
30
  export declare function fetchDeployWarnLogs(accountId: number, projectName: string, deployId: number): HubSpotPromise<WarnLogsResponse>;
31
+ export declare function listAppsForMigration(accountId: number): HubSpotPromise<ListAppsResponse>;
32
+ export declare function beginMigration(accountId: number, applicationId: number): HubSpotPromise<BeginMigrationResponse>;
33
+ export declare function finishMigration(portalId: number, migrationId: number, componentUids: Record<string, string>, projectName: string, targetPlatformVersion: string): HubSpotPromise<FinishMigrationResponse>;
30
34
  export declare function migrateApp(accountId: number, appId: number, projectName: string): HubSpotPromise<MigrateAppResponse>;
31
- export declare function checkMigrationStatus(accountId: number, id: number): HubSpotPromise<PollAppResponse>;
35
+ export declare function checkMigrationStatus(accountId: number, id: number, targetPlatformVersion?: string): HubSpotPromise<PollAppResponse>;
32
36
  export declare function cloneApp(accountId: number, appId: number): HubSpotPromise<CloneAppResponse>;
33
37
  export declare function checkCloneStatus(accountId: number, exportId: number): HubSpotPromise<CloneAppResponse>;
34
38
  export declare function downloadClonedProject(accountId: number, exportId: number): HubSpotPromise<Buffer>;
package/api/projects.js CHANGED
@@ -3,16 +3,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.downloadClonedProject = exports.checkCloneStatus = exports.cloneApp = exports.checkMigrationStatus = exports.migrateApp = exports.fetchDeployWarnLogs = exports.fetchBuildWarnLogs = exports.cancelStagedBuild = exports.deleteFileFromBuild = exports.uploadFileToBuild = exports.queueBuild = exports.provisionBuild = exports.fetchProjectSettings = exports.getDeployStructure = exports.getDeployStatus = exports.deployProject = exports.getBuildStructure = exports.getBuildStatus = exports.fetchProjectBuilds = exports.fetchPlatformVersions = exports.deleteProject = exports.downloadProject = exports.fetchProjectComponentsMetadata = exports.fetchProject = exports.uploadProject = exports.createProject = exports.fetchProjects = void 0;
6
+ exports.downloadClonedProject = exports.checkCloneStatus = exports.cloneApp = exports.checkMigrationStatus = exports.migrateApp = exports.finishMigration = exports.beginMigration = exports.listAppsForMigration = exports.fetchDeployWarnLogs = exports.fetchBuildWarnLogs = exports.cancelStagedBuild = exports.deleteFileFromBuild = exports.uploadFileToBuild = exports.queueBuild = exports.provisionBuild = exports.fetchProjectSettings = exports.getDeployStructure = exports.getDeployStatus = exports.deployProject = exports.getBuildStructure = exports.getBuildStatus = exports.fetchProjectBuilds = exports.fetchPlatformVersions = exports.deleteProject = exports.downloadProject = exports.fetchProjectComponentsMetadata = exports.fetchProject = exports.uploadProject = exports.createProject = exports.fetchProjects = void 0;
7
7
  const http_1 = require("../http");
8
8
  const fs_1 = __importDefault(require("fs"));
9
+ const projects_1 = require("../constants/projects");
9
10
  const PROJECTS_API_PATH = 'dfs/v1/projects';
10
11
  const DEVELOPER_FILE_SYSTEM_PATH = 'dfs/v1';
11
12
  const PROJECTS_DEPLOY_API_PATH = 'dfs/deploy/v1';
12
13
  const PROJECTS_DEPLOY_API_PATH_V3 = 'dfs/deploy/v3';
13
14
  const PROJECTS_LOGS_API_PATH = 'dfs/logging/v1';
14
15
  const DEVELOPER_PROJECTS_API_PATH = 'developer/projects/v1';
15
- const MIGRATIONS_API_PATH = 'dfs/migrations/v1';
16
+ const MIGRATIONS_API_PATH_V1 = 'dfs/migrations/v1';
17
+ const MIGRATIONS_API_PATH_V2 = 'dfs/migrations/v2';
16
18
  const PROJECTS_V3_API_PATH = 'project-components-external/v3';
17
19
  function fetchProjects(accountId) {
18
20
  return http_1.http.get(accountId, {
@@ -205,9 +207,38 @@ function fetchDeployWarnLogs(accountId, projectName, deployId) {
205
207
  });
206
208
  }
207
209
  exports.fetchDeployWarnLogs = fetchDeployWarnLogs;
210
+ async function listAppsForMigration(accountId) {
211
+ return http_1.http.get(accountId, {
212
+ url: `${MIGRATIONS_API_PATH_V2}/list-apps`,
213
+ });
214
+ }
215
+ exports.listAppsForMigration = listAppsForMigration;
216
+ async function beginMigration(accountId, applicationId) {
217
+ return http_1.http.post(accountId, {
218
+ url: `${MIGRATIONS_API_PATH_V2}/migrations`,
219
+ data: {
220
+ applicationId,
221
+ },
222
+ });
223
+ }
224
+ exports.beginMigration = beginMigration;
225
+ async function finishMigration(portalId, migrationId, componentUids, projectName, targetPlatformVersion) {
226
+ const pathPlatformVersion = targetPlatformVersion === projects_1.PLATFORM_VERSIONS.unstable
227
+ ? targetPlatformVersion
228
+ : `v${targetPlatformVersion.replace('.', '')}`;
229
+ return http_1.http.post(portalId, {
230
+ url: `${MIGRATIONS_API_PATH_V2}/migrations/migrate/${pathPlatformVersion}`,
231
+ data: {
232
+ migrationId,
233
+ projectName,
234
+ componentUids,
235
+ },
236
+ });
237
+ }
238
+ exports.finishMigration = finishMigration;
208
239
  function migrateApp(accountId, appId, projectName) {
209
240
  return http_1.http.post(accountId, {
210
- url: `${MIGRATIONS_API_PATH}/migrations`,
241
+ url: `${MIGRATIONS_API_PATH_V1}/migrations`,
211
242
  data: {
212
243
  componentId: appId,
213
244
  componentType: 'PUBLIC_APP_ID',
@@ -216,15 +247,21 @@ function migrateApp(accountId, appId, projectName) {
216
247
  });
217
248
  }
218
249
  exports.migrateApp = migrateApp;
219
- function checkMigrationStatus(accountId, id) {
250
+ function checkMigrationStatus(accountId, id, targetPlatformVersion = projects_1.PLATFORM_VERSIONS.v2023_2) {
251
+ if (targetPlatformVersion === projects_1.PLATFORM_VERSIONS.unstable ||
252
+ targetPlatformVersion === projects_1.PLATFORM_VERSIONS.v2025_2) {
253
+ return http_1.http.get(accountId, {
254
+ url: `${MIGRATIONS_API_PATH_V2}/migrations/${id}/status`,
255
+ });
256
+ }
220
257
  return http_1.http.get(accountId, {
221
- url: `${MIGRATIONS_API_PATH}/migrations/${id}`,
258
+ url: `${MIGRATIONS_API_PATH_V1}/migrations/${id}`,
222
259
  });
223
260
  }
224
261
  exports.checkMigrationStatus = checkMigrationStatus;
225
262
  function cloneApp(accountId, appId) {
226
263
  return http_1.http.post(accountId, {
227
- url: `${MIGRATIONS_API_PATH}/exports`,
264
+ url: `${MIGRATIONS_API_PATH_V1}/exports`,
228
265
  data: {
229
266
  componentId: appId,
230
267
  componentType: 'PUBLIC_APP_ID',
@@ -234,13 +271,13 @@ function cloneApp(accountId, appId) {
234
271
  exports.cloneApp = cloneApp;
235
272
  function checkCloneStatus(accountId, exportId) {
236
273
  return http_1.http.get(accountId, {
237
- url: `${MIGRATIONS_API_PATH}/exports/${exportId}/status`,
274
+ url: `${MIGRATIONS_API_PATH_V1}/exports/${exportId}/status`,
238
275
  });
239
276
  }
240
277
  exports.checkCloneStatus = checkCloneStatus;
241
278
  function downloadClonedProject(accountId, exportId) {
242
279
  return http_1.http.get(accountId, {
243
- url: `${MIGRATIONS_API_PATH}/exports/${exportId}/download-as-clone`,
280
+ url: `${MIGRATIONS_API_PATH_V1}/exports/${exportId}/download-as-clone`,
244
281
  responseType: 'arraybuffer',
245
282
  });
246
283
  }
@@ -0,0 +1,11 @@
1
+ export declare const UNMIGRATABLE_REASONS: {
2
+ UP_TO_DATE: string;
3
+ IS_A_PRIVATE_APP: string;
4
+ LISTED_IN_MARKETPLACE: string;
5
+ };
6
+ export declare const PLATFORM_VERSIONS: {
7
+ v2023_2: string;
8
+ v2025_1: string;
9
+ v2025_2: string;
10
+ unstable: string;
11
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PLATFORM_VERSIONS = exports.UNMIGRATABLE_REASONS = void 0;
4
+ exports.UNMIGRATABLE_REASONS = {
5
+ UP_TO_DATE: 'UP_TO_DATE',
6
+ IS_A_PRIVATE_APP: 'IS_A_PRIVATE_APP',
7
+ LISTED_IN_MARKETPLACE: 'LISTED_IN_MARKETPLACE',
8
+ };
9
+ exports.PLATFORM_VERSIONS = {
10
+ v2023_2: '2023.2',
11
+ v2025_1: '2025.1',
12
+ v2025_2: '2025.2',
13
+ unstable: 'unstable',
14
+ };
package/lib/archive.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { CopySourceToDestOptions } from '../types/Archive';
3
4
  export declare function extractZipArchive(zip: Buffer, name: string, dest: string, { sourceDir, includesRootDir, hideLogs }?: CopySourceToDestOptions): Promise<boolean>;
package/lib/github.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import { GithubReleaseData, GithubRepoFile, RepoPath, CloneGithubRepoOptions } from '../types/Github';
3
4
  /**
4
5
  * @deprecated Use `fetchRepoFile` instead - this util is a thin wrapper around it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/local-dev-lib",
3
- "version": "3.4.1",
3
+ "version": "3.5.0-beta.0",
4
4
  "description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,8 @@
1
+ export type FireAlarm = {
2
+ id: number;
3
+ title: string;
4
+ message: string;
5
+ querySelector: string | null;
6
+ severity: string;
7
+ createdAt: number;
8
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/types/Http.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
+ /// <reference types="node" />
4
5
  import { AxiosPromise, ResponseType } from 'axios';
5
6
  import { ReadStream } from 'fs';
6
7
  import { Stream } from 'stream';
@@ -1,6 +1,7 @@
1
1
  import { Build } from './Build';
2
2
  import { GithubSourceData } from './Github';
3
3
  import { ProjectLog } from './ProjectLog';
4
+ import { UNMIGRATABLE_REASONS } from '../constants/projects';
4
5
  export type Project = {
5
6
  createdAt: number;
6
7
  deletedAt: number;
@@ -66,3 +67,38 @@ export type ProjectStandardError = {
66
67
  export type WarnLogsResponse = {
67
68
  logs: Array<ProjectLog>;
68
69
  };
70
+ interface BaseMigrationApp {
71
+ appId: number;
72
+ appName: string;
73
+ isMigratable: boolean;
74
+ migrationComponents: ListAppsMigrationComponent[];
75
+ }
76
+ export interface MigratableApp extends BaseMigrationApp {
77
+ isMigratable: true;
78
+ }
79
+ export interface UnmigratableApp extends BaseMigrationApp {
80
+ isMigratable: false;
81
+ unmigratableReason: keyof typeof UNMIGRATABLE_REASONS;
82
+ }
83
+ export type MigrationApp = MigratableApp | UnmigratableApp;
84
+ export interface ListAppsResponse {
85
+ migratableApps: MigratableApp[];
86
+ unmigratableApps: UnmigratableApp[];
87
+ }
88
+ export interface BeginMigrationResponse {
89
+ migrationId: number;
90
+ componentsRequiringUids: Record<string, {
91
+ componentType: string;
92
+ componentHint: string | null;
93
+ }>;
94
+ }
95
+ export interface ListAppsMigrationComponent {
96
+ id: string;
97
+ componentType: string;
98
+ isSupported: boolean;
99
+ }
100
+ export type FinishMigrationResponse = {
101
+ projectName: string;
102
+ buildId: number;
103
+ };
104
+ export {};