@hubspot/local-dev-lib 1.9.0 → 1.9.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/appsDev.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { PublicApp, PublicAppDeveloperTestAccountInstallData } from '../types/Apps';
1
+ import { PublicApp, PublicApInstallCounts, PublicAppDeveloperTestAccountInstallData } from '../types/Apps';
2
2
  export declare function fetchPublicAppsForPortal(accountId: number): Promise<Array<PublicApp>>;
3
3
  export declare function fetchPublicAppDeveloperTestAccountInstallData(appId: number, accountId: number): Promise<PublicAppDeveloperTestAccountInstallData>;
4
+ export declare function fetchPublicAppProductionInstallCounts(appId: number, accountId: number): Promise<PublicApInstallCounts>;
4
5
  export declare function fetchPublicAppMetadata(appId: number, accountId: number): Promise<PublicApp>;
package/api/appsDev.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.fetchPublicAppMetadata = exports.fetchPublicAppDeveloperTestAccountInstallData = exports.fetchPublicAppsForPortal = void 0;
6
+ exports.fetchPublicAppMetadata = exports.fetchPublicAppProductionInstallCounts = exports.fetchPublicAppDeveloperTestAccountInstallData = exports.fetchPublicAppsForPortal = void 0;
7
7
  const http_1 = __importDefault(require("../http"));
8
8
  const APPS_DEV_API_PATH = 'apps-dev/external/public/v3';
9
9
  async function fetchPublicAppsForPortal(accountId) {
@@ -19,6 +19,12 @@ function fetchPublicAppDeveloperTestAccountInstallData(appId, accountId) {
19
19
  });
20
20
  }
21
21
  exports.fetchPublicAppDeveloperTestAccountInstallData = fetchPublicAppDeveloperTestAccountInstallData;
22
+ function fetchPublicAppProductionInstallCounts(appId, accountId) {
23
+ return http_1.default.get(accountId, {
24
+ url: `${APPS_DEV_API_PATH}/${appId}/install-counts-without-test-portals`,
25
+ });
26
+ }
27
+ exports.fetchPublicAppProductionInstallCounts = fetchPublicAppProductionInstallCounts;
22
28
  function fetchPublicAppMetadata(appId, accountId) {
23
29
  return http_1.default.get(accountId, {
24
30
  url: `${APPS_DEV_API_PATH}/${appId}/full`,
package/http/index.d.ts CHANGED
@@ -2,10 +2,15 @@ import { AxiosResponse } from 'axios';
2
2
  import { HttpOptions } from '../types/Http';
3
3
  export declare function addUserAgentHeader(key: string, value: string): void;
4
4
  declare function getRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
5
+ declare function getRequest<T>(accountId: number, options: HttpOptions, withFullResponse: true): Promise<AxiosResponse<T>>;
5
6
  declare function postRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
7
+ declare function postRequest<T>(accountId: number, options: HttpOptions, withFullResponse: true): Promise<AxiosResponse<T>>;
6
8
  declare function putRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
9
+ declare function putRequest<T>(accountId: number, options: HttpOptions, withFullResponse: true): Promise<AxiosResponse<T>>;
7
10
  declare function patchRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
11
+ declare function patchRequest<T>(accountId: number, options: HttpOptions, withFullResponse: true): Promise<AxiosResponse<T>>;
8
12
  declare function deleteRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
13
+ declare function deleteRequest<T>(accountId: number, options: HttpOptions, withFullResponse: true): Promise<AxiosResponse<T>>;
9
14
  declare const http: {
10
15
  get: typeof getRequest;
11
16
  post: typeof postRequest;
package/http/index.js CHANGED
@@ -88,32 +88,47 @@ function addQueryParams(configOptions, queryParams = {}) {
88
88
  },
89
89
  };
90
90
  }
91
- async function getRequest(accountId, options) {
91
+ async function getRequest(accountId, options, withFullResponse) {
92
92
  const { params, ...rest } = options;
93
93
  const axiosConfig = addQueryParams(rest, params);
94
94
  const configWithAuth = await withAuth(accountId, axiosConfig);
95
- const { data } = await (0, axios_1.default)(configWithAuth);
96
- return data;
95
+ const response = await (0, axios_1.default)(configWithAuth);
96
+ if (withFullResponse) {
97
+ return response;
98
+ }
99
+ return response.data;
97
100
  }
98
- async function postRequest(accountId, options) {
101
+ async function postRequest(accountId, options, withFullResponse) {
99
102
  const configWithAuth = await withAuth(accountId, options);
100
- const { data } = await (0, axios_1.default)({ ...configWithAuth, method: 'post' });
101
- return data;
103
+ const response = await (0, axios_1.default)({ ...configWithAuth, method: 'post' });
104
+ if (withFullResponse) {
105
+ return response;
106
+ }
107
+ return response.data;
102
108
  }
103
- async function putRequest(accountId, options) {
109
+ async function putRequest(accountId, options, withFullResponse) {
104
110
  const configWithAuth = await withAuth(accountId, options);
105
- const { data } = await (0, axios_1.default)({ ...configWithAuth, method: 'put' });
106
- return data;
111
+ const response = await (0, axios_1.default)({ ...configWithAuth, method: 'put' });
112
+ if (withFullResponse) {
113
+ return response;
114
+ }
115
+ return response.data;
107
116
  }
108
- async function patchRequest(accountId, options) {
117
+ async function patchRequest(accountId, options, withFullResponse) {
109
118
  const configWithAuth = await withAuth(accountId, options);
110
- const { data } = await (0, axios_1.default)({ ...configWithAuth, method: 'patch' });
111
- return data;
119
+ const response = await (0, axios_1.default)({ ...configWithAuth, method: 'patch' });
120
+ if (withFullResponse) {
121
+ return response;
122
+ }
123
+ return response.data;
112
124
  }
113
- async function deleteRequest(accountId, options) {
125
+ async function deleteRequest(accountId, options, withFullResponse = false) {
114
126
  const configWithAuth = await withAuth(accountId, options);
115
- const { data } = await (0, axios_1.default)({ ...configWithAuth, method: 'delete' });
116
- return data;
127
+ const response = await (0, axios_1.default)({ ...configWithAuth, method: 'delete' });
128
+ if (withFullResponse) {
129
+ return response;
130
+ }
131
+ return response.data;
117
132
  }
118
133
  function createGetRequestStream(contentType) {
119
134
  return async (accountId, options, destPath) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/local-dev-lib",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
package/types/Apps.d.ts CHANGED
@@ -13,6 +13,11 @@ export type PublicAppDeveloperTestAccountInstallData = {
13
13
  }>;
14
14
  testPortalInstallCount: string;
15
15
  };
16
+ export type PublicApInstallCounts = {
17
+ uniquePortalInstallCount: number;
18
+ uniqueUserInstallCount: number;
19
+ uniqueBusinessUnitInstallCount: number;
20
+ };
16
21
  export type PublicApp = {
17
22
  id: number;
18
23
  name: string;
@@ -34,11 +39,7 @@ export type PublicApp = {
34
39
  supportPhone: string | null;
35
40
  extensionIconUrl: string | null;
36
41
  isAdvancedScopesSettingEnabled: boolean;
37
- publicApplicationInstallCounts: {
38
- uniquePortalInstallCount: number;
39
- uniqueUserInstallCount: number;
40
- uniqueBusinessUnitInstallCount: number;
41
- };
42
+ publicApplicationInstallCounts: PublicApInstallCounts;
42
43
  redirectUrls: Array<string>;
43
44
  scopeGroupIds: Array<number>;
44
45
  requiredScopeInfo?: Array<{