npm package diff
Package: @forge/sandbox-runtime
Versions: 4.18.4-next.0-experimental-c7a7d36 - 4.18.0-experimental-204139e
File: package/out/sandbox-isolate/api/fetch/middleware/updateUrlVariablesMiddleware.js
Index: package/out/sandbox-isolate/api/fetch/middleware/updateUrlVariablesMiddleware.js
===================================================================
--- package/out/sandbox-isolate/api/fetch/middleware/updateUrlVariablesMiddleware.js
+++ package/out/sandbox-isolate/api/fetch/middleware/updateUrlVariablesMiddleware.js
@@ -11,12 +11,12 @@
function isWebhookQueueEndpoint(path) {
const webhookEndpointsPattern = new RegExp('/webhook/queue/(publish|stats|cancel)/{cloudId}/{environmentId}/{appId}/{appVersion}$');
return webhookEndpointsPattern.test(path);
}
-function updateProductURL(restPath, toReplaceVariables) {
+function updateProductURL(restPath, toReplaceVariables, useContexAriInQueuePaths) {
let updatedRestPath = restPath;
const variablesToUpdate = extractVariables(restPath);
- const replaceCloudIdWithContextAri = isWebhookQueueEndpoint(restPath);
+ const replaceCloudIdWithContextAri = useContexAriInQueuePaths && isWebhookQueueEndpoint(restPath);
variablesToUpdate.forEach((replaceProperty) => {
if (replaceProperty in toReplaceVariables) {
const regex = new RegExp('{' + replaceProperty + '}', 'g');
const replacementValue = replaceCloudIdWithContextAri && replaceProperty === 'cloudId' && 'contextAri' in toReplaceVariables
@@ -27,15 +27,15 @@
});
return updatedRestPath;
}
exports.updateProductURL = updateProductURL;
-function updateUrlVariablesMiddleware(request) {
+function updateUrlVariablesMiddleware(request, useContexAriInQueuePaths) {
return async (url, options, innerFetch) => {
if (url instanceof node_fetch_1.Request) {
- url.url = updateProductURL(url.url, request);
+ url.url = updateProductURL(url.url, request, useContexAriInQueuePaths);
}
else {
- url = updateProductURL(url, request);
+ url = updateProductURL(url, request, useContexAriInQueuePaths);
}
return innerFetch(url, options);
};
}