UNPKG

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