Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor/node api design changes (#459)
* refactor(node): first pass at changing API design away from express middleware * refactor(node): add support for nested express urls via req.originalUrl * refactor(node): remove unneeded test to do with grouping function * refactor(node): fix up bufferLength tests * refactor(node): move get-project-base-url tests elsewhere I think we'll have to tell people to call this manually now, since we can't perform an asynchronous lookup without asking them to `await` the call to the function, which will look kinda bad and like we're blocking. * refactor(node): get `res._body` tests working * refactor(node): get `req.body` tests working * refactor(node): tidy up tests * refactor(node): add some tests for the validation errors * refactor(node): tidy up * refactor(node): fix up other tests * refactor(node): rename default export to readmeio.log() Remove existing readmeio.log() implementation, this should be possible to be done via this default function now * refactor(node): tidy up * refactor(node): switch from using default export For some reason this meant that in commonjs you had to do the following 🤮: ```js const readmeio = require('readmeio').default ``` The way I've done it now, it works in ts-node as I expect, but for some reason I have to do this in the tests: ```js import * as readmeio from '../src'; ``` I have no idea why 🤷♂️ @ilias-t any ideas here? * refactor(integration): updating express app to use new method signature * refactor(node): add test showing usage of calling getProjectBaseUrl() first * refactor(integration): remove unused lint rule * refactor(integration): update hapi code sample to use new api * chore: lint * test: add test for har `pageref` * chore: lint * feat: return with the logId from readme.log() function * chore: lint after `main` branch merge * chore: fix some tests due to missing dependency * refactor: remove `getProjectBaseUrl()` function * refactor: removing express type dependency from logging functions * refactor: remove seemingly unused code We already have a test for this which passes with this code commented out: https://github.com/readmeio/metrics-sdks/blob/e0576f460d66f9ab23cfd2bc22b8f65c5dd01cb1/packages/node/__tests__/index.test.ts#L210-L247 I think this is being handled here: https://github.com/readmeio/metrics-sdks/blob/e0576f460d66f9ab23cfd2bc22b8f65c5dd01cb1/packages/node/src/lib/process-request.ts#L181-L184 * feat(integration): add POST method test Right now the hapi/fastify examples are not working properly for accepting an incoming POST body. This adds a test to expose that flaw, but does not yet fix it. I think this refactor makes the most sense to finish once #459 is merged in. * fix(integration): update hapi test with new api design * fix(integration): get fastify demo working with new api design Make the hapi/express examples more consistent with each other * chore: code comment about raw.setHeaders piece * fix(integration): forgot to re-export verifyWebhook after refactor * feat(integration): add support for POST methods to php and c# * feat(integration): add support for POST methods to python/flask This is dependent on #557 being merged because currently the POST data implementation is broken in the Python SDK * chore(python): lint * chore: temp fix php integration test This can be reverted when #560 is merged in * refactor(node): switch to using spread operator instead of arr.slice() * Update .github/MAINTAINERS.md Co-authored-by: Jon Ursenbach <[email protected]> * chore: updated comment to be clearer Co-authored-by: Jon Ursenbach <[email protected]>
- Loading branch information