@raily/sdk 0.1.0 → 0.2.1
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/index.cjs +23 -2
- package/dist/index.js +13 -2
- package/package.json +29 -7
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -25,9 +35,20 @@ __export(index_exports, {
|
|
|
25
35
|
RailyError: () => RailyError
|
|
26
36
|
});
|
|
27
37
|
module.exports = __toCommonJS(index_exports);
|
|
38
|
+
var import_node_os = __toESM(require("os"), 1);
|
|
28
39
|
var import_client = require("@modelcontextprotocol/sdk/client/index.js");
|
|
29
40
|
var import_streamableHttp = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
30
41
|
var AUTH_SIGNALS = ["401", "403", "unauthorized", "forbidden", "invalid api key", "not active"];
|
|
42
|
+
var CLIENT_NAME = "raily-typescript";
|
|
43
|
+
var VERSION = "0.2.1";
|
|
44
|
+
function userAgent() {
|
|
45
|
+
try {
|
|
46
|
+
const node = process.version.replace(/^v/, "");
|
|
47
|
+
return `${CLIENT_NAME}/${VERSION} (node ${node}; ${import_node_os.default.platform()} ${import_node_os.default.arch()}; async)`;
|
|
48
|
+
} catch {
|
|
49
|
+
return `${CLIENT_NAME}/${VERSION}`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
31
52
|
function properties(tool) {
|
|
32
53
|
return tool.inputSchema?.properties ?? {};
|
|
33
54
|
}
|
|
@@ -96,9 +117,9 @@ var Raily = class {
|
|
|
96
117
|
async search(query, options = {}) {
|
|
97
118
|
if (!query) throw new RailyError("query is required");
|
|
98
119
|
const transport = new import_streamableHttp.StreamableHTTPClientTransport(new URL(this.endpoint), {
|
|
99
|
-
requestInit: { headers: { Authorization: `Bearer ${this.apiKey}
|
|
120
|
+
requestInit: { headers: { Authorization: `Bearer ${this.apiKey}`, "User-Agent": userAgent() } }
|
|
100
121
|
});
|
|
101
|
-
const client = new import_client.Client({ name:
|
|
122
|
+
const client = new import_client.Client({ name: CLIENT_NAME, version: VERSION }, { capabilities: {} });
|
|
102
123
|
const limit = options.limit ?? 3;
|
|
103
124
|
try {
|
|
104
125
|
await client.connect(transport);
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
+
import os from "os";
|
|
2
3
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
3
4
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
4
5
|
var AUTH_SIGNALS = ["401", "403", "unauthorized", "forbidden", "invalid api key", "not active"];
|
|
6
|
+
var CLIENT_NAME = "raily-typescript";
|
|
7
|
+
var VERSION = "0.2.1";
|
|
8
|
+
function userAgent() {
|
|
9
|
+
try {
|
|
10
|
+
const node = process.version.replace(/^v/, "");
|
|
11
|
+
return `${CLIENT_NAME}/${VERSION} (node ${node}; ${os.platform()} ${os.arch()}; async)`;
|
|
12
|
+
} catch {
|
|
13
|
+
return `${CLIENT_NAME}/${VERSION}`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
5
16
|
function properties(tool) {
|
|
6
17
|
return tool.inputSchema?.properties ?? {};
|
|
7
18
|
}
|
|
@@ -70,9 +81,9 @@ var Raily = class {
|
|
|
70
81
|
async search(query, options = {}) {
|
|
71
82
|
if (!query) throw new RailyError("query is required");
|
|
72
83
|
const transport = new StreamableHTTPClientTransport(new URL(this.endpoint), {
|
|
73
|
-
requestInit: { headers: { Authorization: `Bearer ${this.apiKey}
|
|
84
|
+
requestInit: { headers: { Authorization: `Bearer ${this.apiKey}`, "User-Agent": userAgent() } }
|
|
74
85
|
});
|
|
75
|
-
const client = new Client({ name:
|
|
86
|
+
const client = new Client({ name: CLIENT_NAME, version: VERSION }, { capabilities: {} });
|
|
76
87
|
const limit = options.limit ?? 3;
|
|
77
88
|
try {
|
|
78
89
|
await client.connect(transport);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raily/sdk",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Official TypeScript SDK for the Raily search API.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -9,14 +9,34 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
-
"import": {
|
|
13
|
-
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.cts",
|
|
18
|
+
"default": "./dist/index.cjs"
|
|
19
|
+
}
|
|
14
20
|
}
|
|
15
21
|
},
|
|
16
|
-
"files": [
|
|
17
|
-
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/Raily-ai/raily-typescript.git"
|
|
30
|
+
},
|
|
18
31
|
"homepage": "https://docs.raily.ai",
|
|
19
|
-
"keywords": [
|
|
32
|
+
"keywords": [
|
|
33
|
+
"raily",
|
|
34
|
+
"search",
|
|
35
|
+
"retrieval",
|
|
36
|
+
"rag",
|
|
37
|
+
"mcp",
|
|
38
|
+
"sdk"
|
|
39
|
+
],
|
|
20
40
|
"scripts": {
|
|
21
41
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean",
|
|
22
42
|
"typecheck": "tsc --noEmit",
|
|
@@ -31,5 +51,7 @@
|
|
|
31
51
|
"typescript": "^5.6.0",
|
|
32
52
|
"vitest": "^2.1.0"
|
|
33
53
|
},
|
|
34
|
-
"engines": {
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=18"
|
|
56
|
+
}
|
|
35
57
|
}
|