@forge/cli-shared 10.0.0-next.13 → 10.0.0-next.14
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 +6 -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 +4 -0
- 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 +2 -1
package/out/apps/register-app.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const file_system_1 = require("../file-system");
|
|
6
|
-
const ui_1 = require("../ui");
|
|
7
|
-
class RegisterAppCommand {
|
|
1
|
+
import { findUIKit1Modules } from '../config/index.js';
|
|
2
|
+
import { inDirectory } from '../file-system/index.js';
|
|
3
|
+
import { Text } from '../ui/index.js';
|
|
4
|
+
export class RegisterAppCommand {
|
|
8
5
|
appClient;
|
|
9
6
|
appConfigReader;
|
|
10
7
|
appConfigWriter;
|
|
@@ -25,14 +22,14 @@ class RegisterAppCommand {
|
|
|
25
22
|
};
|
|
26
23
|
}
|
|
27
24
|
async registerApp(input, directory, { shouldPrependAppName, compatibility }) {
|
|
28
|
-
this.logger.info(
|
|
25
|
+
this.logger.info(Text.create.taskRegister);
|
|
29
26
|
const result = await this.appClient.createApp(input);
|
|
30
|
-
await
|
|
27
|
+
await inDirectory(directory, async () => {
|
|
31
28
|
const { modules } = await this.configFile.readConfig();
|
|
32
29
|
if (modules) {
|
|
33
|
-
const uiKit1Modules =
|
|
30
|
+
const uiKit1Modules = findUIKit1Modules(modules);
|
|
34
31
|
if (uiKit1Modules.length > 0) {
|
|
35
|
-
this.logger.warn(
|
|
32
|
+
this.logger.warn(Text.warning.deprecation.uikit(uiKit1Modules));
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
35
|
const section = await this.appConfigReader.readConfigSection();
|
|
@@ -51,8 +48,7 @@ class RegisterAppCommand {
|
|
|
51
48
|
await this.appConfigWriter.prependAppNameToModules(input.name);
|
|
52
49
|
}
|
|
53
50
|
});
|
|
54
|
-
this.logger.info(
|
|
51
|
+
this.logger.info(Text.create.taskCreateEnvironments);
|
|
55
52
|
return result;
|
|
56
53
|
}
|
|
57
54
|
}
|
|
58
|
-
exports.RegisterAppCommand = RegisterAppCommand;
|
package/out/apps/sites.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSecureSite = isSecureSite;
|
|
4
1
|
const secureSites = ['product-fabric.atlassian.net', 'hello.atlassian.net'];
|
|
5
|
-
function isSecureSite(site) {
|
|
2
|
+
export function isSecureSite(site) {
|
|
6
3
|
return secureSites.includes(site.host);
|
|
7
4
|
}
|
|
@@ -1,24 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const os_1 = tslib_1.__importDefault(require("os"));
|
|
8
|
-
const url_1 = require("url");
|
|
9
|
-
const adm_zip_1 = tslib_1.__importDefault(require("adm-zip"));
|
|
10
|
-
const text_1 = require("../ui/text");
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import os from 'os';
|
|
4
|
+
import { URL } from 'url';
|
|
5
|
+
import AdmZip from 'adm-zip';
|
|
6
|
+
import { Text } from '../ui/text.js';
|
|
11
7
|
const BIFROST_BASE_URL = 'https://forge-templates-bifrost.prod-east.frontend.public.atl-paas.net/assets/';
|
|
12
8
|
const MODULE_INDEX_FILE = 'template-modules.json';
|
|
13
9
|
const MODULE_SHOW_FILE = 'description.json';
|
|
14
|
-
class BifrostFetchError extends Error {
|
|
10
|
+
export class BifrostFetchError extends Error {
|
|
15
11
|
constructor(message) {
|
|
16
12
|
super(message);
|
|
17
13
|
this.name = 'BifrostFetchError';
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
|
-
|
|
21
|
-
class TemplateModuleServices {
|
|
16
|
+
export class TemplateModuleServices {
|
|
22
17
|
baseUrl;
|
|
23
18
|
templatesCache = null;
|
|
24
19
|
constructor(baseUrl) {
|
|
@@ -28,23 +23,23 @@ class TemplateModuleServices {
|
|
|
28
23
|
if (this.templatesCache) {
|
|
29
24
|
return this.templatesCache;
|
|
30
25
|
}
|
|
31
|
-
const indexUrl = new
|
|
26
|
+
const indexUrl = new URL(MODULE_INDEX_FILE, this.baseUrl);
|
|
32
27
|
const res = await fetch(indexUrl);
|
|
33
28
|
if (!res.ok) {
|
|
34
|
-
throw new BifrostFetchError(
|
|
29
|
+
throw new BifrostFetchError(Text.module.errors.bifrostIndexFetchFailed(res.status, res.statusText));
|
|
35
30
|
}
|
|
36
31
|
const json = await res.json();
|
|
37
32
|
if (Array.isArray(json)) {
|
|
38
33
|
this.templatesCache = json;
|
|
39
34
|
return this.templatesCache;
|
|
40
35
|
}
|
|
41
|
-
throw new BifrostFetchError(
|
|
36
|
+
throw new BifrostFetchError(Text.module.errors.bifrostIndexInvalid);
|
|
42
37
|
}
|
|
43
38
|
async fetchModuleShowMeta(moduleKey) {
|
|
44
39
|
const url = `${this.baseUrl}${moduleKey}/${MODULE_SHOW_FILE}`;
|
|
45
40
|
const res = await fetch(url);
|
|
46
41
|
if (!res.ok) {
|
|
47
|
-
throw new BifrostFetchError(
|
|
42
|
+
throw new BifrostFetchError(Text.module.errors.bifrostIndexFetchFailed(res.status, res.statusText));
|
|
48
43
|
}
|
|
49
44
|
return (await res.json());
|
|
50
45
|
}
|
|
@@ -52,7 +47,7 @@ class TemplateModuleServices {
|
|
|
52
47
|
const url = `${this.baseUrl}${manifestPath}`;
|
|
53
48
|
const res = await fetch(url);
|
|
54
49
|
if (!res.ok) {
|
|
55
|
-
throw new BifrostFetchError(
|
|
50
|
+
throw new BifrostFetchError(Text.module.errors.bifrostManifestFragmentFetchFailed(res.status, res.statusText));
|
|
56
51
|
}
|
|
57
52
|
return await res.text();
|
|
58
53
|
}
|
|
@@ -61,7 +56,7 @@ class TemplateModuleServices {
|
|
|
61
56
|
return { ...template };
|
|
62
57
|
const variantData = template.variants?.[uiFramework];
|
|
63
58
|
if (!variantData) {
|
|
64
|
-
throw new Error(
|
|
59
|
+
throw new Error(Text.module.add.errorInvalidUIFramework(uiFramework, template.moduleKey));
|
|
65
60
|
}
|
|
66
61
|
return {
|
|
67
62
|
...template,
|
|
@@ -76,10 +71,10 @@ class TemplateModuleServices {
|
|
|
76
71
|
}
|
|
77
72
|
async prepareModuleMetadata(template, uiFramework) {
|
|
78
73
|
const resolved = this.applyVariant(template, uiFramework);
|
|
79
|
-
const cacheDir =
|
|
74
|
+
const cacheDir = fs.mkdtempSync(path.join(os.tmpdir(), 'forge-module-'));
|
|
80
75
|
if (resolved.manifestPath) {
|
|
81
76
|
const manifestFragment = await this.fetchManifestFragment(resolved.manifestPath);
|
|
82
|
-
|
|
77
|
+
fs.writeFileSync(path.join(cacheDir, 'manifest-fragment.yml'), manifestFragment);
|
|
83
78
|
}
|
|
84
79
|
return { ...resolved, cacheDir };
|
|
85
80
|
}
|
|
@@ -88,7 +83,7 @@ class TemplateModuleServices {
|
|
|
88
83
|
return;
|
|
89
84
|
}
|
|
90
85
|
if (!template.cacheDir) {
|
|
91
|
-
throw new Error(
|
|
86
|
+
throw new Error(Text.module.add.errorCacheDirMissing(template.moduleKey));
|
|
92
87
|
}
|
|
93
88
|
const rel = uiFramework ? `${template.moduleKey}/${uiFramework}/bundle.zip` : `${template.moduleKey}/bundle.zip`;
|
|
94
89
|
const url = `${this.baseUrl}${rel}`;
|
|
@@ -98,36 +93,35 @@ class TemplateModuleServices {
|
|
|
98
93
|
}
|
|
99
94
|
catch (err) {
|
|
100
95
|
const message = err instanceof Error ? err.message : String(err);
|
|
101
|
-
throw new Error(
|
|
96
|
+
throw new Error(Text.module.add.errorFailedToDownloadBundle(template.moduleKey, message), { cause: err });
|
|
102
97
|
}
|
|
103
98
|
if (!res.ok) {
|
|
104
|
-
throw new BifrostFetchError(`${
|
|
99
|
+
throw new BifrostFetchError(`${Text.module.errors.bifrostZipFetchFailed(template.moduleKey, res.status, res.statusText)} (last URL: ${url})`);
|
|
105
100
|
}
|
|
106
101
|
const arrayBuffer = await res.arrayBuffer();
|
|
107
|
-
const zipPath =
|
|
108
|
-
|
|
102
|
+
const zipPath = path.join(template.cacheDir, 'bundle.zip');
|
|
103
|
+
fs.writeFileSync(zipPath, Buffer.from(arrayBuffer));
|
|
109
104
|
try {
|
|
110
|
-
new
|
|
105
|
+
new AdmZip(zipPath).extractAllTo(template.cacheDir, true);
|
|
111
106
|
}
|
|
112
107
|
catch (err) {
|
|
113
|
-
throw new BifrostFetchError(
|
|
108
|
+
throw new BifrostFetchError(Text.module.add.errorZipExtractionFailed(template.moduleKey, err.message));
|
|
114
109
|
}
|
|
115
110
|
finally {
|
|
116
111
|
try {
|
|
117
|
-
|
|
112
|
+
fs.rmSync(zipPath, { force: true });
|
|
118
113
|
}
|
|
119
114
|
catch (cleanupErr) {
|
|
120
|
-
console.warn(`${
|
|
115
|
+
console.warn(`${Text.module.add.errorZipCleanupFailed(template.moduleKey)}`);
|
|
121
116
|
}
|
|
122
117
|
}
|
|
123
118
|
}
|
|
124
119
|
cleanupCache(cacheDir) {
|
|
125
120
|
try {
|
|
126
|
-
|
|
121
|
+
fs.rmSync(cacheDir, { recursive: true, force: true });
|
|
127
122
|
}
|
|
128
123
|
catch {
|
|
129
|
-
throw new Error(
|
|
124
|
+
throw new Error(Text.module.add.errorCacheCleanupFailed(cacheDir));
|
|
130
125
|
}
|
|
131
126
|
}
|
|
132
127
|
}
|
|
133
|
-
exports.TemplateModuleServices = TemplateModuleServices;
|
package/out/apps/template.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { UserError } from '../shared/error-handling';
|
|
2
|
-
import { ZipAccessor } from '../file-system';
|
|
3
|
-
import { Logger } from '../ui';
|
|
1
|
+
import { UserError } from '../shared/error-handling.js';
|
|
2
|
+
import { ZipAccessor } from '../file-system/index.js';
|
|
3
|
+
import { Logger } from '../ui/index.js';
|
|
4
4
|
export declare class NoTemplateError extends UserError {
|
|
5
5
|
constructor(template: string);
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/apps/template.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/apps/template.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAMxC,qBAAa,eAAgB,SAAQ,SAAS;gBAChC,QAAQ,EAAE,MAAM;CAG7B;AAED,qBAAa,2BAA4B,SAAQ,KAAK;CAAG;AAEzD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE;AAED,MAAM,WAAW,cAAc;IAC7B,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,SAAU,SAAQ,cAAc;IAC/C,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE;AAED,qBAAa,yBAA0B,YAAW,kBAAkB;IACrD,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYvE,OAAO,CAAC,WAAW;CAGpB;AAED,qBAAa,oBAAqB,YAAW,iBAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAExC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAc7D,2BAA2B;CAe1C;AAED,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,OAAO,EAAE,MAAM;CAG5B;AAKD,qBAAa,qBAAsB,YAAW,cAAc;IAC1D,OAAO,CAAC,uBAAuB;IAI/B,OAAO,CAAC,wBAAwB;IAOnB,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAcxD;AAED,qBAAa,mBAAoB,YAAW,SAAS;IAEjD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAHN,UAAU,EAAE,kBAAkB,EAC9B,SAAS,EAAE,iBAAiB,EAC5B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM;IAEpB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBnF,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAG3C"}
|
package/out/apps/template.js
CHANGED
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const tmp_1 = tslib_1.__importDefault(require("tmp"));
|
|
9
|
-
const url_1 = require("url");
|
|
10
|
-
const error_handling_1 = require("../shared/error-handling");
|
|
11
|
-
const ui_1 = require("../ui");
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import fsExtra from 'fs-extra';
|
|
3
|
+
import { resolve as resolvePath } from 'path';
|
|
4
|
+
import tmp from 'tmp';
|
|
5
|
+
import { URL } from 'url';
|
|
6
|
+
import { UserError } from '../shared/error-handling.js';
|
|
7
|
+
import { Text } from '../ui/index.js';
|
|
12
8
|
const TEMPLATE_SERVICE_URL = 'https://forge-templates-bifrost.prod-east.frontend.public.atl-paas.net/assets/';
|
|
13
9
|
const TEMPLATE_MAP = 'templates.json';
|
|
14
|
-
class NoTemplateError extends
|
|
10
|
+
export class NoTemplateError extends UserError {
|
|
15
11
|
constructor(template) {
|
|
16
|
-
super(
|
|
12
|
+
super(Text.create.error.template.notFound(template));
|
|
17
13
|
}
|
|
18
14
|
}
|
|
19
|
-
|
|
20
|
-
class InvalidTemplateArchiveError extends Error {
|
|
15
|
+
export class InvalidTemplateArchiveError extends Error {
|
|
21
16
|
}
|
|
22
|
-
|
|
23
|
-
class TemplateServiceDownloader {
|
|
17
|
+
export class TemplateServiceDownloader {
|
|
24
18
|
async download(template, zipFile) {
|
|
25
19
|
const zipUrl = this.buildZipUrl(template);
|
|
26
20
|
const response = await fetch(zipUrl);
|
|
@@ -28,50 +22,47 @@ class TemplateServiceDownloader {
|
|
|
28
22
|
throw new NoTemplateError(template);
|
|
29
23
|
}
|
|
30
24
|
const zipBytes = await response.arrayBuffer();
|
|
31
|
-
|
|
25
|
+
fs.writeFileSync(zipFile, Buffer.from(zipBytes));
|
|
32
26
|
}
|
|
33
27
|
buildZipUrl(template) {
|
|
34
|
-
return new
|
|
28
|
+
return new URL(`${template}.zip`, TEMPLATE_SERVICE_URL);
|
|
35
29
|
}
|
|
36
30
|
}
|
|
37
|
-
|
|
38
|
-
class ZipTemplateExtractor {
|
|
31
|
+
export class ZipTemplateExtractor {
|
|
39
32
|
zipAccessor;
|
|
40
33
|
constructor(zipAccessor) {
|
|
41
34
|
this.zipAccessor = zipAccessor;
|
|
42
35
|
}
|
|
43
36
|
async extract(zipFile, destDirectory) {
|
|
44
|
-
const extractDirectory =
|
|
37
|
+
const extractDirectory = tmp.dirSync({ prefix: 'template', unsafeCleanup: true }).name;
|
|
45
38
|
try {
|
|
46
39
|
await this.zipAccessor.extract(zipFile, extractDirectory);
|
|
47
40
|
await this.moveArchiveFilesToDirectory(extractDirectory, destDirectory);
|
|
48
41
|
}
|
|
49
42
|
finally {
|
|
50
|
-
|
|
43
|
+
fsExtra.removeSync(extractDirectory);
|
|
51
44
|
}
|
|
52
45
|
}
|
|
53
46
|
async moveArchiveFilesToDirectory(extractDirectory, destDirectory) {
|
|
54
|
-
const archiveChildren =
|
|
47
|
+
const archiveChildren = fs.readdirSync(extractDirectory);
|
|
55
48
|
if (archiveChildren.length !== 1) {
|
|
56
|
-
throw new InvalidTemplateArchiveError(
|
|
49
|
+
throw new InvalidTemplateArchiveError(Text.create.error.template.unexpectedArchiveFormat);
|
|
57
50
|
}
|
|
58
|
-
const templateRepoDirectory = (
|
|
59
|
-
const templateEntries =
|
|
51
|
+
const templateRepoDirectory = resolvePath(extractDirectory, archiveChildren[0]);
|
|
52
|
+
const templateEntries = fs.readdirSync(templateRepoDirectory);
|
|
60
53
|
for (const entry of templateEntries) {
|
|
61
|
-
const entrySourceFullPath = (
|
|
62
|
-
const entryDestFullPath = (
|
|
63
|
-
|
|
54
|
+
const entrySourceFullPath = resolvePath(templateRepoDirectory, entry);
|
|
55
|
+
const entryDestFullPath = resolvePath(destDirectory, entry);
|
|
56
|
+
fsExtra.moveSync(entrySourceFullPath, entryDestFullPath);
|
|
64
57
|
}
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
|
-
|
|
68
|
-
class TemplateFetchError extends Error {
|
|
60
|
+
export class TemplateFetchError extends Error {
|
|
69
61
|
constructor(message) {
|
|
70
|
-
super(
|
|
62
|
+
super(Text.error.templateFetchFailed(message));
|
|
71
63
|
}
|
|
72
64
|
}
|
|
73
|
-
|
|
74
|
-
class TemplateServiceLister {
|
|
65
|
+
export class TemplateServiceLister {
|
|
75
66
|
isValidTemplateMapEntry(entry) {
|
|
76
67
|
return typeof entry === 'object' && entry !== null && typeof entry.name === 'string';
|
|
77
68
|
}
|
|
@@ -82,7 +73,7 @@ class TemplateServiceLister {
|
|
|
82
73
|
return false;
|
|
83
74
|
}
|
|
84
75
|
async getAvailableTemplates() {
|
|
85
|
-
const res = await fetch(new
|
|
76
|
+
const res = await fetch(new URL(TEMPLATE_MAP, TEMPLATE_SERVICE_URL));
|
|
86
77
|
if (!res.ok) {
|
|
87
78
|
throw new TemplateFetchError(res.statusText);
|
|
88
79
|
}
|
|
@@ -95,8 +86,7 @@ class TemplateServiceLister {
|
|
|
95
86
|
}
|
|
96
87
|
}
|
|
97
88
|
}
|
|
98
|
-
|
|
99
|
-
class ComposableTemplater {
|
|
89
|
+
export class ComposableTemplater {
|
|
100
90
|
downloader;
|
|
101
91
|
extractor;
|
|
102
92
|
lister;
|
|
@@ -108,26 +98,25 @@ class ComposableTemplater {
|
|
|
108
98
|
this.logger = logger;
|
|
109
99
|
}
|
|
110
100
|
async downloadAndExtract(template, directory) {
|
|
111
|
-
this.logger.info(
|
|
112
|
-
const zipFile =
|
|
113
|
-
const destDirectory = (
|
|
101
|
+
this.logger.info(Text.create.taskTemplate.title);
|
|
102
|
+
const zipFile = tmp.fileSync({ postfix: '.zip' }).name;
|
|
103
|
+
const destDirectory = resolvePath(process.cwd(), directory);
|
|
114
104
|
try {
|
|
115
|
-
|
|
116
|
-
this.logger.debug(
|
|
105
|
+
fsExtra.mkdirpSync(destDirectory);
|
|
106
|
+
this.logger.debug(Text.create.taskTemplate.downloading(template));
|
|
117
107
|
await this.downloader.download(template, zipFile);
|
|
118
|
-
this.logger.debug(
|
|
108
|
+
this.logger.debug(Text.create.taskTemplate.extracting);
|
|
119
109
|
await this.extractor.extract(zipFile, destDirectory);
|
|
120
110
|
}
|
|
121
111
|
catch (err) {
|
|
122
|
-
|
|
112
|
+
fsExtra.removeSync(destDirectory);
|
|
123
113
|
throw err;
|
|
124
114
|
}
|
|
125
115
|
finally {
|
|
126
|
-
|
|
116
|
+
fs.unlinkSync(zipFile);
|
|
127
117
|
}
|
|
128
118
|
}
|
|
129
119
|
getAvailableTemplates() {
|
|
130
120
|
return this.lister.getAvailableTemplates();
|
|
131
121
|
}
|
|
132
122
|
}
|
|
133
|
-
exports.ComposableTemplater = ComposableTemplater;
|
package/out/ari/ari.js
CHANGED
|
@@ -1,34 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const shared_1 = require("../shared");
|
|
15
|
-
const ui_1 = require("../ui");
|
|
16
|
-
exports.SITE_RESOURCE_TYPE = 'site';
|
|
17
|
-
exports.WORKSPACE_RESOURCE_TYPE = 'workspace';
|
|
18
|
-
exports.WORKSPACE_USER_RESOURCE_TYPE = 'workspace-user';
|
|
19
|
-
exports.INSTALLATION_RESOURCE_TYPE = 'installation';
|
|
20
|
-
exports.UNIT_RESOURCE_TYPE = 'unit';
|
|
21
|
-
exports.TRELLO_RESOURCE_OWNER = 'trello';
|
|
22
|
-
exports.BITBUCKET_RESOURCE_OWNER = 'bitbucket';
|
|
23
|
-
exports.ISOLATION_CONTEXT_PLACEMENT_TYPE = 'isolation-context';
|
|
24
|
-
exports.REGION_PLACEMENT_TYPE = 'region';
|
|
25
|
-
exports.CUSTOMER_DATA_PLANE_PLACEMENT_TYPE = 'customer-data-plane';
|
|
1
|
+
import { AnyAri, CompassWorkspaceAri, ConfluenceWorkspaceAri, EcosystemAppPlacementAri, GraphWorkspaceAri, JiraWorkspaceAri } from '@forge/util/packages/ari';
|
|
2
|
+
import { ariResourceOwner } from '../shared/index.js';
|
|
3
|
+
import { Text } from '../ui/index.js';
|
|
4
|
+
export const SITE_RESOURCE_TYPE = 'site';
|
|
5
|
+
export const WORKSPACE_RESOURCE_TYPE = 'workspace';
|
|
6
|
+
export const WORKSPACE_USER_RESOURCE_TYPE = 'workspace-user';
|
|
7
|
+
export const INSTALLATION_RESOURCE_TYPE = 'installation';
|
|
8
|
+
export const UNIT_RESOURCE_TYPE = 'unit';
|
|
9
|
+
export const TRELLO_RESOURCE_OWNER = 'trello';
|
|
10
|
+
export const BITBUCKET_RESOURCE_OWNER = 'bitbucket';
|
|
11
|
+
export const ISOLATION_CONTEXT_PLACEMENT_TYPE = 'isolation-context';
|
|
12
|
+
export const REGION_PLACEMENT_TYPE = 'region';
|
|
13
|
+
export const CUSTOMER_DATA_PLANE_PLACEMENT_TYPE = 'customer-data-plane';
|
|
26
14
|
const ISOLATION_CONTEXT_ID_PREFIX = 'ic-';
|
|
27
15
|
const CUSTOMER_DATA_PLANE_ID_PREFIX = 'cdp-';
|
|
28
16
|
const ISOLATION_CONTEXT_ID_PATTERN = /^ic-[a-z0-9]+$/;
|
|
29
17
|
const CUSTOMER_DATA_PLANE_ID_PATTERN = /^cdp-[a-z0-9]+$/;
|
|
30
18
|
const REGION_ID_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
31
|
-
function isValidPlacementId(placementId) {
|
|
19
|
+
export function isValidPlacementId(placementId) {
|
|
32
20
|
if (placementId.startsWith(ISOLATION_CONTEXT_ID_PREFIX)) {
|
|
33
21
|
return ISOLATION_CONTEXT_ID_PATTERN.test(placementId);
|
|
34
22
|
}
|
|
@@ -37,80 +25,77 @@ function isValidPlacementId(placementId) {
|
|
|
37
25
|
}
|
|
38
26
|
return REGION_ID_PATTERN.test(placementId);
|
|
39
27
|
}
|
|
40
|
-
function appIdToAriString(appId) {
|
|
28
|
+
export function appIdToAriString(appId) {
|
|
41
29
|
return `ari:cloud:ecosystem::app/${appId}`;
|
|
42
30
|
}
|
|
43
|
-
function placementIdToPlacementType(placementId) {
|
|
31
|
+
export function placementIdToPlacementType(placementId) {
|
|
44
32
|
if (ISOLATION_CONTEXT_ID_PATTERN.test(placementId)) {
|
|
45
|
-
return
|
|
33
|
+
return ISOLATION_CONTEXT_PLACEMENT_TYPE;
|
|
46
34
|
}
|
|
47
35
|
if (CUSTOMER_DATA_PLANE_ID_PATTERN.test(placementId)) {
|
|
48
|
-
return
|
|
36
|
+
return CUSTOMER_DATA_PLANE_PLACEMENT_TYPE;
|
|
49
37
|
}
|
|
50
|
-
return
|
|
38
|
+
return REGION_PLACEMENT_TYPE;
|
|
51
39
|
}
|
|
52
|
-
function placementIdToAri(placementId) {
|
|
53
|
-
return
|
|
40
|
+
export function placementIdToAri(placementId) {
|
|
41
|
+
return EcosystemAppPlacementAri.create({ placementType: placementIdToPlacementType(placementId), placementId });
|
|
54
42
|
}
|
|
55
|
-
function parsePlacementAriString(placementAri) {
|
|
56
|
-
return
|
|
43
|
+
export function parsePlacementAriString(placementAri) {
|
|
44
|
+
return EcosystemAppPlacementAri.parse(placementAri);
|
|
57
45
|
}
|
|
58
|
-
function buildContextAri(cloudId, product) {
|
|
59
|
-
return
|
|
60
|
-
resourceOwner:
|
|
61
|
-
resourceType:
|
|
46
|
+
export function buildContextAri(cloudId, product) {
|
|
47
|
+
return AnyAri.create({
|
|
48
|
+
resourceOwner: ariResourceOwner(product),
|
|
49
|
+
resourceType: SITE_RESOURCE_TYPE,
|
|
62
50
|
resourceId: cloudId
|
|
63
51
|
});
|
|
64
52
|
}
|
|
65
|
-
function buildExtensionAri(appId, environmentId, functionKey) {
|
|
66
|
-
return
|
|
53
|
+
export function buildExtensionAri(appId, environmentId, functionKey) {
|
|
54
|
+
return AnyAri.create({
|
|
67
55
|
resourceOwner: 'ecosystem',
|
|
68
56
|
resourceType: 'extension',
|
|
69
57
|
resourceId: `${appId}/${environmentId}/static/${functionKey}`
|
|
70
58
|
});
|
|
71
59
|
}
|
|
72
|
-
function encodeContext(context, extension) {
|
|
60
|
+
export function encodeContext(context, extension) {
|
|
73
61
|
const serialised = JSON.stringify({ ctx: context.toString(), ext: extension.toString() });
|
|
74
62
|
return Buffer.from(serialised, 'utf-8').toString('base64').replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
|
|
75
63
|
}
|
|
76
|
-
class UnknownSiteWithoutResourceIdError extends Error {
|
|
64
|
+
export class UnknownSiteWithoutResourceIdError extends Error {
|
|
77
65
|
constructor() {
|
|
78
|
-
super(
|
|
66
|
+
super(Text.installList.noResourceId);
|
|
79
67
|
}
|
|
80
68
|
}
|
|
81
|
-
|
|
82
|
-
class UnknownWorkspaceWithoutResourceIdError extends Error {
|
|
69
|
+
export class UnknownWorkspaceWithoutResourceIdError extends Error {
|
|
83
70
|
constructor() {
|
|
84
|
-
super(
|
|
71
|
+
super(Text.installList.noResourceIdInWorkspace);
|
|
85
72
|
}
|
|
86
73
|
}
|
|
87
|
-
|
|
88
|
-
class UnknownInstallationWithoutResourceIdError extends Error {
|
|
74
|
+
export class UnknownInstallationWithoutResourceIdError extends Error {
|
|
89
75
|
constructor() {
|
|
90
|
-
super(
|
|
76
|
+
super(Text.installList.noResourceIdInInstallation);
|
|
91
77
|
}
|
|
92
78
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const context = ari_1.AnyAri.parse(installationContext);
|
|
79
|
+
export function parseInstallationContext(installationContext) {
|
|
80
|
+
const context = AnyAri.parse(installationContext);
|
|
96
81
|
switch (context.resourceType) {
|
|
97
|
-
case
|
|
82
|
+
case SITE_RESOURCE_TYPE:
|
|
98
83
|
if (!context.resourceId) {
|
|
99
84
|
throw new UnknownSiteWithoutResourceIdError();
|
|
100
85
|
}
|
|
101
86
|
break;
|
|
102
|
-
case
|
|
87
|
+
case WORKSPACE_RESOURCE_TYPE:
|
|
103
88
|
if (!context.resourceId) {
|
|
104
89
|
throw new UnknownWorkspaceWithoutResourceIdError();
|
|
105
90
|
}
|
|
106
91
|
break;
|
|
107
|
-
case
|
|
108
|
-
case
|
|
92
|
+
case INSTALLATION_RESOURCE_TYPE:
|
|
93
|
+
case UNIT_RESOURCE_TYPE:
|
|
109
94
|
if (!context.resourceId) {
|
|
110
95
|
throw new UnknownInstallationWithoutResourceIdError();
|
|
111
96
|
}
|
|
112
97
|
break;
|
|
113
|
-
case
|
|
98
|
+
case WORKSPACE_USER_RESOURCE_TYPE:
|
|
114
99
|
const [activationId, userId] = (context.resourceId ?? '')?.split('/');
|
|
115
100
|
if (!(activationId && userId)) {
|
|
116
101
|
throw new UnknownWorkspaceWithoutResourceIdError();
|
|
@@ -121,9 +106,9 @@ function parseInstallationContext(installationContext) {
|
|
|
121
106
|
}
|
|
122
107
|
return context;
|
|
123
108
|
}
|
|
124
|
-
|
|
125
|
-
jira: (siteId, activationId) =>
|
|
126
|
-
confluence: (siteId, activationId) =>
|
|
127
|
-
compass: (siteId, workspaceId) =>
|
|
128
|
-
graph: (_siteId, workspaceId) =>
|
|
109
|
+
export const createWorkspaceAriByProduct = {
|
|
110
|
+
jira: (siteId, activationId) => JiraWorkspaceAri.create({ siteId, activationId }),
|
|
111
|
+
confluence: (siteId, activationId) => ConfluenceWorkspaceAri.create({ siteId, activationId }),
|
|
112
|
+
compass: (siteId, workspaceId) => CompassWorkspaceAri.create({ siteId, workspaceId }),
|
|
113
|
+
graph: (_siteId, workspaceId) => GraphWorkspaceAri.create({ workspaceId })
|
|
129
114
|
};
|
package/out/ari/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './ari';
|
|
1
|
+
export * from './ari.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/out/ari/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ari/index.ts"],"names":[],"mappings":"AAEA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ari/index.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAC"}
|
package/out/ari/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBasicAuthorizationHeader = getBasicAuthorizationHeader;
|
|
4
|
-
exports.getBearerAuthorizationHeader = getBearerAuthorizationHeader;
|
|
5
|
-
function getBasicAuthorizationHeader(username, password) {
|
|
1
|
+
export function getBasicAuthorizationHeader(username, password) {
|
|
6
2
|
const base64 = Buffer.from(`${username}:${password}`).toString('base64');
|
|
7
3
|
return { authorization: `Basic ${base64}` };
|
|
8
4
|
}
|
|
9
|
-
function getBearerAuthorizationHeader(token) {
|
|
5
|
+
export function getBearerAuthorizationHeader(token) {
|
|
10
6
|
return { authorization: `Bearer ${token}` };
|
|
11
7
|
}
|
package/out/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './personal';
|
|
2
|
-
export * from './authenticator';
|
|
3
|
-
export * from './instruction';
|
|
1
|
+
export * from './personal/index.js';
|
|
2
|
+
export * from './authenticator.js';
|
|
3
|
+
export * from './instruction.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/out/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAEA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/auth/index.ts"],"names":[],"mappings":"AAEA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
|
package/out/auth/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
tslib_1.__exportStar(require("./personal"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./authenticator"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./instruction"), exports);
|
|
1
|
+
export * from './personal/index.js';
|
|
2
|
+
export * from './authenticator.js';
|
|
3
|
+
export * from './instruction.js';
|
package/out/auth/instruction.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInstructionsUrl = getInstructionsUrl;
|
|
4
|
-
const gateway_1 = require("../graphql/gateway");
|
|
1
|
+
import { getEnvironmentConfig } from '../graphql/gateway.js';
|
|
5
2
|
const INSTRUCTION_URLS = {
|
|
6
3
|
DEV: 'https://go.atlassian.com/forge-cli-api-token-stg',
|
|
7
4
|
STG: 'https://go.atlassian.com/forge-cli-api-token-stg',
|
|
@@ -9,6 +6,6 @@ const INSTRUCTION_URLS = {
|
|
|
9
6
|
FEDRAMP_MODERATE_STAGING: 'https://go.atlassian.com/forge-cli-api-token-federal-stg',
|
|
10
7
|
FEDRAMP_MODERATE_PROD: 'https://go.atlassian.com/forge-cli-api-token-federal'
|
|
11
8
|
};
|
|
12
|
-
function getInstructionsUrl() {
|
|
13
|
-
return
|
|
9
|
+
export function getInstructionsUrl() {
|
|
10
|
+
return getEnvironmentConfig(INSTRUCTION_URLS);
|
|
14
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as t from 'io-ts';
|
|
2
|
-
import { UserError } from '../../shared';
|
|
3
|
-
import { UserRepository } from './user-repository';
|
|
2
|
+
import { UserError } from '../../shared/index.js';
|
|
3
|
+
import { UserRepository } from './user-repository.js';
|
|
4
4
|
export declare const EMAIL_KEY = "FORGE_EMAIL";
|
|
5
5
|
export declare const API_TOKEN_KEY = "FORGE_API_TOKEN";
|
|
6
6
|
export declare const personalApiCredentialsShape: t.TypeC<{
|