Skip to content

v1.6.0 — TypeScript fixes and custom fetch support

Latest

Choose a tag to compare

@fureweb-com fureweb-com released this 21 Oct 13:02
56c2977

v1.6.0 fixes TypeScript declaration and import errors, adds optional custom fetch support, and makes error handling and package verification more reliable. Existing CommonJS and default-import usage is preserved.

Fixes for package consumers

  • TypeScript declaration error (#55): remove initializers that are invalid in .d.ts ambient declarations, fixing Initializers are not allowed in ambient contexts.
  • TypeScript constructor/import error (#57): align the declaration's CommonJS export with the actual exported class, fixing TS2351: This expression is not constructable in the affected import scenarios. Compiled CommonJS and ESM TypeScript consumers are verified.
  • Response body failures: handle a rejected response.text() promise inside the request error handler. parse() now returns an empty array for this failure, consistently with other handled request failures.
  • Malformed Google Sheets responses: check that the expected callback payload exists before extracting it; responses without that payload return an empty array directly.
  • Option objects: use a safe own-property check so options created with Object.create(null) or an overridden hasOwnProperty do not break option updates. Explicit false values remain supported.

Added

  • A real named export: PublicGoogleSheetsParser is available from both the source entry point and the built bundle, alongside the existing CommonJS constructor and default export.
  • Optional fetch injection: pass a request function in the constructor options or through setOption({ fetch }). This supports offline fixtures or caller-provided logging/retry behavior. Changing unrelated options retains the injected function. Omitting it keeps the existing browser/Node transport.
import { PublicGoogleSheetsParser } from 'public-google-sheets-parser'

const parser = new PublicGoogleSheetsParser('YOUR_SPREADSHEET_ID', {
  fetch: (url) => fetch(url)
})

const rows = await parser.parse()

The injected function receives the request URL and returns a promise for a response with ok and an asynchronous text() method. Automatic retries are not added by this release; they can be implemented in the supplied function.

Test and build improvements

  • Make dist/integration test commands and coverage execution work on Windows as well as Linux.
  • Replace live-network dependence in the default tests with deterministic fixtures while exercising the real parser and transport. Keep live Google Sheets integration checks available separately.
  • Add regression checks for exports, request failures, GID selection, options, formatting, and browser usage. These checks protect existing behavior as well as the fixes above.
  • Pin TypeScript for reproducible CommonJS/ESM consumer compilation and runtime checks.
  • Run CI on Ubuntu and Windows with Node.js 22 and 24. Enforce 100% statement, branch, function, and line coverage.

Upgrade and verification

npm install public-google-sheets-parser@1.6.0

The new fetch option is optional; existing constructor and parse() calls can continue unchanged. The package still has no runtime dependencies.

  • CI run: all four environment jobs and both Codecov checks passed.
  • Built and validated the actual npm tarball from the v1.6.0 tag before publication.
  • Installed the published package into a new consumer project with an empty npm cache. CommonJS/ESM exports, TypeScript compilation/runtime, the browser bundle, and live Google Sheets queries passed.
  • Verified that registry integrity matches the tested tarball, latest points to 1.6.0, and jsDelivr/unpkg serve the same versioned browser bundle.

Release references