@welshman/util 0.0.2 → 0.0.5
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/build/Address.cjs +40 -32
- package/build/Address.cjs.map +1 -1
- package/build/Address.d.ts +20 -18
- package/build/Address.mjs +38 -26
- package/build/Address.mjs.map +1 -1
- package/build/Events.cjs +29 -14
- package/build/Events.cjs.map +1 -1
- package/build/Events.d.ts +42 -15
- package/build/Events.mjs +15 -7
- package/build/Events.mjs.map +1 -1
- package/build/Filters.cjs +40 -8
- package/build/Filters.cjs.map +1 -1
- package/build/Filters.d.ts +7 -6
- package/build/Filters.mjs +37 -6
- package/build/Filters.mjs.map +1 -1
- package/build/Kinds.cjs +111 -46
- package/build/Kinds.cjs.map +1 -1
- package/build/Kinds.d.ts +108 -44
- package/build/Kinds.mjs +108 -44
- package/build/Kinds.mjs.map +1 -1
- package/build/Links.cjs +1 -1
- package/build/Links.cjs.map +1 -1
- package/build/Links.mjs +1 -1
- package/build/Links.mjs.map +1 -1
- package/build/Relay.cjs +59 -131
- package/build/Relay.cjs.map +1 -1
- package/build/Relay.d.ts +16 -18
- package/build/Relay.mjs +58 -132
- package/build/Relay.mjs.map +1 -1
- package/build/Repository.cjs +205 -0
- package/build/Repository.cjs.map +1 -0
- package/build/Repository.d.ts +44 -0
- package/build/Repository.mjs +201 -0
- package/build/Repository.mjs.map +1 -0
- package/build/Router.cjs +24 -24
- package/build/Router.cjs.map +1 -1
- package/build/Router.d.ts +68 -28
- package/build/Router.mjs +24 -24
- package/build/Router.mjs.map +1 -1
- package/build/Tags.cjs +17 -19
- package/build/Tags.cjs.map +1 -1
- package/build/Tags.d.ts +2 -9
- package/build/Tags.mjs +18 -20
- package/build/Tags.mjs.map +1 -1
- package/build/index.cjs +1 -1
- package/build/index.cjs.map +1 -1
- package/build/index.d.ts +1 -1
- package/build/index.mjs +1 -1
- package/package.json +2 -3
- package/build/Relays.cjs +0 -36
- package/build/Relays.cjs.map +0 -1
- package/build/Relays.d.ts +0 -6
- package/build/Relays.mjs +0 -31
- package/build/Relays.mjs.map +0 -1
package/build/Relays.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { normalizeUrl, stripProtocol } from '@welshman/lib';
|
|
2
|
-
export const isShareableRelayUrl = (url) => {
|
|
3
|
-
var _a;
|
|
4
|
-
return Boolean(typeof url === 'string' &&
|
|
5
|
-
// Is it actually a websocket url and has a dot
|
|
6
|
-
url.match(/^wss:\/\/.+\..+/) &&
|
|
7
|
-
// Sometimes bugs cause multiple relays to get concatenated
|
|
8
|
-
((_a = url.match(/:\/\//g)) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
|
|
9
|
-
// It shouldn't have any whitespace, url-encoded or otherwise
|
|
10
|
-
!url.match(/\s|%/) &&
|
|
11
|
-
// Don't match stuff with a port number
|
|
12
|
-
!url.slice(6).match(/:\d+/) &&
|
|
13
|
-
// Don't match raw ip addresses
|
|
14
|
-
!url.slice(6).match(/\d+\.\d+\.\d+\.\d+/) &&
|
|
15
|
-
// Skip nostr.wine's virtual relays
|
|
16
|
-
!url.slice(6).match(/\/npub/));
|
|
17
|
-
};
|
|
18
|
-
export const normalizeRelayUrl = (url, { allowInsecure = false } = {}) => {
|
|
19
|
-
var _a;
|
|
20
|
-
const prefix = allowInsecure ? ((_a = url.match(/^wss?:\/\//)) === null || _a === void 0 ? void 0 : _a[0]) || "wss://" : "wss://";
|
|
21
|
-
// Use our library to normalize
|
|
22
|
-
url = normalizeUrl(url, { stripHash: true, stripAuthentication: false });
|
|
23
|
-
// Strip the protocol since only wss works, lowercase
|
|
24
|
-
url = stripProtocol(url).toLowerCase();
|
|
25
|
-
// Urls without pathnames are supposed to have a trailing slash
|
|
26
|
-
if (!url.includes("/")) {
|
|
27
|
-
url += "/";
|
|
28
|
-
}
|
|
29
|
-
return prefix + url;
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=Relays.mjs.map
|
package/build/Relays.mjs.map
DEL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