UNPKG

2.5 kBTypeScriptView Raw
1// Copyright (c) .NET Foundation. All rights reserved.
2// Licensed under the MIT License.
3
4import { FunctionInput, FunctionOptions, FunctionOutput, FunctionResult, FunctionTrigger } from './index';
5import { InvocationContext } from './InvocationContext';
6
7export type StorageBlobHandler = (blob: unknown, context: InvocationContext) => FunctionResult;
8export type StorageQueueHandler = (queueEntry: unknown, context: InvocationContext) => FunctionResult;
9
10export interface StorageBlobFunctionOptions extends StorageBlobTriggerOptions, Partial<FunctionOptions> {
11 handler: StorageBlobHandler;
12
13 trigger?: StorageBlobTrigger;
14}
15
16export interface StorageQueueFunctionOptions extends StorageQueueTriggerOptions, Partial<FunctionOptions> {
17 handler: StorageQueueHandler;
18
19 trigger?: StorageQueueTrigger;
20}
21
22export interface StorageBlobOptions {
23 /**
24 * The path to the blob container, for example "samples-workitems/{name}"
25 */
26 path: string;
27
28 /**
29 * An app setting (or environment variable) with the storage connection string to be used by this blob input or output
30 */
31 connection: string;
32}
33
34export interface StorageQueueOptions {
35 /**
36 * The queue name
37 */
38 queueName: string;
39
40 /**
41 * An app setting (or environment variable) with the storage connection string to be used by this queue input or output
42 */
43 connection: string;
44}
45
46export interface StorageBlobTriggerOptions extends StorageBlobOptions {
47 /**
48 * The source of the triggering event.
49 * Use `EventGrid` for an Event Grid-based blob trigger, which provides much lower latency.
50 * The default is `LogsAndContainerScan`, which uses the standard polling mechanism to detect changes in the container.
51 */
52 source?: 'EventGrid' | 'LogsAndContainerScan';
53}
54export type StorageBlobTrigger = FunctionTrigger & StorageBlobTriggerOptions;
55
56export type StorageBlobInputOptions = StorageBlobOptions;
57export type StorageBlobInput = FunctionInput & StorageBlobInputOptions;
58
59export type StorageBlobOutputOptions = StorageBlobOptions;
60export type StorageBlobOutput = FunctionOutput & StorageBlobOutputOptions;
61
62export type StorageQueueTriggerOptions = StorageQueueOptions;
63export type StorageQueueTrigger = FunctionTrigger & StorageQueueTriggerOptions;
64
65export type StorageQueueOutputOptions = StorageQueueOptions;
66export type StorageQueueOutput = FunctionOutput & StorageQueueOutputOptions;