@digitalculture/ochre-sdk 0.4.6 → 0.4.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/dist/index.cjs +10 -31
- package/dist/index.d.cts +2 -28
- package/dist/index.d.ts +2 -28
- package/dist/index.js +9 -28
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -71,9 +71,7 @@ __export(index_exports, {
|
|
|
71
71
|
parseStringDocumentItem: () => parseStringDocumentItem,
|
|
72
72
|
parseStringItem: () => parseStringItem,
|
|
73
73
|
parseTree: () => parseTree,
|
|
74
|
-
parseWebsite: () => parseWebsite
|
|
75
|
-
trimEndLineBreaks: () => trimEndLineBreaks,
|
|
76
|
-
trimStartLineBreaks: () => trimStartLineBreaks
|
|
74
|
+
parseWebsite: () => parseWebsite
|
|
77
75
|
});
|
|
78
76
|
module.exports = __toCommonJS(index_exports);
|
|
79
77
|
|
|
@@ -259,7 +257,7 @@ function parseStringItem(item) {
|
|
|
259
257
|
break;
|
|
260
258
|
}
|
|
261
259
|
}
|
|
262
|
-
return
|
|
260
|
+
return returnString;
|
|
263
261
|
}
|
|
264
262
|
function parseStringDocumentItem(item, footnotes) {
|
|
265
263
|
if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
|
|
@@ -382,23 +380,7 @@ function parseStringDocumentItem(item, footnotes) {
|
|
|
382
380
|
);
|
|
383
381
|
}
|
|
384
382
|
}
|
|
385
|
-
return
|
|
386
|
-
}
|
|
387
|
-
function trimEndLineBreaks(string) {
|
|
388
|
-
const trimmedString = string.replaceAll(/^\n<br \/>|\n<br \/>$/g, "");
|
|
389
|
-
const finalLineBreaks = /\n<br \/>$/.exec(trimmedString);
|
|
390
|
-
if (finalLineBreaks) {
|
|
391
|
-
return trimEndLineBreaks(trimmedString);
|
|
392
|
-
}
|
|
393
|
-
return trimmedString;
|
|
394
|
-
}
|
|
395
|
-
function trimStartLineBreaks(string) {
|
|
396
|
-
const trimmedString = string.replaceAll(/^<br \/>\n|<br \/>\n$/g, "");
|
|
397
|
-
const leadingLineBreaks = /^<br \/>\n/.exec(trimmedString);
|
|
398
|
-
if (leadingLineBreaks) {
|
|
399
|
-
return trimStartLineBreaks(trimmedString);
|
|
400
|
-
}
|
|
401
|
-
return trimmedString;
|
|
383
|
+
return returnString;
|
|
402
384
|
}
|
|
403
385
|
function parseStringContent(content, language = "eng") {
|
|
404
386
|
switch (typeof content.content) {
|
|
@@ -801,7 +783,6 @@ function parseDocument(document, language = "eng") {
|
|
|
801
783
|
returnString += parseStringDocumentItem(item, footnotes);
|
|
802
784
|
}
|
|
803
785
|
}
|
|
804
|
-
returnString = trimEndLineBreaks(returnString);
|
|
805
786
|
return { content: returnString, footnotes };
|
|
806
787
|
}
|
|
807
788
|
function parseImage(image) {
|
|
@@ -1970,9 +1951,9 @@ async function parseWebpage(webpageResource) {
|
|
|
1970
1951
|
blocks: [],
|
|
1971
1952
|
elements,
|
|
1972
1953
|
properties: {
|
|
1973
|
-
spacing:
|
|
1954
|
+
spacing: null,
|
|
1974
1955
|
gap: "none",
|
|
1975
|
-
alignItems: "
|
|
1956
|
+
alignItems: "start",
|
|
1976
1957
|
justifyContent: "stretch"
|
|
1977
1958
|
},
|
|
1978
1959
|
cssStyles: []
|
|
@@ -1992,9 +1973,9 @@ async function parseWebpage(webpageResource) {
|
|
|
1992
1973
|
blocks: [],
|
|
1993
1974
|
elements,
|
|
1994
1975
|
properties: {
|
|
1995
|
-
spacing:
|
|
1976
|
+
spacing: null,
|
|
1996
1977
|
gap: "none",
|
|
1997
|
-
alignItems: "
|
|
1978
|
+
alignItems: "start",
|
|
1998
1979
|
justifyContent: "stretch"
|
|
1999
1980
|
},
|
|
2000
1981
|
cssStyles: []
|
|
@@ -2083,9 +2064,9 @@ async function parseBlock(blockResource) {
|
|
|
2083
2064
|
blocks: [],
|
|
2084
2065
|
elements: [],
|
|
2085
2066
|
properties: {
|
|
2086
|
-
spacing:
|
|
2067
|
+
spacing: null,
|
|
2087
2068
|
gap: "none",
|
|
2088
|
-
alignItems: "
|
|
2069
|
+
alignItems: "start",
|
|
2089
2070
|
justifyContent: "stretch"
|
|
2090
2071
|
},
|
|
2091
2072
|
cssStyles: []
|
|
@@ -2700,7 +2681,5 @@ async function fetchWebsite(abbreviation) {
|
|
|
2700
2681
|
parseStringDocumentItem,
|
|
2701
2682
|
parseStringItem,
|
|
2702
2683
|
parseTree,
|
|
2703
|
-
parseWebsite
|
|
2704
|
-
trimEndLineBreaks,
|
|
2705
|
-
trimStartLineBreaks
|
|
2684
|
+
parseWebsite
|
|
2706
2685
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -590,7 +590,7 @@ type Block = {
|
|
|
590
590
|
/**
|
|
591
591
|
* valid `gridTemplateColumns` or `gridTemplateRows` CSS property value
|
|
592
592
|
*/
|
|
593
|
-
spacing: string;
|
|
593
|
+
spacing: string | null;
|
|
594
594
|
/**
|
|
595
595
|
* `gap` CSS property value
|
|
596
596
|
*/
|
|
@@ -1827,32 +1827,6 @@ declare function parseStringItem(item: OchreStringItem): string;
|
|
|
1827
1827
|
* @returns Formatted string with HTML/markdown elements
|
|
1828
1828
|
*/
|
|
1829
1829
|
declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnotes?: Array<Footnote>): string;
|
|
1830
|
-
/**
|
|
1831
|
-
* Removes trailing line breaks from a string
|
|
1832
|
-
*
|
|
1833
|
-
* @param string - Input string to trim
|
|
1834
|
-
* @returns String with trailing line breaks removed
|
|
1835
|
-
*
|
|
1836
|
-
* @example
|
|
1837
|
-
* ```ts
|
|
1838
|
-
* const trimmed = trimEndLineBreaks("Hello\n<br />\n<br />");
|
|
1839
|
-
* // Returns: "Hello"
|
|
1840
|
-
* ```
|
|
1841
|
-
*/
|
|
1842
|
-
declare function trimEndLineBreaks(string: string): string;
|
|
1843
|
-
/**
|
|
1844
|
-
* Removes leading line breaks from a string
|
|
1845
|
-
*
|
|
1846
|
-
* @param string - Input string to trim
|
|
1847
|
-
* @returns String with leading line breaks removed
|
|
1848
|
-
*
|
|
1849
|
-
* @example
|
|
1850
|
-
* ```ts
|
|
1851
|
-
* const trimmed = trimStartLineBreaks("<br />\n<br />\nHello");
|
|
1852
|
-
* // Returns: "Hello"
|
|
1853
|
-
* ```
|
|
1854
|
-
*/
|
|
1855
|
-
declare function trimStartLineBreaks(string: string): string;
|
|
1856
1830
|
/**
|
|
1857
1831
|
* Parses raw string content into a formatted string
|
|
1858
1832
|
*
|
|
@@ -1862,4 +1836,4 @@ declare function trimStartLineBreaks(string: string): string;
|
|
|
1862
1836
|
*/
|
|
1863
1837
|
declare function parseStringContent(content: OchreStringContent, language?: string): string;
|
|
1864
1838
|
|
|
1865
|
-
export { type Bibliography, type Block, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type Document, type Event, type Footnote, type Gallery, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type License, type Link, type Metadata, type NestedConcept, type NestedResource, type NestedSpatialUnit, type Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchBibliography, fetchByUuid, fetchConcept, fetchGallery, fetchPeriod, fetchResource, fetchSet, fetchSpatialUnit, fetchTree, fetchWebsite, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmailAndUrl, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePerson, parsePersons, parseProperties, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite
|
|
1839
|
+
export { type Bibliography, type Block, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type Document, type Event, type Footnote, type Gallery, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type License, type Link, type Metadata, type NestedConcept, type NestedResource, type NestedSpatialUnit, type Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchBibliography, fetchByUuid, fetchConcept, fetchGallery, fetchPeriod, fetchResource, fetchSet, fetchSpatialUnit, fetchTree, fetchWebsite, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmailAndUrl, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePerson, parsePersons, parseProperties, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite };
|
package/dist/index.d.ts
CHANGED
|
@@ -590,7 +590,7 @@ type Block = {
|
|
|
590
590
|
/**
|
|
591
591
|
* valid `gridTemplateColumns` or `gridTemplateRows` CSS property value
|
|
592
592
|
*/
|
|
593
|
-
spacing: string;
|
|
593
|
+
spacing: string | null;
|
|
594
594
|
/**
|
|
595
595
|
* `gap` CSS property value
|
|
596
596
|
*/
|
|
@@ -1827,32 +1827,6 @@ declare function parseStringItem(item: OchreStringItem): string;
|
|
|
1827
1827
|
* @returns Formatted string with HTML/markdown elements
|
|
1828
1828
|
*/
|
|
1829
1829
|
declare function parseStringDocumentItem(item: OchreStringRichTextItem, footnotes?: Array<Footnote>): string;
|
|
1830
|
-
/**
|
|
1831
|
-
* Removes trailing line breaks from a string
|
|
1832
|
-
*
|
|
1833
|
-
* @param string - Input string to trim
|
|
1834
|
-
* @returns String with trailing line breaks removed
|
|
1835
|
-
*
|
|
1836
|
-
* @example
|
|
1837
|
-
* ```ts
|
|
1838
|
-
* const trimmed = trimEndLineBreaks("Hello\n<br />\n<br />");
|
|
1839
|
-
* // Returns: "Hello"
|
|
1840
|
-
* ```
|
|
1841
|
-
*/
|
|
1842
|
-
declare function trimEndLineBreaks(string: string): string;
|
|
1843
|
-
/**
|
|
1844
|
-
* Removes leading line breaks from a string
|
|
1845
|
-
*
|
|
1846
|
-
* @param string - Input string to trim
|
|
1847
|
-
* @returns String with leading line breaks removed
|
|
1848
|
-
*
|
|
1849
|
-
* @example
|
|
1850
|
-
* ```ts
|
|
1851
|
-
* const trimmed = trimStartLineBreaks("<br />\n<br />\nHello");
|
|
1852
|
-
* // Returns: "Hello"
|
|
1853
|
-
* ```
|
|
1854
|
-
*/
|
|
1855
|
-
declare function trimStartLineBreaks(string: string): string;
|
|
1856
1830
|
/**
|
|
1857
1831
|
* Parses raw string content into a formatted string
|
|
1858
1832
|
*
|
|
@@ -1862,4 +1836,4 @@ declare function trimStartLineBreaks(string: string): string;
|
|
|
1862
1836
|
*/
|
|
1863
1837
|
declare function parseStringContent(content: OchreStringContent, language?: string): string;
|
|
1864
1838
|
|
|
1865
|
-
export { type Bibliography, type Block, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type Document, type Event, type Footnote, type Gallery, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type License, type Link, type Metadata, type NestedConcept, type NestedResource, type NestedSpatialUnit, type Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchBibliography, fetchByUuid, fetchConcept, fetchGallery, fetchPeriod, fetchResource, fetchSet, fetchSpatialUnit, fetchTree, fetchWebsite, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmailAndUrl, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePerson, parsePersons, parseProperties, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite
|
|
1839
|
+
export { type Bibliography, type Block, type Concept, type Context, type ContextItem, type ContextNode, type Coordinates, type Data, type Document, type Event, type Footnote, type Gallery, type Identification, type Image, type ImageMap, type ImageMapArea, type Interpretation, type License, type Link, type Metadata, type NestedConcept, type NestedResource, type NestedSpatialUnit, type Note, type Observation, type Period, type Person, type Property, type PropertyValue, type PropertyValueType, type Resource, type Set, type SpatialUnit, type Style, type Tree, type WebElement, type WebElementComponent, type WebImage, type Webpage, type WebpageProperties, type Website, type WebsiteProperties, fetchBibliography, fetchByUuid, fetchConcept, fetchGallery, fetchPeriod, fetchResource, fetchSet, fetchSpatialUnit, fetchTree, fetchWebsite, filterProperties, getAllPropertyLabels, getPropertyByLabel, getPropertyValueByLabel, getPropertyValuesByLabel, parseBibliographies, parseBibliography, parseConcept, parseConcepts, parseContext, parseCoordinates, parseDocument, parseEmailAndUrl, parseEvents, parseFakeString, parseIdentification, parseImage, parseImageMap, parseInterpretations, parseLanguages, parseLicense, parseLink, parseLinks, parseMetadata, parseNotes, parseObservation, parseObservations, parsePeriod, parsePeriods, parsePerson, parsePersons, parseProperties, parseResource, parseResources, parseSet, parseSpatialUnit, parseSpatialUnits, parseStringContent, parseStringDocumentItem, parseStringItem, parseTree, parseWebsite };
|
package/dist/index.js
CHANGED
|
@@ -180,7 +180,7 @@ function parseStringItem(item) {
|
|
|
180
180
|
break;
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
return
|
|
183
|
+
return returnString;
|
|
184
184
|
}
|
|
185
185
|
function parseStringDocumentItem(item, footnotes) {
|
|
186
186
|
if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
|
|
@@ -303,23 +303,7 @@ function parseStringDocumentItem(item, footnotes) {
|
|
|
303
303
|
);
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
return
|
|
307
|
-
}
|
|
308
|
-
function trimEndLineBreaks(string) {
|
|
309
|
-
const trimmedString = string.replaceAll(/^\n<br \/>|\n<br \/>$/g, "");
|
|
310
|
-
const finalLineBreaks = /\n<br \/>$/.exec(trimmedString);
|
|
311
|
-
if (finalLineBreaks) {
|
|
312
|
-
return trimEndLineBreaks(trimmedString);
|
|
313
|
-
}
|
|
314
|
-
return trimmedString;
|
|
315
|
-
}
|
|
316
|
-
function trimStartLineBreaks(string) {
|
|
317
|
-
const trimmedString = string.replaceAll(/^<br \/>\n|<br \/>\n$/g, "");
|
|
318
|
-
const leadingLineBreaks = /^<br \/>\n/.exec(trimmedString);
|
|
319
|
-
if (leadingLineBreaks) {
|
|
320
|
-
return trimStartLineBreaks(trimmedString);
|
|
321
|
-
}
|
|
322
|
-
return trimmedString;
|
|
306
|
+
return returnString;
|
|
323
307
|
}
|
|
324
308
|
function parseStringContent(content, language = "eng") {
|
|
325
309
|
switch (typeof content.content) {
|
|
@@ -722,7 +706,6 @@ function parseDocument(document, language = "eng") {
|
|
|
722
706
|
returnString += parseStringDocumentItem(item, footnotes);
|
|
723
707
|
}
|
|
724
708
|
}
|
|
725
|
-
returnString = trimEndLineBreaks(returnString);
|
|
726
709
|
return { content: returnString, footnotes };
|
|
727
710
|
}
|
|
728
711
|
function parseImage(image) {
|
|
@@ -1891,9 +1874,9 @@ async function parseWebpage(webpageResource) {
|
|
|
1891
1874
|
blocks: [],
|
|
1892
1875
|
elements,
|
|
1893
1876
|
properties: {
|
|
1894
|
-
spacing:
|
|
1877
|
+
spacing: null,
|
|
1895
1878
|
gap: "none",
|
|
1896
|
-
alignItems: "
|
|
1879
|
+
alignItems: "start",
|
|
1897
1880
|
justifyContent: "stretch"
|
|
1898
1881
|
},
|
|
1899
1882
|
cssStyles: []
|
|
@@ -1913,9 +1896,9 @@ async function parseWebpage(webpageResource) {
|
|
|
1913
1896
|
blocks: [],
|
|
1914
1897
|
elements,
|
|
1915
1898
|
properties: {
|
|
1916
|
-
spacing:
|
|
1899
|
+
spacing: null,
|
|
1917
1900
|
gap: "none",
|
|
1918
|
-
alignItems: "
|
|
1901
|
+
alignItems: "start",
|
|
1919
1902
|
justifyContent: "stretch"
|
|
1920
1903
|
},
|
|
1921
1904
|
cssStyles: []
|
|
@@ -2004,9 +1987,9 @@ async function parseBlock(blockResource) {
|
|
|
2004
1987
|
blocks: [],
|
|
2005
1988
|
elements: [],
|
|
2006
1989
|
properties: {
|
|
2007
|
-
spacing:
|
|
1990
|
+
spacing: null,
|
|
2008
1991
|
gap: "none",
|
|
2009
|
-
alignItems: "
|
|
1992
|
+
alignItems: "start",
|
|
2010
1993
|
justifyContent: "stretch"
|
|
2011
1994
|
},
|
|
2012
1995
|
cssStyles: []
|
|
@@ -2620,7 +2603,5 @@ export {
|
|
|
2620
2603
|
parseStringDocumentItem,
|
|
2621
2604
|
parseStringItem,
|
|
2622
2605
|
parseTree,
|
|
2623
|
-
parseWebsite
|
|
2624
|
-
trimEndLineBreaks,
|
|
2625
|
-
trimStartLineBreaks
|
|
2606
|
+
parseWebsite
|
|
2626
2607
|
};
|
package/package.json
CHANGED