apache-iggy 0.5.0-edge.1

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 (265) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +81 -0
  3. package/dist/src/bdd/auth.d.ts +20 -0
  4. package/dist/src/bdd/auth.js +38 -0
  5. package/dist/src/bdd/message.d.ts +20 -0
  6. package/dist/src/bdd/message.js +70 -0
  7. package/dist/src/bdd/stream.d.ts +20 -0
  8. package/dist/src/bdd/stream.js +39 -0
  9. package/dist/src/bdd/topic.d.ts +20 -0
  10. package/dist/src/bdd/topic.js +36 -0
  11. package/dist/src/bdd/world.d.ts +30 -0
  12. package/dist/src/bdd/world.js +21 -0
  13. package/dist/src/client/client.connection.d.ts +40 -0
  14. package/dist/src/client/client.connection.js +171 -0
  15. package/dist/src/client/client.d.ts +38 -0
  16. package/dist/src/client/client.debug.d.ts +21 -0
  17. package/dist/src/client/client.debug.js +21 -0
  18. package/dist/src/client/client.js +97 -0
  19. package/dist/src/client/client.socket.d.ts +48 -0
  20. package/dist/src/client/client.socket.js +156 -0
  21. package/dist/src/client/client.type.d.ts +69 -0
  22. package/dist/src/client/client.type.js +20 -0
  23. package/dist/src/client/client.utils.d.ts +29 -0
  24. package/dist/src/client/client.utils.js +54 -0
  25. package/dist/src/client/index.d.ts +23 -0
  26. package/dist/src/client/index.js +23 -0
  27. package/dist/src/client.e2e.d.ts +20 -0
  28. package/dist/src/client.e2e.js +54 -0
  29. package/dist/src/debug-send.d.ts +20 -0
  30. package/dist/src/debug-send.js +117 -0
  31. package/dist/src/debug.d.ts +20 -0
  32. package/dist/src/debug.js +107 -0
  33. package/dist/src/e2e/tcp.client.e2e.d.ts +20 -0
  34. package/dist/src/e2e/tcp.client.e2e.js +45 -0
  35. package/dist/src/e2e/tcp.consumer-group.e2e.d.ts +20 -0
  36. package/dist/src/e2e/tcp.consumer-group.e2e.js +111 -0
  37. package/dist/src/e2e/tcp.consumer-stream.e2e.d.ts +20 -0
  38. package/dist/src/e2e/tcp.consumer-stream.e2e.js +92 -0
  39. package/dist/src/e2e/tcp.parallel.e2e.d.ts +20 -0
  40. package/dist/src/e2e/tcp.parallel.e2e.js +59 -0
  41. package/dist/src/e2e/tcp.send-message.e2e.d.ts +20 -0
  42. package/dist/src/e2e/tcp.send-message.e2e.js +118 -0
  43. package/dist/src/e2e/tcp.stream.e2e.d.ts +20 -0
  44. package/dist/src/e2e/tcp.stream.e2e.js +59 -0
  45. package/dist/src/e2e/tcp.system.e2e.d.ts +20 -0
  46. package/dist/src/e2e/tcp.system.e2e.js +46 -0
  47. package/dist/src/e2e/tcp.token.e2e.d.ts +20 -0
  48. package/dist/src/e2e/tcp.token.e2e.js +43 -0
  49. package/dist/src/e2e/tcp.topic.e2e.d.ts +20 -0
  50. package/dist/src/e2e/tcp.topic.e2e.js +83 -0
  51. package/dist/src/e2e/tcp.user.e2e.d.ts +20 -0
  52. package/dist/src/e2e/tcp.user.e2e.js +95 -0
  53. package/dist/src/e2e/test-client.utils.d.ts +21 -0
  54. package/dist/src/e2e/test-client.utils.js +28 -0
  55. package/dist/src/index.d.ts +22 -0
  56. package/dist/src/index.js +22 -0
  57. package/dist/src/stream/consumer-stream.d.ts +40 -0
  58. package/dist/src/stream/consumer-stream.js +79 -0
  59. package/dist/src/stream/index.d.ts +20 -0
  60. package/dist/src/stream/index.js +20 -0
  61. package/dist/src/tcp.e2e.d.ts +20 -0
  62. package/dist/src/tcp.e2e.js +106 -0
  63. package/dist/src/tcp.sm.utils.d.ts +97 -0
  64. package/dist/src/tcp.sm.utils.js +66 -0
  65. package/dist/src/tls.system.e2e.d.ts +20 -0
  66. package/dist/src/tls.system.e2e.js +49 -0
  67. package/dist/src/type.utils.d.ts +21 -0
  68. package/dist/src/type.utils.js +25 -0
  69. package/dist/src/wire/client/client.utils.d.ts +32 -0
  70. package/dist/src/wire/client/client.utils.js +48 -0
  71. package/dist/src/wire/client/get-client.command.d.ts +30 -0
  72. package/dist/src/wire/client/get-client.command.js +33 -0
  73. package/dist/src/wire/client/get-clients.command.d.ts +27 -0
  74. package/dist/src/wire/client/get-clients.command.js +38 -0
  75. package/dist/src/wire/client/get-me.command.d.ts +27 -0
  76. package/dist/src/wire/client/get-me.command.js +28 -0
  77. package/dist/src/wire/client/index.d.ts +22 -0
  78. package/dist/src/wire/client/index.js +22 -0
  79. package/dist/src/wire/command-set.d.ts +128 -0
  80. package/dist/src/wire/command-set.js +157 -0
  81. package/dist/src/wire/command.code.d.ts +68 -0
  82. package/dist/src/wire/command.code.js +72 -0
  83. package/dist/src/wire/command.utils.d.ts +26 -0
  84. package/dist/src/wire/command.utils.js +29 -0
  85. package/dist/src/wire/consumer-group/create-group.command.d.ts +34 -0
  86. package/dist/src/wire/consumer-group/create-group.command.js +44 -0
  87. package/dist/src/wire/consumer-group/create-group.command.test.d.ts +20 -0
  88. package/dist/src/wire/consumer-group/create-group.command.test.js +47 -0
  89. package/dist/src/wire/consumer-group/delete-group.command.d.ts +31 -0
  90. package/dist/src/wire/consumer-group/delete-group.command.js +31 -0
  91. package/dist/src/wire/consumer-group/get-group.command.d.ts +33 -0
  92. package/dist/src/wire/consumer-group/get-group.command.js +32 -0
  93. package/dist/src/wire/consumer-group/get-groups.command.d.ts +32 -0
  94. package/dist/src/wire/consumer-group/get-groups.command.js +36 -0
  95. package/dist/src/wire/consumer-group/group.command.test.d.ts +20 -0
  96. package/dist/src/wire/consumer-group/group.command.test.js +50 -0
  97. package/dist/src/wire/consumer-group/group.utils.d.ts +34 -0
  98. package/dist/src/wire/consumer-group/group.utils.js +53 -0
  99. package/dist/src/wire/consumer-group/index.d.ts +25 -0
  100. package/dist/src/wire/consumer-group/index.js +25 -0
  101. package/dist/src/wire/consumer-group/join-group.command.d.ts +31 -0
  102. package/dist/src/wire/consumer-group/join-group.command.js +31 -0
  103. package/dist/src/wire/consumer-group/leave-group.command.d.ts +31 -0
  104. package/dist/src/wire/consumer-group/leave-group.command.js +31 -0
  105. package/dist/src/wire/error.code.d.ts +20 -0
  106. package/dist/src/wire/error.code.js +202 -0
  107. package/dist/src/wire/error.utils.d.ts +20 -0
  108. package/dist/src/wire/error.utils.js +23 -0
  109. package/dist/src/wire/identifier.utils.d.ts +21 -0
  110. package/dist/src/wire/identifier.utils.js +49 -0
  111. package/dist/src/wire/identifier.utils.test.d.ts +20 -0
  112. package/dist/src/wire/identifier.utils.test.js +40 -0
  113. package/dist/src/wire/index.d.ts +32 -0
  114. package/dist/src/wire/index.js +31 -0
  115. package/dist/src/wire/message/flush-unsaved-buffers.command.d.ts +31 -0
  116. package/dist/src/wire/message/flush-unsaved-buffers.command.js +31 -0
  117. package/dist/src/wire/message/header.type.d.ts +101 -0
  118. package/dist/src/wire/message/header.type.js +55 -0
  119. package/dist/src/wire/message/header.utils.d.ts +67 -0
  120. package/dist/src/wire/message/header.utils.js +248 -0
  121. package/dist/src/wire/message/header.utils.test.d.ts +20 -0
  122. package/dist/src/wire/message/header.utils.test.js +39 -0
  123. package/dist/src/wire/message/iggy-header.utils.d.ts +32 -0
  124. package/dist/src/wire/message/iggy-header.utils.js +50 -0
  125. package/dist/src/wire/message/index.d.ts +25 -0
  126. package/dist/src/wire/message/index.js +25 -0
  127. package/dist/src/wire/message/message.utils.d.ts +35 -0
  128. package/dist/src/wire/message/message.utils.js +112 -0
  129. package/dist/src/wire/message/partitioning.utils.d.ts +51 -0
  130. package/dist/src/wire/message/partitioning.utils.js +77 -0
  131. package/dist/src/wire/message/poll-messages.command.d.ts +43 -0
  132. package/dist/src/wire/message/poll-messages.command.js +32 -0
  133. package/dist/src/wire/message/poll.utils.d.ts +93 -0
  134. package/dist/src/wire/message/poll.utils.js +135 -0
  135. package/dist/src/wire/message/send-messages.command.d.ts +34 -0
  136. package/dist/src/wire/message/send-messages.command.js +31 -0
  137. package/dist/src/wire/message/send-messages.command.test.d.ts +20 -0
  138. package/dist/src/wire/message/send-messages.command.test.js +88 -0
  139. package/dist/src/wire/number.utils.d.ts +32 -0
  140. package/dist/src/wire/number.utils.js +85 -0
  141. package/dist/src/wire/offset/delete-offset.command.d.ts +28 -0
  142. package/dist/src/wire/offset/delete-offset.command.js +31 -0
  143. package/dist/src/wire/offset/get-offset.command.d.ts +34 -0
  144. package/dist/src/wire/offset/get-offset.command.js +41 -0
  145. package/dist/src/wire/offset/index.d.ts +22 -0
  146. package/dist/src/wire/offset/index.js +22 -0
  147. package/dist/src/wire/offset/offset.utils.d.ts +54 -0
  148. package/dist/src/wire/offset/offset.utils.js +60 -0
  149. package/dist/src/wire/offset/store-offset.command.d.ts +34 -0
  150. package/dist/src/wire/offset/store-offset.command.js +29 -0
  151. package/dist/src/wire/partition/create-partition.command.d.ts +31 -0
  152. package/dist/src/wire/partition/create-partition.command.js +31 -0
  153. package/dist/src/wire/partition/delete-partition.command.d.ts +31 -0
  154. package/dist/src/wire/partition/delete-partition.command.js +31 -0
  155. package/dist/src/wire/partition/index.d.ts +21 -0
  156. package/dist/src/wire/partition/index.js +21 -0
  157. package/dist/src/wire/partition/partition.utils.d.ts +21 -0
  158. package/dist/src/wire/partition/partition.utils.js +33 -0
  159. package/dist/src/wire/partition/partition.utils.test.d.ts +20 -0
  160. package/dist/src/wire/partition/partition.utils.test.js +33 -0
  161. package/dist/src/wire/segment/delete-segments.command.d.ts +32 -0
  162. package/dist/src/wire/segment/delete-segments.command.js +31 -0
  163. package/dist/src/wire/segment/index.d.ts +20 -0
  164. package/dist/src/wire/segment/index.js +20 -0
  165. package/dist/src/wire/segment/segment.utils.d.ts +21 -0
  166. package/dist/src/wire/segment/segment.utils.js +35 -0
  167. package/dist/src/wire/serialize.utils.d.ts +22 -0
  168. package/dist/src/wire/serialize.utils.js +27 -0
  169. package/dist/src/wire/session/index.d.ts +23 -0
  170. package/dist/src/wire/session/index.js +22 -0
  171. package/dist/src/wire/session/login-with-token.command.d.ts +32 -0
  172. package/dist/src/wire/session/login-with-token.command.js +30 -0
  173. package/dist/src/wire/session/login-with-token.command.test.d.ts +20 -0
  174. package/dist/src/wire/session/login-with-token.command.test.js +38 -0
  175. package/dist/src/wire/session/login.command.d.ts +29 -0
  176. package/dist/src/wire/session/login.command.js +30 -0
  177. package/dist/src/wire/session/login.command.test.d.ts +20 -0
  178. package/dist/src/wire/session/login.command.test.js +52 -0
  179. package/dist/src/wire/session/login.utils.d.ts +30 -0
  180. package/dist/src/wire/session/login.utils.js +54 -0
  181. package/dist/src/wire/session/logout.command.d.ts +25 -0
  182. package/dist/src/wire/session/logout.command.js +30 -0
  183. package/dist/src/wire/stream/create-stream.command.d.ts +31 -0
  184. package/dist/src/wire/stream/create-stream.command.js +41 -0
  185. package/dist/src/wire/stream/create-stream.command.test.d.ts +20 -0
  186. package/dist/src/wire/stream/create-stream.command.test.js +45 -0
  187. package/dist/src/wire/stream/delete-stream.command.d.ts +29 -0
  188. package/dist/src/wire/stream/delete-stream.command.js +31 -0
  189. package/dist/src/wire/stream/get-stream.command.d.ts +31 -0
  190. package/dist/src/wire/stream/get-stream.command.js +33 -0
  191. package/dist/src/wire/stream/get-streams.command.d.ts +27 -0
  192. package/dist/src/wire/stream/get-streams.command.js +38 -0
  193. package/dist/src/wire/stream/index.d.ts +25 -0
  194. package/dist/src/wire/stream/index.js +25 -0
  195. package/dist/src/wire/stream/purge-stream.command.d.ts +29 -0
  196. package/dist/src/wire/stream/purge-stream.command.js +31 -0
  197. package/dist/src/wire/stream/stream.utils.d.ts +33 -0
  198. package/dist/src/wire/stream/stream.utils.js +35 -0
  199. package/dist/src/wire/stream/update-stream.command.d.ts +30 -0
  200. package/dist/src/wire/stream/update-stream.command.js +40 -0
  201. package/dist/src/wire/system/get-stats.command.d.ts +50 -0
  202. package/dist/src/wire/system/get-stats.command.js +83 -0
  203. package/dist/src/wire/system/index.d.ts +21 -0
  204. package/dist/src/wire/system/index.js +21 -0
  205. package/dist/src/wire/system/ping.command.d.ts +25 -0
  206. package/dist/src/wire/system/ping.command.js +30 -0
  207. package/dist/src/wire/token/create-token.command.d.ts +31 -0
  208. package/dist/src/wire/token/create-token.command.js +37 -0
  209. package/dist/src/wire/token/create-token.command.test.d.ts +20 -0
  210. package/dist/src/wire/token/create-token.command.test.js +45 -0
  211. package/dist/src/wire/token/delete-token.command.d.ts +28 -0
  212. package/dist/src/wire/token/delete-token.command.js +38 -0
  213. package/dist/src/wire/token/delete-token.command.test.d.ts +20 -0
  214. package/dist/src/wire/token/delete-token.command.test.js +42 -0
  215. package/dist/src/wire/token/get-tokens.command.d.ts +27 -0
  216. package/dist/src/wire/token/get-tokens.command.js +28 -0
  217. package/dist/src/wire/token/index.d.ts +22 -0
  218. package/dist/src/wire/token/index.js +22 -0
  219. package/dist/src/wire/token/token.utils.d.ts +38 -0
  220. package/dist/src/wire/token/token.utils.js +53 -0
  221. package/dist/src/wire/topic/create-topic.command.d.ts +38 -0
  222. package/dist/src/wire/topic/create-topic.command.js +53 -0
  223. package/dist/src/wire/topic/create-topic.command.test.d.ts +20 -0
  224. package/dist/src/wire/topic/create-topic.command.test.js +67 -0
  225. package/dist/src/wire/topic/delete-topic.command.d.ts +32 -0
  226. package/dist/src/wire/topic/delete-topic.command.js +36 -0
  227. package/dist/src/wire/topic/get-topic.command.d.ts +33 -0
  228. package/dist/src/wire/topic/get-topic.command.js +36 -0
  229. package/dist/src/wire/topic/get-topics.command.d.ts +31 -0
  230. package/dist/src/wire/topic/get-topics.command.js +33 -0
  231. package/dist/src/wire/topic/index.d.ts +25 -0
  232. package/dist/src/wire/topic/index.js +25 -0
  233. package/dist/src/wire/topic/purge-topic.command.d.ts +30 -0
  234. package/dist/src/wire/topic/purge-topic.command.js +34 -0
  235. package/dist/src/wire/topic/topic.utils.d.ts +71 -0
  236. package/dist/src/wire/topic/topic.utils.js +91 -0
  237. package/dist/src/wire/topic/update-topic.command.d.ts +36 -0
  238. package/dist/src/wire/topic/update-topic.command.js +50 -0
  239. package/dist/src/wire/user/change-password.command.d.ts +30 -0
  240. package/dist/src/wire/user/change-password.command.js +45 -0
  241. package/dist/src/wire/user/create-user.command.d.ts +34 -0
  242. package/dist/src/wire/user/create-user.command.js +48 -0
  243. package/dist/src/wire/user/create-user.command.test.d.ts +20 -0
  244. package/dist/src/wire/user/create-user.command.test.js +60 -0
  245. package/dist/src/wire/user/delete-user.command.d.ts +29 -0
  246. package/dist/src/wire/user/delete-user.command.js +31 -0
  247. package/dist/src/wire/user/get-user.command.d.ts +31 -0
  248. package/dist/src/wire/user/get-user.command.js +31 -0
  249. package/dist/src/wire/user/get-users.command.d.ts +27 -0
  250. package/dist/src/wire/user/get-users.command.js +28 -0
  251. package/dist/src/wire/user/index.d.ts +26 -0
  252. package/dist/src/wire/user/index.js +26 -0
  253. package/dist/src/wire/user/permissions.utils.d.ts +77 -0
  254. package/dist/src/wire/user/permissions.utils.js +161 -0
  255. package/dist/src/wire/user/permissions.utils.test.d.ts +20 -0
  256. package/dist/src/wire/user/permissions.utils.test.js +44 -0
  257. package/dist/src/wire/user/update-permissions.command.d.ts +31 -0
  258. package/dist/src/wire/user/update-permissions.command.js +39 -0
  259. package/dist/src/wire/user/update-user.command.d.ts +32 -0
  260. package/dist/src/wire/user/update-user.command.js +54 -0
  261. package/dist/src/wire/user/user.utils.d.ts +41 -0
  262. package/dist/src/wire/user/user.utils.js +74 -0
  263. package/dist/src/wire/uuid.utils.d.ts +22 -0
  264. package/dist/src/wire/uuid.utils.js +23 -0
  265. package/package.json +70 -0
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ import { after, describe, it } from 'node:test';
20
+ import assert from 'node:assert/strict';
21
+ import { getTestClient } from './test-client.utils.js';
22
+ describe('e2e -> user', async () => {
23
+ const c = getTestClient();
24
+ const userId = 42;
25
+ const username = 'test-user';
26
+ const password = 'test-pwd123$!';
27
+ const status = 1; // Active;
28
+ const permissions = {
29
+ global: {
30
+ ManageServers: false,
31
+ ReadServers: false,
32
+ ManageUsers: true,
33
+ ReadUsers: true,
34
+ ManageStreams: true,
35
+ ReadStreams: true,
36
+ ManageTopics: true,
37
+ ReadTopics: true,
38
+ PollMessages: true,
39
+ SendMessages: true
40
+ },
41
+ streams: []
42
+ };
43
+ const cUser = { userId, username, password, status, permissions };
44
+ it('e2e -> user::create', async () => {
45
+ const user = await c.user.create(cUser);
46
+ assert.ok(user);
47
+ });
48
+ it('e2e -> user::list', async () => {
49
+ const users = await c.user.list();
50
+ assert.ok(users.length > 0);
51
+ });
52
+ it('e2e -> user::get#name', async () => {
53
+ const user = await c.user.get({ userId: username });
54
+ assert.ok(user);
55
+ });
56
+ it('e2e -> user::get#id', async () => {
57
+ const u1 = await c.user.get({ userId: username });
58
+ const u2 = await c.user.get({ userId: u1.id });
59
+ assert.deepEqual(u1, u2);
60
+ });
61
+ it('e2e -> user::update', async () => {
62
+ const user = await c.user.get({ userId: username });
63
+ const u2 = await c.user.update({
64
+ userId: user.id,
65
+ status: 2
66
+ });
67
+ assert.ok(u2);
68
+ });
69
+ it('e2e -> user::changePassword', async () => {
70
+ const user = await c.user.get({ userId: username });
71
+ assert.ok(await c.user.changePassword({
72
+ userId: user.id, currentPassword: password, newPassword: 'h4x0r42'
73
+ }));
74
+ });
75
+ it('e2e -> user::updatePermissions', async () => {
76
+ const user = await c.user.get({ userId: username });
77
+ const perms2 = { ...permissions };
78
+ perms2.global.ReadServers = true;
79
+ const u2 = await c.user.updatePermissions({
80
+ userId: user.id, permissions: perms2
81
+ });
82
+ assert.ok(u2);
83
+ });
84
+ it('e2e -> user::delete', async () => {
85
+ const user = await c.user.get({ userId: username });
86
+ assert.ok(await c.user.delete({ userId: user.id }));
87
+ });
88
+ it('e2e -> user::logout', async () => {
89
+ assert.ok(await c.session.logout());
90
+ });
91
+ after(() => {
92
+ c.destroy();
93
+ });
94
+ });
95
+ //# sourceMappingURL=tcp.user.e2e.js.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ import { Client } from '../client/client.js';
20
+ export declare const getTestClient: () => Client;
21
+ //# sourceMappingURL=test-client.utils.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ import { Client } from '../client/client.js';
20
+ import { getIggyAddress } from '../tcp.sm.utils.js';
21
+ const credentials = { username: 'iggy', password: 'iggy' };
22
+ const [host, port] = getIggyAddress();
23
+ export const getTestClient = () => new Client({
24
+ transport: 'TCP',
25
+ options: { host, port },
26
+ credentials
27
+ });
28
+ //# sourceMappingURL=test-client.utils.js.map
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ export { type Id, PollingStrategy, Consumer, Partitioning, HeaderValue, } from './wire/index.js';
20
+ export * from './client/index.js';
21
+ export * from './stream/index.js';
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ export { PollingStrategy, Consumer, Partitioning, HeaderValue, } from './wire/index.js';
20
+ export * from './client/index.js';
21
+ export * from './stream/index.js';
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ import { Readable } from "node:stream";
20
+ import type { ClientConfig } from "../client/client.type.js";
21
+ import type { Id } from '../wire/identifier.utils.js';
22
+ import { type PollingStrategy } from "../wire/index.js";
23
+ export type ConsumerStreamRequest = {
24
+ streamId: Id;
25
+ topicId: Id;
26
+ pollingStrategy: PollingStrategy;
27
+ count: number;
28
+ interval?: number;
29
+ autocommit?: boolean;
30
+ endOnLastOffset?: boolean;
31
+ };
32
+ export type SingleConsumerStreamRequest = ConsumerStreamRequest & {
33
+ partitionId: number;
34
+ };
35
+ export type GroupConsumerStreamRequest = ConsumerStreamRequest & {
36
+ groupId: number;
37
+ };
38
+ export declare const singleConsumerStream: (config: ClientConfig) => ({ streamId, topicId, partitionId, pollingStrategy, count, interval, autocommit, endOnLastOffset }: SingleConsumerStreamRequest) => Promise<Readable>;
39
+ export declare const groupConsumerStream: (config: ClientConfig) => ({ groupId, streamId, topicId, pollingStrategy, count, interval, autocommit, endOnLastOffset }: GroupConsumerStreamRequest) => Promise<Readable>;
40
+ //# sourceMappingURL=consumer-stream.d.ts.map
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ import { Readable } from "node:stream";
20
+ import { getClient } from "../client/client.js";
21
+ import { Consumer } from "../wire/index.js";
22
+ import { debug } from "../client/client.debug.js";
23
+ const wait = (interval, cb) => new Promise((resolve) => {
24
+ setTimeout(() => resolve(cb ? cb() : undefined), interval);
25
+ });
26
+ async function* genEagerUntilPoll(c, poll, interval = 1000, endOnLastOffset = false) {
27
+ const state = new Map();
28
+ while (true) {
29
+ const r = await c.message.poll(poll);
30
+ yield r;
31
+ state.set(`${r.partitionId}`, r.count);
32
+ if (Array.from(state).every(([, last]) => last === 0)) {
33
+ if (endOnLastOffset)
34
+ return;
35
+ else
36
+ await wait(interval);
37
+ }
38
+ }
39
+ }
40
+ ;
41
+ export const singleConsumerStream = (config) => async ({ streamId, topicId, partitionId, pollingStrategy, count, interval = 1000, autocommit = true, endOnLastOffset = false }) => {
42
+ const c = await getClient(config);
43
+ const poll = {
44
+ streamId,
45
+ topicId,
46
+ partitionId,
47
+ consumer: Consumer.Single,
48
+ pollingStrategy,
49
+ count,
50
+ autocommit
51
+ };
52
+ const ps = Readable.from(genEagerUntilPoll(c, poll, interval, endOnLastOffset), { objectMode: true });
53
+ return ps;
54
+ };
55
+ export const groupConsumerStream = (config) => async function groupConsumerStream({ groupId, streamId, topicId, pollingStrategy, count, interval = 1000, autocommit = true, endOnLastOffset = false }) {
56
+ const s = await getClient(config);
57
+ try {
58
+ await s.group.get({ streamId, topicId, groupId });
59
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
60
+ }
61
+ catch (err) {
62
+ const ng = { streamId, topicId, groupId, name: `auto-${groupId}` };
63
+ debug('group does not exist, creating it', ng);
64
+ await s.group.create(ng);
65
+ }
66
+ await s.group.join({ streamId, topicId, groupId });
67
+ const poll = {
68
+ streamId,
69
+ topicId,
70
+ consumer: Consumer.Group(groupId),
71
+ partitionId: 0,
72
+ pollingStrategy,
73
+ count,
74
+ autocommit
75
+ };
76
+ const ps = Readable.from(genEagerUntilPoll(s, poll, interval, endOnLastOffset), { objectMode: true });
77
+ return ps;
78
+ };
79
+ //# sourceMappingURL=consumer-stream.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ export * from './consumer-stream.js';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ export * from './consumer-stream.js';
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ export {};
20
+ //# sourceMappingURL=tcp.e2e.d.ts.map
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ import { getRawClient } from './client/index.js';
20
+ import { login, logout, updateStream, getStream, getStreams, updateTopic, getTopic, getTopics, createPartition, deletePartition, createTopic, deleteTopic, createStream, deleteStream, } from './wire/index.js';
21
+ try {
22
+ // create socket
23
+ const cli = getRawClient({
24
+ transport: 'TCP',
25
+ options: {
26
+ host: '127.0.0.1',
27
+ port: 8090
28
+ },
29
+ credentials: { username: 'iggy', password: 'iggy' }
30
+ });
31
+ const s = () => Promise.resolve(cli);
32
+ // LOGIN
33
+ const r = await login(s)({ username: 'iggy', password: 'iggy' });
34
+ console.log('RESPONSE_login', r);
35
+ const stream = {
36
+ name: 'test-stream',
37
+ streamId: 1
38
+ };
39
+ // CREATE_STREAM
40
+ const r_createStream = await createStream(s)(stream);
41
+ console.log('RESPONSE_createStream', r_createStream);
42
+ // GET_STREAM #ID
43
+ const r7 = await getStream(s)({ streamId: stream.streamId });
44
+ console.log('RESPONSE7', r7);
45
+ // GET_STREAM #NAME
46
+ const r8 = await getStream(s)({ streamId: stream.name });
47
+ console.log('RESPONSE8', r8);
48
+ // UPDATE_STREAM
49
+ const r_updateStream = await updateStream(s)({
50
+ streamId: stream.streamId, name: 'updatedStreamName'
51
+ });
52
+ console.log('RESPONSE_updateStream', r_updateStream);
53
+ // GET_STREAMS
54
+ const r9 = await getStreams(s)();
55
+ console.log('RESPONSE9', r9);
56
+ const topic1 = {
57
+ streamId: stream.streamId,
58
+ topicId: 44,
59
+ name: 'topic-name-44',
60
+ partitionCount: 3,
61
+ compressionAlgorithm: 1, // 1 = None, 2 = Gzip
62
+ };
63
+ // CREATE_TOPIC
64
+ const r_createTopic = await createTopic(s)(topic1);
65
+ console.log('RESPONSE_createTopic', r_createTopic);
66
+ // GET_TOPIC
67
+ const t2 = await getTopic(s)({ streamId: topic1.streamId, topicId: topic1.name });
68
+ console.log('RESPONSE_getTopic', t2);
69
+ // UPDATE_TOPIC
70
+ const r_updateTopic = await updateTopic(s)({
71
+ streamId: topic1.streamId, topicId: topic1.topicId, name: topic1.name, messageExpiry: 42n
72
+ });
73
+ console.log('RESPONSE_updateTopic', r_updateTopic);
74
+ // CREATE_PARTITION
75
+ const r_createPartition = await createPartition(s)({
76
+ streamId: topic1.streamId, topicId: t2.id, partitionCount: 22
77
+ });
78
+ console.log('RESPONSE_createPartition', r_createPartition);
79
+ // DELETE_PARTITION
80
+ const r_deletePartition = await deletePartition(s)({
81
+ streamId: topic1.streamId, topicId: t2.id, partitionCount: 19
82
+ });
83
+ console.log('RESPONSE_deletePartition', r_deletePartition);
84
+ // GET_TOPIC AGAIN
85
+ const r_getTopic2 = await getTopic(s)({ streamId: topic1.streamId, topicId: topic1.name });
86
+ console.log('RESPONSE_getTopic2', r_getTopic2);
87
+ // GET_TOPICS
88
+ const r_getTopics = await getTopics(s)({ streamId: topic1.streamId });
89
+ console.log('RESPONSE_getTopics', r_getTopics);
90
+ // DELETE TOPIC
91
+ const r_deleteTopic = await deleteTopic(s)({
92
+ streamId: topic1.streamId, topicId: t2.id, partitionsCount: 3
93
+ });
94
+ console.log('RESPONSE_deleteTopic', r_deleteTopic);
95
+ // DELETE STREAM
96
+ const rDelS = await deleteStream(s)({ streamId: stream.streamId });
97
+ console.log('RESPONSEDelS', rDelS);
98
+ // LOGOUT
99
+ const rOut = await logout(s)();
100
+ console.log('RESPONSE LOGOUT', rOut);
101
+ }
102
+ catch (err) {
103
+ console.error('FAILED!', err);
104
+ }
105
+ process.exit(0);
106
+ //# sourceMappingURL=tcp.e2e.js.map
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ import { type Partitioning, type Message } from './wire/index.js';
20
+ import type { ClientProvider } from './client/client.type.js';
21
+ import type { Id } from './wire/identifier.utils.js';
22
+ export declare const someMessageContent: () => {
23
+ payload: string;
24
+ headers: {
25
+ foo: import("./wire/message/header.type.js").HeaderValueInt32;
26
+ bar: import("./wire/message/header.type.js").HeaderValueUint8;
27
+ };
28
+ Headers?: undefined;
29
+ } | {
30
+ payload: string;
31
+ headers?: undefined;
32
+ Headers?: undefined;
33
+ } | {
34
+ payload: string;
35
+ headers: {
36
+ 'x-header-string-1': import("./wire/message/header.type.js").HeaderValueString;
37
+ };
38
+ Headers?: undefined;
39
+ } | {
40
+ payload: string;
41
+ headers: {
42
+ 'x-header-bool': import("./wire/message/header.type.js").HeaderValueBool;
43
+ };
44
+ Headers?: undefined;
45
+ } | {
46
+ payload: string;
47
+ Headers: {
48
+ 'x-header-bool': import("./wire/message/header.type.js").HeaderValueBool;
49
+ };
50
+ headers?: undefined;
51
+ };
52
+ export declare const generateMessages: (count?: number) => ({
53
+ payload: string;
54
+ headers: {
55
+ foo: import("./wire/message/header.type.js").HeaderValueInt32;
56
+ bar: import("./wire/message/header.type.js").HeaderValueUint8;
57
+ };
58
+ Headers?: undefined;
59
+ id: string;
60
+ } | {
61
+ payload: string;
62
+ headers?: undefined;
63
+ Headers?: undefined;
64
+ id: string;
65
+ } | {
66
+ payload: string;
67
+ headers: {
68
+ 'x-header-string-1': import("./wire/message/header.type.js").HeaderValueString;
69
+ };
70
+ Headers?: undefined;
71
+ id: string;
72
+ } | {
73
+ payload: string;
74
+ headers: {
75
+ 'x-header-bool': import("./wire/message/header.type.js").HeaderValueBool;
76
+ };
77
+ Headers?: undefined;
78
+ id: string;
79
+ } | {
80
+ payload: string;
81
+ Headers: {
82
+ 'x-header-bool': import("./wire/message/header.type.js").HeaderValueBool;
83
+ };
84
+ headers?: undefined;
85
+ id: string;
86
+ })[];
87
+ export declare const sendSomeMessages: (s: ClientProvider) => (streamId: Id, topicId: Id, partition: Partitioning) => Promise<true>;
88
+ export declare const formatPolledMessages: (msgs: Message[]) => {
89
+ id: string | BigInt;
90
+ offset: bigint;
91
+ headers: import("./wire/message/header.utils.js").HeadersMap;
92
+ payload: string;
93
+ timestamp: Date;
94
+ checksum: bigint;
95
+ }[];
96
+ export declare const getIggyAddress: (host?: string, port?: number) => [string, number];
97
+ //# sourceMappingURL=tcp.sm.utils.d.ts.map
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ import assert from 'node:assert/strict';
20
+ import { v7 } from './wire/uuid.utils.js';
21
+ import { sendMessages, HeaderValue } from './wire/index.js';
22
+ const h0 = { 'foo': HeaderValue.Int32(42), 'bar': HeaderValue.Uint8(123) };
23
+ const h1 = { 'x-header-string-1': HeaderValue.String('incredible') };
24
+ const h2 = { 'x-header-bool': HeaderValue.Bool(false) };
25
+ const messages = [
26
+ { payload: 'content with header', headers: h0 },
27
+ { payload: 'content solo' },
28
+ { payload: 'yolo msg' },
29
+ { payload: 'yolo msg 2' },
30
+ { payload: 'this is fuu', headers: h1 },
31
+ { payload: 'this is bar', headers: h2 },
32
+ { payload: 'yolo msg 3' },
33
+ { payload: 'fuu again', headers: h1 },
34
+ { payload: 'damnit', headers: h0 },
35
+ { payload: 'yolo msg 4', Headers: h2 },
36
+ ];
37
+ export const someMessageContent = () => messages[Math.floor(Math.random() * messages.length)];
38
+ export const generateMessages = (count = 1) => {
39
+ return [...Array(count)].map(() => ({ id: v7(), ...someMessageContent() }));
40
+ };
41
+ export const sendSomeMessages = (s) => async (streamId, topicId, partition) => {
42
+ const rSend = await sendMessages(s)({
43
+ topicId, streamId, messages: generateMessages(100), partition
44
+ });
45
+ assert.ok(rSend);
46
+ return rSend;
47
+ };
48
+ export const formatPolledMessages = (msgs) => msgs.map(m => {
49
+ const { headers: { id, offset, timestamp, checksum }, payload, userHeaders } = m;
50
+ return {
51
+ id,
52
+ offset,
53
+ headers: userHeaders,
54
+ payload: payload.toString(),
55
+ timestamp,
56
+ checksum
57
+ };
58
+ });
59
+ export const getIggyAddress = (host = '127.0.0.1', port = 8090) => {
60
+ if (process.env.IGGY_TCP_ADDRESS) {
61
+ const s = (process.env.IGGY_TCP_ADDRESS || '').split(':');
62
+ [host, port] = [s[0], s[1] ? parseInt(s[1].toString(), 10) : port];
63
+ }
64
+ return [host, port];
65
+ };
66
+ //# sourceMappingURL=tcp.sm.utils.js.map
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ export {};
20
+ //# sourceMappingURL=tls.system.e2e.d.ts.map