@semiont/sdk 0.5.8 → 0.5.9
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 +3 -9
- package/dist/index.js +20 -14
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -523,9 +523,6 @@ interface AuthNamespace$1 {
|
|
|
523
523
|
logout(): Promise<void>;
|
|
524
524
|
me(): Promise<User>;
|
|
525
525
|
acceptTerms(): Promise<void>;
|
|
526
|
-
mcpToken(): Promise<{
|
|
527
|
-
token: string;
|
|
528
|
-
}>;
|
|
529
526
|
mediaToken(resourceId: ResourceId): Promise<{
|
|
530
527
|
token: string;
|
|
531
528
|
}>;
|
|
@@ -842,9 +839,6 @@ declare class AuthNamespace implements AuthNamespace$1 {
|
|
|
842
839
|
logout(): Promise<void>;
|
|
843
840
|
me(): Promise<User>;
|
|
844
841
|
acceptTerms(): Promise<void>;
|
|
845
|
-
mcpToken(): Promise<{
|
|
846
|
-
token: string;
|
|
847
|
-
}>;
|
|
848
842
|
mediaToken(resourceId: ResourceId): Promise<{
|
|
849
843
|
token: string;
|
|
850
844
|
}>;
|
|
@@ -981,7 +975,7 @@ declare class SemiontClient {
|
|
|
981
975
|
}): Promise<SemiontClient>;
|
|
982
976
|
}
|
|
983
977
|
|
|
984
|
-
type BusRequestErrorCode = 'bus.timeout' | 'bus.rejected' | 'bus.bad-payload' | 'bus.unauthorized' | 'bus.forbidden' | 'bus.not-found';
|
|
978
|
+
type BusRequestErrorCode = 'bus.timeout' | 'bus.rejected' | 'bus.closed' | 'bus.bad-payload' | 'bus.unauthorized' | 'bus.forbidden' | 'bus.not-found';
|
|
985
979
|
declare class BusRequestError extends SemiontError {
|
|
986
980
|
code: BusRequestErrorCode;
|
|
987
981
|
constructor(message: string, code: BusRequestErrorCode, details?: Record<string, unknown>);
|
|
@@ -1519,8 +1513,8 @@ declare class SemiontBrowser {
|
|
|
1519
1513
|
/** Read-only observable for an app-scoped channel. */
|
|
1520
1514
|
stream<K extends keyof EventMap>(channel: K): Observable<EventMap[K]>;
|
|
1521
1515
|
/**
|
|
1522
|
-
* Set the app-level identity token. Sourced from
|
|
1523
|
-
*
|
|
1516
|
+
* Set the app-level identity token. Sourced from an external
|
|
1517
|
+
* OAuth/identity-provider token supplied by the host environment.
|
|
1524
1518
|
* Should be called once from the host's startup-and-on-change site;
|
|
1525
1519
|
* no other code should write to this slot.
|
|
1526
1520
|
*/
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { SemiontError, decodeWithCharset, annotationId, resourceId, email, googl
|
|
|
2
2
|
export { SemiontError, accessToken, annotationId, baseUrl, entityType, refreshToken, resourceId, userId } from '@semiont/core';
|
|
3
3
|
import { Observable, lastValueFrom, firstValueFrom, merge, TimeoutError, throwError, map as map$1, BehaviorSubject, Subject, Subscription, of, distinctUntilChanged as distinctUntilChanged$1 } from 'rxjs';
|
|
4
4
|
export { firstValueFrom, lastValueFrom } from 'rxjs';
|
|
5
|
-
import { filter, map, take, timeout, catchError, takeUntil, startWith, debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';
|
|
5
|
+
import { filter, map, take, timeout, catchError, defaultIfEmpty, takeUntil, startWith, debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';
|
|
6
6
|
import { HttpTransport, HttpContentTransport, APIError } from '@semiont/http-transport';
|
|
7
7
|
export { APIError, HttpContentTransport, HttpTransport } from '@semiont/http-transport';
|
|
8
8
|
|
|
@@ -108,16 +108,25 @@ async function busRequest(bus, emitChannel, payload, resultChannel, failureChann
|
|
|
108
108
|
);
|
|
109
109
|
}
|
|
110
110
|
return throwError(() => err);
|
|
111
|
+
}),
|
|
112
|
+
// If the stream completes with no value — the bus was disposed before a
|
|
113
|
+
// reply (e.g. during `semiont.dispose()` with a request in flight) —
|
|
114
|
+
// resolve to a typed `bus.closed` result instead of letting `firstValueFrom`
|
|
115
|
+
// throw rxjs `EmptyError`. An awaited caller then gets a clean
|
|
116
|
+
// BusRequestError; an in-flight promise nobody is awaiting simply resolves,
|
|
117
|
+
// so it can't surface as an unhandled rejection on dispose.
|
|
118
|
+
// See .plans/bugs/busrequest-emptyerror-on-dispose.md.
|
|
119
|
+
defaultIfEmpty({
|
|
120
|
+
ok: false,
|
|
121
|
+
error: new BusRequestError(
|
|
122
|
+
`Bus closed before a reply on ${resultChannel}`,
|
|
123
|
+
"bus.closed",
|
|
124
|
+
{ channel: emitChannel, resultChannel, correlationId }
|
|
125
|
+
)
|
|
111
126
|
})
|
|
112
127
|
);
|
|
113
128
|
const resultPromise = firstValueFrom(result$);
|
|
114
|
-
|
|
115
|
-
await bus.emit(emitChannel, fullPayload);
|
|
116
|
-
} catch (err) {
|
|
117
|
-
resultPromise.catch(() => {
|
|
118
|
-
});
|
|
119
|
-
throw err;
|
|
120
|
-
}
|
|
129
|
+
await bus.emit(emitChannel, fullPayload);
|
|
121
130
|
const result = await resultPromise;
|
|
122
131
|
if (!result.ok) {
|
|
123
132
|
throw result.error;
|
|
@@ -1262,9 +1271,6 @@ var AuthNamespace = class {
|
|
|
1262
1271
|
async acceptTerms() {
|
|
1263
1272
|
await this.backend.acceptTerms();
|
|
1264
1273
|
}
|
|
1265
|
-
async mcpToken() {
|
|
1266
|
-
return this.backend.generateMcpToken();
|
|
1267
|
-
}
|
|
1268
1274
|
async mediaToken(resourceId2) {
|
|
1269
1275
|
return this.backend.getMediaToken(resourceId2);
|
|
1270
1276
|
}
|
|
@@ -2015,10 +2021,10 @@ var SemiontBrowser = class {
|
|
|
2015
2021
|
stream(channel) {
|
|
2016
2022
|
return this.eventBus.get(channel).asObservable();
|
|
2017
2023
|
}
|
|
2018
|
-
// ── Identity token (
|
|
2024
|
+
// ── Identity token (external OAuth/identity bridge; D1) ───────────────
|
|
2019
2025
|
/**
|
|
2020
|
-
* Set the app-level identity token. Sourced from
|
|
2021
|
-
*
|
|
2026
|
+
* Set the app-level identity token. Sourced from an external
|
|
2027
|
+
* OAuth/identity-provider token supplied by the host environment.
|
|
2022
2028
|
* Should be called once from the host's startup-and-on-change site;
|
|
2023
2029
|
* no other code should write to this slot.
|
|
2024
2030
|
*/
|