@activeledger/activestorage 4.5.13 → 4.5.15

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.
Files changed (126) hide show
  1. package/README.md +1 -1
  2. package/es/cache.d.ts +18 -0
  3. package/es/cache.d.ts.map +1 -0
  4. package/es/cache.js +57 -0
  5. package/es/cache.js.map +1 -0
  6. package/es/datastore.d.ts +11 -0
  7. package/es/datastore.d.ts.map +1 -0
  8. package/es/datastore.js +67 -0
  9. package/es/datastore.js.map +1 -0
  10. package/es/driver.d.ts +15 -0
  11. package/es/driver.d.ts.map +1 -0
  12. package/es/driver.js +2 -0
  13. package/es/driver.js.map +1 -0
  14. package/es/drivers/leveldb.d.ts +20 -0
  15. package/es/drivers/leveldb.d.ts.map +1 -0
  16. package/es/drivers/leveldb.js +121 -0
  17. package/es/drivers/leveldb.js.map +1 -0
  18. package/es/drivers/rocksdb.d.ts +20 -0
  19. package/es/drivers/rocksdb.d.ts.map +1 -0
  20. package/es/drivers/rocksdb.js +98 -0
  21. package/es/drivers/rocksdb.js.map +1 -0
  22. package/es/heartbeat.d.ts +6 -0
  23. package/es/heartbeat.d.ts.map +1 -0
  24. package/es/heartbeat.js +15 -0
  25. package/es/heartbeat.js.map +1 -0
  26. package/es/index.d.ts +3 -0
  27. package/es/index.d.ts.map +1 -0
  28. package/es/index.js +3 -0
  29. package/es/index.js.map +1 -0
  30. package/es/levelme.d.ts +82 -0
  31. package/es/levelme.d.ts.map +1 -0
  32. package/es/levelme.js +476 -0
  33. package/es/levelme.js.map +1 -0
  34. package/es/newlinestream.d.ts +3 -0
  35. package/es/newlinestream.d.ts.map +1 -0
  36. package/es/newlinestream.js +28 -0
  37. package/es/newlinestream.js.map +1 -0
  38. package/es/selfhost.d.ts +2 -0
  39. package/es/selfhost.d.ts.map +1 -0
  40. package/es/selfhost.js +479 -0
  41. package/es/selfhost.js.map +1 -0
  42. package/es/sse.d.ts +10 -0
  43. package/es/sse.d.ts.map +1 -0
  44. package/es/sse.js +41 -0
  45. package/es/sse.js.map +1 -0
  46. package/lib/cache.d.ts +18 -0
  47. package/lib/cache.d.ts.map +1 -0
  48. package/lib/cache.js +62 -0
  49. package/lib/cache.js.map +1 -0
  50. package/lib/datastore.d.ts +11 -0
  51. package/lib/datastore.d.ts.map +1 -0
  52. package/lib/datastore.js +94 -0
  53. package/lib/datastore.js.map +1 -0
  54. package/lib/driver.d.ts +15 -0
  55. package/lib/driver.d.ts.map +1 -0
  56. package/lib/driver.js +3 -0
  57. package/lib/driver.js.map +1 -0
  58. package/lib/drivers/leveldb.d.ts +20 -0
  59. package/lib/drivers/leveldb.d.ts.map +1 -0
  60. package/lib/drivers/leveldb.js +125 -0
  61. package/lib/drivers/leveldb.js.map +1 -0
  62. package/lib/drivers/rocksdb.d.ts +20 -0
  63. package/lib/drivers/rocksdb.d.ts.map +1 -0
  64. package/lib/drivers/rocksdb.js +102 -0
  65. package/lib/drivers/rocksdb.js.map +1 -0
  66. package/lib/heartbeat.d.ts +6 -0
  67. package/lib/heartbeat.d.ts.map +1 -0
  68. package/lib/heartbeat.js +19 -0
  69. package/lib/heartbeat.js.map +1 -0
  70. package/lib/index.d.ts +3 -0
  71. package/lib/index.d.ts.map +1 -0
  72. package/lib/index.js +6 -0
  73. package/lib/index.js.map +1 -0
  74. package/lib/levelme.d.ts +82 -0
  75. package/lib/levelme.d.ts.map +1 -0
  76. package/lib/levelme.js +503 -0
  77. package/lib/levelme.js.map +1 -0
  78. package/lib/newlinestream.d.ts +3 -0
  79. package/lib/newlinestream.d.ts.map +1 -0
  80. package/lib/newlinestream.js +31 -0
  81. package/lib/newlinestream.js.map +1 -0
  82. package/lib/selfhost.d.ts +2 -0
  83. package/lib/selfhost.d.ts.map +1 -0
  84. package/lib/selfhost.js +504 -0
  85. package/lib/selfhost.js.map +1 -0
  86. package/lib/sse.d.ts +10 -0
  87. package/lib/sse.d.ts.map +1 -0
  88. package/lib/sse.js +45 -0
  89. package/lib/sse.js.map +1 -0
  90. package/package.json +9 -5
  91. package/src/cache.ts +0 -72
  92. package/src/datastore.ts +0 -191
  93. package/src/driver.ts +0 -18
  94. package/src/drivers/leveldb.ts +0 -145
  95. package/src/drivers/rocksdb.ts +0 -118
  96. package/src/heartbeat.ts +0 -60
  97. package/src/index.ts +0 -25
  98. package/src/levelme.ts +0 -938
  99. package/src/newlinestream.ts +0 -32
  100. package/src/selfhost.ts +0 -1104
  101. package/src/sse.ts +0 -136
  102. package/src/types/rocksdb.d.ts +0 -1
  103. package/tsconfig.json +0 -8
  104. /package/{src → lib}/fauxton/dashboard.assets/css/styles.d43d3249088a6c04b633.css +0 -0
  105. /package/{src → lib}/fauxton/dashboard.assets/fonts/fauxtonicon5.eot +0 -0
  106. /package/{src → lib}/fauxton/dashboard.assets/fonts/fauxtonicon5.ttf +0 -0
  107. /package/{src → lib}/fauxton/dashboard.assets/fonts/fauxtonicon5.woff +0 -0
  108. /package/{src → lib}/fauxton/dashboard.assets/fonts/fontawesome-webfont.eot +0 -0
  109. /package/{src → lib}/fauxton/dashboard.assets/fonts/fontawesome-webfont.ttf +0 -0
  110. /package/{src → lib}/fauxton/dashboard.assets/fonts/fontawesome-webfont.woff +0 -0
  111. /package/{src → lib}/fauxton/dashboard.assets/img/activeledger-logo.png +0 -0
  112. /package/{src → lib}/fauxton/dashboard.assets/img/activeledger.png +0 -0
  113. /package/{src → lib}/fauxton/dashboard.assets/img/asf-feather-logo.png +0 -0
  114. /package/{src → lib}/fauxton/dashboard.assets/img/couch-watermark.png +0 -0
  115. /package/{src → lib}/fauxton/dashboard.assets/img/couchdb-logo.png +0 -0
  116. /package/{src → lib}/fauxton/dashboard.assets/img/fauxtonicon5.svg +0 -0
  117. /package/{src → lib}/fauxton/dashboard.assets/img/fontawesome-webfont.svg +0 -0
  118. /package/{src → lib}/fauxton/dashboard.assets/img/github.png +0 -0
  119. /package/{src → lib}/fauxton/dashboard.assets/img/googleplus.png +0 -0
  120. /package/{src → lib}/fauxton/dashboard.assets/img/linkedin.png +0 -0
  121. /package/{src → lib}/fauxton/dashboard.assets/img/loader.gif +0 -0
  122. /package/{src → lib}/fauxton/dashboard.assets/img/twitter.png +0 -0
  123. /package/{src → lib}/fauxton/dashboard.assets/js/bundle.d43d3249088a6c04b633.js +0 -0
  124. /package/{src → lib}/fauxton/dashboard.assets/js/manifest.a154524a560e5f6f431b.js +0 -0
  125. /package/{src → lib}/fauxton/dashboard.assets/js/vendor.156793045cdeb7c63707.js +0 -0
  126. /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
- }
@@ -1 +0,0 @@
1
- declare module '@nxtedition/rocksdb';
package/tsconfig.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "extends": "../tsconfig.settings.json",
3
- "compilerOptions": {
4
- "rootDir": "src",
5
- "esModuleInterop": true,
6
- "skipLibCheck": true
7
- }
8
- }
File without changes