1 |
|
2 |
|
3 |
|
4 | import {
|
5 | CosmosDBInput,
|
6 | CosmosDBInputOptions,
|
7 | FunctionInput,
|
8 | GenericInputOptions,
|
9 | SqlInput,
|
10 | SqlInputOptions,
|
11 | StorageBlobInput,
|
12 | StorageBlobInputOptions,
|
13 | TableInput,
|
14 | TableInputOptions,
|
15 | } from '@azure/functions';
|
16 | import { addBindingName } from './addBindingName';
|
17 |
|
18 | export function storageBlob(options: StorageBlobInputOptions): StorageBlobInput {
|
19 | return addInputBindingName({
|
20 | ...options,
|
21 | type: 'blob',
|
22 | });
|
23 | }
|
24 |
|
25 | export function table(options: TableInputOptions): TableInput {
|
26 | return addInputBindingName({
|
27 | ...options,
|
28 | type: 'table',
|
29 | });
|
30 | }
|
31 |
|
32 | export function cosmosDB(options: CosmosDBInputOptions): CosmosDBInput {
|
33 | return addInputBindingName({
|
34 | ...options,
|
35 | type: 'cosmosDB',
|
36 | });
|
37 | }
|
38 |
|
39 | export function sql(options: SqlInputOptions): SqlInput {
|
40 | return addInputBindingName({
|
41 | ...options,
|
42 | type: 'sql',
|
43 | });
|
44 | }
|
45 |
|
46 | export function generic(options: GenericInputOptions): FunctionInput {
|
47 | return addInputBindingName(options);
|
48 | }
|
49 |
|
50 | function addInputBindingName<T extends { type: string; name?: string }>(binding: T): T & { name: string } {
|
51 | return addBindingName(binding, 'Input');
|
52 | }
|