@candypoets/nipworker 0.92.0 → 0.93.0
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 +68 -293
- package/dist/cache/index.js +52 -52
- package/dist/cache/pkg/cache.d.ts +2 -2
- package/dist/cache/pkg/cache_bg.wasm.d.ts +2 -2
- package/dist/connections/index.js +21 -21
- package/dist/connections/pkg/connections.d.ts +5 -5
- package/dist/connections/pkg/connections_bg.wasm.d.ts +5 -5
- package/dist/connections/proxy.js +1 -1
- package/dist/connections/proxy.js.map +3 -3
- package/dist/crypto/index.js +34 -34
- package/dist/generated/nostr/fb/video-data.d.ts +6 -2
- package/dist/generated/nostr/fb/video-data.d.ts.map +1 -1
- package/dist/hooks.d.ts +1 -0
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +55 -55
- package/dist/parser/index.js +305 -305
- package/dist/worker-message.js +83 -74
- package/package.json +1 -1
|
@@ -9,18 +9,22 @@ export declare class VideoData implements flatbuffers.IUnpackableObject<VideoDat
|
|
|
9
9
|
url(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
|
10
10
|
thumbnail(): string | null;
|
|
11
11
|
thumbnail(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
|
12
|
+
dim(): string | null;
|
|
13
|
+
dim(optionalEncoding: flatbuffers.Encoding): string | Uint8Array | null;
|
|
12
14
|
static startVideoData(builder: flatbuffers.Builder): void;
|
|
13
15
|
static addUrl(builder: flatbuffers.Builder, urlOffset: flatbuffers.Offset): void;
|
|
14
16
|
static addThumbnail(builder: flatbuffers.Builder, thumbnailOffset: flatbuffers.Offset): void;
|
|
17
|
+
static addDim(builder: flatbuffers.Builder, dimOffset: flatbuffers.Offset): void;
|
|
15
18
|
static endVideoData(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
16
|
-
static createVideoData(builder: flatbuffers.Builder, urlOffset: flatbuffers.Offset, thumbnailOffset: flatbuffers.Offset): flatbuffers.Offset;
|
|
19
|
+
static createVideoData(builder: flatbuffers.Builder, urlOffset: flatbuffers.Offset, thumbnailOffset: flatbuffers.Offset, dimOffset: flatbuffers.Offset): flatbuffers.Offset;
|
|
17
20
|
unpack(): VideoDataT;
|
|
18
21
|
unpackTo(_o: VideoDataT): void;
|
|
19
22
|
}
|
|
20
23
|
export declare class VideoDataT implements flatbuffers.IGeneratedObject {
|
|
21
24
|
url: string | Uint8Array | null;
|
|
22
25
|
thumbnail: string | Uint8Array | null;
|
|
23
|
-
|
|
26
|
+
dim: string | Uint8Array | null;
|
|
27
|
+
constructor(url?: string | Uint8Array | null, thumbnail?: string | Uint8Array | null, dim?: string | Uint8Array | null);
|
|
24
28
|
pack(builder: flatbuffers.Builder): flatbuffers.Offset;
|
|
25
29
|
}
|
|
26
30
|
//# sourceMappingURL=video-data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-data.d.ts","sourceRoot":"","sources":["../../../../src/generated/nostr/fb/video-data.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,WAAW,MAAM,aAAa,CAAC;AAI3C,qBAAa,SAAU,YAAW,WAAW,CAAC,iBAAiB,CAAC,UAAU,CAAC;IACzE,EAAE,EAAE,WAAW,CAAC,UAAU,GAAC,IAAI,CAAQ;IACvC,MAAM,SAAK;IACX,MAAM,CAAC,CAAC,EAAC,MAAM,EAAE,EAAE,EAAC,WAAW,CAAC,UAAU,GAAE,SAAS;IAMvD,MAAM,CAAC,kBAAkB,CAAC,EAAE,EAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,EAAC,SAAS,GAAE,SAAS;IAI9E,MAAM,CAAC,8BAA8B,CAAC,EAAE,EAAC,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC,EAAC,SAAS,GAAE,SAAS;IAK1F,GAAG,IAAG,MAAM,GAAC,IAAI;IACjB,GAAG,CAAC,gBAAgB,EAAC,WAAW,CAAC,QAAQ,GAAE,MAAM,GAAC,UAAU,G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,UAAU,GAAC,IAAI;gBAF3B,GAAG,GAAE,MAAM,GAAC,UAAU,GAAC,IAAW,EAClC,SAAS,GAAE,MAAM,GAAC,UAAU,GAAC,IAAW,EACxC,GAAG,GAAE,MAAM,GAAC,UAAU,GAAC,IAAW;IAI3C,IAAI,CAAC,OAAO,EAAC,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,MAAM;CAWpD"}
|
package/dist/hooks.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare function useSubscription(subId: string, requests: RequestObject[]
|
|
|
13
13
|
export declare function usePublish(pubId: string, event: EventTemplate, callback?: (message: WorkerMessage) => void, options?: {
|
|
14
14
|
trackStatus?: boolean;
|
|
15
15
|
defaultRelays?: string[];
|
|
16
|
+
subId?: string | string[];
|
|
16
17
|
}): () => void;
|
|
17
18
|
export declare function useSignEvent(template: EventTemplate, callback: (event: Event) => void): void;
|
|
18
19
|
//# sourceMappingURL=hooks.d.ts.map
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAc,KAAK,kBAAkB,EAAE,MAAM,GAAG,CAAC;AAEvE,OAAO,EACN,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,MAAM,EACN,aAAa,EACb,YAAY,EACZ,MAAM,mBAAmB,CAAC;AAG3B,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;AAE5F;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,aAAa,cA4BrD;AAED,wBAAgB,eAAe,CAC9B,KAAK,EAA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,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAI1B,GACC,MAAM,IAAI,CA8CZ;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,QAIrF"}
|
package/dist/hooks.js
CHANGED
|
@@ -1,94 +1,94 @@
|
|
|
1
|
-
import { g as
|
|
2
|
-
import { e as M, d as k, b as w, c as
|
|
1
|
+
import { g as r, A as E } from "./index2.js";
|
|
2
|
+
import { e as M, d as k, b as w, c as A, a as N, i as $ } from "./NarrowTypes.js";
|
|
3
3
|
function S(e) {
|
|
4
4
|
let n = false;
|
|
5
|
-
const
|
|
6
|
-
for (const [s, { status:
|
|
7
|
-
e(
|
|
8
|
-
const
|
|
5
|
+
const f = r().getRelayStatuses();
|
|
6
|
+
for (const [s, { status: a }] of f)
|
|
7
|
+
e(a, s);
|
|
8
|
+
const t = (s) => {
|
|
9
9
|
if (n) return;
|
|
10
|
-
const
|
|
11
|
-
e(u,
|
|
10
|
+
const a = s, { status: u, url: c } = a.detail;
|
|
11
|
+
e(u, c);
|
|
12
12
|
};
|
|
13
|
-
return
|
|
14
|
-
n = true,
|
|
13
|
+
return r().addEventListener("relay:status", t), () => {
|
|
14
|
+
n = true, r().removeEventListener("relay:status", t);
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
},
|
|
17
|
+
function y(e, n, f = () => {
|
|
18
|
+
}, t = { closeOnEose: false }) {
|
|
19
19
|
if (!e)
|
|
20
20
|
return () => {
|
|
21
21
|
};
|
|
22
|
-
let s = null,
|
|
23
|
-
e =
|
|
24
|
-
let
|
|
25
|
-
const
|
|
22
|
+
let s = null, a = 4, u = true, c = false, d = false;
|
|
23
|
+
e = r().createShortId(e);
|
|
24
|
+
let l = false, i = false;
|
|
25
|
+
const v = () => {
|
|
26
26
|
if (!u || !s) {
|
|
27
|
-
|
|
27
|
+
i = false;
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
if (!
|
|
31
|
-
|
|
30
|
+
if (!i) {
|
|
31
|
+
i = true;
|
|
32
32
|
try {
|
|
33
|
-
let
|
|
34
|
-
for (;
|
|
35
|
-
for (const
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
let o = E.readMessages(s, a);
|
|
34
|
+
for (; o.hasNewData && s; ) {
|
|
35
|
+
for (const g of o.messages)
|
|
36
|
+
f(g);
|
|
37
|
+
a = o.newReadPosition, o = E.readMessages(s, a);
|
|
38
38
|
}
|
|
39
|
-
} catch (
|
|
40
|
-
console.error("[useSubscription processEvents] error:",
|
|
39
|
+
} catch (o) {
|
|
40
|
+
console.error("[useSubscription processEvents] error:", o);
|
|
41
41
|
} finally {
|
|
42
|
-
|
|
42
|
+
i = false;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
},
|
|
46
|
-
u && (
|
|
47
|
-
|
|
45
|
+
}, b = () => {
|
|
46
|
+
u && (l || (l = true, queueMicrotask(() => {
|
|
47
|
+
l = false, v();
|
|
48
48
|
})));
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
s = null,
|
|
49
|
+
}, h = () => {
|
|
50
|
+
c || (u = false, d && (r().removeEventListener(`subscription:${e}`, b), r().unsubscribe(e), c = true), Promise.resolve().then(() => {
|
|
51
|
+
s = null, a = 4;
|
|
52
52
|
}));
|
|
53
53
|
};
|
|
54
|
-
return s =
|
|
54
|
+
return s = r().subscribe(e, n, t), d = true, r().addEventListener(`subscription:${e}`, b), b(), h;
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
},
|
|
56
|
+
function P(e, n, f = () => {
|
|
57
|
+
}, t = {
|
|
58
58
|
trackStatus: true,
|
|
59
59
|
defaultRelays: []
|
|
60
60
|
}) {
|
|
61
61
|
if (!e)
|
|
62
62
|
return () => {
|
|
63
63
|
};
|
|
64
|
-
|
|
65
|
-
let s = null,
|
|
64
|
+
t = { trackStatus: true, ...t };
|
|
65
|
+
let s = null, a = 4, u = true;
|
|
66
|
+
const c = () => {
|
|
67
|
+
u = false, r().removeEventListener(`publish:${e}`, l);
|
|
68
|
+
}, d = t.subId ? Array.isArray(t.subId) ? t.subId : [t.subId] : void 0;
|
|
69
|
+
s = r().publish(e, n, t.defaultRelays, d);
|
|
66
70
|
const l = () => {
|
|
67
|
-
u = false, t().removeEventListener(`publish:${e}`, o);
|
|
68
|
-
};
|
|
69
|
-
s = t().publish(e, n, a.defaultRelays);
|
|
70
|
-
const o = () => {
|
|
71
71
|
if (!u || !s)
|
|
72
72
|
return;
|
|
73
|
-
const i = E.readMessages(s,
|
|
74
|
-
i.hasNewData && (i.messages.forEach((
|
|
75
|
-
v
|
|
76
|
-
}),
|
|
73
|
+
const i = E.readMessages(s, a);
|
|
74
|
+
i.hasNewData && (i.messages.forEach((v) => {
|
|
75
|
+
f(v);
|
|
76
|
+
}), a = i.newReadPosition);
|
|
77
77
|
};
|
|
78
|
-
return
|
|
78
|
+
return t.trackStatus && (r().addEventListener(`publish:${e}`, l), queueMicrotask(l)), c;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
80
|
+
function R(e, n) {
|
|
81
|
+
r().signEvent(e, n);
|
|
82
82
|
}
|
|
83
83
|
export {
|
|
84
84
|
M as asNostrEvent,
|
|
85
85
|
k as asParsedEvent,
|
|
86
86
|
w as isConnectionStatus,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
A as isEoce,
|
|
88
|
+
N as isNostrEvent,
|
|
89
|
+
$ as isParsedEvent,
|
|
90
|
+
P as usePublish,
|
|
91
91
|
S as useRelayStatus,
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
R as useSignEvent,
|
|
93
|
+
y as useSubscription
|
|
94
94
|
};
|