-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathgetScriptVerifiedTemplateIds.ts
More file actions
49 lines (44 loc) · 2.47 KB
/
getScriptVerifiedTemplateIds.ts
File metadata and controls
49 lines (44 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { FuncVersion } from '../../FuncVersion';
export function getScriptVerifiedTemplateIds(version: string): (string | RegExp)[] {
let verifiedTemplateIds: string[] = [
'BlobTrigger',
'HttpTrigger',
'QueueTrigger',
'TimerTrigger'
];
if (version === FuncVersion.v1) {
verifiedTemplateIds = verifiedTemplateIds.concat([
'GenericWebHook',
'GitHubWebHook',
'HttpTriggerWithParameters',
'ManualTrigger'
]);
return verifiedTemplateIds.map(t => `${t}-JavaScript`);
} else {
// For JavaScript, only include triggers that require extensions in v2. v1 doesn't have the same support for 'func extensions install'
verifiedTemplateIds = verifiedTemplateIds.concat([
'CosmosDBTrigger',
'DurableFunctionsActivity',
'DurableFunctionsHttpStart',
'DurableFunctionsOrchestrator',
'EventGridTrigger',
'EventHubTrigger',
'ServiceBusQueueTrigger',
'ServiceBusTopicTrigger',
'SendGrid',
'IoTHubTrigger',
]);
// These languages are only supported in v2+ - same functions as JavaScript, with a few minor exceptions that aren't worth distinguishing here
// NOTE: The Python Preview IDs are only temporary.
// NOTE: The Node Programming Model IDs include -4.x as a suffix
const regExps = verifiedTemplateIds.map(t => new RegExp(`^${t}-(JavaScript(-4.x)?|TypeScript(-4.x)?|Python|PowerShell|Custom|Python-Preview|Python-Preview-Append)$`, 'i'));
// The Entity templates aren't supported in PowerShell at all, and the DurableFunctionsEntityHttpStart template is not yet supported in Python.
// As a result, we need to manually create their respective regular expressions to account for these edge cases
const entityRegExps = [new RegExp(`^DurableFunctionsEntity-(JavaScript(-4.x)?|TypeScript(-4.x)?|Python|Custom)$`, 'i'), new RegExp(`^DurableFunctionsEntityHttpStart-(JavaScript(-4.x)?|TypeScript(-4.x)?|Custom)$`, 'i')];
return regExps.concat(entityRegExps);
}
}