@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-BjpP_lGG.d.ts → index-BUlCf43K.d.ts} +19 -91
- package/dist/index.d.ts +117 -112
- package/dist/index.js +259 -399
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -243
- package/dist/utils/index.js.map +1 -1
- package/package.json +2 -1
|
@@ -3267,9 +3267,9 @@ declare function resourceAnnotationUri(uri: string): ResourceAnnotationUri;
|
|
|
3267
3267
|
* Target can be simple string IRI or object with source and optional selector
|
|
3268
3268
|
*/
|
|
3269
3269
|
|
|
3270
|
-
type Annotation
|
|
3271
|
-
type HighlightAnnotation = Annotation
|
|
3272
|
-
type ReferenceAnnotation = Annotation
|
|
3270
|
+
type Annotation = components['schemas']['Annotation'];
|
|
3271
|
+
type HighlightAnnotation = Annotation;
|
|
3272
|
+
type ReferenceAnnotation = Annotation;
|
|
3273
3273
|
type TextPositionSelector = components['schemas']['TextPositionSelector'];
|
|
3274
3274
|
type TextQuoteSelector = components['schemas']['TextQuoteSelector'];
|
|
3275
3275
|
type SvgSelector = components['schemas']['SvgSelector'];
|
|
@@ -3280,24 +3280,24 @@ type Selector = TextPositionSelector | TextQuoteSelector | SvgSelector | Fragmen
|
|
|
3280
3280
|
* Get the source from an annotation body (null if stub)
|
|
3281
3281
|
* Search for SpecificResource in body array
|
|
3282
3282
|
*/
|
|
3283
|
-
declare function getBodySource(body: Annotation
|
|
3283
|
+
declare function getBodySource(body: Annotation['body']): ResourceUri | null;
|
|
3284
3284
|
/**
|
|
3285
3285
|
* Get the type from an annotation body (returns first body type in array)
|
|
3286
3286
|
*/
|
|
3287
|
-
declare function getBodyType(body: Annotation
|
|
3287
|
+
declare function getBodyType(body: Annotation['body']): 'TextualBody' | 'SpecificResource' | null;
|
|
3288
3288
|
/**
|
|
3289
3289
|
* Check if body is resolved (has a source)
|
|
3290
3290
|
* Check for SpecificResource in body array
|
|
3291
3291
|
*/
|
|
3292
|
-
declare function isBodyResolved(body: Annotation
|
|
3292
|
+
declare function isBodyResolved(body: Annotation['body']): boolean;
|
|
3293
3293
|
/**
|
|
3294
3294
|
* Get the source IRI from target (handles both string and object forms)
|
|
3295
3295
|
*/
|
|
3296
|
-
declare function getTargetSource(target: Annotation
|
|
3296
|
+
declare function getTargetSource(target: Annotation['target']): ResourceUri;
|
|
3297
3297
|
/**
|
|
3298
3298
|
* Get the selector from target (undefined if string or no selector)
|
|
3299
3299
|
*/
|
|
3300
|
-
declare function getTargetSelector(target: Annotation
|
|
3300
|
+
declare function getTargetSelector(target: Annotation['target']): {
|
|
3301
3301
|
type: "TextPositionSelector";
|
|
3302
3302
|
start: number;
|
|
3303
3303
|
end: number;
|
|
@@ -3333,43 +3333,43 @@ declare function getTargetSelector(target: Annotation$1['target']): {
|
|
|
3333
3333
|
/**
|
|
3334
3334
|
* Check if target has a selector
|
|
3335
3335
|
*/
|
|
3336
|
-
declare function hasTargetSelector(target: Annotation
|
|
3336
|
+
declare function hasTargetSelector(target: Annotation['target']): boolean;
|
|
3337
3337
|
/**
|
|
3338
3338
|
* Type guard to check if an annotation is a highlight
|
|
3339
3339
|
*/
|
|
3340
|
-
declare function isHighlight(annotation: Annotation
|
|
3340
|
+
declare function isHighlight(annotation: Annotation): annotation is HighlightAnnotation;
|
|
3341
3341
|
/**
|
|
3342
3342
|
* Type guard to check if an annotation is a reference (linking)
|
|
3343
3343
|
*/
|
|
3344
|
-
declare function isReference(annotation: Annotation
|
|
3344
|
+
declare function isReference(annotation: Annotation): annotation is ReferenceAnnotation;
|
|
3345
3345
|
/**
|
|
3346
3346
|
* Type guard to check if an annotation is an assessment
|
|
3347
3347
|
*/
|
|
3348
|
-
declare function isAssessment(annotation: Annotation
|
|
3348
|
+
declare function isAssessment(annotation: Annotation): annotation is Annotation;
|
|
3349
3349
|
/**
|
|
3350
3350
|
* Type guard to check if an annotation is a comment
|
|
3351
3351
|
*/
|
|
3352
|
-
declare function isComment(annotation: Annotation
|
|
3352
|
+
declare function isComment(annotation: Annotation): annotation is Annotation;
|
|
3353
3353
|
/**
|
|
3354
3354
|
* Type guard to check if an annotation is a tag
|
|
3355
3355
|
*/
|
|
3356
|
-
declare function isTag(annotation: Annotation
|
|
3356
|
+
declare function isTag(annotation: Annotation): annotation is Annotation;
|
|
3357
3357
|
/**
|
|
3358
3358
|
* Extract comment text from a comment annotation's body
|
|
3359
3359
|
* @param annotation - The annotation to extract comment text from
|
|
3360
3360
|
* @returns The comment text, or undefined if not a comment or no text found
|
|
3361
3361
|
*/
|
|
3362
|
-
declare function getCommentText(annotation: Annotation
|
|
3362
|
+
declare function getCommentText(annotation: Annotation): string | undefined;
|
|
3363
3363
|
/**
|
|
3364
3364
|
* Type guard to check if a reference annotation is a stub (unresolved)
|
|
3365
3365
|
* Stub if no SpecificResource in body array
|
|
3366
3366
|
*/
|
|
3367
|
-
declare function isStubReference(annotation: Annotation
|
|
3367
|
+
declare function isStubReference(annotation: Annotation): boolean;
|
|
3368
3368
|
/**
|
|
3369
3369
|
* Type guard to check if a reference annotation is resolved
|
|
3370
3370
|
* Resolved if SpecificResource exists in body array
|
|
3371
3371
|
*/
|
|
3372
|
-
declare function isResolvedReference(annotation: Annotation
|
|
3372
|
+
declare function isResolvedReference(annotation: Annotation): annotation is ReferenceAnnotation;
|
|
3373
3373
|
/**
|
|
3374
3374
|
* Get the exact text from a selector (single or array)
|
|
3375
3375
|
*
|
|
@@ -3382,7 +3382,7 @@ declare function getExactText(selector: Selector | Selector[] | undefined): stri
|
|
|
3382
3382
|
* Get the exact text from an annotation's target selector
|
|
3383
3383
|
* Uses getTargetSelector helper to safely get selector
|
|
3384
3384
|
*/
|
|
3385
|
-
declare function getAnnotationExactText(annotation: Annotation
|
|
3385
|
+
declare function getAnnotationExactText(annotation: Annotation): string;
|
|
3386
3386
|
/**
|
|
3387
3387
|
* Get the primary selector from a selector (single or array)
|
|
3388
3388
|
*
|
|
@@ -3439,78 +3439,6 @@ declare function extractBoundingBox(svg: string): {
|
|
|
3439
3439
|
height: number;
|
|
3440
3440
|
} | null;
|
|
3441
3441
|
|
|
3442
|
-
/**
|
|
3443
|
-
* Event Utilities
|
|
3444
|
-
*
|
|
3445
|
-
* Pure TypeScript utilities for working with resource events.
|
|
3446
|
-
* No React dependencies - safe to use in any JavaScript environment.
|
|
3447
|
-
*/
|
|
3448
|
-
|
|
3449
|
-
type EventsResponse = paths['/resources/{id}/events']['get']['responses'][200]['content']['application/json'];
|
|
3450
|
-
type StoredEvent = EventsResponse['events'][number];
|
|
3451
|
-
type ResourceEvent = StoredEvent['event'];
|
|
3452
|
-
type EventMetadata = StoredEvent['metadata'];
|
|
3453
|
-
type Annotation = components['schemas']['Annotation'];
|
|
3454
|
-
type ResourceEventType = 'resource.created' | 'resource.cloned' | 'resource.archived' | 'resource.unarchived' | 'annotation.added' | 'annotation.removed' | 'annotation.body.updated' | 'entitytag.added' | 'entitytag.removed' | 'entitytype.added' | 'job.started' | 'job.progress' | 'job.completed' | 'job.failed';
|
|
3455
|
-
type TranslateFn = (key: string, params?: Record<string, string | number>) => string;
|
|
3456
|
-
/**
|
|
3457
|
-
* Extract annotation ID from event payload
|
|
3458
|
-
* Returns null if event is not annotation-related
|
|
3459
|
-
*
|
|
3460
|
-
* For annotation.added: extracts full URI from payload.annotation.id
|
|
3461
|
-
* For annotation.removed/body.updated: constructs full URI from payload.annotationId (UUID) + resourceId
|
|
3462
|
-
*/
|
|
3463
|
-
declare function getAnnotationUriFromEvent(event: StoredEvent): AnnotationUri | null;
|
|
3464
|
-
/**
|
|
3465
|
-
* Check if an event is related to a specific annotation
|
|
3466
|
-
*/
|
|
3467
|
-
declare function isEventRelatedToAnnotation(event: StoredEvent, annotationUri: AnnotationUri): boolean;
|
|
3468
|
-
/**
|
|
3469
|
-
* Type guard to check if event is a resource event
|
|
3470
|
-
*/
|
|
3471
|
-
declare function isResourceEvent(event: any): event is StoredEvent;
|
|
3472
|
-
/**
|
|
3473
|
-
* Format event type for display with i18n support
|
|
3474
|
-
*/
|
|
3475
|
-
declare function formatEventType(type: ResourceEventType, t: TranslateFn, payload?: any): string;
|
|
3476
|
-
/**
|
|
3477
|
-
* Get emoji for event type
|
|
3478
|
-
* For unified annotation events, pass the payload to determine motivation
|
|
3479
|
-
*/
|
|
3480
|
-
declare function getEventEmoji(type: ResourceEventType, payload?: any): string;
|
|
3481
|
-
/**
|
|
3482
|
-
* Format timestamp as relative time with i18n support
|
|
3483
|
-
*/
|
|
3484
|
-
declare function formatRelativeTime(timestamp: string, t: TranslateFn): string;
|
|
3485
|
-
/**
|
|
3486
|
-
* Get display content from event payload - complete implementation
|
|
3487
|
-
*/
|
|
3488
|
-
declare function getEventDisplayContent(event: StoredEvent, annotations: Annotation[], // Unified annotations array (all types)
|
|
3489
|
-
allEvents: StoredEvent[]): {
|
|
3490
|
-
exact: string;
|
|
3491
|
-
isQuoted: boolean;
|
|
3492
|
-
isTag: boolean;
|
|
3493
|
-
} | null;
|
|
3494
|
-
/**
|
|
3495
|
-
* Get entity types from event payload
|
|
3496
|
-
*/
|
|
3497
|
-
declare function getEventEntityTypes(event: StoredEvent): string[];
|
|
3498
|
-
/**
|
|
3499
|
-
* Resource creation details
|
|
3500
|
-
*/
|
|
3501
|
-
interface ResourceCreationDetails {
|
|
3502
|
-
type: 'created' | 'cloned';
|
|
3503
|
-
method: string;
|
|
3504
|
-
userId?: string;
|
|
3505
|
-
sourceDocId?: string;
|
|
3506
|
-
parentResourceId?: string;
|
|
3507
|
-
metadata?: Record<string, any>;
|
|
3508
|
-
}
|
|
3509
|
-
/**
|
|
3510
|
-
* Get resource creation details from event
|
|
3511
|
-
*/
|
|
3512
|
-
declare function getResourceCreationDetails(event: StoredEvent): ResourceCreationDetails | null;
|
|
3513
|
-
|
|
3514
3442
|
/**
|
|
3515
3443
|
* Fuzzy Anchoring for W3C Web Annotation TextQuoteSelector
|
|
3516
3444
|
*
|
|
@@ -3900,4 +3828,4 @@ declare function validateData<T>(schema: {
|
|
|
3900
3828
|
*/
|
|
3901
3829
|
declare function isValidEmail(email: string): boolean;
|
|
3902
3830
|
|
|
3903
|
-
export { type $defs as $, type AccessToken as A, type BaseUrl as B, type ContentFormat as C, getExactText as D, type EntityType as E, type FragmentSelector as F, type GoogleCredential as G, getAnnotationExactText as H, getPrimarySelector as I, type JobId as J, getTextPositionSelector as K, getTextQuoteSelector as L, type Motivation as M, getSvgSelector as N, getFragmentSelector as O, validateSvgMarkup as P, extractBoundingBox as Q, type ResourceUri as R, type SearchQuery as S, type TextPositionSelector as T, type UserDID as U, type
|
|
3831
|
+
export { type $defs as $, type AccessToken as A, type BaseUrl as B, type ContentFormat as C, getExactText as D, type EntityType as E, type FragmentSelector as F, type GoogleCredential as G, getAnnotationExactText as H, getPrimarySelector as I, type JobId as J, getTextPositionSelector as K, getTextQuoteSelector as L, type Motivation as M, getSvgSelector as N, getFragmentSelector as O, validateSvgMarkup as P, extractBoundingBox as Q, type ResourceUri as R, type SearchQuery as S, type TextPositionSelector as T, type UserDID as U, type TextPosition as V, findTextWithContext as W, verifyPosition as X, type LocaleInfo as Y, LOCALES as Z, getLocaleInfo as _, type AnnotationUri as a, getLocaleNativeName as a0, getLocaleEnglishName as a1, formatLocaleDisplay as a2, getAllLocaleCodes as a3, getResourceId as a4, getPrimaryRepresentation as a5, getPrimaryMediaType as a6, getChecksum as a7, getLanguage as a8, getStorageUri as a9, type AuthCode as aA, type MCPToken as aB, email as aC, authCode as aD, googleCredential as aE, accessToken as aF, refreshToken as aG, mcpToken as aH, cloneToken as aI, jobId as aJ, userDID as aK, entityType as aL, searchQuery as aM, baseUrl as aN, resourceUri as aO, annotationUri as aP, resourceAnnotationUri as aQ, getCreator as aa, getDerivedFrom as ab, isArchived as ac, getResourceEntityTypes as ad, isDraft as ae, getNodeEncoding as af, decodeRepresentation as ag, type Point as ah, type BoundingBox as ai, createRectangleSvg as aj, createPolygonSvg as ak, createCircleSvg as al, parseSvgSelector as am, normalizeCoordinates as an, scaleSvgToNative as ao, extractContext as ap, type ValidatedAnnotation as aq, validateAndCorrectOffsets as ar, extractCharset as as, decodeWithCharset as at, type ValidationSuccess as au, type ValidationFailure as av, type ValidationResult as aw, JWTTokenSchema as ax, validateData as ay, isValidEmail as az, type Email as b, type components as c, type RefreshToken as d, type CloneToken as e, type ResourceAnnotationUri as f, type TextQuoteSelector as g, type SvgSelector as h, type Selector as i, getBodySource as j, getBodyType as k, isBodyResolved as l, getTargetSource as m, getTargetSelector as n, type operations as o, type paths as p, hasTargetSelector as q, isHighlight as r, isReference as s, isAssessment as t, isComment as u, isTag as v, type webhooks as w, getCommentText as x, isStubReference as y, isResolvedReference as z };
|