Skip to content

chore: version bump typescript, uuid, ... , fix failing tests and typing issues#646

Open
kings1ay3r wants to merge 1 commit into
cloudevents:mainfrom
kings1ay3r:version-bump-ts-and-uuid
Open

chore: version bump typescript, uuid, ... , fix failing tests and typing issues#646
kings1ay3r wants to merge 1 commit into
cloudevents:mainfrom
kings1ay3r:version-bump-ts-and-uuid

Conversation

@kings1ay3r
Copy link
Copy Markdown

@kings1ay3r kings1ay3r commented May 14, 2026

Proposed Changes

  • Version bump typescript, uuid
  • Fix TypeScript type errors in validation and parsers
  • Correct header serialization for objects
  • Resolve date and payload validation in test suites

Description

  1. Proper Header Serialization (src/message/http/headers.ts)
    Previously, when an extension property was an object, it was improperly cast to a string via value as string. In JavaScript, this results in the exact string "[object Object]" being sent over the network, completely destroying the payload data. The fix properly uses JSON.stringify() when the header value is an object, preserving the data structure.

  2. Type-Safe JSON Parsing (src/parsers.ts)
    The JSONParser.parse() method was incorrectly typed to return a string, even though JSON.parse() returns an Object/Array. It was corrected to return unknown (which is standard for parsed JSON in TypeScript), preventing downstream typing assumptions.

  3. Test Predictability (test/conformance/steps.ts & test/integration/emitter_factory_test.ts)
    The conformance tests were blindly parsing missing dates, causing Invalid Date crashes if a time was missing. The fix safely checks if time exists before comparing date strings.
    In emitter_factory_test.ts, the assertions now handle both pre-parsed objects and stringified JSON properties flexibly rather than blindly asserting deep equality on mismatched types.

  4. Error Message Formatting (src/event/validation.ts)
    The validation Error constructor was heavily relying on a dirty hack (// @ts-ignore) to coerce arrays of error objects into a single string. This was refactored to check Array.isArray(errors) and use a type-safe reduce loop to convert ErrorObject validation failures into a legible string.

  5. Dependency Bumps (package.json)
    DevDependencies like uuid, mocha, @cucumber/cucumber, axios, and typescript were suffering from legacy versioning that caused some of those implicit compilation errors you might have noticed. They were brought up to modern compatibility.
    UUID package had a moderate vulnerability GHSA-w5hq-g745-h8pq

uuid  
Severity: moderate
uuid: Missing buffer bounds check in v3/v5/v6 when buf is provided https://github.com/advisories/GHSA-w5hq-g745-h8pq

- Update devDependencies in package.json
- Fix TypeScript type errors in validation and parsers
- Correct header serialization for objects
- Resolve date and payload validation in test suites

Signed-off-by: Kevin Mathew Sunny <tokevins@protonmail.com>
@kings1ay3r kings1ay3r changed the title chore: version bump typescript, uuid, fix failing tests and typing issues chore: version bump typescript, uuid, ... , fix failing tests and typing issues May 14, 2026
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