Skip to content

Commit 920bbab

Browse files
committed
Convert namespaces to modules
1 parent cc62a12 commit 920bbab

File tree

10 files changed

+10
-42
lines changed

10 files changed

+10
-42
lines changed

src/app.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import * as coreTypes from '@azure/functions-core';
2020
import { CoreInvocationContext, FunctionCallback } from '@azure/functions-core';
2121
import { returnBindingKey, version } from './constants';
2222
import { InvocationModel } from './InvocationModel';
23-
import { output } from './output';
24-
import { trigger } from './trigger';
23+
import * as output from './output';
24+
import * as trigger from './trigger';
2525
import { isTrigger } from './utils/isTrigger';
2626

2727
let coreApi: typeof coreTypes | undefined | null;
@@ -68,7 +68,6 @@ function convertToHttpOptions(
6868
return options;
6969
}
7070

71-
export namespace app {
7271
export function get(name: string, optionsOrHandler: HttpMethodFunctionOptions | HttpHandler): void {
7372
http(name, convertToHttpOptions(optionsOrHandler, 'GET'));
7473
}
@@ -243,4 +242,3 @@ export namespace app {
243242
coreApi.registerFunction({ name, bindings }, <FunctionCallback>options.handler);
244243
}
245244
}
246-
}

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License.
33

4-
export { app } from './app';
4+
export * as app from './app';
55
export { HttpRequest } from './http/HttpRequest';
66
export { HttpResponse } from './http/HttpResponse';
7-
export { input } from './input';
7+
export * as input from './input';
88
export { InvocationContext } from './InvocationContext';
9-
export { output } from './output';
10-
export { trigger } from './trigger';
9+
export * as output from './output';
10+
export * as trigger from './trigger';

src/input.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
} from '@azure/functions';
1212
import { addBindingName } from './addBindingName';
1313

14-
export namespace input {
1514
export function storageBlob(options: StorageBlobInputOptions): StorageBlobInput {
1615
return addInputBindingName({
1716
...options,
@@ -29,7 +28,6 @@ export namespace input {
2928
export function generic(options: GenericInputOptions): FunctionInput {
3029
return addInputBindingName(options);
3130
}
32-
}
3331

3432
function addInputBindingName<T extends { type: string; name?: string }>(binding: T): T & { name: string } {
3533
return addBindingName(binding, 'Input');

src/output.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
} from '@azure/functions';
2424
import { addBindingName } from './addBindingName';
2525

26-
export namespace output {
2726
export function http(options: HttpOutputOptions): HttpOutput {
2827
return addOutputBindingName({
2928
...options,
@@ -83,7 +82,6 @@ export namespace output {
8382
export function generic(options: GenericOutputOptions): FunctionOutput {
8483
return addOutputBindingName(options);
8584
}
86-
}
8785

8886
function addOutputBindingName<T extends { type: string; name?: string }>(binding: T): T & { name: string } {
8987
return addBindingName(binding, 'Output');

src/trigger.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
} from '@azure/functions';
2626
import { addBindingName } from './addBindingName';
2727

28-
export namespace trigger {
2928
export function http(options: HttpTriggerOptions): HttpTrigger {
3029
return addTriggerBindingName({
3130
...options,
@@ -94,7 +93,6 @@ export namespace trigger {
9493
export function generic(options: GenericTriggerOptions): FunctionTrigger {
9594
return addTriggerBindingName(options);
9695
}
97-
}
9896

9997
function addTriggerBindingName<T extends { type: string; name?: string }>(binding: T): T & { name: string } {
10098
return addBindingName(binding, 'Trigger');

types/app.d.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ import { ServiceBusQueueFunctionOptions, ServiceBusTopicFunctionOptions } from '
1010
import { StorageBlobFunctionOptions, StorageQueueFunctionOptions } from './storage';
1111
import { TimerFunctionOptions } from './timer';
1212

13-
/**
14-
* The root namespace for performing operations on your Azure Function App
15-
*/
16-
export namespace app {
1713
/**
1814
* Registers an http function in your app that will be triggered by making a request to the function url
1915
* @param name The name of the function. This will be the route unless a route is explicitly configured in the `HttpTriggerOptions`
@@ -154,4 +150,3 @@ export namespace app {
154150
* @param options Configuration options describing the inputs, outputs, and handler for this function
155151
*/
156152
export function generic(name: string, options: FunctionOptions): void;
157-
}

types/index.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33

44
import { InvocationContext } from './InvocationContext';
55

6-
export * from './app';
6+
export * as app from './app';
77
export * from './cosmosDB';
88
export * from './eventGrid';
99
export * from './eventHub';
1010
export * from './generic';
1111
export * from './http';
12-
export * from './input';
12+
export * as input from './input';
1313
export * from './InvocationContext';
14-
export * from './output';
14+
export * as output from './output';
1515
export * from './serviceBus';
1616
export * from './storage';
1717
export * from './timer';
18-
export * from './trigger';
18+
export * as trigger from './trigger';
1919

2020
/**
2121
* Void if no `return` output is registered

types/input.d.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@ import { GenericInputOptions } from './generic';
66
import { FunctionInput } from './index';
77
import { StorageBlobInput, StorageBlobInputOptions } from './storage';
88

9-
/**
10-
* The root namespace used to help create secondary input configuration ("trigger" is the primary input)
11-
* You can create input config without this namespace, but it provides features like autocomplete, better build errors, and it will set the `name` property for you
12-
* NOTE: Not all triggers can be used as secondary inputs
13-
*/
14-
export namespace input {
159
/**
1610
* [Link to docs and examples](https://docs.microsoft.com/azure/azure-functions/functions-bindings-storage-blob-input?pivots=programming-language-javascript)
1711
*/
@@ -27,4 +21,3 @@ export namespace input {
2721
* Use this method if your desired input type does not already have its own method
2822
*/
2923
export function generic(options: GenericInputOptions): FunctionInput;
30-
}

types/output.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ import {
1515
} from './serviceBus';
1616
import { StorageBlobOutput, StorageBlobOutputOptions, StorageQueueOutput, StorageQueueOutputOptions } from './storage';
1717

18-
/**
19-
* The root namespace used to help create output configuration
20-
* You can create output config without this namespace, but it provides features like autocomplete, better build errors, and it will set the `name` property for you
21-
*/
22-
export namespace output {
2318
/**
2419
* [Link to docs and examples](https://docs.microsoft.com/azure/azure-functions/functions-bindings-http-webhook-output?&pivots=programming-language-javascript)
2520
*/
@@ -65,4 +60,3 @@ export namespace output {
6560
* Use this method if your desired output type does not already have its own method
6661
*/
6762
export function generic(options: GenericOutputOptions): FunctionOutput;
68-
}

types/trigger.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ import {
2121
} from './storage';
2222
import { TimerTrigger, TimerTriggerOptions } from './timer';
2323

24-
/**
25-
* The root namespace used to help create trigger configuration (the primary input)
26-
* You can create trigger config without this namespace, but it provides features like autocomplete, better build errors, and it will set the `name` property for you
27-
*/
28-
export namespace trigger {
2924
/**
3025
* [Link to docs and examples](https://docs.microsoft.com/azure/azure-functions/functions-bindings-http-webhook-trigger?&pivots=programming-language-javascript)
3126
*/
@@ -76,4 +71,3 @@ export namespace trigger {
7671
* Use this method if your desired trigger type does not already have its own method
7772
*/
7873
export function generic(options: GenericTriggerOptions): FunctionTrigger;
79-
}

0 commit comments

Comments
 (0)