@semiont/api-client 0.2.33-build.79 → 0.2.33-build.80
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 +112 -86
- package/dist/index.js +258 -156
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BaseUrl,
|
|
1
|
+
import { B as BaseUrl, R as ResourceUri, E as EntityType, A as AccessToken, a as AnnotationUri, c as components, b as Email, p as paths, d as RefreshToken, G as GoogleCredential, C as ContentFormat, S as SearchQuery, e as CloneToken, f as ResourceAnnotationUri, M as Motivation, U as UserDID, J as JobId } from './index-BUlCf43K.js';
|
|
2
2
|
export { $ as $defs, aA as AuthCode, ai as BoundingBox, F as FragmentSelector, ax as JWTTokenSchema, Z as LOCALES, Y as LocaleInfo, aB as MCPToken, ah as Point, i as Selector, h as SvgSelector, V as TextPosition, T as TextPositionSelector, g as TextQuoteSelector, aq as ValidatedAnnotation, av as ValidationFailure, aw as ValidationResult, au as ValidationSuccess, aF as accessToken, aP as annotationUri, aD as authCode, aN as baseUrl, aI as cloneToken, al as createCircleSvg, ak as createPolygonSvg, aj as createRectangleSvg, ag as decodeRepresentation, at as decodeWithCharset, aC as email, aL as entityType, Q as extractBoundingBox, as as extractCharset, ap as extractContext, W as findTextWithContext, a2 as formatLocaleDisplay, a3 as getAllLocaleCodes, H as getAnnotationExactText, j as getBodySource, k as getBodyType, a7 as getChecksum, x as getCommentText, aa as getCreator, ab as getDerivedFrom, D as getExactText, O as getFragmentSelector, a8 as getLanguage, a1 as getLocaleEnglishName, _ as getLocaleInfo, a0 as getLocaleNativeName, af as getNodeEncoding, a6 as getPrimaryMediaType, a5 as getPrimaryRepresentation, I as getPrimarySelector, ad as getResourceEntityTypes, a4 as getResourceId, a9 as getStorageUri, N as getSvgSelector, n as getTargetSelector, m as getTargetSource, K as getTextPositionSelector, L as getTextQuoteSelector, aE as googleCredential, q as hasTargetSelector, ac as isArchived, t as isAssessment, l as isBodyResolved, u as isComment, ae as isDraft, r as isHighlight, s as isReference, z as isResolvedReference, y as isStubReference, v as isTag, az as isValidEmail, aJ as jobId, aH as mcpToken, an as normalizeCoordinates, o as operations, am as parseSvgSelector, aG as refreshToken, aQ as resourceAnnotationUri, aO as resourceUri, ao as scaleSvgToNative, aM as searchQuery, aK as userDID, ar as validateAndCorrectOffsets, ay as validateData, P as validateSvgMarkup, X as verifyPosition, w as webhooks } from './index-BUlCf43K.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -353,25 +353,32 @@ interface DetectTagsStreamRequest {
|
|
|
353
353
|
*/
|
|
354
354
|
interface SSEClientConfig {
|
|
355
355
|
baseUrl: BaseUrl;
|
|
356
|
-
accessToken?: AccessToken;
|
|
357
356
|
logger?: Logger;
|
|
358
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* Options for SSE requests
|
|
360
|
+
*/
|
|
361
|
+
interface SSERequestOptions {
|
|
362
|
+
auth?: AccessToken;
|
|
363
|
+
}
|
|
359
364
|
/**
|
|
360
365
|
* SSE Client for real-time streaming operations
|
|
361
366
|
*
|
|
362
367
|
* Separate from the main HTTP client to clearly mark streaming endpoints.
|
|
363
368
|
* Uses native fetch() instead of ky for SSE support.
|
|
364
369
|
*
|
|
370
|
+
* This client is stateless - auth tokens are passed per-request via options.
|
|
371
|
+
*
|
|
365
372
|
* @example
|
|
366
373
|
* ```typescript
|
|
367
374
|
* const sseClient = new SSEClient({
|
|
368
|
-
* baseUrl: 'http://localhost:4000'
|
|
369
|
-
* accessToken: 'your-token'
|
|
375
|
+
* baseUrl: 'http://localhost:4000'
|
|
370
376
|
* });
|
|
371
377
|
*
|
|
372
378
|
* const stream = sseClient.detectAnnotations(
|
|
373
379
|
* 'http://localhost:4000/resources/doc-123',
|
|
374
|
-
* { entityTypes: ['Person', 'Organization'] }
|
|
380
|
+
* { entityTypes: ['Person', 'Organization'] },
|
|
381
|
+
* { auth: 'your-token' }
|
|
375
382
|
* );
|
|
376
383
|
*
|
|
377
384
|
* stream.onProgress((p) => console.log(p.message));
|
|
@@ -381,17 +388,8 @@ interface SSEClientConfig {
|
|
|
381
388
|
*/
|
|
382
389
|
declare class SSEClient {
|
|
383
390
|
private baseUrl;
|
|
384
|
-
private accessToken;
|
|
385
391
|
private logger?;
|
|
386
392
|
constructor(config: SSEClientConfig);
|
|
387
|
-
/**
|
|
388
|
-
* Set the access token for authenticated requests
|
|
389
|
-
*/
|
|
390
|
-
setAccessToken(token: AccessToken): void;
|
|
391
|
-
/**
|
|
392
|
-
* Clear the access token
|
|
393
|
-
*/
|
|
394
|
-
clearAccessToken(): void;
|
|
395
393
|
/**
|
|
396
394
|
* Get common headers for SSE requests
|
|
397
395
|
*/
|
|
@@ -411,13 +409,15 @@ declare class SSEClient {
|
|
|
411
409
|
*
|
|
412
410
|
* @param resourceId - Resource URI or ID
|
|
413
411
|
* @param request - Detection configuration (entity types to detect)
|
|
412
|
+
* @param options - Request options (auth token)
|
|
414
413
|
* @returns SSE stream controller with progress/complete/error callbacks
|
|
415
414
|
*
|
|
416
415
|
* @example
|
|
417
416
|
* ```typescript
|
|
418
417
|
* const stream = sseClient.detectAnnotations(
|
|
419
418
|
* 'http://localhost:4000/resources/doc-123',
|
|
420
|
-
* { entityTypes: ['Person', 'Organization'] }
|
|
419
|
+
* { entityTypes: ['Person', 'Organization'] },
|
|
420
|
+
* { auth: 'your-token' }
|
|
421
421
|
* );
|
|
422
422
|
*
|
|
423
423
|
* stream.onProgress((progress) => {
|
|
@@ -437,7 +437,7 @@ declare class SSEClient {
|
|
|
437
437
|
* stream.close();
|
|
438
438
|
* ```
|
|
439
439
|
*/
|
|
440
|
-
detectAnnotations(resourceId: ResourceUri, request: DetectAnnotationsStreamRequest): SSEStream<DetectionProgress, DetectionProgress>;
|
|
440
|
+
detectAnnotations(resourceId: ResourceUri, request: DetectAnnotationsStreamRequest, options?: SSERequestOptions): SSEStream<DetectionProgress, DetectionProgress>;
|
|
441
441
|
/**
|
|
442
442
|
* Generate resource from annotation (streaming)
|
|
443
443
|
*
|
|
@@ -446,6 +446,7 @@ declare class SSEClient {
|
|
|
446
446
|
* @param resourceId - Source resource URI or ID
|
|
447
447
|
* @param annotationId - Annotation URI or ID to use as generation source
|
|
448
448
|
* @param request - Generation options (title, prompt, language)
|
|
449
|
+
* @param options - Request options (auth token)
|
|
449
450
|
* @returns SSE stream controller with progress/complete/error callbacks
|
|
450
451
|
*
|
|
451
452
|
* @example
|
|
@@ -453,7 +454,8 @@ declare class SSEClient {
|
|
|
453
454
|
* const stream = sseClient.generateResourceFromAnnotation(
|
|
454
455
|
* 'http://localhost:4000/resources/doc-123',
|
|
455
456
|
* 'http://localhost:4000/annotations/ann-456',
|
|
456
|
-
* { language: 'es', title: 'Spanish Summary' }
|
|
457
|
+
* { language: 'es', title: 'Spanish Summary' },
|
|
458
|
+
* { auth: 'your-token' }
|
|
457
459
|
* );
|
|
458
460
|
*
|
|
459
461
|
* stream.onProgress((progress) => {
|
|
@@ -473,7 +475,7 @@ declare class SSEClient {
|
|
|
473
475
|
* stream.close();
|
|
474
476
|
* ```
|
|
475
477
|
*/
|
|
476
|
-
generateResourceFromAnnotation(resourceId: ResourceUri, annotationId: AnnotationUri, request: GenerateResourceStreamRequest): SSEStream<GenerationProgress, GenerationProgress>;
|
|
478
|
+
generateResourceFromAnnotation(resourceId: ResourceUri, annotationId: AnnotationUri, request: GenerateResourceStreamRequest, options?: SSERequestOptions): SSEStream<GenerationProgress, GenerationProgress>;
|
|
477
479
|
/**
|
|
478
480
|
* Detect highlights in a resource (streaming)
|
|
479
481
|
*
|
|
@@ -481,13 +483,15 @@ declare class SSEClient {
|
|
|
481
483
|
*
|
|
482
484
|
* @param resourceId - Resource URI or ID
|
|
483
485
|
* @param request - Detection configuration (optional instructions)
|
|
486
|
+
* @param options - Request options (auth token)
|
|
484
487
|
* @returns SSE stream controller with progress/complete/error callbacks
|
|
485
488
|
*
|
|
486
489
|
* @example
|
|
487
490
|
* ```typescript
|
|
488
491
|
* const stream = sseClient.detectHighlights(
|
|
489
492
|
* 'http://localhost:4000/resources/doc-123',
|
|
490
|
-
* { instructions: 'Focus on key technical points' }
|
|
493
|
+
* { instructions: 'Focus on key technical points' },
|
|
494
|
+
* { auth: 'your-token' }
|
|
491
495
|
* );
|
|
492
496
|
*
|
|
493
497
|
* stream.onProgress((progress) => {
|
|
@@ -507,7 +511,7 @@ declare class SSEClient {
|
|
|
507
511
|
* stream.close();
|
|
508
512
|
* ```
|
|
509
513
|
*/
|
|
510
|
-
detectHighlights(resourceId: ResourceUri, request?: DetectHighlightsStreamRequest): SSEStream<HighlightDetectionProgress, HighlightDetectionProgress>;
|
|
514
|
+
detectHighlights(resourceId: ResourceUri, request?: DetectHighlightsStreamRequest, options?: SSERequestOptions): SSEStream<HighlightDetectionProgress, HighlightDetectionProgress>;
|
|
511
515
|
/**
|
|
512
516
|
* Detect assessments in a resource (streaming)
|
|
513
517
|
*
|
|
@@ -515,13 +519,15 @@ declare class SSEClient {
|
|
|
515
519
|
*
|
|
516
520
|
* @param resourceId - Resource URI or ID
|
|
517
521
|
* @param request - Detection configuration (optional instructions)
|
|
522
|
+
* @param options - Request options (auth token)
|
|
518
523
|
* @returns SSE stream controller with progress/complete/error callbacks
|
|
519
524
|
*
|
|
520
525
|
* @example
|
|
521
526
|
* ```typescript
|
|
522
527
|
* const stream = sseClient.detectAssessments(
|
|
523
528
|
* 'http://localhost:4000/resources/doc-123',
|
|
524
|
-
* { instructions: 'Evaluate claims for accuracy' }
|
|
529
|
+
* { instructions: 'Evaluate claims for accuracy' },
|
|
530
|
+
* { auth: 'your-token' }
|
|
525
531
|
* );
|
|
526
532
|
*
|
|
527
533
|
* stream.onProgress((progress) => {
|
|
@@ -541,7 +547,7 @@ declare class SSEClient {
|
|
|
541
547
|
* stream.close();
|
|
542
548
|
* ```
|
|
543
549
|
*/
|
|
544
|
-
detectAssessments(resourceId: ResourceUri, request?: DetectAssessmentsStreamRequest): SSEStream<AssessmentDetectionProgress, AssessmentDetectionProgress>;
|
|
550
|
+
detectAssessments(resourceId: ResourceUri, request?: DetectAssessmentsStreamRequest, options?: SSERequestOptions): SSEStream<AssessmentDetectionProgress, AssessmentDetectionProgress>;
|
|
545
551
|
/**
|
|
546
552
|
* Detect comments in a resource (streaming)
|
|
547
553
|
*
|
|
@@ -551,14 +557,19 @@ declare class SSEClient {
|
|
|
551
557
|
*
|
|
552
558
|
* @param resourceId - Resource URI or ID
|
|
553
559
|
* @param request - Detection configuration (optional instructions and tone)
|
|
560
|
+
* @param options - Request options (auth token)
|
|
554
561
|
* @returns SSE stream controller with progress/complete/error callbacks
|
|
555
562
|
*
|
|
556
563
|
* @example
|
|
557
564
|
* ```typescript
|
|
558
|
-
* const stream = sseClient.detectComments(
|
|
559
|
-
*
|
|
560
|
-
*
|
|
561
|
-
*
|
|
565
|
+
* const stream = sseClient.detectComments(
|
|
566
|
+
* 'http://localhost:4000/resources/doc-123',
|
|
567
|
+
* {
|
|
568
|
+
* instructions: 'Focus on technical terminology',
|
|
569
|
+
* tone: 'scholarly'
|
|
570
|
+
* },
|
|
571
|
+
* { auth: 'your-token' }
|
|
572
|
+
* );
|
|
562
573
|
*
|
|
563
574
|
* stream.onProgress((progress) => {
|
|
564
575
|
* console.log(`${progress.status}: ${progress.percentage}%`);
|
|
@@ -576,7 +587,7 @@ declare class SSEClient {
|
|
|
576
587
|
* stream.close();
|
|
577
588
|
* ```
|
|
578
589
|
*/
|
|
579
|
-
detectComments(resourceId: ResourceUri, request?: DetectCommentsStreamRequest): SSEStream<CommentDetectionProgress, CommentDetectionProgress>;
|
|
590
|
+
detectComments(resourceId: ResourceUri, request?: DetectCommentsStreamRequest, options?: SSERequestOptions): SSEStream<CommentDetectionProgress, CommentDetectionProgress>;
|
|
580
591
|
/**
|
|
581
592
|
* Detect tags in a resource (streaming)
|
|
582
593
|
*
|
|
@@ -586,14 +597,19 @@ declare class SSEClient {
|
|
|
586
597
|
*
|
|
587
598
|
* @param resourceId - Resource URI or ID
|
|
588
599
|
* @param request - Detection configuration (schema and categories to detect)
|
|
600
|
+
* @param options - Request options (auth token)
|
|
589
601
|
* @returns SSE stream controller with progress/complete/error callbacks
|
|
590
602
|
*
|
|
591
603
|
* @example
|
|
592
604
|
* ```typescript
|
|
593
|
-
* const stream = sseClient.detectTags(
|
|
594
|
-
*
|
|
595
|
-
*
|
|
596
|
-
*
|
|
605
|
+
* const stream = sseClient.detectTags(
|
|
606
|
+
* 'http://localhost:4000/resources/doc-123',
|
|
607
|
+
* {
|
|
608
|
+
* schemaId: 'legal-irac',
|
|
609
|
+
* categories: ['Issue', 'Rule', 'Application', 'Conclusion']
|
|
610
|
+
* },
|
|
611
|
+
* { auth: 'your-token' }
|
|
612
|
+
* );
|
|
597
613
|
*
|
|
598
614
|
* stream.onProgress((progress) => {
|
|
599
615
|
* console.log(`${progress.status}: ${progress.percentage}%`);
|
|
@@ -612,7 +628,7 @@ declare class SSEClient {
|
|
|
612
628
|
* stream.close();
|
|
613
629
|
* ```
|
|
614
630
|
*/
|
|
615
|
-
detectTags(resourceId: ResourceUri, request: DetectTagsStreamRequest): SSEStream<TagDetectionProgress, TagDetectionProgress>;
|
|
631
|
+
detectTags(resourceId: ResourceUri, request: DetectTagsStreamRequest, options?: SSERequestOptions): SSEStream<TagDetectionProgress, TagDetectionProgress>;
|
|
616
632
|
/**
|
|
617
633
|
* Subscribe to resource events (long-lived stream)
|
|
618
634
|
*
|
|
@@ -622,11 +638,15 @@ declare class SSEClient {
|
|
|
622
638
|
* This stream does NOT have a complete event - it stays open until explicitly closed.
|
|
623
639
|
*
|
|
624
640
|
* @param resourceId - Resource URI or ID to subscribe to
|
|
641
|
+
* @param options - Request options (auth token)
|
|
625
642
|
* @returns SSE stream controller with event callback
|
|
626
643
|
*
|
|
627
644
|
* @example
|
|
628
645
|
* ```typescript
|
|
629
|
-
* const stream = sseClient.resourceEvents(
|
|
646
|
+
* const stream = sseClient.resourceEvents(
|
|
647
|
+
* 'http://localhost:4000/resources/doc-123',
|
|
648
|
+
* { auth: 'your-token' }
|
|
649
|
+
* );
|
|
630
650
|
*
|
|
631
651
|
* stream.onProgress((event) => {
|
|
632
652
|
* console.log(`Event: ${event.type}`);
|
|
@@ -643,7 +663,7 @@ declare class SSEClient {
|
|
|
643
663
|
* stream.close();
|
|
644
664
|
* ```
|
|
645
665
|
*/
|
|
646
|
-
resourceEvents(resourceId: ResourceUri): SSEStream<any, never>;
|
|
666
|
+
resourceEvents(resourceId: ResourceUri, options?: SSERequestOptions): SSEStream<any, never>;
|
|
647
667
|
}
|
|
648
668
|
|
|
649
669
|
/**
|
|
@@ -689,20 +709,26 @@ declare class APIError extends Error {
|
|
|
689
709
|
}
|
|
690
710
|
interface SemiontApiClientConfig {
|
|
691
711
|
baseUrl: BaseUrl;
|
|
692
|
-
accessToken?: AccessToken;
|
|
693
712
|
timeout?: number;
|
|
694
713
|
retry?: number;
|
|
695
714
|
logger?: Logger;
|
|
696
715
|
}
|
|
716
|
+
/**
|
|
717
|
+
* Options for individual API requests
|
|
718
|
+
*/
|
|
719
|
+
interface RequestOptions {
|
|
720
|
+
/** Access token for this request */
|
|
721
|
+
auth?: AccessToken;
|
|
722
|
+
}
|
|
697
723
|
/**
|
|
698
724
|
* Semiont API Client
|
|
699
725
|
*
|
|
700
726
|
* Provides type-safe methods for all Semiont backend API endpoints.
|
|
727
|
+
* This client is fully stateless - authentication must be provided per request.
|
|
701
728
|
*/
|
|
702
729
|
declare class SemiontApiClient {
|
|
703
730
|
private http;
|
|
704
731
|
private baseUrl;
|
|
705
|
-
private accessToken;
|
|
706
732
|
private logger?;
|
|
707
733
|
/**
|
|
708
734
|
* SSE streaming client for real-time operations
|
|
@@ -714,7 +740,8 @@ declare class SemiontApiClient {
|
|
|
714
740
|
* ```typescript
|
|
715
741
|
* const stream = client.sse.detectAnnotations(
|
|
716
742
|
* resourceId,
|
|
717
|
-
* { entityTypes: ['Person', 'Organization'] }
|
|
743
|
+
* { entityTypes: ['Person', 'Organization'] },
|
|
744
|
+
* { auth: accessToken }
|
|
718
745
|
* );
|
|
719
746
|
*
|
|
720
747
|
* stream.onProgress((p) => console.log(p.message));
|
|
@@ -724,21 +751,13 @@ declare class SemiontApiClient {
|
|
|
724
751
|
*/
|
|
725
752
|
readonly sse: SSEClient;
|
|
726
753
|
constructor(config: SemiontApiClientConfig);
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
clearAccessToken(): void;
|
|
735
|
-
authenticatePassword(email: Email, password: string): Promise<ResponseContent<paths['/api/tokens/password']['post']>>;
|
|
736
|
-
refreshToken(token: RefreshToken): Promise<ResponseContent<paths['/api/tokens/refresh']['post']>>;
|
|
737
|
-
authenticateGoogle(credential: GoogleCredential): Promise<ResponseContent<paths['/api/tokens/google']['post']>>;
|
|
738
|
-
generateMCPToken(): Promise<ResponseContent<paths['/api/tokens/mcp-generate']['post']>>;
|
|
739
|
-
getMe(): Promise<ResponseContent<paths['/api/users/me']['get']>>;
|
|
740
|
-
acceptTerms(): Promise<ResponseContent<paths['/api/users/accept-terms']['post']>>;
|
|
741
|
-
logout(): Promise<ResponseContent<paths['/api/users/logout']['post']>>;
|
|
754
|
+
authenticatePassword(email: Email, password: string, options?: RequestOptions): Promise<ResponseContent<paths['/api/tokens/password']['post']>>;
|
|
755
|
+
refreshToken(token: RefreshToken, options?: RequestOptions): Promise<ResponseContent<paths['/api/tokens/refresh']['post']>>;
|
|
756
|
+
authenticateGoogle(credential: GoogleCredential, options?: RequestOptions): Promise<ResponseContent<paths['/api/tokens/google']['post']>>;
|
|
757
|
+
generateMCPToken(options?: RequestOptions): Promise<ResponseContent<paths['/api/tokens/mcp-generate']['post']>>;
|
|
758
|
+
getMe(options?: RequestOptions): Promise<ResponseContent<paths['/api/users/me']['get']>>;
|
|
759
|
+
acceptTerms(options?: RequestOptions): Promise<ResponseContent<paths['/api/users/accept-terms']['post']>>;
|
|
760
|
+
logout(options?: RequestOptions): Promise<ResponseContent<paths['/api/users/logout']['post']>>;
|
|
742
761
|
/**
|
|
743
762
|
* Create a new resource with binary content support
|
|
744
763
|
*
|
|
@@ -751,6 +770,7 @@ declare class SemiontApiClient {
|
|
|
751
770
|
* @param data.creationMethod - Optional creation method
|
|
752
771
|
* @param data.sourceAnnotationId - Optional source annotation ID
|
|
753
772
|
* @param data.sourceResourceId - Optional source resource ID
|
|
773
|
+
* @param options - Request options including auth
|
|
754
774
|
*/
|
|
755
775
|
createResource(data: {
|
|
756
776
|
name: string;
|
|
@@ -761,32 +781,33 @@ declare class SemiontApiClient {
|
|
|
761
781
|
creationMethod?: string;
|
|
762
782
|
sourceAnnotationId?: string;
|
|
763
783
|
sourceResourceId?: string;
|
|
764
|
-
}): Promise<ResponseContent<paths['/resources']['post']>>;
|
|
765
|
-
getResource(resourceUri: ResourceUri): Promise<ResponseContent<paths['/resources/{id}']['get']>>;
|
|
784
|
+
}, options?: RequestOptions): Promise<ResponseContent<paths['/resources']['post']>>;
|
|
785
|
+
getResource(resourceUri: ResourceUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}']['get']>>;
|
|
766
786
|
/**
|
|
767
787
|
* Get resource representation using W3C content negotiation
|
|
768
788
|
* Returns raw binary content (images, PDFs, text, etc.) with content type
|
|
769
789
|
*
|
|
770
790
|
* @param resourceUri - Full resource URI
|
|
771
|
-
* @param options - Options including Accept header for content negotiation
|
|
791
|
+
* @param options - Options including Accept header for content negotiation and auth
|
|
772
792
|
* @returns Object with data (ArrayBuffer) and contentType (string)
|
|
773
793
|
*
|
|
774
794
|
* @example
|
|
775
795
|
* ```typescript
|
|
776
796
|
* // Get markdown representation
|
|
777
|
-
* const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'text/markdown' });
|
|
797
|
+
* const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'text/markdown', auth: token });
|
|
778
798
|
* const markdown = new TextDecoder().decode(data);
|
|
779
799
|
*
|
|
780
800
|
* // Get image representation
|
|
781
|
-
* const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'image/png' });
|
|
801
|
+
* const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'image/png', auth: token });
|
|
782
802
|
* const blob = new Blob([data], { type: contentType });
|
|
783
803
|
*
|
|
784
804
|
* // Get PDF representation
|
|
785
|
-
* const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'application/pdf' });
|
|
805
|
+
* const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'application/pdf', auth: token });
|
|
786
806
|
* ```
|
|
787
807
|
*/
|
|
788
808
|
getResourceRepresentation(resourceUri: ResourceUri, options?: {
|
|
789
809
|
accept?: ContentFormat;
|
|
810
|
+
auth?: AccessToken;
|
|
790
811
|
}): Promise<{
|
|
791
812
|
data: ArrayBuffer;
|
|
792
813
|
contentType: string;
|
|
@@ -800,14 +821,15 @@ declare class SemiontApiClient {
|
|
|
800
821
|
* until the stream is fully consumed or closed.
|
|
801
822
|
*
|
|
802
823
|
* @param resourceUri - Full resource URI
|
|
803
|
-
* @param options - Options including Accept header for content negotiation
|
|
824
|
+
* @param options - Options including Accept header for content negotiation and auth
|
|
804
825
|
* @returns Object with stream (ReadableStream) and contentType (string)
|
|
805
826
|
*
|
|
806
827
|
* @example
|
|
807
828
|
* ```typescript
|
|
808
829
|
* // Stream large file
|
|
809
830
|
* const { stream, contentType } = await client.getResourceRepresentationStream(rUri, {
|
|
810
|
-
* accept: 'video/mp4'
|
|
831
|
+
* accept: 'video/mp4',
|
|
832
|
+
* auth: token
|
|
811
833
|
* });
|
|
812
834
|
*
|
|
813
835
|
* // Consume stream chunk by chunk (never loads entire file into memory)
|
|
@@ -828,44 +850,46 @@ declare class SemiontApiClient {
|
|
|
828
850
|
*/
|
|
829
851
|
getResourceRepresentationStream(resourceUri: ResourceUri, options?: {
|
|
830
852
|
accept?: ContentFormat;
|
|
853
|
+
auth?: AccessToken;
|
|
831
854
|
}): Promise<{
|
|
832
855
|
stream: ReadableStream<Uint8Array>;
|
|
833
856
|
contentType: string;
|
|
834
857
|
}>;
|
|
835
|
-
listResources(limit?: number, archived?: boolean, query?: SearchQuery): Promise<ResponseContent<paths['/resources']['get']>>;
|
|
836
|
-
updateResource(resourceUri: ResourceUri, data: RequestContent<paths['/resources/{id}']['patch']
|
|
837
|
-
getResourceEvents(resourceUri: ResourceUri): Promise<{
|
|
858
|
+
listResources(limit?: number, archived?: boolean, query?: SearchQuery, options?: RequestOptions): Promise<ResponseContent<paths['/resources']['get']>>;
|
|
859
|
+
updateResource(resourceUri: ResourceUri, data: RequestContent<paths['/resources/{id}']['patch']>, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}']['patch']>>;
|
|
860
|
+
getResourceEvents(resourceUri: ResourceUri, options?: RequestOptions): Promise<{
|
|
838
861
|
events: any[];
|
|
839
862
|
}>;
|
|
840
|
-
getResourceAnnotations(resourceUri: ResourceUri): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
|
|
863
|
+
getResourceAnnotations(resourceUri: ResourceUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
|
|
841
864
|
getAnnotationLLMContext(resourceUri: ResourceUri, annotationId: string, options?: {
|
|
842
865
|
contextWindow?: number;
|
|
866
|
+
auth?: AccessToken;
|
|
843
867
|
}): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/llm-context']['get']>>;
|
|
844
|
-
getResourceReferencedBy(resourceUri: ResourceUri): Promise<{
|
|
868
|
+
getResourceReferencedBy(resourceUri: ResourceUri, options?: RequestOptions): Promise<{
|
|
845
869
|
referencedBy: any[];
|
|
846
870
|
}>;
|
|
847
|
-
generateCloneToken(resourceUri: ResourceUri): Promise<ResponseContent<paths['/resources/{id}/clone-with-token']['post']>>;
|
|
848
|
-
getResourceByToken(token: CloneToken): Promise<ResponseContent<paths['/api/resources/token/{token}']['get']>>;
|
|
849
|
-
createResourceFromToken(data: RequestContent<paths['/api/resources/create-from-token']['post']
|
|
850
|
-
createAnnotation(resourceUri: ResourceUri, data: RequestContent<paths['/resources/{id}/annotations']['post']
|
|
851
|
-
getAnnotation(annotationUri: AnnotationUri): Promise<ResponseContent<paths['/annotations/{id}']['get']>>;
|
|
852
|
-
getResourceAnnotation(annotationUri: ResourceAnnotationUri): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}']['get']>>;
|
|
853
|
-
listAnnotations(resourceUri: ResourceUri, motivation?: Motivation): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
|
|
854
|
-
deleteAnnotation(annotationUri: ResourceAnnotationUri): Promise<void>;
|
|
855
|
-
updateAnnotationBody(annotationUri: ResourceAnnotationUri, data: RequestContent<paths['/resources/{resourceId}/annotations/{annotationId}/body']['put']
|
|
856
|
-
getAnnotationHistory(annotationUri: ResourceAnnotationUri): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/history']['get']>>;
|
|
857
|
-
addEntityType(type: EntityType): Promise<ResponseContent<paths['/api/entity-types']['post']>>;
|
|
858
|
-
addEntityTypesBulk(types: EntityType[]): Promise<ResponseContent<paths['/api/entity-types/bulk']['post']>>;
|
|
859
|
-
listEntityTypes(): Promise<ResponseContent<paths['/api/entity-types']['get']>>;
|
|
860
|
-
listUsers(): Promise<ResponseContent<paths['/api/admin/users']['get']>>;
|
|
861
|
-
getUserStats(): Promise<ResponseContent<paths['/api/admin/users/stats']['get']>>;
|
|
871
|
+
generateCloneToken(resourceUri: ResourceUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/clone-with-token']['post']>>;
|
|
872
|
+
getResourceByToken(token: CloneToken, options?: RequestOptions): Promise<ResponseContent<paths['/api/resources/token/{token}']['get']>>;
|
|
873
|
+
createResourceFromToken(data: RequestContent<paths['/api/resources/create-from-token']['post']>, options?: RequestOptions): Promise<ResponseContent<paths['/api/resources/create-from-token']['post']>>;
|
|
874
|
+
createAnnotation(resourceUri: ResourceUri, data: RequestContent<paths['/resources/{id}/annotations']['post']>, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/annotations']['post']>>;
|
|
875
|
+
getAnnotation(annotationUri: AnnotationUri, options?: RequestOptions): Promise<ResponseContent<paths['/annotations/{id}']['get']>>;
|
|
876
|
+
getResourceAnnotation(annotationUri: ResourceAnnotationUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}']['get']>>;
|
|
877
|
+
listAnnotations(resourceUri: ResourceUri, motivation?: Motivation, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
|
|
878
|
+
deleteAnnotation(annotationUri: ResourceAnnotationUri, options?: RequestOptions): Promise<void>;
|
|
879
|
+
updateAnnotationBody(annotationUri: ResourceAnnotationUri, data: RequestContent<paths['/resources/{resourceId}/annotations/{annotationId}/body']['put']>, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/body']['put']>>;
|
|
880
|
+
getAnnotationHistory(annotationUri: ResourceAnnotationUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/history']['get']>>;
|
|
881
|
+
addEntityType(type: EntityType, options?: RequestOptions): Promise<ResponseContent<paths['/api/entity-types']['post']>>;
|
|
882
|
+
addEntityTypesBulk(types: EntityType[], options?: RequestOptions): Promise<ResponseContent<paths['/api/entity-types/bulk']['post']>>;
|
|
883
|
+
listEntityTypes(options?: RequestOptions): Promise<ResponseContent<paths['/api/entity-types']['get']>>;
|
|
884
|
+
listUsers(options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/users']['get']>>;
|
|
885
|
+
getUserStats(options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/users/stats']['get']>>;
|
|
862
886
|
/**
|
|
863
887
|
* Update a user by ID
|
|
864
888
|
* Note: Users use DID identifiers (did:web:domain:users:id), not HTTP URIs.
|
|
865
889
|
*/
|
|
866
|
-
updateUser(id: UserDID, data: RequestContent<paths['/api/admin/users/{id}']['patch']
|
|
867
|
-
getOAuthConfig(): Promise<ResponseContent<paths['/api/admin/oauth/config']['get']>>;
|
|
868
|
-
getJobStatus(id: JobId): Promise<ResponseContent<paths['/api/jobs/{id}']['get']>>;
|
|
890
|
+
updateUser(id: UserDID, data: RequestContent<paths['/api/admin/users/{id}']['patch']>, options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/users/{id}']['patch']>>;
|
|
891
|
+
getOAuthConfig(options?: RequestOptions): Promise<ResponseContent<paths['/api/admin/oauth/config']['get']>>;
|
|
892
|
+
getJobStatus(id: JobId, options?: RequestOptions): Promise<ResponseContent<paths['/api/jobs/{id}']['get']>>;
|
|
869
893
|
/**
|
|
870
894
|
* Poll a job until it completes or fails
|
|
871
895
|
* @param id - The job ID to poll
|
|
@@ -876,15 +900,17 @@ declare class SemiontApiClient {
|
|
|
876
900
|
interval?: number;
|
|
877
901
|
timeout?: number;
|
|
878
902
|
onProgress?: (status: ResponseContent<paths['/api/jobs/{id}']['get']>) => void;
|
|
903
|
+
auth?: AccessToken;
|
|
879
904
|
}): Promise<ResponseContent<paths['/api/jobs/{id}']['get']>>;
|
|
880
905
|
getResourceLLMContext(resourceUri: ResourceUri, options?: {
|
|
881
906
|
depth?: number;
|
|
882
907
|
maxResources?: number;
|
|
883
908
|
includeContent?: boolean;
|
|
884
909
|
includeSummary?: boolean;
|
|
910
|
+
auth?: AccessToken;
|
|
885
911
|
}): Promise<ResponseContent<paths['/resources/{id}/llm-context']['get']>>;
|
|
886
|
-
healthCheck(): Promise<ResponseContent<paths['/api/health']['get']>>;
|
|
887
|
-
getStatus(): Promise<ResponseContent<paths['/api/status']['get']>>;
|
|
912
|
+
healthCheck(options?: RequestOptions): Promise<ResponseContent<paths['/api/health']['get']>>;
|
|
913
|
+
getStatus(options?: RequestOptions): Promise<ResponseContent<paths['/api/status']['get']>>;
|
|
888
914
|
}
|
|
889
915
|
|
|
890
916
|
/**
|
|
@@ -959,4 +985,4 @@ declare function getMimeCategory(mimeType: string): MimeCategory;
|
|
|
959
985
|
type GenerationContext = components['schemas']['GenerationContext'];
|
|
960
986
|
type AnnotationLLMContextResponse = components['schemas']['AnnotationLLMContextResponse'];
|
|
961
987
|
|
|
962
|
-
export { APIError, AccessToken, type AnnotationLLMContextResponse, AnnotationUri, BaseUrl, CloneToken, ContentFormat, type DetectAnnotationsStreamRequest, type DetectionProgress, Email, EntityType, type GenerateResourceStreamRequest, type GenerationContext, type GenerationProgress, GoogleCredential, JobId, type Logger, type MimeCategory, Motivation, RefreshToken, ResourceAnnotationUri, ResourceUri, SSEClient, type SSEClientConfig, type SSEStream, SearchQuery, SemiontApiClient, type SemiontApiClientConfig, UserDID, components, getExtensionForMimeType, getMimeCategory, isImageMimeType, isPdfMimeType, isTextMimeType, paths };
|
|
988
|
+
export { APIError, AccessToken, type AnnotationLLMContextResponse, AnnotationUri, BaseUrl, CloneToken, ContentFormat, type DetectAnnotationsStreamRequest, type DetectionProgress, Email, EntityType, type GenerateResourceStreamRequest, type GenerationContext, type GenerationProgress, GoogleCredential, JobId, type Logger, type MimeCategory, Motivation, RefreshToken, type RequestOptions, ResourceAnnotationUri, ResourceUri, SSEClient, type SSEClientConfig, type SSEStream, SearchQuery, SemiontApiClient, type SemiontApiClientConfig, UserDID, components, getExtensionForMimeType, getMimeCategory, isImageMimeType, isPdfMimeType, isTextMimeType, paths };
|