@sinch/functions-runtime 0.3.0 → 0.3.2
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/dist/bin/sinch-runtime.js +259 -20
- package/dist/bin/sinch-runtime.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1028,6 +1028,8 @@ export interface VoiceFunction {
|
|
|
1028
1028
|
notify?: NotifyHandler;
|
|
1029
1029
|
/** Default handler for GET / */
|
|
1030
1030
|
default?: ApiHandler;
|
|
1031
|
+
/** Root route handler — TypeScript-friendly alias for 'default' */
|
|
1032
|
+
home?: ApiHandler;
|
|
1031
1033
|
/** Custom API endpoints (any other exported function) */
|
|
1032
1034
|
[key: string]: unknown;
|
|
1033
1035
|
}
|
package/dist/index.js
CHANGED
|
@@ -1128,7 +1128,10 @@ async function handleVoiceCallback(functionName, userFunction, context, callback
|
|
|
1128
1128
|
return formatSvamlResponse(result, functionName);
|
|
1129
1129
|
}
|
|
1130
1130
|
async function handleCustomEndpoint(functionName, userFunction, context, request, logger) {
|
|
1131
|
-
|
|
1131
|
+
let handler = userFunction[functionName];
|
|
1132
|
+
if ((!handler || typeof handler !== "function") && functionName === "default") {
|
|
1133
|
+
handler = userFunction["home"];
|
|
1134
|
+
}
|
|
1132
1135
|
if (!handler || typeof handler !== "function") {
|
|
1133
1136
|
throw new Error(`Function '${functionName}' not found in function.js`);
|
|
1134
1137
|
}
|
|
@@ -1635,8 +1638,8 @@ async function configureConversationWebhooks(tunnelUrl, config) {
|
|
|
1635
1638
|
try {
|
|
1636
1639
|
const conversationAppId = process.env.CONVERSATION_APP_ID;
|
|
1637
1640
|
const projectId = process.env.PROJECT_ID;
|
|
1638
|
-
const keyId = process.env.
|
|
1639
|
-
const keySecret = process.env.
|
|
1641
|
+
const keyId = process.env.PROJECT_ID_API_KEY;
|
|
1642
|
+
const keySecret = process.env.PROJECT_ID_API_SECRET;
|
|
1640
1643
|
if (!conversationAppId || !projectId || !keyId || !keySecret) {
|
|
1641
1644
|
console.log("\u{1F4A1} Conversation API not fully configured - skipping webhook setup");
|
|
1642
1645
|
return;
|
|
@@ -1680,8 +1683,8 @@ async function cleanupConversationWebhook(config) {
|
|
|
1680
1683
|
try {
|
|
1681
1684
|
const conversationAppId = process.env.CONVERSATION_APP_ID;
|
|
1682
1685
|
const projectId = process.env.PROJECT_ID;
|
|
1683
|
-
const keyId = process.env.
|
|
1684
|
-
const keySecret = process.env.
|
|
1686
|
+
const keyId = process.env.PROJECT_ID_API_KEY;
|
|
1687
|
+
const keySecret = process.env.PROJECT_ID_API_SECRET;
|
|
1685
1688
|
if (!conversationAppId || !projectId || !keyId || !keySecret) return;
|
|
1686
1689
|
const sinchClient = new SinchClient2({
|
|
1687
1690
|
projectId,
|