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.
- package/LICENSE +201 -0
- package/README.md +81 -0
- package/dist/src/bdd/auth.d.ts +20 -0
- package/dist/src/bdd/auth.js +38 -0
- package/dist/src/bdd/message.d.ts +20 -0
- package/dist/src/bdd/message.js +70 -0
- package/dist/src/bdd/stream.d.ts +20 -0
- package/dist/src/bdd/stream.js +39 -0
- package/dist/src/bdd/topic.d.ts +20 -0
- package/dist/src/bdd/topic.js +36 -0
- package/dist/src/bdd/world.d.ts +30 -0
- package/dist/src/bdd/world.js +21 -0
- package/dist/src/client/client.connection.d.ts +40 -0
- package/dist/src/client/client.connection.js +171 -0
- package/dist/src/client/client.d.ts +38 -0
- package/dist/src/client/client.debug.d.ts +21 -0
- package/dist/src/client/client.debug.js +21 -0
- package/dist/src/client/client.js +97 -0
- package/dist/src/client/client.socket.d.ts +48 -0
- package/dist/src/client/client.socket.js +156 -0
- package/dist/src/client/client.type.d.ts +69 -0
- package/dist/src/client/client.type.js +20 -0
- package/dist/src/client/client.utils.d.ts +29 -0
- package/dist/src/client/client.utils.js +54 -0
- package/dist/src/client/index.d.ts +23 -0
- package/dist/src/client/index.js +23 -0
- package/dist/src/client.e2e.d.ts +20 -0
- package/dist/src/client.e2e.js +54 -0
- package/dist/src/debug-send.d.ts +20 -0
- package/dist/src/debug-send.js +117 -0
- package/dist/src/debug.d.ts +20 -0
- package/dist/src/debug.js +107 -0
- package/dist/src/e2e/tcp.client.e2e.d.ts +20 -0
- package/dist/src/e2e/tcp.client.e2e.js +45 -0
- package/dist/src/e2e/tcp.consumer-group.e2e.d.ts +20 -0
- package/dist/src/e2e/tcp.consumer-group.e2e.js +111 -0
- package/dist/src/e2e/tcp.consumer-stream.e2e.d.ts +20 -0
- package/dist/src/e2e/tcp.consumer-stream.e2e.js +92 -0
- package/dist/src/e2e/tcp.parallel.e2e.d.ts +20 -0
- package/dist/src/e2e/tcp.parallel.e2e.js +59 -0
- package/dist/src/e2e/tcp.send-message.e2e.d.ts +20 -0
- package/dist/src/e2e/tcp.send-message.e2e.js +118 -0
- package/dist/src/e2e/tcp.stream.e2e.d.ts +20 -0
- package/dist/src/e2e/tcp.stream.e2e.js +59 -0
- package/dist/src/e2e/tcp.system.e2e.d.ts +20 -0
- package/dist/src/e2e/tcp.system.e2e.js +46 -0
- package/dist/src/e2e/tcp.token.e2e.d.ts +20 -0
- package/dist/src/e2e/tcp.token.e2e.js +43 -0
- package/dist/src/e2e/tcp.topic.e2e.d.ts +20 -0
- package/dist/src/e2e/tcp.topic.e2e.js +83 -0
- package/dist/src/e2e/tcp.user.e2e.d.ts +20 -0
- package/dist/src/e2e/tcp.user.e2e.js +95 -0
- package/dist/src/e2e/test-client.utils.d.ts +21 -0
- package/dist/src/e2e/test-client.utils.js +28 -0
- package/dist/src/index.d.ts +22 -0
- package/dist/src/index.js +22 -0
- package/dist/src/stream/consumer-stream.d.ts +40 -0
- package/dist/src/stream/consumer-stream.js +79 -0
- package/dist/src/stream/index.d.ts +20 -0
- package/dist/src/stream/index.js +20 -0
- package/dist/src/tcp.e2e.d.ts +20 -0
- package/dist/src/tcp.e2e.js +106 -0
- package/dist/src/tcp.sm.utils.d.ts +97 -0
- package/dist/src/tcp.sm.utils.js +66 -0
- package/dist/src/tls.system.e2e.d.ts +20 -0
- package/dist/src/tls.system.e2e.js +49 -0
- package/dist/src/type.utils.d.ts +21 -0
- package/dist/src/type.utils.js +25 -0
- package/dist/src/wire/client/client.utils.d.ts +32 -0
- package/dist/src/wire/client/client.utils.js +48 -0
- package/dist/src/wire/client/get-client.command.d.ts +30 -0
- package/dist/src/wire/client/get-client.command.js +33 -0
- package/dist/src/wire/client/get-clients.command.d.ts +27 -0
- package/dist/src/wire/client/get-clients.command.js +38 -0
- package/dist/src/wire/client/get-me.command.d.ts +27 -0
- package/dist/src/wire/client/get-me.command.js +28 -0
- package/dist/src/wire/client/index.d.ts +22 -0
- package/dist/src/wire/client/index.js +22 -0
- package/dist/src/wire/command-set.d.ts +128 -0
- package/dist/src/wire/command-set.js +157 -0
- package/dist/src/wire/command.code.d.ts +68 -0
- package/dist/src/wire/command.code.js +72 -0
- package/dist/src/wire/command.utils.d.ts +26 -0
- package/dist/src/wire/command.utils.js +29 -0
- package/dist/src/wire/consumer-group/create-group.command.d.ts +34 -0
- package/dist/src/wire/consumer-group/create-group.command.js +44 -0
- package/dist/src/wire/consumer-group/create-group.command.test.d.ts +20 -0
- package/dist/src/wire/consumer-group/create-group.command.test.js +47 -0
- package/dist/src/wire/consumer-group/delete-group.command.d.ts +31 -0
- package/dist/src/wire/consumer-group/delete-group.command.js +31 -0
- package/dist/src/wire/consumer-group/get-group.command.d.ts +33 -0
- package/dist/src/wire/consumer-group/get-group.command.js +32 -0
- package/dist/src/wire/consumer-group/get-groups.command.d.ts +32 -0
- package/dist/src/wire/consumer-group/get-groups.command.js +36 -0
- package/dist/src/wire/consumer-group/group.command.test.d.ts +20 -0
- package/dist/src/wire/consumer-group/group.command.test.js +50 -0
- package/dist/src/wire/consumer-group/group.utils.d.ts +34 -0
- package/dist/src/wire/consumer-group/group.utils.js +53 -0
- package/dist/src/wire/consumer-group/index.d.ts +25 -0
- package/dist/src/wire/consumer-group/index.js +25 -0
- package/dist/src/wire/consumer-group/join-group.command.d.ts +31 -0
- package/dist/src/wire/consumer-group/join-group.command.js +31 -0
- package/dist/src/wire/consumer-group/leave-group.command.d.ts +31 -0
- package/dist/src/wire/consumer-group/leave-group.command.js +31 -0
- package/dist/src/wire/error.code.d.ts +20 -0
- package/dist/src/wire/error.code.js +202 -0
- package/dist/src/wire/error.utils.d.ts +20 -0
- package/dist/src/wire/error.utils.js +23 -0
- package/dist/src/wire/identifier.utils.d.ts +21 -0
- package/dist/src/wire/identifier.utils.js +49 -0
- package/dist/src/wire/identifier.utils.test.d.ts +20 -0
- package/dist/src/wire/identifier.utils.test.js +40 -0
- package/dist/src/wire/index.d.ts +32 -0
- package/dist/src/wire/index.js +31 -0
- package/dist/src/wire/message/flush-unsaved-buffers.command.d.ts +31 -0
- package/dist/src/wire/message/flush-unsaved-buffers.command.js +31 -0
- package/dist/src/wire/message/header.type.d.ts +101 -0
- package/dist/src/wire/message/header.type.js +55 -0
- package/dist/src/wire/message/header.utils.d.ts +67 -0
- package/dist/src/wire/message/header.utils.js +248 -0
- package/dist/src/wire/message/header.utils.test.d.ts +20 -0
- package/dist/src/wire/message/header.utils.test.js +39 -0
- package/dist/src/wire/message/iggy-header.utils.d.ts +32 -0
- package/dist/src/wire/message/iggy-header.utils.js +50 -0
- package/dist/src/wire/message/index.d.ts +25 -0
- package/dist/src/wire/message/index.js +25 -0
- package/dist/src/wire/message/message.utils.d.ts +35 -0
- package/dist/src/wire/message/message.utils.js +112 -0
- package/dist/src/wire/message/partitioning.utils.d.ts +51 -0
- package/dist/src/wire/message/partitioning.utils.js +77 -0
- package/dist/src/wire/message/poll-messages.command.d.ts +43 -0
- package/dist/src/wire/message/poll-messages.command.js +32 -0
- package/dist/src/wire/message/poll.utils.d.ts +93 -0
- package/dist/src/wire/message/poll.utils.js +135 -0
- package/dist/src/wire/message/send-messages.command.d.ts +34 -0
- package/dist/src/wire/message/send-messages.command.js +31 -0
- package/dist/src/wire/message/send-messages.command.test.d.ts +20 -0
- package/dist/src/wire/message/send-messages.command.test.js +88 -0
- package/dist/src/wire/number.utils.d.ts +32 -0
- package/dist/src/wire/number.utils.js +85 -0
- package/dist/src/wire/offset/delete-offset.command.d.ts +28 -0
- package/dist/src/wire/offset/delete-offset.command.js +31 -0
- package/dist/src/wire/offset/get-offset.command.d.ts +34 -0
- package/dist/src/wire/offset/get-offset.command.js +41 -0
- package/dist/src/wire/offset/index.d.ts +22 -0
- package/dist/src/wire/offset/index.js +22 -0
- package/dist/src/wire/offset/offset.utils.d.ts +54 -0
- package/dist/src/wire/offset/offset.utils.js +60 -0
- package/dist/src/wire/offset/store-offset.command.d.ts +34 -0
- package/dist/src/wire/offset/store-offset.command.js +29 -0
- package/dist/src/wire/partition/create-partition.command.d.ts +31 -0
- package/dist/src/wire/partition/create-partition.command.js +31 -0
- package/dist/src/wire/partition/delete-partition.command.d.ts +31 -0
- package/dist/src/wire/partition/delete-partition.command.js +31 -0
- package/dist/src/wire/partition/index.d.ts +21 -0
- package/dist/src/wire/partition/index.js +21 -0
- package/dist/src/wire/partition/partition.utils.d.ts +21 -0
- package/dist/src/wire/partition/partition.utils.js +33 -0
- package/dist/src/wire/partition/partition.utils.test.d.ts +20 -0
- package/dist/src/wire/partition/partition.utils.test.js +33 -0
- package/dist/src/wire/segment/delete-segments.command.d.ts +32 -0
- package/dist/src/wire/segment/delete-segments.command.js +31 -0
- package/dist/src/wire/segment/index.d.ts +20 -0
- package/dist/src/wire/segment/index.js +20 -0
- package/dist/src/wire/segment/segment.utils.d.ts +21 -0
- package/dist/src/wire/segment/segment.utils.js +35 -0
- package/dist/src/wire/serialize.utils.d.ts +22 -0
- package/dist/src/wire/serialize.utils.js +27 -0
- package/dist/src/wire/session/index.d.ts +23 -0
- package/dist/src/wire/session/index.js +22 -0
- package/dist/src/wire/session/login-with-token.command.d.ts +32 -0
- package/dist/src/wire/session/login-with-token.command.js +30 -0
- package/dist/src/wire/session/login-with-token.command.test.d.ts +20 -0
- package/dist/src/wire/session/login-with-token.command.test.js +38 -0
- package/dist/src/wire/session/login.command.d.ts +29 -0
- package/dist/src/wire/session/login.command.js +30 -0
- package/dist/src/wire/session/login.command.test.d.ts +20 -0
- package/dist/src/wire/session/login.command.test.js +52 -0
- package/dist/src/wire/session/login.utils.d.ts +30 -0
- package/dist/src/wire/session/login.utils.js +54 -0
- package/dist/src/wire/session/logout.command.d.ts +25 -0
- package/dist/src/wire/session/logout.command.js +30 -0
- package/dist/src/wire/stream/create-stream.command.d.ts +31 -0
- package/dist/src/wire/stream/create-stream.command.js +41 -0
- package/dist/src/wire/stream/create-stream.command.test.d.ts +20 -0
- package/dist/src/wire/stream/create-stream.command.test.js +45 -0
- package/dist/src/wire/stream/delete-stream.command.d.ts +29 -0
- package/dist/src/wire/stream/delete-stream.command.js +31 -0
- package/dist/src/wire/stream/get-stream.command.d.ts +31 -0
- package/dist/src/wire/stream/get-stream.command.js +33 -0
- package/dist/src/wire/stream/get-streams.command.d.ts +27 -0
- package/dist/src/wire/stream/get-streams.command.js +38 -0
- package/dist/src/wire/stream/index.d.ts +25 -0
- package/dist/src/wire/stream/index.js +25 -0
- package/dist/src/wire/stream/purge-stream.command.d.ts +29 -0
- package/dist/src/wire/stream/purge-stream.command.js +31 -0
- package/dist/src/wire/stream/stream.utils.d.ts +33 -0
- package/dist/src/wire/stream/stream.utils.js +35 -0
- package/dist/src/wire/stream/update-stream.command.d.ts +30 -0
- package/dist/src/wire/stream/update-stream.command.js +40 -0
- package/dist/src/wire/system/get-stats.command.d.ts +50 -0
- package/dist/src/wire/system/get-stats.command.js +83 -0
- package/dist/src/wire/system/index.d.ts +21 -0
- package/dist/src/wire/system/index.js +21 -0
- package/dist/src/wire/system/ping.command.d.ts +25 -0
- package/dist/src/wire/system/ping.command.js +30 -0
- package/dist/src/wire/token/create-token.command.d.ts +31 -0
- package/dist/src/wire/token/create-token.command.js +37 -0
- package/dist/src/wire/token/create-token.command.test.d.ts +20 -0
- package/dist/src/wire/token/create-token.command.test.js +45 -0
- package/dist/src/wire/token/delete-token.command.d.ts +28 -0
- package/dist/src/wire/token/delete-token.command.js +38 -0
- package/dist/src/wire/token/delete-token.command.test.d.ts +20 -0
- package/dist/src/wire/token/delete-token.command.test.js +42 -0
- package/dist/src/wire/token/get-tokens.command.d.ts +27 -0
- package/dist/src/wire/token/get-tokens.command.js +28 -0
- package/dist/src/wire/token/index.d.ts +22 -0
- package/dist/src/wire/token/index.js +22 -0
- package/dist/src/wire/token/token.utils.d.ts +38 -0
- package/dist/src/wire/token/token.utils.js +53 -0
- package/dist/src/wire/topic/create-topic.command.d.ts +38 -0
- package/dist/src/wire/topic/create-topic.command.js +53 -0
- package/dist/src/wire/topic/create-topic.command.test.d.ts +20 -0
- package/dist/src/wire/topic/create-topic.command.test.js +67 -0
- package/dist/src/wire/topic/delete-topic.command.d.ts +32 -0
- package/dist/src/wire/topic/delete-topic.command.js +36 -0
- package/dist/src/wire/topic/get-topic.command.d.ts +33 -0
- package/dist/src/wire/topic/get-topic.command.js +36 -0
- package/dist/src/wire/topic/get-topics.command.d.ts +31 -0
- package/dist/src/wire/topic/get-topics.command.js +33 -0
- package/dist/src/wire/topic/index.d.ts +25 -0
- package/dist/src/wire/topic/index.js +25 -0
- package/dist/src/wire/topic/purge-topic.command.d.ts +30 -0
- package/dist/src/wire/topic/purge-topic.command.js +34 -0
- package/dist/src/wire/topic/topic.utils.d.ts +71 -0
- package/dist/src/wire/topic/topic.utils.js +91 -0
- package/dist/src/wire/topic/update-topic.command.d.ts +36 -0
- package/dist/src/wire/topic/update-topic.command.js +50 -0
- package/dist/src/wire/user/change-password.command.d.ts +30 -0
- package/dist/src/wire/user/change-password.command.js +45 -0
- package/dist/src/wire/user/create-user.command.d.ts +34 -0
- package/dist/src/wire/user/create-user.command.js +48 -0
- package/dist/src/wire/user/create-user.command.test.d.ts +20 -0
- package/dist/src/wire/user/create-user.command.test.js +60 -0
- package/dist/src/wire/user/delete-user.command.d.ts +29 -0
- package/dist/src/wire/user/delete-user.command.js +31 -0
- package/dist/src/wire/user/get-user.command.d.ts +31 -0
- package/dist/src/wire/user/get-user.command.js +31 -0
- package/dist/src/wire/user/get-users.command.d.ts +27 -0
- package/dist/src/wire/user/get-users.command.js +28 -0
- package/dist/src/wire/user/index.d.ts +26 -0
- package/dist/src/wire/user/index.js +26 -0
- package/dist/src/wire/user/permissions.utils.d.ts +77 -0
- package/dist/src/wire/user/permissions.utils.js +161 -0
- package/dist/src/wire/user/permissions.utils.test.d.ts +20 -0
- package/dist/src/wire/user/permissions.utils.test.js +44 -0
- package/dist/src/wire/user/update-permissions.command.d.ts +31 -0
- package/dist/src/wire/user/update-permissions.command.js +39 -0
- package/dist/src/wire/user/update-user.command.d.ts +32 -0
- package/dist/src/wire/user/update-user.command.js +54 -0
- package/dist/src/wire/user/user.utils.d.ts +41 -0
- package/dist/src/wire/user/user.utils.js +74 -0
- package/dist/src/wire/uuid.utils.d.ts +22 -0
- package/dist/src/wire/uuid.utils.js +23 -0
- package/package.json +70 -0
|
@@ -0,0 +1,53 @@
|
|
|
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 { toDate } from '../serialize.utils.js';
|
|
20
|
+
export const deserializeCreateToken = (p, pos = 0) => {
|
|
21
|
+
const len = p.readUInt8(pos);
|
|
22
|
+
const token = p.subarray(pos + 1, pos + 1 + len).toString();
|
|
23
|
+
return { bytesRead: 1 + len, data: { token } };
|
|
24
|
+
};
|
|
25
|
+
export const deserializeToken = (p, pos = 0) => {
|
|
26
|
+
const nameLength = p.readUInt8(pos);
|
|
27
|
+
const name = p.subarray(pos + 1, pos + 1 + nameLength).toString();
|
|
28
|
+
const rest = p.subarray(pos + 1 + nameLength);
|
|
29
|
+
let expiry = null;
|
|
30
|
+
let bytesRead = pos + 1 + nameLength;
|
|
31
|
+
if (rest.length >= 8) {
|
|
32
|
+
expiry = toDate(rest.readBigUInt64LE(0));
|
|
33
|
+
bytesRead += 8;
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
bytesRead,
|
|
37
|
+
data: {
|
|
38
|
+
name,
|
|
39
|
+
expiry
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export const deserializeTokens = (p, pos = 0) => {
|
|
44
|
+
const tokens = [];
|
|
45
|
+
const len = p.length;
|
|
46
|
+
while (pos < len) {
|
|
47
|
+
const { bytesRead, data } = deserializeToken(p, pos);
|
|
48
|
+
tokens.push(data);
|
|
49
|
+
pos += bytesRead;
|
|
50
|
+
}
|
|
51
|
+
return tokens;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=token.utils.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { CommandResponse } from '../../client/client.type.js';
|
|
20
|
+
import { type Id } from '../identifier.utils.js';
|
|
21
|
+
import { type Topic, type CompressionAlgorithm } from './topic.utils.js';
|
|
22
|
+
export type CreateTopic = {
|
|
23
|
+
streamId: Id;
|
|
24
|
+
topicId: number;
|
|
25
|
+
name: string;
|
|
26
|
+
partitionCount: number;
|
|
27
|
+
compressionAlgorithm: CompressionAlgorithm;
|
|
28
|
+
messageExpiry?: bigint;
|
|
29
|
+
maxTopicSize?: bigint;
|
|
30
|
+
replicationFactor?: number;
|
|
31
|
+
};
|
|
32
|
+
export declare const CREATE_TOPIC: {
|
|
33
|
+
code: number;
|
|
34
|
+
serialize: ({ streamId, topicId, name, partitionCount, compressionAlgorithm, messageExpiry, maxTopicSize, replicationFactor }: CreateTopic) => Buffer<ArrayBuffer>;
|
|
35
|
+
deserialize: (r: CommandResponse) => Topic;
|
|
36
|
+
};
|
|
37
|
+
export declare const createTopic: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: CreateTopic) => Promise<Topic>;
|
|
38
|
+
//# sourceMappingURL=create-topic.command.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
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 { serializeIdentifier } from '../identifier.utils.js';
|
|
20
|
+
import { wrapCommand } from '../command.utils.js';
|
|
21
|
+
import { COMMAND_CODE } from '../command.code.js';
|
|
22
|
+
import { isValidCompressionAlgorithm, CompressionAlgorithmKind, deserializeTopic } from './topic.utils.js';
|
|
23
|
+
export const CREATE_TOPIC = {
|
|
24
|
+
code: COMMAND_CODE.CreateTopic,
|
|
25
|
+
serialize: ({ streamId, topicId, name, partitionCount, compressionAlgorithm = CompressionAlgorithmKind.None, messageExpiry = 0n, maxTopicSize = 0n, replicationFactor = 1 }) => {
|
|
26
|
+
const streamIdentifier = serializeIdentifier(streamId);
|
|
27
|
+
const bName = Buffer.from(name);
|
|
28
|
+
if (replicationFactor < 1 || replicationFactor > 255)
|
|
29
|
+
throw new Error('Topic replication factor should be between 1 and 255');
|
|
30
|
+
if (bName.length < 1 || bName.length > 255)
|
|
31
|
+
throw new Error('Topic name should be between 1 and 255 bytes');
|
|
32
|
+
if (!isValidCompressionAlgorithm(compressionAlgorithm))
|
|
33
|
+
throw new Error(`createTopic: invalid compressionAlgorithm (${compressionAlgorithm})`);
|
|
34
|
+
const b = Buffer.allocUnsafe(4 + 4 + 1 + 8 + 8 + 1 + 1);
|
|
35
|
+
b.writeUInt32LE(topicId, 0);
|
|
36
|
+
b.writeUInt32LE(partitionCount, 4);
|
|
37
|
+
b.writeUInt8(compressionAlgorithm, 8);
|
|
38
|
+
b.writeBigUInt64LE(messageExpiry, 9); // 0 is unlimited
|
|
39
|
+
b.writeBigUInt64LE(maxTopicSize, 17); // optional, 0 is null
|
|
40
|
+
b.writeUInt8(replicationFactor, 25); // must be > 0
|
|
41
|
+
b.writeUInt8(bName.length, 26);
|
|
42
|
+
return Buffer.concat([
|
|
43
|
+
streamIdentifier,
|
|
44
|
+
b,
|
|
45
|
+
bName,
|
|
46
|
+
]);
|
|
47
|
+
},
|
|
48
|
+
deserialize: (r) => {
|
|
49
|
+
return deserializeTopic(r.data).data;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
export const createTopic = wrapCommand(CREATE_TOPIC);
|
|
53
|
+
//# sourceMappingURL=create-topic.command.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=create-topic.command.test.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
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 { describe, it } from 'node:test';
|
|
20
|
+
import assert from 'node:assert/strict';
|
|
21
|
+
import { CREATE_TOPIC } from './create-topic.command.js';
|
|
22
|
+
describe('CreateTopic', () => {
|
|
23
|
+
describe('serialize', () => {
|
|
24
|
+
const t1 = {
|
|
25
|
+
streamId: 1,
|
|
26
|
+
topicId: 2,
|
|
27
|
+
name: 'test-topic',
|
|
28
|
+
partitionCount: 1,
|
|
29
|
+
compressionAlgorithm: 1, // 1 = None, 2 = Gzip
|
|
30
|
+
messageExpiry: 0n,
|
|
31
|
+
maxTopicSize: 0n,
|
|
32
|
+
replicationFactor: 1
|
|
33
|
+
};
|
|
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);
|
|
36
|
+
});
|
|
37
|
+
it('throw on name < 1', () => {
|
|
38
|
+
const t = { ...t1, name: '' };
|
|
39
|
+
assert.throws(() => CREATE_TOPIC.serialize(t));
|
|
40
|
+
});
|
|
41
|
+
it("throw on name > 255 bytes", () => {
|
|
42
|
+
const t = { ...t1, name: "YoLo".repeat(65) };
|
|
43
|
+
assert.throws(() => CREATE_TOPIC.serialize(t));
|
|
44
|
+
});
|
|
45
|
+
it("throw on name > 255 bytes - utf8 version", () => {
|
|
46
|
+
const t = { ...t1, name: "¥Ø£Ø".repeat(33) };
|
|
47
|
+
assert.throws(() => CREATE_TOPIC.serialize(t));
|
|
48
|
+
});
|
|
49
|
+
it('throw on replication_factor < 1', () => {
|
|
50
|
+
const t = { ...t1, replicationFactor: 0 };
|
|
51
|
+
assert.throws(() => CREATE_TOPIC.serialize(t));
|
|
52
|
+
});
|
|
53
|
+
it('throw on replication_factor > 255', () => {
|
|
54
|
+
const t = { ...t1, replicationFactor: 257 };
|
|
55
|
+
assert.throws(() => CREATE_TOPIC.serialize(t));
|
|
56
|
+
});
|
|
57
|
+
it('accept compressionAlgorithm = 2 (gzip)', () => {
|
|
58
|
+
const t = { ...t1, compressionAlgorithm: 2 };
|
|
59
|
+
assert.doesNotThrow(() => CREATE_TOPIC.serialize(t));
|
|
60
|
+
});
|
|
61
|
+
it('throw on invalid compressionAlgorithm', () => {
|
|
62
|
+
const t = { ...t1, compressionAlgorithm: 42 };
|
|
63
|
+
assert.throws(() => CREATE_TOPIC.serialize(t));
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=create-topic.command.test.js.map
|
|
@@ -0,0 +1,32 @@
|
|
|
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 Id } from '../identifier.utils.js';
|
|
20
|
+
type DeleteTopic = {
|
|
21
|
+
streamId: Id;
|
|
22
|
+
topicId: Id;
|
|
23
|
+
partitionsCount: number;
|
|
24
|
+
};
|
|
25
|
+
export declare const DELETE_TOPIC: {
|
|
26
|
+
code: number;
|
|
27
|
+
serialize: ({ streamId, topicId, partitionsCount }: DeleteTopic) => Buffer<ArrayBuffer>;
|
|
28
|
+
deserialize: (r: import("../../index.js").CommandResponse) => boolean;
|
|
29
|
+
};
|
|
30
|
+
export declare const deleteTopic: (getClient: import("../../index.js").ClientProvider) => (arg: DeleteTopic) => Promise<boolean>;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=delete-topic.command.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { deserializeVoidResponse } from '../../client/client.utils.js';
|
|
20
|
+
import { wrapCommand } from '../command.utils.js';
|
|
21
|
+
import { COMMAND_CODE } from '../command.code.js';
|
|
22
|
+
import { serializeIdentifier } from '../identifier.utils.js';
|
|
23
|
+
import { uint32ToBuf } from '../number.utils.js';
|
|
24
|
+
export const DELETE_TOPIC = {
|
|
25
|
+
code: COMMAND_CODE.DeleteTopic,
|
|
26
|
+
serialize: ({ streamId, topicId, partitionsCount }) => {
|
|
27
|
+
return Buffer.concat([
|
|
28
|
+
serializeIdentifier(streamId),
|
|
29
|
+
serializeIdentifier(topicId),
|
|
30
|
+
uint32ToBuf(partitionsCount)
|
|
31
|
+
]);
|
|
32
|
+
},
|
|
33
|
+
deserialize: deserializeVoidResponse
|
|
34
|
+
};
|
|
35
|
+
export const deleteTopic = wrapCommand(DELETE_TOPIC);
|
|
36
|
+
//# sourceMappingURL=delete-topic.command.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { CommandResponse } from '../../client/client.type.js';
|
|
20
|
+
import { type Id } from '../identifier.utils.js';
|
|
21
|
+
import { type Topic } from './topic.utils.js';
|
|
22
|
+
type GetTopic = {
|
|
23
|
+
streamId: Id;
|
|
24
|
+
topicId: Id;
|
|
25
|
+
};
|
|
26
|
+
export declare const GET_TOPIC: {
|
|
27
|
+
code: number;
|
|
28
|
+
serialize: ({ streamId, topicId }: GetTopic) => Buffer<ArrayBuffer>;
|
|
29
|
+
deserialize: (r: CommandResponse) => Topic;
|
|
30
|
+
};
|
|
31
|
+
export declare const getTopic: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: GetTopic) => Promise<Topic>;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=get-topic.command.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { wrapCommand } from '../command.utils.js';
|
|
20
|
+
import { COMMAND_CODE } from '../command.code.js';
|
|
21
|
+
import { serializeIdentifier } from '../identifier.utils.js';
|
|
22
|
+
import { deserializeTopic } from './topic.utils.js';
|
|
23
|
+
export const GET_TOPIC = {
|
|
24
|
+
code: COMMAND_CODE.GetTopic,
|
|
25
|
+
serialize: ({ streamId, topicId }) => {
|
|
26
|
+
return Buffer.concat([
|
|
27
|
+
serializeIdentifier(streamId),
|
|
28
|
+
serializeIdentifier(topicId)
|
|
29
|
+
]);
|
|
30
|
+
},
|
|
31
|
+
deserialize: (r) => {
|
|
32
|
+
return deserializeTopic(r.data).data;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
export const getTopic = wrapCommand(GET_TOPIC);
|
|
36
|
+
//# sourceMappingURL=get-topic.command.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
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 { CommandResponse } from '../../client/client.type.js';
|
|
20
|
+
import { type Id } from '../identifier.utils.js';
|
|
21
|
+
import { type Topic } from './topic.utils.js';
|
|
22
|
+
export type GetTopics = {
|
|
23
|
+
streamId: Id;
|
|
24
|
+
};
|
|
25
|
+
export declare const GET_TOPICS: {
|
|
26
|
+
code: number;
|
|
27
|
+
serialize: ({ streamId }: GetTopics) => Buffer<ArrayBufferLike>;
|
|
28
|
+
deserialize: (r: CommandResponse) => Topic[];
|
|
29
|
+
};
|
|
30
|
+
export declare const getTopics: (getClient: import("../../client/client.type.js").ClientProvider) => (arg: GetTopics) => Promise<Topic[]>;
|
|
31
|
+
//# sourceMappingURL=get-topics.command.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { wrapCommand } from '../command.utils.js';
|
|
20
|
+
import { COMMAND_CODE } from '../command.code.js';
|
|
21
|
+
import { serializeIdentifier } from '../identifier.utils.js';
|
|
22
|
+
import { deserializeTopics } from './topic.utils.js';
|
|
23
|
+
export const GET_TOPICS = {
|
|
24
|
+
code: COMMAND_CODE.GetTopics,
|
|
25
|
+
serialize: ({ streamId }) => {
|
|
26
|
+
return serializeIdentifier(streamId);
|
|
27
|
+
},
|
|
28
|
+
deserialize: (r) => {
|
|
29
|
+
return deserializeTopics(r.data);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export const getTopics = wrapCommand(GET_TOPICS);
|
|
33
|
+
//# sourceMappingURL=get-topics.command.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
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 './create-topic.command.js';
|
|
20
|
+
export * from './delete-topic.command.js';
|
|
21
|
+
export * from './get-topic.command.js';
|
|
22
|
+
export * from './get-topics.command.js';
|
|
23
|
+
export * from './purge-topic.command.js';
|
|
24
|
+
export * from './update-topic.command.js';
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
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 './create-topic.command.js';
|
|
20
|
+
export * from './delete-topic.command.js';
|
|
21
|
+
export * from './get-topic.command.js';
|
|
22
|
+
export * from './get-topics.command.js';
|
|
23
|
+
export * from './purge-topic.command.js';
|
|
24
|
+
export * from './update-topic.command.js';
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
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 Id } from '../identifier.utils.js';
|
|
20
|
+
export type PurgeTopic = {
|
|
21
|
+
streamId: Id;
|
|
22
|
+
topicId: Id;
|
|
23
|
+
};
|
|
24
|
+
export declare const PURGE_TOPIC: {
|
|
25
|
+
code: number;
|
|
26
|
+
serialize: ({ streamId, topicId }: PurgeTopic) => Buffer<ArrayBuffer>;
|
|
27
|
+
deserialize: (r: import("../../index.js").CommandResponse) => boolean;
|
|
28
|
+
};
|
|
29
|
+
export declare const purgeTopic: (getClient: import("../../index.js").ClientProvider) => (arg: PurgeTopic) => Promise<boolean>;
|
|
30
|
+
//# sourceMappingURL=purge-topic.command.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { serializeIdentifier } from '../identifier.utils.js';
|
|
20
|
+
import { COMMAND_CODE } from '../command.code.js';
|
|
21
|
+
import { deserializeVoidResponse } from '../../client/client.utils.js';
|
|
22
|
+
import { wrapCommand } from '../command.utils.js';
|
|
23
|
+
export const PURGE_TOPIC = {
|
|
24
|
+
code: COMMAND_CODE.PurgeTopic,
|
|
25
|
+
serialize: ({ streamId, topicId }) => {
|
|
26
|
+
return Buffer.concat([
|
|
27
|
+
serializeIdentifier(streamId),
|
|
28
|
+
serializeIdentifier(topicId),
|
|
29
|
+
]);
|
|
30
|
+
},
|
|
31
|
+
deserialize: deserializeVoidResponse
|
|
32
|
+
};
|
|
33
|
+
export const purgeTopic = wrapCommand(PURGE_TOPIC);
|
|
34
|
+
//# sourceMappingURL=purge-topic.command.js.map
|
|
@@ -0,0 +1,71 @@
|
|
|
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 { ValueOf } from '../../type.utils.js';
|
|
20
|
+
export type BaseTopic = {
|
|
21
|
+
id: number;
|
|
22
|
+
name: string;
|
|
23
|
+
createdAt: Date;
|
|
24
|
+
partitionsCount: number;
|
|
25
|
+
compressionAlgorithm: number;
|
|
26
|
+
messageExpiry: bigint;
|
|
27
|
+
maxTopicSize: bigint;
|
|
28
|
+
replicationFactor: number;
|
|
29
|
+
sizeBytes: bigint;
|
|
30
|
+
messagesCount: bigint;
|
|
31
|
+
};
|
|
32
|
+
export type Partition = {
|
|
33
|
+
id: number;
|
|
34
|
+
createdAt: Date;
|
|
35
|
+
segmentsCount: number;
|
|
36
|
+
currentOffset: bigint;
|
|
37
|
+
sizeBytes: bigint;
|
|
38
|
+
messagesCount: bigint;
|
|
39
|
+
};
|
|
40
|
+
export type Topic = BaseTopic & {
|
|
41
|
+
partitions: Partition[];
|
|
42
|
+
};
|
|
43
|
+
type Serialized = {
|
|
44
|
+
bytesRead: number;
|
|
45
|
+
};
|
|
46
|
+
type PartitionSerialized = {
|
|
47
|
+
data: Partition;
|
|
48
|
+
} & Serialized;
|
|
49
|
+
type BaseTopicSerialized = {
|
|
50
|
+
data: BaseTopic;
|
|
51
|
+
} & Serialized;
|
|
52
|
+
type TopicSerialized = {
|
|
53
|
+
data: Topic;
|
|
54
|
+
} & Serialized;
|
|
55
|
+
export declare const CompressionAlgorithmKind: {
|
|
56
|
+
None: number;
|
|
57
|
+
Gzip: number;
|
|
58
|
+
};
|
|
59
|
+
export type CompressionAlgorithmKind = typeof CompressionAlgorithmKind;
|
|
60
|
+
export type CompressionAlgorithmKindId = keyof CompressionAlgorithmKind;
|
|
61
|
+
export type CompressionAlgorithmKindValue = ValueOf<CompressionAlgorithmKind>;
|
|
62
|
+
export type CompressionAlgorithmNone = CompressionAlgorithmKind['None'];
|
|
63
|
+
export type CompressionAlgorithmGzip = CompressionAlgorithmKind['Gzip'];
|
|
64
|
+
export type CompressionAlgorithm = CompressionAlgorithmNone | CompressionAlgorithmGzip;
|
|
65
|
+
export declare const isValidCompressionAlgorithm: (ca: number) => ca is CompressionAlgorithm;
|
|
66
|
+
export declare const deserializeBaseTopic: (p: Buffer, pos?: number) => BaseTopicSerialized;
|
|
67
|
+
export declare const deserializePartition: (p: Buffer, pos?: number) => PartitionSerialized;
|
|
68
|
+
export declare const deserializeTopic: (p: Buffer, pos?: number) => TopicSerialized;
|
|
69
|
+
export declare const deserializeTopics: (p: Buffer, pos?: number) => Topic[];
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=topic.utils.d.ts.map
|