Skip to content

Commit 2721d8a

Browse files
authored
Merge pull request #20 from vectorize-io/doclinkFixes
Update docs plus create function for new API reqs
2 parents e1810fa + 0449f15 commit 2721d8a

File tree

5 files changed

+242
-87
lines changed

5 files changed

+242
-87
lines changed

README.md

Lines changed: 161 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# Vectorize Connect SDK
22

3-
TypeScript/JavaScript SDK for connecting different platforms such as Google Drive and Dropbox to the Vectorize platform.
3+
TypeScript/JavaScript SDK for building multi-user connectors that integrate cloud storage platforms such as Google Drive with the Vectorize platform.
44

5-
This is a lightweight client that provides functionality for OAuth authentication and Vectorize API integration. The SDK helps you create connectors to various platforms, let users select files, and manage those connections through the Vectorize platform.
5+
## What is this?
6+
7+
The Vectorize Connect SDK enables you to:
8+
- Build applications where multiple users can connect their cloud storage accounts
9+
- Let users select specific files to be processed by Vectorize RAG pipelines
10+
- Manage user authentication and file permissions
11+
- Handle OAuth flows without building the authentication infrastructure yourself
12+
13+
This SDK is designed for developers who want to integrate multiple users' documents into their AI-powered applications using Vectorize's infrastructure.
614

715
## SDK Installation
816

@@ -21,76 +29,170 @@ yarn add @vectorize-io/vectorize-connect
2129
pnpm add @vectorize-io/vectorize-connect
2230
```
2331

24-
## Documentation
25-
26-
For detailed documentation, please refer to:
27-
28-
- [General Guide](./docs/general-guide.md) - Overview and common concepts
29-
- [Google Drive Integration](./docs/google-drive/) - Google Drive specific integration
30-
- [Dropbox Integration](./docs/dropbox/) - Dropbox specific integration
31-
- [API Reference](./docs/API.md) - Complete API documentation
32-
- [White-Label Integration](./docs/google-drive/white-label-guide.md) - White-label integration
33-
- [Vectorize Integration](./docs/google-drive/vectorize-guide.md) - Vectorize integration
34-
- [Setup Guide](./docs/setup.md) - Setup instructions
35-
36-
## SDK Example Usage
37-
38-
### For Google Drive Integration
39-
40-
For detailed information and examples on Google Drive integration, please refer to the [Google Drive Integration](./docs/google-drive/) guides.
41-
42-
### For Dropbox Integration
43-
44-
For detailed information and examples on Dropbox integration, please refer to the [Dropbox Integration](./docs/dropbox/) guides.
32+
## Quick Start
4533

34+
### 1. Install the SDK
35+
```bash
36+
npm install @vectorize-io/vectorize-connect
37+
```
4638

47-
## API Reference
48-
49-
For detailed API documentation, please refer to the [API Reference](./docs/API.md) which includes:
39+
### 2. Set up your environment
40+
```typescript
41+
import { createGDriveConnector } from '@vectorize-io/vectorize-connect';
5042

51-
- OAuth functions for Google Drive and Dropbox
52-
- File selection functions
53-
- Connector management functions
54-
- User management functions
55-
- Token utilities
56-
- Configuration types
43+
const vectorizeConfig = {
44+
organizationId: 'your-org-id',
45+
authorization: 'your-api-key'
46+
};
47+
```
5748

58-
## Configuration
49+
### 3. Create a connector and add users
50+
```typescript
51+
// Create a connector
52+
const connector = await createGDriveConnector({
53+
connectorName: 'My Google Drive Connector',
54+
config: vectorizeConfig
55+
});
56+
57+
// Add users via OAuth
58+
const authUrl = await getGDriveAuthURL({
59+
connectorId: connector.id,
60+
redirectUri: 'https://your-app.com/callback',
61+
config: vectorizeConfig
62+
});
63+
```
5964

60-
### `VectorizeAPIConfig`
65+
## Documentation
6166

62-
| Property | Type | Description |
63-
|----------|------|-------------|
64-
| `organizationId` | `string` | Your Vectorize organization ID |
65-
| `authorization` | `string` | Your Vectorize API key |
67+
For comprehensive guides and examples:
68+
69+
- [Multi-User Connectors Overview](https://docs.vectorize.io/developer-guides/multi-user-connectors) - Understanding connector types
70+
- [Vectorize-Managed OAuth Guide](https://docs.vectorize.io/developer-guides/multi-user-connectors/vectorize-managed-oauth) - Quick setup using Vectorize's OAuth
71+
- [White-Label OAuth Guide](https://docs.vectorize.io/developer-guides/multi-user-connectors/white-labeled-oauth) - Using your own OAuth apps
72+
73+
### SDK-Specific Documentation
74+
75+
- [API Reference](https://github.com/vectorize-io/vectorize-connect-sdk/blob/main/docs/API.md) - Complete API documentation
76+
- [General Guide](https://github.com/vectorize-io/vectorize-connect-sdk/blob/main/docs/general-guide.md) - SDK concepts and patterns
77+
- [TypeScript Definitions](https://github.com/vectorize-io/vectorize-connect-sdk/blob/main/docs/types.md) - Type definitions
78+
79+
### Implementation Examples
80+
81+
- [Environment Setup](https://github.com/vectorize-io/vectorize-connect-sdk/tree/main/docs/environment-setup)
82+
- [Creating Connectors](https://github.com/vectorize-io/vectorize-connect-sdk/tree/main/docs/creating-connectors)
83+
- [Authentication Flows](https://github.com/vectorize-io/vectorize-connect-sdk/tree/main/docs/authentication)
84+
- [User Management](https://github.com/vectorize-io/vectorize-connect-sdk/tree/main/docs/user-management)
85+
- [Frontend Integration](https://github.com/vectorize-io/vectorize-connect-sdk/tree/main/docs/frontend-implementation)
86+
- [Testing](https://github.com/vectorize-io/vectorize-connect-sdk/tree/main/docs/testing)
87+
88+
## Supported Platforms
89+
90+
### Google Drive
91+
- [Google Drive Overview](https://docs.vectorize.io/integrations/source-connectors/google-drive)
92+
- [Multi-User Setup (Vectorize)](https://docs.vectorize.io/integrations/source-connectors/google-drive/multi-user-vectorize)
93+
- [Multi-User Setup (White-Label)](https://docs.vectorize.io/integrations/source-connectors/google-drive/multi-user-white-label)
94+
95+
### Dropbox
96+
- [Dropbox Overview](https://docs.vectorize.io/integrations/source-connectors/dropbox)
97+
- [Multi-User Setup (Vectorize)](https://docs.vectorize.io/integrations/source-connectors/dropbox/multi-user-vectorize)
98+
- [Multi-User Setup (White-Label)](https://docs.vectorize.io/integrations/source-connectors/dropbox/multi-user-white-label)
99+
100+
### Notion
101+
- [OAuth Setup](https://docs.vectorize.io/integrations/source-connectors/notion)
102+
103+
## Two Approaches: Vectorize-Managed vs White-Label
104+
105+
### Vectorize-Managed OAuth (Recommended for Getting Started)
106+
- Uses Vectorize's pre-configured OAuth apps
107+
- No OAuth app setup required
108+
- Fastest way to get started
109+
- Available on Starter plan and above
110+
111+
### White-Label OAuth (For Production Apps)
112+
- Use your own OAuth applications
113+
- Full control over branding and authentication flow
114+
- Required for production applications with custom branding
115+
- Available on Pro plan and above
116+
117+
118+
## Core Features
119+
120+
### OAuth Authentication
121+
- Handle complex OAuth flows for Google Drive, Dropbox, and Notion
122+
- Support for both Vectorize-managed and white-label OAuth approaches
123+
- Automatic token management and refresh
124+
125+
### File Selection
126+
- Interactive file picker UI components
127+
- Granular file and folder selection
128+
- Support for file type filtering
129+
130+
### User Management
131+
- Add multiple users to a single connector
132+
- Update user file selections
133+
- Remove users and their associated data
134+
135+
### Connector Management
136+
- Create and configure connectors programmatically
137+
- Monitor connector status
138+
- Handle connector lifecycle
139+
140+
## Example: Building a Team Knowledge Base
141+
142+
```typescript
143+
import {
144+
createGDriveConnector,
145+
getGDriveAuthURL,
146+
selectGDriveFiles
147+
} from '@vectorize-io/vectorize-connect';
148+
149+
// 1. Create a connector for your team
150+
const connector = await createGDriveConnector({
151+
connectorName: 'Team Knowledge Base',
152+
config: {
153+
organizationId: process.env.VECTORIZE_ORG_ID,
154+
authorization: process.env.VECTORIZE_API_KEY
155+
}
156+
});
157+
158+
// 2. Each team member authorizes access
159+
app.get('/connect-drive', async (req, res) => {
160+
const authUrl = await getGDriveAuthURL({
161+
connectorId: connector.id,
162+
redirectUri: 'https://your-app.com/oauth/callback',
163+
config: vectorizeConfig
164+
});
165+
res.redirect(authUrl);
166+
});
167+
168+
// 3. Let users select which files to include
169+
app.post('/select-files', async (req, res) => {
170+
await selectGDriveFiles({
171+
connectorId: connector.id,
172+
selectedFiles: req.body.files,
173+
config: vectorizeConfig
174+
});
175+
});
176+
```
66177

67178
## Requirements
68179

69-
- This SDK is compatible with Node.js environments and modern browsers
70-
- TypeScript 4.7+ for type definitions
71-
- Next.js 14.0.0+ for server components (optional)
72-
73-
## Summary
74-
75-
The Vectorize Connect SDK provides:
180+
- Node.js 16+ or modern browsers
181+
- TypeScript 4.7+ (optional, for TypeScript projects)
182+
- A Vectorize account with API credentials
76183

77-
- OAuth authentication for Google Drive and Dropbox
78-
- File selection functionality
79-
- Token management for platform APIs
80-
- Vectorize API integration for connectors
81-
- User management capabilities
184+
## Resources
82185

83-
## Detailed Documentation
186+
### Getting Help
187+
- [Vectorize Documentation](https://docs.vectorize.io)
188+
- [GitHub Issues](https://github.com/vectorize-io/vectorize-connect-sdk/issues)
189+
- [Example Implementation](https://github.com/vectorize-io/test-vectorize-connect-sdk)
84190

85-
For more detailed documentation, please refer to the following guides:
191+
### Related Documentation
192+
- [RAG Pipelines Overview](https://docs.vectorize.io/rag-pipelines/understanding)
193+
- [Source Connectors Guide](https://docs.vectorize.io/integrations/source-connectors)
194+
- [Vectorize Platform Overview](https://docs.vectorize.io/concepts/vectorize-architecture)
86195

87-
- [API Reference](./docs/API.md)
88-
- [Google Drive White-Label Guide](./docs/google-drive/white-label-guide.md)
89-
- [Google Drive Vectorize Guide](./docs/google-drive/vectorize-guide.md)
90-
- [Dropbox White-Label Guide](./docs/dropbox/white-label-guide.md)
91-
- [Dropbox Vectorize Guide](./docs/dropbox/vectorize-guide.md)
92-
- [TypeScript Definitions](./docs/types.md)
93-
- [Setup Guide](./docs/setup.md)
94196

95197
## License
96198

docs/general-guide.md

Lines changed: 76 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Overview
44

5-
The Vectorize Connect SDK provides a set of tools to integrate with various cloud storage platforms, enabling seamless connection between your application and Vectorize's platform. This guide covers the general concepts and usage patterns for the SDK.
5+
The Vectorize Connect SDK enables you to build multi-user connectors that integrate cloud storage platforms with the Vectorize platform. This SDK allows multiple users to connect their accounts and select files to be processed by Vectorize's RAG pipelines.
66

77
## Installation
88

@@ -12,36 +12,48 @@ npm install @vectorize-io/vectorize-connect
1212

1313
## Authentication
1414

15-
All interactions with the Vectorize API require authentication using a Vectorize token. You'll need to provide this token in your API requests:
15+
All interactions with the Vectorize API require authentication using your API credentials:
1616

1717
```typescript
18-
const config = {
19-
authorization: 'Bearer your-token', // Use VECTORIZE_API_KEY environment variable
20-
organizationId: 'your-org-id'
18+
const config: VectorizeAPIConfig = {
19+
authorization: process.env.VECTORIZE_API_KEY, // Your API key (without "Bearer" prefix)
20+
organizationId: process.env.VECTORIZE_ORGANIZATION_ID // Your organization ID
2121
};
2222
```
2323

24-
## Connection Types
24+
**Important**: The SDK handles adding the "Bearer" prefix internally, so provide only your API key.
2525

26-
The SDK supports two main connection types:
26+
## Connector Types
2727

28-
1. **White-Label Integration**: Your application handles the OAuth flow and user interface, with Vectorize providing the backend services.
28+
The SDK supports two approaches for implementing multi-user connectors:
2929

30-
2. **Non-White-Label Integration**: Vectorize handles the OAuth flow and user interface, with your application integrating with the Vectorize platform.
30+
### 1. Vectorize-Managed OAuth (Recommended for Getting Started)
31+
- Uses Vectorize's pre-configured OAuth applications
32+
- No need to set up your own OAuth credentials
33+
- Quickest way to get started
34+
- Available on Starter plan and above
35+
36+
### 2. White-Label OAuth (For Production Apps)
37+
- Use your own OAuth applications
38+
- Full control over branding and authentication flow
39+
- Required for production applications with custom branding
40+
- Available on Pro plan and above
3141

3242
## Common Configuration
3343

3444
### VectorizeAPIConfig
3545

36-
Most functions in the SDK require a `VectorizeAPIConfig` object:
46+
All SDK functions require a `VectorizeAPIConfig` object:
3747

3848
```typescript
3949
interface VectorizeAPIConfig {
40-
authorization: string; // Bearer token for authentication - use VECTORIZE_API_KEY env var
41-
organizationId: string; // Your Vectorize organization ID - use VECTORIZE_ORGANIZATION_ID env var
50+
authorization: string; // Your Vectorize API key
51+
organizationId: string; // Your Vectorize organization ID
4252
}
4353
```
4454

55+
Get these values from your Vectorize dashboard under Settings > Access Tokens.
56+
4557
## Error Handling
4658

4759
All SDK functions return Promises that may reject with errors. Always implement proper error handling:
@@ -55,16 +67,62 @@ try {
5567
}
5668
```
5769

58-
## Connector Management
70+
## Basic Usage Flow
5971

60-
Connectors are the bridge between your application and data sources. The SDK provides functions to create and manage connectors:
72+
### For Vectorize-Managed OAuth (Simple Approach)
73+
74+
With Vectorize-managed OAuth, the authentication flow is handled through the Vectorize platform:
6175

6276
```typescript
63-
// Create a connector
64-
const connectorId = await createConnector(config, connectorName);
77+
import {
78+
// Import the create function for your platform
79+
// e.g., createVectorizeGDriveConnector, createVectorizeDropboxConnector, etc.
80+
createVectorize[Platform]Connector,
81+
getOneTimeConnectorToken
82+
} from '@vectorize-io/vectorize-connect';
83+
84+
// 1. Create a connector
85+
const connectorId = await createVectorize[Platform]Connector(
86+
config,
87+
'Team Knowledge Base'
88+
);
89+
90+
// 2. Generate a one-time token for secure authentication
91+
const tokenData = await getOneTimeConnectorToken(
92+
config,
93+
'user123',
94+
connectorId
95+
);
96+
97+
// 3. Redirect user to Vectorize's OAuth flow
98+
// The user will be redirected to the appropriate platform authentication page
99+
100+
// 4. After user completes OAuth and file selection on Vectorize platform,
101+
// they return to your application
102+
```
65103

66-
// Manage users for a connector
67-
await manageUser(config, connectorId, userId);
104+
### For White-Label OAuth (Advanced)
105+
106+
For white-label implementations, you handle the OAuth flow yourself:
107+
108+
```typescript
109+
import {
110+
// Import the create function and OAuth classes for your platform
111+
createWhiteLabel[Platform]Connector,
112+
[Platform]OAuth,
113+
[Platform]Selection
114+
} from '@vectorize-io/vectorize-connect';
115+
116+
// 1. Create a white-label connector with your own OAuth credentials
117+
const connectorId = await createWhiteLabel[Platform]Connector(
118+
config,
119+
'My Custom Connector',
120+
process.env.PLATFORM_CLIENT_ID!,
121+
process.env.PLATFORM_CLIENT_SECRET!
122+
);
123+
124+
// 2. Use OAuth classes to handle authentication
125+
// See the OAuth Classes section in the API documentation for platform-specific details
68126
```
69127

70128
## Next Steps
@@ -89,6 +147,3 @@ For specific platform integrations, refer to the step-based documentation struct
89147
- [Frontend Implementation](./frontend-implementation/white-label/README.md)
90148
- [Testing](./testing/white-label/README.md)
91149

92-
### Legacy Platform-Specific Guides (Deprecated)
93-
- [Google Drive Integration](./legacy-docs/google-drive/) - Use step-based guides instead
94-
- [Dropbox Integration](./legacy-docs/dropbox/) - Use step-based guides instead

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vectorize-io/vectorize-connect",
3-
"version": "0.3.3",
3+
"version": "0.3.6",
44
"description": "A simple package for Google Drive authorization and file selection",
55
"main": "dist/index.js",
66
"module": "dist/index.mjs",

0 commit comments

Comments
 (0)