@flighthq/socket 0.5.1-next.1404.457d1da → 0.5.1-next.1410.b534771
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/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/socket`. The `@fligh
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/socket@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/socket@0.5.1-next.1410.b534771](https://github.com/flighthq/flight/tree/b53477179b2672048eb54d134f94ee8af050d130/packages/socket)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/b53477179b2672048eb54d134f94ee8af050d130/LICENSE.md)
|
|
@@ -17,7 +17,7 @@ export function enableSocketGuards() {
|
|
|
17
17
|
function warnOnSocketMisuse(notice) {
|
|
18
18
|
const url = notice.socket.url;
|
|
19
19
|
const message = notice.reason === 'no-connection'
|
|
20
|
-
? 'createSocket: the host carries no socket
|
|
20
|
+
? 'createSocket: the host carries no socket capability for this transport, or the capability returned no connection — pass a host whose net.socket supports it'
|
|
21
21
|
: `${notice.operation}: socket is already disposed — call createSocket(...) to create a new socket`;
|
|
22
22
|
logOnce(`socket:${notice.operation}:${notice.reason}`, LogLevel.Warn, { message, operation: notice.operation, reason: notice.reason, url }, 'socket');
|
|
23
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enableSocketGuards.js","sourceRoot":"","sources":["../src/enableSocketGuards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAE,cAAc,EAAE,MAA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AG,MAAM,CAAC,SAAS,8EAA8E,CAAC;IACxG,OAAO,CACL,UAAU,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,EAC7C,QAAQ,CAAC,IAAI,EACb,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,EACpE,QAAQ,CACT,CAAC;AACJ,CAAC;AAED,IAAI,QAAQ,GAAG,KAAK,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/socket",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.1410.b534771",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/log": "0.5.1-next.
|
|
43
|
-
"@flighthq/signals": "0.5.1-next.
|
|
44
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.1410.b534771",
|
|
42
|
+
"@flighthq/log": "0.5.1-next.1410.b534771",
|
|
43
|
+
"@flighthq/signals": "0.5.1-next.1410.b534771",
|
|
44
|
+
"@flighthq/types": "0.5.1-next.1410.b534771"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"typescript": "^5.3.0"
|
package/src/socketHost.test.ts
CHANGED
|
@@ -26,13 +26,13 @@ function hostWith(backend: HostSocketCapability | undefined): {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
describe('createSocket', () => {
|
|
29
|
-
it('opens through the
|
|
29
|
+
it('opens through the capability carried by the host it is given', () => {
|
|
30
30
|
const opened: string[] = [];
|
|
31
31
|
createSocket(hostWith(recordingBackend('a', opened)).net.socket, { url: 'wss://example.test' });
|
|
32
32
|
expect(opened).toEqual(['a']);
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
// ★ HOST ISOLATION. Two hosts, two
|
|
35
|
+
// ★ HOST ISOLATION. Two hosts, two capabilities, two answers. Under the ambient resolver one
|
|
36
36
|
// process-wide backend answered for every caller, so the second host was unreachable no matter what
|
|
37
37
|
// it carried — this is the property the migration exists to create.
|
|
38
38
|
it('keeps two hosts independent', () => {
|
|
@@ -42,16 +42,16 @@ describe('createSocket', () => {
|
|
|
42
42
|
expect(opened).toEqual(['first', 'second']);
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
// ★ NO AMBIENT FALLBACK. A host that carries no socket
|
|
45
|
+
// ★ NO AMBIENT FALLBACK. A host that carries no socket capability must yield no connection rather than
|
|
46
46
|
// quietly reaching a process-global web backend. The socket stays 'connecting', which is the
|
|
47
47
|
// documented shape for a backend that cannot open the transport.
|
|
48
|
-
it('yields no connection when the host carries no socket
|
|
48
|
+
it('yields no connection when the host carries no socket capability', () => {
|
|
49
49
|
const socket = createSocket(hostWith(undefined).net.socket, { url: 'wss://absent.test' });
|
|
50
50
|
expect(socket.runtime.connection).toBeNull();
|
|
51
51
|
expect(getSocketReadyState(socket)).toBe('connecting');
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
it('does not consult one host
|
|
54
|
+
it('does not consult one host capability when another host is passed', () => {
|
|
55
55
|
const opened: string[] = [];
|
|
56
56
|
const unused = recordingBackend('unused', opened);
|
|
57
57
|
createSocket(hostWith(recordingBackend('used', opened)).net.socket, { url: 'wss://x.test' });
|