@semiont/api-client 0.2.2-build.15 → 0.2.2
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/events.d.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Event Utilities
|
|
3
|
-
*
|
|
4
|
-
* Pure TypeScript utilities for working with resource events.
|
|
5
|
-
* No React dependencies - safe to use in any JavaScript environment.
|
|
6
|
-
*/
|
|
7
|
-
import type { paths, components } from '../types';
|
|
8
|
-
import { AnnotationUri } from '../branded-types';
|
|
9
|
-
type EventsResponse = paths['/resources/{id}/events']['get']['responses'][200]['content']['application/json'];
|
|
10
|
-
export type StoredEvent = EventsResponse['events'][number];
|
|
11
|
-
export type ResourceEvent = StoredEvent['event'];
|
|
12
|
-
export type EventMetadata = StoredEvent['metadata'];
|
|
13
|
-
type Annotation = components['schemas']['Annotation'];
|
|
14
|
-
export 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';
|
|
15
|
-
type TranslateFn = (key: string, params?: Record<string, string | number>) => string;
|
|
16
|
-
/**
|
|
17
|
-
* Extract annotation ID from event payload
|
|
18
|
-
* Returns null if event is not annotation-related
|
|
19
|
-
*
|
|
20
|
-
* For annotation.added: extracts full URI from payload.annotation.id
|
|
21
|
-
* For annotation.removed/body.updated: constructs full URI from payload.annotationId (UUID) + resourceId
|
|
22
|
-
*/
|
|
23
|
-
export declare function getAnnotationUriFromEvent(event: StoredEvent): AnnotationUri | null;
|
|
24
|
-
/**
|
|
25
|
-
* Check if an event is related to a specific annotation
|
|
26
|
-
*/
|
|
27
|
-
export declare function isEventRelatedToAnnotation(event: StoredEvent, annotationUri: AnnotationUri): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Type guard to check if event is a resource event
|
|
30
|
-
*/
|
|
31
|
-
export declare function isResourceEvent(event: any): event is StoredEvent;
|
|
32
|
-
/**
|
|
33
|
-
* Format event type for display with i18n support
|
|
34
|
-
*/
|
|
35
|
-
export declare function formatEventType(type: ResourceEventType, t: TranslateFn, payload?: any): string;
|
|
36
|
-
/**
|
|
37
|
-
* Get emoji for event type
|
|
38
|
-
* For unified annotation events, pass the payload to determine motivation
|
|
39
|
-
*/
|
|
40
|
-
export declare function getEventEmoji(type: ResourceEventType, payload?: any): string;
|
|
41
|
-
/**
|
|
42
|
-
* Format timestamp as relative time with i18n support
|
|
43
|
-
*/
|
|
44
|
-
export declare function formatRelativeTime(timestamp: string, t: TranslateFn): string;
|
|
45
|
-
/**
|
|
46
|
-
* Get display content from event payload - complete implementation
|
|
47
|
-
*/
|
|
48
|
-
export declare function getEventDisplayContent(event: StoredEvent, annotations: Annotation[], // Unified annotations array (all types)
|
|
49
|
-
allEvents: StoredEvent[]): {
|
|
50
|
-
exact: string;
|
|
51
|
-
isQuoted: boolean;
|
|
52
|
-
isTag: boolean;
|
|
53
|
-
} | null;
|
|
54
|
-
/**
|
|
55
|
-
* Get entity types from event payload
|
|
56
|
-
*/
|
|
57
|
-
export declare function getEventEntityTypes(event: StoredEvent): string[];
|
|
58
|
-
/**
|
|
59
|
-
* Resource creation details
|
|
60
|
-
*/
|
|
61
|
-
export interface ResourceCreationDetails {
|
|
62
|
-
type: 'created' | 'cloned';
|
|
63
|
-
method: string;
|
|
64
|
-
userId?: string;
|
|
65
|
-
sourceDocId?: string;
|
|
66
|
-
parentResourceId?: string;
|
|
67
|
-
metadata?: Record<string, any>;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Get resource creation details from event
|
|
71
|
-
*/
|
|
72
|
-
export declare function getResourceCreationDetails(event: StoredEvent): ResourceCreationDetails | null;
|
|
73
|
-
export {};
|
|
74
|
-
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIjD,KAAK,cAAc,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AAC9G,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAC3D,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AACjD,MAAM,MAAM,aAA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,GACvB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAiG7D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,EAAE,CAYhE;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,WAAW,GAAG,uBAAuB,GAAG,IAAI,CAyB7F"}
|
package/dist/utils/events.js
DELETED
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Event Utilities
|
|
4
|
-
*
|
|
5
|
-
* Pure TypeScript utilities for working with resource events.
|
|
6
|
-
* No React dependencies - safe to use in any JavaScript environment.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.getAnnotationUriFromEvent = getAnnotationUriFromEvent;
|
|
10
|
-
exports.isEventRelatedToAnnotation = isEventRelatedToAnnotation;
|
|
11
|
-
exports.isResourceEvent = isResourceEvent;
|
|
12
|
-
exports.formatEventType = formatEventType;
|
|
13
|
-
exports.getEventEmoji = getEventEmoji;
|
|
14
|
-
exports.formatRelativeTime = formatRelativeTime;
|
|
15
|
-
exports.getEventDisplayContent = getEventDisplayContent;
|
|
16
|
-
exports.getEventEntityTypes = getEventEntityTypes;
|
|
17
|
-
exports.getResourceCreationDetails = getResourceCreationDetails;
|
|
18
|
-
const annotations_1 = require("./annotations");
|
|
19
|
-
// =============================================================================
|
|
20
|
-
// EVENT TYPE GUARDS AND EXTRACTION
|
|
21
|
-
// =============================================================================
|
|
22
|
-
/**
|
|
23
|
-
* Extract annotation ID from event payload
|
|
24
|
-
* Returns null if event is not annotation-related
|
|
25
|
-
*
|
|
26
|
-
* For annotation.added: extracts full URI from payload.annotation.id
|
|
27
|
-
* For annotation.removed/body.updated: constructs full URI from payload.annotationId (UUID) + resourceId
|
|
28
|
-
*/
|
|
29
|
-
function getAnnotationUriFromEvent(event) {
|
|
30
|
-
const eventData = event.event;
|
|
31
|
-
const payload = eventData.payload;
|
|
32
|
-
if (!payload) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
switch (eventData.type) {
|
|
36
|
-
case 'annotation.added':
|
|
37
|
-
// annotation.added has the full annotation object with id as full URI
|
|
38
|
-
return payload.annotation?.id || null;
|
|
39
|
-
case 'annotation.removed':
|
|
40
|
-
case 'annotation.body.updated':
|
|
41
|
-
// These events have annotationId (UUID only), need to construct full URI
|
|
42
|
-
// Extract base URL from resourceId (format: http://host/resources/id)
|
|
43
|
-
if (payload.annotationId && eventData.resourceId) {
|
|
44
|
-
try {
|
|
45
|
-
const resourceUri = eventData.resourceId;
|
|
46
|
-
// Extract base URL by removing the /resources/{id} part
|
|
47
|
-
const baseUrl = resourceUri.substring(0, resourceUri.lastIndexOf('/resources/'));
|
|
48
|
-
return `${baseUrl}/annotations/${payload.annotationId}`;
|
|
49
|
-
}
|
|
50
|
-
catch (e) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return null;
|
|
55
|
-
default:
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Check if an event is related to a specific annotation
|
|
61
|
-
*/
|
|
62
|
-
function isEventRelatedToAnnotation(event, annotationUri) {
|
|
63
|
-
const eventAnnotationUri = getAnnotationUriFromEvent(event);
|
|
64
|
-
return eventAnnotationUri === annotationUri;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Type guard to check if event is a resource event
|
|
68
|
-
*/
|
|
69
|
-
function isResourceEvent(event) {
|
|
70
|
-
return event &&
|
|
71
|
-
typeof event.event === 'object' &&
|
|
72
|
-
typeof event.event.id === 'string' &&
|
|
73
|
-
typeof event.event.timestamp === 'string' &&
|
|
74
|
-
typeof event.event.resourceId === 'string' &&
|
|
75
|
-
typeof event.event.type === 'string' &&
|
|
76
|
-
typeof event.metadata === 'object' &&
|
|
77
|
-
typeof event.metadata.sequenceNumber === 'number';
|
|
78
|
-
}
|
|
79
|
-
// =============================================================================
|
|
80
|
-
// EVENT FORMATTING AND DISPLAY
|
|
81
|
-
// =============================================================================
|
|
82
|
-
/**
|
|
83
|
-
* Format event type for display with i18n support
|
|
84
|
-
*/
|
|
85
|
-
function formatEventType(type, t, payload) {
|
|
86
|
-
switch (type) {
|
|
87
|
-
case 'resource.created':
|
|
88
|
-
return t('resourceCreated');
|
|
89
|
-
case 'resource.cloned':
|
|
90
|
-
return t('resourceCloned');
|
|
91
|
-
case 'resource.archived':
|
|
92
|
-
return t('resourceArchived');
|
|
93
|
-
case 'resource.unarchived':
|
|
94
|
-
return t('resourceUnarchived');
|
|
95
|
-
case 'annotation.added': {
|
|
96
|
-
const motivation = payload?.annotation?.motivation;
|
|
97
|
-
if (motivation === 'highlighting')
|
|
98
|
-
return t('highlightAdded');
|
|
99
|
-
if (motivation === 'linking')
|
|
100
|
-
return t('referenceCreated');
|
|
101
|
-
if (motivation === 'assessing')
|
|
102
|
-
return t('assessmentAdded');
|
|
103
|
-
return t('annotationAdded');
|
|
104
|
-
}
|
|
105
|
-
case 'annotation.removed': {
|
|
106
|
-
return t('annotationRemoved');
|
|
107
|
-
}
|
|
108
|
-
case 'annotation.body.updated': {
|
|
109
|
-
return t('annotationBodyUpdated');
|
|
110
|
-
}
|
|
111
|
-
case 'entitytag.added':
|
|
112
|
-
return t('entitytagAdded');
|
|
113
|
-
case 'entitytag.removed':
|
|
114
|
-
return t('entitytagRemoved');
|
|
115
|
-
case 'entitytype.added':
|
|
116
|
-
return t('entitytypeAdded');
|
|
117
|
-
case 'job.completed':
|
|
118
|
-
case 'job.started':
|
|
119
|
-
case 'job.progress':
|
|
120
|
-
case 'job.failed':
|
|
121
|
-
return t('jobEvent');
|
|
122
|
-
default:
|
|
123
|
-
const _exhaustiveCheck = type;
|
|
124
|
-
return _exhaustiveCheck;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Get emoji for event type
|
|
129
|
-
* For unified annotation events, pass the payload to determine motivation
|
|
130
|
-
*/
|
|
131
|
-
function getEventEmoji(type, payload) {
|
|
132
|
-
switch (type) {
|
|
133
|
-
case 'resource.created':
|
|
134
|
-
case 'resource.cloned':
|
|
135
|
-
case 'resource.archived':
|
|
136
|
-
case 'resource.unarchived':
|
|
137
|
-
return '📄';
|
|
138
|
-
case 'annotation.added': {
|
|
139
|
-
const motivation = payload?.annotation?.motivation;
|
|
140
|
-
if (motivation === 'highlighting')
|
|
141
|
-
return '🟡';
|
|
142
|
-
if (motivation === 'linking')
|
|
143
|
-
return '🔵';
|
|
144
|
-
if (motivation === 'assessing')
|
|
145
|
-
return '🔴';
|
|
146
|
-
return '📝';
|
|
147
|
-
}
|
|
148
|
-
case 'annotation.removed': {
|
|
149
|
-
return '🗑️';
|
|
150
|
-
}
|
|
151
|
-
case 'annotation.body.updated': {
|
|
152
|
-
return '✏️';
|
|
153
|
-
}
|
|
154
|
-
case 'entitytag.added':
|
|
155
|
-
case 'entitytag.removed':
|
|
156
|
-
return '🏷️';
|
|
157
|
-
case 'entitytype.added':
|
|
158
|
-
return '🏷️'; // Same emoji as entitytag (global entity type collection)
|
|
159
|
-
case 'job.completed':
|
|
160
|
-
return '🔗'; // Link emoji for linked document creation
|
|
161
|
-
case 'job.started':
|
|
162
|
-
case 'job.progress':
|
|
163
|
-
return '⚙️'; // Gear for job processing
|
|
164
|
-
case 'job.failed':
|
|
165
|
-
return '❌'; // X mark for failed jobs
|
|
166
|
-
default:
|
|
167
|
-
const _exhaustiveCheck = type;
|
|
168
|
-
return _exhaustiveCheck;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Format timestamp as relative time with i18n support
|
|
173
|
-
*/
|
|
174
|
-
function formatRelativeTime(timestamp, t) {
|
|
175
|
-
const date = new Date(timestamp);
|
|
176
|
-
const now = new Date();
|
|
177
|
-
const diffMs = now.getTime() - date.getTime();
|
|
178
|
-
const diffMins = Math.floor(diffMs / 60000);
|
|
179
|
-
const diffHours = Math.floor(diffMs / 3600000);
|
|
180
|
-
const diffDays = Math.floor(diffMs / 86400000);
|
|
181
|
-
if (diffMins < 1)
|
|
182
|
-
return t('justNow');
|
|
183
|
-
if (diffMins < 60)
|
|
184
|
-
return t('minutesAgo', { count: diffMins });
|
|
185
|
-
if (diffHours < 24)
|
|
186
|
-
return t('hoursAgo', { count: diffHours });
|
|
187
|
-
if (diffDays < 7)
|
|
188
|
-
return t('daysAgo', { count: diffDays });
|
|
189
|
-
return date.toLocaleDateString();
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Helper to truncate text for display
|
|
193
|
-
*/
|
|
194
|
-
function truncateText(text, maxLength = 50) {
|
|
195
|
-
const trimmed = text.trim();
|
|
196
|
-
return trimmed.length > maxLength ? trimmed.substring(0, maxLength) + '...' : trimmed;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Get display content from event payload - complete implementation
|
|
200
|
-
*/
|
|
201
|
-
function getEventDisplayContent(event, annotations, // Unified annotations array (all types)
|
|
202
|
-
allEvents) {
|
|
203
|
-
const eventData = event.event;
|
|
204
|
-
const payload = eventData.payload;
|
|
205
|
-
// Use type discriminators instead of runtime typeof checks
|
|
206
|
-
switch (eventData.type) {
|
|
207
|
-
case 'resource.created':
|
|
208
|
-
case 'resource.cloned': {
|
|
209
|
-
return { exact: payload.name, isQuoted: false, isTag: false };
|
|
210
|
-
}
|
|
211
|
-
// Unified annotation events
|
|
212
|
-
case 'annotation.body.updated': {
|
|
213
|
-
// Find current annotation to get its text
|
|
214
|
-
// payload.annotationId is just the UUID, but annotation.id is the full URI
|
|
215
|
-
const annotation = annotations.find(a => a.id.endsWith(`/annotations/${payload.annotationId}`));
|
|
216
|
-
if (annotation?.target) {
|
|
217
|
-
try {
|
|
218
|
-
const targetSelector = (0, annotations_1.getTargetSelector)(annotation.target);
|
|
219
|
-
const exact = (0, annotations_1.getExactText)(targetSelector);
|
|
220
|
-
if (exact) {
|
|
221
|
-
return { exact: truncateText(exact), isQuoted: true, isTag: false };
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
catch {
|
|
225
|
-
// If selector parsing fails, continue to return null
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return null;
|
|
229
|
-
}
|
|
230
|
-
case 'annotation.removed': {
|
|
231
|
-
// Find the original annotation.added event to get the text
|
|
232
|
-
// payload.annotationId is just the UUID, but annotation.id in the added event is the full URI
|
|
233
|
-
const addedEvent = allEvents.find(e => e.event.type === 'annotation.added' &&
|
|
234
|
-
e.event.payload.annotation?.id?.endsWith(`/annotations/${payload.annotationId}`));
|
|
235
|
-
if (addedEvent) {
|
|
236
|
-
const addedPayload = addedEvent.event.payload;
|
|
237
|
-
try {
|
|
238
|
-
const exact = (0, annotations_1.getExactText)(addedPayload.annotation.target.selector);
|
|
239
|
-
if (exact) {
|
|
240
|
-
return { exact: truncateText(exact), isQuoted: true, isTag: false };
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
catch {
|
|
244
|
-
// If selector parsing fails, return null
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return null;
|
|
248
|
-
}
|
|
249
|
-
case 'annotation.added': {
|
|
250
|
-
// New unified event structure - annotation is in payload
|
|
251
|
-
try {
|
|
252
|
-
const exact = (0, annotations_1.getExactText)(payload.annotation.target.selector);
|
|
253
|
-
if (exact) {
|
|
254
|
-
return { exact: truncateText(exact), isQuoted: true, isTag: false };
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
catch {
|
|
258
|
-
// If selector parsing fails, return null
|
|
259
|
-
}
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
case 'entitytag.added':
|
|
263
|
-
case 'entitytag.removed': {
|
|
264
|
-
return { exact: payload.entityType, isQuoted: false, isTag: true };
|
|
265
|
-
}
|
|
266
|
-
case 'job.completed': {
|
|
267
|
-
// Find the annotation that was used to generate the resource
|
|
268
|
-
if (payload.annotationUri) {
|
|
269
|
-
const annotation = annotations.find(a => a.id === payload.annotationUri);
|
|
270
|
-
if (annotation?.target) {
|
|
271
|
-
try {
|
|
272
|
-
const targetSelector = (0, annotations_1.getTargetSelector)(annotation.target);
|
|
273
|
-
const exact = (0, annotations_1.getExactText)(targetSelector);
|
|
274
|
-
if (exact) {
|
|
275
|
-
return { exact: truncateText(exact), isQuoted: true, isTag: false };
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
catch {
|
|
279
|
-
// If selector parsing fails, continue to return null
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
return null;
|
|
284
|
-
}
|
|
285
|
-
default:
|
|
286
|
-
return null;
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Get entity types from event payload
|
|
291
|
-
*/
|
|
292
|
-
function getEventEntityTypes(event) {
|
|
293
|
-
const eventData = event.event;
|
|
294
|
-
if (eventData.type === 'annotation.added') {
|
|
295
|
-
const payload = eventData.payload;
|
|
296
|
-
const motivation = payload?.annotation?.motivation;
|
|
297
|
-
if (motivation === 'linking') {
|
|
298
|
-
return payload.annotation?.body?.entityTypes ?? [];
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
return [];
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Get resource creation details from event
|
|
305
|
-
*/
|
|
306
|
-
function getResourceCreationDetails(event) {
|
|
307
|
-
const eventData = event.event;
|
|
308
|
-
const payload = eventData.payload;
|
|
309
|
-
if (eventData.type === 'resource.created') {
|
|
310
|
-
return {
|
|
311
|
-
type: 'created',
|
|
312
|
-
method: payload.creationMethod || 'unknown',
|
|
313
|
-
userId: eventData.userId,
|
|
314
|
-
metadata: payload.metadata,
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
if (eventData.type === 'resource.cloned') {
|
|
318
|
-
return {
|
|
319
|
-
type: 'cloned',
|
|
320
|
-
method: payload.creationMethod || 'clone',
|
|
321
|
-
userId: eventData.userId,
|
|
322
|
-
sourceDocId: payload.parentResourceId,
|
|
323
|
-
parentResourceId: payload.parentResourceId,
|
|
324
|
-
metadata: payload.metadata,
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
return null;
|
|
328
|
-
}
|
|
329
|
-
//# sourceMappingURL=events.js.map
|
package/dist/utils/events.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/utils/events.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AA2CH,8DAgCC;AAKD,gEAGC;AAKD,0CASC;AASD,0CA0CC;AAMD,sCAwCC;AAKD,gDAcC;AAaD,wDAqGC;AAKD,kDAYC;AAiBD,gEAyBC;AA9XD,+CAAgE;AA4BhE,gFAAgF;AAChF,mCAAmC;AACnC,gFAAgF;AAEhF;;;;;;GAMG;AACH,SAAgB,yBAAyB,CAAC,KAAkB;IAC1D,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC;IAC9B,MAAM,OAAO,GAAG,SAAS,CAAC,OAAc,CAAC;IAEzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,KAAK,kBAAkB;YACrB,sEAAsE;YACtE,OAAO,OAAO,CAAC,UAAU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AAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAcD;;GAEG;AACH,SAAgB,0BAA0B,CAAC,KAAkB;IAC3D,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC;IAC9B,MAAM,OAAO,GAAG,SAAS,CAAC,OAAc,CAAC;IAEzC,IAAI,SAAS,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;QAC1C,OAAO;YACL,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,OAAO,CAAC,cAAc,IAAI,SAAS;YAC3C,MAAM,EAAE,SAAS,CAAC,MAAM;YACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC;IACJ,CAAC;IAED,IAAI,SAAS,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;QACzC,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,OAAO,CAAC,cAAc,IAAI,OAAO;YACzC,MAAM,EAAE,SAAS,CAAC,MAAM;YACxB,WAAW,EAAE,OAAO,CAAC,gBAAgB;YACrC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
package/dist/utils/locales.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Locale information
|
|
3
|
-
* Copied from SDK for frontend use
|
|
4
|
-
*/
|
|
5
|
-
export interface LocaleInfo {
|
|
6
|
-
code: string;
|
|
7
|
-
nativeName: string;
|
|
8
|
-
englishName: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const LOCALES: readonly LocaleInfo[];
|
|
11
|
-
/**
|
|
12
|
-
* Get locale information by code
|
|
13
|
-
*/
|
|
14
|
-
export declare function getLocaleInfo(code: string | undefined): LocaleInfo | undefined;
|
|
15
|
-
/**
|
|
16
|
-
* Get the native name of a language by its locale code
|
|
17
|
-
*/
|
|
18
|
-
export declare function getLocaleNativeName(code: string | undefined): string | undefined;
|
|
19
|
-
/**
|
|
20
|
-
* Get the English name of a language by its locale code
|
|
21
|
-
*/
|
|
22
|
-
export declare function getLocaleEnglishName(code: string | undefined): string | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Format locale code for display as "Native Name (code)"
|
|
25
|
-
*/
|
|
26
|
-
export declare function formatLocaleDisplay(code: string | undefined): string | undefined;
|
|
27
|
-
/**
|
|
28
|
-
* Get all supported locale codes
|
|
29
|
-
*/
|
|
30
|
-
export declare function getAllLocaleCodes(): readonly string[];
|
|
31
|
-
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/utils/locales.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,OAAO,EAAE,SAAS,UAAU,EA8B/B,CAAC;AAOX;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAG9E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAEhF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAEjF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAOhF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,SAAS,MAAM,EAAE,CAErD"}
|
package/dist/utils/locales.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Locale information
|
|
4
|
-
* Copied from SDK for frontend use
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.LOCALES = void 0;
|
|
8
|
-
exports.getLocaleInfo = getLocaleInfo;
|
|
9
|
-
exports.getLocaleNativeName = getLocaleNativeName;
|
|
10
|
-
exports.getLocaleEnglishName = getLocaleEnglishName;
|
|
11
|
-
exports.formatLocaleDisplay = formatLocaleDisplay;
|
|
12
|
-
exports.getAllLocaleCodes = getAllLocaleCodes;
|
|
13
|
-
exports.LOCALES = [
|
|
14
|
-
{ code: 'ar', nativeName: 'العربية', englishName: 'Arabic' },
|
|
15
|
-
{ code: 'bn', nativeName: 'বাংলা', englishName: 'Bengali' },
|
|
16
|
-
{ code: 'cs', nativeName: 'Čeština', englishName: 'Czech' },
|
|
17
|
-
{ code: 'da', nativeName: 'Dansk', englishName: 'Danish' },
|
|
18
|
-
{ code: 'de', nativeName: 'Deutsch', englishName: 'German' },
|
|
19
|
-
{ code: 'el', nativeName: 'Ελληνικά', englishName: 'Greek' },
|
|
20
|
-
{ code: 'en', nativeName: 'English', englishName: 'English' },
|
|
21
|
-
{ code: 'es', nativeName: 'Español', englishName: 'Spanish' },
|
|
22
|
-
{ code: 'fa', nativeName: 'فارسی', englishName: 'Persian' },
|
|
23
|
-
{ code: 'fi', nativeName: 'Suomi', englishName: 'Finnish' },
|
|
24
|
-
{ code: 'fr', nativeName: 'Français', englishName: 'French' },
|
|
25
|
-
{ code: 'he', nativeName: 'עברית', englishName: 'Hebrew' },
|
|
26
|
-
{ code: 'hi', nativeName: 'हिन्दी', englishName: 'Hindi' },
|
|
27
|
-
{ code: 'id', nativeName: 'Bahasa Indonesia', englishName: 'Indonesian' },
|
|
28
|
-
{ code: 'it', nativeName: 'Italiano', englishName: 'Italian' },
|
|
29
|
-
{ code: 'ja', nativeName: '日本語', englishName: 'Japanese' },
|
|
30
|
-
{ code: 'ko', nativeName: '한국어', englishName: 'Korean' },
|
|
31
|
-
{ code: 'ms', nativeName: 'Bahasa Melayu', englishName: 'Malay' },
|
|
32
|
-
{ code: 'nl', nativeName: 'Nederlands', englishName: 'Dutch' },
|
|
33
|
-
{ code: 'no', nativeName: 'Norsk', englishName: 'Norwegian' },
|
|
34
|
-
{ code: 'pl', nativeName: 'Polski', englishName: 'Polish' },
|
|
35
|
-
{ code: 'pt', nativeName: 'Português', englishName: 'Portuguese' },
|
|
36
|
-
{ code: 'ro', nativeName: 'Română', englishName: 'Romanian' },
|
|
37
|
-
{ code: 'sv', nativeName: 'Svenska', englishName: 'Swedish' },
|
|
38
|
-
{ code: 'th', nativeName: 'ไทย', englishName: 'Thai' },
|
|
39
|
-
{ code: 'tr', nativeName: 'Türkçe', englishName: 'Turkish' },
|
|
40
|
-
{ code: 'uk', nativeName: 'Українська', englishName: 'Ukrainian' },
|
|
41
|
-
{ code: 'vi', nativeName: 'Tiếng Việt', englishName: 'Vietnamese' },
|
|
42
|
-
{ code: 'zh', nativeName: '中文', englishName: 'Chinese' },
|
|
43
|
-
];
|
|
44
|
-
// Create lookup map for efficient access
|
|
45
|
-
const localeByCode = new Map(exports.LOCALES.map(locale => [locale.code.toLowerCase(), locale]));
|
|
46
|
-
/**
|
|
47
|
-
* Get locale information by code
|
|
48
|
-
*/
|
|
49
|
-
function getLocaleInfo(code) {
|
|
50
|
-
if (!code)
|
|
51
|
-
return undefined;
|
|
52
|
-
return localeByCode.get(code.toLowerCase());
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Get the native name of a language by its locale code
|
|
56
|
-
*/
|
|
57
|
-
function getLocaleNativeName(code) {
|
|
58
|
-
return getLocaleInfo(code)?.nativeName;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Get the English name of a language by its locale code
|
|
62
|
-
*/
|
|
63
|
-
function getLocaleEnglishName(code) {
|
|
64
|
-
return getLocaleInfo(code)?.englishName;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Format locale code for display as "Native Name (code)"
|
|
68
|
-
*/
|
|
69
|
-
function formatLocaleDisplay(code) {
|
|
70
|
-
if (!code)
|
|
71
|
-
return undefined;
|
|
72
|
-
const info = getLocaleInfo(code);
|
|
73
|
-
if (!info)
|
|
74
|
-
return code;
|
|
75
|
-
return `${info.nativeName} (${code.toLowerCase()})`;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Get all supported locale codes
|
|
79
|
-
*/
|
|
80
|
-
function getAllLocaleCodes() {
|
|
81
|
-
return exports.LOCALES.map(l => l.code);
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=locales.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"locales.js","sourceRoot":"","sources":["../../src/utils/locales.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAgDH,sCAGC;AAKD,kDAEC;AAKD,oDAEC;AAKD,kDAOC;AAKD,8CAEC;AA5EY,QAAA,OAAO,GAA0B;IAC5C,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE;IAC5D,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE;IAC3D,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE;IAC3D,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE;IAC1D,EAAE,IAAI,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W,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAwB;IAC1D,OAAO,aAAa,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAAC,IAAwB;IAC3D,OAAO,aAAa,CAAC,IAAI,CAAC,EAAE,WAAW,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAwB;IAC1D,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAE5B,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAEvB,OAAO,GAAG,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB;IAC/B,OAAO,eAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helper functions for working with W3C ResourceDescriptor
|
|
3
|
-
*/
|
|
4
|
-
import type { components } from '../types';
|
|
5
|
-
type ResourceDescriptor = components['schemas']['ResourceDescriptor'];
|
|
6
|
-
type Representation = components['schemas']['Representation'];
|
|
7
|
-
/**
|
|
8
|
-
* Get the resource ID from @id property
|
|
9
|
-
*
|
|
10
|
-
* For internal resources: extracts UUID from "http://localhost:4000/resources/{uuid}"
|
|
11
|
-
* For external resources: returns undefined
|
|
12
|
-
*
|
|
13
|
-
* This is used for routing - the frontend URL should contain only the resource ID,
|
|
14
|
-
* not the full HTTP URI.
|
|
15
|
-
*/
|
|
16
|
-
export declare function getResourceId(resource: ResourceDescriptor | undefined): string | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Get the primary representation (first or only representation)
|
|
19
|
-
*/
|
|
20
|
-
export declare function getPrimaryRepresentation(resource: ResourceDescriptor | undefined): Representation | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Get the media type from the primary representation
|
|
23
|
-
*/
|
|
24
|
-
export declare function getPrimaryMediaType(resource: ResourceDescriptor | undefined): string | undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Get the checksum from the primary representation
|
|
27
|
-
*/
|
|
28
|
-
export declare function getChecksum(resource: ResourceDescriptor | undefined): string | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Get the language from the primary representation
|
|
31
|
-
*/
|
|
32
|
-
export declare function getLanguage(resource: ResourceDescriptor | undefined): string | undefined;
|
|
33
|
-
export {};
|
|
34
|
-
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/utils/resources.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,KAAK,kBAAkB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,oBAAoB,CAAC,CAAC;AACtE,KAAK,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,CAAC;AAE9D;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAe1F;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,CAM7G;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAEhG;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAExF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAExF"}
|
package/dist/utils/resources.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Helper functions for working with W3C ResourceDescriptor
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getResourceId = getResourceId;
|
|
7
|
-
exports.getPrimaryRepresentation = getPrimaryRepresentation;
|
|
8
|
-
exports.getPrimaryMediaType = getPrimaryMediaType;
|
|
9
|
-
exports.getChecksum = getChecksum;
|
|
10
|
-
exports.getLanguage = getLanguage;
|
|
11
|
-
/**
|
|
12
|
-
* Get the resource ID from @id property
|
|
13
|
-
*
|
|
14
|
-
* For internal resources: extracts UUID from "http://localhost:4000/resources/{uuid}"
|
|
15
|
-
* For external resources: returns undefined
|
|
16
|
-
*
|
|
17
|
-
* This is used for routing - the frontend URL should contain only the resource ID,
|
|
18
|
-
* not the full HTTP URI.
|
|
19
|
-
*/
|
|
20
|
-
function getResourceId(resource) {
|
|
21
|
-
if (!resource)
|
|
22
|
-
return undefined;
|
|
23
|
-
const fullId = resource['@id'];
|
|
24
|
-
// For internal resources, extract the last path segment
|
|
25
|
-
// http://localhost:4000/resources/{uuid} -> {uuid}
|
|
26
|
-
if (fullId.includes('/resources/')) {
|
|
27
|
-
const parts = fullId.split('/resources/');
|
|
28
|
-
const lastPart = parts[parts.length - 1];
|
|
29
|
-
return lastPart || undefined;
|
|
30
|
-
}
|
|
31
|
-
// For external resources, cannot extract ID
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Get the primary representation (first or only representation)
|
|
36
|
-
*/
|
|
37
|
-
function getPrimaryRepresentation(resource) {
|
|
38
|
-
if (!resource?.representations)
|
|
39
|
-
return undefined;
|
|
40
|
-
const reps = Array.isArray(resource.representations)
|
|
41
|
-
? resource.representations
|
|
42
|
-
: [resource.representations];
|
|
43
|
-
return reps[0];
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Get the media type from the primary representation
|
|
47
|
-
*/
|
|
48
|
-
function getPrimaryMediaType(resource) {
|
|
49
|
-
return getPrimaryRepresentation(resource)?.mediaType;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Get the checksum from the primary representation
|
|
53
|
-
*/
|
|
54
|
-
function getChecksum(resource) {
|
|
55
|
-
return getPrimaryRepresentation(resource)?.checksum;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Get the language from the primary representation
|
|
59
|
-
*/
|
|
60
|
-
function getLanguage(resource) {
|
|
61
|
-
return getPrimaryRepresentation(resource)?.language;
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=resources.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/utils/resources.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAgBH,sCAeC;AAKD,4DAMC;AAKD,kDAEC;AAKD,kCAEC;AAKD,kCAEC;AAxDD;;;;;;;;GAQG;AACH,SAAgB,aAAa,CAAC,QAAwC;IACpE,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IAEhC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE/B,wDAAwD;IACxD,mDAAmD;IACnD,IAAI,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QACnC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAC1C,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACzC,OAAO,QAAQ,IAAI,SAAS,CAAC;IAC/B,CAAC;IAED,4CAA4C;IAC5C,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,SAAgB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