functionless
functionless copied to clipboard
Lambda: detect transitive dependencies from higher-order functions
We currently do not support detecting dependencies to infer IAM Policies and automate environment variable/client instantiation if the dependency is contained within another function called by the closure.
- [ ] detect dependencies used by another function (declared outside of its scope)
const table = new Table(..);
function foo() {
return $AWS.DynamoDB.GetItem({
Table: table,
...
});
}
new Function(scope, id, () => {
return foo();
});
- [ ] detect dependencies passed to a function as input
function foo(table: Table) {
return $AWS.DynamoDB.GetItem({
Table: table,
...
});
}
const table = new Table(..);
new Function(scope, id, () => {
// dependency passed to foo
return foo(table);
});
- [ ] detect dependencies returned from another funciton
const table = new Table(..);
function getTable() {
return table;
}
new Function(scope, id, () => {
return $AWS.DynamoDB.GetItem({
// dependency returned by a function call
Table: getTable(),
...
});
});
The "Integration" term is inclusive of all cases here right?
The "Integration" term is inclusive of all cases here right?
Not sure what you mean
I mean the goal is a bit simpler, "find all integrations and apply them based on their contract" (bind, pre-warm, maybe call)
Same as #350 ?
declare const table1;
declare const table2;
declare const table3;
function getTables(table1) {
return [table1, table2, table3]
}
const tables = getTables(table1);
for (const table of tables) {
$AWS.DynamoDB.GetItem({
Table: table,
})
}