apache-iggy 0.8.0 → 0.8.1-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.
- package/LICENSE +1 -1
- package/NOTICE +12 -0
- package/README.md +14 -0
- package/dist/client/client.connection.d.ts +0 -18
- package/dist/client/client.connection.js +17 -18
- package/dist/client/client.d.ts +0 -18
- package/dist/client/client.debug.d.ts +0 -18
- package/dist/client/client.debug.js +17 -18
- package/dist/client/client.js +17 -18
- package/dist/client/client.socket.d.ts +1 -19
- package/dist/client/client.socket.js +17 -18
- package/dist/client/client.type.d.ts +0 -18
- package/dist/client/client.type.js +17 -18
- package/dist/client/client.utils.d.ts +1 -18
- package/dist/client/client.utils.js +19 -19
- package/dist/client/client.utils.test.d.ts +2 -0
- package/dist/client/client.utils.test.js +58 -0
- package/dist/client/index.d.ts +0 -18
- package/dist/client/index.js +17 -18
- package/dist/client.e2e.d.ts +0 -18
- package/dist/client.e2e.js +17 -18
- package/dist/debug-send.d.ts +0 -18
- package/dist/debug-send.js +17 -18
- package/dist/debug.d.ts +0 -18
- package/dist/debug.js +17 -18
- package/dist/e2e/tcp.client.e2e.d.ts +0 -18
- package/dist/e2e/tcp.client.e2e.js +17 -18
- package/dist/e2e/tcp.cluster.e2e.d.ts +0 -18
- package/dist/e2e/tcp.cluster.e2e.js +17 -18
- package/dist/e2e/tcp.consumer-group.e2e.d.ts +0 -18
- package/dist/e2e/tcp.consumer-group.e2e.js +17 -18
- package/dist/e2e/tcp.consumer-stream.e2e.d.ts +0 -18
- package/dist/e2e/tcp.consumer-stream.e2e.js +17 -18
- package/dist/e2e/tcp.parallel.e2e.d.ts +0 -18
- package/dist/e2e/tcp.parallel.e2e.js +17 -18
- package/dist/e2e/tcp.raw.e2e.d.ts +2 -0
- package/dist/e2e/tcp.raw.e2e.js +42 -0
- package/dist/e2e/tcp.send-message.e2e.d.ts +0 -18
- package/dist/e2e/tcp.send-message.e2e.js +17 -18
- package/dist/e2e/tcp.stream.e2e.d.ts +0 -18
- package/dist/e2e/tcp.stream.e2e.js +17 -18
- package/dist/e2e/tcp.system.e2e.d.ts +0 -18
- package/dist/e2e/tcp.system.e2e.js +17 -18
- package/dist/e2e/tcp.token.e2e.d.ts +0 -18
- package/dist/e2e/tcp.token.e2e.js +17 -18
- package/dist/e2e/tcp.topic.e2e.d.ts +0 -18
- package/dist/e2e/tcp.topic.e2e.js +17 -18
- package/dist/e2e/tcp.user.e2e.d.ts +0 -18
- package/dist/e2e/tcp.user.e2e.js +51 -21
- package/dist/e2e/test-client.utils.d.ts +0 -18
- package/dist/e2e/test-client.utils.js +17 -18
- package/dist/e2e/tls.system.e2e.d.ts +0 -18
- package/dist/e2e/tls.system.e2e.js +17 -18
- package/dist/index.d.ts +0 -18
- package/dist/index.js +17 -18
- package/dist/stream/consumer-stream.d.ts +0 -18
- package/dist/stream/consumer-stream.js +17 -18
- package/dist/stream/index.d.ts +0 -18
- package/dist/stream/index.js +17 -18
- package/dist/tcp.e2e.d.ts +0 -18
- package/dist/tcp.e2e.js +17 -18
- package/dist/tcp.sm.utils.d.ts +0 -18
- package/dist/tcp.sm.utils.js +17 -18
- package/dist/tls.system.e2e.d.ts +0 -18
- package/dist/tls.system.e2e.js +17 -18
- package/dist/type.utils.d.ts +0 -18
- package/dist/type.utils.js +17 -18
- package/dist/wire/client/client.utils.d.ts +0 -18
- package/dist/wire/client/client.utils.js +17 -18
- package/dist/wire/client/get-client.command.d.ts +0 -18
- package/dist/wire/client/get-client.command.js +17 -18
- package/dist/wire/client/get-clients.command.d.ts +0 -18
- package/dist/wire/client/get-clients.command.js +17 -18
- package/dist/wire/client/get-me.command.d.ts +0 -18
- package/dist/wire/client/get-me.command.js +17 -18
- package/dist/wire/client/index.d.ts +0 -18
- package/dist/wire/client/index.js +17 -18
- package/dist/wire/cluster/cluster.type.d.ts +2 -20
- package/dist/wire/cluster/cluster.type.js +17 -18
- package/dist/wire/cluster/cluster.utils.d.ts +0 -18
- package/dist/wire/cluster/cluster.utils.js +17 -18
- package/dist/wire/cluster/get-cluster-metadata.command.d.ts +0 -18
- package/dist/wire/cluster/get-cluster-metadata.command.js +17 -18
- package/dist/wire/cluster/index.d.ts +0 -18
- package/dist/wire/cluster/index.js +17 -18
- package/dist/wire/command-set.d.ts +9 -18
- package/dist/wire/command-set.js +42 -19
- package/dist/wire/command-set.test.d.ts +2 -0
- package/dist/wire/command-set.test.js +93 -0
- package/dist/wire/command.code.d.ts +2 -18
- package/dist/wire/command.code.js +19 -18
- package/dist/wire/command.utils.d.ts +0 -18
- package/dist/wire/command.utils.js +17 -18
- package/dist/wire/consumer-group/create-group.command.d.ts +0 -18
- package/dist/wire/consumer-group/create-group.command.js +17 -18
- package/dist/wire/consumer-group/create-group.command.test.d.ts +0 -18
- package/dist/wire/consumer-group/create-group.command.test.js +17 -18
- package/dist/wire/consumer-group/delete-group.command.d.ts +0 -18
- package/dist/wire/consumer-group/delete-group.command.js +17 -18
- package/dist/wire/consumer-group/ensure-group.virtual.command.d.ts +0 -18
- package/dist/wire/consumer-group/ensure-group.virtual.command.js +17 -18
- package/dist/wire/consumer-group/get-group.command.d.ts +0 -18
- package/dist/wire/consumer-group/get-group.command.js +17 -18
- package/dist/wire/consumer-group/get-groups.command.d.ts +0 -18
- package/dist/wire/consumer-group/get-groups.command.js +17 -18
- package/dist/wire/consumer-group/group.command.test.d.ts +0 -18
- package/dist/wire/consumer-group/group.command.test.js +17 -18
- package/dist/wire/consumer-group/group.utils.d.ts +0 -18
- package/dist/wire/consumer-group/group.utils.js +17 -18
- package/dist/wire/consumer-group/index.d.ts +0 -18
- package/dist/wire/consumer-group/index.js +17 -18
- package/dist/wire/consumer-group/join-group.command.d.ts +0 -18
- package/dist/wire/consumer-group/join-group.command.js +17 -18
- package/dist/wire/consumer-group/leave-group.command.d.ts +0 -18
- package/dist/wire/consumer-group/leave-group.command.js +17 -18
- package/dist/wire/error.code.d.ts +0 -18
- package/dist/wire/error.code.js +17 -18
- package/dist/wire/error.utils.d.ts +0 -18
- package/dist/wire/error.utils.js +17 -18
- package/dist/wire/identifier.utils.d.ts +0 -18
- package/dist/wire/identifier.utils.js +17 -18
- package/dist/wire/identifier.utils.test.d.ts +0 -18
- package/dist/wire/identifier.utils.test.js +17 -18
- package/dist/wire/index.d.ts +0 -18
- package/dist/wire/index.js +17 -18
- package/dist/wire/message/flush-unsaved-buffers.command.d.ts +0 -18
- package/dist/wire/message/flush-unsaved-buffers.command.js +17 -18
- package/dist/wire/message/header.type.d.ts +1 -19
- package/dist/wire/message/header.type.js +17 -18
- package/dist/wire/message/header.utils.d.ts +0 -18
- package/dist/wire/message/header.utils.js +17 -18
- package/dist/wire/message/header.utils.test.d.ts +0 -18
- package/dist/wire/message/header.utils.test.js +17 -18
- package/dist/wire/message/iggy-header.utils.d.ts +0 -18
- package/dist/wire/message/iggy-header.utils.js +17 -18
- package/dist/wire/message/index.d.ts +0 -18
- package/dist/wire/message/index.js +17 -18
- package/dist/wire/message/message.utils.d.ts +0 -18
- package/dist/wire/message/message.utils.js +17 -18
- package/dist/wire/message/partitioning.utils.d.ts +0 -18
- package/dist/wire/message/partitioning.utils.js +17 -18
- package/dist/wire/message/poll-messages.command.d.ts +0 -18
- package/dist/wire/message/poll-messages.command.js +17 -18
- package/dist/wire/message/poll.utils.d.ts +0 -18
- package/dist/wire/message/poll.utils.js +17 -18
- package/dist/wire/message/send-messages.command.d.ts +0 -18
- package/dist/wire/message/send-messages.command.js +19 -20
- package/dist/wire/message/send-messages.command.test.d.ts +0 -18
- package/dist/wire/message/send-messages.command.test.js +35 -18
- package/dist/wire/number.utils.d.ts +0 -18
- package/dist/wire/number.utils.js +17 -18
- package/dist/wire/offset/delete-offset.command.d.ts +0 -18
- package/dist/wire/offset/delete-offset.command.js +17 -18
- package/dist/wire/offset/get-offset.command.d.ts +0 -18
- package/dist/wire/offset/get-offset.command.js +17 -18
- package/dist/wire/offset/index.d.ts +0 -18
- package/dist/wire/offset/index.js +17 -18
- package/dist/wire/offset/offset.utils.d.ts +0 -18
- package/dist/wire/offset/offset.utils.js +17 -18
- package/dist/wire/offset/store-offset.command.d.ts +0 -18
- package/dist/wire/offset/store-offset.command.js +17 -18
- package/dist/wire/partition/create-partition.command.d.ts +0 -18
- package/dist/wire/partition/create-partition.command.js +17 -18
- package/dist/wire/partition/delete-partition.command.d.ts +0 -18
- package/dist/wire/partition/delete-partition.command.js +17 -18
- package/dist/wire/partition/index.d.ts +0 -18
- package/dist/wire/partition/index.js +17 -18
- package/dist/wire/partition/partition.utils.d.ts +0 -18
- package/dist/wire/partition/partition.utils.js +17 -18
- package/dist/wire/partition/partition.utils.test.d.ts +0 -18
- package/dist/wire/partition/partition.utils.test.js +17 -18
- package/dist/wire/segment/delete-segments.command.d.ts +0 -18
- package/dist/wire/segment/delete-segments.command.js +17 -18
- package/dist/wire/segment/index.d.ts +0 -18
- package/dist/wire/segment/index.js +17 -18
- package/dist/wire/segment/segment.utils.d.ts +0 -18
- package/dist/wire/segment/segment.utils.js +17 -18
- package/dist/wire/serialize.utils.d.ts +0 -18
- package/dist/wire/serialize.utils.js +17 -18
- package/dist/wire/session/index.d.ts +0 -18
- package/dist/wire/session/index.js +17 -18
- package/dist/wire/session/login-with-token.command.d.ts +0 -18
- package/dist/wire/session/login-with-token.command.js +17 -18
- package/dist/wire/session/login-with-token.command.test.d.ts +0 -18
- package/dist/wire/session/login-with-token.command.test.js +17 -18
- package/dist/wire/session/login.command.d.ts +0 -18
- package/dist/wire/session/login.command.js +17 -18
- package/dist/wire/session/login.command.test.d.ts +0 -18
- package/dist/wire/session/login.command.test.js +17 -18
- package/dist/wire/session/login.utils.d.ts +0 -18
- package/dist/wire/session/login.utils.js +17 -18
- package/dist/wire/session/logout.command.d.ts +0 -18
- package/dist/wire/session/logout.command.js +17 -18
- package/dist/wire/stream/create-stream.command.d.ts +0 -18
- package/dist/wire/stream/create-stream.command.js +17 -18
- package/dist/wire/stream/create-stream.command.test.d.ts +0 -18
- package/dist/wire/stream/create-stream.command.test.js +17 -18
- package/dist/wire/stream/delete-stream.command.d.ts +0 -18
- package/dist/wire/stream/delete-stream.command.js +17 -18
- package/dist/wire/stream/ensure-stream.virtual.command.d.ts +0 -18
- package/dist/wire/stream/ensure-stream.virtual.command.js +17 -18
- package/dist/wire/stream/get-stream.command.d.ts +0 -18
- package/dist/wire/stream/get-stream.command.js +17 -18
- package/dist/wire/stream/get-streams.command.d.ts +0 -18
- package/dist/wire/stream/get-streams.command.js +17 -18
- package/dist/wire/stream/index.d.ts +0 -18
- package/dist/wire/stream/index.js +17 -18
- package/dist/wire/stream/purge-stream.command.d.ts +0 -18
- package/dist/wire/stream/purge-stream.command.js +17 -18
- package/dist/wire/stream/stream.utils.d.ts +0 -18
- package/dist/wire/stream/stream.utils.js +17 -18
- package/dist/wire/stream/update-stream.command.d.ts +0 -18
- package/dist/wire/stream/update-stream.command.js +17 -18
- package/dist/wire/system/get-stats.command.d.ts +0 -18
- package/dist/wire/system/get-stats.command.js +17 -18
- package/dist/wire/system/index.d.ts +0 -18
- package/dist/wire/system/index.js +17 -18
- package/dist/wire/system/ping.command.d.ts +0 -18
- package/dist/wire/system/ping.command.js +17 -18
- package/dist/wire/token/create-token.command.d.ts +0 -18
- package/dist/wire/token/create-token.command.js +17 -18
- package/dist/wire/token/create-token.command.test.d.ts +0 -18
- package/dist/wire/token/create-token.command.test.js +17 -18
- package/dist/wire/token/delete-token.command.d.ts +0 -18
- package/dist/wire/token/delete-token.command.js +17 -18
- package/dist/wire/token/delete-token.command.test.d.ts +0 -18
- package/dist/wire/token/delete-token.command.test.js +17 -18
- package/dist/wire/token/get-tokens.command.d.ts +0 -18
- package/dist/wire/token/get-tokens.command.js +17 -18
- package/dist/wire/token/index.d.ts +0 -18
- package/dist/wire/token/index.js +17 -18
- package/dist/wire/token/token.utils.d.ts +0 -18
- package/dist/wire/token/token.utils.js +17 -18
- package/dist/wire/topic/create-topic.command.d.ts +0 -18
- package/dist/wire/topic/create-topic.command.js +17 -18
- package/dist/wire/topic/create-topic.command.test.d.ts +0 -18
- package/dist/wire/topic/create-topic.command.test.js +17 -18
- package/dist/wire/topic/delete-topic.command.d.ts +0 -18
- package/dist/wire/topic/delete-topic.command.js +17 -18
- package/dist/wire/topic/ensure-topic.virtual.command.d.ts +0 -18
- package/dist/wire/topic/ensure-topic.virtual.command.js +17 -18
- package/dist/wire/topic/get-topic.command.d.ts +0 -18
- package/dist/wire/topic/get-topic.command.js +17 -18
- package/dist/wire/topic/get-topics.command.d.ts +0 -18
- package/dist/wire/topic/get-topics.command.js +17 -18
- package/dist/wire/topic/index.d.ts +0 -18
- package/dist/wire/topic/index.js +17 -18
- package/dist/wire/topic/purge-topic.command.d.ts +0 -18
- package/dist/wire/topic/purge-topic.command.js +17 -18
- package/dist/wire/topic/topic.utils.d.ts +0 -18
- package/dist/wire/topic/topic.utils.js +17 -18
- package/dist/wire/topic/update-topic.command.d.ts +0 -18
- package/dist/wire/topic/update-topic.command.js +17 -18
- package/dist/wire/user/change-password.command.d.ts +0 -18
- package/dist/wire/user/change-password.command.js +17 -18
- package/dist/wire/user/create-user.command.d.ts +0 -18
- package/dist/wire/user/create-user.command.js +25 -21
- package/dist/wire/user/create-user.command.test.d.ts +0 -18
- package/dist/wire/user/create-user.command.test.js +45 -22
- package/dist/wire/user/delete-user.command.d.ts +0 -18
- package/dist/wire/user/delete-user.command.js +17 -18
- package/dist/wire/user/get-user.command.d.ts +0 -18
- package/dist/wire/user/get-user.command.js +17 -18
- package/dist/wire/user/get-users.command.d.ts +0 -18
- package/dist/wire/user/get-users.command.js +17 -18
- package/dist/wire/user/index.d.ts +0 -18
- package/dist/wire/user/index.js +17 -18
- package/dist/wire/user/permissions.utils.d.ts +2 -21
- package/dist/wire/user/permissions.utils.js +48 -48
- package/dist/wire/user/permissions.utils.test.d.ts +0 -18
- package/dist/wire/user/permissions.utils.test.js +106 -36
- package/dist/wire/user/update-permissions.command.d.ts +0 -18
- package/dist/wire/user/update-permissions.command.js +17 -18
- package/dist/wire/user/update-user.command.d.ts +0 -18
- package/dist/wire/user/update-user.command.js +17 -18
- package/dist/wire/user/user.utils.d.ts +0 -18
- package/dist/wire/user/user.utils.js +17 -18
- package/dist/wire/uuid.utils.d.ts +0 -18
- package/dist/wire/uuid.utils.js +17 -18
- package/package.json +12 -10
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
1
|
+
// Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
//
|
|
19
18
|
import { uint8ToBuf, uint32ToBuf } from '../number.utils.js';
|
|
20
19
|
/**
|
|
21
20
|
* Converts a number to a boolean (1 = true).
|
|
@@ -133,15 +132,15 @@ export const deserializeStreamPermissions = (p, pos = 0) => {
|
|
|
133
132
|
pos += 10;
|
|
134
133
|
const topics = [];
|
|
135
134
|
const hasTopics = toBool(p.readUInt8(pos));
|
|
135
|
+
pos += 1;
|
|
136
136
|
if (hasTopics) {
|
|
137
|
-
let
|
|
138
|
-
|
|
139
|
-
while (read) {
|
|
137
|
+
let hasNextTopic = true;
|
|
138
|
+
while (hasNextTopic) {
|
|
140
139
|
const { bytesRead, topicId, permissions } = deserializeTopicPermissions(p, pos);
|
|
141
140
|
pos += bytesRead;
|
|
142
141
|
topics.push({ topicId, permissions });
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
hasNextTopic = toBool(p.readUInt8(pos));
|
|
143
|
+
pos += 1;
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
146
|
return {
|
|
@@ -168,14 +167,16 @@ export const serializeStreamPermissions = (p) => {
|
|
|
168
167
|
uint8ToBuf(boolToByte(p.permissions.pollMessages)),
|
|
169
168
|
uint8ToBuf(boolToByte(p.permissions.sendMessages)),
|
|
170
169
|
]);
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
const bHead = Buffer.concat([bStream,
|
|
174
|
-
if (!
|
|
170
|
+
const hasTopics = p.topics.length > 0;
|
|
171
|
+
const bHasTopics = uint8ToBuf(boolToByte(hasTopics));
|
|
172
|
+
const bHead = Buffer.concat([bStream, bHasTopics]);
|
|
173
|
+
if (!hasTopics)
|
|
175
174
|
return bHead;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
175
|
+
const bTopics = p.topics.map((topic, index) => Buffer.concat([
|
|
176
|
+
serializeTopicPermissions(topic),
|
|
177
|
+
uint8ToBuf(boolToByte(index < p.topics.length - 1))
|
|
178
|
+
]));
|
|
179
|
+
return Buffer.concat([bHead, ...bTopics]);
|
|
179
180
|
};
|
|
180
181
|
/**
|
|
181
182
|
* Deserializes complete user permissions from a buffer.
|
|
@@ -189,16 +190,16 @@ export const deserializePermissions = (p, pos = 0) => {
|
|
|
189
190
|
const { bytesRead, data } = deserializeGlobalPermissions(p, pos);
|
|
190
191
|
pos += bytesRead;
|
|
191
192
|
const streams = [];
|
|
192
|
-
const
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
while (
|
|
193
|
+
const hasStreams = toBool(p.readUInt8(pos));
|
|
194
|
+
pos += 1;
|
|
195
|
+
if (hasStreams) {
|
|
196
|
+
let hasNextStream = true;
|
|
197
|
+
while (hasNextStream) {
|
|
197
198
|
const { bytesRead, streamId, permissions, topics } = deserializeStreamPermissions(p, pos);
|
|
198
199
|
streams.push({ streamId, permissions, topics });
|
|
199
200
|
pos += bytesRead;
|
|
200
|
-
|
|
201
|
-
|
|
201
|
+
hasNextStream = toBool(p.readUInt8(pos));
|
|
202
|
+
pos += 1;
|
|
202
203
|
}
|
|
203
204
|
}
|
|
204
205
|
return {
|
|
@@ -208,22 +209,21 @@ export const deserializePermissions = (p, pos = 0) => {
|
|
|
208
209
|
};
|
|
209
210
|
/**
|
|
210
211
|
* Serializes user permissions to a buffer.
|
|
211
|
-
* Returns a single zero byte if no permissions provided.
|
|
212
212
|
*
|
|
213
|
-
* @param p -
|
|
213
|
+
* @param p - User permissions to serialize
|
|
214
214
|
* @returns Serialized permissions buffer
|
|
215
215
|
*/
|
|
216
216
|
export const serializePermissions = (p) => {
|
|
217
|
-
if (!p)
|
|
218
|
-
return uint8ToBuf(0);
|
|
219
217
|
const bGlobal = serializeGlobalPermission(p.global);
|
|
220
|
-
const
|
|
221
|
-
const
|
|
222
|
-
const bHead = Buffer.concat([bGlobal,
|
|
223
|
-
if (!
|
|
218
|
+
const hasStreams = p.streams.length > 0;
|
|
219
|
+
const bHasStreams = uint8ToBuf(boolToByte(hasStreams));
|
|
220
|
+
const bHead = Buffer.concat([bGlobal, bHasStreams]);
|
|
221
|
+
if (!hasStreams)
|
|
224
222
|
return bHead;
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
223
|
+
const bStreams = p.streams.map((stream, index) => Buffer.concat([
|
|
224
|
+
serializeStreamPermissions(stream),
|
|
225
|
+
uint8ToBuf(boolToByte(index < p.streams.length - 1))
|
|
226
|
+
]));
|
|
227
|
+
return Buffer.concat([bHead, ...bStreams]);
|
|
228
228
|
};
|
|
229
229
|
//# sourceMappingURL=permissions.utils.js.map
|
|
@@ -1,20 +1,2 @@
|
|
|
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
1
|
export {};
|
|
20
2
|
//# sourceMappingURL=permissions.utils.test.d.ts.map
|
|
@@ -1,44 +1,114 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
1
|
+
// Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
//
|
|
19
18
|
import { describe, it } from 'node:test';
|
|
20
19
|
import assert from 'node:assert/strict';
|
|
21
|
-
import {
|
|
20
|
+
import { deserializePermissions, serializePermissions } from './permissions.utils.js';
|
|
22
21
|
describe('Permissions', () => {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
const globalPermissions = {
|
|
23
|
+
ManageServers: true,
|
|
24
|
+
ReadServers: true,
|
|
25
|
+
ManageUsers: true,
|
|
26
|
+
ReadUsers: true,
|
|
27
|
+
ManageStreams: true,
|
|
28
|
+
ReadStreams: true,
|
|
29
|
+
ManageTopics: true,
|
|
30
|
+
ReadTopics: true,
|
|
31
|
+
PollMessages: true,
|
|
32
|
+
SendMessages: true
|
|
33
|
+
};
|
|
34
|
+
const globalOnlyPermissions = {
|
|
35
|
+
global: globalPermissions,
|
|
36
36
|
streams: []
|
|
37
37
|
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
const scopedPermissions = {
|
|
39
|
+
global: globalPermissions,
|
|
40
|
+
streams: [
|
|
41
|
+
{
|
|
42
|
+
streamId: 1,
|
|
43
|
+
permissions: {
|
|
44
|
+
manageStream: true,
|
|
45
|
+
readStream: false,
|
|
46
|
+
manageTopics: true,
|
|
47
|
+
readTopics: false,
|
|
48
|
+
pollMessages: true,
|
|
49
|
+
sendMessages: false
|
|
50
|
+
},
|
|
51
|
+
topics: [
|
|
52
|
+
{
|
|
53
|
+
topicId: 10,
|
|
54
|
+
permissions: {
|
|
55
|
+
manage: true,
|
|
56
|
+
read: false,
|
|
57
|
+
pollMessages: true,
|
|
58
|
+
sendMessages: false
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
topicId: 20,
|
|
63
|
+
permissions: {
|
|
64
|
+
manage: false,
|
|
65
|
+
read: true,
|
|
66
|
+
pollMessages: false,
|
|
67
|
+
sendMessages: true
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
streamId: 2,
|
|
74
|
+
permissions: {
|
|
75
|
+
manageStream: false,
|
|
76
|
+
readStream: true,
|
|
77
|
+
manageTopics: false,
|
|
78
|
+
readTopics: true,
|
|
79
|
+
pollMessages: false,
|
|
80
|
+
sendMessages: true
|
|
81
|
+
},
|
|
82
|
+
topics: []
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
};
|
|
86
|
+
const serializedScopedPermissions = Buffer.from([
|
|
87
|
+
// Global permissions and has_streams.
|
|
88
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
89
|
+
// Stream 1, its permissions, and has_topics.
|
|
90
|
+
1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1,
|
|
91
|
+
// Topic 10 and has_next_topic.
|
|
92
|
+
10, 0, 0, 0, 1, 0, 1, 0, 1,
|
|
93
|
+
// Topic 20 and has_next_topic.
|
|
94
|
+
20, 0, 0, 0, 0, 1, 0, 1, 0,
|
|
95
|
+
// has_next_stream.
|
|
96
|
+
1,
|
|
97
|
+
// Stream 2, its permissions, has_topics, and has_next_stream.
|
|
98
|
+
2, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0
|
|
99
|
+
]);
|
|
100
|
+
it('round-trips global permissions', () => {
|
|
101
|
+
const serialized = serializePermissions(globalOnlyPermissions);
|
|
102
|
+
const deserialized = deserializePermissions(serialized);
|
|
103
|
+
assert.deepEqual(deserialized, globalOnlyPermissions);
|
|
104
|
+
});
|
|
105
|
+
it('serializes stream and topic continuation markers', () => {
|
|
106
|
+
const serialized = serializePermissions(scopedPermissions);
|
|
107
|
+
assert.deepEqual(serialized, serializedScopedPermissions);
|
|
108
|
+
});
|
|
109
|
+
it('round-trips multiple streams and topics', () => {
|
|
110
|
+
const deserialized = deserializePermissions(serializedScopedPermissions);
|
|
111
|
+
assert.deepEqual(deserialized, scopedPermissions);
|
|
42
112
|
});
|
|
43
113
|
});
|
|
44
114
|
//# sourceMappingURL=permissions.utils.test.js.map
|
|
@@ -1,21 +1,3 @@
|
|
|
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
1
|
import { type Id } from '../identifier.utils.js';
|
|
20
2
|
import { type UserPermissions } from './permissions.utils.js';
|
|
21
3
|
/**
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
1
|
+
// Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
//
|
|
19
18
|
import { wrapCommand } from '../command.utils.js';
|
|
20
19
|
import { COMMAND_CODE } from '../command.code.js';
|
|
21
20
|
import { deserializeVoidResponse } from '../../client/client.utils.js';
|
|
@@ -1,21 +1,3 @@
|
|
|
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
1
|
import type { UserStatus } from './user.utils.js';
|
|
20
2
|
import { type Id } from '../identifier.utils.js';
|
|
21
3
|
/**
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
1
|
+
// Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
//
|
|
19
18
|
import { wrapCommand } from '../command.utils.js';
|
|
20
19
|
import { COMMAND_CODE } from '../command.code.js';
|
|
21
20
|
import { deserializeVoidResponse } from '../../client/client.utils.js';
|
|
@@ -1,21 +1,3 @@
|
|
|
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
1
|
import { type UserPermissions } from './permissions.utils.js';
|
|
20
2
|
/**
|
|
21
3
|
* Basic user information without permissions.
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
1
|
+
// Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
//
|
|
19
18
|
import { toDate } from '../serialize.utils.js';
|
|
20
19
|
import { deserializePermissions } from './permissions.utils.js';
|
|
21
20
|
/**
|
|
@@ -1,21 +1,3 @@
|
|
|
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
1
|
import { UUID } from "uuidv7";
|
|
20
2
|
/**
|
|
21
3
|
* Parses a UUID string into a UUID object.
|
package/dist/wire/uuid.utils.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
1
|
+
// Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
//
|
|
19
18
|
import { uuidv7, UUID } from "uuidv7";
|
|
20
19
|
/**
|
|
21
20
|
* Parses a UUID string into a UUID object.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "apache-iggy",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.1-edge.2",
|
|
5
5
|
"description": "Official Apache Iggy NodeJS SDK",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"iggy",
|
|
@@ -28,7 +28,9 @@
|
|
|
28
28
|
"dist/**/*.d.ts",
|
|
29
29
|
"dist/index.d.ts",
|
|
30
30
|
"!dist/bdd/",
|
|
31
|
-
"!dist/examples/"
|
|
31
|
+
"!dist/examples/",
|
|
32
|
+
"LICENSE",
|
|
33
|
+
"NOTICE"
|
|
32
34
|
],
|
|
33
35
|
"types": "dist/index.d.ts",
|
|
34
36
|
"main": "dist/index.js",
|
|
@@ -49,18 +51,18 @@
|
|
|
49
51
|
"dependencies": {
|
|
50
52
|
"debug": "4.4.3",
|
|
51
53
|
"generic-pool": "3.9.0",
|
|
52
|
-
"uuidv7": "1.
|
|
54
|
+
"uuidv7": "1.2.1"
|
|
53
55
|
},
|
|
54
56
|
"devDependencies": {
|
|
55
|
-
"@commitlint/cli": "
|
|
56
|
-
"@commitlint/config-conventional": "
|
|
57
|
-
"@cucumber/cucumber": "
|
|
57
|
+
"@commitlint/cli": "21.2.0",
|
|
58
|
+
"@commitlint/config-conventional": "21.2.0",
|
|
59
|
+
"@cucumber/cucumber": "13.0.0",
|
|
58
60
|
"@swc-node/register": "1.11.1",
|
|
59
|
-
"@types/debug": "4.1.
|
|
60
|
-
"@types/node": "
|
|
61
|
-
"c8": "^
|
|
61
|
+
"@types/debug": "4.1.13",
|
|
62
|
+
"@types/node": "26.1.0",
|
|
63
|
+
"c8": "^11.0.0",
|
|
62
64
|
"husky": "9.1.7",
|
|
63
|
-
"typescript": "
|
|
65
|
+
"typescript": "6.0.3",
|
|
64
66
|
"typescript-eslint": "^8.47.0"
|
|
65
67
|
},
|
|
66
68
|
"overrides": {
|