@s2-dev/streamstore 0.20.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/LICENSE +21 -201
  2. package/README.md +60 -10
  3. package/dist/cjs/accessTokens.d.ts +27 -14
  4. package/dist/cjs/accessTokens.d.ts.map +1 -1
  5. package/dist/cjs/accessTokens.js +72 -8
  6. package/dist/cjs/accessTokens.js.map +1 -1
  7. package/dist/cjs/basins.d.ts +29 -19
  8. package/dist/cjs/basins.d.ts.map +1 -1
  9. package/dist/cjs/basins.js +119 -9
  10. package/dist/cjs/basins.js.map +1 -1
  11. package/dist/cjs/batch-transform.d.ts +12 -16
  12. package/dist/cjs/batch-transform.d.ts.map +1 -1
  13. package/dist/cjs/batch-transform.js +17 -21
  14. package/dist/cjs/batch-transform.js.map +1 -1
  15. package/dist/cjs/common.d.ts +31 -24
  16. package/dist/cjs/common.d.ts.map +1 -1
  17. package/dist/cjs/common.js +22 -0
  18. package/dist/cjs/common.js.map +1 -1
  19. package/dist/cjs/endpoints.d.ts +63 -0
  20. package/dist/cjs/endpoints.d.ts.map +1 -0
  21. package/dist/cjs/endpoints.js +120 -0
  22. package/dist/cjs/endpoints.js.map +1 -0
  23. package/dist/cjs/error.d.ts.map +1 -1
  24. package/dist/cjs/error.js +11 -0
  25. package/dist/cjs/error.js.map +1 -1
  26. package/dist/cjs/generated/types.gen.d.ts +11 -20
  27. package/dist/cjs/generated/types.gen.d.ts.map +1 -1
  28. package/dist/cjs/index.d.ts +30 -46
  29. package/dist/cjs/index.d.ts.map +1 -1
  30. package/dist/cjs/index.js +50 -26
  31. package/dist/cjs/index.js.map +1 -1
  32. package/dist/cjs/internal/case-transform.d.ts +59 -0
  33. package/dist/cjs/internal/case-transform.d.ts.map +1 -0
  34. package/dist/cjs/internal/case-transform.js +80 -0
  35. package/dist/cjs/internal/case-transform.js.map +1 -0
  36. package/dist/cjs/internal/mappers.d.ts +51 -0
  37. package/dist/cjs/internal/mappers.d.ts.map +1 -0
  38. package/dist/cjs/internal/mappers.js +225 -0
  39. package/dist/cjs/internal/mappers.js.map +1 -0
  40. package/dist/cjs/internal/sdk-types.d.ts +127 -0
  41. package/dist/cjs/internal/sdk-types.d.ts.map +1 -0
  42. package/dist/cjs/internal/sdk-types.js +9 -0
  43. package/dist/cjs/internal/sdk-types.js.map +1 -0
  44. package/dist/cjs/lib/base64.d.ts +8 -0
  45. package/dist/cjs/lib/base64.d.ts.map +1 -1
  46. package/dist/cjs/lib/base64.js +32 -12
  47. package/dist/cjs/lib/base64.js.map +1 -1
  48. package/dist/cjs/lib/event-stream.d.ts.map +1 -1
  49. package/dist/cjs/lib/event-stream.js +2 -1
  50. package/dist/cjs/lib/event-stream.js.map +1 -1
  51. package/dist/cjs/lib/paginate.d.ts +57 -0
  52. package/dist/cjs/lib/paginate.d.ts.map +1 -0
  53. package/dist/cjs/lib/paginate.js +51 -0
  54. package/dist/cjs/lib/paginate.js.map +1 -0
  55. package/dist/cjs/lib/result.d.ts +1 -1
  56. package/dist/cjs/lib/result.d.ts.map +1 -1
  57. package/dist/cjs/lib/retry.d.ts +47 -31
  58. package/dist/cjs/lib/retry.d.ts.map +1 -1
  59. package/dist/cjs/lib/retry.js +302 -201
  60. package/dist/cjs/lib/retry.js.map +1 -1
  61. package/dist/cjs/lib/stream/runtime.d.ts +1 -1
  62. package/dist/cjs/lib/stream/transport/fetch/index.d.ts +7 -9
  63. package/dist/cjs/lib/stream/transport/fetch/index.d.ts.map +1 -1
  64. package/dist/cjs/lib/stream/transport/fetch/index.js +38 -39
  65. package/dist/cjs/lib/stream/transport/fetch/index.js.map +1 -1
  66. package/dist/cjs/lib/stream/transport/fetch/shared.d.ts +7 -2
  67. package/dist/cjs/lib/stream/transport/fetch/shared.d.ts.map +1 -1
  68. package/dist/cjs/lib/stream/transport/fetch/shared.js +56 -110
  69. package/dist/cjs/lib/stream/transport/fetch/shared.js.map +1 -1
  70. package/dist/cjs/lib/stream/transport/proto.d.ts +9 -0
  71. package/dist/cjs/lib/stream/transport/proto.d.ts.map +1 -0
  72. package/dist/cjs/lib/stream/transport/proto.js +118 -0
  73. package/dist/cjs/lib/stream/transport/proto.js.map +1 -0
  74. package/dist/cjs/lib/stream/transport/s2s/index.d.ts +3 -3
  75. package/dist/cjs/lib/stream/transport/s2s/index.d.ts.map +1 -1
  76. package/dist/cjs/lib/stream/transport/s2s/index.js +115 -82
  77. package/dist/cjs/lib/stream/transport/s2s/index.js.map +1 -1
  78. package/dist/cjs/lib/stream/types.d.ts +81 -36
  79. package/dist/cjs/lib/stream/types.d.ts.map +1 -1
  80. package/dist/cjs/lib/stream/types.js +18 -0
  81. package/dist/cjs/lib/stream/types.js.map +1 -1
  82. package/dist/cjs/metrics.d.ts +18 -17
  83. package/dist/cjs/metrics.d.ts.map +1 -1
  84. package/dist/cjs/metrics.js +67 -12
  85. package/dist/cjs/metrics.js.map +1 -1
  86. package/dist/cjs/producer.d.ts +82 -0
  87. package/dist/cjs/producer.d.ts.map +1 -0
  88. package/dist/cjs/producer.js +305 -0
  89. package/dist/cjs/producer.js.map +1 -0
  90. package/dist/cjs/s2.d.ts +1 -2
  91. package/dist/cjs/s2.d.ts.map +1 -1
  92. package/dist/cjs/s2.js +9 -9
  93. package/dist/cjs/s2.js.map +1 -1
  94. package/dist/cjs/stream.d.ts +26 -12
  95. package/dist/cjs/stream.d.ts.map +1 -1
  96. package/dist/cjs/stream.js +77 -13
  97. package/dist/cjs/stream.js.map +1 -1
  98. package/dist/cjs/streams.d.ts +29 -19
  99. package/dist/cjs/streams.d.ts.map +1 -1
  100. package/dist/cjs/streams.js +120 -9
  101. package/dist/cjs/streams.js.map +1 -1
  102. package/dist/cjs/types.d.ts +624 -0
  103. package/dist/cjs/types.d.ts.map +1 -0
  104. package/dist/cjs/types.js +129 -0
  105. package/dist/cjs/types.js.map +1 -0
  106. package/dist/cjs/utils.d.ts +1 -22
  107. package/dist/cjs/utils.d.ts.map +1 -1
  108. package/dist/cjs/utils.js +0 -42
  109. package/dist/cjs/utils.js.map +1 -1
  110. package/dist/cjs/version.d.ts +1 -1
  111. package/dist/cjs/version.js +1 -1
  112. package/dist/esm/accessTokens.d.ts +27 -14
  113. package/dist/esm/accessTokens.d.ts.map +1 -1
  114. package/dist/esm/accessTokens.js +73 -9
  115. package/dist/esm/accessTokens.js.map +1 -1
  116. package/dist/esm/basins.d.ts +29 -19
  117. package/dist/esm/basins.d.ts.map +1 -1
  118. package/dist/esm/basins.js +119 -9
  119. package/dist/esm/basins.js.map +1 -1
  120. package/dist/esm/batch-transform.d.ts +12 -16
  121. package/dist/esm/batch-transform.d.ts.map +1 -1
  122. package/dist/esm/batch-transform.js +18 -22
  123. package/dist/esm/batch-transform.js.map +1 -1
  124. package/dist/esm/common.d.ts +31 -24
  125. package/dist/esm/common.d.ts.map +1 -1
  126. package/dist/esm/common.js +20 -1
  127. package/dist/esm/common.js.map +1 -1
  128. package/dist/esm/endpoints.d.ts +63 -0
  129. package/dist/esm/endpoints.d.ts.map +1 -0
  130. package/dist/esm/endpoints.js +115 -0
  131. package/dist/esm/endpoints.js.map +1 -0
  132. package/dist/esm/error.d.ts.map +1 -1
  133. package/dist/esm/error.js +11 -0
  134. package/dist/esm/error.js.map +1 -1
  135. package/dist/esm/generated/types.gen.d.ts +11 -20
  136. package/dist/esm/generated/types.gen.d.ts.map +1 -1
  137. package/dist/esm/index.d.ts +30 -46
  138. package/dist/esm/index.d.ts.map +1 -1
  139. package/dist/esm/index.js +33 -19
  140. package/dist/esm/index.js.map +1 -1
  141. package/dist/esm/internal/case-transform.d.ts +59 -0
  142. package/dist/esm/internal/case-transform.d.ts.map +1 -0
  143. package/dist/esm/internal/case-transform.js +76 -0
  144. package/dist/esm/internal/case-transform.js.map +1 -0
  145. package/dist/esm/internal/mappers.d.ts +51 -0
  146. package/dist/esm/internal/mappers.d.ts.map +1 -0
  147. package/dist/esm/internal/mappers.js +218 -0
  148. package/dist/esm/internal/mappers.js.map +1 -0
  149. package/dist/esm/internal/sdk-types.d.ts +127 -0
  150. package/dist/esm/internal/sdk-types.d.ts.map +1 -0
  151. package/dist/esm/internal/sdk-types.js +8 -0
  152. package/dist/esm/internal/sdk-types.js.map +1 -0
  153. package/dist/esm/lib/base64.d.ts +8 -0
  154. package/dist/esm/lib/base64.d.ts.map +1 -1
  155. package/dist/esm/lib/base64.js +30 -11
  156. package/dist/esm/lib/base64.js.map +1 -1
  157. package/dist/esm/lib/event-stream.d.ts.map +1 -1
  158. package/dist/esm/lib/event-stream.js +2 -1
  159. package/dist/esm/lib/event-stream.js.map +1 -1
  160. package/dist/esm/lib/paginate.d.ts +57 -0
  161. package/dist/esm/lib/paginate.d.ts.map +1 -0
  162. package/dist/esm/lib/paginate.js +48 -0
  163. package/dist/esm/lib/paginate.js.map +1 -0
  164. package/dist/esm/lib/result.d.ts +1 -1
  165. package/dist/esm/lib/result.d.ts.map +1 -1
  166. package/dist/esm/lib/retry.d.ts +47 -31
  167. package/dist/esm/lib/retry.d.ts.map +1 -1
  168. package/dist/esm/lib/retry.js +303 -201
  169. package/dist/esm/lib/retry.js.map +1 -1
  170. package/dist/esm/lib/stream/runtime.d.ts +1 -1
  171. package/dist/esm/lib/stream/transport/fetch/index.d.ts +7 -9
  172. package/dist/esm/lib/stream/transport/fetch/index.d.ts.map +1 -1
  173. package/dist/esm/lib/stream/transport/fetch/index.js +40 -41
  174. package/dist/esm/lib/stream/transport/fetch/index.js.map +1 -1
  175. package/dist/esm/lib/stream/transport/fetch/shared.d.ts +7 -2
  176. package/dist/esm/lib/stream/transport/fetch/shared.d.ts.map +1 -1
  177. package/dist/esm/lib/stream/transport/fetch/shared.js +58 -112
  178. package/dist/esm/lib/stream/transport/fetch/shared.js.map +1 -1
  179. package/dist/esm/lib/stream/transport/proto.d.ts +9 -0
  180. package/dist/esm/lib/stream/transport/proto.d.ts.map +1 -0
  181. package/dist/esm/lib/stream/transport/proto.js +110 -0
  182. package/dist/esm/lib/stream/transport/proto.js.map +1 -0
  183. package/dist/esm/lib/stream/transport/s2s/index.d.ts +3 -3
  184. package/dist/esm/lib/stream/transport/s2s/index.d.ts.map +1 -1
  185. package/dist/esm/lib/stream/transport/s2s/index.js +116 -82
  186. package/dist/esm/lib/stream/transport/s2s/index.js.map +1 -1
  187. package/dist/esm/lib/stream/types.d.ts +81 -36
  188. package/dist/esm/lib/stream/types.d.ts.map +1 -1
  189. package/dist/esm/lib/stream/types.js +17 -1
  190. package/dist/esm/lib/stream/types.js.map +1 -1
  191. package/dist/esm/metrics.d.ts +18 -17
  192. package/dist/esm/metrics.d.ts.map +1 -1
  193. package/dist/esm/metrics.js +66 -12
  194. package/dist/esm/metrics.js.map +1 -1
  195. package/dist/esm/producer.d.ts +82 -0
  196. package/dist/esm/producer.d.ts.map +1 -0
  197. package/dist/esm/producer.js +300 -0
  198. package/dist/esm/producer.js.map +1 -0
  199. package/dist/esm/s2.d.ts +1 -2
  200. package/dist/esm/s2.d.ts.map +1 -1
  201. package/dist/esm/s2.js +9 -9
  202. package/dist/esm/s2.js.map +1 -1
  203. package/dist/esm/stream.d.ts +26 -12
  204. package/dist/esm/stream.d.ts.map +1 -1
  205. package/dist/esm/stream.js +79 -15
  206. package/dist/esm/stream.js.map +1 -1
  207. package/dist/esm/streams.d.ts +29 -19
  208. package/dist/esm/streams.d.ts.map +1 -1
  209. package/dist/esm/streams.js +120 -9
  210. package/dist/esm/streams.js.map +1 -1
  211. package/dist/esm/types.d.ts +624 -0
  212. package/dist/esm/types.d.ts.map +1 -0
  213. package/dist/esm/types.js +126 -0
  214. package/dist/esm/types.js.map +1 -0
  215. package/dist/esm/utils.d.ts +1 -22
  216. package/dist/esm/utils.d.ts.map +1 -1
  217. package/dist/esm/utils.js +0 -41
  218. package/dist/esm/utils.js.map +1 -1
  219. package/dist/esm/version.d.ts +1 -1
  220. package/dist/esm/version.js +1 -1
  221. package/package.json +4 -3
package/LICENSE CHANGED
@@ -1,201 +1,21 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright [yyyy] [name of copyright owner]
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Stream Store
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -18,26 +18,76 @@ bun add @s2-dev/streamstore
18
18
 
19
19
  Generate an access token from the S2 console at <https://s2.dev/dashboard>, then:
20
20
 
21
+ <!-- snippet:start quick-start -->
21
22
  ```ts
22
- import { S2, AppendRecord } from "@s2-dev/streamstore";
23
+ import {
24
+ AppendAck,
25
+ AppendInput,
26
+ AppendRecord,
27
+ S2,
28
+ S2Environment,
29
+ } from "@s2-dev/streamstore";
30
+
31
+ const basinName = process.env.S2_BASIN ?? "my-existing-basin";
32
+ const streamName = process.env.S2_STREAM ?? "my-new-stream";
23
33
 
24
34
  const s2 = new S2({
25
- accessToken: process.env.S2_ACCESS_TOKEN!,
35
+ ...S2Environment.parse(),
36
+ accessToken: process.env.S2_ACCESS_TOKEN ?? "my-access-token",
26
37
  });
27
38
 
28
- const basin = s2.basin("my-basin");
29
- const stream = basin.stream("my-stream");
39
+ // Create a basin (namespace) client for basin-level operations.
40
+ const basin = s2.basin(basinName);
41
+
42
+ // Make a new stream within the basin, using the default configuration.
43
+ const streamResponse = await basin.streams.create({ stream: streamName });
44
+ console.dir(streamResponse, { depth: null });
45
+
46
+ // Create a stream client on our new stream.
47
+ const stream = basin.stream(streamName);
48
+
49
+ // Make a single append call.
50
+ const append: Promise<AppendAck> = stream.append(
51
+ // `append` expects an input batch of one or many records.
52
+ AppendInput.create([
53
+ // Records can use a string encoding...
54
+ AppendRecord.string({
55
+ body: "Hello from the docs snippet!",
56
+ headers: [["content-type", "text/plain"]],
57
+ }),
58
+ // ...or contain raw binary data.
59
+ AppendRecord.bytes({
60
+ body: new TextEncoder().encode("Bytes payload"),
61
+ }),
62
+ ]),
63
+ );
30
64
 
31
- await stream.append([
32
- AppendRecord.make("Hello, world!", { foo: "bar" }),
33
- ]);
65
+ // When the promise resolves, the data is fully durable and present on the stream.
66
+ const ack = await append;
67
+ console.log(
68
+ `Appended records ${ack.start.seqNum} through ${ack.end.seqNum} (exclusive).`,
69
+ );
70
+ console.dir(ack, { depth: null });
34
71
 
35
- const result = await stream.read({ seq_num: 0, count: 10 });
36
- console.log(result.records);
72
+ // Read the two records back as binary.
73
+ const batch = await stream.read(
74
+ {
75
+ start: { from: { seqNum: ack.start.seqNum } },
76
+ stop: { limits: { count: 2 } },
77
+ },
78
+ { as: "bytes" },
79
+ );
80
+
81
+ for (const record of batch.records) {
82
+ console.dir(record, { depth: null });
83
+ console.log("decoded body: %s", new TextDecoder().decode(record.body));
84
+ }
37
85
  ```
86
+ <!-- snippet:end quick-start -->
87
+
88
+ > Tip: snippets look for `S2_ACCESS_TOKEN`, `S2_BASIN`, and `S2_STREAM` so you can run them with `npx tsx examples/<file>.ts`.
38
89
 
39
90
  ## More documentation
40
91
 
41
92
  - Full SDK overview and additional examples: see the root repo README at <https://github.com/s2-streamstore/s2-sdk-typescript>.
42
93
  - S2 service docs: <https://s2.dev/docs>.
43
-
@@ -1,12 +1,11 @@
1
- import type { DataToObject, RetryConfig, S2RequestOptions } from "./common.js";
1
+ import type { RetryConfig, S2RequestOptions } from "./common.js";
2
2
  import type { Client } from "./generated/client/types.gen.js";
3
- import { type IssueAccessTokenData, type ListAccessTokensData, type RevokeAccessTokenData } from "./generated/index.js";
4
- export interface ListAccessTokensArgs extends DataToObject<ListAccessTokensData> {
5
- }
6
- export interface IssueAccessTokenArgs extends DataToObject<IssueAccessTokenData> {
7
- }
8
- export interface RevokeAccessTokenArgs extends DataToObject<RevokeAccessTokenData> {
9
- }
3
+ import type * as Types from "./types.js";
4
+ /**
5
+ * Account-scoped helper for listing, issuing, and revoking access tokens.
6
+ *
7
+ * Acquire via {@link S2.accessTokens}. Use {@link S2AccessTokens.listAll} for async iteration.
8
+ */
10
9
  export declare class S2AccessTokens {
11
10
  readonly client: Client;
12
11
  private readonly retryConfig?;
@@ -15,24 +14,38 @@ export declare class S2AccessTokens {
15
14
  * List access tokens.
16
15
  *
17
16
  * @param args.prefix Filter to IDs beginning with this prefix
18
- * @param args.start_after Filter to IDs lexicographically after this value
17
+ * @param args.startAfter Filter to IDs lexicographically after this value
19
18
  * @param args.limit Max results (up to 1000)
20
19
  */
21
- list(args?: ListAccessTokensArgs, options?: S2RequestOptions): Promise<import("./generated/types.gen.js").ListAccessTokensResponse>;
20
+ list(args?: Types.ListAccessTokensInput, options?: S2RequestOptions): Promise<Types.ListAccessTokensResponse>;
21
+ /**
22
+ * List all access tokens with automatic pagination.
23
+ * Returns a lazy async iterable that fetches pages as needed.
24
+ *
25
+ * @param args - Optional filtering options: `prefix` to filter by ID prefix, `limit` for max results per page
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * for await (const token of s2.accessTokens.listAll({ prefix: "service-" })) {
30
+ * console.log(token.id);
31
+ * }
32
+ * ```
33
+ */
34
+ listAll(args?: Types.ListAllAccessTokensInput, options?: S2RequestOptions): AsyncIterable<Types.AccessTokenInfo>;
22
35
  /**
23
36
  * Issue a new access token.
24
37
  *
25
38
  * @param args.id Unique token ID (1-96 bytes)
26
39
  * @param args.scope Token scope (operations and resource sets)
27
- * @param args.auto_prefix_streams Namespace stream names by configured prefix scope
28
- * @param args.expires_at Expiration in ISO 8601; defaults to requestor's token expiry
40
+ * @param args.autoPrefixStreams Namespace stream names by configured prefix scope
41
+ * @param args.expiresAt Expiration time (Date or RFC 3339 string); defaults to requestor's token expiry
29
42
  */
30
- issue(args: IssueAccessTokenArgs, options?: S2RequestOptions): Promise<import("./generated/types.gen.js").IssueAccessTokenResponse>;
43
+ issue(args: Types.IssueAccessTokenInput, options?: S2RequestOptions): Promise<Types.IssueAccessTokenResponse>;
31
44
  /**
32
45
  * Revoke an access token by ID.
33
46
  *
34
47
  * @param args.id Token ID to revoke
35
48
  */
36
- revoke(args: RevokeAccessTokenArgs, options?: S2RequestOptions): Promise<unknown>;
49
+ revoke(args: Types.RevokeAccessTokenInput, options?: S2RequestOptions): Promise<void>;
37
50
  }
38
51
  //# sourceMappingURL=accessTokens.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"accessTokens.d.ts","sourceRoot":"","sources":["../../src/accessTokens.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EACN,KAAK,oBAAoB,EAEzB,KAAK,oBAAoB,EAEzB,KAAK,qBAAqB,EAE1B,MAAM,sBAAsB,CAAC;AAG9B,MAAM,WAAW,oBAChB,SAAQ,YAAY,CAAC,oBAAoB,CAAC;CAAG;AAC9C,MAAM,WAAW,oBAChB,SAAQ,YAAY,CAAC,oBAAoB,CAAC;CAAG;AAC9C,MAAM,WAAW,qBAChB,SAAQ,YAAY,CAAC,qBAAqB,CAAC;CAAG;AAE/C,qBAAa,cAAc;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAc;gBAE/B,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW;IAKrD;;;;;;OAMG;IACU,IAAI,C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E,gBAAgB,GACxB,OAAO,CAAC,IAAI,CAAC;CAWhB"}
@@ -3,7 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.S2AccessTokens = void 0;
4
4
  const error_js_1 = require("./error.js");
5
5
  const index_js_1 = require("./generated/index.js");
6
+ const case_transform_js_1 = require("./internal/case-transform.js");
7
+ const paginate_js_1 = require("./lib/paginate.js");
6
8
  const retry_js_1 = require("./lib/retry.js");
9
+ /** Convert expiresAt input (Date, milliseconds, or string) to RFC 3339 string for API. */
10
+ function toISOString(value) {
11
+ if (value === null)
12
+ return null;
13
+ if (value === undefined)
14
+ return undefined;
15
+ if (value instanceof Date)
16
+ return value.toISOString();
17
+ if (typeof value === "number")
18
+ return new Date(value).toISOString();
19
+ return value;
20
+ }
21
+ /** Convert expiresAt from API (ISO string) to Date. */
22
+ function toDate(value) {
23
+ if (value === null)
24
+ return null;
25
+ if (value === undefined)
26
+ return undefined;
27
+ return new Date(value);
28
+ }
29
+ /** Transform AccessTokenInfo response: convert expiresAt to Date. */
30
+ function transformTokenInfo(token) {
31
+ return {
32
+ ...token,
33
+ expiresAt: toDate(token.expiresAt),
34
+ };
35
+ }
36
+ /**
37
+ * Account-scoped helper for listing, issuing, and revoking access tokens.
38
+ *
39
+ * Acquire via {@link S2.accessTokens}. Use {@link S2AccessTokens.listAll} for async iteration.
40
+ */
7
41
  class S2AccessTokens {
8
42
  client;
9
43
  retryConfig;
@@ -15,34 +49,64 @@ class S2AccessTokens {
15
49
  * List access tokens.
16
50
  *
17
51
  * @param args.prefix Filter to IDs beginning with this prefix
18
- * @param args.start_after Filter to IDs lexicographically after this value
52
+ * @param args.startAfter Filter to IDs lexicographically after this value
19
53
  * @param args.limit Max results (up to 1000)
20
54
  */
21
55
  async list(args, options) {
22
- return await (0, retry_js_1.withRetries)(this.retryConfig, async () => {
56
+ const response = await (0, retry_js_1.withRetries)(this.retryConfig, async () => {
23
57
  return await (0, error_js_1.withS2Data)(() => (0, index_js_1.listAccessTokens)({
24
58
  client: this.client,
25
- query: args,
59
+ query: (0, case_transform_js_1.toSnakeCase)(args),
26
60
  ...options,
27
61
  }));
28
62
  });
63
+ const camelCased = (0, case_transform_js_1.toCamelCase)(response);
64
+ return {
65
+ ...camelCased,
66
+ accessTokens: camelCased.accessTokens.map(transformTokenInfo),
67
+ };
68
+ }
69
+ /**
70
+ * List all access tokens with automatic pagination.
71
+ * Returns a lazy async iterable that fetches pages as needed.
72
+ *
73
+ * @param args - Optional filtering options: `prefix` to filter by ID prefix, `limit` for max results per page
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * for await (const token of s2.accessTokens.listAll({ prefix: "service-" })) {
78
+ * console.log(token.id);
79
+ * }
80
+ * ```
81
+ */
82
+ listAll(args, options) {
83
+ return (0, paginate_js_1.paginate)((a) => this.list(a, options).then((r) => ({
84
+ items: r.accessTokens,
85
+ hasMore: r.hasMore,
86
+ })), args ?? {}, (token) => token.id);
29
87
  }
30
88
  /**
31
89
  * Issue a new access token.
32
90
  *
33
91
  * @param args.id Unique token ID (1-96 bytes)
34
92
  * @param args.scope Token scope (operations and resource sets)
35
- * @param args.auto_prefix_streams Namespace stream names by configured prefix scope
36
- * @param args.expires_at Expiration in ISO 8601; defaults to requestor's token expiry
93
+ * @param args.autoPrefixStreams Namespace stream names by configured prefix scope
94
+ * @param args.expiresAt Expiration time (Date or RFC 3339 string); defaults to requestor's token expiry
37
95
  */
38
96
  async issue(args, options) {
39
- return await (0, retry_js_1.withRetries)(this.retryConfig, async () => {
97
+ // Convert Date to ISO string for API
98
+ const apiArgs = {
99
+ ...args,
100
+ expiresAt: toISOString(args.expiresAt),
101
+ };
102
+ const response = await (0, retry_js_1.withRetries)(this.retryConfig, async () => {
40
103
  return await (0, error_js_1.withS2Data)(() => (0, index_js_1.issueAccessToken)({
41
104
  client: this.client,
42
- body: args,
105
+ body: (0, case_transform_js_1.toSnakeCase)(apiArgs),
43
106
  ...options,
44
107
  }));
45
108
  });
109
+ return (0, case_transform_js_1.toCamelCase)(response);
46
110
  }
47
111
  /**
48
112
  * Revoke an access token by ID.
@@ -50,7 +114,7 @@ class S2AccessTokens {
50
114
  * @param args.id Token ID to revoke
51
115
  */
52
116
  async revoke(args, options) {
53
- return await (0, retry_js_1.withRetries)(this.retryConfig, async () => {
117
+ await (0, retry_js_1.withRetries)(this.retryConfig, async () => {
54
118
  return await (0, error_js_1.withS2Data)(() => (0, index_js_1.revokeAccessToken)({
55
119
  client: this.client,
56
120
  path: args,
@@ -1 +1 @@
1
- {"version":3,"file":"accessTokens.js","sourceRoot":"","sources":["../../src/accessTokens.ts"],"names":[],"mappings":";;;AACA,yCAAiD;AAEjD,mDAO8B;AAC9B,6CAA6C;AAS7C,MAAa,cAAc;IACjB,MAAM,CAAS;IACP,WAAW,CAAe;IAE3C,YAAY,MAAc,EAAE,WAAyB;QACpD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IAChC,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,IAAI,CAAC,IAA2B,EAAE,OAA0B;QACxE,OAAO,MAAM,IAAA,sBAAW,EAAC,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,EAAE;YACrD,OAAO,MAAM,IAAA,qBAAU,EAAC,GAAG,EAAE,CAC5B,IAAA,2BAAgB,EAAC;gBAChB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,KAAK,EAAE,IAAI;gBACX,GAAG,OAAO;aACV,CAAC,CACF,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,KAAK,CAAC,IAA0B,EAAE,OAA0B;QACxE,OAAO,MAAM,IAAA,sBAAW,EAAC,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,EAAE;YACrD,OAAO,MAAM,IAAA,qBAAU,EAAC,GAAG,EAAE,CAC5B,IAAA,2BAAgB,EAAC;gBAChB,MAAM,EAAE,IAAI,CAAC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IAAI,EAAE,EACV,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CACnB,CAAC;IACH,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,KAAK,CACjB,IAAiC,EACjC,OAA0B;QAE1B,qCAAqC;QACrC,MAAM,OAAO,GAAG;YACf,GAAG,IAAI;YACP,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC;SACtC,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAW,EAAC,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,EAAE;YAC/D,OAAO,MAAM,IAAA,qBAAU,EAAC,GAAG,EAAE,CAC5B,IAAA,2BAAgB,EAAC;gBAChB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,IAAI,EAAE,IAAA,+BAAW,EAAC,OAAO,CAAC;gBAC1B,GAAG,OAAO;aACV,CAAC,CACF,CAAC;QACH,CAAC,CAAC,CAAC;QACH,OAAO,IAAA,+BAAW,EAAiC,QAAQ,CAAC,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,MAAM,CAClB,IAAkC,EAClC,OAA0B;QAE1B,MAAM,IAAA,sBAAW,EAAC,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,EAAE;YAC9C,OAAO,MAAM,IAAA,qBAAU,EAAC,GAAG,EAAE,CAC5B,IAAA,4BAAiB,EAAC;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,IAAI,EAAE,IAAI;gBACV,GAAG,OAAO;aACV,CAAC,CACF,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AAhHD,wCAgHC"}
@@ -1,16 +1,11 @@
1
- import type { DataToObject, RetryConfig, S2RequestOptions } from "./common.js";
1
+ import type { RetryConfig, S2RequestOptions } from "./common.js";
2
2
  import type { Client } from "./generated/client/types.gen.js";
3
- import { type BasinConfig, type CreateBasinData, type CreateBasinResponse, type DeleteBasinData, type GetBasinConfigData, type ListBasinsData, type ListBasinsResponse, type ReconfigureBasinData, type ReconfigureBasinResponse } from "./generated/index.js";
4
- export interface ListBasinsArgs extends DataToObject<ListBasinsData> {
5
- }
6
- export interface CreateBasinArgs extends DataToObject<CreateBasinData> {
7
- }
8
- export interface GetBasinConfigArgs extends DataToObject<GetBasinConfigData> {
9
- }
10
- export interface DeleteBasinArgs extends DataToObject<DeleteBasinData> {
11
- }
12
- export interface ReconfigureBasinArgs extends DataToObject<ReconfigureBasinData> {
13
- }
3
+ import type * as Types from "./types.js";
4
+ /**
5
+ * Account-scoped helper for listing, creating, deleting, and reconfiguring basins.
6
+ *
7
+ * Retrieve this via {@link S2.basins}. Each method retries according to the client-level retry config.
8
+ */
14
9
  export declare class S2Basins {
15
10
  private readonly client;
16
11
  private readonly retryConfig;
@@ -19,35 +14,50 @@ export declare class S2Basins {
19
14
  * List basins.
20
15
  *
21
16
  * @param args.prefix Return basins whose names start with the given prefix
22
- * @param args.start_after Name to start after (for pagination)
17
+ * @param args.startAfter Name to start after (for pagination)
23
18
  * @param args.limit Max results (up to 1000)
24
19
  */
25
- list(args?: ListBasinsArgs, options?: S2RequestOptions): Promise<ListBasinsResponse>;
20
+ list(args?: Types.ListBasinsInput, options?: S2RequestOptions): Promise<Types.ListBasinsResponse>;
21
+ /**
22
+ * List all basins with automatic pagination.
23
+ * Returns a lazy async iterable that fetches pages as needed.
24
+ *
25
+ * @param includeDeleted - Include basins that are being deleted (default: false)
26
+ * @param args - Optional filtering options: `prefix` to filter by name prefix, `limit` for max results per page
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * for await (const basin of s2.basins.listAll(false, { prefix: "my-" })) {
31
+ * console.log(basin.name);
32
+ * }
33
+ * ```
34
+ */
35
+ listAll(includeDeleted?: boolean, args?: Types.ListAllBasinsInput, options?: S2RequestOptions): AsyncIterable<Types.BasinInfo>;
26
36
  /**
27
37
  * Create a basin.
28
38
  *
29
39
  * @param args.basin Globally unique basin name (8-48 chars, lowercase letters, numbers, hyphens; cannot begin or end with a hyphen)
30
- * @param args.config Optional basin configuration (e.g. default stream config)
40
+ * @param args.config Optional basin configuration (e.g. defaultStreamConfig)
31
41
  * @param args.scope Basin scope
32
42
  */
33
- create(args: CreateBasinArgs, options?: S2RequestOptions): Promise<CreateBasinResponse>;
43
+ create(args: Types.CreateBasinInput, options?: S2RequestOptions): Promise<Types.CreateBasinResponse>;
34
44
  /**
35
45
  * Get basin configuration.
36
46
  *
37
47
  * @param args.basin Basin name
38
48
  */
39
- getConfig(args: GetBasinConfigArgs, options?: S2RequestOptions): Promise<BasinConfig>;
49
+ getConfig(args: Types.GetBasinConfigInput, options?: S2RequestOptions): Promise<Types.BasinConfig>;
40
50
  /**
41
51
  * Delete a basin.
42
52
  *
43
53
  * @param args.basin Basin name
44
54
  */
45
- delete(args: DeleteBasinArgs, options?: S2RequestOptions): Promise<void>;
55
+ delete(args: Types.DeleteBasinInput, options?: S2RequestOptions): Promise<void>;
46
56
  /**
47
57
  * Reconfigure a basin.
48
58
  *
49
59
  * @param args Configuration for the basin to reconfigure (including basin name and fields to change)
50
60
  */
51
- reconfigure(args: ReconfigureBasinArgs, options?: S2RequestOptions): Promise<ReconfigureBasinResponse>;
61
+ reconfigure(args: Types.ReconfigureBasinInput, options?: S2RequestOptions): Promise<Types.ReconfigureBasinResponse>;
52
62
  }
53
63
  //# sourceMappingURL=basins.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"basins.d.ts","sourceRoot":"","sources":["../../src/basins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAExB,KAAK,eAAe,EAEpB,KAAK,kBAAkB,EAEvB,KAAK,cAAc,EACnB,KAAK,kBAAkB,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