fix: export hooks subpaths and harden X-Glean env parsing #97
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
Follow-up to #96 to fix a couple of post-merge issues:
./hooks,./hooks/*.js,./hooks/*) so consumers can importXGleanOptionsas documented..speakeasy/gen.yaml(typescript.additionalPackageJSON).src/hooks/x-glean.tsby removing the unsafe cast, adding runtime guards, and aligningX_GLEAN_INCLUDE_EXPERIMENTALsemantics to only enable the header when the env var is explicitlytrue(case-insensitive). Any other non-empty value disables/omits the header; empty/whitespace falls back to constructor options.README.mdconstructor options example to be TS-safe (satisfies SDKOptions & XGleanOptions).Why
After #96, TypeScript consumers could no longer pass
excludeDeprecatedAfter/includeExperimentalas constructor options without excess-property errors, andXGleanOptionswas not importable from the published package. Also, env var parsing previously allowed accidental values likeX_GLEAN_INCLUDE_EXPERIMENTAL=falseto be sent as a header.Test Plan
npx vitest run src/__tests__/x-glean.test.tsnpm run lintnpm run buildimport('@gleanwork/api-client/hooks/x-glean-options.js')resolves with the new export map.