@forge/cli-shared 5.0.0-next.5 → 5.0.0-next.6
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 +8 -0
- package/out/app-logs/graphql-client.js +9 -2
- package/out/app-logs/view-logs.js +4 -0
- package/out/apps/app-config.js +4 -1
- package/out/apps/create-an-app.js +3 -0
- package/out/apps/create-app-graphql-client.js +1 -0
- package/out/apps/get-app-owner.js +2 -0
- package/out/apps/package-installer.js +1 -0
- package/out/apps/register-app.js +8 -1
- package/out/apps/template.js +5 -0
- package/out/auth/personal/credential-store.js +7 -2
- package/out/auth/personal/login.js +8 -2
- package/out/auth/personal/logout.js +1 -0
- package/out/auth/personal/me-graphql-client.js +2 -0
- package/out/auth/personal/token-authenticator.js +1 -0
- package/out/cache/cached-conf.js +1 -0
- package/out/config/config-file-section-reader.js +4 -0
- package/out/config/config-file-section-writer.js +2 -0
- package/out/config/config-file.d.ts +2 -2
- package/out/config/config-file.d.ts.map +1 -1
- package/out/config/config-file.js +48 -55
- package/out/config/config-section.js +1 -0
- package/out/file-system/file-system-reader.js +2 -2
- package/out/graphql/app-environment-graphql-client.js +1 -0
- package/out/graphql/app-oauth-client-id-graphql-client.js +1 -0
- package/out/graphql/debugging-graphql-runner.js +3 -0
- package/out/graphql/get-mutation-error.js +4 -5
- package/out/graphql/graphql-types.d.ts +91 -0
- package/out/graphql/graphql-types.d.ts.map +1 -1
- package/out/graphql/graphql-types.js +14 -7
- package/out/graphql/minimal-graphql-runner.js +30 -22
- package/out/graphql/mutation-aware-graphql-client.js +14 -10
- package/out/http-client/feedback-post-client.js +1 -3
- package/out/http-client/file-uploader.js +1 -0
- package/out/http-client/global-edge-http-client.js +1 -0
- package/out/http-client/trace.js +1 -2
- package/out/runtimes/helper.js +1 -1
- package/out/service/bridge-script-service.js +1 -0
- package/out/service/feature-flag-service.js +51 -48
- package/out/service/iframe-resizer-script-service.js +1 -0
- package/out/shared/cli-details.js +2 -2
- package/out/shared/error-handling.js +5 -3
- package/out/shared/product.js +2 -4
- package/out/shared/read-app-config-files.js +7 -5
- package/out/shared/validate.js +1 -1
- package/out/ui/command-line-ui.js +14 -8
- package/out/ui/multiple-table-prompt.js +1 -1
- package/out/ui/table-prompt.js +8 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -20,6 +20,7 @@ class MissingMetadataError extends Error {
|
|
|
20
20
|
}
|
|
21
21
|
exports.MissingMetadataError = MissingMetadataError;
|
|
22
22
|
class LogsGraphQLClient {
|
|
23
|
+
graphqlClient;
|
|
23
24
|
constructor(graphqlClient) {
|
|
24
25
|
this.graphqlClient = graphqlClient;
|
|
25
26
|
}
|
|
@@ -28,7 +29,10 @@ class LogsGraphQLClient {
|
|
|
28
29
|
if (!result.lines.length) {
|
|
29
30
|
throw new MissingInvocationError();
|
|
30
31
|
}
|
|
31
|
-
return
|
|
32
|
+
return {
|
|
33
|
+
...this.extractInvocationInfo(result.metadata),
|
|
34
|
+
logs: result.lines.map(sanitizeLogLine)
|
|
35
|
+
};
|
|
32
36
|
}
|
|
33
37
|
async viewAppLogs(details) {
|
|
34
38
|
const query = `
|
|
@@ -153,7 +157,10 @@ class LogsGraphQLClient {
|
|
|
153
157
|
}
|
|
154
158
|
const { cursor, lines } = this.extractLogLines(result.appLogLines);
|
|
155
159
|
if (result.appLogLines.pageInfo.hasNextPage) {
|
|
156
|
-
const nextLines = await this.getInvocationLogs(
|
|
160
|
+
const nextLines = await this.getInvocationLogs({
|
|
161
|
+
...filter,
|
|
162
|
+
after: cursor
|
|
163
|
+
});
|
|
157
164
|
lines.push(...nextLines.lines);
|
|
158
165
|
}
|
|
159
166
|
return {
|
|
@@ -4,6 +4,10 @@ exports.ViewAppLogsCommand = void 0;
|
|
|
4
4
|
const ari_1 = require("@forge/util/packages/ari");
|
|
5
5
|
const ari_2 = require("../ari");
|
|
6
6
|
class ViewAppLogsCommand {
|
|
7
|
+
getAppConfig;
|
|
8
|
+
appEnvironmentClient;
|
|
9
|
+
globalEdgeClient;
|
|
10
|
+
logsClient;
|
|
7
11
|
constructor(getAppConfig, appEnvironmentClient, globalEdgeClient, logsClient) {
|
|
8
12
|
this.getAppConfig = getAppConfig;
|
|
9
13
|
this.appEnvironmentClient = appEnvironmentClient;
|
package/out/apps/app-config.js
CHANGED
|
@@ -14,7 +14,10 @@ function adjustLegacyAppId(legacyAppDetails) {
|
|
|
14
14
|
if (legacyAppDetails.id.startsWith('ari:')) {
|
|
15
15
|
return legacyAppDetails;
|
|
16
16
|
}
|
|
17
|
-
return
|
|
17
|
+
return {
|
|
18
|
+
...legacyAppDetails,
|
|
19
|
+
id: (0, ari_1.appIdToAriString)(legacyAppDetails.id)
|
|
20
|
+
};
|
|
18
21
|
}
|
|
19
22
|
exports.adjustLegacyAppId = adjustLegacyAppId;
|
|
20
23
|
const assertiveAppConfigProvider = (appConfigReader) => () => (0, config_1.assertive)(appConfigReader)
|
|
@@ -9,6 +9,9 @@ class NoTemplatesError extends Error {
|
|
|
9
9
|
}
|
|
10
10
|
exports.NoTemplatesError = NoTemplatesError;
|
|
11
11
|
class CreateAppCommand {
|
|
12
|
+
templater;
|
|
13
|
+
registerAppCommand;
|
|
14
|
+
packageInstaller;
|
|
12
15
|
constructor(templater, registerAppCommand, packageInstaller) {
|
|
13
16
|
this.templater = templater;
|
|
14
17
|
this.registerAppCommand = registerAppCommand;
|
|
@@ -10,6 +10,8 @@ class MissingAppOwnerError extends Error {
|
|
|
10
10
|
}
|
|
11
11
|
exports.MissingAppOwnerError = MissingAppOwnerError;
|
|
12
12
|
class GetAppOwnerQuery {
|
|
13
|
+
graphqlClient;
|
|
14
|
+
getAppConfig;
|
|
13
15
|
constructor(graphqlClient, getAppConfig) {
|
|
14
16
|
this.graphqlClient = graphqlClient;
|
|
15
17
|
this.getAppConfig = getAppConfig;
|
package/out/apps/register-app.js
CHANGED
|
@@ -4,6 +4,10 @@ exports.RegisterAppCommand = void 0;
|
|
|
4
4
|
const file_system_1 = require("../file-system");
|
|
5
5
|
const ui_1 = require("../ui");
|
|
6
6
|
class RegisterAppCommand {
|
|
7
|
+
appClient;
|
|
8
|
+
appConfigReader;
|
|
9
|
+
appConfigWriter;
|
|
10
|
+
logger;
|
|
7
11
|
constructor(appClient, appConfigReader, appConfigWriter, logger) {
|
|
8
12
|
this.appClient = appClient;
|
|
9
13
|
this.appConfigReader = appConfigReader;
|
|
@@ -26,7 +30,10 @@ class RegisterAppCommand {
|
|
|
26
30
|
id: result.id
|
|
27
31
|
};
|
|
28
32
|
if (section !== 'invalid' && section !== 'missing') {
|
|
29
|
-
newAppDetails =
|
|
33
|
+
newAppDetails = {
|
|
34
|
+
...section,
|
|
35
|
+
...newAppDetails
|
|
36
|
+
};
|
|
30
37
|
}
|
|
31
38
|
await this.appConfigWriter.writeConfigSection(newAppDetails);
|
|
32
39
|
if (shouldPrependAppName) {
|
package/out/apps/template.js
CHANGED
|
@@ -40,6 +40,7 @@ class TemplateServiceDownloader {
|
|
|
40
40
|
}
|
|
41
41
|
exports.TemplateServiceDownloader = TemplateServiceDownloader;
|
|
42
42
|
class ZipTemplateExtractor {
|
|
43
|
+
zipAccessor;
|
|
43
44
|
constructor(zipAccessor) {
|
|
44
45
|
this.zipAccessor = zipAccessor;
|
|
45
46
|
}
|
|
@@ -100,6 +101,10 @@ class TemplateServiceLister {
|
|
|
100
101
|
}
|
|
101
102
|
exports.TemplateServiceLister = TemplateServiceLister;
|
|
102
103
|
class ComposableTemplater {
|
|
104
|
+
downloader;
|
|
105
|
+
extractor;
|
|
106
|
+
lister;
|
|
107
|
+
logger;
|
|
103
108
|
constructor(downloader, extractor, lister, logger) {
|
|
104
109
|
this.downloader = downloader;
|
|
105
110
|
this.extractor = extractor;
|
|
@@ -27,7 +27,7 @@ function getKeytar() {
|
|
|
27
27
|
try {
|
|
28
28
|
return require('keytar');
|
|
29
29
|
}
|
|
30
|
-
catch
|
|
30
|
+
catch {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -56,6 +56,11 @@ class KeytarAccessError extends shared_1.UserError {
|
|
|
56
56
|
}
|
|
57
57
|
exports.KeytarAccessError = KeytarAccessError;
|
|
58
58
|
class CredentialStoreImpl {
|
|
59
|
+
logger;
|
|
60
|
+
instructionsURL;
|
|
61
|
+
keytar;
|
|
62
|
+
cachedConfig;
|
|
63
|
+
keytarAccount;
|
|
59
64
|
constructor(logger, instructionsURL, keytar, cachedConfig) {
|
|
60
65
|
this.logger = logger;
|
|
61
66
|
this.instructionsURL = instructionsURL;
|
|
@@ -90,7 +95,7 @@ class CredentialStoreImpl {
|
|
|
90
95
|
try {
|
|
91
96
|
credentials = JSON.parse(credentialsString);
|
|
92
97
|
}
|
|
93
|
-
catch
|
|
98
|
+
catch {
|
|
94
99
|
throw new NoTokenInStoreError();
|
|
95
100
|
}
|
|
96
101
|
const decodeResult = exports.personalApiCredentialsValidatedShape.decode(credentials);
|
|
@@ -4,6 +4,9 @@ exports.LoginCommand = void 0;
|
|
|
4
4
|
const me_graphql_client_1 = require("./me-graphql-client");
|
|
5
5
|
const token_authenticator_1 = require("./token-authenticator");
|
|
6
6
|
class LoginCommand {
|
|
7
|
+
createGraphQLClient;
|
|
8
|
+
store;
|
|
9
|
+
logger;
|
|
7
10
|
constructor(createGraphQLClient, store, logger) {
|
|
8
11
|
this.createGraphQLClient = createGraphQLClient;
|
|
9
12
|
this.store = store;
|
|
@@ -11,7 +14,10 @@ class LoginCommand {
|
|
|
11
14
|
}
|
|
12
15
|
async execute(credentials) {
|
|
13
16
|
const user = await this.getUser(credentials);
|
|
14
|
-
const creds =
|
|
17
|
+
const creds = {
|
|
18
|
+
...credentials,
|
|
19
|
+
accountId: user.accountId
|
|
20
|
+
};
|
|
15
21
|
await this.store.setCredentials(creds);
|
|
16
22
|
return {
|
|
17
23
|
user,
|
|
@@ -23,7 +29,7 @@ class LoginCommand {
|
|
|
23
29
|
}
|
|
24
30
|
async getUser(credentials) {
|
|
25
31
|
const authenticator = new token_authenticator_1.PersonalTokenAuthenticator({
|
|
26
|
-
getCredentials: async () => (
|
|
32
|
+
getCredentials: async () => ({ ...credentials, accountId: '' }),
|
|
27
33
|
getInstructionsWhenInvalid: this.store.getInstructionsWhenInvalid
|
|
28
34
|
});
|
|
29
35
|
const graphqlClient = this.createGraphQLClient(authenticator);
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PersonalTokenAuthenticator = void 0;
|
|
4
4
|
const authenticator_1 = require("../authenticator");
|
|
5
5
|
class PersonalTokenAuthenticator {
|
|
6
|
+
credentialStore;
|
|
6
7
|
constructor(credentialStore) {
|
|
7
8
|
this.credentialStore = credentialStore;
|
|
8
9
|
}
|
package/out/cache/cached-conf.js
CHANGED
|
@@ -7,6 +7,7 @@ const shared_1 = require("../shared");
|
|
|
7
7
|
exports.CONFIG_PROJECT_NAME = process.env.CONFIG_PROJECT_NAME || shared_1.FORGE_CLI_PACKAGE;
|
|
8
8
|
const isThenable = (input) => input && typeof input.then === 'function';
|
|
9
9
|
class CachedConf {
|
|
10
|
+
conf;
|
|
10
11
|
constructor(arg) {
|
|
11
12
|
if (typeof arg === 'string') {
|
|
12
13
|
this.conf = new conf_1.default({
|
|
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const t = tslib_1.__importStar(require("io-ts"));
|
|
6
6
|
exports.NO_VALIDATION = t.type({});
|
|
7
7
|
class ConfigFileSectionReader {
|
|
8
|
+
configReader;
|
|
8
9
|
constructor(configReader) {
|
|
9
10
|
this.configReader = configReader;
|
|
10
11
|
}
|
|
@@ -24,6 +25,9 @@ class ConfigFileSectionReader {
|
|
|
24
25
|
}
|
|
25
26
|
exports.ConfigFileSectionReader = ConfigFileSectionReader;
|
|
26
27
|
class ShapedConfigFileSectionReader {
|
|
28
|
+
configSectionReader;
|
|
29
|
+
key;
|
|
30
|
+
schema;
|
|
27
31
|
constructor(configSectionReader, key, schema) {
|
|
28
32
|
this.configSectionReader = configSectionReader;
|
|
29
33
|
this.key = key;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.configFileWriterForSection = exports.ConfigFileSectionWriter = void 0;
|
|
4
4
|
class ConfigFileSectionWriter {
|
|
5
|
+
key;
|
|
6
|
+
configWriter;
|
|
5
7
|
constructor(key, configWriter) {
|
|
6
8
|
this.key = key;
|
|
7
9
|
this.configWriter = configWriter;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Document } from 'yaml';
|
|
2
1
|
import { FileSystemReader, FileSystemWriter } from '../file-system';
|
|
3
2
|
import { ConfigReader, ConfigWriter } from './';
|
|
4
3
|
import { ManifestSchema, Resources } from '@forge/manifest';
|
|
@@ -26,10 +25,11 @@ export interface ResourceDetails extends Resource {
|
|
|
26
25
|
export declare class ConfigFile implements ConfigReader, ConfigWriter, ConfigInteractor {
|
|
27
26
|
private readonly fileReader;
|
|
28
27
|
private readonly fileWriter;
|
|
28
|
+
private manifestParser;
|
|
29
29
|
constructor(fileReader: FileSystemReader, fileWriter: FileSystemWriter);
|
|
30
30
|
getAppHandlers(): Promise<Array<Handler>>;
|
|
31
31
|
readConfig(): Promise<ManifestSchema>;
|
|
32
|
-
|
|
32
|
+
readConfigAsString(): string;
|
|
33
33
|
snapshotsEnabled(): Promise<boolean>;
|
|
34
34
|
runtimeType(): Promise<RuntimeType>;
|
|
35
35
|
private makeManifestUnique;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-file.d.ts","sourceRoot":"","sources":["../../src/config/config-file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config-file.d.ts","sourceRoot":"","sources":["../../src/config/config-file.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGpE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAoB,MAAM,IAAI,CAAC;AAGlE,OAAO,EAAW,cAAc,EAAE,SAAS,EAAkC,MAAM,iBAAiB,CAAC;AAGrG,OAAO,EAAE,SAAS,EAAE,eAAe,EAAQ,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAkB,MAAM,aAAa,CAAC;AAE1D,qBAAa,oBAAqB,SAAQ,eAAe;;CAIxD;AAED,qBAAa,8BAA+B,SAAQ,SAAS;gBAC/C,SAAS,EAAE,MAAM,EAAE;CAGhC;AAED,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1C,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACtC;AAED,oBAAY,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AACpC,oBAAY,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;AAC/D,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,qBAAa,UAAW,YAAW,YAAY,EAAE,YAAY,EAAE,gBAAgB;IAG3E,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,UAAU;IAH7B,OAAO,CAAC,cAAc,CAAiB;gBAEpB,UAAU,EAAE,gBAAgB,EAC5B,UAAU,EAAE,gBAAgB;IAKlC,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAiBzC,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC;IAS3C,kBAAkB,IAAI,MAAM;IAKtB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAMpC,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;IAMhD,OAAO,CAAC,kBAAkB;IAmBb,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAajE,OAAO,CAAC,aAAa;IAIR,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAe1G,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,6BAA6B;IAYrC,OAAO,CAAC,gBAAgB;IAIX,oBAAoB,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;KAAE,EAAE,CAAC;IAoClF,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAe1E,YAAY,CAAC,aAAa,CAAC,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAqBxE,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAKzD,OAAO,CAAC,eAAe;CA0BxB"}
|
|
@@ -7,6 +7,7 @@ const ui_1 = require("../ui");
|
|
|
7
7
|
const _1 = require("./");
|
|
8
8
|
const case_1 = tslib_1.__importDefault(require("case"));
|
|
9
9
|
const config_1 = require("./config");
|
|
10
|
+
const manifest_1 = require("@forge/manifest");
|
|
10
11
|
const url_1 = require("url");
|
|
11
12
|
const shared_1 = require("../shared");
|
|
12
13
|
const runtimes_1 = require("../runtimes");
|
|
@@ -23,14 +24,17 @@ class ResourceDefinitionMissingError extends shared_1.UserError {
|
|
|
23
24
|
}
|
|
24
25
|
exports.ResourceDefinitionMissingError = ResourceDefinitionMissingError;
|
|
25
26
|
class ConfigFile {
|
|
27
|
+
fileReader;
|
|
28
|
+
fileWriter;
|
|
29
|
+
manifestParser;
|
|
26
30
|
constructor(fileReader, fileWriter) {
|
|
27
31
|
this.fileReader = fileReader;
|
|
28
32
|
this.fileWriter = fileWriter;
|
|
33
|
+
this.manifestParser = new manifest_1.ManifestParser(process.env);
|
|
29
34
|
}
|
|
30
35
|
async getAppHandlers() {
|
|
31
|
-
var _a, _b;
|
|
32
36
|
const config = await this.readConfig();
|
|
33
|
-
const functions =
|
|
37
|
+
const functions = config.modules?.function ?? [];
|
|
34
38
|
const handlers = Array.from(new Set(functions.map((f) => f.handler)));
|
|
35
39
|
return handlers.map((handler) => {
|
|
36
40
|
const parts = handler.split('.');
|
|
@@ -44,39 +48,30 @@ class ConfigFile {
|
|
|
44
48
|
async readConfig() {
|
|
45
49
|
const manifestFileContents = this.fileReader.readFile(_1.manifestFileName);
|
|
46
50
|
try {
|
|
47
|
-
return
|
|
51
|
+
return this.manifestParser.parseManifest(manifestFileContents);
|
|
48
52
|
}
|
|
49
|
-
catch
|
|
53
|
+
catch {
|
|
50
54
|
throw new InvalidManifestError();
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
|
-
|
|
57
|
+
readConfigAsString() {
|
|
54
58
|
const manifestFileContents = this.fileReader.readFile(_1.manifestFileName);
|
|
55
|
-
|
|
56
|
-
try {
|
|
57
|
-
return (0, yaml_1.parseDocument)(manifestFileContents);
|
|
58
|
-
}
|
|
59
|
-
catch (_a) {
|
|
60
|
-
throw new InvalidManifestError();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
59
|
+
return this.manifestParser.parseManifestAsString(manifestFileContents);
|
|
63
60
|
}
|
|
64
61
|
async snapshotsEnabled() {
|
|
65
|
-
var _a, _b;
|
|
66
62
|
const config = await this.readConfig();
|
|
67
|
-
const entry =
|
|
63
|
+
const entry = config.app?.runtime?.snapshots;
|
|
68
64
|
return entry || entry === undefined;
|
|
69
65
|
}
|
|
70
66
|
async runtimeType() {
|
|
71
|
-
var _a, _b;
|
|
72
67
|
const config = await this.readConfig();
|
|
73
|
-
const runtimeName =
|
|
68
|
+
const runtimeName = config.app?.runtime?.name;
|
|
74
69
|
return (0, runtimes_1.getRuntimeType)(runtimeName);
|
|
75
70
|
}
|
|
76
71
|
makeManifestUnique(modules, appName) {
|
|
77
72
|
const actualModules = {};
|
|
78
73
|
for (const [moduleKey, moduleArray] of Object.entries(modules)) {
|
|
79
|
-
actualModules[moduleKey] = moduleArray
|
|
74
|
+
actualModules[moduleKey] = moduleArray?.map((module) => {
|
|
80
75
|
if (moduleKey !== 'function' && !moduleKey.startsWith(case_1.default.kebab(appName))) {
|
|
81
76
|
module['key'] = case_1.default.kebab([appName, module.key].join(' '));
|
|
82
77
|
if ('title' in module) {
|
|
@@ -142,45 +137,41 @@ class ConfigFile {
|
|
|
142
137
|
}
|
|
143
138
|
async getEgressPermissions() {
|
|
144
139
|
const { permissions, remotes } = await this.readConfig();
|
|
145
|
-
const egressPermissions = permissions
|
|
140
|
+
const egressPermissions = permissions?.external;
|
|
146
141
|
if (!egressPermissions) {
|
|
147
142
|
return [];
|
|
148
143
|
}
|
|
149
|
-
const { fetch: fetchEgress
|
|
144
|
+
const { fetch: fetchEgress, ...otherEgress } = egressPermissions;
|
|
150
145
|
const getDomainsFromPermissions = (input, typePrefix = undefined) => Object.entries(input)
|
|
151
146
|
.filter((entry) => Array.isArray(entry[1]))
|
|
152
|
-
.map((entry) => {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
})
|
|
167
|
-
});
|
|
168
|
-
});
|
|
147
|
+
.map((entry) => ({
|
|
148
|
+
type: typePrefix ? `${typePrefix}_${entry[0]}` : entry[0],
|
|
149
|
+
domains: entry[1]?.map((url) => {
|
|
150
|
+
let domain = this.instanceOfRemote(url) ? url.remote : url;
|
|
151
|
+
try {
|
|
152
|
+
domain = this.instanceOfRemote(url)
|
|
153
|
+
? this.getRemoteFromEgressPermission(url.remote, remotes)
|
|
154
|
+
: new url_1.URL(url).hostname;
|
|
155
|
+
}
|
|
156
|
+
catch (e) {
|
|
157
|
+
}
|
|
158
|
+
return domain;
|
|
159
|
+
})
|
|
160
|
+
}));
|
|
169
161
|
const egressUrls = getDomainsFromPermissions(otherEgress);
|
|
170
162
|
const fetchUrls = fetchEgress ? getDomainsFromPermissions(fetchEgress, 'fetch') : [];
|
|
171
163
|
return [...egressUrls, ...fetchUrls];
|
|
172
164
|
}
|
|
173
165
|
async getAuthProviders() {
|
|
174
|
-
var _a;
|
|
175
166
|
const config = await this.readConfig();
|
|
176
|
-
return (
|
|
167
|
+
return (config.providers?.auth.reduce((hash, { key, name }) => {
|
|
177
168
|
return Object.assign(hash, {
|
|
178
169
|
[key]: {
|
|
179
170
|
key,
|
|
180
171
|
name
|
|
181
172
|
}
|
|
182
173
|
});
|
|
183
|
-
}, {})
|
|
174
|
+
}, {}) || {});
|
|
184
175
|
}
|
|
185
176
|
async getResources(resourceTypes) {
|
|
186
177
|
const { modules, resources } = await this.readConfig();
|
|
@@ -188,30 +179,32 @@ class ConfigFile {
|
|
|
188
179
|
const maybeResources = resources || [];
|
|
189
180
|
const validResources = maybeResources.filter(config_1.validateResource);
|
|
190
181
|
this.assertNoMissingResources(hostedResourceModules, validResources);
|
|
191
|
-
const validResourcesWithDetails = validResources.map((resource) => (
|
|
182
|
+
const validResourcesWithDetails = validResources.map((resource) => ({
|
|
183
|
+
...resource,
|
|
184
|
+
resourceType: this.getResourceType(resource, hostedResourceModules)
|
|
185
|
+
})) || [];
|
|
192
186
|
if (!resourceTypes) {
|
|
193
187
|
return validResourcesWithDetails;
|
|
194
188
|
}
|
|
195
189
|
return validResourcesWithDetails.filter(({ resourceType }) => resourceTypes.includes(resourceType));
|
|
196
190
|
}
|
|
197
191
|
async getConnectKey() {
|
|
198
|
-
var _a;
|
|
199
192
|
const { app } = await this.readConfig();
|
|
200
|
-
return
|
|
193
|
+
return app.connect?.key;
|
|
201
194
|
}
|
|
202
195
|
getResourceType({ key: resourceKey }, allModules) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
196
|
+
const linkedModule = allModules.find((m) => m.resource === resourceKey) ??
|
|
197
|
+
allModules
|
|
198
|
+
.reduce((acc, m) => {
|
|
199
|
+
config_1.ModuleEntryPoints.forEach((entryPoint) => {
|
|
200
|
+
const entryPointModule = m[entryPoint];
|
|
201
|
+
if (entryPointModule) {
|
|
202
|
+
acc.push(entryPointModule);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
return acc;
|
|
206
|
+
}, [])
|
|
207
|
+
.find(({ resource }) => resource === resourceKey);
|
|
215
208
|
if (!linkedModule) {
|
|
216
209
|
return 'default';
|
|
217
210
|
}
|
|
@@ -8,6 +8,7 @@ class ConfigSectionNotFoundError extends Error {
|
|
|
8
8
|
}
|
|
9
9
|
exports.ConfigSectionNotFoundError = ConfigSectionNotFoundError;
|
|
10
10
|
class AssertiveConfigSectionReader {
|
|
11
|
+
configSectionReader;
|
|
11
12
|
constructor(configSectionReader) {
|
|
12
13
|
this.configSectionReader = configSectionReader;
|
|
13
14
|
}
|
|
@@ -33,7 +33,7 @@ class FileSystemReader {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
async recursiveReadDir(rootDir, ignores) {
|
|
36
|
-
const ignoreDirs = ignores
|
|
36
|
+
const ignoreDirs = ignores?.map((ignore) => {
|
|
37
37
|
if (typeof ignore === 'string' && !path_1.default.extname(ignore)) {
|
|
38
38
|
return (dir, stats) => stats.isDirectory() && path_1.default.basename(dir) === path_1.default.basename(ignore);
|
|
39
39
|
}
|
|
@@ -92,7 +92,7 @@ class FileSystemReader {
|
|
|
92
92
|
try {
|
|
93
93
|
return fs_1.default.statSync(filePath).size;
|
|
94
94
|
}
|
|
95
|
-
catch
|
|
95
|
+
catch {
|
|
96
96
|
return undefined;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -16,6 +16,7 @@ class MissingAppEnvironmentError extends error_handling_1.UserError {
|
|
|
16
16
|
}
|
|
17
17
|
exports.MissingAppEnvironmentError = MissingAppEnvironmentError;
|
|
18
18
|
class AppEnvironmentsGraphqlClient {
|
|
19
|
+
graphqlClient;
|
|
19
20
|
constructor(graphqlClient) {
|
|
20
21
|
this.graphqlClient = graphqlClient;
|
|
21
22
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AppOauthClientGraphqlClient = void 0;
|
|
4
4
|
const index_1 = require("./index");
|
|
5
5
|
class AppOauthClientGraphqlClient {
|
|
6
|
+
graphqlClient;
|
|
6
7
|
constructor(graphqlClient) {
|
|
7
8
|
this.graphqlClient = graphqlClient;
|
|
8
9
|
}
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getError = void 0;
|
|
4
4
|
function getError(errors) {
|
|
5
|
-
|
|
6
|
-
const error = errors === null || errors === void 0 ? void 0 : errors[0];
|
|
5
|
+
const error = errors?.[0];
|
|
7
6
|
return {
|
|
8
|
-
code:
|
|
9
|
-
message:
|
|
10
|
-
statusCode:
|
|
7
|
+
code: error?.extensions?.errorType || undefined,
|
|
8
|
+
message: error?.message || undefined,
|
|
9
|
+
statusCode: error?.extensions?.statusCode || undefined
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
12
|
exports.getError = getError;
|