@lanonasis/cli 3.2.14 → 3.4.15
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/README.md +57 -13
- package/dist/commands/auth.js +7 -7
- package/dist/commands/completion.js +2 -0
- package/dist/commands/config.js +4 -4
- package/dist/commands/enhanced-memory.js +1 -1
- package/dist/commands/mcp.js +15 -9
- package/dist/core/achievements.js +1 -1
- package/dist/core/power-mode.js +5 -3
- package/dist/core/welcome.js +7 -6
- package/dist/enhanced-cli.js +6 -3
- package/dist/index-simple.js +5 -1
- package/dist/index.js +5 -1
- package/dist/mcp/access-control.d.ts +1 -1
- package/dist/mcp/access-control.js +4 -4
- package/dist/mcp/client/enhanced-client.js +4 -5
- package/dist/mcp/schemas/tool-schemas.d.ts +1 -1
- package/dist/mcp/schemas/tool-schemas.js +1 -1
- package/dist/mcp/server/lanonasis-server.d.ts +2 -1
- package/dist/mcp/server/lanonasis-server.js +7 -5
- package/dist/mcp/transports/transport-manager.js +3 -3
- package/dist/mcp-server.js +3 -3
- package/dist/utils/config.js +59 -10
- package/dist/utils/mcp-client.d.ts +4 -2
- package/dist/utils/mcp-client.js +86 -42
- package/package.json +3 -3
- package/dist/__tests__/auth-persistence.test.d.ts +0 -1
- package/dist/__tests__/auth-persistence.test.js +0 -243
- package/dist/__tests__/cross-device-integration.test.d.ts +0 -1
- package/dist/__tests__/cross-device-integration.test.js +0 -305
- package/dist/__tests__/mcp-connection-reliability.test.d.ts +0 -1
- package/dist/__tests__/mcp-connection-reliability.test.js +0 -489
- package/dist/__tests__/setup.d.ts +0 -1
- package/dist/__tests__/setup.js +0 -26
- package/dist/mcp/server/mcp/server/lanonasis-server.js +0 -911
- package/dist/mcp/server/utils/api.js +0 -431
- package/dist/mcp/server/utils/config.js +0 -855
|
@@ -1,431 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.apiClient = exports.APIClient = void 0;
|
|
51
|
-
var axios_1 = require("axios");
|
|
52
|
-
var chalk_1 = require("chalk");
|
|
53
|
-
var crypto_1 = require("crypto");
|
|
54
|
-
var config_js_1 = require("./config.js");
|
|
55
|
-
var APIClient = /** @class */ (function () {
|
|
56
|
-
function APIClient() {
|
|
57
|
-
var _this = this;
|
|
58
|
-
this.config = new config_js_1.CLIConfig();
|
|
59
|
-
this.client = axios_1.default.create();
|
|
60
|
-
// Setup request interceptor to add auth token and headers
|
|
61
|
-
this.client.interceptors.request.use(function (config) { return __awaiter(_this, void 0, void 0, function () {
|
|
62
|
-
var isAuthEndpoint, discoveredServices, token, vendorKey, requestId;
|
|
63
|
-
var _a, _b, _c, _d;
|
|
64
|
-
return __generator(this, function (_e) {
|
|
65
|
-
switch (_e.label) {
|
|
66
|
-
case 0: return [4 /*yield*/, this.config.init()];
|
|
67
|
-
case 1:
|
|
68
|
-
_e.sent();
|
|
69
|
-
// Service Discovery
|
|
70
|
-
return [4 /*yield*/, this.config.discoverServices()];
|
|
71
|
-
case 2:
|
|
72
|
-
// Service Discovery
|
|
73
|
-
_e.sent();
|
|
74
|
-
isAuthEndpoint = ((_a = config.url) === null || _a === void 0 ? void 0 : _a.includes('/auth/')) || ((_b = config.url) === null || _b === void 0 ? void 0 : _b.includes('/login')) || ((_c = config.url) === null || _c === void 0 ? void 0 : _c.includes('/register'));
|
|
75
|
-
discoveredServices = this.config.get('discoveredServices');
|
|
76
|
-
config.baseURL = isAuthEndpoint ?
|
|
77
|
-
((discoveredServices === null || discoveredServices === void 0 ? void 0 : discoveredServices.auth_base) || 'https://api.lanonasis.com') :
|
|
78
|
-
this.config.getApiUrl();
|
|
79
|
-
// Add project scope header for auth endpoints
|
|
80
|
-
if (isAuthEndpoint) {
|
|
81
|
-
config.headers['X-Project-Scope'] = 'lanonasis-maas';
|
|
82
|
-
}
|
|
83
|
-
token = this.config.getToken();
|
|
84
|
-
vendorKey = this.config.getVendorKey();
|
|
85
|
-
if (vendorKey) {
|
|
86
|
-
// Vendor key authentication (pk_*.sk_* format)
|
|
87
|
-
config.headers['X-API-Key'] = vendorKey;
|
|
88
|
-
config.headers['X-Auth-Method'] = 'vendor_key';
|
|
89
|
-
}
|
|
90
|
-
else if (token) {
|
|
91
|
-
// JWT token authentication
|
|
92
|
-
config.headers.Authorization = "Bearer ".concat(token);
|
|
93
|
-
config.headers['X-Auth-Method'] = 'jwt';
|
|
94
|
-
}
|
|
95
|
-
requestId = (0, crypto_1.randomUUID)();
|
|
96
|
-
config.headers['X-Request-ID'] = requestId;
|
|
97
|
-
// Add project scope for Golden Contract compliance
|
|
98
|
-
config.headers['X-Project-Scope'] = 'lanonasis-maas';
|
|
99
|
-
if (process.env.CLI_VERBOSE === 'true') {
|
|
100
|
-
console.log(chalk_1.default.dim("\u2192 ".concat((_d = config.method) === null || _d === void 0 ? void 0 : _d.toUpperCase(), " ").concat(config.url, " [").concat(requestId, "]")));
|
|
101
|
-
}
|
|
102
|
-
return [2 /*return*/, config];
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}); });
|
|
106
|
-
// Setup response interceptor for error handling
|
|
107
|
-
this.client.interceptors.response.use(function (response) {
|
|
108
|
-
if (process.env.CLI_VERBOSE === 'true') {
|
|
109
|
-
console.log(chalk_1.default.dim("\u2190 ".concat(response.status, " ").concat(response.statusText)));
|
|
110
|
-
}
|
|
111
|
-
return response;
|
|
112
|
-
}, function (error) {
|
|
113
|
-
if (error.response) {
|
|
114
|
-
var _a = error.response, status_1 = _a.status, data = _a.data;
|
|
115
|
-
if (status_1 === 401) {
|
|
116
|
-
console.error(chalk_1.default.red('✖ Authentication failed'));
|
|
117
|
-
console.log(chalk_1.default.yellow('Please run:'), chalk_1.default.white('memory login'));
|
|
118
|
-
process.exit(1);
|
|
119
|
-
}
|
|
120
|
-
if (status_1 === 403) {
|
|
121
|
-
console.error(chalk_1.default.red('✖ Permission denied'));
|
|
122
|
-
if (data.message) {
|
|
123
|
-
console.error(chalk_1.default.gray(data.message));
|
|
124
|
-
}
|
|
125
|
-
process.exit(1);
|
|
126
|
-
}
|
|
127
|
-
if (status_1 === 429) {
|
|
128
|
-
console.error(chalk_1.default.red('✖ Rate limit exceeded'));
|
|
129
|
-
console.error(chalk_1.default.gray('Please wait a moment before trying again'));
|
|
130
|
-
process.exit(1);
|
|
131
|
-
}
|
|
132
|
-
if (process.env.CLI_VERBOSE === 'true') {
|
|
133
|
-
console.error(chalk_1.default.dim("\u2190 ".concat(status_1, " ").concat(error.response.statusText)));
|
|
134
|
-
console.error(chalk_1.default.dim(JSON.stringify(data, null, 2)));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return Promise.reject(error);
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
// Authentication - aligned with Supabase auth
|
|
141
|
-
APIClient.prototype.login = function (email, password) {
|
|
142
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
143
|
-
var response;
|
|
144
|
-
return __generator(this, function (_a) {
|
|
145
|
-
switch (_a.label) {
|
|
146
|
-
case 0: return [4 /*yield*/, this.client.post('/v1/auth/login', {
|
|
147
|
-
email: email,
|
|
148
|
-
password: password
|
|
149
|
-
})];
|
|
150
|
-
case 1:
|
|
151
|
-
response = _a.sent();
|
|
152
|
-
return [2 /*return*/, response.data];
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
APIClient.prototype.register = function (email, password, organizationName) {
|
|
158
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
159
|
-
var response;
|
|
160
|
-
return __generator(this, function (_a) {
|
|
161
|
-
switch (_a.label) {
|
|
162
|
-
case 0: return [4 /*yield*/, this.client.post('/v1/auth/signup', {
|
|
163
|
-
email: email,
|
|
164
|
-
password: password,
|
|
165
|
-
name: organizationName
|
|
166
|
-
})];
|
|
167
|
-
case 1:
|
|
168
|
-
response = _a.sent();
|
|
169
|
-
return [2 /*return*/, response.data];
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
});
|
|
173
|
-
};
|
|
174
|
-
// Memory operations - aligned with existing schema
|
|
175
|
-
APIClient.prototype.createMemory = function (data) {
|
|
176
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
177
|
-
var response;
|
|
178
|
-
return __generator(this, function (_a) {
|
|
179
|
-
switch (_a.label) {
|
|
180
|
-
case 0: return [4 /*yield*/, this.client.post('/api/v1/memory', data)];
|
|
181
|
-
case 1:
|
|
182
|
-
response = _a.sent();
|
|
183
|
-
return [2 /*return*/, response.data];
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
APIClient.prototype.getMemories = function () {
|
|
189
|
-
return __awaiter(this, arguments, void 0, function (params) {
|
|
190
|
-
var response;
|
|
191
|
-
if (params === void 0) { params = {}; }
|
|
192
|
-
return __generator(this, function (_a) {
|
|
193
|
-
switch (_a.label) {
|
|
194
|
-
case 0: return [4 /*yield*/, this.client.get('/api/v1/memory', { params: params })];
|
|
195
|
-
case 1:
|
|
196
|
-
response = _a.sent();
|
|
197
|
-
return [2 /*return*/, response.data];
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
APIClient.prototype.getMemory = function (id) {
|
|
203
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
204
|
-
var response;
|
|
205
|
-
return __generator(this, function (_a) {
|
|
206
|
-
switch (_a.label) {
|
|
207
|
-
case 0: return [4 /*yield*/, this.client.get("/api/v1/memory/".concat(id))];
|
|
208
|
-
case 1:
|
|
209
|
-
response = _a.sent();
|
|
210
|
-
return [2 /*return*/, response.data];
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
};
|
|
215
|
-
APIClient.prototype.updateMemory = function (id, data) {
|
|
216
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
217
|
-
var response;
|
|
218
|
-
return __generator(this, function (_a) {
|
|
219
|
-
switch (_a.label) {
|
|
220
|
-
case 0: return [4 /*yield*/, this.client.put("/api/v1/memory/".concat(id), data)];
|
|
221
|
-
case 1:
|
|
222
|
-
response = _a.sent();
|
|
223
|
-
return [2 /*return*/, response.data];
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
};
|
|
228
|
-
APIClient.prototype.deleteMemory = function (id) {
|
|
229
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
230
|
-
return __generator(this, function (_a) {
|
|
231
|
-
switch (_a.label) {
|
|
232
|
-
case 0: return [4 /*yield*/, this.client.delete("/api/v1/memory/".concat(id))];
|
|
233
|
-
case 1:
|
|
234
|
-
_a.sent();
|
|
235
|
-
return [2 /*return*/];
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
};
|
|
240
|
-
APIClient.prototype.searchMemories = function (query_1) {
|
|
241
|
-
return __awaiter(this, arguments, void 0, function (query, options) {
|
|
242
|
-
var response;
|
|
243
|
-
if (options === void 0) { options = {}; }
|
|
244
|
-
return __generator(this, function (_a) {
|
|
245
|
-
switch (_a.label) {
|
|
246
|
-
case 0: return [4 /*yield*/, this.client.post('/api/v1/memory/search', __assign({ query: query }, options))];
|
|
247
|
-
case 1:
|
|
248
|
-
response = _a.sent();
|
|
249
|
-
return [2 /*return*/, response.data];
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
};
|
|
254
|
-
APIClient.prototype.getMemoryStats = function () {
|
|
255
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
256
|
-
var response;
|
|
257
|
-
return __generator(this, function (_a) {
|
|
258
|
-
switch (_a.label) {
|
|
259
|
-
case 0: return [4 /*yield*/, this.client.get('/api/v1/memory/stats')];
|
|
260
|
-
case 1:
|
|
261
|
-
response = _a.sent();
|
|
262
|
-
return [2 /*return*/, response.data];
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
};
|
|
267
|
-
APIClient.prototype.bulkDeleteMemories = function (memoryIds) {
|
|
268
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
269
|
-
var response;
|
|
270
|
-
return __generator(this, function (_a) {
|
|
271
|
-
switch (_a.label) {
|
|
272
|
-
case 0: return [4 /*yield*/, this.client.post('/api/v1/memory/bulk/delete', {
|
|
273
|
-
memory_ids: memoryIds
|
|
274
|
-
})];
|
|
275
|
-
case 1:
|
|
276
|
-
response = _a.sent();
|
|
277
|
-
return [2 /*return*/, response.data];
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
};
|
|
282
|
-
// Topic operations - working with existing memory_topics table
|
|
283
|
-
APIClient.prototype.createTopic = function (data) {
|
|
284
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
285
|
-
var response;
|
|
286
|
-
return __generator(this, function (_a) {
|
|
287
|
-
switch (_a.label) {
|
|
288
|
-
case 0: return [4 /*yield*/, this.client.post('/api/v1/topics', data)];
|
|
289
|
-
case 1:
|
|
290
|
-
response = _a.sent();
|
|
291
|
-
return [2 /*return*/, response.data];
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
});
|
|
295
|
-
};
|
|
296
|
-
APIClient.prototype.getTopics = function () {
|
|
297
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
298
|
-
var response;
|
|
299
|
-
return __generator(this, function (_a) {
|
|
300
|
-
switch (_a.label) {
|
|
301
|
-
case 0: return [4 /*yield*/, this.client.get('/api/v1/topics')];
|
|
302
|
-
case 1:
|
|
303
|
-
response = _a.sent();
|
|
304
|
-
return [2 /*return*/, response.data];
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
});
|
|
308
|
-
};
|
|
309
|
-
APIClient.prototype.getTopic = function (id) {
|
|
310
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
311
|
-
var response;
|
|
312
|
-
return __generator(this, function (_a) {
|
|
313
|
-
switch (_a.label) {
|
|
314
|
-
case 0: return [4 /*yield*/, this.client.get("/api/v1/topics/".concat(id))];
|
|
315
|
-
case 1:
|
|
316
|
-
response = _a.sent();
|
|
317
|
-
return [2 /*return*/, response.data];
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
});
|
|
321
|
-
};
|
|
322
|
-
APIClient.prototype.updateTopic = function (id, data) {
|
|
323
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
324
|
-
var response;
|
|
325
|
-
return __generator(this, function (_a) {
|
|
326
|
-
switch (_a.label) {
|
|
327
|
-
case 0: return [4 /*yield*/, this.client.put("/api/v1/topics/".concat(id), data)];
|
|
328
|
-
case 1:
|
|
329
|
-
response = _a.sent();
|
|
330
|
-
return [2 /*return*/, response.data];
|
|
331
|
-
}
|
|
332
|
-
});
|
|
333
|
-
});
|
|
334
|
-
};
|
|
335
|
-
APIClient.prototype.deleteTopic = function (id) {
|
|
336
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
337
|
-
return __generator(this, function (_a) {
|
|
338
|
-
switch (_a.label) {
|
|
339
|
-
case 0: return [4 /*yield*/, this.client.delete("/api/v1/topics/".concat(id))];
|
|
340
|
-
case 1:
|
|
341
|
-
_a.sent();
|
|
342
|
-
return [2 /*return*/];
|
|
343
|
-
}
|
|
344
|
-
});
|
|
345
|
-
});
|
|
346
|
-
};
|
|
347
|
-
// Health check
|
|
348
|
-
APIClient.prototype.getHealth = function () {
|
|
349
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
350
|
-
var response;
|
|
351
|
-
return __generator(this, function (_a) {
|
|
352
|
-
switch (_a.label) {
|
|
353
|
-
case 0: return [4 /*yield*/, this.client.get('/api/v1/health')];
|
|
354
|
-
case 1:
|
|
355
|
-
response = _a.sent();
|
|
356
|
-
return [2 /*return*/, response.data];
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
});
|
|
360
|
-
};
|
|
361
|
-
// Generic HTTP methods
|
|
362
|
-
APIClient.prototype.get = function (url, config) {
|
|
363
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
364
|
-
var response;
|
|
365
|
-
return __generator(this, function (_a) {
|
|
366
|
-
switch (_a.label) {
|
|
367
|
-
case 0: return [4 /*yield*/, this.client.get(url, config)];
|
|
368
|
-
case 1:
|
|
369
|
-
response = _a.sent();
|
|
370
|
-
return [2 /*return*/, response.data];
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
});
|
|
374
|
-
};
|
|
375
|
-
APIClient.prototype.post = function (url, data, config) {
|
|
376
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
377
|
-
var response;
|
|
378
|
-
return __generator(this, function (_a) {
|
|
379
|
-
switch (_a.label) {
|
|
380
|
-
case 0: return [4 /*yield*/, this.client.post(url, data, config)];
|
|
381
|
-
case 1:
|
|
382
|
-
response = _a.sent();
|
|
383
|
-
return [2 /*return*/, response.data];
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
};
|
|
388
|
-
APIClient.prototype.put = function (url, data, config) {
|
|
389
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
390
|
-
var response;
|
|
391
|
-
return __generator(this, function (_a) {
|
|
392
|
-
switch (_a.label) {
|
|
393
|
-
case 0: return [4 /*yield*/, this.client.put(url, data, config)];
|
|
394
|
-
case 1:
|
|
395
|
-
response = _a.sent();
|
|
396
|
-
return [2 /*return*/, response.data];
|
|
397
|
-
}
|
|
398
|
-
});
|
|
399
|
-
});
|
|
400
|
-
};
|
|
401
|
-
APIClient.prototype.delete = function (url, config) {
|
|
402
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
403
|
-
var response;
|
|
404
|
-
return __generator(this, function (_a) {
|
|
405
|
-
switch (_a.label) {
|
|
406
|
-
case 0: return [4 /*yield*/, this.client.delete(url, config)];
|
|
407
|
-
case 1:
|
|
408
|
-
response = _a.sent();
|
|
409
|
-
return [2 /*return*/, response.data];
|
|
410
|
-
}
|
|
411
|
-
});
|
|
412
|
-
});
|
|
413
|
-
};
|
|
414
|
-
// Generic request method
|
|
415
|
-
APIClient.prototype.request = function (config) {
|
|
416
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
417
|
-
var response;
|
|
418
|
-
return __generator(this, function (_a) {
|
|
419
|
-
switch (_a.label) {
|
|
420
|
-
case 0: return [4 /*yield*/, this.client.request(config)];
|
|
421
|
-
case 1:
|
|
422
|
-
response = _a.sent();
|
|
423
|
-
return [2 /*return*/, response.data];
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
});
|
|
427
|
-
};
|
|
428
|
-
return APIClient;
|
|
429
|
-
}());
|
|
430
|
-
exports.APIClient = APIClient;
|
|
431
|
-
exports.apiClient = new APIClient();
|