seeksphere-sdk 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LLM.md ADDED
@@ -0,0 +1,299 @@
1
+ # SeekSphere SDK - AI Assistant Guide
2
+
3
+ This document provides AI assistants (like Claude, ChatGPT, etc.) with comprehensive information to help developers implement the SeekSphere SDK effectively.
4
+
5
+ ## Quick Implementation Guide
6
+
7
+ ### Installation
8
+ ```bash
9
+ npm install seeksphere-sdk
10
+ ```
11
+
12
+ ### Basic Setup
13
+ ```typescript
14
+ import { SeekSphereClient } from 'seeksphere-sdk';
15
+
16
+ const client = new SeekSphereClient({
17
+ apiKey: 'your-org-id-here', // This is your organization ID from SeekSphere dashboard
18
+ timeout: 30000 // Optional, defaults to 30 seconds
19
+ });
20
+ ```
21
+
22
+ ### Core Search Functionality
23
+ ```typescript
24
+ // Basic search (only public method available)
25
+ const result = await client.search({
26
+ query: 'show me all users from last month'
27
+ });
28
+
29
+ // Search with explicit mode (only 'sql_only' is currently supported)
30
+ const result = await client.search({
31
+ query: 'find top 10 products by sales'
32
+ }, 'sql_only');
33
+ ```
34
+
35
+ ## Key Implementation Details
36
+
37
+ ### 1. Configuration
38
+ - **No baseUrl needed**: The SDK uses a fixed base URL (`https://api.seeksphere.com`)
39
+ - **Only apiKey required**: This is your organization ID from the SeekSphere dashboard
40
+ - **Optional timeout**: Defaults to 30 seconds if not specified
41
+
42
+ ### 2. Search Modes
43
+ - **'sql_only'**: Currently supported (default)
44
+ - **'full'**: Coming soon - will throw error if used
45
+
46
+ ### 3. Private Methods Warning
47
+ The following methods are private and should NOT be used:
48
+ - `updateTokens()` - Use SeekSphere dashboard instead
49
+ - `updateSchema()` - Use SeekSphere dashboard instead
50
+ - `getTokens()` - Use SeekSphere dashboard instead
51
+ - `getSchema()` - Use SeekSphere dashboard instead
52
+
53
+ These methods are deprecated and may be removed in future versions.
54
+
55
+ ## Common Implementation Patterns
56
+
57
+ ### Error Handling
58
+ ```typescript
59
+ try {
60
+ const result = await client.search({
61
+ query: 'your search query here'
62
+ });
63
+ console.log('Search successful:', result);
64
+ } catch (error) {
65
+ if (error instanceof Error) {
66
+ console.error('Search failed:', error.message);
67
+ }
68
+ }
69
+ ```
70
+
71
+ ### TypeScript Types
72
+ ```typescript
73
+ import {
74
+ SeekSphereClient,
75
+ SearchRequest,
76
+ SearchResponse,
77
+ SearchMode
78
+ } from 'seeksphere-sdk';
79
+
80
+ // Request type
81
+ const request: SearchRequest = {
82
+ query: 'find all active users'
83
+ };
84
+
85
+ // Response type
86
+ const response: SearchResponse = await client.search(request);
87
+ ```
88
+
89
+ ### Environment Variables Pattern
90
+ ```typescript
91
+ // Recommended: Use environment variables
92
+ const client = new SeekSphereClient({
93
+ apiKey: process.env.SEEKSPHERE_ORG_ID || 'fallback-org-id',
94
+ timeout: parseInt(process.env.SEEKSPHERE_TIMEOUT || '30000')
95
+ });
96
+ ```
97
+
98
+ ## Response Structure
99
+
100
+ ### Successful Search Response
101
+ ```typescript
102
+ {
103
+ success: boolean;
104
+ org_id: string;
105
+ mode: string;
106
+ user_id: string;
107
+ // Additional response data varies based on query
108
+ [key: string]: any;
109
+ }
110
+ ```
111
+
112
+ ### Error Handling
113
+ The SDK automatically handles and formats errors:
114
+ - **API Errors**: `API Error: {status} - {message}`
115
+ - **Network Errors**: `Network Error: No response received from server`
116
+ - **Request Errors**: `Request Error: {message}`
117
+
118
+ ## Best Practices for AI Assistants
119
+
120
+ ### When Helping Developers:
121
+
122
+ 1. **Always use the public search method only**
123
+ - Never suggest using private methods (updateTokens, updateSchema, etc.)
124
+ - Direct users to the SeekSphere dashboard for configuration
125
+
126
+ 2. **Configuration guidance**:
127
+ - Emphasize that no baseUrl is needed
128
+ - apiKey is the organization ID from their dashboard
129
+ - Suggest using environment variables for the API key
130
+
131
+ 3. **Error handling**:
132
+ - Always wrap search calls in try-catch blocks
133
+ - Show proper error message extraction
134
+
135
+ 4. **Search mode guidance**:
136
+ - Default to 'sql_only' mode
137
+ - Warn that 'full' mode will throw an error (coming soon)
138
+
139
+ ### Code Examples to Provide
140
+
141
+ #### Basic Implementation
142
+ ```typescript
143
+ import { SeekSphereClient } from 'seeksphere-sdk';
144
+
145
+ const client = new SeekSphereClient({
146
+ apiKey: process.env.SEEKSPHERE_ORG_ID!
147
+ });
148
+
149
+ async function searchData(query: string) {
150
+ try {
151
+ const result = await client.search({ query });
152
+ return result;
153
+ } catch (error) {
154
+ console.error('Search failed:', error);
155
+ throw error;
156
+ }
157
+ }
158
+ ```
159
+
160
+ #### With Custom Timeout
161
+ ```typescript
162
+ const client = new SeekSphereClient({
163
+ apiKey: 'your-org-id',
164
+ timeout: 60000 // 60 seconds for complex queries
165
+ });
166
+ ```
167
+
168
+ #### Multiple Searches
169
+ ```typescript
170
+ async function performMultipleSearches() {
171
+ const queries = [
172
+ 'show recent orders',
173
+ 'find top customers',
174
+ 'get product analytics'
175
+ ];
176
+
177
+ const results = await Promise.all(
178
+ queries.map(query => client.search({ query }))
179
+ );
180
+
181
+ return results;
182
+ }
183
+ ```
184
+
185
+ ## Common Issues and Solutions
186
+
187
+ ### Issue: "baseUrl does not exist in type SDKConfig"
188
+ **Solution**: Remove baseUrl from configuration - it's now fixed internally.
189
+
190
+ ### Issue: "SearchMode 'full' is coming soon"
191
+ **Solution**: Use 'sql_only' mode or omit the mode parameter (defaults to 'sql_only').
192
+
193
+ ### Issue: Cannot access updateTokens/updateSchema methods
194
+ **Solution**: These are now private. Direct users to the SeekSphere dashboard for token and schema management.
195
+
196
+ ### Issue: Network timeouts
197
+ **Solution**: Increase the timeout in the configuration or optimize the search query.
198
+
199
+ ## Integration Examples
200
+
201
+ ### Express.js API
202
+ ```typescript
203
+ import express from 'express';
204
+ import { SeekSphereClient } from 'seeksphere-sdk';
205
+
206
+ const app = express();
207
+ const client = new SeekSphereClient({
208
+ apiKey: process.env.SEEKSPHERE_ORG_ID!
209
+ });
210
+
211
+ app.post('/search', async (req, res) => {
212
+ try {
213
+ const { query } = req.body;
214
+ const result = await client.search({ query });
215
+ res.json(result);
216
+ } catch (error) {
217
+ res.status(500).json({
218
+ error: error instanceof Error ? error.message : 'Search failed'
219
+ });
220
+ }
221
+ });
222
+ ```
223
+
224
+ ### Next.js API Route
225
+ ```typescript
226
+ // pages/api/search.ts
227
+ import { NextApiRequest, NextApiResponse } from 'next';
228
+ import { SeekSphereClient } from 'seeksphere-sdk';
229
+
230
+ const client = new SeekSphereClient({
231
+ apiKey: process.env.SEEKSPHERE_ORG_ID!
232
+ });
233
+
234
+ export default async function handler(req: NextApiRequest, res: NextApiResponse) {
235
+ if (req.method !== 'POST') {
236
+ return res.status(405).json({ error: 'Method not allowed' });
237
+ }
238
+
239
+ try {
240
+ const { query } = req.body;
241
+ const result = await client.search({ query });
242
+ res.status(200).json(result);
243
+ } catch (error) {
244
+ res.status(500).json({
245
+ error: error instanceof Error ? error.message : 'Search failed'
246
+ });
247
+ }
248
+ }
249
+ ```
250
+
251
+ ## Testing Guidance
252
+
253
+ ### Unit Testing
254
+ ```typescript
255
+ import { SeekSphereClient } from 'seeksphere-sdk';
256
+
257
+ // Mock the client for testing
258
+ jest.mock('seeksphere-sdk');
259
+
260
+ const mockClient = {
261
+ search: jest.fn().mockResolvedValue({ success: true, data: [] })
262
+ };
263
+
264
+ (SeekSphereClient as jest.Mock).mockImplementation(() => mockClient);
265
+ ```
266
+
267
+ ### Integration Testing
268
+ ```typescript
269
+ // Use a test organization ID for integration tests
270
+ const testClient = new SeekSphereClient({
271
+ apiKey: process.env.TEST_SEEKSPHERE_ORG_ID!,
272
+ timeout: 10000
273
+ });
274
+
275
+ describe('SeekSphere Integration', () => {
276
+ it('should perform search successfully', async () => {
277
+ const result = await testClient.search({
278
+ query: 'test query'
279
+ });
280
+ expect(result.success).toBe(true);
281
+ });
282
+ });
283
+ ```
284
+
285
+ ## Version Information
286
+
287
+ - **Current Version**: 1.0.0
288
+ - **Node.js Requirement**: >= 18.0.0
289
+ - **TypeScript Support**: Full TypeScript definitions included
290
+ - **Dependencies**: axios (HTTP client)
291
+
292
+ ## Support and Resources
293
+
294
+ - **Dashboard**: Use SeekSphere dashboard for token and schema management
295
+ - **Documentation**: This SDK focuses only on search functionality
296
+ - **Issues**: Report issues on the GitHub repository
297
+ - **Updates**: Follow semantic versioning (patch/minor/major)
298
+
299
+ Remember: This SDK is designed to be simple and focused on search functionality only. All configuration and management should be done through the SeekSphere dashboard.
package/README.md CHANGED
@@ -15,36 +15,19 @@ import { SeekSphereClient } from 'seeksphere-sdk';
15
15
 
16
16
  // Initialize the client
17
17
  const client = new SeekSphereClient({
18
- baseUrl: 'https://your-api-domain.com',
19
- apiKey: 'your-org-id', // org_id is used as the API key
18
+ apiKey: 'your-org-id', // Your organization ID from SeekSphere dashboard
20
19
  timeout: 30000 // optional, defaults to 30 seconds
21
20
  });
22
21
 
23
- // Search
22
+ // Search (main functionality)
24
23
  const searchResult = await client.search({
25
- query: 'your search query'
26
- }, 'sql_only'); // mode can be 'sql_only' or 'full'
27
-
28
- // Update tokens
29
- await client.updateTokens({
30
- tokens: {
31
- 'category1': ['token1', 'token2'],
32
- 'category2': ['token3', 'token4']
33
- }
24
+ query: 'show me all users from last month'
34
25
  });
35
26
 
36
- // Update schema
37
- await client.updateSchema({
38
- search_schema: {
39
- // your schema object
40
- }
41
- });
42
-
43
- // Get current tokens
44
- const tokens = await client.getTokens();
45
-
46
- // Get current schema
47
- const schema = await client.getSchema();
27
+ // Search with explicit mode
28
+ const searchResult = await client.search({
29
+ query: 'find top 10 products by sales'
30
+ }, 'sql_only'); // Currently only 'sql_only' is supported
48
31
  ```
49
32
 
50
33
  ## API Methods
@@ -52,29 +35,34 @@ const schema = await client.getSchema();
52
35
  ### `search(request, mode?)`
53
36
  - **request**: `{ query: string }`
54
37
  - **mode**: `'sql_only' | 'full'` (optional, defaults to 'sql_only')
38
+ - `'sql_only'`: Currently supported
39
+ - `'full'`: Coming soon (will throw error if used)
55
40
  - **returns**: Search results
56
41
 
57
- ### `updateTokens(request)`
58
- - **request**: `{ tokens: Record<string, string[]> }`
59
- - **returns**: Success response
60
-
61
- ### `updateSchema(request)`
62
- - **request**: `{ search_schema: any }`
63
- - **returns**: Success response
64
-
65
- ### `getTokens()`
66
- - **returns**: Current tokens mapping
42
+ ## Configuration Management
67
43
 
68
- ### `getSchema()`
69
- - **returns**: Current search schema
44
+ **Important**: Token and schema management should be done through the SeekSphere dashboard, not programmatically. The SDK focuses on search functionality only.
70
45
 
71
46
  ## Configuration
72
47
 
48
+ ### SDK Configuration
49
+ - **Base URL**: Fixed to `https://api.seeksphere.com` (cannot be overridden)
50
+ - **API Key**: Your organization ID from the SeekSphere dashboard
51
+ - **Timeout**: Optional, defaults to 30 seconds
52
+
73
53
  The SDK automatically sets:
74
54
  - `X-Org-Id` header to your provided `apiKey`
75
55
  - `X-User-Id` header to `'node_sdk'`
76
56
  - `Content-Type` header to `'application/json'`
77
57
 
58
+ ### Environment Variables (Recommended)
59
+ ```typescript
60
+ const client = new SeekSphereClient({
61
+ apiKey: process.env.SEEKSPHERE_ORG_ID!,
62
+ timeout: parseInt(process.env.SEEKSPHERE_TIMEOUT || '30000')
63
+ });
64
+ ```
65
+
78
66
  ## Error Handling
79
67
 
80
68
  The SDK throws descriptive errors for:
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SDKConfig, SearchRequest, SearchResponse, UpdateTokensRequest, UpdateSchemaRequest, ApiResponse, SearchMode } from './types';
1
+ import { SDKConfig, SearchRequest, SearchResponse, SearchMode } from './types';
2
2
  export declare class SeekSphereClient {
3
3
  private client;
4
4
  private static readonly BASE_URL;
@@ -8,26 +8,32 @@ export declare class SeekSphereClient {
8
8
  */
9
9
  search(request: SearchRequest, mode?: SearchMode): Promise<SearchResponse>;
10
10
  /**
11
+ * @deprecated WARNING: This method is for internal use only and may be removed in future versions.
12
+ * Please use the SeekSphere dashboard to manage tokens instead of this API method.
13
+ * @private
11
14
  * Update tokens mapping
12
15
  */
13
- updateTokens(request: UpdateTokensRequest): Promise<ApiResponse>;
16
+ private updateTokens;
14
17
  /**
18
+ * @deprecated WARNING: This method is for internal use only and may be removed in future versions.
19
+ * Please use the SeekSphere dashboard to manage search schema instead of this API method.
20
+ * @private
15
21
  * Update search schema
16
22
  */
17
- updateSchema(request: UpdateSchemaRequest): Promise<ApiResponse>;
23
+ private updateSchema;
18
24
  /**
25
+ * @deprecated WARNING: This method is for internal use only and may be removed in future versions.
26
+ * Please use the SeekSphere dashboard to view tokens instead of this API method.
27
+ * @private
19
28
  * Get current tokens (helper method)
20
29
  */
21
- getTokens(): Promise<{
22
- tokens: Record<string, string[]>;
23
- org_id: string;
24
- }>;
30
+ private getTokens;
25
31
  /**
32
+ * @deprecated WARNING: This method is for internal use only and may be removed in future versions.
33
+ * Please use the SeekSphere dashboard to view search schema instead of this API method.
34
+ * @private
26
35
  * Get current search schema (helper method)
27
36
  */
28
- getSchema(): Promise<{
29
- search_schema: any;
30
- org_id: string;
31
- }>;
37
+ private getSchema;
32
38
  }
33
39
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,UAAU,EACX,MAAM,SAAS,CAAC;AAEjB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAgC;gBAEpD,MAAM,EAAE,SAAS;IA2B7B;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,GAAE,UAAuB,GAAG,OAAO,CAAC,cAAc,CAAC;IAa5F;;OAEG;IACG,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC;IAKtE;;OAEG;IACG,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC;IAKtE;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAKhF;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC;QAAE,aAAa,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAInE"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,aAAa,EACb,cAAc,EAId,UAAU,EACX,MAAM,SAAS,CAAC;AAEjB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAgC;gBAEpD,MAAM,EAAE,SAAS;IA2B7B;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,GAAE,UAAuB,GAAG,OAAO,CAAC,cAAc,CAAC;IAa5F;;;;;OAKG;YACW,YAAY;IAK1B;;;;;OAKG;YACW,YAAY;IAK1B;;;;;OAKG;YACW,SAAS;IAKvB;;;;;OAKG;YACW,SAAS;CAIxB"}
package/dist/client.js CHANGED
@@ -44,6 +44,9 @@ class SeekSphereClient {
44
44
  return response.data;
45
45
  }
46
46
  /**
47
+ * @deprecated WARNING: This method is for internal use only and may be removed in future versions.
48
+ * Please use the SeekSphere dashboard to manage tokens instead of this API method.
49
+ * @private
47
50
  * Update tokens mapping
48
51
  */
49
52
  async updateTokens(request) {
@@ -51,6 +54,9 @@ class SeekSphereClient {
51
54
  return response.data;
52
55
  }
53
56
  /**
57
+ * @deprecated WARNING: This method is for internal use only and may be removed in future versions.
58
+ * Please use the SeekSphere dashboard to manage search schema instead of this API method.
59
+ * @private
54
60
  * Update search schema
55
61
  */
56
62
  async updateSchema(request) {
@@ -58,6 +64,9 @@ class SeekSphereClient {
58
64
  return response.data;
59
65
  }
60
66
  /**
67
+ * @deprecated WARNING: This method is for internal use only and may be removed in future versions.
68
+ * Please use the SeekSphere dashboard to view tokens instead of this API method.
69
+ * @private
61
70
  * Get current tokens (helper method)
62
71
  */
63
72
  async getTokens() {
@@ -65,6 +74,9 @@ class SeekSphereClient {
65
74
  return response.data;
66
75
  }
67
76
  /**
77
+ * @deprecated WARNING: This method is for internal use only and may be removed in future versions.
78
+ * Please use the SeekSphere dashboard to view search schema instead of this API method.
79
+ * @private
68
80
  * Get current search schema (helper method)
69
81
  */
70
82
  async getSchema() {
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA4D;AAW5D,MAAa,gBAAgB;IAI3B,YAAY,MAAiB;QAE3B,IAAI,CAAC,MAAM,GAAG,eAAK,CAAC,MAAM,CAAC;YACzB,OAAO,EAAE,gBAAgB,CAAC,QAAQ;YAClC,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,KAAK;YAChC,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,4BAA4B;gBACvD,WAAW,EAAE,UAAU,CAAC,wBAAwB;aACjD;SACF,CAAC,CAAC;QAEH,0CAA0C;QAC1C,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CACnC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EACtB,CAAC,KAAK,EAAE,EAAE;YACR,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACnB,MAAM,IAAI,KAAK,CAAC,cAAc,KAAK,CAAC,QAAQ,CAAC,MAAM,MAAM,KAAK,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;YACtH,CAA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"","sources":["../src/example.ts"],"names":[],"mappings":"AAEA,iBAAe,OAAO,kBAoErB;AAOD,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAEA,iBAAe,OAAO,kBAuCrB;AAOD,OAAO,EAAE,OAAO,EAAE,CAAC"}
package/dist/example.js CHANGED
@@ -26,41 +26,14 @@ async function example() {
26
26
  catch (error) {
27
27
  console.log('Expected error for full mode:', error instanceof Error ? error.message : String(error));
28
28
  }
29
- // Example 3: Update tokens
30
- console.log('\nUpdating tokens...');
31
- const updateTokensResult = await client.updateTokens({
32
- tokens: {
33
- 'product_categories': ['electronics', 'clothing', 'books'],
34
- 'user_types': ['premium', 'standard', 'trial'],
35
- 'regions': ['north', 'south', 'east', 'west']
36
- }
29
+ // Example 3: Additional search with different query
30
+ console.log('\nSearching for different data...');
31
+ const anotherSearchResult = await client.search({
32
+ query: 'find all orders from this week'
37
33
  });
38
- console.log('Update tokens result:', updateTokensResult);
39
- // Example 4: Update schema
40
- console.log('\nUpdating schema...');
41
- const updateSchemaResult = await client.updateSchema({
42
- search_schema: {
43
- tables: {
44
- users: {
45
- columns: ['id', 'name', 'email', 'created_at'],
46
- types: ['int', 'varchar', 'varchar', 'datetime']
47
- },
48
- orders: {
49
- columns: ['id', 'user_id', 'amount', 'status'],
50
- types: ['int', 'int', 'decimal', 'varchar']
51
- }
52
- }
53
- }
54
- });
55
- console.log('Update schema result:', updateSchemaResult);
56
- // Example 5: Get current tokens
57
- console.log('\nGetting current tokens...');
58
- const currentTokens = await client.getTokens();
59
- console.log('Current tokens:', currentTokens);
60
- // Example 6: Get current schema
61
- console.log('\nGetting current schema...');
62
- const currentSchema = await client.getSchema();
63
- console.log('Current schema:', currentSchema);
34
+ console.log('Another search result:', anotherSearchResult);
35
+ // Note: Token and schema management methods are private and should be managed
36
+ // through the SeekSphere dashboard instead of programmatically.
64
37
  }
65
38
  catch (error) {
66
39
  console.error('Error:', error instanceof Error ? error.message : String(error));
@@ -1 +1 @@
1
- {"version":3,"file":"example.js","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":";;AA6ES,0BAAO;AA7EhB,mCAA2C;AAE3C,KAAK,UAAU,OAAO;IACpB,wBAAwB;IACxB,MAAM,MAAM,GAAG,IAAI,wBAAgB,CAAC;QAClC,MAAM,EAAE,kBAAkB,EAAE,kCAAkC;QAC9D,OAAO,EAAE,KAAK;KACf,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,uCAAuC;QACvC,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAC/C,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YACvC,KAAK,EAAE,mCAAmC;SAC3C,EAAE,UAAU,CAAC,CAAC;QACf,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QAE5C,oEAAoE;QACpE,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QACpD,IAAI,CAAC;YACH,MAAM,gBAAgB,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;gBAC3C,KAAK,EAAE,kCAAkC;aAC1C,EAAE,MAAM,CAAC,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,gBAAgB,CAAC,CAAC;QACvD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACvG,CAAC;QAED,2BAA2B;QAC3B,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QACpC,MAAM,kBAAkB,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC;YACnD,MAAM,EAAE;gBACN,oBAAoB,EAAE,CAAC,aAAa,EAAE,UAAU,EAAE,OAAO,CA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C,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACvG,CAAC;QAED,oDAAoD;QACpD,OAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;QACjD,MAAM,mBAAmB,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;YAC9C,KAAK,EAAE,gCAAgC;SACxC,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,mBAAmB,CAAC,CAAC;QAE3D,8EAA8E;QAC9E,gEAAgE;IAElE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAClF,CAAC;AACH,CAAC;AAED,kBAAkB;AAClB,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,OAAO,EAAE,CAAC;AACZ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seeksphere-sdk",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Official TypeScript Node.js SDK for SeekSphere API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,16 @@
18
18
  "prepublishOnly": "npm run lint && npm run test && npm run build",
19
19
  "release": "npm version patch && git push && git push --tags"
20
20
  },
21
- "keywords": ["seeksphere", "search", "api", "sdk", "typescript", "nodejs", "database", "query"],
21
+ "keywords": [
22
+ "seeksphere",
23
+ "search",
24
+ "api",
25
+ "sdk",
26
+ "typescript",
27
+ "nodejs",
28
+ "database",
29
+ "query"
30
+ ],
22
31
  "author": "SeekSphere",
23
32
  "license": "MIT",
24
33
  "repository": {
@@ -32,16 +41,17 @@
32
41
  "files": [
33
42
  "dist/**/*",
34
43
  "README.md",
35
- "LICENSE"
44
+ "LICENSE",
45
+ "LLM.md"
36
46
  ],
37
47
  "engines": {
38
48
  "node": ">=18.0.0"
39
49
  },
40
50
  "devDependencies": {
41
- "@types/node": "^20.0.0",
42
51
  "@types/jest": "^29.0.0",
43
- "@typescript-eslint/eslint-plugin": "^6.0.0",
44
- "@typescript-eslint/parser": "^6.0.0",
52
+ "@types/node": "^20.0.0",
53
+ "@typescript-eslint/eslint-plugin": "^8.43.0",
54
+ "@typescript-eslint/parser": "^8.43.0",
45
55
  "eslint": "^8.0.0",
46
56
  "jest": "^29.0.0",
47
57
  "prettier": "^3.0.0",
@@ -51,4 +61,4 @@
51
61
  "dependencies": {
52
62
  "axios": "^1.6.0"
53
63
  }
54
- }
64
+ }