@s2-dev/streamstore 0.11.0 → 0.11.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 (290) hide show
  1. package/FUNCTIONS.md +1 -1
  2. package/README.md +19 -14
  3. package/bin/mcp-server.js +359 -124
  4. package/bin/mcp-server.js.map +41 -33
  5. package/dist/commonjs/funcs/accessTokensIssueAccessToken.js +3 -3
  6. package/dist/commonjs/funcs/accessTokensIssueAccessToken.js.map +1 -1
  7. package/dist/commonjs/funcs/accessTokensListAccessTokens.js +3 -3
  8. package/dist/commonjs/funcs/accessTokensListAccessTokens.js.map +1 -1
  9. package/dist/commonjs/funcs/accessTokensRevokeAccessToken.js +3 -3
  10. package/dist/commonjs/funcs/accessTokensRevokeAccessToken.js.map +1 -1
  11. package/dist/commonjs/funcs/basinsCreateOrReconfigureBasin.js +3 -3
  12. package/dist/commonjs/funcs/basinsCreateOrReconfigureBasin.js.map +1 -1
  13. package/dist/commonjs/funcs/basinsDeleteBasin.js +3 -3
  14. package/dist/commonjs/funcs/basinsDeleteBasin.js.map +1 -1
  15. package/dist/commonjs/funcs/basinsGetBasinConfig.js +3 -3
  16. package/dist/commonjs/funcs/basinsGetBasinConfig.js.map +1 -1
  17. package/dist/commonjs/funcs/basinsListBasins.js +3 -3
  18. package/dist/commonjs/funcs/basinsListBasins.js.map +1 -1
  19. package/dist/commonjs/funcs/basinsReconfigureBasin.js +3 -3
  20. package/dist/commonjs/funcs/basinsReconfigureBasin.js.map +1 -1
  21. package/dist/commonjs/funcs/recordsCheckTail.d.ts +18 -0
  22. package/dist/commonjs/funcs/recordsCheckTail.d.ts.map +1 -0
  23. package/dist/commonjs/funcs/recordsCheckTail.js +127 -0
  24. package/dist/commonjs/funcs/recordsCheckTail.js.map +1 -0
  25. package/dist/commonjs/funcs/streamsCreateOrReconfigureStream.js +3 -3
  26. package/dist/commonjs/funcs/streamsCreateOrReconfigureStream.js.map +1 -1
  27. package/dist/commonjs/funcs/streamsDeleteStream.js +3 -3
  28. package/dist/commonjs/funcs/streamsDeleteStream.js.map +1 -1
  29. package/dist/commonjs/funcs/streamsGetStreamConfig.js +3 -3
  30. package/dist/commonjs/funcs/streamsGetStreamConfig.js.map +1 -1
  31. package/dist/commonjs/funcs/streamsListStreams.js +3 -3
  32. package/dist/commonjs/funcs/streamsListStreams.js.map +1 -1
  33. package/dist/commonjs/funcs/streamsReconfigureStream.js +3 -3
  34. package/dist/commonjs/funcs/streamsReconfigureStream.js.map +1 -1
  35. package/dist/commonjs/lib/config.d.ts +4 -4
  36. package/dist/commonjs/lib/config.d.ts.map +1 -1
  37. package/dist/commonjs/lib/config.js +3 -3
  38. package/dist/commonjs/lib/env.d.ts +1 -1
  39. package/dist/commonjs/lib/env.d.ts.map +1 -1
  40. package/dist/commonjs/lib/env.js +1 -1
  41. package/dist/commonjs/lib/env.js.map +1 -1
  42. package/dist/commonjs/lib/sdks.d.ts +3 -1
  43. package/dist/commonjs/lib/sdks.d.ts.map +1 -1
  44. package/dist/commonjs/lib/sdks.js +6 -11
  45. package/dist/commonjs/lib/sdks.js.map +1 -1
  46. package/dist/commonjs/lib/security.js +1 -1
  47. package/dist/commonjs/lib/security.js.map +1 -1
  48. package/dist/commonjs/mcp-server/cli/start/command.js +2 -2
  49. package/dist/commonjs/mcp-server/cli/start/command.js.map +1 -1
  50. package/dist/commonjs/mcp-server/cli/start/impl.d.ts +1 -1
  51. package/dist/commonjs/mcp-server/cli/start/impl.d.ts.map +1 -1
  52. package/dist/commonjs/mcp-server/cli/start/impl.js +2 -2
  53. package/dist/commonjs/mcp-server/cli/start/impl.js.map +1 -1
  54. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  55. package/dist/commonjs/mcp-server/server.d.ts +1 -1
  56. package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
  57. package/dist/commonjs/mcp-server/server.js +4 -2
  58. package/dist/commonjs/mcp-server/server.js.map +1 -1
  59. package/dist/commonjs/mcp-server/tools/recordsCheckTail.d.ts +8 -0
  60. package/dist/commonjs/mcp-server/tools/recordsCheckTail.d.ts.map +1 -0
  61. package/dist/commonjs/mcp-server/tools/recordsCheckTail.js +65 -0
  62. package/dist/commonjs/mcp-server/tools/recordsCheckTail.js.map +1 -0
  63. package/dist/commonjs/models/components/accesstokeninfo.d.ts +1 -1
  64. package/dist/commonjs/models/components/checktailresponse.d.ts +33 -0
  65. package/dist/commonjs/models/components/checktailresponse.d.ts.map +1 -0
  66. package/dist/commonjs/models/components/checktailresponse.js +70 -0
  67. package/dist/commonjs/models/components/checktailresponse.js.map +1 -0
  68. package/dist/commonjs/models/components/index.d.ts +5 -0
  69. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  70. package/dist/commonjs/models/components/index.js +5 -0
  71. package/dist/commonjs/models/components/index.js.map +1 -1
  72. package/dist/commonjs/models/components/listaccesstokensresponse.d.ts +5 -5
  73. package/dist/commonjs/models/components/listaccesstokensresponse.d.ts.map +1 -1
  74. package/dist/commonjs/models/components/listaccesstokensresponse.js +4 -2
  75. package/dist/commonjs/models/components/listaccesstokensresponse.js.map +1 -1
  76. package/dist/commonjs/models/components/security.d.ts +2 -2
  77. package/dist/commonjs/models/components/security.d.ts.map +1 -1
  78. package/dist/commonjs/models/components/security.js +11 -2
  79. package/dist/commonjs/models/components/security.js.map +1 -1
  80. package/dist/commonjs/models/components/streamconfig.d.ts +3 -18
  81. package/dist/commonjs/models/components/streamconfig.d.ts.map +1 -1
  82. package/dist/commonjs/models/components/streamconfig.js +3 -8
  83. package/dist/commonjs/models/components/streamconfig.js.map +1 -1
  84. package/dist/commonjs/models/components/streamposition.d.ts +43 -0
  85. package/dist/commonjs/models/components/streamposition.d.ts.map +1 -0
  86. package/dist/commonjs/models/components/streamposition.js +80 -0
  87. package/dist/commonjs/models/components/streamposition.js.map +1 -0
  88. package/dist/commonjs/models/components/streamreconfiguration.d.ts +3 -18
  89. package/dist/commonjs/models/components/streamreconfiguration.d.ts.map +1 -1
  90. package/dist/commonjs/models/components/streamreconfiguration.js +3 -8
  91. package/dist/commonjs/models/components/streamreconfiguration.js.map +1 -1
  92. package/dist/commonjs/models/components/timestampingconfig.d.ts +38 -0
  93. package/dist/commonjs/models/components/timestampingconfig.d.ts.map +1 -0
  94. package/dist/commonjs/models/components/timestampingconfig.js +72 -0
  95. package/dist/commonjs/models/components/timestampingconfig.js.map +1 -0
  96. package/dist/commonjs/models/components/timestampingmode.d.ts +31 -0
  97. package/dist/commonjs/models/components/timestampingmode.d.ts.map +1 -0
  98. package/dist/commonjs/models/components/timestampingmode.js +61 -0
  99. package/dist/commonjs/models/components/timestampingmode.js.map +1 -0
  100. package/dist/commonjs/models/components/timestampingreconfiguration.d.ts +35 -0
  101. package/dist/commonjs/models/components/timestampingreconfiguration.d.ts.map +1 -0
  102. package/dist/commonjs/models/components/timestampingreconfiguration.js +72 -0
  103. package/dist/commonjs/models/components/timestampingreconfiguration.js.map +1 -0
  104. package/dist/commonjs/models/operations/checktail.d.ts +37 -0
  105. package/dist/commonjs/models/operations/checktail.d.ts.map +1 -0
  106. package/dist/commonjs/models/operations/checktail.js +75 -0
  107. package/dist/commonjs/models/operations/checktail.js.map +1 -0
  108. package/dist/commonjs/models/operations/index.d.ts +1 -0
  109. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  110. package/dist/commonjs/models/operations/index.js +1 -0
  111. package/dist/commonjs/models/operations/index.js.map +1 -1
  112. package/dist/commonjs/models/operations/liststreams.d.ts +1 -1
  113. package/dist/commonjs/models/operations/liststreams.d.ts.map +1 -1
  114. package/dist/commonjs/models/operations/liststreams.js +1 -1
  115. package/dist/commonjs/models/operations/liststreams.js.map +1 -1
  116. package/dist/commonjs/models/operations/revokeaccesstoken.d.ts +1 -1
  117. package/dist/commonjs/sdk/records.d.ts +13 -0
  118. package/dist/commonjs/sdk/records.d.ts.map +1 -0
  119. package/dist/commonjs/sdk/records.js +22 -0
  120. package/dist/commonjs/sdk/records.js.map +1 -0
  121. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  122. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  123. package/dist/commonjs/sdk/sdk.js +4 -0
  124. package/dist/commonjs/sdk/sdk.js.map +1 -1
  125. package/dist/esm/funcs/accessTokensIssueAccessToken.js +3 -3
  126. package/dist/esm/funcs/accessTokensIssueAccessToken.js.map +1 -1
  127. package/dist/esm/funcs/accessTokensListAccessTokens.js +3 -3
  128. package/dist/esm/funcs/accessTokensListAccessTokens.js.map +1 -1
  129. package/dist/esm/funcs/accessTokensRevokeAccessToken.js +3 -3
  130. package/dist/esm/funcs/accessTokensRevokeAccessToken.js.map +1 -1
  131. package/dist/esm/funcs/basinsCreateOrReconfigureBasin.js +3 -3
  132. package/dist/esm/funcs/basinsCreateOrReconfigureBasin.js.map +1 -1
  133. package/dist/esm/funcs/basinsDeleteBasin.js +3 -3
  134. package/dist/esm/funcs/basinsDeleteBasin.js.map +1 -1
  135. package/dist/esm/funcs/basinsGetBasinConfig.js +3 -3
  136. package/dist/esm/funcs/basinsGetBasinConfig.js.map +1 -1
  137. package/dist/esm/funcs/basinsListBasins.js +3 -3
  138. package/dist/esm/funcs/basinsListBasins.js.map +1 -1
  139. package/dist/esm/funcs/basinsReconfigureBasin.js +3 -3
  140. package/dist/esm/funcs/basinsReconfigureBasin.js.map +1 -1
  141. package/dist/esm/funcs/recordsCheckTail.d.ts +18 -0
  142. package/dist/esm/funcs/recordsCheckTail.d.ts.map +1 -0
  143. package/dist/esm/funcs/recordsCheckTail.js +91 -0
  144. package/dist/esm/funcs/recordsCheckTail.js.map +1 -0
  145. package/dist/esm/funcs/streamsCreateOrReconfigureStream.js +3 -3
  146. package/dist/esm/funcs/streamsCreateOrReconfigureStream.js.map +1 -1
  147. package/dist/esm/funcs/streamsDeleteStream.js +3 -3
  148. package/dist/esm/funcs/streamsDeleteStream.js.map +1 -1
  149. package/dist/esm/funcs/streamsGetStreamConfig.js +3 -3
  150. package/dist/esm/funcs/streamsGetStreamConfig.js.map +1 -1
  151. package/dist/esm/funcs/streamsListStreams.js +3 -3
  152. package/dist/esm/funcs/streamsListStreams.js.map +1 -1
  153. package/dist/esm/funcs/streamsReconfigureStream.js +3 -3
  154. package/dist/esm/funcs/streamsReconfigureStream.js.map +1 -1
  155. package/dist/esm/lib/config.d.ts +4 -4
  156. package/dist/esm/lib/config.d.ts.map +1 -1
  157. package/dist/esm/lib/config.js +3 -3
  158. package/dist/esm/lib/env.d.ts +1 -1
  159. package/dist/esm/lib/env.d.ts.map +1 -1
  160. package/dist/esm/lib/env.js +1 -1
  161. package/dist/esm/lib/env.js.map +1 -1
  162. package/dist/esm/lib/sdks.d.ts +3 -1
  163. package/dist/esm/lib/sdks.d.ts.map +1 -1
  164. package/dist/esm/lib/sdks.js +6 -11
  165. package/dist/esm/lib/sdks.js.map +1 -1
  166. package/dist/esm/lib/security.js +1 -1
  167. package/dist/esm/lib/security.js.map +1 -1
  168. package/dist/esm/mcp-server/cli/start/command.js +2 -2
  169. package/dist/esm/mcp-server/cli/start/command.js.map +1 -1
  170. package/dist/esm/mcp-server/cli/start/impl.d.ts +1 -1
  171. package/dist/esm/mcp-server/cli/start/impl.d.ts.map +1 -1
  172. package/dist/esm/mcp-server/cli/start/impl.js +2 -2
  173. package/dist/esm/mcp-server/cli/start/impl.js.map +1 -1
  174. package/dist/esm/mcp-server/mcp-server.js +1 -1
  175. package/dist/esm/mcp-server/server.d.ts +1 -1
  176. package/dist/esm/mcp-server/server.d.ts.map +1 -1
  177. package/dist/esm/mcp-server/server.js +4 -2
  178. package/dist/esm/mcp-server/server.js.map +1 -1
  179. package/dist/esm/mcp-server/tools/recordsCheckTail.d.ts +8 -0
  180. package/dist/esm/mcp-server/tools/recordsCheckTail.d.ts.map +1 -0
  181. package/dist/esm/mcp-server/tools/recordsCheckTail.js +29 -0
  182. package/dist/esm/mcp-server/tools/recordsCheckTail.js.map +1 -0
  183. package/dist/esm/models/components/accesstokeninfo.d.ts +1 -1
  184. package/dist/esm/models/components/checktailresponse.d.ts +33 -0
  185. package/dist/esm/models/components/checktailresponse.d.ts.map +1 -0
  186. package/dist/esm/models/components/checktailresponse.js +32 -0
  187. package/dist/esm/models/components/checktailresponse.js.map +1 -0
  188. package/dist/esm/models/components/index.d.ts +5 -0
  189. package/dist/esm/models/components/index.d.ts.map +1 -1
  190. package/dist/esm/models/components/index.js +5 -0
  191. package/dist/esm/models/components/index.js.map +1 -1
  192. package/dist/esm/models/components/listaccesstokensresponse.d.ts +5 -5
  193. package/dist/esm/models/components/listaccesstokensresponse.d.ts.map +1 -1
  194. package/dist/esm/models/components/listaccesstokensresponse.js +4 -2
  195. package/dist/esm/models/components/listaccesstokensresponse.js.map +1 -1
  196. package/dist/esm/models/components/security.d.ts +2 -2
  197. package/dist/esm/models/components/security.d.ts.map +1 -1
  198. package/dist/esm/models/components/security.js +11 -2
  199. package/dist/esm/models/components/security.js.map +1 -1
  200. package/dist/esm/models/components/streamconfig.d.ts +3 -18
  201. package/dist/esm/models/components/streamconfig.d.ts.map +1 -1
  202. package/dist/esm/models/components/streamconfig.js +3 -8
  203. package/dist/esm/models/components/streamconfig.js.map +1 -1
  204. package/dist/esm/models/components/streamposition.d.ts +43 -0
  205. package/dist/esm/models/components/streamposition.d.ts.map +1 -0
  206. package/dist/esm/models/components/streamposition.js +42 -0
  207. package/dist/esm/models/components/streamposition.js.map +1 -0
  208. package/dist/esm/models/components/streamreconfiguration.d.ts +3 -18
  209. package/dist/esm/models/components/streamreconfiguration.d.ts.map +1 -1
  210. package/dist/esm/models/components/streamreconfiguration.js +3 -8
  211. package/dist/esm/models/components/streamreconfiguration.js.map +1 -1
  212. package/dist/esm/models/components/timestampingconfig.d.ts +38 -0
  213. package/dist/esm/models/components/timestampingconfig.d.ts.map +1 -0
  214. package/dist/esm/models/components/timestampingconfig.js +34 -0
  215. package/dist/esm/models/components/timestampingconfig.js.map +1 -0
  216. package/dist/esm/models/components/timestampingmode.d.ts +31 -0
  217. package/dist/esm/models/components/timestampingmode.d.ts.map +1 -0
  218. package/dist/esm/models/components/timestampingmode.js +25 -0
  219. package/dist/esm/models/components/timestampingmode.js.map +1 -0
  220. package/dist/esm/models/components/timestampingreconfiguration.d.ts +35 -0
  221. package/dist/esm/models/components/timestampingreconfiguration.d.ts.map +1 -0
  222. package/dist/esm/models/components/timestampingreconfiguration.js +34 -0
  223. package/dist/esm/models/components/timestampingreconfiguration.js.map +1 -0
  224. package/dist/esm/models/operations/checktail.d.ts +37 -0
  225. package/dist/esm/models/operations/checktail.d.ts.map +1 -0
  226. package/dist/esm/models/operations/checktail.js +37 -0
  227. package/dist/esm/models/operations/checktail.js.map +1 -0
  228. package/dist/esm/models/operations/index.d.ts +1 -0
  229. package/dist/esm/models/operations/index.d.ts.map +1 -1
  230. package/dist/esm/models/operations/index.js +1 -0
  231. package/dist/esm/models/operations/index.js.map +1 -1
  232. package/dist/esm/models/operations/liststreams.d.ts +1 -1
  233. package/dist/esm/models/operations/liststreams.d.ts.map +1 -1
  234. package/dist/esm/models/operations/liststreams.js +1 -1
  235. package/dist/esm/models/operations/liststreams.js.map +1 -1
  236. package/dist/esm/models/operations/revokeaccesstoken.d.ts +1 -1
  237. package/dist/esm/sdk/records.d.ts +13 -0
  238. package/dist/esm/sdk/records.d.ts.map +1 -0
  239. package/dist/esm/sdk/records.js +18 -0
  240. package/dist/esm/sdk/records.js.map +1 -0
  241. package/dist/esm/sdk/sdk.d.ts +3 -0
  242. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  243. package/dist/esm/sdk/sdk.js +4 -0
  244. package/dist/esm/sdk/sdk.js.map +1 -1
  245. package/docs/sdks/accesstokens/README.md +6 -6
  246. package/docs/sdks/basins/README.md +10 -10
  247. package/docs/sdks/records/README.md +90 -0
  248. package/docs/sdks/streams/README.md +22 -14
  249. package/jsr.json +1 -1
  250. package/package.json +1 -1
  251. package/src/funcs/accessTokensIssueAccessToken.ts +3 -3
  252. package/src/funcs/accessTokensListAccessTokens.ts +3 -3
  253. package/src/funcs/accessTokensRevokeAccessToken.ts +3 -3
  254. package/src/funcs/basinsCreateOrReconfigureBasin.ts +3 -3
  255. package/src/funcs/basinsDeleteBasin.ts +3 -3
  256. package/src/funcs/basinsGetBasinConfig.ts +3 -3
  257. package/src/funcs/basinsListBasins.ts +3 -3
  258. package/src/funcs/basinsReconfigureBasin.ts +3 -3
  259. package/src/funcs/recordsCheckTail.ts +184 -0
  260. package/src/funcs/streamsCreateOrReconfigureStream.ts +3 -3
  261. package/src/funcs/streamsDeleteStream.ts +3 -3
  262. package/src/funcs/streamsGetStreamConfig.ts +3 -3
  263. package/src/funcs/streamsListStreams.ts +3 -3
  264. package/src/funcs/streamsReconfigureStream.ts +3 -3
  265. package/src/lib/config.ts +4 -4
  266. package/src/lib/env.ts +2 -2
  267. package/src/lib/sdks.ts +11 -11
  268. package/src/lib/security.ts +1 -1
  269. package/src/mcp-server/cli/start/command.ts +2 -2
  270. package/src/mcp-server/cli/start/impl.ts +3 -3
  271. package/src/mcp-server/mcp-server.ts +1 -1
  272. package/src/mcp-server/server.ts +5 -3
  273. package/src/mcp-server/tools/recordsCheckTail.ts +38 -0
  274. package/src/models/components/accesstokeninfo.ts +1 -1
  275. package/src/models/components/checktailresponse.ts +75 -0
  276. package/src/models/components/index.ts +5 -0
  277. package/src/models/components/listaccesstokensresponse.ts +9 -7
  278. package/src/models/components/security.ts +13 -4
  279. package/src/models/components/streamconfig.ts +10 -26
  280. package/src/models/components/streamposition.ts +87 -0
  281. package/src/models/components/streamreconfiguration.ts +10 -26
  282. package/src/models/components/timestampingconfig.ts +81 -0
  283. package/src/models/components/timestampingmode.ts +34 -0
  284. package/src/models/components/timestampingreconfiguration.ts +80 -0
  285. package/src/models/operations/checktail.ts +80 -0
  286. package/src/models/operations/index.ts +1 -0
  287. package/src/models/operations/liststreams.ts +1 -1
  288. package/src/models/operations/revokeaccesstoken.ts +1 -1
  289. package/src/sdk/records.ts +28 -0
  290. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,90 @@
1
+ # Records
2
+ (*records*)
3
+
4
+ ## Overview
5
+
6
+ Manage records
7
+
8
+ ### Available Operations
9
+
10
+ * [checkTail](#checktail) - Check the tail.
11
+
12
+ ## checkTail
13
+
14
+ Check the tail of a stream.
15
+
16
+ ### Example Usage
17
+
18
+ ```typescript
19
+ import { S2 } from "@s2-dev/streamstore";
20
+
21
+ const s2 = new S2({
22
+ accessToken: process.env["S2_ACCESS_TOKEN"] ?? "",
23
+ });
24
+
25
+ async function run() {
26
+ const result = await s2.records.checkTail({
27
+ stream: "<value>",
28
+ });
29
+
30
+ // Handle the result
31
+ console.log(result);
32
+ }
33
+
34
+ run();
35
+ ```
36
+
37
+ ### Standalone function
38
+
39
+ The standalone function version of this method:
40
+
41
+ ```typescript
42
+ import { S2Core } from "@s2-dev/streamstore/core.js";
43
+ import { recordsCheckTail } from "@s2-dev/streamstore/funcs/recordsCheckTail.js";
44
+
45
+ // Use `S2Core` for best tree-shaking performance.
46
+ // You can create one instance of it to use across an application.
47
+ const s2 = new S2Core({
48
+ accessToken: process.env["S2_ACCESS_TOKEN"] ?? "",
49
+ });
50
+
51
+ async function run() {
52
+ const res = await recordsCheckTail(s2, {
53
+ stream: "<value>",
54
+ });
55
+
56
+ if (!res.ok) {
57
+ throw res.error;
58
+ }
59
+
60
+ const { value: result } = res;
61
+
62
+ // Handle the result
63
+ console.log(result);
64
+ }
65
+
66
+ run();
67
+ ```
68
+
69
+ ### Parameters
70
+
71
+ | Parameter | Type | Required | Description |
72
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
73
+ | `request` | [operations.CheckTailRequest](../../models/operations/checktailrequest.md) | :heavy_check_mark: | The request object to use for the request. |
74
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
75
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
76
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
77
+ | `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
78
+
79
+ ### Response
80
+
81
+ **Promise\<[components.CheckTailResponse](../../models/components/checktailresponse.md)\>**
82
+
83
+ ### Errors
84
+
85
+ | Error Type | Status Code | Content Type |
86
+ | --------------------- | --------------------- | --------------------- |
87
+ | errors.ErrorResponse | 400, 401, 404 | application/json |
88
+ | errors.RetryableError | 499 | application/json |
89
+ | errors.RetryableError | 500, 503, 504 | application/json |
90
+ | errors.APIError | 4XX, 5XX | \*/\* |
@@ -23,7 +23,7 @@ List streams.
23
23
  import { S2 } from "@s2-dev/streamstore";
24
24
 
25
25
  const s2 = new S2({
26
- bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
26
+ accessToken: process.env["S2_ACCESS_TOKEN"] ?? "",
27
27
  });
28
28
 
29
29
  async function run() {
@@ -49,7 +49,7 @@ import { streamsListStreams } from "@s2-dev/streamstore/funcs/streamsListStreams
49
49
  // Use `S2Core` for best tree-shaking performance.
50
50
  // You can create one instance of it to use across an application.
51
51
  const s2 = new S2Core({
52
- bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
52
+ accessToken: process.env["S2_ACCESS_TOKEN"] ?? "",
53
53
  });
54
54
 
55
55
  async function run() {
@@ -103,7 +103,7 @@ Get stream configuration.
103
103
  import { S2 } from "@s2-dev/streamstore";
104
104
 
105
105
  const s2 = new S2({
106
- bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
106
+ accessToken: process.env["S2_ACCESS_TOKEN"] ?? "",
107
107
  });
108
108
 
109
109
  async function run() {
@@ -129,7 +129,7 @@ import { streamsGetStreamConfig } from "@s2-dev/streamstore/funcs/streamsGetStre
129
129
  // Use `S2Core` for best tree-shaking performance.
130
130
  // You can create one instance of it to use across an application.
131
131
  const s2 = new S2Core({
132
- bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
132
+ accessToken: process.env["S2_ACCESS_TOKEN"] ?? "",
133
133
  });
134
134
 
135
135
  async function run() {
@@ -183,13 +183,15 @@ Create or reconfigure a stream.
183
183
  import { S2 } from "@s2-dev/streamstore";
184
184
 
185
185
  const s2 = new S2({
186
- bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
186
+ accessToken: process.env["S2_ACCESS_TOKEN"] ?? "",
187
187
  });
188
188
 
189
189
  async function run() {
190
190
  const result = await s2.streams.createOrReconfigureStream({
191
191
  stream: "<value>",
192
- streamConfig: {},
192
+ streamConfig: {
193
+ timestamping: {},
194
+ },
193
195
  });
194
196
 
195
197
  // Handle the result
@@ -210,13 +212,15 @@ import { streamsCreateOrReconfigureStream } from "@s2-dev/streamstore/funcs/stre
210
212
  // Use `S2Core` for best tree-shaking performance.
211
213
  // You can create one instance of it to use across an application.
212
214
  const s2 = new S2Core({
213
- bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
215
+ accessToken: process.env["S2_ACCESS_TOKEN"] ?? "",
214
216
  });
215
217
 
216
218
  async function run() {
217
219
  const res = await streamsCreateOrReconfigureStream(s2, {
218
220
  stream: "<value>",
219
- streamConfig: {},
221
+ streamConfig: {
222
+ timestamping: {},
223
+ },
220
224
  });
221
225
 
222
226
  if (!res.ok) {
@@ -265,7 +269,7 @@ Delete a stream.
265
269
  import { S2 } from "@s2-dev/streamstore";
266
270
 
267
271
  const s2 = new S2({
268
- bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
272
+ accessToken: process.env["S2_ACCESS_TOKEN"] ?? "",
269
273
  });
270
274
 
271
275
  async function run() {
@@ -290,7 +294,7 @@ import { streamsDeleteStream } from "@s2-dev/streamstore/funcs/streamsDeleteStre
290
294
  // Use `S2Core` for best tree-shaking performance.
291
295
  // You can create one instance of it to use across an application.
292
296
  const s2 = new S2Core({
293
- bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
297
+ accessToken: process.env["S2_ACCESS_TOKEN"] ?? "",
294
298
  });
295
299
 
296
300
  async function run() {
@@ -343,13 +347,15 @@ Reconfigure a stream.
343
347
  import { S2 } from "@s2-dev/streamstore";
344
348
 
345
349
  const s2 = new S2({
346
- bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
350
+ accessToken: process.env["S2_ACCESS_TOKEN"] ?? "",
347
351
  });
348
352
 
349
353
  async function run() {
350
354
  const result = await s2.streams.reconfigureStream({
351
355
  stream: "<value>",
352
- streamReconfiguration: {},
356
+ streamReconfiguration: {
357
+ timestamping: {},
358
+ },
353
359
  });
354
360
 
355
361
  // Handle the result
@@ -370,13 +376,15 @@ import { streamsReconfigureStream } from "@s2-dev/streamstore/funcs/streamsRecon
370
376
  // Use `S2Core` for best tree-shaking performance.
371
377
  // You can create one instance of it to use across an application.
372
378
  const s2 = new S2Core({
373
- bearerAuth: process.env["S2_BEARER_AUTH"] ?? "",
379
+ accessToken: process.env["S2_ACCESS_TOKEN"] ?? "",
374
380
  });
375
381
 
376
382
  async function run() {
377
383
  const res = await streamsReconfigureStream(s2, {
378
384
  stream: "<value>",
379
- streamReconfiguration: {},
385
+ streamReconfiguration: {
386
+ timestamping: {},
387
+ },
380
388
  });
381
389
 
382
390
  if (!res.ok) {
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@s2-dev/streamstore",
5
- "version": "0.11.0",
5
+ "version": "0.11.2",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s2-dev/streamstore",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "author": "Speakeasy",
5
5
  "type": "module",
6
6
  "bin": {
@@ -93,8 +93,8 @@ async function $do(
93
93
  Accept: "application/json",
94
94
  }));
95
95
 
96
- const secConfig = await extractSecurity(client._options.bearerAuth);
97
- const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
96
+ const secConfig = await extractSecurity(client._options.accessToken);
97
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
98
98
  const requestSecurity = resolveGlobalSecurity(securityInput);
99
99
 
100
100
  const context = {
@@ -104,7 +104,7 @@ async function $do(
104
104
 
105
105
  resolvedSecurity: requestSecurity,
106
106
 
107
- securitySource: client._options.bearerAuth,
107
+ securitySource: client._options.accessToken,
108
108
  retryConfig: options?.retries
109
109
  || client._options.retryConfig
110
110
  || { strategy: "none" },
@@ -99,8 +99,8 @@ async function $do(
99
99
  Accept: "application/json",
100
100
  }));
101
101
 
102
- const secConfig = await extractSecurity(client._options.bearerAuth);
103
- const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
102
+ const secConfig = await extractSecurity(client._options.accessToken);
103
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
104
104
  const requestSecurity = resolveGlobalSecurity(securityInput);
105
105
 
106
106
  const context = {
@@ -110,7 +110,7 @@ async function $do(
110
110
 
111
111
  resolvedSecurity: requestSecurity,
112
112
 
113
- securitySource: client._options.bearerAuth,
113
+ securitySource: client._options.accessToken,
114
114
  retryConfig: options?.retries
115
115
  || client._options.retryConfig
116
116
  || { strategy: "none" },
@@ -100,8 +100,8 @@ async function $do(
100
100
  Accept: "application/json",
101
101
  }));
102
102
 
103
- const secConfig = await extractSecurity(client._options.bearerAuth);
104
- const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
103
+ const secConfig = await extractSecurity(client._options.accessToken);
104
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
105
105
  const requestSecurity = resolveGlobalSecurity(securityInput);
106
106
 
107
107
  const context = {
@@ -111,7 +111,7 @@ async function $do(
111
111
 
112
112
  resolvedSecurity: requestSecurity,
113
113
 
114
- securitySource: client._options.bearerAuth,
114
+ securitySource: client._options.accessToken,
115
115
  retryConfig: options?.retries
116
116
  || client._options.retryConfig
117
117
  || { strategy: "none" },
@@ -109,8 +109,8 @@ async function $do(
109
109
  ),
110
110
  }));
111
111
 
112
- const secConfig = await extractSecurity(client._options.bearerAuth);
113
- const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
112
+ const secConfig = await extractSecurity(client._options.accessToken);
113
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
114
114
  const requestSecurity = resolveGlobalSecurity(securityInput);
115
115
 
116
116
  const context = {
@@ -120,7 +120,7 @@ async function $do(
120
120
 
121
121
  resolvedSecurity: requestSecurity,
122
122
 
123
- securitySource: client._options.bearerAuth,
123
+ securitySource: client._options.accessToken,
124
124
  retryConfig: options?.retries
125
125
  || client._options.retryConfig
126
126
  || { strategy: "none" },
@@ -100,8 +100,8 @@ async function $do(
100
100
  Accept: "application/json",
101
101
  }));
102
102
 
103
- const secConfig = await extractSecurity(client._options.bearerAuth);
104
- const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
103
+ const secConfig = await extractSecurity(client._options.accessToken);
104
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
105
105
  const requestSecurity = resolveGlobalSecurity(securityInput);
106
106
 
107
107
  const context = {
@@ -111,7 +111,7 @@ async function $do(
111
111
 
112
112
  resolvedSecurity: requestSecurity,
113
113
 
114
- securitySource: client._options.bearerAuth,
114
+ securitySource: client._options.accessToken,
115
115
  retryConfig: options?.retries
116
116
  || client._options.retryConfig
117
117
  || { strategy: "none" },
@@ -100,8 +100,8 @@ async function $do(
100
100
  Accept: "application/json",
101
101
  }));
102
102
 
103
- const secConfig = await extractSecurity(client._options.bearerAuth);
104
- const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
103
+ const secConfig = await extractSecurity(client._options.accessToken);
104
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
105
105
  const requestSecurity = resolveGlobalSecurity(securityInput);
106
106
 
107
107
  const context = {
@@ -111,7 +111,7 @@ async function $do(
111
111
 
112
112
  resolvedSecurity: requestSecurity,
113
113
 
114
- securitySource: client._options.bearerAuth,
114
+ securitySource: client._options.accessToken,
115
115
  retryConfig: options?.retries
116
116
  || client._options.retryConfig
117
117
  || { strategy: "none" },
@@ -111,8 +111,8 @@ async function $do(
111
111
  Accept: "application/json",
112
112
  }));
113
113
 
114
- const secConfig = await extractSecurity(client._options.bearerAuth);
115
- const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
114
+ const secConfig = await extractSecurity(client._options.accessToken);
115
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
116
116
  const requestSecurity = resolveGlobalSecurity(securityInput);
117
117
 
118
118
  const context = {
@@ -122,7 +122,7 @@ async function $do(
122
122
 
123
123
  resolvedSecurity: requestSecurity,
124
124
 
125
- securitySource: client._options.bearerAuth,
125
+ securitySource: client._options.accessToken,
126
126
  retryConfig: options?.retries
127
127
  || client._options.retryConfig
128
128
  || { strategy: "none" },
@@ -103,8 +103,8 @@ async function $do(
103
103
  Accept: "application/json",
104
104
  }));
105
105
 
106
- const secConfig = await extractSecurity(client._options.bearerAuth);
107
- const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
106
+ const secConfig = await extractSecurity(client._options.accessToken);
107
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
108
108
  const requestSecurity = resolveGlobalSecurity(securityInput);
109
109
 
110
110
  const context = {
@@ -114,7 +114,7 @@ async function $do(
114
114
 
115
115
  resolvedSecurity: requestSecurity,
116
116
 
117
- securitySource: client._options.bearerAuth,
117
+ securitySource: client._options.accessToken,
118
118
  retryConfig: options?.retries
119
119
  || client._options.retryConfig
120
120
  || { strategy: "none" },
@@ -0,0 +1,184 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { S2Core } from "../core.js";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import * as components from "../models/components/index.js";
14
+ import { APIError } from "../models/errors/apierror.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import { CheckTailServerList } from "../models/operations/checktail.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Check the tail.
31
+ *
32
+ * @remarks
33
+ * Check the tail of a stream.
34
+ */
35
+ export function recordsCheckTail(
36
+ client: S2Core,
37
+ request: operations.CheckTailRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ components.CheckTailResponse,
42
+ | errors.ErrorResponse
43
+ | errors.RetryableError
44
+ | errors.RetryableError
45
+ | APIError
46
+ | SDKValidationError
47
+ | UnexpectedClientError
48
+ | InvalidRequestError
49
+ | RequestAbortedError
50
+ | RequestTimeoutError
51
+ | ConnectionError
52
+ >
53
+ > {
54
+ return new APIPromise($do(
55
+ client,
56
+ request,
57
+ options,
58
+ ));
59
+ }
60
+
61
+ async function $do(
62
+ client: S2Core,
63
+ request: operations.CheckTailRequest,
64
+ options?: RequestOptions,
65
+ ): Promise<
66
+ [
67
+ Result<
68
+ components.CheckTailResponse,
69
+ | errors.ErrorResponse
70
+ | errors.RetryableError
71
+ | errors.RetryableError
72
+ | APIError
73
+ | SDKValidationError
74
+ | UnexpectedClientError
75
+ | InvalidRequestError
76
+ | RequestAbortedError
77
+ | RequestTimeoutError
78
+ | ConnectionError
79
+ >,
80
+ APICall,
81
+ ]
82
+ > {
83
+ const parsed = safeParse(
84
+ request,
85
+ (value) => operations.CheckTailRequest$outboundSchema.parse(value),
86
+ "Input validation failed",
87
+ );
88
+ if (!parsed.ok) {
89
+ return [parsed, { status: "invalid" }];
90
+ }
91
+ const payload = parsed.value;
92
+ const body = null;
93
+
94
+ const baseURL = options?.serverURL
95
+ || pathToFunc(CheckTailServerList[0], { charEncoding: "percent" })({
96
+ basin: "",
97
+ });
98
+
99
+ const pathParams = {
100
+ stream: encodeSimple("stream", payload.stream, {
101
+ explode: false,
102
+ charEncoding: "percent",
103
+ }),
104
+ };
105
+
106
+ const path = pathToFunc("/streams/{stream}/records/tail")(pathParams);
107
+
108
+ const headers = new Headers(compactMap({
109
+ Accept: "application/json",
110
+ }));
111
+
112
+ const secConfig = await extractSecurity(client._options.accessToken);
113
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
114
+ const requestSecurity = resolveGlobalSecurity(securityInput);
115
+
116
+ const context = {
117
+ baseURL: baseURL ?? "",
118
+ operationID: "check_tail",
119
+ oAuth2Scopes: [],
120
+
121
+ resolvedSecurity: requestSecurity,
122
+
123
+ securitySource: client._options.accessToken,
124
+ retryConfig: options?.retries
125
+ || client._options.retryConfig
126
+ || { strategy: "none" },
127
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
128
+ };
129
+
130
+ const requestRes = client._createRequest(context, {
131
+ security: requestSecurity,
132
+ method: "GET",
133
+ baseURL: baseURL,
134
+ path: path,
135
+ headers: headers,
136
+ body: body,
137
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
138
+ }, options);
139
+ if (!requestRes.ok) {
140
+ return [requestRes, { status: "invalid" }];
141
+ }
142
+ const req = requestRes.value;
143
+
144
+ const doResult = await client._do(req, {
145
+ context,
146
+ errorCodes: ["400", "401", "404", "499", "4XX", "500", "503", "504", "5XX"],
147
+ retryConfig: context.retryConfig,
148
+ retryCodes: context.retryCodes,
149
+ });
150
+ if (!doResult.ok) {
151
+ return [doResult, { status: "request-error", request: req }];
152
+ }
153
+ const response = doResult.value;
154
+
155
+ const responseFields = {
156
+ HttpMeta: { Response: response, Request: req },
157
+ };
158
+
159
+ const [result] = await M.match<
160
+ components.CheckTailResponse,
161
+ | errors.ErrorResponse
162
+ | errors.RetryableError
163
+ | errors.RetryableError
164
+ | APIError
165
+ | SDKValidationError
166
+ | UnexpectedClientError
167
+ | InvalidRequestError
168
+ | RequestAbortedError
169
+ | RequestTimeoutError
170
+ | ConnectionError
171
+ >(
172
+ M.json(200, components.CheckTailResponse$inboundSchema),
173
+ M.jsonErr([400, 401, 404], errors.ErrorResponse$inboundSchema),
174
+ M.jsonErr(499, errors.RetryableError$inboundSchema),
175
+ M.jsonErr([500, 503, 504], errors.RetryableError$inboundSchema),
176
+ M.fail("4XX"),
177
+ M.fail("5XX"),
178
+ )(response, { extraFields: responseFields });
179
+ if (!result.ok) {
180
+ return [result, { status: "complete", request: req, response }];
181
+ }
182
+
183
+ return [result, { status: "complete", request: req, response }];
184
+ }
@@ -115,8 +115,8 @@ async function $do(
115
115
  ),
116
116
  }));
117
117
 
118
- const secConfig = await extractSecurity(client._options.bearerAuth);
119
- const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
118
+ const secConfig = await extractSecurity(client._options.accessToken);
119
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
120
120
  const requestSecurity = resolveGlobalSecurity(securityInput);
121
121
 
122
122
  const context = {
@@ -126,7 +126,7 @@ async function $do(
126
126
 
127
127
  resolvedSecurity: requestSecurity,
128
128
 
129
- securitySource: client._options.bearerAuth,
129
+ securitySource: client._options.accessToken,
130
130
  retryConfig: options?.retries
131
131
  || client._options.retryConfig
132
132
  || { strategy: "none" },
@@ -106,8 +106,8 @@ async function $do(
106
106
  Accept: "application/json",
107
107
  }));
108
108
 
109
- const secConfig = await extractSecurity(client._options.bearerAuth);
110
- const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
109
+ const secConfig = await extractSecurity(client._options.accessToken);
110
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
111
111
  const requestSecurity = resolveGlobalSecurity(securityInput);
112
112
 
113
113
  const context = {
@@ -117,7 +117,7 @@ async function $do(
117
117
 
118
118
  resolvedSecurity: requestSecurity,
119
119
 
120
- securitySource: client._options.bearerAuth,
120
+ securitySource: client._options.accessToken,
121
121
  retryConfig: options?.retries
122
122
  || client._options.retryConfig
123
123
  || { strategy: "none" },
@@ -106,8 +106,8 @@ async function $do(
106
106
  Accept: "application/json",
107
107
  }));
108
108
 
109
- const secConfig = await extractSecurity(client._options.bearerAuth);
110
- const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
109
+ const secConfig = await extractSecurity(client._options.accessToken);
110
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
111
111
  const requestSecurity = resolveGlobalSecurity(securityInput);
112
112
 
113
113
  const context = {
@@ -117,7 +117,7 @@ async function $do(
117
117
 
118
118
  resolvedSecurity: requestSecurity,
119
119
 
120
- securitySource: client._options.bearerAuth,
120
+ securitySource: client._options.accessToken,
121
121
  retryConfig: options?.retries
122
122
  || client._options.retryConfig
123
123
  || { strategy: "none" },
@@ -117,8 +117,8 @@ async function $do(
117
117
  Accept: "application/json",
118
118
  }));
119
119
 
120
- const secConfig = await extractSecurity(client._options.bearerAuth);
121
- const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
120
+ const secConfig = await extractSecurity(client._options.accessToken);
121
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
122
122
  const requestSecurity = resolveGlobalSecurity(securityInput);
123
123
 
124
124
  const context = {
@@ -128,7 +128,7 @@ async function $do(
128
128
 
129
129
  resolvedSecurity: requestSecurity,
130
130
 
131
- securitySource: client._options.bearerAuth,
131
+ securitySource: client._options.accessToken,
132
132
  retryConfig: options?.retries
133
133
  || client._options.retryConfig
134
134
  || { strategy: "none" },