@semiont/core 0.5.6 → 0.5.8
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/README.md +120 -140
- package/dist/config/node-config-loader.d.ts +1 -5
- package/dist/config/node-config-loader.js +0 -4
- package/dist/config/node-config-loader.js.map +1 -1
- package/dist/index.d.ts +297 -90
- package/dist/index.js +137 -34
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1663,35 +1663,142 @@ function isValidEmail(email2) {
|
|
|
1663
1663
|
return emailRegex.test(email2);
|
|
1664
1664
|
}
|
|
1665
1665
|
|
|
1666
|
-
// src/
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
}
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1666
|
+
// src/media-types.ts
|
|
1667
|
+
var storedBinary = (extension, label) => ({
|
|
1668
|
+
extension,
|
|
1669
|
+
label,
|
|
1670
|
+
render: "none",
|
|
1671
|
+
anchoring: "none",
|
|
1672
|
+
extractText: "none",
|
|
1673
|
+
authorable: false,
|
|
1674
|
+
uploadable: true
|
|
1675
|
+
});
|
|
1676
|
+
var storedText = (extension, label) => ({
|
|
1677
|
+
...storedBinary(extension, label),
|
|
1678
|
+
extractText: "decode"
|
|
1679
|
+
});
|
|
1680
|
+
var MEDIA_TYPES = {
|
|
1681
|
+
// Full-capability tier
|
|
1682
|
+
"text/markdown": { extension: ".md", label: "Markdown", render: "text", anchoring: "text-selector", extractText: "decode", authorable: true, uploadable: true },
|
|
1683
|
+
"text/plain": { extension: ".txt", label: "Plain Text", render: "text", anchoring: "text-selector", extractText: "decode", authorable: true, uploadable: true },
|
|
1684
|
+
"text/html": { extension: ".html", label: "HTML", render: "text", anchoring: "text-selector", extractText: "decode", authorable: true, uploadable: true },
|
|
1685
|
+
"application/json": { extension: ".json", label: "JSON", render: "text", anchoring: "text-selector", extractText: "decode", authorable: false, uploadable: true },
|
|
1686
|
+
"image/png": { extension: ".png", label: "PNG image", render: "image", anchoring: "spatial", extractText: "none", authorable: false, uploadable: true },
|
|
1687
|
+
"image/jpeg": { extension: ".jpg", label: "JPEG image", render: "image", anchoring: "spatial", extractText: "none", authorable: false, uploadable: true },
|
|
1688
|
+
"application/pdf": { extension: ".pdf", label: "PDF", render: "pdf", anchoring: "spatial", extractText: "pdf-text-layer", authorable: false, uploadable: true },
|
|
1689
|
+
// Storage tier — the big tent. Every row is a deliberate admission,
|
|
1690
|
+
// promotable by editing its row. Text-flavored rows embed (decode).
|
|
1691
|
+
// Text
|
|
1692
|
+
"text/css": storedText(".css", "CSS"),
|
|
1693
|
+
"text/csv": storedText(".csv", "CSV"),
|
|
1694
|
+
"text/xml": storedText(".xml", "XML"),
|
|
1695
|
+
// Structured-text application formats
|
|
1696
|
+
"application/xml": storedText(".xml", "XML"),
|
|
1697
|
+
"application/yaml": storedText(".yaml", "YAML"),
|
|
1698
|
+
"application/x-yaml": storedText(".yaml", "YAML"),
|
|
1699
|
+
// Programming languages
|
|
1700
|
+
"text/javascript": storedText(".js", "JavaScript"),
|
|
1701
|
+
"application/javascript": storedText(".js", "JavaScript"),
|
|
1702
|
+
"text/x-typescript": storedText(".ts", "TypeScript"),
|
|
1703
|
+
"application/typescript": storedText(".ts", "TypeScript"),
|
|
1704
|
+
"text/x-python": storedText(".py", "Python source"),
|
|
1705
|
+
"text/x-java": storedText(".java", "Java source"),
|
|
1706
|
+
"text/x-c": storedText(".c", "C source"),
|
|
1707
|
+
"text/x-c++": storedText(".cpp", "C++ source"),
|
|
1708
|
+
"text/x-csharp": storedText(".cs", "C# source"),
|
|
1709
|
+
"text/x-go": storedText(".go", "Go source"),
|
|
1710
|
+
"text/x-rust": storedText(".rs", "Rust source"),
|
|
1711
|
+
"text/x-ruby": storedText(".rb", "Ruby source"),
|
|
1712
|
+
"text/x-php": storedText(".php", "PHP source"),
|
|
1713
|
+
"text/x-swift": storedText(".swift", "Swift source"),
|
|
1714
|
+
"text/x-kotlin": storedText(".kt", "Kotlin source"),
|
|
1715
|
+
"text/x-shell": storedText(".sh", "Shell script"),
|
|
1716
|
+
// Documents
|
|
1717
|
+
"application/msword": storedBinary(".doc", "Word document (legacy)"),
|
|
1718
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": storedBinary(".docx", "Word document"),
|
|
1719
|
+
"application/vnd.ms-excel": storedBinary(".xls", "Excel spreadsheet (legacy)"),
|
|
1720
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": storedBinary(".xlsx", "Excel spreadsheet"),
|
|
1721
|
+
"application/vnd.ms-powerpoint": storedBinary(".ppt", "PowerPoint presentation (legacy)"),
|
|
1722
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": storedBinary(".pptx", "PowerPoint presentation"),
|
|
1723
|
+
// Archives
|
|
1724
|
+
"application/zip": storedBinary(".zip", "ZIP archive"),
|
|
1725
|
+
"application/gzip": storedBinary(".gz", "Gzip archive"),
|
|
1726
|
+
"application/x-tar": storedBinary(".tar", "TAR archive"),
|
|
1727
|
+
"application/x-7z-compressed": storedBinary(".7z", "7z archive"),
|
|
1728
|
+
// Binaries
|
|
1729
|
+
"application/octet-stream": storedBinary(".bin", "Binary"),
|
|
1730
|
+
"application/wasm": storedBinary(".wasm", "WebAssembly module"),
|
|
1731
|
+
// Images beyond the rendered pair
|
|
1732
|
+
"image/gif": storedBinary(".gif", "GIF image"),
|
|
1733
|
+
"image/webp": storedBinary(".webp", "WebP image"),
|
|
1734
|
+
"image/svg+xml": storedBinary(".svg", "SVG image"),
|
|
1735
|
+
"image/bmp": storedBinary(".bmp", "BMP image"),
|
|
1736
|
+
"image/tiff": storedBinary(".tiff", "TIFF image"),
|
|
1737
|
+
"image/x-icon": storedBinary(".ico", "Icon"),
|
|
1738
|
+
// Video (before audio so .webm resolves to video)
|
|
1739
|
+
"video/mp4": storedBinary(".mp4", "MP4 video"),
|
|
1740
|
+
"video/mpeg": storedBinary(".mpeg", "MPEG video"),
|
|
1741
|
+
"video/webm": storedBinary(".webm", "WebM video"),
|
|
1742
|
+
"video/ogg": storedBinary(".ogv", "Ogg video"),
|
|
1743
|
+
"video/quicktime": storedBinary(".mov", "QuickTime video"),
|
|
1744
|
+
"video/x-msvideo": storedBinary(".avi", "AVI video"),
|
|
1745
|
+
// Audio
|
|
1746
|
+
"audio/mpeg": storedBinary(".mp3", "MP3 audio"),
|
|
1747
|
+
"audio/wav": storedBinary(".wav", "WAV audio"),
|
|
1748
|
+
"audio/ogg": storedBinary(".ogg", "Ogg audio"),
|
|
1749
|
+
"audio/webm": storedBinary(".webm", "WebM audio"),
|
|
1750
|
+
"audio/aac": storedBinary(".aac", "AAC audio"),
|
|
1751
|
+
"audio/flac": storedBinary(".flac", "FLAC audio"),
|
|
1752
|
+
// Fonts
|
|
1753
|
+
"font/woff": storedBinary(".woff", "WOFF font"),
|
|
1754
|
+
"font/woff2": storedBinary(".woff2", "WOFF2 font"),
|
|
1755
|
+
"font/ttf": storedBinary(".ttf", "TrueType font"),
|
|
1756
|
+
"font/otf": storedBinary(".otf", "OpenType font")
|
|
1757
|
+
};
|
|
1758
|
+
var REGISTRY = MEDIA_TYPES;
|
|
1759
|
+
function baseMediaType(format) {
|
|
1760
|
+
return format.split(";")[0].trim().toLowerCase();
|
|
1761
|
+
}
|
|
1762
|
+
function isSupportedMediaType(format) {
|
|
1763
|
+
return Object.hasOwn(MEDIA_TYPES, format);
|
|
1764
|
+
}
|
|
1765
|
+
function capabilitiesOf(format) {
|
|
1766
|
+
return REGISTRY[baseMediaType(format)];
|
|
1767
|
+
}
|
|
1768
|
+
function extensionForMediaType(format) {
|
|
1769
|
+
return capabilitiesOf(format)?.extension ?? ".dat";
|
|
1770
|
+
}
|
|
1771
|
+
var EXTENSION_TO_MEDIA_TYPE = (() => {
|
|
1772
|
+
const map = /* @__PURE__ */ new Map();
|
|
1773
|
+
for (const type of Object.keys(MEDIA_TYPES)) {
|
|
1774
|
+
const ext = MEDIA_TYPES[type].extension;
|
|
1775
|
+
if (!map.has(ext)) map.set(ext, type);
|
|
1776
|
+
}
|
|
1777
|
+
return map;
|
|
1778
|
+
})();
|
|
1779
|
+
var EXTENSION_ALIASES = {
|
|
1780
|
+
".markdown": ".md",
|
|
1781
|
+
".htm": ".html",
|
|
1782
|
+
".jpeg": ".jpg",
|
|
1783
|
+
".yml": ".yaml"
|
|
1784
|
+
};
|
|
1785
|
+
function mediaTypeForExtension(ext) {
|
|
1786
|
+
const lower = ext.trim().toLowerCase();
|
|
1787
|
+
const dotted = lower.startsWith(".") ? lower : `.${lower}`;
|
|
1788
|
+
return EXTENSION_TO_MEDIA_TYPE.get(EXTENSION_ALIASES[dotted] ?? dotted);
|
|
1789
|
+
}
|
|
1790
|
+
function textExtractionOf(format) {
|
|
1791
|
+
const caps = capabilitiesOf(format);
|
|
1792
|
+
if (caps) return caps.extractText;
|
|
1793
|
+
return baseMediaType(format).startsWith("text/") ? "decode" : "none";
|
|
1794
|
+
}
|
|
1795
|
+
var REGISTRY_KEYS = Object.keys(MEDIA_TYPES);
|
|
1796
|
+
var AUTHORABLE_MEDIA_TYPES = REGISTRY_KEYS.filter(
|
|
1797
|
+
(type) => MEDIA_TYPES[type].authorable
|
|
1798
|
+
);
|
|
1799
|
+
var EMBEDDABLE_MEDIA_TYPES = REGISTRY_KEYS.filter(
|
|
1800
|
+
(type) => MEDIA_TYPES[type].extractText !== "none"
|
|
1801
|
+
);
|
|
1695
1802
|
|
|
1696
1803
|
// src/type-guards.ts
|
|
1697
1804
|
function isString(value) {
|
|
@@ -2164,10 +2271,6 @@ function getAllPlatformTypes() {
|
|
|
2164
2271
|
return ["aws", "container", "posix", "external"];
|
|
2165
2272
|
}
|
|
2166
2273
|
|
|
2167
|
-
|
|
2168
|
-
var CORE_TYPES_VERSION = "0.1.0";
|
|
2169
|
-
var SDK_VERSION = "0.1.0";
|
|
2170
|
-
|
|
2171
|
-
export { BRIDGED_CHANNELS, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, CORE_TYPES_VERSION, ConfigurationError, ConflictError, EventBus, JWTTokenSchema, LOCALES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, SDK_VERSION, ScopedEventBus, ScriptError, SemiontError, UnauthorizedError, ValidationError, accessToken, agentToDid, anchorAnnotation, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseUrl, buildContentCache, burstBuffer, busLog, busLogEnabled, cloneToken, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, createTomlConfigLoader, decodeRepresentation, decodeWithCharset, didToAgent, email, entityType, errField, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, formatLocaleDisplay, generateUuid, getAllLocaleCodes, getAllPlatformTypes, getAnnotationExactText, getAnnotationUriFromEvent, getBodySource, getBodyType, getChecksum, getCommentText, getCreator, getDerivedFrom, getExactText, getExtensionForMimeType, getFragmentSelector, getLanguage, getLocaleEnglishName, getLocaleInfo, getLocaleNativeName, getMimeCategory, getNodeEncoding, getPageFromFragment, getPrimaryMediaType, getPrimaryRepresentation, getPrimarySelector, getResourceEntityTypes, getResourceId, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, googleCredential, hasTargetSelector, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isHighlight, isImageMimeType, isNull, isNullish, isNumber, isObject, isPdfMimeType, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isTag, isTextMimeType, isUndefined, isValidEmail, isValidPlatformType, jobId, loadTomlConfig, mcpToken, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, reconcileSelector, refreshToken, resourceAnnotationUri, resourceId, resourceUri, scaleSvgToNative, searchQuery, serializePerKey, setBusLogTraceIdProvider, softwareToAgent, userDID, userId, userToAgent, userToDid, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
|
|
2274
|
+
export { AUTHORABLE_MEDIA_TYPES, BRIDGED_CHANNELS, CHANNEL_SCHEMAS, CONTEXT_FULL_WEIGHT, CONTEXT_PARTIAL_WEIGHT, ConfigurationError, ConflictError, EMBEDDABLE_MEDIA_TYPES, EventBus, JWTTokenSchema, LOCALES, MEDIA_TYPES, NotFoundError, PERSISTED_EVENT_TYPES, POSITION_WEIGHT_MAX, POSITION_WINDOW, RESOURCE_BROADCAST_TYPES, ScopedEventBus, ScriptError, SemiontError, UnauthorizedError, ValidationError, accessToken, agentToDid, anchorAnnotation, annotationId, annotationUri, applyBodyOperations, assembleAnnotation, authCode, baseMediaType, baseUrl, buildContentCache, burstBuffer, busLog, busLogEnabled, capabilitiesOf, cloneToken, createCircleSvg, createFragmentSelector, createPolygonSvg, createRectangleSvg, createTomlConfigLoader, decodeRepresentation, decodeWithCharset, didToAgent, email, entityType, errField, extensionForMediaType, extractBoundingBox, extractCharset, extractContext, findBestTextMatch, findBodyItem, 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, getStorageUri, getSvgSelector, getTargetSelector, getTargetSource, getTextPositionSelector, getTextQuoteSelector, googleCredential, hasTargetSelector, isAnnotationId, isArchived, isArray, isAssessment, isBodyResolved, isBoolean, isComment, isDefined, isDraft, isEventRelatedToAnnotation, isFunction, isHighlight, isNull, isNullish, isNumber, isObject, isReference, isResolvedReference, isResourceId, isStoredEvent, isString, isStubReference, isSupportedMediaType, isTag, isUndefined, isValidEmail, isValidPlatformType, jobId, loadTomlConfig, mcpToken, mediaTypeForExtension, normalizeCoordinates, normalizeText, parseEnvironment, parseFragmentSelector, parseSvgSelector, reconcileSelector, refreshToken, resourceAnnotationUri, resourceId, resourceUri, scaleSvgToNative, searchQuery, serializePerKey, setBusLogTraceIdProvider, softwareToAgent, textExtractionOf, userDID, userId, userToAgent, userToDid, validateData, validateEnvironment, validateSvgMarkup, verifyPosition };
|
|
2172
2275
|
//# sourceMappingURL=index.js.map
|
|
2173
2276
|
//# sourceMappingURL=index.js.map
|