UNPKG

2.77 kBPlain TextView Raw
1// Copyright (c) .NET Foundation. All rights reserved.
2// Licensed under the MIT License.
3
4import {
5 CosmosDBOutput,
6 CosmosDBOutputOptions,
7 EventGridOutput,
8 EventGridOutputOptions,
9 EventHubOutput,
10 EventHubOutputOptions,
11 FunctionOutput,
12 GenericOutputOptions,
13 HttpOutput,
14 HttpOutputOptions,
15 ServiceBusQueueOutput,
16 ServiceBusQueueOutputOptions,
17 ServiceBusTopicOutput,
18 ServiceBusTopicOutputOptions,
19 SqlOutput,
20 SqlOutputOptions,
21 StorageBlobOutput,
22 StorageBlobOutputOptions,
23 StorageQueueOutput,
24 StorageQueueOutputOptions,
25 TableOutput,
26 TableOutputOptions,
27} from '@azure/functions';
28import { addBindingName } from './addBindingName';
29
30export function http(options: HttpOutputOptions): HttpOutput {
31 return addOutputBindingName({
32 ...options,
33 type: 'http',
34 });
35}
36
37export function storageBlob(options: StorageBlobOutputOptions): StorageBlobOutput {
38 return addOutputBindingName({
39 ...options,
40 type: 'blob',
41 });
42}
43
44export function table(options: TableOutputOptions): TableOutput {
45 return addOutputBindingName({
46 ...options,
47 type: 'table',
48 });
49}
50
51export function storageQueue(options: StorageQueueOutputOptions): StorageQueueOutput {
52 return addOutputBindingName({
53 ...options,
54 type: 'queue',
55 });
56}
57
58export function serviceBusQueue(options: ServiceBusQueueOutputOptions): ServiceBusQueueOutput {
59 return addOutputBindingName({
60 ...options,
61 type: 'serviceBus',
62 });
63}
64
65export function serviceBusTopic(options: ServiceBusTopicOutputOptions): ServiceBusTopicOutput {
66 return addOutputBindingName({
67 ...options,
68 type: 'serviceBus',
69 });
70}
71
72export function eventHub(options: EventHubOutputOptions): EventHubOutput {
73 return addOutputBindingName({
74 ...options,
75 type: 'eventHub',
76 });
77}
78
79export function eventGrid(options: EventGridOutputOptions): EventGridOutput {
80 return addOutputBindingName({
81 ...options,
82 type: 'eventGrid',
83 });
84}
85
86export function cosmosDB(options: CosmosDBOutputOptions): CosmosDBOutput {
87 return addOutputBindingName({
88 ...options,
89 type: 'cosmosDB',
90 });
91}
92
93export function sql(options: SqlOutputOptions): SqlOutput {
94 return addOutputBindingName({
95 ...options,
96 type: 'sql',
97 });
98}
99
100export function generic(options: GenericOutputOptions): FunctionOutput {
101 return addOutputBindingName(options);
102}
103
104function addOutputBindingName<T extends { type: string; name?: string }>(binding: T): T & { name: string } {
105 return addBindingName(binding, 'Output');
106}