Skip to content

Conversation

@roderik
Copy link
Member

@roderik roderik commented Oct 5, 2024

Summary by Sourcery

Add new Hasura and The Graph clients to the SDK, along with supporting packages and documentation. Update build and CI configurations to accommodate new packages and ensure proper environment setup for GraphQL endpoints.

New Features:

  • Introduce Hasura and The Graph clients for both client-side and server-side use, allowing integration with respective GraphQL APIs.
  • Add new packages for Hasura, The Graph, and Utils, each with their own configuration and setup files.

Enhancements:

  • Refactor existing code to use a unified ClientOptions type across different modules, improving consistency and maintainability.
  • Update the build configuration to include new packages and ensure proper environment variable handling for GraphQL endpoints.

Build:

  • Modify the build workflow to publish new SDK packages for Hasura, The Graph, and Utils, ensuring they are available for public access.

CI:

  • Update CI workflow to include environment variables for GraphQL endpoints and adjust file patterns for version updates.

Documentation:

  • Add comprehensive README files for the new Hasura, The Graph, and Utils packages, detailing installation, usage, API reference, and contribution guidelines.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 5, 2024

Reviewer's Guide by Sourcery

This pull request introduces significant changes to the SettleMint SDK, including the addition of new packages for Hasura and The Graph clients, updates to the existing JS package, and the introduction of a new utils package. The changes focus on improving the SDK's structure, adding new functionality, and enhancing the build process.

Class diagram for the updated SettleMint SDK

classDiagram
    class GraphQLClient {
        +request(query, variables)
    }
    class ClientOptions {
        +instance: Url
        +accessToken: AccessToken
    }
    class ServerClientOptions {
        +instance: Url
        +accessToken: AccessToken
        +adminSecret: String
    }
    class HasuraClient {
        +createHasuraClient(options: ClientOptions, requestConfig: RequestConfig)
        +createServerHasuraClient(options: ServerClientOptions, requestConfig: RequestConfig)
    }
    class TheGraphClient {
        +createTheGraphClient(options: ClientOptions, requestConfig: RequestConfig)
        +createServerTheGraphClient(options: ServerClientOptions, requestConfig: RequestConfig)
    }
    class Validation {
        +validate(schema: ZodSchema, value: unknown)
    }
    GraphQLClient --> ClientOptions
    GraphQLClient --> ServerClientOptions
    HasuraClient --> GraphQLClient
    TheGraphClient --> GraphQLClient
    Validation --> ClientOptions
    Validation --> ServerClientOptions
Loading

File-Level Changes

Change Details Files
Added new packages for Hasura and The Graph clients
  • Created Hasura client with createHasuraClient and createServerHasuraClient functions
  • Created The Graph client with createTheGraphClient and createServerTheGraphClient functions
  • Added README files for both new packages
  • Implemented client options schemas for both packages
packages/hasura/src/hasura.ts
packages/thegraph/src/thegraph.ts
packages/hasura/README.md
packages/thegraph/README.md
packages/hasura/src/helpers/client-options.schema.ts
packages/thegraph/src/helpers/client-options.schema.ts
Created a new utils package with shared functionality
  • Implemented validation utilities
  • Added package manager detection
  • Created filesystem utilities
  • Implemented runtime checks
packages/utils/src/validation.ts
packages/utils/src/package-manager/get-package-manager.ts
packages/utils/src/filesystem/ensure-folder.ts
packages/utils/src/runtime/ensure-server.ts
Updated the JS package to use new utility functions
  • Replaced SettleMintClientOptions with ClientOptions
  • Updated import statements to use new utility functions
  • Modified createSettleMintClient function to use new ClientOptionsSchema
packages/js/src/settlemint.ts
packages/js/src/fetchers/workspace.ts
packages/js/src/fetchers/blockchain-network.ts
packages/js/src/fetchers/blockchain-node.ts
packages/js/src/fetchers/custom-deployment.ts
packages/js/src/fetchers/insights.ts
packages/js/src/fetchers/integration-tool.ts
packages/js/src/fetchers/middleware.ts
packages/js/src/fetchers/private-key.ts
packages/js/src/fetchers/storage.ts
Enhanced build process and configuration
  • Updated tsconfig.json files for all packages
  • Created tsup.config.ts files for new packages
  • Added knip.json files for dependency management
  • Modified .github/workflows/build.yml to include new packages in the build process
packages/hasura/tsconfig.json
packages/thegraph/tsconfig.json
packages/utils/tsconfig.json
packages/hasura/tsup.config.ts
packages/thegraph/tsup.config.ts
packages/utils/tsup.config.ts
packages/hasura/knip.json
packages/thegraph/knip.json
packages/utils/knip.json
.github/workflows/build.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added the feat New feature label Oct 5, 2024
@github-actions
Copy link

github-actions bot commented Oct 5, 2024

📦 Packages

Package Version
SDK Cli @settlemint/sdk-cli@0.4.34-prfcf304a
SDK Config @settlemint/sdk-config@0.4.34-prfcf304a
SDK Next @settlemint/sdk-next@0.4.34-prfcf304a
SDK The Graph @settlemint/sdk-thegraph@0.4.34-prfcf304a
SDK Hasura @settlemint/sdk-hasura@0.4.34-prfcf304a
SDK JS @settlemint/sdk-js@0.4.34-prfcf304a
SDK Utils @settlemint/sdk-utils@0.4.34-prfcf304a

@roderik roderik merged commit bfec4b2 into main Oct 5, 2024
@roderik roderik deleted the feat/hasura-client branch October 5, 2024 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants