@forge/cli-shared 2.1.5-next.9 → 2.1.6-next.10

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,5 +1,109 @@
1
1
  # @forge/cli-shared
2
2
 
3
+ ## 2.1.6-next.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [22a488ec]
8
+ - @forge/manifest@2.6.0-next.9
9
+
10
+ ## 2.1.6-next.9
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [c0e5696]
15
+ - Updated dependencies [7c0d2ee]
16
+ - @forge/manifest@2.6.0-next.8
17
+
18
+ ## 2.1.6-next.8
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [d3afe01]
23
+ - @forge/manifest@2.6.0-next.7
24
+
25
+ ## 2.1.6-next.7
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies [cdd8645]
30
+ - Updated dependencies [b97660c]
31
+ - @forge/manifest@2.6.0-next.6
32
+
33
+ ## 2.1.6-next.6
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [0a39c43]
38
+ - @forge/manifest@2.6.0-next.5
39
+
40
+ ## 2.1.6-next.5
41
+
42
+ ### Patch Changes
43
+
44
+ - Updated dependencies [91ea057]
45
+ - @forge/manifest@2.5.1-next.4
46
+
47
+ ## 2.1.6-next.4
48
+
49
+ ### Patch Changes
50
+
51
+ - Updated dependencies [3010f0e]
52
+ - @forge/manifest@2.5.1-next.3
53
+
54
+ ## 2.1.6-next.3
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies [a017696]
59
+ - @forge/manifest@2.5.1-next.2
60
+
61
+ ## 2.1.6-next.2
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [af1473c]
66
+ - @forge/manifest@2.5.1-next.1
67
+
68
+ ## 2.1.6-next.1
69
+
70
+ ### Patch Changes
71
+
72
+ - Updated dependencies [06209fc]
73
+ - @forge/manifest@2.5.1-next.0
74
+
75
+ ## 2.1.6-next.0
76
+
77
+ ### Patch Changes
78
+
79
+ - 2338be5: Handle the manifest case of remotes found in the egress permissions section when installing an app
80
+
81
+ ## 2.1.5
82
+
83
+ ### Patch Changes
84
+
85
+ - Updated dependencies [4de9850]
86
+ - Updated dependencies [70e9c8c]
87
+ - Updated dependencies [fde4ba7]
88
+ - Updated dependencies [601527b]
89
+ - Updated dependencies [755e35e]
90
+ - Updated dependencies [a5656f6]
91
+ - Updated dependencies [cc8799c]
92
+ - Updated dependencies [f5eb8e0]
93
+ - Updated dependencies [f013199]
94
+ - Updated dependencies [78d682f]
95
+ - Updated dependencies [70e9c8c]
96
+ - Updated dependencies [dec8066]
97
+ - Updated dependencies [0e82242]
98
+ - @forge/manifest@2.5.0
99
+
100
+ ## 2.1.5-next.10
101
+
102
+ ### Patch Changes
103
+
104
+ - Updated dependencies [fde4ba7]
105
+ - @forge/manifest@2.5.0-next.10
106
+
3
107
  ## 2.1.5-next.9
4
108
 
5
109
  ### Patch Changes
@@ -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":"AA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,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,OAAO,CAAC;IAMjD,OAAO,CAAC,kBAAkB;IAmBb,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAapD,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAe3F,OAAO,CAAC,qBAAqB;IAY7B,OAAO,CAAC,oBAAoB;IAK5B,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,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IA0B1C,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() {