Add grain data connector filter options and resolve typescript deprecation issues. #111
Add grain data connector filter options and resolve typescript deprecation issues. #111kdr merged 7 commits intocloudglue:mainfrom
Conversation
📝 WalkthroughWalkthroughThis pull request extends Grain data connector support by adding filter parameters to the listFiles API, bumps the package version from 0.7.7 to 0.8.0, updates build configuration to use bundler module resolution, adds explicit return types, and updates a spec submodule commit reference. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@chillenberger update title for this pr to be descriptive on what is being added to the SDK (as this will be used in the release notes) and also describe what we are adding / what chagnes are into the PR description it self |
| "compilerOptions": { | ||
| "target": "es2020", | ||
| "module": "commonjs", | ||
| "module": "Node16", |
There was a problem hiding this comment.
anyway i suspect not / that we should change back (cloudglue sdk can operate in browser or server)
There was a problem hiding this comment.
I updated the PR nots with reasons, links, and tests I performed concerning this issue.
| @@ -1,3 +1,4 @@ | |||
| /// <reference types="node" /> | |||
There was a problem hiding this comment.
We either need type: ['node'] in tsconfig or file level types since we user process.env. To limit the scope where node specific types are accepted, we use this.
| } from '../types'; | ||
| import { CloudglueError } from '../error'; | ||
|
|
||
| import type { AxiosResponse } from 'axios'; |
There was a problem hiding this comment.
Because Axios supports both commonJS and ESM, and we need a declaration file, we will need to type AxiosResponse explicitly.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/api/files.api.ts (1)
12-12: ExplicitAxiosResponsereturn type LGTM.Adding the type-only import and annotating
uploadFilewithPromise<AxiosResponse>is the right call to ensure the emitted.d.tsresolves axios types correctly under both CJS and ESM consumers.Minor optional nit: consider parameterizing the response body, e.g.
Promise<AxiosResponse<CloudglueFile>>(or whatever thePOST /filesresponse schema is), so callers get typed access toresponse.datainstead ofany. Non-blocking.Also applies to: 44-44
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/api/files.api.ts` at line 12, Annotate the AxiosResponse return types with the concrete response body generics so callers get typed response.data (e.g., change Promise<AxiosResponse> to Promise<AxiosResponse<CloudglueFile>> in the uploadFile function and similarly for the other API functions referenced at line 44); locate the functions uploadFile (and the other API method at the noted spot) and replace the unparameterized AxiosResponse with the appropriate model type that matches the POST /files (or other endpoint) response schema, importing or defining CloudglueFile (or the correct DTO) as needed so response.data is strongly typed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/api/files.api.ts`:
- Line 12: Annotate the AxiosResponse return types with the concrete response
body generics so callers get typed response.data (e.g., change
Promise<AxiosResponse> to Promise<AxiosResponse<CloudglueFile>> in the
uploadFile function and similarly for the other API functions referenced at line
44); locate the functions uploadFile (and the other API method at the noted
spot) and replace the unparameterized AxiosResponse with the appropriate model
type that matches the POST /files (or other endpoint) response schema, importing
or defining CloudglueFile (or the correct DTO) as needed so response.data is
strongly typed.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4d450e60-05fb-4efa-bf36-548105a45347
⛔ Files ignored due to path filters (3)
generated/Data_Connectors.tsis excluded by!**/generated/**generated/common.tsis excluded by!**/generated/**package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (7)
docs/data-connectors.mdpackage.jsonspecsrc/api/data-connectors.api.tssrc/api/files.api.tssrc/client.tstsconfig.json
| { | ||
| "name": "@cloudglue/cloudglue-js", | ||
| "version": "0.7.7", | ||
| "version": "0.8.0", |
There was a problem hiding this comment.
lets do this to 0.7.8 and re run npm install to update package lock again
Summary
This PR updates the js sdk to include the grain data connector.
Build issue
article
ref
to fix this in the narrowest way possible we have opted to follow this advice and this advice
Testing
-Browser - setup simple vita app ensure we can install, import and use common-js
main.ts
in browser we see: Cloudglue client OK true
and received successful responses.
Summary by CodeRabbit
New Features
Documentation
Chores