@semiont/api-client 0.2.33-build.78 → 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 CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BaseUrl, A as AccessToken, R as ResourceUri, E as EntityType, 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-BjpP_lGG.js';
2
- export { $ as $defs, aN as AuthCode, av as BoundingBox, W as EventMetadata, F as FragmentSelector, aK as JWTTokenSchema, ab as LOCALES, aa as LocaleInfo, aO as MCPToken, au as Point, a5 as ResourceCreationDetails, X as ResourceEventType, i as Selector, V as StoredEvent, h as SvgSelector, a7 as TextPosition, T as TextPositionSelector, g as TextQuoteSelector, aD as ValidatedAnnotation, aI as ValidationFailure, aJ as ValidationResult, aH as ValidationSuccess, aS as accessToken, b0 as annotationUri, aQ as authCode, a_ as baseUrl, aV as cloneToken, ay as createCircleSvg, ax as createPolygonSvg, aw as createRectangleSvg, at as decodeRepresentation, aG as decodeWithCharset, aP as email, aY as entityType, Q as extractBoundingBox, aF as extractCharset, aC as extractContext, a8 as findTextWithContext, a0 as formatEventType, af as formatLocaleDisplay, a2 as formatRelativeTime, ag as getAllLocaleCodes, H as getAnnotationExactText, Y as getAnnotationUriFromEvent, j as getBodySource, k as getBodyType, ak as getChecksum, x as getCommentText, an as getCreator, ao as getDerivedFrom, a3 as getEventDisplayContent, a1 as getEventEmoji, a4 as getEventEntityTypes, D as getExactText, O as getFragmentSelector, al as getLanguage, ae as getLocaleEnglishName, ac as getLocaleInfo, ad as getLocaleNativeName, as as getNodeEncoding, aj as getPrimaryMediaType, ai as getPrimaryRepresentation, I as getPrimarySelector, a6 as getResourceCreationDetails, aq as getResourceEntityTypes, ah as getResourceId, am as getStorageUri, N as getSvgSelector, n as getTargetSelector, m as getTargetSource, K as getTextPositionSelector, L as getTextQuoteSelector, aR as googleCredential, q as hasTargetSelector, ap as isArchived, t as isAssessment, l as isBodyResolved, u as isComment, ar as isDraft, Z as isEventRelatedToAnnotation, r as isHighlight, s as isReference, z as isResolvedReference, _ as isResourceEvent, y as isStubReference, v as isTag, aM as isValidEmail, aW as jobId, aU as mcpToken, aA as normalizeCoordinates, o as operations, az as parseSvgSelector, aT as refreshToken, b1 as resourceAnnotationUri, a$ as resourceUri, aB as scaleSvgToNative, aZ as searchQuery, aX as userDID, aE as validateAndCorrectOffsets, aL as validateData, P as validateSvgMarkup, a9 as verifyPosition, w as webhooks } from './index-BjpP_lGG.js';
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
+ 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
  /**
5
5
  * TypeScript types for Server-Sent Events (SSE) streaming
@@ -205,39 +205,18 @@ interface TagDetectionProgress {
205
205
  * as it occurs. Used for real-time collaboration - multiple users see each
206
206
  * other's changes as they happen.
207
207
  *
208
+ * Re-exported from @semiont/core (authoritative source).
209
+ * The discriminated union type provides type-safe event handling.
210
+ *
208
211
  * @example
209
212
  * ```typescript
210
- * stream.onEvent((event: ResourceEvent) => {
213
+ * stream.onEvent((event) => {
211
214
  * console.log(`Event: ${event.type}`);
212
215
  * console.log(`User: ${event.userId}`);
213
216
  * console.log(`Payload:`, event.payload);
214
- * console.log(`Sequence: ${event.metadata.sequenceNumber}`);
215
217
  * });
216
218
  * ```
217
219
  */
218
- interface ResourceEvent {
219
- /** Event ID (unique) */
220
- id: string;
221
- /** Event type (e.g., 'resource.created', 'annotation.created', etc.) */
222
- type: string;
223
- /** ISO 8601 timestamp */
224
- timestamp: string;
225
- /** User ID who triggered the event */
226
- userId: string;
227
- /** Resource ID this event relates to */
228
- resourceId: string;
229
- /** Event-specific payload (varies by event type) */
230
- payload: any;
231
- /** Event store metadata */
232
- metadata: {
233
- /** Monotonically increasing sequence number */
234
- sequenceNumber: number;
235
- /** SHA-256 hash of previous event (for integrity) */
236
- prevEventHash: string;
237
- /** SHA-256 checksum of this event */
238
- checksum: string;
239
- };
240
- }
241
220
  /**
242
221
  * SSE stream controller interface
243
222
  *
@@ -374,25 +353,32 @@ interface DetectTagsStreamRequest {
374
353
  */
375
354
  interface SSEClientConfig {
376
355
  baseUrl: BaseUrl;
377
- accessToken?: AccessToken;
378
356
  logger?: Logger;
379
357
  }
358
+ /**
359
+ * Options for SSE requests
360
+ */
361
+ interface SSERequestOptions {
362
+ auth?: AccessToken;
363
+ }
380
364
  /**
381
365
  * SSE Client for real-time streaming operations
382
366
  *
383
367
  * Separate from the main HTTP client to clearly mark streaming endpoints.
384
368
  * Uses native fetch() instead of ky for SSE support.
385
369
  *
370
+ * This client is stateless - auth tokens are passed per-request via options.
371
+ *
386
372
  * @example
387
373
  * ```typescript
388
374
  * const sseClient = new SSEClient({
389
- * baseUrl: 'http://localhost:4000',
390
- * accessToken: 'your-token'
375
+ * baseUrl: 'http://localhost:4000'
391
376
  * });
392
377
  *
393
378
  * const stream = sseClient.detectAnnotations(
394
379
  * 'http://localhost:4000/resources/doc-123',
395
- * { entityTypes: ['Person', 'Organization'] }
380
+ * { entityTypes: ['Person', 'Organization'] },
381
+ * { auth: 'your-token' }
396
382
  * );
397
383
  *
398
384
  * stream.onProgress((p) => console.log(p.message));
@@ -402,17 +388,8 @@ interface SSEClientConfig {
402
388
  */
403
389
  declare class SSEClient {
404
390
  private baseUrl;
405
- private accessToken;
406
391
  private logger?;
407
392
  constructor(config: SSEClientConfig);
408
- /**
409
- * Set the access token for authenticated requests
410
- */
411
- setAccessToken(token: AccessToken): void;
412
- /**
413
- * Clear the access token
414
- */
415
- clearAccessToken(): void;
416
393
  /**
417
394
  * Get common headers for SSE requests
418
395
  */
@@ -432,13 +409,15 @@ declare class SSEClient {
432
409
  *
433
410
  * @param resourceId - Resource URI or ID
434
411
  * @param request - Detection configuration (entity types to detect)
412
+ * @param options - Request options (auth token)
435
413
  * @returns SSE stream controller with progress/complete/error callbacks
436
414
  *
437
415
  * @example
438
416
  * ```typescript
439
417
  * const stream = sseClient.detectAnnotations(
440
418
  * 'http://localhost:4000/resources/doc-123',
441
- * { entityTypes: ['Person', 'Organization'] }
419
+ * { entityTypes: ['Person', 'Organization'] },
420
+ * { auth: 'your-token' }
442
421
  * );
443
422
  *
444
423
  * stream.onProgress((progress) => {
@@ -458,7 +437,7 @@ declare class SSEClient {
458
437
  * stream.close();
459
438
  * ```
460
439
  */
461
- detectAnnotations(resourceId: ResourceUri, request: DetectAnnotationsStreamRequest): SSEStream<DetectionProgress, DetectionProgress>;
440
+ detectAnnotations(resourceId: ResourceUri, request: DetectAnnotationsStreamRequest, options?: SSERequestOptions): SSEStream<DetectionProgress, DetectionProgress>;
462
441
  /**
463
442
  * Generate resource from annotation (streaming)
464
443
  *
@@ -467,6 +446,7 @@ declare class SSEClient {
467
446
  * @param resourceId - Source resource URI or ID
468
447
  * @param annotationId - Annotation URI or ID to use as generation source
469
448
  * @param request - Generation options (title, prompt, language)
449
+ * @param options - Request options (auth token)
470
450
  * @returns SSE stream controller with progress/complete/error callbacks
471
451
  *
472
452
  * @example
@@ -474,7 +454,8 @@ declare class SSEClient {
474
454
  * const stream = sseClient.generateResourceFromAnnotation(
475
455
  * 'http://localhost:4000/resources/doc-123',
476
456
  * 'http://localhost:4000/annotations/ann-456',
477
- * { language: 'es', title: 'Spanish Summary' }
457
+ * { language: 'es', title: 'Spanish Summary' },
458
+ * { auth: 'your-token' }
478
459
  * );
479
460
  *
480
461
  * stream.onProgress((progress) => {
@@ -494,7 +475,7 @@ declare class SSEClient {
494
475
  * stream.close();
495
476
  * ```
496
477
  */
497
- generateResourceFromAnnotation(resourceId: ResourceUri, annotationId: AnnotationUri, request: GenerateResourceStreamRequest): SSEStream<GenerationProgress, GenerationProgress>;
478
+ generateResourceFromAnnotation(resourceId: ResourceUri, annotationId: AnnotationUri, request: GenerateResourceStreamRequest, options?: SSERequestOptions): SSEStream<GenerationProgress, GenerationProgress>;
498
479
  /**
499
480
  * Detect highlights in a resource (streaming)
500
481
  *
@@ -502,13 +483,15 @@ declare class SSEClient {
502
483
  *
503
484
  * @param resourceId - Resource URI or ID
504
485
  * @param request - Detection configuration (optional instructions)
486
+ * @param options - Request options (auth token)
505
487
  * @returns SSE stream controller with progress/complete/error callbacks
506
488
  *
507
489
  * @example
508
490
  * ```typescript
509
491
  * const stream = sseClient.detectHighlights(
510
492
  * 'http://localhost:4000/resources/doc-123',
511
- * { instructions: 'Focus on key technical points' }
493
+ * { instructions: 'Focus on key technical points' },
494
+ * { auth: 'your-token' }
512
495
  * );
513
496
  *
514
497
  * stream.onProgress((progress) => {
@@ -528,7 +511,7 @@ declare class SSEClient {
528
511
  * stream.close();
529
512
  * ```
530
513
  */
531
- detectHighlights(resourceId: ResourceUri, request?: DetectHighlightsStreamRequest): SSEStream<HighlightDetectionProgress, HighlightDetectionProgress>;
514
+ detectHighlights(resourceId: ResourceUri, request?: DetectHighlightsStreamRequest, options?: SSERequestOptions): SSEStream<HighlightDetectionProgress, HighlightDetectionProgress>;
532
515
  /**
533
516
  * Detect assessments in a resource (streaming)
534
517
  *
@@ -536,13 +519,15 @@ declare class SSEClient {
536
519
  *
537
520
  * @param resourceId - Resource URI or ID
538
521
  * @param request - Detection configuration (optional instructions)
522
+ * @param options - Request options (auth token)
539
523
  * @returns SSE stream controller with progress/complete/error callbacks
540
524
  *
541
525
  * @example
542
526
  * ```typescript
543
527
  * const stream = sseClient.detectAssessments(
544
528
  * 'http://localhost:4000/resources/doc-123',
545
- * { instructions: 'Evaluate claims for accuracy' }
529
+ * { instructions: 'Evaluate claims for accuracy' },
530
+ * { auth: 'your-token' }
546
531
  * );
547
532
  *
548
533
  * stream.onProgress((progress) => {
@@ -562,7 +547,7 @@ declare class SSEClient {
562
547
  * stream.close();
563
548
  * ```
564
549
  */
565
- detectAssessments(resourceId: ResourceUri, request?: DetectAssessmentsStreamRequest): SSEStream<AssessmentDetectionProgress, AssessmentDetectionProgress>;
550
+ detectAssessments(resourceId: ResourceUri, request?: DetectAssessmentsStreamRequest, options?: SSERequestOptions): SSEStream<AssessmentDetectionProgress, AssessmentDetectionProgress>;
566
551
  /**
567
552
  * Detect comments in a resource (streaming)
568
553
  *
@@ -572,14 +557,19 @@ declare class SSEClient {
572
557
  *
573
558
  * @param resourceId - Resource URI or ID
574
559
  * @param request - Detection configuration (optional instructions and tone)
560
+ * @param options - Request options (auth token)
575
561
  * @returns SSE stream controller with progress/complete/error callbacks
576
562
  *
577
563
  * @example
578
564
  * ```typescript
579
- * const stream = sseClient.detectComments('http://localhost:4000/resources/doc-123', {
580
- * instructions: 'Focus on technical terminology',
581
- * tone: 'scholarly'
582
- * });
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
+ * );
583
573
  *
584
574
  * stream.onProgress((progress) => {
585
575
  * console.log(`${progress.status}: ${progress.percentage}%`);
@@ -597,7 +587,7 @@ declare class SSEClient {
597
587
  * stream.close();
598
588
  * ```
599
589
  */
600
- detectComments(resourceId: ResourceUri, request?: DetectCommentsStreamRequest): SSEStream<CommentDetectionProgress, CommentDetectionProgress>;
590
+ detectComments(resourceId: ResourceUri, request?: DetectCommentsStreamRequest, options?: SSERequestOptions): SSEStream<CommentDetectionProgress, CommentDetectionProgress>;
601
591
  /**
602
592
  * Detect tags in a resource (streaming)
603
593
  *
@@ -607,14 +597,19 @@ declare class SSEClient {
607
597
  *
608
598
  * @param resourceId - Resource URI or ID
609
599
  * @param request - Detection configuration (schema and categories to detect)
600
+ * @param options - Request options (auth token)
610
601
  * @returns SSE stream controller with progress/complete/error callbacks
611
602
  *
612
603
  * @example
613
604
  * ```typescript
614
- * const stream = sseClient.detectTags('http://localhost:4000/resources/doc-123', {
615
- * schemaId: 'legal-irac',
616
- * categories: ['Issue', 'Rule', 'Application', 'Conclusion']
617
- * });
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
+ * );
618
613
  *
619
614
  * stream.onProgress((progress) => {
620
615
  * console.log(`${progress.status}: ${progress.percentage}%`);
@@ -633,7 +628,7 @@ declare class SSEClient {
633
628
  * stream.close();
634
629
  * ```
635
630
  */
636
- detectTags(resourceId: ResourceUri, request: DetectTagsStreamRequest): SSEStream<TagDetectionProgress, TagDetectionProgress>;
631
+ detectTags(resourceId: ResourceUri, request: DetectTagsStreamRequest, options?: SSERequestOptions): SSEStream<TagDetectionProgress, TagDetectionProgress>;
637
632
  /**
638
633
  * Subscribe to resource events (long-lived stream)
639
634
  *
@@ -643,11 +638,15 @@ declare class SSEClient {
643
638
  * This stream does NOT have a complete event - it stays open until explicitly closed.
644
639
  *
645
640
  * @param resourceId - Resource URI or ID to subscribe to
641
+ * @param options - Request options (auth token)
646
642
  * @returns SSE stream controller with event callback
647
643
  *
648
644
  * @example
649
645
  * ```typescript
650
- * const stream = sseClient.resourceEvents('http://localhost:4000/resources/doc-123');
646
+ * const stream = sseClient.resourceEvents(
647
+ * 'http://localhost:4000/resources/doc-123',
648
+ * { auth: 'your-token' }
649
+ * );
651
650
  *
652
651
  * stream.onProgress((event) => {
653
652
  * console.log(`Event: ${event.type}`);
@@ -664,7 +663,7 @@ declare class SSEClient {
664
663
  * stream.close();
665
664
  * ```
666
665
  */
667
- resourceEvents(resourceId: ResourceUri): SSEStream<ResourceEvent, never>;
666
+ resourceEvents(resourceId: ResourceUri, options?: SSERequestOptions): SSEStream<any, never>;
668
667
  }
669
668
 
670
669
  /**
@@ -710,20 +709,26 @@ declare class APIError extends Error {
710
709
  }
711
710
  interface SemiontApiClientConfig {
712
711
  baseUrl: BaseUrl;
713
- accessToken?: AccessToken;
714
712
  timeout?: number;
715
713
  retry?: number;
716
714
  logger?: Logger;
717
715
  }
716
+ /**
717
+ * Options for individual API requests
718
+ */
719
+ interface RequestOptions {
720
+ /** Access token for this request */
721
+ auth?: AccessToken;
722
+ }
718
723
  /**
719
724
  * Semiont API Client
720
725
  *
721
726
  * Provides type-safe methods for all Semiont backend API endpoints.
727
+ * This client is fully stateless - authentication must be provided per request.
722
728
  */
723
729
  declare class SemiontApiClient {
724
730
  private http;
725
731
  private baseUrl;
726
- private accessToken;
727
732
  private logger?;
728
733
  /**
729
734
  * SSE streaming client for real-time operations
@@ -735,7 +740,8 @@ declare class SemiontApiClient {
735
740
  * ```typescript
736
741
  * const stream = client.sse.detectAnnotations(
737
742
  * resourceId,
738
- * { entityTypes: ['Person', 'Organization'] }
743
+ * { entityTypes: ['Person', 'Organization'] },
744
+ * { auth: accessToken }
739
745
  * );
740
746
  *
741
747
  * stream.onProgress((p) => console.log(p.message));
@@ -745,21 +751,13 @@ declare class SemiontApiClient {
745
751
  */
746
752
  readonly sse: SSEClient;
747
753
  constructor(config: SemiontApiClientConfig);
748
- /**
749
- * Set the access token for authenticated requests
750
- */
751
- setAccessToken(token: AccessToken): void;
752
- /**
753
- * Clear the access token
754
- */
755
- clearAccessToken(): void;
756
- authenticatePassword(email: Email, password: string): Promise<ResponseContent<paths['/api/tokens/password']['post']>>;
757
- refreshToken(token: RefreshToken): Promise<ResponseContent<paths['/api/tokens/refresh']['post']>>;
758
- authenticateGoogle(credential: GoogleCredential): Promise<ResponseContent<paths['/api/tokens/google']['post']>>;
759
- generateMCPToken(): Promise<ResponseContent<paths['/api/tokens/mcp-generate']['post']>>;
760
- getMe(): Promise<ResponseContent<paths['/api/users/me']['get']>>;
761
- acceptTerms(): Promise<ResponseContent<paths['/api/users/accept-terms']['post']>>;
762
- 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']>>;
763
761
  /**
764
762
  * Create a new resource with binary content support
765
763
  *
@@ -772,6 +770,7 @@ declare class SemiontApiClient {
772
770
  * @param data.creationMethod - Optional creation method
773
771
  * @param data.sourceAnnotationId - Optional source annotation ID
774
772
  * @param data.sourceResourceId - Optional source resource ID
773
+ * @param options - Request options including auth
775
774
  */
776
775
  createResource(data: {
777
776
  name: string;
@@ -782,32 +781,33 @@ declare class SemiontApiClient {
782
781
  creationMethod?: string;
783
782
  sourceAnnotationId?: string;
784
783
  sourceResourceId?: string;
785
- }): Promise<ResponseContent<paths['/resources']['post']>>;
786
- 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']>>;
787
786
  /**
788
787
  * Get resource representation using W3C content negotiation
789
788
  * Returns raw binary content (images, PDFs, text, etc.) with content type
790
789
  *
791
790
  * @param resourceUri - Full resource URI
792
- * @param options - Options including Accept header for content negotiation
791
+ * @param options - Options including Accept header for content negotiation and auth
793
792
  * @returns Object with data (ArrayBuffer) and contentType (string)
794
793
  *
795
794
  * @example
796
795
  * ```typescript
797
796
  * // Get markdown representation
798
- * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'text/markdown' });
797
+ * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'text/markdown', auth: token });
799
798
  * const markdown = new TextDecoder().decode(data);
800
799
  *
801
800
  * // Get image representation
802
- * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'image/png' });
801
+ * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'image/png', auth: token });
803
802
  * const blob = new Blob([data], { type: contentType });
804
803
  *
805
804
  * // Get PDF representation
806
- * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'application/pdf' });
805
+ * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'application/pdf', auth: token });
807
806
  * ```
808
807
  */
809
808
  getResourceRepresentation(resourceUri: ResourceUri, options?: {
810
809
  accept?: ContentFormat;
810
+ auth?: AccessToken;
811
811
  }): Promise<{
812
812
  data: ArrayBuffer;
813
813
  contentType: string;
@@ -821,14 +821,15 @@ declare class SemiontApiClient {
821
821
  * until the stream is fully consumed or closed.
822
822
  *
823
823
  * @param resourceUri - Full resource URI
824
- * @param options - Options including Accept header for content negotiation
824
+ * @param options - Options including Accept header for content negotiation and auth
825
825
  * @returns Object with stream (ReadableStream) and contentType (string)
826
826
  *
827
827
  * @example
828
828
  * ```typescript
829
829
  * // Stream large file
830
830
  * const { stream, contentType } = await client.getResourceRepresentationStream(rUri, {
831
- * accept: 'video/mp4'
831
+ * accept: 'video/mp4',
832
+ * auth: token
832
833
  * });
833
834
  *
834
835
  * // Consume stream chunk by chunk (never loads entire file into memory)
@@ -849,44 +850,46 @@ declare class SemiontApiClient {
849
850
  */
850
851
  getResourceRepresentationStream(resourceUri: ResourceUri, options?: {
851
852
  accept?: ContentFormat;
853
+ auth?: AccessToken;
852
854
  }): Promise<{
853
855
  stream: ReadableStream<Uint8Array>;
854
856
  contentType: string;
855
857
  }>;
856
- listResources(limit?: number, archived?: boolean, query?: SearchQuery): Promise<ResponseContent<paths['/resources']['get']>>;
857
- updateResource(resourceUri: ResourceUri, data: RequestContent<paths['/resources/{id}']['patch']>): Promise<ResponseContent<paths['/resources/{id}']['patch']>>;
858
- 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<{
859
861
  events: any[];
860
862
  }>;
861
- getResourceAnnotations(resourceUri: ResourceUri): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
863
+ getResourceAnnotations(resourceUri: ResourceUri, options?: RequestOptions): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
862
864
  getAnnotationLLMContext(resourceUri: ResourceUri, annotationId: string, options?: {
863
865
  contextWindow?: number;
866
+ auth?: AccessToken;
864
867
  }): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/llm-context']['get']>>;
865
- getResourceReferencedBy(resourceUri: ResourceUri): Promise<{
868
+ getResourceReferencedBy(resourceUri: ResourceUri, options?: RequestOptions): Promise<{
866
869
  referencedBy: any[];
867
870
  }>;
868
- generateCloneToken(resourceUri: ResourceUri): Promise<ResponseContent<paths['/resources/{id}/clone-with-token']['post']>>;
869
- getResourceByToken(token: CloneToken): Promise<ResponseContent<paths['/api/resources/token/{token}']['get']>>;
870
- createResourceFromToken(data: RequestContent<paths['/api/resources/create-from-token']['post']>): Promise<ResponseContent<paths['/api/resources/create-from-token']['post']>>;
871
- createAnnotation(resourceUri: ResourceUri, data: RequestContent<paths['/resources/{id}/annotations']['post']>): Promise<ResponseContent<paths['/resources/{id}/annotations']['post']>>;
872
- getAnnotation(annotationUri: AnnotationUri): Promise<ResponseContent<paths['/annotations/{id}']['get']>>;
873
- getResourceAnnotation(annotationUri: ResourceAnnotationUri): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}']['get']>>;
874
- listAnnotations(resourceUri: ResourceUri, motivation?: Motivation): Promise<ResponseContent<paths['/resources/{id}/annotations']['get']>>;
875
- deleteAnnotation(annotationUri: ResourceAnnotationUri): Promise<void>;
876
- updateAnnotationBody(annotationUri: ResourceAnnotationUri, data: RequestContent<paths['/resources/{resourceId}/annotations/{annotationId}/body']['put']>): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/body']['put']>>;
877
- getAnnotationHistory(annotationUri: ResourceAnnotationUri): Promise<ResponseContent<paths['/resources/{resourceId}/annotations/{annotationId}/history']['get']>>;
878
- addEntityType(type: EntityType): Promise<ResponseContent<paths['/api/entity-types']['post']>>;
879
- addEntityTypesBulk(types: EntityType[]): Promise<ResponseContent<paths['/api/entity-types/bulk']['post']>>;
880
- listEntityTypes(): Promise<ResponseContent<paths['/api/entity-types']['get']>>;
881
- listUsers(): Promise<ResponseContent<paths['/api/admin/users']['get']>>;
882
- 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']>>;
883
886
  /**
884
887
  * Update a user by ID
885
888
  * Note: Users use DID identifiers (did:web:domain:users:id), not HTTP URIs.
886
889
  */
887
- updateUser(id: UserDID, data: RequestContent<paths['/api/admin/users/{id}']['patch']>): Promise<ResponseContent<paths['/api/admin/users/{id}']['patch']>>;
888
- getOAuthConfig(): Promise<ResponseContent<paths['/api/admin/oauth/config']['get']>>;
889
- 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']>>;
890
893
  /**
891
894
  * Poll a job until it completes or fails
892
895
  * @param id - The job ID to poll
@@ -897,15 +900,17 @@ declare class SemiontApiClient {
897
900
  interval?: number;
898
901
  timeout?: number;
899
902
  onProgress?: (status: ResponseContent<paths['/api/jobs/{id}']['get']>) => void;
903
+ auth?: AccessToken;
900
904
  }): Promise<ResponseContent<paths['/api/jobs/{id}']['get']>>;
901
905
  getResourceLLMContext(resourceUri: ResourceUri, options?: {
902
906
  depth?: number;
903
907
  maxResources?: number;
904
908
  includeContent?: boolean;
905
909
  includeSummary?: boolean;
910
+ auth?: AccessToken;
906
911
  }): Promise<ResponseContent<paths['/resources/{id}/llm-context']['get']>>;
907
- healthCheck(): Promise<ResponseContent<paths['/api/health']['get']>>;
908
- 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']>>;
909
914
  }
910
915
 
911
916
  /**
@@ -980,4 +985,4 @@ declare function getMimeCategory(mimeType: string): MimeCategory;
980
985
  type GenerationContext = components['schemas']['GenerationContext'];
981
986
  type AnnotationLLMContextResponse = components['schemas']['AnnotationLLMContextResponse'];
982
987
 
983
- 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, type ResourceEvent, 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 };