@sinch/functions-runtime 0.2.3-beta → 0.3.1

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/index.js CHANGED
@@ -352,7 +352,20 @@ function createPieBuilder() {
352
352
  }
353
353
 
354
354
  // ../runtime-shared/dist/builders/menu.js
355
- var VALID_DTMF_KEYS = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "#"];
355
+ var VALID_DTMF_KEYS = [
356
+ "0",
357
+ "1",
358
+ "2",
359
+ "3",
360
+ "4",
361
+ "5",
362
+ "6",
363
+ "7",
364
+ "8",
365
+ "9",
366
+ "*",
367
+ "#"
368
+ ];
356
369
  var MenuBuilder = class {
357
370
  menuStructure;
358
371
  currentMenu;
@@ -1622,8 +1635,8 @@ async function configureConversationWebhooks(tunnelUrl, config) {
1622
1635
  try {
1623
1636
  const conversationAppId = process.env.CONVERSATION_APP_ID;
1624
1637
  const projectId = process.env.PROJECT_ID;
1625
- const keyId = process.env.KEY_ID;
1626
- const keySecret = process.env.KEY_SECRET;
1638
+ const keyId = process.env.PROJECT_ID_API_KEY;
1639
+ const keySecret = process.env.PROJECT_ID_API_SECRET;
1627
1640
  if (!conversationAppId || !projectId || !keyId || !keySecret) {
1628
1641
  console.log("\u{1F4A1} Conversation API not fully configured - skipping webhook setup");
1629
1642
  return;
@@ -1635,11 +1648,11 @@ async function configureConversationWebhooks(tunnelUrl, config) {
1635
1648
  keyId,
1636
1649
  keySecret
1637
1650
  });
1638
- const webhooksResult = await sinchClient.conversation.webhooks.list({ app_id: conversationAppId });
1651
+ const webhooksResult = await sinchClient.conversation.webhooks.list({
1652
+ app_id: conversationAppId
1653
+ });
1639
1654
  const existingWebhooks = webhooksResult.webhooks || [];
1640
- const tunnelWebhooks = existingWebhooks.filter(
1641
- (w) => w.target?.includes("/api/ingress/")
1642
- );
1655
+ const tunnelWebhooks = existingWebhooks.filter((w) => w.target?.includes("/api/ingress/"));
1643
1656
  for (const staleWebhook of tunnelWebhooks) {
1644
1657
  try {
1645
1658
  await sinchClient.conversation.webhooks.delete({ webhook_id: staleWebhook.id });
@@ -1667,8 +1680,8 @@ async function cleanupConversationWebhook(config) {
1667
1680
  try {
1668
1681
  const conversationAppId = process.env.CONVERSATION_APP_ID;
1669
1682
  const projectId = process.env.PROJECT_ID;
1670
- const keyId = process.env.KEY_ID;
1671
- const keySecret = process.env.KEY_SECRET;
1683
+ const keyId = process.env.PROJECT_ID_API_KEY;
1684
+ const keySecret = process.env.PROJECT_ID_API_SECRET;
1672
1685
  if (!conversationAppId || !projectId || !keyId || !keySecret) return;
1673
1686
  const sinchClient = new SinchClient2({
1674
1687
  projectId,
@@ -1919,17 +1932,21 @@ var TunnelClient = class {
1919
1932
  try {
1920
1933
  const updateUrl = `https://callingapi.sinch.com/v1/configuration/callbacks/applications/${appKey}/`;
1921
1934
  const auth = Buffer.from(`${appKey}:${appSecret}`).toString("base64");
1922
- await axios.post(updateUrl, {
1923
- url: {
1924
- primary: this.tunnelUrl,
1925
- fallback: null
1926
- }
1927
- }, {
1928
- headers: {
1929
- "Authorization": `Basic ${auth}`,
1930
- "Content-Type": "application/json"
1935
+ await axios.post(
1936
+ updateUrl,
1937
+ {
1938
+ url: {
1939
+ primary: this.tunnelUrl,
1940
+ fallback: null
1941
+ }
1942
+ },
1943
+ {
1944
+ headers: {
1945
+ Authorization: `Basic ${auth}`,
1946
+ "Content-Type": "application/json"
1947
+ }
1931
1948
  }
1932
- });
1949
+ );
1933
1950
  console.log("\u2705 Updated voice webhook URL");
1934
1951
  } catch (error) {
1935
1952
  console.log("\u26A0\uFE0F Could not update webhook URL:", error.message);
@@ -1939,7 +1956,7 @@ var TunnelClient = class {
1939
1956
  const auth = Buffer.from(`${appKey}:${appSecret}`).toString("base64");
1940
1957
  const response = await axios.get(listUrl, {
1941
1958
  headers: {
1942
- "Authorization": `Basic ${auth}`
1959
+ Authorization: `Basic ${auth}`
1943
1960
  }
1944
1961
  });
1945
1962
  const numbers = response.data?.numbers || [];
@@ -2075,7 +2092,10 @@ var SecretsLoader = class {
2075
2092
  continue;
2076
2093
  }
2077
2094
  if (functionName) {
2078
- const value = await keytar.getPassword(this.SERVICE_NAME, `${functionName}-${secretName}`);
2095
+ const value = await keytar.getPassword(
2096
+ this.SERVICE_NAME,
2097
+ `${functionName}-${secretName}`
2098
+ );
2079
2099
  if (value) {
2080
2100
  process.env[secretName] = value;
2081
2101
  console.log(`\u2705 Loaded ${secretName} from secure storage`);