Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const areaId = getAreaIdForProtocol(protocolType);
const serviceUri = await getServiceUriFromAreaId(
collectionUrl,
accessToken,
areaId
);
const webApi = getWebApiWithProxy(serviceUri);
const locationApi = await webApi.getLocationsApi();
tl.debug("Acquiring Packaging endpoints from " + serviceUri);
const connectionData = await locationApi.getConnectionData(
interfaces.ConnectOptions.IncludeServices
);
tl.debug("Successfully acquired the connection data");
const defaultAccessPoint: string = connectionData.locationServiceData.accessMappings.find(
mapping =>
mapping.moniker ===
connectionData.locationServiceData.defaultAccessMappingMoniker
).accessPoint;
pkgLocation.DefaultPackagingUri = defaultAccessPoint;
pkgLocation.PackagingUris.push(defaultAccessPoint);
pkgLocation.PackagingUris = pkgLocation.PackagingUris.concat(
connectionData.locationServiceData.accessMappings.map(mapping => {
return mapping.accessPoint;
})
);
if (!serverType || serverType.toLowerCase() !== 'hosted') {
return pkgLocation;
}
const accessToken = getSystemAccessToken();
const areaId = getAreaIdForProtocol(protocolType);
const serviceUri = await getServiceUriFromAreaId(collectionUrl, accessToken, areaId);
const webApi = getWebApiWithProxy(serviceUri);
const locationApi = await webApi.getLocationsApi();
tl.debug('Acquiring Packaging endpoints from ' + serviceUri);
const connectionData = await locationApi.getConnectionData(interfaces.ConnectOptions.IncludeServices);
tl.debug('Successfully acquired the connection data');
const defaultAccessPoint: string = connectionData.locationServiceData.accessMappings.find((mapping) =>
mapping.moniker === connectionData.locationServiceData.defaultAccessMappingMoniker
).accessPoint;
pkgLocation.DefaultPackagingUri = defaultAccessPoint;
pkgLocation.PackagingUris.push(defaultAccessPoint);
pkgLocation.PackagingUris = pkgLocation.PackagingUris.concat(
connectionData.locationServiceData.accessMappings.map((mapping) => {
return mapping.accessPoint;
}));
tl.debug('Acquired location');
tl.debug(JSON.stringify(pkgLocation));
return pkgLocation;
const accessToken = getSystemAccessToken();
const areaId = getAreaIdForProtocol(protocolType);
const serviceUri = await getServiceUriFromAreaId(
collectionUrl,
accessToken,
areaId
);
const webApi = getWebApiWithProxy(serviceUri);
const locationApi = await webApi.getLocationsApi();
tl.debug("Acquiring Packaging endpoints from " + serviceUri);
return locationApi
.getConnectionData(interfaces.ConnectOptions.IncludeServices)
.then(connectionData => {
tl.debug("Successfully acquired the connection data");
const defaultAccessPoint: string = connectionData.locationServiceData.accessMappings.find(
mapping =>
mapping.moniker ===
connectionData.locationServiceData.defaultAccessMappingMoniker
).accessPoint;
pkgLocation.DefaultPackagingUri = defaultAccessPoint;
pkgLocation.PackagingUris.push(defaultAccessPoint);
pkgLocation.PackagingUris = pkgLocation.PackagingUris.concat(
connectionData.locationServiceData.accessMappings.map(mapping => {
return mapping.accessPoint;
})
);