@rainfall-devkit/sdk 0.1.3 → 0.1.4
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/dist/chunk-OT6N7K6Q.mjs +772 -0
- package/dist/chunk-PUYYL2BZ.mjs +753 -0
- package/dist/chunk-PXSDTG55.mjs +764 -0
- package/dist/chunk-U776PJWT.mjs +731 -0
- package/dist/cli/index.js +52 -11
- package/dist/cli/index.mjs +7 -7
- package/dist/errors-COkXMRZk.d.mts +818 -0
- package/dist/errors-COkXMRZk.d.ts +818 -0
- package/dist/errors-DnNhMfS6.d.mts +814 -0
- package/dist/errors-DnNhMfS6.d.ts +814 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +46 -5
- package/dist/index.mjs +1 -1
- package/dist/mcp.d.mts +2 -2
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +46 -5
- package/dist/mcp.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AI, a as ApiError, b as ApiResponse, c as Articles, d as AuthenticationError, D as Data, I as Integrations, M as Memory, N as NetworkError, e as NotFoundError, R as Rainfall, f as RainfallClient, g as RainfallConfig, h as RainfallError, i as RateLimitError, j as RateLimitInfo, k as RequestOptions, S as ServerError, T as TimeoutError, l as ToolNotFoundError, m as ToolSchema, U as Utils, V as ValidationError, W as Web } from './errors-
|
|
1
|
+
export { A as AI, a as ApiError, b as ApiResponse, c as Articles, d as AuthenticationError, D as Data, I as Integrations, M as Memory, N as NetworkError, e as NotFoundError, R as Rainfall, f as RainfallClient, g as RainfallConfig, h as RainfallError, i as RateLimitError, j as RateLimitInfo, k as RequestOptions, S as ServerError, T as TimeoutError, l as ToolNotFoundError, m as ToolSchema, U as Utils, V as ValidationError, W as Web } from './errors-COkXMRZk.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Rainfall SDK - Official SDK for Rainfall API
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AI, a as ApiError, b as ApiResponse, c as Articles, d as AuthenticationError, D as Data, I as Integrations, M as Memory, N as NetworkError, e as NotFoundError, R as Rainfall, f as RainfallClient, g as RainfallConfig, h as RainfallError, i as RateLimitError, j as RateLimitInfo, k as RequestOptions, S as ServerError, T as TimeoutError, l as ToolNotFoundError, m as ToolSchema, U as Utils, V as ValidationError, W as Web } from './errors-
|
|
1
|
+
export { A as AI, a as ApiError, b as ApiResponse, c as Articles, d as AuthenticationError, D as Data, I as Integrations, M as Memory, N as NetworkError, e as NotFoundError, R as Rainfall, f as RainfallClient, g as RainfallConfig, h as RainfallError, i as RateLimitError, j as RateLimitInfo, k as RequestOptions, S as ServerError, T as TimeoutError, l as ToolNotFoundError, m as ToolSchema, U as Utils, V as ValidationError, W as Web } from './errors-COkXMRZk.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Rainfall SDK - Official SDK for Rainfall API
|
package/dist/index.js
CHANGED
|
@@ -185,6 +185,7 @@ var RainfallClient = class {
|
|
|
185
185
|
defaultRetries;
|
|
186
186
|
defaultRetryDelay;
|
|
187
187
|
lastRateLimitInfo;
|
|
188
|
+
subscriberId;
|
|
188
189
|
constructor(config) {
|
|
189
190
|
this.apiKey = config.apiKey;
|
|
190
191
|
this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
|
|
@@ -215,7 +216,7 @@ var RainfallClient = class {
|
|
|
215
216
|
const response = await fetch(url, {
|
|
216
217
|
method,
|
|
217
218
|
headers: {
|
|
218
|
-
"
|
|
219
|
+
"x-api-key": this.apiKey,
|
|
219
220
|
"Content-Type": "application/json",
|
|
220
221
|
"Accept": "application/json",
|
|
221
222
|
"X-Rainfall-SDK-Version": "0.1.0",
|
|
@@ -275,7 +276,8 @@ var RainfallClient = class {
|
|
|
275
276
|
* Execute a tool/node by ID
|
|
276
277
|
*/
|
|
277
278
|
async executeTool(toolId, params, options) {
|
|
278
|
-
|
|
279
|
+
const subscriberId = await this.ensureSubscriberId();
|
|
280
|
+
return this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}`, {
|
|
279
281
|
method: "POST",
|
|
280
282
|
body: params
|
|
281
283
|
}, options);
|
|
@@ -284,19 +286,58 @@ var RainfallClient = class {
|
|
|
284
286
|
* List all available tools
|
|
285
287
|
*/
|
|
286
288
|
async listTools() {
|
|
287
|
-
|
|
289
|
+
const subscriberId = await this.ensureSubscriberId();
|
|
290
|
+
const result = await this.request(`/olympic/subscribers/${subscriberId}/nodes/_utils/node-list`);
|
|
291
|
+
if (result.keys && Array.isArray(result.keys)) {
|
|
292
|
+
return result.keys.map((key) => ({
|
|
293
|
+
id: key,
|
|
294
|
+
name: key,
|
|
295
|
+
description: "",
|
|
296
|
+
category: "general"
|
|
297
|
+
}));
|
|
298
|
+
}
|
|
299
|
+
return result.nodes || [];
|
|
288
300
|
}
|
|
289
301
|
/**
|
|
290
302
|
* Get tool schema/parameters
|
|
291
303
|
*/
|
|
292
304
|
async getToolSchema(toolId) {
|
|
293
|
-
|
|
305
|
+
const subscriberId = await this.ensureSubscriberId();
|
|
306
|
+
return this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}/params`);
|
|
294
307
|
}
|
|
295
308
|
/**
|
|
296
309
|
* Get subscriber info
|
|
297
310
|
*/
|
|
298
311
|
async getMe() {
|
|
299
|
-
|
|
312
|
+
const result = await this.request("/olympic/subscribers/me");
|
|
313
|
+
if (result.subscriber?.id) {
|
|
314
|
+
this.subscriberId = result.subscriber.id;
|
|
315
|
+
}
|
|
316
|
+
const subscriber = result.subscriber;
|
|
317
|
+
return {
|
|
318
|
+
id: subscriber.id,
|
|
319
|
+
name: subscriber.name,
|
|
320
|
+
email: subscriber.google_id,
|
|
321
|
+
billingStatus: subscriber.billing_status,
|
|
322
|
+
plan: subscriber.billing_status,
|
|
323
|
+
usage: {
|
|
324
|
+
callsThisMonth: subscriber.metadata?.usage?.callsThisMonth ?? 0,
|
|
325
|
+
callsLimit: subscriber.metadata?.usage?.callsLimit ?? 5e3
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Ensure we have a subscriber ID, fetching it if necessary
|
|
331
|
+
*/
|
|
332
|
+
async ensureSubscriberId() {
|
|
333
|
+
if (this.subscriberId) {
|
|
334
|
+
return this.subscriberId;
|
|
335
|
+
}
|
|
336
|
+
const me = await this.getMe();
|
|
337
|
+
if (!me.id) {
|
|
338
|
+
throw new RainfallError("Failed to get subscriber ID", "NO_SUBSCRIBER_ID");
|
|
339
|
+
}
|
|
340
|
+
return me.id;
|
|
300
341
|
}
|
|
301
342
|
sleep(ms) {
|
|
302
343
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
package/dist/index.mjs
CHANGED
package/dist/mcp.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as RainfallConfig, R as Rainfall } from './errors-
|
|
2
|
-
export { A as AI, a as ApiError, b as ApiResponse, c as Articles, d as AuthenticationError, D as Data, I as Integrations, M as Memory, N as NetworkError, e as NotFoundError, h as RainfallError, i as RateLimitError, j as RateLimitInfo, k as RequestOptions, S as ServerError, T as TimeoutError, l as ToolNotFoundError, m as ToolSchema, U as Utils, V as ValidationError, W as Web, p as parseErrorResponse } from './errors-
|
|
1
|
+
import { g as RainfallConfig, R as Rainfall } from './errors-COkXMRZk.mjs';
|
|
2
|
+
export { A as AI, a as ApiError, b as ApiResponse, c as Articles, d as AuthenticationError, D as Data, I as Integrations, M as Memory, N as NetworkError, e as NotFoundError, h as RainfallError, i as RateLimitError, j as RateLimitInfo, k as RequestOptions, S as ServerError, T as TimeoutError, l as ToolNotFoundError, m as ToolSchema, U as Utils, V as ValidationError, W as Web, p as parseErrorResponse } from './errors-COkXMRZk.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* MCP (Model Context Protocol) server export for Rainfall SDK
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as RainfallConfig, R as Rainfall } from './errors-
|
|
2
|
-
export { A as AI, a as ApiError, b as ApiResponse, c as Articles, d as AuthenticationError, D as Data, I as Integrations, M as Memory, N as NetworkError, e as NotFoundError, h as RainfallError, i as RateLimitError, j as RateLimitInfo, k as RequestOptions, S as ServerError, T as TimeoutError, l as ToolNotFoundError, m as ToolSchema, U as Utils, V as ValidationError, W as Web, p as parseErrorResponse } from './errors-
|
|
1
|
+
import { g as RainfallConfig, R as Rainfall } from './errors-COkXMRZk.js';
|
|
2
|
+
export { A as AI, a as ApiError, b as ApiResponse, c as Articles, d as AuthenticationError, D as Data, I as Integrations, M as Memory, N as NetworkError, e as NotFoundError, h as RainfallError, i as RateLimitError, j as RateLimitInfo, k as RequestOptions, S as ServerError, T as TimeoutError, l as ToolNotFoundError, m as ToolSchema, U as Utils, V as ValidationError, W as Web, p as parseErrorResponse } from './errors-COkXMRZk.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* MCP (Model Context Protocol) server export for Rainfall SDK
|
package/dist/mcp.js
CHANGED
|
@@ -185,6 +185,7 @@ var RainfallClient = class {
|
|
|
185
185
|
defaultRetries;
|
|
186
186
|
defaultRetryDelay;
|
|
187
187
|
lastRateLimitInfo;
|
|
188
|
+
subscriberId;
|
|
188
189
|
constructor(config) {
|
|
189
190
|
this.apiKey = config.apiKey;
|
|
190
191
|
this.baseUrl = config.baseUrl || DEFAULT_BASE_URL;
|
|
@@ -215,7 +216,7 @@ var RainfallClient = class {
|
|
|
215
216
|
const response = await fetch(url, {
|
|
216
217
|
method,
|
|
217
218
|
headers: {
|
|
218
|
-
"
|
|
219
|
+
"x-api-key": this.apiKey,
|
|
219
220
|
"Content-Type": "application/json",
|
|
220
221
|
"Accept": "application/json",
|
|
221
222
|
"X-Rainfall-SDK-Version": "0.1.0",
|
|
@@ -275,7 +276,8 @@ var RainfallClient = class {
|
|
|
275
276
|
* Execute a tool/node by ID
|
|
276
277
|
*/
|
|
277
278
|
async executeTool(toolId, params, options) {
|
|
278
|
-
|
|
279
|
+
const subscriberId = await this.ensureSubscriberId();
|
|
280
|
+
return this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}`, {
|
|
279
281
|
method: "POST",
|
|
280
282
|
body: params
|
|
281
283
|
}, options);
|
|
@@ -284,19 +286,58 @@ var RainfallClient = class {
|
|
|
284
286
|
* List all available tools
|
|
285
287
|
*/
|
|
286
288
|
async listTools() {
|
|
287
|
-
|
|
289
|
+
const subscriberId = await this.ensureSubscriberId();
|
|
290
|
+
const result = await this.request(`/olympic/subscribers/${subscriberId}/nodes/_utils/node-list`);
|
|
291
|
+
if (result.keys && Array.isArray(result.keys)) {
|
|
292
|
+
return result.keys.map((key) => ({
|
|
293
|
+
id: key,
|
|
294
|
+
name: key,
|
|
295
|
+
description: "",
|
|
296
|
+
category: "general"
|
|
297
|
+
}));
|
|
298
|
+
}
|
|
299
|
+
return result.nodes || [];
|
|
288
300
|
}
|
|
289
301
|
/**
|
|
290
302
|
* Get tool schema/parameters
|
|
291
303
|
*/
|
|
292
304
|
async getToolSchema(toolId) {
|
|
293
|
-
|
|
305
|
+
const subscriberId = await this.ensureSubscriberId();
|
|
306
|
+
return this.request(`/olympic/subscribers/${subscriberId}/nodes/${toolId}/params`);
|
|
294
307
|
}
|
|
295
308
|
/**
|
|
296
309
|
* Get subscriber info
|
|
297
310
|
*/
|
|
298
311
|
async getMe() {
|
|
299
|
-
|
|
312
|
+
const result = await this.request("/olympic/subscribers/me");
|
|
313
|
+
if (result.subscriber?.id) {
|
|
314
|
+
this.subscriberId = result.subscriber.id;
|
|
315
|
+
}
|
|
316
|
+
const subscriber = result.subscriber;
|
|
317
|
+
return {
|
|
318
|
+
id: subscriber.id,
|
|
319
|
+
name: subscriber.name,
|
|
320
|
+
email: subscriber.google_id,
|
|
321
|
+
billingStatus: subscriber.billing_status,
|
|
322
|
+
plan: subscriber.billing_status,
|
|
323
|
+
usage: {
|
|
324
|
+
callsThisMonth: subscriber.metadata?.usage?.callsThisMonth ?? 0,
|
|
325
|
+
callsLimit: subscriber.metadata?.usage?.callsLimit ?? 5e3
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Ensure we have a subscriber ID, fetching it if necessary
|
|
331
|
+
*/
|
|
332
|
+
async ensureSubscriberId() {
|
|
333
|
+
if (this.subscriberId) {
|
|
334
|
+
return this.subscriberId;
|
|
335
|
+
}
|
|
336
|
+
const me = await this.getMe();
|
|
337
|
+
if (!me.id) {
|
|
338
|
+
throw new RainfallError("Failed to get subscriber ID", "NO_SUBSCRIBER_ID");
|
|
339
|
+
}
|
|
340
|
+
return me.id;
|
|
300
341
|
}
|
|
301
342
|
sleep(ms) {
|
|
302
343
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
package/dist/mcp.mjs
CHANGED
package/package.json
CHANGED