Skip to content

Commit a82cc65

Browse files
committed
feat(EWT-1376): adds logic to create and wait for the SQL session
currently this async work is happening internal to the Connection constructor, but going forward we might want to refactor it to some sort of static factory that returns a Promise for a Connection instance so that async behavior is more explicit. brought in `fetch-retry` to manage the polling over http. this library is probably overkill for this initial use case, but i think it will make itself worthwhile when we later add in timeouts and retries in case of unavailability errors brought in `pino` for logging. it seems lightweight enough for the way we're using it now as a debugging tool, but also something we can grow into. i find its API a little awkward, so might also keep my eye out for a replacement down the line. i pinkie-promise the next PR will be unit tests
1 parent ca25b35 commit a82cc65

10 files changed

+615
-58
lines changed

.eslintrc.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
"rules": {
99
"node/no-unsupported-features/es-syntax": "off",
1010
// no-missing-import gets confused by typescript `paths`
11-
"node/no-missing-import": "off"
11+
"node/no-missing-import": "off",
12+
"@typescript-eslint/no-unused-vars": [
13+
"error",
14+
{
15+
"ignoreRestSiblings": true
16+
}
17+
]
1218
}
1319
}

examples/connectionWithDefaults.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
// run with: node -r @swc-node/register examples/connectionWithDefaults.ts
1+
/*
2+
* run with:
3+
4+
* `WHEROBOTS_API_KEY=<api key> node -r @swc-node/register examples/connectionWithDefaults.ts`
5+
*
6+
* or for verbose logging:
7+
*
8+
* `NODE_DEBUG="wherobots" WHEROBOTS_API_KEY=<api key> node -r @swc-node/register examples/connectionWithDefaults.ts`
9+
*/
210

311
import { Connection, Runtime } from "@/index";
412

513
const conn = new Connection({
6-
apiKey: "00000000-0000-0000-0000-000000000000",
14+
apiKey:
15+
process.env["WHEROBOTS_API_KEY"] || "00000000-0000-0000-0000-000000000000",
716
runtime: Runtime.SEDONA,
817
});
918

0 commit comments

Comments
 (0)