@semiont/core 0.2.46 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +346 -131
- package/dist/index.js +3 -50
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -95,46 +95,6 @@ function userId(id) {
|
|
|
95
95
|
return id;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
// src/uri-utils.ts
|
|
99
|
-
function resourceIdToURI(id, publicURL) {
|
|
100
|
-
const normalizedBase = publicURL.endsWith("/") ? publicURL.slice(0, -1) : publicURL;
|
|
101
|
-
return resourceUri(`${normalizedBase}/resources/${id}`);
|
|
102
|
-
}
|
|
103
|
-
function uriToResourceId(uri) {
|
|
104
|
-
const url = new URL(uri);
|
|
105
|
-
const match = url.pathname.match(/\/resources\/([^/]+)/);
|
|
106
|
-
if (!match || !match[1]) {
|
|
107
|
-
throw new Error(`Invalid resource URI: ${uri}`);
|
|
108
|
-
}
|
|
109
|
-
return resourceId(match[1]);
|
|
110
|
-
}
|
|
111
|
-
function annotationIdToURI(id, publicURL) {
|
|
112
|
-
const normalizedBase = publicURL.endsWith("/") ? publicURL.slice(0, -1) : publicURL;
|
|
113
|
-
return annotationUri(`${normalizedBase}/annotations/${id}`);
|
|
114
|
-
}
|
|
115
|
-
function uriToAnnotationId(uri) {
|
|
116
|
-
const url = new URL(uri);
|
|
117
|
-
const match = url.pathname.match(/\/annotations\/([^/]+)/);
|
|
118
|
-
if (!match || !match[1]) {
|
|
119
|
-
throw new Error(`Invalid annotation URI: ${uri}`);
|
|
120
|
-
}
|
|
121
|
-
return annotationId(match[1]);
|
|
122
|
-
}
|
|
123
|
-
function uriToAnnotationIdOrPassthrough(uriOrId) {
|
|
124
|
-
try {
|
|
125
|
-
return uriToAnnotationId(uriOrId);
|
|
126
|
-
} catch {
|
|
127
|
-
return annotationId(uriOrId);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
function extractResourceUriFromAnnotationUri(annotationUri2) {
|
|
131
|
-
const parts = annotationUri2.split("/annotations/");
|
|
132
|
-
if (parts.length !== 2) {
|
|
133
|
-
throw new Error(`Invalid annotation URI format: ${annotationUri2}`);
|
|
134
|
-
}
|
|
135
|
-
return resourceUri(parts[0]);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
98
|
// src/events.ts
|
|
139
99
|
function isResourceEvent(event) {
|
|
140
100
|
return event && typeof event.id === "string" && typeof event.timestamp === "string" && (event.resourceId === void 0 || typeof event.resourceId === "string") && // resourceId now optional
|
|
@@ -444,15 +404,8 @@ function validateSvgMarkup(svg) {
|
|
|
444
404
|
}
|
|
445
405
|
return null;
|
|
446
406
|
}
|
|
447
|
-
function
|
|
448
|
-
|
|
449
|
-
throw new Error("baseUrl is required to generate annotation URIs");
|
|
450
|
-
}
|
|
451
|
-
const normalizedBase = baseUrl2.endsWith("/") ? baseUrl2.slice(0, -1) : baseUrl2;
|
|
452
|
-
return `${normalizedBase}/annotations/${generateUuid()}`;
|
|
453
|
-
}
|
|
454
|
-
function assembleAnnotation(request, creator, publicURL) {
|
|
455
|
-
const newAnnotationId = generateAnnotationId(publicURL);
|
|
407
|
+
function assembleAnnotation(request, creator) {
|
|
408
|
+
const newAnnotationId = generateUuid();
|
|
456
409
|
const posSelector = getTextPositionSelector(request.target.selector);
|
|
457
410
|
const svgSelector = getSvgSelector(request.target.selector);
|
|
458
411
|
const fragmentSelector = getFragmentSelector(request.target.selector);
|
|
@@ -2485,6 +2438,6 @@ function getAllPlatformTypes() {
|
|
|
2485
2438
|
var CORE_TYPES_VERSION = "0.1.0";
|
|
2486
2439
|
var SDK_VERSION = "0.1.0";
|
|
2487
2440
|
|
|
2488
|
-
export { APIError, CORE_TYPES_VERSION, CREATION_METHODS, ConfigurationError, ConflictError, EventBus, NotFoundError, SDK_VERSION, ScopedEventBus, ScriptError, SemiontError, UnauthorizedError, ValidationError, accessToken, annotationId,
|
|
2441
|
+
export { APIError, CORE_TYPES_VERSION, CREATION_METHODS, ConfigurationError, ConflictError, EventBus, NotFoundError, SDK_VERSION, ScopedEventBus, ScriptError, SemiontError, UnauthorizedError, ValidationError, accessToken, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, burstBuffer, cloneToken, createConfigLoader, deepMerge, didToAgent, displayConfiguration, email, entityType, findBodyItem, formatErrors, generateUuid, getAllPlatformTypes, getAnnotationUriFromEvent, getEventType, getFragmentSelector, getNodeEnvForEnvironment, getSvgSelector, getTextPositionSelector, googleCredential, hasAWSConfig, isAnnotationId, isArray, isBoolean, isDefined, isEventRelatedToAnnotation, isFunction, isNull, isNullish, isNumber, isObject, isResourceEvent, isResourceId, isResourceScopedEvent, isResourceEvent2 as isStoredEvent, isString, isSystemEvent, isUndefined, isValidPlatformType, jobId, listEnvironmentNames, mcpToken, parseAndMergeConfigs, parseEnvironment, refreshToken, resolveEnvVars, resourceAnnotationUri, resourceId, resourceUri, searchQuery, userDID, userId, userToAgent, userToDid, validateEnvironment, validateEnvironmentConfig, validateSemiontConfig, validateSiteConfig, validateSvgMarkup };
|
|
2489
2442
|
//# sourceMappingURL=index.js.map
|
|
2490
2443
|
//# sourceMappingURL=index.js.map
|