@hubspot/local-dev-lib 0.3.11 → 0.3.13

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.
@@ -1,10 +1,11 @@
1
1
  import { AxiosError } from 'axios';
2
2
  import { GenericError, AxiosErrorContext, ValidationError } from '../types/Error';
3
3
  import { HubSpotAuthError } from '../models/HubSpotAuthError';
4
- export declare function isSpecifiedError(err: Error | AxiosError, { statusCode, category, subCategory, code, }: {
4
+ export declare function isSpecifiedError(err: Error | AxiosError, { statusCode, category, subCategory, errorType, code, }: {
5
5
  statusCode?: number;
6
6
  category?: string;
7
7
  subCategory?: string;
8
+ errorType?: string;
8
9
  code?: string;
9
10
  }): boolean;
10
11
  export declare function isMissingScopeError(err: Error | AxiosError): boolean;
@@ -5,17 +5,19 @@ const api_1 = require("../constants/api");
5
5
  const lang_1 = require("../utils/lang");
6
6
  const standardErrors_1 = require("./standardErrors");
7
7
  const i18nKey = 'errors.apiErrors';
8
- function isSpecifiedError(err, { statusCode, category, subCategory, code, }) {
8
+ function isSpecifiedError(err, { statusCode, category, subCategory, errorType, code, }) {
9
9
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
10
  const error = (err && err.cause) || err;
11
11
  const statusCodeErr = !statusCode || error.response?.status === statusCode;
12
12
  const categoryErr = !category || error.response?.data?.category === category;
13
13
  const subCategoryErr = !subCategory || error.response?.data?.subCategory === subCategory;
14
+ const errorTypeErr = !errorType || error.response?.data?.errorType === errorType;
14
15
  const codeError = !code || error.code === code;
15
16
  return (error.isAxiosError &&
16
17
  statusCodeErr &&
17
18
  categoryErr &&
18
19
  subCategoryErr &&
20
+ errorTypeErr &&
19
21
  codeError);
20
22
  }
21
23
  exports.isSpecifiedError = isSpecifiedError;
@@ -34,7 +36,7 @@ exports.isTimeoutError = isTimeoutError;
34
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
37
  function isApiUploadValidationError(err) {
36
38
  return (err.isAxiosError &&
37
- err.status === 400 &&
39
+ (err.status === 400 || err.response?.status === 400) &&
38
40
  !!err.response &&
39
41
  !!(err.response?.data?.message || !!err.response?.data?.errors));
40
42
  }
@@ -1,4 +1,4 @@
1
- import { DeveloperTestAccount } from '../types/developerTestAccounts';
1
+ import { DeveloperTestAccount, FetchDeveloperTestAccountsResponse } from '../types/developerTestAccounts';
2
2
  export declare function createDeveloperTestAccount(accountId: number, accountName: string): Promise<DeveloperTestAccount>;
3
3
  export declare function deleteDeveloperTestAccount(accountId: number, testAccountId: number): Promise<void>;
4
- export declare function fetchDeveloperTestAccounts(accountId: number): Promise<DeveloperTestAccount[]>;
4
+ export declare function fetchDeveloperTestAccounts(accountId: number): Promise<FetchDeveloperTestAccountsResponse>;
@@ -26,7 +26,7 @@ exports.deleteDeveloperTestAccount = deleteDeveloperTestAccount;
26
26
  async function fetchDeveloperTestAccounts(accountId) {
27
27
  try {
28
28
  const resp = await (0, developerTestAccounts_1.fetchDeveloperTestAccounts)(accountId);
29
- return resp.results;
29
+ return resp;
30
30
  }
31
31
  catch (err) {
32
32
  (0, apiErrors_1.throwApiError)(err);
package/lib/urls.js CHANGED
@@ -11,7 +11,11 @@ function getEnvUrlString(env) {
11
11
  const getHubSpotWebsiteOrigin = (env) => `https://app.hubspot${getEnvUrlString(env)}.com`;
12
12
  exports.getHubSpotWebsiteOrigin = getHubSpotWebsiteOrigin;
13
13
  function getHubSpotApiOrigin(env, useLocalHost) {
14
- let domain = process.env.HUBAPI_DOMAIN_OVERRIDE;
14
+ let domain;
15
+ const domainOverride = process.env.HUBAPI_DOMAIN_OVERRIDE;
16
+ if (domainOverride && typeof domainOverride === 'string') {
17
+ domain = `${domainOverride}${getEnvUrlString(env)}`;
18
+ }
15
19
  if (!domain || typeof domain !== 'string') {
16
20
  domain = `${useLocalHost ? 'local' : 'api'}.hubapi${getEnvUrlString(env)}`;
17
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/local-dev-lib",
3
- "version": "0.3.11",
3
+ "version": "0.3.13",
4
4
  "description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -8,4 +8,5 @@ export type DeveloperTestAccount = {
8
8
  };
9
9
  export type FetchDeveloperTestAccountsResponse = {
10
10
  results: DeveloperTestAccount[];
11
+ maxTestPortals: number;
11
12
  };