@hubspot/local-dev-lib 0.3.15 → 0.4.0-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/LICENSE +12 -0
- package/README.md +17 -0
- package/api/appsDev.d.ts +6 -0
- package/api/appsDev.js +29 -0
- package/api/customObjects.d.ts +8 -20
- package/api/customObjects.js +13 -16
- package/api/designManager.d.ts +4 -14
- package/api/designManager.js +5 -8
- package/api/devSecrets.d.ts +6 -0
- package/api/devSecrets.js +40 -0
- package/api/developerTestAccounts.d.ts +12 -5
- package/api/developerTestAccounts.js +17 -10
- package/api/fileManager.d.ts +5 -4
- package/api/fileManager.js +9 -9
- package/api/fileMapper.d.ts +8 -7
- package/api/fileMapper.js +16 -16
- package/api/fileTransport.d.ts +4 -3
- package/api/fileTransport.js +5 -5
- package/api/fireAlarm.d.ts +3 -0
- package/api/fireAlarm.js +11 -0
- package/api/functions.d.ts +7 -7
- package/api/functions.js +11 -14
- package/api/github.d.ts +8 -9
- package/api/github.js +30 -13
- package/api/hubdb.d.ts +11 -10
- package/api/hubdb.js +24 -21
- package/api/lighthouseScore.d.ts +4 -4
- package/api/lighthouseScore.js +7 -10
- package/api/localDevAuth.d.ts +9 -19
- package/api/localDevAuth.js +34 -9
- package/api/marketplaceValidation.d.ts +4 -4
- package/api/marketplaceValidation.js +4 -7
- package/api/projects.d.ts +47 -35
- package/api/projects.js +145 -57
- package/api/sandboxHubs.d.ts +6 -4
- package/api/sandboxHubs.js +9 -10
- package/api/sandboxSync.d.ts +4 -4
- package/api/sandboxSync.js +4 -13
- package/api/secrets.d.ts +6 -8
- package/api/secrets.js +9 -12
- package/api/validateHubl.d.ts +2 -1
- package/api/validateHubl.js +3 -6
- package/config/CLIConfiguration.d.ts +16 -9
- package/config/CLIConfiguration.js +148 -74
- package/config/configFile.js +8 -17
- package/config/configUtils.d.ts +2 -21
- package/config/configUtils.js +2 -2
- package/config/config_DEPRECATED.d.ts +10 -8
- package/config/config_DEPRECATED.js +62 -32
- package/config/getAccountIdentifier.d.ts +2 -0
- package/config/getAccountIdentifier.js +15 -0
- package/config/index.d.ts +14 -8
- package/config/index.js +108 -59
- package/config/migrate.d.ts +22 -0
- package/config/migrate.js +178 -0
- package/constants/config.d.ts +13 -1
- package/constants/config.js +19 -2
- package/constants/extensions.d.ts +1 -0
- package/constants/extensions.js +2 -1
- package/constants/files.d.ts +2 -2
- package/constants/files.js +3 -3
- package/constants/projects.d.ts +12 -0
- package/constants/projects.js +15 -0
- package/errors/errors_DEPRECATED.d.ts +1 -5
- package/errors/errors_DEPRECATED.js +2 -2
- package/errors/index.d.ts +18 -0
- package/errors/index.js +63 -0
- package/http/addQueryParams.d.ts +2 -0
- package/http/addQueryParams.js +14 -0
- package/http/getAxiosConfig.d.ts +2 -2
- package/http/getAxiosConfig.js +31 -2
- package/http/index.d.ts +10 -10
- package/http/index.js +80 -34
- package/http/unauthed.d.ts +14 -0
- package/http/unauthed.js +38 -0
- package/lang/en.json +384 -376
- package/lib/archive.d.ts +3 -6
- package/lib/archive.js +26 -20
- package/lib/cms/functions.d.ts +6 -9
- package/lib/cms/functions.js +24 -19
- package/lib/cms/handleFieldsJS.d.ts +2 -2
- package/lib/cms/handleFieldsJS.js +13 -9
- package/lib/cms/modules.d.ts +5 -13
- package/lib/cms/modules.js +40 -23
- package/lib/cms/processFieldsJs.js +8 -7
- package/lib/cms/templates.d.ts +42 -0
- package/lib/cms/templates.js +48 -5
- package/lib/cms/uploadFolder.d.ts +3 -18
- package/lib/cms/uploadFolder.js +19 -17
- package/lib/cms/validate.js +1 -1
- package/lib/cms/watch.d.ts +2 -15
- package/lib/cms/watch.js +31 -23
- package/lib/customObjects.js +4 -15
- package/lib/fileManager.js +22 -22
- package/lib/fileMapper.d.ts +4 -13
- package/lib/fileMapper.js +47 -50
- package/lib/fs.d.ts +1 -1
- package/lib/fs.js +10 -6
- package/lib/github.d.ts +11 -11
- package/lib/github.js +44 -30
- package/lib/gitignore.d.ts +1 -6
- package/lib/gitignore.js +2 -2
- package/lib/hubdb.d.ts +3 -2
- package/lib/hubdb.js +11 -9
- package/lib/notify.js +2 -2
- package/lib/oauth.d.ts +1 -1
- package/lib/oauth.js +9 -18
- package/lib/path.d.ts +3 -0
- package/lib/path.js +46 -1
- package/lib/personalAccessKey.d.ts +5 -17
- package/lib/personalAccessKey.js +42 -32
- package/lib/portManager.d.ts +3 -5
- package/lib/portManager.js +18 -6
- package/lib/text.d.ts +1 -1
- package/lib/text.js +3 -0
- package/lib/trackUsage.js +13 -7
- package/models/FileSystemError.d.ts +6 -0
- package/models/FileSystemError.js +47 -0
- package/models/HubSpotHttpError.d.ts +26 -0
- package/models/HubSpotHttpError.js +208 -0
- package/models/OAuth2Manager.d.ts +2 -27
- package/models/OAuth2Manager.js +14 -29
- package/package.json +38 -35
- package/types/Accounts.d.ts +98 -3
- package/types/Apps.d.ts +77 -0
- package/types/Apps.js +2 -0
- package/types/Archive.d.ts +9 -0
- package/types/Archive.js +2 -0
- package/types/Build.d.ts +4 -2
- package/types/ComponentStructure.d.ts +30 -10
- package/types/Config.d.ts +21 -2
- package/types/Deploy.d.ts +3 -2
- package/types/DesignManager.d.ts +15 -0
- package/types/DesignManager.js +2 -0
- package/types/DevSecrets.d.ts +5 -0
- package/types/DevSecrets.js +2 -0
- package/types/Error.d.ts +9 -5
- package/types/FieldsJS.d.ts +1 -0
- package/types/FieldsJS.js +2 -0
- package/types/FileManager.d.ts +1 -1
- package/types/Files.d.ts +43 -4
- package/types/FireAlarm.d.ts +9 -0
- package/types/FireAlarm.js +2 -0
- package/types/Functions.d.ts +52 -0
- package/types/Github.d.ts +13 -0
- package/types/Http.d.ts +12 -11
- package/types/Hubdb.d.ts +9 -0
- package/types/MarketplaceValidation.d.ts +7 -3
- package/types/Migration.d.ts +30 -0
- package/types/Migration.js +12 -0
- package/types/Modules.d.ts +11 -0
- package/types/PortManager.d.ts +7 -0
- package/types/Project.d.ts +30 -0
- package/types/Sandbox.d.ts +25 -36
- package/types/Schemas.d.ts +56 -0
- package/types/Secrets.d.ts +3 -0
- package/types/Secrets.js +2 -0
- package/types/developerTestAccounts.d.ts +11 -0
- package/utils/PortManagerServer.d.ts +6 -7
- package/utils/PortManagerServer.js +15 -9
- package/utils/{getAccountIdentifier.d.ts → accounts.d.ts} +0 -6
- package/utils/{getAccountIdentifier.js → accounts.js} +1 -13
- package/utils/cms/fieldsJS.d.ts +1 -2
- package/utils/cms/modules.js +2 -2
- package/utils/detectPort.js +3 -3
- package/errors/apiErrors.d.ts +0 -25
- package/errors/apiErrors.js +0 -186
- package/errors/fileSystemErrors.d.ts +0 -6
- package/errors/fileSystemErrors.js +0 -35
- package/errors/standardErrors.d.ts +0 -21
- package/errors/standardErrors.js +0 -52
- package/lang/lang/en.json +0 -391
- package/lib/developerTestAccounts.d.ts +0 -4
- package/lib/developerTestAccounts.js +0 -35
- package/lib/sandboxes.d.ts +0 -14
- package/lib/sandboxes.js +0 -70
- package/models/HubSpotAuthError.d.ts +0 -12
- package/models/HubSpotAuthError.js +0 -20
package/api/functions.js
CHANGED
|
@@ -1,33 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getBuildStatus = exports.buildPackage = exports.getLatestFunctionLog = exports.getFunctionLogs = exports.getRoutes = void 0;
|
|
7
|
-
const http_1 =
|
|
4
|
+
const http_1 = require("../http");
|
|
8
5
|
const FUNCTION_API_PATH = 'cms/v3/functions';
|
|
9
|
-
|
|
10
|
-
return http_1.
|
|
6
|
+
function getRoutes(accountId) {
|
|
7
|
+
return http_1.http.get(accountId, {
|
|
11
8
|
url: `${FUNCTION_API_PATH}/routes`,
|
|
12
9
|
});
|
|
13
10
|
}
|
|
14
11
|
exports.getRoutes = getRoutes;
|
|
15
|
-
|
|
12
|
+
function getFunctionLogs(accountId, route, params = {}) {
|
|
16
13
|
const { limit = 5 } = params;
|
|
17
|
-
return http_1.
|
|
14
|
+
return http_1.http.get(accountId, {
|
|
18
15
|
url: `${FUNCTION_API_PATH}/results/by-route/${encodeURIComponent(route)}`,
|
|
19
16
|
params: { ...params, limit },
|
|
20
17
|
});
|
|
21
18
|
}
|
|
22
19
|
exports.getFunctionLogs = getFunctionLogs;
|
|
23
|
-
|
|
24
|
-
return http_1.
|
|
20
|
+
function getLatestFunctionLog(accountId, route) {
|
|
21
|
+
return http_1.http.get(accountId, {
|
|
25
22
|
url: `${FUNCTION_API_PATH}/results/by-route/${encodeURIComponent(route)}/latest`,
|
|
26
23
|
});
|
|
27
24
|
}
|
|
28
25
|
exports.getLatestFunctionLog = getLatestFunctionLog;
|
|
29
|
-
|
|
30
|
-
return http_1.
|
|
26
|
+
function buildPackage(accountId, folderPath) {
|
|
27
|
+
return http_1.http.post(accountId, {
|
|
31
28
|
url: `${FUNCTION_API_PATH}/build/async`,
|
|
32
29
|
headers: {
|
|
33
30
|
Accept: 'text/plain',
|
|
@@ -38,8 +35,8 @@ async function buildPackage(accountId, folderPath) {
|
|
|
38
35
|
});
|
|
39
36
|
}
|
|
40
37
|
exports.buildPackage = buildPackage;
|
|
41
|
-
|
|
42
|
-
return http_1.
|
|
38
|
+
function getBuildStatus(accountId, buildId) {
|
|
39
|
+
return http_1.http.get(accountId, {
|
|
43
40
|
url: `${FUNCTION_API_PATH}/build/${buildId}/poll`,
|
|
44
41
|
});
|
|
45
42
|
}
|
package/api/github.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
import { GithubReleaseData, GithubRepoFile } from '../types/Github';
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { GithubReleaseData, GithubRepoFile, RepoPath } from '../types/Github';
|
|
4
|
+
import { HubSpotPromise } from '../types/Http';
|
|
4
5
|
declare global {
|
|
5
6
|
var githubToken: string;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function
|
|
12
|
-
export declare function fetchRepoContents(repoPath: RepoPath, path: string, ref?: string): Promise<AxiosResponse<Array<GithubRepoFile>>>;
|
|
13
|
-
export {};
|
|
8
|
+
export declare function fetchRepoReleaseData(repoPath: RepoPath, tag?: string): HubSpotPromise<GithubReleaseData>;
|
|
9
|
+
export declare function fetchRepoAsZip(zipUrl: string): HubSpotPromise<Buffer>;
|
|
10
|
+
export declare function fetchRepoFile<T = Buffer>(repoPath: RepoPath, filePath: string, ref: string): HubSpotPromise<T>;
|
|
11
|
+
export declare function fetchRepoFileByDownloadUrl(downloadUrl: string): HubSpotPromise<Buffer>;
|
|
12
|
+
export declare function fetchRepoContents(repoPath: RepoPath, path: string, ref?: string): HubSpotPromise<Array<GithubRepoFile>>;
|
package/api/github.js
CHANGED
|
@@ -8,47 +8,64 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
8
8
|
const getAxiosConfig_1 = require("../http/getAxiosConfig");
|
|
9
9
|
const GITHUB_REPOS_API = 'https://api.github.com/repos';
|
|
10
10
|
const GITHUB_RAW_CONTENT_API_PATH = 'https://raw.githubusercontent.com';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
function getAdditionalHeaders() {
|
|
12
|
+
const headers = {};
|
|
13
|
+
if (global && global.githubToken) {
|
|
14
|
+
headers.authorization = `Bearer ${global.githubToken}`;
|
|
15
|
+
}
|
|
16
|
+
else if (process.env.GITHUB_TOKEN) {
|
|
17
|
+
headers.authorization = `Bearer ${process.env.GITHUB_TOKEN}`;
|
|
18
|
+
}
|
|
19
|
+
return headers;
|
|
20
|
+
}
|
|
14
21
|
// Returns information about the repo's releases. Defaults to "latest" if no tag is provided
|
|
15
22
|
// https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#get-a-release-by-tag-name
|
|
16
|
-
|
|
23
|
+
function fetchRepoReleaseData(repoPath, tag = '') {
|
|
17
24
|
const URL = `${GITHUB_REPOS_API}/${repoPath}/releases`;
|
|
18
25
|
return axios_1.default.get(`${URL}/${tag ? `tags/${tag}` : 'latest'}`, {
|
|
19
|
-
headers: {
|
|
26
|
+
headers: {
|
|
27
|
+
...(0, getAxiosConfig_1.getDefaultUserAgentHeader)(),
|
|
28
|
+
...getAdditionalHeaders(),
|
|
29
|
+
},
|
|
20
30
|
});
|
|
21
31
|
}
|
|
22
32
|
exports.fetchRepoReleaseData = fetchRepoReleaseData;
|
|
23
33
|
// Returns the entire repo content as a zip, using the zipball_url from fetchRepoReleaseData()
|
|
24
34
|
// https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#download-a-repository-archive-zip
|
|
25
|
-
|
|
35
|
+
function fetchRepoAsZip(zipUrl) {
|
|
26
36
|
return axios_1.default.get(zipUrl, {
|
|
27
37
|
responseType: 'arraybuffer',
|
|
28
|
-
headers: { ...(0, getAxiosConfig_1.getDefaultUserAgentHeader)(), ...
|
|
38
|
+
headers: { ...(0, getAxiosConfig_1.getDefaultUserAgentHeader)(), ...getAdditionalHeaders() },
|
|
29
39
|
});
|
|
30
40
|
}
|
|
31
41
|
exports.fetchRepoAsZip = fetchRepoAsZip;
|
|
32
42
|
// Returns the raw file contents via the raw.githubusercontent endpoint
|
|
33
|
-
|
|
43
|
+
function fetchRepoFile(repoPath, filePath, ref) {
|
|
34
44
|
return axios_1.default.get(`${GITHUB_RAW_CONTENT_API_PATH}/${repoPath}/${ref}/${filePath}`, {
|
|
35
|
-
headers: {
|
|
45
|
+
headers: {
|
|
46
|
+
...(0, getAxiosConfig_1.getDefaultUserAgentHeader)(),
|
|
47
|
+
...getAdditionalHeaders(),
|
|
48
|
+
},
|
|
36
49
|
});
|
|
37
50
|
}
|
|
38
51
|
exports.fetchRepoFile = fetchRepoFile;
|
|
39
52
|
// Returns the raw file contents via the raw.githubusercontent endpoint
|
|
40
|
-
|
|
53
|
+
function fetchRepoFileByDownloadUrl(downloadUrl) {
|
|
41
54
|
return axios_1.default.get(downloadUrl, {
|
|
42
|
-
headers: { ...(0, getAxiosConfig_1.getDefaultUserAgentHeader)(), ...
|
|
55
|
+
headers: { ...(0, getAxiosConfig_1.getDefaultUserAgentHeader)(), ...getAdditionalHeaders() },
|
|
56
|
+
responseType: 'arraybuffer',
|
|
43
57
|
});
|
|
44
58
|
}
|
|
45
59
|
exports.fetchRepoFileByDownloadUrl = fetchRepoFileByDownloadUrl;
|
|
46
60
|
// Returns the contents of a file or directory in a repository by path
|
|
47
61
|
// https://docs.github.com/en/rest/repos/contents?apiVersion=2022-11-28#get-repository-content
|
|
48
|
-
|
|
62
|
+
function fetchRepoContents(repoPath, path, ref) {
|
|
49
63
|
const refQuery = ref ? `?ref=${ref}` : '';
|
|
50
64
|
return axios_1.default.get(`${GITHUB_REPOS_API}/${repoPath}/contents/${path}${refQuery}`, {
|
|
51
|
-
headers: {
|
|
65
|
+
headers: {
|
|
66
|
+
...(0, getAxiosConfig_1.getDefaultUserAgentHeader)(),
|
|
67
|
+
...getAdditionalHeaders(),
|
|
68
|
+
},
|
|
52
69
|
});
|
|
53
70
|
}
|
|
54
71
|
exports.fetchRepoContents = fetchRepoContents;
|
package/api/hubdb.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { QueryParams } from '../types/Http';
|
|
2
|
-
import { CreateRowsResponse, FetchRowsResponse, Row, Schema, Table } from '../types/Hubdb';
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
1
|
+
import { HubSpotPromise, QueryParams } from '../types/Http';
|
|
2
|
+
import { CreateRowsResponse, FetchRowsResponse, Row, Schema, Table, FetchTablesResponse } from '../types/Hubdb';
|
|
3
|
+
export declare function fetchTables(accountId: number): HubSpotPromise<FetchTablesResponse>;
|
|
4
|
+
export declare function fetchTable(accountId: number, tableId: string): HubSpotPromise<Table>;
|
|
5
|
+
export declare function createTable(accountId: number, schema: Schema): HubSpotPromise<Table>;
|
|
6
|
+
export declare function updateTable(accountId: number, tableId: string, schema: Schema): HubSpotPromise<Table>;
|
|
7
|
+
export declare function publishTable(accountId: number, tableId: string): HubSpotPromise<Table>;
|
|
8
|
+
export declare function deleteTable(accountId: number, tableId: string): HubSpotPromise<void>;
|
|
9
|
+
export declare function createRows(accountId: number, tableId: string, rows: Array<Row>): HubSpotPromise<CreateRowsResponse>;
|
|
10
|
+
export declare function fetchRows(accountId: number, tableId: string, params?: QueryParams): HubSpotPromise<FetchRowsResponse>;
|
|
11
|
+
export declare function deleteRows(accountId: number, tableId: string, rowIds: Array<string>): HubSpotPromise<void>;
|
package/api/hubdb.js
CHANGED
|
@@ -1,33 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.deleteRows = exports.fetchRows = exports.createRows = exports.deleteTable = exports.publishTable = exports.updateTable = exports.createTable = exports.fetchTable = void 0;
|
|
7
|
-
const http_1 =
|
|
3
|
+
exports.deleteRows = exports.fetchRows = exports.createRows = exports.deleteTable = exports.publishTable = exports.updateTable = exports.createTable = exports.fetchTable = exports.fetchTables = void 0;
|
|
4
|
+
const http_1 = require("../http");
|
|
8
5
|
const HUBDB_API_PATH = 'cms/v3/hubdb';
|
|
9
|
-
|
|
10
|
-
return http_1.
|
|
6
|
+
function fetchTables(accountId) {
|
|
7
|
+
return http_1.http.get(accountId, {
|
|
8
|
+
url: `${HUBDB_API_PATH}/tables`,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
exports.fetchTables = fetchTables;
|
|
12
|
+
function fetchTable(accountId, tableId) {
|
|
13
|
+
return http_1.http.get(accountId, {
|
|
11
14
|
url: `${HUBDB_API_PATH}/tables/${tableId}`,
|
|
12
15
|
});
|
|
13
16
|
}
|
|
14
17
|
exports.fetchTable = fetchTable;
|
|
15
|
-
|
|
16
|
-
return http_1.
|
|
18
|
+
function createTable(accountId, schema) {
|
|
19
|
+
return http_1.http.post(accountId, {
|
|
17
20
|
url: `${HUBDB_API_PATH}/tables`,
|
|
18
21
|
data: schema,
|
|
19
22
|
});
|
|
20
23
|
}
|
|
21
24
|
exports.createTable = createTable;
|
|
22
|
-
|
|
23
|
-
return http_1.
|
|
25
|
+
function updateTable(accountId, tableId, schema) {
|
|
26
|
+
return http_1.http.patch(accountId, {
|
|
24
27
|
url: `${HUBDB_API_PATH}/tables/${tableId}/draft`,
|
|
25
28
|
data: schema,
|
|
26
29
|
});
|
|
27
30
|
}
|
|
28
31
|
exports.updateTable = updateTable;
|
|
29
|
-
|
|
30
|
-
return http_1.
|
|
32
|
+
function publishTable(accountId, tableId) {
|
|
33
|
+
return http_1.http.post(accountId, {
|
|
31
34
|
url: `${HUBDB_API_PATH}/tables/${tableId}/draft/publish`,
|
|
32
35
|
headers: {
|
|
33
36
|
'Content-Type': 'application/json',
|
|
@@ -35,28 +38,28 @@ async function publishTable(accountId, tableId) {
|
|
|
35
38
|
});
|
|
36
39
|
}
|
|
37
40
|
exports.publishTable = publishTable;
|
|
38
|
-
|
|
39
|
-
return http_1.
|
|
41
|
+
function deleteTable(accountId, tableId) {
|
|
42
|
+
return http_1.http.delete(accountId, {
|
|
40
43
|
url: `${HUBDB_API_PATH}/tables/${tableId}`,
|
|
41
44
|
});
|
|
42
45
|
}
|
|
43
46
|
exports.deleteTable = deleteTable;
|
|
44
|
-
|
|
45
|
-
return http_1.
|
|
47
|
+
function createRows(accountId, tableId, rows) {
|
|
48
|
+
return http_1.http.post(accountId, {
|
|
46
49
|
url: `${HUBDB_API_PATH}/tables/${tableId}/rows/draft/batch/create`,
|
|
47
50
|
data: { inputs: rows },
|
|
48
51
|
});
|
|
49
52
|
}
|
|
50
53
|
exports.createRows = createRows;
|
|
51
|
-
|
|
52
|
-
return http_1.
|
|
54
|
+
function fetchRows(accountId, tableId, params = {}) {
|
|
55
|
+
return http_1.http.get(accountId, {
|
|
53
56
|
url: `${HUBDB_API_PATH}/tables/${tableId}/rows/draft`,
|
|
54
57
|
params,
|
|
55
58
|
});
|
|
56
59
|
}
|
|
57
60
|
exports.fetchRows = fetchRows;
|
|
58
|
-
|
|
59
|
-
return http_1.
|
|
61
|
+
function deleteRows(accountId, tableId, rowIds) {
|
|
62
|
+
return http_1.http.post(accountId, {
|
|
60
63
|
url: `${HUBDB_API_PATH}/tables/${tableId}/rows/draft/batch/purge`,
|
|
61
64
|
data: { inputs: rowIds },
|
|
62
65
|
});
|
package/api/lighthouseScore.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Data, QueryParams } from '../types/Http';
|
|
1
|
+
import { Data, HubSpotPromise, QueryParams } from '../types/Http';
|
|
2
2
|
import { GetLighthouseScoreResponse, RequestLighthouseScoreResponse } from '../types/Lighthouse';
|
|
3
|
-
export declare function requestLighthouseScore(accountId: number, data?: Data):
|
|
4
|
-
export declare function getLighthouseScoreStatus(accountId: number, params?: QueryParams):
|
|
5
|
-
export declare function getLighthouseScore(accountId: number, params?: QueryParams):
|
|
3
|
+
export declare function requestLighthouseScore(accountId: number, data?: Data): HubSpotPromise<RequestLighthouseScoreResponse>;
|
|
4
|
+
export declare function getLighthouseScoreStatus(accountId: number, params?: QueryParams): HubSpotPromise<string>;
|
|
5
|
+
export declare function getLighthouseScore(accountId: number, params?: QueryParams): HubSpotPromise<GetLighthouseScoreResponse>;
|
package/api/lighthouseScore.js
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getLighthouseScore = exports.getLighthouseScoreStatus = exports.requestLighthouseScore = void 0;
|
|
7
|
-
const http_1 =
|
|
4
|
+
const http_1 = require("../http");
|
|
8
5
|
const LIGHTHOUSE_SCORE_API_BASE = 'quality-engine/v1/lighthouse';
|
|
9
|
-
|
|
10
|
-
return http_1.
|
|
6
|
+
function requestLighthouseScore(accountId, data = {}) {
|
|
7
|
+
return http_1.http.post(accountId, {
|
|
11
8
|
url: `${LIGHTHOUSE_SCORE_API_BASE}/request`,
|
|
12
9
|
data,
|
|
13
10
|
});
|
|
14
11
|
}
|
|
15
12
|
exports.requestLighthouseScore = requestLighthouseScore;
|
|
16
|
-
|
|
17
|
-
return http_1.
|
|
13
|
+
function getLighthouseScoreStatus(accountId, params = {}) {
|
|
14
|
+
return http_1.http.get(accountId, {
|
|
18
15
|
url: `${LIGHTHOUSE_SCORE_API_BASE}/status`,
|
|
19
16
|
params,
|
|
20
17
|
});
|
|
21
18
|
}
|
|
22
19
|
exports.getLighthouseScoreStatus = getLighthouseScoreStatus;
|
|
23
|
-
|
|
24
|
-
return http_1.
|
|
20
|
+
function getLighthouseScore(accountId, params = {}) {
|
|
21
|
+
return http_1.http.get(accountId, {
|
|
25
22
|
url: `${LIGHTHOUSE_SCORE_API_BASE}/scores`,
|
|
26
23
|
params,
|
|
27
24
|
});
|
package/api/localDevAuth.d.ts
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
import { Environment } from '../types/Config';
|
|
2
|
-
import { ScopeData } from '../types/Accounts';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[key: string]: number;
|
|
12
|
-
};
|
|
13
|
-
scopeGroups: Array<string>;
|
|
14
|
-
encodedOAuthRefreshToken: string;
|
|
15
|
-
hubName: string;
|
|
16
|
-
accountType: ValueOf<typeof HUBSPOT_ACCOUNT_TYPES>;
|
|
17
|
-
};
|
|
18
|
-
export declare function fetchAccessToken(personalAccessKey: string, env?: Environment, portalId?: number): Promise<AccessTokenResponse>;
|
|
19
|
-
export declare function fetchScopeData(accountId: number, scopeGroup: string): Promise<ScopeData>;
|
|
20
|
-
export {};
|
|
2
|
+
import { ScopeData, AccessTokenResponse, EnabledFeaturesResponse, ScopeAuthorizationResponse } from '../types/Accounts';
|
|
3
|
+
import { PublicAppInstallationData } from '../types/Apps';
|
|
4
|
+
import { HubSpotPromise } from '../types/Http';
|
|
5
|
+
export declare const LOCALDEVAUTH_ACCESS_TOKEN_PATH: string;
|
|
6
|
+
export declare function fetchAccessToken(personalAccessKey: string, env?: Environment, portalId?: number): HubSpotPromise<AccessTokenResponse>;
|
|
7
|
+
export declare function fetchScopeData(accountId: number, scopeGroup: string): HubSpotPromise<ScopeData>;
|
|
8
|
+
export declare function fetchScopeAuthorizationData(accountId: number): HubSpotPromise<ScopeAuthorizationResponse>;
|
|
9
|
+
export declare function fetchAppInstallationData(portalId: number, projectId: number, appUid: string, requiredScopeGroups: Array<string>, optionalScopeGroups?: Array<string>): HubSpotPromise<PublicAppInstallationData>;
|
|
10
|
+
export declare function fetchEnabledFeatures(accountId: number): Promise<import("axios").AxiosResponse<EnabledFeaturesResponse, any>>;
|
package/api/localDevAuth.js
CHANGED
|
@@ -3,33 +3,58 @@ 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.fetchScopeData = exports.fetchAccessToken = void 0;
|
|
6
|
+
exports.fetchEnabledFeatures = exports.fetchAppInstallationData = exports.fetchScopeAuthorizationData = exports.fetchScopeData = exports.fetchAccessToken = exports.LOCALDEVAUTH_ACCESS_TOKEN_PATH = void 0;
|
|
7
7
|
const getAxiosConfig_1 = require("../http/getAxiosConfig");
|
|
8
|
-
const http_1 =
|
|
8
|
+
const http_1 = require("../http");
|
|
9
9
|
const environments_1 = require("../constants/environments");
|
|
10
10
|
const axios_1 = __importDefault(require("axios"));
|
|
11
11
|
const LOCALDEVAUTH_API_AUTH_PATH = 'localdevauth/v1/auth';
|
|
12
|
-
|
|
12
|
+
exports.LOCALDEVAUTH_ACCESS_TOKEN_PATH = `${LOCALDEVAUTH_API_AUTH_PATH}/refresh`;
|
|
13
|
+
function fetchAccessToken(personalAccessKey, env = environments_1.ENVIRONMENTS.PROD, portalId) {
|
|
13
14
|
const axiosConfig = (0, getAxiosConfig_1.getAxiosConfig)({
|
|
14
15
|
env,
|
|
15
16
|
localHostOverride: true,
|
|
16
|
-
url:
|
|
17
|
+
url: exports.LOCALDEVAUTH_ACCESS_TOKEN_PATH,
|
|
17
18
|
data: {
|
|
18
19
|
encodedOAuthRefreshToken: personalAccessKey,
|
|
19
20
|
},
|
|
20
21
|
params: portalId ? { portalId } : {},
|
|
21
22
|
});
|
|
22
|
-
|
|
23
|
+
return (0, axios_1.default)({
|
|
23
24
|
...axiosConfig,
|
|
24
25
|
method: 'post',
|
|
25
26
|
});
|
|
26
|
-
return data;
|
|
27
27
|
}
|
|
28
28
|
exports.fetchAccessToken = fetchAccessToken;
|
|
29
|
-
|
|
30
|
-
return http_1.
|
|
31
|
-
url:
|
|
29
|
+
function fetchScopeData(accountId, scopeGroup) {
|
|
30
|
+
return http_1.http.get(accountId, {
|
|
31
|
+
url: `${LOCALDEVAUTH_API_AUTH_PATH}/check-scopes`,
|
|
32
32
|
params: { scopeGroup },
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
exports.fetchScopeData = fetchScopeData;
|
|
36
|
+
async function fetchScopeAuthorizationData(accountId) {
|
|
37
|
+
return http_1.http.get(accountId, {
|
|
38
|
+
url: `${LOCALDEVAUTH_API_AUTH_PATH}/scope-groups/authorized`,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
exports.fetchScopeAuthorizationData = fetchScopeAuthorizationData;
|
|
42
|
+
function fetchAppInstallationData(portalId, projectId, appUid, requiredScopeGroups, optionalScopeGroups = []) {
|
|
43
|
+
return http_1.http.post(portalId, {
|
|
44
|
+
url: `${LOCALDEVAUTH_API_AUTH_PATH}/install-info`,
|
|
45
|
+
data: {
|
|
46
|
+
portalId,
|
|
47
|
+
projectId,
|
|
48
|
+
sourceId: appUid,
|
|
49
|
+
requiredScopeGroups,
|
|
50
|
+
optionalScopeGroups,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
exports.fetchAppInstallationData = fetchAppInstallationData;
|
|
55
|
+
async function fetchEnabledFeatures(accountId) {
|
|
56
|
+
return http_1.http.get(accountId, {
|
|
57
|
+
url: `${LOCALDEVAUTH_API_AUTH_PATH}/enabled-features`,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
exports.fetchEnabledFeatures = fetchEnabledFeatures;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Data, QueryParams } from '../types/Http';
|
|
1
|
+
import { Data, HubSpotPromise, QueryParams } from '../types/Http';
|
|
2
2
|
import { GetValidationResultsResponse } from '../types/MarketplaceValidation';
|
|
3
|
-
export declare function requestValidation(accountId: number, data?: Data):
|
|
4
|
-
export declare function getValidationStatus(accountId: number, params?: QueryParams):
|
|
5
|
-
export declare function getValidationResults(accountId: number, params?: QueryParams):
|
|
3
|
+
export declare function requestValidation(accountId: number, data?: Data): HubSpotPromise<number>;
|
|
4
|
+
export declare function getValidationStatus(accountId: number, params?: QueryParams): HubSpotPromise<string>;
|
|
5
|
+
export declare function getValidationResults(accountId: number, params?: QueryParams): HubSpotPromise<GetValidationResultsResponse>;
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getValidationResults = exports.getValidationStatus = exports.requestValidation = void 0;
|
|
7
|
-
const http_1 =
|
|
4
|
+
const http_1 = require("../http");
|
|
8
5
|
const VALIDATION_API_BASE = 'quality-engine/v1/validation';
|
|
9
6
|
function requestValidation(accountId, data = {}) {
|
|
10
|
-
return http_1.
|
|
7
|
+
return http_1.http.post(accountId, {
|
|
11
8
|
url: `${VALIDATION_API_BASE}/request`,
|
|
12
9
|
data,
|
|
13
10
|
});
|
|
14
11
|
}
|
|
15
12
|
exports.requestValidation = requestValidation;
|
|
16
13
|
function getValidationStatus(accountId, params = {}) {
|
|
17
|
-
return http_1.
|
|
14
|
+
return http_1.http.get(accountId, {
|
|
18
15
|
url: `${VALIDATION_API_BASE}/status`,
|
|
19
16
|
params,
|
|
20
17
|
});
|
|
21
18
|
}
|
|
22
19
|
exports.getValidationStatus = getValidationStatus;
|
|
23
20
|
function getValidationResults(accountId, params = {}) {
|
|
24
|
-
return http_1.
|
|
21
|
+
return http_1.http.get(accountId, {
|
|
25
22
|
url: `${VALIDATION_API_BASE}/results`,
|
|
26
23
|
params,
|
|
27
24
|
});
|
package/api/projects.d.ts
CHANGED
|
@@ -1,38 +1,50 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
3
|
-
import {
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { HubSpotPromise, QueryParams } from '../types/Http';
|
|
4
|
+
import { Project, FetchProjectResponse, UploadProjectResponse, ProjectSettings, FetchPlatformVersionResponse, WarnLogsResponse, UploadIRResponse } from '../types/Project';
|
|
4
5
|
import { Build, FetchProjectBuildsResponse } from '../types/Build';
|
|
5
|
-
import {
|
|
6
|
+
import { ComponentStructureResponse, ProjectComponentsMetadata } from '../types/ComponentStructure';
|
|
6
7
|
import { Deploy, ProjectDeployResponse } from '../types/Deploy';
|
|
7
|
-
import {
|
|
8
|
-
export declare function fetchProjects(accountId: number):
|
|
9
|
-
export declare function createProject(accountId: number, name: string):
|
|
10
|
-
export declare function uploadProject(accountId: number, projectName: string, projectFile: string, uploadMessage: string, platformVersion?: string):
|
|
11
|
-
export declare function fetchProject(accountId: number, projectName: string):
|
|
12
|
-
export declare function
|
|
13
|
-
export declare function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export declare function
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function
|
|
22
|
-
export declare function
|
|
23
|
-
export declare function
|
|
24
|
-
export declare function
|
|
25
|
-
export declare function
|
|
26
|
-
export declare function
|
|
27
|
-
export declare function
|
|
28
|
-
export declare function
|
|
29
|
-
export declare function
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
8
|
+
import { MigrateAppResponse, CloneAppResponse, PollAppResponse } from '../types/Migration';
|
|
9
|
+
export declare function fetchProjects(accountId: number): HubSpotPromise<FetchProjectResponse>;
|
|
10
|
+
export declare function createProject(accountId: number, name: string): HubSpotPromise<Project>;
|
|
11
|
+
export declare function uploadProject(accountId: number, projectName: string, projectFile: string, uploadMessage: string, platformVersion?: string, intermediateRepresentation?: unknown): HubSpotPromise<UploadProjectResponse | UploadIRResponse>;
|
|
12
|
+
export declare function fetchProject(accountId: number, projectName: string): HubSpotPromise<Project>;
|
|
13
|
+
export declare function fetchProjectComponentsMetadata(accountId: number, projectId: number): HubSpotPromise<ProjectComponentsMetadata>;
|
|
14
|
+
export declare function downloadProject(accountId: number, projectName: string, buildId: number): HubSpotPromise<Buffer>;
|
|
15
|
+
export declare function deleteProject(accountId: number, projectName: string): HubSpotPromise<void>;
|
|
16
|
+
export declare function fetchPlatformVersions(accountId: number): HubSpotPromise<FetchPlatformVersionResponse>;
|
|
17
|
+
export declare function fetchProjectBuilds(accountId: number, projectName: string, params?: QueryParams): HubSpotPromise<FetchProjectBuildsResponse>;
|
|
18
|
+
export declare function getBuildStatus(accountId: number, projectName: string, buildId: number): HubSpotPromise<Build>;
|
|
19
|
+
export declare function getBuildStructure(accountId: number, projectName: string, buildId: number): HubSpotPromise<ComponentStructureResponse>;
|
|
20
|
+
export declare function deployProject(accountId: number, projectName: string, buildId: number, useNewDeployApi?: boolean): HubSpotPromise<ProjectDeployResponse>;
|
|
21
|
+
export declare function getDeployStatus(accountId: number, projectName: string, deployId: number): HubSpotPromise<Deploy>;
|
|
22
|
+
export declare function getDeployStructure(accountId: number, projectName: string, deployId: number): HubSpotPromise<ComponentStructureResponse>;
|
|
23
|
+
export declare function fetchProjectSettings(accountId: number, projectName: string): HubSpotPromise<ProjectSettings>;
|
|
24
|
+
export declare function provisionBuild(accountId: number, projectName: string, platformVersion?: string): HubSpotPromise<Build>;
|
|
25
|
+
export declare function queueBuild(accountId: number, projectName: string, platformVersion?: string): HubSpotPromise<void>;
|
|
26
|
+
export declare function uploadFileToBuild(accountId: number, projectName: string, filePath: string, path: string): HubSpotPromise<void>;
|
|
27
|
+
export declare function deleteFileFromBuild(accountId: number, projectName: string, path: string): HubSpotPromise<void>;
|
|
28
|
+
export declare function cancelStagedBuild(accountId: number, projectName: string): HubSpotPromise<void>;
|
|
29
|
+
export declare function fetchBuildWarnLogs(accountId: number, projectName: string, buildId: number): HubSpotPromise<WarnLogsResponse>;
|
|
30
|
+
export declare function fetchDeployWarnLogs(accountId: number, projectName: string, deployId: number): HubSpotPromise<WarnLogsResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated
|
|
33
|
+
*/
|
|
34
|
+
export declare function migrateApp(accountId: number, appId: number, projectName: string): HubSpotPromise<MigrateAppResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated
|
|
37
|
+
*/
|
|
38
|
+
export declare function checkMigrationStatus(accountId: number, id: number): HubSpotPromise<PollAppResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated
|
|
41
|
+
*/
|
|
42
|
+
export declare function cloneApp(accountId: number, appId: number): HubSpotPromise<CloneAppResponse>;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated
|
|
45
|
+
*/
|
|
46
|
+
export declare function checkCloneStatus(accountId: number, exportId: number): HubSpotPromise<CloneAppResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated
|
|
49
|
+
*/
|
|
50
|
+
export declare function downloadClonedProject(accountId: number, exportId: number): HubSpotPromise<Buffer>;
|