@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
|
@@ -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,
|
|
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
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
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
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
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
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
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
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
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
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
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
|
-
//
|
|
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)
|
|
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
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
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
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
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
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
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
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
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
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
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
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
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
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
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
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
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
|
|
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
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
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
|
}
|