@hubspot/local-dev-lib 3.13.1 → 3.14.0-beta.1
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/sandboxHubs.d.ts +3 -1
- package/api/sandboxHubs.js +18 -1
- package/lib/archive.js +3 -0
- package/package.json +1 -1
- package/types/Deploy.d.ts +17 -1
- package/types/Sandbox.d.ts +33 -0
- package/types/Sandbox.js +10 -0
package/api/sandboxHubs.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AxiosPromise } from 'axios';
|
|
2
2
|
import { Environment } from '../types/Config';
|
|
3
|
-
import { SandboxHubData, SandboxResponse, SandboxUsageLimitsResponse } from '../types/Sandbox';
|
|
3
|
+
import { SandboxPersonalAccessKey, SandboxHubData, SandboxResponse, SandboxUsageLimitsResponse, V2Sandbox } from '../types/Sandbox';
|
|
4
4
|
import { HubSpotPromise } from '../types/Http';
|
|
5
5
|
export declare function createSandbox(accountId: number, name: string, type: 1 | 2): HubSpotPromise<SandboxResponse>;
|
|
6
6
|
export declare function deleteSandbox(parentAccountId: number, sandboxAccountId: number): HubSpotPromise<void>;
|
|
7
7
|
export declare function getSandboxUsageLimits(parentAccountId: number): HubSpotPromise<SandboxUsageLimitsResponse>;
|
|
8
8
|
export declare function fetchSandboxHubData(accessToken: string, accountId: number, env?: Environment): AxiosPromise<SandboxHubData>;
|
|
9
|
+
export declare function createV2Sandbox(accountId: number, name: string, type: 'STANDARD' | 'DEVELOPER', syncObjectRecords: boolean): HubSpotPromise<V2Sandbox>;
|
|
10
|
+
export declare function getSandboxPersonalAccessKey(accountId: number, sandboxId: number): HubSpotPromise<SandboxPersonalAccessKey>;
|
package/api/sandboxHubs.js
CHANGED
|
@@ -3,7 +3,7 @@ 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.fetchSandboxHubData = exports.getSandboxUsageLimits = exports.deleteSandbox = exports.createSandbox = void 0;
|
|
6
|
+
exports.getSandboxPersonalAccessKey = exports.createV2Sandbox = exports.fetchSandboxHubData = exports.getSandboxUsageLimits = exports.deleteSandbox = exports.createSandbox = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const http_1 = require("../http");
|
|
9
9
|
const getAxiosConfig_1 = require("../http/getAxiosConfig");
|
|
@@ -47,3 +47,20 @@ function fetchSandboxHubData(accessToken, accountId, env = environments_1.ENVIRO
|
|
|
47
47
|
return (0, axios_1.default)(reqWithToken);
|
|
48
48
|
}
|
|
49
49
|
exports.fetchSandboxHubData = fetchSandboxHubData;
|
|
50
|
+
function createV2Sandbox(accountId, name, type, syncObjectRecords) {
|
|
51
|
+
return http_1.http.post(accountId, {
|
|
52
|
+
url: `${SANDBOX_API_PATH_V2}/sandboxes`,
|
|
53
|
+
data: { name, type, syncObjectRecords },
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
exports.createV2Sandbox = createV2Sandbox;
|
|
57
|
+
function getSandboxPersonalAccessKey(accountId, sandboxId) {
|
|
58
|
+
return http_1.http.post(accountId, {
|
|
59
|
+
url: `${SANDBOX_API_PATH_V2}/sandboxes/${sandboxId}/personal-access-key`,
|
|
60
|
+
headers: {
|
|
61
|
+
'Content-Type': 'application/json',
|
|
62
|
+
},
|
|
63
|
+
timeout: api_1.SANDBOX_TIMEOUT,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
exports.getSandboxPersonalAccessKey = getSandboxPersonalAccessKey;
|
package/lib/archive.js
CHANGED
|
@@ -109,6 +109,7 @@ async function copySourceToDest(src, dest, { sourceDir, includesRootDir = true,
|
|
|
109
109
|
for (let i = 0; i < sourceDirs.length; i++) {
|
|
110
110
|
const projectSrcDir = (0, path_1.join)(...srcDirPath, sourceDirs[i]);
|
|
111
111
|
let collisions = [];
|
|
112
|
+
let filesWithoutCollisions = [];
|
|
112
113
|
if (fs_extra_1.default.existsSync(dest) &&
|
|
113
114
|
handleCollision &&
|
|
114
115
|
typeof handleCollision === 'function') {
|
|
@@ -116,6 +117,7 @@ async function copySourceToDest(src, dest, { sourceDir, includesRootDir = true,
|
|
|
116
117
|
const newFiles = (await (0, fs_1.walk)(projectSrcDir, ['node_modules'])).map(file => path_1.default.relative(projectSrcDir, file));
|
|
117
118
|
// Find files that exist in the same positions in both directories
|
|
118
119
|
collisions = existingFiles.filter(currentFile => newFiles.includes(currentFile));
|
|
120
|
+
filesWithoutCollisions = newFiles.filter(currentFile => !collisions.includes(currentFile));
|
|
119
121
|
}
|
|
120
122
|
if (collisions.length &&
|
|
121
123
|
handleCollision &&
|
|
@@ -125,6 +127,7 @@ async function copySourceToDest(src, dest, { sourceDir, includesRootDir = true,
|
|
|
125
127
|
src: projectSrcDir,
|
|
126
128
|
collisions,
|
|
127
129
|
});
|
|
130
|
+
await Promise.all(filesWithoutCollisions.map(currentFile => fs_extra_1.default.copy(path_1.default.join(projectSrcDir, currentFile), path_1.default.join(dest, currentFile))));
|
|
128
131
|
}
|
|
129
132
|
else {
|
|
130
133
|
await fs_extra_1.default.copy(projectSrcDir, dest);
|
package/package.json
CHANGED
package/types/Deploy.d.ts
CHANGED
|
@@ -35,9 +35,25 @@ export type DeployStatusTaskLocator = {
|
|
|
35
35
|
status: string;
|
|
36
36
|
}>;
|
|
37
37
|
};
|
|
38
|
-
export type
|
|
38
|
+
export type ProjectDeployResponseQueued = {
|
|
39
39
|
id: string;
|
|
40
|
+
buildResultType: 'DEPLOY_QUEUED';
|
|
40
41
|
links: {
|
|
41
42
|
status: string;
|
|
42
43
|
};
|
|
43
44
|
};
|
|
45
|
+
type SubdeployValidationIssue = {
|
|
46
|
+
uid: string;
|
|
47
|
+
componentTypeName: string;
|
|
48
|
+
errorMessages: string[];
|
|
49
|
+
blockingMessages: {
|
|
50
|
+
message: string;
|
|
51
|
+
isWarning: boolean;
|
|
52
|
+
}[];
|
|
53
|
+
};
|
|
54
|
+
export type ProjectDeployResponseBlocked = {
|
|
55
|
+
buildResultType: 'DEPLOY_BLOCKED';
|
|
56
|
+
issues: SubdeployValidationIssue[];
|
|
57
|
+
};
|
|
58
|
+
export type ProjectDeployResponse = ProjectDeployResponseQueued | ProjectDeployResponseBlocked;
|
|
59
|
+
export {};
|
package/types/Sandbox.d.ts
CHANGED
|
@@ -111,6 +111,33 @@ export type Sandbox = {
|
|
|
111
111
|
requestAccessFrom?: User | null;
|
|
112
112
|
superAdminsInSandbox?: number;
|
|
113
113
|
};
|
|
114
|
+
export declare const SandboxVersioning: {
|
|
115
|
+
readonly V1: "V1";
|
|
116
|
+
readonly V2: "V2";
|
|
117
|
+
};
|
|
118
|
+
export declare const SandboxStatus: {
|
|
119
|
+
readonly PENDING: "PENDING";
|
|
120
|
+
readonly READY: "READY";
|
|
121
|
+
readonly FAILED: "FAILED";
|
|
122
|
+
};
|
|
123
|
+
export type SandboxVersion = keyof typeof SandboxVersioning;
|
|
124
|
+
export type V2SandboxStatus = keyof typeof SandboxStatus;
|
|
125
|
+
export type V2Sandbox = {
|
|
126
|
+
sandboxHubId: number;
|
|
127
|
+
parentHubId: number;
|
|
128
|
+
name: string;
|
|
129
|
+
version: SandboxVersion;
|
|
130
|
+
type: string;
|
|
131
|
+
status: V2SandboxStatus;
|
|
132
|
+
createdAt: string;
|
|
133
|
+
createdByUser: User;
|
|
134
|
+
currentUserHasAccess?: boolean;
|
|
135
|
+
currentUserHasSuperAdminAccess?: boolean;
|
|
136
|
+
superAdminsInSandbox?: number;
|
|
137
|
+
requestAccessFrom?: User | null;
|
|
138
|
+
updatedAt?: string;
|
|
139
|
+
updatedByUser?: User | null;
|
|
140
|
+
};
|
|
114
141
|
export type SandboxResponse = {
|
|
115
142
|
sandbox: Sandbox;
|
|
116
143
|
personalAccessKey: string;
|
|
@@ -152,4 +179,10 @@ export type SandboxType = {
|
|
|
152
179
|
export type FetchTypesResponse = {
|
|
153
180
|
results: Array<SandboxType>;
|
|
154
181
|
};
|
|
182
|
+
export type SandboxPersonalAccessKey = {
|
|
183
|
+
personalAccessKey: {
|
|
184
|
+
encodedOAuthRefreshToken: string;
|
|
185
|
+
oauthAccessToken: string;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
155
188
|
export {};
|
package/types/Sandbox.js
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SandboxStatus = exports.SandboxVersioning = void 0;
|
|
4
|
+
exports.SandboxVersioning = {
|
|
5
|
+
V1: 'V1',
|
|
6
|
+
V2: 'V2',
|
|
7
|
+
};
|
|
8
|
+
exports.SandboxStatus = {
|
|
9
|
+
PENDING: 'PENDING',
|
|
10
|
+
READY: 'READY',
|
|
11
|
+
FAILED: 'FAILED',
|
|
12
|
+
};
|