@forge/cli-shared 0.0.0-experimental-9489df9 → 0.0.0-experimental-52c2a24

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 (119) hide show
  1. package/CHANGELOG.md +599 -4
  2. package/out/app-logs/view-logs.js +3 -3
  3. package/out/apps/app-config.d.ts.map +1 -1
  4. package/out/apps/app-config.js +3 -2
  5. package/out/apps/create-app-graphql-client.d.ts.map +1 -1
  6. package/out/apps/create-app-graphql-client.js +6 -2
  7. package/out/apps/package-installer.js +1 -1
  8. package/out/apps/register-app.js +1 -1
  9. package/out/apps/template.js +12 -12
  10. package/out/auth/index.d.ts +0 -1
  11. package/out/auth/index.d.ts.map +1 -1
  12. package/out/auth/index.js +0 -1
  13. package/out/auth/personal/credential-store.d.ts +57 -0
  14. package/out/auth/personal/credential-store.d.ts.map +1 -0
  15. package/out/auth/personal/credential-store.js +188 -0
  16. package/out/auth/personal/index.d.ts +1 -4
  17. package/out/auth/personal/index.d.ts.map +1 -1
  18. package/out/auth/personal/index.js +1 -4
  19. package/out/auth/personal/login.d.ts +2 -2
  20. package/out/auth/personal/login.d.ts.map +1 -1
  21. package/out/auth/personal/login.js +1 -1
  22. package/out/auth/personal/logout.d.ts +2 -2
  23. package/out/auth/personal/logout.d.ts.map +1 -1
  24. package/out/auth/personal/me-graphql-client.d.ts +2 -1
  25. package/out/auth/personal/me-graphql-client.d.ts.map +1 -1
  26. package/out/auth/personal/me-graphql-client.js +3 -2
  27. package/out/auth/personal/token-authenticator.d.ts +3 -3
  28. package/out/auth/personal/token-authenticator.d.ts.map +1 -1
  29. package/out/auth/personal/token-authenticator.js +5 -5
  30. package/out/config/config-file-section-reader.js +2 -1
  31. package/out/config/config-file-section-writer.js +2 -1
  32. package/out/config/config-file.d.ts +14 -8
  33. package/out/config/config-file.d.ts.map +1 -1
  34. package/out/config/config-file.js +42 -41
  35. package/out/config/config-section.js +2 -1
  36. package/out/config/config.d.ts +2 -1
  37. package/out/config/config.d.ts.map +1 -1
  38. package/out/config/config.js +4 -2
  39. package/out/file-system/file-system-reader.d.ts +1 -0
  40. package/out/file-system/file-system-reader.d.ts.map +1 -1
  41. package/out/file-system/file-system-reader.js +7 -7
  42. package/out/file-system/file-system-writer.js +1 -1
  43. package/out/file-system/zip-accessor.js +1 -1
  44. package/out/graphql/app-environment-graphql-client.d.ts +3 -2
  45. package/out/graphql/app-environment-graphql-client.d.ts.map +1 -1
  46. package/out/graphql/app-environment-graphql-client.js +3 -2
  47. package/out/graphql/gateway.js +5 -3
  48. package/out/graphql/get-mutation-error.d.ts +1 -0
  49. package/out/graphql/get-mutation-error.d.ts.map +1 -1
  50. package/out/graphql/get-mutation-error.js +3 -2
  51. package/out/graphql/graphql-types.d.ts +5781 -618
  52. package/out/graphql/graphql-types.d.ts.map +1 -1
  53. package/out/graphql/graphql-types.js +520 -22
  54. package/out/graphql/minimal-graphql-runner.d.ts +9 -4
  55. package/out/graphql/minimal-graphql-runner.d.ts.map +1 -1
  56. package/out/graphql/minimal-graphql-runner.js +15 -5
  57. package/out/graphql/mutation-aware-graphql-client.d.ts +15 -4
  58. package/out/graphql/mutation-aware-graphql-client.d.ts.map +1 -1
  59. package/out/graphql/mutation-aware-graphql-client.js +17 -2
  60. package/out/http-client/feedback-post-client.js +1 -1
  61. package/out/http-client/file-uploader.js +1 -1
  62. package/out/service/bridge-script-service.d.ts +2 -0
  63. package/out/service/bridge-script-service.d.ts.map +1 -1
  64. package/out/service/bridge-script-service.js +4 -2
  65. package/out/service/feature-flag-service.d.ts +18 -6
  66. package/out/service/feature-flag-service.d.ts.map +1 -1
  67. package/out/service/feature-flag-service.js +32 -8
  68. package/out/service/iframe-resizer-script-service.d.ts +2 -0
  69. package/out/service/iframe-resizer-script-service.d.ts.map +1 -1
  70. package/out/service/iframe-resizer-script-service.js +4 -2
  71. package/out/shared/error-handling.d.ts +16 -2
  72. package/out/shared/error-handling.d.ts.map +1 -1
  73. package/out/shared/error-handling.js +43 -9
  74. package/out/shared/index.js +1 -1
  75. package/out/shared/installationId.js +2 -2
  76. package/out/shared/pause.js +2 -1
  77. package/out/shared/product.d.ts +4 -1
  78. package/out/shared/product.d.ts.map +1 -1
  79. package/out/shared/product.js +15 -5
  80. package/out/shared/read-app-config-files.d.ts.map +1 -1
  81. package/out/shared/read-app-config-files.js +8 -6
  82. package/out/shared/validate.d.ts +1 -1
  83. package/out/shared/validate.d.ts.map +1 -1
  84. package/out/shared/validate.js +8 -3
  85. package/out/ui/command-line-ui.d.ts +5 -3
  86. package/out/ui/command-line-ui.d.ts.map +1 -1
  87. package/out/ui/command-line-ui.js +37 -10
  88. package/out/ui/index.d.ts +0 -1
  89. package/out/ui/index.d.ts.map +1 -1
  90. package/out/ui/index.js +0 -1
  91. package/out/ui/multiple-table-prompt.js +4 -2
  92. package/out/ui/runtime-log.d.ts.map +1 -1
  93. package/out/ui/runtime-log.js +10 -5
  94. package/out/ui/single-table-prompt.js +4 -2
  95. package/out/ui/table-prompt.js +1 -1
  96. package/out/ui/text.d.ts +59 -11
  97. package/out/ui/text.d.ts.map +1 -1
  98. package/out/ui/text.js +90 -24
  99. package/out/ui/ui.d.ts +11 -0
  100. package/out/ui/ui.d.ts.map +1 -1
  101. package/package.json +13 -15
  102. package/out/auth/credentials-store-provider.d.ts +0 -4
  103. package/out/auth/credentials-store-provider.d.ts.map +0 -1
  104. package/out/auth/credentials-store-provider.js +0 -11
  105. package/out/auth/personal/abstract-token-store-getter.d.ts +0 -13
  106. package/out/auth/personal/abstract-token-store-getter.d.ts.map +0 -1
  107. package/out/auth/personal/abstract-token-store-getter.js +0 -31
  108. package/out/auth/personal/token-store-cache.d.ts +0 -12
  109. package/out/auth/personal/token-store-cache.d.ts.map +0 -1
  110. package/out/auth/personal/token-store-cache.js +0 -41
  111. package/out/auth/personal/token-store-keytar.d.ts +0 -23
  112. package/out/auth/personal/token-store-keytar.d.ts.map +0 -1
  113. package/out/auth/personal/token-store-keytar.js +0 -101
  114. package/out/auth/personal/token-store.d.ts +0 -28
  115. package/out/auth/personal/token-store.d.ts.map +0 -1
  116. package/out/auth/personal/token-store.js +0 -21
  117. package/out/ui/validation-error.d.ts +0 -3
  118. package/out/ui/validation-error.d.ts.map +0 -1
  119. package/out/ui/validation-error.js +0 -6
@@ -9,7 +9,8 @@ const _1 = require("./");
9
9
  const case_1 = tslib_1.__importDefault(require("case"));
10
10
  const config_1 = require("./config");
11
11
  const url_1 = require("url");
12
- class ResourceDefinitionMissingError extends Error {
12
+ const shared_1 = require("../shared");
13
+ class ResourceDefinitionMissingError extends shared_1.UserError {
13
14
  constructor(resources) {
14
15
  super(ui_1.Text.error.resourceDefinitionMissing(resources));
15
16
  }
@@ -21,32 +22,37 @@ class ConfigFile {
21
22
  this.fileWriter = fileWriter;
22
23
  }
23
24
  async getAppHandlers() {
24
- var _a;
25
+ var _a, _b;
25
26
  const config = await this.readConfig();
26
- const functions = (_a = config.modules) === null || _a === void 0 ? void 0 : _a.function;
27
- if (functions === undefined) {
28
- return [];
29
- }
30
- return functions.map((funcs) => funcs.handler.split('.')[0]);
27
+ const functions = (_b = (_a = config.modules) === null || _a === void 0 ? void 0 : _a.function) !== null && _b !== void 0 ? _b : [];
28
+ const handlers = Array.from(new Set(functions.map((f) => f.handler)));
29
+ return handlers.map((handler) => {
30
+ const parts = handler.split('.');
31
+ if (parts.length !== 2) {
32
+ throw new shared_1.ValidationError(ui_1.Text.error.handlerFormat(handler));
33
+ }
34
+ const [module, func] = parts;
35
+ return { module, func };
36
+ });
31
37
  }
32
38
  async readConfig() {
33
39
  const manifestFileContents = this.fileReader.readFile(_1.manifestFileName);
34
40
  try {
35
41
  yaml_1.default.scalarOptions.null.nullStr = '';
36
- return yaml_1.parse(manifestFileContents);
42
+ return (0, yaml_1.parse)(manifestFileContents);
37
43
  }
38
44
  catch (_a) {
39
- throw new ui_1.ValidationError(ui_1.Text.artifact.error.invalidYaml(_1.manifestFileName));
45
+ throw new shared_1.ValidationError(ui_1.Text.artifact.error.invalidYaml(_1.manifestFileName));
40
46
  }
41
47
  }
42
48
  async readConfigToDocument() {
43
49
  const manifestFileContents = this.fileReader.readFile(_1.manifestFileName);
44
50
  if (manifestFileContents) {
45
51
  try {
46
- return yaml_1.parseDocument(manifestFileContents);
52
+ return (0, yaml_1.parseDocument)(manifestFileContents);
47
53
  }
48
54
  catch (_a) {
49
- throw new ui_1.ValidationError(ui_1.Text.artifact.error.invalidYaml(_1.manifestFileName));
55
+ throw new shared_1.ValidationError(ui_1.Text.artifact.error.invalidYaml(_1.manifestFileName));
50
56
  }
51
57
  }
52
58
  }
@@ -57,10 +63,9 @@ class ConfigFile {
57
63
  return entry || entry === undefined;
58
64
  }
59
65
  makeManifestUnique(modules, appName) {
60
- var _a;
61
66
  const actualModules = {};
62
67
  for (const [moduleKey, moduleArray] of Object.entries(modules)) {
63
- actualModules[moduleKey] = (_a = moduleArray) === null || _a === void 0 ? void 0 : _a.map((module) => {
68
+ actualModules[moduleKey] = moduleArray === null || moduleArray === void 0 ? void 0 : moduleArray.map((module) => {
64
69
  if (moduleKey !== 'function' && !moduleKey.startsWith(case_1.default.kebab(appName))) {
65
70
  module['key'] = case_1.default.kebab([appName, module.key].join(' '));
66
71
  if ('title' in module) {
@@ -77,7 +82,7 @@ class ConfigFile {
77
82
  }
78
83
  async prependAppNameToModules(name) {
79
84
  const manifestFileContents = this.fileReader.readFile(_1.manifestFileName);
80
- const currentConfigDoc = yaml_1.parseDocument(manifestFileContents || '');
85
+ const currentConfigDoc = (0, yaml_1.parseDocument)(manifestFileContents || '');
81
86
  const modules = currentConfigDoc.get('modules');
82
87
  if (modules && modules.type === util_1.Type.MAP) {
83
88
  const modulesObject = modules.toJSON();
@@ -88,7 +93,7 @@ class ConfigFile {
88
93
  }
89
94
  async writeToConfigFile(configKey, config) {
90
95
  const manifestFileContents = this.fileReader.readFile(_1.manifestFileName);
91
- const currentConfigDoc = yaml_1.parseDocument(manifestFileContents || '');
96
+ const currentConfigDoc = (0, yaml_1.parseDocument)(manifestFileContents || '');
92
97
  Object.keys(config).forEach((key) => {
93
98
  if (config[key] === undefined) {
94
99
  delete config[key];
@@ -97,20 +102,15 @@ class ConfigFile {
97
102
  currentConfigDoc.set(configKey, config);
98
103
  this.fileWriter.writeStringToFile(currentConfigDoc.toString(), _1.manifestFileName);
99
104
  }
100
- getHostedResourceKeys(modules) {
101
- const resourceKeys = [];
102
- for (const moduleKey in modules) {
103
- modules[moduleKey].forEach((module) => {
104
- if (config_1.isHostedResourceModule(module)) {
105
- resourceKeys.push(module.resource);
106
- }
107
- });
108
- }
109
- return resourceKeys;
105
+ getHostedResourceModules(modules) {
106
+ const modulesArray = Object.values(modules).flat();
107
+ return modulesArray.filter((module) => (0, config_1.isHostedResourceModule)(module));
110
108
  }
111
- findMissingResources(resourceKeys, resources) {
112
- const missing = resourceKeys.filter((resourceKey) => !resources.some(({ key }) => resourceKey === key));
113
- return missing;
109
+ assertNoMissingResources(modules, resources) {
110
+ const missingResources = modules.filter(({ resource }) => !resources.some(({ key }) => resource === key));
111
+ if (missingResources.length > 0) {
112
+ throw new ResourceDefinitionMissingError(missingResources.map((m) => m.resource));
113
+ }
114
114
  }
115
115
  getRemoteFromEgressPermission(remoteEgressPermission, remotes) {
116
116
  if (!remotes) {
@@ -168,28 +168,29 @@ class ConfigFile {
168
168
  });
169
169
  }, {})) || {});
170
170
  }
171
- async getResources() {
171
+ async getResources(resourceTypes) {
172
172
  const { modules, resources } = await this.readConfig();
173
- const hostedResourceKeys = modules ? this.getHostedResourceKeys(modules) : [];
173
+ const hostedResourceModules = modules ? this.getHostedResourceModules(modules) : [];
174
174
  const maybeResources = resources || [];
175
175
  const validResources = maybeResources.filter(config_1.validateResource);
176
- const missingResources = this.findMissingResources(hostedResourceKeys, validResources);
177
- if (missingResources.length > 0) {
178
- throw new ResourceDefinitionMissingError(missingResources);
176
+ this.assertNoMissingResources(hostedResourceModules, validResources);
177
+ const validResourcesWithDetails = validResources.map((resource) => (Object.assign(Object.assign({}, resource), { resourceType: this.getResourceType(resource, hostedResourceModules) }))) || [];
178
+ if (!resourceTypes) {
179
+ return validResourcesWithDetails;
179
180
  }
180
- const getResourceType = (resourceKey) => {
181
- if (hostedResourceKeys.includes(resourceKey)) {
182
- return 'customUI';
183
- }
184
- return 'default';
185
- };
186
- const validResourcesWithDetails = validResources.map((resource) => (Object.assign(Object.assign({}, resource), { resourceType: getResourceType(resource.key) })));
187
- return validResourcesWithDetails || [];
181
+ return validResourcesWithDetails.filter(({ resourceType }) => resourceTypes.includes(resourceType));
188
182
  }
189
183
  async getConnectKey() {
190
184
  var _a;
191
185
  const { app } = await this.readConfig();
192
186
  return (_a = app.connect) === null || _a === void 0 ? void 0 : _a.key;
193
187
  }
188
+ getResourceType({ key: resourceKey }, allModules) {
189
+ const linkedModule = allModules.find((m) => m.resource === resourceKey);
190
+ if (!linkedModule) {
191
+ return 'default';
192
+ }
193
+ return linkedModule.render === 'native' ? 'nativeUI' : 'customUI';
194
+ }
194
195
  }
195
196
  exports.ConfigFile = ConfigFile;
@@ -25,4 +25,5 @@ class AssertiveConfigSectionReader {
25
25
  }
26
26
  }
27
27
  exports.AssertiveConfigSectionReader = AssertiveConfigSectionReader;
28
- exports.assertive = (configSectionReader) => new AssertiveConfigSectionReader(configSectionReader);
28
+ const assertive = (configSectionReader) => new AssertiveConfigSectionReader(configSectionReader);
29
+ exports.assertive = assertive;
@@ -5,7 +5,8 @@ export interface BaseModule {
5
5
  key: string;
6
6
  }
7
7
  export interface HostedResourcesModule extends BaseModule {
8
- resource?: string;
8
+ resource: string;
9
+ render?: 'default' | 'native';
9
10
  }
10
11
  export interface ConfigReader {
11
12
  readConfig(): Promise<ManifestSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5D,eAAO,MAAM,gBAAgB,iBAAi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E,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9F,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,gBAAgB,aAAc,GAAG,0BAG7C,CAAC;AAEF,eAAO,MAAM,sBAAsB,WAAY,GAAG,oCAGjD,CAAC"}
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isHostedResourceModule = exports.validateResource = exports.dependencyFileNames = exports.manifestFileName = void 0;
4
4
  exports.manifestFileName = 'manifest.yml';
5
5
  exports.dependencyFileNames = [exports.manifestFileName, 'package.json', 'package-lock.json', 'yarn.lock'];
6
- exports.validateResource = (resource) => {
6
+ const validateResource = (resource) => {
7
7
  const { key, path } = resource;
8
8
  return typeof key === 'string' && typeof path === 'string';
9
9
  };
10
- exports.isHostedResourceModule = (module) => {
10
+ exports.validateResource = validateResource;
11
+ const isHostedResourceModule = (module) => {
11
12
  const resource = module.resource;
12
13
  return resource !== undefined;
13
14
  };
15
+ exports.isHostedResourceModule = isHostedResourceModule;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="node" />
2
+ /// <reference types="node" />
2
3
  import fs from 'fs';
3
4
  declare type IgnoreFunction = (file: string, stats: fs.Stats) => boolean;
4
5
  export declare class FileSystemReader {
@@ -1 +1 @@
1
- {"version":3,"file":"file-system-reader.d.ts","sourceRoot":"","sources":["../../src/file-system/file-system-reader.ts"],"names":[],"mappings":";AAAA,OAAO,EAA4B,MAAM,IAAI,CAAC;AAU9C,aAAK,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,OAAO,CAAC;AAEjE,qBAAa,gBAAgB;IACpB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAQxC,aAAa,CAAC,QAAQ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,EAAE,aAAa,CAAC,MAAM,GAAG,cAAc,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAgBtG,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAY/C,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAI7C,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAQ9C,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IASxE,gBAAgB,IAAI,MAAM;IAI1B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM;IAO3C,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAQvC,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAW/E,OAAO,CAAC,eAAe;CAOxB"}
@@ -23,7 +23,7 @@ class FileSystemReader {
23
23
  }
24
24
  }
25
25
  async readFileAsync(filePath) {
26
- const read = util_1.promisify(fs_1.default.readFile);
26
+ const read = (0, util_1.promisify)(fs_1.default.readFile);
27
27
  try {
28
28
  return await read(filePath, 'utf8');
29
29
  }
@@ -38,10 +38,10 @@ class FileSystemReader {
38
38
  }
39
39
  return ignore;
40
40
  });
41
- if (!fs_1.existsSync(path_1.resolve(rootDir)) || !fs_1.statSync(path_1.resolve(rootDir)).isDirectory()) {
41
+ if (!(0, fs_1.existsSync)((0, path_1.resolve)(rootDir)) || !(0, fs_1.statSync)((0, path_1.resolve)(rootDir)).isDirectory()) {
42
42
  return [];
43
43
  }
44
- return recursive_readdir_1.default(rootDir, ignoreDirs);
44
+ return (0, recursive_readdir_1.default)(rootDir, ignoreDirs);
45
45
  }
46
46
  async readGlob(glob) {
47
47
  return new Promise((resolve, reject) => {
@@ -56,7 +56,7 @@ class FileSystemReader {
56
56
  });
57
57
  }
58
58
  hasGlobSpecialChars(pattern) {
59
- return glob_1.hasMagic(pattern);
59
+ return (0, glob_1.hasMagic)(pattern);
60
60
  }
61
61
  readBinaryFile(filePath) {
62
62
  try {
@@ -67,7 +67,7 @@ class FileSystemReader {
67
67
  }
68
68
  }
69
69
  async readBinaryFileAsync(filePath) {
70
- const read = util_1.promisify(fs_1.default.readFile);
70
+ const read = (0, util_1.promisify)(fs_1.default.readFile);
71
71
  try {
72
72
  return await read(filePath);
73
73
  }
@@ -76,7 +76,7 @@ class FileSystemReader {
76
76
  }
77
77
  }
78
78
  getHomeDirectory() {
79
- return os_1.homedir();
79
+ return (0, os_1.homedir)();
80
80
  }
81
81
  bytesToMb(size) {
82
82
  if (!size) {
@@ -94,7 +94,7 @@ class FileSystemReader {
94
94
  }
95
95
  async getFolderSizeAsync(directory) {
96
96
  return new Promise((resolve) => {
97
- get_folder_size_1.default(directory, (err, size) => {
97
+ (0, get_folder_size_1.default)(directory, (err, size) => {
98
98
  if (err) {
99
99
  resolve(undefined);
100
100
  }
@@ -7,7 +7,7 @@ const yaml_1 = require("yaml");
7
7
  const yamlWriterConfig = { indent: 2, skipInvalid: true };
8
8
  class FileSystemWriter {
9
9
  writeObjectToYamlFile(objectToWrite, filename) {
10
- fs_1.default.writeFileSync(filename, yaml_1.stringify(objectToWrite, yamlWriterConfig), 'utf-8');
10
+ fs_1.default.writeFileSync(filename, (0, yaml_1.stringify)(objectToWrite, yamlWriterConfig), 'utf-8');
11
11
  }
12
12
  writeStringToFile(stringToWrite, filename) {
13
13
  fs_1.default.writeFileSync(filename, stringToWrite, 'utf-8');
@@ -14,7 +14,7 @@ class UnzipperZipAccessor {
14
14
  }
15
15
  extract(zipFile, extractDirectory) {
16
16
  const zipStream = fs_1.default.createReadStream(zipFile);
17
- const extractStream = unzipper_1.Extract({ path: extractDirectory });
17
+ const extractStream = (0, unzipper_1.Extract)({ path: extractDirectory });
18
18
  return new Promise((resolve, reject) => {
19
19
  zipStream.pipe(extractStream);
20
20
  zipStream.on('error', reject);
@@ -1,8 +1,9 @@
1
1
  import { GraphQLClient } from './index';
2
- export declare class MissingAppError extends Error {
2
+ import { UserError } from '../shared';
3
+ export declare class MissingAppError extends UserError {
3
4
  constructor();
4
5
  }
5
- export declare class MissingAppEnvironmentError extends Error {
6
+ export declare class MissingAppEnvironmentError extends UserError {
6
7
  constructor();
7
8
  }
8
9
  export interface AppEnvironmentClient {
@@ -1 +1 @@
1
- {"version":3,"file":"app-environment-graphql-client.d.ts","sourceRoot":"","sources":["../../src/graphql/app-environment-graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,qBAAa,eAAgB,SAAQ,KAAK;;CAIzC;AAED,qBAAa,0BAA2B,SAAQ,KAAK;;CAIpD;AAED,MAAM,WAAW,oBAAoB;IACnC,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACjF;AAED,qBAAa,4BAA6B,YAAW,oBAAoB;IAC3D,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA0BzF"}
1
+ {"version":3,"file":"app-environment-graphql-client.d.ts","sourceRoot":"","sources":["../../src/graphql/app-environment-graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,qBAAa,eAAgB,SAAQ,SAAS;;CAI7C;AAED,qBAAa,0BAA2B,SAAQ,SAAS;;CAIxD;AAED,MAAM,WAAW,oBAAoB;IACnC,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACjF;AAED,qBAAa,4BAA6B,YAAW,oBAAoB;IAC3D,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA0BzF"}
@@ -2,13 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AppEnvironmentsGraphqlClient = exports.MissingAppEnvironmentError = exports.MissingAppError = void 0;
4
4
  const ui_1 = require("../ui");
5
- class MissingAppError extends Error {
5
+ const shared_1 = require("../shared");
6
+ class MissingAppError extends shared_1.UserError {
6
7
  constructor() {
7
8
  super(ui_1.Text.env.error.appNotExist);
8
9
  }
9
10
  }
10
11
  exports.MissingAppError = MissingAppError;
11
- class MissingAppEnvironmentError extends Error {
12
+ class MissingAppEnvironmentError extends shared_1.UserError {
12
13
  constructor() {
13
14
  super(ui_1.Text.env.error.envNotExist);
14
15
  }
@@ -2,9 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getEnvironment = exports.CDNEnvironments = exports.getGraphqlGateway = exports.DEFAULT_GRAPHQL_GATEWAY = void 0;
4
4
  exports.DEFAULT_GRAPHQL_GATEWAY = 'https://api.atlassian.com/graphql';
5
- exports.getGraphqlGateway = () => {
5
+ const getGraphqlGateway = () => {
6
6
  return process.env.FORGE_GRAPHQL_GATEWAY || exports.DEFAULT_GRAPHQL_GATEWAY;
7
7
  };
8
+ exports.getGraphqlGateway = getGraphqlGateway;
8
9
  var Environments;
9
10
  (function (Environments) {
10
11
  Environments["DEV"] = "dev";
@@ -17,8 +18,8 @@ var CDNEnvironments;
17
18
  CDNEnvironments["STG"] = "stg";
18
19
  CDNEnvironments["PROD"] = "prod";
19
20
  })(CDNEnvironments = exports.CDNEnvironments || (exports.CDNEnvironments = {}));
20
- exports.getEnvironment = (envOptions = Environments) => {
21
- const graphqlGateway = exports.getGraphqlGateway();
21
+ const getEnvironment = (envOptions = Environments) => {
22
+ const graphqlGateway = (0, exports.getGraphqlGateway)();
22
23
  if (graphqlGateway.includes('.dev.')) {
23
24
  return envOptions.DEV;
24
25
  }
@@ -27,3 +28,4 @@ exports.getEnvironment = (envOptions = Environments) => {
27
28
  }
28
29
  return envOptions.PROD;
29
30
  };
31
+ exports.getEnvironment = getEnvironment;
@@ -2,5 +2,6 @@ import { Maybe, MutationError } from './graphql-types';
2
2
  export declare function getError(errors: Maybe<MutationError[]> | undefined): {
3
3
  code: string | undefined;
4
4
  message: string | undefined;
5
+ statusCode: number | undefined;
5
6
  };
6
7
  //# sourceMappingURL=get-mutation-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-mutation-error.d.ts","sourceRoot":"","sources":["../../src/graphql/get-mutation-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEvD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,GAAG,SAAS;;;EAOlE"}
1
+ {"version":3,"file":"get-mutation-error.d.ts","sourceRoot":"","sources":["../../src/graphql/get-mutation-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEvD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,GAAG,SAAS;;;;EAQlE"}
@@ -2,11 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getError = void 0;
4
4
  function getError(errors) {
5
- var _a;
5
+ var _a, _b;
6
6
  const error = errors === null || errors === void 0 ? void 0 : errors[0];
7
7
  return {
8
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
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;