@based/client 4.0.9 → 4.1.1
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/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/getUrlFromOpts.d.ts +0 -3
- package/dist/getUrlFromOpts.js +0 -27
- package/dist/getUrlFromOpts.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export declare class BasedClient extends Emitter {
|
|
|
103
103
|
.subscribe(event => console.info(event))
|
|
104
104
|
|
|
105
105
|
client.channel('events', { type: 'pageview' })
|
|
106
|
-
.publish({
|
|
106
|
+
.publish({ path: '/home' })
|
|
107
107
|
```
|
|
108
108
|
*/
|
|
109
109
|
channel(name: string, payload?: any): BasedChannel;
|
package/dist/index.js
CHANGED
|
@@ -223,7 +223,7 @@ class BasedClient extends Emitter_1.default {
|
|
|
223
223
|
.subscribe(event => console.info(event))
|
|
224
224
|
|
|
225
225
|
client.channel('events', { type: 'pageview' })
|
|
226
|
-
.publish({
|
|
226
|
+
.publish({ path: '/home' })
|
|
227
227
|
```
|
|
228
228
|
*/
|
|
229
229
|
channel(name, payload) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@based/client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"nodemon": "^2.0.20",
|
|
37
|
-
"@based/functions": "^
|
|
37
|
+
"@based/functions": "^2.0.1",
|
|
38
38
|
"concurrently": "^7.1.0",
|
|
39
39
|
"@saulx/utils": "^3.2.2",
|
|
40
40
|
"@saulx/aristotle": "^4.3.0",
|
package/dist/getUrlFromOpts.d.ts
DELETED
package/dist/getUrlFromOpts.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
7
|
-
exports.default = async (opts) => {
|
|
8
|
-
if (opts.url) {
|
|
9
|
-
return opts.url;
|
|
10
|
-
}
|
|
11
|
-
const discoveryUrls = opts.discoveryUrls || [
|
|
12
|
-
`https://${opts.org}-${opts.project}-${opts.env}.based.io`,
|
|
13
|
-
];
|
|
14
|
-
while (true) {
|
|
15
|
-
for (const hubDiscoveryUrl of discoveryUrls) {
|
|
16
|
-
const dUrl = `${hubDiscoveryUrl}/status?hub=${opts.name || '@based/env-hub'}&key=${opts.key}`;
|
|
17
|
-
const res = await (0, cross_fetch_1.default)(dUrl).catch(() => ({ ok: false }));
|
|
18
|
-
if (res.ok) {
|
|
19
|
-
const hubs = (await res.json());
|
|
20
|
-
const [hubUrl] = hubs[~~(Math.random() * hubs.length)];
|
|
21
|
-
return hubUrl;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
await new Promise((resolve) => setTimeout(resolve, 5e3 + ~~(Math.random() * 1e3)));
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=getUrlFromOpts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getUrlFromOpts.js","sourceRoot":"","sources":["../src/getUrlFromOpts.ts"],"names":[],"mappings":";;;;;AACA,8DAA+B;AAE/B,kBAAe,KAAK,EAClB,IAAe,EAC4B,EAAE;IAC7C,IAAI,IAAI,CAAC,GAAG,EAAE;QACZ,OAAO,IAAI,CAAC,GAAG,CAAA;KAChB;IAED,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,IAAI;QAC1C,WAAW,I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