-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latest version problem with fields query param #76
Comments
👀 So it looks like the Not 100% sure why they're returning different values at present, we are digging. |
In the new API worker we consume the main package metadata to determine the version to return, which does appear to sort the versions using some rudimentary semver logic: https://github.com/cdnjs/tools/blob/2b7cddcb99cae64fca46a0703e548750c7d096c7/functions/kv-pump/main.go#L193 / https://github.com/cdnjs/tools/blob/2b7cddcb99cae64fca46a0703e548750c7d096c7/packages/packages.go#L236-L283 Due to the semver sorting here, it is using Whereas, the old Express API relied on a slightly different set of aggregated metadata and the logic that generates this doesn't seem to apply any semver sorting, just always using the most recently processed version: https://github.com/cdnjs/tools/blob/2b7cddcb99cae64fca46a0703e548750c7d096c7/kv/aggregate.go#L115 The most recent version to be processed was |
Thanks for the info 😃 . Do you know if it is plan to align the workers API version ? (just to get a consistent behavior) |
The API worker version that's currently rolling out is actually the correct version (aligning with what's served from the main /libraries endpoint for example). Once the rollout is complete, this value will be consistently returning then. |
cdnjs/cdnjs#14140 is tracking that rollout :) (and the PR is #75) |
Thanks a lot @MattIPv4 |
Help request
Problem
Hello guys, actually I ran into a strange behavior on the cdnjs api.
While trying to get the latest version of a library it seems that the response is not always the same when using the fields query param.
For example:
if you reach this endpoint several times:
the answer is randomly one of these two responses:
{"version":"4.7.4","latest":"https://cdnjs.cloudflare.com/ajax/libs/typescript/4.7.4/typescript.min.js"}
{"version":"4.8.0-beta","latest":"https://cdnjs.cloudflare.com/ajax/libs/typescript/4.8.0-beta/typescript.min.js"}
Only the second one should be expected
Nevertheless when trying to directly get the full response of a library without the fields query param:
https://api.cdnjs.com/libraries/typescript
the response is always constant and as expected:
Do you know where it can come from ?
Kr,
Jordan.
The text was updated successfully, but these errors were encountered: