apache-iggy 0.5.2 → 0.6.0-edge.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 (75) hide show
  1. package/dist/client/client.connection.js +30 -34
  2. package/dist/client/client.socket.js +1 -1
  3. package/dist/debug-send.js +14 -16
  4. package/dist/debug.js +13 -15
  5. package/dist/e2e/tcp.cluster.e2e.d.ts +20 -0
  6. package/dist/e2e/tcp.cluster.e2e.js +55 -0
  7. package/dist/e2e/tcp.consumer-group.e2e.js +41 -29
  8. package/dist/e2e/tcp.consumer-stream.e2e.js +11 -12
  9. package/dist/e2e/tcp.send-message.e2e.js +60 -23
  10. package/dist/e2e/tcp.stream.e2e.js +5 -6
  11. package/dist/e2e/tcp.system.e2e.js +1 -1
  12. package/dist/e2e/tcp.topic.e2e.js +18 -23
  13. package/dist/e2e/tcp.user.e2e.js +5 -0
  14. package/dist/stream/consumer-stream.d.ts +2 -2
  15. package/dist/stream/consumer-stream.js +4 -14
  16. package/dist/tcp.e2e.js +2 -0
  17. package/dist/wire/client/get-client.command.d.ts +2 -2
  18. package/dist/wire/client/get-client.command.js +5 -1
  19. package/dist/wire/cluster/cluster.type.d.ts +54 -0
  20. package/dist/wire/cluster/cluster.type.js +62 -0
  21. package/dist/wire/cluster/cluster.utils.d.ts +40 -0
  22. package/dist/wire/cluster/cluster.utils.js +85 -0
  23. package/dist/wire/cluster/get-cluster-metadata.command.d.ts +27 -0
  24. package/dist/wire/cluster/get-cluster-metadata.command.js +30 -0
  25. package/dist/wire/cluster/index.d.ts +21 -0
  26. package/dist/wire/cluster/index.js +21 -0
  27. package/dist/wire/command-set.d.ts +15 -6
  28. package/dist/wire/command-set.js +14 -2
  29. package/dist/wire/command.code.d.ts +1 -0
  30. package/dist/wire/command.code.js +1 -0
  31. package/dist/wire/command.utils.js +0 -6
  32. package/dist/wire/consumer-group/create-group.command.d.ts +1 -2
  33. package/dist/wire/consumer-group/create-group.command.js +4 -4
  34. package/dist/wire/consumer-group/create-group.command.test.js +1 -2
  35. package/dist/wire/consumer-group/ensure-group.virtual.command.d.ts +23 -0
  36. package/dist/wire/consumer-group/ensure-group.virtual.command.js +33 -0
  37. package/dist/wire/consumer-group/get-group.command.d.ts +2 -2
  38. package/dist/wire/consumer-group/get-group.command.js +2 -0
  39. package/dist/wire/consumer-group/index.d.ts +1 -0
  40. package/dist/wire/consumer-group/index.js +1 -0
  41. package/dist/wire/error.utils.d.ts +4 -0
  42. package/dist/wire/error.utils.js +10 -0
  43. package/dist/wire/message/header.type.d.ts +1 -1
  44. package/dist/wire/message/poll-messages.command.d.ts +1 -1
  45. package/dist/wire/message/poll.utils.d.ts +1 -1
  46. package/dist/wire/message/poll.utils.js +1 -2
  47. package/dist/wire/offset/delete-offset.command.js +1 -1
  48. package/dist/wire/offset/get-offset.command.d.ts +7 -3
  49. package/dist/wire/offset/get-offset.command.js +3 -3
  50. package/dist/wire/offset/offset.utils.d.ts +2 -2
  51. package/dist/wire/offset/offset.utils.js +13 -4
  52. package/dist/wire/offset/store-offset.command.d.ts +1 -1
  53. package/dist/wire/stream/create-stream.command.d.ts +2 -2
  54. package/dist/wire/stream/create-stream.command.js +4 -4
  55. package/dist/wire/stream/create-stream.command.test.js +2 -3
  56. package/dist/wire/stream/ensure-stream.virtual.command.d.ts +21 -0
  57. package/dist/wire/stream/ensure-stream.virtual.command.js +26 -0
  58. package/dist/wire/stream/get-stream.command.d.ts +2 -2
  59. package/dist/wire/stream/get-stream.command.js +2 -0
  60. package/dist/wire/stream/index.d.ts +1 -0
  61. package/dist/wire/stream/index.js +1 -0
  62. package/dist/wire/system/get-stats.command.d.ts +1 -1
  63. package/dist/wire/topic/create-topic.command.d.ts +1 -2
  64. package/dist/wire/topic/create-topic.command.js +9 -9
  65. package/dist/wire/topic/create-topic.command.test.js +2 -3
  66. package/dist/wire/topic/ensure-topic.virtual.command.d.ts +22 -0
  67. package/dist/wire/topic/ensure-topic.virtual.command.js +28 -0
  68. package/dist/wire/topic/get-topic.command.d.ts +2 -2
  69. package/dist/wire/topic/get-topic.command.js +2 -0
  70. package/dist/wire/topic/index.d.ts +1 -0
  71. package/dist/wire/topic/index.js +1 -0
  72. package/dist/wire/topic/topic.utils.js +1 -1
  73. package/dist/wire/user/get-user.command.d.ts +2 -2
  74. package/dist/wire/user/get-user.command.js +5 -1
  75. package/package.json +1 -1
@@ -23,7 +23,6 @@ describe('CreateTopic', () => {
23
23
  describe('serialize', () => {
24
24
  const t1 = {
25
25
  streamId: 1,
26
- topicId: 2,
27
26
  name: 'test-topic',
28
27
  partitionCount: 1,
29
28
  compressionAlgorithm: 1, // 1 = None, 2 = Gzip
@@ -31,8 +30,8 @@ describe('CreateTopic', () => {
31
30
  maxTopicSize: 0n,
32
31
  replicationFactor: 1
33
32
  };
34
- it('serialize 1 numeric id & 1 name into buffer', () => {
35
- assert.deepEqual(CREATE_TOPIC.serialize(t1).length, 6 + 4 + 4 + 1 + 8 + 8 + 1 + 1 + t1.name.length);
33
+ it('serialize 1 name into buffer', () => {
34
+ assert.deepEqual(CREATE_TOPIC.serialize(t1).length, 6 + 4 + 1 + 8 + 8 + 1 + 1 + t1.name.length);
36
35
  });
37
36
  it('throw on name < 1', () => {
38
37
  const t = { ...t1, name: '' };
@@ -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
+ import { Id } from '../identifier.utils.js';
20
+ import { ClientProvider } from '../../client/index.js';
21
+ export declare const ensureTopic: (c: ClientProvider) => (streamId: Id, topicName: string, partitionCount?: number, compressionAlgorithm?: number) => Promise<import("./topic.utils.js").Topic>;
22
+ //# sourceMappingURL=ensure-topic.virtual.command.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 { createTopic } from './create-topic.command.js';
20
+ import { getTopic } from './get-topic.command.js';
21
+ export const ensureTopic = (c) => async function ensureTopic(streamId, topicName, partitionCount = 1, compressionAlgorithm = 1) {
22
+ const topic = await getTopic(c)({ streamId, topicId: topicName });
23
+ return topic === null ?
24
+ createTopic(c)({
25
+ streamId, name: topicName, partitionCount, compressionAlgorithm
26
+ }) : topic;
27
+ };
28
+ //# sourceMappingURL=ensure-topic.virtual.command.js.map
@@ -26,8 +26,8 @@ type GetTopic = {
26
26
  export declare const GET_TOPIC: {
27
27
  code: number;
28
28
  serialize: ({ streamId, topicId }: GetTopic) => Buffer<ArrayBuffer>;
29
- deserialize: (r: CommandResponse) => Topic;
29
+ deserialize: (r: CommandResponse) => Topic | null;
30
30
  };
31
- export declare const getTopic: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: GetTopic) => Promise<Topic>;
31
+ export declare const getTopic: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: GetTopic) => Promise<Topic | null>;
32
32
  export {};
33
33
  //# sourceMappingURL=get-topic.command.d.ts.map
@@ -29,6 +29,8 @@ export const GET_TOPIC = {
29
29
  ]);
30
30
  },
31
31
  deserialize: (r) => {
32
+ if (r.status === 0 && r.length === 0)
33
+ return null;
32
34
  return deserializeTopic(r.data).data;
33
35
  }
34
36
  };
@@ -22,5 +22,6 @@ export * from './get-topic.command.js';
22
22
  export * from './get-topics.command.js';
23
23
  export * from './purge-topic.command.js';
24
24
  export * from './update-topic.command.js';
25
+ export * from './ensure-topic.virtual.command.js';
25
26
  export { CompressionAlgorithm } from './topic.utils.js';
26
27
  //# sourceMappingURL=index.d.ts.map
@@ -22,5 +22,6 @@ export * from './get-topic.command.js';
22
22
  export * from './get-topics.command.js';
23
23
  export * from './purge-topic.command.js';
24
24
  export * from './update-topic.command.js';
25
+ export * from './ensure-topic.virtual.command.js';
25
26
  export { CompressionAlgorithm } from './topic.utils.js';
26
27
  //# sourceMappingURL=index.js.map
@@ -59,7 +59,7 @@ export const deserializePartition = (p, pos = 0) => {
59
59
  segmentsCount: p.readUInt32LE(pos + 12),
60
60
  currentOffset: p.readBigUint64LE(pos + 16),
61
61
  sizeBytes: p.readBigUint64LE(pos + 24),
62
- messagesCount: p.readBigUint64LE(pos + 24),
62
+ messagesCount: p.readBigUint64LE(pos + 32),
63
63
  }
64
64
  };
65
65
  };
@@ -25,7 +25,7 @@ export type GetUser = {
25
25
  export declare const GET_USER: {
26
26
  code: number;
27
27
  serialize: ({ userId }: GetUser) => Buffer<ArrayBufferLike>;
28
- deserialize: (r: CommandResponse) => User;
28
+ deserialize: (r: CommandResponse) => User | null;
29
29
  };
30
- export declare const getUser: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: GetUser) => Promise<User>;
30
+ export declare const getUser: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: GetUser) => Promise<User | null>;
31
31
  //# sourceMappingURL=get-user.command.d.ts.map
@@ -25,7 +25,11 @@ export const GET_USER = {
25
25
  serialize: ({ userId }) => {
26
26
  return serializeIdentifier(userId);
27
27
  },
28
- deserialize: (r) => deserializeUser(r.data)
28
+ deserialize: (r) => {
29
+ if (r.status === 0 && r.length === 0)
30
+ return null;
31
+ return deserializeUser(r.data);
32
+ }
29
33
  };
30
34
  export const getUser = wrapCommand(GET_USER);
31
35
  //# sourceMappingURL=get-user.command.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "apache-iggy",
3
3
  "type": "module",
4
- "version": "0.5.2",
4
+ "version": "0.6.0-edge.2",
5
5
  "description": "Official Apache Iggy NodeJS SDK",
6
6
  "keywords": [
7
7
  "iggy",