corebasic 1.0.233 → 1.0.234
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/dist/libs/dipper.js +1 -1
- package/dist/libs/messaging.js +1 -1
- package/libs/dipper.ts +1 -1
- package/libs/kafka.ts +1 -1
- package/libs/messaging.ts +14 -12
- package/package.json +1 -1
package/dist/libs/dipper.js
CHANGED
|
@@ -30,7 +30,7 @@ function shard(key) {
|
|
|
30
30
|
}
|
|
31
31
|
export let shard_hits = {};
|
|
32
32
|
async function postDip(url, arg) {
|
|
33
|
-
return (await axios.post(url, arg)).data;
|
|
33
|
+
return (await axios.post(String(url), arg)).data;
|
|
34
34
|
// curl
|
|
35
35
|
// -----
|
|
36
36
|
// const { data } = await curly.post(url, {
|
package/dist/libs/messaging.js
CHANGED
|
@@ -53,7 +53,7 @@ export async function start(app) {
|
|
|
53
53
|
await consumer.connect();
|
|
54
54
|
publisher = createClient({ url });
|
|
55
55
|
await publisher.connect();
|
|
56
|
-
consumer.on('error', err => console.log('Redis Client Error', err));
|
|
56
|
+
consumer.on('error', (err) => console.log('Redis Client Error', err));
|
|
57
57
|
app.get('/messages/:user', async (req, res) => {
|
|
58
58
|
let uid = req.body.client;
|
|
59
59
|
await connect({ user: req.params.user, req, res, uid });
|
package/libs/dipper.ts
CHANGED
|
@@ -51,7 +51,7 @@ function shard(key: string) {
|
|
|
51
51
|
export let shard_hits: Record<string, number> = {}
|
|
52
52
|
|
|
53
53
|
async function postDip(url: string | URL, arg: unknown) {
|
|
54
|
-
return (await axios.post(url, arg)).data
|
|
54
|
+
return (await axios.post(String(url), arg)).data
|
|
55
55
|
// curl
|
|
56
56
|
// -----
|
|
57
57
|
// const { data } = await curly.post(url, {
|
package/libs/kafka.ts
CHANGED
package/libs/messaging.ts
CHANGED
|
@@ -10,20 +10,22 @@ const url = process.env.REDIS_URL || "redis://localhost:6380"
|
|
|
10
10
|
|
|
11
11
|
// url: 'redis://alice:foobared@localhost:6380'
|
|
12
12
|
|
|
13
|
+
type RedisConsumer = ReturnType<typeof createClient>;
|
|
14
|
+
type RedisPublisher = ReturnType<typeof createClient>;
|
|
13
15
|
|
|
14
16
|
type RedisListener = (message: string, channel: string) => void
|
|
15
17
|
|
|
16
|
-
type RedisConsumer = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type RedisPublisher = {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
18
|
+
// type RedisConsumer = {
|
|
19
|
+
// connect: () => Promise<void>
|
|
20
|
+
// subscribe: (channel: string, listener: RedisListener) => Promise<void>
|
|
21
|
+
// unsubscribe: (channel: string, listener: RedisListener) => Promise<void>
|
|
22
|
+
// on: (event: string, listener: (err: unknown) => void) => void
|
|
23
|
+
// }
|
|
24
|
+
//
|
|
25
|
+
// type RedisPublisher = {
|
|
26
|
+
// connect: () => Promise<void>
|
|
27
|
+
// publish: (channel: string, message: string) => Promise<unknown>
|
|
28
|
+
// }
|
|
27
29
|
|
|
28
30
|
type Request = {
|
|
29
31
|
body: {
|
|
@@ -123,7 +125,7 @@ export async function start(app: ExpressApp) {
|
|
|
123
125
|
publisher = createClient({ url });
|
|
124
126
|
await publisher.connect();
|
|
125
127
|
|
|
126
|
-
consumer.on('error', err => console.log('Redis Client Error', err));
|
|
128
|
+
consumer.on('error', (err: any) => console.log('Redis Client Error', err));
|
|
127
129
|
|
|
128
130
|
app.get('/messages/:user', async (req, res) => {
|
|
129
131
|
let uid = req.body.client
|