Skip to content

Fix build typings and default API URL#2

Open
slegarraga wants to merge 1 commit into
Hashlock-Tech:mainfrom
slegarraga:fix-build-node-types-default-api
Open

Fix build typings and default API URL#2
slegarraga wants to merge 1 commit into
Hashlock-Tech:mainfrom
slegarraga:fix-build-node-types-default-api

Conversation

@slegarraga

@slegarraga slegarraga commented Jun 11, 2026

Copy link
Copy Markdown

Summary

  • add Node ambient types so tsc can resolve the package's process and fetch globals
  • make getConfig() use the documented https://api.hashlock.markets default when HASHLOCK_API_URL is not set
  • keep HASHLOCK_API_KEY required

Before this change, npm run build fails with TS2580 for process and TS2304 for fetch.

Validation

  • npm install --no-package-lock
  • npm run build
  • HASHLOCK_API_KEY=test node -e "const { getConfig } = require('./dist/index.js'); const cfg = getConfig(); console.log(JSON.stringify(cfg));"

Summary by CodeRabbit

  • New Features

    • API URL configuration is now optional and defaults to https://api.hashlock.markets when not provided
    • Configuration simplified—only API key is required
  • Chores

    • Added TypeScript type definitions support for Node.js environments

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0f5ac88e-675b-4754-96d8-90fea7546e2c

📥 Commits

Reviewing files that changed from the base of the PR and between b8869d7 and bb8ec93.

📒 Files selected for processing (2)
  • package.json
  • src/index.ts

📝 Walkthrough

Walkthrough

This PR adds a default API URL fallback to the SDK configuration, relaxes validation to require only an API key, and explicitly exports the public configuration type and functions. It also adds TypeScript node type definitions to development dependencies.

Changes

SDK Configuration and API Surface

Layer / File(s) Summary
Configuration defaults and public API
src/index.ts
getConfig defaults apiUrl to https://api.hashlock.markets when not provided and validates only apiKey presence. Module exports HashlockConfig type alongside hashlockPost and getConfig functions.
Development dependencies
package.json
@types/node added to devDependencies for TypeScript node runtime type support.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A default URL hops into place,
Validation now checks just one case,
The exports shine bright,
Types added just right,
The SDK finds its happy space! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix build typings and default API URL' accurately summarizes the main changes: adding Node types and setting a default API URL.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant