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