@cumulusds/flow-aws-sdk
v2.818.4
Published
flow libdef for aws sdk
Downloads
1,001
Maintainers
Keywords
Readme
aws-sdk libdef
Flow libdef for aws-sdk. The version of this package matches the equivalent aws-sdk version. The types are generated from typescript using flowgen.
To use, add the follow the following lines to the libs
section of .flowconfig
:
[libs]
node_modules/@cumulusds/flow-aws-sdk/index.js
node_modules/@cumulusds/flow-aws-sdk/clients
node_modules/@cumulusds/flow-aws-sdk/lib
The libdef defines the "aws-sdk" module, exporting several client APIs.
import { Lambda } from "aws-sdk";
function(lambda: Lambda) {
// $FlowExpectedError[incompatible-call] FunctionName is missing in object literal but exists in Lambda$InvocationRequest.
lambda.invoke({});
}
The libdef adds name-mangled supporting types (inputs and outputs of APIs) to the global namespace. For example the result of Lambda#invoke
is Lambda$InvocationResponse
:
// @flow
import { Lambda } from "aws-sdk";
const lambda = new Lambda();
function invokeLambda(message: string, lambdaFunctionName: string): Promise<Lambda$InvocationResponse> {
return lambda
.invoke({
InvocationType: "Event",
Payload: message,
FunctionName: lambdaFunctionName,
LogType: "Tail"
})
.promise();
}
The libdef is compatible with flow-bin less than 0.143. In 0.143, import statements are no longer allowed at the toplevel of library files. The flowgen utility needs to be reworked to meet the new requirement.
Use build/upgrade.sh
to rebuild this libdef with a new version of aws-sdk.