@forge/cli-shared 5.0.0-next.4-experimental-c6147b1 → 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.
Files changed (49) hide show
  1. package/CHANGELOG.md +8 -34
  2. package/out/app-logs/graphql-client.js +9 -2
  3. package/out/app-logs/view-logs.js +4 -0
  4. package/out/apps/app-config.js +4 -1
  5. package/out/apps/create-an-app.js +3 -0
  6. package/out/apps/create-app-graphql-client.js +1 -0
  7. package/out/apps/get-app-owner.js +2 -0
  8. package/out/apps/package-installer.js +1 -0
  9. package/out/apps/register-app.js +8 -1
  10. package/out/apps/template.js +5 -0
  11. package/out/auth/personal/credential-store.js +7 -2
  12. package/out/auth/personal/login.js +8 -2
  13. package/out/auth/personal/logout.js +1 -0
  14. package/out/auth/personal/me-graphql-client.js +2 -0
  15. package/out/auth/personal/token-authenticator.js +1 -0
  16. package/out/cache/cached-conf.js +1 -0
  17. package/out/config/config-file-section-reader.js +4 -0
  18. package/out/config/config-file-section-writer.js +2 -0
  19. package/out/config/config-file.d.ts +2 -2
  20. package/out/config/config-file.d.ts.map +1 -1
  21. package/out/config/config-file.js +48 -55
  22. package/out/config/config-section.js +1 -0
  23. package/out/file-system/file-system-reader.js +2 -2
  24. package/out/graphql/app-environment-graphql-client.js +1 -0
  25. package/out/graphql/app-oauth-client-id-graphql-client.js +1 -0
  26. package/out/graphql/debugging-graphql-runner.js +3 -0
  27. package/out/graphql/get-mutation-error.js +4 -5
  28. package/out/graphql/graphql-types.d.ts +269 -32
  29. package/out/graphql/graphql-types.d.ts.map +1 -1
  30. package/out/graphql/graphql-types.js +49 -12
  31. package/out/graphql/minimal-graphql-runner.js +30 -22
  32. package/out/graphql/mutation-aware-graphql-client.js +14 -10
  33. package/out/http-client/feedback-post-client.js +1 -3
  34. package/out/http-client/file-uploader.js +1 -0
  35. package/out/http-client/global-edge-http-client.js +1 -0
  36. package/out/http-client/trace.js +1 -2
  37. package/out/runtimes/helper.js +1 -1
  38. package/out/service/bridge-script-service.js +1 -0
  39. package/out/service/feature-flag-service.js +51 -48
  40. package/out/service/iframe-resizer-script-service.js +1 -0
  41. package/out/shared/cli-details.js +2 -2
  42. package/out/shared/error-handling.js +5 -3
  43. package/out/shared/product.js +2 -4
  44. package/out/shared/read-app-config-files.js +7 -5
  45. package/out/shared/validate.js +1 -1
  46. package/out/ui/command-line-ui.js +14 -8
  47. package/out/ui/multiple-table-prompt.js +1 -1
  48. package/out/ui/table-prompt.js +8 -1
  49. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,45 +1,19 @@
1
1
  # @forge/cli-shared
2
2
 
3
- ## 5.0.0-next.4-experimental-c6147b1
3
+ ## 5.0.0-next.6
4
4
 
5
- ### Major Changes
5
+ ### Patch Changes
6
6
 
7
- - 5c2c20f: Fixed the issue where the CLI was unable to bundle modules with multiple entrypoints using different resource types.
7
+ - 670a419: Only parse listed environment variables in the manifest
8
+ - Updated dependencies [670a419]
9
+ - @forge/manifest@7.3.0-next.5
8
10
 
9
- Specifically the following configuration that supports both UI Kit and Custom UI resources are now supported properly.
10
-
11
- ```yaml
12
- modules:
13
- jira:customFieldType:
14
- - key: my_custom_field_app
15
- resource: ui-kit-resource
16
- render: native
17
- contextConfig:
18
- resource: custom-ui-resource
19
- ```
20
-
21
- In the previous CLI version, the above configuration would assume that the `custom-ui-resource` is a UI Kit resource
22
- and would expected a UI Kit based resource is linked. To support using same resource type for multiple entrypoints,
23
- in above example, please add `render: native` to the `contextConfig` to correct the resource type:
24
-
25
- ```yaml
26
- modules:
27
- jira:customFieldType:
28
- - key: my_custom_field_app
29
- resource: ui-kit-resource
30
- render: native
31
- contextConfig:
32
- resource: ui-kit-resource
33
- render: native
34
- ```
11
+ ## 5.0.0-next.5
35
12
 
36
13
  ### Patch Changes
37
14
 
38
- - Updated dependencies [77d16a9]
39
- - Updated dependencies [4c2dc9f]
40
- - Updated dependencies [6099d41]
41
- - Updated dependencies [f04a310]
42
- - @forge/manifest@7.3.0-next.3-experimental-c6147b1
15
+ - Updated dependencies [7787d36]
16
+ - @forge/manifest@7.3.0-next.4
43
17
 
44
18
  ## 5.0.0-next.4
45
19
 
@@ -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 Object.assign(Object.assign({}, this.extractInvocationInfo(result.metadata)), { logs: result.lines.map(sanitizeLogLine) });
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(Object.assign(Object.assign({}, filter), { after: cursor }));
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;
@@ -14,7 +14,10 @@ function adjustLegacyAppId(legacyAppDetails) {
14
14
  if (legacyAppDetails.id.startsWith('ari:')) {
15
15
  return legacyAppDetails;
16
16
  }
17
- return Object.assign(Object.assign({}, legacyAppDetails), { id: (0, ari_1.appIdToAriString)(legacyAppDetails.id) });
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;
@@ -7,6 +7,7 @@ class CannotCreateAppError extends Error {
7
7
  }
8
8
  exports.CannotCreateAppError = CannotCreateAppError;
9
9
  class CreateAppGraphQLClient {
10
+ graphqlClient;
10
11
  constructor(graphqlClient) {
11
12
  this.graphqlClient = graphqlClient;
12
13
  }
@@ -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;
@@ -7,6 +7,7 @@ const cross_spawn_1 = require("cross-spawn");
7
7
  const fs = tslib_1.__importStar(require("fs"));
8
8
  const path = tslib_1.__importStar(require("path"));
9
9
  class NpmInstaller {
10
+ logger;
10
11
  constructor(logger) {
11
12
  this.logger = logger;
12
13
  }
@@ -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 = Object.assign(Object.assign({}, section), newAppDetails);
33
+ newAppDetails = {
34
+ ...section,
35
+ ...newAppDetails
36
+ };
30
37
  }
31
38
  await this.appConfigWriter.writeConfigSection(newAppDetails);
32
39
  if (shouldPrependAppName) {
@@ -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 (_a) {
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 (_a) {
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 = Object.assign(Object.assign({}, credentials), { accountId: user.accountId });
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 () => (Object.assign(Object.assign({}, credentials), { accountId: '' })),
32
+ getCredentials: async () => ({ ...credentials, accountId: '' }),
27
33
  getInstructionsWhenInvalid: this.store.getInstructionsWhenInvalid
28
34
  });
29
35
  const graphqlClient = this.createGraphQLClient(authenticator);
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LogoutCommand = void 0;
4
4
  class LogoutCommand {
5
+ store;
5
6
  constructor(store) {
6
7
  this.store = store;
7
8
  }
@@ -7,6 +7,8 @@ class UserNotFoundError extends shared_1.UserError {
7
7
  }
8
8
  exports.UserNotFoundError = UserNotFoundError;
9
9
  class MeGraphqlClient {
10
+ graphqlClient;
11
+ logger;
10
12
  constructor(graphqlClient, logger) {
11
13
  this.graphqlClient = graphqlClient;
12
14
  this.logger = logger;
@@ -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
  }
@@ -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
- readConfigToDocument(): Promise<Document.Parsed | undefined>;
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":"AAAA,OAAa,EAAwB,QAAQ,EAAS,MAAM,MAAM,CAAC;AAEnE,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,EAAkB,MAAM,iBAAiB,CAAC;AAGrF,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,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AI,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 = (_b = (_a = config.modules) === null || _a === void 0 ? void 0 : _a.function) !== null && _b !== void 0 ? _b : [];
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 (0, yaml_1.parse)(manifestFileContents);
51
+ return this.manifestParser.parseManifest(manifestFileContents);
48
52
  }
49
- catch (_a) {
53
+ catch {
50
54
  throw new InvalidManifestError();
51
55
  }
52
56
  }
53
- async readConfigToDocument() {
57
+ readConfigAsString() {
54
58
  const manifestFileContents = this.fileReader.readFile(_1.manifestFileName);
55
- if (manifestFileContents) {
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 = (_b = (_a = config.app) === null || _a === void 0 ? void 0 : _a.runtime) === null || _b === void 0 ? void 0 : _b.snapshots;
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 = (_b = (_a = config.app) === null || _a === void 0 ? void 0 : _a.runtime) === null || _b === void 0 ? void 0 : _b.name;
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 === null || moduleArray === void 0 ? void 0 : moduleArray.map((module) => {
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 === null || permissions === void 0 ? void 0 : permissions.external;
140
+ const egressPermissions = permissions?.external;
146
141
  if (!egressPermissions) {
147
142
  return [];
148
143
  }
149
- const { fetch: fetchEgress } = egressPermissions, otherEgress = tslib_1.__rest(egressPermissions, ["fetch"]);
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
- var _a;
154
- return ({
155
- type: typePrefix ? `${typePrefix}_${entry[0]}` : entry[0],
156
- domains: (_a = entry[1]) === null || _a === void 0 ? void 0 : _a.map((url) => {
157
- let domain = this.instanceOfRemote(url) ? url.remote : url;
158
- try {
159
- domain = this.instanceOfRemote(url)
160
- ? this.getRemoteFromEgressPermission(url.remote, remotes)
161
- : new url_1.URL(url).hostname;
162
- }
163
- catch (e) {
164
- }
165
- return domain;
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 (((_a = config.providers) === null || _a === void 0 ? void 0 : _a.auth.reduce((hash, { key, name }) => {
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) => (Object.assign(Object.assign({}, resource), { resourceType: this.getResourceType(resource, hostedResourceModules) }))) || [];
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 (_a = app.connect) === null || _a === void 0 ? void 0 : _a.key;
193
+ return app.connect?.key;
201
194
  }
202
195
  getResourceType({ key: resourceKey }, allModules) {
203
- var _a;
204
- const linkedModule = (_a = allModules.find((m) => m.resource === resourceKey)) !== null && _a !== void 0 ? _a : allModules
205
- .reduce((acc, m) => {
206
- config_1.ModuleEntryPoints.forEach((entryPoint) => {
207
- const entryPointModule = m[entryPoint];
208
- if (entryPointModule) {
209
- acc.push(entryPointModule);
210
- }
211
- });
212
- return acc;
213
- }, [])
214
- .find(({ resource }) => resource === resourceKey);
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 === null || ignores === void 0 ? void 0 : ignores.map((ignore) => {
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 (_a) {
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
  }
@@ -7,6 +7,9 @@ function stringify(variables) {
7
7
  }
8
8
  exports.stringify = stringify;
9
9
  class DebuggingGraphqlRunner {
10
+ innerClient;
11
+ endpoint;
12
+ logger;
10
13
  constructor(innerClient, endpoint, logger) {
11
14
  this.innerClient = innerClient;
12
15
  this.endpoint = endpoint;
@@ -2,12 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getError = void 0;
4
4
  function getError(errors) {
5
- var _a, _b;
6
- const error = errors === null || errors === void 0 ? void 0 : errors[0];
5
+ const error = errors?.[0];
7
6
  return {
8
- code: ((_a = error === null || error === void 0 ? void 0 : error.extensions) === null || _a === void 0 ? void 0 : _a.errorType) || undefined,
9
- message: (error === null || error === void 0 ? void 0 : error.message) || undefined,
10
- statusCode: ((_b = error === null || error === void 0 ? void 0 : error.extensions) === null || _b === void 0 ? void 0 : _b.statusCode) || undefined
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;