@undefineds.co/xpod 0.3.67 → 0.3.69
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/config/components-ignore.json +1 -0
- package/dist/api/ApiServer.d.ts +9 -1
- package/dist/api/ApiServer.js +22 -1
- package/dist/api/ApiServer.js.map +1 -1
- package/dist/api/container/common.js +1 -1
- package/dist/api/container/common.js.map +1 -1
- package/dist/api/container/routes.js +13 -0
- package/dist/api/container/routes.js.map +1 -1
- package/dist/api/container/types.d.ts +1 -1
- package/dist/api/container/types.js.map +1 -1
- package/dist/api/handlers/DeviceNotificationRuntime.d.ts +26 -0
- package/dist/api/handlers/DeviceNotificationRuntime.js +77 -0
- package/dist/api/handlers/DeviceNotificationRuntime.js.map +1 -0
- package/dist/api/handlers/DeviceNotificationTicketHandler.d.ts +50 -0
- package/dist/api/handlers/DeviceNotificationTicketHandler.js +130 -0
- package/dist/api/handlers/DeviceNotificationTicketHandler.js.map +1 -0
- package/dist/api/handlers/DeviceNotificationTicketHandler.jsonld +117 -0
- package/dist/api/runs/InngestRunExecutionBackend.d.ts +2 -2
- package/dist/api/tasks/InngestTaskScheduler.d.ts +4 -4
- package/dist/components/components.jsonld +6 -1
- package/dist/components/context.jsonld +122 -0
- package/dist/http/DeviceNotificationWebSocketServer.d.ts +29 -0
- package/dist/http/DeviceNotificationWebSocketServer.js +138 -0
- package/dist/http/DeviceNotificationWebSocketServer.js.map +1 -0
- package/dist/http/DeviceNotificationWebSocketServer.jsonld +148 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/notifications/DeviceNotificationHub.d.ts +74 -0
- package/dist/notifications/DeviceNotificationHub.js +313 -0
- package/dist/notifications/DeviceNotificationHub.js.map +1 -0
- package/dist/notifications/DeviceNotificationHub.jsonld +258 -0
- package/dist/notifications/DeviceNotificationResourceListener.d.ts +21 -0
- package/dist/notifications/DeviceNotificationResourceListener.js +38 -0
- package/dist/notifications/DeviceNotificationResourceListener.js.map +1 -0
- package/dist/notifications/DeviceNotificationResourceListener.jsonld +98 -0
- package/dist/notifications/device-notification-protocol.d.ts +56 -0
- package/dist/notifications/device-notification-protocol.js +127 -0
- package/dist/notifications/device-notification-protocol.js.map +1 -0
- package/dist/notifications/device-notification-protocol.jsonld +29 -0
- package/dist/notifications/index.d.ts +3 -0
- package/dist/notifications/index.js +20 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/storage/ObservableResourceStore.d.ts +3 -0
- package/dist/storage/ObservableResourceStore.js +17 -1
- package/dist/storage/ObservableResourceStore.js.map +1 -1
- package/package.json +1 -1
|
@@ -1393,6 +1393,123 @@
|
|
|
1393
1393
|
}
|
|
1394
1394
|
}
|
|
1395
1395
|
},
|
|
1396
|
+
"DeviceNotificationHub": {
|
|
1397
|
+
"@id": "undefineds:dist/notifications/DeviceNotificationHub.jsonld#DeviceNotificationHub",
|
|
1398
|
+
"@prefix": true,
|
|
1399
|
+
"@context": {
|
|
1400
|
+
"options": {
|
|
1401
|
+
"@id": "undefineds:dist/notifications/DeviceNotificationHub.jsonld#DeviceNotificationHub_options"
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1405
|
+
"DeviceNotificationHubOptions": {
|
|
1406
|
+
"@id": "undefineds:dist/notifications/DeviceNotificationHub.jsonld#DeviceNotificationHubOptions",
|
|
1407
|
+
"@prefix": true,
|
|
1408
|
+
"@context": {}
|
|
1409
|
+
},
|
|
1410
|
+
"OpenDeviceNotificationConnectionInput": {
|
|
1411
|
+
"@id": "undefineds:dist/notifications/DeviceNotificationHub.jsonld#OpenDeviceNotificationConnectionInput",
|
|
1412
|
+
"@prefix": true,
|
|
1413
|
+
"@context": {}
|
|
1414
|
+
},
|
|
1415
|
+
"DeviceNotificationConnectionHandle": {
|
|
1416
|
+
"@id": "undefineds:dist/notifications/DeviceNotificationHub.jsonld#DeviceNotificationConnectionHandle",
|
|
1417
|
+
"@prefix": true,
|
|
1418
|
+
"@context": {}
|
|
1419
|
+
},
|
|
1420
|
+
"DeviceNotificationPublishInput": {
|
|
1421
|
+
"@id": "undefineds:dist/notifications/DeviceNotificationHub.jsonld#DeviceNotificationPublishInput",
|
|
1422
|
+
"@prefix": true,
|
|
1423
|
+
"@context": {}
|
|
1424
|
+
},
|
|
1425
|
+
"DeviceNotificationResourceListener": {
|
|
1426
|
+
"@id": "undefineds:dist/notifications/DeviceNotificationResourceListener.jsonld#DeviceNotificationResourceListener",
|
|
1427
|
+
"@prefix": true,
|
|
1428
|
+
"@context": {
|
|
1429
|
+
"options_origin": {
|
|
1430
|
+
"@id": "undefineds:dist/notifications/DeviceNotificationResourceListener.jsonld#DeviceNotificationResourceListener_options_origin"
|
|
1431
|
+
},
|
|
1432
|
+
"options_hub": {
|
|
1433
|
+
"@id": "undefineds:dist/notifications/DeviceNotificationResourceListener.jsonld#DeviceNotificationResourceListener_options_hub"
|
|
1434
|
+
},
|
|
1435
|
+
"origin": {
|
|
1436
|
+
"@id": "undefineds:dist/notifications/DeviceNotificationResourceListener.jsonld#DeviceNotificationResourceListener_options_origin"
|
|
1437
|
+
},
|
|
1438
|
+
"hub": {
|
|
1439
|
+
"@id": "undefineds:dist/notifications/DeviceNotificationResourceListener.jsonld#DeviceNotificationResourceListener_options_hub"
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
},
|
|
1443
|
+
"DeviceNotificationResourcePublisher": {
|
|
1444
|
+
"@id": "undefineds:dist/notifications/DeviceNotificationResourceListener.jsonld#DeviceNotificationResourcePublisher",
|
|
1445
|
+
"@prefix": true,
|
|
1446
|
+
"@context": {}
|
|
1447
|
+
},
|
|
1448
|
+
"DeviceNotificationResourceListenerOptions": {
|
|
1449
|
+
"@id": "undefineds:dist/notifications/DeviceNotificationResourceListener.jsonld#DeviceNotificationResourceListenerOptions",
|
|
1450
|
+
"@prefix": true,
|
|
1451
|
+
"@context": {}
|
|
1452
|
+
},
|
|
1453
|
+
"DeviceNotificationWebSocketServer": {
|
|
1454
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer",
|
|
1455
|
+
"@prefix": true,
|
|
1456
|
+
"@context": {
|
|
1457
|
+
"options_hub": {
|
|
1458
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_hub"
|
|
1459
|
+
},
|
|
1460
|
+
"options_ticketStore": {
|
|
1461
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_ticketStore"
|
|
1462
|
+
},
|
|
1463
|
+
"options_path": {
|
|
1464
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_path"
|
|
1465
|
+
},
|
|
1466
|
+
"options_heartbeatIntervalMs": {
|
|
1467
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_heartbeatIntervalMs"
|
|
1468
|
+
},
|
|
1469
|
+
"hub": {
|
|
1470
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_hub"
|
|
1471
|
+
},
|
|
1472
|
+
"ticketStore": {
|
|
1473
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_ticketStore"
|
|
1474
|
+
},
|
|
1475
|
+
"path": {
|
|
1476
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_path"
|
|
1477
|
+
},
|
|
1478
|
+
"heartbeatIntervalMs": {
|
|
1479
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_heartbeatIntervalMs"
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
},
|
|
1483
|
+
"DeviceNotificationTicketHandler": {
|
|
1484
|
+
"@id": "undefineds:dist/api/handlers/DeviceNotificationTicketHandler.jsonld#DeviceNotificationTicketHandler",
|
|
1485
|
+
"@prefix": true,
|
|
1486
|
+
"@context": {
|
|
1487
|
+
"options_webSocketEndpoint": {
|
|
1488
|
+
"@id": "undefineds:dist/api/handlers/DeviceNotificationTicketHandler.jsonld#DeviceNotificationTicketHandler_options_webSocketEndpoint"
|
|
1489
|
+
},
|
|
1490
|
+
"options_origin": {
|
|
1491
|
+
"@id": "undefineds:dist/api/handlers/DeviceNotificationTicketHandler.jsonld#DeviceNotificationTicketHandler_options_origin"
|
|
1492
|
+
},
|
|
1493
|
+
"options_ticketTtlMs": {
|
|
1494
|
+
"@id": "undefineds:dist/api/handlers/DeviceNotificationTicketHandler.jsonld#DeviceNotificationTicketHandler_options_ticketTtlMs"
|
|
1495
|
+
},
|
|
1496
|
+
"options_ticketStore": {
|
|
1497
|
+
"@id": "undefineds:dist/api/handlers/DeviceNotificationTicketHandler.jsonld#DeviceNotificationTicketHandler_options_ticketStore"
|
|
1498
|
+
},
|
|
1499
|
+
"webSocketEndpoint": {
|
|
1500
|
+
"@id": "undefineds:dist/api/handlers/DeviceNotificationTicketHandler.jsonld#DeviceNotificationTicketHandler_options_webSocketEndpoint"
|
|
1501
|
+
},
|
|
1502
|
+
"origin": {
|
|
1503
|
+
"@id": "undefineds:dist/api/handlers/DeviceNotificationTicketHandler.jsonld#DeviceNotificationTicketHandler_options_origin"
|
|
1504
|
+
},
|
|
1505
|
+
"ticketTtlMs": {
|
|
1506
|
+
"@id": "undefineds:dist/api/handlers/DeviceNotificationTicketHandler.jsonld#DeviceNotificationTicketHandler_options_ticketTtlMs"
|
|
1507
|
+
},
|
|
1508
|
+
"ticketStore": {
|
|
1509
|
+
"@id": "undefineds:dist/api/handlers/DeviceNotificationTicketHandler.jsonld#DeviceNotificationTicketHandler_options_ticketStore"
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
},
|
|
1396
1513
|
"ReservedSuffixIdentifierGenerator": {
|
|
1397
1514
|
"@id": "undefineds:dist/pods/ReservedSuffixIdentifierGenerator.jsonld#ReservedSuffixIdentifierGenerator",
|
|
1398
1515
|
"@prefix": true,
|
|
@@ -3813,6 +3930,11 @@
|
|
|
3813
3930
|
"@id": "undefineds:dist/edge/reachability/P2PRealnetAcceptance.jsonld#P2PRealnetAcceptanceVerification",
|
|
3814
3931
|
"@prefix": true,
|
|
3815
3932
|
"@context": {}
|
|
3933
|
+
},
|
|
3934
|
+
"ParseClientFrameOptions": {
|
|
3935
|
+
"@id": "undefineds:dist/notifications/device-notification-protocol.jsonld#ParseClientFrameOptions",
|
|
3936
|
+
"@prefix": true,
|
|
3937
|
+
"@context": {}
|
|
3816
3938
|
}
|
|
3817
3939
|
}
|
|
3818
3940
|
]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { IncomingMessage, Server } from 'node:http';
|
|
2
|
+
import type { Duplex } from 'node:stream';
|
|
3
|
+
import type { DeviceNotificationTicketStore } from '../api/handlers/DeviceNotificationTicketHandler';
|
|
4
|
+
import { DeviceNotificationHub } from '../notifications/DeviceNotificationHub';
|
|
5
|
+
export interface DeviceNotificationWebSocketServerOptions {
|
|
6
|
+
hub: DeviceNotificationHub;
|
|
7
|
+
ticketStore: DeviceNotificationTicketStore;
|
|
8
|
+
path?: string;
|
|
9
|
+
heartbeatIntervalMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class DeviceNotificationWebSocketServer {
|
|
12
|
+
private readonly hub;
|
|
13
|
+
private readonly ticketStore;
|
|
14
|
+
private readonly path;
|
|
15
|
+
private readonly heartbeatIntervalMs;
|
|
16
|
+
private readonly wss;
|
|
17
|
+
private readonly sockets;
|
|
18
|
+
private readonly socketConnections;
|
|
19
|
+
private readonly alive;
|
|
20
|
+
private heartbeatTimer?;
|
|
21
|
+
constructor(options: DeviceNotificationWebSocketServerOptions);
|
|
22
|
+
attach(server: Server): void;
|
|
23
|
+
handleUpgrade(request: IncomingMessage, socket: Duplex, head: Buffer): void;
|
|
24
|
+
stop(): void;
|
|
25
|
+
private handleFrame;
|
|
26
|
+
private reject;
|
|
27
|
+
private startHeartbeat;
|
|
28
|
+
private cleanupSocket;
|
|
29
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeviceNotificationWebSocketServer = void 0;
|
|
4
|
+
const ws_1 = require("ws");
|
|
5
|
+
const device_notification_protocol_1 = require("../notifications/device-notification-protocol");
|
|
6
|
+
class DeviceNotificationWebSocketServer {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.wss = new ws_1.WebSocketServer({ noServer: true });
|
|
9
|
+
this.sockets = new Set();
|
|
10
|
+
this.socketConnections = new Map();
|
|
11
|
+
this.alive = new Map();
|
|
12
|
+
this.hub = options.hub;
|
|
13
|
+
this.ticketStore = options.ticketStore;
|
|
14
|
+
this.path = options.path ?? '/v1/notifications/ws';
|
|
15
|
+
this.heartbeatIntervalMs = options.heartbeatIntervalMs ?? 30_000;
|
|
16
|
+
this.startHeartbeat();
|
|
17
|
+
}
|
|
18
|
+
attach(server) {
|
|
19
|
+
server.on('upgrade', (request, socket, head) => {
|
|
20
|
+
this.handleUpgrade(request, socket, head);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
handleUpgrade(request, socket, head) {
|
|
24
|
+
const url = new URL(request.url ?? '/', `http://${request.headers.host ?? 'localhost'}`);
|
|
25
|
+
if (url.pathname !== this.path) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const { protocolAccepted, ticket } = (0, device_notification_protocol_1.parseDeviceNotificationSubprotocols)(request.headers['sec-websocket-protocol']);
|
|
29
|
+
if (!protocolAccepted || !ticket) {
|
|
30
|
+
this.reject(socket, 401, 'Missing notification subprotocol');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const record = this.ticketStore.consume(ticket);
|
|
34
|
+
if (!record) {
|
|
35
|
+
this.reject(socket, 401, 'Invalid notification ticket');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.wss.handleUpgrade(request, socket, head, (ws) => {
|
|
39
|
+
this.sockets.add(ws);
|
|
40
|
+
const connection = this.hub.openConnection({
|
|
41
|
+
identity: record.identity,
|
|
42
|
+
deviceSessionId: record.deviceSessionId,
|
|
43
|
+
send: (frame) => {
|
|
44
|
+
if (ws.readyState !== ws_1.WebSocket.OPEN) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
ws.send((0, device_notification_protocol_1.serializeServerFrame)(frame));
|
|
48
|
+
return true;
|
|
49
|
+
},
|
|
50
|
+
close: (code, reason) => {
|
|
51
|
+
ws.close(code, reason);
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
this.socketConnections.set(ws, connection.connectionId);
|
|
55
|
+
this.alive.set(ws, true);
|
|
56
|
+
ws.on('pong', () => {
|
|
57
|
+
this.alive.set(ws, true);
|
|
58
|
+
});
|
|
59
|
+
ws.on('message', (data) => {
|
|
60
|
+
void (async () => {
|
|
61
|
+
try {
|
|
62
|
+
const frame = (0, device_notification_protocol_1.parseClientFrame)(JSON.parse(data.toString()), {
|
|
63
|
+
origin: record.origin,
|
|
64
|
+
});
|
|
65
|
+
await this.handleFrame(connection.connectionId, frame);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
ws.send((0, device_notification_protocol_1.serializeServerFrame)((0, device_notification_protocol_1.createProtocolErrorFrame)('bad-frame', error.message)));
|
|
69
|
+
}
|
|
70
|
+
})();
|
|
71
|
+
});
|
|
72
|
+
ws.on('close', () => {
|
|
73
|
+
this.cleanupSocket(ws);
|
|
74
|
+
});
|
|
75
|
+
ws.on('error', () => {
|
|
76
|
+
this.cleanupSocket(ws);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
stop() {
|
|
81
|
+
for (const socket of this.sockets) {
|
|
82
|
+
socket.close();
|
|
83
|
+
}
|
|
84
|
+
this.sockets.clear();
|
|
85
|
+
this.socketConnections.clear();
|
|
86
|
+
this.alive.clear();
|
|
87
|
+
if (this.heartbeatTimer) {
|
|
88
|
+
clearInterval(this.heartbeatTimer);
|
|
89
|
+
this.heartbeatTimer = undefined;
|
|
90
|
+
}
|
|
91
|
+
this.wss.close();
|
|
92
|
+
}
|
|
93
|
+
async handleFrame(connectionId, frame) {
|
|
94
|
+
switch (frame.type) {
|
|
95
|
+
case 'hello':
|
|
96
|
+
this.hub.hello(connectionId, frame.resumeFrom);
|
|
97
|
+
break;
|
|
98
|
+
case 'register':
|
|
99
|
+
await this.hub.registerTopics(connectionId, frame.requestId, frame.topics);
|
|
100
|
+
break;
|
|
101
|
+
case 'unregister':
|
|
102
|
+
await this.hub.unregisterTopics(connectionId, frame.requestId, frame.topics);
|
|
103
|
+
break;
|
|
104
|
+
case 'ack':
|
|
105
|
+
this.hub.ack(connectionId, frame.sequence);
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
reject(socket, status, message) {
|
|
110
|
+
socket.write(`HTTP/1.1 ${status} ${message}\r\nConnection: close\r\n\r\n`);
|
|
111
|
+
socket.end();
|
|
112
|
+
}
|
|
113
|
+
startHeartbeat() {
|
|
114
|
+
this.heartbeatTimer = setInterval(() => {
|
|
115
|
+
for (const socket of this.sockets) {
|
|
116
|
+
if (this.alive.get(socket) === false) {
|
|
117
|
+
this.cleanupSocket(socket);
|
|
118
|
+
socket.close();
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
this.alive.set(socket, false);
|
|
122
|
+
socket.ping();
|
|
123
|
+
}
|
|
124
|
+
}, this.heartbeatIntervalMs);
|
|
125
|
+
this.heartbeatTimer.unref?.();
|
|
126
|
+
}
|
|
127
|
+
cleanupSocket(socket) {
|
|
128
|
+
this.sockets.delete(socket);
|
|
129
|
+
this.alive.delete(socket);
|
|
130
|
+
const connectionId = this.socketConnections.get(socket);
|
|
131
|
+
this.socketConnections.delete(socket);
|
|
132
|
+
if (connectionId) {
|
|
133
|
+
this.hub.closeConnection(connectionId);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.DeviceNotificationWebSocketServer = DeviceNotificationWebSocketServer;
|
|
138
|
+
//# sourceMappingURL=DeviceNotificationWebSocketServer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeviceNotificationWebSocketServer.js","sourceRoot":"","sources":["../../src/http/DeviceNotificationWebSocketServer.ts"],"names":[],"mappings":";;;AAEA,2BAAgD;AAGhD,gGAMuD;AASvD,MAAa,iCAAiC;IAW5C,YAAmB,OAAiD;QANnD,QAAG,GAAG,IAAI,oBAAe,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9C,YAAO,GAAG,IAAI,GAAG,EAAa,CAAC;QAC/B,sBAAiB,GAAG,IAAI,GAAG,EAAqB,CAAC;QACjD,UAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;QAIrD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,sBAAsB,CAAC;QACnD,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,IAAI,MAAM,CAAC;QACjE,IAAI,CAAC,cAAc,EAAE,CAAC;IACxB,CAAC;IAEM,MAAM,CAAC,MAAc;QAC1B,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;YAC7C,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,aAAa,CAAC,OAAwB,EAAE,MAAc,EAAE,IAAY;QACzE,MAA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ex } from 'node:stream';\nimport { WebSocket, WebSocketServer } from 'ws';\nimport type { DeviceNotificationTicketStore } from '../api/handlers/DeviceNotificationTicketHandler';\nimport { DeviceNotificationHub } from '../notifications/DeviceNotificationHub';\nimport {\n XPOD_NOTIFICATIONS_PROTOCOL,\n createProtocolErrorFrame,\n parseClientFrame,\n parseDeviceNotificationSubprotocols,\n serializeServerFrame,\n} from '../notifications/device-notification-protocol';\n\nexport interface DeviceNotificationWebSocketServerOptions {\n hub: DeviceNotificationHub;\n ticketStore: DeviceNotificationTicketStore;\n path?: string;\n heartbeatIntervalMs?: number;\n}\n\nexport class DeviceNotificationWebSocketServer {\n private readonly hub: DeviceNotificationHub;\n private readonly ticketStore: DeviceNotificationTicketStore;\n private readonly path: string;\n private readonly heartbeatIntervalMs: number;\n private readonly wss = new WebSocketServer({ noServer: true });\n private readonly sockets = new Set<WebSocket>();\n private readonly socketConnections = new Map<WebSocket, string>();\n private readonly alive = new Map<WebSocket, boolean>();\n private heartbeatTimer?: ReturnType<typeof setInterval>;\n\n public constructor(options: DeviceNotificationWebSocketServerOptions) {\n this.hub = options.hub;\n this.ticketStore = options.ticketStore;\n this.path = options.path ?? '/v1/notifications/ws';\n this.heartbeatIntervalMs = options.heartbeatIntervalMs ?? 30_000;\n this.startHeartbeat();\n }\n\n public attach(server: Server): void {\n server.on('upgrade', (request, socket, head) => {\n this.handleUpgrade(request, socket, head);\n });\n }\n\n public handleUpgrade(request: IncomingMessage, socket: Duplex, head: Buffer): void {\n const url = new URL(request.url ?? '/', `http://${request.headers.host ?? 'localhost'}`);\n if (url.pathname !== this.path) {\n return;\n }\n const { protocolAccepted, ticket } = parseDeviceNotificationSubprotocols(request.headers['sec-websocket-protocol']);\n if (!protocolAccepted || !ticket) {\n this.reject(socket, 401, 'Missing notification subprotocol');\n return;\n }\n const record = this.ticketStore.consume(ticket);\n if (!record) {\n this.reject(socket, 401, 'Invalid notification ticket');\n return;\n }\n this.wss.handleUpgrade(request, socket as any, head, (ws) => {\n this.sockets.add(ws);\n const connection = this.hub.openConnection({\n identity: record.identity,\n deviceSessionId: record.deviceSessionId,\n send: (frame) => {\n if (ws.readyState !== WebSocket.OPEN) {\n return false;\n }\n ws.send(serializeServerFrame(frame));\n return true;\n },\n close: (code, reason) => {\n ws.close(code, reason);\n },\n });\n this.socketConnections.set(ws, connection.connectionId);\n this.alive.set(ws, true);\n ws.on('pong', () => {\n this.alive.set(ws, true);\n });\n ws.on('message', (data) => {\n void (async () => {\n try {\n const frame = parseClientFrame(JSON.parse(data.toString()), {\n origin: record.origin,\n });\n await this.handleFrame(connection.connectionId, frame);\n } catch (error) {\n ws.send(serializeServerFrame(createProtocolErrorFrame('bad-frame', (error as Error).message)));\n }\n })();\n });\n ws.on('close', () => {\n this.cleanupSocket(ws);\n });\n ws.on('error', () => {\n this.cleanupSocket(ws);\n });\n });\n }\n\n public stop(): void {\n for (const socket of this.sockets) {\n socket.close();\n }\n this.sockets.clear();\n this.socketConnections.clear();\n this.alive.clear();\n if (this.heartbeatTimer) {\n clearInterval(this.heartbeatTimer);\n this.heartbeatTimer = undefined;\n }\n this.wss.close();\n }\n\n private async handleFrame(connectionId: string, frame: ReturnType<typeof parseClientFrame>): Promise<void> {\n switch (frame.type) {\n case 'hello':\n this.hub.hello(connectionId, frame.resumeFrom);\n break;\n case 'register':\n await this.hub.registerTopics(connectionId, frame.requestId, frame.topics);\n break;\n case 'unregister':\n await this.hub.unregisterTopics(connectionId, frame.requestId, frame.topics);\n break;\n case 'ack':\n this.hub.ack(connectionId, frame.sequence);\n break;\n }\n }\n\n private reject(socket: Duplex, status: number, message: string): void {\n socket.write(`HTTP/1.1 ${status} ${message}\\r\\nConnection: close\\r\\n\\r\\n`);\n socket.end();\n }\n\n private startHeartbeat(): void {\n this.heartbeatTimer = setInterval(() => {\n for (const socket of this.sockets) {\n if (this.alive.get(socket) === false) {\n this.cleanupSocket(socket);\n socket.close();\n continue;\n }\n this.alive.set(socket, false);\n socket.ping();\n }\n }, this.heartbeatIntervalMs);\n this.heartbeatTimer.unref?.();\n }\n\n private cleanupSocket(socket: WebSocket): void {\n this.sockets.delete(socket);\n this.alive.delete(socket);\n const connectionId = this.socketConnections.get(socket);\n this.socketConnections.delete(socket);\n if (connectionId) {\n this.hub.closeConnection(connectionId);\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@undefineds.co/xpod/^0.0.0/components/context.jsonld"
|
|
4
|
+
],
|
|
5
|
+
"@id": "npmd:@undefineds.co/xpod",
|
|
6
|
+
"components": [
|
|
7
|
+
{
|
|
8
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer",
|
|
9
|
+
"@type": "Class",
|
|
10
|
+
"requireElement": "DeviceNotificationWebSocketServer",
|
|
11
|
+
"parameters": [
|
|
12
|
+
{
|
|
13
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_hub",
|
|
14
|
+
"range": "undefineds:dist/notifications/DeviceNotificationHub.jsonld#DeviceNotificationHub"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_ticketStore",
|
|
18
|
+
"range": "undefineds:dist/api/handlers/DeviceNotificationTicketHandler.jsonld#DeviceNotificationTicketStore"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_path",
|
|
22
|
+
"range": {
|
|
23
|
+
"@type": "ParameterRangeUnion",
|
|
24
|
+
"parameterRangeElements": [
|
|
25
|
+
"xsd:string",
|
|
26
|
+
{
|
|
27
|
+
"@type": "ParameterRangeUndefined"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_heartbeatIntervalMs",
|
|
34
|
+
"range": {
|
|
35
|
+
"@type": "ParameterRangeUnion",
|
|
36
|
+
"parameterRangeElements": [
|
|
37
|
+
"xsd:number",
|
|
38
|
+
{
|
|
39
|
+
"@type": "ParameterRangeUndefined"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"memberFields": [
|
|
46
|
+
{
|
|
47
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_hub",
|
|
48
|
+
"memberFieldName": "hub"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_ticketStore",
|
|
52
|
+
"memberFieldName": "ticketStore"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_path",
|
|
56
|
+
"memberFieldName": "path"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_heartbeatIntervalMs",
|
|
60
|
+
"memberFieldName": "heartbeatIntervalMs"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_wss",
|
|
64
|
+
"memberFieldName": "wss"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_sockets",
|
|
68
|
+
"memberFieldName": "sockets"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_socketConnections",
|
|
72
|
+
"memberFieldName": "socketConnections"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_alive",
|
|
76
|
+
"memberFieldName": "alive"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_heartbeatTimer",
|
|
80
|
+
"memberFieldName": "heartbeatTimer"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_constructor",
|
|
84
|
+
"memberFieldName": "constructor"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_attach",
|
|
88
|
+
"memberFieldName": "attach"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_handleUpgrade",
|
|
92
|
+
"memberFieldName": "handleUpgrade"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_stop",
|
|
96
|
+
"memberFieldName": "stop"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_handleFrame",
|
|
100
|
+
"memberFieldName": "handleFrame"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_reject",
|
|
104
|
+
"memberFieldName": "reject"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_startHeartbeat",
|
|
108
|
+
"memberFieldName": "startHeartbeat"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer__member_cleanupSocket",
|
|
112
|
+
"memberFieldName": "cleanupSocket"
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"constructorArguments": [
|
|
116
|
+
{
|
|
117
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options__constructorArgument",
|
|
118
|
+
"fields": [
|
|
119
|
+
{
|
|
120
|
+
"keyRaw": "hub",
|
|
121
|
+
"value": {
|
|
122
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_hub"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"keyRaw": "ticketStore",
|
|
127
|
+
"value": {
|
|
128
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_ticketStore"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"keyRaw": "path",
|
|
133
|
+
"value": {
|
|
134
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_path"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"keyRaw": "heartbeatIntervalMs",
|
|
139
|
+
"value": {
|
|
140
|
+
"@id": "undefineds:dist/http/DeviceNotificationWebSocketServer.jsonld#DeviceNotificationWebSocketServer_options_heartbeatIntervalMs"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,11 @@ import { RouterHttpHandler } from './http/RouterHttpHandler';
|
|
|
30
30
|
import { RouterHttpRoute } from './http/RouterHttpRoute';
|
|
31
31
|
import { TracingHandler } from './http/TracingHandler';
|
|
32
32
|
import { TerminalHttpHandler } from './http/terminal/TerminalHttpHandler';
|
|
33
|
+
import { DeviceNotificationHub } from './notifications/DeviceNotificationHub';
|
|
34
|
+
import { DeviceNotificationResourceListener } from './notifications/DeviceNotificationResourceListener';
|
|
35
|
+
import { DeviceNotificationWebSocketServer } from './http/DeviceNotificationWebSocketServer';
|
|
36
|
+
import { DeviceNotificationTicketHandler } from './api/handlers/DeviceNotificationTicketHandler';
|
|
37
|
+
import { registerDeviceNotificationRuntime } from './api/handlers/DeviceNotificationRuntime';
|
|
33
38
|
import { EdgeNodeCertificateHttpHandler } from './http/admin/EdgeNodeCertificateHttpHandler';
|
|
34
39
|
import { ReservedSuffixIdentifierGenerator } from './pods/ReservedSuffixIdentifierGenerator';
|
|
35
40
|
import { DrizzleIndexedStorage } from './identity/drizzle/DrizzleIndexedStorage';
|
|
@@ -101,6 +106,7 @@ import { LocalPodProvisioningService } from './provision/LocalPodProvisioningSer
|
|
|
101
106
|
import { SqliteSolidFsSyncJournal } from './solidfs/SolidFsSyncJournal';
|
|
102
107
|
export * from './api/reconciler';
|
|
103
108
|
export * from './edge/reachability';
|
|
109
|
+
export * from './notifications';
|
|
104
110
|
export type { DnsProvider, ListDnsRecordsInput, ListableDnsProvider, DeleteDnsRecordInput, DnsRecordSummary, UpsertDnsRecordInput, } from './dns/DnsProvider';
|
|
105
111
|
export type { EdgeNodeCertificateProvisioner } from './edge/EdgeNodeCertificateProvisioner';
|
|
106
112
|
export type { EdgeNodeAgentOptions, EdgeNodeP2PAcceptEvent } from './edge/EdgeNodeAgent';
|
|
@@ -110,4 +116,4 @@ export type { EntitlementProvider, AccountEntitlement } from './quota/Entitlemen
|
|
|
110
116
|
export type { TunnelProvider, TunnelConfig, TunnelSetupOptions, TunnelStatus, } from './tunnel/TunnelProvider';
|
|
111
117
|
export type { SubdomainRegistration, ConnectivityResult, SubdomainServiceOptions, } from './subdomain/SubdomainService';
|
|
112
118
|
export { AppStaticAssetHandler } from './http/AppStaticAssetHandler';
|
|
113
|
-
export { RepresentationPartialConvertingStore, MinioDataAccessor, QuadstoreSparqlDataAccessor, QuintStoreSparqlDataAccessor, SolidRdfDataAccessor, MixDataAccessor, ConfigurableLoggerFactory, SparqlUpdateResourceStore, SubgraphQueryEngine, QuadstoreSparqlEngine, QuintstoreSparqlEngine, SubgraphSparqlHttpHandler, QuotaAdminHttpHandler, ClusterIngressRouter, ClusterWebSocketConfigurator, EdgeNodeDirectDebugHttpHandler, EdgeNodeProxyHttpHandler, RouterHttpHandler, RouterHttpRoute, TracingHandler, EdgeNodeCertificateHttpHandler, TerminalHttpHandler, ReservedSuffixIdentifierGenerator, DrizzleIndexedStorage, ValidatingIdentityProviderHttpHandler, PostgresKeyValueStorage, RedisKeyValueStorage, SqliteKeyValueStorage, BaseKeyValueStorage, DrizzleQuotaService, NoopQuotaService, HttpEntitlementProvider, NoopEntitlementProvider, PerAccountQuotaStrategy, TencentDnsProvider, EdgeNodeDnsCoordinator, Dns01CertificateProvisioner, SimpleEdgeNodeTunnelManager, NoopEdgeNodeTunnelManager, FrpTunnelManager, EdgeNodeHealthProbeService, EdgeNodeAgent, EdgeNodeAgentInitializer, EdgeNodeCertificateService, AcmeCertificateManager, EdgeNodeModeDetector, ClusterIdentifierStrategy, UsageTrackingStore, CenterNodeRegistrationService, PodRoutingHttpHandler, ReactAppViewHandler, QuintStore, SqliteQuintStore, PgQuintStore, RdfTermDictionary, RdfQuadIndex, Rdf3xIndex, RdfTextIndex, RdfVectorIndex, PostgresRdfTextIndex, PostgresRdfVectorIndex, RdfSparqlAdapter, ShadowRdfQuintStore, SolidRdfEngine, PostgresRdfEngine, SolidRdfSparqlEngine, VectorStore, SqliteVectorStore, PostgresVectorStore, VectorHttpHandler, ProviderRegistry, ProviderRegistryImpl, EmbeddingService, EmbeddingServiceImpl, CredentialReader, CredentialReaderImpl, CloudflareTunnelProvider, LocalTunnelProvider, NgrokTunnelProvider, SubdomainService, MultiDomainIdentifierStrategy, SubdomainPodIdentifierStrategy, DisabledOidcHandler, DisabledIdentityProviderHandler, AutoDetectOidcHandler, AutoDetectIdentityProviderHandler, LoopbackClientIdAdapterFactory, ScopedPickWebIdHandler, UrlAwareRedisLocker, ProvisionPodCreator, ProvisionCodeCodec, LocalPodProvisioningService, SqliteSolidFsSyncJournal, };
|
|
119
|
+
export { RepresentationPartialConvertingStore, MinioDataAccessor, QuadstoreSparqlDataAccessor, QuintStoreSparqlDataAccessor, SolidRdfDataAccessor, MixDataAccessor, ConfigurableLoggerFactory, SparqlUpdateResourceStore, SubgraphQueryEngine, QuadstoreSparqlEngine, QuintstoreSparqlEngine, SubgraphSparqlHttpHandler, QuotaAdminHttpHandler, ClusterIngressRouter, ClusterWebSocketConfigurator, EdgeNodeDirectDebugHttpHandler, EdgeNodeProxyHttpHandler, RouterHttpHandler, RouterHttpRoute, TracingHandler, EdgeNodeCertificateHttpHandler, TerminalHttpHandler, DeviceNotificationHub, DeviceNotificationResourceListener, DeviceNotificationWebSocketServer, DeviceNotificationTicketHandler, registerDeviceNotificationRuntime, ReservedSuffixIdentifierGenerator, DrizzleIndexedStorage, ValidatingIdentityProviderHttpHandler, PostgresKeyValueStorage, RedisKeyValueStorage, SqliteKeyValueStorage, BaseKeyValueStorage, DrizzleQuotaService, NoopQuotaService, HttpEntitlementProvider, NoopEntitlementProvider, PerAccountQuotaStrategy, TencentDnsProvider, EdgeNodeDnsCoordinator, Dns01CertificateProvisioner, SimpleEdgeNodeTunnelManager, NoopEdgeNodeTunnelManager, FrpTunnelManager, EdgeNodeHealthProbeService, EdgeNodeAgent, EdgeNodeAgentInitializer, EdgeNodeCertificateService, AcmeCertificateManager, EdgeNodeModeDetector, ClusterIdentifierStrategy, UsageTrackingStore, CenterNodeRegistrationService, PodRoutingHttpHandler, ReactAppViewHandler, QuintStore, SqliteQuintStore, PgQuintStore, RdfTermDictionary, RdfQuadIndex, Rdf3xIndex, RdfTextIndex, RdfVectorIndex, PostgresRdfTextIndex, PostgresRdfVectorIndex, RdfSparqlAdapter, ShadowRdfQuintStore, SolidRdfEngine, PostgresRdfEngine, SolidRdfSparqlEngine, VectorStore, SqliteVectorStore, PostgresVectorStore, VectorHttpHandler, ProviderRegistry, ProviderRegistryImpl, EmbeddingService, EmbeddingServiceImpl, CredentialReader, CredentialReaderImpl, CloudflareTunnelProvider, LocalTunnelProvider, NgrokTunnelProvider, SubdomainService, MultiDomainIdentifierStrategy, SubdomainPodIdentifierStrategy, DisabledOidcHandler, DisabledIdentityProviderHandler, AutoDetectOidcHandler, AutoDetectIdentityProviderHandler, LoopbackClientIdAdapterFactory, ScopedPickWebIdHandler, UrlAwareRedisLocker, ProvisionPodCreator, ProvisionCodeCodec, LocalPodProvisioningService, SqliteSolidFsSyncJournal, };
|
package/dist/index.js
CHANGED
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
exports.SqliteSolidFsSyncJournal = exports.LocalPodProvisioningService = exports.ProvisionCodeCodec = exports.ProvisionPodCreator = exports.UrlAwareRedisLocker = exports.ScopedPickWebIdHandler = exports.LoopbackClientIdAdapterFactory = exports.AutoDetectIdentityProviderHandler = exports.AutoDetectOidcHandler = exports.DisabledIdentityProviderHandler = exports.DisabledOidcHandler = exports.SubdomainPodIdentifierStrategy = exports.MultiDomainIdentifierStrategy = exports.SubdomainService = exports.NgrokTunnelProvider = exports.LocalTunnelProvider = exports.CloudflareTunnelProvider = exports.CredentialReaderImpl = exports.CredentialReader = exports.EmbeddingServiceImpl = exports.EmbeddingService = exports.ProviderRegistryImpl = exports.ProviderRegistry = exports.VectorHttpHandler = exports.PostgresVectorStore = exports.SqliteVectorStore = exports.VectorStore = exports.SolidRdfSparqlEngine = exports.PostgresRdfEngine = exports.SolidRdfEngine = exports.ShadowRdfQuintStore = exports.RdfSparqlAdapter = exports.PostgresRdfVectorIndex = exports.PostgresRdfTextIndex = exports.RdfVectorIndex = exports.RdfTextIndex = exports.Rdf3xIndex = exports.RdfQuadIndex = exports.RdfTermDictionary = exports.PgQuintStore = exports.SqliteQuintStore = exports.QuintStore = exports.ReactAppViewHandler = exports.PodRoutingHttpHandler = void 0;
|
|
17
|
+
exports.EdgeNodeCertificateService = exports.EdgeNodeAgentInitializer = exports.EdgeNodeAgent = exports.EdgeNodeHealthProbeService = exports.FrpTunnelManager = exports.NoopEdgeNodeTunnelManager = exports.SimpleEdgeNodeTunnelManager = exports.Dns01CertificateProvisioner = exports.EdgeNodeDnsCoordinator = exports.TencentDnsProvider = exports.PerAccountQuotaStrategy = exports.NoopEntitlementProvider = exports.HttpEntitlementProvider = exports.NoopQuotaService = exports.DrizzleQuotaService = exports.BaseKeyValueStorage = exports.SqliteKeyValueStorage = exports.RedisKeyValueStorage = exports.PostgresKeyValueStorage = exports.ValidatingIdentityProviderHttpHandler = exports.DrizzleIndexedStorage = exports.ReservedSuffixIdentifierGenerator = exports.registerDeviceNotificationRuntime = exports.DeviceNotificationTicketHandler = exports.DeviceNotificationWebSocketServer = exports.DeviceNotificationResourceListener = exports.DeviceNotificationHub = exports.TerminalHttpHandler = exports.EdgeNodeCertificateHttpHandler = exports.TracingHandler = exports.RouterHttpRoute = exports.RouterHttpHandler = exports.EdgeNodeProxyHttpHandler = exports.EdgeNodeDirectDebugHttpHandler = exports.ClusterWebSocketConfigurator = exports.ClusterIngressRouter = exports.QuotaAdminHttpHandler = exports.SubgraphSparqlHttpHandler = exports.QuintstoreSparqlEngine = exports.QuadstoreSparqlEngine = exports.SubgraphQueryEngine = exports.SparqlUpdateResourceStore = exports.ConfigurableLoggerFactory = exports.MixDataAccessor = exports.SolidRdfDataAccessor = exports.QuintStoreSparqlDataAccessor = exports.QuadstoreSparqlDataAccessor = exports.MinioDataAccessor = exports.RepresentationPartialConvertingStore = exports.AppStaticAssetHandler = void 0;
|
|
18
|
+
exports.SqliteSolidFsSyncJournal = exports.LocalPodProvisioningService = exports.ProvisionCodeCodec = exports.ProvisionPodCreator = exports.UrlAwareRedisLocker = exports.ScopedPickWebIdHandler = exports.LoopbackClientIdAdapterFactory = exports.AutoDetectIdentityProviderHandler = exports.AutoDetectOidcHandler = exports.DisabledIdentityProviderHandler = exports.DisabledOidcHandler = exports.SubdomainPodIdentifierStrategy = exports.MultiDomainIdentifierStrategy = exports.SubdomainService = exports.NgrokTunnelProvider = exports.LocalTunnelProvider = exports.CloudflareTunnelProvider = exports.CredentialReaderImpl = exports.CredentialReader = exports.EmbeddingServiceImpl = exports.EmbeddingService = exports.ProviderRegistryImpl = exports.ProviderRegistry = exports.VectorHttpHandler = exports.PostgresVectorStore = exports.SqliteVectorStore = exports.VectorStore = exports.SolidRdfSparqlEngine = exports.PostgresRdfEngine = exports.SolidRdfEngine = exports.ShadowRdfQuintStore = exports.RdfSparqlAdapter = exports.PostgresRdfVectorIndex = exports.PostgresRdfTextIndex = exports.RdfVectorIndex = exports.RdfTextIndex = exports.Rdf3xIndex = exports.RdfQuadIndex = exports.RdfTermDictionary = exports.PgQuintStore = exports.SqliteQuintStore = exports.QuintStore = exports.ReactAppViewHandler = exports.PodRoutingHttpHandler = exports.CenterNodeRegistrationService = exports.UsageTrackingStore = exports.ClusterIdentifierStrategy = exports.EdgeNodeModeDetector = exports.AcmeCertificateManager = void 0;
|
|
19
19
|
require("./runtime/configure-drizzle-solid");
|
|
20
20
|
const RepresentationPartialConvertingStore_1 = require("./storage/RepresentationPartialConvertingStore");
|
|
21
21
|
Object.defineProperty(exports, "RepresentationPartialConvertingStore", { enumerable: true, get: function () { return RepresentationPartialConvertingStore_1.RepresentationPartialConvertingStore; } });
|
|
@@ -60,6 +60,16 @@ const TracingHandler_1 = require("./http/TracingHandler");
|
|
|
60
60
|
Object.defineProperty(exports, "TracingHandler", { enumerable: true, get: function () { return TracingHandler_1.TracingHandler; } });
|
|
61
61
|
const TerminalHttpHandler_1 = require("./http/terminal/TerminalHttpHandler");
|
|
62
62
|
Object.defineProperty(exports, "TerminalHttpHandler", { enumerable: true, get: function () { return TerminalHttpHandler_1.TerminalHttpHandler; } });
|
|
63
|
+
const DeviceNotificationHub_1 = require("./notifications/DeviceNotificationHub");
|
|
64
|
+
Object.defineProperty(exports, "DeviceNotificationHub", { enumerable: true, get: function () { return DeviceNotificationHub_1.DeviceNotificationHub; } });
|
|
65
|
+
const DeviceNotificationResourceListener_1 = require("./notifications/DeviceNotificationResourceListener");
|
|
66
|
+
Object.defineProperty(exports, "DeviceNotificationResourceListener", { enumerable: true, get: function () { return DeviceNotificationResourceListener_1.DeviceNotificationResourceListener; } });
|
|
67
|
+
const DeviceNotificationWebSocketServer_1 = require("./http/DeviceNotificationWebSocketServer");
|
|
68
|
+
Object.defineProperty(exports, "DeviceNotificationWebSocketServer", { enumerable: true, get: function () { return DeviceNotificationWebSocketServer_1.DeviceNotificationWebSocketServer; } });
|
|
69
|
+
const DeviceNotificationTicketHandler_1 = require("./api/handlers/DeviceNotificationTicketHandler");
|
|
70
|
+
Object.defineProperty(exports, "DeviceNotificationTicketHandler", { enumerable: true, get: function () { return DeviceNotificationTicketHandler_1.DeviceNotificationTicketHandler; } });
|
|
71
|
+
const DeviceNotificationRuntime_1 = require("./api/handlers/DeviceNotificationRuntime");
|
|
72
|
+
Object.defineProperty(exports, "registerDeviceNotificationRuntime", { enumerable: true, get: function () { return DeviceNotificationRuntime_1.registerDeviceNotificationRuntime; } });
|
|
63
73
|
const EdgeNodeCertificateHttpHandler_1 = require("./http/admin/EdgeNodeCertificateHttpHandler");
|
|
64
74
|
Object.defineProperty(exports, "EdgeNodeCertificateHttpHandler", { enumerable: true, get: function () { return EdgeNodeCertificateHttpHandler_1.EdgeNodeCertificateHttpHandler; } });
|
|
65
75
|
const ReservedSuffixIdentifierGenerator_1 = require("./pods/ReservedSuffixIdentifierGenerator");
|
|
@@ -207,6 +217,7 @@ const SolidFsSyncJournal_1 = require("./solidfs/SolidFsSyncJournal");
|
|
|
207
217
|
Object.defineProperty(exports, "SqliteSolidFsSyncJournal", { enumerable: true, get: function () { return SolidFsSyncJournal_1.SqliteSolidFsSyncJournal; } });
|
|
208
218
|
__exportStar(require("./api/reconciler"), exports);
|
|
209
219
|
__exportStar(require("./edge/reachability"), exports);
|
|
220
|
+
__exportStar(require("./notifications"), exports);
|
|
210
221
|
// Export the new AppStaticAssetHandler
|
|
211
222
|
var AppStaticAssetHandler_1 = require("./http/AppStaticAssetHandler");
|
|
212
223
|
Object.defineProperty(exports, "AppStaticAssetHandler", { enumerable: true, get: function () { return AppStaticAssetHandler_1.AppStaticAssetHandler; } });
|