ngx-ghe-stream 0.0.0-stage → 0.0.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/README.md +4 -2
- package/fesm2022/ngx-ghe-stream.mjs +32 -0
- package/fesm2022/ngx-ghe-stream.mjs.map +1 -0
- package/package.json +21 -3
- package/types/ngx-ghe-stream.d.ts +13 -0
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# NGX-GHE-Stream
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This module supports generated stream methods for GHE.
|
|
4
|
+
|
|
5
|
+
Still in early development.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { webSocket } from "rxjs/webSocket";
|
|
2
|
+
function makeWebSocketUrlBase(platLoc) {
|
|
3
|
+
return `${platLoc.protocol === "https:" ? "wss:" : "ws:"}//${platLoc.hostname}${platLoc.port ? `:${platLoc.port}` : ""}`;
|
|
4
|
+
}
|
|
5
|
+
var GHEServerStreamWS = class {
|
|
6
|
+
req;
|
|
7
|
+
wsSubject;
|
|
8
|
+
reqEmitted = false;
|
|
9
|
+
constructor(wsUrl, req) {
|
|
10
|
+
this.req = req;
|
|
11
|
+
this.wsSubject = webSocket({ url: wsUrl });
|
|
12
|
+
}
|
|
13
|
+
subscribe(observer) {
|
|
14
|
+
if (!this.reqEmitted) {
|
|
15
|
+
this.wsSubject.next(this.req);
|
|
16
|
+
this.reqEmitted = true;
|
|
17
|
+
}
|
|
18
|
+
return this.wsSubject.subscribe(observer);
|
|
19
|
+
}
|
|
20
|
+
asObservable() {
|
|
21
|
+
return this.wsSubject.asObservable();
|
|
22
|
+
}
|
|
23
|
+
error(err) {
|
|
24
|
+
this.wsSubject.error(err);
|
|
25
|
+
}
|
|
26
|
+
complete() {
|
|
27
|
+
this.wsSubject.complete();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export { GHEServerStreamWS, makeWebSocketUrlBase };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=ngx-ghe-stream.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ngx-ghe-stream.mjs","names":[],"sources":["../../../projects/ngx-ghe-stream/src/lib/ngx-ghe-stream-ws.ts"],"sourcesContent":["import { PlatformLocation } from '@angular/common';\n\nimport { webSocket, WebSocketSubject } from 'rxjs/webSocket';\nimport { Observer, Subscription, Observable } from 'rxjs';\n\nexport function makeWebSocketUrlBase(platLoc: PlatformLocation): string {\n const wsProtocol = platLoc.protocol === 'https:' ? 'wss:' : 'ws:';\n const wsHost = platLoc.hostname;\n const wsPort = platLoc.port ? `:${platLoc.port}` : '';\n return `${wsProtocol}//${wsHost}${wsPort}`;\n}\n\nexport class GHEServerStreamWS<R, T> {\n private readonly wsSubject;\n private reqEmitted = false;\n\n constructor(\n wsUrl: string,\n private readonly req: R,\n ) {\n this.wsSubject = webSocket({ url: wsUrl });\n }\n\n subscribe(observer: Partial<Observer<T>>): Subscription {\n if (!this.reqEmitted) {\n (this.wsSubject as WebSocketSubject<R>).next(this.req);\n this.reqEmitted = true;\n }\n return (this.wsSubject as WebSocketSubject<T>).subscribe(observer);\n }\n\n asObservable(): Observable<T> {\n return (this.wsSubject as WebSocketSubject<T>).asObservable();\n }\n\n error(err: any): void {\n this.wsSubject.error(err);\n }\n\n complete(): void {\n this.wsSubject.complete();\n }\n}\n"],"mappings":";AAKA,SAAgB,qBAAqB,SAAyB;CAI5D,OAAO,GAHY,QAAQ,aAAa,WAAW,SAAS,MAGxC,IAFL,QAAQ,WACR,QAAQ,OAAO,IAAI,QAAQ,SAAS;AAErD;AAEA,IAAa,oBAAb,MAA8B;CAMT;CALF;CACT,aAAa;CAErB,YACE,OACiB,KAAM;EAAN,KAAA,MAAA;EAEjB,KAAK,YAAY,UAAU,EAAE,KAAK,MAAK,CAAE;CAC3C;CAEA,UAAU,UAA8B;EACtC,IAAI,CAAC,KAAK,YAAY;GACnB,KAAK,UAAkC,KAAK,KAAK,GAAG;GACrD,KAAK,aAAa;EACpB;EACA,OAAQ,KAAK,UAAkC,UAAU,QAAQ;CACnE;CAEA,eAAY;EACV,OAAQ,KAAK,UAAkC,aAAY;CAC7D;CAEA,MAAM,KAAQ;EACZ,KAAK,UAAU,MAAM,GAAG;CAC1B;CAEA,WAAQ;EACN,KAAK,UAAU,SAAQ;CACzB;AACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-ghe-stream",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^22.2.0",
|
|
6
|
+
"@angular/core": "^22.2.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"sideEffects": false,
|
|
12
|
+
"module": "fesm2022/ngx-ghe-stream.mjs",
|
|
13
|
+
"typings": "types/ngx-ghe-stream.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
"./package.json": {
|
|
16
|
+
"default": "./package.json"
|
|
17
|
+
},
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./types/ngx-ghe-stream.d.ts",
|
|
20
|
+
"default": "./fesm2022/ngx-ghe-stream.mjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"type": "module"
|
|
6
24
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PlatformLocation } from "@angular/common";
|
|
2
|
+
import { Observable, Observer, Subscription } from "rxjs";
|
|
3
|
+
export declare function makeWebSocketUrlBase(platLoc: PlatformLocation): string;
|
|
4
|
+
export declare class GHEServerStreamWS<R, T> {
|
|
5
|
+
private readonly req;
|
|
6
|
+
private readonly wsSubject;
|
|
7
|
+
private reqEmitted;
|
|
8
|
+
constructor(wsUrl: string, req: R);
|
|
9
|
+
subscribe(observer: Partial<Observer<T>>): Subscription;
|
|
10
|
+
asObservable(): Observable<T>;
|
|
11
|
+
error(err: any): void;
|
|
12
|
+
complete(): void;
|
|
13
|
+
}
|