@activeledger/activestorage 4.5.12 → 4.5.14
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/es/cache.d.ts +18 -0
- package/es/cache.d.ts.map +1 -0
- package/es/cache.js +57 -0
- package/es/cache.js.map +1 -0
- package/es/datastore.d.ts +11 -0
- package/es/datastore.d.ts.map +1 -0
- package/es/datastore.js +67 -0
- package/es/datastore.js.map +1 -0
- package/es/driver.d.ts +15 -0
- package/es/driver.d.ts.map +1 -0
- package/es/driver.js +2 -0
- package/es/driver.js.map +1 -0
- package/es/drivers/leveldb.d.ts +20 -0
- package/es/drivers/leveldb.d.ts.map +1 -0
- package/es/drivers/leveldb.js +121 -0
- package/es/drivers/leveldb.js.map +1 -0
- package/es/drivers/rocksdb.d.ts +20 -0
- package/es/drivers/rocksdb.d.ts.map +1 -0
- package/es/drivers/rocksdb.js +98 -0
- package/es/drivers/rocksdb.js.map +1 -0
- package/es/heartbeat.d.ts +6 -0
- package/es/heartbeat.d.ts.map +1 -0
- package/es/heartbeat.js +15 -0
- package/es/heartbeat.js.map +1 -0
- package/es/index.d.ts +3 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +3 -0
- package/es/index.js.map +1 -0
- package/es/levelme.d.ts +82 -0
- package/es/levelme.d.ts.map +1 -0
- package/es/levelme.js +488 -0
- package/es/levelme.js.map +1 -0
- package/es/newlinestream.d.ts +3 -0
- package/es/newlinestream.d.ts.map +1 -0
- package/es/newlinestream.js +28 -0
- package/es/newlinestream.js.map +1 -0
- package/es/selfhost.d.ts +2 -0
- package/es/selfhost.d.ts.map +1 -0
- package/es/selfhost.js +479 -0
- package/es/selfhost.js.map +1 -0
- package/es/sse.d.ts +10 -0
- package/es/sse.d.ts.map +1 -0
- package/es/sse.js +41 -0
- package/es/sse.js.map +1 -0
- package/lib/cache.d.ts +18 -0
- package/lib/cache.d.ts.map +1 -0
- package/lib/cache.js +62 -0
- package/lib/cache.js.map +1 -0
- package/lib/datastore.d.ts +11 -0
- package/lib/datastore.d.ts.map +1 -0
- package/lib/datastore.js +94 -0
- package/lib/datastore.js.map +1 -0
- package/lib/driver.d.ts +15 -0
- package/lib/driver.d.ts.map +1 -0
- package/lib/driver.js +3 -0
- package/lib/driver.js.map +1 -0
- package/lib/drivers/leveldb.d.ts +20 -0
- package/lib/drivers/leveldb.d.ts.map +1 -0
- package/lib/drivers/leveldb.js +125 -0
- package/lib/drivers/leveldb.js.map +1 -0
- package/lib/drivers/rocksdb.d.ts +20 -0
- package/lib/drivers/rocksdb.d.ts.map +1 -0
- package/lib/drivers/rocksdb.js +102 -0
- package/lib/drivers/rocksdb.js.map +1 -0
- package/lib/heartbeat.d.ts +6 -0
- package/lib/heartbeat.d.ts.map +1 -0
- package/lib/heartbeat.js +19 -0
- package/lib/heartbeat.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -0
- package/lib/levelme.d.ts +82 -0
- package/lib/levelme.d.ts.map +1 -0
- package/lib/levelme.js +515 -0
- package/lib/levelme.js.map +1 -0
- package/lib/newlinestream.d.ts +3 -0
- package/lib/newlinestream.d.ts.map +1 -0
- package/lib/newlinestream.js +31 -0
- package/lib/newlinestream.js.map +1 -0
- package/lib/selfhost.d.ts +2 -0
- package/lib/selfhost.d.ts.map +1 -0
- package/lib/selfhost.js +504 -0
- package/lib/selfhost.js.map +1 -0
- package/lib/sse.d.ts +10 -0
- package/lib/sse.d.ts.map +1 -0
- package/lib/sse.js +45 -0
- package/lib/sse.js.map +1 -0
- package/package.json +12 -8
- package/src/cache.ts +0 -72
- package/src/datastore.ts +0 -187
- package/src/driver.ts +0 -18
- package/src/drivers/leveldb.ts +0 -145
- package/src/drivers/rocksdb.ts +0 -118
- package/src/heartbeat.ts +0 -60
- package/src/index.ts +0 -25
- package/src/levelme.ts +0 -938
- package/src/newlinestream.ts +0 -32
- package/src/selfhost.ts +0 -1078
- package/src/sse.ts +0 -136
- package/src/types/rocksdb.d.ts +0 -1
- package/tsconfig.json +0 -8
- /package/{src → lib}/fauxton/dashboard.assets/css/styles.d43d3249088a6c04b633.css +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/fonts/fauxtonicon5.eot +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/fonts/fauxtonicon5.ttf +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/fonts/fauxtonicon5.woff +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/fonts/fontawesome-webfont.eot +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/fonts/fontawesome-webfont.ttf +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/fonts/fontawesome-webfont.woff +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/img/activeledger-logo.png +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/img/activeledger.png +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/img/asf-feather-logo.png +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/img/couch-watermark.png +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/img/couchdb-logo.png +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/img/fauxtonicon5.svg +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/img/fontawesome-webfont.svg +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/img/github.png +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/img/googleplus.png +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/img/linkedin.png +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/img/loader.gif +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/img/twitter.png +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/js/bundle.d43d3249088a6c04b633.js +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/js/manifest.a154524a560e5f6f431b.js +0 -0
- /package/{src → lib}/fauxton/dashboard.assets/js/vendor.156793045cdeb7c63707.js +0 -0
- /package/{src → lib}/fauxton/index.html +0 -0
package/src/sse.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* MIT License (MIT)
|
|
3
|
-
* Copyright (c) 2018 Activeledger
|
|
4
|
-
*
|
|
5
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
* in the Software without restriction, including without limitation the rights
|
|
8
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
* furnished to do so, subject to the following conditions:
|
|
11
|
-
*
|
|
12
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
* copies or substantial portions of the Software.
|
|
14
|
-
*
|
|
15
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
* SOFTWARE.
|
|
22
|
-
*/
|
|
23
|
-
import { IActiveHttpResponse } from "@activeledger/httpd/lib/httpd";
|
|
24
|
-
import { HeartBeat } from "./heartbeat";
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Manages SSE Connection
|
|
28
|
-
*
|
|
29
|
-
* @export
|
|
30
|
-
* @class SSE
|
|
31
|
-
*/
|
|
32
|
-
export class SSE {
|
|
33
|
-
private heartBeat: NodeJS.Timeout;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Extra caller-supplied cleanup to run on disconnect, in addition to this
|
|
37
|
-
* class's own (writable=false, stop heartbeat). uWS's res.onAborted()
|
|
38
|
-
* replaces any previously registered callback rather than stacking them -
|
|
39
|
-
* this exists so a caller (e.g. selfhost.ts's /events handler, to
|
|
40
|
-
* deregister its own db.changes() listener) doesn't have to call
|
|
41
|
-
* res.onAborted() a second time and silently clobber this class's own
|
|
42
|
-
* handler.
|
|
43
|
-
*
|
|
44
|
-
* @private
|
|
45
|
-
*/
|
|
46
|
-
private disconnectCallback?: () => void;
|
|
47
|
-
|
|
48
|
-
constructor(private res: IActiveHttpResponse) {
|
|
49
|
-
// Make sure we have an array
|
|
50
|
-
//res.statusCode = 200;
|
|
51
|
-
|
|
52
|
-
// Set Header
|
|
53
|
-
res.cork(() => {
|
|
54
|
-
res.writeHeader(`Content-type`, `text/event-stream`);
|
|
55
|
-
res.writeHeader(`Connection`, `keep-alive`);
|
|
56
|
-
res.writeHeader(`Cache-Control`, `no-cache`);
|
|
57
|
-
res.writeHeader(`X-Accel-Buffering`, `no`);
|
|
58
|
-
res.writeStatus(`200 OK`);
|
|
59
|
-
// Shows connection as open
|
|
60
|
-
res.write(":\n\n");
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
/*
|
|
64
|
-
Ngnix recommend values:
|
|
65
|
-
proxy_set_header Connection '';
|
|
66
|
-
proxy_http_version 1.1;
|
|
67
|
-
proxy_connect_timeout 24h;
|
|
68
|
-
proxy_read_timeout 24h;
|
|
69
|
-
*/
|
|
70
|
-
// Prevents proxy buffering
|
|
71
|
-
// res.setHeader("X-Accel-Buffering", "no");
|
|
72
|
-
// if (req.httpVersion !== "2.0") {
|
|
73
|
-
// res.setHeader("Connection", "keep-alive");
|
|
74
|
-
// }
|
|
75
|
-
|
|
76
|
-
// Native TCP Keepalive optimal
|
|
77
|
-
// res.shouldKeepAlive = true;
|
|
78
|
-
// res.setTimeout(0);
|
|
79
|
-
// res.setNoDelay(true);
|
|
80
|
-
// res.setKeepAlive(true);
|
|
81
|
-
|
|
82
|
-
// Setup Heartbeat
|
|
83
|
-
this.heartBeat = HeartBeat.Start(res);
|
|
84
|
-
|
|
85
|
-
// On disconnect remove listener
|
|
86
|
-
// res.on("close", () => {
|
|
87
|
-
// // Clear Heartbeat
|
|
88
|
-
// HeartBeat.Stop(heartBeat);
|
|
89
|
-
// });
|
|
90
|
-
|
|
91
|
-
res.onAborted(() => {
|
|
92
|
-
res.writable = false;
|
|
93
|
-
HeartBeat.Stop(this.heartBeat);
|
|
94
|
-
if (this.disconnectCallback) {
|
|
95
|
-
this.disconnectCallback();
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Register extra cleanup to run immediately on disconnect (in the same
|
|
102
|
-
* onAborted callback this class already owns), instead of only being
|
|
103
|
-
* discovered reactively the next time write() is called and notices
|
|
104
|
-
* res.writable is false. On a quiet stream that could otherwise be a long
|
|
105
|
-
* time - or never - after the client actually disconnects.
|
|
106
|
-
*
|
|
107
|
-
* @param {() => void} callback
|
|
108
|
-
*/
|
|
109
|
-
public onDisconnect(callback: () => void): void {
|
|
110
|
-
this.disconnectCallback = callback;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Write to the SSE stream
|
|
115
|
-
*
|
|
116
|
-
* @param {(number | string)} sequence
|
|
117
|
-
* @param {unknown} prepare
|
|
118
|
-
* @returns {boolean}
|
|
119
|
-
*/
|
|
120
|
-
public write(sequence: number | string, prepare: unknown): boolean {
|
|
121
|
-
// Connection still open?
|
|
122
|
-
if (this.res.writable) {
|
|
123
|
-
this.res.cork(() => {
|
|
124
|
-
this.res.write(
|
|
125
|
-
`id:${sequence}\nevent: message\ndata:${JSON.stringify(prepare)}\n\n`
|
|
126
|
-
);
|
|
127
|
-
});
|
|
128
|
-
return true;
|
|
129
|
-
} else {
|
|
130
|
-
// End Server Side
|
|
131
|
-
//this.res.end();
|
|
132
|
-
HeartBeat.Stop(this.heartBeat);
|
|
133
|
-
return false;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
package/src/types/rocksdb.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare module '@nxtedition/rocksdb';
|
package/tsconfig.json
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|