@hubspot/local-dev-lib 3.2.0 → 3.3.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/github.d.ts +0 -1
- package/api/localDevAuth.d.ts +2 -1
- package/api/localDevAuth.js +7 -1
- package/api/projects.d.ts +0 -1
- package/lib/archive.d.ts +0 -1
- package/lib/github.d.ts +0 -1
- package/lib/personalAccessKey.d.ts +2 -1
- package/lib/personalAccessKey.js +5 -1
- package/package.json +1 -1
- package/types/Accounts.d.ts +13 -0
- package/types/Http.d.ts +0 -1
package/api/github.d.ts
CHANGED
package/api/localDevAuth.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Environment } from '../types/Config';
|
|
2
|
-
import { ScopeData, AccessTokenResponse, EnabledFeaturesResponse } from '../types/Accounts';
|
|
2
|
+
import { ScopeData, AccessTokenResponse, EnabledFeaturesResponse, ScopeAuthorizationResponse } from '../types/Accounts';
|
|
3
3
|
import { PublicAppInstallationData } from '../types/Apps';
|
|
4
4
|
import { HubSpotPromise } from '../types/Http';
|
|
5
5
|
export declare function fetchAccessToken(personalAccessKey: string, env?: Environment, portalId?: number): HubSpotPromise<AccessTokenResponse>;
|
|
6
6
|
export declare function fetchScopeData(accountId: number, scopeGroup: string): HubSpotPromise<ScopeData>;
|
|
7
|
+
export declare function fetchScopeAuthorizationData(accountId: number): HubSpotPromise<ScopeAuthorizationResponse>;
|
|
7
8
|
export declare function fetchAppInstallationData(portalId: number, projectId: number, appUid: string, requiredScopeGroups: Array<string>, optionalScopeGroups?: Array<string>): HubSpotPromise<PublicAppInstallationData>;
|
|
8
9
|
export declare function fetchEnabledFeatures(accountId: number): Promise<import("axios").AxiosResponse<EnabledFeaturesResponse, any>>;
|
package/api/localDevAuth.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.fetchEnabledFeatures = exports.fetchAppInstallationData = exports.fetchScopeData = exports.fetchAccessToken = void 0;
|
|
6
|
+
exports.fetchEnabledFeatures = exports.fetchAppInstallationData = exports.fetchScopeAuthorizationData = exports.fetchScopeData = exports.fetchAccessToken = void 0;
|
|
7
7
|
const getAxiosConfig_1 = require("../http/getAxiosConfig");
|
|
8
8
|
const http_1 = require("../http");
|
|
9
9
|
const environments_1 = require("../constants/environments");
|
|
@@ -32,6 +32,12 @@ function fetchScopeData(accountId, scopeGroup) {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
exports.fetchScopeData = fetchScopeData;
|
|
35
|
+
async function fetchScopeAuthorizationData(accountId) {
|
|
36
|
+
return http_1.http.get(accountId, {
|
|
37
|
+
url: `${LOCALDEVAUTH_API_AUTH_PATH}/scope-groups/authorized`,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.fetchScopeAuthorizationData = fetchScopeAuthorizationData;
|
|
35
41
|
function fetchAppInstallationData(portalId, projectId, appUid, requiredScopeGroups, optionalScopeGroups = []) {
|
|
36
42
|
return http_1.http.post(portalId, {
|
|
37
43
|
url: `${LOCALDEVAUTH_API_AUTH_PATH}/install-info`,
|
package/api/projects.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
2
|
import { HubSpotPromise, QueryParams } from '../types/Http';
|
|
4
3
|
import { Project, FetchProjectResponse, UploadProjectResponse, ProjectSettings, FetchPlatformVersionResponse, WarnLogsResponse, UploadIRResponse } from '../types/Project';
|
|
5
4
|
import { Build, FetchProjectBuildsResponse } from '../types/Build';
|
package/lib/archive.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
2
|
import { CopySourceToDestOptions } from '../types/Archive';
|
|
4
3
|
export declare function extractZipArchive(zip: Buffer, name: string, dest: string, { sourceDir, includesRootDir, hideLogs }?: CopySourceToDestOptions): Promise<boolean>;
|
package/lib/github.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
2
|
import { GithubReleaseData, GithubRepoFile, RepoPath, CloneGithubRepoOptions } from '../types/Github';
|
|
4
3
|
export declare function fetchFileFromRepository<T = Buffer>(repoPath: RepoPath, filePath: string, ref: string): Promise<T>;
|
|
5
4
|
export declare function fetchReleaseData(repoPath: RepoPath, tag?: string): Promise<GithubReleaseData>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CLIAccount } from '../types/Accounts';
|
|
1
|
+
import { CLIAccount, ScopeGroupAuthorization } from '../types/Accounts';
|
|
2
2
|
import { Environment } from '../types/Config';
|
|
3
3
|
import { AccessToken } from '../types/Accounts';
|
|
4
4
|
export declare function getAccessToken(personalAccessKey: string, env?: Environment, accountId?: number): Promise<AccessToken>;
|
|
@@ -7,4 +7,5 @@ export declare function enabledFeaturesForPersonalAccessKey(accountId: number):
|
|
|
7
7
|
[key: string]: number;
|
|
8
8
|
} | undefined>;
|
|
9
9
|
export declare function scopesOnAccessToken(accountId: number): Promise<Array<string>>;
|
|
10
|
+
export declare function authorizedScopesForPortalAndUser(accountId: number): Promise<Array<ScopeGroupAuthorization>>;
|
|
10
11
|
export declare function updateConfigWithAccessToken(token: AccessToken, personalAccessKey: string, env?: Environment, name?: string, makeDefault?: boolean): Promise<CLIAccount | null>;
|
package/lib/personalAccessKey.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.updateConfigWithAccessToken = exports.scopesOnAccessToken = exports.enabledFeaturesForPersonalAccessKey = exports.accessTokenForPersonalAccessKey = exports.getAccessToken = void 0;
|
|
6
|
+
exports.updateConfigWithAccessToken = exports.authorizedScopesForPortalAndUser = exports.scopesOnAccessToken = exports.enabledFeaturesForPersonalAccessKey = exports.accessTokenForPersonalAccessKey = exports.getAccessToken = void 0;
|
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
|
8
8
|
const environments_1 = require("../constants/environments");
|
|
9
9
|
const auth_1 = require("../constants/auth");
|
|
@@ -107,6 +107,10 @@ async function scopesOnAccessToken(accountId) {
|
|
|
107
107
|
return (await getNewAccessTokenByAccountId(accountId)).scopeGroups;
|
|
108
108
|
}
|
|
109
109
|
exports.scopesOnAccessToken = scopesOnAccessToken;
|
|
110
|
+
async function authorizedScopesForPortalAndUser(accountId) {
|
|
111
|
+
return (await (0, localDevAuth_1.fetchScopeAuthorizationData)(accountId)).data.results;
|
|
112
|
+
}
|
|
113
|
+
exports.authorizedScopesForPortalAndUser = authorizedScopesForPortalAndUser;
|
|
110
114
|
async function updateConfigWithAccessToken(token, personalAccessKey, env, name, makeDefault = false) {
|
|
111
115
|
const { portalId, accessToken, expiresAt, accountType } = token;
|
|
112
116
|
const accountEnv = env || (0, config_1.getEnv)(name);
|
package/package.json
CHANGED
package/types/Accounts.d.ts
CHANGED
|
@@ -106,6 +106,19 @@ export type ScopeData = {
|
|
|
106
106
|
portalScopesInGroup: Array<string>;
|
|
107
107
|
userScopesInGroup: Array<string>;
|
|
108
108
|
};
|
|
109
|
+
export type ScopeAuthorizationResponse = {
|
|
110
|
+
results: Array<ScopeGroupAuthorization>;
|
|
111
|
+
};
|
|
112
|
+
export type ScopeGroupAuthorization = {
|
|
113
|
+
scopeGroup: ScopeGroup;
|
|
114
|
+
portalAuthorized: boolean;
|
|
115
|
+
userAuthorized: boolean;
|
|
116
|
+
};
|
|
117
|
+
export type ScopeGroup = {
|
|
118
|
+
name: string;
|
|
119
|
+
shortDescription: string;
|
|
120
|
+
longDescription: string;
|
|
121
|
+
};
|
|
109
122
|
export type AccessTokenResponse = {
|
|
110
123
|
hubId: number;
|
|
111
124
|
userId: number;
|
package/types/Http.d.ts
CHANGED