@hubspot/local-dev-lib 0.2.2 → 0.2.3-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.
Files changed (187) hide show
  1. package/LICENSE +12 -0
  2. package/README.md +17 -0
  3. package/api/appsDev.d.ts +6 -0
  4. package/api/appsDev.js +29 -0
  5. package/api/customObjects.d.ts +8 -7
  6. package/api/customObjects.js +13 -16
  7. package/api/designManager.d.ts +4 -13
  8. package/api/designManager.js +6 -9
  9. package/api/developerTestAccounts.d.ts +7 -0
  10. package/api/developerTestAccounts.js +48 -0
  11. package/api/fileManager.d.ts +5 -4
  12. package/api/fileManager.js +11 -11
  13. package/api/fileMapper.d.ts +8 -7
  14. package/api/fileMapper.js +17 -17
  15. package/api/fileTransport.d.ts +4 -0
  16. package/api/fileTransport.js +39 -0
  17. package/api/functions.d.ts +7 -4
  18. package/api/functions.js +22 -11
  19. package/api/github.d.ts +7 -9
  20. package/api/github.js +31 -13
  21. package/api/hubdb.d.ts +11 -10
  22. package/api/hubdb.js +28 -22
  23. package/api/lighthouseScore.d.ts +4 -4
  24. package/api/lighthouseScore.js +9 -12
  25. package/api/localDevAuth.d.ts +8 -16
  26. package/api/localDevAuth.js +34 -13
  27. package/api/marketplaceValidation.d.ts +4 -4
  28. package/api/marketplaceValidation.js +8 -11
  29. package/api/projects.d.ts +31 -24
  30. package/api/projects.js +164 -44
  31. package/api/sandboxHubs.d.ts +6 -4
  32. package/api/sandboxHubs.js +10 -11
  33. package/api/sandboxSync.d.ts +4 -4
  34. package/api/sandboxSync.js +4 -13
  35. package/api/secrets.d.ts +6 -8
  36. package/api/secrets.js +9 -12
  37. package/api/validateHubl.d.ts +2 -1
  38. package/api/validateHubl.js +3 -6
  39. package/config/CLIConfiguration.d.ts +15 -11
  40. package/config/CLIConfiguration.js +175 -90
  41. package/config/configFile.js +12 -18
  42. package/config/configUtils.d.ts +2 -21
  43. package/config/configUtils.js +5 -4
  44. package/config/config_DEPRECATED.d.ts +6 -8
  45. package/config/config_DEPRECATED.js +79 -25
  46. package/config/environment.js +5 -4
  47. package/config/getAccountIdentifier.d.ts +2 -0
  48. package/config/getAccountIdentifier.js +15 -0
  49. package/config/index.d.ts +14 -8
  50. package/config/index.js +108 -57
  51. package/constants/config.d.ts +18 -1
  52. package/constants/config.js +20 -3
  53. package/constants/environments.d.ts +1 -0
  54. package/constants/environments.js +1 -0
  55. package/constants/extensions.d.ts +2 -0
  56. package/constants/extensions.js +3 -1
  57. package/constants/files.d.ts +2 -2
  58. package/constants/files.js +3 -3
  59. package/errors/errors_DEPRECATED.d.ts +1 -5
  60. package/errors/errors_DEPRECATED.js +2 -2
  61. package/errors/index.d.ts +18 -0
  62. package/errors/index.js +63 -0
  63. package/http/addQueryParams.d.ts +2 -0
  64. package/http/addQueryParams.js +14 -0
  65. package/http/getAxiosConfig.d.ts +6 -3
  66. package/http/getAxiosConfig.js +51 -7
  67. package/http/index.d.ts +11 -12
  68. package/http/index.js +35 -41
  69. package/http/unauthed.d.ts +14 -0
  70. package/http/unauthed.js +38 -0
  71. package/lang/en.json +378 -386
  72. package/lib/archive.d.ts +2 -8
  73. package/lib/archive.js +34 -30
  74. package/lib/cms/functions.d.ts +7 -12
  75. package/lib/cms/functions.js +49 -51
  76. package/lib/cms/handleFieldsJS.js +16 -14
  77. package/lib/cms/modules.d.ts +4 -15
  78. package/lib/cms/modules.js +81 -78
  79. package/lib/cms/processFieldsJs.js +10 -33
  80. package/lib/cms/templates.d.ts +43 -3
  81. package/lib/cms/templates.js +53 -11
  82. package/lib/cms/uploadFolder.d.ts +3 -14
  83. package/lib/cms/uploadFolder.js +58 -42
  84. package/lib/cms/validate.js +1 -1
  85. package/lib/cms/watch.d.ts +2 -18
  86. package/lib/cms/watch.js +63 -68
  87. package/lib/customObjects.js +4 -15
  88. package/lib/fileManager.d.ts +2 -6
  89. package/lib/fileManager.js +54 -65
  90. package/lib/fileMapper.d.ts +4 -15
  91. package/lib/fileMapper.js +67 -88
  92. package/lib/fs.d.ts +1 -1
  93. package/lib/fs.js +10 -6
  94. package/lib/github.d.ts +12 -14
  95. package/lib/github.js +70 -35
  96. package/lib/gitignore.d.ts +2 -0
  97. package/lib/gitignore.js +21 -4
  98. package/lib/hubdb.d.ts +3 -2
  99. package/lib/hubdb.js +11 -9
  100. package/{utils → lib}/notify.js +2 -2
  101. package/lib/oauth.d.ts +2 -5
  102. package/lib/oauth.js +14 -25
  103. package/lib/path.d.ts +3 -0
  104. package/lib/path.js +46 -1
  105. package/lib/personalAccessKey.d.ts +8 -11
  106. package/lib/personalAccessKey.js +75 -38
  107. package/lib/portManager.d.ts +3 -5
  108. package/lib/portManager.js +18 -6
  109. package/lib/trackUsage.js +18 -11
  110. package/lib/urls.js +5 -1
  111. package/models/FileSystemError.d.ts +6 -0
  112. package/models/FileSystemError.js +47 -0
  113. package/models/HubSpotHttpError.d.ts +24 -0
  114. package/models/HubSpotHttpError.js +197 -0
  115. package/models/OAuth2Manager.d.ts +5 -27
  116. package/models/OAuth2Manager.js +41 -64
  117. package/package.json +34 -35
  118. package/types/Accounts.d.ts +103 -3
  119. package/types/Apps.d.ts +77 -0
  120. package/types/Archive.d.ts +9 -0
  121. package/types/Archive.js +2 -0
  122. package/types/Build.d.ts +4 -2
  123. package/types/ComponentStructure.d.ts +30 -10
  124. package/types/Config.d.ts +19 -2
  125. package/types/Deploy.d.ts +3 -2
  126. package/types/DesignManager.d.ts +10 -0
  127. package/types/DesignManager.js +2 -0
  128. package/types/Error.d.ts +9 -5
  129. package/types/FieldsJS.d.ts +1 -0
  130. package/types/FieldsJS.js +2 -0
  131. package/types/FileManager.d.ts +1 -1
  132. package/types/Files.d.ts +43 -4
  133. package/types/Functions.d.ts +52 -0
  134. package/types/Github.d.ts +13 -0
  135. package/types/Http.d.ts +12 -11
  136. package/types/Hubdb.d.ts +9 -0
  137. package/types/MarketplaceValidation.d.ts +7 -3
  138. package/types/Migration.d.ts +28 -0
  139. package/types/Migration.js +10 -0
  140. package/types/Modules.d.ts +11 -0
  141. package/types/PortManager.d.ts +7 -0
  142. package/types/Project.d.ts +30 -0
  143. package/types/ProjectLog.d.ts +9 -0
  144. package/types/ProjectLog.js +2 -0
  145. package/types/Sandbox.d.ts +37 -47
  146. package/types/Schemas.d.ts +56 -0
  147. package/types/Secrets.d.ts +3 -0
  148. package/types/Secrets.js +2 -0
  149. package/types/developerTestAccounts.d.ts +13 -0
  150. package/types/developerTestAccounts.js +2 -0
  151. package/utils/PortManagerServer.d.ts +6 -7
  152. package/utils/PortManagerServer.js +22 -16
  153. package/utils/{getAccountIdentifier.d.ts → accounts.d.ts} +0 -6
  154. package/utils/{getAccountIdentifier.js → accounts.js} +1 -13
  155. package/utils/cms/fieldsJS.d.ts +1 -2
  156. package/utils/cms/modules.js +2 -2
  157. package/utils/detectPort.js +3 -3
  158. package/utils/git.d.ts +1 -7
  159. package/utils/git.js +2 -18
  160. package/errors/apiErrors.d.ts +0 -19
  161. package/errors/apiErrors.js +0 -179
  162. package/errors/fileSystemErrors.d.ts +0 -5
  163. package/errors/fileSystemErrors.js +0 -31
  164. package/errors/standardErrors.d.ts +0 -27
  165. package/errors/standardErrors.js +0 -59
  166. package/lang/lang/en.json +0 -401
  167. package/lib/logging/git.d.ts +0 -2
  168. package/lib/logging/git.js +0 -54
  169. package/lib/logging/logs.d.ts +0 -22
  170. package/lib/logging/logs.js +0 -86
  171. package/lib/logging/table.d.ts +0 -3
  172. package/lib/logging/table.js +0 -47
  173. package/lib/sandboxes.d.ts +0 -14
  174. package/lib/sandboxes.js +0 -71
  175. package/models/HubSpotAuthError.d.ts +0 -12
  176. package/models/HubSpotAuthError.js +0 -20
  177. package/types/LogCallbacks.d.ts +0 -7
  178. package/utils/logger.d.ts +0 -5
  179. package/utils/logger.js +0 -23
  180. package/utils/objectUtils.d.ts +0 -8
  181. package/utils/objectUtils.js +0 -33
  182. /package/{utils → lib}/escapeRegExp.d.ts +0 -0
  183. /package/{utils → lib}/escapeRegExp.js +0 -0
  184. /package/lib/{logging/logger.d.ts → logger.d.ts} +0 -0
  185. /package/lib/{logging/logger.js → logger.js} +0 -0
  186. /package/{utils → lib}/notify.d.ts +0 -0
  187. /package/types/{LogCallbacks.js → Apps.js} +0 -0
@@ -1,21 +1,65 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAxiosConfig = exports.DEFAULT_USER_AGENT_HEADERS = void 0;
6
+ exports.getAxiosConfig = exports.getDefaultUserAgentHeader = exports.USER_AGENTS = void 0;
4
7
  const package_json_1 = require("../package.json");
5
8
  const config_1 = require("../config");
6
9
  const urls_1 = require("../lib/urls");
7
- exports.DEFAULT_USER_AGENT_HEADERS = {
8
- 'User-Agent': `HubSpot Local Dev Lib/${package_json_1.version}`,
10
+ const https_1 = __importDefault(require("https"));
11
+ const http_1 = __importDefault(require("http"));
12
+ // Total number of sockets across all hosts
13
+ const MAX_TOTAL_SOCKETS = 25;
14
+ // Total number of sockets per each host
15
+ const MAX_SOCKETS_PER_HOST = 5;
16
+ const httpAgent = new http_1.default.Agent({
17
+ keepAlive: true,
18
+ maxTotalSockets: MAX_TOTAL_SOCKETS,
19
+ maxSockets: MAX_SOCKETS_PER_HOST,
20
+ });
21
+ const httpsAgent = new https_1.default.Agent({
22
+ keepAlive: true,
23
+ maxTotalSockets: MAX_TOTAL_SOCKETS,
24
+ maxSockets: MAX_SOCKETS_PER_HOST,
25
+ });
26
+ exports.USER_AGENTS = {
27
+ 'HubSpot Local Dev Lib': package_json_1.version,
28
+ };
29
+ function getDefaultUserAgentHeader() {
30
+ let userAgentString = '';
31
+ Object.keys(exports.USER_AGENTS).forEach((userAgentKey, i) => {
32
+ userAgentString += `${i > 0 ? ', ' : ''}${userAgentKey}/${exports.USER_AGENTS[userAgentKey]}`;
33
+ });
34
+ return {
35
+ 'User-Agent': userAgentString,
36
+ };
37
+ }
38
+ exports.getDefaultUserAgentHeader = getDefaultUserAgentHeader;
39
+ const DEFAULT_TRANSITIONAL = {
40
+ clarifyTimeoutError: true,
9
41
  };
10
42
  function getAxiosConfig(options) {
11
- const { env, localHostOverride, ...rest } = options;
12
- const { httpTimeout, httpUseLocalhost } = (0, config_1.getAndLoadConfigIfNeeded)();
43
+ const { env, localHostOverride, headers, ...rest } = options;
44
+ const config = (0, config_1.getAndLoadConfigIfNeeded)();
45
+ let httpTimeout = 15000;
46
+ let httpUseLocalhost = false;
47
+ if (config && config.httpTimeout) {
48
+ httpTimeout = config.httpTimeout;
49
+ }
50
+ if (config && config.httpUseLocalhost) {
51
+ httpUseLocalhost = config.httpUseLocalhost;
52
+ }
13
53
  return {
14
54
  baseURL: (0, urls_1.getHubSpotApiOrigin)(env, localHostOverride ? false : httpUseLocalhost),
15
55
  headers: {
16
- ...exports.DEFAULT_USER_AGENT_HEADERS,
56
+ ...getDefaultUserAgentHeader(),
57
+ ...(headers || {}),
17
58
  },
18
- timeout: httpTimeout || 15000,
59
+ timeout: httpTimeout,
60
+ transitional: DEFAULT_TRANSITIONAL,
61
+ httpAgent,
62
+ httpsAgent,
19
63
  ...rest,
20
64
  };
21
65
  }
package/http/index.d.ts CHANGED
@@ -1,18 +1,17 @@
1
- import { LogCallbacksArg } from '../types/LogCallbacks';
2
- import { HttpOptions } from '../types/Http';
3
- import { AxiosResponse } from 'axios';
4
- declare function getRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
5
- declare function postRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
6
- declare function putRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
7
- declare function patchRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
8
- declare function deleteRequest<T>(accountId: number, options: HttpOptions): Promise<T>;
9
- declare const getRequestStreamCallbackKeys: readonly ["onWrite"];
10
- declare const http: {
1
+ import { AxiosPromise } from 'axios';
2
+ import { HttpOptions, HubSpotPromise } from '../types/Http';
3
+ export declare function addUserAgentHeader(key: string, value: string): void;
4
+ declare function getRequest<T>(accountId: number, options: HttpOptions): HubSpotPromise<T>;
5
+ declare function postRequest<T>(accountId: number, options: HttpOptions): HubSpotPromise<T>;
6
+ declare function putRequest<T>(accountId: number, options: HttpOptions): HubSpotPromise<T>;
7
+ declare function patchRequest<T>(accountId: number, options: HttpOptions): HubSpotPromise<T>;
8
+ declare function deleteRequest<T>(accountId: number, options: HttpOptions): HubSpotPromise<T>;
9
+ export declare const http: {
11
10
  get: typeof getRequest;
12
11
  post: typeof postRequest;
13
12
  put: typeof putRequest;
14
13
  patch: typeof patchRequest;
15
14
  delete: typeof deleteRequest;
16
- getOctetStream: (accountId: number, options: HttpOptions, destPath: string, logCallbacks?: LogCallbacksArg<typeof getRequestStreamCallbackKeys>) => Promise<AxiosResponse>;
15
+ getOctetStream: (accountId: number, options: HttpOptions, destPath: string) => AxiosPromise<any>;
17
16
  };
18
- export default http;
17
+ export {};
package/http/index.js CHANGED
@@ -3,22 +3,34 @@ 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.http = exports.addUserAgentHeader = void 0;
6
7
  const path_1 = __importDefault(require("path"));
7
8
  const fs_extra_1 = __importDefault(require("fs-extra"));
8
9
  const content_disposition_1 = __importDefault(require("content-disposition"));
10
+ const axios_1 = __importDefault(require("axios"));
9
11
  const config_1 = require("../config");
10
12
  const getAxiosConfig_1 = require("./getAxiosConfig");
13
+ const addQueryParams_1 = require("./addQueryParams");
11
14
  const personalAccessKey_1 = require("../lib/personalAccessKey");
12
15
  const oauth_1 = require("../lib/oauth");
13
- const standardErrors_1 = require("../errors/standardErrors");
14
- const logger_1 = require("../utils/logger");
15
- const axios_1 = __importDefault(require("axios"));
16
+ const logger_1 = require("../lib/logger");
17
+ const lang_1 = require("../utils/lang");
18
+ const HubSpotHttpError_1 = require("../models/HubSpotHttpError");
16
19
  const i18nKey = 'http.index';
20
+ axios_1.default.interceptors.response.use(undefined, error => {
21
+ // Wrap all axios errors in our own Error class. Attach the error
22
+ // as the cause for the new error, so we maintain the stack trace
23
+ return Promise.reject(new HubSpotHttpError_1.HubSpotHttpError(error.message, { cause: error }));
24
+ });
25
+ function addUserAgentHeader(key, value) {
26
+ getAxiosConfig_1.USER_AGENTS[key] = value;
27
+ }
28
+ exports.addUserAgentHeader = addUserAgentHeader;
17
29
  async function withOauth(accountId, accountConfig, axiosConfig) {
18
30
  const { headers } = axiosConfig;
19
31
  const oauth = (0, oauth_1.getOauthManager)(accountId, accountConfig);
20
32
  if (!oauth) {
21
- (0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.withOauth`, { accountId });
33
+ throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.withOauth`, { accountId }));
22
34
  }
23
35
  const accessToken = await oauth.accessToken();
24
36
  return {
@@ -53,7 +65,7 @@ function withPortalId(portalId, axiosConfig) {
53
65
  async function withAuth(accountId, options) {
54
66
  const accountConfig = (0, config_1.getAccountConfig)(accountId);
55
67
  if (!accountConfig) {
56
- (0, standardErrors_1.throwErrorWithMessage)(`${i18nKey}.errors.withAuth`, { accountId });
68
+ throw new Error((0, lang_1.i18n)(`${i18nKey}.errors.withAuth`, { accountId }));
57
69
  }
58
70
  const { env, authType, apiKey } = accountConfig;
59
71
  const axiosConfig = withPortalId(accountId, (0, getAxiosConfig_1.getAxiosConfig)({ env, ...options }));
@@ -72,49 +84,32 @@ async function withAuth(accountId, options) {
72
84
  },
73
85
  };
74
86
  }
75
- function addQueryParams(configOptions, queryParams = {}) {
76
- const { params } = configOptions;
77
- return {
78
- ...configOptions,
79
- params: {
80
- ...queryParams,
81
- ...params,
82
- },
83
- };
84
- }
85
87
  async function getRequest(accountId, options) {
86
- const { query, ...rest } = options;
87
- const axiosConfig = addQueryParams(rest, query);
88
- const configWithAuth = await withAuth(accountId, axiosConfig);
89
- const { data } = await (0, axios_1.default)(configWithAuth);
90
- return data;
88
+ const { params, ...rest } = options;
89
+ const optionsWithParams = (0, addQueryParams_1.addQueryParams)(rest, params);
90
+ const requestConfig = await withAuth(accountId, optionsWithParams);
91
+ return (0, axios_1.default)(requestConfig);
91
92
  }
92
93
  async function postRequest(accountId, options) {
93
- const configWithAuth = await withAuth(accountId, options);
94
- const { data } = await (0, axios_1.default)({ ...configWithAuth, method: 'post' });
95
- return data;
94
+ const requestConfig = await withAuth(accountId, options);
95
+ return (0, axios_1.default)({ ...requestConfig, method: 'post' });
96
96
  }
97
97
  async function putRequest(accountId, options) {
98
- const configWithAuth = await withAuth(accountId, options);
99
- const { data } = await (0, axios_1.default)({ ...configWithAuth, method: 'put' });
100
- return data;
98
+ const requestConfig = await withAuth(accountId, options);
99
+ return (0, axios_1.default)({ ...requestConfig, method: 'put' });
101
100
  }
102
101
  async function patchRequest(accountId, options) {
103
- const configWithAuth = await withAuth(accountId, options);
104
- const { data } = await (0, axios_1.default)({ ...configWithAuth, method: 'put' });
105
- return data;
102
+ const requestConfig = await withAuth(accountId, options);
103
+ return (0, axios_1.default)({ ...requestConfig, method: 'patch' });
106
104
  }
107
105
  async function deleteRequest(accountId, options) {
108
- const configWithAuth = await withAuth(accountId, options);
109
- const { data } = await (0, axios_1.default)({ ...configWithAuth, method: 'delete' });
110
- return data;
106
+ const requestConfig = await withAuth(accountId, options);
107
+ return (0, axios_1.default)({ ...requestConfig, method: 'delete' });
111
108
  }
112
- const getRequestStreamCallbackKeys = ['onWrite'];
113
109
  function createGetRequestStream(contentType) {
114
- return async (accountId, options, destPath, logCallbacks) => {
115
- const { query, ...rest } = options;
116
- const axiosConfig = addQueryParams(rest, query);
117
- const logger = (0, logger_1.makeTypedLogger)(logCallbacks);
110
+ return async (accountId, options, destPath) => {
111
+ const { params, ...rest } = options;
112
+ const axiosConfig = (0, addQueryParams_1.addQueryParams)(rest, params);
118
113
  // eslint-disable-next-line no-async-promise-executor
119
114
  return new Promise(async (resolve, reject) => {
120
115
  try {
@@ -151,9 +146,9 @@ function createGetRequestStream(contentType) {
151
146
  reject(err);
152
147
  });
153
148
  writeStream.on('close', async () => {
154
- logger('onWrite', `${i18nKey}.createGetRequestStream.onWrite`, {
149
+ logger_1.logger.log((0, lang_1.i18n)(`${i18nKey}.createGetRequestStream.onWrite`, {
155
150
  filepath,
156
- });
151
+ }));
157
152
  resolve(res);
158
153
  });
159
154
  }
@@ -168,7 +163,7 @@ function createGetRequestStream(contentType) {
168
163
  };
169
164
  }
170
165
  const getOctetStream = createGetRequestStream('application/octet-stream');
171
- const http = {
166
+ exports.http = {
172
167
  get: getRequest,
173
168
  post: postRequest,
174
169
  put: putRequest,
@@ -176,4 +171,3 @@ const http = {
176
171
  delete: deleteRequest,
177
172
  getOctetStream,
178
173
  };
179
- exports.default = http;
@@ -0,0 +1,14 @@
1
+ import { HttpOptions, HubSpotPromise } from '../types/Http';
2
+ declare function getRequest<T>(options: HttpOptions): HubSpotPromise<T>;
3
+ declare function postRequest<T>(options: HttpOptions): HubSpotPromise<T>;
4
+ declare function putRequest<T>(options: HttpOptions): HubSpotPromise<T>;
5
+ declare function patchRequest<T>(options: HttpOptions): HubSpotPromise<T>;
6
+ declare function deleteRequest<T>(options: HttpOptions): HubSpotPromise<T>;
7
+ export declare const http: {
8
+ get: typeof getRequest;
9
+ post: typeof postRequest;
10
+ put: typeof putRequest;
11
+ patch: typeof patchRequest;
12
+ delete: typeof deleteRequest;
13
+ };
14
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.http = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const getAxiosConfig_1 = require("./getAxiosConfig");
9
+ const addQueryParams_1 = require("./addQueryParams");
10
+ async function getRequest(options) {
11
+ const { params, ...rest } = options;
12
+ const optionsWithParams = (0, addQueryParams_1.addQueryParams)(rest, params);
13
+ const requestConfig = await (0, getAxiosConfig_1.getAxiosConfig)(optionsWithParams);
14
+ return (0, axios_1.default)(requestConfig);
15
+ }
16
+ async function postRequest(options) {
17
+ const requestConfig = await (0, getAxiosConfig_1.getAxiosConfig)(options);
18
+ return (0, axios_1.default)({ ...requestConfig, method: 'post' });
19
+ }
20
+ async function putRequest(options) {
21
+ const requestConfig = await (0, getAxiosConfig_1.getAxiosConfig)(options);
22
+ return (0, axios_1.default)({ ...requestConfig, method: 'put' });
23
+ }
24
+ async function patchRequest(options) {
25
+ const requestConfig = await (0, getAxiosConfig_1.getAxiosConfig)(options);
26
+ return (0, axios_1.default)({ ...requestConfig, method: 'patch' });
27
+ }
28
+ async function deleteRequest(options) {
29
+ const requestConfig = await (0, getAxiosConfig_1.getAxiosConfig)(options);
30
+ return (0, axios_1.default)({ ...requestConfig, method: 'delete' });
31
+ }
32
+ exports.http = {
33
+ get: getRequest,
34
+ post: postRequest,
35
+ put: putRequest,
36
+ patch: patchRequest,
37
+ delete: deleteRequest,
38
+ };