@forge/cli-shared 0.0.0-experimental-9489df9 → 0.0.0-experimental-52c2a24
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/CHANGELOG.md +599 -4
- package/out/app-logs/view-logs.js +3 -3
- package/out/apps/app-config.d.ts.map +1 -1
- package/out/apps/app-config.js +3 -2
- package/out/apps/create-app-graphql-client.d.ts.map +1 -1
- package/out/apps/create-app-graphql-client.js +6 -2
- package/out/apps/package-installer.js +1 -1
- package/out/apps/register-app.js +1 -1
- package/out/apps/template.js +12 -12
- package/out/auth/index.d.ts +0 -1
- package/out/auth/index.d.ts.map +1 -1
- package/out/auth/index.js +0 -1
- package/out/auth/personal/credential-store.d.ts +57 -0
- package/out/auth/personal/credential-store.d.ts.map +1 -0
- package/out/auth/personal/credential-store.js +188 -0
- package/out/auth/personal/index.d.ts +1 -4
- package/out/auth/personal/index.d.ts.map +1 -1
- package/out/auth/personal/index.js +1 -4
- package/out/auth/personal/login.d.ts +2 -2
- package/out/auth/personal/login.d.ts.map +1 -1
- package/out/auth/personal/login.js +1 -1
- package/out/auth/personal/logout.d.ts +2 -2
- package/out/auth/personal/logout.d.ts.map +1 -1
- package/out/auth/personal/me-graphql-client.d.ts +2 -1
- package/out/auth/personal/me-graphql-client.d.ts.map +1 -1
- package/out/auth/personal/me-graphql-client.js +3 -2
- package/out/auth/personal/token-authenticator.d.ts +3 -3
- package/out/auth/personal/token-authenticator.d.ts.map +1 -1
- package/out/auth/personal/token-authenticator.js +5 -5
- package/out/config/config-file-section-reader.js +2 -1
- package/out/config/config-file-section-writer.js +2 -1
- package/out/config/config-file.d.ts +14 -8
- package/out/config/config-file.d.ts.map +1 -1
- package/out/config/config-file.js +42 -41
- package/out/config/config-section.js +2 -1
- package/out/config/config.d.ts +2 -1
- package/out/config/config.d.ts.map +1 -1
- package/out/config/config.js +4 -2
- package/out/file-system/file-system-reader.d.ts +1 -0
- package/out/file-system/file-system-reader.d.ts.map +1 -1
- package/out/file-system/file-system-reader.js +7 -7
- package/out/file-system/file-system-writer.js +1 -1
- package/out/file-system/zip-accessor.js +1 -1
- package/out/graphql/app-environment-graphql-client.d.ts +3 -2
- package/out/graphql/app-environment-graphql-client.d.ts.map +1 -1
- package/out/graphql/app-environment-graphql-client.js +3 -2
- package/out/graphql/gateway.js +5 -3
- package/out/graphql/get-mutation-error.d.ts +1 -0
- package/out/graphql/get-mutation-error.d.ts.map +1 -1
- package/out/graphql/get-mutation-error.js +3 -2
- package/out/graphql/graphql-types.d.ts +5781 -618
- package/out/graphql/graphql-types.d.ts.map +1 -1
- package/out/graphql/graphql-types.js +520 -22
- package/out/graphql/minimal-graphql-runner.d.ts +9 -4
- package/out/graphql/minimal-graphql-runner.d.ts.map +1 -1
- package/out/graphql/minimal-graphql-runner.js +15 -5
- package/out/graphql/mutation-aware-graphql-client.d.ts +15 -4
- package/out/graphql/mutation-aware-graphql-client.d.ts.map +1 -1
- package/out/graphql/mutation-aware-graphql-client.js +17 -2
- package/out/http-client/feedback-post-client.js +1 -1
- package/out/http-client/file-uploader.js +1 -1
- package/out/service/bridge-script-service.d.ts +2 -0
- package/out/service/bridge-script-service.d.ts.map +1 -1
- package/out/service/bridge-script-service.js +4 -2
- package/out/service/feature-flag-service.d.ts +18 -6
- package/out/service/feature-flag-service.d.ts.map +1 -1
- package/out/service/feature-flag-service.js +32 -8
- package/out/service/iframe-resizer-script-service.d.ts +2 -0
- package/out/service/iframe-resizer-script-service.d.ts.map +1 -1
- package/out/service/iframe-resizer-script-service.js +4 -2
- package/out/shared/error-handling.d.ts +16 -2
- package/out/shared/error-handling.d.ts.map +1 -1
- package/out/shared/error-handling.js +43 -9
- package/out/shared/index.js +1 -1
- package/out/shared/installationId.js +2 -2
- package/out/shared/pause.js +2 -1
- package/out/shared/product.d.ts +4 -1
- package/out/shared/product.d.ts.map +1 -1
- package/out/shared/product.js +15 -5
- package/out/shared/read-app-config-files.d.ts.map +1 -1
- package/out/shared/read-app-config-files.js +8 -6
- package/out/shared/validate.d.ts +1 -1
- package/out/shared/validate.d.ts.map +1 -1
- package/out/shared/validate.js +8 -3
- package/out/ui/command-line-ui.d.ts +5 -3
- package/out/ui/command-line-ui.d.ts.map +1 -1
- package/out/ui/command-line-ui.js +37 -10
- package/out/ui/index.d.ts +0 -1
- package/out/ui/index.d.ts.map +1 -1
- package/out/ui/index.js +0 -1
- package/out/ui/multiple-table-prompt.js +4 -2
- package/out/ui/runtime-log.d.ts.map +1 -1
- package/out/ui/runtime-log.js +10 -5
- package/out/ui/single-table-prompt.js +4 -2
- package/out/ui/table-prompt.js +1 -1
- package/out/ui/text.d.ts +59 -11
- package/out/ui/text.d.ts.map +1 -1
- package/out/ui/text.js +90 -24
- package/out/ui/ui.d.ts +11 -0
- package/out/ui/ui.d.ts.map +1 -1
- package/package.json +13 -15
- package/out/auth/credentials-store-provider.d.ts +0 -4
- package/out/auth/credentials-store-provider.d.ts.map +0 -1
- package/out/auth/credentials-store-provider.js +0 -11
- package/out/auth/personal/abstract-token-store-getter.d.ts +0 -13
- package/out/auth/personal/abstract-token-store-getter.d.ts.map +0 -1
- package/out/auth/personal/abstract-token-store-getter.js +0 -31
- package/out/auth/personal/token-store-cache.d.ts +0 -12
- package/out/auth/personal/token-store-cache.d.ts.map +0 -1
- package/out/auth/personal/token-store-cache.js +0 -41
- package/out/auth/personal/token-store-keytar.d.ts +0 -23
- package/out/auth/personal/token-store-keytar.d.ts.map +0 -1
- package/out/auth/personal/token-store-keytar.js +0 -101
- package/out/auth/personal/token-store.d.ts +0 -28
- package/out/auth/personal/token-store.d.ts.map +0 -1
- package/out/auth/personal/token-store.js +0 -21
- package/out/ui/validation-error.d.ts +0 -3
- package/out/ui/validation-error.d.ts.map +0 -1
- package/out/ui/validation-error.js +0 -6
|
@@ -2,14 +2,19 @@ import { GraphQLClient } from 'graphql-request';
|
|
|
2
2
|
import { GraphQLError } from 'graphql-request/dist/types';
|
|
3
3
|
import { Authenticator, AuthorizationHeader } from '../auth';
|
|
4
4
|
import { CLIDetails } from '../index';
|
|
5
|
+
import { BaseError, UserError } from '../shared';
|
|
5
6
|
import { GraphQLRunner } from './graphql-client';
|
|
6
|
-
export declare class GraphQLAuthenticationError extends
|
|
7
|
+
export declare class GraphQLAuthenticationError extends UserError {
|
|
7
8
|
}
|
|
8
|
-
export declare class OutdatedClientVersionError extends
|
|
9
|
+
export declare class OutdatedClientVersionError extends UserError {
|
|
9
10
|
constructor();
|
|
10
11
|
}
|
|
11
|
-
export declare class GraphQLProviderServiceError extends
|
|
12
|
-
|
|
12
|
+
export declare class GraphQLProviderServiceError extends BaseError {
|
|
13
|
+
private readonly userError;
|
|
14
|
+
private readonly requestId;
|
|
15
|
+
constructor(userError: boolean, requestId: string | undefined, errors: GraphQLError[]);
|
|
16
|
+
isUserError(): boolean;
|
|
17
|
+
getAttributes(): Record<string, any>;
|
|
13
18
|
}
|
|
14
19
|
export declare class GraphqlError extends Error {
|
|
15
20
|
constructor(data: any, requestId?: string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"minimal-graphql-runner.d.ts","sourceRoot":"","sources":["../../src/graphql/minimal-graphql-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"minimal-graphql-runner.d.ts","sourceRoot":"","sources":["../../src/graphql/minimal-graphql-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AA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|
@@ -2,20 +2,29 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MinimalGraphQLRunner = exports.GraphqlError = exports.GraphQLProviderServiceError = exports.OutdatedClientVersionError = exports.GraphQLAuthenticationError = void 0;
|
|
4
4
|
const graphql_request_1 = require("graphql-request");
|
|
5
|
+
const shared_1 = require("../shared");
|
|
5
6
|
const ui_1 = require("../ui");
|
|
6
|
-
class GraphQLAuthenticationError extends
|
|
7
|
+
class GraphQLAuthenticationError extends shared_1.UserError {
|
|
7
8
|
}
|
|
8
9
|
exports.GraphQLAuthenticationError = GraphQLAuthenticationError;
|
|
9
10
|
const isOutdatedClientVersionError = (error) => { var _a; return (_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('client version is outdated'); };
|
|
10
|
-
class OutdatedClientVersionError extends
|
|
11
|
+
class OutdatedClientVersionError extends shared_1.UserError {
|
|
11
12
|
constructor() {
|
|
12
13
|
super(ui_1.Text.graphQL.outdatedClientVersion);
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
exports.OutdatedClientVersionError = OutdatedClientVersionError;
|
|
16
|
-
class GraphQLProviderServiceError extends
|
|
17
|
-
constructor(
|
|
17
|
+
class GraphQLProviderServiceError extends shared_1.BaseError {
|
|
18
|
+
constructor(userError, requestId, errors) {
|
|
18
19
|
super(`${ui_1.Text.graphQL.error}: ${JSON.stringify(errors)}, requestId=${requestId || 'unknown'}`);
|
|
20
|
+
this.userError = userError;
|
|
21
|
+
this.requestId = requestId;
|
|
22
|
+
}
|
|
23
|
+
isUserError() {
|
|
24
|
+
return this.userError;
|
|
25
|
+
}
|
|
26
|
+
getAttributes() {
|
|
27
|
+
return Object.assign(Object.assign({}, super.getAttributes()), { requestId: this.requestId });
|
|
19
28
|
}
|
|
20
29
|
}
|
|
21
30
|
exports.GraphQLProviderServiceError = GraphQLProviderServiceError;
|
|
@@ -42,7 +51,8 @@ class MinimalGraphQLRunner {
|
|
|
42
51
|
if (errors.find((e) => isOutdatedClientVersionError(e))) {
|
|
43
52
|
throw new OutdatedClientVersionError();
|
|
44
53
|
}
|
|
45
|
-
|
|
54
|
+
const isUserError = status >= 400 && status < 500;
|
|
55
|
+
throw new GraphQLProviderServiceError(isUserError, requestId, errors);
|
|
46
56
|
}
|
|
47
57
|
if (status !== 200) {
|
|
48
58
|
throw new GraphqlError(data, requestId);
|
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import { GraphQLClient } from './index';
|
|
2
|
-
import { AvailableMutations, GraphQLRunner } from './graphql-client';
|
|
3
|
-
|
|
2
|
+
import { AvailableMutations, GraphQLRunner, MutationResult } from './graphql-client';
|
|
3
|
+
import { BaseError } from '../shared';
|
|
4
|
+
export declare class UnexpectedGraphQlResponseError extends BaseError {
|
|
4
5
|
}
|
|
5
6
|
export declare class GraphQlMutationError extends UnexpectedGraphQlResponseError {
|
|
6
7
|
private readonly code;
|
|
7
|
-
|
|
8
|
+
private readonly statusCode;
|
|
9
|
+
private readonly requestId;
|
|
10
|
+
constructor(message: string, { requestId, code, statusCode }: {
|
|
11
|
+
requestId: string | undefined;
|
|
12
|
+
code?: string;
|
|
13
|
+
statusCode?: number;
|
|
14
|
+
});
|
|
8
15
|
getCode: () => string;
|
|
16
|
+
getStatusCode: () => number | undefined;
|
|
17
|
+
getRequestId: () => string | undefined;
|
|
18
|
+
isUserError(): boolean;
|
|
19
|
+
getAttributes(): Record<string, any>;
|
|
9
20
|
}
|
|
10
21
|
export declare class MutationAwareGraphQLClient implements GraphQLClient {
|
|
11
22
|
private readonly runner;
|
|
12
23
|
constructor(runner: GraphQLRunner);
|
|
13
24
|
mutate<TLabel extends keyof AvailableMutations, TVariables>(query: string, variables: TVariables): Promise<{
|
|
14
|
-
response:
|
|
25
|
+
response: MutationResult<TLabel>;
|
|
15
26
|
requestId: string | undefined;
|
|
16
27
|
}>;
|
|
17
28
|
query<TVariables, TResponse>(query: string, variables: TVariables): Promise<TResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutation-aware-graphql-client.d.ts","sourceRoot":"","sources":["../../src/graphql/mutation-aware-graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"mutation-aware-graphql-client.d.ts","sourceRoot":"","sources":["../../src/graphql/mutation-aware-graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,qBAAa,8BAA+B,SAAQ,SAAS;CAAG;AAChE,qBAAa,oBAAqB,SAAQ,8BAA8B;IACtE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqB;IAChD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqB;gBAG7C,OAAO,EAAE,MAAM,EACf,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE;IAQxG,OAAO,QAAO,MAAM,CAElB;IAEF,aAAa,QAAO,MAAM,GAAG,SAAS,CAEpC;IAEF,YAAY,QAAO,MAAM,GAAG,SAAS,CAEnC;IAEK,WAAW,IAAI,OAAO;IAItB,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAM5C;AAED,qBAAa,0BAA2B,YAAW,aAAa;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAErC,MAAM,CAAC,MAAM,SAAS,MAAM,kBAAkB,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU;;;;IAuBhG,KAAK,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU;CAI/E"}
|
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MutationAwareGraphQLClient = exports.GraphQlMutationError = exports.UnexpectedGraphQlResponseError = void 0;
|
|
4
|
-
|
|
4
|
+
const shared_1 = require("../shared");
|
|
5
|
+
class UnexpectedGraphQlResponseError extends shared_1.BaseError {
|
|
5
6
|
}
|
|
6
7
|
exports.UnexpectedGraphQlResponseError = UnexpectedGraphQlResponseError;
|
|
7
8
|
class GraphQlMutationError extends UnexpectedGraphQlResponseError {
|
|
8
|
-
constructor(message, code) {
|
|
9
|
+
constructor(message, { requestId, code, statusCode }) {
|
|
9
10
|
super(message);
|
|
10
11
|
this.getCode = () => {
|
|
11
12
|
return this.code;
|
|
12
13
|
};
|
|
14
|
+
this.getStatusCode = () => {
|
|
15
|
+
return this.statusCode;
|
|
16
|
+
};
|
|
17
|
+
this.getRequestId = () => {
|
|
18
|
+
return this.requestId;
|
|
19
|
+
};
|
|
13
20
|
this.code = code || 'GENERIC_GRAPHQL_MUTATION_ERROR';
|
|
21
|
+
this.statusCode = statusCode;
|
|
22
|
+
this.requestId = requestId;
|
|
23
|
+
}
|
|
24
|
+
isUserError() {
|
|
25
|
+
return Boolean(this.statusCode && this.statusCode >= 400 && this.statusCode < 500);
|
|
26
|
+
}
|
|
27
|
+
getAttributes() {
|
|
28
|
+
return Object.assign(Object.assign({}, super.getAttributes()), { requestId: this.getRequestId() });
|
|
14
29
|
}
|
|
15
30
|
}
|
|
16
31
|
exports.GraphQlMutationError = GraphQlMutationError;
|
|
@@ -26,7 +26,7 @@ class HttpsFeedbackPostClient {
|
|
|
26
26
|
this.forgeFeedbackCollectorUrl = 'https://jsd-widget.atlassian.com/api/embeddable/b8a921af-5e55-4b6f-a219-590251ab908f/request?requestTypeId=326';
|
|
27
27
|
}
|
|
28
28
|
async sendFeedback(feedback) {
|
|
29
|
-
return node_fetch_1.default(this.forgeFeedbackCollectorUrl, {
|
|
29
|
+
return (0, node_fetch_1.default)(this.forgeFeedbackCollectorUrl, {
|
|
30
30
|
method: 'POST',
|
|
31
31
|
headers: {
|
|
32
32
|
'Content-Type': 'application/json'
|
|
@@ -34,7 +34,7 @@ class HttpFileUploader {
|
|
|
34
34
|
async uploadFromPath(url, filePath) {
|
|
35
35
|
const fileContents = this.fileSystem.readBinaryFile(filePath);
|
|
36
36
|
const validFileContents = validateFileContents(filePath, fileContents);
|
|
37
|
-
const response = await node_fetch_1.default(url, {
|
|
37
|
+
const response = await (0, node_fetch_1.default)(url, {
|
|
38
38
|
method: 'PUT',
|
|
39
39
|
headers: {
|
|
40
40
|
'Content-Type': 'application/zip',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-script-service.d.ts","sourceRoot":"","sources":["../../src/service/bridge-script-service.ts"],"names":[],"mappings":";AAMA,qBAAa,mBAAmB;
|
|
1
|
+
{"version":3,"file":"bridge-script-service.d.ts","sourceRoot":"","sources":["../../src/service/bridge-script-service.ts"],"names":[],"mappings":";AAMA,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,SAAkC;IAElE,OAAO,CAAC,yBAAyB;IAI1B,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM;CAYtE"}
|
|
@@ -7,9 +7,11 @@ const gateway_1 = require("../graphql/gateway");
|
|
|
7
7
|
const BRIDGE_CORE_CDN_PATH = 'global-bridge.js';
|
|
8
8
|
const GLOBAL_FORGE_INSTALL_ID = 'forge';
|
|
9
9
|
class BridgeScriptService {
|
|
10
|
+
constructor(env = (0, gateway_1.getEnvironment)(gateway_1.CDNEnvironments)) {
|
|
11
|
+
this.env = env;
|
|
12
|
+
}
|
|
10
13
|
createBridgeCoreScriptTag() {
|
|
11
|
-
|
|
12
|
-
return `<script src="https://${GLOBAL_FORGE_INSTALL_ID}.cdn.${env}.atlassian-dev.net/${BRIDGE_CORE_CDN_PATH}"></script>`;
|
|
14
|
+
return `<script src="https://${GLOBAL_FORGE_INSTALL_ID}.cdn.${this.env}.atlassian-dev.net/${BRIDGE_CORE_CDN_PATH}"></script>`;
|
|
13
15
|
}
|
|
14
16
|
injectBridgeCore(content, onError) {
|
|
15
17
|
const $ = cheerio_1.default.load(content);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LDClient, LDOptions, LDUser } from 'launchdarkly-node-client-sdk';
|
|
2
|
-
import {
|
|
2
|
+
import { CredentialGetter } from '../auth';
|
|
3
3
|
import { ConfigSectionReader } from '../config';
|
|
4
4
|
import { getEnvironment } from '../graphql';
|
|
5
5
|
import { CLIDetails } from '../shared';
|
|
@@ -8,22 +8,27 @@ declare type FeatureFlagType = {
|
|
|
8
8
|
'forge-cli-test-flag': 'apple' | 'banana' | 'orange' | 'watermelon';
|
|
9
9
|
'forge-cli-startup-warning': string;
|
|
10
10
|
'xls-lambda-runtime': string;
|
|
11
|
+
'forge-cli-enable-muao': boolean;
|
|
12
|
+
'forge-cli-enable-sentry': boolean;
|
|
13
|
+
'xls-do-not-automatically-add-read-me-scope': boolean;
|
|
11
14
|
};
|
|
12
15
|
export declare type FeatureFlag = keyof FeatureFlagType;
|
|
13
|
-
export
|
|
14
|
-
readFlag<F extends FeatureFlag>(flag: F): Promise<FeatureFlagType[F] | null>;
|
|
16
|
+
export declare abstract class FeatureFlagReader {
|
|
17
|
+
abstract readFlag<F extends FeatureFlag>(flag: F): Promise<FeatureFlagType[F] | null>;
|
|
18
|
+
isNodeRuntime(): Promise<boolean>;
|
|
19
|
+
readMeScopeAddedByXLS(): Promise<boolean>;
|
|
15
20
|
}
|
|
16
21
|
declare type ILaunchDarkly = Pick<LDClient, 'variation' | 'waitUntilReady'>;
|
|
17
22
|
declare type LaunchDarklyInitialize = (envKey: string, user: LDUser, options?: LDOptions) => ILaunchDarkly;
|
|
18
23
|
export declare function cachedMethod<C, T>(getter: (this: C) => Promise<T>): (this: C) => Promise<T>;
|
|
19
|
-
export declare class FeatureFlagService
|
|
24
|
+
export declare class FeatureFlagService extends FeatureFlagReader {
|
|
20
25
|
private readonly logger;
|
|
21
26
|
private readonly cliDetails;
|
|
22
|
-
private readonly
|
|
27
|
+
private readonly credentialStore;
|
|
23
28
|
private readonly appConfigReader;
|
|
24
29
|
private readonly getEnvironmentFn;
|
|
25
30
|
private readonly initializeLD;
|
|
26
|
-
constructor(logger: Logger, cliDetails: Pick<CLIDetails, 'version'> | undefined,
|
|
31
|
+
constructor(logger: Logger, cliDetails: Pick<CLIDetails, 'version'> | undefined, credentialStore: CredentialGetter, appConfigReader: ConfigSectionReader<{
|
|
27
32
|
id: string;
|
|
28
33
|
}>, getEnvironmentFn?: typeof getEnvironment, initializeLD?: LaunchDarklyInitialize);
|
|
29
34
|
private appID;
|
|
@@ -31,5 +36,12 @@ export declare class FeatureFlagService implements FeatureFlagReader {
|
|
|
31
36
|
private client;
|
|
32
37
|
readFlag<F extends FeatureFlag>(flag: F): Promise<FeatureFlagType[F] | null>;
|
|
33
38
|
}
|
|
39
|
+
export declare class MockFeatureFlagReader extends FeatureFlagReader {
|
|
40
|
+
private featureFlags;
|
|
41
|
+
constructor(featureFlags?: {
|
|
42
|
+
[key in FeatureFlag]: any;
|
|
43
|
+
} | undefined);
|
|
44
|
+
readFlag<F extends keyof FeatureFlagType>(flag: F): Promise<FeatureFlagType[F] | null>;
|
|
45
|
+
}
|
|
34
46
|
export {};
|
|
35
47
|
//# sourceMappingURL=feature-flag-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-flag-service.d.ts","sourceRoot":"","sources":["../../src/service/feature-flag-service.ts"],"names":[],"mappings":"AAAA,O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AI,CAAC;CAG7F"}
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FeatureFlagService = exports.cachedMethod = void 0;
|
|
3
|
+
exports.MockFeatureFlagReader = exports.FeatureFlagService = exports.cachedMethod = exports.FeatureFlagReader = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const launchdarkly_node_client_sdk_1 = tslib_1.__importStar(require("launchdarkly-node-client-sdk"));
|
|
6
6
|
const env_paths_1 = tslib_1.__importDefault(require("env-paths"));
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const util_1 = require("util");
|
|
9
9
|
const graphql_1 = require("../graphql");
|
|
10
|
+
class FeatureFlagReader {
|
|
11
|
+
async isNodeRuntime() {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
return (_b = (_a = (await this.readFlag('xls-lambda-runtime'))) === null || _a === void 0 ? void 0 : _a.startsWith('nodejs')) !== null && _b !== void 0 ? _b : false;
|
|
14
|
+
}
|
|
15
|
+
async readMeScopeAddedByXLS() {
|
|
16
|
+
var _a;
|
|
17
|
+
const doNotAddReadMeScope = (_a = (await this.readFlag('xls-do-not-automatically-add-read-me-scope'))) !== null && _a !== void 0 ? _a : false;
|
|
18
|
+
return !doNotAddReadMeScope;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.FeatureFlagReader = FeatureFlagReader;
|
|
10
22
|
var CLIENT_SIDE_ID;
|
|
11
23
|
(function (CLIENT_SIDE_ID) {
|
|
12
24
|
CLIENT_SIDE_ID["DEV"] = "5d22bfb52c6a0707aac5be90";
|
|
@@ -26,11 +38,12 @@ function cachedMethod(getter) {
|
|
|
26
38
|
};
|
|
27
39
|
}
|
|
28
40
|
exports.cachedMethod = cachedMethod;
|
|
29
|
-
class FeatureFlagService {
|
|
30
|
-
constructor(logger, cliDetails,
|
|
41
|
+
class FeatureFlagService extends FeatureFlagReader {
|
|
42
|
+
constructor(logger, cliDetails, credentialStore, appConfigReader, getEnvironmentFn = graphql_1.getEnvironment, initializeLD = launchdarkly_node_client_sdk_1.default.initialize) {
|
|
43
|
+
super();
|
|
31
44
|
this.logger = logger;
|
|
32
45
|
this.cliDetails = cliDetails;
|
|
33
|
-
this.
|
|
46
|
+
this.credentialStore = credentialStore;
|
|
34
47
|
this.appConfigReader = appConfigReader;
|
|
35
48
|
this.getEnvironmentFn = getEnvironmentFn;
|
|
36
49
|
this.initializeLD = initializeLD;
|
|
@@ -54,7 +67,7 @@ class FeatureFlagService {
|
|
|
54
67
|
}
|
|
55
68
|
let key;
|
|
56
69
|
try {
|
|
57
|
-
key = (await this.
|
|
70
|
+
key = (await this.credentialStore.getCredentials()).accountId;
|
|
58
71
|
}
|
|
59
72
|
catch (e) {
|
|
60
73
|
key = 'anonymous';
|
|
@@ -64,10 +77,10 @@ class FeatureFlagService {
|
|
|
64
77
|
this.client = cachedMethod(async () => {
|
|
65
78
|
const clientSideID = this.getEnvironmentFn(CLIENT_SIDE_ID);
|
|
66
79
|
const user = await this.user();
|
|
67
|
-
const cachePath = env_paths_1.default('@forge/cli').cache;
|
|
68
|
-
await util_1.promisify(fs_1.mkdir)(cachePath, { recursive: true });
|
|
80
|
+
const cachePath = (0, env_paths_1.default)('@forge/cli').cache;
|
|
81
|
+
await (0, util_1.promisify)(fs_1.mkdir)(cachePath, { recursive: true });
|
|
69
82
|
const options = {
|
|
70
|
-
logger: launchdarkly_node_client_sdk_1.basicLogger({ level: 'error' }),
|
|
83
|
+
logger: (0, launchdarkly_node_client_sdk_1.basicLogger)({ level: 'error' }),
|
|
71
84
|
sendEvents: false
|
|
72
85
|
};
|
|
73
86
|
return this.initializeLD(clientSideID, user, options);
|
|
@@ -86,3 +99,14 @@ class FeatureFlagService {
|
|
|
86
99
|
}
|
|
87
100
|
}
|
|
88
101
|
exports.FeatureFlagService = FeatureFlagService;
|
|
102
|
+
class MockFeatureFlagReader extends FeatureFlagReader {
|
|
103
|
+
constructor(featureFlags = undefined) {
|
|
104
|
+
super();
|
|
105
|
+
this.featureFlags = featureFlags;
|
|
106
|
+
}
|
|
107
|
+
async readFlag(flag) {
|
|
108
|
+
var _a;
|
|
109
|
+
return ((_a = this.featureFlags) === null || _a === void 0 ? void 0 : _a[flag]) || null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.MockFeatureFlagReader = MockFeatureFlagReader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe-resizer-script-service.d.ts","sourceRoot":"","sources":["../../src/service/iframe-resizer-script-service.ts"],"names":[],"mappings":";AAMA,qBAAa,0BAA0B;
|
|
1
|
+
{"version":3,"file":"iframe-resizer-script-service.d.ts","sourceRoot":"","sources":["../../src/service/iframe-resizer-script-service.ts"],"names":[],"mappings":";AAMA,qBAAa,0BAA0B;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,SAAkC;IAElE,OAAO,CAAC,4BAA4B;IAI7B,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,MAAM;CAYzE"}
|
|
@@ -7,9 +7,11 @@ const gateway_1 = require("../graphql/gateway");
|
|
|
7
7
|
const IFRAME_RESIZER_CDN_PATH = 'iframeResizer.contentWindow.min.js';
|
|
8
8
|
const GLOBAL_FORGE_INSTALL_ID = 'forge';
|
|
9
9
|
class IframeResizerScriptService {
|
|
10
|
+
constructor(env = (0, gateway_1.getEnvironment)(gateway_1.CDNEnvironments)) {
|
|
11
|
+
this.env = env;
|
|
12
|
+
}
|
|
10
13
|
createIframeResizerScriptTag() {
|
|
11
|
-
|
|
12
|
-
return `<script async src="https://${GLOBAL_FORGE_INSTALL_ID}.cdn.${env}.atlassian-dev.net/${IFRAME_RESIZER_CDN_PATH}"></script>`;
|
|
14
|
+
return `<script async src="https://${GLOBAL_FORGE_INSTALL_ID}.cdn.${this.env}.atlassian-dev.net/${IFRAME_RESIZER_CDN_PATH}"></script>`;
|
|
13
15
|
}
|
|
14
16
|
injectIframeResizer(content, onError) {
|
|
15
17
|
const $ = cheerio_1.default.load(content);
|
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { Logger } from '../ui';
|
|
2
|
-
export declare class
|
|
2
|
+
export declare class BaseError extends Error implements ErrorWithAnalytics {
|
|
3
|
+
getAttributes(): Record<string, any>;
|
|
4
|
+
isUserError(): boolean;
|
|
3
5
|
}
|
|
4
|
-
export declare
|
|
6
|
+
export declare class UserError extends BaseError {
|
|
7
|
+
isUserError(): boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class HiddenError extends BaseError {
|
|
10
|
+
}
|
|
11
|
+
export declare const exitOnError: (logger: Logger, error?: Error, hint?: string | null) => Promise<never>;
|
|
5
12
|
export declare const wrapError: (error: unknown) => Error;
|
|
6
13
|
export declare const assertIsError: (error: unknown) => asserts error is Error;
|
|
14
|
+
export interface ErrorWithAnalytics {
|
|
15
|
+
getAttributes: () => Record<string, string | string[] | boolean>;
|
|
16
|
+
}
|
|
17
|
+
export declare class ValidationError extends UserError {
|
|
18
|
+
}
|
|
19
|
+
export declare class BundlerTSError extends UserError {
|
|
20
|
+
}
|
|
7
21
|
//# sourceMappingURL=error-handling.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/shared/error-handling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/shared/error-handling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAI/B,qBAAa,SAAU,SAAQ,KAAM,YAAW,kBAAkB;IACzD,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAKpC,WAAW,IAAI,OAAO;CAG9B;AAED,qBAAa,SAAU,SAAQ,SAAS;IAC/B,WAAW,IAAI,OAAO;CAG9B;AAED,qBAAa,WAAY,SAAQ,SAAS;CAAG;AAgB7C,eAAO,MAAM,WAAW,WAAkB,MAAM,UAAU,KAAK,SAAS,MAAM,GAAG,IAAI,KAAG,QAAQ,KAAK,CAuBpG,CAAC;AAOF,eAAO,MAAM,SAAS,UAAW,OAAO,KAAG,KAK1C,CAAC;AAMF,eAAO,MAAM,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,KAAK,IAAI,KAIhE,CAAC;AAKF,MAAM,WAAW,kBAAkB;IACjC,aAAa,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC;CAClE;AAED,qBAAa,eAAgB,SAAQ,SAAS;CAAG;AAEjD,qBAAa,cAAe,SAAQ,SAAS;CAAG"}
|
|
@@ -1,8 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.assertIsError = exports.wrapError = exports.exitOnError = exports.HiddenError = void 0;
|
|
3
|
+
exports.BundlerTSError = exports.ValidationError = exports.assertIsError = exports.wrapError = exports.exitOnError = exports.HiddenError = exports.UserError = exports.BaseError = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const ui_1 = require("../ui");
|
|
5
|
-
|
|
6
|
+
const Sentry = tslib_1.__importStar(require("@sentry/node"));
|
|
7
|
+
class BaseError extends Error {
|
|
8
|
+
getAttributes() {
|
|
9
|
+
return {
|
|
10
|
+
isUserError: this.isUserError()
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
isUserError() {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.BaseError = BaseError;
|
|
18
|
+
class UserError extends BaseError {
|
|
19
|
+
isUserError() {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.UserError = UserError;
|
|
24
|
+
class HiddenError extends BaseError {
|
|
6
25
|
}
|
|
7
26
|
exports.HiddenError = HiddenError;
|
|
8
27
|
function removePrefixFromErrorMessage(message) {
|
|
@@ -11,26 +30,41 @@ function removePrefixFromErrorMessage(message) {
|
|
|
11
30
|
}
|
|
12
31
|
return message;
|
|
13
32
|
}
|
|
14
|
-
|
|
33
|
+
const exitOnError = async (logger, error, hint) => {
|
|
34
|
+
let exitCode = 0;
|
|
15
35
|
if (error) {
|
|
36
|
+
Sentry.captureException(error);
|
|
16
37
|
error.message = removePrefixFromErrorMessage(error.message);
|
|
17
38
|
if (!(error instanceof HiddenError))
|
|
18
39
|
logger.error(error);
|
|
19
|
-
if (!logger.debugEnabled) {
|
|
20
|
-
|
|
40
|
+
if (hint === undefined && !logger.debugEnabled) {
|
|
41
|
+
hint = ui_1.Text.rerunningWithVerbose;
|
|
42
|
+
}
|
|
43
|
+
if (hint) {
|
|
44
|
+
logger.info(hint);
|
|
21
45
|
}
|
|
22
|
-
|
|
46
|
+
exitCode = 1;
|
|
23
47
|
}
|
|
24
|
-
|
|
48
|
+
await Sentry.close();
|
|
49
|
+
process.exit(exitCode);
|
|
25
50
|
};
|
|
26
|
-
exports.
|
|
51
|
+
exports.exitOnError = exitOnError;
|
|
52
|
+
const wrapError = (error) => {
|
|
27
53
|
if (error instanceof Error) {
|
|
28
54
|
return error;
|
|
29
55
|
}
|
|
30
56
|
return new Error(JSON.stringify(error));
|
|
31
57
|
};
|
|
32
|
-
exports.
|
|
58
|
+
exports.wrapError = wrapError;
|
|
59
|
+
const assertIsError = (error) => {
|
|
33
60
|
if (!(error instanceof Error)) {
|
|
34
61
|
throw new Error(`A non Error type object ${JSON.stringify(error)} of type '${typeof error}' was thrown.`);
|
|
35
62
|
}
|
|
36
63
|
};
|
|
64
|
+
exports.assertIsError = assertIsError;
|
|
65
|
+
class ValidationError extends UserError {
|
|
66
|
+
}
|
|
67
|
+
exports.ValidationError = ValidationError;
|
|
68
|
+
class BundlerTSError extends UserError {
|
|
69
|
+
}
|
|
70
|
+
exports.BundlerTSError = BundlerTSError;
|
package/out/shared/index.js
CHANGED
|
@@ -12,5 +12,5 @@ tslib_1.__exportStar(require("./validate"), exports);
|
|
|
12
12
|
tslib_1.__exportStar(require("./read-app-config-files"), exports);
|
|
13
13
|
const array_prototype_flatmap_1 = tslib_1.__importDefault(require("array.prototype.flatmap"));
|
|
14
14
|
exports.flatMap = array_prototype_flatmap_1.default;
|
|
15
|
-
const flat = (array) => array_prototype_flatmap_1.default(array, (x) => x);
|
|
15
|
+
const flat = (array) => (0, array_prototype_flatmap_1.default)(array, (x) => x);
|
|
16
16
|
exports.flat = flat;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getInstallationId = void 0;
|
|
4
4
|
const ui_1 = require("../ui");
|
|
5
|
-
const
|
|
5
|
+
const error_handling_1 = require("./error-handling");
|
|
6
6
|
function trimInstallationId(installationId, throwError) {
|
|
7
7
|
const trimmedId = installationId.trim();
|
|
8
8
|
if (throwError && trimmedId.length === 0) {
|
|
9
|
-
throw new
|
|
9
|
+
throw new error_handling_1.ValidationError(ui_1.Text.installationId.errors.invalid);
|
|
10
10
|
}
|
|
11
11
|
return trimmedId;
|
|
12
12
|
}
|
package/out/shared/pause.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pause = void 0;
|
|
4
|
-
|
|
4
|
+
const pause = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
5
|
+
exports.pause = pause;
|
package/out/shared/product.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export declare const SUPPORTED_PRODUCTS: string[];
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const WORKSPACE_PRODUCTS: string[];
|
|
3
3
|
export declare function capitalizeProduct(product: string): string;
|
|
4
|
+
export declare const isWorkspaceProduct: (product: string) => boolean;
|
|
5
|
+
export declare const isBitbucketProduct: (product: string) => boolean;
|
|
6
|
+
export declare const isSupportedProduct: (product: string) => boolean;
|
|
4
7
|
//# sourceMappingURL=product.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../src/shared/product.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,UAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../src/shared/product.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,UAAoC,CAAC;AACpE,eAAO,MAAM,kBAAkB,UAAgB,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,eAAO,MAAM,kBAAkB,YAAa,MAAM,KAAG,OAEpD,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAAa,MAAM,KAAG,OAEpD,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAAa,MAAM,KAAG,OAEpD,CAAC"}
|
package/out/shared/product.js
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.capitalizeProduct = exports.
|
|
3
|
+
exports.isSupportedProduct = exports.isBitbucketProduct = exports.isWorkspaceProduct = exports.capitalizeProduct = exports.WORKSPACE_PRODUCTS = exports.SUPPORTED_PRODUCTS = void 0;
|
|
4
4
|
const case_1 = require("case");
|
|
5
5
|
exports.SUPPORTED_PRODUCTS = ['Jira', 'Confluence', 'Compass'];
|
|
6
|
-
exports.
|
|
7
|
-
return exports.SUPPORTED_PRODUCTS.includes(product);
|
|
8
|
-
};
|
|
6
|
+
exports.WORKSPACE_PRODUCTS = ['Bitbucket'];
|
|
9
7
|
function capitalizeProduct(product) {
|
|
10
|
-
return case_1.capital(product);
|
|
8
|
+
return (0, case_1.capital)(product);
|
|
11
9
|
}
|
|
12
10
|
exports.capitalizeProduct = capitalizeProduct;
|
|
11
|
+
const isWorkspaceProduct = (product) => {
|
|
12
|
+
return exports.WORKSPACE_PRODUCTS.includes(capitalizeProduct(product));
|
|
13
|
+
};
|
|
14
|
+
exports.isWorkspaceProduct = isWorkspaceProduct;
|
|
15
|
+
const isBitbucketProduct = (product) => {
|
|
16
|
+
return capitalizeProduct(product) === 'Bitbucket';
|
|
17
|
+
};
|
|
18
|
+
exports.isBitbucketProduct = isBitbucketProduct;
|
|
19
|
+
const isSupportedProduct = (product) => {
|
|
20
|
+
return exports.SUPPORTED_PRODUCTS.includes(capitalizeProduct(product)) || (0, exports.isWorkspaceProduct)(product);
|
|
21
|
+
};
|
|
22
|
+
exports.isSupportedProduct = isSupportedProduct;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-app-config-files.d.ts","sourceRoot":"","sources":["../../src/shared/read-app-config-files.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKlD,eAAO,MAAM,kBAAkB,qBACX,
|
|
1
|
+
{"version":3,"file":"read-app-config-files.d.ts","sourceRoot":"","sources":["../../src/shared/read-app-config-files.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKlD,eAAO,MAAM,kBAAkB,qBACX,KAAK,gBAAgB,EAAE,UAAU,GAAG,UAAU,GAAG,qBAAqB,CAAC,6BAExF,QAAQ,MAAM,EAAE,CAmBlB,CAAC;AAgBF,eAAO,MAAM,0BAA0B,qBACnB,KAAK,gBAAgB,EAAE,UAAU,GAAG,UAAU,CAAC,4BAEhE,QAAQ;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAUlD,CAAC"}
|
|
@@ -5,11 +5,11 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
6
|
const array_prototype_flatmap_1 = tslib_1.__importDefault(require("array.prototype.flatmap"));
|
|
7
7
|
const typescript_1 = require("typescript");
|
|
8
|
-
|
|
8
|
+
const listGitIgnoreFiles = async (fileSystemReader, gitIgnorePath = '.gitignore') => {
|
|
9
9
|
var _a;
|
|
10
10
|
const gitignoreContents = ((_a = fileSystemReader
|
|
11
|
-
.readFile(gitIgnorePath)) === null || _a === void 0 ? void 0 : _a.trim().split('\n').filter((glob) => glob !== '')) || [];
|
|
12
|
-
return array_prototype_flatmap_1.default(await Promise.all(gitignoreContents.map((glob) => {
|
|
11
|
+
.readFile(gitIgnorePath)) === null || _a === void 0 ? void 0 : _a.trim().split('\n').filter((glob) => glob.trim() !== '')) || [];
|
|
12
|
+
return (0, array_prototype_flatmap_1.default)(await Promise.all(gitignoreContents.map((glob) => {
|
|
13
13
|
if (fileSystemReader.hasGlobSpecialChars(glob)) {
|
|
14
14
|
return fileSystemReader.readGlob(glob);
|
|
15
15
|
}
|
|
@@ -18,15 +18,16 @@ exports.listGitIgnoreFiles = async (fileSystemReader, gitIgnorePath = '.gitignor
|
|
|
18
18
|
}
|
|
19
19
|
})), (x) => x);
|
|
20
20
|
};
|
|
21
|
+
exports.listGitIgnoreFiles = listGitIgnoreFiles;
|
|
21
22
|
const processTSConfigGlobList = async (fileSystemReader, globList) => {
|
|
22
23
|
if (!globList) {
|
|
23
24
|
return [];
|
|
24
25
|
}
|
|
25
26
|
const relativePaths = await Promise.all(globList.map((glob) => fileSystemReader.readGlob(glob)));
|
|
26
|
-
return array_prototype_flatmap_1.default(relativePaths, (pathsFromSingleGlob) => pathsFromSingleGlob.map((relativePath) => path_1.default.resolve('./', relativePath)));
|
|
27
|
+
return (0, array_prototype_flatmap_1.default)(relativePaths, (pathsFromSingleGlob) => pathsFromSingleGlob.map((relativePath) => path_1.default.resolve('./', relativePath)));
|
|
27
28
|
};
|
|
28
|
-
|
|
29
|
-
const { config } = typescript_1.readConfigFile(tsConfigPath, fileSystemReader.readFile);
|
|
29
|
+
const listTSConfigIncludeExclude = async (fileSystemReader, tsConfigPath = 'tsconfig.json') => {
|
|
30
|
+
const { config } = (0, typescript_1.readConfigFile)(tsConfigPath, fileSystemReader.readFile);
|
|
30
31
|
if (!config) {
|
|
31
32
|
return { include: [], exclude: [] };
|
|
32
33
|
}
|
|
@@ -35,3 +36,4 @@ exports.listTSConfigIncludeExclude = async (fileSystemReader, tsConfigPath = 'ts
|
|
|
35
36
|
exclude: await processTSConfigGlobList(fileSystemReader, config === null || config === void 0 ? void 0 : config.exclude)
|
|
36
37
|
};
|
|
37
38
|
};
|
|
39
|
+
exports.listTSConfigIncludeExclude = listTSConfigIncludeExclude;
|