@redneckz/wildless-cms-uni-blocks 0.14.858 → 0.14.859
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/bundle/bundle.umd.js +1 -1
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ContentPage/computeAPIFallback.d.ts +3 -0
- package/bundle/content-page-repository/ContentPageRepository.d.ts +10 -0
- package/bundle/content-page-repository/JSONDocContentBox.d.ts +8 -0
- package/bundle/content-page-repository/TransformationOptions.d.ts +4 -0
- package/bundle/content-page-repository/clearAttachmentHref.d.ts +2 -0
- package/bundle/content-page-repository/computeImgOutputPath.d.ts +3 -0
- package/bundle/content-page-repository/extensions.d.ts +3 -0
- package/bundle/content-page-repository/index.d.ts +3 -0
- package/bundle/content-page-repository/mapJSON.d.ts +1 -0
- package/bundle/content-page-repository/mergePages.d.ts +2 -0
- package/bundle/content-page-repository/replaceHeadingTags.d.ts +1 -0
- package/bundle/content-page-repository/resizeImg.d.ts +3 -0
- package/bundle/content-page-repository/transformAttachmentLink.d.ts +3 -0
- package/bundle/content-page-repository/transformContentPage.d.ts +4 -0
- package/bundle/content-page-repository/transformDocument.d.ts +3 -0
- package/bundle/content-page-repository/transformHTML.d.ts +1 -0
- package/bundle/content-page-repository/transformImg.d.ts +12 -0
- package/bundle/content-page-repository/transformMarkdown.d.ts +1 -0
- package/bundle/content-page-repository/transformPicture.d.ts +3 -0
- package/dist/components/ContentPage/computeAPIFallback.d.ts +3 -0
- package/dist/components/ContentPage/computeAPIFallback.js +22 -0
- package/dist/components/ContentPage/computeAPIFallback.js.map +1 -0
- package/dist/content-page-repository/ContentPageRepository.d.ts +10 -0
- package/dist/content-page-repository/ContentPageRepository.js +31 -0
- package/dist/content-page-repository/ContentPageRepository.js.map +1 -0
- package/dist/content-page-repository/JSONDocContentBox.d.ts +8 -0
- package/dist/content-page-repository/JSONDocContentBox.js +39 -0
- package/dist/content-page-repository/JSONDocContentBox.js.map +1 -0
- package/dist/content-page-repository/TransformationOptions.d.ts +4 -0
- package/dist/content-page-repository/TransformationOptions.js +2 -0
- package/dist/content-page-repository/TransformationOptions.js.map +1 -0
- package/dist/content-page-repository/clearAttachmentHref.d.ts +2 -0
- package/dist/content-page-repository/clearAttachmentHref.js +6 -0
- package/dist/content-page-repository/clearAttachmentHref.js.map +1 -0
- package/dist/content-page-repository/computeImgOutputPath.d.ts +3 -0
- package/dist/content-page-repository/computeImgOutputPath.js +18 -0
- package/dist/content-page-repository/computeImgOutputPath.js.map +1 -0
- package/dist/content-page-repository/extensions.d.ts +3 -0
- package/dist/content-page-repository/extensions.js +18 -0
- package/dist/content-page-repository/extensions.js.map +1 -0
- package/dist/content-page-repository/index.d.ts +3 -0
- package/dist/content-page-repository/index.js +9 -0
- package/dist/content-page-repository/index.js.map +1 -0
- package/dist/content-page-repository/mapJSON.d.ts +1 -0
- package/dist/content-page-repository/mapJSON.js +26 -0
- package/dist/content-page-repository/mapJSON.js.map +1 -0
- package/dist/content-page-repository/mergePages.d.ts +2 -0
- package/dist/content-page-repository/mergePages.js +7 -0
- package/dist/content-page-repository/mergePages.js.map +1 -0
- package/dist/content-page-repository/replaceHeadingTags.d.ts +1 -0
- package/dist/content-page-repository/replaceHeadingTags.js +5 -0
- package/dist/content-page-repository/replaceHeadingTags.js.map +1 -0
- package/dist/content-page-repository/resizeImg.d.ts +3 -0
- package/dist/content-page-repository/resizeImg.js +19 -0
- package/dist/content-page-repository/resizeImg.js.map +1 -0
- package/dist/content-page-repository/transformAttachmentLink.d.ts +3 -0
- package/dist/content-page-repository/transformAttachmentLink.js +40 -0
- package/dist/content-page-repository/transformAttachmentLink.js.map +1 -0
- package/dist/content-page-repository/transformContentPage.d.ts +4 -0
- package/dist/content-page-repository/transformContentPage.js +78 -0
- package/dist/content-page-repository/transformContentPage.js.map +1 -0
- package/dist/content-page-repository/transformDocument.d.ts +3 -0
- package/dist/content-page-repository/transformDocument.js +38 -0
- package/dist/content-page-repository/transformDocument.js.map +1 -0
- package/dist/content-page-repository/transformHTML.d.ts +1 -0
- package/dist/content-page-repository/transformHTML.js +54 -0
- package/dist/content-page-repository/transformHTML.js.map +1 -0
- package/dist/content-page-repository/transformImg.d.ts +12 -0
- package/dist/content-page-repository/transformImg.js +51 -0
- package/dist/content-page-repository/transformImg.js.map +1 -0
- package/dist/content-page-repository/transformMarkdown.d.ts +1 -0
- package/dist/content-page-repository/transformMarkdown.js +18 -0
- package/dist/content-page-repository/transformMarkdown.js.map +1 -0
- package/dist/content-page-repository/transformPicture.d.ts +3 -0
- package/dist/content-page-repository/transformPicture.js +28 -0
- package/dist/content-page-repository/transformPicture.js.map +1 -0
- package/lib/components/ContentPage/computeAPIFallback.d.ts +3 -0
- package/lib/components/ContentPage/computeAPIFallback.js +19 -0
- package/lib/components/ContentPage/computeAPIFallback.js.map +1 -0
- package/lib/content-page-repository/ContentPageRepository.d.ts +10 -0
- package/lib/content-page-repository/ContentPageRepository.js +25 -0
- package/lib/content-page-repository/ContentPageRepository.js.map +1 -0
- package/lib/content-page-repository/JSONDocContentBox.d.ts +8 -0
- package/lib/content-page-repository/JSONDocContentBox.js +36 -0
- package/lib/content-page-repository/JSONDocContentBox.js.map +1 -0
- package/lib/content-page-repository/TransformationOptions.d.ts +4 -0
- package/lib/content-page-repository/TransformationOptions.js +2 -0
- package/lib/content-page-repository/TransformationOptions.js.map +1 -0
- package/lib/content-page-repository/clearAttachmentHref.d.ts +2 -0
- package/lib/content-page-repository/clearAttachmentHref.js +3 -0
- package/lib/content-page-repository/clearAttachmentHref.js.map +1 -0
- package/lib/content-page-repository/computeImgOutputPath.d.ts +3 -0
- package/lib/content-page-repository/computeImgOutputPath.js +12 -0
- package/lib/content-page-repository/computeImgOutputPath.js.map +1 -0
- package/lib/content-page-repository/extensions.d.ts +3 -0
- package/lib/content-page-repository/extensions.js +16 -0
- package/lib/content-page-repository/extensions.js.map +1 -0
- package/lib/content-page-repository/index.d.ts +3 -0
- package/lib/content-page-repository/index.js +4 -0
- package/lib/content-page-repository/index.js.map +1 -0
- package/lib/content-page-repository/mapJSON.d.ts +1 -0
- package/lib/content-page-repository/mapJSON.js +23 -0
- package/lib/content-page-repository/mapJSON.js.map +1 -0
- package/lib/content-page-repository/mergePages.d.ts +2 -0
- package/lib/content-page-repository/mergePages.js +4 -0
- package/lib/content-page-repository/mergePages.js.map +1 -0
- package/lib/content-page-repository/replaceHeadingTags.d.ts +1 -0
- package/lib/content-page-repository/replaceHeadingTags.js +2 -0
- package/lib/content-page-repository/replaceHeadingTags.js.map +1 -0
- package/lib/content-page-repository/resizeImg.d.ts +3 -0
- package/lib/content-page-repository/resizeImg.js +13 -0
- package/lib/content-page-repository/resizeImg.js.map +1 -0
- package/lib/content-page-repository/transformAttachmentLink.d.ts +3 -0
- package/lib/content-page-repository/transformAttachmentLink.js +34 -0
- package/lib/content-page-repository/transformAttachmentLink.js.map +1 -0
- package/lib/content-page-repository/transformContentPage.d.ts +4 -0
- package/lib/content-page-repository/transformContentPage.js +71 -0
- package/lib/content-page-repository/transformContentPage.js.map +1 -0
- package/lib/content-page-repository/transformDocument.d.ts +3 -0
- package/lib/content-page-repository/transformDocument.js +32 -0
- package/lib/content-page-repository/transformDocument.js.map +1 -0
- package/lib/content-page-repository/transformHTML.d.ts +1 -0
- package/lib/content-page-repository/transformHTML.js +25 -0
- package/lib/content-page-repository/transformHTML.js.map +1 -0
- package/lib/content-page-repository/transformImg.d.ts +12 -0
- package/lib/content-page-repository/transformImg.js +45 -0
- package/lib/content-page-repository/transformImg.js.map +1 -0
- package/lib/content-page-repository/transformMarkdown.d.ts +1 -0
- package/lib/content-page-repository/transformMarkdown.js +12 -0
- package/lib/content-page-repository/transformMarkdown.js.map +1 -0
- package/lib/content-page-repository/transformPicture.d.ts +3 -0
- package/lib/content-page-repository/transformPicture.js +22 -0
- package/lib/content-page-repository/transformPicture.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +1 -1
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ContentPage/computeAPIFallback.d.ts +3 -0
- package/mobile/bundle/content-page-repository/ContentPageRepository.d.ts +10 -0
- package/mobile/bundle/content-page-repository/JSONDocContentBox.d.ts +8 -0
- package/mobile/bundle/content-page-repository/TransformationOptions.d.ts +4 -0
- package/mobile/bundle/content-page-repository/clearAttachmentHref.d.ts +2 -0
- package/mobile/bundle/content-page-repository/computeImgOutputPath.d.ts +3 -0
- package/mobile/bundle/content-page-repository/extensions.d.ts +3 -0
- package/mobile/bundle/content-page-repository/index.d.ts +3 -0
- package/mobile/bundle/content-page-repository/mapJSON.d.ts +1 -0
- package/mobile/bundle/content-page-repository/mergePages.d.ts +2 -0
- package/mobile/bundle/content-page-repository/replaceHeadingTags.d.ts +1 -0
- package/mobile/bundle/content-page-repository/resizeImg.d.ts +3 -0
- package/mobile/bundle/content-page-repository/transformAttachmentLink.d.ts +3 -0
- package/mobile/bundle/content-page-repository/transformContentPage.d.ts +4 -0
- package/mobile/bundle/content-page-repository/transformDocument.d.ts +3 -0
- package/mobile/bundle/content-page-repository/transformHTML.d.ts +1 -0
- package/mobile/bundle/content-page-repository/transformImg.d.ts +12 -0
- package/mobile/bundle/content-page-repository/transformMarkdown.d.ts +1 -0
- package/mobile/bundle/content-page-repository/transformPicture.d.ts +3 -0
- package/mobile/dist/components/ContentPage/computeAPIFallback.d.ts +3 -0
- package/mobile/dist/components/ContentPage/computeAPIFallback.js +22 -0
- package/mobile/dist/components/ContentPage/computeAPIFallback.js.map +1 -0
- package/mobile/dist/content-page-repository/ContentPageRepository.d.ts +10 -0
- package/mobile/dist/content-page-repository/ContentPageRepository.js +31 -0
- package/mobile/dist/content-page-repository/ContentPageRepository.js.map +1 -0
- package/mobile/dist/content-page-repository/JSONDocContentBox.d.ts +8 -0
- package/mobile/dist/content-page-repository/JSONDocContentBox.js +39 -0
- package/mobile/dist/content-page-repository/JSONDocContentBox.js.map +1 -0
- package/mobile/dist/content-page-repository/TransformationOptions.d.ts +4 -0
- package/mobile/dist/content-page-repository/TransformationOptions.js +2 -0
- package/mobile/dist/content-page-repository/TransformationOptions.js.map +1 -0
- package/mobile/dist/content-page-repository/clearAttachmentHref.d.ts +2 -0
- package/mobile/dist/content-page-repository/clearAttachmentHref.js +6 -0
- package/mobile/dist/content-page-repository/clearAttachmentHref.js.map +1 -0
- package/mobile/dist/content-page-repository/computeImgOutputPath.d.ts +3 -0
- package/mobile/dist/content-page-repository/computeImgOutputPath.js +18 -0
- package/mobile/dist/content-page-repository/computeImgOutputPath.js.map +1 -0
- package/mobile/dist/content-page-repository/extensions.d.ts +3 -0
- package/mobile/dist/content-page-repository/extensions.js +18 -0
- package/mobile/dist/content-page-repository/extensions.js.map +1 -0
- package/mobile/dist/content-page-repository/index.d.ts +3 -0
- package/mobile/dist/content-page-repository/index.js +9 -0
- package/mobile/dist/content-page-repository/index.js.map +1 -0
- package/mobile/dist/content-page-repository/mapJSON.d.ts +1 -0
- package/mobile/dist/content-page-repository/mapJSON.js +26 -0
- package/mobile/dist/content-page-repository/mapJSON.js.map +1 -0
- package/mobile/dist/content-page-repository/mergePages.d.ts +2 -0
- package/mobile/dist/content-page-repository/mergePages.js +7 -0
- package/mobile/dist/content-page-repository/mergePages.js.map +1 -0
- package/mobile/dist/content-page-repository/replaceHeadingTags.d.ts +1 -0
- package/mobile/dist/content-page-repository/replaceHeadingTags.js +5 -0
- package/mobile/dist/content-page-repository/replaceHeadingTags.js.map +1 -0
- package/mobile/dist/content-page-repository/resizeImg.d.ts +3 -0
- package/mobile/dist/content-page-repository/resizeImg.js +19 -0
- package/mobile/dist/content-page-repository/resizeImg.js.map +1 -0
- package/mobile/dist/content-page-repository/transformAttachmentLink.d.ts +3 -0
- package/mobile/dist/content-page-repository/transformAttachmentLink.js +40 -0
- package/mobile/dist/content-page-repository/transformAttachmentLink.js.map +1 -0
- package/mobile/dist/content-page-repository/transformContentPage.d.ts +4 -0
- package/mobile/dist/content-page-repository/transformContentPage.js +78 -0
- package/mobile/dist/content-page-repository/transformContentPage.js.map +1 -0
- package/mobile/dist/content-page-repository/transformDocument.d.ts +3 -0
- package/mobile/dist/content-page-repository/transformDocument.js +38 -0
- package/mobile/dist/content-page-repository/transformDocument.js.map +1 -0
- package/mobile/dist/content-page-repository/transformHTML.d.ts +1 -0
- package/mobile/dist/content-page-repository/transformHTML.js +54 -0
- package/mobile/dist/content-page-repository/transformHTML.js.map +1 -0
- package/mobile/dist/content-page-repository/transformImg.d.ts +12 -0
- package/mobile/dist/content-page-repository/transformImg.js +51 -0
- package/mobile/dist/content-page-repository/transformImg.js.map +1 -0
- package/mobile/dist/content-page-repository/transformMarkdown.d.ts +1 -0
- package/mobile/dist/content-page-repository/transformMarkdown.js +18 -0
- package/mobile/dist/content-page-repository/transformMarkdown.js.map +1 -0
- package/mobile/dist/content-page-repository/transformPicture.d.ts +3 -0
- package/mobile/dist/content-page-repository/transformPicture.js +28 -0
- package/mobile/dist/content-page-repository/transformPicture.js.map +1 -0
- package/mobile/lib/components/ContentPage/computeAPIFallback.d.ts +3 -0
- package/mobile/lib/components/ContentPage/computeAPIFallback.js +19 -0
- package/mobile/lib/components/ContentPage/computeAPIFallback.js.map +1 -0
- package/mobile/lib/content-page-repository/ContentPageRepository.d.ts +10 -0
- package/mobile/lib/content-page-repository/ContentPageRepository.js +25 -0
- package/mobile/lib/content-page-repository/ContentPageRepository.js.map +1 -0
- package/mobile/lib/content-page-repository/JSONDocContentBox.d.ts +8 -0
- package/mobile/lib/content-page-repository/JSONDocContentBox.js +36 -0
- package/mobile/lib/content-page-repository/JSONDocContentBox.js.map +1 -0
- package/mobile/lib/content-page-repository/TransformationOptions.d.ts +4 -0
- package/mobile/lib/content-page-repository/TransformationOptions.js +2 -0
- package/mobile/lib/content-page-repository/TransformationOptions.js.map +1 -0
- package/mobile/lib/content-page-repository/clearAttachmentHref.d.ts +2 -0
- package/mobile/lib/content-page-repository/clearAttachmentHref.js +3 -0
- package/mobile/lib/content-page-repository/clearAttachmentHref.js.map +1 -0
- package/mobile/lib/content-page-repository/computeImgOutputPath.d.ts +3 -0
- package/mobile/lib/content-page-repository/computeImgOutputPath.js +12 -0
- package/mobile/lib/content-page-repository/computeImgOutputPath.js.map +1 -0
- package/mobile/lib/content-page-repository/extensions.d.ts +3 -0
- package/mobile/lib/content-page-repository/extensions.js +16 -0
- package/mobile/lib/content-page-repository/extensions.js.map +1 -0
- package/mobile/lib/content-page-repository/index.d.ts +3 -0
- package/mobile/lib/content-page-repository/index.js +4 -0
- package/mobile/lib/content-page-repository/index.js.map +1 -0
- package/mobile/lib/content-page-repository/mapJSON.d.ts +1 -0
- package/mobile/lib/content-page-repository/mapJSON.js +23 -0
- package/mobile/lib/content-page-repository/mapJSON.js.map +1 -0
- package/mobile/lib/content-page-repository/mergePages.d.ts +2 -0
- package/mobile/lib/content-page-repository/mergePages.js +4 -0
- package/mobile/lib/content-page-repository/mergePages.js.map +1 -0
- package/mobile/lib/content-page-repository/replaceHeadingTags.d.ts +1 -0
- package/mobile/lib/content-page-repository/replaceHeadingTags.js +2 -0
- package/mobile/lib/content-page-repository/replaceHeadingTags.js.map +1 -0
- package/mobile/lib/content-page-repository/resizeImg.d.ts +3 -0
- package/mobile/lib/content-page-repository/resizeImg.js +13 -0
- package/mobile/lib/content-page-repository/resizeImg.js.map +1 -0
- package/mobile/lib/content-page-repository/transformAttachmentLink.d.ts +3 -0
- package/mobile/lib/content-page-repository/transformAttachmentLink.js +34 -0
- package/mobile/lib/content-page-repository/transformAttachmentLink.js.map +1 -0
- package/mobile/lib/content-page-repository/transformContentPage.d.ts +4 -0
- package/mobile/lib/content-page-repository/transformContentPage.js +71 -0
- package/mobile/lib/content-page-repository/transformContentPage.js.map +1 -0
- package/mobile/lib/content-page-repository/transformDocument.d.ts +3 -0
- package/mobile/lib/content-page-repository/transformDocument.js +32 -0
- package/mobile/lib/content-page-repository/transformDocument.js.map +1 -0
- package/mobile/lib/content-page-repository/transformHTML.d.ts +1 -0
- package/mobile/lib/content-page-repository/transformHTML.js +25 -0
- package/mobile/lib/content-page-repository/transformHTML.js.map +1 -0
- package/mobile/lib/content-page-repository/transformImg.d.ts +12 -0
- package/mobile/lib/content-page-repository/transformImg.js +45 -0
- package/mobile/lib/content-page-repository/transformImg.js.map +1 -0
- package/mobile/lib/content-page-repository/transformMarkdown.d.ts +1 -0
- package/mobile/lib/content-page-repository/transformMarkdown.js +12 -0
- package/mobile/lib/content-page-repository/transformMarkdown.js.map +1 -0
- package/mobile/lib/content-page-repository/transformPicture.d.ts +3 -0
- package/mobile/lib/content-page-repository/transformPicture.js +22 -0
- package/mobile/lib/content-page-repository/transformPicture.js.map +1 -0
- package/mobile/src/components/ContentPage/computeAPIFallback.ts +35 -0
- package/mobile/src/content-page-repository/ContentPageRepository.ts +31 -0
- package/mobile/src/content-page-repository/JSONDocContentBox.ts +56 -0
- package/mobile/src/content-page-repository/TransformationOptions.ts +4 -0
- package/mobile/src/content-page-repository/clearAttachmentHref.ts +3 -0
- package/mobile/src/content-page-repository/computeImgOutputPath.ts +21 -0
- package/mobile/src/content-page-repository/extensions.ts +17 -0
- package/mobile/src/content-page-repository/index.ts +3 -0
- package/mobile/src/content-page-repository/mapJSON.ts +30 -0
- package/mobile/src/content-page-repository/mergePages.ts +8 -0
- package/mobile/src/content-page-repository/replaceHeadingTags.ts +2 -0
- package/mobile/src/content-page-repository/resizeImg.ts +17 -0
- package/mobile/src/content-page-repository/transformAttachmentLink.ts +46 -0
- package/mobile/src/content-page-repository/transformContentPage.ts +102 -0
- package/mobile/src/content-page-repository/transformDocument.ts +43 -0
- package/mobile/src/content-page-repository/transformHTML.ts +28 -0
- package/mobile/src/content-page-repository/transformImg.ts +81 -0
- package/mobile/src/content-page-repository/transformMarkdown.ts +14 -0
- package/mobile/src/content-page-repository/transformPicture.ts +35 -0
- package/package.json +21 -1
- package/src/components/ContentPage/computeAPIFallback.ts +35 -0
- package/src/content-page-repository/ContentPageRepository.ts +31 -0
- package/src/content-page-repository/JSONDocContentBox.ts +56 -0
- package/src/content-page-repository/TransformationOptions.ts +4 -0
- package/src/content-page-repository/clearAttachmentHref.ts +3 -0
- package/src/content-page-repository/computeImgOutputPath.ts +21 -0
- package/src/content-page-repository/extensions.ts +17 -0
- package/src/content-page-repository/index.ts +3 -0
- package/src/content-page-repository/mapJSON.ts +30 -0
- package/src/content-page-repository/mergePages.ts +8 -0
- package/src/content-page-repository/replaceHeadingTags.ts +2 -0
- package/src/content-page-repository/resizeImg.ts +17 -0
- package/src/content-page-repository/transformAttachmentLink.ts +46 -0
- package/src/content-page-repository/transformContentPage.ts +102 -0
- package/src/content-page-repository/transformDocument.ts +43 -0
- package/src/content-page-repository/transformHTML.ts +28 -0
- package/src/content-page-repository/transformImg.ts +81 -0
- package/src/content-page-repository/transformMarkdown.ts +14 -0
- package/src/content-page-repository/transformPicture.ts +35 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ContentPageDef } from '../model/ContentPageDef';
|
|
2
|
+
import { type TransformationOptions } from './TransformationOptions';
|
|
3
|
+
export declare class ContentPageRepository {
|
|
4
|
+
private readonly options;
|
|
5
|
+
static readonly inst: ContentPageRepository;
|
|
6
|
+
constructor(options?: TransformationOptions);
|
|
7
|
+
listAllContentPages(): Promise<string[]>;
|
|
8
|
+
readPage(filePath: string): Promise<ContentPageDef>;
|
|
9
|
+
generatePage(filePath: string): Promise<ContentPageDef>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JSONBoxDefault, type JSONBox, type JSONNode } from '@redneckz/json-op';
|
|
2
|
+
import { type JSONPathElement } from '@redneckz/json-op/lib/JSONPath';
|
|
3
|
+
export declare class JSONDocContentBox extends JSONBoxDefault {
|
|
4
|
+
size(): number;
|
|
5
|
+
entries(): Array<[p: JSONPathElement, child: JSONBox]>;
|
|
6
|
+
get(p?: JSONPathElement): JSONBox;
|
|
7
|
+
set(p: JSONPathElement | undefined, child: JSONNode): JSONBox;
|
|
8
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type ImgSource } from '../model/Picture';
|
|
2
|
+
import { type TransformationOptions } from './TransformationOptions';
|
|
3
|
+
export declare function computeImgOutputPath(imgInputPath: string, { contentDir, publicDir, format, size }: TransformationOptions & ImgSource, withoutTransform?: boolean): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mapJSON<T>(data: T, mapper: <In, Out = In>(value: In, key: string[]) => Promise<Out>, keyParts?: string[]): Promise<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const replaceHeadingTags: (html: string) => string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ContentPageDef } from '../model/ContentPageDef';
|
|
2
|
+
import { type TransformationOptions } from './TransformationOptions';
|
|
3
|
+
export declare function transformContentPage(pagePath: string, options: TransformationOptions): Promise<ContentPageDef>;
|
|
4
|
+
export declare const generatedPagePath: (pagePath: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function transformHTML(html: string | null | undefined): Promise<string>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ImageSize } from '../model/ImageSize';
|
|
2
|
+
import { type ImgSource } from '../model/Picture';
|
|
3
|
+
import { type TransformationOptions } from './TransformationOptions';
|
|
4
|
+
declare type ImgOutputPath = string;
|
|
5
|
+
declare type TransformationTaskKey = ImgOutputPath;
|
|
6
|
+
declare type TransformationTasksCache = Map<TransformationTaskKey, Promise<ImgOutputPath>>;
|
|
7
|
+
declare type TransformImgOptions = TransformationOptions & ImgSource & {
|
|
8
|
+
containerSize?: ImageSize;
|
|
9
|
+
cache?: TransformationTasksCache;
|
|
10
|
+
};
|
|
11
|
+
export declare function transformImg(src: string, pagePath: string, options: TransformImgOptions): ImgOutputPath | Promise<ImgOutputPath>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function transformMarkdown(markdown: string | null | undefined): Promise<string>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.computeAPIFallback = void 0;
|
|
3
|
+
const json_ref_1 = require("@redneckz/json-ref");
|
|
4
|
+
const ContentPageRepository_1 = require("../../content-page-repository/ContentPageRepository");
|
|
5
|
+
const unique_1 = require("../../utils/unique");
|
|
6
|
+
const url_1 = require("../../utils/url");
|
|
7
|
+
const BASE_DIR = 'content';
|
|
8
|
+
const computeAPIFallback = async (contentPageData) => {
|
|
9
|
+
return Object.fromEntries((await computeFallbackFromContentRefs(contentPageData)).filter(([key, data]) => key && data));
|
|
10
|
+
};
|
|
11
|
+
exports.computeAPIFallback = computeAPIFallback;
|
|
12
|
+
const computeFallbackFromContentRefs = async (contentPageData) => {
|
|
13
|
+
const refs = (0, unique_1.unique)((0, json_ref_1.collectRef)(contentPageData));
|
|
14
|
+
return (await Promise.allSettled(refs.map(async (_) => [
|
|
15
|
+
_,
|
|
16
|
+
(await ContentPageRepository_1.ContentPageRepository.inst.generatePage((0, url_1.joinPath)(BASE_DIR, _))),
|
|
17
|
+
])))
|
|
18
|
+
.filter((_) => _.status === 'fulfilled')
|
|
19
|
+
.map(({ value }) => value)
|
|
20
|
+
.map(([ref, data]) => [ref, (0, json_ref_1.resolveJPointer)(data, ref)]);
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=computeAPIFallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeAPIFallback.js","sourceRoot":"","sources":["../../../src/components/ContentPage/computeAPIFallback.ts"],"names":[],"mappings":";;AACA,iDAAiE;AACjE,+FAA4F;AAG5F,+CAA4C;AAC5C,yCAA2C;AAI3C,MAAM,QAAQ,GAAG,SAAS,CAAC;AAEpB,MAAM,kBAAkB,GAAG,KAAK,EAAE,eAA+B,EAAqB,EAAE;IAC7F,OAAO,MAAM,CAAC,WAAW,CACvB,CAAC,MAAM,8BAA8B,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,IAAI,CAAC,CAC7F,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,kBAAkB,sBAI7B;AAEF,MAAM,8BAA8B,GAAG,KAAK,EAC1C,eAA+B,EACL,EAAE;IAC5B,MAAM,IAAI,GAAG,IAAA,eAAM,EAAC,IAAA,qBAAU,EAAC,eAA2B,CAAC,CAAC,CAAC;IAE7D,OAAO,CACL,MAAM,OAAO,CAAC,UAAU,CACtB,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;QACpB,CAAC;QACD,CAAC,MAAM,6CAAqB,CAAC,IAAI,CAAC,YAAY,CAAC,IAAA,cAAQ,EAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAa;KACnF,CAAC,CACH,CACF;SACE,MAAM,CAAC,CAAC,CAAC,EAA8C,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,WAAW,CAAC;SACnF,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC;SACzB,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,IAAA,0BAAe,EAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7D,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ContentPageDef } from '../model/ContentPageDef';
|
|
2
|
+
import { type TransformationOptions } from './TransformationOptions';
|
|
3
|
+
export declare class ContentPageRepository {
|
|
4
|
+
private readonly options;
|
|
5
|
+
static readonly inst: ContentPageRepository;
|
|
6
|
+
constructor(options?: TransformationOptions);
|
|
7
|
+
listAllContentPages(): Promise<string[]>;
|
|
8
|
+
readPage(filePath: string): Promise<ContentPageDef>;
|
|
9
|
+
generatePage(filePath: string): Promise<ContentPageDef>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3
|
+
};
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.ContentPageRepository = void 0;
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const glob_1 = require("glob");
|
|
8
|
+
const util_1 = __importDefault(require("util"));
|
|
9
|
+
const transformContentPage_1 = require("./transformContentPage");
|
|
10
|
+
const readFile = util_1.default.promisify(fs_1.default.readFile);
|
|
11
|
+
class ContentPageRepository {
|
|
12
|
+
options;
|
|
13
|
+
static inst = new ContentPageRepository();
|
|
14
|
+
constructor(options = {
|
|
15
|
+
contentDir: 'content',
|
|
16
|
+
publicDir: 'public',
|
|
17
|
+
}) {
|
|
18
|
+
this.options = options;
|
|
19
|
+
}
|
|
20
|
+
listAllContentPages() {
|
|
21
|
+
return (0, glob_1.glob)(`${this.options.contentDir}/**/*.page.json`, { posix: true });
|
|
22
|
+
}
|
|
23
|
+
async readPage(filePath) {
|
|
24
|
+
return JSON.parse(await readFile((0, transformContentPage_1.generatedPagePath)(filePath), 'utf-8'));
|
|
25
|
+
}
|
|
26
|
+
generatePage(filePath) {
|
|
27
|
+
return (0, transformContentPage_1.transformContentPage)(filePath, this.options);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.ContentPageRepository = ContentPageRepository;
|
|
31
|
+
//# sourceMappingURL=ContentPageRepository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPageRepository.js","sourceRoot":"","sources":["../../src/content-page-repository/ContentPageRepository.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,+BAA4B;AAC5B,gDAAwB;AAGxB,iEAAiF;AAEjF,MAAM,QAAQ,GAAG,cAAI,CAAC,SAAS,CAAC,YAAE,CAAC,QAAQ,CAAC,CAAC;AAE7C,MAAa,qBAAqB;IAIb;IAHZ,MAAM,CAAU,IAAI,GAAG,IAAI,qBAAqB,EAAE,CAAC;IAE1D,YACmB,UAAiC;QAChD,UAAU,EAAE,SAAS;QACrB,SAAS,EAAE,QAAQ;KACpB;QAHgB,YAAO,GAAP,OAAO,CAGvB;IACA,CAAC;IAEJ,mBAAmB;QACjB,OAAO,IAAA,WAAI,EAAC,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,iBAAiB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,QAAgB;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAA,wCAAiB,EAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,YAAY,CAAC,QAAgB;QAC3B,OAAO,IAAA,2CAAoB,EAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;;AApBH,sDAqBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { JSONBoxDefault, type JSONBox, type JSONNode } from '@redneckz/json-op';
|
|
2
|
+
import { type JSONPathElement } from '@redneckz/json-op/lib/JSONPath';
|
|
3
|
+
export declare class JSONDocContentBox extends JSONBoxDefault {
|
|
4
|
+
size(): number;
|
|
5
|
+
entries(): Array<[p: JSONPathElement, child: JSONBox]>;
|
|
6
|
+
get(p?: JSONPathElement): JSONBox;
|
|
7
|
+
set(p: JSONPathElement | undefined, child: JSONNode): JSONBox;
|
|
8
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.JSONDocContentBox = void 0;
|
|
3
|
+
const json_op_1 = require("@redneckz/json-op");
|
|
4
|
+
const isAtomicArray = (node) => (0, json_op_1.isJSONArray)(node) && !node.some(nodeId);
|
|
5
|
+
const ID_PREFIX = 'id:';
|
|
6
|
+
const nodeId = (node) => (0, json_op_1.isJSONRecord)(node) && '__id' in node ? node.__id : undefined;
|
|
7
|
+
const keyToId = (p) => typeof p === 'string' && p.startsWith(ID_PREFIX) ? p.substring(ID_PREFIX.length) : undefined;
|
|
8
|
+
const findIndexById = (_, id) => id && (0, json_op_1.isJSONArray)(_) ? _.findIndex((node) => id === nodeId(node)) : -1;
|
|
9
|
+
class JSONDocContentBox extends json_op_1.JSONBoxDefault {
|
|
10
|
+
size() {
|
|
11
|
+
return isAtomicArray(this._) ? 0 : super.size();
|
|
12
|
+
}
|
|
13
|
+
entries() {
|
|
14
|
+
if (isAtomicArray(this._)) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
else if ((0, json_op_1.isJSONArray)(this._)) {
|
|
18
|
+
return this._.map((node, i) => [
|
|
19
|
+
nodeId(node) ? `${ID_PREFIX}${nodeId(node)}` : i,
|
|
20
|
+
new JSONDocContentBox(node),
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return super.entries();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
get(p) {
|
|
28
|
+
const id = keyToId(p);
|
|
29
|
+
return super.get(id ? findIndexById(this._, id) : p);
|
|
30
|
+
}
|
|
31
|
+
set(p, child) {
|
|
32
|
+
const id = keyToId(p);
|
|
33
|
+
const index = findIndexById(this._, id);
|
|
34
|
+
const adjustedIndex = index >= 0 ? index : this.size();
|
|
35
|
+
return super.set(id ? adjustedIndex : p, id ? { ...child, __id: id } : child);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.JSONDocContentBox = JSONDocContentBox;
|
|
39
|
+
//# sourceMappingURL=JSONDocContentBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSONDocContentBox.js","sourceRoot":"","sources":["../../src/content-page-repository/JSONDocContentBox.ts"],"names":[],"mappings":";;AAAA,+CAO2B;AAG3B,MAAM,aAAa,GAAG,CAAC,IAA0B,EAAW,EAAE,CAC5D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IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;gBAChD,IAAI,iBAAiB,CAAC,IAAI,CAAC;aAC5B,CAAC,CAAC;SACJ;aAAM;YACL,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;SACxB;IACH,CAAC;IAED,GAAG,CAAC,CAAmB;QACrB,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAEtB,OAAO,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC;IAED,GAAG,CAAC,CAA8B,EAAE,KAAe;QACjD,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACtB,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACxC,MAAM,aAAa,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QAEvD,OAAO,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAI,KAAoB,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAChG,CAAC;CACF;AA/BD,8CA+BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransformationOptions.js","sourceRoot":"","sources":["../../src/content-page-repository/TransformationOptions.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.clearAttachmentHref = exports.ATTACHMENT_PREFIX = void 0;
|
|
3
|
+
exports.ATTACHMENT_PREFIX = 'file://';
|
|
4
|
+
const clearAttachmentHref = (href) => href.replace(exports.ATTACHMENT_PREFIX, '');
|
|
5
|
+
exports.clearAttachmentHref = clearAttachmentHref;
|
|
6
|
+
//# sourceMappingURL=clearAttachmentHref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clearAttachmentHref.js","sourceRoot":"","sources":["../../src/content-page-repository/clearAttachmentHref.ts"],"names":[],"mappings":";;AAAa,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAEpC,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAiB,EAAE,EAAE,CAAC,CAAC;AAApF,QAAA,mBAAmB,uBAAiE"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type ImgSource } from '../model/Picture';
|
|
2
|
+
import { type TransformationOptions } from './TransformationOptions';
|
|
3
|
+
export declare function computeImgOutputPath(imgInputPath: string, { contentDir, publicDir, format, size }: TransformationOptions & ImgSource, withoutTransform?: boolean): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3
|
+
};
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.computeImgOutputPath = void 0;
|
|
6
|
+
const path_1 = __importDefault(require("path"));
|
|
7
|
+
function computeImgOutputPath(imgInputPath, { contentDir, publicDir, format, size }, withoutTransform = false) {
|
|
8
|
+
const imgRelativePath = path_1.default.relative(contentDir, imgInputPath);
|
|
9
|
+
const imgDir = path_1.default.dirname(imgRelativePath);
|
|
10
|
+
const inputExt = path_1.default.extname(imgRelativePath);
|
|
11
|
+
const fileName = path_1.default.basename(imgRelativePath, inputExt);
|
|
12
|
+
const suffixParts = [size?.width, size?.height].filter(Boolean);
|
|
13
|
+
const suffix = suffixParts.length && !withoutTransform ? `-${suffixParts.join('-')}` : '';
|
|
14
|
+
const ext = format && !withoutTransform ? `.${format}` : inputExt;
|
|
15
|
+
return path_1.default.join(publicDir, imgDir, `${fileName}${suffix}${ext}`);
|
|
16
|
+
}
|
|
17
|
+
exports.computeImgOutputPath = computeImgOutputPath;
|
|
18
|
+
//# sourceMappingURL=computeImgOutputPath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"computeImgOutputPath.js","sourceRoot":"","sources":["../../src/content-page-repository/computeImgOutputPath.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AAIxB,SAAgB,oBAAoB,CAClC,YAAoB,EACpB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAqC,EAC1E,gBAAgB,GAAG,KAAK;IAExB,MAAM,eAAe,GAAG,cAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAEhE,MAAM,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAE7C,MAAM,QAAQ,GAAG,cAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,cAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;IAC1D,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAChE,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1F,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;IAElE,OAAO,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,QAAQ,GAAG,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC;AACpE,CAAC;AAhBD,oDAgBC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.IMAGE_EXT_LIST = exports.DOCUMENT_EXT_LIST = exports.OUTPUT_SUFFIX = void 0;
|
|
3
|
+
exports.OUTPUT_SUFFIX = '.static';
|
|
4
|
+
exports.DOCUMENT_EXT_LIST = [
|
|
5
|
+
'.txt',
|
|
6
|
+
'.doc',
|
|
7
|
+
'.docx',
|
|
8
|
+
'.xls',
|
|
9
|
+
'.xlsx',
|
|
10
|
+
'.xlsb',
|
|
11
|
+
'.ppt',
|
|
12
|
+
'.pptx',
|
|
13
|
+
'.pdf',
|
|
14
|
+
'.zip',
|
|
15
|
+
'.7z',
|
|
16
|
+
];
|
|
17
|
+
exports.IMAGE_EXT_LIST = ['.jpeg', '.jpg', '.png', '.gif', '.webp', '.heif', '.avif', '.svg'];
|
|
18
|
+
//# sourceMappingURL=extensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extensions.js","sourceRoot":"","sources":["../../src/content-page-repository/extensions.ts"],"names":[],"mappings":";;AAAa,QAAA,aAAa,GAAG,SAAS,CAAC;AAE1B,QAAA,iBAAiB,GAAG;IAC/B,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,KAAK;CACN,CAAC;AAEW,QAAA,cAAc,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.transformContentPage = exports.ContentPageRepository = exports.clearAttachmentHref = void 0;
|
|
3
|
+
var clearAttachmentHref_1 = require("./clearAttachmentHref");
|
|
4
|
+
Object.defineProperty(exports, "clearAttachmentHref", { enumerable: true, get: function () { return clearAttachmentHref_1.clearAttachmentHref; } });
|
|
5
|
+
var ContentPageRepository_1 = require("./ContentPageRepository");
|
|
6
|
+
Object.defineProperty(exports, "ContentPageRepository", { enumerable: true, get: function () { return ContentPageRepository_1.ContentPageRepository; } });
|
|
7
|
+
var transformContentPage_1 = require("./transformContentPage");
|
|
8
|
+
Object.defineProperty(exports, "transformContentPage", { enumerable: true, get: function () { return transformContentPage_1.transformContentPage; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/content-page-repository/index.ts"],"names":[],"mappings":";;AAAA,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mapJSON<T>(data: T, mapper: <In, Out = In>(value: In, key: string[]) => Promise<Out>, keyParts?: string[]): Promise<T>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.mapJSON = void 0;
|
|
3
|
+
async function mapJSON(data, mapper, keyParts = []) {
|
|
4
|
+
if (data === null || data === undefined) {
|
|
5
|
+
return data;
|
|
6
|
+
}
|
|
7
|
+
const mappedData = await mapper(data, keyParts);
|
|
8
|
+
if (mappedData !== data) {
|
|
9
|
+
return mappedData;
|
|
10
|
+
}
|
|
11
|
+
if (Array.isArray(data)) {
|
|
12
|
+
const values = data.map((_, i) => mapJSON(_, mapper, [String(i)].concat(keyParts)));
|
|
13
|
+
return Promise.all(values);
|
|
14
|
+
}
|
|
15
|
+
else if (typeof data === 'object' && data.toString() === '[object Object]') {
|
|
16
|
+
const subKeys = Object.keys(data);
|
|
17
|
+
const values = subKeys.map((k) => mapJSON(data[k], mapper, [k].concat(keyParts)));
|
|
18
|
+
const pairs = (await Promise.all(values)).map((_, i) => ({
|
|
19
|
+
[subKeys[i]]: _,
|
|
20
|
+
}));
|
|
21
|
+
return Object.assign({}, ...pairs);
|
|
22
|
+
}
|
|
23
|
+
return mapper(data, keyParts);
|
|
24
|
+
}
|
|
25
|
+
exports.mapJSON = mapJSON;
|
|
26
|
+
//# sourceMappingURL=mapJSON.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapJSON.js","sourceRoot":"","sources":["../../src/content-page-repository/mapJSON.ts"],"names":[],"mappings":";;AAAO,KAAK,UAAU,OAAO,CAC3B,IAAO,EACP,MAAgE,EAChE,WAAqB,EAAE;IAEvB,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE;QACvC,OAAO,IAAI,CAAC;KACb;IAED,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAChD,IAAI,UAAU,KAAK,IAAI,EAAE;QACvB,OAAO,UAAe,CAAC;KACxB;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACvB,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAEpF,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAQ,CAAC;KACnC;SAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAK,IAAY,CAAC,QAAQ,EAAE,KAAK,iBAAiB,EAAE;QACrF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAClF,MAAM,KAAK,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACvD,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAChB,CAAC,CAAC,CAAC;QAEJ,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC;KACpC;IAED,OAAO,MAAM,CAAI,IAAI,EAAE,QAAQ,CAAC,CAAC;AACnC,CAAC;AA7BD,0BA6BC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.mergePages = void 0;
|
|
3
|
+
const json_op_1 = require("@redneckz/json-op");
|
|
4
|
+
const JSONDocContentBox_1 = require("./JSONDocContentBox");
|
|
5
|
+
const mergePages = (page, diffs) => (0, json_op_1.merge)(new JSONDocContentBox_1.JSONDocContentBox(page), (0, json_op_1.leafs)(new JSONDocContentBox_1.JSONDocContentBox(diffs)));
|
|
6
|
+
exports.mergePages = mergePages;
|
|
7
|
+
//# sourceMappingURL=mergePages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergePages.js","sourceRoot":"","sources":["../../src/content-page-repository/mergePages.ts"],"names":[],"mappings":";;AAAA,+CAAkE;AAClE,2DAAwD;AAEjD,MAAM,UAAU,GAAG,CAAC,IAAgB,EAAE,KAAiB,EAAc,EAAE,CAC5E,IAAA,eAAK,EACH,IAAI,qCAAiB,CAAC,IAAkB,CAAC,EACzC,IAAA,eAAK,EAAC,IAAI,qCAAiB,CAAC,KAAmB,CAAC,CAAC,CACpC,CAAC;AAJL,QAAA,UAAU,cAIL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const replaceHeadingTags: (html: string) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.replaceHeadingTags = void 0;
|
|
3
|
+
const replaceHeadingTags = (html) => html.replaceAll(/<h(\d)>(.*?)<\/h\d>/g, '<p class="h$1">$2</p>');
|
|
4
|
+
exports.replaceHeadingTags = replaceHeadingTags;
|
|
5
|
+
//# sourceMappingURL=replaceHeadingTags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replaceHeadingTags.js","sourceRoot":"","sources":["../../src/content-page-repository/replaceHeadingTags.ts"],"names":[],"mappings":";;AAAO,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,EAAE,CACjD,IAAI,CAAC,UAAU,CAAC,sBAAsB,EAAE,uBAAuB,CAAC,CAAC;AADtD,QAAA,kBAAkB,sBACoC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3
|
+
};
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.resizeImg = void 0;
|
|
6
|
+
const sharp_1 = __importDefault(require("sharp"));
|
|
7
|
+
const resizeImg = (size, options) => (chain) => size
|
|
8
|
+
? chain.resize(size.width || null, size.height || null, {
|
|
9
|
+
/*
|
|
10
|
+
* Editor behaviour with one dimension present: resize by given dimension maintaining aspect ratio. (fit: contain)
|
|
11
|
+
* With two dimensions present: resize trying to fill given dimensions (fit: fill)
|
|
12
|
+
*/
|
|
13
|
+
fit: size.width && size.height ? sharp_1.default.fit.fill : sharp_1.default.fit.contain,
|
|
14
|
+
background: { r: 0, g: 0, b: 0, alpha: 0 },
|
|
15
|
+
...options,
|
|
16
|
+
})
|
|
17
|
+
: chain;
|
|
18
|
+
exports.resizeImg = resizeImg;
|
|
19
|
+
//# sourceMappingURL=resizeImg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizeImg.js","sourceRoot":"","sources":["../../src/content-page-repository/resizeImg.ts"],"names":[],"mappings":";;;;;AAAA,kDAA8D;AAGvD,MAAM,SAAS,GACpB,CAAC,IAAyB,EAAE,OAAuB,EAAE,EAAE,CACvD,CAAC,KAAY,EAAS,EAAE,CACtB,IAAI;IACF,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE;QACpD;;;WAGG;QACH,GAAG,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,OAAO;QACnE,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;QAC1C,GAAG,OAAO;KACX,CAAC;IACJ,CAAC,CAAC,KAAK,CAAC;AAbD,QAAA,SAAS,aAaR"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3
|
+
};
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.transformAttachmentLink = void 0;
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const util_1 = __importDefault(require("util"));
|
|
9
|
+
const isUUID_1 = require("../utils/isUUID");
|
|
10
|
+
const clearAttachmentHref_1 = require("./clearAttachmentHref");
|
|
11
|
+
const mkdir = util_1.default.promisify(fs_1.default.mkdir);
|
|
12
|
+
const copyFile = util_1.default.promisify(fs_1.default.copyFile);
|
|
13
|
+
async function transformAttachmentLink(link, pagePath, options) {
|
|
14
|
+
if (!link?.href) {
|
|
15
|
+
return link;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
return {
|
|
19
|
+
...link,
|
|
20
|
+
href: await transformHref((0, clearAttachmentHref_1.clearAttachmentHref)(link.href), options),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
console.info(`No "${link.href}" attachment found on page: "${pagePath}"`);
|
|
25
|
+
return link;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.transformAttachmentLink = transformAttachmentLink;
|
|
29
|
+
async function transformHref(input, options) {
|
|
30
|
+
if ((0, isUUID_1.isUUID)(input)) {
|
|
31
|
+
return input;
|
|
32
|
+
}
|
|
33
|
+
const { contentDir, publicDir } = options;
|
|
34
|
+
const docRelativePath = path_1.default.relative(contentDir, input);
|
|
35
|
+
const output = path_1.default.join(publicDir, docRelativePath);
|
|
36
|
+
await mkdir(path_1.default.dirname(output), { recursive: true });
|
|
37
|
+
await copyFile(input, output);
|
|
38
|
+
return path_1.default.join('/', docRelativePath);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=transformAttachmentLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformAttachmentLink.js","sourceRoot":"","sources":["../../src/content-page-repository/transformAttachmentLink.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,gDAAwB;AAExB,4CAAyC;AACzC,+DAA4D;AAG5D,MAAM,KAAK,GAAG,cAAI,CAAC,SAAS,CAAC,YAAE,CAAC,KAAK,CAAC,CAAC;AACvC,MAAM,QAAQ,GAAG,cAAI,CAAC,SAAS,CAAC,YAAE,CAAC,QAAQ,CAAC,CAAC;AAEtC,KAAK,UAAU,uBAAuB,CAC3C,IAAe,EACf,QAAgB,EAChB,OAA8B;IAE9B,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE;QACf,OAAO,IAAI,CAAC;KACb;IAED,IAAI;QACF,OAAO;YACL,GAAG,IAAI;YACP,IAAI,EAAE,MAAM,aAAa,CAAC,IAAA,yCAAmB,EAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;SACnE,CAAC;KACH;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,gCAAgC,QAAQ,GAAG,CAAC,CAAC;QAE1E,OAAO,IAAI,CAAC;KACb;AACH,CAAC;AAnBD,0DAmBC;AAED,KAAK,UAAU,aAAa,CAAC,KAAa,EAAE,OAA8B;IACxE,IAAI,IAAA,eAAM,EAAC,KAAK,CAAC,EAAE;QACjB,OAAO,KAAK,CAAC;KACd;IAED,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IAC1C,MAAM,eAAe,GAAG,cAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IAErD,MAAM,KAAK,CAAC,cAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,MAAM,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAE9B,OAAO,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ContentPageDef } from '../model/ContentPageDef';
|
|
2
|
+
import { type TransformationOptions } from './TransformationOptions';
|
|
3
|
+
export declare function transformContentPage(pagePath: string, options: TransformationOptions): Promise<ContentPageDef>;
|
|
4
|
+
export declare const generatedPagePath: (pagePath: string) => string;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
2
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3
|
+
};
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.generatedPagePath = exports.transformContentPage = void 0;
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const util_1 = __importDefault(require("util"));
|
|
8
|
+
const isUUID_1 = require("../utils/isUUID");
|
|
9
|
+
const tableFunc_1 = require("../utils/tableFunc");
|
|
10
|
+
const clearAttachmentHref_1 = require("./clearAttachmentHref");
|
|
11
|
+
const extensions_1 = require("./extensions");
|
|
12
|
+
const mapJSON_1 = require("./mapJSON");
|
|
13
|
+
const mergePages_1 = require("./mergePages");
|
|
14
|
+
const transformAttachmentLink_1 = require("./transformAttachmentLink");
|
|
15
|
+
const transformDocument_1 = require("./transformDocument");
|
|
16
|
+
const transformHTML_1 = require("./transformHTML");
|
|
17
|
+
const transformMarkdown_1 = require("./transformMarkdown");
|
|
18
|
+
const transformPicture_1 = require("./transformPicture");
|
|
19
|
+
const readFile = util_1.default.promisify(fs_1.default.readFile);
|
|
20
|
+
const writeFile = util_1.default.promisify(fs_1.default.writeFile);
|
|
21
|
+
const DEFAULT_PARENT_CONTENT = {};
|
|
22
|
+
async function transformContentPage(pagePath, options) {
|
|
23
|
+
const content = JSON.parse(await readFile(pagePath, 'utf8'));
|
|
24
|
+
const parentContent = await (content?._extends
|
|
25
|
+
? JSON.parse(await readFile(content._extends, 'utf-8'))
|
|
26
|
+
: DEFAULT_PARENT_CONTENT);
|
|
27
|
+
const mergedContent = (0, mergePages_1.mergePages)(parentContent, content);
|
|
28
|
+
const result = await (0, mapJSON_1.mapJSON)(mergedContent, async (value, [key]) => {
|
|
29
|
+
try {
|
|
30
|
+
return await transform([value, key])(value, pagePath, options);
|
|
31
|
+
}
|
|
32
|
+
catch (ex) {
|
|
33
|
+
console.warn(`Error while transforming field "${key}" on page: ${pagePath}`);
|
|
34
|
+
console.error(ex);
|
|
35
|
+
}
|
|
36
|
+
return value;
|
|
37
|
+
});
|
|
38
|
+
await writeFile((0, exports.generatedPagePath)(pagePath), JSON.stringify(result), 'utf-8');
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
exports.transformContentPage = transformContentPage;
|
|
42
|
+
const transform = (0, tableFunc_1.tableFunc)([
|
|
43
|
+
[([value, key]) => isMarkdown(key, value), async (value) => (0, transformMarkdown_1.transformMarkdown)(value)],
|
|
44
|
+
[([value, key]) => isHTML(key, value), async (value) => (0, transformHTML_1.transformHTML)(value)],
|
|
45
|
+
[([value]) => (0, isUUID_1.isUUID)(value?.src), async (value) => ({ src: value?.src })],
|
|
46
|
+
[
|
|
47
|
+
([value]) => isAttachmentLink(value),
|
|
48
|
+
async (value, pagePath, options) => (0, transformAttachmentLink_1.transformAttachmentLink)(value, pagePath, options),
|
|
49
|
+
],
|
|
50
|
+
[
|
|
51
|
+
([value]) => isAttachmentFile(value, extensions_1.DOCUMENT_EXT_LIST),
|
|
52
|
+
async (value, pagePath, options) => (0, transformDocument_1.transformDocument)(value, pagePath, options),
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
([value]) => isAttachmentFile(value, extensions_1.IMAGE_EXT_LIST),
|
|
56
|
+
async (value, pagePath, options) => (0, transformPicture_1.transformPicture)(value, pagePath, options),
|
|
57
|
+
],
|
|
58
|
+
[() => true, async (value) => value],
|
|
59
|
+
]);
|
|
60
|
+
const generatedPagePath = (pagePath) => `${pagePath}${extensions_1.OUTPUT_SUFFIX}`;
|
|
61
|
+
exports.generatedPagePath = generatedPagePath;
|
|
62
|
+
const isMarkdown = (key, value) => isString(value) && key?.endsWith('__md');
|
|
63
|
+
const isHTML = (key, value) => isString(value) && key?.endsWith('__html');
|
|
64
|
+
const isAttachmentLink = (_) => isLocalPath(_?.href) && (_.href.startsWith(clearAttachmentHref_1.ATTACHMENT_PREFIX) || isLocalFile(_.href));
|
|
65
|
+
const isAttachmentFile = (_, exts) => Boolean(_ && isLocalPath(_?.src)) && exts.some((ext) => _.src.toLowerCase().endsWith(ext));
|
|
66
|
+
const isLocalPath = (_) => isString(_) && _.length < 1024 && !isURL(_);
|
|
67
|
+
const isURL = (src) => ['data:', 'https:', 'http:'].some((proto) => src.startsWith(proto));
|
|
68
|
+
const isString = (_) => Boolean(_ && typeof _ === 'string');
|
|
69
|
+
const isLocalFile = (_) => isString(_) && isFileExists(_);
|
|
70
|
+
const isFileExists = (_) => {
|
|
71
|
+
try {
|
|
72
|
+
return fs_1.default.statSync(_).isFile();
|
|
73
|
+
}
|
|
74
|
+
catch (ex) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=transformContentPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformContentPage.js","sourceRoot":"","sources":["../../src/content-page-repository/transformContentPage.ts"],"names":[],"mappings":";;;;;AACA,4CAAoB;AACpB,gDAAwB;AAKxB,4CAAyC;AACzC,kDAA+C;AAC/C,+DAA0D;AAC1D,6CAAgF;AAChF,uCAAoC;AACpC,6CAA0C;AAE1C,uEAAoE;AACpE,2DAAwD;AACxD,mDAAgD;AAChD,2DAAwD;AACxD,yDAAsD;AAEtD,MAAM,QAAQ,GAAG,cAAI,CAAC,SAAS,CAAC,YAAE,CAAC,QAAQ,CAAC,CAAC;AAC7C,MAAM,SAAS,GAAG,cAAI,CAAC,SAAS,CAAC,YAAE,CAAC,SAAS,CAAC,CAAC;AAE/C,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAE3B,KAAK,UAAU,oBAAoB,CACxC,QAAgB,EAChB,OAA8B;IAE9B,MAAM,OAAO,GAAe,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IACzE,MAAM,aA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