@semiont/sdk 0.5.4 → 0.5.6
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 +1792 -52
- package/dist/index.js +140 -44
- package/dist/index.js.map +1 -1
- package/package.json +9 -6
- package/dist/awaitable.d.ts +0 -103
- package/dist/awaitable.d.ts.map +0 -1
- package/dist/bus-request.d.ts +0 -18
- package/dist/bus-request.d.ts.map +0 -1
- package/dist/cache.d.ts +0 -57
- package/dist/cache.d.ts.map +0 -1
- package/dist/client.d.ts +0 -138
- package/dist/client.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/namespaces/admin.d.ts +0 -27
- package/dist/namespaces/admin.d.ts.map +0 -1
- package/dist/namespaces/auth.d.ts +0 -26
- package/dist/namespaces/auth.d.ts.map +0 -1
- package/dist/namespaces/beckon.d.ts +0 -12
- package/dist/namespaces/beckon.d.ts.map +0 -1
- package/dist/namespaces/bind.d.ts +0 -11
- package/dist/namespaces/bind.d.ts.map +0 -1
- package/dist/namespaces/browse.d.ts +0 -111
- package/dist/namespaces/browse.d.ts.map +0 -1
- package/dist/namespaces/frame.d.ts +0 -29
- package/dist/namespaces/frame.d.ts.map +0 -1
- package/dist/namespaces/gather.d.ts +0 -16
- package/dist/namespaces/gather.d.ts.map +0 -1
- package/dist/namespaces/job.d.ts +0 -32
- package/dist/namespaces/job.d.ts.map +0 -1
- package/dist/namespaces/mark.d.ts +0 -27
- package/dist/namespaces/mark.d.ts.map +0 -1
- package/dist/namespaces/match.d.ts +0 -15
- package/dist/namespaces/match.d.ts.map +0 -1
- package/dist/namespaces/types.d.ts +0 -438
- package/dist/namespaces/types.d.ts.map +0 -1
- package/dist/namespaces/yield.d.ts +0 -23
- package/dist/namespaces/yield.d.ts.map +0 -1
- package/dist/session/errors.d.ts +0 -18
- package/dist/session/errors.d.ts.map +0 -1
- package/dist/session/http-session-factory.d.ts +0 -15
- package/dist/session/http-session-factory.d.ts.map +0 -1
- package/dist/session/knowledge-base.d.ts +0 -95
- package/dist/session/knowledge-base.d.ts.map +0 -1
- package/dist/session/open-resource.d.ts +0 -22
- package/dist/session/open-resource.d.ts.map +0 -1
- package/dist/session/registry.d.ts +0 -31
- package/dist/session/registry.d.ts.map +0 -1
- package/dist/session/semiont-browser.d.ts +0 -141
- package/dist/session/semiont-browser.d.ts.map +0 -1
- package/dist/session/semiont-session.d.ts +0 -210
- package/dist/session/semiont-session.d.ts.map +0 -1
- package/dist/session/session-factory.d.ts +0 -31
- package/dist/session/session-factory.d.ts.map +0 -1
- package/dist/session/session-signals.d.ts +0 -40
- package/dist/session/session-signals.d.ts.map +0 -1
- package/dist/session/session-storage.d.ts +0 -41
- package/dist/session/session-storage.d.ts.map +0 -1
- package/dist/session/storage.d.ts +0 -52
- package/dist/session/storage.d.ts.map +0 -1
- package/dist/session/testing.d.ts +0 -7
- package/dist/session/testing.d.ts.map +0 -1
- package/dist/state/flows/beckon-state-unit.d.ts +0 -22
- package/dist/state/flows/beckon-state-unit.d.ts.map +0 -1
- package/dist/state/flows/gather-state-unit.d.ts +0 -12
- package/dist/state/flows/gather-state-unit.d.ts.map +0 -1
- package/dist/state/flows/mark-state-unit.d.ts +0 -17
- package/dist/state/flows/mark-state-unit.d.ts.map +0 -1
- package/dist/state/flows/match-state-unit.d.ts +0 -7
- package/dist/state/flows/match-state-unit.d.ts.map +0 -1
- package/dist/state/flows/yield-state-unit.d.ts +0 -25
- package/dist/state/flows/yield-state-unit.d.ts.map +0 -1
- package/dist/state/index.d.ts +0 -10
- package/dist/state/index.d.ts.map +0 -1
- package/dist/state/lib/search-pipeline.d.ts +0 -38
- package/dist/state/lib/search-pipeline.d.ts.map +0 -1
- package/dist/state/lib/state-unit.d.ts +0 -33
- package/dist/state/lib/state-unit.d.ts.map +0 -1
- package/dist/state/lib/worker-bus.d.ts +0 -21
- package/dist/state/lib/worker-bus.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -17,12 +17,27 @@ var StreamObservable = class _StreamObservable extends Observable {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
var CacheObservable = class _CacheObservable extends Observable {
|
|
20
|
+
/**
|
|
21
|
+
* Optional one-shot fresh-fetch action. When present, `then()` (the await
|
|
22
|
+
* path) resolves to a freshly fetched value and rejects on fetch failure —
|
|
23
|
+
* so a re-read reflects writes (#847). `.subscribe(...)` never uses it: it
|
|
24
|
+
* keeps the stale-while-revalidate cached view over `source`.
|
|
25
|
+
*/
|
|
26
|
+
fetchFresh;
|
|
20
27
|
then(onfulfilled, onrejected) {
|
|
28
|
+
if (this.fetchFresh) {
|
|
29
|
+
return this.fetchFresh().then(onfulfilled, onrejected);
|
|
30
|
+
}
|
|
21
31
|
return firstValueFrom(this.pipe(filter((v) => v !== void 0))).then(onfulfilled, onrejected);
|
|
22
32
|
}
|
|
23
33
|
/**
|
|
24
34
|
* Wrap an existing Observable's subscribe behavior in a `CacheObservable`.
|
|
25
35
|
*
|
|
36
|
+
* `fetchFresh`, when supplied, backs the await path: `await` resolves to a
|
|
37
|
+
* freshly fetched value (rejecting on failure), so a one-shot read reflects
|
|
38
|
+
* writes without a scoped subscription (#847). `.subscribe(...)` consumers
|
|
39
|
+
* keep the SWR view over `source`.
|
|
40
|
+
*
|
|
26
41
|
* Memoizes on source identity: passing the same `source` returns the same
|
|
27
42
|
* wrapper instance. The Browse cache primitive already returns a stable
|
|
28
43
|
* Observable per key (its B4 contract), so this preserves that contract
|
|
@@ -32,10 +47,11 @@ var CacheObservable = class _CacheObservable extends Observable {
|
|
|
32
47
|
*
|
|
33
48
|
* Backed by a `WeakMap`, so wrappers are GC'd when their source is.
|
|
34
49
|
*/
|
|
35
|
-
static from(source) {
|
|
50
|
+
static from(source, fetchFresh) {
|
|
36
51
|
let wrapper = wrapperCache.get(source);
|
|
37
52
|
if (!wrapper) {
|
|
38
53
|
wrapper = new _CacheObservable((subscriber) => source.subscribe(subscriber));
|
|
54
|
+
wrapper.fetchFresh = fetchFresh;
|
|
39
55
|
wrapperCache.set(source, wrapper);
|
|
40
56
|
}
|
|
41
57
|
return wrapper;
|
|
@@ -95,7 +111,13 @@ async function busRequest(bus, emitChannel, payload, resultChannel, failureChann
|
|
|
95
111
|
})
|
|
96
112
|
);
|
|
97
113
|
const resultPromise = firstValueFrom(result$);
|
|
98
|
-
|
|
114
|
+
try {
|
|
115
|
+
await bus.emit(emitChannel, fullPayload);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
resultPromise.catch(() => {
|
|
118
|
+
});
|
|
119
|
+
throw err;
|
|
120
|
+
}
|
|
99
121
|
const result = await resultPromise;
|
|
100
122
|
if (!result.ok) {
|
|
101
123
|
throw result.error;
|
|
@@ -104,25 +126,31 @@ async function busRequest(bus, emitChannel, payload, resultChannel, failureChann
|
|
|
104
126
|
}
|
|
105
127
|
function createCache(fetchFn) {
|
|
106
128
|
const store$ = new BehaviorSubject(/* @__PURE__ */ new Map());
|
|
107
|
-
const inflight = /* @__PURE__ */ new
|
|
129
|
+
const inflight = /* @__PURE__ */ new Map();
|
|
108
130
|
const obsCache = /* @__PURE__ */ new Map();
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
131
|
+
const runFetch = (key) => {
|
|
132
|
+
const existing = inflight.get(key);
|
|
133
|
+
if (existing) return existing;
|
|
134
|
+
let p;
|
|
135
|
+
p = (async () => {
|
|
136
|
+
try {
|
|
137
|
+
const value = await fetchFn(key);
|
|
138
|
+
const next = new Map(store$.value);
|
|
139
|
+
next.set(key, value);
|
|
140
|
+
store$.next(next);
|
|
141
|
+
return value;
|
|
142
|
+
} finally {
|
|
143
|
+
if (inflight.get(key) === p) inflight.delete(key);
|
|
144
|
+
}
|
|
145
|
+
})();
|
|
146
|
+
inflight.set(key, p);
|
|
147
|
+
return p;
|
|
121
148
|
};
|
|
122
149
|
return {
|
|
123
150
|
observe(key) {
|
|
124
151
|
if (!store$.value.has(key) && !inflight.has(key)) {
|
|
125
|
-
void
|
|
152
|
+
void runFetch(key).catch(() => {
|
|
153
|
+
});
|
|
126
154
|
}
|
|
127
155
|
let obs = obsCache.get(key);
|
|
128
156
|
if (!obs) {
|
|
@@ -134,6 +162,9 @@ function createCache(fetchFn) {
|
|
|
134
162
|
}
|
|
135
163
|
return obs;
|
|
136
164
|
},
|
|
165
|
+
fetch(key) {
|
|
166
|
+
return runFetch(key);
|
|
167
|
+
},
|
|
137
168
|
get(key) {
|
|
138
169
|
return store$.value.get(key);
|
|
139
170
|
},
|
|
@@ -142,7 +173,8 @@ function createCache(fetchFn) {
|
|
|
142
173
|
},
|
|
143
174
|
invalidate(key) {
|
|
144
175
|
inflight.delete(key);
|
|
145
|
-
void
|
|
176
|
+
void runFetch(key).catch(() => {
|
|
177
|
+
});
|
|
146
178
|
},
|
|
147
179
|
remove(key) {
|
|
148
180
|
const next = new Map(store$.value);
|
|
@@ -158,7 +190,8 @@ function createCache(fetchFn) {
|
|
|
158
190
|
invalidateAll() {
|
|
159
191
|
for (const key of store$.value.keys()) {
|
|
160
192
|
inflight.delete(key);
|
|
161
|
-
void
|
|
193
|
+
void runFetch(key).catch(() => {
|
|
194
|
+
});
|
|
162
195
|
}
|
|
163
196
|
},
|
|
164
197
|
dispose() {
|
|
@@ -193,7 +226,13 @@ var BrowseNamespace = class {
|
|
|
193
226
|
const result = await busRequest(
|
|
194
227
|
this.transport,
|
|
195
228
|
"browse:resources-requested",
|
|
196
|
-
{
|
|
229
|
+
{
|
|
230
|
+
search,
|
|
231
|
+
archived: filters.archived,
|
|
232
|
+
entityType: filters.entityType,
|
|
233
|
+
limit: filters.limit ?? 100,
|
|
234
|
+
offset: 0
|
|
235
|
+
},
|
|
197
236
|
"browse:resources-result",
|
|
198
237
|
"browse:resources-failed"
|
|
199
238
|
);
|
|
@@ -264,6 +303,9 @@ var BrowseNamespace = class {
|
|
|
264
303
|
});
|
|
265
304
|
this.subscribeToEvents();
|
|
266
305
|
}
|
|
306
|
+
transport;
|
|
307
|
+
bus;
|
|
308
|
+
content;
|
|
267
309
|
// ── Caches, backed by the RxJS-native `Cache<K, V>` primitive ───────────
|
|
268
310
|
//
|
|
269
311
|
// Each cache encapsulates the BehaviorSubject store, in-flight guard,
|
|
@@ -300,18 +342,58 @@ var BrowseNamespace = class {
|
|
|
300
342
|
* `distinctUntilChanged` at a higher level — would misbehave.
|
|
301
343
|
*/
|
|
302
344
|
annotationListObs = /* @__PURE__ */ new Map();
|
|
345
|
+
/**
|
|
346
|
+
* Per-source memo for the scope-acquiring wrapper (#847 Phase 4), keyed by
|
|
347
|
+
* the underlying (stable, per-key) cache observable so the wrapped
|
|
348
|
+
* observable is itself stable per key — preserving B4/B11 referential
|
|
349
|
+
* identity through to `CacheObservable.from`'s own memo.
|
|
350
|
+
*/
|
|
351
|
+
scopedSources = /* @__PURE__ */ new WeakMap();
|
|
352
|
+
/**
|
|
353
|
+
* Wrap a resource-scoped live query's source so that *subscribing* acquires
|
|
354
|
+
* the resource's scope (via the transport's ref-counted
|
|
355
|
+
* `subscribeToResource`) and the last unsubscribe releases it (#847 Phase 4).
|
|
356
|
+
* Freshness follows observation: a `.subscribe()` keeps `rId`'s scoped
|
|
357
|
+
* events flowing — so `mark:*` / entity-tag invalidations reach this cache —
|
|
358
|
+
* with no separate `subscribeToResource` call from the consumer.
|
|
359
|
+
*
|
|
360
|
+
* The one-shot `await` path does NOT go through here (it resolves via the
|
|
361
|
+
* cache's `fetch` — see `CacheObservable.from`'s `fetchFresh`), so a
|
|
362
|
+
* one-shot read acquires no scope.
|
|
363
|
+
*
|
|
364
|
+
* Memoized per source so the wrapped observable is stable per key (B4/B11).
|
|
365
|
+
* Each subscription calls `subscribeToResource(rId)`; the transport
|
|
366
|
+
* ref-counts concurrent subscriptions for the same resource onto a single
|
|
367
|
+
* SSE scope. Single-scope model unchanged — multi-scope is deferred (see
|
|
368
|
+
* `.plans/MULTI-RESOURCE-SCOPE.md`).
|
|
369
|
+
*/
|
|
370
|
+
withScope(rId, source) {
|
|
371
|
+
let scoped = this.scopedSources.get(source);
|
|
372
|
+
if (!scoped) {
|
|
373
|
+
scoped = new Observable((subscriber) => {
|
|
374
|
+
const release = this.transport.subscribeToResource(rId);
|
|
375
|
+
const inner = source.subscribe(subscriber);
|
|
376
|
+
return () => {
|
|
377
|
+
inner.unsubscribe();
|
|
378
|
+
release();
|
|
379
|
+
};
|
|
380
|
+
});
|
|
381
|
+
this.scopedSources.set(source, scoped);
|
|
382
|
+
}
|
|
383
|
+
return scoped;
|
|
384
|
+
}
|
|
303
385
|
// ── Live queries ────────────────────────────────────────────────────────
|
|
304
386
|
//
|
|
305
387
|
// These return `CacheObservable<T>`: subscribers see `T | undefined`
|
|
306
388
|
// (with `undefined` during initial load), and `await` resolves to the
|
|
307
389
|
// first non-undefined value.
|
|
308
390
|
resource(resourceId2) {
|
|
309
|
-
return CacheObservable.from(this.resourceCache.observe(resourceId2));
|
|
391
|
+
return CacheObservable.from(this.withScope(resourceId2, this.resourceCache.observe(resourceId2)), () => this.resourceCache.fetch(resourceId2));
|
|
310
392
|
}
|
|
311
393
|
resources(filters) {
|
|
312
394
|
const key = JSON.stringify(filters ?? {});
|
|
313
395
|
this.resourceListFilters.set(key, filters ?? {});
|
|
314
|
-
return CacheObservable.from(this.resourceListCache.observe(key));
|
|
396
|
+
return CacheObservable.from(this.resourceListCache.observe(key), () => this.resourceListCache.fetch(key));
|
|
315
397
|
}
|
|
316
398
|
annotations(resourceId2) {
|
|
317
399
|
let obs = this.annotationListObs.get(resourceId2);
|
|
@@ -319,23 +401,23 @@ var BrowseNamespace = class {
|
|
|
319
401
|
obs = this.annotationListCache.observe(resourceId2).pipe(map$1((r) => r?.annotations));
|
|
320
402
|
this.annotationListObs.set(resourceId2, obs);
|
|
321
403
|
}
|
|
322
|
-
return CacheObservable.from(obs);
|
|
404
|
+
return CacheObservable.from(this.withScope(resourceId2, obs), () => this.annotationListCache.fetch(resourceId2).then((r) => r.annotations));
|
|
323
405
|
}
|
|
324
406
|
annotation(resourceId2, annotationId2) {
|
|
325
407
|
this.annotationResources.set(annotationId2, resourceId2);
|
|
326
|
-
return CacheObservable.from(this.annotationDetailCache.observe(annotationId2));
|
|
408
|
+
return CacheObservable.from(this.withScope(resourceId2, this.annotationDetailCache.observe(annotationId2)), () => this.annotationDetailCache.fetch(annotationId2));
|
|
327
409
|
}
|
|
328
410
|
entityTypes() {
|
|
329
|
-
return CacheObservable.from(this.entityTypesCache.observe(ENTITY_TYPES_KEY));
|
|
411
|
+
return CacheObservable.from(this.entityTypesCache.observe(ENTITY_TYPES_KEY), () => this.entityTypesCache.fetch(ENTITY_TYPES_KEY));
|
|
330
412
|
}
|
|
331
413
|
tagSchemas() {
|
|
332
|
-
return CacheObservable.from(this.tagSchemasCache.observe(TAG_SCHEMAS_KEY));
|
|
414
|
+
return CacheObservable.from(this.tagSchemasCache.observe(TAG_SCHEMAS_KEY), () => this.tagSchemasCache.fetch(TAG_SCHEMAS_KEY));
|
|
333
415
|
}
|
|
334
416
|
referencedBy(resourceId2) {
|
|
335
|
-
return CacheObservable.from(this.referencedByCache.observe(resourceId2));
|
|
417
|
+
return CacheObservable.from(this.withScope(resourceId2, this.referencedByCache.observe(resourceId2)), () => this.referencedByCache.fetch(resourceId2));
|
|
336
418
|
}
|
|
337
419
|
events(resourceId2) {
|
|
338
|
-
return CacheObservable.from(this.resourceEventsCache.observe(resourceId2));
|
|
420
|
+
return CacheObservable.from(this.withScope(resourceId2, this.resourceEventsCache.observe(resourceId2)), () => this.resourceEventsCache.fetch(resourceId2));
|
|
339
421
|
}
|
|
340
422
|
// ── One-shot reads ──────────────────────────────────────────────────────
|
|
341
423
|
async resourceContent(resourceId2) {
|
|
@@ -538,6 +620,8 @@ var MarkNamespace = class {
|
|
|
538
620
|
this.transport = transport;
|
|
539
621
|
this.bus = bus;
|
|
540
622
|
}
|
|
623
|
+
transport;
|
|
624
|
+
bus;
|
|
541
625
|
async annotation(input) {
|
|
542
626
|
const resourceId2 = resourceId(input.target.source);
|
|
543
627
|
const result = await busRequest(
|
|
@@ -563,7 +647,6 @@ var MarkNamespace = class {
|
|
|
563
647
|
let done = false;
|
|
564
648
|
let pollTimer = null;
|
|
565
649
|
let pollInterval = null;
|
|
566
|
-
let unsubscribeResource = this.transport.subscribeToResource(resourceId2);
|
|
567
650
|
const cleanup = () => {
|
|
568
651
|
done = true;
|
|
569
652
|
if (pollTimer) {
|
|
@@ -574,10 +657,6 @@ var MarkNamespace = class {
|
|
|
574
657
|
clearInterval(pollInterval);
|
|
575
658
|
pollInterval = null;
|
|
576
659
|
}
|
|
577
|
-
if (unsubscribeResource) {
|
|
578
|
-
unsubscribeResource();
|
|
579
|
-
unsubscribeResource = null;
|
|
580
|
-
}
|
|
581
660
|
};
|
|
582
661
|
const resetPollTimer = (jobId) => {
|
|
583
662
|
if (pollTimer) clearTimeout(pollTimer);
|
|
@@ -647,6 +726,7 @@ var MarkNamespace = class {
|
|
|
647
726
|
resetPollTimer(jobId);
|
|
648
727
|
}
|
|
649
728
|
}).catch((error) => {
|
|
729
|
+
if (done) return;
|
|
650
730
|
cleanup();
|
|
651
731
|
subscriber.error(error);
|
|
652
732
|
});
|
|
@@ -700,9 +780,14 @@ var MarkNamespace = class {
|
|
|
700
780
|
const jobType = jobTypeMap[motivation];
|
|
701
781
|
if (!jobType) throw new Error(`Unsupported motivation: ${motivation}`);
|
|
702
782
|
if (motivation === "tagging") {
|
|
703
|
-
if (!options.schemaId
|
|
783
|
+
if (!options.schemaId) {
|
|
784
|
+
throw new Error('mark.assist with motivation "tagging" requires options.schemaId');
|
|
785
|
+
}
|
|
786
|
+
if (!options.categories?.length) {
|
|
787
|
+
throw new Error('mark.assist with motivation "tagging" requires a non-empty options.categories array');
|
|
788
|
+
}
|
|
704
789
|
} else if (motivation === "linking") {
|
|
705
|
-
if (!options.entityTypes?.length) throw new Error("
|
|
790
|
+
if (!options.entityTypes?.length) throw new Error('mark.assist with motivation "linking" requires a non-empty entityTypes array');
|
|
706
791
|
}
|
|
707
792
|
const params = {};
|
|
708
793
|
if (options.entityTypes) params.entityTypes = options.entityTypes;
|
|
@@ -730,6 +815,8 @@ var BindNamespace = class {
|
|
|
730
815
|
this.transport = transport;
|
|
731
816
|
this.bus = bus;
|
|
732
817
|
}
|
|
818
|
+
transport;
|
|
819
|
+
bus;
|
|
733
820
|
async body(resourceId2, annotationId2, operations) {
|
|
734
821
|
await this.transport.emit("bind:update-body", {
|
|
735
822
|
correlationId: crypto.randomUUID(),
|
|
@@ -747,6 +834,8 @@ var GatherNamespace = class {
|
|
|
747
834
|
this.transport = transport;
|
|
748
835
|
this.bus = bus;
|
|
749
836
|
}
|
|
837
|
+
transport;
|
|
838
|
+
bus;
|
|
750
839
|
annotation(resourceId2, annotationId2, options) {
|
|
751
840
|
return new StreamObservable((subscriber) => {
|
|
752
841
|
const correlationId = crypto.randomUUID();
|
|
@@ -779,6 +868,7 @@ var GatherNamespace = class {
|
|
|
779
868
|
resourceId: resourceId2,
|
|
780
869
|
options: { contextWindow: options?.contextWindow ?? 2e3 }
|
|
781
870
|
}).catch((error) => {
|
|
871
|
+
if (subscriber.closed) return;
|
|
782
872
|
subscriber.error(error);
|
|
783
873
|
});
|
|
784
874
|
return () => {
|
|
@@ -797,6 +887,8 @@ var MatchNamespace = class {
|
|
|
797
887
|
this.transport = transport;
|
|
798
888
|
this.bus = bus;
|
|
799
889
|
}
|
|
890
|
+
transport;
|
|
891
|
+
bus;
|
|
800
892
|
requestSearch(input) {
|
|
801
893
|
this.bus.get("match:search-requested").next(input);
|
|
802
894
|
}
|
|
@@ -824,6 +916,7 @@ var MatchNamespace = class {
|
|
|
824
916
|
limit: options?.limit ?? 10,
|
|
825
917
|
useSemanticScoring: options?.useSemanticScoring ?? true
|
|
826
918
|
}).catch((error) => {
|
|
919
|
+
if (subscriber.closed) return;
|
|
827
920
|
subscriber.error(error);
|
|
828
921
|
});
|
|
829
922
|
return () => {
|
|
@@ -839,6 +932,9 @@ var YieldNamespace = class {
|
|
|
839
932
|
this.bus = bus;
|
|
840
933
|
this.content = content;
|
|
841
934
|
}
|
|
935
|
+
transport;
|
|
936
|
+
bus;
|
|
937
|
+
content;
|
|
842
938
|
resource(data) {
|
|
843
939
|
const totalBytes = typeof Buffer !== "undefined" && data.file instanceof Buffer ? data.file.length : data.file.size;
|
|
844
940
|
return new UploadObservable((subscriber) => {
|
|
@@ -891,7 +987,6 @@ var YieldNamespace = class {
|
|
|
891
987
|
let done = false;
|
|
892
988
|
let pollTimer = null;
|
|
893
989
|
let pollInterval = null;
|
|
894
|
-
let unsubscribeResource = this.transport.subscribeToResource(resourceId2);
|
|
895
990
|
const cleanup = () => {
|
|
896
991
|
done = true;
|
|
897
992
|
if (pollTimer) {
|
|
@@ -902,10 +997,6 @@ var YieldNamespace = class {
|
|
|
902
997
|
clearInterval(pollInterval);
|
|
903
998
|
pollInterval = null;
|
|
904
999
|
}
|
|
905
|
-
if (unsubscribeResource) {
|
|
906
|
-
unsubscribeResource();
|
|
907
|
-
unsubscribeResource = null;
|
|
908
|
-
}
|
|
909
1000
|
};
|
|
910
1001
|
const resetPollTimer = (jid) => {
|
|
911
1002
|
if (pollTimer) clearTimeout(pollTimer);
|
|
@@ -996,6 +1087,7 @@ var YieldNamespace = class {
|
|
|
996
1087
|
resetPollTimer(jobId);
|
|
997
1088
|
}
|
|
998
1089
|
}).catch((error) => {
|
|
1090
|
+
if (done) return;
|
|
999
1091
|
cleanup();
|
|
1000
1092
|
subscriber.error(error);
|
|
1001
1093
|
});
|
|
@@ -1047,6 +1139,8 @@ var BeckonNamespace = class {
|
|
|
1047
1139
|
this.transport = transport;
|
|
1048
1140
|
this.bus = bus;
|
|
1049
1141
|
}
|
|
1142
|
+
transport;
|
|
1143
|
+
bus;
|
|
1050
1144
|
attention(resourceId2, annotationId2) {
|
|
1051
1145
|
void this.transport.emit("beckon:focus", { annotationId: annotationId2, resourceId: resourceId2 });
|
|
1052
1146
|
}
|
|
@@ -1063,6 +1157,7 @@ var FrameNamespace = class {
|
|
|
1063
1157
|
constructor(transport) {
|
|
1064
1158
|
this.transport = transport;
|
|
1065
1159
|
}
|
|
1160
|
+
transport;
|
|
1066
1161
|
async addEntityType(type) {
|
|
1067
1162
|
await this.transport.emit("frame:add-entity-type", { tag: type });
|
|
1068
1163
|
}
|
|
@@ -1082,6 +1177,8 @@ var JobNamespace = class {
|
|
|
1082
1177
|
this.transport = transport;
|
|
1083
1178
|
this.bus = bus;
|
|
1084
1179
|
}
|
|
1180
|
+
transport;
|
|
1181
|
+
bus;
|
|
1085
1182
|
/**
|
|
1086
1183
|
* Live stream of `job:queued` events. Surfaces a typed view onto the
|
|
1087
1184
|
* underlying bus channel for consumers (CLIs, MCP handlers, widgets)
|
|
@@ -1094,11 +1191,11 @@ var JobNamespace = class {
|
|
|
1094
1191
|
get progress$() {
|
|
1095
1192
|
return this.bus.get("job:report-progress");
|
|
1096
1193
|
}
|
|
1097
|
-
/** Live stream of `job:complete` events. */
|
|
1194
|
+
/** Live stream of `job:complete` events (global; filter by `jobId`). */
|
|
1098
1195
|
get complete$() {
|
|
1099
1196
|
return this.bus.get("job:complete");
|
|
1100
1197
|
}
|
|
1101
|
-
/** Live stream of `job:fail` events. */
|
|
1198
|
+
/** Live stream of `job:fail` events (global; filter by `jobId`). */
|
|
1102
1199
|
get fail$() {
|
|
1103
1200
|
return this.bus.get("job:fail");
|
|
1104
1201
|
}
|
|
@@ -1138,6 +1235,7 @@ var AuthNamespace = class {
|
|
|
1138
1235
|
constructor(backend) {
|
|
1139
1236
|
this.backend = backend;
|
|
1140
1237
|
}
|
|
1238
|
+
backend;
|
|
1141
1239
|
async password(emailStr, passwordStr) {
|
|
1142
1240
|
return this.backend.authenticatePassword(email(emailStr), passwordStr);
|
|
1143
1241
|
}
|
|
@@ -1169,6 +1267,7 @@ var AdminNamespace = class {
|
|
|
1169
1267
|
constructor(backend) {
|
|
1170
1268
|
this.backend = backend;
|
|
1171
1269
|
}
|
|
1270
|
+
backend;
|
|
1172
1271
|
async users() {
|
|
1173
1272
|
const result = await this.backend.listUsers();
|
|
1174
1273
|
return result.users;
|
|
@@ -1291,9 +1390,6 @@ var SemiontClient = class _SemiontClient {
|
|
|
1291
1390
|
get state$() {
|
|
1292
1391
|
return this.transport.state$;
|
|
1293
1392
|
}
|
|
1294
|
-
subscribeToResource(resourceId2) {
|
|
1295
|
-
return this.transport.subscribeToResource(resourceId2);
|
|
1296
|
-
}
|
|
1297
1393
|
dispose() {
|
|
1298
1394
|
this.transport.dispose();
|
|
1299
1395
|
this.content.dispose();
|