@semiont/sdk 0.5.3 → 0.5.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/dist/index.d.ts +2 -2
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/package.json +6 -4
package/dist/index.d.ts
CHANGED
|
@@ -187,7 +187,6 @@ interface CreateResourceInput {
|
|
|
187
187
|
format: string;
|
|
188
188
|
entityTypes?: string[];
|
|
189
189
|
language?: string;
|
|
190
|
-
creationMethod?: string;
|
|
191
190
|
sourceAnnotationId?: string;
|
|
192
191
|
sourceResourceId?: string;
|
|
193
192
|
storageUri: string;
|
|
@@ -1756,4 +1755,5 @@ interface MarkStateUnit extends StateUnit {
|
|
|
1756
1755
|
}
|
|
1757
1756
|
declare function createMarkStateUnit(client: SemiontClient, resourceId: ResourceId): MarkStateUnit;
|
|
1758
1757
|
|
|
1759
|
-
export { AdminNamespace,
|
|
1758
|
+
export { AdminNamespace, AuthNamespace, BeckonNamespace, BindNamespace, BrowseNamespace, BusRequestError, CacheObservable, FrameNamespace, GatherNamespace, HOVER_DELAY_MS, InMemorySessionStorage, JobNamespace, MarkNamespace, MatchNamespace, SemiontBrowser, SemiontClient, SemiontSession, SemiontSessionError, SessionSignals, StreamObservable, UploadObservable, YieldNamespace, busRequest, createBeckonStateUnit, createDisposer, createGatherStateUnit, createHoverHandlers, createHttpSessionFactory, createMarkStateUnit, createMatchStateUnit, createSearchPipeline, createYieldStateUnit, defaultProtocol, getBrowser, httpKb, isValidHostname, kbBackendUrl, setStoredSession };
|
|
1759
|
+
export type { AnnotationHistoryResponse, BeckonStateUnit, BusRequestErrorCode, BusRequestPrimitive, CreateAnnotationInput, CreateFromTokenOptions, CreateResourceInput, GatherAnnotationProgress, GatherStateUnit, GenerateDocumentOptions, GenerationOptions, GetBrowserOptions, HoverHandlers, HttpEndpoint, KbEndpoint, KbSessionStatus, KnowledgeBase, LocalEndpoint, MarkAssistEvent, MarkAssistOptions, MarkAssistProgress, MarkStateUnit, MatchSearchProgress, MatchStateUnit, NewKnowledgeBase, OpenResource, PendingAnnotation, ReferencedByEntry, RequestContent, ResponseContent, SearchPipeline, SearchPipelineOptions, SearchState, SemiontBrowserConfig, SemiontSessionConfig, SemiontSessionErrorCode, SessionFactory, SessionFactoryOptions, SessionStorage, StateUnit, StoredSession, UploadProgress, User, UserInfo, WorkerBus, YieldGenerationEvent, YieldStateUnit };
|
package/dist/index.js
CHANGED
|
@@ -95,7 +95,13 @@ async function busRequest(bus, emitChannel, payload, resultChannel, failureChann
|
|
|
95
95
|
})
|
|
96
96
|
);
|
|
97
97
|
const resultPromise = firstValueFrom(result$);
|
|
98
|
-
|
|
98
|
+
try {
|
|
99
|
+
await bus.emit(emitChannel, fullPayload);
|
|
100
|
+
} catch (err) {
|
|
101
|
+
resultPromise.catch(() => {
|
|
102
|
+
});
|
|
103
|
+
throw err;
|
|
104
|
+
}
|
|
99
105
|
const result = await resultPromise;
|
|
100
106
|
if (!result.ok) {
|
|
101
107
|
throw result.error;
|
|
@@ -647,6 +653,7 @@ var MarkNamespace = class {
|
|
|
647
653
|
resetPollTimer(jobId);
|
|
648
654
|
}
|
|
649
655
|
}).catch((error) => {
|
|
656
|
+
if (done) return;
|
|
650
657
|
cleanup();
|
|
651
658
|
subscriber.error(error);
|
|
652
659
|
});
|
|
@@ -700,9 +707,14 @@ var MarkNamespace = class {
|
|
|
700
707
|
const jobType = jobTypeMap[motivation];
|
|
701
708
|
if (!jobType) throw new Error(`Unsupported motivation: ${motivation}`);
|
|
702
709
|
if (motivation === "tagging") {
|
|
703
|
-
if (!options.schemaId
|
|
710
|
+
if (!options.schemaId) {
|
|
711
|
+
throw new Error('mark.assist with motivation "tagging" requires options.schemaId');
|
|
712
|
+
}
|
|
713
|
+
if (!options.categories?.length) {
|
|
714
|
+
throw new Error('mark.assist with motivation "tagging" requires a non-empty options.categories array');
|
|
715
|
+
}
|
|
704
716
|
} else if (motivation === "linking") {
|
|
705
|
-
if (!options.entityTypes?.length) throw new Error("
|
|
717
|
+
if (!options.entityTypes?.length) throw new Error('mark.assist with motivation "linking" requires a non-empty entityTypes array');
|
|
706
718
|
}
|
|
707
719
|
const params = {};
|
|
708
720
|
if (options.entityTypes) params.entityTypes = options.entityTypes;
|
|
@@ -779,6 +791,7 @@ var GatherNamespace = class {
|
|
|
779
791
|
resourceId: resourceId2,
|
|
780
792
|
options: { contextWindow: options?.contextWindow ?? 2e3 }
|
|
781
793
|
}).catch((error) => {
|
|
794
|
+
if (subscriber.closed) return;
|
|
782
795
|
subscriber.error(error);
|
|
783
796
|
});
|
|
784
797
|
return () => {
|
|
@@ -824,6 +837,7 @@ var MatchNamespace = class {
|
|
|
824
837
|
limit: options?.limit ?? 10,
|
|
825
838
|
useSemanticScoring: options?.useSemanticScoring ?? true
|
|
826
839
|
}).catch((error) => {
|
|
840
|
+
if (subscriber.closed) return;
|
|
827
841
|
subscriber.error(error);
|
|
828
842
|
});
|
|
829
843
|
return () => {
|
|
@@ -853,7 +867,6 @@ var YieldNamespace = class {
|
|
|
853
867
|
storageUri: data.storageUri,
|
|
854
868
|
...data.entityTypes ? { entityTypes: data.entityTypes } : {},
|
|
855
869
|
...data.language ? { language: data.language } : {},
|
|
856
|
-
...data.creationMethod ? { creationMethod: data.creationMethod } : {},
|
|
857
870
|
...data.sourceAnnotationId ? { sourceAnnotationId: data.sourceAnnotationId } : {},
|
|
858
871
|
...data.sourceResourceId ? { sourceResourceId: data.sourceResourceId } : {},
|
|
859
872
|
...data.generationPrompt ? { generationPrompt: data.generationPrompt } : {},
|
|
@@ -997,6 +1010,7 @@ var YieldNamespace = class {
|
|
|
997
1010
|
resetPollTimer(jobId);
|
|
998
1011
|
}
|
|
999
1012
|
}).catch((error) => {
|
|
1013
|
+
if (done) return;
|
|
1000
1014
|
cleanup();
|
|
1001
1015
|
subscriber.error(error);
|
|
1002
1016
|
});
|