@forge/cli-shared 0.0.0-experimental-d8cea00 → 0.0.0-experimental-64caa5a

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 CHANGED
@@ -1,15 +1,402 @@
1
1
  # @forge/cli-shared
2
2
 
3
- ## 0.0.0-experimental-d8cea00
3
+ ## 0.0.0-experimental-64caa5a
4
+
5
+ ### Minor Changes
6
+
7
+ - f4c23d3: Support workspace installation for Forge App
8
+ - 5bf2ff0: Add support for workspace app installation and upgrade
9
+ - b63af27: Refactor templates code to be more generic in order to ease implementing other templating methods
10
+
11
+ ### Patch Changes
12
+
13
+ - 2338be5: Handle the manifest case of remotes found in the egress permissions section when installing an app
14
+ - Updated dependencies [bd6e025]
15
+ - Updated dependencies [a0a2c5b]
16
+ - Updated dependencies [22a488e]
17
+ - Updated dependencies [62089be]
18
+ - Updated dependencies [689c09b]
19
+ - Updated dependencies [b97660c]
20
+ - Updated dependencies [7c0d2ee]
21
+ - Updated dependencies [06209fc]
22
+ - Updated dependencies [d3afe01]
23
+ - Updated dependencies [dfe9dd8]
24
+ - Updated dependencies [91ea057]
25
+ - Updated dependencies [3010f0e]
26
+ - Updated dependencies [2b7c32b]
27
+ - Updated dependencies [92d081d]
28
+ - Updated dependencies [d3c8c8d]
29
+ - Updated dependencies [36c7c8f]
30
+ - Updated dependencies [d2f6992]
31
+ - Updated dependencies [a017696]
32
+ - Updated dependencies [0a7725f]
33
+ - Updated dependencies [af1473c]
34
+ - Updated dependencies [e4a14c7]
35
+ - Updated dependencies [2bb89c5]
36
+ - Updated dependencies [0a39c43]
37
+ - @forge/manifest@0.0.0-experimental-64caa5a
38
+
39
+ ## 2.2.0-next.16
40
+
41
+ ### Minor Changes
42
+
43
+ - b63af27: Refactor templates code to be more generic in order to ease implementing other templating methods
44
+
45
+ ### Patch Changes
46
+
47
+ - Updated dependencies [e4a14c7]
48
+ - @forge/manifest@2.6.0-next.15
49
+
50
+ ## 2.1.6-next.15
51
+
52
+ ### Patch Changes
53
+
54
+ - Updated dependencies [2b7c32b]
55
+ - @forge/manifest@2.6.0-next.14
56
+
57
+ ## 2.1.6-next.14
58
+
59
+ ### Patch Changes
60
+
61
+ - Updated dependencies [a0a2c5b]
62
+ - Updated dependencies [689c09b]
63
+ - Updated dependencies [92d081d]
64
+ - Updated dependencies [36c7c8f]
65
+ - @forge/manifest@2.6.0-next.13
66
+
67
+ ## 2.1.6-next.13
68
+
69
+ ### Patch Changes
70
+
71
+ - Updated dependencies [62089be]
72
+ - @forge/manifest@2.6.0-next.12
73
+
74
+ ## 2.1.6-next.12
75
+
76
+ ### Patch Changes
77
+
78
+ - Updated dependencies [dfe9dd8]
79
+ - Updated dependencies [d3c8c8d]
80
+ - Updated dependencies [0a7725f]
81
+ - Updated dependencies [2bb89c5]
82
+ - @forge/manifest@2.6.0-next.11
83
+
84
+ ## 2.1.6-next.11
85
+
86
+ ### Patch Changes
87
+
88
+ - Updated dependencies [bd6e025]
89
+ - Updated dependencies [d2f6992]
90
+ - @forge/manifest@2.6.0-next.10
91
+
92
+ ## 2.1.6-next.10
93
+
94
+ ### Patch Changes
95
+
96
+ - Updated dependencies [22a488ec]
97
+ - @forge/manifest@2.6.0-next.9
98
+
99
+ ## 2.1.6-next.9
100
+
101
+ ### Patch Changes
102
+
103
+ - Updated dependencies [c0e5696]
104
+ - Updated dependencies [7c0d2ee]
105
+ - @forge/manifest@2.6.0-next.8
106
+
107
+ ## 2.1.6-next.8
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies [d3afe01]
112
+ - @forge/manifest@2.6.0-next.7
113
+
114
+ ## 2.1.6-next.7
115
+
116
+ ### Patch Changes
117
+
118
+ - Updated dependencies [cdd8645]
119
+ - Updated dependencies [b97660c]
120
+ - @forge/manifest@2.6.0-next.6
121
+
122
+ ## 2.1.6-next.6
123
+
124
+ ### Patch Changes
125
+
126
+ - Updated dependencies [0a39c43]
127
+ - @forge/manifest@2.6.0-next.5
128
+
129
+ ## 2.1.6-next.5
130
+
131
+ ### Patch Changes
132
+
133
+ - Updated dependencies [91ea057]
134
+ - @forge/manifest@2.5.1-next.4
135
+
136
+ ## 2.1.6-next.4
137
+
138
+ ### Patch Changes
139
+
140
+ - Updated dependencies [3010f0e]
141
+ - @forge/manifest@2.5.1-next.3
142
+
143
+ ## 2.1.6-next.3
144
+
145
+ ### Patch Changes
146
+
147
+ - Updated dependencies [a017696]
148
+ - @forge/manifest@2.5.1-next.2
149
+
150
+ ## 2.1.6-next.2
151
+
152
+ ### Patch Changes
153
+
154
+ - Updated dependencies [af1473c]
155
+ - @forge/manifest@2.5.1-next.1
156
+
157
+ ## 2.1.6-next.1
158
+
159
+ ### Patch Changes
160
+
161
+ - Updated dependencies [06209fc]
162
+ - @forge/manifest@2.5.1-next.0
163
+
164
+ ## 2.1.6-next.0
165
+
166
+ ### Patch Changes
167
+
168
+ - 2338be5: Handle the manifest case of remotes found in the egress permissions section when installing an app
169
+
170
+ ## 2.1.5
171
+
172
+ ### Patch Changes
173
+
174
+ - Updated dependencies [4de9850]
175
+ - Updated dependencies [70e9c8c]
176
+ - Updated dependencies [fde4ba7]
177
+ - Updated dependencies [601527b]
178
+ - Updated dependencies [755e35e]
179
+ - Updated dependencies [a5656f6]
180
+ - Updated dependencies [cc8799c]
181
+ - Updated dependencies [f5eb8e0]
182
+ - Updated dependencies [f013199]
183
+ - Updated dependencies [78d682f]
184
+ - Updated dependencies [70e9c8c]
185
+ - Updated dependencies [dec8066]
186
+ - Updated dependencies [0e82242]
187
+ - @forge/manifest@2.5.0
188
+
189
+ ## 2.1.5-next.10
190
+
191
+ ### Patch Changes
192
+
193
+ - Updated dependencies [fde4ba7]
194
+ - @forge/manifest@2.5.0-next.10
195
+
196
+ ## 2.1.5-next.9
197
+
198
+ ### Patch Changes
199
+
200
+ - Updated dependencies [601527b]
201
+ - @forge/manifest@2.5.0-next.9
202
+
203
+ ## 2.1.5-next.8
204
+
205
+ ### Patch Changes
206
+
207
+ - Updated dependencies [a5656f6]
208
+ - Updated dependencies [78d682f]
209
+ - @forge/manifest@2.5.0-next.8
210
+
211
+ ## 2.1.5-next.7
212
+
213
+ ### Patch Changes
214
+
215
+ - Updated dependencies [cc8799c]
216
+ - @forge/manifest@2.5.0-next.7
217
+
218
+ ## 2.1.5-next.6
219
+
220
+ ### Patch Changes
221
+
222
+ - Updated dependencies [0e82242]
223
+ - @forge/manifest@2.5.0-next.6
224
+
225
+ ## 2.1.5-next.5
226
+
227
+ ### Patch Changes
228
+
229
+ - Updated dependencies [f5eb8e0]
230
+ - @forge/manifest@2.5.0-next.5
231
+
232
+ ## 2.1.5-next.4
233
+
234
+ ### Patch Changes
235
+
236
+ - Updated dependencies [4de9850]
237
+ - @forge/manifest@2.5.0-next.4
238
+
239
+ ## 2.1.5-next.3
240
+
241
+ ### Patch Changes
242
+
243
+ - Updated dependencies [dec8066]
244
+ - @forge/manifest@2.5.0-next.3
245
+
246
+ ## 2.1.5-next.2
247
+
248
+ ### Patch Changes
249
+
250
+ - Updated dependencies [755e35e]
251
+ - Updated dependencies [f013199]
252
+ - @forge/manifest@2.5.0-next.2
253
+
254
+ ## 2.1.5-next.1
255
+
256
+ ### Patch Changes
257
+
258
+ - Updated dependencies [66f60f9]
259
+ - @forge/manifest@2.5.0-next.1
260
+
261
+ ## 2.1.5-next.0
262
+
263
+ ### Patch Changes
264
+
265
+ - Updated dependencies [bc0c83b]
266
+ - @forge/manifest@2.4.1-next.0
267
+
268
+ ## 2.1.4
269
+
270
+ ### Patch Changes
271
+
272
+ - Updated dependencies [fbcb4a3]
273
+ - Updated dependencies [4608ccd]
274
+ - Updated dependencies [0bc8683]
275
+ - Updated dependencies [f08a9cb]
276
+ - Updated dependencies [e28cc2c]
277
+ - Updated dependencies [b415d76]
278
+ - Updated dependencies [b91d511]
279
+ - Updated dependencies [daa138b]
280
+ - Updated dependencies [33cbdba]
281
+ - Updated dependencies [ee3919d]
282
+ - Updated dependencies [ba6d463]
283
+ - Updated dependencies [1d7f9f1]
284
+ - Updated dependencies [82167f3]
285
+ - Updated dependencies [873f913]
286
+ - Updated dependencies [a9bdd4f]
287
+ - Updated dependencies [2ea75dd]
288
+ - @forge/manifest@2.4.0
289
+ - @forge/util@1.0.1
290
+
291
+ ## 2.1.4-next.9
292
+
293
+ ### Patch Changes
294
+
295
+ - Updated dependencies [ba6d463]
296
+ - @forge/manifest@2.4.0-next.9
297
+
298
+ ## 2.1.4-next.8
299
+
300
+ ### Patch Changes
301
+
302
+ - Updated dependencies [e28cc2c]
303
+ - Updated dependencies [ee3919d]
304
+ - @forge/manifest@2.4.0-next.8
305
+
306
+ ## 2.1.4-next.7
307
+
308
+ ### Patch Changes
309
+
310
+ - Updated dependencies [daa138b]
311
+ - Updated dependencies [2ea75dd]
312
+ - @forge/manifest@2.4.0-next.7
313
+
314
+ ## 2.1.4-next.6
315
+
316
+ ### Patch Changes
317
+
318
+ - Updated dependencies [f08a9cb]
319
+ - Updated dependencies [873f913]
320
+ - @forge/manifest@2.4.0-next.6
321
+
322
+ ## 2.1.4-next.5
323
+
324
+ ### Patch Changes
325
+
326
+ - Updated dependencies [fbcb4a3]
327
+ - Updated dependencies [a9bdd4f]
328
+ - @forge/manifest@2.4.0-next.5
329
+
330
+ ## 2.1.4-next.4
331
+
332
+ ### Patch Changes
333
+
334
+ - Updated dependencies [0bc8683]
335
+ - @forge/manifest@2.3.1-next.4
336
+
337
+ ## 2.1.4-next.3
338
+
339
+ ### Patch Changes
340
+
341
+ - Updated dependencies [1d7f9f1]
342
+ - @forge/manifest@2.3.1-next.3
343
+
344
+ ## 2.1.4-next.2
345
+
346
+ ### Patch Changes
347
+
348
+ - Updated dependencies [b415d76]
349
+ - Updated dependencies [33cbdba]
350
+ - @forge/manifest@2.3.1-next.2
351
+
352
+ ## 2.1.4-next.1
353
+
354
+ ### Patch Changes
355
+
356
+ - Updated dependencies [4608ccd]
357
+ - Updated dependencies [b91d511]
358
+ - @forge/util@1.0.1-next.0
359
+ - @forge/manifest@2.3.1-next.1
360
+
361
+ ## 2.1.4-next.0
362
+
363
+ ### Patch Changes
364
+
365
+ - Updated dependencies [82167f3]
366
+ - @forge/manifest@2.3.1-next.0
367
+
368
+ ## 2.1.3
4
369
 
5
370
  ### Patch Changes
6
371
 
7
372
  - 962582f: Remove ts-ignore and fix complex union type error related to MutationResult generic.
8
- - Updated dependencies [0fe60df]
373
+ - Updated dependencies [f3c0748]
9
374
  - Updated dependencies [bd2be7f]
375
+ - Updated dependencies [46240f3]
376
+ - Updated dependencies [18c799a]
377
+ - Updated dependencies [5ed2e3a]
10
378
  - Updated dependencies [7cfcd6c]
11
379
  - Updated dependencies [f0d3871]
12
- - @forge/manifest@0.0.0-experimental-d8cea00
380
+ - Updated dependencies [9b09fef]
381
+ - @forge/manifest@2.3.0
382
+
383
+ ## 2.1.3-next.4
384
+
385
+ ### Patch Changes
386
+
387
+ - Updated dependencies [46240f3]
388
+ - Updated dependencies [5ed2e3a]
389
+ - @forge/manifest@2.3.0-next.3
390
+
391
+ ## 2.1.3-next.3
392
+
393
+ ### Patch Changes
394
+
395
+ - Updated dependencies [f3c0748]
396
+ - Updated dependencies [18c799a]
397
+ - Updated dependencies [7cfcd6c]
398
+ - Updated dependencies [9b09fef]
399
+ - @forge/manifest@2.3.0-next.2
13
400
 
14
401
  ## 2.1.3-next.2
15
402
 
@@ -11,15 +11,17 @@ export interface TemplateDownloader {
11
11
  export interface TemplateExtractor {
12
12
  extract(zipFile: string, destDirectory: string): Promise<void>;
13
13
  }
14
- export interface Templater {
15
- downloadAndExtract(template: string, directory: string): Promise<void>;
14
+ export interface TemplateLister {
16
15
  getAvailableTemplates(): Promise<string[]>;
17
16
  }
17
+ export interface Templater extends TemplateLister {
18
+ downloadAndExtract(template: string, directory: string): Promise<void>;
19
+ }
18
20
  export declare class BitbucketTemplateDownloader implements TemplateDownloader {
19
21
  download(template: string, zipFile: string): Promise<void>;
20
22
  private buildZipUrl;
21
23
  }
22
- export declare class BitbucketTemplateExtractor implements TemplateExtractor {
24
+ export declare class ZipTemplateExtractor implements TemplateExtractor {
23
25
  private readonly zipAccessor;
24
26
  constructor(zipAccessor: ZipAccessor);
25
27
  extract(zipFile: string, destDirectory: string): Promise<void>;
@@ -28,11 +30,15 @@ export declare class BitbucketTemplateExtractor implements TemplateExtractor {
28
30
  export declare class TemplateFetchError extends Error {
29
31
  constructor();
30
32
  }
31
- export declare class BitbucketTemplater implements Templater {
33
+ export declare class BitbucketTemplateLister implements TemplateLister {
34
+ getAvailableTemplates(): Promise<string[]>;
35
+ }
36
+ export declare class ComposableTemplater implements Templater {
32
37
  private readonly downloader;
33
38
  private readonly extractor;
39
+ private readonly lister;
34
40
  private readonly logger;
35
- constructor(downloader: TemplateDownloader, extractor: TemplateExtractor, logger: Logger);
41
+ constructor(downloader: TemplateDownloader, extractor: TemplateExtractor, lister: TemplateLister, logger: Logger);
36
42
  downloadAndExtract(template: string, directory: string): Promise<void>;
37
43
  getAvailableTemplates(): Promise<string[]>;
38
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/apps/template.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAK/B,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,QAAQ,EAAE,MAAM;CAG7B;AAED,qBAAa,2BAA4B,SAAQ,KAAK;CAAG;AAEzD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE;AAED,MAAM,WAAW,SAAS;IACxB,kBAAkB,CAAC,Q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EAC5B,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM;IAEpB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBnF,qBAAqB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAG3C"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BitbucketTemplater = exports.TemplateFetchError = exports.BitbucketTemplateExtractor = exports.BitbucketTemplateDownloader = exports.InvalidTemplateArchiveError = exports.NoTemplateError = void 0;
3
+ exports.ComposableTemplater = exports.BitbucketTemplateLister = exports.TemplateFetchError = exports.ZipTemplateExtractor = exports.BitbucketTemplateDownloader = exports.InvalidTemplateArchiveError = exports.NoTemplateError = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const fs_1 = tslib_1.__importDefault(require("fs"));
6
6
  const fs_extra_1 = require("fs-extra");
@@ -41,7 +41,7 @@ class BitbucketTemplateDownloader {
41
41
  }
42
42
  }
43
43
  exports.BitbucketTemplateDownloader = BitbucketTemplateDownloader;
44
- class BitbucketTemplateExtractor {
44
+ class ZipTemplateExtractor {
45
45
  constructor(zipAccessor) {
46
46
  this.zipAccessor = zipAccessor;
47
47
  }
@@ -73,17 +73,34 @@ class BitbucketTemplateExtractor {
73
73
  }
74
74
  }
75
75
  }
76
- exports.BitbucketTemplateExtractor = BitbucketTemplateExtractor;
76
+ exports.ZipTemplateExtractor = ZipTemplateExtractor;
77
77
  class TemplateFetchError extends Error {
78
78
  constructor() {
79
79
  super(ui_1.Text.error.templateFetchFailed);
80
80
  }
81
81
  }
82
82
  exports.TemplateFetchError = TemplateFetchError;
83
- class BitbucketTemplater {
84
- constructor(downloader, extractor, logger) {
83
+ class BitbucketTemplateLister {
84
+ async getAvailableTemplates() {
85
+ try {
86
+ const res = await node_fetch_1.default(`https://api.bitbucket.org/2.0/repositories/atlassian?q=project.key=%22${BITBUCKET_PROJECT}%22&sort=name&pagelen=50`);
87
+ if (!res.ok) {
88
+ throw new TemplateFetchError();
89
+ }
90
+ const json = await res.json();
91
+ return json.values.map((repo) => repo.name);
92
+ }
93
+ catch (e) {
94
+ throw new TemplateFetchError();
95
+ }
96
+ }
97
+ }
98
+ exports.BitbucketTemplateLister = BitbucketTemplateLister;
99
+ class ComposableTemplater {
100
+ constructor(downloader, extractor, lister, logger) {
85
101
  this.downloader = downloader;
86
102
  this.extractor = extractor;
103
+ this.lister = lister;
87
104
  this.logger = logger;
88
105
  }
89
106
  async downloadAndExtract(template, directory) {
@@ -105,18 +122,8 @@ class BitbucketTemplater {
105
122
  fs_1.default.unlinkSync(zipFile);
106
123
  }
107
124
  }
108
- async getAvailableTemplates() {
109
- try {
110
- const res = await node_fetch_1.default(`https://api.bitbucket.org/2.0/repositories/atlassian?q=project.key=%22${BITBUCKET_PROJECT}%22&sort=name&pagelen=50`);
111
- if (!res.ok) {
112
- throw new TemplateFetchError();
113
- }
114
- const json = await res.json();
115
- return json.values.map((repo) => repo.name);
116
- }
117
- catch (e) {
118
- throw new TemplateFetchError();
119
- }
125
+ getAvailableTemplates() {
126
+ return this.lister.getAvailableTemplates();
120
127
  }
121
128
  }
122
- exports.BitbucketTemplater = BitbucketTemplater;
129
+ exports.ComposableTemplater = ComposableTemplater;
@@ -1,7 +1,7 @@
1
1
  import { Document } from 'yaml';
2
2
  import { FileSystemReader, FileSystemWriter } from '../file-system';
3
3
  import { ConfigReader, ConfigWriter } from './';
4
- import { ManifestSchema, Resources } from '@forge/manifest';
4
+ import { ManifestSchema, Resources } from '@forge/manifest/out/schema/manifest';
5
5
  export declare class ResourceDefinitionMissingError extends Error {
6
6
  constructor(resources: string[]);
7
7
  }
@@ -27,6 +27,8 @@ export declare class ConfigFile implements ConfigReader, ConfigWriter, ConfigInt
27
27
  writeToConfigFile<K extends string, V>(configKey: K, config: V): Promise<void>;
28
28
  private getHostedResourceKeys;
29
29
  private findMissingResources;
30
+ private getRemoteFromEgressPermission;
31
+ private instanceOfRemote;
30
32
  getEgressPermissions(): Promise<{
31
33
  type: string;
32
34
  domains: string[] | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"config-file.d.ts","sourceRoot":"","sources":["../../src/config/config-file.ts"],"names":[],"mappings":"AAAA,OAAa,EAAwB,QAAQ,EAAE,MAAM,MAAM,CAAC;AAI5D,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,EAAE,MAAM,iBAAiB,CAAC;AAGrE,qBAAa,8BAA+B,SAAQ,KAAK;gBAC3C,SAAS,EAAE,MAAM,EAAE;CAGhC;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACzC,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACtC;AAED,oBAAY,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AACpC,oBAAY,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC;AAClD,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED,qBAAa,UAAW,YAAW,YAAY,EAAE,YAAY,EAAE,gBAAgB;IACjE,OAAO,CAAC,QAAQ,CAAC,UAAU;IAAoB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAzD,UAAU,EAAE,gBAAgB,EAAmB,UAAU,EAAE,gBAAgB;IAE3F,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IASxC,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC;IAUrC,oBAAoB,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;IAW5D,gBAAgB,IAAI,OAAO,CAAC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B1C,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAI1D"}
@@ -112,8 +112,22 @@ class ConfigFile {
112
112
  const missing = resourceKeys.filter((resourceKey) => !resources.some(({ key }) => resourceKey === key));
113
113
  return missing;
114
114
  }
115
+ getRemoteFromEgressPermission(remoteEgressPermission, remotes) {
116
+ if (!remotes) {
117
+ return remoteEgressPermission;
118
+ }
119
+ for (const remote of remotes) {
120
+ if (remote.key === remoteEgressPermission) {
121
+ return new url_1.URL(remote.baseUrl).hostname;
122
+ }
123
+ }
124
+ return remoteEgressPermission;
125
+ }
126
+ instanceOfRemote(remote) {
127
+ return typeof remote !== 'string' && 'remote' in remote;
128
+ }
115
129
  async getEgressPermissions() {
116
- const { permissions } = await this.readConfig();
130
+ const { permissions, remotes } = await this.readConfig();
117
131
  const egressPermissions = permissions === null || permissions === void 0 ? void 0 : permissions.external;
118
132
  if (!egressPermissions) {
119
133
  return [];
@@ -126,9 +140,11 @@ class ConfigFile {
126
140
  return ({
127
141
  type: typePrefix ? `${typePrefix}_${entry[0]}` : entry[0],
128
142
  domains: (_a = entry[1]) === null || _a === void 0 ? void 0 : _a.map((url) => {
129
- let domain = url;
143
+ let domain = this.instanceOfRemote(url) ? url.remote : url;
130
144
  try {
131
- domain = new url_1.URL(url).hostname;
145
+ domain = this.instanceOfRemote(url)
146
+ ? this.getRemoteFromEgressPermission(url.remote, remotes)
147
+ : new url_1.URL(url).hostname;
132
148
  }
133
149
  catch (e) {
134
150
  }
@@ -137,9 +153,7 @@ class ConfigFile {
137
153
  });
138
154
  });
139
155
  const egressUrls = getDomainsFromPermissions(otherEgress);
140
- const fetchUrls = fetchEgress
141
- ? getDomainsFromPermissions(fetchEgress, 'fetch')
142
- : [];
156
+ const fetchUrls = fetchEgress ? getDomainsFromPermissions(fetchEgress, 'fetch') : [];
143
157
  return [...egressUrls, ...fetchUrls];
144
158
  }
145
159
  async getAuthProviders() {