1 |
|
2 |
|
3 |
|
4 | import {
|
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';
|
28 | import { addBindingName } from './addBindingName';
|
29 |
|
30 | export function http(options: HttpOutputOptions): HttpOutput {
|
31 | return addOutputBindingName({
|
32 | ...options,
|
33 | type: 'http',
|
34 | });
|
35 | }
|
36 |
|
37 | export function storageBlob(options: StorageBlobOutputOptions): StorageBlobOutput {
|
38 | return addOutputBindingName({
|
39 | ...options,
|
40 | type: 'blob',
|
41 | });
|
42 | }
|
43 |
|
44 | export function table(options: TableOutputOptions): TableOutput {
|
45 | return addOutputBindingName({
|
46 | ...options,
|
47 | type: 'table',
|
48 | });
|
49 | }
|
50 |
|
51 | export function storageQueue(options: StorageQueueOutputOptions): StorageQueueOutput {
|
52 | return addOutputBindingName({
|
53 | ...options,
|
54 | type: 'queue',
|
55 | });
|
56 | }
|
57 |
|
58 | export function serviceBusQueue(options: ServiceBusQueueOutputOptions): ServiceBusQueueOutput {
|
59 | return addOutputBindingName({
|
60 | ...options,
|
61 | type: 'serviceBus',
|
62 | });
|
63 | }
|
64 |
|
65 | export function serviceBusTopic(options: ServiceBusTopicOutputOptions): ServiceBusTopicOutput {
|
66 | return addOutputBindingName({
|
67 | ...options,
|
68 | type: 'serviceBus',
|
69 | });
|
70 | }
|
71 |
|
72 | export function eventHub(options: EventHubOutputOptions): EventHubOutput {
|
73 | return addOutputBindingName({
|
74 | ...options,
|
75 | type: 'eventHub',
|
76 | });
|
77 | }
|
78 |
|
79 | export function eventGrid(options: EventGridOutputOptions): EventGridOutput {
|
80 | return addOutputBindingName({
|
81 | ...options,
|
82 | type: 'eventGrid',
|
83 | });
|
84 | }
|
85 |
|
86 | export function cosmosDB(options: CosmosDBOutputOptions): CosmosDBOutput {
|
87 | return addOutputBindingName({
|
88 | ...options,
|
89 | type: 'cosmosDB',
|
90 | });
|
91 | }
|
92 |
|
93 | export function sql(options: SqlOutputOptions): SqlOutput {
|
94 | return addOutputBindingName({
|
95 | ...options,
|
96 | type: 'sql',
|
97 | });
|
98 | }
|
99 |
|
100 | export function generic(options: GenericOutputOptions): FunctionOutput {
|
101 | return addOutputBindingName(options);
|
102 | }
|
103 |
|
104 | function addOutputBindingName<T extends { type: string; name?: string }>(binding: T): T & { name: string } {
|
105 | return addBindingName(binding, 'Output');
|
106 | }
|