@forge/cli-shared 2.1.5 → 2.1.6-next.0
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,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,
|
|
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,MA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,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 =
|
|
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() {
|
|
@@ -1696,6 +1696,7 @@ export declare type CompassCreateMetricDefinitionInput = {
|
|
|
1696
1696
|
cloudId: Scalars['ID'];
|
|
1697
1697
|
name: Scalars['String'];
|
|
1698
1698
|
description?: Maybe<Scalars['String']>;
|
|
1699
|
+
format?: Maybe<CompassMetricDefinitionFormatInput>;
|
|
1699
1700
|
};
|
|
1700
1701
|
export declare type CompassCreateMetricDefinitionPayload = Payload & {
|
|
1701
1702
|
__typename?: 'CompassCreateMetricDefinitionPayload';
|
|
@@ -1995,12 +1996,24 @@ export declare type CompassMetricDefinition = {
|
|
|
1995
1996
|
id: Scalars['ID'];
|
|
1996
1997
|
name?: Maybe<Scalars['String']>;
|
|
1997
1998
|
description?: Maybe<Scalars['String']>;
|
|
1999
|
+
format?: Maybe<CompassMetricDefinitionFormat>;
|
|
1998
2000
|
};
|
|
1999
2001
|
export declare type CompassMetricDefinitionEdge = {
|
|
2000
2002
|
__typename?: 'CompassMetricDefinitionEdge';
|
|
2001
2003
|
cursor: Scalars['String'];
|
|
2002
2004
|
node?: Maybe<CompassMetricDefinition>;
|
|
2003
2005
|
};
|
|
2006
|
+
export declare type CompassMetricDefinitionFormat = CompassMetricDefinitionFormatSuffix;
|
|
2007
|
+
export declare type CompassMetricDefinitionFormatInput = {
|
|
2008
|
+
suffix?: Maybe<CompassMetricDefinitionFormatSuffixInput>;
|
|
2009
|
+
};
|
|
2010
|
+
export declare type CompassMetricDefinitionFormatSuffix = {
|
|
2011
|
+
__typename?: 'CompassMetricDefinitionFormatSuffix';
|
|
2012
|
+
suffix?: Maybe<Scalars['String']>;
|
|
2013
|
+
};
|
|
2014
|
+
export declare type CompassMetricDefinitionFormatSuffixInput = {
|
|
2015
|
+
suffix: Scalars['String'];
|
|
2016
|
+
};
|
|
2004
2017
|
export declare type CompassMetricDefinitionsConnection = {
|
|
2005
2018
|
__typename?: 'CompassMetricDefinitionsConnection';
|
|
2006
2019
|
edges?: Maybe<Array<CompassMetricDefinitionEdge>>;
|
|
@@ -2302,6 +2315,7 @@ export declare type CompassUpdateMetricDefinitionInput = {
|
|
|
2302
2315
|
id: Scalars['ID'];
|
|
2303
2316
|
name?: Maybe<Scalars['String']>;
|
|
2304
2317
|
description?: Maybe<Scalars['String']>;
|
|
2318
|
+
format?: Maybe<CompassMetricDefinitionFormatInput>;
|
|
2305
2319
|
};
|
|
2306
2320
|
export declare type CompassUpdateMetricDefinitionPayload = Payload & {
|
|
2307
2321
|
__typename?: 'CompassUpdateMetricDefinitionPayload';
|