Comments (3)
After thinking about this, I think it's unacceptable that old adaptors should be totally incompatible with the new runtime.
I think the compiler should add the magic to export an execute function. The runtime will use the job's exported execute
, if it exists (and print a warning about it).
Which means automated imports probably need to look something like this:
import * as adaptor from '@openfn/language-postgres';
const { get, put, execute } = adaptor;
export execute; // is that even legal if adaptor is undefined?
export default[get(state.url)];
Later, we can add intelligence to only do this for language-adaptors which we know override execute. Although this relies on the adaptor having a .d.ts really, so maybe we invert the logic and do this unless a) the package has a .d.ts and b) the d.ts does not export execute).
New adaptors should still register side-effects from @openfn/runtime on import.
from kit.
Hang on, a way easier fix is just to export everything:
import { upsert } from "@openfn/language-postgres";
export * from "@openfn/language-postgres";
export default [upsert(state.data.incoming]);
from kit.
Ok, so live on v2
at the moment we have a working strategy for legacy adaptors.
If exportAll
is truthy on compilerOptions['add-imports'].adaptor, then an export default
statement is added for the adaptor. This is always enabled in the CLI, so jobs compiled through the CLI will always export * from adaptor
.
If a job exports a function called execute
, the runtime will use that function instead of its built-in one.
Next steps are to implement the lifecycle features described in #25.
from kit.
Related Issues (20)
- Ensure prettier is automatically set up for new developers
- Rethink CircleCI workflow triggers
- Logger: support console.table
- Update lightning plan options to use snake case keys
- CLI: apollo command
- CLI: add better validation on workflows HOT 7
- Lazy state fails on function calls HOT 1
- Check that worker timeouts are actually working as planned HOT 1
- Auto-deploy worker to demo and staging
- Worker: do something better when the JWT expires
- Worker: better error messages on credentials HOT 1
- Runtime: support multiple inputs
- worker: if a module fails to load, that's a crash
- cli: make apollo user-friendly
- cli: unit tests for apollo command
- Update prettier to 3.x
- lazy state: doesn't work with ! expressionbs HOT 1
- CLI: add a `schema` command which prints configuration schema
- CLI: Config issues with pull HOT 1
- CLI Deploy: bad error message if project yaml has a workflow not in state json
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kit.