@olane/o-client-limited 0.7.40 → 0.7.42

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.
@@ -1,5 +1,5 @@
1
1
  import { oNodeConnection } from '@olane/o-node';
2
- import type { oNodeConnectionConfig } from '@olane/o-node/src/connection/interfaces/o-node-connection.config.js';
2
+ import type { oNodeConnectionConfig } from '@olane/o-node';
3
3
  /**
4
4
  * oLimitedConnection extends oNodeConnection with stream reuse enabled
5
5
  * This is optimized for limited connections where creating new streams is expensive
@@ -1 +1 @@
1
- {"version":3,"file":"o-limited-connection.d.ts","sourceRoot":"","sources":["../../../src/connection/o-limited-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qEAAqE,CAAC;AAEjH;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,eAAe;gBACzC,MAAM,EAAE,qBAAqB;CAM1C"}
1
+ {"version":3,"file":"o-limited-connection.d.ts","sourceRoot":"","sources":["../../../src/connection/o-limited-connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,eAAe;gBACzC,MAAM,EAAE,qBAAqB;CAQ1C"}
@@ -5,9 +5,11 @@ import { oNodeConnection } from '@olane/o-node';
5
5
  */
6
6
  export class oLimitedConnection extends oNodeConnection {
7
7
  constructor(config) {
8
- super(config);
9
- // Override default 'none' policy with 'reuse' for limited connections
10
- // Can still be overridden via config.reusePolicy
11
- this.reusePolicy = config.reusePolicy ?? 'reuse';
8
+ const reusePolicy = config.reusePolicy ?? 'reuse';
9
+ super({
10
+ ...config,
11
+ reusePolicy: reusePolicy,
12
+ });
13
+ this.reusePolicy = reusePolicy;
12
14
  }
13
15
  }
@@ -51,7 +51,7 @@ describe('Error Handling & Resource Management', () => {
51
51
  // Should not throw
52
52
  const stream = await connection.getOrCreateStream();
53
53
  expect(stream).toBeDefined();
54
- expect(stream.status).toBe('open');
54
+ expect(stream.p2pStream.status).toBe('open');
55
55
  });
56
56
  });
57
57
  describe('Stream Creation Failures', () => {
@@ -111,7 +111,7 @@ describe('Error Handling & Resource Management', () => {
111
111
  expect(streams.length).toBe(10);
112
112
  streams.forEach((stream) => {
113
113
  expect(stream).toBeDefined();
114
- expect(stream.protocol).toBe(testProtocol);
114
+ expect(stream.p2pStream.protocol).toBe(testProtocol);
115
115
  });
116
116
  // With stream reuse, they should all get the same stream
117
117
  // (since the first one creates it, rest reuse it)
@@ -160,7 +160,7 @@ describe('Error Handling & Resource Management', () => {
160
160
  const stream2 = await stream2Promise;
161
161
  // Should reuse the same stream
162
162
  expect(stream2).toBe(stream1);
163
- expect(stream2.status).toBe('open');
163
+ expect(stream2.p2pStream.status).toBe('open');
164
164
  });
165
165
  });
166
166
  describe('Stream State Edge Cases', () => {
@@ -191,7 +191,7 @@ describe('Error Handling & Resource Management', () => {
191
191
  // Next call should create a new stream (not reuse the reset one)
192
192
  const secondStream = await connection.getOrCreateStream();
193
193
  expect(secondStream).not.toBe(stream1);
194
- expect(secondStream.status).toBe('open');
194
+ expect(secondStream.p2pStream.status).toBe('open');
195
195
  });
196
196
  it('should handle stream that becomes non-writable', async () => {
197
197
  const mockConnection = createMockP2PConnection('test-conn', 'open');
@@ -216,7 +216,7 @@ describe('Error Handling & Resource Management', () => {
216
216
  // Should create new stream instead of using non-writable one
217
217
  const newStream = await connection.getOrCreateStream();
218
218
  expect(newStream).not.toBe(stream);
219
- expect(newStream.writeStatus).toBe('writable');
219
+ expect(newStream.p2pStream.writeStatus).toBe('writable');
220
220
  });
221
221
  it('should handle stream where remote side closes read', async () => {
222
222
  const mockConnection = createMockP2PConnection('test-conn', 'open');
@@ -241,7 +241,7 @@ describe('Error Handling & Resource Management', () => {
241
241
  // Should create new stream
242
242
  const newStream = await connection.getOrCreateStream();
243
243
  expect(newStream).not.toBe(stream);
244
- expect(newStream.remoteReadStatus).toBe('readable');
244
+ expect(newStream.p2pStream.remoteReadStatus).toBe('readable');
245
245
  });
246
246
  });
247
247
  describe('Resource Cleanup', () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olane/o-client-limited",
3
- "version": "0.7.40",
3
+ "version": "0.7.42",
4
4
  "type": "module",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -53,13 +53,13 @@
53
53
  "typescript": "5.4.5"
54
54
  },
55
55
  "dependencies": {
56
- "@olane/o-config": "0.7.40",
57
- "@olane/o-core": "0.7.40",
58
- "@olane/o-node": "0.7.40",
59
- "@olane/o-protocol": "0.7.40",
60
- "@olane/o-tool": "0.7.40",
56
+ "@olane/o-config": "0.7.42",
57
+ "@olane/o-core": "0.7.42",
58
+ "@olane/o-node": "0.7.42",
59
+ "@olane/o-protocol": "0.7.42",
60
+ "@olane/o-tool": "0.7.42",
61
61
  "debug": "^4.4.1",
62
62
  "dotenv": "^16.5.0"
63
63
  },
64
- "gitHead": "d2d7cb62d69249fe63d4cb293dbbdfc44d250f17"
64
+ "gitHead": "689465b34c2aefe28b6c87e3822d69651f2a49b7"
65
65
  }