@hubspot/local-dev-lib 3.9.0-beta.0 → 3.10.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.
@@ -1,7 +1,8 @@
1
- import { DeveloperTestAccount, CreateDeveloperTestAccountResponse, FetchDeveloperTestAccountsResponse } from '../types/developerTestAccounts';
1
+ import { DeveloperTestAccount, CreateDeveloperTestAccountResponse, FetchDeveloperTestAccountsResponse, DeveloperTestAccountConfig, CreateDeveloperTestAccountV3Response } from '../types/developerTestAccounts';
2
2
  import { Environment } from '../types/Config';
3
3
  import { HubSpotPromise } from '../types/Http';
4
4
  export declare function fetchDeveloperTestAccounts(accountId: number): HubSpotPromise<FetchDeveloperTestAccountsResponse>;
5
- export declare function createDeveloperTestAccount(accountId: number, accountName: string): HubSpotPromise<CreateDeveloperTestAccountResponse>;
6
- export declare function deleteDeveloperTestAccount(accountId: number, testAccountId: number): HubSpotPromise<void>;
5
+ export declare function createDeveloperTestAccount(accountId: number, accountInfo: string): HubSpotPromise<CreateDeveloperTestAccountResponse>;
6
+ export declare function createDeveloperTestAccount(accountId: number, accountInfo: DeveloperTestAccountConfig): HubSpotPromise<CreateDeveloperTestAccountV3Response>;
7
+ export declare function deleteDeveloperTestAccount(accountId: number, testAccountId: number, useV3?: boolean): HubSpotPromise<void>;
7
8
  export declare function fetchDeveloperTestAccountData(accessToken: string, accountId: number, env?: Environment): HubSpotPromise<DeveloperTestAccount>;
@@ -10,21 +10,34 @@ const getAxiosConfig_1 = require("../http/getAxiosConfig");
10
10
  const environments_1 = require("../constants/environments");
11
11
  const api_1 = require("../constants/api");
12
12
  const TEST_ACCOUNTS_API_PATH = 'integrators/test-portals/v2';
13
+ const TEST_ACCOUNTS_API_PATH_V3 = 'integrators/test-portals/v3';
13
14
  function fetchDeveloperTestAccounts(accountId) {
14
15
  return http_1.http.get(accountId, {
15
16
  url: TEST_ACCOUNTS_API_PATH,
16
17
  });
17
18
  }
18
19
  exports.fetchDeveloperTestAccounts = fetchDeveloperTestAccounts;
19
- function createDeveloperTestAccount(accountId, accountName) {
20
+ function createDeveloperTestAccount(accountId, accountInfo) {
21
+ if (typeof accountInfo === 'object') {
22
+ return http_1.http.post(accountId, {
23
+ url: TEST_ACCOUNTS_API_PATH_V3,
24
+ data: accountInfo,
25
+ timeout: api_1.SANDBOX_TIMEOUT,
26
+ });
27
+ }
20
28
  return http_1.http.post(accountId, {
21
29
  url: TEST_ACCOUNTS_API_PATH,
22
- data: { accountName, generatePersonalAccessKey: true },
30
+ data: { accountName: accountInfo, generatePersonalAccessKey: true },
23
31
  timeout: api_1.SANDBOX_TIMEOUT,
24
32
  });
25
33
  }
26
34
  exports.createDeveloperTestAccount = createDeveloperTestAccount;
27
- function deleteDeveloperTestAccount(accountId, testAccountId) {
35
+ function deleteDeveloperTestAccount(accountId, testAccountId, useV3 = false) {
36
+ if (useV3) {
37
+ return http_1.http.delete(accountId, {
38
+ url: `${TEST_ACCOUNTS_API_PATH_V3}/${testAccountId}`,
39
+ });
40
+ }
28
41
  return http_1.http.delete(accountId, {
29
42
  url: `${TEST_ACCOUNTS_API_PATH}/${testAccountId}`,
30
43
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/local-dev-lib",
3
- "version": "3.9.0-beta.0",
3
+ "version": "3.10.0-beta.0",
4
4
  "description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,7 +17,22 @@ export type CreateDeveloperTestAccountResponse = {
17
17
  currentUserHasAccess: boolean;
18
18
  personalAccessKey: string;
19
19
  };
20
+ export type CreateDeveloperTestAccountV3Response = {
21
+ id: number;
22
+ accountName: string;
23
+ personalAccessKey: string;
24
+ };
20
25
  export type FetchDeveloperTestAccountsResponse = {
21
26
  results: DeveloperTestAccount[];
22
27
  maxTestPortals: number;
23
28
  };
29
+ export type AccountLevel = 'STARTER' | 'PROFESSIONAL' | 'ENTERPRISE';
30
+ export type DeveloperTestAccountConfig = {
31
+ accountName: string;
32
+ description?: string;
33
+ marketingLevel?: AccountLevel;
34
+ opsLevel?: AccountLevel;
35
+ serviceLevel?: AccountLevel;
36
+ salesLevel?: AccountLevel;
37
+ contentLevel?: AccountLevel;
38
+ };