@sinch/functions-runtime 0.5.3 → 0.5.4
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.d.ts
CHANGED
|
@@ -1232,6 +1232,53 @@ export declare function createJsonResponse<T>(body: T, statusCode?: number): Fun
|
|
|
1232
1232
|
* Create an error response
|
|
1233
1233
|
*/
|
|
1234
1234
|
export declare function createErrorResponse(message: string, statusCode?: number): FunctionResponse;
|
|
1235
|
+
/** ICE callback payload as delivered to your handler (`callid` normalized to `callId`). */
|
|
1236
|
+
export type IceCallback = Omit<Voice.IceRequest, "callid" | "event"> & {
|
|
1237
|
+
callId?: string;
|
|
1238
|
+
event: "ice";
|
|
1239
|
+
};
|
|
1240
|
+
/** ACE callback payload as delivered to your handler. */
|
|
1241
|
+
export type AceCallback = Omit<Voice.AceRequest, "callid" | "event"> & {
|
|
1242
|
+
callId?: string;
|
|
1243
|
+
event: "ace";
|
|
1244
|
+
};
|
|
1245
|
+
/** PIE callback payload as delivered to your handler. */
|
|
1246
|
+
export type PieCallback = Omit<Voice.PieRequest, "callid" | "event"> & {
|
|
1247
|
+
callId?: string;
|
|
1248
|
+
event: "pie";
|
|
1249
|
+
};
|
|
1250
|
+
/** DICE callback payload as delivered to your handler. */
|
|
1251
|
+
export type DiceCallback = Omit<Voice.DiceRequest, "callid" | "event"> & {
|
|
1252
|
+
callId?: string;
|
|
1253
|
+
event: "dice";
|
|
1254
|
+
};
|
|
1255
|
+
/** NOTIFY callback payload as delivered to your handler. */
|
|
1256
|
+
export type NotifyCallback = Omit<Voice.NotifyRequest, "callid" | "event"> & {
|
|
1257
|
+
callId?: string;
|
|
1258
|
+
event: "notify";
|
|
1259
|
+
};
|
|
1260
|
+
/** @deprecated Import from '@sinch/voice' instead: `import type { Voice } from '@sinch/voice'` then use `Voice.IceRequest` @internal */
|
|
1261
|
+
export type IceCallbackData = Voice.IceRequest;
|
|
1262
|
+
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
1263
|
+
export type AceCallbackData = Voice.AceRequest;
|
|
1264
|
+
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
1265
|
+
export type PieCallbackData = Voice.PieRequest;
|
|
1266
|
+
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
1267
|
+
export type DiceCallbackData = Voice.DiceRequest;
|
|
1268
|
+
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
1269
|
+
export type NotifyCallbackData = Voice.NotifyRequest;
|
|
1270
|
+
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
1271
|
+
export type MenuResult = Voice.MenuResult;
|
|
1272
|
+
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
1273
|
+
export type AmdResult = Voice.AnsweringMachineDetection;
|
|
1274
|
+
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
1275
|
+
export type DisconnectReason = Voice.DiceReasonEnum;
|
|
1276
|
+
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
1277
|
+
export type CallResult = Voice.ResultEnum;
|
|
1278
|
+
/**
|
|
1279
|
+
* Union type for all voice callback data
|
|
1280
|
+
*/
|
|
1281
|
+
export type VoiceCallbackData = Voice.IceRequest | Voice.AceRequest | Voice.PieRequest | Voice.DiceRequest | Voice.NotifyRequest;
|
|
1235
1282
|
/**
|
|
1236
1283
|
* Voice event handler function signature
|
|
1237
1284
|
*
|
|
@@ -1246,23 +1293,23 @@ export type ApiHandler = (context: FunctionContext, request: FunctionRequest) =>
|
|
|
1246
1293
|
/**
|
|
1247
1294
|
* ICE (Incoming Call Event) handler
|
|
1248
1295
|
*/
|
|
1249
|
-
export type IceHandler = (context: FunctionContext, callbackData:
|
|
1296
|
+
export type IceHandler = (context: FunctionContext, callbackData: IceCallback) => Promise<SvamletResponse>;
|
|
1250
1297
|
/**
|
|
1251
1298
|
* ACE (Answered Call Event) handler
|
|
1252
1299
|
*/
|
|
1253
|
-
export type AceHandler = (context: FunctionContext, callbackData:
|
|
1300
|
+
export type AceHandler = (context: FunctionContext, callbackData: AceCallback) => Promise<SvamletResponse>;
|
|
1254
1301
|
/**
|
|
1255
1302
|
* PIE (Prompt Input Event) handler
|
|
1256
1303
|
*/
|
|
1257
|
-
export type PieHandler = (context: FunctionContext, callbackData:
|
|
1304
|
+
export type PieHandler = (context: FunctionContext, callbackData: PieCallback) => Promise<SvamletResponse>;
|
|
1258
1305
|
/**
|
|
1259
1306
|
* DICE (Disconnect Call Event) handler
|
|
1260
1307
|
*/
|
|
1261
|
-
export type DiceHandler = (context: FunctionContext, callbackData:
|
|
1308
|
+
export type DiceHandler = (context: FunctionContext, callbackData: DiceCallback) => Promise<void>;
|
|
1262
1309
|
/**
|
|
1263
1310
|
* Notify handler
|
|
1264
1311
|
*/
|
|
1265
|
-
export type NotifyHandler = (context: FunctionContext, callbackData:
|
|
1312
|
+
export type NotifyHandler = (context: FunctionContext, callbackData: NotifyCallback) => Promise<void>;
|
|
1266
1313
|
/**
|
|
1267
1314
|
* Voice function export structure
|
|
1268
1315
|
*
|
|
@@ -1272,12 +1319,11 @@ export type NotifyHandler = (context: FunctionContext, callbackData: Voice.Notif
|
|
|
1272
1319
|
*
|
|
1273
1320
|
* @example
|
|
1274
1321
|
* ```typescript
|
|
1275
|
-
* import type { VoiceFunction } from '@sinch/functions-runtime';
|
|
1276
|
-
* import type { Voice } from '@sinch/voice';
|
|
1322
|
+
* import type { VoiceFunction, IceCallback } from '@sinch/functions-runtime';
|
|
1277
1323
|
*
|
|
1278
1324
|
* export default {
|
|
1279
|
-
* async ice(context, data:
|
|
1280
|
-
* const { cli, to } = data;
|
|
1325
|
+
* async ice(context, data: IceCallback) {
|
|
1326
|
+
* const { cli, to, callId } = data;
|
|
1281
1327
|
* return createIceBuilder().hangup().build();
|
|
1282
1328
|
* }
|
|
1283
1329
|
* } satisfies VoiceFunction;
|
|
@@ -2534,48 +2580,6 @@ export declare class DefaultEndpointHandler {
|
|
|
2534
2580
|
* TypeScript projects compile to dist/function.js
|
|
2535
2581
|
*/
|
|
2536
2582
|
export declare function findFunctionPath(): string;
|
|
2537
|
-
/** ICE callback payload as delivered to your handler (`callid` normalized to `callId`). */
|
|
2538
|
-
export type IceCallback = Omit<Voice.IceRequest, "callid"> & {
|
|
2539
|
-
callId?: string;
|
|
2540
|
-
};
|
|
2541
|
-
/** ACE callback payload as delivered to your handler. */
|
|
2542
|
-
export type AceCallback = Omit<Voice.AceRequest, "callid"> & {
|
|
2543
|
-
callId?: string;
|
|
2544
|
-
};
|
|
2545
|
-
/** PIE callback payload as delivered to your handler. */
|
|
2546
|
-
export type PieCallback = Omit<Voice.PieRequest, "callid"> & {
|
|
2547
|
-
callId?: string;
|
|
2548
|
-
};
|
|
2549
|
-
/** DICE callback payload as delivered to your handler. */
|
|
2550
|
-
export type DiceCallback = Omit<Voice.DiceRequest, "callid"> & {
|
|
2551
|
-
callId?: string;
|
|
2552
|
-
};
|
|
2553
|
-
/** NOTIFY callback payload as delivered to your handler. */
|
|
2554
|
-
export type NotifyCallback = Omit<Voice.NotifyRequest, "callid"> & {
|
|
2555
|
-
callId?: string;
|
|
2556
|
-
};
|
|
2557
|
-
/** @deprecated Import from '@sinch/voice' instead: `import type { Voice } from '@sinch/voice'` then use `Voice.IceRequest` @internal */
|
|
2558
|
-
export type IceCallbackData = Voice.IceRequest;
|
|
2559
|
-
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
2560
|
-
export type AceCallbackData = Voice.AceRequest;
|
|
2561
|
-
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
2562
|
-
export type PieCallbackData = Voice.PieRequest;
|
|
2563
|
-
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
2564
|
-
export type DiceCallbackData = Voice.DiceRequest;
|
|
2565
|
-
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
2566
|
-
export type NotifyCallbackData = Voice.NotifyRequest;
|
|
2567
|
-
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
2568
|
-
export type MenuResult = Voice.MenuResult;
|
|
2569
|
-
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
2570
|
-
export type AmdResult = Voice.AnsweringMachineDetection;
|
|
2571
|
-
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
2572
|
-
export type DisconnectReason = Voice.DiceReasonEnum;
|
|
2573
|
-
/** @deprecated Import from '@sinch/voice' instead @internal */
|
|
2574
|
-
export type CallResult = Voice.ResultEnum;
|
|
2575
|
-
/**
|
|
2576
|
-
* Union type for all voice callback data
|
|
2577
|
-
*/
|
|
2578
|
-
export type VoiceCallbackData = Voice.IceRequest | Voice.AceRequest | Voice.PieRequest | Voice.DiceRequest | Voice.NotifyRequest;
|
|
2579
2583
|
/**
|
|
2580
2584
|
* Local cache client for development
|
|
2581
2585
|
*
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sinch/functions-runtime",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "Development runtime for Sinch Functions - serverless voice applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"url": "https://sinch.com/support"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
|
-
"node": ">=
|
|
46
|
+
"node": ">=24.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@sinch/sdk-core": "^1.3.0",
|