Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async getRequestBuilder(
builderType: ApiName,
abortSignal?: AbortSignal
): Promise {
return RequestFactory.create(
builderType,
this.apiVersion,
this.settings,
HRN.fromString(this.hrn),
abortSignal
).catch(err =>
Promise.reject(
`Error retrieving from cache builder for resource "${this.hrn}" and api: "${builderType}.\n${err}"`
)
);
}
private async getRequestBuilder(
builderType: ApiName,
abortSignal?: AbortSignal
): Promise {
return RequestFactory.create(
builderType,
this.apiVersion,
this.settings,
HRN.fromString(this.hrn),
abortSignal
).catch(err =>
Promise.reject(
`Error retrieving from cache builder for resource "${this.hrn}" and api: "${builderType}.\n${err}"`
)
);
}
async getCopyrightCoverageData(): Promise {
if (this.m_cachedCopyrightResponse !== undefined) {
return this.m_cachedCopyrightResponse;
}
const hrn = HRN.fromString(this.m_params.hrn);
const context = new DataStoreContext({
getToken: this.m_params.getToken,
environment: hrn.data.partition
});
const catalogClient = new CatalogClient({
context,
hrn: this.m_params.hrn
});
this.m_cachedCopyrightResponse = catalogClient
.getVolatileOrVersionedLayer(this.m_params.layer || DEFAULT_LAYER)
.then()
.then(layer => layer.getPartition(this.m_params.partition || DEFAULT_PARTITION))
.then(response => response.json())
.then(json => json[this.m_params.baseScheme || "normal"])
.catch(error => {
private async getRequestBuilder(
builderType: ApiName,
abortSignal?: AbortSignal
): Promise {
return RequestFactory.create(
builderType,
this.apiVersion,
this.settings,
HRN.fromString(this.hrn),
abortSignal
).catch(err =>
Promise.reject(
`Error retrieving from cache builder for resource "${this.hrn}" and api: "${builderType}.\n${err}"`
)
);
}
private async getRequestBuilder(
builderType: ApiName,
abortSignal?: AbortSignal
): Promise {
return RequestFactory.create(
builderType,
this.apiVersion,
this.settings,
HRN.fromString(this.hrn),
abortSignal
).catch(err =>
Promise.reject(
`Error retrieving from cache builder for resource "${this.hrn}" and api: "${builderType}.\n${err}"`
)
);
}
async getCopyrightCoverageData(): Promise {
if (this.m_cachedCopyrightResponse !== undefined) {
return this.m_cachedCopyrightResponse;
}
const hrn = HRN.fromString(this.m_params.hrn);
const context = new DataStoreContext({
getToken: this.m_params.getToken,
environment: hrn.data.partition
});
const catalogClient = new CatalogClient({
context,
hrn: this.m_params.hrn
});
this.m_cachedCopyrightResponse = catalogClient
.getVolatileOrVersionedLayer(this.m_params.layer || DEFAULT_LAYER)
.then()
.then(layer => layer.getPartition(this.m_params.partition || DEFAULT_PARTITION))
.then(response => response.json())
.then(json => json[this.m_params.baseScheme || "normal"])
.catch(error => {
this.logger.error(error);
return [];
});
return this.m_cachedCopyrightResponse;
async getCopyrightCoverageData(): Promise {
if (this.m_cachedCopyrightResponse !== undefined) {
return this.m_cachedCopyrightResponse;
}
const hrn = HRN.fromString(this.m_params.hrn);
const context = new DataStoreContext({
getToken: this.m_params.getToken,
environment: hrn.data.partition
});
const catalogClient = new CatalogClient({
context,
hrn: this.m_params.hrn
});
this.m_cachedCopyrightResponse = catalogClient
.getVolatileOrVersionedLayer(this.m_params.layer || DEFAULT_LAYER)
.then()
.then(layer => layer.getPartition(this.m_params.partition || DEFAULT_PARTITION))
.then(response => response.json())
.then(json => json[this.m_params.baseScheme || "normal"])
.catch(error => {
this.logger.error(error);
constructor(params: DataStoreContextParams) {
this.lookUpUrl = getEnvLookUpUrl(params.environment);
this.getToken = params.getToken;
this.dm = params.dm || new DataStoreDownloadManager();
this.environment = params.environment;
this.requestBuilder = new DataStoreRequestBuilder(
this.dm,
this.lookUpUrl,
this.getToken
);
}
constructor(params: DataStoreContextParams) {
this.lookUpUrl = getEnvLookUpUrl(params.environment);
this.getToken = params.getToken;
this.dm = params.dm || new DataStoreDownloadManager();
this.environment = params.environment;
this.requestBuilder = new DataStoreRequestBuilder(
this.dm,
this.lookUpUrl,
this.getToken
);
}
private async errorHandler(error: any) {
return Promise.reject(
new ErrorHTTPResponse(
`Statistics Service error: HTTP ${
error.status
}, ${error.statusText || error.cause || ""}` +
`\n${error.action || ""}`,
error
)
);
}