Closed josephjclark closed 2 months ago
This job now works:
fn(async (state) => {
const response = await http.get({ url: 'https://jsonplaceholder.typicode.com/todos/1' })(state);
return {
...state,
data: response.data
}
})
Output:
[CLI] ♦ Versions:
▸ node.js 18.12.1
▸ cli 1.1.4
▸ @openfn/language-common latest
[CLI] ✔ Installing packages...
[CLI] ✔ Installation complete in 336ms
[CLI] ✔ Compiled all expressions in workflow
The common.http.¬get function has been deprecated. This adaptor should migrate to use common.util.http instead.
[R/T] ✔ Completed step job-1 in 231ms
[CLI] ✔ Result:
[CLI] ♦ {
"data": {
"userId": 1,
"id": 1,
"title": "delectus aut autem",
"completed": false
}
}
[CLI] ✔ Finished in 650ms ✨
The same job against the production CLI fails (http not defined)
This works with the new common helpers (but only if I edit the adaptor to support the helpers, see https://github.com/OpenFn/adaptors/issues/507 )
fn(async (state) => {
const response = await util.request('GET', 'https://jsonplaceholder.typicode.com/todos/1');
return {
data: response.body
}
})
This PR adds a little fix to
describe-package
which allows us to trackexport * as http from './http'
style export aliases.This has been a big problem and stops us using eg
http.get
in jobs.The problem is that our
wrapped-symbol.ts
, which wraps up a TS symbol into something more manageable, is failing to recognise exports of the typeexport * as
. Two small tweaks towrapped-symbol
fix it.One thing to note is that the generated package description now includes a
namespaces
array as well as afunctions
array. The nice thing about this is that the new exports won't break anything unexpected - we're adding new information to an export, we're not changing existing information,This fix will apply to the CLI and worker.
Related issue
Fixes #238 #363