@jcbuisson/express-x-plugins 4.0.8 → 4.0.9
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 -3
- package/package.json +1 -1
- package/src/electric-client-plugin.mjs +10 -11
- package/src/reload-client-plugin.mjs +2 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# express-x-plugins
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
IMPORTANT
|
|
5
|
+
IMPORTANT FOR ELECTRIC
|
|
6
6
|
|
|
7
7
|
# set lc_messages=C for the PostgreSQL role so Electric receives recognizable English errors
|
|
8
8
|
ALTER ROLE chris SET lc_messages = 'C';
|
|
@@ -13,9 +13,10 @@ ALTER SYSTEM SET max_replication_slots = 10;
|
|
|
13
13
|
ALTER SYSTEM SET max_wal_senders = 10;
|
|
14
14
|
ALTER ROLE chris WITH REPLICATION;
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
sudo systemctl restart postgresql
|
|
16
|
+
(restart postgres: `sudo systemctl restart postgresql`)
|
|
18
17
|
|
|
18
|
+
## Use HTTP2
|
|
19
|
+
nginx: `listen 443 ssl http2;`
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
Currently includes:
|
package/package.json
CHANGED
|
@@ -2,17 +2,6 @@ import { Shape, ShapeStream } from '@electric-sql/client'
|
|
|
2
2
|
import { firstValueFrom, Observable, Subject, takeUntil } from 'rxjs'
|
|
3
3
|
import { getCurrentScope, onScopeDispose, ref } from 'vue'
|
|
4
4
|
|
|
5
|
-
export class DisposableShape extends Shape {
|
|
6
|
-
subscribe(callback) {
|
|
7
|
-
const unsubscribe = super.subscribe(callback)
|
|
8
|
-
return () => {
|
|
9
|
-
unsubscribe()
|
|
10
|
-
if (this.numSubscribers === 0) this.stream.unsubscribeAll()
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
5
|
/**
|
|
17
6
|
* Add Electric-backed reactive models to an Express-X client.
|
|
18
7
|
*
|
|
@@ -100,6 +89,16 @@ export function electricClientPlugin(app, options = {}) {
|
|
|
100
89
|
|
|
101
90
|
////////////////////// UTILITIES //////////////////////
|
|
102
91
|
|
|
92
|
+
export class DisposableShape extends Shape {
|
|
93
|
+
subscribe(callback) {
|
|
94
|
+
const unsubscribe = super.subscribe(callback)
|
|
95
|
+
return () => {
|
|
96
|
+
unsubscribe()
|
|
97
|
+
if (this.numSubscribers === 0) this.stream.unsubscribeAll()
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
103
102
|
const IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/
|
|
104
103
|
const RANGE_OPERATORS = { gt: '>', gte: '>=', lt: '<', lte: '<=' }
|
|
105
104
|
|