Skip to content

Add grain data connector filter options and resolve typescript deprecation issues. #111

Merged
kdr merged 7 commits intocloudglue:mainfrom
chillenberger:dan-add-grain
Apr 21, 2026
Merged

Add grain data connector filter options and resolve typescript deprecation issues. #111
kdr merged 7 commits intocloudglue:mainfrom
chillenberger:dan-add-grain

Conversation

@chillenberger
Copy link
Copy Markdown
Contributor

@chillenberger chillenberger commented Apr 18, 2026

Summary

This PR updates the js sdk to include the grain data connector.

  • Added three new filter options to the ListDataConnectorFilesParams
  • updated package.json to resolve depreciated legacy settings build issue.
  • Minor version bump to 0.7.8

Build issue

article
ref

to fix this in the narrowest way possible we have opted to follow this advice and this advice

Testing

  • node - ensured sdk is importable and runnable on local node.
cd {common-js directory}
run node
const { Cloudglue } = require('./dist/src/index.js')
const client = new Cloudglue({ apiKey: 'not my real api key'})
const myFiles = await client.files.listFiles({limit: 10});
console.log(myFiles)
{
  object: 'list',
  data: [
    {
      id: '****************',
      object: 'file',
      bytes: 148648709,
...

-Browser - setup simple vita app ensure we can install, import and use common-js
main.ts

import { Cloudglue } from '@cloudglue/cloudglue-js';

// Smoke: constructor only (no network). Use a real key + API calls to test CORS.
const _client = new Cloudglue({ apiKey: 'browser-smoke-not-a-real-key' });
console.info('Cloudglue client OK', _client.files != null);

in browser we see: Cloudglue client OK true

  • ensure filters are working - tested limit, meeting_type, from, to filters from sdk in the following way:
const client = new Cloudglue({ apiKey: "1234567890", baseUrl: "http://localhost:3002/v1"});
const dataConnectors = await client.dataConnectors.list();
const grain = dataConnectors.data[0];
const params = { 
  limit: 10,
};
const files = await client.dataConnectors.listFiles(grain.id, params);
console.info('Cloudglue client OK', files); 

and received successful responses.

Summary by CodeRabbit

  • New Features

    • Added support for the Grain data connector with new filtering capabilities for connector file operations.
    • Introduced three new optional filters: title search, team, and meeting type.
  • Documentation

    • Updated data connector documentation to reflect Grain connector support and usage examples.
  • Chores

    • Version updated to 0.8.0.
    • Enhanced type safety and optimized build configuration.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 18, 2026

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary
Grain Data Connector Support
docs/data-connectors.md, src/api/data-connectors.api.ts
Added Grain to supported connectors list and extended ListDataConnectorFilesParams with three optional Grain-specific query filters: title_search, team, and meeting_type.
Type System Improvements
src/api/files.api.ts, src/client.ts
Added explicit return type annotation Promise<AxiosResponse> to uploadFile method and Node.js type reference directive for type resolution.
Build Configuration
tsconfig.json
Changed TypeScript module resolution strategy from node to bundler.
Version & Spec Updates
package.json, spec
Bumped package version to 0.8.0 and updated spec submodule commit hash to 85f748be6478a941e83e743bcf59b06347798550.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • #98: Extends ListDataConnectorFilesParams and listFiles functionality with Grain-specific query filters.
  • #94: Introduced the EnhancedDataConnectorsApi wrapper that is now being extended with new parameter fields.

Suggested reviewers

  • amyxst

Poem

🐰 A version hops up, from point-seven to eight,
Grain filters now ready, no need more to wait,
Types now explicit, configs align,
Bundler resolves imports—oh, what a design! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the two main changes: adding grain data connector filter options and resolving TypeScript deprecation issues. It is specific, concise, and clearly communicates the primary objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kdr
Copy link
Copy Markdown
Contributor

kdr commented Apr 18, 2026

@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

Comment thread tsconfig.json Outdated
"compilerOptions": {
"target": "es2020",
"module": "commonjs",
"module": "Node16",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this update intentional?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anyway i suspect not / that we should change back (cloudglue sdk can operate in browser or server)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the PR nots with reasons, links, and tests I performed concerning this issue.

@chillenberger chillenberger changed the title Dan add grain Add grain data connector filter options and resolve typescript deprecation issues. Apr 20, 2026
Comment thread src/client.ts
@@ -1,3 +1,4 @@
/// <reference types="node" />
Copy link
Copy Markdown
Contributor Author

@chillenberger chillenberger Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/api/files.api.ts
} from '../types';
import { CloudglueError } from '../error';

import type { AxiosResponse } from 'axios';
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because Axios supports both commonJS and ESM, and we need a declaration file, we will need to type AxiosResponse explicitly.

@chillenberger chillenberger marked this pull request as ready for review April 21, 2026 18:06
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/api/files.api.ts (1)

12-12: Explicit AxiosResponse return type LGTM.

Adding the type-only import and annotating uploadFile with Promise<AxiosResponse> is the right call to ensure the emitted .d.ts resolves axios types correctly under both CJS and ESM consumers.

Minor optional nit: consider parameterizing the response body, e.g. Promise<AxiosResponse<CloudglueFile>> (or whatever the POST /files response schema is), so callers get typed access to response.data instead of any. 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7ec0e59 and d7c1174.

⛔ Files ignored due to path filters (3)
  • generated/Data_Connectors.ts is excluded by !**/generated/**
  • generated/common.ts is excluded by !**/generated/**
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • docs/data-connectors.md
  • package.json
  • spec
  • src/api/data-connectors.api.ts
  • src/api/files.api.ts
  • src/client.ts
  • tsconfig.json

Comment thread package.json Outdated
{
"name": "@cloudglue/cloudglue-js",
"version": "0.7.7",
"version": "0.8.0",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets do this to 0.7.8 and re run npm install to update package lock again

@kdr kdr merged commit ad3ca39 into cloudglue:main Apr 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants