-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* rpc http cookies * take out log in nodejs worker * Updated subtree from https://github.com/azure/azure-functions-language-worker-protobuf. Branch: dev. Commit:bd4379767d6c25be59dfbe91dc57f6c03af9968b Tag: v1.1.0 * fixde merged conflict * add test * addressing cr comments * add comment * added comments * nit * unit tests * start of e2e tests * tests and change behavior to throw instead of warn * add pst for machines... really should never use expire * http expires * test
- Loading branch information
Showing
24 changed files
with
826 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
azure-functions-language-worker-protobuf/src/proto/identity/ClaimsIdentityRpc.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
azure-functions-language-worker-protobuf/src/proto/shared/NullableString.proto
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
azure-functions-language-worker-protobuf/src/proto/shared/NullableTypes.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
syntax = "proto3"; | ||
// protobuf vscode extension: https://marketplace.visualstudio.com/items?itemName=zxh404.vscode-proto3 | ||
|
||
import "google/protobuf/timestamp.proto"; | ||
|
||
message NullableString { | ||
oneof string { | ||
string value = 1; | ||
} | ||
} | ||
|
||
message NullableDouble { | ||
oneof double { | ||
double value = 1; | ||
} | ||
} | ||
|
||
message NullableBool { | ||
oneof bool { | ||
bool value = 1; | ||
} | ||
} | ||
|
||
message NullableTimestamp { | ||
oneof timestamp { | ||
google.protobuf.Timestamp value = 1; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { AzureFunctionsRpcMessages as rpc } from '../../azure-functions-language-worker-protobuf/src/rpc'; | ||
import { FunctionInfo } from '../FunctionInfo'; | ||
import { Dict } from '../Context'; | ||
import { BindingDefinition } from '../public/Interfaces'; | ||
import { fromTypedData } from './RpcConverters'; | ||
|
||
type BindingDirection = 'in' | 'out' | 'inout' | undefined; | ||
|
||
export function getBindingDefinitions(info: FunctionInfo): BindingDefinition[] { | ||
let bindings = info.bindings; | ||
if (!bindings) { | ||
return []; | ||
} | ||
|
||
return Object.keys(bindings) | ||
.map(name => { return { | ||
name: name, | ||
type: bindings[name].type || "", | ||
direction: getDirectionName(bindings[name].direction) | ||
}; | ||
}); | ||
} | ||
|
||
export function getNormalizedBindingData(request: rpc.IInvocationRequest): Dict<any> { | ||
let bindingData: Dict<any> = { | ||
invocationId: request.invocationId | ||
}; | ||
// node binding data is camel cased due to language convention | ||
if (request.triggerMetadata) { | ||
Object.assign(bindingData, convertKeysToCamelCase(request.triggerMetadata)) | ||
} | ||
return bindingData; | ||
} | ||
|
||
function getDirectionName(direction: rpc.BindingInfo.Direction|null|undefined): BindingDirection { | ||
let directionName = Object.keys(rpc.BindingInfo.Direction).find(k => rpc.BindingInfo.Direction[k] === direction); | ||
return isBindingDirection(directionName)? directionName as BindingDirection : undefined; | ||
} | ||
|
||
function isBindingDirection(input: string | undefined): boolean { | ||
return (input == 'in' || input == 'out' || input == 'inout') | ||
} | ||
|
||
// Recursively convert keys of objects to camel case | ||
function convertKeysToCamelCase(obj: any) { | ||
var output = {}; | ||
for (var key in obj) { | ||
let value = fromTypedData(obj[key]) || obj[key]; | ||
let camelCasedKey = key.charAt(0).toLocaleLowerCase() + key.slice(1); | ||
// If the value is a JSON object (and not array and not http, which is already cased), convert keys to camel case | ||
if (!Array.isArray(value) && typeof value === 'object' && value && value.http == undefined) { | ||
output[camelCasedKey] = convertKeysToCamelCase(value); | ||
} else { | ||
output[camelCasedKey] = value; | ||
} | ||
} | ||
return output; | ||
} |
Oops, something went wrong.