@wildix/wim-tools-client 0.0.16 → 0.0.18

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.
@@ -1,7 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ToolExecutionException = exports.ToolVariableType = exports.ToolHandler = exports.ToolMcpTransport = exports.ToolAuthorizationType = exports.ToolEmailHandler = exports.ToolChatHandler = exports.ToolStringValue = exports.AlreadyExistException = exports.ValidationException = exports.NotFoundException = void 0;
3
+ exports.ToolExecutionServerException = exports.ToolExecutionException = exports.ToolVariableType = exports.ToolHandler = exports.ToolEmailHandler = exports.ToolStringValue = exports.ValidationException = exports.NotFoundException = exports.AlreadyExistException = void 0;
4
4
  const ToolsServiceException_1 = require("./ToolsServiceException");
5
+ class AlreadyExistException extends ToolsServiceException_1.ToolsServiceException {
6
+ name = "AlreadyExistException";
7
+ $fault = "client";
8
+ constructor(opts) {
9
+ super({
10
+ name: "AlreadyExistException",
11
+ $fault: "client",
12
+ ...opts
13
+ });
14
+ Object.setPrototypeOf(this, AlreadyExistException.prototype);
15
+ }
16
+ }
17
+ exports.AlreadyExistException = AlreadyExistException;
5
18
  class NotFoundException extends ToolsServiceException_1.ToolsServiceException {
6
19
  name = "NotFoundException";
7
20
  $fault = "client";
@@ -28,19 +41,6 @@ class ValidationException extends ToolsServiceException_1.ToolsServiceException
28
41
  }
29
42
  }
30
43
  exports.ValidationException = ValidationException;
31
- class AlreadyExistException extends ToolsServiceException_1.ToolsServiceException {
32
- name = "AlreadyExistException";
33
- $fault = "client";
34
- constructor(opts) {
35
- super({
36
- name: "AlreadyExistException",
37
- $fault: "client",
38
- ...opts
39
- });
40
- Object.setPrototypeOf(this, AlreadyExistException.prototype);
41
- }
42
- }
43
- exports.AlreadyExistException = AlreadyExistException;
44
44
  var ToolStringValue;
45
45
  (function (ToolStringValue) {
46
46
  ToolStringValue.visit = (value, visitor) => {
@@ -53,16 +53,6 @@ var ToolStringValue;
53
53
  return visitor._(value.$unknown[0], value.$unknown[1]);
54
54
  };
55
55
  })(ToolStringValue || (exports.ToolStringValue = ToolStringValue = {}));
56
- var ToolChatHandler;
57
- (function (ToolChatHandler) {
58
- ToolChatHandler.visit = (value, visitor) => {
59
- if (value.direct !== undefined)
60
- return visitor.direct(value.direct);
61
- if (value.channel !== undefined)
62
- return visitor.channel(value.channel);
63
- return visitor._(value.$unknown[0], value.$unknown[1]);
64
- };
65
- })(ToolChatHandler || (exports.ToolChatHandler = ToolChatHandler = {}));
66
56
  var ToolEmailHandler;
67
57
  (function (ToolEmailHandler) {
68
58
  ToolEmailHandler.visit = (value, visitor) => {
@@ -73,29 +63,11 @@ var ToolEmailHandler;
73
63
  return visitor._(value.$unknown[0], value.$unknown[1]);
74
64
  };
75
65
  })(ToolEmailHandler || (exports.ToolEmailHandler = ToolEmailHandler = {}));
76
- exports.ToolAuthorizationType = {
77
- API_KEY: "ApiKey",
78
- BASIC: "Basic",
79
- BEARER: "Bearer",
80
- };
81
- exports.ToolMcpTransport = {
82
- HTTP: "http",
83
- SSE: "sse",
84
- STDIO: "stdio",
85
- };
86
66
  var ToolHandler;
87
67
  (function (ToolHandler) {
88
68
  ToolHandler.visit = (value, visitor) => {
89
69
  if (value.email !== undefined)
90
70
  return visitor.email(value.email);
91
- if (value.sms !== undefined)
92
- return visitor.sms(value.sms);
93
- if (value.chat !== undefined)
94
- return visitor.chat(value.chat);
95
- if (value.webhook !== undefined)
96
- return visitor.webhook(value.webhook);
97
- if (value.mcp !== undefined)
98
- return visitor.mcp(value.mcp);
99
71
  return visitor._(value.$unknown[0], value.$unknown[1]);
100
72
  };
101
73
  })(ToolHandler || (exports.ToolHandler = ToolHandler = {}));
@@ -108,12 +80,12 @@ exports.ToolVariableType = {
108
80
  };
109
81
  class ToolExecutionException extends ToolsServiceException_1.ToolsServiceException {
110
82
  name = "ToolExecutionException";
111
- $fault = "server";
83
+ $fault = "client";
112
84
  details;
113
85
  constructor(opts) {
114
86
  super({
115
87
  name: "ToolExecutionException",
116
- $fault: "server",
88
+ $fault: "client",
117
89
  ...opts
118
90
  });
119
91
  Object.setPrototypeOf(this, ToolExecutionException.prototype);
@@ -121,3 +93,18 @@ class ToolExecutionException extends ToolsServiceException_1.ToolsServiceExcepti
121
93
  }
122
94
  }
123
95
  exports.ToolExecutionException = ToolExecutionException;
96
+ class ToolExecutionServerException extends ToolsServiceException_1.ToolsServiceException {
97
+ name = "ToolExecutionServerException";
98
+ $fault = "server";
99
+ details;
100
+ constructor(opts) {
101
+ super({
102
+ name: "ToolExecutionServerException",
103
+ $fault: "server",
104
+ ...opts
105
+ });
106
+ Object.setPrototypeOf(this, ToolExecutionServerException.prototype);
107
+ this.details = opts.details;
108
+ }
109
+ }
110
+ exports.ToolExecutionServerException = ToolExecutionServerException;
@@ -13,13 +13,13 @@ const se_CreateToolCommand = async (input, context) => {
13
13
  };
14
14
  b.bp("/v1/tools");
15
15
  const query = (0, smithy_client_1.map)({
16
- [_c]: [, input[_c]],
16
+ [_c]: [, input[_cI]],
17
17
  });
18
18
  let body;
19
19
  body = JSON.stringify((0, smithy_client_1.take)(input, {
20
20
  'category': [],
21
21
  'description': [],
22
- 'handler': _ => se_ToolHandler(_, context),
22
+ 'handler': _ => (0, smithy_client_1._json)(_),
23
23
  'input': _ => (0, smithy_client_1._json)(_),
24
24
  'name': [],
25
25
  }));
@@ -36,7 +36,7 @@ const se_DeleteToolCommand = async (input, context) => {
36
36
  b.bp("/v1/tools/{toolId}");
37
37
  b.p('toolId', () => input.toolId, '{toolId}', false);
38
38
  const query = (0, smithy_client_1.map)({
39
- [_c]: [, input[_c]],
39
+ [_c]: [, input[_cI]],
40
40
  });
41
41
  let body;
42
42
  b.m("DELETE")
@@ -53,7 +53,7 @@ const se_DescribeToolsCommand = async (input, context) => {
53
53
  };
54
54
  b.bp("/v1/tools/describe");
55
55
  const query = (0, smithy_client_1.map)({
56
- [_c]: [, input[_c]],
56
+ [_c]: [, input[_cI]],
57
57
  });
58
58
  let body;
59
59
  body = JSON.stringify((0, smithy_client_1.take)(input, {
@@ -73,7 +73,7 @@ const se_ExecuteToolCommand = async (input, context) => {
73
73
  };
74
74
  b.bp("/v1/tools/execute");
75
75
  const query = (0, smithy_client_1.map)({
76
- [_c]: [, input[_c]],
76
+ [_c]: [, input[_cI]],
77
77
  });
78
78
  let body;
79
79
  body = JSON.stringify((0, smithy_client_1.take)(input, {
@@ -95,7 +95,7 @@ const se_GetToolCommand = async (input, context) => {
95
95
  b.bp("/v1/tools/{toolId}");
96
96
  b.p('toolId', () => input.toolId, '{toolId}', false);
97
97
  const query = (0, smithy_client_1.map)({
98
- [_c]: [, input[_c]],
98
+ [_c]: [, input[_cI]],
99
99
  });
100
100
  let body;
101
101
  b.m("GET")
@@ -110,7 +110,7 @@ const se_ListToolsCommand = async (input, context) => {
110
110
  const headers = {};
111
111
  b.bp("/v1/tools");
112
112
  const query = (0, smithy_client_1.map)({
113
- [_c]: [, input[_c]],
113
+ [_c]: [, input[_cI]],
114
114
  });
115
115
  let body;
116
116
  b.m("GET")
@@ -128,13 +128,13 @@ const se_UpdateToolCommand = async (input, context) => {
128
128
  b.bp("/v1/tools/{toolId}");
129
129
  b.p('toolId', () => input.toolId, '{toolId}', false);
130
130
  const query = (0, smithy_client_1.map)({
131
- [_c]: [, input[_c]],
131
+ [_c]: [, input[_cI]],
132
132
  });
133
133
  let body;
134
134
  body = JSON.stringify((0, smithy_client_1.take)(input, {
135
135
  'category': [],
136
136
  'description': [],
137
- 'handler': _ => se_ToolHandler(_, context),
137
+ 'handler': _ => (0, smithy_client_1._json)(_),
138
138
  'input': _ => (0, smithy_client_1._json)(_),
139
139
  'name': [],
140
140
  }));
@@ -154,7 +154,7 @@ const de_CreateToolCommand = async (output, context) => {
154
154
  });
155
155
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
156
156
  const doc = (0, smithy_client_1.take)(data, {
157
- 'tool': _ => de_Tool(_, context),
157
+ 'tool': smithy_client_1._json,
158
158
  });
159
159
  Object.assign(contents, doc);
160
160
  return contents;
@@ -196,7 +196,6 @@ const de_ExecuteToolCommand = async (output, context) => {
196
196
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
197
197
  const doc = (0, smithy_client_1.take)(data, {
198
198
  'result': _ => de_ToolExecutionResult(_, context),
199
- 'traceId': smithy_client_1.expectString,
200
199
  });
201
200
  Object.assign(contents, doc);
202
201
  return contents;
@@ -211,7 +210,7 @@ const de_GetToolCommand = async (output, context) => {
211
210
  });
212
211
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
213
212
  const doc = (0, smithy_client_1.take)(data, {
214
- 'tool': _ => de_Tool(_, context),
213
+ 'tool': smithy_client_1._json,
215
214
  });
216
215
  Object.assign(contents, doc);
217
216
  return contents;
@@ -226,7 +225,7 @@ const de_ListToolsCommand = async (output, context) => {
226
225
  });
227
226
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
228
227
  const doc = (0, smithy_client_1.take)(data, {
229
- 'tools': _ => de_ToolsList(_, context),
228
+ 'tools': smithy_client_1._json,
230
229
  });
231
230
  Object.assign(contents, doc);
232
231
  return contents;
@@ -241,7 +240,7 @@ const de_UpdateToolCommand = async (output, context) => {
241
240
  });
242
241
  const data = (0, smithy_client_1.expectNonNull)(((0, smithy_client_1.expectObject)(await (0, core_1.parseJsonBody)(output.body, context))), "body");
243
242
  const doc = (0, smithy_client_1.take)(data, {
244
- 'tool': _ => de_Tool(_, context),
243
+ 'tool': smithy_client_1._json,
245
244
  });
246
245
  Object.assign(contents, doc);
247
246
  return contents;
@@ -263,6 +262,9 @@ const de_CommandError = async (output, context) => {
263
262
  case "ToolExecutionException":
264
263
  case "wildix.wim.tools#ToolExecutionException":
265
264
  throw await de_ToolExecutionExceptionRes(parsedOutput, context);
265
+ case "ToolExecutionServerException":
266
+ case "wildix.wim.tools#ToolExecutionServerException":
267
+ throw await de_ToolExecutionServerExceptionRes(parsedOutput, context);
266
268
  case "ValidationException":
267
269
  case "smithy.framework#ValidationException":
268
270
  throw await de_ValidationExceptionRes(parsedOutput, context);
@@ -329,54 +331,26 @@ const de_ToolExecutionExceptionRes = async (parsedOutput, context) => {
329
331
  });
330
332
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
331
333
  };
332
- const se_Document = (input, context) => {
333
- return input;
334
- };
335
- const se_ToolHandler = (input, context) => {
336
- return models_0_1.ToolHandler.visit(input, {
337
- chat: value => ({ "chat": (0, smithy_client_1._json)(value) }),
338
- email: value => ({ "email": (0, smithy_client_1._json)(value) }),
339
- mcp: value => ({ "mcp": se_ToolMcpHandler(value, context) }),
340
- sms: value => ({ "sms": (0, smithy_client_1._json)(value) }),
341
- webhook: value => ({ "webhook": (0, smithy_client_1._json)(value) }),
342
- _: (name, value) => ({ [name]: value })
343
- });
344
- };
345
- const se_ToolMcpHandler = (input, context) => {
346
- return (0, smithy_client_1.take)(input, {
347
- 'authentication': smithy_client_1._json,
348
- 'serverUrl': [],
349
- 'timeout': [],
350
- 'tools': _ => se_ToolMcpToolConfigList(_, context),
351
- 'transport': [],
334
+ const de_ToolExecutionServerExceptionRes = async (parsedOutput, context) => {
335
+ const contents = (0, smithy_client_1.map)({});
336
+ const data = parsedOutput.body;
337
+ const doc = (0, smithy_client_1.take)(data, {
338
+ 'details': _ => de_Document(_, context),
339
+ 'message': smithy_client_1.expectString,
352
340
  });
353
- };
354
- const se_ToolMcpToolConfig = (input, context) => {
355
- return (0, smithy_client_1.take)(input, {
356
- 'description': [],
357
- 'mcpToolId': [],
358
- 'parameters': _ => se_Document(_, context),
341
+ Object.assign(contents, doc);
342
+ const exception = new models_0_1.ToolExecutionServerException({
343
+ $metadata: deserializeMetadata(parsedOutput),
344
+ ...contents
359
345
  });
346
+ return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
360
347
  };
361
- const se_ToolMcpToolConfigList = (input, context) => {
362
- return input.filter((e) => e != null).map(entry => {
363
- return se_ToolMcpToolConfig(entry, context);
364
- });
348
+ const se_Document = (input, context) => {
349
+ return input;
365
350
  };
366
351
  const de_Document = (output, context) => {
367
352
  return output;
368
353
  };
369
- const de_Tool = (output, context) => {
370
- return (0, smithy_client_1.take)(output, {
371
- 'category': smithy_client_1.expectString,
372
- 'company': smithy_client_1.expectString,
373
- 'description': smithy_client_1.expectString,
374
- 'handler': (_) => de_ToolHandler((0, core_1.awsExpectUnion)(_), context),
375
- 'id': smithy_client_1.expectString,
376
- 'input': smithy_client_1._json,
377
- 'name': smithy_client_1.expectString,
378
- });
379
- };
380
354
  const de_ToolExecutionResult = (output, context) => {
381
355
  return (0, smithy_client_1.take)(output, {
382
356
  'error': smithy_client_1._json,
@@ -384,62 +358,6 @@ const de_ToolExecutionResult = (output, context) => {
384
358
  'statusCode': smithy_client_1.expectInt32,
385
359
  });
386
360
  };
387
- const de_ToolHandler = (output, context) => {
388
- if (output.chat != null) {
389
- return {
390
- chat: (0, smithy_client_1._json)((0, core_1.awsExpectUnion)(output.chat))
391
- };
392
- }
393
- if (output.email != null) {
394
- return {
395
- email: (0, smithy_client_1._json)((0, core_1.awsExpectUnion)(output.email))
396
- };
397
- }
398
- if (output.mcp != null) {
399
- return {
400
- mcp: de_ToolMcpHandler(output.mcp, context)
401
- };
402
- }
403
- if (output.sms != null) {
404
- return {
405
- sms: (0, smithy_client_1._json)(output.sms)
406
- };
407
- }
408
- if (output.webhook != null) {
409
- return {
410
- webhook: (0, smithy_client_1._json)(output.webhook)
411
- };
412
- }
413
- return { $unknown: Object.entries(output)[0] };
414
- };
415
- const de_ToolMcpHandler = (output, context) => {
416
- return (0, smithy_client_1.take)(output, {
417
- 'authentication': smithy_client_1._json,
418
- 'serverUrl': smithy_client_1.expectString,
419
- 'timeout': smithy_client_1.expectInt32,
420
- 'tools': (_) => de_ToolMcpToolConfigList(_, context),
421
- 'transport': smithy_client_1.expectString,
422
- });
423
- };
424
- const de_ToolMcpToolConfig = (output, context) => {
425
- return (0, smithy_client_1.take)(output, {
426
- 'description': smithy_client_1.expectString,
427
- 'mcpToolId': smithy_client_1.expectString,
428
- 'parameters': (_) => de_Document(_, context),
429
- });
430
- };
431
- const de_ToolMcpToolConfigList = (output, context) => {
432
- const retVal = (output || []).filter((e) => e != null).map((entry) => {
433
- return de_ToolMcpToolConfig(entry, context);
434
- });
435
- return retVal;
436
- };
437
- const de_ToolsList = (output, context) => {
438
- const retVal = (output || []).filter((e) => e != null).map((entry) => {
439
- return de_Tool(entry, context);
440
- });
441
- return retVal;
442
- };
443
361
  const deserializeMetadata = (output) => ({
444
362
  httpStatusCode: output.statusCode,
445
363
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -448,3 +366,4 @@ const deserializeMetadata = (output) => ({
448
366
  });
449
367
  const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then(body => context.utf8Encoder(body));
450
368
  const _c = "company";
369
+ const _cI = "companyId";
@@ -1,38 +1,38 @@
1
1
  import { ToolsServiceException as __BaseException } from "./ToolsServiceException";
2
- export class NotFoundException extends __BaseException {
3
- name = "NotFoundException";
2
+ export class AlreadyExistException extends __BaseException {
3
+ name = "AlreadyExistException";
4
4
  $fault = "client";
5
5
  constructor(opts) {
6
6
  super({
7
- name: "NotFoundException",
7
+ name: "AlreadyExistException",
8
8
  $fault: "client",
9
9
  ...opts
10
10
  });
11
- Object.setPrototypeOf(this, NotFoundException.prototype);
11
+ Object.setPrototypeOf(this, AlreadyExistException.prototype);
12
12
  }
13
13
  }
14
- export class ValidationException extends __BaseException {
15
- name = "ValidationException";
14
+ export class NotFoundException extends __BaseException {
15
+ name = "NotFoundException";
16
16
  $fault = "client";
17
17
  constructor(opts) {
18
18
  super({
19
- name: "ValidationException",
19
+ name: "NotFoundException",
20
20
  $fault: "client",
21
21
  ...opts
22
22
  });
23
- Object.setPrototypeOf(this, ValidationException.prototype);
23
+ Object.setPrototypeOf(this, NotFoundException.prototype);
24
24
  }
25
25
  }
26
- export class AlreadyExistException extends __BaseException {
27
- name = "AlreadyExistException";
26
+ export class ValidationException extends __BaseException {
27
+ name = "ValidationException";
28
28
  $fault = "client";
29
29
  constructor(opts) {
30
30
  super({
31
- name: "AlreadyExistException",
31
+ name: "ValidationException",
32
32
  $fault: "client",
33
33
  ...opts
34
34
  });
35
- Object.setPrototypeOf(this, AlreadyExistException.prototype);
35
+ Object.setPrototypeOf(this, ValidationException.prototype);
36
36
  }
37
37
  }
38
38
  export var ToolStringValue;
@@ -47,16 +47,6 @@ export var ToolStringValue;
47
47
  return visitor._(value.$unknown[0], value.$unknown[1]);
48
48
  };
49
49
  })(ToolStringValue || (ToolStringValue = {}));
50
- export var ToolChatHandler;
51
- (function (ToolChatHandler) {
52
- ToolChatHandler.visit = (value, visitor) => {
53
- if (value.direct !== undefined)
54
- return visitor.direct(value.direct);
55
- if (value.channel !== undefined)
56
- return visitor.channel(value.channel);
57
- return visitor._(value.$unknown[0], value.$unknown[1]);
58
- };
59
- })(ToolChatHandler || (ToolChatHandler = {}));
60
50
  export var ToolEmailHandler;
61
51
  (function (ToolEmailHandler) {
62
52
  ToolEmailHandler.visit = (value, visitor) => {
@@ -67,29 +57,11 @@ export var ToolEmailHandler;
67
57
  return visitor._(value.$unknown[0], value.$unknown[1]);
68
58
  };
69
59
  })(ToolEmailHandler || (ToolEmailHandler = {}));
70
- export const ToolAuthorizationType = {
71
- API_KEY: "ApiKey",
72
- BASIC: "Basic",
73
- BEARER: "Bearer",
74
- };
75
- export const ToolMcpTransport = {
76
- HTTP: "http",
77
- SSE: "sse",
78
- STDIO: "stdio",
79
- };
80
60
  export var ToolHandler;
81
61
  (function (ToolHandler) {
82
62
  ToolHandler.visit = (value, visitor) => {
83
63
  if (value.email !== undefined)
84
64
  return visitor.email(value.email);
85
- if (value.sms !== undefined)
86
- return visitor.sms(value.sms);
87
- if (value.chat !== undefined)
88
- return visitor.chat(value.chat);
89
- if (value.webhook !== undefined)
90
- return visitor.webhook(value.webhook);
91
- if (value.mcp !== undefined)
92
- return visitor.mcp(value.mcp);
93
65
  return visitor._(value.$unknown[0], value.$unknown[1]);
94
66
  };
95
67
  })(ToolHandler || (ToolHandler = {}));
@@ -102,15 +74,29 @@ export const ToolVariableType = {
102
74
  };
103
75
  export class ToolExecutionException extends __BaseException {
104
76
  name = "ToolExecutionException";
105
- $fault = "server";
77
+ $fault = "client";
106
78
  details;
107
79
  constructor(opts) {
108
80
  super({
109
81
  name: "ToolExecutionException",
110
- $fault: "server",
82
+ $fault: "client",
111
83
  ...opts
112
84
  });
113
85
  Object.setPrototypeOf(this, ToolExecutionException.prototype);
114
86
  this.details = opts.details;
115
87
  }
116
88
  }
89
+ export class ToolExecutionServerException extends __BaseException {
90
+ name = "ToolExecutionServerException";
91
+ $fault = "server";
92
+ details;
93
+ constructor(opts) {
94
+ super({
95
+ name: "ToolExecutionServerException",
96
+ $fault: "server",
97
+ ...opts
98
+ });
99
+ Object.setPrototypeOf(this, ToolExecutionServerException.prototype);
100
+ this.details = opts.details;
101
+ }
102
+ }