@mcp-z/client 1.0.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/AGENTS.md +159 -0
- package/LICENSE +21 -0
- package/README.md +90 -0
- package/dist/cjs/auth/capability-discovery.d.cts +25 -0
- package/dist/cjs/auth/capability-discovery.d.ts +25 -0
- package/dist/cjs/auth/capability-discovery.js +280 -0
- package/dist/cjs/auth/capability-discovery.js.map +1 -0
- package/dist/cjs/auth/index.d.cts +9 -0
- package/dist/cjs/auth/index.d.ts +9 -0
- package/dist/cjs/auth/index.js +28 -0
- package/dist/cjs/auth/index.js.map +1 -0
- package/dist/cjs/auth/interactive-oauth-flow.d.cts +58 -0
- package/dist/cjs/auth/interactive-oauth-flow.d.ts +58 -0
- package/dist/cjs/auth/interactive-oauth-flow.js +537 -0
- package/dist/cjs/auth/interactive-oauth-flow.js.map +1 -0
- package/dist/cjs/auth/oauth-callback-listener.d.cts +56 -0
- package/dist/cjs/auth/oauth-callback-listener.d.ts +56 -0
- package/dist/cjs/auth/oauth-callback-listener.js +333 -0
- package/dist/cjs/auth/oauth-callback-listener.js.map +1 -0
- package/dist/cjs/auth/pkce.d.cts +17 -0
- package/dist/cjs/auth/pkce.d.ts +17 -0
- package/dist/cjs/auth/pkce.js +192 -0
- package/dist/cjs/auth/pkce.js.map +1 -0
- package/dist/cjs/auth/rfc9728-discovery.d.cts +34 -0
- package/dist/cjs/auth/rfc9728-discovery.d.ts +34 -0
- package/dist/cjs/auth/rfc9728-discovery.js +436 -0
- package/dist/cjs/auth/rfc9728-discovery.js.map +1 -0
- package/dist/cjs/auth/types.d.cts +137 -0
- package/dist/cjs/auth/types.d.ts +137 -0
- package/dist/cjs/auth/types.js +9 -0
- package/dist/cjs/auth/types.js.map +1 -0
- package/dist/cjs/client-helpers.d.cts +55 -0
- package/dist/cjs/client-helpers.d.ts +55 -0
- package/dist/cjs/client-helpers.js +128 -0
- package/dist/cjs/client-helpers.js.map +1 -0
- package/dist/cjs/config/server-loader.d.cts +27 -0
- package/dist/cjs/config/server-loader.d.ts +27 -0
- package/dist/cjs/config/server-loader.js +111 -0
- package/dist/cjs/config/server-loader.js.map +1 -0
- package/dist/cjs/config/validate-config.d.cts +15 -0
- package/dist/cjs/config/validate-config.d.ts +15 -0
- package/dist/cjs/config/validate-config.js +128 -0
- package/dist/cjs/config/validate-config.js.map +1 -0
- package/dist/cjs/connection/connect-client.d.cts +59 -0
- package/dist/cjs/connection/connect-client.d.ts +59 -0
- package/dist/cjs/connection/connect-client.js +536 -0
- package/dist/cjs/connection/connect-client.js.map +1 -0
- package/dist/cjs/connection/existing-process-transport.d.cts +40 -0
- package/dist/cjs/connection/existing-process-transport.d.ts +40 -0
- package/dist/cjs/connection/existing-process-transport.js +274 -0
- package/dist/cjs/connection/existing-process-transport.js.map +1 -0
- package/dist/cjs/connection/types.d.cts +61 -0
- package/dist/cjs/connection/types.d.ts +61 -0
- package/dist/cjs/connection/types.js +53 -0
- package/dist/cjs/connection/types.js.map +1 -0
- package/dist/cjs/connection/wait-for-http-ready.d.cts +15 -0
- package/dist/cjs/connection/wait-for-http-ready.d.ts +15 -0
- package/dist/cjs/connection/wait-for-http-ready.js +232 -0
- package/dist/cjs/connection/wait-for-http-ready.js.map +1 -0
- package/dist/cjs/dcr/dcr-authenticator.d.cts +73 -0
- package/dist/cjs/dcr/dcr-authenticator.d.ts +73 -0
- package/dist/cjs/dcr/dcr-authenticator.js +655 -0
- package/dist/cjs/dcr/dcr-authenticator.js.map +1 -0
- package/dist/cjs/dcr/dynamic-client-registrar.d.cts +28 -0
- package/dist/cjs/dcr/dynamic-client-registrar.d.ts +28 -0
- package/dist/cjs/dcr/dynamic-client-registrar.js +245 -0
- package/dist/cjs/dcr/dynamic-client-registrar.js.map +1 -0
- package/dist/cjs/dcr/index.d.cts +8 -0
- package/dist/cjs/dcr/index.d.ts +8 -0
- package/dist/cjs/dcr/index.js +24 -0
- package/dist/cjs/dcr/index.js.map +1 -0
- package/dist/cjs/index.d.cts +21 -0
- package/dist/cjs/index.d.ts +21 -0
- package/dist/cjs/index.js +94 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/monkey-patches.d.cts +6 -0
- package/dist/cjs/monkey-patches.d.ts +6 -0
- package/dist/cjs/monkey-patches.js +236 -0
- package/dist/cjs/monkey-patches.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/response-wrappers.d.cts +41 -0
- package/dist/cjs/response-wrappers.d.ts +41 -0
- package/dist/cjs/response-wrappers.js +443 -0
- package/dist/cjs/response-wrappers.js.map +1 -0
- package/dist/cjs/search/index.d.cts +6 -0
- package/dist/cjs/search/index.d.ts +6 -0
- package/dist/cjs/search/index.js +25 -0
- package/dist/cjs/search/index.js.map +1 -0
- package/dist/cjs/search/search.d.cts +22 -0
- package/dist/cjs/search/search.d.ts +22 -0
- package/dist/cjs/search/search.js +630 -0
- package/dist/cjs/search/search.js.map +1 -0
- package/dist/cjs/search/types.d.cts +122 -0
- package/dist/cjs/search/types.d.ts +122 -0
- package/dist/cjs/search/types.js +10 -0
- package/dist/cjs/search/types.js.map +1 -0
- package/dist/cjs/spawn/spawn-server.d.cts +83 -0
- package/dist/cjs/spawn/spawn-server.d.ts +83 -0
- package/dist/cjs/spawn/spawn-server.js +410 -0
- package/dist/cjs/spawn/spawn-server.js.map +1 -0
- package/dist/cjs/spawn/spawn-servers.d.cts +151 -0
- package/dist/cjs/spawn/spawn-servers.d.ts +151 -0
- package/dist/cjs/spawn/spawn-servers.js +911 -0
- package/dist/cjs/spawn/spawn-servers.js.map +1 -0
- package/dist/cjs/types.d.cts +11 -0
- package/dist/cjs/types.d.ts +11 -0
- package/dist/cjs/types.js +10 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/utils/logger.d.cts +24 -0
- package/dist/cjs/utils/logger.d.ts +24 -0
- package/dist/cjs/utils/logger.js +80 -0
- package/dist/cjs/utils/logger.js.map +1 -0
- package/dist/cjs/utils/path-utils.d.cts +45 -0
- package/dist/cjs/utils/path-utils.d.ts +45 -0
- package/dist/cjs/utils/path-utils.js +158 -0
- package/dist/cjs/utils/path-utils.js.map +1 -0
- package/dist/cjs/utils/sanitizer.d.cts +30 -0
- package/dist/cjs/utils/sanitizer.d.ts +30 -0
- package/dist/cjs/utils/sanitizer.js +124 -0
- package/dist/cjs/utils/sanitizer.js.map +1 -0
- package/dist/esm/auth/capability-discovery.d.ts +25 -0
- package/dist/esm/auth/capability-discovery.js +110 -0
- package/dist/esm/auth/capability-discovery.js.map +1 -0
- package/dist/esm/auth/index.d.ts +9 -0
- package/dist/esm/auth/index.js +6 -0
- package/dist/esm/auth/index.js.map +1 -0
- package/dist/esm/auth/interactive-oauth-flow.d.ts +58 -0
- package/dist/esm/auth/interactive-oauth-flow.js +217 -0
- package/dist/esm/auth/interactive-oauth-flow.js.map +1 -0
- package/dist/esm/auth/oauth-callback-listener.d.ts +56 -0
- package/dist/esm/auth/oauth-callback-listener.js +166 -0
- package/dist/esm/auth/oauth-callback-listener.js.map +1 -0
- package/dist/esm/auth/pkce.d.ts +17 -0
- package/dist/esm/auth/pkce.js +41 -0
- package/dist/esm/auth/pkce.js.map +1 -0
- package/dist/esm/auth/rfc9728-discovery.d.ts +34 -0
- package/dist/esm/auth/rfc9728-discovery.js +157 -0
- package/dist/esm/auth/rfc9728-discovery.js.map +1 -0
- package/dist/esm/auth/types.d.ts +137 -0
- package/dist/esm/auth/types.js +7 -0
- package/dist/esm/auth/types.js.map +1 -0
- package/dist/esm/client-helpers.d.ts +55 -0
- package/dist/esm/client-helpers.js +81 -0
- package/dist/esm/client-helpers.js.map +1 -0
- package/dist/esm/config/server-loader.d.ts +27 -0
- package/dist/esm/config/server-loader.js +49 -0
- package/dist/esm/config/server-loader.js.map +1 -0
- package/dist/esm/config/validate-config.d.ts +15 -0
- package/dist/esm/config/validate-config.js +76 -0
- package/dist/esm/config/validate-config.js.map +1 -0
- package/dist/esm/connection/connect-client.d.ts +59 -0
- package/dist/esm/connection/connect-client.js +272 -0
- package/dist/esm/connection/connect-client.js.map +1 -0
- package/dist/esm/connection/existing-process-transport.d.ts +40 -0
- package/dist/esm/connection/existing-process-transport.js +103 -0
- package/dist/esm/connection/existing-process-transport.js.map +1 -0
- package/dist/esm/connection/types.d.ts +61 -0
- package/dist/esm/connection/types.js +34 -0
- package/dist/esm/connection/types.js.map +1 -0
- package/dist/esm/connection/wait-for-http-ready.d.ts +15 -0
- package/dist/esm/connection/wait-for-http-ready.js +43 -0
- package/dist/esm/connection/wait-for-http-ready.js.map +1 -0
- package/dist/esm/dcr/dcr-authenticator.d.ts +73 -0
- package/dist/esm/dcr/dcr-authenticator.js +235 -0
- package/dist/esm/dcr/dcr-authenticator.js.map +1 -0
- package/dist/esm/dcr/dynamic-client-registrar.d.ts +28 -0
- package/dist/esm/dcr/dynamic-client-registrar.js +66 -0
- package/dist/esm/dcr/dynamic-client-registrar.js.map +1 -0
- package/dist/esm/dcr/index.d.ts +8 -0
- package/dist/esm/dcr/index.js +5 -0
- package/dist/esm/dcr/index.js.map +1 -0
- package/dist/esm/index.d.ts +21 -0
- package/dist/esm/index.js +22 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/monkey-patches.d.ts +6 -0
- package/dist/esm/monkey-patches.js +32 -0
- package/dist/esm/monkey-patches.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/response-wrappers.d.ts +41 -0
- package/dist/esm/response-wrappers.js +201 -0
- package/dist/esm/response-wrappers.js.map +1 -0
- package/dist/esm/search/index.d.ts +6 -0
- package/dist/esm/search/index.js +3 -0
- package/dist/esm/search/index.js.map +1 -0
- package/dist/esm/search/search.d.ts +22 -0
- package/dist/esm/search/search.js +236 -0
- package/dist/esm/search/search.js.map +1 -0
- package/dist/esm/search/types.d.ts +122 -0
- package/dist/esm/search/types.js +8 -0
- package/dist/esm/search/types.js.map +1 -0
- package/dist/esm/spawn/spawn-server.d.ts +83 -0
- package/dist/esm/spawn/spawn-server.js +145 -0
- package/dist/esm/spawn/spawn-server.js.map +1 -0
- package/dist/esm/spawn/spawn-servers.d.ts +151 -0
- package/dist/esm/spawn/spawn-servers.js +406 -0
- package/dist/esm/spawn/spawn-servers.js.map +1 -0
- package/dist/esm/types.d.ts +11 -0
- package/dist/esm/types.js +9 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/utils/logger.d.ts +24 -0
- package/dist/esm/utils/logger.js +59 -0
- package/dist/esm/utils/logger.js.map +1 -0
- package/dist/esm/utils/path-utils.d.ts +45 -0
- package/dist/esm/utils/path-utils.js +89 -0
- package/dist/esm/utils/path-utils.js.map +1 -0
- package/dist/esm/utils/sanitizer.d.ts +30 -0
- package/dist/esm/utils/sanitizer.js +43 -0
- package/dist/esm/utils/sanitizer.js.map +1 -0
- package/package.json +92 -0
- package/schemas/servers.d.ts +90 -0
- package/schemas/servers.schema.json +104 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* existing-process-transport.ts
|
|
3
|
+
*
|
|
4
|
+
* MCP transport that wraps an existing child process for stdio communication.
|
|
5
|
+
* Used when connecting to servers already spawned by initServers().
|
|
6
|
+
*/ "use strict";
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(exports, "ExistingProcessTransport", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function() {
|
|
13
|
+
return ExistingProcessTransport;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
var _stdio = require("@modelcontextprotocol/sdk/shared/stdio.js");
|
|
17
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
18
|
+
try {
|
|
19
|
+
var info = gen[key](arg);
|
|
20
|
+
var value = info.value;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
reject(error);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (info.done) {
|
|
26
|
+
resolve(value);
|
|
27
|
+
} else {
|
|
28
|
+
Promise.resolve(value).then(_next, _throw);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function _async_to_generator(fn) {
|
|
32
|
+
return function() {
|
|
33
|
+
var self = this, args = arguments;
|
|
34
|
+
return new Promise(function(resolve, reject) {
|
|
35
|
+
var gen = fn.apply(self, args);
|
|
36
|
+
function _next(value) {
|
|
37
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
38
|
+
}
|
|
39
|
+
function _throw(err) {
|
|
40
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
41
|
+
}
|
|
42
|
+
_next(undefined);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function _class_call_check(instance, Constructor) {
|
|
47
|
+
if (!(instance instanceof Constructor)) {
|
|
48
|
+
throw new TypeError("Cannot call a class as a function");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function _ts_generator(thisArg, body) {
|
|
52
|
+
var f, y, t, _ = {
|
|
53
|
+
label: 0,
|
|
54
|
+
sent: function() {
|
|
55
|
+
if (t[0] & 1) throw t[1];
|
|
56
|
+
return t[1];
|
|
57
|
+
},
|
|
58
|
+
trys: [],
|
|
59
|
+
ops: []
|
|
60
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
61
|
+
return d(g, "next", {
|
|
62
|
+
value: verb(0)
|
|
63
|
+
}), d(g, "throw", {
|
|
64
|
+
value: verb(1)
|
|
65
|
+
}), d(g, "return", {
|
|
66
|
+
value: verb(2)
|
|
67
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
68
|
+
value: function() {
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
}), g;
|
|
72
|
+
function verb(n) {
|
|
73
|
+
return function(v) {
|
|
74
|
+
return step([
|
|
75
|
+
n,
|
|
76
|
+
v
|
|
77
|
+
]);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function step(op) {
|
|
81
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
82
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
83
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
84
|
+
if (y = 0, t) op = [
|
|
85
|
+
op[0] & 2,
|
|
86
|
+
t.value
|
|
87
|
+
];
|
|
88
|
+
switch(op[0]){
|
|
89
|
+
case 0:
|
|
90
|
+
case 1:
|
|
91
|
+
t = op;
|
|
92
|
+
break;
|
|
93
|
+
case 4:
|
|
94
|
+
_.label++;
|
|
95
|
+
return {
|
|
96
|
+
value: op[1],
|
|
97
|
+
done: false
|
|
98
|
+
};
|
|
99
|
+
case 5:
|
|
100
|
+
_.label++;
|
|
101
|
+
y = op[1];
|
|
102
|
+
op = [
|
|
103
|
+
0
|
|
104
|
+
];
|
|
105
|
+
continue;
|
|
106
|
+
case 7:
|
|
107
|
+
op = _.ops.pop();
|
|
108
|
+
_.trys.pop();
|
|
109
|
+
continue;
|
|
110
|
+
default:
|
|
111
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
112
|
+
_ = 0;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
116
|
+
_.label = op[1];
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
120
|
+
_.label = t[1];
|
|
121
|
+
t = op;
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
if (t && _.label < t[2]) {
|
|
125
|
+
_.label = t[2];
|
|
126
|
+
_.ops.push(op);
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
if (t[2]) _.ops.pop();
|
|
130
|
+
_.trys.pop();
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
op = body.call(thisArg, _);
|
|
134
|
+
} catch (e) {
|
|
135
|
+
op = [
|
|
136
|
+
6,
|
|
137
|
+
e
|
|
138
|
+
];
|
|
139
|
+
y = 0;
|
|
140
|
+
} finally{
|
|
141
|
+
f = t = 0;
|
|
142
|
+
}
|
|
143
|
+
if (op[0] & 5) throw op[1];
|
|
144
|
+
return {
|
|
145
|
+
value: op[0] ? op[1] : void 0,
|
|
146
|
+
done: true
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
var ExistingProcessTransport = /*#__PURE__*/ function() {
|
|
151
|
+
"use strict";
|
|
152
|
+
function ExistingProcessTransport(process) {
|
|
153
|
+
_class_call_check(this, ExistingProcessTransport);
|
|
154
|
+
this._dataHandler = null;
|
|
155
|
+
this._errorHandler = null;
|
|
156
|
+
if (!process.stdin || !process.stdout) {
|
|
157
|
+
throw new Error('Child process must have stdin and stdout pipes');
|
|
158
|
+
}
|
|
159
|
+
this._process = process;
|
|
160
|
+
this._readBuffer = new _stdio.ReadBuffer();
|
|
161
|
+
}
|
|
162
|
+
var _proto = ExistingProcessTransport.prototype;
|
|
163
|
+
/**
|
|
164
|
+
* Start the transport - sets up stdio listeners on existing process.
|
|
165
|
+
*/ _proto.start = function start() {
|
|
166
|
+
return _async_to_generator(function() {
|
|
167
|
+
var _this;
|
|
168
|
+
return _ts_generator(this, function(_state) {
|
|
169
|
+
_this = this;
|
|
170
|
+
return [
|
|
171
|
+
2,
|
|
172
|
+
new Promise(function(resolve, reject) {
|
|
173
|
+
var // Listen for stdout data (MCP messages)
|
|
174
|
+
_this__process_stdout, _this__process_stdout1, _this__process_stdin;
|
|
175
|
+
// Listen for process events
|
|
176
|
+
_this._process.on('error', function(error) {
|
|
177
|
+
var _this_onerror, _this1;
|
|
178
|
+
(_this_onerror = (_this1 = _this).onerror) === null || _this_onerror === void 0 ? void 0 : _this_onerror.call(_this1, error);
|
|
179
|
+
reject(error);
|
|
180
|
+
});
|
|
181
|
+
_this._process.on('close', function() {
|
|
182
|
+
var _this_onclose, _this1;
|
|
183
|
+
(_this_onclose = (_this1 = _this).onclose) === null || _this_onclose === void 0 ? void 0 : _this_onclose.call(_this1);
|
|
184
|
+
});
|
|
185
|
+
// Create and save data handler for close
|
|
186
|
+
_this._dataHandler = function(chunk) {
|
|
187
|
+
_this._readBuffer.append(chunk);
|
|
188
|
+
_this.processReadBuffer();
|
|
189
|
+
};
|
|
190
|
+
// Create and save error handler for close
|
|
191
|
+
_this._errorHandler = function(error) {
|
|
192
|
+
var _this_onerror, _this1;
|
|
193
|
+
(_this_onerror = (_this1 = _this).onerror) === null || _this_onerror === void 0 ? void 0 : _this_onerror.call(_this1, error);
|
|
194
|
+
};
|
|
195
|
+
(_this__process_stdout = _this._process.stdout) === null || _this__process_stdout === void 0 ? void 0 : _this__process_stdout.on('data', _this._dataHandler);
|
|
196
|
+
(_this__process_stdout1 = _this._process.stdout) === null || _this__process_stdout1 === void 0 ? void 0 : _this__process_stdout1.on('error', _this._errorHandler);
|
|
197
|
+
(_this__process_stdin = _this._process.stdin) === null || _this__process_stdin === void 0 ? void 0 : _this__process_stdin.on('error', _this._errorHandler);
|
|
198
|
+
// Process is already running - resolve immediately
|
|
199
|
+
resolve();
|
|
200
|
+
})
|
|
201
|
+
];
|
|
202
|
+
});
|
|
203
|
+
}).call(this);
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Process buffered messages from stdout.
|
|
207
|
+
*/ _proto.processReadBuffer = function processReadBuffer() {
|
|
208
|
+
while(true){
|
|
209
|
+
try {
|
|
210
|
+
var _this_onmessage, _this;
|
|
211
|
+
var message = this._readBuffer.readMessage();
|
|
212
|
+
if (message === null) {
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
(_this_onmessage = (_this = this).onmessage) === null || _this_onmessage === void 0 ? void 0 : _this_onmessage.call(_this, message);
|
|
216
|
+
} catch (error) {
|
|
217
|
+
var _this_onerror, _this1;
|
|
218
|
+
(_this_onerror = (_this1 = this).onerror) === null || _this_onerror === void 0 ? void 0 : _this_onerror.call(_this1, error);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Close the transport - close without killing the shared process.
|
|
224
|
+
* The process is managed by the cluster and may have other active connections.
|
|
225
|
+
*/ _proto.close = function close() {
|
|
226
|
+
return _async_to_generator(function() {
|
|
227
|
+
var _this__process_stdout, _this__process_stdout1, _this__process_stdin;
|
|
228
|
+
return _ts_generator(this, function(_state) {
|
|
229
|
+
if (this._dataHandler) {
|
|
230
|
+
;
|
|
231
|
+
(_this__process_stdout = this._process.stdout) === null || _this__process_stdout === void 0 ? void 0 : _this__process_stdout.off('data', this._dataHandler);
|
|
232
|
+
this._dataHandler = null;
|
|
233
|
+
}
|
|
234
|
+
if (this._errorHandler) {
|
|
235
|
+
;
|
|
236
|
+
(_this__process_stdout1 = this._process.stdout) === null || _this__process_stdout1 === void 0 ? void 0 : _this__process_stdout1.off('error', this._errorHandler);
|
|
237
|
+
(_this__process_stdin = this._process.stdin) === null || _this__process_stdin === void 0 ? void 0 : _this__process_stdin.off('error', this._errorHandler);
|
|
238
|
+
this._errorHandler = null;
|
|
239
|
+
}
|
|
240
|
+
this._readBuffer.clear();
|
|
241
|
+
return [
|
|
242
|
+
2
|
|
243
|
+
];
|
|
244
|
+
});
|
|
245
|
+
}).call(this);
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* Send a message to the server via stdin.
|
|
249
|
+
*/ _proto.send = function send(message) {
|
|
250
|
+
return _async_to_generator(function() {
|
|
251
|
+
var _this;
|
|
252
|
+
return _ts_generator(this, function(_state) {
|
|
253
|
+
_this = this;
|
|
254
|
+
return [
|
|
255
|
+
2,
|
|
256
|
+
new Promise(function(resolve, reject) {
|
|
257
|
+
if (!_this._process.stdin) {
|
|
258
|
+
reject(new Error('stdin is not available'));
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
var json = (0, _stdio.serializeMessage)(message);
|
|
262
|
+
if (_this._process.stdin.write(json)) {
|
|
263
|
+
resolve();
|
|
264
|
+
} else {
|
|
265
|
+
_this._process.stdin.once('drain', resolve);
|
|
266
|
+
}
|
|
267
|
+
})
|
|
268
|
+
];
|
|
269
|
+
});
|
|
270
|
+
}).call(this);
|
|
271
|
+
};
|
|
272
|
+
return ExistingProcessTransport;
|
|
273
|
+
}();
|
|
274
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/Projects/ai/mcp-z/libs/client/src/connection/existing-process-transport.ts"],"sourcesContent":["/**\n * existing-process-transport.ts\n *\n * MCP transport that wraps an existing child process for stdio communication.\n * Used when connecting to servers already spawned by initServers().\n */\n\nimport { ReadBuffer, serializeMessage } from '@modelcontextprotocol/sdk/shared/stdio.js';\nimport type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';\nimport type { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';\nimport type { ChildProcess } from 'child_process';\n\n/**\n * Transport that communicates with an existing child process via stdio.\n * Does NOT spawn a new process - uses the one provided.\n */\nexport class ExistingProcessTransport implements Transport {\n private _process: ChildProcess;\n private _readBuffer: ReadBuffer;\n private _dataHandler: ((chunk: Buffer) => void) | null = null;\n private _errorHandler: ((error: Error) => void) | null = null;\n\n // Transport interface callbacks\n onclose?: () => void;\n onerror?: (error: Error) => void;\n onmessage?: (message: JSONRPCMessage) => void;\n\n constructor(process: ChildProcess) {\n if (!process.stdin || !process.stdout) {\n throw new Error('Child process must have stdin and stdout pipes');\n }\n\n this._process = process;\n this._readBuffer = new ReadBuffer();\n }\n\n /**\n * Start the transport - sets up stdio listeners on existing process.\n */\n async start(): Promise<void> {\n return new Promise((resolve, reject) => {\n // Listen for process events\n this._process.on('error', (error) => {\n this.onerror?.(error);\n reject(error);\n });\n\n this._process.on('close', () => {\n this.onclose?.();\n });\n\n // Create and save data handler for close\n this._dataHandler = (chunk: Buffer) => {\n this._readBuffer.append(chunk);\n this.processReadBuffer();\n };\n\n // Create and save error handler for close\n this._errorHandler = (error: Error) => {\n this.onerror?.(error);\n };\n\n // Listen for stdout data (MCP messages)\n this._process.stdout?.on('data', this._dataHandler);\n this._process.stdout?.on('error', this._errorHandler);\n this._process.stdin?.on('error', this._errorHandler);\n\n // Process is already running - resolve immediately\n resolve();\n });\n }\n\n /**\n * Process buffered messages from stdout.\n */\n private processReadBuffer(): void {\n while (true) {\n try {\n const message = this._readBuffer.readMessage();\n if (message === null) {\n break;\n }\n this.onmessage?.(message);\n } catch (error) {\n this.onerror?.(error as Error);\n }\n }\n }\n\n /**\n * Close the transport - close without killing the shared process.\n * The process is managed by the cluster and may have other active connections.\n */\n async close(): Promise<void> {\n if (this._dataHandler) {\n this._process.stdout?.off('data', this._dataHandler);\n this._dataHandler = null;\n }\n\n if (this._errorHandler) {\n this._process.stdout?.off('error', this._errorHandler);\n this._process.stdin?.off('error', this._errorHandler);\n this._errorHandler = null;\n }\n\n this._readBuffer.clear();\n }\n\n /**\n * Send a message to the server via stdin.\n */\n async send(message: JSONRPCMessage): Promise<void> {\n return new Promise((resolve, reject) => {\n if (!this._process.stdin) {\n reject(new Error('stdin is not available'));\n return;\n }\n\n const json = serializeMessage(message);\n\n if (this._process.stdin.write(json)) {\n resolve();\n } else {\n this._process.stdin.once('drain', resolve);\n }\n });\n }\n}\n"],"names":["ExistingProcessTransport","process","_dataHandler","_errorHandler","stdin","stdout","Error","_process","_readBuffer","ReadBuffer","start","Promise","resolve","reject","on","error","onerror","onclose","chunk","append","processReadBuffer","message","readMessage","onmessage","close","off","clear","send","json","serializeMessage","write","once"],"mappings":"AAAA;;;;;CAKC;;;;+BAWYA;;;eAAAA;;;qBATgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAStC,IAAA,AAAMA,yCAAN;;aAAMA,yBAWCC,OAAqB;gCAXtBD;aAGHE,eAAiD;aACjDC,gBAAiD;QAQvD,IAAI,CAACF,QAAQG,KAAK,IAAI,CAACH,QAAQI,MAAM,EAAE;YACrC,MAAM,IAAIC,MAAM;QAClB;QAEA,IAAI,CAACC,QAAQ,GAAGN;QAChB,IAAI,CAACO,WAAW,GAAG,IAAIC,iBAAU;;iBAjBxBT;IAoBX;;GAEC,GACD,OAAMU,KA+BL,GA/BD,SAAMA;;;;;gBACJ;;oBAAO,IAAIC,QAAQ,SAACC,SAASC;4BAsB3B,wCAAwC;wBACxC,uBACA,wBACA;wBAxBA,4BAA4B;wBAC5B,MAAKN,QAAQ,CAACO,EAAE,CAAC,SAAS,SAACC;gCACzB,eAAA;6BAAA,gBAAA,CAAA,gBAAKC,OAAO,cAAZ,oCAAA,mBAAA,QAAeD;4BACfF,OAAOE;wBACT;wBAEA,MAAKR,QAAQ,CAACO,EAAE,CAAC,SAAS;gCACxB,eAAA;6BAAA,gBAAA,CAAA,gBAAKG,OAAO,cAAZ,oCAAA,mBAAA;wBACF;wBAEA,yCAAyC;wBACzC,MAAKf,YAAY,GAAG,SAACgB;4BACnB,MAAKV,WAAW,CAACW,MAAM,CAACD;4BACxB,MAAKE,iBAAiB;wBACxB;wBAEA,0CAA0C;wBAC1C,MAAKjB,aAAa,GAAG,SAACY;gCACpB,eAAA;6BAAA,gBAAA,CAAA,gBAAKC,OAAO,cAAZ,oCAAA,mBAAA,QAAeD;wBACjB;yBAGA,wBAAA,MAAKR,QAAQ,CAACF,MAAM,cAApB,4CAAA,sBAAsBS,EAAE,CAAC,QAAQ,MAAKZ,YAAY;yBAClD,yBAAA,MAAKK,QAAQ,CAACF,MAAM,cAApB,6CAAA,uBAAsBS,EAAE,CAAC,SAAS,MAAKX,aAAa;yBACpD,uBAAA,MAAKI,QAAQ,CAACH,KAAK,cAAnB,2CAAA,qBAAqBU,EAAE,CAAC,SAAS,MAAKX,aAAa;wBAEnD,mDAAmD;wBACnDS;oBACF;;;QACF;;IAEA;;GAEC,GACD,OAAQQ,iBAYP,GAZD,SAAQA;QACN,MAAO,KAAM;YACX,IAAI;oBAKF,iBAAA;gBAJA,IAAMC,UAAU,IAAI,CAACb,WAAW,CAACc,WAAW;gBAC5C,IAAID,YAAY,MAAM;oBACpB;gBACF;iBACA,kBAAA,CAAA,QAAA,IAAI,EAACE,SAAS,cAAd,sCAAA,qBAAA,OAAiBF;YACnB,EAAE,OAAON,OAAO;oBACd,eAAA;iBAAA,gBAAA,CAAA,SAAA,IAAI,EAACC,OAAO,cAAZ,oCAAA,mBAAA,QAAeD;YACjB;QACF;IACF;IAEA;;;GAGC,GACD,OAAMS,KAaL,GAbD,SAAMA;;gBAEF,uBAKA,wBACA;;gBAPF,IAAI,IAAI,CAACtB,YAAY,EAAE;;qBACrB,wBAAA,IAAI,CAACK,QAAQ,CAACF,MAAM,cAApB,4CAAA,sBAAsBoB,GAAG,CAAC,QAAQ,IAAI,CAACvB,YAAY;oBACnD,IAAI,CAACA,YAAY,GAAG;gBACtB;gBAEA,IAAI,IAAI,CAACC,aAAa,EAAE;;qBACtB,yBAAA,IAAI,CAACI,QAAQ,CAACF,MAAM,cAApB,6CAAA,uBAAsBoB,GAAG,CAAC,SAAS,IAAI,CAACtB,aAAa;qBACrD,uBAAA,IAAI,CAACI,QAAQ,CAACH,KAAK,cAAnB,2CAAA,qBAAqBqB,GAAG,CAAC,SAAS,IAAI,CAACtB,aAAa;oBACpD,IAAI,CAACA,aAAa,GAAG;gBACvB;gBAEA,IAAI,CAACK,WAAW,CAACkB,KAAK;;;;;QACxB;;IAEA;;GAEC,GACD,OAAMC,IAeL,GAfD,SAAMA,KAAKN,OAAuB;;;;;gBAChC;;oBAAO,IAAIV,QAAQ,SAACC,SAASC;wBAC3B,IAAI,CAAC,MAAKN,QAAQ,CAACH,KAAK,EAAE;4BACxBS,OAAO,IAAIP,MAAM;4BACjB;wBACF;wBAEA,IAAMsB,OAAOC,IAAAA,uBAAgB,EAACR;wBAE9B,IAAI,MAAKd,QAAQ,CAACH,KAAK,CAAC0B,KAAK,CAACF,OAAO;4BACnChB;wBACF,OAAO;4BACL,MAAKL,QAAQ,CAACH,KAAK,CAAC2B,IAAI,CAAC,SAASnB;wBACpC;oBACF;;;QACF;;WA9GWZ"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions and type guards for CLI
|
|
3
|
+
* Per project convention, all types and runtime validators in single file
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* JSON-serializable value type per MCP spec
|
|
7
|
+
* Used for tool arguments and responses
|
|
8
|
+
*/
|
|
9
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
10
|
+
[key: string]: JsonValue;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Tool arguments must be JSON-serializable
|
|
14
|
+
*/
|
|
15
|
+
export type ToolArguments = Record<string, JsonValue>;
|
|
16
|
+
/**
|
|
17
|
+
* Spawn metadata for logging and sanitization
|
|
18
|
+
*/
|
|
19
|
+
export interface SpawnMetadata {
|
|
20
|
+
command?: string;
|
|
21
|
+
args?: string[];
|
|
22
|
+
env?: Record<string, string>;
|
|
23
|
+
cwd?: string;
|
|
24
|
+
pid?: number;
|
|
25
|
+
[key: string]: JsonValue;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* MCP prompt argument structure
|
|
29
|
+
* Explicit undefined for exactOptionalPropertyTypes compatibility
|
|
30
|
+
*/
|
|
31
|
+
export interface PromptArgument {
|
|
32
|
+
name: string;
|
|
33
|
+
description?: string | undefined;
|
|
34
|
+
required?: boolean | undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parsed MCP response structure
|
|
38
|
+
*/
|
|
39
|
+
export interface ParsedResponse {
|
|
40
|
+
result?: JsonValue;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Result object structure for error detection
|
|
44
|
+
*/
|
|
45
|
+
export interface ResultObject {
|
|
46
|
+
type?: string;
|
|
47
|
+
error?: string;
|
|
48
|
+
message?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Type guard for JSON-serializable values
|
|
52
|
+
*/
|
|
53
|
+
export declare function isJsonValue(value: unknown): value is JsonValue;
|
|
54
|
+
/**
|
|
55
|
+
* Type guard for parsed MCP response
|
|
56
|
+
*/
|
|
57
|
+
export declare function isParsedResponse(value: unknown): value is ParsedResponse;
|
|
58
|
+
/**
|
|
59
|
+
* Type guard for result object
|
|
60
|
+
*/
|
|
61
|
+
export declare function isResultObject(value: unknown): value is ResultObject;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions and type guards for CLI
|
|
3
|
+
* Per project convention, all types and runtime validators in single file
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* JSON-serializable value type per MCP spec
|
|
7
|
+
* Used for tool arguments and responses
|
|
8
|
+
*/
|
|
9
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
10
|
+
[key: string]: JsonValue;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Tool arguments must be JSON-serializable
|
|
14
|
+
*/
|
|
15
|
+
export type ToolArguments = Record<string, JsonValue>;
|
|
16
|
+
/**
|
|
17
|
+
* Spawn metadata for logging and sanitization
|
|
18
|
+
*/
|
|
19
|
+
export interface SpawnMetadata {
|
|
20
|
+
command?: string;
|
|
21
|
+
args?: string[];
|
|
22
|
+
env?: Record<string, string>;
|
|
23
|
+
cwd?: string;
|
|
24
|
+
pid?: number;
|
|
25
|
+
[key: string]: JsonValue;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* MCP prompt argument structure
|
|
29
|
+
* Explicit undefined for exactOptionalPropertyTypes compatibility
|
|
30
|
+
*/
|
|
31
|
+
export interface PromptArgument {
|
|
32
|
+
name: string;
|
|
33
|
+
description?: string | undefined;
|
|
34
|
+
required?: boolean | undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Parsed MCP response structure
|
|
38
|
+
*/
|
|
39
|
+
export interface ParsedResponse {
|
|
40
|
+
result?: JsonValue;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Result object structure for error detection
|
|
44
|
+
*/
|
|
45
|
+
export interface ResultObject {
|
|
46
|
+
type?: string;
|
|
47
|
+
error?: string;
|
|
48
|
+
message?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Type guard for JSON-serializable values
|
|
52
|
+
*/
|
|
53
|
+
export declare function isJsonValue(value: unknown): value is JsonValue;
|
|
54
|
+
/**
|
|
55
|
+
* Type guard for parsed MCP response
|
|
56
|
+
*/
|
|
57
|
+
export declare function isParsedResponse(value: unknown): value is ParsedResponse;
|
|
58
|
+
/**
|
|
59
|
+
* Type guard for result object
|
|
60
|
+
*/
|
|
61
|
+
export declare function isResultObject(value: unknown): value is ResultObject;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions and type guards for CLI
|
|
3
|
+
* Per project convention, all types and runtime validators in single file
|
|
4
|
+
*/ /**
|
|
5
|
+
* JSON-serializable value type per MCP spec
|
|
6
|
+
* Used for tool arguments and responses
|
|
7
|
+
*/ "use strict";
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
function _export(target, all) {
|
|
12
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
_export(exports, {
|
|
18
|
+
get isJsonValue () {
|
|
19
|
+
return isJsonValue;
|
|
20
|
+
},
|
|
21
|
+
get isParsedResponse () {
|
|
22
|
+
return isParsedResponse;
|
|
23
|
+
},
|
|
24
|
+
get isResultObject () {
|
|
25
|
+
return isResultObject;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
function _type_of(obj) {
|
|
29
|
+
"@swc/helpers - typeof";
|
|
30
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
31
|
+
}
|
|
32
|
+
function isJsonValue(value) {
|
|
33
|
+
if (value === null) return true;
|
|
34
|
+
if (typeof value === 'string') return true;
|
|
35
|
+
if (typeof value === 'number') return true;
|
|
36
|
+
if (typeof value === 'boolean') return true;
|
|
37
|
+
if (Array.isArray(value)) {
|
|
38
|
+
return value.every(isJsonValue);
|
|
39
|
+
}
|
|
40
|
+
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) === 'object') {
|
|
41
|
+
return Object.values(value).every(isJsonValue);
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
function isParsedResponse(value) {
|
|
46
|
+
return (typeof value === "undefined" ? "undefined" : _type_of(value)) === 'object' && value !== null && 'result' in value;
|
|
47
|
+
}
|
|
48
|
+
function isResultObject(value) {
|
|
49
|
+
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) !== 'object' || value === null) return false;
|
|
50
|
+
var obj = value;
|
|
51
|
+
return (obj.type === undefined || typeof obj.type === 'string') && (obj.error === undefined || typeof obj.error === 'string') && (obj.message === undefined || typeof obj.message === 'string');
|
|
52
|
+
}
|
|
53
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/Projects/ai/mcp-z/libs/client/src/connection/types.ts"],"sourcesContent":["/**\n * Type definitions and type guards for CLI\n * Per project convention, all types and runtime validators in single file\n */\n\n/**\n * JSON-serializable value type per MCP spec\n * Used for tool arguments and responses\n */\nexport type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };\n\n/**\n * Tool arguments must be JSON-serializable\n */\nexport type ToolArguments = Record<string, JsonValue>;\n\n/**\n * Spawn metadata for logging and sanitization\n */\nexport interface SpawnMetadata {\n command?: string;\n args?: string[];\n env?: Record<string, string>;\n cwd?: string;\n pid?: number;\n [key: string]: JsonValue;\n}\n\n/**\n * MCP prompt argument structure\n * Explicit undefined for exactOptionalPropertyTypes compatibility\n */\nexport interface PromptArgument {\n name: string;\n description?: string | undefined;\n required?: boolean | undefined;\n}\n\n/**\n * Parsed MCP response structure\n */\nexport interface ParsedResponse {\n result?: JsonValue;\n}\n\n/**\n * Result object structure for error detection\n */\nexport interface ResultObject {\n type?: string;\n error?: string;\n message?: string;\n}\n\n// Type Guards (runtime validation functions)\n\n/**\n * Type guard for JSON-serializable values\n */\nexport function isJsonValue(value: unknown): value is JsonValue {\n if (value === null) return true;\n if (typeof value === 'string') return true;\n if (typeof value === 'number') return true;\n if (typeof value === 'boolean') return true;\n\n if (Array.isArray(value)) {\n return value.every(isJsonValue);\n }\n\n if (typeof value === 'object') {\n return Object.values(value).every(isJsonValue);\n }\n\n return false;\n}\n\n/**\n * Type guard for parsed MCP response\n */\nexport function isParsedResponse(value: unknown): value is ParsedResponse {\n return typeof value === 'object' && value !== null && 'result' in value;\n}\n\n/**\n * Type guard for result object\n */\nexport function isResultObject(value: unknown): value is ResultObject {\n if (typeof value !== 'object' || value === null) return false;\n const obj = value as Record<string, unknown>;\n return (obj.type === undefined || typeof obj.type === 'string') && (obj.error === undefined || typeof obj.error === 'string') && (obj.message === undefined || typeof obj.message === 'string');\n}\n"],"names":["isJsonValue","isParsedResponse","isResultObject","value","Array","isArray","every","Object","values","obj","type","undefined","error","message"],"mappings":"AAAA;;;CAGC,GAED;;;CAGC;;;;;;;;;;;QAmDeA;eAAAA;;QAoBAC;eAAAA;;QAOAC;eAAAA;;;;;;;AA3BT,SAASF,YAAYG,KAAc;IACxC,IAAIA,UAAU,MAAM,OAAO;IAC3B,IAAI,OAAOA,UAAU,UAAU,OAAO;IACtC,IAAI,OAAOA,UAAU,UAAU,OAAO;IACtC,IAAI,OAAOA,UAAU,WAAW,OAAO;IAEvC,IAAIC,MAAMC,OAAO,CAACF,QAAQ;QACxB,OAAOA,MAAMG,KAAK,CAACN;IACrB;IAEA,IAAI,CAAA,OAAOG,sCAAP,SAAOA,MAAI,MAAM,UAAU;QAC7B,OAAOI,OAAOC,MAAM,CAACL,OAAOG,KAAK,CAACN;IACpC;IAEA,OAAO;AACT;AAKO,SAASC,iBAAiBE,KAAc;IAC7C,OAAO,CAAA,OAAOA,sCAAP,SAAOA,MAAI,MAAM,YAAYA,UAAU,QAAQ,YAAYA;AACpE;AAKO,SAASD,eAAeC,KAAc;IAC3C,IAAI,CAAA,OAAOA,sCAAP,SAAOA,MAAI,MAAM,YAAYA,UAAU,MAAM,OAAO;IACxD,IAAMM,MAAMN;IACZ,OAAO,AAACM,CAAAA,IAAIC,IAAI,KAAKC,aAAa,OAAOF,IAAIC,IAAI,KAAK,QAAO,KAAOD,CAAAA,IAAIG,KAAK,KAAKD,aAAa,OAAOF,IAAIG,KAAK,KAAK,QAAO,KAAOH,CAAAA,IAAII,OAAO,KAAKF,aAAa,OAAOF,IAAII,OAAO,KAAK,QAAO;AAC/L"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* wait-for-http-ready.ts
|
|
3
|
+
*
|
|
4
|
+
* Utility for waiting for HTTP servers to become ready.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Wait for HTTP server to be ready by checking endpoint accessibility.
|
|
8
|
+
* Used to handle HTTP servers that need time to start listening.
|
|
9
|
+
*
|
|
10
|
+
* @param url - URL to check for server readiness
|
|
11
|
+
* @param timeoutMs - Maximum time to wait in milliseconds (default: 30000)
|
|
12
|
+
* @returns Promise that resolves when server is ready
|
|
13
|
+
* @throws Error if server doesn't become ready within timeout
|
|
14
|
+
*/
|
|
15
|
+
export declare function waitForHttpReady(url: string, timeoutMs?: number): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* wait-for-http-ready.ts
|
|
3
|
+
*
|
|
4
|
+
* Utility for waiting for HTTP servers to become ready.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Wait for HTTP server to be ready by checking endpoint accessibility.
|
|
8
|
+
* Used to handle HTTP servers that need time to start listening.
|
|
9
|
+
*
|
|
10
|
+
* @param url - URL to check for server readiness
|
|
11
|
+
* @param timeoutMs - Maximum time to wait in milliseconds (default: 30000)
|
|
12
|
+
* @returns Promise that resolves when server is ready
|
|
13
|
+
* @throws Error if server doesn't become ready within timeout
|
|
14
|
+
*/
|
|
15
|
+
export declare function waitForHttpReady(url: string, timeoutMs?: number): Promise<void>;
|