Skip to content

Conversation

@Convly
Copy link
Member

@Convly Convly commented Dec 20, 2024

What does it do?

  • adds a dependency to the npm debug package (54kB) and supports-color (10kB)
  • introduce debug logs for critical parts of the SDK lifecycle (initialization, validation, http client, auth, content-type managers)

Also

  • fix repo configuration around lint, tests and pre-commit scripts

Why is it needed?

Better traceability and maintainability of the codebase.

Easier issue management/reproduction with finegrained logs

How to test it?

DEBUG=* node main.js # debug everything
DEBUG=sdk:auth:* node main.js # debug every auth module
DEBUG=sdj:ct:* node main.js # debug content type managers
DEBUG=*,-sdk:validators:* node main.js # debug everything except validators

TODO

  • add documentation

@Convly Convly added pr: feature New or updates to features source: client Source is the main client object labels Dec 20, 2024
Copy link
Contributor

@innerdvations innerdvations left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I didn't test it out, but code lgtm.

Comment on lines 224 to +231

private setContentTypeHeader(request: Request) {
const [key, value] = ['Content-Type', 'application/json'];

request.headers.set(key, value);

debug('%o header set to %o for %o', key, value, RequestHelper.format(request));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? Could we instead have a setHeader(key, value)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where would the log originate from? RequestHelper.setHeader(req, name, value) or from the http client when it calls it?

Let's continue the discussion and possibly add this in a later PR

@Convly Convly merged commit 3151d0d into main Dec 26, 2024
7 checks passed
@Convly Convly deleted the feat/debug branch December 26, 2024 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: feature New or updates to features source: client Source is the main client object

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants