@semiont/core 0.5.28 → 0.5.29

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.js CHANGED
@@ -1,6 +1,6 @@
1
- export { createTomlConfigLoader, loadTomlConfig } from './chunk-JWTQJVKM.js';
2
- import { BUS_OPERATIONS } from './chunk-CUPZGI7I.js';
3
- export { BRIDGED_CHANNELS, BUS_OPERATIONS, EventBus, ScopedEventBus, accessToken, annotationUri, authCode, baseUrl, busLog, busLogEnabled, cloneToken, email, entityType, googleCredential, jobId, mcpToken, refreshToken, resourceAnnotationUri, resourceUri, searchQuery, setBusLogTraceIdProvider, userDID } from './chunk-CUPZGI7I.js';
1
+ export { createTomlConfigLoader, loadTomlConfig } from './chunk-VBMXNYPL.js';
2
+ import { BUS_OPERATIONS } from './chunk-MM4HBHMM.js';
3
+ export { BRIDGED_CHANNELS, BUS_OPERATIONS, EventBus, ScopedEventBus, accessToken, annotationUri, authCode, baseUrl, busLog, busLogEnabled, cloneToken, email, entityType, googleCredential, jobId, mcpToken, refreshToken, resourceAnnotationUri, resourceUri, searchQuery, setBusLogTraceIdProvider, userDID } from './chunk-MM4HBHMM.js';
4
4
  import './chunk-YLJ4XMA6.js';
5
5
  import { Observable, merge, TimeoutError, throwError, firstValueFrom } from 'rxjs';
6
6
  import { filter, map, take, timeout, catchError, defaultIfEmpty } from 'rxjs/operators';
@@ -71,6 +71,7 @@ var CHANNEL_SCHEMAS = {
71
71
  "yield:representation-added": null,
72
72
  "yield:representation-removed": null,
73
73
  "yield:create": "YieldCreateCommand",
74
+ "yield:clone-persist": "YieldClonePersistCommand",
74
75
  "yield:update": "YieldUpdateCommand",
75
76
  "yield:mv": "YieldMvCommand",
76
77
  "yield:clone": null,
@@ -80,6 +81,9 @@ var CHANNEL_SCHEMAS = {
80
81
  "yield:clone-create": "YieldCloneCreateCommand",
81
82
  "yield:create-ok": "YieldCreateOk",
82
83
  "yield:create-failed": "CommandError",
84
+ "yield:clone-persist-ok": "YieldClonePersistOk",
85
+ "yield:clone-persist-failed": null,
86
+ // { correlationId } & CommandError
83
87
  "yield:update-ok": "YieldUpdateOk",
84
88
  "yield:update-failed": null,
85
89
  // { correlationId } & CommandError
@@ -183,6 +187,10 @@ var CHANNEL_SCHEMAS = {
183
187
  "browse:anchored-text-result": "BrowseAnchoredTextResult",
184
188
  "browse:anchored-text-failed": null,
185
189
  // { correlationId } & CommandError
190
+ "browse:anchored-text-by-checksum-requested": "BrowseAnchoredTextByChecksumRequest",
191
+ "browse:anchored-text-by-checksum-result": "BrowseAnchoredTextResult",
192
+ "browse:anchored-text-by-checksum-failed": null,
193
+ // { correlationId } & CommandError
186
194
  "browse:resources-requested": "BrowseResourcesRequest",
187
195
  "browse:resources-result": "BrowseResourcesResult",
188
196
  "browse:resources-failed": null,
@@ -265,7 +273,7 @@ var CHANNEL_SCHEMAS = {
265
273
  "job:claim-failed": null,
266
274
  "job:cancel-ok": null,
267
275
  "job:cancel-failed": "CommandError",
268
- // ── SETTINGS (frontend-only) ────────────────────────────────────
276
+ // ── SETTINGS (Browser-only) ────────────────────────────────────
269
277
  "settings:theme-changed": "SettingsThemeChangedEvent",
270
278
  "settings:line-numbers-toggled": null,
271
279
  // void
@@ -1817,6 +1825,10 @@ function isSupportedMediaType(format) {
1817
1825
  function capabilitiesOf(format) {
1818
1826
  return REGISTRY[baseMediaType(format)];
1819
1827
  }
1828
+ function cloneFormat(sourceMediaType) {
1829
+ const base = baseMediaType(sourceMediaType ?? "text/plain");
1830
+ return isSupportedMediaType(base) && capabilitiesOf(base)?.authorable ? base : "text/plain";
1831
+ }
1820
1832
  function extensionForMediaType(format) {
1821
1833
  return capabilitiesOf(format)?.extension ?? ".dat";
1822
1834
  }
@@ -1844,6 +1856,10 @@ function textExtractionOf(format) {
1844
1856
  if (caps) return caps.extractText;
1845
1857
  return baseMediaType(format).startsWith("text/") ? "decode" : "none";
1846
1858
  }
1859
+ function isAnnotatable(format) {
1860
+ const caps = capabilitiesOf(format);
1861
+ return caps !== void 0 && caps.anchoring !== "none";
1862
+ }
1847
1863
  var REGISTRY_KEYS = Object.keys(MEDIA_TYPES);
1848
1864
  var AUTHORABLE_MEDIA_TYPES = REGISTRY_KEYS.filter(
1849
1865
  (type) => MEDIA_TYPES[type].authorable
@@ -1899,6 +1915,25 @@ function chunkText(text, config = DEFAULT_CHUNKING_CONFIG) {
1899
1915
  return chunks.filter((c) => c.length > 0);
1900
1916
  }
1901
1917
 
1918
+ // src/storage-uri.ts
1919
+ function storageFileName(name, format) {
1920
+ const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
1921
+ return `${slug}${MEDIA_TYPES[format].extension}`;
1922
+ }
1923
+ function deriveStorageUri(name, format) {
1924
+ return `file://${storageFileName(name, format)}`;
1925
+ }
1926
+ function folderOf(storageUri) {
1927
+ const path = (storageUri ?? "").replace(/^file:\/\//, "");
1928
+ const cut = path.lastIndexOf("/");
1929
+ return cut === -1 ? "" : path.slice(0, cut);
1930
+ }
1931
+ function proposeStoragePath(folder, title, format) {
1932
+ const name = storageFileName(title, format);
1933
+ if (name === MEDIA_TYPES[format].extension) return "";
1934
+ return folder ? `${folder}/${name}` : name;
1935
+ }
1936
+
1902
1937
  // src/type-guards.ts
1903
1938
  function isString(value) {
1904
1939
  return typeof value === "string";
@@ -1932,7 +1967,7 @@ function isDefined(value) {
1932
1967
  }
1933
1968
  function isGenerationJobParams(value) {
1934
1969
  if (!isObject(value)) return false;
1935
- return typeof value.title === "string" && typeof value.storageUri === "string" && isObject(value.context);
1970
+ return typeof value.title === "string" && value.title.length > 0 && typeof value.storageUri === "string" && value.storageUri.length > 0 && isObject(value.context);
1936
1971
  }
1937
1972
  function isGatheredContext(value) {
1938
1973
  if (!isObject(value)) return false;
@@ -2160,6 +2195,6 @@ function getShardPath(key, numBuckets = 65536) {
2160
2195
  // src/discovery.ts
2161
2196
  var DISCOVERY_URL_PATH = "/discovery/kbs.json";
2162
2197
 
2163
- export { AUTHORABLE_MEDIA_TYPES, BusRequestError, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, ConfigurationError, ConflictError, DEFAULT_CHUNKING_CONFIG, DISCOVERY_URL_PATH, EMBEDDABLE_MEDIA_TYPES, GENERATABLE_MEDIA_TYPES, JWTTokenSchema, LOCALES, MEDIA_TYPES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, STARTUP_FETCH_RETRY, ScriptError, SemiontError, UnauthorizedError, ValidationError, agentToDid, anchorAnnotation, anchorRuns, annotationId, applyBodyOperations, assembleAnnotation, baseMediaType, buildContentCache, burstBuffer, busRequest, capabilitiesOf, chunkText, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, decodeRepresentation, decodeWithCharset, deriveViews, didToAgent, errField, estimateTokens, extensionForMediaType, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, findClaimSpan, formatLocaleDisplay, generateUuid, getAllLocaleCodes, getAllPlatformTypes, getAnnotationExactText, getAnnotationUriFromEvent, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getNodeEncoding, getPageFromFragment, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getShardPath, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, hasTargetSelector, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isGatheredContext, isGenerationJobParams, isHighlight, isNull, isNullish, isNumber, isObject, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isSupportedMediaType, isTag, isTextRun, isTransientFetchError, isUndefined, isValidEmail, isValidPlatformType, jumpConsistentHash, kbDid, locate, mediaTypeForExtension, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, reconcileSelector, resourceId, retryWithBackoff, scaleSvgToNative, serializePerKey, softwareToAgent, textExtractionOf, textUnder, userId, userToAgent, userToDid, uuidV4, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
2198
+ export { AUTHORABLE_MEDIA_TYPES, BusRequestError, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, ConfigurationError, ConflictError, DEFAULT_CHUNKING_CONFIG, DISCOVERY_URL_PATH, EMBEDDABLE_MEDIA_TYPES, GENERATABLE_MEDIA_TYPES, JWTTokenSchema, LOCALES, MEDIA_TYPES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, STARTUP_FETCH_RETRY, ScriptError, SemiontError, UnauthorizedError, ValidationError, agentToDid, anchorAnnotation, anchorRuns, annotationId, applyBodyOperations, assembleAnnotation, baseMediaType, buildContentCache, burstBuffer, busRequest, capabilitiesOf, chunkText, cloneFormat, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, decodeRepresentation, decodeWithCharset, deriveStorageUri, deriveViews, didToAgent, errField, estimateTokens, extensionForMediaType, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, findClaimSpan, folderOf, formatLocaleDisplay, generateUuid, getAllLocaleCodes, getAllPlatformTypes, getAnnotationExactText, getAnnotationUriFromEvent, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getNodeEncoding, getPageFromFragment, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getShardPath, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, hasTargetSelector, isAnnotatable, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isGatheredContext, isGenerationJobParams, isHighlight, isNull, isNullish, isNumber, isObject, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isSupportedMediaType, isTag, isTextRun, isTransientFetchError, isUndefined, isValidEmail, isValidPlatformType, jumpConsistentHash, kbDid, locate, mediaTypeForExtension, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, proposeStoragePath, reconcileSelector, resourceId, retryWithBackoff, scaleSvgToNative, serializePerKey, softwareToAgent, storageFileName, textExtractionOf, textUnder, userId, userToAgent, userToDid, uuidV4, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
2164
2199
  //# sourceMappingURL=index.js.map
2165
2200
  //# sourceMappingURL=index.js.map