@semiont/api-client 0.2.1 → 0.2.2-build.16
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/{types.d.ts → index-DHh0ToZB.d.ts} +460 -6
- package/dist/index.d.ts +909 -13
- package/dist/index.js +1598 -60
- package/dist/index.js.map +1 -1
- package/dist/utils/index.d.ts +1 -12
- package/dist/utils/index.js +597 -26
- package/dist/utils/index.js.map +1 -1
- package/package.json +11 -8
- package/dist/__tests__/client.test.d.ts +0 -28
- package/dist/__tests__/client.test.d.ts.map +0 -1
- package/dist/__tests__/client.test.js +0 -567
- package/dist/__tests__/client.test.js.map +0 -1
- package/dist/__tests__/sse-client.test.d.ts +0 -7
- package/dist/__tests__/sse-client.test.d.ts.map +0 -1
- package/dist/__tests__/sse-client.test.js +0 -421
- package/dist/__tests__/sse-client.test.js.map +0 -1
- package/dist/__tests__/sse-stream.test.d.ts +0 -7
- package/dist/__tests__/sse-stream.test.d.ts.map +0 -1
- package/dist/__tests__/sse-stream.test.js +0 -394
- package/dist/__tests__/sse-stream.test.js.map +0 -1
- package/dist/__tests__/svg-selectors.test.d.ts +0 -5
- package/dist/__tests__/svg-selectors.test.d.ts.map +0 -1
- package/dist/__tests__/svg-selectors.test.js +0 -124
- package/dist/__tests__/svg-selectors.test.js.map +0 -1
- package/dist/branded-types.d.ts +0 -70
- package/dist/branded-types.d.ts.map +0 -1
- package/dist/branded-types.js +0 -62
- package/dist/branded-types.js.map +0 -1
- package/dist/client.d.ts +0 -243
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -460
- package/dist/client.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/mime-utils.d.ts +0 -27
- package/dist/mime-utils.d.ts.map +0 -1
- package/dist/mime-utils.js +0 -49
- package/dist/mime-utils.js.map +0 -1
- package/dist/sse/index.d.ts +0 -343
- package/dist/sse/index.d.ts.map +0 -1
- package/dist/sse/index.js +0 -404
- package/dist/sse/index.js.map +0 -1
- package/dist/sse/stream.d.ts +0 -58
- package/dist/sse/stream.d.ts.map +0 -1
- package/dist/sse/stream.js +0 -187
- package/dist/sse/stream.js.map +0 -1
- package/dist/sse/types.d.ts +0 -295
- package/dist/sse/types.d.ts.map +0 -1
- package/dist/sse/types.js +0 -10
- package/dist/sse/types.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -7
- package/dist/types.js.map +0 -1
- package/dist/utils/annotations.d.ts +0 -191
- package/dist/utils/annotations.d.ts.map +0 -1
- package/dist/utils/annotations.js +0 -404
- package/dist/utils/annotations.js.map +0 -1
- package/dist/utils/events.d.ts +0 -74
- package/dist/utils/events.d.ts.map +0 -1
- package/dist/utils/events.js +0 -329
- package/dist/utils/events.js.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/locales.d.ts +0 -31
- package/dist/utils/locales.d.ts.map +0 -1
- package/dist/utils/locales.js +0 -83
- package/dist/utils/locales.js.map +0 -1
- package/dist/utils/resources.d.ts +0 -34
- package/dist/utils/resources.d.ts.map +0 -1
- package/dist/utils/resources.js +0 -63
- package/dist/utils/resources.js.map +0 -1
- package/dist/utils/validation.d.ts +0 -57
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/validation.js +0 -89
- package/dist/utils/validation.js.map +0 -1
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,gDAA8B;AAC9B,2CAAyB;AACzB,4CAA0B;AAC1B,8CAA4B;AAC5B,+CAA6B"}
|
|
1
|
+
{"version":3,"sources":["../../src/branded-types.ts","../../src/utils/annotations.ts","../../src/utils/events.ts","../../src/utils/locales.ts","../../src/utils/resources.ts","../../src/utils/validation.ts"],"names":["resourceUri"],"mappings":";AAwEO,SAAS,YAAY,GAAA,EAA0B;AACpD,EA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AAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU;AAAA,KAClD;AAAA,EACF;AACF;AAUO,SAAS,aAAa,KAAA,EAAwB;AACnD,EAAA,IAAI,KAAA,CAAM,MAAA,GAAS,CAAA,IAAK,KAAA,CAAM,SAAS,GAAA,EAAK;AAC1C,IAAA,OAAO,KAAA;AAAA,EACT;AAEA,EAAA,MAAM,UAAA,GAAa,4BAAA;AACnB,EAAA,OAAO,UAAA,CAAW,KAAK,KAAK,CAAA;AAC9B","file":"index.js","sourcesContent":["/**\n * Branded string types for compile-time type safety\n *\n * These types are zero-cost at runtime but prevent mixing\n * different string types at compile time.\n */\n\nimport type { components } from './types';\n\n// ============================================================================\n// OPENAPI-GENERATED TYPES (use directly from spec)\n// ============================================================================\n\nexport type Motivation = components['schemas']['Motivation'];\nexport type ContentFormat = components['schemas']['ContentFormat'];\n\n// ============================================================================\n// AUTHENTICATION & TOKENS\n// ============================================================================\n\nexport type Email = string & { readonly __brand: 'Email' };\nexport type AuthCode = string & { readonly __brand: 'AuthCode' };\nexport type GoogleCredential = string & { readonly __brand: 'GoogleCredential' };\nexport type AccessToken = string & { readonly __brand: 'AccessToken' };\nexport type RefreshToken = string & { readonly __brand: 'RefreshToken' };\nexport type MCPToken = string & { readonly __brand: 'MCPToken' };\nexport type CloneToken = string & { readonly __brand: 'CloneToken' };\n\n// ============================================================================\n// SYSTEM IDENTIFIERS\n// ============================================================================\n\nexport type JobId = string & { readonly __brand: 'JobId' };\nexport type UserDID = string & { readonly __brand: 'UserDID' };\nexport type EntityType = string & { readonly __brand: 'EntityType' };\nexport type SearchQuery = string & { readonly __brand: 'SearchQuery' };\nexport type BaseUrl = string & { readonly __brand: 'BaseUrl' };\n\n// ============================================================================\n// HELPER FUNCTIONS (minimal validation, just branding)\n// ============================================================================\n\nexport function email(value: string): Email { return value as Email; }\nexport function authCode(value: string): AuthCode { return value as AuthCode; }\nexport function googleCredential(value: string): GoogleCredential { return value as GoogleCredential; }\nexport function accessToken(value: string): AccessToken { return value as AccessToken; }\nexport function refreshToken(value: string): RefreshToken { return value as RefreshToken; }\nexport function mcpToken(value: string): MCPToken { return value as MCPToken; }\nexport function cloneToken(value: string): CloneToken { return value as CloneToken; }\nexport function jobId(value: string): JobId { return value as JobId; }\nexport function userDID(value: string): UserDID { return value as UserDID; }\nexport function entityType(value: string): EntityType { return value as EntityType; }\nexport function searchQuery(value: string): SearchQuery { return value as SearchQuery; }\nexport function baseUrl(value: string): BaseUrl { return value as BaseUrl; }\n\n// Motivation and ContentFormat use OpenAPI enums - no helpers needed\n// Use the enum values directly from the OpenAPI spec\n\n// ============================================================================\n// HTTP URI TYPES\n// ============================================================================\n\n// Branded type definitions for HTTP URIs returned by the API\nexport type ResourceUri = string & { readonly __brand: 'ResourceUri' };\n\n// W3C flat format for content negotiation: http://localhost:4000/annotations/{id}\nexport type AnnotationUri = string & { readonly __brand: 'AnnotationUri' };\n\n// Nested format for CRUD operations: http://localhost:4000/resources/{resourceId}/annotations/{annotationId}\nexport type ResourceAnnotationUri = string & { readonly __brand: 'ResourceAnnotationUri' };\n\n// Factory functions with runtime validation\nexport function resourceUri(uri: string): ResourceUri {\n if (!uri.startsWith('http://') && !uri.startsWith('https://')) {\n throw new TypeError(`Expected ResourceUri, got: ${uri}`);\n }\n return uri as ResourceUri;\n}\n\nexport function annotationUri(uri: string): AnnotationUri {\n if (!uri.startsWith('http://') && !uri.startsWith('https://')) {\n throw new TypeError(`Expected AnnotationUri, got: ${uri}`);\n }\n return uri as AnnotationUri;\n}\n\nexport function resourceAnnotationUri(uri: string): ResourceAnnotationUri {\n if (!uri.startsWith('http://') && !uri.startsWith('https://')) {\n throw new TypeError(`Expected ResourceAnnotationUri, got: ${uri}`);\n }\n // Additional validation: must contain /resources/ and /annotations/\n if (!uri.includes('/resources/') || !uri.includes('/annotations/')) {\n throw new TypeError(`Expected nested ResourceAnnotationUri format, got: ${uri}`);\n }\n return uri as ResourceAnnotationUri;\n}\n","/**\n * Annotation and Selector Utilities\n *\n * Pure TypeScript utilities for working with W3C Web Annotations.\n * No React dependencies - safe to use in any JavaScript environment.\n *\n * Body is either empty array (stub) or single SpecificResource (resolved)\n * Body can be array of TextualBody (tagging) + SpecificResource (linking)\n * Target can be simple string IRI or object with source and optional selector\n */\n\nimport type { components } from '../types';\nimport type { ResourceUri } from '../branded-types';\nimport { resourceUri } from '../branded-types';\n\ntype Annotation = components['schemas']['Annotation'];\ntype HighlightAnnotation = Annotation;\ntype ReferenceAnnotation = Annotation;\ntype TextPositionSelector = components['schemas']['TextPositionSelector'];\ntype TextQuoteSelector = components['schemas']['TextQuoteSelector'];\ntype SvgSelector = components['schemas']['SvgSelector'];\ntype Selector = TextPositionSelector | TextQuoteSelector | SvgSelector;\n\n// Re-export selector types for convenience\nexport type { TextPositionSelector, TextQuoteSelector, SvgSelector, Selector };\n\n/**\n * Get the source from an annotation body (null if stub)\n * Search for SpecificResource in body array\n */\nexport function getBodySource(body: Annotation['body']): ResourceUri | null {\n if (Array.isArray(body)) {\n // Search for SpecificResource with source\n for (const item of body) {\n if (\n typeof item === 'object' &&\n item !== null &&\n 'type' in item &&\n 'source' in item\n ) {\n const itemType = (item as { type: unknown }).type;\n const itemSource = (item as { source: unknown }).source;\n\n if (itemType === 'SpecificResource' && typeof itemSource === 'string') {\n return resourceUri(itemSource);\n }\n }\n }\n return null; // No SpecificResource found = stub\n }\n\n // Single body object (SpecificResource)\n if (\n typeof body === 'object' &&\n body !== null &&\n 'type' in body &&\n 'source' in body\n ) {\n const bodyType = (body as { type: unknown }).type;\n const bodySource = (body as { source: unknown }).source;\n\n if (bodyType === 'SpecificResource' && typeof bodySource === 'string') {\n return resourceUri(bodySource);\n }\n }\n\n return null;\n}\n\n/**\n * Get the type from an annotation body (returns first body type in array)\n */\nexport function getBodyType(body: Annotation['body']): 'TextualBody' | 'SpecificResource' | null {\n if (Array.isArray(body)) {\n if (body.length === 0) {\n return null;\n }\n // Return type of first body item\n if (typeof body[0] === 'object' && body[0] !== null && 'type' in body[0]) {\n const firstType = (body[0] as { type: unknown }).type;\n if (firstType === 'TextualBody' || firstType === 'SpecificResource') {\n return firstType;\n }\n }\n return null;\n }\n\n // Single body object\n if (typeof body === 'object' && body !== null && 'type' in body) {\n const bodyType = (body as { type: unknown }).type;\n if (bodyType === 'TextualBody' || bodyType === 'SpecificResource') {\n return bodyType;\n }\n }\n\n return null;\n}\n\n/**\n * Check if body is resolved (has a source)\n * Check for SpecificResource in body array\n */\nexport function isBodyResolved(body: Annotation['body']): boolean {\n return getBodySource(body) !== null;\n}\n\n/**\n * Get the source IRI from target (handles both string and object forms)\n */\nexport function getTargetSource(target: Annotation['target']): ResourceUri {\n if (typeof target === 'string') {\n return resourceUri(target);\n }\n return resourceUri(target.source);\n}\n\n/**\n * Get the selector from target (undefined if string or no selector)\n */\nexport function getTargetSelector(target: Annotation['target']) {\n if (typeof target === 'string') {\n return undefined;\n }\n return target.selector;\n}\n\n/**\n * Check if target has a selector\n */\nexport function hasTargetSelector(target: Annotation['target']): boolean {\n return typeof target !== 'string' && target.selector !== undefined;\n}\n\n/**\n * Extract entity types from annotation bodies\n * Entity types are stored as TextualBody with purpose: \"tagging\"\n * Accepts any object with a body property matching Annotation['body']\n */\nexport function getEntityTypes(annotation: { body: Annotation['body'] }): string[] {\n // Extract from TextualBody bodies with purpose: \"tagging\"\n if (Array.isArray(annotation.body)) {\n const entityTags: string[] = [];\n\n for (const item of annotation.body) {\n // Runtime check for TextualBody with tagging purpose\n // TypeScript incorrectly narrows the union type here, so we use runtime checks only\n if (\n typeof item === 'object' &&\n item !== null &&\n 'type' in item &&\n 'value' in item &&\n 'purpose' in item\n ) {\n // Access properties as unknown first to avoid TypeScript narrowing issues\n const itemType = (item as { type: unknown }).type;\n const itemValue = (item as { value: unknown }).value;\n const itemPurpose = (item as { purpose: unknown }).purpose;\n\n if (itemType === 'TextualBody' && itemPurpose === 'tagging' && typeof itemValue === 'string' && itemValue.length > 0) {\n entityTags.push(itemValue);\n }\n }\n }\n\n return entityTags;\n }\n\n return [];\n}\n\n/**\n * Type guard to check if an annotation is a highlight\n */\nexport function isHighlight(annotation: Annotation): annotation is HighlightAnnotation {\n return annotation.motivation === 'highlighting';\n}\n\n/**\n * Type guard to check if an annotation is a reference (linking)\n */\nexport function isReference(annotation: Annotation): annotation is ReferenceAnnotation {\n return annotation.motivation === 'linking';\n}\n\n/**\n * Type guard to check if an annotation is an assessment\n */\nexport function isAssessment(annotation: Annotation): annotation is Annotation {\n return annotation.motivation === 'assessing';\n}\n\n/**\n * Type guard to check if an annotation is a comment\n */\nexport function isComment(annotation: Annotation): annotation is Annotation {\n return annotation.motivation === 'commenting';\n}\n\n/**\n * Type guard to check if an annotation is a tag\n */\nexport function isTag(annotation: Annotation): annotation is Annotation {\n return annotation.motivation === 'tagging';\n}\n\n/**\n * Extract comment text from a comment annotation's body\n * @param annotation - The annotation to extract comment text from\n * @returns The comment text, or undefined if not a comment or no text found\n */\nexport function getCommentText(annotation: Annotation): string | undefined {\n if (!isComment(annotation)) return undefined;\n const body = Array.isArray(annotation.body) ? annotation.body[0] : annotation.body;\n if (body && 'value' in body) {\n return body.value;\n }\n return undefined;\n}\n\n/**\n * Extract tag category from a tag annotation's body\n * Tags use dual-body structure: first body has purpose: \"tagging\" with category value\n * @param annotation - The annotation to extract category from\n * @returns The tag category (e.g., \"Issue\", \"Rule\"), or undefined if not a tag or no category found\n */\nexport function getTagCategory(annotation: Annotation): string | undefined {\n if (!isTag(annotation)) return undefined;\n const bodies = Array.isArray(annotation.body) ? annotation.body : [annotation.body];\n const taggingBody = bodies.find(b => b && 'purpose' in b && b.purpose === 'tagging');\n if (taggingBody && 'value' in taggingBody) {\n return taggingBody.value;\n }\n return undefined;\n}\n\n/**\n * Extract tag schema ID from a tag annotation's body\n * Tags use dual-body structure: second body has purpose: \"classifying\" with schema ID\n * @param annotation - The annotation to extract schema ID from\n * @returns The schema ID (e.g., \"legal-irac\"), or undefined if not a tag or no schema found\n */\nexport function getTagSchemaId(annotation: Annotation): string | undefined {\n if (!isTag(annotation)) return undefined;\n const bodies = Array.isArray(annotation.body) ? annotation.body : [annotation.body];\n const classifyingBody = bodies.find(b => b && 'purpose' in b && b.purpose === 'classifying');\n if (classifyingBody && 'value' in classifyingBody) {\n return classifyingBody.value;\n }\n return undefined;\n}\n\n/**\n * Type guard to check if a reference annotation is a stub (unresolved)\n * Stub if no SpecificResource in body array\n */\nexport function isStubReference(annotation: Annotation): boolean {\n return isReference(annotation) && !isBodyResolved(annotation.body);\n}\n\n/**\n * Type guard to check if a reference annotation is resolved\n * Resolved if SpecificResource exists in body array\n */\nexport function isResolvedReference(annotation: Annotation): annotation is ReferenceAnnotation {\n return isReference(annotation) && isBodyResolved(annotation.body);\n}\n\n// =============================================================================\n// SELECTOR UTILITIES\n// =============================================================================\n\n/**\n * Get the exact text from a selector (single or array)\n *\n * When selector is an array, tries to find a TextQuoteSelector (which has exact text).\n * TextPositionSelector does not have exact text, only character offsets.\n * Handles undefined selector (when target is a string IRI with no selector)\n */\nexport function getExactText(selector: Selector | Selector[] | undefined): string {\n if (!selector) {\n return ''; // No selector means entire resource\n }\n const selectors = Array.isArray(selector) ? selector : [selector];\n\n // Try to find TextQuoteSelector (has exact text)\n const quoteSelector = selectors.find(s => s.type === 'TextQuoteSelector') as TextQuoteSelector | undefined;\n if (quoteSelector) {\n return quoteSelector.exact;\n }\n\n // No TextQuoteSelector found\n return '';\n}\n\n/**\n * Get the exact text from an annotation's target selector\n * Uses getTargetSelector helper to safely get selector\n */\nexport function getAnnotationExactText(annotation: Annotation): string {\n const selector = getTargetSelector(annotation.target);\n return getExactText(selector as Selector | Selector[] | undefined);\n}\n\n/**\n * Get the primary selector from a selector (single or array)\n *\n * When selector is an array, returns the first selector.\n * When selector is a single object, returns it as-is.\n */\nexport function getPrimarySelector(selector: Selector | Selector[]): Selector {\n if (Array.isArray(selector)) {\n if (selector.length === 0) {\n throw new Error('Empty selector array');\n }\n const first = selector[0];\n if (!first) {\n throw new Error('Invalid selector array');\n }\n return first;\n }\n return selector;\n}\n\n/**\n * Get TextPositionSelector from a selector (single or array)\n *\n * Returns the first TextPositionSelector found, or null if none exists.\n * Handles undefined selector (when target is a string IRI with no selector)\n */\nexport function getTextPositionSelector(selector: Selector | Selector[] | undefined): TextPositionSelector | null {\n if (!selector) return null; // No selector means entire resource\n const selectors = Array.isArray(selector) ? selector : [selector];\n const found = selectors.find(s => s.type === 'TextPositionSelector');\n if (!found) return null;\n return found.type === 'TextPositionSelector' ? found : null;\n}\n\n/**\n * Get TextQuoteSelector from a selector (single or array)\n *\n * Returns the first TextQuoteSelector found, or null if none exists.\n */\nexport function getTextQuoteSelector(selector: Selector | Selector[]): TextQuoteSelector | null {\n const selectors = Array.isArray(selector) ? selector : [selector];\n const found = selectors.find(s => s.type === 'TextQuoteSelector');\n if (!found) return null;\n return found.type === 'TextQuoteSelector' ? found : null;\n}\n\n/**\n * Get SvgSelector from a selector (single or array)\n *\n * Returns the first SvgSelector found, or null if none exists.\n */\nexport function getSvgSelector(selector: Selector | Selector[] | undefined): SvgSelector | null {\n if (!selector) return null;\n const selectors = Array.isArray(selector) ? selector : [selector];\n const found = selectors.find(s => s.type === 'SvgSelector');\n if (!found) return null;\n return found.type === 'SvgSelector' ? found : null;\n}\n\n/**\n * Validate SVG markup for W3C compliance\n *\n * Checks that:\n * - SVG contains xmlns attribute\n * - SVG is well-formed XML\n * - SVG contains at least one shape element\n *\n * @returns null if valid, error message if invalid\n */\nexport function validateSvgMarkup(svg: string): string | null {\n // Check for xmlns attribute (required by W3C spec)\n if (!svg.includes('xmlns=\"http://www.w3.org/2000/svg\"')) {\n return 'SVG must include xmlns=\"http://www.w3.org/2000/svg\" attribute';\n }\n\n // Check for basic SVG tag structure\n if (!svg.includes('<svg') || !svg.includes('</svg>')) {\n return 'SVG must have opening and closing tags';\n }\n\n // Check for at least one shape element\n const shapeElements = ['rect', 'circle', 'ellipse', 'polygon', 'polyline', 'path', 'line'];\n const hasShape = shapeElements.some(shape =>\n svg.includes(`<${shape}`) || svg.includes(`<${shape} `)\n );\n\n if (!hasShape) {\n return 'SVG must contain at least one shape element (rect, circle, ellipse, polygon, polyline, path, or line)';\n }\n\n return null; // Valid\n}\n\n/**\n * Extract bounding box from SVG markup\n *\n * Attempts to extract x, y, width, height from the SVG viewBox or root element.\n * Returns null if bounding box cannot be determined.\n */\nexport function extractBoundingBox(svg: string): { x: number; y: number; width: number; height: number } | null {\n // Try to extract viewBox attribute from SVG element\n const viewBoxMatch = svg.match(/<svg[^>]*viewBox=\"([^\"]+)\"/);\n if (viewBoxMatch) {\n const values = viewBoxMatch[1].split(/\\s+/).map(parseFloat);\n if (values.length === 4 && values.every(v => !isNaN(v))) {\n return {\n x: values[0],\n y: values[1],\n width: values[2],\n height: values[3]\n };\n }\n }\n\n // Try to extract width/height attributes from SVG element (assume x=0, y=0)\n const svgTagMatch = svg.match(/<svg[^>]*>/);\n if (svgTagMatch) {\n const svgTag = svgTagMatch[0];\n const widthMatch = svgTag.match(/width=\"([^\"]+)\"/);\n const heightMatch = svgTag.match(/height=\"([^\"]+)\"/);\n\n if (widthMatch && heightMatch) {\n const width = parseFloat(widthMatch[1]);\n const height = parseFloat(heightMatch[1]);\n\n if (!isNaN(width) && !isNaN(height)) {\n return { x: 0, y: 0, width, height };\n }\n }\n }\n\n return null;\n}\n","/**\n * Event Utilities\n *\n * Pure TypeScript utilities for working with resource events.\n * No React dependencies - safe to use in any JavaScript environment.\n */\n\nimport type { paths, components } from '../types';\nimport { AnnotationUri } from '../branded-types';\nimport { getExactText, getTargetSelector } from './annotations';\n\n// Extract StoredEvent type from events endpoint response\ntype EventsResponse = paths['/resources/{id}/events']['get']['responses'][200]['content']['application/json'];\nexport type StoredEvent = EventsResponse['events'][number];\nexport type ResourceEvent = StoredEvent['event'];\nexport type EventMetadata = StoredEvent['metadata'];\ntype Annotation = components['schemas']['Annotation'];\n\n// Event types\nexport type ResourceEventType =\n | 'resource.created'\n | 'resource.cloned'\n | 'resource.archived'\n | 'resource.unarchived'\n | 'annotation.added'\n | 'annotation.removed'\n | 'annotation.body.updated'\n | 'entitytag.added'\n | 'entitytag.removed'\n | 'entitytype.added' // Global entity type collection\n | 'job.started'\n | 'job.progress'\n | 'job.completed'\n | 'job.failed';\n\ntype TranslateFn = (key: string, params?: Record<string, string | number>) => string;\n\n// =============================================================================\n// EVENT TYPE GUARDS AND EXTRACTION\n// =============================================================================\n\n/**\n * Extract annotation ID from event payload\n * Returns null if event is not annotation-related\n *\n * For annotation.added: extracts full URI from payload.annotation.id\n * For annotation.removed/body.updated: constructs full URI from payload.annotationId (UUID) + resourceId\n */\nexport function getAnnotationUriFromEvent(event: StoredEvent): AnnotationUri | null {\n const eventData = event.event;\n const payload = eventData.payload as any;\n\n if (!payload) {\n return null;\n }\n\n switch (eventData.type) {\n case 'annotation.added':\n // annotation.added has the full annotation object with id as full URI\n return payload.annotation?.id || null;\n\n case 'annotation.removed':\n case 'annotation.body.updated':\n // These events have annotationId (UUID only), need to construct full URI\n // Extract base URL from resourceId (format: http://host/resources/id)\n if (payload.annotationId && eventData.resourceId) {\n try {\n const resourceUri = eventData.resourceId;\n // Extract base URL by removing the /resources/{id} part\n const baseUrl = resourceUri.substring(0, resourceUri.lastIndexOf('/resources/'));\n return `${baseUrl}/annotations/${payload.annotationId}` as AnnotationUri;\n } catch (e) {\n return null;\n }\n }\n return null;\n\n default:\n return null;\n }\n}\n\n/**\n * Check if an event is related to a specific annotation\n */\nexport function isEventRelatedToAnnotation(event: StoredEvent, annotationUri: AnnotationUri): boolean {\n const eventAnnotationUri = getAnnotationUriFromEvent(event);\n return eventAnnotationUri === annotationUri;\n}\n\n/**\n * Type guard to check if event is a resource event\n */\nexport function isResourceEvent(event: any): event is StoredEvent {\n return event &&\n typeof event.event === 'object' &&\n typeof event.event.id === 'string' &&\n typeof event.event.timestamp === 'string' &&\n typeof event.event.resourceId === 'string' &&\n typeof event.event.type === 'string' &&\n typeof event.metadata === 'object' &&\n typeof event.metadata.sequenceNumber === 'number';\n}\n\n// =============================================================================\n// EVENT FORMATTING AND DISPLAY\n// =============================================================================\n\n/**\n * Format event type for display with i18n support\n */\nexport function formatEventType(type: ResourceEventType, t: TranslateFn, payload?: any): string {\n switch (type) {\n case 'resource.created':\n return t('resourceCreated');\n case 'resource.cloned':\n return t('resourceCloned');\n case 'resource.archived':\n return t('resourceArchived');\n case 'resource.unarchived':\n return t('resourceUnarchived');\n\n case 'annotation.added': {\n const motivation = payload?.annotation?.motivation;\n if (motivation === 'highlighting') return t('highlightAdded');\n if (motivation === 'linking') return t('referenceCreated');\n if (motivation === 'assessing') return t('assessmentAdded');\n return t('annotationAdded');\n }\n case 'annotation.removed': {\n return t('annotationRemoved');\n }\n case 'annotation.body.updated': {\n return t('annotationBodyUpdated');\n }\n\n case 'entitytag.added':\n return t('entitytagAdded');\n case 'entitytag.removed':\n return t('entitytagRemoved');\n case 'entitytype.added':\n return t('entitytypeAdded');\n\n case 'job.completed':\n case 'job.started':\n case 'job.progress':\n case 'job.failed':\n return t('jobEvent');\n\n default:\n const _exhaustiveCheck: never = type;\n return _exhaustiveCheck;\n }\n}\n\n/**\n * Get emoji for event type\n * For unified annotation events, pass the payload to determine motivation\n */\nexport function getEventEmoji(type: ResourceEventType, payload?: any): string {\n switch (type) {\n case 'resource.created':\n case 'resource.cloned':\n case 'resource.archived':\n case 'resource.unarchived':\n return '📄';\n\n case 'annotation.added': {\n const motivation = payload?.annotation?.motivation;\n if (motivation === 'highlighting') return '🟡';\n if (motivation === 'linking') return '🔵';\n if (motivation === 'assessing') return '🔴';\n return '📝';\n }\n case 'annotation.removed': {\n return '🗑️';\n }\n case 'annotation.body.updated': {\n return '✏️';\n }\n\n case 'entitytag.added':\n case 'entitytag.removed':\n return '🏷️';\n case 'entitytype.added':\n return '🏷️'; // Same emoji as entitytag (global entity type collection)\n\n case 'job.completed':\n return '🔗'; // Link emoji for linked document creation\n case 'job.started':\n case 'job.progress':\n return '⚙️'; // Gear for job processing\n case 'job.failed':\n return '❌'; // X mark for failed jobs\n\n default:\n const _exhaustiveCheck: never = type;\n return _exhaustiveCheck;\n }\n}\n\n/**\n * Format timestamp as relative time with i18n support\n */\nexport function formatRelativeTime(timestamp: string, t: TranslateFn): string {\n const date = new Date(timestamp);\n const now = new Date();\n const diffMs = now.getTime() - date.getTime();\n const diffMins = Math.floor(diffMs / 60000);\n const diffHours = Math.floor(diffMs / 3600000);\n const diffDays = Math.floor(diffMs / 86400000);\n\n if (diffMins < 1) return t('justNow');\n if (diffMins < 60) return t('minutesAgo', { count: diffMins });\n if (diffHours < 24) return t('hoursAgo', { count: diffHours });\n if (diffDays < 7) return t('daysAgo', { count: diffDays });\n\n return date.toLocaleDateString();\n}\n\n/**\n * Helper to truncate text for display\n */\nfunction truncateText(text: string, maxLength = 50): string {\n const trimmed = text.trim();\n return trimmed.length > maxLength ? trimmed.substring(0, maxLength) + '...' : trimmed;\n}\n\n/**\n * Get display content from event payload - complete implementation\n */\nexport function getEventDisplayContent(\n event: StoredEvent,\n annotations: Annotation[], // Unified annotations array (all types)\n allEvents: StoredEvent[]\n): { exact: string; isQuoted: boolean; isTag: boolean } | null {\n const eventData = event.event;\n const payload = eventData.payload as any;\n\n // Use type discriminators instead of runtime typeof checks\n switch (eventData.type) {\n case 'resource.created':\n case 'resource.cloned': {\n return { exact: payload.name, isQuoted: false, isTag: false };\n }\n\n // Unified annotation events\n case 'annotation.body.updated': {\n // Find current annotation to get its text\n // payload.annotationId is just the UUID, but annotation.id is the full URI\n const annotation = annotations.find(a =>\n a.id.endsWith(`/annotations/${payload.annotationId}`)\n );\n\n if (annotation?.target) {\n try {\n const targetSelector = getTargetSelector(annotation.target);\n const exact = getExactText(targetSelector);\n if (exact) {\n return { exact: truncateText(exact), isQuoted: true, isTag: false };\n }\n } catch {\n // If selector parsing fails, continue to return null\n }\n }\n return null;\n }\n\n case 'annotation.removed': {\n // Find the original annotation.added event to get the text\n // payload.annotationId is just the UUID, but annotation.id in the added event is the full URI\n const addedEvent = allEvents.find(e =>\n e.event.type === 'annotation.added' &&\n (e.event.payload as any).annotation?.id?.endsWith(`/annotations/${payload.annotationId}`)\n );\n if (addedEvent) {\n const addedPayload = addedEvent.event.payload as any;\n try {\n const exact = getExactText(addedPayload.annotation.target.selector);\n if (exact) {\n return { exact: truncateText(exact), isQuoted: true, isTag: false };\n }\n } catch {\n // If selector parsing fails, return null\n }\n }\n return null;\n }\n\n case 'annotation.added': {\n // New unified event structure - annotation is in payload\n try {\n const exact = getExactText(payload.annotation.target.selector);\n if (exact) {\n return { exact: truncateText(exact), isQuoted: true, isTag: false };\n }\n } catch {\n // If selector parsing fails, return null\n }\n return null;\n }\n\n case 'entitytag.added':\n case 'entitytag.removed': {\n return { exact: payload.entityType, isQuoted: false, isTag: true };\n }\n\n case 'job.completed': {\n // Find the annotation that was used to generate the resource\n if (payload.annotationUri) {\n const annotation = annotations.find(a =>\n a.id === payload.annotationUri\n );\n\n if (annotation?.target) {\n try {\n const targetSelector = getTargetSelector(annotation.target);\n const exact = getExactText(targetSelector);\n if (exact) {\n return { exact: truncateText(exact), isQuoted: true, isTag: false };\n }\n } catch {\n // If selector parsing fails, continue to return null\n }\n }\n }\n return null;\n }\n\n default:\n return null;\n }\n}\n\n/**\n * Get entity types from event payload\n */\nexport function getEventEntityTypes(event: StoredEvent): string[] {\n const eventData = event.event;\n\n if (eventData.type === 'annotation.added') {\n const payload = eventData.payload as any;\n const motivation = payload?.annotation?.motivation;\n if (motivation === 'linking') {\n return payload.annotation?.body?.entityTypes ?? [];\n }\n }\n\n return [];\n}\n\n/**\n * Resource creation details\n */\nexport interface ResourceCreationDetails {\n type: 'created' | 'cloned';\n method: string;\n userId?: string;\n sourceDocId?: string; // For cloned resources\n parentResourceId?: string;\n metadata?: Record<string, any>;\n}\n\n/**\n * Get resource creation details from event\n */\nexport function getResourceCreationDetails(event: StoredEvent): ResourceCreationDetails | null {\n const eventData = event.event;\n const payload = eventData.payload as any;\n\n if (eventData.type === 'resource.created') {\n return {\n type: 'created',\n method: payload.creationMethod || 'unknown',\n userId: eventData.userId,\n metadata: payload.metadata,\n };\n }\n\n if (eventData.type === 'resource.cloned') {\n return {\n type: 'cloned',\n method: payload.creationMethod || 'clone',\n userId: eventData.userId,\n sourceDocId: payload.parentResourceId,\n parentResourceId: payload.parentResourceId,\n metadata: payload.metadata,\n };\n }\n\n return null;\n}\n","/**\n * Locale information\n * Copied from SDK for frontend use\n */\n\nexport interface LocaleInfo {\n code: string;\n nativeName: string;\n englishName: string;\n}\n\nexport const LOCALES: readonly LocaleInfo[] = [\n { code: 'ar', nativeName: 'العربية', englishName: 'Arabic' },\n { code: 'bn', nativeName: 'বাংলা', englishName: 'Bengali' },\n { code: 'cs', nativeName: 'Čeština', englishName: 'Czech' },\n { code: 'da', nativeName: 'Dansk', englishName: 'Danish' },\n { code: 'de', nativeName: 'Deutsch', englishName: 'German' },\n { code: 'el', nativeName: 'Ελληνικά', englishName: 'Greek' },\n { code: 'en', nativeName: 'English', englishName: 'English' },\n { code: 'es', nativeName: 'Español', englishName: 'Spanish' },\n { code: 'fa', nativeName: 'فارسی', englishName: 'Persian' },\n { code: 'fi', nativeName: 'Suomi', englishName: 'Finnish' },\n { code: 'fr', nativeName: 'Français', englishName: 'French' },\n { code: 'he', nativeName: 'עברית', englishName: 'Hebrew' },\n { code: 'hi', nativeName: 'हिन्दी', englishName: 'Hindi' },\n { code: 'id', nativeName: 'Bahasa Indonesia', englishName: 'Indonesian' },\n { code: 'it', nativeName: 'Italiano', englishName: 'Italian' },\n { code: 'ja', nativeName: '日本語', englishName: 'Japanese' },\n { code: 'ko', nativeName: '한국어', englishName: 'Korean' },\n { code: 'ms', nativeName: 'Bahasa Melayu', englishName: 'Malay' },\n { code: 'nl', nativeName: 'Nederlands', englishName: 'Dutch' },\n { code: 'no', nativeName: 'Norsk', englishName: 'Norwegian' },\n { code: 'pl', nativeName: 'Polski', englishName: 'Polish' },\n { code: 'pt', nativeName: 'Português', englishName: 'Portuguese' },\n { code: 'ro', nativeName: 'Română', englishName: 'Romanian' },\n { code: 'sv', nativeName: 'Svenska', englishName: 'Swedish' },\n { code: 'th', nativeName: 'ไทย', englishName: 'Thai' },\n { code: 'tr', nativeName: 'Türkçe', englishName: 'Turkish' },\n { code: 'uk', nativeName: 'Українська', englishName: 'Ukrainian' },\n { code: 'vi', nativeName: 'Tiếng Việt', englishName: 'Vietnamese' },\n { code: 'zh', nativeName: '中文', englishName: 'Chinese' },\n] as const;\n\n// Create lookup map for efficient access\nconst localeByCode = new Map<string, LocaleInfo>(\n LOCALES.map(locale => [locale.code.toLowerCase(), locale])\n);\n\n/**\n * Get locale information by code\n */\nexport function getLocaleInfo(code: string | undefined): LocaleInfo | undefined {\n if (!code) return undefined;\n return localeByCode.get(code.toLowerCase());\n}\n\n/**\n * Get the native name of a language by its locale code\n */\nexport function getLocaleNativeName(code: string | undefined): string | undefined {\n return getLocaleInfo(code)?.nativeName;\n}\n\n/**\n * Get the English name of a language by its locale code\n */\nexport function getLocaleEnglishName(code: string | undefined): string | undefined {\n return getLocaleInfo(code)?.englishName;\n}\n\n/**\n * Format locale code for display as \"Native Name (code)\"\n */\nexport function formatLocaleDisplay(code: string | undefined): string | undefined {\n if (!code) return undefined;\n\n const info = getLocaleInfo(code);\n if (!info) return code;\n\n return `${info.nativeName} (${code.toLowerCase()})`;\n}\n\n/**\n * Get all supported locale codes\n */\nexport function getAllLocaleCodes(): readonly string[] {\n return LOCALES.map(l => l.code);\n}\n","/**\n * Helper functions for working with W3C ResourceDescriptor\n */\n\nimport type { components } from '../types';\n\ntype ResourceDescriptor = components['schemas']['ResourceDescriptor'];\ntype Representation = components['schemas']['Representation'];\n\n/**\n * Get the resource ID from @id property\n *\n * For internal resources: extracts UUID from \"http://localhost:4000/resources/{uuid}\"\n * For external resources: returns undefined\n *\n * This is used for routing - the frontend URL should contain only the resource ID,\n * not the full HTTP URI.\n */\nexport function getResourceId(resource: ResourceDescriptor | undefined): string | undefined {\n if (!resource) return undefined;\n\n const fullId = resource['@id'];\n\n // For internal resources, extract the last path segment\n // http://localhost:4000/resources/{uuid} -> {uuid}\n if (fullId.includes('/resources/')) {\n const parts = fullId.split('/resources/');\n const lastPart = parts[parts.length - 1];\n return lastPart || undefined;\n }\n\n // For external resources, cannot extract ID\n return undefined;\n}\n\n/**\n * Get the primary representation (first or only representation)\n */\nexport function getPrimaryRepresentation(resource: ResourceDescriptor | undefined): Representation | undefined {\n if (!resource?.representations) return undefined;\n const reps = Array.isArray(resource.representations)\n ? resource.representations\n : [resource.representations];\n return reps[0];\n}\n\n/**\n * Get the media type from the primary representation\n */\nexport function getPrimaryMediaType(resource: ResourceDescriptor | undefined): string | undefined {\n return getPrimaryRepresentation(resource)?.mediaType;\n}\n\n/**\n * Get the checksum from the primary representation\n */\nexport function getChecksum(resource: ResourceDescriptor | undefined): string | undefined {\n return getPrimaryRepresentation(resource)?.checksum;\n}\n\n/**\n * Get the language from the primary representation\n */\nexport function getLanguage(resource: ResourceDescriptor | undefined): string | undefined {\n return getPrimaryRepresentation(resource)?.language;\n}\n","/**\n * Generic validation utilities for @semiont/api-client\n *\n * Pure TypeScript validation with no external dependencies.\n * Safe to use in any JavaScript environment (Node.js, browser, Deno, etc.)\n */\n\n/**\n * Validation result types\n */\nexport type ValidationSuccess<T> = { success: true; data: T };\nexport type ValidationFailure = { success: false; error: string; details?: string[] };\nexport type ValidationResult<T> = ValidationSuccess<T> | ValidationFailure;\n\n/**\n * JWT Token validation\n *\n * Validates JWT token format (header.payload.signature).\n * Does not verify signature - use for format validation only.\n */\nexport const JWTTokenSchema = {\n parse(token: unknown): string {\n if (typeof token !== 'string') {\n throw new Error('Token must be a string');\n }\n if (!token || token.length === 0) {\n throw new Error('Token is required');\n }\n // JWT format: header.payload.signature\n const jwtRegex = /^[A-Za-z0-9\\-_]+\\.[A-Za-z0-9\\-_]+\\.[A-Za-z0-9\\-_]*$/;\n if (!jwtRegex.test(token)) {\n throw new Error('Invalid JWT token format');\n }\n return token;\n },\n\n safeParse(token: unknown): ValidationResult<string> {\n try {\n const validated = this.parse(token);\n return { success: true, data: validated };\n } catch (error) {\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Invalid JWT token',\n };\n }\n },\n};\n\n/**\n * Generic validation helper with error formatting\n *\n * Wraps any schema's parse method with try/catch and returns ValidationResult.\n *\n * @example\n * ```typescript\n * const result = validateData(JWTTokenSchema, 'eyJ...');\n * if (result.success) {\n * console.log('Valid token:', result.data);\n * } else {\n * console.error('Invalid:', result.error);\n * }\n * ```\n */\nexport function validateData<T>(\n schema: { parse(data: unknown): T },\n data: unknown\n): ValidationResult<T> {\n try {\n const validated = schema.parse(data);\n return { success: true, data: validated };\n } catch (error) {\n return {\n success: false,\n error: error instanceof Error ? error.message : 'Validation failed',\n };\n }\n}\n\n/**\n * Email validation helper\n *\n * Validates email format using RFC 5322 simplified regex.\n *\n * @param email - Email address to validate\n * @returns true if valid email format\n */\nexport function isValidEmail(email: string): boolean {\n if (email.length < 1 || email.length > 255) {\n return false;\n }\n // RFC 5322 simplified email regex\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n return emailRegex.test(email);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semiont/api-client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2-build.16",
|
|
4
4
|
"description": "Semiont API SDK - types, client, and utilities",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": {
|
|
9
10
|
"types": "./dist/index.d.ts",
|
|
10
|
-
"import": "./dist/index.js"
|
|
11
|
-
"require": "./dist/index.js"
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
12
|
},
|
|
13
13
|
"./utils": {
|
|
14
14
|
"types": "./dist/utils/index.d.ts",
|
|
15
|
-
"import": "./dist/utils/index.js"
|
|
16
|
-
"require": "./dist/utils/index.js"
|
|
15
|
+
"import": "./dist/utils/index.js"
|
|
17
16
|
}
|
|
18
17
|
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=20.18.1"
|
|
20
|
+
},
|
|
19
21
|
"files": [
|
|
20
22
|
"dist",
|
|
21
23
|
"README.md",
|
|
@@ -33,10 +35,10 @@
|
|
|
33
35
|
"bundle-spec": "cd ../.. && npm run openapi:bundle",
|
|
34
36
|
"copy-spec": "cp ../../specs/openapi.json openapi.json",
|
|
35
37
|
"generate": "npm run bundle-spec && npm run copy-spec && openapi-typescript openapi.json -o src/types.ts",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"build": "npm run typecheck && tsup",
|
|
38
40
|
"prebuild": "npm run generate",
|
|
39
|
-
"watch": "
|
|
41
|
+
"watch": "tsup --watch",
|
|
40
42
|
"clean": "rm -rf dist src/types.ts openapi.json",
|
|
41
43
|
"test": "vitest run",
|
|
42
44
|
"test:watch": "vitest"
|
|
@@ -47,6 +49,7 @@
|
|
|
47
49
|
"devDependencies": {
|
|
48
50
|
"openapi-typescript": "^7.10.1",
|
|
49
51
|
"orval": "^6.31.0",
|
|
52
|
+
"tsup": "^8.5.1",
|
|
50
53
|
"typescript": "^5.6.3",
|
|
51
54
|
"vitest": "^3.2.4"
|
|
52
55
|
},
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unit tests for SemiontApiClient with mocked HTTP
|
|
3
|
-
*/
|
|
4
|
-
export {};
|
|
5
|
-
/**
|
|
6
|
-
* Example usage documentation
|
|
7
|
-
*
|
|
8
|
-
* Archive a resource:
|
|
9
|
-
* ```typescript
|
|
10
|
-
* await client.updateResource(resourceUri, { archived: true });
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* Unarchive a resource:
|
|
14
|
-
* ```typescript
|
|
15
|
-
* await client.updateResource(resourceUri, { archived: false });
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* List active resources only:
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const active = await client.listResources(20, false);
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* List archived resources only:
|
|
24
|
-
* ```typescript
|
|
25
|
-
* const archived = await client.listResources(20, true);
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
//# sourceMappingURL=client.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/client.test.ts"],"names":[],"mappings":"AAAA;;GAEG;;AA+pBH;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
|