@hubspot/local-dev-lib 4.0.4 → 5.0.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.
- package/api/appsDev.d.ts +2 -2
- package/api/appsDev.js +13 -22
- package/api/crm.d.ts +2 -2
- package/api/crm.js +9 -16
- package/api/customObjects.d.ts +2 -2
- package/api/customObjects.js +13 -22
- package/api/designManager.d.ts +2 -2
- package/api/designManager.js +5 -10
- package/api/devSecrets.d.ts +2 -2
- package/api/devSecrets.js +9 -16
- package/api/developerTestAccounts.d.ts +3 -3
- package/api/developerTestAccounts.js +29 -40
- package/api/fileManager.d.ts +2 -2
- package/api/fileManager.js +14 -24
- package/api/fileMapper.d.ts +2 -2
- package/api/fileMapper.js +34 -49
- package/api/fileTransport.d.ts +1 -1
- package/api/fileTransport.js +12 -21
- package/api/fireAlarm.d.ts +2 -2
- package/api/fireAlarm.js +5 -9
- package/api/functions.d.ts +2 -2
- package/api/functions.js +11 -19
- package/api/github.d.ts +2 -4
- package/api/github.js +16 -27
- package/api/hubdb.d.ts +2 -2
- package/api/hubdb.js +19 -31
- package/api/lighthouseScore.d.ts +2 -2
- package/api/lighthouseScore.js +7 -13
- package/api/localDevAuth.d.ts +5 -5
- package/api/localDevAuth.js +17 -25
- package/api/marketplaceValidation.d.ts +2 -2
- package/api/marketplaceValidation.js +7 -13
- package/api/projects.d.ts +6 -8
- package/api/projects.js +65 -100
- package/api/sandboxHubs.d.ts +3 -3
- package/api/sandboxHubs.js +21 -30
- package/api/sandboxSync.d.ts +2 -2
- package/api/sandboxSync.js +7 -12
- package/api/secrets.d.ts +2 -2
- package/api/secrets.js +9 -16
- package/api/validateHubl.d.ts +2 -2
- package/api/validateHubl.js +3 -7
- package/config/defaultAccountOverride.js +18 -26
- package/config/index.d.ts +4 -4
- package/config/index.js +141 -177
- package/config/migrate.d.ts +2 -2
- package/config/migrate.js +26 -37
- package/config/state.d.ts +1 -1
- package/config/state.js +17 -45
- package/config/utils.d.ts +4 -4
- package/config/utils.js +85 -108
- package/constants/api.js +3 -6
- package/constants/auth.js +9 -12
- package/constants/config.js +37 -43
- package/constants/environments.js +1 -4
- package/constants/extensions.js +6 -9
- package/constants/files.js +5 -8
- package/constants/ports.js +3 -6
- package/constants/projects.js +2 -5
- package/enums/build.js +5 -8
- package/enums/deploy.js +2 -5
- package/enums/project.js +1 -4
- package/errors/errors_DEPRECATED.d.ts +1 -1
- package/errors/errors_DEPRECATED.js +2 -7
- package/errors/index.d.ts +4 -4
- package/errors/index.js +17 -31
- package/http/addQueryParams.d.ts +1 -1
- package/http/addQueryParams.js +1 -5
- package/http/client.js +16 -42
- package/http/getAxiosConfig.d.ts +1 -1
- package/http/getAxiosConfig.js +21 -31
- package/http/index.d.ts +2 -2
- package/http/index.js +39 -46
- package/http/unauthed.d.ts +1 -1
- package/http/unauthed.js +15 -18
- package/lib/archive.d.ts +1 -3
- package/lib/archive.js +38 -67
- package/lib/cms/functions.d.ts +1 -1
- package/lib/cms/functions.js +45 -55
- package/lib/cms/handleFieldsJS.js +36 -44
- package/lib/cms/modules.d.ts +2 -2
- package/lib/cms/modules.js +49 -59
- package/lib/cms/processFieldsJs.js +17 -32
- package/lib/cms/templates.js +17 -26
- package/lib/cms/themes.js +10 -18
- package/lib/cms/uploadFolder.d.ts +4 -4
- package/lib/cms/uploadFolder.js +55 -64
- package/lib/cms/validate.d.ts +1 -1
- package/lib/cms/validate.js +11 -18
- package/lib/cms/watch.d.ts +2 -2
- package/lib/cms/watch.js +66 -73
- package/lib/crm.d.ts +1 -1
- package/lib/crm.js +16 -23
- package/lib/customObjects.d.ts +1 -1
- package/lib/customObjects.js +15 -25
- package/lib/environment.d.ts +1 -1
- package/lib/environment.js +5 -11
- package/lib/escapeRegExp.js +1 -5
- package/lib/fileManager.js +43 -51
- package/lib/fileMapper.d.ts +1 -1
- package/lib/fileMapper.js +70 -84
- package/lib/fs.d.ts +1 -1
- package/lib/fs.js +18 -27
- package/lib/github.d.ts +1 -3
- package/lib/github.js +39 -51
- package/lib/gitignore.d.ts +1 -1
- package/lib/gitignore.js +16 -24
- package/lib/hubdb.d.ts +1 -1
- package/lib/hubdb.js +29 -40
- package/lib/ignoreRules.js +25 -34
- package/lib/isDeepEqual.js +1 -5
- package/lib/logger.d.ts +8 -20
- package/lib/logger.js +47 -59
- package/lib/notify.js +9 -16
- package/lib/oauth.d.ts +2 -2
- package/lib/oauth.js +12 -17
- package/lib/path.d.ts +0 -1
- package/lib/path.js +30 -48
- package/lib/personalAccessKey.d.ts +3 -3
- package/lib/personalAccessKey.js +47 -59
- package/lib/portManager.d.ts +2 -2
- package/lib/portManager.js +26 -41
- package/lib/text.js +2 -7
- package/lib/trackUsage.d.ts +2 -2
- package/lib/trackUsage.js +26 -29
- package/lib/urls.js +4 -9
- package/models/FileSystemError.d.ts +1 -1
- package/models/FileSystemError.js +12 -16
- package/models/HubSpotConfigError.d.ts +1 -1
- package/models/HubSpotConfigError.js +8 -12
- package/models/HubSpotHttpError.d.ts +1 -1
- package/models/HubSpotHttpError.js +22 -26
- package/models/OAuth2Manager.d.ts +1 -1
- package/models/OAuth2Manager.js +17 -24
- package/package.json +17 -16
- package/types/Accounts.d.ts +5 -5
- package/types/Accounts.js +1 -2
- package/types/Activity.d.ts +3 -3
- package/types/Activity.js +1 -2
- package/types/Api.d.ts +1 -1
- package/types/Api.js +1 -2
- package/types/Apps.js +1 -2
- package/types/Archive.js +1 -2
- package/types/Build.d.ts +5 -5
- package/types/Build.js +1 -2
- package/types/CLIOptions.js +1 -2
- package/types/ComponentStructure.d.ts +2 -2
- package/types/ComponentStructure.js +1 -2
- package/types/Config.d.ts +5 -5
- package/types/Config.js +1 -2
- package/types/Crm.js +1 -2
- package/types/Deploy.d.ts +5 -5
- package/types/Deploy.js +1 -2
- package/types/DesignManager.js +1 -2
- package/types/DevSecrets.js +1 -2
- package/types/Error.js +1 -2
- package/types/FieldsJS.js +1 -2
- package/types/FileManager.js +1 -2
- package/types/Files.d.ts +4 -4
- package/types/Files.js +1 -2
- package/types/FireAlarm.js +1 -2
- package/types/Functions.js +1 -2
- package/types/Github.d.ts +1 -1
- package/types/Github.js +1 -2
- package/types/Http.d.ts +0 -4
- package/types/Http.js +1 -2
- package/types/Hubdb.js +1 -2
- package/types/HublValidation.js +1 -2
- package/types/Lang.d.ts +1 -1
- package/types/Lang.js +1 -2
- package/types/Lighthouse.js +1 -2
- package/types/MarketplaceValidation.js +1 -2
- package/types/Migration.d.ts +2 -2
- package/types/Migration.js +1 -4
- package/types/Modules.js +1 -2
- package/types/PortManager.js +1 -2
- package/types/Project.d.ts +3 -3
- package/types/Project.js +1 -2
- package/types/ProjectLog.js +1 -2
- package/types/Sandbox.js +2 -5
- package/types/Schemas.js +1 -2
- package/types/Secrets.js +1 -2
- package/types/Utils.js +1 -2
- package/types/developerTestAccounts.js +1 -2
- package/utils/PortManagerServer.d.ts +1 -2
- package/utils/PortManagerServer.js +32 -38
- package/utils/cms/fieldsJS.d.ts +1 -1
- package/utils/cms/fieldsJS.js +1 -5
- package/utils/cms/modules.d.ts +1 -1
- package/utils/cms/modules.js +13 -22
- package/utils/detectPort.js +12 -19
- package/utils/git.js +17 -26
- package/utils/lang.d.ts +1 -1
- package/utils/lang.js +5 -14
package/api/appsDev.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PublicApp, PublicAppInstallCounts, PublicAppDeveloperTestAccountInstallData, FetchPublicAppsForPortalResponse } from '../types/Apps';
|
|
2
|
-
import { HubSpotPromise } from '../types/Http';
|
|
1
|
+
import { PublicApp, PublicAppInstallCounts, PublicAppDeveloperTestAccountInstallData, FetchPublicAppsForPortalResponse } from '../types/Apps.js';
|
|
2
|
+
import { HubSpotPromise } from '../types/Http.js';
|
|
3
3
|
export declare function fetchPublicAppsForPortal(accountId: number): HubSpotPromise<FetchPublicAppsForPortalResponse>;
|
|
4
4
|
export declare function fetchPublicAppDeveloperTestAccountInstallData(appId: number, accountId: number): HubSpotPromise<PublicAppDeveloperTestAccountInstallData>;
|
|
5
5
|
export declare function fetchPublicAppProductionInstallCounts(appId: number, accountId: number): HubSpotPromise<PublicAppInstallCounts>;
|
package/api/appsDev.js
CHANGED
|
@@ -1,35 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchAppMetadataByUid = exports.installStaticAuthAppOnTestAccount = exports.fetchPublicAppMetadata = exports.fetchPublicAppProductionInstallCounts = exports.fetchPublicAppDeveloperTestAccountInstallData = exports.fetchPublicAppsForPortal = void 0;
|
|
4
|
-
const http_1 = require("../http");
|
|
1
|
+
import { http } from '../http/index.js';
|
|
5
2
|
const APPS_DEV_API_PATH = 'apps-dev/external/public/v3';
|
|
6
3
|
const APPS_HUBLETS_API_PATH = 'apps-hublets/external/static-token/v3';
|
|
7
|
-
function fetchPublicAppsForPortal(accountId) {
|
|
8
|
-
return
|
|
4
|
+
export function fetchPublicAppsForPortal(accountId) {
|
|
5
|
+
return http.get(accountId, {
|
|
9
6
|
url: `${APPS_DEV_API_PATH}/full/portal`,
|
|
10
7
|
});
|
|
11
8
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return http_1.http.get(accountId, {
|
|
9
|
+
export function fetchPublicAppDeveloperTestAccountInstallData(appId, accountId) {
|
|
10
|
+
return http.get(accountId, {
|
|
15
11
|
url: `${APPS_DEV_API_PATH}/${appId}/test-portal-installs`,
|
|
16
12
|
});
|
|
17
13
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return http_1.http.get(accountId, {
|
|
14
|
+
export function fetchPublicAppProductionInstallCounts(appId, accountId) {
|
|
15
|
+
return http.get(accountId, {
|
|
21
16
|
url: `${APPS_DEV_API_PATH}/${appId}/install-counts-without-test-portals`,
|
|
22
17
|
});
|
|
23
18
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return http_1.http.get(accountId, {
|
|
19
|
+
export function fetchPublicAppMetadata(appId, accountId) {
|
|
20
|
+
return http.get(accountId, {
|
|
27
21
|
url: `${APPS_DEV_API_PATH}/${appId}/full`,
|
|
28
22
|
});
|
|
29
23
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return http_1.http.post(accountId, {
|
|
24
|
+
export function installStaticAuthAppOnTestAccount(appId, accountId, scopeGroupIds) {
|
|
25
|
+
return http.post(accountId, {
|
|
33
26
|
url: APPS_HUBLETS_API_PATH,
|
|
34
27
|
data: {
|
|
35
28
|
appId,
|
|
@@ -38,13 +31,11 @@ function installStaticAuthAppOnTestAccount(appId, accountId, scopeGroupIds) {
|
|
|
38
31
|
},
|
|
39
32
|
});
|
|
40
33
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return http_1.http.get(accountId, {
|
|
34
|
+
export function fetchAppMetadataByUid(appUid, accountId) {
|
|
35
|
+
return http.get(accountId, {
|
|
44
36
|
url: `${APPS_DEV_API_PATH}/full/portal/sourceId`,
|
|
45
37
|
params: {
|
|
46
38
|
sourceId: appUid,
|
|
47
39
|
},
|
|
48
40
|
});
|
|
49
41
|
}
|
|
50
|
-
exports.fetchAppMetadataByUid = fetchAppMetadataByUid;
|
package/api/crm.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { HubSpotPromise } from '../types/Http';
|
|
2
|
-
import { ImportRequest, ImportResponse } from '../types/Crm';
|
|
1
|
+
import { HubSpotPromise } from '../types/Http.js';
|
|
2
|
+
import { ImportRequest, ImportResponse } from '../types/Crm.js';
|
|
3
3
|
export declare function createImport(accountId: number, importRequest: ImportRequest, dataFileNames: string[]): HubSpotPromise<ImportResponse>;
|
package/api/crm.js
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
exports.createImport = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
|
-
const form_data_1 = __importDefault(require("form-data"));
|
|
10
|
-
const http_1 = require("../http");
|
|
11
|
-
const path_2 = require("../lib/path");
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import FormData from 'form-data';
|
|
4
|
+
import { http } from '../http/index.js';
|
|
5
|
+
import { getCwd } from '../lib/path.js';
|
|
12
6
|
const HUBSPOT_CRM_IMPORT_PATH = '/crm/v3/imports';
|
|
13
|
-
function createImport(accountId, importRequest, dataFileNames) {
|
|
7
|
+
export function createImport(accountId, importRequest, dataFileNames) {
|
|
14
8
|
const jsonImportRequest = JSON.stringify(importRequest);
|
|
15
|
-
const formData = new
|
|
9
|
+
const formData = new FormData();
|
|
16
10
|
formData.append('importRequest', jsonImportRequest);
|
|
17
11
|
dataFileNames.forEach(file => {
|
|
18
|
-
const stream =
|
|
12
|
+
const stream = fs.createReadStream(path.resolve(getCwd(), file));
|
|
19
13
|
formData.append('files', stream, file);
|
|
20
14
|
});
|
|
21
|
-
return
|
|
15
|
+
return http.post(accountId, {
|
|
22
16
|
url: `${HUBSPOT_CRM_IMPORT_PATH}`,
|
|
23
17
|
data: formData,
|
|
24
18
|
headers: {
|
|
@@ -26,4 +20,3 @@ function createImport(accountId, importRequest, dataFileNames) {
|
|
|
26
20
|
},
|
|
27
21
|
});
|
|
28
22
|
}
|
|
29
|
-
exports.createImport = createImport;
|
package/api/customObjects.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FetchSchemasResponse, Schema, SchemaDefinition, ObjectDefinition, CreateObjectsResponse } from '../types/Schemas';
|
|
2
|
-
import { HubSpotPromise } from '../types/Http';
|
|
1
|
+
import { FetchSchemasResponse, Schema, SchemaDefinition, ObjectDefinition, CreateObjectsResponse } from '../types/Schemas.js';
|
|
2
|
+
import { HubSpotPromise } from '../types/Http.js';
|
|
3
3
|
export declare function batchCreateObjects(accountId: number, objectTypeId: string, objects: ObjectDefinition): HubSpotPromise<CreateObjectsResponse>;
|
|
4
4
|
export declare function createObjectSchema(accountId: number, schema: SchemaDefinition): HubSpotPromise<Schema>;
|
|
5
5
|
export declare function updateObjectSchema(accountId: number, schemaObjectType: string, schema: SchemaDefinition): HubSpotPromise<Schema>;
|
package/api/customObjects.js
CHANGED
|
@@ -1,45 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteObjectSchema = exports.fetchObjectSchemas = exports.fetchObjectSchema = exports.updateObjectSchema = exports.createObjectSchema = exports.batchCreateObjects = void 0;
|
|
4
|
-
const http_1 = require("../http");
|
|
1
|
+
import { http } from '../http/index.js';
|
|
5
2
|
const CUSTOM_OBJECTS_API_PATH = 'crm/v3/objects';
|
|
6
3
|
const SCHEMA_API_PATH = 'crm-object-schemas/v3/schemas';
|
|
7
|
-
function batchCreateObjects(accountId, objectTypeId, objects) {
|
|
8
|
-
return
|
|
4
|
+
export function batchCreateObjects(accountId, objectTypeId, objects) {
|
|
5
|
+
return http.post(accountId, {
|
|
9
6
|
url: `${CUSTOM_OBJECTS_API_PATH}/${objectTypeId}/batch/create`,
|
|
10
7
|
data: objects,
|
|
11
8
|
});
|
|
12
9
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return http_1.http.post(accountId, {
|
|
10
|
+
export function createObjectSchema(accountId, schema) {
|
|
11
|
+
return http.post(accountId, {
|
|
16
12
|
url: SCHEMA_API_PATH,
|
|
17
13
|
data: schema,
|
|
18
14
|
});
|
|
19
15
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return http_1.http.patch(accountId, {
|
|
16
|
+
export function updateObjectSchema(accountId, schemaObjectType, schema) {
|
|
17
|
+
return http.patch(accountId, {
|
|
23
18
|
url: `${SCHEMA_API_PATH}/${schemaObjectType}`,
|
|
24
19
|
data: schema,
|
|
25
20
|
});
|
|
26
21
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return http_1.http.get(accountId, {
|
|
22
|
+
export function fetchObjectSchema(accountId, schemaObjectType) {
|
|
23
|
+
return http.get(accountId, {
|
|
30
24
|
url: `${SCHEMA_API_PATH}/${schemaObjectType}`,
|
|
31
25
|
});
|
|
32
26
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return http_1.http.get(accountId, {
|
|
27
|
+
export function fetchObjectSchemas(accountId) {
|
|
28
|
+
return http.get(accountId, {
|
|
36
29
|
url: SCHEMA_API_PATH,
|
|
37
30
|
});
|
|
38
31
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return http_1.http.delete(accountId, {
|
|
32
|
+
export function deleteObjectSchema(accountId, schemaObjectType) {
|
|
33
|
+
return http.delete(accountId, {
|
|
42
34
|
url: `${SCHEMA_API_PATH}/${schemaObjectType}`,
|
|
43
35
|
});
|
|
44
36
|
}
|
|
45
|
-
exports.deleteObjectSchema = deleteObjectSchema;
|
package/api/designManager.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HubSpotPromise, QueryParams } from '../types/Http';
|
|
2
|
-
import { FetchThemesResponse, FetchBuiltinMappingResponse } from '../types/DesignManager';
|
|
1
|
+
import { HubSpotPromise, QueryParams } from '../types/Http.js';
|
|
2
|
+
import { FetchThemesResponse, FetchBuiltinMappingResponse } from '../types/DesignManager.js';
|
|
3
3
|
export declare function fetchThemes(accountId: number, params?: QueryParams): HubSpotPromise<FetchThemesResponse>;
|
|
4
4
|
export declare function fetchBuiltinMapping(accountId: number): HubSpotPromise<FetchBuiltinMappingResponse>;
|
package/api/designManager.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchBuiltinMapping = exports.fetchThemes = void 0;
|
|
4
|
-
const http_1 = require("../http");
|
|
1
|
+
import { http } from '../http/index.js';
|
|
5
2
|
const DESIGN_MANAGER_API_PATH = 'designmanager/v1';
|
|
6
|
-
function fetchThemes(accountId, params = {}) {
|
|
7
|
-
return
|
|
3
|
+
export function fetchThemes(accountId, params = {}) {
|
|
4
|
+
return http.get(accountId, {
|
|
8
5
|
url: `${DESIGN_MANAGER_API_PATH}/themes/combined`,
|
|
9
6
|
params,
|
|
10
7
|
});
|
|
11
8
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return http_1.http.get(accountId, {
|
|
9
|
+
export function fetchBuiltinMapping(accountId) {
|
|
10
|
+
return http.get(accountId, {
|
|
15
11
|
url: `${DESIGN_MANAGER_API_PATH}/widgets/builtin-mapping`,
|
|
16
12
|
});
|
|
17
13
|
}
|
|
18
|
-
exports.fetchBuiltinMapping = fetchBuiltinMapping;
|
package/api/devSecrets.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HubSpotPromise } from '../types/Http';
|
|
2
|
-
import { FetchDevSecretsResponse } from '../types/DevSecrets';
|
|
1
|
+
import { HubSpotPromise } from '../types/Http.js';
|
|
2
|
+
import { FetchDevSecretsResponse } from '../types/DevSecrets.js';
|
|
3
3
|
export declare function addAppSecret(accountId: number, appId: number, key: string, value: string): HubSpotPromise<void>;
|
|
4
4
|
export declare function updateAppSecret(accountId: number, appId: number, key: string, value: string): HubSpotPromise<void>;
|
|
5
5
|
export declare function deleteAppSecret(accountId: number, appId: number, key: string): HubSpotPromise<void>;
|
package/api/devSecrets.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchAppSecrets = exports.deleteAppSecret = exports.updateAppSecret = exports.addAppSecret = void 0;
|
|
4
|
-
const http_1 = require("../http");
|
|
1
|
+
import { http } from '../http/index.js';
|
|
5
2
|
const DEV_SECRETS_API_PATH = 'dev-secrets/management/v3';
|
|
6
|
-
function addAppSecret(accountId, appId, key, value) {
|
|
7
|
-
return
|
|
3
|
+
export function addAppSecret(accountId, appId, key, value) {
|
|
4
|
+
return http.post(accountId, {
|
|
8
5
|
url: `${DEV_SECRETS_API_PATH}/secrets/app/${appId}`,
|
|
9
6
|
data: {
|
|
10
7
|
key,
|
|
@@ -12,9 +9,8 @@ function addAppSecret(accountId, appId, key, value) {
|
|
|
12
9
|
},
|
|
13
10
|
});
|
|
14
11
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return http_1.http.patch(accountId, {
|
|
12
|
+
export function updateAppSecret(accountId, appId, key, value) {
|
|
13
|
+
return http.patch(accountId, {
|
|
18
14
|
url: `${DEV_SECRETS_API_PATH}/secrets/app/${appId}`,
|
|
19
15
|
data: {
|
|
20
16
|
key,
|
|
@@ -22,19 +18,16 @@ function updateAppSecret(accountId, appId, key, value) {
|
|
|
22
18
|
},
|
|
23
19
|
});
|
|
24
20
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return http_1.http.delete(accountId, {
|
|
21
|
+
export function deleteAppSecret(accountId, appId, key) {
|
|
22
|
+
return http.delete(accountId, {
|
|
28
23
|
url: `${DEV_SECRETS_API_PATH}/secrets/app/${appId}`,
|
|
29
24
|
data: {
|
|
30
25
|
key,
|
|
31
26
|
},
|
|
32
27
|
});
|
|
33
28
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return http_1.http.get(accountId, {
|
|
29
|
+
export function fetchAppSecrets(accountId, appId) {
|
|
30
|
+
return http.get(accountId, {
|
|
37
31
|
url: `${DEV_SECRETS_API_PATH}/keys/app/${appId}`,
|
|
38
32
|
});
|
|
39
33
|
}
|
|
40
|
-
exports.fetchAppSecrets = fetchAppSecrets;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DeveloperTestAccount, CreateDeveloperTestAccountResponse, FetchDeveloperTestAccountsResponse, DeveloperTestAccountConfig, CreateDeveloperTestAccountV3Response, InstallOauthAppIntoDeveloperTestAccountResponse, TestPortalStatusResponse, GenerateDeveloperTestAccountPersonalAccessKeyResponse } from '../types/developerTestAccounts';
|
|
2
|
-
import { Environment } from '../types/Config';
|
|
3
|
-
import { HubSpotPromise } from '../types/Http';
|
|
1
|
+
import { DeveloperTestAccount, CreateDeveloperTestAccountResponse, FetchDeveloperTestAccountsResponse, DeveloperTestAccountConfig, CreateDeveloperTestAccountV3Response, InstallOauthAppIntoDeveloperTestAccountResponse, TestPortalStatusResponse, GenerateDeveloperTestAccountPersonalAccessKeyResponse } from '../types/developerTestAccounts.js';
|
|
2
|
+
import { Environment } from '../types/Config.js';
|
|
3
|
+
import { HubSpotPromise } from '../types/Http.js';
|
|
4
4
|
export declare function fetchDeveloperTestAccounts(accountId: number): HubSpotPromise<FetchDeveloperTestAccountsResponse>;
|
|
5
5
|
export declare function createDeveloperTestAccount(accountId: number, accountInfo: string): HubSpotPromise<CreateDeveloperTestAccountResponse>;
|
|
6
6
|
export declare function createDeveloperTestAccount(accountId: number, accountInfo: DeveloperTestAccountConfig): HubSpotPromise<CreateDeveloperTestAccountV3Response>;
|
|
@@ -1,47 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const getAxiosConfig_1 = require("../http/getAxiosConfig");
|
|
7
|
-
const environments_1 = require("../constants/environments");
|
|
8
|
-
const api_1 = require("../constants/api");
|
|
1
|
+
import { httpClient } from '../http/client.js';
|
|
2
|
+
import { http } from '../http/index.js';
|
|
3
|
+
import { getAxiosConfig } from '../http/getAxiosConfig.js';
|
|
4
|
+
import { ENVIRONMENTS } from '../constants/environments.js';
|
|
5
|
+
import { SANDBOX_TIMEOUT } from '../constants/api.js';
|
|
9
6
|
const TEST_ACCOUNTS_API_PATH = 'integrators/test-portals/v2';
|
|
10
7
|
const TEST_ACCOUNTS_API_PATH_V3 = 'integrators/test-portals/v3';
|
|
11
|
-
function fetchDeveloperTestAccounts(accountId) {
|
|
12
|
-
return
|
|
8
|
+
export function fetchDeveloperTestAccounts(accountId) {
|
|
9
|
+
return http.get(accountId, {
|
|
13
10
|
url: TEST_ACCOUNTS_API_PATH,
|
|
14
11
|
});
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
function createDeveloperTestAccount(accountId, accountInfo) {
|
|
13
|
+
export function createDeveloperTestAccount(accountId, accountInfo) {
|
|
18
14
|
if (typeof accountInfo === 'object') {
|
|
19
|
-
return
|
|
15
|
+
return http.post(accountId, {
|
|
20
16
|
url: TEST_ACCOUNTS_API_PATH_V3,
|
|
21
17
|
data: accountInfo,
|
|
22
|
-
timeout:
|
|
18
|
+
timeout: SANDBOX_TIMEOUT,
|
|
23
19
|
});
|
|
24
20
|
}
|
|
25
|
-
return
|
|
21
|
+
return http.post(accountId, {
|
|
26
22
|
url: TEST_ACCOUNTS_API_PATH,
|
|
27
|
-
data: { accountName: accountInfo, generatePersonalAccessKey: true },
|
|
28
|
-
timeout:
|
|
23
|
+
data: { accountName: accountInfo, generatePersonalAccessKey: true }, // For CLI, generatePersonalAccessKey will always be true since we'll be saving the entry to the config
|
|
24
|
+
timeout: SANDBOX_TIMEOUT,
|
|
29
25
|
});
|
|
30
26
|
}
|
|
31
|
-
|
|
32
|
-
function deleteDeveloperTestAccount(accountId, testAccountId, useV3 = false) {
|
|
27
|
+
export function deleteDeveloperTestAccount(accountId, testAccountId, useV3 = false) {
|
|
33
28
|
if (useV3) {
|
|
34
|
-
return
|
|
29
|
+
return http.delete(accountId, {
|
|
35
30
|
url: `${TEST_ACCOUNTS_API_PATH_V3}/${testAccountId}`,
|
|
36
31
|
});
|
|
37
32
|
}
|
|
38
|
-
return
|
|
33
|
+
return http.delete(accountId, {
|
|
39
34
|
url: `${TEST_ACCOUNTS_API_PATH}/${testAccountId}`,
|
|
40
35
|
});
|
|
41
36
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const axiosConfig = (0, getAxiosConfig_1.getAxiosConfig)({
|
|
37
|
+
export function fetchDeveloperTestAccountData(accessToken, accountId, env = ENVIRONMENTS.PROD) {
|
|
38
|
+
const axiosConfig = getAxiosConfig({
|
|
45
39
|
env,
|
|
46
40
|
url: `${TEST_ACCOUNTS_API_PATH}/self`,
|
|
47
41
|
params: { portalId: accountId },
|
|
@@ -53,39 +47,34 @@ function fetchDeveloperTestAccountData(accessToken, accountId, env = environment
|
|
|
53
47
|
Authorization: `Bearer ${accessToken}`,
|
|
54
48
|
},
|
|
55
49
|
};
|
|
56
|
-
return
|
|
50
|
+
return httpClient(reqWithToken);
|
|
57
51
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return http_1.http.post(accountId, {
|
|
52
|
+
export function installOauthAppIntoDeveloperTestAccount(accountId, testAccountId, projectName, appUId) {
|
|
53
|
+
return http.post(accountId, {
|
|
61
54
|
url: `${TEST_ACCOUNTS_API_PATH_V3}/install-apps`,
|
|
62
55
|
data: {
|
|
63
56
|
testPortalId: testAccountId,
|
|
64
57
|
developerQualifiedSymbol: { developerSymbol: appUId, projectName },
|
|
65
58
|
},
|
|
66
|
-
timeout:
|
|
59
|
+
timeout: SANDBOX_TIMEOUT,
|
|
67
60
|
});
|
|
68
61
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return http_1.http.post(accountId, {
|
|
62
|
+
export function fetchDeveloperTestAccountOauthAppInstallStatus(accountId, projectName, appUId) {
|
|
63
|
+
return http.post(accountId, {
|
|
72
64
|
url: `${TEST_ACCOUNTS_API_PATH_V3}/install-apps/readiness`,
|
|
73
65
|
data: {
|
|
74
66
|
developerQualifiedSymbol: { developerSymbol: appUId, projectName },
|
|
75
67
|
},
|
|
76
|
-
timeout:
|
|
68
|
+
timeout: SANDBOX_TIMEOUT,
|
|
77
69
|
});
|
|
78
70
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return http_1.http.get(accountId, {
|
|
71
|
+
export function fetchDeveloperTestAccountGateSyncStatus(accountId, testAccountId) {
|
|
72
|
+
return http.get(accountId, {
|
|
82
73
|
url: `${TEST_ACCOUNTS_API_PATH_V3}/gate-sync-status/${testAccountId}`,
|
|
83
74
|
});
|
|
84
75
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
return http_1.http.get(accountId, {
|
|
76
|
+
export function generateDeveloperTestAccountPersonalAccessKey(accountId, testAccountId) {
|
|
77
|
+
return http.get(accountId, {
|
|
88
78
|
url: `${TEST_ACCOUNTS_API_PATH_V3}/generate-pak/${testAccountId}`,
|
|
89
79
|
});
|
|
90
80
|
}
|
|
91
|
-
exports.generateDeveloperTestAccountPersonalAccessKey = generateDeveloperTestAccountPersonalAccessKey;
|
package/api/fileManager.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HubSpotPromise } from '../types/Http';
|
|
2
|
-
import { FetchStatResponse, FetchFilesResponse, FetchFolderResponse, UploadResponse } from '../types/FileManager';
|
|
1
|
+
import { HubSpotPromise } from '../types/Http.js';
|
|
2
|
+
import { FetchStatResponse, FetchFilesResponse, FetchFolderResponse, UploadResponse } from '../types/FileManager.js';
|
|
3
3
|
export declare function uploadFile(accountId: number, src: string, dest: string): HubSpotPromise<UploadResponse>;
|
|
4
4
|
export declare function fetchStat(accountId: number, src: string): HubSpotPromise<FetchStatResponse>;
|
|
5
5
|
export declare function fetchFiles(accountId: number, folderId: number | 'None', offset: number, archived?: boolean): HubSpotPromise<FetchFilesResponse>;
|
package/api/fileManager.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fetchFolders = exports.fetchFiles = exports.fetchStat = exports.uploadFile = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const http_1 = require("../http");
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { http } from '../http/index.js';
|
|
10
4
|
const FILE_MANAGER_V2_API_PATH = 'filemanager/api/v2';
|
|
11
5
|
const FILE_MANAGER_V3_API_PATH = 'filemanager/api/v3';
|
|
12
|
-
function uploadFile(accountId, src, dest) {
|
|
13
|
-
const directory =
|
|
14
|
-
const filename =
|
|
6
|
+
export function uploadFile(accountId, src, dest) {
|
|
7
|
+
const directory = path.dirname(dest);
|
|
8
|
+
const filename = path.basename(dest);
|
|
15
9
|
const formData = {
|
|
16
|
-
file:
|
|
10
|
+
file: fs.createReadStream(src),
|
|
17
11
|
fileName: filename,
|
|
18
12
|
options: JSON.stringify({
|
|
19
13
|
access: 'PUBLIC_INDEXABLE',
|
|
@@ -26,21 +20,19 @@ function uploadFile(accountId, src, dest) {
|
|
|
26
20
|
else {
|
|
27
21
|
formData.folderPath = '/';
|
|
28
22
|
}
|
|
29
|
-
return
|
|
23
|
+
return http.post(accountId, {
|
|
30
24
|
url: `${FILE_MANAGER_V3_API_PATH}/files/upload`,
|
|
31
25
|
data: formData,
|
|
32
26
|
headers: { 'Content-Type': 'multipart/form-data' },
|
|
33
27
|
});
|
|
34
28
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return http_1.http.get(accountId, {
|
|
29
|
+
export function fetchStat(accountId, src) {
|
|
30
|
+
return http.get(accountId, {
|
|
38
31
|
url: `${FILE_MANAGER_V2_API_PATH}/files/stat/${src}`,
|
|
39
32
|
});
|
|
40
33
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return http_1.http.get(accountId, {
|
|
34
|
+
export function fetchFiles(accountId, folderId, offset, archived) {
|
|
35
|
+
return http.get(accountId, {
|
|
44
36
|
url: `${FILE_MANAGER_V2_API_PATH}/files/`,
|
|
45
37
|
params: {
|
|
46
38
|
hidden: 0,
|
|
@@ -50,9 +42,8 @@ function fetchFiles(accountId, folderId, offset, archived) {
|
|
|
50
42
|
},
|
|
51
43
|
});
|
|
52
44
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return http_1.http.get(accountId, {
|
|
45
|
+
export function fetchFolders(accountId, folderId) {
|
|
46
|
+
return http.get(accountId, {
|
|
56
47
|
url: `${FILE_MANAGER_V2_API_PATH}/folders/`,
|
|
57
48
|
params: {
|
|
58
49
|
hidden: 0,
|
|
@@ -60,4 +51,3 @@ function fetchFolders(accountId, folderId) {
|
|
|
60
51
|
},
|
|
61
52
|
});
|
|
62
53
|
}
|
|
63
|
-
exports.fetchFolders = fetchFolders;
|
package/api/fileMapper.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
|
-
import { FileMapperNode, FileMapperOptions, FileTree } from '../types/Files';
|
|
3
|
-
import { HubSpotPromise } from '../types/Http';
|
|
2
|
+
import { FileMapperNode, FileMapperOptions, FileTree } from '../types/Files.js';
|
|
3
|
+
import { HubSpotPromise } from '../types/Http.js';
|
|
4
4
|
export declare const FILE_MAPPER_API_PATH = "content/filemapper/v1";
|
|
5
5
|
export declare function createFileMapperNodeFromStreamResponse(filePath: string, response: Partial<AxiosResponse>): FileMapperNode;
|
|
6
6
|
export declare function upload(accountId: number, src: string, dest: string, options?: FileMapperOptions): HubSpotPromise<void>;
|
package/api/fileMapper.js
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const content_disposition_1 = __importDefault(require("content-disposition"));
|
|
10
|
-
const http_1 = require("../http");
|
|
11
|
-
const path_2 = require("../lib/path");
|
|
12
|
-
exports.FILE_MAPPER_API_PATH = 'content/filemapper/v1';
|
|
13
|
-
function createFileMapperNodeFromStreamResponse(filePath, response) {
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import contentDisposition from 'content-disposition';
|
|
4
|
+
import { http } from '../http/index.js';
|
|
5
|
+
import { getCwd } from '../lib/path.js';
|
|
6
|
+
export const FILE_MAPPER_API_PATH = 'content/filemapper/v1';
|
|
7
|
+
export function createFileMapperNodeFromStreamResponse(filePath, response) {
|
|
14
8
|
if (filePath[0] !== '/') {
|
|
15
9
|
filePath = `/${filePath}`;
|
|
16
10
|
}
|
|
@@ -20,7 +14,7 @@ function createFileMapperNodeFromStreamResponse(filePath, response) {
|
|
|
20
14
|
const node = {
|
|
21
15
|
source: null,
|
|
22
16
|
path: filePath,
|
|
23
|
-
name:
|
|
17
|
+
name: path.basename(filePath),
|
|
24
18
|
folder: false,
|
|
25
19
|
children: [],
|
|
26
20
|
createdAt: 0,
|
|
@@ -29,7 +23,7 @@ function createFileMapperNodeFromStreamResponse(filePath, response) {
|
|
|
29
23
|
if (!(response.headers && response.headers['content-disposition'])) {
|
|
30
24
|
return node;
|
|
31
25
|
}
|
|
32
|
-
const { parameters } =
|
|
26
|
+
const { parameters } = contentDisposition.parse(response.headers['content-disposition']);
|
|
33
27
|
return {
|
|
34
28
|
...node,
|
|
35
29
|
name: parameters.filename,
|
|
@@ -37,70 +31,61 @@ function createFileMapperNodeFromStreamResponse(filePath, response) {
|
|
|
37
31
|
updatedAt: parseInt(parameters['modification-date'], 10) || 0,
|
|
38
32
|
};
|
|
39
33
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
url: `${exports.FILE_MAPPER_API_PATH}/upload/${encodeURIComponent(dest)}`,
|
|
34
|
+
export function upload(accountId, src, dest, options = {}) {
|
|
35
|
+
return http.post(accountId, {
|
|
36
|
+
url: `${FILE_MAPPER_API_PATH}/upload/${encodeURIComponent(dest)}`,
|
|
44
37
|
data: {
|
|
45
|
-
file:
|
|
38
|
+
file: fs.createReadStream(path.resolve(getCwd(), src)),
|
|
46
39
|
},
|
|
47
40
|
headers: { 'Content-Type': 'multipart/form-data' },
|
|
48
41
|
...options,
|
|
49
42
|
});
|
|
50
43
|
}
|
|
51
|
-
exports.upload = upload;
|
|
52
44
|
// Fetch a module by moduleId
|
|
53
|
-
function fetchModule(accountId, moduleId, options = {}) {
|
|
54
|
-
return
|
|
55
|
-
url: `${
|
|
45
|
+
export function fetchModule(accountId, moduleId, options = {}) {
|
|
46
|
+
return http.get(accountId, {
|
|
47
|
+
url: `${FILE_MAPPER_API_PATH}/modules/${moduleId}`,
|
|
56
48
|
...options,
|
|
57
49
|
});
|
|
58
50
|
}
|
|
59
|
-
exports.fetchModule = fetchModule;
|
|
60
51
|
// Fetch a file by file path.
|
|
61
|
-
async function fetchFileStream(accountId, filePath, destination, options = {}) {
|
|
62
|
-
const response = await
|
|
63
|
-
url: `${
|
|
52
|
+
export async function fetchFileStream(accountId, filePath, destination, options = {}) {
|
|
53
|
+
const response = await http.getOctetStream(accountId, {
|
|
54
|
+
url: `${FILE_MAPPER_API_PATH}/stream/${encodeURIComponent(filePath)}`,
|
|
64
55
|
...options,
|
|
65
56
|
}, destination);
|
|
66
57
|
return createFileMapperNodeFromStreamResponse(filePath, response);
|
|
67
58
|
}
|
|
68
|
-
exports.fetchFileStream = fetchFileStream;
|
|
69
59
|
// Fetch a folder or file node by path.
|
|
70
|
-
function download(accountId, filepath, options = {}) {
|
|
71
|
-
return
|
|
72
|
-
url: `${
|
|
60
|
+
export function download(accountId, filepath, options = {}) {
|
|
61
|
+
return http.get(accountId, {
|
|
62
|
+
url: `${FILE_MAPPER_API_PATH}/download/${encodeURIComponent(filepath)}`,
|
|
73
63
|
...options,
|
|
74
64
|
});
|
|
75
65
|
}
|
|
76
|
-
exports.download = download;
|
|
77
66
|
// Fetch a folder or file node by path.
|
|
78
|
-
function downloadDefault(accountId, filepath, options = {}) {
|
|
79
|
-
return
|
|
80
|
-
url: `${
|
|
67
|
+
export function downloadDefault(accountId, filepath, options = {}) {
|
|
68
|
+
return http.get(accountId, {
|
|
69
|
+
url: `${FILE_MAPPER_API_PATH}/download-default/${filepath}`,
|
|
81
70
|
...options,
|
|
82
71
|
});
|
|
83
72
|
}
|
|
84
|
-
exports.downloadDefault = downloadDefault;
|
|
85
73
|
// Delete a file or folder by path
|
|
86
|
-
function deleteFile(accountId, filePath) {
|
|
87
|
-
return
|
|
88
|
-
url: `${
|
|
74
|
+
export function deleteFile(accountId, filePath) {
|
|
75
|
+
return http.delete(accountId, {
|
|
76
|
+
url: `${FILE_MAPPER_API_PATH}/delete/${encodeURIComponent(filePath)}`,
|
|
89
77
|
});
|
|
90
78
|
}
|
|
91
|
-
exports.deleteFile = deleteFile;
|
|
92
79
|
// Moves file from srcPath to destPath
|
|
93
|
-
function moveFile(accountId, srcPath, destPath) {
|
|
94
|
-
return
|
|
95
|
-
url: `${
|
|
80
|
+
export function moveFile(accountId, srcPath, destPath) {
|
|
81
|
+
return http.put(accountId, {
|
|
82
|
+
url: `${FILE_MAPPER_API_PATH}/rename/${srcPath}?path=${destPath}`,
|
|
96
83
|
headers: { 'Content-Type': 'application/json' },
|
|
97
84
|
});
|
|
98
85
|
}
|
|
99
|
-
exports.moveFile = moveFile;
|
|
100
86
|
// Get directory contents
|
|
101
|
-
function getDirectoryContentsByPath(accountId, path) {
|
|
102
|
-
return
|
|
103
|
-
url: `${
|
|
87
|
+
export function getDirectoryContentsByPath(accountId, path) {
|
|
88
|
+
return http.get(accountId, {
|
|
89
|
+
url: `${FILE_MAPPER_API_PATH}/meta/${path}`,
|
|
104
90
|
});
|
|
105
91
|
}
|
|
106
|
-
exports.getDirectoryContentsByPath = getDirectoryContentsByPath;
|