@forge/cli-shared 4.0.1-next.1 → 4.0.1

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 +18 -0
  2. package/out/app-logs/graphql-client.js +2 -9
  3. package/out/app-logs/view-logs.js +0 -4
  4. package/out/apps/app-config.js +1 -4
  5. package/out/apps/create-an-app.js +0 -3
  6. package/out/apps/create-app-graphql-client.js +0 -1
  7. package/out/apps/get-app-owner.js +0 -2
  8. package/out/apps/package-installer.js +0 -1
  9. package/out/apps/register-app.js +1 -8
  10. package/out/apps/template.js +0 -5
  11. package/out/auth/personal/credential-store.js +2 -7
  12. package/out/auth/personal/login.js +2 -8
  13. package/out/auth/personal/logout.js +0 -1
  14. package/out/auth/personal/me-graphql-client.js +0 -2
  15. package/out/auth/personal/token-authenticator.js +0 -1
  16. package/out/cache/cached-conf.js +0 -1
  17. package/out/config/config-file-section-reader.js +0 -4
  18. package/out/config/config-file-section-writer.js +0 -2
  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 +44 -37
  22. package/out/config/config-section.js +0 -1
  23. package/out/file-system/file-system-reader.js +2 -2
  24. package/out/graphql/app-environment-graphql-client.js +0 -1
  25. package/out/graphql/app-oauth-client-id-graphql-client.js +0 -1
  26. package/out/graphql/debugging-graphql-runner.js +0 -3
  27. package/out/graphql/get-mutation-error.js +5 -4
  28. package/out/graphql/graphql-types.d.ts +240 -2
  29. package/out/graphql/graphql-types.d.ts.map +1 -1
  30. package/out/graphql/graphql-types.js +14 -7
  31. package/out/graphql/minimal-graphql-runner.js +22 -30
  32. package/out/graphql/mutation-aware-graphql-client.js +10 -14
  33. package/out/http-client/feedback-post-client.js +3 -1
  34. package/out/http-client/file-uploader.js +0 -1
  35. package/out/http-client/global-edge-http-client.js +0 -1
  36. package/out/http-client/trace.js +2 -1
  37. package/out/runtimes/helper.js +1 -1
  38. package/out/service/bridge-script-service.js +0 -1
  39. package/out/service/feature-flag-service.js +46 -50
  40. package/out/service/iframe-resizer-script-service.js +0 -1
  41. package/out/shared/cli-details.js +2 -2
  42. package/out/shared/error-handling.js +3 -5
  43. package/out/shared/product.js +4 -2
  44. package/out/shared/read-app-config-files.js +5 -7
  45. package/out/shared/validate.js +1 -1
  46. package/out/ui/command-line-ui.js +8 -14
  47. package/out/ui/multiple-table-prompt.js +1 -1
  48. package/out/ui/table-prompt.js +1 -8
  49. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @forge/cli-shared
2
2
 
3
+ ## 4.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 937db7a: Rollback manifest env var support
8
+ - Updated dependencies [d72f638]
9
+ - Updated dependencies [9eee9ac]
10
+ - Updated dependencies [937db7a]
11
+ - @forge/manifest@7.2.0
12
+
13
+ ## 4.0.1-next.2
14
+
15
+ ### Patch Changes
16
+
17
+ - 937db7a: Rollback manifest env var support
18
+ - Updated dependencies [937db7a]
19
+ - @forge/manifest@7.2.0-next.2
20
+
3
21
  ## 4.0.1-next.1
4
22
 
5
23
  ### Patch Changes
@@ -20,7 +20,6 @@ class MissingMetadataError extends Error {
20
20
  }
21
21
  exports.MissingMetadataError = MissingMetadataError;
22
22
  class LogsGraphQLClient {
23
- graphqlClient;
24
23
  constructor(graphqlClient) {
25
24
  this.graphqlClient = graphqlClient;
26
25
  }
@@ -29,10 +28,7 @@ class LogsGraphQLClient {
29
28
  if (!result.lines.length) {
30
29
  throw new MissingInvocationError();
31
30
  }
32
- return {
33
- ...this.extractInvocationInfo(result.metadata),
34
- logs: result.lines.map(sanitizeLogLine)
35
- };
31
+ return Object.assign(Object.assign({}, this.extractInvocationInfo(result.metadata)), { logs: result.lines.map(sanitizeLogLine) });
36
32
  }
37
33
  async viewAppLogs(details) {
38
34
  const query = `
@@ -157,10 +153,7 @@ class LogsGraphQLClient {
157
153
  }
158
154
  const { cursor, lines } = this.extractLogLines(result.appLogLines);
159
155
  if (result.appLogLines.pageInfo.hasNextPage) {
160
- const nextLines = await this.getInvocationLogs({
161
- ...filter,
162
- after: cursor
163
- });
156
+ const nextLines = await this.getInvocationLogs(Object.assign(Object.assign({}, filter), { after: cursor }));
164
157
  lines.push(...nextLines.lines);
165
158
  }
166
159
  return {
@@ -4,10 +4,6 @@ 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;
11
7
  constructor(getAppConfig, appEnvironmentClient, globalEdgeClient, logsClient) {
12
8
  this.getAppConfig = getAppConfig;
13
9
  this.appEnvironmentClient = appEnvironmentClient;
@@ -14,10 +14,7 @@ function adjustLegacyAppId(legacyAppDetails) {
14
14
  if (legacyAppDetails.id.startsWith('ari:')) {
15
15
  return legacyAppDetails;
16
16
  }
17
- return {
18
- ...legacyAppDetails,
19
- id: (0, ari_1.appIdToAriString)(legacyAppDetails.id)
20
- };
17
+ return Object.assign(Object.assign({}, legacyAppDetails), { id: (0, ari_1.appIdToAriString)(legacyAppDetails.id) });
21
18
  }
22
19
  exports.adjustLegacyAppId = adjustLegacyAppId;
23
20
  const assertiveAppConfigProvider = (appConfigReader) => () => (0, config_1.assertive)(appConfigReader)
@@ -9,9 +9,6 @@ class NoTemplatesError extends Error {
9
9
  }
10
10
  exports.NoTemplatesError = NoTemplatesError;
11
11
  class CreateAppCommand {
12
- templater;
13
- registerAppCommand;
14
- packageInstaller;
15
12
  constructor(templater, registerAppCommand, packageInstaller) {
16
13
  this.templater = templater;
17
14
  this.registerAppCommand = registerAppCommand;
@@ -7,7 +7,6 @@ class CannotCreateAppError extends Error {
7
7
  }
8
8
  exports.CannotCreateAppError = CannotCreateAppError;
9
9
  class CreateAppGraphQLClient {
10
- graphqlClient;
11
10
  constructor(graphqlClient) {
12
11
  this.graphqlClient = graphqlClient;
13
12
  }
@@ -10,8 +10,6 @@ class MissingAppOwnerError extends Error {
10
10
  }
11
11
  exports.MissingAppOwnerError = MissingAppOwnerError;
12
12
  class GetAppOwnerQuery {
13
- graphqlClient;
14
- getAppConfig;
15
13
  constructor(graphqlClient, getAppConfig) {
16
14
  this.graphqlClient = graphqlClient;
17
15
  this.getAppConfig = getAppConfig;
@@ -7,7 +7,6 @@ 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;
11
10
  constructor(logger) {
12
11
  this.logger = logger;
13
12
  }
@@ -4,10 +4,6 @@ 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;
11
7
  constructor(appClient, appConfigReader, appConfigWriter, logger) {
12
8
  this.appClient = appClient;
13
9
  this.appConfigReader = appConfigReader;
@@ -30,10 +26,7 @@ class RegisterAppCommand {
30
26
  id: result.id
31
27
  };
32
28
  if (section !== 'invalid' && section !== 'missing') {
33
- newAppDetails = {
34
- ...section,
35
- ...newAppDetails
36
- };
29
+ newAppDetails = Object.assign(Object.assign({}, section), newAppDetails);
37
30
  }
38
31
  await this.appConfigWriter.writeConfigSection(newAppDetails);
39
32
  if (shouldPrependAppName) {
@@ -40,7 +40,6 @@ class TemplateServiceDownloader {
40
40
  }
41
41
  exports.TemplateServiceDownloader = TemplateServiceDownloader;
42
42
  class ZipTemplateExtractor {
43
- zipAccessor;
44
43
  constructor(zipAccessor) {
45
44
  this.zipAccessor = zipAccessor;
46
45
  }
@@ -101,10 +100,6 @@ class TemplateServiceLister {
101
100
  }
102
101
  exports.TemplateServiceLister = TemplateServiceLister;
103
102
  class ComposableTemplater {
104
- downloader;
105
- extractor;
106
- lister;
107
- logger;
108
103
  constructor(downloader, extractor, lister, logger) {
109
104
  this.downloader = downloader;
110
105
  this.extractor = extractor;
@@ -27,7 +27,7 @@ function getKeytar() {
27
27
  try {
28
28
  return require('keytar');
29
29
  }
30
- catch {
30
+ catch (_a) {
31
31
  return null;
32
32
  }
33
33
  }
@@ -56,11 +56,6 @@ 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;
64
59
  constructor(logger, instructionsURL, keytar, cachedConfig) {
65
60
  this.logger = logger;
66
61
  this.instructionsURL = instructionsURL;
@@ -95,7 +90,7 @@ class CredentialStoreImpl {
95
90
  try {
96
91
  credentials = JSON.parse(credentialsString);
97
92
  }
98
- catch {
93
+ catch (_a) {
99
94
  throw new NoTokenInStoreError();
100
95
  }
101
96
  const decodeResult = exports.personalApiCredentialsValidatedShape.decode(credentials);
@@ -4,9 +4,6 @@ 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;
10
7
  constructor(createGraphQLClient, store, logger) {
11
8
  this.createGraphQLClient = createGraphQLClient;
12
9
  this.store = store;
@@ -14,10 +11,7 @@ class LoginCommand {
14
11
  }
15
12
  async execute(credentials) {
16
13
  const user = await this.getUser(credentials);
17
- const creds = {
18
- ...credentials,
19
- accountId: user.accountId
20
- };
14
+ const creds = Object.assign(Object.assign({}, credentials), { accountId: user.accountId });
21
15
  await this.store.setCredentials(creds);
22
16
  return {
23
17
  user,
@@ -29,7 +23,7 @@ class LoginCommand {
29
23
  }
30
24
  async getUser(credentials) {
31
25
  const authenticator = new token_authenticator_1.PersonalTokenAuthenticator({
32
- getCredentials: async () => ({ ...credentials, accountId: '' }),
26
+ getCredentials: async () => (Object.assign(Object.assign({}, credentials), { accountId: '' })),
33
27
  getInstructionsWhenInvalid: this.store.getInstructionsWhenInvalid
34
28
  });
35
29
  const graphqlClient = this.createGraphQLClient(authenticator);
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LogoutCommand = void 0;
4
4
  class LogoutCommand {
5
- store;
6
5
  constructor(store) {
7
6
  this.store = store;
8
7
  }
@@ -7,8 +7,6 @@ class UserNotFoundError extends shared_1.UserError {
7
7
  }
8
8
  exports.UserNotFoundError = UserNotFoundError;
9
9
  class MeGraphqlClient {
10
- graphqlClient;
11
- logger;
12
10
  constructor(graphqlClient, logger) {
13
11
  this.graphqlClient = graphqlClient;
14
12
  this.logger = logger;
@@ -3,7 +3,6 @@ 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;
7
6
  constructor(credentialStore) {
8
7
  this.credentialStore = credentialStore;
9
8
  }
@@ -7,7 +7,6 @@ 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;
11
10
  constructor(arg) {
12
11
  if (typeof arg === 'string') {
13
12
  this.conf = new conf_1.default({
@@ -5,7 +5,6 @@ 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;
9
8
  constructor(configReader) {
10
9
  this.configReader = configReader;
11
10
  }
@@ -25,9 +24,6 @@ class ConfigFileSectionReader {
25
24
  }
26
25
  exports.ConfigFileSectionReader = ConfigFileSectionReader;
27
26
  class ShapedConfigFileSectionReader {
28
- configSectionReader;
29
- key;
30
- schema;
31
27
  constructor(configSectionReader, key, schema) {
32
28
  this.configSectionReader = configSectionReader;
33
29
  this.key = key;
@@ -2,8 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.configFileWriterForSection = exports.ConfigFileSectionWriter = void 0;
4
4
  class ConfigFileSectionWriter {
5
- key;
6
- configWriter;
7
5
  constructor(key, configWriter) {
8
6
  this.key = key;
9
7
  this.configWriter = configWriter;
@@ -1,3 +1,4 @@
1
+ import { Document } from 'yaml';
1
2
  import { FileSystemReader, FileSystemWriter } from '../file-system';
2
3
  import { ConfigReader, ConfigWriter } from './';
3
4
  import { ManifestSchema, Resources } from '@forge/manifest';
@@ -25,11 +26,10 @@ export interface ResourceDetails extends Resource {
25
26
  export declare class ConfigFile implements ConfigReader, ConfigWriter, ConfigInteractor {
26
27
  private readonly fileReader;
27
28
  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
- readConfigAsString(): string;
32
+ readConfigToDocument(): Promise<Document.Parsed | undefined>;
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":"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,EAA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,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;CAiBxB"}
@@ -7,7 +7,6 @@ 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");
11
10
  const url_1 = require("url");
12
11
  const shared_1 = require("../shared");
13
12
  const runtimes_1 = require("../runtimes");
@@ -24,17 +23,14 @@ class ResourceDefinitionMissingError extends shared_1.UserError {
24
23
  }
25
24
  exports.ResourceDefinitionMissingError = ResourceDefinitionMissingError;
26
25
  class ConfigFile {
27
- fileReader;
28
- fileWriter;
29
- manifestParser;
30
26
  constructor(fileReader, fileWriter) {
31
27
  this.fileReader = fileReader;
32
28
  this.fileWriter = fileWriter;
33
- this.manifestParser = new manifest_1.ManifestParser(process.env);
34
29
  }
35
30
  async getAppHandlers() {
31
+ var _a, _b;
36
32
  const config = await this.readConfig();
37
- const functions = config.modules?.function ?? [];
33
+ const functions = (_b = (_a = config.modules) === null || _a === void 0 ? void 0 : _a.function) !== null && _b !== void 0 ? _b : [];
38
34
  const handlers = Array.from(new Set(functions.map((f) => f.handler)));
39
35
  return handlers.map((handler) => {
40
36
  const parts = handler.split('.');
@@ -48,30 +44,39 @@ class ConfigFile {
48
44
  async readConfig() {
49
45
  const manifestFileContents = this.fileReader.readFile(_1.manifestFileName);
50
46
  try {
51
- return this.manifestParser.parseManifest(manifestFileContents);
47
+ return (0, yaml_1.parse)(manifestFileContents);
52
48
  }
53
- catch {
49
+ catch (_a) {
54
50
  throw new InvalidManifestError();
55
51
  }
56
52
  }
57
- readConfigAsString() {
53
+ async readConfigToDocument() {
58
54
  const manifestFileContents = this.fileReader.readFile(_1.manifestFileName);
59
- return this.manifestParser.parseManifestAsString(manifestFileContents);
55
+ if (manifestFileContents) {
56
+ try {
57
+ return (0, yaml_1.parseDocument)(manifestFileContents);
58
+ }
59
+ catch (_a) {
60
+ throw new InvalidManifestError();
61
+ }
62
+ }
60
63
  }
61
64
  async snapshotsEnabled() {
65
+ var _a, _b;
62
66
  const config = await this.readConfig();
63
- const entry = config.app?.runtime?.snapshots;
67
+ const entry = (_b = (_a = config.app) === null || _a === void 0 ? void 0 : _a.runtime) === null || _b === void 0 ? void 0 : _b.snapshots;
64
68
  return entry || entry === undefined;
65
69
  }
66
70
  async runtimeType() {
71
+ var _a, _b;
67
72
  const config = await this.readConfig();
68
- const runtimeName = config.app?.runtime?.name;
73
+ const runtimeName = (_b = (_a = config.app) === null || _a === void 0 ? void 0 : _a.runtime) === null || _b === void 0 ? void 0 : _b.name;
69
74
  return (0, runtimes_1.getRuntimeType)(runtimeName);
70
75
  }
71
76
  makeManifestUnique(modules, appName) {
72
77
  const actualModules = {};
73
78
  for (const [moduleKey, moduleArray] of Object.entries(modules)) {
74
- actualModules[moduleKey] = moduleArray?.map((module) => {
79
+ actualModules[moduleKey] = moduleArray === null || moduleArray === void 0 ? void 0 : moduleArray.map((module) => {
75
80
  if (moduleKey !== 'function' && !moduleKey.startsWith(case_1.default.kebab(appName))) {
76
81
  module['key'] = case_1.default.kebab([appName, module.key].join(' '));
77
82
  if ('title' in module) {
@@ -137,41 +142,45 @@ class ConfigFile {
137
142
  }
138
143
  async getEgressPermissions() {
139
144
  const { permissions, remotes } = await this.readConfig();
140
- const egressPermissions = permissions?.external;
145
+ const egressPermissions = permissions === null || permissions === void 0 ? void 0 : permissions.external;
141
146
  if (!egressPermissions) {
142
147
  return [];
143
148
  }
144
- const { fetch: fetchEgress, ...otherEgress } = egressPermissions;
149
+ const { fetch: fetchEgress } = egressPermissions, otherEgress = tslib_1.__rest(egressPermissions, ["fetch"]);
145
150
  const getDomainsFromPermissions = (input, typePrefix = undefined) => Object.entries(input)
146
151
  .filter((entry) => Array.isArray(entry[1]))
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
- }));
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
+ });
161
169
  const egressUrls = getDomainsFromPermissions(otherEgress);
162
170
  const fetchUrls = fetchEgress ? getDomainsFromPermissions(fetchEgress, 'fetch') : [];
163
171
  return [...egressUrls, ...fetchUrls];
164
172
  }
165
173
  async getAuthProviders() {
174
+ var _a;
166
175
  const config = await this.readConfig();
167
- return (config.providers?.auth.reduce((hash, { key, name }) => {
176
+ return (((_a = config.providers) === null || _a === void 0 ? void 0 : _a.auth.reduce((hash, { key, name }) => {
168
177
  return Object.assign(hash, {
169
178
  [key]: {
170
179
  key,
171
180
  name
172
181
  }
173
182
  });
174
- }, {}) || {});
183
+ }, {})) || {});
175
184
  }
176
185
  async getResources(resourceTypes) {
177
186
  const { modules, resources } = await this.readConfig();
@@ -179,21 +188,19 @@ class ConfigFile {
179
188
  const maybeResources = resources || [];
180
189
  const validResources = maybeResources.filter(config_1.validateResource);
181
190
  this.assertNoMissingResources(hostedResourceModules, validResources);
182
- const validResourcesWithDetails = validResources.map((resource) => ({
183
- ...resource,
184
- resourceType: this.getResourceType(resource, hostedResourceModules)
185
- })) || [];
191
+ const validResourcesWithDetails = validResources.map((resource) => (Object.assign(Object.assign({}, resource), { resourceType: this.getResourceType(resource, hostedResourceModules) }))) || [];
186
192
  if (!resourceTypes) {
187
193
  return validResourcesWithDetails;
188
194
  }
189
195
  return validResourcesWithDetails.filter(({ resourceType }) => resourceTypes.includes(resourceType));
190
196
  }
191
197
  async getConnectKey() {
198
+ var _a;
192
199
  const { app } = await this.readConfig();
193
- return app.connect?.key;
200
+ return (_a = app.connect) === null || _a === void 0 ? void 0 : _a.key;
194
201
  }
195
202
  getResourceType({ key: resourceKey }, allModules) {
196
- const linkedModule = allModules.find((m) => m.resource === resourceKey || config_1.ModuleEntryPoints.some((entryPoint) => m[entryPoint]?.resource === resourceKey));
203
+ const linkedModule = allModules.find((m) => m.resource === resourceKey || config_1.ModuleEntryPoints.some((entryPoint) => { var _a; return ((_a = m[entryPoint]) === null || _a === void 0 ? void 0 : _a.resource) === resourceKey; }));
197
204
  if (!linkedModule) {
198
205
  return 'default';
199
206
  }
@@ -8,7 +8,6 @@ class ConfigSectionNotFoundError extends Error {
8
8
  }
9
9
  exports.ConfigSectionNotFoundError = ConfigSectionNotFoundError;
10
10
  class AssertiveConfigSectionReader {
11
- configSectionReader;
12
11
  constructor(configSectionReader) {
13
12
  this.configSectionReader = configSectionReader;
14
13
  }
@@ -33,7 +33,7 @@ class FileSystemReader {
33
33
  }
34
34
  }
35
35
  async recursiveReadDir(rootDir, ignores) {
36
- const ignoreDirs = ignores?.map((ignore) => {
36
+ const ignoreDirs = ignores === null || ignores === void 0 ? void 0 : 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 (_a) {
96
96
  return undefined;
97
97
  }
98
98
  }
@@ -16,7 +16,6 @@ class MissingAppEnvironmentError extends error_handling_1.UserError {
16
16
  }
17
17
  exports.MissingAppEnvironmentError = MissingAppEnvironmentError;
18
18
  class AppEnvironmentsGraphqlClient {
19
- graphqlClient;
20
19
  constructor(graphqlClient) {
21
20
  this.graphqlClient = graphqlClient;
22
21
  }
@@ -3,7 +3,6 @@ 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;
7
6
  constructor(graphqlClient) {
8
7
  this.graphqlClient = graphqlClient;
9
8
  }
@@ -7,9 +7,6 @@ function stringify(variables) {
7
7
  }
8
8
  exports.stringify = stringify;
9
9
  class DebuggingGraphqlRunner {
10
- innerClient;
11
- endpoint;
12
- logger;
13
10
  constructor(innerClient, endpoint, logger) {
14
11
  this.innerClient = innerClient;
15
12
  this.endpoint = endpoint;
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getError = void 0;
4
4
  function getError(errors) {
5
- const error = errors?.[0];
5
+ var _a, _b;
6
+ const error = errors === null || errors === void 0 ? void 0 : errors[0];
6
7
  return {
7
- code: error?.extensions?.errorType || undefined,
8
- message: error?.message || undefined,
9
- statusCode: error?.extensions?.statusCode || undefined
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
10
11
  };
11
12
  }
12
13
  exports.getError = getError;