@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.
- package/dist/browser/bitmark-parser-generator.min.js +1 -1
- package/dist/browser/bundle-report.html +2 -2
- package/dist/cjs/BitmarkParserGenerator.js +8 -3
- package/dist/cjs/BitmarkParserGenerator.js.map +1 -1
- package/dist/cjs/ast/Ast.js +1 -0
- package/dist/cjs/ast/Ast.js.map +1 -1
- package/dist/cjs/ast/BaseBuilder.js +91 -54
- package/dist/cjs/ast/BaseBuilder.js.map +1 -1
- package/dist/cjs/ast/Builder.js +776 -389
- package/dist/cjs/ast/Builder.js.map +1 -1
- package/dist/cjs/ast/ResourceBuilder.js +516 -252
- package/dist/cjs/ast/ResourceBuilder.js.map +1 -1
- package/dist/cjs/ast/rules/NodeValidator.js +61 -22
- package/dist/cjs/ast/rules/NodeValidator.js.map +1 -1
- package/dist/cjs/breakscaping/Breakscape.js +96 -71
- package/dist/cjs/breakscaping/Breakscape.js.map +1 -1
- package/dist/cjs/config/raw/bits.js +14 -5
- package/dist/cjs/config/raw/bits.js.map +1 -1
- package/dist/cjs/config/raw/properties.js +7 -2
- package/dist/cjs/config/raw/properties.js.map +1 -1
- package/dist/cjs/generated/build-info.js +1 -1
- package/dist/cjs/generated/build-info.js.map +1 -1
- package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js +1 -0
- package/dist/cjs/generated/parser/bitmark/bitmark-peggy-parser.js.map +1 -1
- package/dist/cjs/generator/AstWalkerGenerator.js +4 -1
- package/dist/cjs/generator/AstWalkerGenerator.js.map +1 -1
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js +959 -338
- package/dist/cjs/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/cjs/generator/json/JsonGenerator.js +308 -1982
- package/dist/cjs/generator/json/JsonGenerator.js.map +1 -1
- package/dist/cjs/generator/text/TextGenerator.js +26 -8
- package/dist/cjs/generator/text/TextGenerator.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/ast/NodeType.js +27 -8
- package/dist/cjs/model/ast/NodeType.js.map +1 -1
- package/dist/cjs/model/config/enum/PropertyConfigKey.js +1 -0
- package/dist/cjs/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/cjs/model/enum/BitType.js +1 -2
- package/dist/cjs/model/enum/BitType.js.map +1 -1
- package/dist/cjs/model/enum/PropertyFormat.js +3 -1
- package/dist/cjs/model/enum/PropertyFormat.js.map +1 -1
- package/dist/cjs/model/enum/TextFormat.js +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js +9 -3
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserHelper.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js +49 -131
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js +7 -31
- package/dist/cjs/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +255 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +2 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +175 -129
- package/dist/cjs/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +8 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +61 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +1 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +11 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +21 -17
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +50 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -0
- package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +2 -15
- package/dist/cjs/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -4
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +4 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +2 -4
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +5 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +5 -6
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +23 -7
- package/dist/cjs/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +5 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +3 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +19 -8
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +4 -6
- package/dist/cjs/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +4 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +14 -5
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +37 -21
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +3 -2
- package/dist/cjs/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/cjs/parser/json/JsonParser.js +73 -765
- package/dist/cjs/parser/json/JsonParser.js.map +1 -1
- package/dist/cjs/parser/text/TextParser.js +61 -2
- package/dist/cjs/parser/text/TextParser.js.map +1 -1
- package/dist/cjs/utils/BitUtils.js +15 -13
- package/dist/cjs/utils/BitUtils.js.map +1 -1
- package/dist/esm/BitmarkParserGenerator.js +8 -3
- package/dist/esm/BitmarkParserGenerator.js.map +1 -1
- package/dist/esm/ast/Ast.js +1 -0
- package/dist/esm/ast/Ast.js.map +1 -1
- package/dist/esm/ast/BaseBuilder.js +91 -54
- package/dist/esm/ast/BaseBuilder.js.map +1 -1
- package/dist/esm/ast/Builder.js +776 -389
- package/dist/esm/ast/Builder.js.map +1 -1
- package/dist/esm/ast/ResourceBuilder.js +516 -252
- package/dist/esm/ast/ResourceBuilder.js.map +1 -1
- package/dist/esm/ast/rules/NodeValidator.js +61 -22
- package/dist/esm/ast/rules/NodeValidator.js.map +1 -1
- package/dist/esm/breakscaping/Breakscape.js +96 -71
- package/dist/esm/breakscaping/Breakscape.js.map +1 -1
- package/dist/esm/config/raw/bits.js +14 -5
- package/dist/esm/config/raw/bits.js.map +1 -1
- package/dist/esm/config/raw/properties.js +7 -2
- package/dist/esm/config/raw/properties.js.map +1 -1
- package/dist/esm/generated/build-info.js +1 -1
- package/dist/esm/generated/build-info.js.map +1 -1
- package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js +1 -0
- package/dist/esm/generated/parser/bitmark/bitmark-peggy-parser.js.map +1 -1
- package/dist/esm/generator/AstWalkerGenerator.js +4 -1
- package/dist/esm/generator/AstWalkerGenerator.js.map +1 -1
- package/dist/esm/generator/bitmark/BitmarkGenerator.js +959 -338
- package/dist/esm/generator/bitmark/BitmarkGenerator.js.map +1 -1
- package/dist/esm/generator/json/JsonGenerator.js +308 -1982
- package/dist/esm/generator/json/JsonGenerator.js.map +1 -1
- package/dist/esm/generator/text/TextGenerator.js +26 -8
- package/dist/esm/generator/text/TextGenerator.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/ast/NodeType.js +27 -8
- package/dist/esm/model/ast/NodeType.js.map +1 -1
- package/dist/esm/model/config/enum/PropertyConfigKey.js +1 -0
- package/dist/esm/model/config/enum/PropertyConfigKey.js.map +1 -1
- package/dist/esm/model/enum/BitType.js +1 -2
- package/dist/esm/model/enum/BitType.js.map +1 -1
- package/dist/esm/model/enum/PropertyFormat.js +3 -1
- package/dist/esm/model/enum/PropertyFormat.js.map +1 -1
- package/dist/esm/model/enum/TextFormat.js +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js +9 -3
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserHelper.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js +49 -131
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserTypes.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js +7 -31
- package/dist/esm/parser/bitmark/peg/BitmarkPegParserValidator.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js +252 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/BodyContentProcessor.js.map +1 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js +2 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js +175 -129
- package/dist/esm/parser/bitmark/peg/contentProcessors/CardContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js +8 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js +58 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.js.map +1 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js +11 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js +21 -17
- package/dist/esm/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js +47 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/FooterContentProcessor.js.map +1 -0
- package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js +2 -15
- package/dist/esm/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js +2 -4
- package/dist/esm/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js +4 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js +2 -4
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js +5 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js +5 -6
- package/dist/esm/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js +23 -7
- package/dist/esm/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js +5 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js +3 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js +19 -8
- package/dist/esm/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js +4 -6
- package/dist/esm/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js +4 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js +14 -5
- package/dist/esm/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js +37 -21
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.js.map +1 -1
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js +3 -2
- package/dist/esm/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.js.map +1 -1
- package/dist/esm/parser/json/JsonParser.js +73 -765
- package/dist/esm/parser/json/JsonParser.js.map +1 -1
- package/dist/esm/parser/text/TextParser.js +61 -2
- package/dist/esm/parser/text/TextParser.js.map +1 -1
- package/dist/esm/utils/BitUtils.js +15 -13
- package/dist/esm/utils/BitUtils.js.map +1 -1
- package/dist/types/BitmarkParserGenerator.d.ts +8 -0
- package/dist/types/BitmarkParserGenerator.d.ts.map +1 -1
- package/dist/types/ast/Ast.d.ts.map +1 -1
- package/dist/types/ast/BaseBuilder.d.ts +31 -21
- package/dist/types/ast/BaseBuilder.d.ts.map +1 -1
- package/dist/types/ast/Builder.d.ts +279 -441
- package/dist/types/ast/Builder.d.ts.map +1 -1
- package/dist/types/ast/ResourceBuilder.d.ts +177 -164
- package/dist/types/ast/ResourceBuilder.d.ts.map +1 -1
- package/dist/types/ast/rules/NodeValidator.d.ts +3 -2
- package/dist/types/ast/rules/NodeValidator.d.ts.map +1 -1
- package/dist/types/breakscaping/Breakscape.d.ts +6 -5
- package/dist/types/breakscaping/Breakscape.d.ts.map +1 -1
- package/dist/types/config/raw/bits.d.ts.map +1 -1
- package/dist/types/config/raw/properties.d.ts.map +1 -1
- package/dist/types/generated/parser/bitmark/bitmark-peggy-parser.d.ts.map +1 -1
- package/dist/types/generator/AstWalkerGenerator.d.ts.map +1 -1
- package/dist/types/generator/bitmark/BitmarkGenerator.d.ts +89 -55
- package/dist/types/generator/bitmark/BitmarkGenerator.d.ts.map +1 -1
- package/dist/types/generator/json/JsonGenerator.d.ts +88 -108
- package/dist/types/generator/json/JsonGenerator.d.ts.map +1 -1
- package/dist/types/generator/text/TextGenerator.d.ts +14 -2
- package/dist/types/generator/text/TextGenerator.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/model/ast/NodeType.d.ts +48 -16
- package/dist/types/model/ast/NodeType.d.ts.map +1 -1
- package/dist/types/model/ast/Nodes.d.ts +64 -440
- package/dist/types/model/ast/Nodes.d.ts.map +1 -1
- package/dist/types/model/config/enum/ConfigKey.d.ts +2 -0
- package/dist/types/model/config/enum/ConfigKey.d.ts.map +1 -1
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts +3 -0
- package/dist/types/model/config/enum/PropertyConfigKey.d.ts.map +1 -1
- package/dist/types/model/enum/BitType.d.ts +2 -4
- package/dist/types/model/enum/BitType.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyFormat.d.ts +4 -2
- package/dist/types/model/enum/PropertyFormat.d.ts.map +1 -1
- package/dist/types/model/enum/PropertyTag.d.ts +2 -0
- package/dist/types/model/enum/PropertyTag.d.ts.map +1 -1
- package/dist/types/model/json/BitJson.d.ts +32 -20
- package/dist/types/model/json/BitJson.d.ts.map +1 -1
- package/dist/types/model/json/BodyBitJson.d.ts +16 -12
- package/dist/types/model/json/BodyBitJson.d.ts.map +1 -1
- package/dist/types/model/json/ResourceJson.d.ts +2 -22
- package/dist/types/model/json/ResourceJson.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts +3 -2
- package/dist/types/parser/bitmark/peg/BitmarkPegParserHelper.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts +2 -15
- package/dist/types/parser/bitmark/peg/BitmarkPegParserProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts +83 -71
- package/dist/types/parser/bitmark/peg/BitmarkPegParserTypes.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/BitmarkPegParserValidator.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts +37 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/BodyContentProcessor.d.ts.map +1 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/BookChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/CardContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ClozeTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts +15 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/ContentProcessorUtils.d.ts.map +1 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/DefaultTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ExampleTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts +16 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/FooterContentProcessor.d.ts.map +1 -0
- package/dist/types/parser/bitmark/peg/contentProcessors/GapChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ImageSourceChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ItemLeadTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/MarkConfigChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PersonChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/PropertyContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/RatingLevelChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ReferenceTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts +2 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/ResourceContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/ServingsChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TechnicalTermChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts +5 -2
- package/dist/types/parser/bitmark/peg/contentProcessors/TitleTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseChainContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/bitmark/peg/contentProcessors/TrueFalseTagContentProcessor.d.ts.map +1 -1
- package/dist/types/parser/json/JsonParser.d.ts +9 -72
- package/dist/types/parser/json/JsonParser.d.ts.map +1 -1
- package/dist/types/parser/text/TextParser.d.ts +16 -1
- package/dist/types/parser/text/TextParser.d.ts.map +1 -1
- package/dist/types/utils/BitUtils.d.ts +8 -8
- package/dist/types/utils/BitUtils.d.ts.map +1 -1
- 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,
|
|
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
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
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
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
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
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
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
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
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
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
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
|
-
//
|
|
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)
|
|
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
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
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
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
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
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
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
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
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
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
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
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
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
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
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
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
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
|
|
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
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
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
|
}
|