@s2-dev/streamstore 0.3.14 → 0.4.2

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.
Files changed (224) hide show
  1. package/README.md +115 -2
  2. package/bin/mcp-server.js +50283 -0
  3. package/bin/mcp-server.js.map +347 -0
  4. package/funcs/accountCreateBasin.d.ts +2 -1
  5. package/funcs/accountCreateBasin.d.ts.map +1 -1
  6. package/funcs/accountCreateBasin.js +11 -6
  7. package/funcs/accountCreateBasin.js.map +1 -1
  8. package/funcs/accountDeleteBasin.d.ts +2 -1
  9. package/funcs/accountDeleteBasin.d.ts.map +1 -1
  10. package/funcs/accountDeleteBasin.js +11 -6
  11. package/funcs/accountDeleteBasin.js.map +1 -1
  12. package/funcs/accountGetBasinConfig.d.ts +2 -1
  13. package/funcs/accountGetBasinConfig.d.ts.map +1 -1
  14. package/funcs/accountGetBasinConfig.js +11 -6
  15. package/funcs/accountGetBasinConfig.js.map +1 -1
  16. package/funcs/accountListBasins.d.ts +2 -1
  17. package/funcs/accountListBasins.d.ts.map +1 -1
  18. package/funcs/accountListBasins.js +19 -6
  19. package/funcs/accountListBasins.js.map +1 -1
  20. package/funcs/accountReconfigureBasin.d.ts +2 -1
  21. package/funcs/accountReconfigureBasin.d.ts.map +1 -1
  22. package/funcs/accountReconfigureBasin.js +11 -6
  23. package/funcs/accountReconfigureBasin.js.map +1 -1
  24. package/funcs/basinCreateStream.d.ts +2 -1
  25. package/funcs/basinCreateStream.d.ts.map +1 -1
  26. package/funcs/basinCreateStream.js +11 -6
  27. package/funcs/basinCreateStream.js.map +1 -1
  28. package/funcs/basinDeleteStream.d.ts +2 -1
  29. package/funcs/basinDeleteStream.d.ts.map +1 -1
  30. package/funcs/basinDeleteStream.js +11 -6
  31. package/funcs/basinDeleteStream.js.map +1 -1
  32. package/funcs/basinGetStreamConfig.d.ts +2 -1
  33. package/funcs/basinGetStreamConfig.d.ts.map +1 -1
  34. package/funcs/basinGetStreamConfig.js +11 -6
  35. package/funcs/basinGetStreamConfig.js.map +1 -1
  36. package/funcs/basinListStreams.d.ts +2 -1
  37. package/funcs/basinListStreams.d.ts.map +1 -1
  38. package/funcs/basinListStreams.js +19 -6
  39. package/funcs/basinListStreams.js.map +1 -1
  40. package/funcs/basinReconfigureStream.d.ts +2 -1
  41. package/funcs/basinReconfigureStream.d.ts.map +1 -1
  42. package/funcs/basinReconfigureStream.js +11 -6
  43. package/funcs/basinReconfigureStream.js.map +1 -1
  44. package/funcs/streamAppend.d.ts +2 -1
  45. package/funcs/streamAppend.d.ts.map +1 -1
  46. package/funcs/streamAppend.js +11 -6
  47. package/funcs/streamAppend.js.map +1 -1
  48. package/funcs/streamCheckTail.d.ts +2 -1
  49. package/funcs/streamCheckTail.d.ts.map +1 -1
  50. package/funcs/streamCheckTail.js +11 -6
  51. package/funcs/streamCheckTail.js.map +1 -1
  52. package/funcs/streamRead.d.ts +2 -1
  53. package/funcs/streamRead.d.ts.map +1 -1
  54. package/funcs/streamRead.js +11 -6
  55. package/funcs/streamRead.js.map +1 -1
  56. package/hooks/types.d.ts +1 -0
  57. package/hooks/types.d.ts.map +1 -1
  58. package/index.extras.d.ts +38 -15
  59. package/index.extras.d.ts.map +1 -1
  60. package/index.extras.js +91 -46
  61. package/index.extras.js.map +1 -1
  62. package/jsr.json +1 -1
  63. package/lib/config.d.ts +6 -6
  64. package/lib/config.d.ts.map +1 -1
  65. package/lib/config.js +3 -3
  66. package/lib/config.js.map +1 -1
  67. package/lib/files.js.map +1 -1
  68. package/lib/primitives.d.ts +3 -0
  69. package/lib/primitives.d.ts.map +1 -1
  70. package/lib/primitives.js +7 -0
  71. package/lib/primitives.js.map +1 -1
  72. package/lib/sdks.d.ts +1 -1
  73. package/lib/sdks.d.ts.map +1 -1
  74. package/lib/security.d.ts.map +1 -1
  75. package/lib/security.js.map +1 -1
  76. package/mcp-server/build.d.mts.map +1 -0
  77. package/mcp-server/build.mjs +14 -0
  78. package/mcp-server/build.mjs.map +1 -0
  79. package/mcp-server/cli/start/command.d.ts +2 -0
  80. package/mcp-server/cli/start/command.d.ts.map +1 -0
  81. package/mcp-server/cli/start/command.js +129 -0
  82. package/mcp-server/cli/start/command.js.map +1 -0
  83. package/mcp-server/cli/start/impl.d.ts +17 -0
  84. package/mcp-server/cli/start/impl.d.ts.map +1 -0
  85. package/mcp-server/cli/start/impl.js +102 -0
  86. package/mcp-server/cli/start/impl.js.map +1 -0
  87. package/mcp-server/cli.d.ts +6 -0
  88. package/mcp-server/cli.d.ts.map +1 -0
  89. package/mcp-server/cli.js +10 -0
  90. package/mcp-server/cli.js.map +1 -0
  91. package/mcp-server/console-logger.d.ts +7 -0
  92. package/mcp-server/console-logger.d.ts.map +1 -0
  93. package/mcp-server/console-logger.js +59 -0
  94. package/mcp-server/console-logger.js.map +1 -0
  95. package/mcp-server/mcp-server.d.ts +2 -0
  96. package/mcp-server/mcp-server.d.ts.map +1 -0
  97. package/mcp-server/mcp-server.js +29 -0
  98. package/mcp-server/mcp-server.js.map +1 -0
  99. package/mcp-server/resources.d.ts +27 -0
  100. package/mcp-server/resources.d.ts.map +1 -0
  101. package/mcp-server/resources.js +51 -0
  102. package/mcp-server/resources.js.map +1 -0
  103. package/mcp-server/scopes.d.ts +3 -0
  104. package/mcp-server/scopes.d.ts.map +1 -0
  105. package/mcp-server/scopes.js +11 -0
  106. package/mcp-server/scopes.js.map +1 -0
  107. package/mcp-server/server.d.ts +12 -0
  108. package/mcp-server/server.d.ts.map +1 -0
  109. package/mcp-server/server.js +51 -0
  110. package/mcp-server/server.js.map +1 -0
  111. package/mcp-server/shared.d.ts +7 -0
  112. package/mcp-server/shared.d.ts.map +1 -0
  113. package/mcp-server/shared.js +98 -0
  114. package/mcp-server/shared.js.map +1 -0
  115. package/mcp-server/tools/accountCreateBasin.d.ts +8 -0
  116. package/mcp-server/tools/accountCreateBasin.d.ts.map +1 -0
  117. package/mcp-server/tools/accountCreateBasin.js +63 -0
  118. package/mcp-server/tools/accountCreateBasin.js.map +1 -0
  119. package/mcp-server/tools/accountDeleteBasin.d.ts +8 -0
  120. package/mcp-server/tools/accountDeleteBasin.d.ts.map +1 -0
  121. package/mcp-server/tools/accountDeleteBasin.js +62 -0
  122. package/mcp-server/tools/accountDeleteBasin.js.map +1 -0
  123. package/mcp-server/tools/accountGetBasinConfig.d.ts +8 -0
  124. package/mcp-server/tools/accountGetBasinConfig.d.ts.map +1 -0
  125. package/mcp-server/tools/accountGetBasinConfig.js +63 -0
  126. package/mcp-server/tools/accountGetBasinConfig.js.map +1 -0
  127. package/mcp-server/tools/accountListBasins.d.ts +8 -0
  128. package/mcp-server/tools/accountListBasins.d.ts.map +1 -0
  129. package/mcp-server/tools/accountListBasins.js +63 -0
  130. package/mcp-server/tools/accountListBasins.js.map +1 -0
  131. package/mcp-server/tools/accountReconfigureBasin.d.ts +8 -0
  132. package/mcp-server/tools/accountReconfigureBasin.d.ts.map +1 -0
  133. package/mcp-server/tools/accountReconfigureBasin.js +63 -0
  134. package/mcp-server/tools/accountReconfigureBasin.js.map +1 -0
  135. package/mcp-server/tools/basinCreateStream.d.ts +8 -0
  136. package/mcp-server/tools/basinCreateStream.d.ts.map +1 -0
  137. package/mcp-server/tools/basinCreateStream.js +63 -0
  138. package/mcp-server/tools/basinCreateStream.js.map +1 -0
  139. package/mcp-server/tools/basinDeleteStream.d.ts +8 -0
  140. package/mcp-server/tools/basinDeleteStream.d.ts.map +1 -0
  141. package/mcp-server/tools/basinDeleteStream.js +62 -0
  142. package/mcp-server/tools/basinDeleteStream.js.map +1 -0
  143. package/mcp-server/tools/basinGetStreamConfig.d.ts +8 -0
  144. package/mcp-server/tools/basinGetStreamConfig.d.ts.map +1 -0
  145. package/mcp-server/tools/basinGetStreamConfig.js +63 -0
  146. package/mcp-server/tools/basinGetStreamConfig.js.map +1 -0
  147. package/mcp-server/tools/basinListStreams.d.ts +8 -0
  148. package/mcp-server/tools/basinListStreams.d.ts.map +1 -0
  149. package/mcp-server/tools/basinListStreams.js +63 -0
  150. package/mcp-server/tools/basinListStreams.js.map +1 -0
  151. package/mcp-server/tools/basinReconfigureStream.d.ts +8 -0
  152. package/mcp-server/tools/basinReconfigureStream.d.ts.map +1 -0
  153. package/mcp-server/tools/basinReconfigureStream.js +63 -0
  154. package/mcp-server/tools/basinReconfigureStream.js.map +1 -0
  155. package/mcp-server/tools/streamAppend.d.ts +8 -0
  156. package/mcp-server/tools/streamAppend.d.ts.map +1 -0
  157. package/mcp-server/tools/streamAppend.js +65 -0
  158. package/mcp-server/tools/streamAppend.js.map +1 -0
  159. package/mcp-server/tools/streamCheckTail.d.ts +8 -0
  160. package/mcp-server/tools/streamCheckTail.d.ts.map +1 -0
  161. package/mcp-server/tools/streamCheckTail.js +65 -0
  162. package/mcp-server/tools/streamCheckTail.js.map +1 -0
  163. package/mcp-server/tools/streamRead.d.ts +8 -0
  164. package/mcp-server/tools/streamRead.d.ts.map +1 -0
  165. package/mcp-server/tools/streamRead.js +65 -0
  166. package/mcp-server/tools/streamRead.js.map +1 -0
  167. package/mcp-server/tools.d.ts +25 -0
  168. package/mcp-server/tools.d.ts.map +1 -0
  169. package/mcp-server/tools.js +74 -0
  170. package/mcp-server/tools.js.map +1 -0
  171. package/models/components/endpoints.d.ts +67 -0
  172. package/models/components/endpoints.d.ts.map +1 -0
  173. package/models/components/endpoints.js +126 -0
  174. package/models/components/endpoints.js.map +1 -0
  175. package/package.json +16 -2
  176. package/src/funcs/accountCreateBasin.ts +38 -7
  177. package/src/funcs/accountDeleteBasin.ts +39 -7
  178. package/src/funcs/accountGetBasinConfig.ts +38 -7
  179. package/src/funcs/accountListBasins.ts +49 -7
  180. package/src/funcs/accountReconfigureBasin.ts +38 -7
  181. package/src/funcs/basinCreateStream.ts +38 -7
  182. package/src/funcs/basinDeleteStream.ts +39 -7
  183. package/src/funcs/basinGetStreamConfig.ts +38 -7
  184. package/src/funcs/basinListStreams.ts +49 -7
  185. package/src/funcs/basinReconfigureStream.ts +38 -7
  186. package/src/funcs/streamAppend.ts +38 -7
  187. package/src/funcs/streamCheckTail.ts +38 -7
  188. package/src/funcs/streamRead.ts +38 -7
  189. package/src/hooks/types.ts +1 -0
  190. package/src/index.extras.ts +113 -49
  191. package/src/lib/config.ts +6 -7
  192. package/src/lib/files.ts +1 -1
  193. package/src/lib/primitives.ts +14 -0
  194. package/src/lib/sdks.ts +1 -1
  195. package/src/lib/security.ts +0 -1
  196. package/src/mcp-server/cli/start/command.ts +98 -0
  197. package/src/mcp-server/cli/start/impl.ts +131 -0
  198. package/src/mcp-server/cli.ts +13 -0
  199. package/src/mcp-server/console-logger.ts +71 -0
  200. package/src/mcp-server/mcp-server.ts +26 -0
  201. package/src/mcp-server/resources.ts +96 -0
  202. package/src/mcp-server/scopes.ts +10 -0
  203. package/src/mcp-server/server.ts +60 -0
  204. package/src/mcp-server/shared.ts +75 -0
  205. package/src/mcp-server/tools/accountCreateBasin.ts +36 -0
  206. package/src/mcp-server/tools/accountDeleteBasin.ts +34 -0
  207. package/src/mcp-server/tools/accountGetBasinConfig.ts +36 -0
  208. package/src/mcp-server/tools/accountListBasins.ts +36 -0
  209. package/src/mcp-server/tools/accountReconfigureBasin.ts +36 -0
  210. package/src/mcp-server/tools/basinCreateStream.ts +36 -0
  211. package/src/mcp-server/tools/basinDeleteStream.ts +34 -0
  212. package/src/mcp-server/tools/basinGetStreamConfig.ts +36 -0
  213. package/src/mcp-server/tools/basinListStreams.ts +36 -0
  214. package/src/mcp-server/tools/basinReconfigureStream.ts +36 -0
  215. package/src/mcp-server/tools/streamAppend.ts +38 -0
  216. package/src/mcp-server/tools/streamCheckTail.ts +38 -0
  217. package/src/mcp-server/tools/streamRead.ts +38 -0
  218. package/src/mcp-server/tools.ts +116 -0
  219. package/src/models/components/endpoints.ts +159 -0
  220. package/src/types/async.ts +68 -0
  221. package/types/async.d.ts +23 -0
  222. package/types/async.d.ts.map +1 -0
  223. package/types/async.js +44 -0
  224. package/types/async.js.map +1 -0
@@ -0,0 +1,8 @@
1
+ import * as operations from "../../models/operations/index.js";
2
+ import { ToolDefinition } from "../tools.js";
3
+ declare const args: {
4
+ request: import("zod").ZodType<operations.ReadRequest, import("zod").ZodTypeDef, unknown>;
5
+ };
6
+ export declare const tool$streamRead: ToolDefinition<typeof args>;
7
+ export {};
8
+ //# sourceMappingURL=streamRead.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streamRead.d.ts","sourceRoot":"","sources":["../../src/mcp-server/tools/streamRead.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAgB,cAAc,EAAE,MAAM,aAAa,CAAC;AAE3D,QAAA,MAAM,IAAI;;CAET,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,OAAO,IAAI,CAyBvD,CAAC"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.tool$streamRead = void 0;
40
+ const streamRead_js_1 = require("../../funcs/streamRead.js");
41
+ const operations = __importStar(require("../../models/operations/index.js"));
42
+ const tools_js_1 = require("../tools.js");
43
+ const args = {
44
+ request: operations.ReadRequest$inboundSchema,
45
+ };
46
+ exports.tool$streamRead = {
47
+ name: "stream_read",
48
+ description: `Retrieve records.
49
+
50
+ Retrieve a batch of records, or set \`Accept: text/event-stream\` to stream using server-sent events.`,
51
+ scopes: ["read"],
52
+ args,
53
+ tool: async (client, args, ctx) => {
54
+ const [result, apiCall] = await (0, streamRead_js_1.streamRead)(client, args.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
55
+ if (!result.ok) {
56
+ return {
57
+ content: [{ type: "text", text: result.error.message }],
58
+ isError: true,
59
+ };
60
+ }
61
+ const value = result.value;
62
+ return (0, tools_js_1.formatResult)(value, apiCall);
63
+ },
64
+ };
65
+ //# sourceMappingURL=streamRead.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streamRead.js","sourceRoot":"","sources":["../../src/mcp-server/tools/streamRead.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6DAAuD;AACvD,6EAA+D;AAC/D,0CAA2D;AAE3D,MAAM,IAAI,GAAG;IACX,OAAO,EAAE,UAAU,CAAC,yBAAyB;CAC9C,CAAC;AAEW,QAAA,eAAe,GAAgC;IAC1D,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE;;sGAEuF;IACpG,MAAM,EAAE,CAAC,MAAM,CAAC;IAChB,IAAI;IACJ,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,IAAA,0BAAU,EACxC,MAAM,EACN,IAAI,CAAC,OAAO,EACZ,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CACzC,CAAC,QAAQ,EAAE,CAAC;QAEb,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;YACf,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;gBACvD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAE3B,OAAO,IAAA,uBAAY,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACF,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
3
+ import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
4
+ import { objectOutputType, ZodRawShape, ZodTypeAny } from "zod";
5
+ import { S2Core } from "../core.js";
6
+ import { ConsoleLogger } from "./console-logger.js";
7
+ import { MCPScope } from "./scopes.js";
8
+ export type ToolDefinition<Args extends undefined | ZodRawShape = undefined> = Args extends ZodRawShape ? {
9
+ name: string;
10
+ description: string;
11
+ scopes?: MCPScope[];
12
+ args: Args;
13
+ tool: (client: S2Core, args: objectOutputType<Args, ZodTypeAny>, extra: RequestHandlerExtra) => CallToolResult | Promise<CallToolResult>;
14
+ } : {
15
+ name: string;
16
+ description: string;
17
+ scopes?: MCPScope[];
18
+ args?: undefined;
19
+ tool: (client: S2Core, extra: RequestHandlerExtra) => CallToolResult | Promise<CallToolResult>;
20
+ };
21
+ export declare function formatResult(value: unknown, init: {
22
+ response?: Response | undefined;
23
+ }): Promise<CallToolResult>;
24
+ export declare function createRegisterTool(logger: ConsoleLogger, server: McpServer, sdk: S2Core, allowedScopes: Set<MCPScope>): <A extends ZodRawShape | undefined>(tool: ToolDefinition<A>) => void;
25
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/mcp-server/tools.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGvC,MAAM,MAAM,cAAc,CAAC,IAAI,SAAS,SAAS,GAAG,WAAW,GAAG,SAAS,IACzE,IAAI,SAAS,WAAW,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,CACJ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,EACxC,KAAK,EAAE,mBAAmB,KACvB,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC/C,GACC;IACA,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,CACJ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,mBAAmB,KACvB,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC/C,CAAC;AAEN,wBAAsB,YAAY,CAChC,KAAK,EAAE,OAAO,EACd,IAAI,EAAE;IAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;CAAE,GACxC,OAAO,CAAC,cAAc,CAAC,CAkCzB;AAkBD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,GAAG,CAAC,QAAQ,CAAC,GAC3B,CAAC,CAAC,SAAS,WAAW,GAAG,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI,CAmBtE"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.formatResult = formatResult;
7
+ exports.createRegisterTool = createRegisterTool;
8
+ const shared_js_1 = require("./shared.js");
9
+ async function formatResult(value, init) {
10
+ if (typeof value === "undefined") {
11
+ return { content: [] };
12
+ }
13
+ const { response } = init;
14
+ const contentType = response?.headers.get("content-type") ?? "";
15
+ let content = [];
16
+ if (contentType.search(/\bjson\b/g)) {
17
+ content = [{ type: "text", text: JSON.stringify(value) }];
18
+ }
19
+ else if (contentType.startsWith("text/event-stream")
20
+ && (0, shared_js_1.isAsyncIterable)(value)) {
21
+ content = await consumeSSE(value);
22
+ }
23
+ else if (contentType.startsWith("text/") && typeof value === "string") {
24
+ content = [{ type: "text", text: value }];
25
+ }
26
+ else if ((0, shared_js_1.isBinaryData)(value) && contentType.startsWith("image/")) {
27
+ const data = await (0, shared_js_1.valueToBase64)(value);
28
+ content = data == null
29
+ ? []
30
+ : [{ type: "image", data, mimeType: contentType }];
31
+ }
32
+ else {
33
+ return {
34
+ content: [{
35
+ type: "text",
36
+ text: `Unsupported content type: "${contentType}"`,
37
+ }],
38
+ isError: true,
39
+ };
40
+ }
41
+ return { content };
42
+ }
43
+ async function consumeSSE(value) {
44
+ const content = [];
45
+ for await (const chunk of value) {
46
+ if (typeof chunk === "string") {
47
+ content.push({ type: "text", text: chunk });
48
+ }
49
+ else {
50
+ content.push({ type: "text", text: JSON.stringify(chunk) });
51
+ }
52
+ }
53
+ return content;
54
+ }
55
+ function createRegisterTool(logger, server, sdk, allowedScopes) {
56
+ return (tool) => {
57
+ const toolScopes = tool.scopes ?? [];
58
+ if (!toolScopes.every((s) => allowedScopes.has(s))) {
59
+ return;
60
+ }
61
+ if (tool.args) {
62
+ server.tool(tool.name, tool.description, tool.args, async (args, ctx) => {
63
+ return tool.tool(sdk, args, ctx);
64
+ });
65
+ }
66
+ else {
67
+ server.tool(tool.name, tool.description, async (ctx) => {
68
+ return tool.tool(sdk, ctx);
69
+ });
70
+ }
71
+ logger.debug("Registered tool", { name: tool.name });
72
+ };
73
+ }
74
+ //# sourceMappingURL=tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/mcp-server/tools.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAkCH,oCAqCC;AAkBD,gDAwBC;AAxGD,2CAA2E;AAyBpE,KAAK,UAAU,YAAY,CAChC,KAAc,EACd,IAAyC;IAEzC,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;QACjC,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC;IAED,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC;IAC1B,MAAM,WAAW,GAAG,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IAChE,IAAI,OAAO,GAA8B,EAAE,CAAC;IAE5C,IAAI,WAAW,CAAC,MAAM,CAAC,WAAW,CAAC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,CAAC,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,67 @@
1
+ type Authority = string;
2
+ type BasinName = string;
3
+ /**
4
+ * S2 cloud environment to connect with.
5
+ */
6
+ export declare enum S2Cloud {
7
+ /** S2 running on AWS */
8
+ Aws = "aws"
9
+ }
10
+ /**
11
+ * Endpoint for connecting to an S2 basin.
12
+ */
13
+ export declare enum BasinEndpointKind {
14
+ ParentZone = "ParentZone",
15
+ Direct = "Direct"
16
+ }
17
+ export type BasinEndpoint = {
18
+ kind: BasinEndpointKind.ParentZone;
19
+ authority: Authority;
20
+ } | {
21
+ kind: BasinEndpointKind.Direct;
22
+ authority: Authority;
23
+ };
24
+ /**
25
+ * Endpoints for the S2 environment.
26
+ *
27
+ * You can find the S2 endpoints in our [documentation](https://s2.dev/docs/interface/endpoints)
28
+ */
29
+ export declare class S2Endpoints {
30
+ /** Used by `AccountService` requests */
31
+ account: Authority;
32
+ /** Used by `BasinService` and `StreamService` requests */
33
+ basin: BasinEndpoint;
34
+ constructor(account: Authority, basin: BasinEndpoint);
35
+ /**
36
+ * Get S2 endpoints for the specified cloud.
37
+ */
38
+ static forCloud(cloud: S2Cloud): S2Endpoints;
39
+ /**
40
+ * Get S2 endpoints for the specified cell.
41
+ */
42
+ static forCell(cloud: S2Cloud, cellId: string): S2Endpoints;
43
+ /**
44
+ * Get S2 endpoints from environment variables.
45
+ *
46
+ * The following environment variables are used:
47
+ * - `S2_CLOUD`: Valid S2 cloud name. Defaults to AWS.
48
+ * - `S2_ACCOUNT_ENDPOINT`: Overrides the account endpoint.
49
+ * - `S2_BASIN_ENDPOINT`: Overrides the basin endpoint. The prefix `"{basin}."` indicates the
50
+ * basin endpoint is `ParentZone` else `Direct`.
51
+ */
52
+ static fromEnv(): S2Endpoints;
53
+ }
54
+ /**
55
+ * Client kind for different S2 services
56
+ */
57
+ export type ClientKind = {
58
+ kind: 'Account';
59
+ } | {
60
+ kind: 'Basin';
61
+ basin: BasinName;
62
+ };
63
+ export declare const ClientKind: {
64
+ toAuthority(kind: ClientKind, endpoints: S2Endpoints): Authority;
65
+ };
66
+ export {};
67
+ //# sourceMappingURL=endpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../src/models/components/endpoints.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GAAG,MAAM,CAAC;AAGxB,KAAK,SAAS,GAAG,MAAM,CAAC;AAExB;;GAEG;AACH,oBAAY,OAAO;IACf,wBAAwB;IACxB,GAAG,QAAQ;CACd;AAED;;GAEG;AACH,oBAAY,iBAAiB;IACzB,UAAU,eAAe;IACzB,MAAM,WAAW;CACpB;AAED,MAAM,MAAM,aAAa,GAAG;IACxB,IAAI,EAAE,iBAAiB,CAAC,UAAU,CAAC;IACnC,SAAS,EAAE,SAAS,CAAC;CACxB,GAAG;IACA,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE,SAAS,CAAC;CACxB,CAAC;AASF;;;;GAIG;AACH,qBAAa,WAAW;IACpB,wCAAwC;IACjC,OAAO,EAAE,SAAS,CAAC;IAC1B,0DAA0D;IACnD,KAAK,EAAE,aAAa,CAAC;gBAEhB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa;IAKpD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW;IAW5C;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW;IAW3D;;;;;;;;OAQG;IACH,MAAM,CAAC,OAAO,IAAI,WAAW;CA8ChC;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAChB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAE1C,eAAO,MAAM,UAAU;sBACD,UAAU,aAAa,WAAW,GAAG,SAAS;CAanE,CAAC"}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ClientKind = exports.S2Endpoints = exports.BasinEndpointKind = exports.S2Cloud = void 0;
4
+ /**
5
+ * S2 cloud environment to connect with.
6
+ */
7
+ var S2Cloud;
8
+ (function (S2Cloud) {
9
+ /** S2 running on AWS */
10
+ S2Cloud["Aws"] = "aws";
11
+ })(S2Cloud || (exports.S2Cloud = S2Cloud = {}));
12
+ /**
13
+ * Endpoint for connecting to an S2 basin.
14
+ */
15
+ var BasinEndpointKind;
16
+ (function (BasinEndpointKind) {
17
+ BasinEndpointKind["ParentZone"] = "ParentZone";
18
+ BasinEndpointKind["Direct"] = "Direct";
19
+ })(BasinEndpointKind || (exports.BasinEndpointKind = BasinEndpointKind = {}));
20
+ class S2EndpointError extends Error {
21
+ constructor(message) {
22
+ super(message);
23
+ this.name = 'S2EndpointError';
24
+ }
25
+ }
26
+ /**
27
+ * Endpoints for the S2 environment.
28
+ *
29
+ * You can find the S2 endpoints in our [documentation](https://s2.dev/docs/interface/endpoints)
30
+ */
31
+ class S2Endpoints {
32
+ constructor(account, basin) {
33
+ this.account = account;
34
+ this.basin = basin;
35
+ }
36
+ /**
37
+ * Get S2 endpoints for the specified cloud.
38
+ */
39
+ static forCloud(cloud) {
40
+ const authority = `${cloud}.s2.dev`;
41
+ return new S2Endpoints(authority, {
42
+ kind: BasinEndpointKind.ParentZone,
43
+ authority: `b.${cloud}.s2.dev`
44
+ });
45
+ }
46
+ /**
47
+ * Get S2 endpoints for the specified cell.
48
+ */
49
+ static forCell(cloud, cellId) {
50
+ const cellEndpoint = `${cellId}.o.${cloud}.s2.dev`;
51
+ return new S2Endpoints(cellEndpoint, {
52
+ kind: BasinEndpointKind.Direct,
53
+ authority: cellEndpoint
54
+ });
55
+ }
56
+ /**
57
+ * Get S2 endpoints from environment variables.
58
+ *
59
+ * The following environment variables are used:
60
+ * - `S2_CLOUD`: Valid S2 cloud name. Defaults to AWS.
61
+ * - `S2_ACCOUNT_ENDPOINT`: Overrides the account endpoint.
62
+ * - `S2_BASIN_ENDPOINT`: Overrides the basin endpoint. The prefix `"{basin}."` indicates the
63
+ * basin endpoint is `ParentZone` else `Direct`.
64
+ */
65
+ static fromEnv() {
66
+ let cloud;
67
+ try {
68
+ const cloudEnv = process.env['S2_CLOUD'] || S2Cloud.Aws;
69
+ if (Object.values(S2Cloud).includes(cloudEnv)) {
70
+ cloud = cloudEnv;
71
+ }
72
+ else {
73
+ throw new S2EndpointError(`Invalid S2_CLOUD: ${cloudEnv}`);
74
+ }
75
+ }
76
+ catch (err) {
77
+ const error = err;
78
+ throw new S2EndpointError(`Invalid S2_CLOUD: ${error.message}`);
79
+ }
80
+ const endpoints = S2Endpoints.forCloud(cloud);
81
+ const accountEndpoint = process.env['S2_ACCOUNT_ENDPOINT'];
82
+ if (accountEndpoint !== undefined) {
83
+ if (typeof accountEndpoint !== 'string') {
84
+ throw new S2EndpointError('Invalid S2_ACCOUNT_ENDPOINT: not string');
85
+ }
86
+ endpoints.account = accountEndpoint;
87
+ }
88
+ const basinEndpoint = process.env['S2_BASIN_ENDPOINT'];
89
+ if (basinEndpoint !== undefined) {
90
+ if (typeof basinEndpoint !== 'string') {
91
+ throw new S2EndpointError('Invalid S2_BASIN_ENDPOINT: not string');
92
+ }
93
+ if (basinEndpoint.startsWith('{basin}.')) {
94
+ const parentZone = basinEndpoint.substring(7);
95
+ endpoints.basin = {
96
+ kind: BasinEndpointKind.ParentZone,
97
+ authority: parentZone
98
+ };
99
+ }
100
+ else {
101
+ endpoints.basin = {
102
+ kind: BasinEndpointKind.Direct,
103
+ authority: basinEndpoint
104
+ };
105
+ }
106
+ }
107
+ return endpoints;
108
+ }
109
+ }
110
+ exports.S2Endpoints = S2Endpoints;
111
+ exports.ClientKind = {
112
+ toAuthority(kind, endpoints) {
113
+ switch (kind.kind) {
114
+ case 'Account':
115
+ return endpoints.account;
116
+ case 'Basin':
117
+ switch (endpoints.basin.kind) {
118
+ case BasinEndpointKind.ParentZone:
119
+ return `${kind.basin}.${endpoints.basin.authority}`;
120
+ case BasinEndpointKind.Direct:
121
+ return endpoints.basin.authority;
122
+ }
123
+ }
124
+ }
125
+ };
126
+ //# sourceMappingURL=endpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../../src/models/components/endpoints.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACH,IAAY,OAGX;AAHD,WAAY,OAAO;IACf,wBAAwB;IACxB,sBAAW,CAAA;AACf,CAAC,EAHW,OAAO,uBAAP,OAAO,QAGlB;AAED;;GAEG;AACH,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IACzB,8CAAyB,CAAA;IACzB,sCAAiB,CAAA;AACrB,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B;AAUD,MAAM,eAAgB,SAAQ,KAAK;IAC/B,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAClC,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAa,WAAW;IAMpB,YAAY,OAAkB,EAAE,KAAoB;QAChD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAc;QAC1B,MAAM,SAAS,GAAG,GAAG,KAAK,SAAS,CAAC;QACpC,OAAO,IAAI,WAAW,CAClB,SAAS,EACT;YACI,IAAI,EAAE,iBAAiB,CAAC,UAAU;YAClC,SAAS,EAAE,KAAK,KAAK,SAAS;SACjC,CACJ,CAAC;IACN,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,KAAc,EAAE,MAAc;QACzC,MAAM,YAAY,GAAG,GAAG,MAAM,MA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C,MAAM,IAAI,eAAe,CAAC,uCAAuC,CAAC,CAAC;YACvE,CAAC;YAED,IAAI,aAAa,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;gBACvC,MAAM,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;gBAC9C,SAAS,CAAC,KAAK,GAAG;oBACd,IAAI,EAAE,iBAAiB,CAAC,UAAU;oBAClC,SAAS,EAAE,UAAU;iBACxB,CAAC;YACN,CAAC;iBAAM,CAAC;gBACJ,SAAS,CAAC,KAAK,GAAG;oBACd,IAAI,EAAE,iBAAiB,CAAC,MAAM;oBAC9B,SAAS,EAAE,aAAa;iBAC3B,CAAC;YACN,CAAC;QACL,CAAC;QAED,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AA9FD,kCA8FC;AASY,QAAA,UAAU,GAAG;IACtB,WAAW,CAAC,IAAgB,EAAE,SAAsB;QAChD,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAChB,KAAK,SAAS;gBACV,OAAO,SAAS,CAAC,OAAO,CAAC;YAC7B,KAAK,OAAO;gBACR,QAAQ,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;oBAC3B,KAAK,iBAAiB,CAAC,UAAU;wBAC7B,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;oBACxD,KAAK,iBAAiB,CAAC,MAAM;wBACzB,OAAO,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC;gBACzC,CAAC;QACT,CAAC;IACL,CAAC;CACJ,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@s2-dev/streamstore",
3
- "version": "0.3.14",
3
+ "version": "0.4.2",
4
4
  "author": "Speakeasy",
5
+ "bin": {
6
+ "mcp": "bin/mcp-server.js"
7
+ },
5
8
  "main": "./index.js",
6
9
  "sideEffects": false,
7
10
  "repository": {
@@ -10,18 +13,29 @@
10
13
  },
11
14
  "scripts": {
12
15
  "lint": "eslint --cache --max-warnings=0 src",
13
- "build": "tsc",
16
+ "build:mcp": "bun src/mcp-server/build.mts",
17
+ "build": "npm run build:mcp && tsc",
14
18
  "prepublishOnly": "npm run build"
15
19
  },
16
20
  "peerDependencies": {
21
+ "@modelcontextprotocol/sdk": "^1.5.0",
17
22
  "zod": ">= 3"
18
23
  },
24
+ "peerDependenciesMeta": {
25
+ "@modelcontextprotocol/sdk": {"optional":true}
26
+ },
19
27
  "devDependencies": {
20
28
  "@eslint/js": "^9.19.0",
29
+ "@modelcontextprotocol/sdk": "^1.5.0",
30
+ "@stricli/core": "^1.1.1",
31
+ "@types/express": "^4.17.21",
21
32
  "@types/jsonpath": "^0.2.4",
22
33
  "@types/node": "^22.13.1",
23
34
  "@types/uuid": "^9.0.8",
35
+ "bun": "^1.2.2",
36
+ "bun-types": "^1.2.2",
24
37
  "eslint": "^9.19.0",
38
+ "express": "^4.21.2",
25
39
  "globals": "^15.14.0",
26
40
  "typescript": "^5.4.5",
27
41
  "typescript-eslint": "^8.22.0",
@@ -22,16 +22,17 @@ import {
22
22
  import * as errors from "../models/errors/index.js";
23
23
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
24
  import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
25
26
  import { Result } from "../types/fp.js";
26
27
 
27
28
  /**
28
29
  * Create a new basin.
29
30
  */
30
- export async function accountCreateBasin(
31
+ export function accountCreateBasin(
31
32
  client: S2Core,
32
33
  request: operations.CreateBasinRequest,
33
34
  options?: RequestOptions,
34
- ): Promise<
35
+ ): APIPromise<
35
36
  Result<
36
37
  components.BasinInfo,
37
38
  | errors.ErrorResponse
@@ -45,6 +46,35 @@ export async function accountCreateBasin(
45
46
  | RequestTimeoutError
46
47
  | ConnectionError
47
48
  >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: S2Core,
59
+ request: operations.CreateBasinRequest,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ components.BasinInfo,
65
+ | errors.ErrorResponse
66
+ | errors.RetryableError
67
+ | errors.RetryableError
68
+ | APIError
69
+ | SDKValidationError
70
+ | UnexpectedClientError
71
+ | InvalidRequestError
72
+ | RequestAbortedError
73
+ | RequestTimeoutError
74
+ | ConnectionError
75
+ >,
76
+ APICall,
77
+ ]
48
78
  > {
49
79
  const parsed = safeParse(
50
80
  request,
@@ -52,7 +82,7 @@ export async function accountCreateBasin(
52
82
  "Input validation failed",
53
83
  );
54
84
  if (!parsed.ok) {
55
- return parsed;
85
+ return [parsed, { status: "invalid" }];
56
86
  }
57
87
  const payload = parsed.value;
58
88
  const body = encodeJSON("body", payload.CreateBasinRequest, {
@@ -83,6 +113,7 @@ export async function accountCreateBasin(
83
113
  const requestSecurity = resolveGlobalSecurity(securityInput);
84
114
 
85
115
  const context = {
116
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
86
117
  operationID: "create_basin",
87
118
  oAuth2Scopes: [],
88
119
 
@@ -105,7 +136,7 @@ export async function accountCreateBasin(
105
136
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
106
137
  }, options);
107
138
  if (!requestRes.ok) {
108
- return requestRes;
139
+ return [requestRes, { status: "invalid" }];
109
140
  }
110
141
  const req = requestRes.value;
111
142
 
@@ -116,7 +147,7 @@ export async function accountCreateBasin(
116
147
  retryCodes: context.retryCodes,
117
148
  });
118
149
  if (!doResult.ok) {
119
- return doResult;
150
+ return [doResult, { status: "request-error", request: req }];
120
151
  }
121
152
  const response = doResult.value;
122
153
 
@@ -145,8 +176,8 @@ export async function accountCreateBasin(
145
176
  M.fail("5XX"),
146
177
  )(response, { extraFields: responseFields });
147
178
  if (!result.ok) {
148
- return result;
179
+ return [result, { status: "complete", request: req, response }];
149
180
  }
150
181
 
151
- return result;
182
+ return [result, { status: "complete", request: req, response }];
152
183
  }
@@ -22,16 +22,17 @@ import {
22
22
  import * as errors from "../models/errors/index.js";
23
23
  import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
24
  import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
25
26
  import { Result } from "../types/fp.js";
26
27
 
27
28
  /**
28
29
  * Delete a basin.
29
30
  */
30
- export async function accountDeleteBasin(
31
+ export function accountDeleteBasin(
31
32
  client: S2Core,
32
33
  request: operations.DeleteBasinRequest,
33
34
  options?: RequestOptions,
34
- ): Promise<
35
+ ): APIPromise<
35
36
  Result<
36
37
  void,
37
38
  | errors.ErrorResponse
@@ -46,6 +47,36 @@ export async function accountDeleteBasin(
46
47
  | RequestTimeoutError
47
48
  | ConnectionError
48
49
  >
50
+ > {
51
+ return new APIPromise($do(
52
+ client,
53
+ request,
54
+ options,
55
+ ));
56
+ }
57
+
58
+ async function $do(
59
+ client: S2Core,
60
+ request: operations.DeleteBasinRequest,
61
+ options?: RequestOptions,
62
+ ): Promise<
63
+ [
64
+ Result<
65
+ void,
66
+ | errors.ErrorResponse
67
+ | errors.NotFoundError
68
+ | errors.RetryableError
69
+ | errors.RetryableError
70
+ | APIError
71
+ | SDKValidationError
72
+ | UnexpectedClientError
73
+ | InvalidRequestError
74
+ | RequestAbortedError
75
+ | RequestTimeoutError
76
+ | ConnectionError
77
+ >,
78
+ APICall,
79
+ ]
49
80
  > {
50
81
  const parsed = safeParse(
51
82
  request,
@@ -53,7 +84,7 @@ export async function accountDeleteBasin(
53
84
  "Input validation failed",
54
85
  );
55
86
  if (!parsed.ok) {
56
- return parsed;
87
+ return [parsed, { status: "invalid" }];
57
88
  }
58
89
  const payload = parsed.value;
59
90
  const body = null;
@@ -76,6 +107,7 @@ export async function accountDeleteBasin(
76
107
  const requestSecurity = resolveGlobalSecurity(securityInput);
77
108
 
78
109
  const context = {
110
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
79
111
  operationID: "delete_basin",
80
112
  oAuth2Scopes: [],
81
113
 
@@ -98,7 +130,7 @@ export async function accountDeleteBasin(
98
130
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
99
131
  }, options);
100
132
  if (!requestRes.ok) {
101
- return requestRes;
133
+ return [requestRes, { status: "invalid" }];
102
134
  }
103
135
  const req = requestRes.value;
104
136
 
@@ -109,7 +141,7 @@ export async function accountDeleteBasin(
109
141
  retryCodes: context.retryCodes,
110
142
  });
111
143
  if (!doResult.ok) {
112
- return doResult;
144
+ return [doResult, { status: "request-error", request: req }];
113
145
  }
114
146
  const response = doResult.value;
115
147
 
@@ -140,8 +172,8 @@ export async function accountDeleteBasin(
140
172
  M.fail("5XX"),
141
173
  )(response, { extraFields: responseFields });
142
174
  if (!result.ok) {
143
- return result;
175
+ return [result, { status: "complete", request: req, response }];
144
176
  }
145
177
 
146
- return result;
178
+ return [result, { status: "complete", request: req, response }];
147
179
  }