Skip to content
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

[packagist] api v2 support #7575

Closed
wants to merge 43 commits into from

Commits on Feb 6, 2022

  1. Update Packagist service to use v2 api

    Packagist deprecated the original `packagist.org/p/username/package` endpoint in favor of v2 `packagist.org/p2/username/package` endpoint. Because of this, new packages aren't being found using v1.
    
    This PR updates the Packagist service to use the new endpoint.
    GeoffSelby authored and yookoala committed Feb 6, 2022
    Configuration menu
    Copy the full SHA
    2a87125 View commit details
    Browse the repository at this point in the history
  2. Adjust validation schema

    Some packages don't return the same data structure as others with the new api endpoints. This changes the validation schema to account for the potential differences.
    GeoffSelby authored and yookoala committed Feb 6, 2022
    Configuration menu
    Copy the full SHA
    90694b2 View commit details
    Browse the repository at this point in the history
  3. Fix typo

    GeoffSelby authored and yookoala committed Feb 6, 2022
    Configuration menu
    Copy the full SHA
    b7e39af View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    efeee15 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    dd567c7 View commit details
    Browse the repository at this point in the history
  6. Address issues raised by reviewer

    Address issues raised by @chris48s in badges#6508, which this PR is base on.
    Includes:
    
    * Remove getDefaultBranch() from base class for it is no longer used.
    * Change try-catch statement syntax to align code style.
    * Rename findRelease() to findLatestRelease() for clarity.
    yookoala committed Feb 6, 2022
    Configuration menu
    Copy the full SHA
    cb68e95 View commit details
    Browse the repository at this point in the history
  7. remove unusued param

    chris48s committed Feb 6, 2022
    Configuration menu
    Copy the full SHA
    633021a View commit details
    Browse the repository at this point in the history
  8. throw if no version found

    chris48s committed Feb 6, 2022
    Configuration menu
    Copy the full SHA
    8d43736 View commit details
    Browse the repository at this point in the history
  9. require version key

    chris48s committed Feb 6, 2022
    Configuration menu
    Copy the full SHA
    714c5d6 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    d04934f View commit details
    Browse the repository at this point in the history
  11. don't throw in render()

    chris48s committed Feb 6, 2022
    Configuration menu
    Copy the full SHA
    4b66398 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    1d7af3a View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2022

  1. Improve BasePackagistService testing

    * Change BasePackagistService.decompressResponse to static
      method BasePackagistService.expandPackageVersions.
    * Fix expandPackageVersions implementation.
    * Add unit test for the function.
    yookoala committed Feb 9, 2022
    Configuration menu
    Copy the full SHA
    928081f View commit details
    Browse the repository at this point in the history
  2. Extend BasePackagistService.findLatestRelease

    * extend BasePackagistService.findLatestRelease to also handle
      PackagistVersion.
    * remove PackagistVersion.transform.
    yookoala committed Feb 9, 2022
    Configuration menu
    Copy the full SHA
    77835c3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    352ad3c View commit details
    Browse the repository at this point in the history

Commits on Feb 10, 2022

  1. Improve BasePackagistService.findLatestRelease

    * Update findLatestRelease to throw NotFound itself.
    * Update PackagistLicense and PackagistVersion and remove the
      NotFound throwing logics.
    yookoala committed Feb 10, 2022
    Configuration menu
    Copy the full SHA
    6497c3b View commit details
    Browse the repository at this point in the history
  2. Revert unneeded change

    yookoala committed Feb 10, 2022
    Configuration menu
    Copy the full SHA
    64b8592 View commit details
    Browse the repository at this point in the history

Commits on Feb 11, 2022

  1. Corrected packagist php version spec

    * The test was on a false assumption that '__unset' might appear
      inside an array leaf while the composer's MetadataMinifier::minify
      never does thing recursively. The '__unset' should be value of the
      top level key.
    yookoala committed Feb 11, 2022
    Configuration menu
    Copy the full SHA
    b164565 View commit details
    Browse the repository at this point in the history

Commits on Feb 17, 2022

  1. Improved PackagistPhpVersion

    * improve jsDoc to the PackagistPhpVersion class.
    * simplified PackagistPhpVersion.getPhpVersion logics and remove
      fetchDev from getPhpVersion method.
    * update tests accordingly.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    e5b31cd View commit details
    Browse the repository at this point in the history
  2. Refactor PackagistPhpVersion

    * migrate expandPackageVersions usage to handle to simplify getPhpVersion
      logics.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    eb06baf View commit details
    Browse the repository at this point in the history
  3. Fix PackagistVersion issue with unexpanded versions

    * fix potential issues where the versions array is unexpanded.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    19fa292 View commit details
    Browse the repository at this point in the history
  4. Refactor PAckagistLicenseService

    * rename method "transform" into "getVersion" to better describe its
      use.
    * moved usage of expandPackageVersions into handle function.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    3ff0ee8 View commit details
    Browse the repository at this point in the history
  5. Refactor all expandPackageVersions call into fetchVersions

    * Rename BasePackageService.fetch method as fetchRelease.
    
    * Add a new fetch method that calls fetchRelease. Extract
      all expandPackageVersions calls from handle methods
      of different child class into fetchRelease.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    36c4a23 View commit details
    Browse the repository at this point in the history
  6. Convert BasePackagistService.findLatestRelease into static method

    * More reasonable defination.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    dba0fba View commit details
    Browse the repository at this point in the history
  7. Move findSpecifiedVersion in packagist service

    * Move method findSpecifiedVersion from PackagistPhpVersionService
      to BasePackagistService as a static method.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    ba29586 View commit details
    Browse the repository at this point in the history
  8. Reformat BasePackagistService test

    * moved method specific test data into the test itself.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    612f54b View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    74c3f8b View commit details
    Browse the repository at this point in the history
  10. Reduce repeated call to the same schema

    * rename allVersionSchema into composerMetadatApiSchema to better
      describe what it is.
    * make composerMetadatApiSchema the default value of schema in
      fetchVersions, fetchRelease and fetchDev. Remove explicit import
      and use of composerMetadatApiSchema from child services.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    2af02fd View commit details
    Browse the repository at this point in the history
  11. Packagist: Unify the way to find suitable package

    * unify all version search into a single
      BasePackagistService.findVersion method.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    1bde0b3 View commit details
    Browse the repository at this point in the history
  12. Improve test coverage on BasePackagistService

    * Add test coverage of findSpecifiedVersion.
    * Add test coverage of findLatestVersion.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    199d7ea View commit details
    Browse the repository at this point in the history
  13. Add option to BasePackagistService.findVersion

    * Add a includeDefaultBranch flag in findVersion to also search
      for metadata of default branch.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    e0e6e65 View commit details
    Browse the repository at this point in the history
  14. Simplified PackagistPhpVersion.getPhpVersion

    * simplified parameter list of getPhpVersion
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    5c134eb View commit details
    Browse the repository at this point in the history
  15. Improve PackagistPhpVersionService testing

    * resurrected some of the relevant older tests.
    * remove the api json array expand logics from test.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    1d93442 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    4782fc1 View commit details
    Browse the repository at this point in the history
  17. Refactor and documentation BasePackagistService

    * Moved expandPackageVersions calls into fetchRelease and fetchDev.
      The return values needed to be expanded anyway.
    * Rename fetchVersions as fetch to make it closer resembling the
      current stable version.
    * Improve documentations.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    2ce31b7 View commit details
    Browse the repository at this point in the history
  18. Simplify PackagistVersion fetch call

    * Use fetchRelease instead of fetch. Less API calls.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    cf195bf View commit details
    Browse the repository at this point in the history
  19. Simplifiy fetch used in packagist license and php version service

    * Only fetch the ~dev.json endpoint if needed.
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    cb470f4 View commit details
    Browse the repository at this point in the history
  20. Reuse error message constant

    * export error message string as constant and reuse in tests
    yookoala committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    83932b4 View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    ac771b1 View commit details
    Browse the repository at this point in the history

Commits on Mar 1, 2022

  1. Fix service.js file export issue

    * Move all messages constant to base class file. Ensure *.service.js
      exports only services or collection of services.
    yookoala committed Mar 1, 2022
    Configuration menu
    Copy the full SHA
    c6ef489 View commit details
    Browse the repository at this point in the history
  2. Add a new findDefaultBranchVersion method in PackagistBase

    * Off load the default branch searching logics from findLatestRelease
      to findDefaultBranchVersion. Implement Packagist default logic to
      search for default metadata to display.
    yookoala committed Mar 1, 2022
    Configuration menu
    Copy the full SHA
    2f4bdee View commit details
    Browse the repository at this point in the history
  3. Partially fix issues with the latest refactoring

    * fix documentation in fetchRelease and fetchDev.
    * use await keyword in usage of fetchRelease and fetchDev to get
      reasonable results.
    yookoala committed Mar 1, 2022
    Configuration menu
    Copy the full SHA
    45a603c View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2022

  1. Configuration menu
    Copy the full SHA
    54d5604 View commit details
    Browse the repository at this point in the history