@forge/cli-shared 10.0.0-next.13 → 10.0.0-next.15
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 +13 -0
- package/out/app-logs/graphql-client.d.ts +2 -2
- package/out/app-logs/graphql-client.d.ts.map +1 -1
- package/out/app-logs/graphql-client.js +9 -17
- package/out/app-logs/index.d.ts +2 -2
- package/out/app-logs/index.d.ts.map +1 -1
- package/out/app-logs/index.js +2 -5
- package/out/app-logs/view-logs.d.ts +4 -4
- package/out/app-logs/view-logs.d.ts.map +1 -1
- package/out/app-logs/view-logs.js +8 -12
- package/out/apps/app-config.d.ts +2 -2
- package/out/apps/app-config.d.ts.map +1 -1
- package/out/apps/app-config.js +13 -20
- package/out/apps/create-an-app.d.ts +4 -4
- package/out/apps/create-an-app.d.ts.map +1 -1
- package/out/apps/create-an-app.js +6 -11
- package/out/apps/create-app-graphql-client.d.ts +2 -2
- package/out/apps/create-app-graphql-client.d.ts.map +1 -1
- package/out/apps/create-app-graphql-client.js +9 -14
- package/out/apps/get-app-owner.d.ts +4 -4
- package/out/apps/get-app-owner.d.ts.map +1 -1
- package/out/apps/get-app-owner.js +8 -13
- package/out/apps/index.d.ts +9 -9
- package/out/apps/index.d.ts.map +1 -1
- package/out/apps/index.js +9 -12
- package/out/apps/package-installer.d.ts +1 -1
- package/out/apps/package-installer.d.ts.map +1 -1
- package/out/apps/package-installer.js +9 -14
- package/out/apps/register-app.d.ts +4 -4
- package/out/apps/register-app.d.ts.map +1 -1
- package/out/apps/register-app.js +9 -13
- package/out/apps/sites.js +1 -4
- package/out/apps/template-module.js +27 -33
- package/out/apps/template.d.ts +3 -3
- package/out/apps/template.d.ts.map +1 -1
- package/out/apps/template.js +36 -47
- package/out/ari/ari.js +48 -63
- package/out/ari/index.d.ts +1 -1
- package/out/ari/index.d.ts.map +1 -1
- package/out/ari/index.js +1 -4
- package/out/auth/authenticator.js +2 -6
- package/out/auth/index.d.ts +3 -3
- package/out/auth/index.d.ts.map +1 -1
- package/out/auth/index.js +3 -6
- package/out/auth/instruction.js +3 -6
- package/out/auth/personal/credential-store.d.ts +2 -2
- package/out/auth/personal/credential-store.d.ts.map +1 -1
- package/out/auth/personal/credential-store.js +48 -57
- package/out/auth/personal/index.d.ts +6 -6
- package/out/auth/personal/index.d.ts.map +1 -1
- package/out/auth/personal/index.js +6 -9
- package/out/auth/personal/login.d.ts +3 -3
- package/out/auth/personal/login.d.ts.map +1 -1
- package/out/auth/personal/login.js +1 -5
- package/out/auth/personal/logout.d.ts +1 -1
- package/out/auth/personal/logout.d.ts.map +1 -1
- package/out/auth/personal/logout.js +1 -5
- package/out/auth/personal/me-graphql-client.d.ts +3 -3
- package/out/auth/personal/me-graphql-client.d.ts.map +1 -1
- package/out/auth/personal/me-graphql-client.js +7 -12
- 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 +10 -14
- package/out/auth/personal/user-repository.d.ts +4 -4
- package/out/auth/personal/user-repository.d.ts.map +1 -1
- package/out/auth/personal/user-repository.js +5 -9
- package/out/cache/cached-conf.d.ts.map +1 -1
- package/out/cache/cached-conf.js +5 -10
- package/out/cache/index.d.ts +1 -1
- package/out/cache/index.d.ts.map +1 -1
- package/out/cache/index.js +1 -4
- package/out/config/config-codec-types.js +1 -2
- package/out/config/config-file-section-reader.d.ts +3 -3
- package/out/config/config-file-section-reader.d.ts.map +1 -1
- package/out/config/config-file-section-reader.js +4 -10
- package/out/config/config-file-section-writer.d.ts +3 -3
- package/out/config/config-file-section-writer.d.ts.map +1 -1
- package/out/config/config-file-section-writer.js +2 -7
- package/out/config/config-file.d.ts +3 -3
- package/out/config/config-file.d.ts.map +1 -1
- package/out/config/config-file.js +40 -49
- package/out/config/config-section.js +4 -11
- package/out/config/config.d.ts +1 -1
- package/out/config/config.d.ts.map +1 -1
- package/out/config/config.js +7 -13
- package/out/config/index.d.ts +6 -6
- package/out/config/index.d.ts.map +1 -1
- package/out/config/index.js +6 -9
- package/out/file-system/archiver.d.ts +2 -2
- package/out/file-system/archiver.d.ts.map +1 -1
- package/out/file-system/archiver.js +20 -29
- package/out/file-system/file-system-reader.d.ts.map +1 -1
- package/out/file-system/file-system-reader.js +21 -26
- package/out/file-system/file-system-writer.js +5 -10
- package/out/file-system/index.d.ts +5 -5
- package/out/file-system/index.d.ts.map +1 -1
- package/out/file-system/index.js +5 -8
- package/out/file-system/util.js +1 -4
- package/out/file-system/zip-accessor.js +3 -8
- package/out/graphql/app-environment-graphql-client.d.ts +2 -2
- package/out/graphql/app-environment-graphql-client.d.ts.map +1 -1
- package/out/graphql/app-environment-graphql-client.js +10 -16
- package/out/graphql/app-oauth-client-id-graphql-client.d.ts +1 -1
- package/out/graphql/app-oauth-client-id-graphql-client.d.ts.map +1 -1
- package/out/graphql/app-oauth-client-id-graphql-client.js +6 -10
- package/out/graphql/debugging-graphql-runner.d.ts +2 -2
- package/out/graphql/debugging-graphql-runner.d.ts.map +1 -1
- package/out/graphql/debugging-graphql-runner.js +5 -10
- package/out/graphql/gateway.js +15 -23
- package/out/graphql/get-mutation-error.js +4 -8
- package/out/graphql/gql/gql.d.ts +82 -82
- package/out/graphql/gql/gql.d.ts.map +1 -1
- package/out/graphql/gql/gql.js +2 -6
- package/out/graphql/gql/graphql.d.ts +214 -12
- package/out/graphql/gql/graphql.d.ts.map +1 -1
- package/out/graphql/gql/graphql.js +83 -88
- package/out/graphql/gql/index.d.ts +1 -1
- package/out/graphql/gql/index.d.ts.map +1 -1
- package/out/graphql/gql/index.js +1 -4
- package/out/graphql/graphql-client.js +1 -2
- package/out/graphql/graphql-domain-types.d.ts +1 -1
- package/out/graphql/graphql-domain-types.d.ts.map +1 -1
- package/out/graphql/graphql-domain-types.js +1 -2
- package/out/graphql/graphql-runtime-enums.js +16 -19
- package/out/graphql/index.d.ts +12 -12
- package/out/graphql/index.d.ts.map +1 -1
- package/out/graphql/index.js +12 -17
- package/out/graphql/minimal-graphql-runner.d.ts +4 -4
- package/out/graphql/minimal-graphql-runner.d.ts.map +1 -1
- package/out/graphql/minimal-graphql-runner.js +31 -40
- package/out/graphql/mutation-aware-graphql-client.d.ts +2 -2
- package/out/graphql/mutation-aware-graphql-client.d.ts.map +1 -1
- package/out/graphql/mutation-aware-graphql-client.js +4 -10
- package/out/graphql/path-based-graphql-client-resolver.d.ts +1 -1
- package/out/graphql/path-based-graphql-client-resolver.d.ts.map +1 -1
- package/out/graphql/path-based-graphql-client-resolver.js +3 -7
- package/out/http-client/feedback-post-client.js +1 -5
- package/out/http-client/file-uploader.d.ts +1 -1
- package/out/http-client/file-uploader.d.ts.map +1 -1
- package/out/http-client/file-uploader.js +11 -18
- package/out/http-client/global-edge-http-client.js +8 -14
- package/out/http-client/index.d.ts +5 -5
- package/out/http-client/index.d.ts.map +1 -1
- package/out/http-client/index.js +5 -8
- package/out/http-client/node-request.js +10 -16
- package/out/http-client/trace.js +1 -4
- package/out/index.d.ts +13 -13
- package/out/index.d.ts.map +1 -1
- package/out/index.js +13 -16
- package/out/service/bridge-script-service.js +5 -9
- package/out/service/i18n-resource-bundling-service.js +24 -30
- package/out/service/iframe-resizer-script-service.js +5 -9
- package/out/service/index.d.ts +5 -5
- package/out/service/index.d.ts.map +1 -1
- package/out/service/index.js +5 -8
- package/out/service/statsig-service.d.ts +1 -1
- package/out/service/statsig-service.d.ts.map +1 -1
- package/out/service/statsig-service.js +9 -15
- package/out/service/supported-products-service.d.ts +2 -2
- package/out/service/supported-products-service.d.ts.map +1 -1
- package/out/service/supported-products-service.js +13 -18
- package/out/shared/assertUnreachable.js +1 -4
- package/out/shared/assistant-cli.d.ts +1 -1
- package/out/shared/assistant-cli.d.ts.map +1 -1
- package/out/shared/assistant-cli.js +15 -24
- package/out/shared/cli-details.js +6 -11
- package/out/shared/developer-console.js +12 -18
- package/out/shared/directories.js +4 -8
- package/out/shared/environment.d.ts +1 -1
- package/out/shared/environment.d.ts.map +1 -1
- package/out/shared/environment.js +19 -25
- package/out/shared/error-handling.d.ts +1 -1
- package/out/shared/error-handling.d.ts.map +1 -1
- package/out/shared/error-handling.js +24 -44
- package/out/shared/forge-cli-attribution.js +6 -11
- package/out/shared/index.d.ts +13 -13
- package/out/shared/index.d.ts.map +1 -1
- package/out/shared/index.js +13 -16
- package/out/shared/installations.js +1 -4
- package/out/shared/pause.js +1 -5
- package/out/shared/product.d.ts.map +1 -1
- package/out/shared/product.js +5 -10
- package/out/shared/read-app-config-files.d.ts +1 -1
- package/out/shared/read-app-config-files.d.ts.map +1 -1
- package/out/shared/read-app-config-files.js +6 -12
- package/out/shared/runner-signals.js +1 -5
- package/out/shared/test.d.ts +1 -1
- package/out/shared/test.d.ts.map +1 -1
- package/out/shared/test.js +24 -29
- package/out/tunnel/docker-compose-lifecycle.d.ts +3 -3
- package/out/tunnel/docker-compose-lifecycle.d.ts.map +1 -1
- package/out/tunnel/docker-compose-lifecycle.js +53 -70
- package/out/tunnel/index.d.ts +2 -2
- package/out/tunnel/index.d.ts.map +1 -1
- package/out/tunnel/index.js +2 -5
- package/out/tunnel/tunnel-options.js +13 -18
- package/out/ui/command-line-ui.d.ts +2 -2
- package/out/ui/command-line-ui.d.ts.map +1 -1
- package/out/ui/command-line-ui.js +53 -58
- package/out/ui/hint-rotation.d.ts +2 -2
- package/out/ui/hint-rotation.d.ts.map +1 -1
- package/out/ui/hint-rotation.js +2 -6
- package/out/ui/index.d.ts +8 -8
- package/out/ui/index.d.ts.map +1 -1
- package/out/ui/index.js +8 -11
- package/out/ui/log-color.js +16 -20
- package/out/ui/log-symbols.js +10 -13
- package/out/ui/logger.js +2 -6
- package/out/ui/multiple-table-prompt.d.ts +1 -1
- package/out/ui/multiple-table-prompt.d.ts.map +1 -1
- package/out/ui/multiple-table-prompt.js +13 -20
- package/out/ui/runtime-log.js +12 -16
- package/out/ui/single-table-prompt.d.ts +1 -1
- package/out/ui/single-table-prompt.d.ts.map +1 -1
- package/out/ui/single-table-prompt.js +12 -19
- package/out/ui/table-prompt.d.ts +1 -1
- package/out/ui/table-prompt.d.ts.map +1 -1
- package/out/ui/table-prompt.js +11 -16
- package/out/ui/table.d.ts.map +1 -1
- package/out/ui/table.js +4 -7
- package/out/ui/text.d.ts +1 -1
- package/out/ui/text.d.ts.map +1 -1
- package/out/ui/text.js +208 -214
- package/out/ui/ui.d.ts +2 -2
- package/out/ui/ui.d.ts.map +1 -1
- package/out/ui/ui.js +1 -2
- package/package.json +3 -2
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const url_1 = require("url");
|
|
5
|
-
const ui_1 = require("../ui");
|
|
6
|
-
class InvalidSiteError extends Error {
|
|
1
|
+
import { URL } from 'url';
|
|
2
|
+
import { Text } from '../ui/index.js';
|
|
3
|
+
export class InvalidSiteError extends Error {
|
|
7
4
|
constructor(url) {
|
|
8
|
-
super(
|
|
5
|
+
super(Text.install.error.url(url.toString()));
|
|
9
6
|
}
|
|
10
7
|
}
|
|
11
|
-
|
|
12
|
-
class InvalidResponseError extends Error {
|
|
8
|
+
export class InvalidResponseError extends Error {
|
|
13
9
|
constructor(url) {
|
|
14
|
-
super(
|
|
10
|
+
super(Text.install.error.site(url.toString()));
|
|
15
11
|
}
|
|
16
12
|
}
|
|
17
|
-
|
|
18
|
-
class GlobalEdgeHttpClient {
|
|
13
|
+
export class GlobalEdgeHttpClient {
|
|
19
14
|
fetchClient;
|
|
20
15
|
constructor(fetchClient) {
|
|
21
16
|
this.fetchClient = fetchClient;
|
|
@@ -39,8 +34,7 @@ class GlobalEdgeHttpClient {
|
|
|
39
34
|
throw new InvalidResponseError(site);
|
|
40
35
|
}
|
|
41
36
|
buildUrl(site) {
|
|
42
|
-
const urlObj = new
|
|
37
|
+
const urlObj = new URL('/_edge/tenant_info', site.toString());
|
|
43
38
|
return urlObj.toString();
|
|
44
39
|
}
|
|
45
40
|
}
|
|
46
|
-
exports.GlobalEdgeHttpClient = GlobalEdgeHttpClient;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './file-uploader';
|
|
2
|
-
export * from './global-edge-http-client';
|
|
3
|
-
export * from './feedback-post-client';
|
|
4
|
-
export * from './node-request';
|
|
5
|
-
export * from './trace';
|
|
1
|
+
export * from './file-uploader.js';
|
|
2
|
+
export * from './global-edge-http-client.js';
|
|
3
|
+
export * from './feedback-post-client.js';
|
|
4
|
+
export * from './node-request.js';
|
|
5
|
+
export * from './trace.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http-client/index.ts"],"names":[],"mappings":"AAEA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http-client/index.ts"],"names":[],"mappings":"AAEA,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC"}
|
package/out/http-client/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
tslib_1.__exportStar(require("./feedback-post-client"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./node-request"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./trace"), exports);
|
|
1
|
+
export * from './file-uploader.js';
|
|
2
|
+
export * from './global-edge-http-client.js';
|
|
3
|
+
export * from './feedback-post-client.js';
|
|
4
|
+
export * from './node-request.js';
|
|
5
|
+
export * from './trace.js';
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const http_1 = tslib_1.__importDefault(require("http"));
|
|
6
|
-
const https_1 = tslib_1.__importDefault(require("https"));
|
|
7
|
-
const url_1 = require("url");
|
|
1
|
+
import http from 'http';
|
|
2
|
+
import https from 'https';
|
|
3
|
+
import { URL } from 'url';
|
|
8
4
|
const DEFAULT_HTTP_ERROR_STATUS = 500;
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
export const DEFAULT_NODE_REQUEST_TIMEOUT_MS = 30_000;
|
|
6
|
+
export const DEFAULT_NODE_UPLOAD_TIMEOUT_MS = 300_000;
|
|
11
7
|
const NO_BODY_STATUS_CODES = new Set([204, 205, 304]);
|
|
12
|
-
const toHeaders = (rawHeaders) => {
|
|
8
|
+
export const toHeaders = (rawHeaders) => {
|
|
13
9
|
const headers = new Headers();
|
|
14
10
|
Object.entries(rawHeaders).forEach(([key, value]) => {
|
|
15
11
|
if (Array.isArray(value)) {
|
|
@@ -22,11 +18,10 @@ const toHeaders = (rawHeaders) => {
|
|
|
22
18
|
});
|
|
23
19
|
return headers;
|
|
24
20
|
};
|
|
25
|
-
|
|
26
|
-
const sendWithNodeRequest = ({ method, url, headers, body, timeoutMs = exports.DEFAULT_NODE_REQUEST_TIMEOUT_MS }) => {
|
|
21
|
+
export const sendWithNodeRequest = ({ method, url, headers, body, timeoutMs = DEFAULT_NODE_REQUEST_TIMEOUT_MS }) => {
|
|
27
22
|
return new Promise((resolve, reject) => {
|
|
28
|
-
const parsedUrl = new
|
|
29
|
-
const transport = parsedUrl.protocol === 'https:' ?
|
|
23
|
+
const parsedUrl = new URL(url);
|
|
24
|
+
const transport = parsedUrl.protocol === 'https:' ? https : http;
|
|
30
25
|
const request = transport.request(parsedUrl, {
|
|
31
26
|
method,
|
|
32
27
|
headers
|
|
@@ -41,7 +36,7 @@ const sendWithNodeRequest = ({ method, url, headers, body, timeoutMs = exports.D
|
|
|
41
36
|
resolve(new Response(body, {
|
|
42
37
|
status,
|
|
43
38
|
statusText: response.statusMessage,
|
|
44
|
-
headers:
|
|
39
|
+
headers: toHeaders(response.headers)
|
|
45
40
|
}));
|
|
46
41
|
});
|
|
47
42
|
});
|
|
@@ -55,4 +50,3 @@ const sendWithNodeRequest = ({ method, url, headers, body, timeoutMs = exports.D
|
|
|
55
50
|
request.end();
|
|
56
51
|
});
|
|
57
52
|
};
|
|
58
|
-
exports.sendWithNodeRequest = sendWithNodeRequest;
|
package/out/http-client/trace.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getAtlassianTraceId = getAtlassianTraceId;
|
|
4
|
-
function getAtlassianTraceId(headers) {
|
|
1
|
+
export function getAtlassianTraceId(headers) {
|
|
5
2
|
return headers.get('atl-traceid') ?? undefined;
|
|
6
3
|
}
|
package/out/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export * from './app-logs';
|
|
2
|
-
export * from './apps';
|
|
3
|
-
export * from './ari';
|
|
4
|
-
export * from './auth';
|
|
5
|
-
export * from './cache';
|
|
6
|
-
export * from './config';
|
|
7
|
-
export * from './file-system';
|
|
8
|
-
export * from './graphql';
|
|
9
|
-
export * from './http-client';
|
|
10
|
-
export * from './service';
|
|
11
|
-
export * from './shared';
|
|
12
|
-
export * from './tunnel';
|
|
13
|
-
export * from './ui';
|
|
1
|
+
export * from './app-logs/index.js';
|
|
2
|
+
export * from './apps/index.js';
|
|
3
|
+
export * from './ari/index.js';
|
|
4
|
+
export * from './auth/index.js';
|
|
5
|
+
export * from './cache/index.js';
|
|
6
|
+
export * from './config/index.js';
|
|
7
|
+
export * from './file-system/index.js';
|
|
8
|
+
export * from './graphql/index.js';
|
|
9
|
+
export * from './http-client/index.js';
|
|
10
|
+
export * from './service/index.js';
|
|
11
|
+
export * from './shared/index.js';
|
|
12
|
+
export * from './tunnel/index.js';
|
|
13
|
+
export * from './ui/index.js';
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC"}
|
package/out/index.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
tslib_1.__exportStar(require("./shared"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./tunnel"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./ui"), exports);
|
|
1
|
+
export * from './app-logs/index.js';
|
|
2
|
+
export * from './apps/index.js';
|
|
3
|
+
export * from './ari/index.js';
|
|
4
|
+
export * from './auth/index.js';
|
|
5
|
+
export * from './cache/index.js';
|
|
6
|
+
export * from './config/index.js';
|
|
7
|
+
export * from './file-system/index.js';
|
|
8
|
+
export * from './graphql/index.js';
|
|
9
|
+
export * from './http-client/index.js';
|
|
10
|
+
export * from './service/index.js';
|
|
11
|
+
export * from './shared/index.js';
|
|
12
|
+
export * from './tunnel/index.js';
|
|
13
|
+
export * from './ui/index.js';
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.BridgeScriptService = void 0;
|
|
4
|
-
const cheerio_1 = require("cheerio");
|
|
5
|
-
const gateway_1 = require("../graphql/gateway");
|
|
1
|
+
import { load } from 'cheerio';
|
|
2
|
+
import { CDNEnvironments, getEnvironmentConfig } from '../graphql/gateway.js';
|
|
6
3
|
const BRIDGE_CORE_CDN_PATH = 'global-bridge.js';
|
|
7
4
|
const GLOBAL_FORGE_INSTALL_ID = 'forge';
|
|
8
|
-
class BridgeScriptService {
|
|
5
|
+
export class BridgeScriptService {
|
|
9
6
|
env;
|
|
10
|
-
constructor(env =
|
|
7
|
+
constructor(env = getEnvironmentConfig(CDNEnvironments)) {
|
|
11
8
|
this.env = env;
|
|
12
9
|
}
|
|
13
10
|
createBridgeCoreScriptTag() {
|
|
14
11
|
return `<script src="https://${GLOBAL_FORGE_INSTALL_ID}.cdn.${this.env}.atlassian-dev.net/${BRIDGE_CORE_CDN_PATH}"></script>`;
|
|
15
12
|
}
|
|
16
13
|
injectBridgeCore(content, onError) {
|
|
17
|
-
const $ =
|
|
14
|
+
const $ = load(content, { xml: { xmlMode: false } });
|
|
18
15
|
if ($('html').length === 0)
|
|
19
16
|
onError();
|
|
20
17
|
let head = $('head');
|
|
@@ -26,4 +23,3 @@ class BridgeScriptService {
|
|
|
26
23
|
return Buffer.from($.html());
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
exports.BridgeScriptService = BridgeScriptService;
|
|
@@ -1,41 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const i18n_1 = require("@forge/i18n");
|
|
9
|
-
const __1 = require("..");
|
|
10
|
-
exports.EMPTY_I18N_RESOURCE_BUNDLE = { exists: false };
|
|
11
|
-
const listFilesInI18nResourceBundle = (i18nResourceBundle) => {
|
|
1
|
+
import tmp from 'tmp';
|
|
2
|
+
import { promises, readdirSync } from 'fs';
|
|
3
|
+
import { resolve, join } from 'path';
|
|
4
|
+
import { extractI18nKeysFromModules, getTranslationValue, I18N_INFO_FILE_NAME } from '@forge/i18n';
|
|
5
|
+
import { UserError } from '../index.js';
|
|
6
|
+
export const EMPTY_I18N_RESOURCE_BUNDLE = { exists: false };
|
|
7
|
+
export const listFilesInI18nResourceBundle = (i18nResourceBundle) => {
|
|
12
8
|
if (!i18nResourceBundle.exists) {
|
|
13
9
|
return [];
|
|
14
10
|
}
|
|
15
|
-
return
|
|
11
|
+
return readdirSync(i18nResourceBundle.path).map((fileName) => [fileName, join(i18nResourceBundle.path, fileName)]);
|
|
16
12
|
};
|
|
17
|
-
|
|
18
|
-
class I18nResourceBundlingService {
|
|
13
|
+
export class I18nResourceBundlingService {
|
|
19
14
|
async copyLocaleFilesToBundleDir(bundleDirPath, i18nConfig) {
|
|
20
|
-
const providedLocaleFilePaths = i18nConfig.resources.map((resource) => [resource.key,
|
|
15
|
+
const providedLocaleFilePaths = i18nConfig.resources.map((resource) => [resource.key, resolve(resource.path)]);
|
|
21
16
|
await Promise.all(providedLocaleFilePaths.map(async ([key, providedPath]) => {
|
|
22
|
-
const dest =
|
|
23
|
-
await
|
|
17
|
+
const dest = join(bundleDirPath, `${key}.json`);
|
|
18
|
+
await promises.copyFile(providedPath, dest);
|
|
24
19
|
}));
|
|
25
20
|
}
|
|
26
21
|
async createI18nInfoFile(bundleDirPath, i18nConfig, modules) {
|
|
27
|
-
const i18nKeys =
|
|
22
|
+
const i18nKeys = extractI18nKeysFromModules(modules);
|
|
28
23
|
const translationLookup = await this.loadTranslationLookup(i18nConfig);
|
|
29
24
|
const i18nInfo = this.createI18nInfo(i18nConfig, i18nKeys, translationLookup);
|
|
30
|
-
const i18nInfoFilePath =
|
|
31
|
-
await
|
|
25
|
+
const i18nInfoFilePath = join(bundleDirPath, I18N_INFO_FILE_NAME);
|
|
26
|
+
await promises.writeFile(i18nInfoFilePath, JSON.stringify(i18nInfo));
|
|
32
27
|
}
|
|
33
28
|
createI18nInfo(i18nConfig, i18nKeys, translationLookup) {
|
|
34
29
|
const translations = {};
|
|
35
30
|
const localeKeys = Object.keys(translationLookup).sort();
|
|
36
31
|
i18nKeys.forEach((i18nKey) => {
|
|
37
32
|
const i18nInfoEntry = localeKeys.reduce((entry, locale) => {
|
|
38
|
-
const translationValue =
|
|
33
|
+
const translationValue = getTranslationValue(translationLookup, i18nKey, locale);
|
|
39
34
|
if (translationValue) {
|
|
40
35
|
entry[locale] = translationValue;
|
|
41
36
|
}
|
|
@@ -45,7 +40,7 @@ class I18nResourceBundlingService {
|
|
|
45
40
|
});
|
|
46
41
|
const defaultLocale = i18nConfig.fallback.default;
|
|
47
42
|
if (i18nKeys.some((key) => !translations[key][defaultLocale])) {
|
|
48
|
-
throw new
|
|
43
|
+
throw new UserError(`Default locale '${defaultLocale}' is missing translations for some keys`);
|
|
49
44
|
}
|
|
50
45
|
return {
|
|
51
46
|
translations,
|
|
@@ -58,25 +53,25 @@ class I18nResourceBundlingService {
|
|
|
58
53
|
async loadTranslationLookup(i18nConfig) {
|
|
59
54
|
const providedLocaleFilePaths = i18nConfig.resources.map((resource) => [
|
|
60
55
|
resource.key,
|
|
61
|
-
|
|
56
|
+
resolve(resource.path)
|
|
62
57
|
]);
|
|
63
58
|
const results = await Promise.all(providedLocaleFilePaths.map(async ([key, providedPath]) => {
|
|
64
|
-
const file = await
|
|
59
|
+
const file = await promises.readFile(providedPath);
|
|
65
60
|
return [key, JSON.parse(file.toString())];
|
|
66
61
|
}));
|
|
67
62
|
return Object.fromEntries(results);
|
|
68
63
|
}
|
|
69
64
|
async bundle(modules, i18nConfig) {
|
|
70
65
|
if (!modules || !i18nConfig) {
|
|
71
|
-
return
|
|
66
|
+
return EMPTY_I18N_RESOURCE_BUNDLE;
|
|
72
67
|
}
|
|
73
|
-
const bundleDirPath =
|
|
68
|
+
const bundleDirPath = tmp.dirSync().name;
|
|
74
69
|
await this.copyLocaleFilesToBundleDir(bundleDirPath, i18nConfig);
|
|
75
70
|
await this.createI18nInfoFile(bundleDirPath, i18nConfig, modules);
|
|
76
71
|
return { exists: true, path: bundleDirPath };
|
|
77
72
|
}
|
|
78
73
|
createFileAccessor(i18nConfig) {
|
|
79
|
-
const i18nInfoFileKey =
|
|
74
|
+
const i18nInfoFileKey = I18N_INFO_FILE_NAME.split('.')[0];
|
|
80
75
|
return async (resourceKey) => {
|
|
81
76
|
if (resourceKey === i18nInfoFileKey) {
|
|
82
77
|
return Buffer.from(JSON.stringify({
|
|
@@ -88,11 +83,10 @@ class I18nResourceBundlingService {
|
|
|
88
83
|
}));
|
|
89
84
|
}
|
|
90
85
|
const i18nResource = i18nConfig.resources.find((resource) => resource.key === resourceKey);
|
|
91
|
-
if (!i18nResource || !(await
|
|
86
|
+
if (!i18nResource || !(await promises.stat(resolve(i18nResource.path))).isFile()) {
|
|
92
87
|
return null;
|
|
93
88
|
}
|
|
94
|
-
return
|
|
89
|
+
return promises.readFile(resolve(i18nResource.path));
|
|
95
90
|
};
|
|
96
91
|
}
|
|
97
92
|
}
|
|
98
|
-
exports.I18nResourceBundlingService = I18nResourceBundlingService;
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.IframeResizerScriptService = void 0;
|
|
4
|
-
const cheerio_1 = require("cheerio");
|
|
5
|
-
const gateway_1 = require("../graphql/gateway");
|
|
1
|
+
import { load } from 'cheerio';
|
|
2
|
+
import { CDNEnvironments, getEnvironmentConfig } from '../graphql/gateway.js';
|
|
6
3
|
const IFRAME_RESIZER_CDN_PATH = 'iframeResizer.contentWindow.min.js';
|
|
7
4
|
const GLOBAL_FORGE_INSTALL_ID = 'forge';
|
|
8
|
-
class IframeResizerScriptService {
|
|
5
|
+
export class IframeResizerScriptService {
|
|
9
6
|
env;
|
|
10
|
-
constructor(env =
|
|
7
|
+
constructor(env = getEnvironmentConfig(CDNEnvironments)) {
|
|
11
8
|
this.env = env;
|
|
12
9
|
}
|
|
13
10
|
createIframeResizerScriptTag() {
|
|
14
11
|
return `<script async src="https://${GLOBAL_FORGE_INSTALL_ID}.cdn.${this.env}.atlassian-dev.net/${IFRAME_RESIZER_CDN_PATH}"></script>`;
|
|
15
12
|
}
|
|
16
13
|
injectIframeResizer(content, onError) {
|
|
17
|
-
const $ =
|
|
14
|
+
const $ = load(content, { xml: { xmlMode: false } });
|
|
18
15
|
if ($('html').length === 0)
|
|
19
16
|
onError();
|
|
20
17
|
let head = $('head');
|
|
@@ -26,4 +23,3 @@ class IframeResizerScriptService {
|
|
|
26
23
|
return Buffer.from($.html());
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
exports.IframeResizerScriptService = IframeResizerScriptService;
|
package/out/service/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './bridge-script-service';
|
|
2
|
-
export * from './iframe-resizer-script-service';
|
|
3
|
-
export * from './i18n-resource-bundling-service';
|
|
4
|
-
export * from './statsig-service';
|
|
5
|
-
export * from './supported-products-service';
|
|
1
|
+
export * from './bridge-script-service.js';
|
|
2
|
+
export * from './iframe-resizer-script-service.js';
|
|
3
|
+
export * from './i18n-resource-bundling-service.js';
|
|
4
|
+
export * from './statsig-service.js';
|
|
5
|
+
export * from './supported-products-service.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAEA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAEA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sBAAsB,CAAC;AACrC,cAAc,iCAAiC,CAAC"}
|
package/out/service/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
tslib_1.__exportStar(require("./i18n-resource-bundling-service"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./statsig-service"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./supported-products-service"), exports);
|
|
1
|
+
export * from './bridge-script-service.js';
|
|
2
|
+
export * from './iframe-resizer-script-service.js';
|
|
3
|
+
export * from './i18n-resource-bundling-service.js';
|
|
4
|
+
export * from './statsig-service.js';
|
|
5
|
+
export * from './supported-products-service.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CLIDetails, ConfigSectionReader, CredentialGetter, getEnvironmentConfig, Logger } from '../index';
|
|
1
|
+
import { CLIDetails, ConfigSectionReader, CredentialGetter, getEnvironmentConfig, Logger } from '../index.js';
|
|
2
2
|
export type FeatureGate = 'forge-cli-test-gate' | 'is-logs-v-2-api-enabled' | 'forge-cli-enable-teamwork-graph-product-support' | 'forge-cli-enable-developer-space-enforcement-flow' | 'forge-cli-enable-self-managed-tunnel' | 'fg-forge-cli-enable-combined-artifact-upload';
|
|
3
3
|
export interface CliHint {
|
|
4
4
|
weight: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statsig-service.d.ts","sourceRoot":"","sources":["../../src/service/statsig-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EAEpB,MAAM,EAEP,MAAM,
|
|
1
|
+
{"version":3,"file":"statsig-service.d.ts","sourceRoot":"","sources":["../../src/service/statsig-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EAEpB,MAAM,EAEP,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,WAAW,GACnB,qBAAqB,GACrB,yBAAyB,GACzB,iDAAiD,GACjD,mDAAmD,GACnD,sCAAsC,GACtC,8CAA8C,CAAC;AAEnD,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CA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AC,CAAC,GAAG,IAAI,CAAC;CAWpC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StatsigService = exports.StatsigReader = void 0;
|
|
4
|
-
exports.cacheStatsigResult = cacheStatsigResult;
|
|
5
|
-
const index_1 = require("../index");
|
|
1
|
+
import { getEnvironmentConfig, isFedrampEnv, Text } from '../index.js';
|
|
6
2
|
const HINT_SEPARATOR = '::';
|
|
7
3
|
const HINT_CATEGORY_SEPARATOR = ',';
|
|
8
4
|
function parseHint(configured) {
|
|
@@ -25,7 +21,7 @@ function parseHint(configured) {
|
|
|
25
21
|
? { weight, categories, text }
|
|
26
22
|
: undefined;
|
|
27
23
|
}
|
|
28
|
-
class StatsigReader {
|
|
24
|
+
export class StatsigReader {
|
|
29
25
|
async testForgeCliTestGate() {
|
|
30
26
|
return (await this.checkGate('forge-cli-test-gate')) ?? false;
|
|
31
27
|
}
|
|
@@ -42,10 +38,10 @@ class StatsigReader {
|
|
|
42
38
|
return (await this.getDynamicConfig('xls-forge-cli-deprecated-runtimes')) ?? [];
|
|
43
39
|
}
|
|
44
40
|
async isDevSpaceSelectionEnabled() {
|
|
45
|
-
return !
|
|
41
|
+
return !isFedrampEnv();
|
|
46
42
|
}
|
|
47
43
|
async isDeveloperSpaceEnforcementFlowEnabled() {
|
|
48
|
-
if (
|
|
44
|
+
if (isFedrampEnv() || process.env.FORGE_CLI_DISABLE_DEV_SPACE === 'true') {
|
|
49
45
|
return false;
|
|
50
46
|
}
|
|
51
47
|
else if (process.env.FORGE_CLI_DISABLE_DEV_SPACE === 'false') {
|
|
@@ -73,7 +69,6 @@ class StatsigReader {
|
|
|
73
69
|
return configured?.map(parseHint).filter((hint) => hint !== undefined) ?? null;
|
|
74
70
|
}
|
|
75
71
|
}
|
|
76
|
-
exports.StatsigReader = StatsigReader;
|
|
77
72
|
var STATSIG_API_KEYS;
|
|
78
73
|
(function (STATSIG_API_KEYS) {
|
|
79
74
|
STATSIG_API_KEYS["DEV"] = "8821cc19-368d-43d4-a20d-c6b8dca6b7ee";
|
|
@@ -90,7 +85,7 @@ var BASE_FEATURE_FLAG_SERVICE_URL;
|
|
|
90
85
|
BASE_FEATURE_FLAG_SERVICE_URL["FEDRAMP_MODERATE_STAGING"] = "https://api.stg.atlassian.com/flags/api/v2/";
|
|
91
86
|
BASE_FEATURE_FLAG_SERVICE_URL["FEDRAMP_MODERATE_PROD"] = "https://api.atlassian.com/flags/api/v2/";
|
|
92
87
|
})(BASE_FEATURE_FLAG_SERVICE_URL || (BASE_FEATURE_FLAG_SERVICE_URL = {}));
|
|
93
|
-
function cacheStatsigResult(getter) {
|
|
88
|
+
export function cacheStatsigResult(getter) {
|
|
94
89
|
const cacheDict = new Map();
|
|
95
90
|
return async function (...args) {
|
|
96
91
|
const relevantArgs = args.filter((arg) => arg !== undefined);
|
|
@@ -103,13 +98,13 @@ function cacheStatsigResult(getter) {
|
|
|
103
98
|
return value;
|
|
104
99
|
};
|
|
105
100
|
}
|
|
106
|
-
class StatsigService extends StatsigReader {
|
|
101
|
+
export class StatsigService extends StatsigReader {
|
|
107
102
|
logger;
|
|
108
103
|
cliDetails;
|
|
109
104
|
credentialStore;
|
|
110
105
|
appConfigReader;
|
|
111
106
|
getEnvironmentFn;
|
|
112
|
-
constructor(logger, cliDetails, credentialStore, appConfigReader, getEnvironmentFn =
|
|
107
|
+
constructor(logger, cliDetails, credentialStore, appConfigReader, getEnvironmentFn = getEnvironmentConfig) {
|
|
113
108
|
super();
|
|
114
109
|
this.logger = logger;
|
|
115
110
|
this.cliDetails = cliDetails;
|
|
@@ -223,7 +218,7 @@ class StatsigService extends StatsigReader {
|
|
|
223
218
|
}
|
|
224
219
|
catch (error) {
|
|
225
220
|
if (this.logger.traceEnabled) {
|
|
226
|
-
this.logger.warn(
|
|
221
|
+
this.logger.warn(Text.warning.statsigFetchFailed('feature gates'));
|
|
227
222
|
}
|
|
228
223
|
return null;
|
|
229
224
|
}
|
|
@@ -235,10 +230,9 @@ class StatsigService extends StatsigReader {
|
|
|
235
230
|
}
|
|
236
231
|
catch (error) {
|
|
237
232
|
if (this.logger.traceEnabled) {
|
|
238
|
-
this.logger.warn(
|
|
233
|
+
this.logger.warn(Text.warning.statsigFetchFailed('dynamic configurations'));
|
|
239
234
|
}
|
|
240
235
|
return null;
|
|
241
236
|
}
|
|
242
237
|
}
|
|
243
238
|
}
|
|
244
|
-
exports.StatsigService = StatsigService;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { StatsigService } from './statsig-service';
|
|
1
|
+
import { StatsigService } from './statsig-service.js';
|
|
2
2
|
import { URL } from 'url';
|
|
3
|
-
import { ProductDisplayName } from '../shared';
|
|
3
|
+
import { ProductDisplayName } from '../shared/index.js';
|
|
4
4
|
export type SupportedProduct = 'Jira' | 'Confluence' | 'Compass' | 'Teamwork Graph' | 'Atlas' | 'Bitbucket';
|
|
5
5
|
type ProductType = 'sited' | 'workspace';
|
|
6
6
|
export type ProductDefinition = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supported-products-service.d.ts","sourceRoot":"","sources":["../../src/service/supported-products-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"supported-products-service.d.ts","sourceRoot":"","sources":["../../src/service/supported-products-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAuC,MAAM,oBAAoB,CAAC;AAK7F,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,GAAG,gBAAgB,GAAG,OAAO,GAAG,WAAW,CAAC;AAuC5G,KAAK,WAAW,GAAG,OAAO,GAAG,WAAW,CAAC;AAEzC,MAAM,MAAM,iBAAiB,GAAG;I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= require("../ui");
|
|
1
|
+
import { URL } from 'url';
|
|
2
|
+
import { productDisplayName, ValidationError } from '../shared/index.js';
|
|
3
|
+
import { Text } from '../ui/index.js';
|
|
7
4
|
const SUPPORTED_PRODUCTS_DEFINITIONS = [
|
|
8
5
|
{
|
|
9
6
|
name: 'Jira',
|
|
@@ -79,7 +76,7 @@ class SupportedProductEntriesHolder {
|
|
|
79
76
|
return this.value;
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
|
-
class SupportedProductsService {
|
|
79
|
+
export class SupportedProductsService {
|
|
83
80
|
supportedProductEntriesHolder;
|
|
84
81
|
constructor(supportedProductEntries) {
|
|
85
82
|
this.supportedProductEntriesHolder = new SupportedProductEntriesHolder(supportedProductEntries);
|
|
@@ -97,27 +94,27 @@ class SupportedProductsService {
|
|
|
97
94
|
return this.supportedProductEntriesHolder.get().map((p) => p.productName);
|
|
98
95
|
}
|
|
99
96
|
getSupportedSecondaryProductsForXPA(requiredProducts) {
|
|
100
|
-
const requiredProductsNames = requiredProducts.map((p) =>
|
|
97
|
+
const requiredProductsNames = requiredProducts.map((p) => productDisplayName(p));
|
|
101
98
|
return this.getFilteredSupportedProducts((p) => p.supportedByCrossProductApps && !requiredProductsNames.includes(p.productName));
|
|
102
99
|
}
|
|
103
100
|
validateSupportedProduct(productNameInput) {
|
|
104
|
-
const productName =
|
|
101
|
+
const productName = productDisplayName(productNameInput);
|
|
105
102
|
const supportedProducts = this.getSupportedProducts();
|
|
106
103
|
if (supportedProducts.includes(productName)) {
|
|
107
104
|
return productName;
|
|
108
105
|
}
|
|
109
106
|
else {
|
|
110
|
-
throw new
|
|
107
|
+
throw new ValidationError(Text.error.invalidContext([]));
|
|
111
108
|
}
|
|
112
109
|
}
|
|
113
110
|
isWorkspaceProduct(product) {
|
|
114
|
-
return this.getFilteredSupportedProducts((p) => p.productType === 'workspace').includes(
|
|
111
|
+
return this.getFilteredSupportedProducts((p) => p.productType === 'workspace').includes(productDisplayName(product));
|
|
115
112
|
}
|
|
116
113
|
validateSite(site, product) {
|
|
117
114
|
const trySites = [site, `https://${site}`];
|
|
118
115
|
for (const trySite of trySites) {
|
|
119
116
|
try {
|
|
120
|
-
const urlObj = new
|
|
117
|
+
const urlObj = new URL(trySite);
|
|
121
118
|
if (product && this.isWorkspaceProduct(product)) {
|
|
122
119
|
return urlObj;
|
|
123
120
|
}
|
|
@@ -127,14 +124,12 @@ class SupportedProductsService {
|
|
|
127
124
|
catch {
|
|
128
125
|
}
|
|
129
126
|
}
|
|
130
|
-
throw new
|
|
127
|
+
throw new ValidationError(Text.error.invalidSite);
|
|
131
128
|
}
|
|
132
129
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
return (0, shared_1.productDisplayName)(product) === 'Bitbucket';
|
|
130
|
+
export const isBitbucketProduct = (product) => {
|
|
131
|
+
return productDisplayName(product) === 'Bitbucket';
|
|
136
132
|
};
|
|
137
|
-
|
|
138
|
-
exports.TEST_ONLY_EXPORTS = {
|
|
133
|
+
export const TEST_ONLY_EXPORTS = {
|
|
139
134
|
resolveEnabledProducts
|
|
140
135
|
};
|