@gmb/bitmark-parser-generator 1.35.0 → 2.0.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.
Files changed (290) hide show
  1. package/dist/browser/bitmark-parser-generator.min.js +1 -1
  2. package/dist/browser/bundle-report.html +2 -2
  3. package/dist/cjs/BitmarkParserGenerator.js +8 -3
  4. package/dist/cjs/BitmarkParserGenerator.js.map +1 -1
  5. package/dist/cjs/ast/Ast.js +1 -0
  6. package/dist/cjs/ast/Ast.js.map +1 -1
  7. package/dist/cjs/ast/BaseBuilder.js +91 -54
  8. package/dist/cjs/ast/BaseBuilder.js.map +1 -1
  9. package/dist/cjs/ast/Builder.js +776 -389
  10. package/dist/cjs/ast/Builder.js.map +1 -1
  11. package/dist/cjs/ast/ResourceBuilder.js +516 -252
  12. package/dist/cjs/ast/ResourceBuilder.js.map +1 -1
  13. package/dist/cjs/ast/rules/NodeValidator.js +61 -22
  14. package/dist/cjs/ast/rules/NodeValidator.js.map +1 -1
  15. package/dist/cjs/breakscaping/Breakscape.js +96 -71
  16. package/dist/cjs/breakscaping/Breakscape.js.map +1 -1
  17. package/dist/cjs/config/raw/bits.js +14 -5
  18. package/dist/cjs/config/raw/bits.js.map +1 -1
  19. package/dist/cjs/config/raw/properties.js +7 -2
  20. package/dist/cjs/config/raw/properties.js.map +1 -1
  21. package/dist/cjs/generated/build-info.js +1 -1
  22. package/dist/cjs/generated/build-info.js.map +1 -1
  23. package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js +1 -0
  24. package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js.map +1 -1
  25. package/dist/cjs/generator/AstWalkerGenerator.js +4 -1
  26. package/dist/cjs/generator/AstWalkerGenerator.js.map +1 -1
  27. package/dist/cjs/generator/bitmark/BitmarkGenerator.js +959 -338
  28. package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +1 -1
  29. package/dist/cjs/generator/json/JsonGenerator.js +308 -1982
  30. package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
  31. package/dist/cjs/generator/text/TextGenerator.js +26 -8
  32. package/dist/cjs/generator/text/TextGenerator.js.map +1 -1
  33. package/dist/cjs/index.js.map +1 -1
  34. package/dist/cjs/model/ast/NodeType.js +27 -8
  35. package/dist/cjs/model/ast/NodeType.js.map +1 -1
  36. package/dist/cjs/model/config/enum/PropertyConfigKey.js +1 -0
  37. package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
  38. package/dist/cjs/model/enum/BitType.js +1 -2
  39. package/dist/cjs/model/enum/BitType.js.map +1 -1
  40. package/dist/cjs/model/enum/PropertyFormat.js +3 -1
  41. package/dist/cjs/model/enum/PropertyFormat.js.map +1 -1
  42. package/dist/cjs/model/enum/TextFormat.js +1 -1
  43. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js +9 -3
  44. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js.map +1 -1
  45. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +49 -131
  46. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
  47. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
  48. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js +7 -31
  49. package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
  50. package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +255 -0
  51. package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -0
  52. package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +2 -1
  53. package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
  54. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +175 -129
  55. package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
  56. package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +8 -2
  57. package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
  58. package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +61 -0
  59. package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +1 -0
  60. package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +11 -5
  61. package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
  62. package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +21 -17
  63. package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
  64. package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +50 -0
  65. package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -0
  66. package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +2 -15
  67. package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
  68. package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -4
  69. package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
  70. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +4 -1
  71. package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
  72. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +2 -4
  73. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
  74. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +5 -5
  75. package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
  76. package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +5 -6
  77. package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
  78. package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +23 -7
  79. package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
  80. package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +5 -5
  81. package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
  82. package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +3 -2
  83. package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
  84. package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +19 -8
  85. package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
  86. package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +4 -6
  87. package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +1 -1
  88. package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +4 -5
  89. package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
  90. package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +14 -5
  91. package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
  92. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +37 -21
  93. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
  94. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +3 -2
  95. package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
  96. package/dist/cjs/parser/json/JsonParser.js +73 -765
  97. package/dist/cjs/parser/json/JsonParser.js.map +1 -1
  98. package/dist/cjs/parser/text/TextParser.js +61 -2
  99. package/dist/cjs/parser/text/TextParser.js.map +1 -1
  100. package/dist/cjs/utils/BitUtils.js +15 -13
  101. package/dist/cjs/utils/BitUtils.js.map +1 -1
  102. package/dist/esm/BitmarkParserGenerator.js +8 -3
  103. package/dist/esm/BitmarkParserGenerator.js.map +1 -1
  104. package/dist/esm/ast/Ast.js +1 -0
  105. package/dist/esm/ast/Ast.js.map +1 -1
  106. package/dist/esm/ast/BaseBuilder.js +91 -54
  107. package/dist/esm/ast/BaseBuilder.js.map +1 -1
  108. package/dist/esm/ast/Builder.js +776 -389
  109. package/dist/esm/ast/Builder.js.map +1 -1
  110. package/dist/esm/ast/ResourceBuilder.js +516 -252
  111. package/dist/esm/ast/ResourceBuilder.js.map +1 -1
  112. package/dist/esm/ast/rules/NodeValidator.js +61 -22
  113. package/dist/esm/ast/rules/NodeValidator.js.map +1 -1
  114. package/dist/esm/breakscaping/Breakscape.js +96 -71
  115. package/dist/esm/breakscaping/Breakscape.js.map +1 -1
  116. package/dist/esm/config/raw/bits.js +14 -5
  117. package/dist/esm/config/raw/bits.js.map +1 -1
  118. package/dist/esm/config/raw/properties.js +7 -2
  119. package/dist/esm/config/raw/properties.js.map +1 -1
  120. package/dist/esm/generated/build-info.js +1 -1
  121. package/dist/esm/generated/build-info.js.map +1 -1
  122. package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js +1 -0
  123. package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js.map +1 -1
  124. package/dist/esm/generator/AstWalkerGenerator.js +4 -1
  125. package/dist/esm/generator/AstWalkerGenerator.js.map +1 -1
  126. package/dist/esm/generator/bitmark/BitmarkGenerator.js +959 -338
  127. package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +1 -1
  128. package/dist/esm/generator/json/JsonGenerator.js +308 -1982
  129. package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
  130. package/dist/esm/generator/text/TextGenerator.js +26 -8
  131. package/dist/esm/generator/text/TextGenerator.js.map +1 -1
  132. package/dist/esm/index.js.map +1 -1
  133. package/dist/esm/model/ast/NodeType.js +27 -8
  134. package/dist/esm/model/ast/NodeType.js.map +1 -1
  135. package/dist/esm/model/config/enum/PropertyConfigKey.js +1 -0
  136. package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
  137. package/dist/esm/model/enum/BitType.js +1 -2
  138. package/dist/esm/model/enum/BitType.js.map +1 -1
  139. package/dist/esm/model/enum/PropertyFormat.js +3 -1
  140. package/dist/esm/model/enum/PropertyFormat.js.map +1 -1
  141. package/dist/esm/model/enum/TextFormat.js +1 -1
  142. package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js +9 -3
  143. package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js.map +1 -1
  144. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +49 -131
  145. package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
  146. package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
  147. package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js +7 -31
  148. package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
  149. package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +252 -0
  150. package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -0
  151. package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +2 -1
  152. package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
  153. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +175 -129
  154. package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
  155. package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +8 -2
  156. package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
  157. package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +58 -0
  158. package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +1 -0
  159. package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +11 -5
  160. package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
  161. package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +21 -17
  162. package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
  163. package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +47 -0
  164. package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -0
  165. package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +2 -15
  166. package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
  167. package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -4
  168. package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
  169. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +4 -1
  170. package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
  171. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +2 -4
  172. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
  173. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +5 -5
  174. package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
  175. package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +5 -6
  176. package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
  177. package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +23 -7
  178. package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
  179. package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +5 -5
  180. package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
  181. package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +3 -2
  182. package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
  183. package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +19 -8
  184. package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
  185. package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +4 -6
  186. package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +1 -1
  187. package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +4 -5
  188. package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
  189. package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +14 -5
  190. package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
  191. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +37 -21
  192. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
  193. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +3 -2
  194. package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
  195. package/dist/esm/parser/json/JsonParser.js +73 -765
  196. package/dist/esm/parser/json/JsonParser.js.map +1 -1
  197. package/dist/esm/parser/text/TextParser.js +61 -2
  198. package/dist/esm/parser/text/TextParser.js.map +1 -1
  199. package/dist/esm/utils/BitUtils.js +15 -13
  200. package/dist/esm/utils/BitUtils.js.map +1 -1
  201. package/dist/types/BitmarkParserGenerator.d.ts +8 -0
  202. package/dist/types/BitmarkParserGenerator.d.ts.map +1 -1
  203. package/dist/types/ast/Ast.d.ts.map +1 -1
  204. package/dist/types/ast/BaseBuilder.d.ts +31 -21
  205. package/dist/types/ast/BaseBuilder.d.ts.map +1 -1
  206. package/dist/types/ast/Builder.d.ts +279 -441
  207. package/dist/types/ast/Builder.d.ts.map +1 -1
  208. package/dist/types/ast/ResourceBuilder.d.ts +177 -164
  209. package/dist/types/ast/ResourceBuilder.d.ts.map +1 -1
  210. package/dist/types/ast/rules/NodeValidator.d.ts +3 -2
  211. package/dist/types/ast/rules/NodeValidator.d.ts.map +1 -1
  212. package/dist/types/breakscaping/Breakscape.d.ts +6 -5
  213. package/dist/types/breakscaping/Breakscape.d.ts.map +1 -1
  214. package/dist/types/config/raw/bits.d.ts.map +1 -1
  215. package/dist/types/config/raw/properties.d.ts.map +1 -1
  216. package/dist/types/generated/parser/bitmark/bitmark-peggy-parser.d.ts.map +1 -1
  217. package/dist/types/generator/AstWalkerGenerator.d.ts.map +1 -1
  218. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts +89 -55
  219. package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +1 -1
  220. package/dist/types/generator/json/JsonGenerator.d.ts +88 -108
  221. package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
  222. package/dist/types/generator/text/TextGenerator.d.ts +14 -2
  223. package/dist/types/generator/text/TextGenerator.d.ts.map +1 -1
  224. package/dist/types/index.d.ts +2 -2
  225. package/dist/types/index.d.ts.map +1 -1
  226. package/dist/types/model/ast/NodeType.d.ts +48 -16
  227. package/dist/types/model/ast/NodeType.d.ts.map +1 -1
  228. package/dist/types/model/ast/Nodes.d.ts +64 -440
  229. package/dist/types/model/ast/Nodes.d.ts.map +1 -1
  230. package/dist/types/model/config/enum/ConfigKey.d.ts +2 -0
  231. package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
  232. package/dist/types/model/config/enum/PropertyConfigKey.d.ts +3 -0
  233. package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
  234. package/dist/types/model/enum/BitType.d.ts +2 -4
  235. package/dist/types/model/enum/BitType.d.ts.map +1 -1
  236. package/dist/types/model/enum/PropertyFormat.d.ts +4 -2
  237. package/dist/types/model/enum/PropertyFormat.d.ts.map +1 -1
  238. package/dist/types/model/enum/PropertyTag.d.ts +2 -0
  239. package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
  240. package/dist/types/model/json/BitJson.d.ts +32 -20
  241. package/dist/types/model/json/BitJson.d.ts.map +1 -1
  242. package/dist/types/model/json/BodyBitJson.d.ts +16 -12
  243. package/dist/types/model/json/BodyBitJson.d.ts.map +1 -1
  244. package/dist/types/model/json/ResourceJson.d.ts +2 -22
  245. package/dist/types/model/json/ResourceJson.d.ts.map +1 -1
  246. package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts +3 -2
  247. package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts.map +1 -1
  248. package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts +2 -15
  249. package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +1 -1
  250. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +83 -71
  251. package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +1 -1
  252. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +2 -2
  253. package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +1 -1
  254. package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts +37 -0
  255. package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts.map +1 -0
  256. package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts.map +1 -1
  257. package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts +2 -2
  258. package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts.map +1 -1
  259. package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts.map +1 -1
  260. package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts +15 -0
  261. package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts.map +1 -0
  262. package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +1 -1
  263. package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +1 -1
  264. package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts +16 -0
  265. package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts.map +1 -0
  266. package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts.map +1 -1
  267. package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +1 -1
  268. package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +1 -1
  269. package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +1 -1
  270. package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +1 -1
  271. package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts.map +1 -1
  272. package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts.map +1 -1
  273. package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts.map +1 -1
  274. package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +1 -1
  275. package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts +2 -2
  276. package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +1 -1
  277. package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts.map +1 -1
  278. package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts.map +1 -1
  279. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +5 -2
  280. package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts.map +1 -1
  281. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts +1 -1
  282. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts.map +1 -1
  283. package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +1 -1
  284. package/dist/types/parser/json/JsonParser.d.ts +9 -72
  285. package/dist/types/parser/json/JsonParser.d.ts.map +1 -1
  286. package/dist/types/parser/text/TextParser.d.ts +16 -1
  287. package/dist/types/parser/text/TextParser.d.ts.map +1 -1
  288. package/dist/types/utils/BitUtils.d.ts +8 -8
  289. package/dist/types/utils/BitUtils.d.ts.map +1 -1
  290. package/package.json +1 -1
@@ -10,8 +10,11 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { Breakscape } from '../breakscaping/Breakscape';
13
+ import { Config } from '../config/Config';
14
+ import { BitType } from '../model/enum/BitType';
13
15
  import { ResourceTag } from '../model/enum/ResourceTag';
14
16
  import { ObjectUtils } from '../utils/ObjectUtils';
17
+ import { StringUtils } from '../utils/StringUtils';
15
18
  import { UrlUtils } from '../utils/UrlUtils';
16
19
  import { BaseBuilder } from './BaseBuilder';
17
20
  import { NodeValidator } from './rules/NodeValidator';
@@ -19,13 +22,136 @@ import { NodeValidator } from './rules/NodeValidator';
19
22
  * Builder to build bitmark Resource AST nodes programmatically
20
23
  */
21
24
  class ResourceBuilder extends BaseBuilder {
25
+ /**
26
+ * Build and validate resource JSON object(s) from external resource JSON object(s)
27
+ *
28
+ * Note: a single input resource object can be converted to multiple resource objects
29
+ * (e.g. stillImageFilm -> image + audio)
30
+ *
31
+ * @param bitType
32
+ * @param resource
33
+ * @returns
34
+ */
35
+ resourceFromResourceJson(bitType, resource) {
36
+ if (!resource)
37
+ return undefined;
38
+ const nodes = [];
39
+ // Convert single resource to array
40
+ if (!Array.isArray(resource))
41
+ resource = [resource];
42
+ for (const thisResource of resource) {
43
+ // Validate we have a valid resource type
44
+ let type = ResourceTag.fromValue(thisResource.type);
45
+ if (!type)
46
+ return undefined;
47
+ // Get the resource key
48
+ const resourceKey = ResourceTag.keyFromValue(type);
49
+ if (!resourceKey)
50
+ return undefined;
51
+ // Override original type with type alias if present
52
+ const __typeAlias = ResourceTag.fromValue(thisResource.__typeAlias);
53
+ type = __typeAlias !== null && __typeAlias !== void 0 ? __typeAlias : type;
54
+ let data;
55
+ // TODO: This code should use the config to handle the combo resources. For now the logic is hardcoded
56
+ // Handle special cases for multiple resource bits (imageResponsive, stillImageFilm)
57
+ if (type === ResourceTag.imageResponsive) {
58
+ const r = thisResource;
59
+ const imagePortraitNode = this.resourceFromResourceDataJson(bitType, ResourceTag.imagePortrait, r.imagePortrait);
60
+ const imageLandscapeNode = this.resourceFromResourceDataJson(bitType, ResourceTag.imageLandscape, r.imageLandscape);
61
+ if (imagePortraitNode)
62
+ nodes.push(imagePortraitNode);
63
+ if (imageLandscapeNode)
64
+ nodes.push(imageLandscapeNode);
65
+ }
66
+ else if (type === ResourceTag.stillImageFilm) {
67
+ const r = thisResource;
68
+ const imageNode = this.resourceFromResourceDataJson(bitType, ResourceTag.image, r.image);
69
+ const audioNode = this.resourceFromResourceDataJson(bitType, ResourceTag.audio, r.audio);
70
+ if (imageNode)
71
+ nodes.push(imageNode);
72
+ if (audioNode)
73
+ nodes.push(audioNode);
74
+ }
75
+ else {
76
+ // Standard single resource case
77
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
78
+ data = thisResource[resourceKey];
79
+ if (!data)
80
+ return undefined;
81
+ const node = this.resourceFromResourceDataJson(bitType, type, data);
82
+ if (node)
83
+ nodes.push(node);
84
+ }
85
+ }
86
+ if (nodes.length === 0)
87
+ return undefined;
88
+ if (nodes.length === 1)
89
+ return nodes[0];
90
+ return nodes;
91
+ }
92
+ resourceFromResourceDataJson(bitType, type, data) {
93
+ var _a, _b, _c;
94
+ if (!data)
95
+ return undefined;
96
+ type = ResourceTag.fromValue(type);
97
+ if (!type)
98
+ return undefined;
99
+ const dataAsString = StringUtils.isString(data) ? data : undefined;
100
+ // url / src / href / app
101
+ const url = data.url || data.src || data.body || dataAsString;
102
+ // Sub resources
103
+ const posterImage = data.posterImage
104
+ ? (_a = this.resourceFromResourceDataJson(bitType, ResourceTag.image, data.posterImage)) === null || _a === void 0 ? void 0 : _a.image
105
+ : undefined;
106
+ const thumbnails = data.thumbnails
107
+ ? data.thumbnails.map((t) => {
108
+ var _a;
109
+ return (_a = this.resourceFromResourceDataJson(bitType, ResourceTag.image, t)) === null || _a === void 0 ? void 0 : _a.image;
110
+ })
111
+ : undefined;
112
+ // Resource
113
+ const node = this.resource(bitType, {
114
+ type,
115
+ // Generic (except Article / Document)
116
+ value: url,
117
+ // ImageLikeResource / AudioLikeResource / VideoLikeResource / Article / Document
118
+ format: data.format,
119
+ // ImageLikeResource
120
+ src1x: data.src1x,
121
+ src2x: data.src2x,
122
+ src3x: data.src3x,
123
+ src4x: data.src4x,
124
+ caption: this.handleJsonText(data.caption),
125
+ // ImageLikeResource / VideoLikeResource
126
+ width: (_b = data.width) !== null && _b !== void 0 ? _b : undefined,
127
+ height: (_c = data.height) !== null && _c !== void 0 ? _c : undefined,
128
+ alt: data.alt,
129
+ zoomDisabled: data.zoomDisabled,
130
+ // VideoLikeResource
131
+ duration: data.duration,
132
+ mute: data.mute,
133
+ autoplay: data.autoplay,
134
+ allowSubtitles: data.allowSubtitles,
135
+ showSubtitles: data.showSubtitles,
136
+ posterImage,
137
+ thumbnails,
138
+ // WebsiteLinkResource
139
+ siteName: undefined, //data.siteName,
140
+ // Generic Resource
141
+ license: data.license,
142
+ copyright: data.copyright,
143
+ showInIndex: data.showInIndex,
144
+ search: data.search,
145
+ });
146
+ return node;
147
+ }
22
148
  /**
23
149
  * Build resource node
24
150
  *
25
151
  * @param data - data for the node
26
152
  * @returns
27
153
  */
28
- resource(data) {
154
+ /* private */ resource(bitType, data) {
29
155
  var _a;
30
156
  let node;
31
157
  const { type, value: valueIn, format: formatIn } = data, rest = __rest(data, ["type", "value", "format"]);
@@ -44,12 +170,12 @@ class ResourceBuilder extends BaseBuilder {
44
170
  const dataAsAny = data;
45
171
  const value = dataAsAny[k];
46
172
  if (value) {
47
- const image = this.resource({
173
+ const image = this.resource(bitType, {
48
174
  type: ResourceTag.image,
49
175
  value,
50
176
  });
51
177
  if (image)
52
- thumbnails.push(image);
178
+ thumbnails.push(image.image);
53
179
  }
54
180
  }
55
181
  // Merge with existing thumbnails
@@ -60,7 +186,7 @@ class ResourceBuilder extends BaseBuilder {
60
186
  case ResourceTag.image:
61
187
  case ResourceTag.imagePortrait:
62
188
  case ResourceTag.imageLandscape:
63
- node = this.imageResource(finalData, type);
189
+ node = this.imageResource(bitType, finalData, type);
64
190
  break;
65
191
  // case ResourceTag.imageResponsive: {
66
192
  // node = this.imageResponsiveResource({
@@ -154,32 +280,47 @@ class ResourceBuilder extends BaseBuilder {
154
280
  * @param data - data for the node
155
281
  * @returns
156
282
  */
157
- imageResource(data, typeAlias) {
283
+ imageResource(bitType, data, __typeAlias) {
284
+ var _a, _b;
158
285
  const { value, src1x, src2x, src3x, src4x, width, height, alt, zoomDisabled, license, copyright, showInIndex, caption, search, } = data;
286
+ let zoomDisabledDefault = false;
287
+ if (Config.isOfBitType(bitType, [
288
+ BitType.imageSeparator,
289
+ BitType.pageBanner,
290
+ BitType.imagesLogoGrave,
291
+ BitType.prototypeImages,
292
+ ])) {
293
+ zoomDisabledDefault = true;
294
+ }
159
295
  // NOTE: Node order is important and is defined here
160
296
  const node = {
161
297
  type: ResourceTag.image,
162
- typeAlias: typeAlias !== null && typeAlias !== void 0 ? typeAlias : ResourceTag.image,
163
- format: UrlUtils.fileExtensionFromUrl(value),
164
- provider: UrlUtils.domainFromUrl(value),
165
- value,
166
- src1x,
167
- src2x,
168
- src3x,
169
- src4x,
170
- width,
171
- height,
172
- alt,
173
- zoomDisabled,
174
- license,
175
- copyright,
176
- showInIndex,
177
- caption,
178
- search,
298
+ __typeAlias: __typeAlias !== null && __typeAlias !== void 0 ? __typeAlias : ResourceTag.image,
299
+ image: {
300
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
301
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
302
+ src: value !== null && value !== void 0 ? value : '',
303
+ src1x: (src1x !== null && src1x !== void 0 ? src1x : undefined),
304
+ src2x: (src2x !== null && src2x !== void 0 ? src2x : undefined),
305
+ src3x: (src3x !== null && src3x !== void 0 ? src3x : undefined),
306
+ src4x: (src4x !== null && src4x !== void 0 ? src4x : undefined),
307
+ width: (width !== null && width !== void 0 ? width : null),
308
+ height: (height !== null && height !== void 0 ? height : null),
309
+ alt: alt !== null && alt !== void 0 ? alt : '',
310
+ zoomDisabled: zoomDisabled !== null && zoomDisabled !== void 0 ? zoomDisabled : zoomDisabledDefault,
311
+ license: license !== null && license !== void 0 ? license : '',
312
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
313
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
314
+ caption: this.handleJsonText(caption),
315
+ search: (search !== null && search !== void 0 ? search : undefined),
316
+ },
179
317
  };
180
318
  // Remove Unset Optionals
181
- ObjectUtils.removeUnwantedProperties(node, {
182
- ignoreFalse: ['zoomDisabled'],
319
+ ObjectUtils.removeUnwantedProperties(node.image, {
320
+ ignoreFalse: ['zoomDisabled', 'showInIndex'],
321
+ ignoreEmptyArrays: ['caption'],
322
+ ignoreUndefined: ['width', 'height'],
323
+ ignoreEmptyString: ['src', 'alt', 'license', 'copyright'],
183
324
  });
184
325
  // Validate and correct invalid bits as much as possible
185
326
  return NodeValidator.validateResource(node);
@@ -191,31 +332,38 @@ class ResourceBuilder extends BaseBuilder {
191
332
  * @returns
192
333
  */
193
334
  imageLinkResource(data) {
335
+ var _a, _b;
194
336
  const { value, src1x, src2x, src3x, src4x, width, height, alt, zoomDisabled, license, copyright, showInIndex, caption, search, } = data;
195
337
  // NOTE: Node order is important and is defined here
196
338
  const node = {
197
339
  type: ResourceTag.imageLink,
198
- typeAlias: ResourceTag.imageLink,
199
- format: UrlUtils.fileExtensionFromUrl(value),
200
- provider: UrlUtils.domainFromUrl(value),
201
- value,
202
- src1x,
203
- src2x,
204
- src3x,
205
- src4x,
206
- zoomDisabled,
207
- width,
208
- height,
209
- alt,
210
- license,
211
- copyright,
212
- showInIndex,
213
- caption,
214
- search,
340
+ __typeAlias: ResourceTag.imageLink,
341
+ imageLink: {
342
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
343
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
344
+ // src: value ?? '',
345
+ url: value !== null && value !== void 0 ? value : '',
346
+ src1x: (src1x !== null && src1x !== void 0 ? src1x : undefined),
347
+ src2x: (src2x !== null && src2x !== void 0 ? src2x : undefined),
348
+ src3x: (src3x !== null && src3x !== void 0 ? src3x : undefined),
349
+ src4x: (src4x !== null && src4x !== void 0 ? src4x : undefined),
350
+ width: (width !== null && width !== void 0 ? width : null),
351
+ height: (height !== null && height !== void 0 ? height : null),
352
+ alt: alt !== null && alt !== void 0 ? alt : '',
353
+ zoomDisabled: zoomDisabled !== null && zoomDisabled !== void 0 ? zoomDisabled : false, // TODO: Default depends on the bit(!)
354
+ license: license !== null && license !== void 0 ? license : '',
355
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
356
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
357
+ caption: this.handleJsonText(caption),
358
+ search: (search !== null && search !== void 0 ? search : undefined),
359
+ },
215
360
  };
216
361
  // Remove Unset Optionals
217
- ObjectUtils.removeUnwantedProperties(node, {
218
- ignoreFalse: ['zoomDisabled'],
362
+ ObjectUtils.removeUnwantedProperties(node.imageLink, {
363
+ ignoreFalse: ['zoomDisabled', 'showInIndex'],
364
+ ignoreEmptyArrays: ['caption'],
365
+ ignoreUndefined: ['width', 'height'],
366
+ ignoreEmptyString: ['url', 'alt', 'license', 'copyright'],
219
367
  });
220
368
  // Validate and correct invalid bits as much as possible
221
369
  return NodeValidator.validateResource(node);
@@ -227,25 +375,32 @@ class ResourceBuilder extends BaseBuilder {
227
375
  * @returns
228
376
  */
229
377
  audioResource(data) {
378
+ var _a, _b;
230
379
  const { value, duration, mute, autoplay, license, copyright, showInIndex, caption, search } = data;
231
380
  // NOTE: Node order is important and is defined here
232
381
  const node = {
233
382
  type: ResourceTag.audio,
234
- typeAlias: ResourceTag.audio,
235
- format: UrlUtils.fileExtensionFromUrl(value),
236
- provider: UrlUtils.domainFromUrl(value),
237
- value,
238
- duration,
239
- mute,
240
- autoplay,
241
- license,
242
- copyright,
243
- showInIndex,
244
- caption,
245
- search,
383
+ __typeAlias: ResourceTag.audio,
384
+ audio: {
385
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
386
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
387
+ src: value !== null && value !== void 0 ? value : '',
388
+ duration: (duration !== null && duration !== void 0 ? duration : undefined),
389
+ mute: (mute !== null && mute !== void 0 ? mute : undefined),
390
+ autoplay: (autoplay !== null && autoplay !== void 0 ? autoplay : undefined),
391
+ license: license !== null && license !== void 0 ? license : '',
392
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
393
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
394
+ caption: this.handleJsonText(caption),
395
+ search: (search !== null && search !== void 0 ? search : undefined),
396
+ },
246
397
  };
247
398
  // Remove Unset Optionals
248
- ObjectUtils.removeUnwantedProperties(node);
399
+ ObjectUtils.removeUnwantedProperties(node.audio, {
400
+ ignoreEmptyArrays: ['caption'],
401
+ ignoreEmptyString: ['src', 'alt', 'license', 'copyright'],
402
+ ignoreFalse: ['showInIndex'],
403
+ });
249
404
  // Validate and correct invalid bits as much as possible
250
405
  return NodeValidator.validateResource(node);
251
406
  }
@@ -256,25 +411,32 @@ class ResourceBuilder extends BaseBuilder {
256
411
  * @returns
257
412
  */
258
413
  audioEmbedResource(data) {
414
+ var _a, _b;
259
415
  const { value, duration, mute, autoplay, license, copyright, showInIndex, caption, search } = data;
260
416
  // NOTE: Node order is important and is defined here
261
417
  const node = {
262
418
  type: ResourceTag.audioEmbed,
263
- typeAlias: ResourceTag.audioEmbed,
264
- format: UrlUtils.fileExtensionFromUrl(value),
265
- provider: UrlUtils.domainFromUrl(value),
266
- value,
267
- duration,
268
- mute,
269
- autoplay,
270
- license,
271
- copyright,
272
- showInIndex,
273
- caption,
274
- search,
419
+ __typeAlias: ResourceTag.audioEmbed,
420
+ audioEmbed: {
421
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
422
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
423
+ src: value !== null && value !== void 0 ? value : '',
424
+ duration: (duration !== null && duration !== void 0 ? duration : undefined),
425
+ mute: (mute !== null && mute !== void 0 ? mute : undefined),
426
+ autoplay: (autoplay !== null && autoplay !== void 0 ? autoplay : undefined),
427
+ license: license !== null && license !== void 0 ? license : '',
428
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
429
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
430
+ caption: this.handleJsonText(caption),
431
+ search: (search !== null && search !== void 0 ? search : undefined),
432
+ },
275
433
  };
276
434
  // Remove Unset Optionals
277
- ObjectUtils.removeUnwantedProperties(node);
435
+ ObjectUtils.removeUnwantedProperties(node.audioEmbed, {
436
+ ignoreEmptyArrays: ['caption'],
437
+ ignoreEmptyString: ['src', /*'alt',*/ 'license', 'copyright'],
438
+ ignoreFalse: ['showInIndex'],
439
+ });
278
440
  // Validate and correct invalid bits as much as possible
279
441
  return NodeValidator.validateResource(node);
280
442
  }
@@ -285,25 +447,32 @@ class ResourceBuilder extends BaseBuilder {
285
447
  * @returns
286
448
  */
287
449
  audioLinkResource(data) {
450
+ var _a, _b;
288
451
  const { value, duration, mute, autoplay, license, copyright, showInIndex, caption, search } = data;
289
452
  // NOTE: Node order is important and is defined here
290
453
  const node = {
291
454
  type: ResourceTag.audioLink,
292
- typeAlias: ResourceTag.audioLink,
293
- format: UrlUtils.fileExtensionFromUrl(value),
294
- provider: UrlUtils.domainFromUrl(value),
295
- value,
296
- duration,
297
- mute,
298
- autoplay,
299
- license,
300
- copyright,
301
- showInIndex,
302
- caption,
303
- search,
455
+ __typeAlias: ResourceTag.audioLink,
456
+ audioLink: {
457
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
458
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
459
+ // src: value ?? '',
460
+ url: value !== null && value !== void 0 ? value : '',
461
+ duration: (duration !== null && duration !== void 0 ? duration : undefined),
462
+ mute: (mute !== null && mute !== void 0 ? mute : undefined),
463
+ autoplay: (autoplay !== null && autoplay !== void 0 ? autoplay : undefined),
464
+ license: license !== null && license !== void 0 ? license : '',
465
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
466
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
467
+ caption: this.handleJsonText(caption),
468
+ search: (search !== null && search !== void 0 ? search : undefined),
469
+ },
304
470
  };
305
471
  // Remove Unset Optionals
306
- ObjectUtils.removeUnwantedProperties(node);
472
+ ObjectUtils.removeUnwantedProperties(node.audioLink, {
473
+ // ignoreEmptyArrays: ['caption'],
474
+ ignoreEmptyString: ['url' /*'alt', 'license', 'copyright'*/],
475
+ });
307
476
  // Validate and correct invalid bits as much as possible
308
477
  return NodeValidator.validateResource(node);
309
478
  }
@@ -314,32 +483,40 @@ class ResourceBuilder extends BaseBuilder {
314
483
  * @returns
315
484
  */
316
485
  videoResource(data) {
486
+ var _a, _b;
317
487
  const { value, width, height, duration, mute, autoplay, allowSubtitles, showSubtitles, alt, posterImage, thumbnails, license, copyright, showInIndex, caption, search, } = data;
318
488
  // NOTE: Node order is important and is defined here
319
489
  const node = {
320
490
  type: ResourceTag.video,
321
- typeAlias: ResourceTag.video,
322
- format: UrlUtils.fileExtensionFromUrl(value),
323
- provider: UrlUtils.domainFromUrl(value),
324
- value,
325
- width,
326
- height,
327
- duration,
328
- mute,
329
- autoplay,
330
- allowSubtitles,
331
- showSubtitles,
332
- alt,
333
- posterImage,
334
- thumbnails,
335
- license,
336
- copyright,
337
- showInIndex,
338
- caption,
339
- search,
491
+ __typeAlias: ResourceTag.video,
492
+ video: {
493
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
494
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
495
+ src: value !== null && value !== void 0 ? value : '',
496
+ width: (width !== null && width !== void 0 ? width : null),
497
+ height: (height !== null && height !== void 0 ? height : null),
498
+ duration: (duration !== null && duration !== void 0 ? duration : undefined),
499
+ mute: (mute !== null && mute !== void 0 ? mute : undefined),
500
+ autoplay: (autoplay !== null && autoplay !== void 0 ? autoplay : undefined),
501
+ allowSubtitles: (allowSubtitles !== null && allowSubtitles !== void 0 ? allowSubtitles : undefined),
502
+ showSubtitles: (showSubtitles !== null && showSubtitles !== void 0 ? showSubtitles : undefined),
503
+ alt: alt !== null && alt !== void 0 ? alt : '',
504
+ posterImage: (posterImage !== null && posterImage !== void 0 ? posterImage : undefined),
505
+ thumbnails: (thumbnails !== null && thumbnails !== void 0 ? thumbnails : undefined),
506
+ license: license !== null && license !== void 0 ? license : '',
507
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
508
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
509
+ caption: this.handleJsonText(caption),
510
+ search: (search !== null && search !== void 0 ? search : undefined),
511
+ },
340
512
  };
341
513
  // Remove Unset Optionals
342
- ObjectUtils.removeUnwantedProperties(node);
514
+ ObjectUtils.removeUnwantedProperties(node.video, {
515
+ ignoreEmptyArrays: ['caption'],
516
+ ignoreUndefined: ['width', 'height'],
517
+ ignoreEmptyString: ['src', /*'alt',*/ 'license', 'copyright'],
518
+ ignoreFalse: ['showInIndex'],
519
+ });
343
520
  // Validate and correct invalid bits as much as possible
344
521
  return NodeValidator.validateResource(node);
345
522
  }
@@ -350,32 +527,41 @@ class ResourceBuilder extends BaseBuilder {
350
527
  * @returns
351
528
  */
352
529
  videoEmbedResource(data) {
530
+ var _a, _b;
353
531
  const { value, width, height, duration, mute, autoplay, allowSubtitles, showSubtitles, alt, posterImage, thumbnails, license, copyright, showInIndex, caption, search, } = data;
354
532
  // NOTE: Node order is important and is defined here
355
533
  const node = {
356
534
  type: ResourceTag.videoEmbed,
357
- typeAlias: ResourceTag.videoEmbed,
358
- format: UrlUtils.fileExtensionFromUrl(value),
359
- provider: UrlUtils.domainFromUrl(value),
360
- value,
361
- width,
362
- height,
363
- duration,
364
- mute,
365
- autoplay,
366
- allowSubtitles,
367
- showSubtitles,
368
- alt,
369
- posterImage,
370
- thumbnails,
371
- license,
372
- copyright,
373
- showInIndex,
374
- caption,
375
- search,
535
+ __typeAlias: ResourceTag.videoEmbed,
536
+ videoEmbed: {
537
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
538
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
539
+ // src: value ?? '',
540
+ url: value !== null && value !== void 0 ? value : '',
541
+ width: (width !== null && width !== void 0 ? width : null),
542
+ height: (height !== null && height !== void 0 ? height : null),
543
+ duration: (duration !== null && duration !== void 0 ? duration : undefined),
544
+ mute: (mute !== null && mute !== void 0 ? mute : undefined),
545
+ autoplay: (autoplay !== null && autoplay !== void 0 ? autoplay : undefined),
546
+ allowSubtitles: (allowSubtitles !== null && allowSubtitles !== void 0 ? allowSubtitles : undefined),
547
+ showSubtitles: (showSubtitles !== null && showSubtitles !== void 0 ? showSubtitles : undefined),
548
+ alt: alt !== null && alt !== void 0 ? alt : '',
549
+ posterImage: (posterImage !== null && posterImage !== void 0 ? posterImage : undefined),
550
+ thumbnails: (thumbnails !== null && thumbnails !== void 0 ? thumbnails : undefined),
551
+ license: license !== null && license !== void 0 ? license : '',
552
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
553
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
554
+ caption: this.handleJsonText(caption),
555
+ search: (search !== null && search !== void 0 ? search : undefined),
556
+ },
376
557
  };
377
558
  // Remove Unset Optionals
378
- ObjectUtils.removeUnwantedProperties(node);
559
+ ObjectUtils.removeUnwantedProperties(node.videoEmbed, {
560
+ ignoreEmptyArrays: ['caption'],
561
+ ignoreUndefined: ['width', 'height'],
562
+ ignoreEmptyString: ['url', /*'alt',*/ 'license', 'copyright'],
563
+ ignoreFalse: ['showInIndex'],
564
+ });
379
565
  // Validate and correct invalid bits as much as possible
380
566
  return NodeValidator.validateResource(node);
381
567
  }
@@ -386,32 +572,41 @@ class ResourceBuilder extends BaseBuilder {
386
572
  * @returns
387
573
  */
388
574
  videoLinkResource(data) {
575
+ var _a, _b;
389
576
  const { value, width, height, duration, mute, autoplay, allowSubtitles, showSubtitles, alt, posterImage, thumbnails, license, copyright, showInIndex, caption, search, } = data;
390
577
  // NOTE: Node order is important and is defined here
391
578
  const node = {
392
579
  type: ResourceTag.videoLink,
393
- typeAlias: ResourceTag.videoLink,
394
- format: UrlUtils.fileExtensionFromUrl(value),
395
- provider: UrlUtils.domainFromUrl(value),
396
- value,
397
- width,
398
- height,
399
- duration,
400
- mute,
401
- autoplay,
402
- allowSubtitles,
403
- showSubtitles,
404
- alt,
405
- posterImage,
406
- thumbnails,
407
- license,
408
- copyright,
409
- showInIndex,
410
- caption,
411
- search,
580
+ __typeAlias: ResourceTag.videoLink,
581
+ videoLink: {
582
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
583
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
584
+ // src: value ?? '',
585
+ url: value !== null && value !== void 0 ? value : '',
586
+ width: (width !== null && width !== void 0 ? width : null),
587
+ height: (height !== null && height !== void 0 ? height : null),
588
+ duration: (duration !== null && duration !== void 0 ? duration : undefined),
589
+ mute: (mute !== null && mute !== void 0 ? mute : undefined),
590
+ autoplay: (autoplay !== null && autoplay !== void 0 ? autoplay : undefined),
591
+ allowSubtitles: (allowSubtitles !== null && allowSubtitles !== void 0 ? allowSubtitles : undefined),
592
+ showSubtitles: (showSubtitles !== null && showSubtitles !== void 0 ? showSubtitles : undefined),
593
+ alt: alt !== null && alt !== void 0 ? alt : '',
594
+ posterImage: (posterImage !== null && posterImage !== void 0 ? posterImage : undefined),
595
+ thumbnails: (thumbnails !== null && thumbnails !== void 0 ? thumbnails : undefined),
596
+ license: license !== null && license !== void 0 ? license : '',
597
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
598
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
599
+ caption: this.handleJsonText(caption),
600
+ search: (search !== null && search !== void 0 ? search : undefined),
601
+ },
412
602
  };
413
603
  // Remove Unset Optionals
414
- ObjectUtils.removeUnwantedProperties(node);
604
+ ObjectUtils.removeUnwantedProperties(node.videoLink, {
605
+ ignoreEmptyArrays: ['caption'],
606
+ ignoreUndefined: ['width', 'height'],
607
+ ignoreEmptyString: ['url', /*'alt',*/ 'license', 'copyright'],
608
+ ignoreFalse: ['showInIndex'],
609
+ });
415
610
  // Validate and correct invalid bits as much as possible
416
611
  return NodeValidator.validateResource(node);
417
612
  }
@@ -426,14 +621,14 @@ class ResourceBuilder extends BaseBuilder {
426
621
  // // NOTE: Node order is important and is defined here
427
622
  // const node: StillImageFilmResource = {
428
623
  // type: ResourceTag.stillImageFilm,
429
- // typeAlias: ResourceTag.stillImageFilm,
624
+ // __typeAlias: ResourceTag.stillImageFilm,
430
625
  // image: image ?? this.imageResource({ format: '', value: '' }),
431
626
  // audio: audio ?? this.audioResource({ format: '', value: '' }),
432
627
  // };
433
628
  // // Remove Unset Optionals
434
629
  // ObjectUtils.removeUnwantedProperties(node);
435
630
  // // Validate and correct invalid bits as much as possible
436
- // return NodeValidator.validateResource(node) as StillImageFilmResource;
631
+ // return NodeValidator.validateResource(node) ;
437
632
  // }
438
633
  /**
439
634
  * Build stillImageFilmEmbedResource node
@@ -442,32 +637,41 @@ class ResourceBuilder extends BaseBuilder {
442
637
  * @returns
443
638
  */
444
639
  stillImageFilmEmbedResource(data) {
640
+ var _a, _b;
445
641
  const { value, width, height, duration, mute, autoplay, allowSubtitles, showSubtitles, alt, posterImage, thumbnails, license, copyright, showInIndex, caption, search, } = data;
446
642
  // NOTE: Node order is important and is defined here
447
643
  const node = {
448
644
  type: ResourceTag.stillImageFilmEmbed,
449
- typeAlias: ResourceTag.stillImageFilmEmbed,
450
- format: UrlUtils.fileExtensionFromUrl(value),
451
- provider: UrlUtils.domainFromUrl(value),
452
- value,
453
- width,
454
- height,
455
- duration,
456
- mute,
457
- autoplay,
458
- allowSubtitles,
459
- showSubtitles,
460
- alt,
461
- posterImage,
462
- thumbnails,
463
- license,
464
- copyright,
465
- showInIndex,
466
- caption,
467
- search,
645
+ __typeAlias: ResourceTag.stillImageFilmEmbed,
646
+ stillImageFilmEmbed: {
647
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
648
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
649
+ // src: value ?? '',
650
+ url: value !== null && value !== void 0 ? value : '',
651
+ width: (width !== null && width !== void 0 ? width : null),
652
+ height: (height !== null && height !== void 0 ? height : null),
653
+ duration: (duration !== null && duration !== void 0 ? duration : undefined),
654
+ mute: (mute !== null && mute !== void 0 ? mute : undefined),
655
+ autoplay: (autoplay !== null && autoplay !== void 0 ? autoplay : undefined),
656
+ allowSubtitles: (allowSubtitles !== null && allowSubtitles !== void 0 ? allowSubtitles : undefined),
657
+ showSubtitles: (showSubtitles !== null && showSubtitles !== void 0 ? showSubtitles : undefined),
658
+ alt: alt !== null && alt !== void 0 ? alt : '',
659
+ posterImage: (posterImage !== null && posterImage !== void 0 ? posterImage : undefined),
660
+ thumbnails: (thumbnails !== null && thumbnails !== void 0 ? thumbnails : undefined),
661
+ license: license !== null && license !== void 0 ? license : '',
662
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
663
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
664
+ caption: this.handleJsonText(caption),
665
+ search: (search !== null && search !== void 0 ? search : undefined),
666
+ },
468
667
  };
469
668
  // Remove Unset Optionals
470
- ObjectUtils.removeUnwantedProperties(node);
669
+ ObjectUtils.removeUnwantedProperties(node.stillImageFilmEmbed, {
670
+ ignoreEmptyArrays: ['caption'],
671
+ ignoreUndefined: ['width', 'height'],
672
+ ignoreEmptyString: ['url', /*'alt',*/ 'license', 'copyright'],
673
+ ignoreFalse: ['showInIndex'],
674
+ });
471
675
  // Validate and correct invalid bits as much as possible
472
676
  return NodeValidator.validateResource(node);
473
677
  }
@@ -478,32 +682,41 @@ class ResourceBuilder extends BaseBuilder {
478
682
  * @returns
479
683
  */
480
684
  stillImageFilmLinkResource(data) {
685
+ var _a, _b;
481
686
  const { value, width, height, duration, mute, autoplay, allowSubtitles, showSubtitles, alt, posterImage, thumbnails, license, copyright, showInIndex, caption, search, } = data;
482
687
  // NOTE: Node order is important and is defined here
483
688
  const node = {
484
689
  type: ResourceTag.stillImageFilmLink,
485
- typeAlias: ResourceTag.stillImageFilmLink,
486
- format: UrlUtils.fileExtensionFromUrl(value),
487
- provider: UrlUtils.domainFromUrl(value),
488
- value,
489
- width,
490
- height,
491
- duration,
492
- mute,
493
- autoplay,
494
- allowSubtitles,
495
- showSubtitles,
496
- alt,
497
- posterImage,
498
- thumbnails,
499
- license,
500
- copyright,
501
- showInIndex,
502
- caption,
503
- search,
690
+ __typeAlias: ResourceTag.stillImageFilmLink,
691
+ stillImageFilmLink: {
692
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
693
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
694
+ // src: value ?? '',
695
+ url: value !== null && value !== void 0 ? value : '',
696
+ width: (width !== null && width !== void 0 ? width : null),
697
+ height: (height !== null && height !== void 0 ? height : null),
698
+ duration: (duration !== null && duration !== void 0 ? duration : undefined),
699
+ mute: (mute !== null && mute !== void 0 ? mute : undefined),
700
+ autoplay: (autoplay !== null && autoplay !== void 0 ? autoplay : undefined),
701
+ allowSubtitles: (allowSubtitles !== null && allowSubtitles !== void 0 ? allowSubtitles : undefined),
702
+ showSubtitles: (showSubtitles !== null && showSubtitles !== void 0 ? showSubtitles : undefined),
703
+ alt: alt !== null && alt !== void 0 ? alt : '',
704
+ posterImage: (posterImage !== null && posterImage !== void 0 ? posterImage : undefined),
705
+ thumbnails: (thumbnails !== null && thumbnails !== void 0 ? thumbnails : undefined),
706
+ license: license !== null && license !== void 0 ? license : '',
707
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
708
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
709
+ caption: this.handleJsonText(caption),
710
+ search: (search !== null && search !== void 0 ? search : undefined),
711
+ },
504
712
  };
505
713
  // Remove Unset Optionals
506
- ObjectUtils.removeUnwantedProperties(node);
714
+ ObjectUtils.removeUnwantedProperties(node.stillImageFilmLink, {
715
+ ignoreEmptyArrays: ['caption'],
716
+ ignoreUndefined: ['width', 'height'],
717
+ ignoreEmptyString: ['url', /*'alt',*/ 'license', 'copyright'],
718
+ ignoreFalse: ['showInIndex'],
719
+ });
507
720
  // Validate and correct invalid bits as much as possible
508
721
  return NodeValidator.validateResource(node);
509
722
  }
@@ -514,22 +727,28 @@ class ResourceBuilder extends BaseBuilder {
514
727
  * @returns
515
728
  */
516
729
  articleResource(data) {
730
+ var _a, _b;
517
731
  const { value, license, copyright, showInIndex, caption, search } = data;
518
732
  // NOTE: Node order is important and is defined here
519
733
  const node = {
520
734
  type: ResourceTag.article,
521
- typeAlias: ResourceTag.article,
522
- format: UrlUtils.fileExtensionFromUrl(value),
523
- provider: UrlUtils.domainFromUrl(value),
524
- value,
525
- license,
526
- copyright,
527
- showInIndex,
528
- caption,
529
- search,
735
+ __typeAlias: ResourceTag.article,
736
+ article: {
737
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
738
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
739
+ body: value !== null && value !== void 0 ? value : '',
740
+ license: license !== null && license !== void 0 ? license : '',
741
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
742
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
743
+ caption: this.handleJsonText(caption),
744
+ search: (search !== null && search !== void 0 ? search : undefined),
745
+ },
530
746
  };
531
747
  // Remove Unset Optionals
532
- ObjectUtils.removeUnwantedProperties(node);
748
+ ObjectUtils.removeUnwantedProperties(node.article, {
749
+ ignoreEmptyArrays: ['caption'],
750
+ ignoreEmptyString: ['body', 'alt', 'license', 'copyright'],
751
+ });
533
752
  // Validate and correct invalid bits as much as possible
534
753
  return NodeValidator.validateResource(node);
535
754
  }
@@ -540,22 +759,29 @@ class ResourceBuilder extends BaseBuilder {
540
759
  * @returns
541
760
  */
542
761
  documentResource(data) {
762
+ var _a, _b;
543
763
  const { value, license, copyright, showInIndex, caption, search } = data;
544
764
  // NOTE: Node order is important and is defined here
545
765
  const node = {
546
766
  type: ResourceTag.document,
547
- typeAlias: ResourceTag.document,
548
- format: UrlUtils.fileExtensionFromUrl(value),
549
- provider: UrlUtils.domainFromUrl(value),
550
- value,
551
- license,
552
- copyright,
553
- showInIndex,
554
- caption,
555
- search,
767
+ __typeAlias: ResourceTag.document,
768
+ document: {
769
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
770
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
771
+ url: value !== null && value !== void 0 ? value : '',
772
+ license: license !== null && license !== void 0 ? license : '',
773
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
774
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
775
+ caption: this.handleJsonText(caption),
776
+ search: (search !== null && search !== void 0 ? search : undefined),
777
+ },
556
778
  };
557
779
  // Remove Unset Optionals
558
- ObjectUtils.removeUnwantedProperties(node);
780
+ ObjectUtils.removeUnwantedProperties(node.document, {
781
+ ignoreEmptyArrays: ['caption'],
782
+ ignoreEmptyString: ['url', 'alt', 'license', 'copyright'],
783
+ ignoreFalse: ['showInIndex'],
784
+ });
559
785
  // Validate and correct invalid bits as much as possible
560
786
  return NodeValidator.validateResource(node);
561
787
  }
@@ -566,22 +792,29 @@ class ResourceBuilder extends BaseBuilder {
566
792
  * @returns
567
793
  */
568
794
  documentEmbedResource(data) {
795
+ var _a, _b;
569
796
  const { value, license, copyright, showInIndex, caption, search } = data;
570
797
  // NOTE: Node order is important and is defined here
571
798
  const node = {
572
799
  type: ResourceTag.documentEmbed,
573
- typeAlias: ResourceTag.documentEmbed,
574
- format: UrlUtils.fileExtensionFromUrl(value),
575
- provider: UrlUtils.domainFromUrl(value),
576
- value,
577
- license,
578
- copyright,
579
- showInIndex,
580
- caption,
581
- search,
800
+ __typeAlias: ResourceTag.documentEmbed,
801
+ documentEmbed: {
802
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
803
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
804
+ url: value !== null && value !== void 0 ? value : '',
805
+ license: license !== null && license !== void 0 ? license : '',
806
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
807
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
808
+ caption: this.handleJsonText(caption),
809
+ search: (search !== null && search !== void 0 ? search : undefined),
810
+ },
582
811
  };
583
812
  // Remove Unset Optionals
584
- ObjectUtils.removeUnwantedProperties(node);
813
+ ObjectUtils.removeUnwantedProperties(node.documentEmbed, {
814
+ ignoreEmptyArrays: ['caption'],
815
+ ignoreEmptyString: ['url', 'alt', 'license', 'copyright'],
816
+ ignoreFalse: ['showInIndex'],
817
+ });
585
818
  // Validate and correct invalid bits as much as possible
586
819
  return NodeValidator.validateResource(node);
587
820
  }
@@ -592,22 +825,29 @@ class ResourceBuilder extends BaseBuilder {
592
825
  * @returns
593
826
  */
594
827
  documentLinkResource(data) {
828
+ var _a, _b;
595
829
  const { value, license, copyright, showInIndex, caption, search } = data;
596
830
  // NOTE: Node order is important and is defined here
597
831
  const node = {
598
832
  type: ResourceTag.documentLink,
599
- typeAlias: ResourceTag.documentLink,
600
- format: UrlUtils.fileExtensionFromUrl(value),
601
- provider: UrlUtils.domainFromUrl(value),
602
- value,
603
- license,
604
- copyright,
605
- showInIndex,
606
- caption,
607
- search,
833
+ __typeAlias: ResourceTag.documentLink,
834
+ documentLink: {
835
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
836
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
837
+ url: value !== null && value !== void 0 ? value : '',
838
+ license: license !== null && license !== void 0 ? license : '',
839
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
840
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
841
+ caption: this.handleJsonText(caption),
842
+ search: (search !== null && search !== void 0 ? search : undefined),
843
+ },
608
844
  };
609
845
  // Remove Unset Optionals
610
- ObjectUtils.removeUnwantedProperties(node);
846
+ ObjectUtils.removeUnwantedProperties(node.documentLink, {
847
+ ignoreEmptyArrays: ['caption'],
848
+ ignoreEmptyString: ['url', 'alt', 'license', 'copyright'],
849
+ ignoreFalse: ['showInIndex'],
850
+ });
611
851
  // Validate and correct invalid bits as much as possible
612
852
  return NodeValidator.validateResource(node);
613
853
  }
@@ -618,22 +858,29 @@ class ResourceBuilder extends BaseBuilder {
618
858
  * @returns
619
859
  */
620
860
  documentDownloadResource(data) {
861
+ var _a, _b;
621
862
  const { value, license, copyright, showInIndex, caption, search } = data;
622
863
  // NOTE: Node order is important and is defined here
623
864
  const node = {
624
865
  type: ResourceTag.documentDownload,
625
- typeAlias: ResourceTag.documentDownload,
626
- format: UrlUtils.fileExtensionFromUrl(value),
627
- provider: UrlUtils.domainFromUrl(value),
628
- value,
629
- license,
630
- copyright,
631
- showInIndex,
632
- caption,
633
- search,
866
+ __typeAlias: ResourceTag.documentDownload,
867
+ documentDownload: {
868
+ format: ((_a = UrlUtils.fileExtensionFromUrl(value)) !== null && _a !== void 0 ? _a : undefined),
869
+ provider: ((_b = UrlUtils.domainFromUrl(value)) !== null && _b !== void 0 ? _b : undefined),
870
+ url: value !== null && value !== void 0 ? value : '',
871
+ license: license !== null && license !== void 0 ? license : '',
872
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
873
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
874
+ caption: this.handleJsonText(caption),
875
+ search: (search !== null && search !== void 0 ? search : undefined),
876
+ },
634
877
  };
635
878
  // Remove Unset Optionals
636
- ObjectUtils.removeUnwantedProperties(node);
879
+ ObjectUtils.removeUnwantedProperties(node.documentDownload, {
880
+ ignoreEmptyArrays: ['caption'],
881
+ ignoreEmptyString: ['url', 'alt', 'license', 'copyright'],
882
+ ignoreFalse: ['showInIndex'],
883
+ });
637
884
  // Validate and correct invalid bits as much as possible
638
885
  return NodeValidator.validateResource(node);
639
886
  }
@@ -648,16 +895,25 @@ class ResourceBuilder extends BaseBuilder {
648
895
  // NOTE: Node order is important and is defined here
649
896
  const node = {
650
897
  type: ResourceTag.appLink,
651
- typeAlias: ResourceTag.appLink,
652
- value,
653
- license,
654
- copyright,
655
- showInIndex,
656
- caption,
657
- search,
898
+ __typeAlias: ResourceTag.appLink,
899
+ appLink: {
900
+ // format: (UrlUtils.fileExtensionFromUrl(value) ?? undefined) as string,
901
+ // provider: (UrlUtils.domainFromUrl(value) ?? undefined) as string,
902
+ provider: undefined,
903
+ url: value !== null && value !== void 0 ? value : '',
904
+ license: license !== null && license !== void 0 ? license : '',
905
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
906
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
907
+ caption: this.handleJsonText(caption),
908
+ search: (search !== null && search !== void 0 ? search : undefined),
909
+ },
658
910
  };
659
911
  // Remove Unset Optionals
660
- ObjectUtils.removeUnwantedProperties(node);
912
+ ObjectUtils.removeUnwantedProperties(node.appLink, {
913
+ ignoreEmptyArrays: ['caption'],
914
+ ignoreEmptyString: ['url', /*'alt',*/ 'license', 'copyright'],
915
+ ignoreFalse: ['showInIndex'],
916
+ });
661
917
  // Validate and correct invalid bits as much as possible
662
918
  return NodeValidator.validateResource(node);
663
919
  }
@@ -668,21 +924,29 @@ class ResourceBuilder extends BaseBuilder {
668
924
  * @returns
669
925
  */
670
926
  websiteLinkResource(data) {
671
- const { value, siteName, license, copyright, showInIndex, caption, search } = data;
927
+ const { value, /*siteName,*/ license, copyright, showInIndex, caption, search } = data;
672
928
  // NOTE: Node order is important and is defined here
673
929
  const node = {
674
930
  type: ResourceTag.websiteLink,
675
- typeAlias: ResourceTag.websiteLink,
676
- value,
677
- siteName,
678
- license,
679
- copyright,
680
- showInIndex,
681
- caption,
682
- search,
931
+ __typeAlias: ResourceTag.websiteLink,
932
+ websiteLink: {
933
+ // provider: (UrlUtils.domainFromUrl(value) ?? undefined) as string,
934
+ provider: undefined,
935
+ url: value !== null && value !== void 0 ? value : '',
936
+ // siteName,
937
+ license: license !== null && license !== void 0 ? license : '',
938
+ copyright: copyright !== null && copyright !== void 0 ? copyright : '',
939
+ showInIndex: showInIndex !== null && showInIndex !== void 0 ? showInIndex : false,
940
+ caption: this.handleJsonText(caption),
941
+ search: (search !== null && search !== void 0 ? search : undefined),
942
+ },
683
943
  };
684
944
  // Remove Unset Optionals
685
- ObjectUtils.removeUnwantedProperties(node);
945
+ ObjectUtils.removeUnwantedProperties(node.websiteLink, {
946
+ ignoreEmptyArrays: ['caption'],
947
+ ignoreEmptyString: ['url', 'alt', 'license', 'copyright'],
948
+ ignoreFalse: ['showInIndex'],
949
+ });
686
950
  // Validate and correct invalid bits as much as possible
687
951
  return NodeValidator.validateResource(node);
688
952
  }