apache-iggy 0.7.1-edge.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+ export {};
20
+ //# sourceMappingURL=tls.system.e2e.d.ts.map
@@ -0,0 +1,117 @@
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
+ // TLS integration tests for the Node.js SDK.
20
+ //
21
+ // These tests require a TLS-enabled Iggy server and are skipped by default.
22
+ // To run them locally:
23
+ //
24
+ // 1. Start the server with TLS:
25
+ // IGGY_ROOT_USERNAME=iggy IGGY_ROOT_PASSWORD=iggy \
26
+ // IGGY_TCP_TLS_ENABLED=true \
27
+ // IGGY_TCP_TLS_CERT_FILE=core/certs/iggy_cert.pem \
28
+ // IGGY_TCP_TLS_KEY_FILE=core/certs/iggy_key.pem \
29
+ // cargo r --bin iggy-server
30
+ //
31
+ // 2. Run the tests:
32
+ // cd foreign/node
33
+ // IGGY_TCP_TLS_ENABLED=true IGGY_TCP_ADDRESS=127.0.0.1:8090 \
34
+ // node --import @swc-node/register/esm-register --test src/e2e/tls.system.e2e.ts
35
+ import { readFileSync } from 'node:fs';
36
+ import { resolve } from 'node:path';
37
+ import { after, describe, it } from 'node:test';
38
+ import assert from 'node:assert/strict';
39
+ import { Client } from '../client/client.js';
40
+ import { Partitioning, Consumer, PollingStrategy } from '../wire/index.js';
41
+ import { getIggyAddress } from '../tcp.sm.utils.js';
42
+ const tlsEnabled = process.env.IGGY_TCP_TLS_ENABLED === 'true';
43
+ // Path to the CA certificate. Override with E2E_ROOT_CA_CERT env var,
44
+ // otherwise fall back to the default relative path from the repo root.
45
+ const caCertPath = process.env.E2E_ROOT_CA_CERT
46
+ || resolve(process.cwd(), '../../core/certs/iggy_ca_cert.pem');
47
+ const getTlsClient = () => {
48
+ const [, port] = getIggyAddress();
49
+ const caCert = readFileSync(caCertPath);
50
+ // The server certificate SAN is DNS:localhost, so we connect via 'localhost'
51
+ // for proper hostname verification (consistent with Python and C# TLS tests).
52
+ return new Client({
53
+ transport: 'TLS',
54
+ options: {
55
+ port,
56
+ host: 'localhost',
57
+ ca: caCert,
58
+ },
59
+ credentials: { username: 'iggy', password: 'iggy' },
60
+ });
61
+ };
62
+ describe('e2e -> tls', { skip: !tlsEnabled && 'IGGY_TCP_TLS_ENABLED is not set' }, async () => {
63
+ const c = getTlsClient();
64
+ const credentials = { username: 'iggy', password: 'iggy' };
65
+ it('e2e -> tls::ping', async () => {
66
+ assert.ok(await c.system.ping());
67
+ });
68
+ it('e2e -> tls::login', async () => {
69
+ assert.deepEqual(await c.session.login(credentials), { userId: 0 });
70
+ });
71
+ it('e2e -> tls::getStats', async () => {
72
+ const stats = await c.system.getStats();
73
+ assert.ok(stats);
74
+ assert.ok('processId' in stats);
75
+ assert.ok('hostname' in stats);
76
+ });
77
+ it('e2e -> tls::send and poll messages', async () => {
78
+ const streamName = 'tls-e2e-stream';
79
+ const topicName = 'tls-e2e-topic';
80
+ await c.stream.create({ name: streamName });
81
+ await c.topic.create({
82
+ streamId: streamName,
83
+ name: topicName,
84
+ partitionCount: 1,
85
+ compressionAlgorithm: 1,
86
+ });
87
+ const messages = [
88
+ { id: 1, headers: [], payload: 'tls-message-1' },
89
+ { id: 2, headers: [], payload: 'tls-message-2' },
90
+ { id: 3, headers: [], payload: 'tls-message-3' },
91
+ ];
92
+ await c.message.send({
93
+ streamId: streamName,
94
+ topicId: topicName,
95
+ messages,
96
+ partition: Partitioning.PartitionId(0),
97
+ });
98
+ const polled = await c.message.poll({
99
+ streamId: streamName,
100
+ topicId: topicName,
101
+ consumer: Consumer.Single,
102
+ partitionId: 0,
103
+ pollingStrategy: PollingStrategy.First,
104
+ count: 10,
105
+ autocommit: false,
106
+ });
107
+ assert.equal(polled.messages.length, 3);
108
+ await c.stream.delete({ streamId: streamName });
109
+ });
110
+ it('e2e -> tls::logout', async () => {
111
+ assert.ok(await c.session.logout());
112
+ });
113
+ after(() => {
114
+ c.destroy();
115
+ });
116
+ });
117
+ //# sourceMappingURL=tls.system.e2e.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "apache-iggy",
3
3
  "type": "module",
4
- "version": "0.7.1-edge.1",
4
+ "version": "0.8.0",
5
5
  "description": "Official Apache Iggy NodeJS SDK",
6
6
  "keywords": [
7
7
  "iggy",
@@ -63,6 +63,9 @@
63
63
  "typescript": "5.9.3",
64
64
  "typescript-eslint": "^8.47.0"
65
65
  },
66
+ "overrides": {
67
+ "flatted": "^3.4.2"
68
+ },
66
69
  "optionalDependencies": {
67
70
  "@swc/core-darwin-arm64": "^1.15.3",
68
71
  "@swc/core-darwin-x64": "^1.15.3",