@sinch/functions-runtime 0.5.20 → 0.5.21
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.
|
@@ -70156,10 +70156,17 @@ var {
|
|
|
70156
70156
|
// src/tunnel/webhook-config.ts
|
|
70157
70157
|
var import_sdk_core2 = __toESM(require_dist11(), 1);
|
|
70158
70158
|
import { randomBytes } from "crypto";
|
|
70159
|
-
var SINCH_FN_URL_PATTERN = /\.fn(-\w+)?\.sinch\.com/;
|
|
70159
|
+
var SINCH_FN_URL_PATTERN = /\.fn(-\w+)?\.sinch\.(?:com|io)/;
|
|
70160
70160
|
function isOurWebhook(target) {
|
|
70161
70161
|
return !!target && SINCH_FN_URL_PATTERN.test(target);
|
|
70162
70162
|
}
|
|
70163
|
+
var FUNCTIONS_DOMAIN_DEFAULT = "fn.sinch.com";
|
|
70164
|
+
function deployedWebhookTarget(functionName) {
|
|
70165
|
+
const injected = process.env.FUNCTION_URL;
|
|
70166
|
+
if (injected) return `${injected.replace(/\/+$/, "")}/webhook/conversation`;
|
|
70167
|
+
const domain = process.env.SINCH_FUNCTIONS_DOMAIN || FUNCTIONS_DOMAIN_DEFAULT;
|
|
70168
|
+
return `https://${functionName}.${domain}/webhook/conversation`;
|
|
70169
|
+
}
|
|
70163
70170
|
function isTunnelUrl(target) {
|
|
70164
70171
|
return !!target && target.includes("tunnel.fn");
|
|
70165
70172
|
}
|
|
@@ -70227,7 +70234,7 @@ async function cleanupConversationWebhook(config) {
|
|
|
70227
70234
|
if (!restoreTarget || isTunnelUrl(restoreTarget)) {
|
|
70228
70235
|
const functionName = process.env.FUNCTION_NAME || process.env.FUNCTION_ID;
|
|
70229
70236
|
if (functionName) {
|
|
70230
|
-
restoreTarget =
|
|
70237
|
+
restoreTarget = deployedWebhookTarget(functionName);
|
|
70231
70238
|
console.log(`\u{1F527} Derived restore target from env: ${restoreTarget}`);
|
|
70232
70239
|
} else {
|
|
70233
70240
|
console.log("\u26A0\uFE0F Cannot restore webhook \u2014 no FUNCTION_NAME or FUNCTION_ID available");
|
|
@@ -71796,4 +71803,4 @@ serve-static/index.js:
|
|
|
71796
71803
|
* MIT Licensed
|
|
71797
71804
|
*)
|
|
71798
71805
|
*/
|
|
71799
|
-
//# sourceMappingURL=chunk-
|
|
71806
|
+
//# sourceMappingURL=chunk-GHTTRPRF.js.map
|