@okf/ootils 1.21.6 → 1.22.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.d.mts +47 -1
- package/dist/browser.d.ts +47 -1
- package/dist/browser.js +82 -0
- package/dist/browser.mjs +78 -0
- package/dist/node.d.mts +59 -6
- package/dist/node.d.ts +59 -6
- package/dist/node.js +89 -0
- package/dist/node.mjs +85 -0
- package/dist/universal.d.mts +47 -1
- package/dist/universal.d.ts +47 -1
- package/dist/universal.js +82 -0
- package/dist/universal.mjs +78 -0
- package/package.json +1 -1
package/dist/browser.d.mts
CHANGED
|
@@ -749,4 +749,50 @@ interface MergeParams {
|
|
|
749
749
|
*/
|
|
750
750
|
declare const mergeAnnoDataIntoAnnotationsTags: ({ prevObj, newLexValue, thisBlockValuePath, author, }: MergeParams) => any;
|
|
751
751
|
|
|
752
|
-
|
|
752
|
+
declare const parseSpecialConfigSyntax: ({ config, content, returnUndefinedIfReplacementWordNotFound }: {
|
|
753
|
+
config: string | object;
|
|
754
|
+
content: Record<string, any>;
|
|
755
|
+
returnUndefinedIfReplacementWordNotFound?: boolean;
|
|
756
|
+
}) => any;
|
|
757
|
+
|
|
758
|
+
declare const getRoutePathToPublishedContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, scrollIntoViewElemId, }: {
|
|
759
|
+
contentType: string;
|
|
760
|
+
contentId: string;
|
|
761
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
762
|
+
enable?: boolean;
|
|
763
|
+
contentPageRelated?: {
|
|
764
|
+
linkToPublishedPage?: string;
|
|
765
|
+
[key: string]: any;
|
|
766
|
+
};
|
|
767
|
+
[key: string]: any;
|
|
768
|
+
};
|
|
769
|
+
scrollIntoViewElemId?: string;
|
|
770
|
+
}) => string;
|
|
771
|
+
|
|
772
|
+
declare const getRoutePathToEditContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, }: {
|
|
773
|
+
contentType: string;
|
|
774
|
+
contentId: string;
|
|
775
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
776
|
+
enable?: boolean;
|
|
777
|
+
contentPageRelated?: {
|
|
778
|
+
linkToEdit?: string;
|
|
779
|
+
[key: string]: any;
|
|
780
|
+
};
|
|
781
|
+
[key: string]: any;
|
|
782
|
+
};
|
|
783
|
+
}) => string;
|
|
784
|
+
|
|
785
|
+
declare const getRoutePathToModerateContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, }: {
|
|
786
|
+
contentType: string;
|
|
787
|
+
contentId: string;
|
|
788
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
789
|
+
enable?: boolean;
|
|
790
|
+
contentPageRelated?: {
|
|
791
|
+
linkToModerate?: string;
|
|
792
|
+
[key: string]: any;
|
|
793
|
+
};
|
|
794
|
+
[key: string]: any;
|
|
795
|
+
};
|
|
796
|
+
}) => string;
|
|
797
|
+
|
|
798
|
+
export { BASE_BULLMQ_CONFIG, deleteVal, extractAllBlocksFromTpl, genTagId, getPlatformContextContent, getRollupPossibilities, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToPublishedContent, getVal, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
package/dist/browser.d.ts
CHANGED
|
@@ -749,4 +749,50 @@ interface MergeParams {
|
|
|
749
749
|
*/
|
|
750
750
|
declare const mergeAnnoDataIntoAnnotationsTags: ({ prevObj, newLexValue, thisBlockValuePath, author, }: MergeParams) => any;
|
|
751
751
|
|
|
752
|
-
|
|
752
|
+
declare const parseSpecialConfigSyntax: ({ config, content, returnUndefinedIfReplacementWordNotFound }: {
|
|
753
|
+
config: string | object;
|
|
754
|
+
content: Record<string, any>;
|
|
755
|
+
returnUndefinedIfReplacementWordNotFound?: boolean;
|
|
756
|
+
}) => any;
|
|
757
|
+
|
|
758
|
+
declare const getRoutePathToPublishedContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, scrollIntoViewElemId, }: {
|
|
759
|
+
contentType: string;
|
|
760
|
+
contentId: string;
|
|
761
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
762
|
+
enable?: boolean;
|
|
763
|
+
contentPageRelated?: {
|
|
764
|
+
linkToPublishedPage?: string;
|
|
765
|
+
[key: string]: any;
|
|
766
|
+
};
|
|
767
|
+
[key: string]: any;
|
|
768
|
+
};
|
|
769
|
+
scrollIntoViewElemId?: string;
|
|
770
|
+
}) => string;
|
|
771
|
+
|
|
772
|
+
declare const getRoutePathToEditContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, }: {
|
|
773
|
+
contentType: string;
|
|
774
|
+
contentId: string;
|
|
775
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
776
|
+
enable?: boolean;
|
|
777
|
+
contentPageRelated?: {
|
|
778
|
+
linkToEdit?: string;
|
|
779
|
+
[key: string]: any;
|
|
780
|
+
};
|
|
781
|
+
[key: string]: any;
|
|
782
|
+
};
|
|
783
|
+
}) => string;
|
|
784
|
+
|
|
785
|
+
declare const getRoutePathToModerateContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, }: {
|
|
786
|
+
contentType: string;
|
|
787
|
+
contentId: string;
|
|
788
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
789
|
+
enable?: boolean;
|
|
790
|
+
contentPageRelated?: {
|
|
791
|
+
linkToModerate?: string;
|
|
792
|
+
[key: string]: any;
|
|
793
|
+
};
|
|
794
|
+
[key: string]: any;
|
|
795
|
+
};
|
|
796
|
+
}) => string;
|
|
797
|
+
|
|
798
|
+
export { BASE_BULLMQ_CONFIG, deleteVal, extractAllBlocksFromTpl, genTagId, getPlatformContextContent, getRollupPossibilities, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToPublishedContent, getVal, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
package/dist/browser.js
CHANGED
|
@@ -26,8 +26,12 @@ __export(browser_exports, {
|
|
|
26
26
|
genTagId: () => genTagId,
|
|
27
27
|
getPlatformContextContent: () => getPlatformContextContent,
|
|
28
28
|
getRollupPossibilities: () => getRollupPossibilities,
|
|
29
|
+
getRoutePathToEditContent: () => getRoutePathToEditContent,
|
|
30
|
+
getRoutePathToModerateContent: () => getRoutePathToModerateContent,
|
|
31
|
+
getRoutePathToPublishedContent: () => getRoutePathToPublishedContent,
|
|
29
32
|
getVal: () => getVal,
|
|
30
33
|
mergeAnnoDataIntoAnnotationsTags: () => mergeAnnoDataIntoAnnotationsTags,
|
|
34
|
+
parseSpecialConfigSyntax: () => parseSpecialConfigSyntax,
|
|
31
35
|
recursivelyExtractBlocks: () => _recursExtractBlocks,
|
|
32
36
|
segrigateDocs: () => segrigateDocs,
|
|
33
37
|
setVal: () => setVal,
|
|
@@ -850,6 +854,80 @@ var mergeAnnoDataIntoAnnotationsTags = ({
|
|
|
850
854
|
});
|
|
851
855
|
return newConsolidated;
|
|
852
856
|
};
|
|
857
|
+
|
|
858
|
+
// src/utils/parseSpecialConfigSyntax.ts
|
|
859
|
+
var parseSpecialConfigSyntax = ({
|
|
860
|
+
config,
|
|
861
|
+
// can be string or JSON
|
|
862
|
+
content,
|
|
863
|
+
returnUndefinedIfReplacementWordNotFound = false
|
|
864
|
+
}) => {
|
|
865
|
+
let filterConfigString = typeof config === "string" ? config : JSON.stringify(config);
|
|
866
|
+
filterConfigString = parseDynamicValuePaths({ filterConfigString, content });
|
|
867
|
+
if (filterConfigString === "replacement-word-not-found" && returnUndefinedIfReplacementWordNotFound) {
|
|
868
|
+
return void 0;
|
|
869
|
+
}
|
|
870
|
+
return typeof config === "string" ? filterConfigString : JSON.parse(filterConfigString);
|
|
871
|
+
};
|
|
872
|
+
var parseDynamicValuePaths = ({ filterConfigString, content }) => {
|
|
873
|
+
let valPathRegex = /\$valuePath\(.*?\)/g;
|
|
874
|
+
let valPathMatch = filterConfigString.match(valPathRegex);
|
|
875
|
+
if (!valPathMatch) return filterConfigString;
|
|
876
|
+
let toReturn = filterConfigString;
|
|
877
|
+
for (let singleMatch of valPathMatch) {
|
|
878
|
+
let actualValPath = singleMatch.replace("$valuePath(", "");
|
|
879
|
+
actualValPath = actualValPath.replace(")", "");
|
|
880
|
+
let replacementWord = getVal(content, actualValPath);
|
|
881
|
+
if (replacementWord === void 0) {
|
|
882
|
+
return "replacement-word-not-found";
|
|
883
|
+
}
|
|
884
|
+
if (Array.isArray(replacementWord)) {
|
|
885
|
+
replacementWord = '["' + replacementWord.join('", "') + '"]';
|
|
886
|
+
toReturn = toReturn.replace('"' + singleMatch + '"', replacementWord);
|
|
887
|
+
} else {
|
|
888
|
+
toReturn = toReturn.replace(singleMatch, replacementWord);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
return toReturn;
|
|
892
|
+
};
|
|
893
|
+
|
|
894
|
+
// src/utils/routePathGenerators/getRoutePathToPublishedContent.ts
|
|
895
|
+
var getRoutePathToPublishedContent = ({
|
|
896
|
+
contentType,
|
|
897
|
+
contentId,
|
|
898
|
+
SELF_MANAGED_BASE_CONFIGS,
|
|
899
|
+
scrollIntoViewElemId
|
|
900
|
+
}) => {
|
|
901
|
+
const scrollIntoViewQueryParam = scrollIntoViewElemId ? `scrollIntoViewElemId=${scrollIntoViewElemId}` : void 0;
|
|
902
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.enable && SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToPublishedPage + (scrollIntoViewQueryParam ? `?${scrollIntoViewQueryParam}` : "");
|
|
903
|
+
const standard_link = `/published-page/${contentType}?id=${contentId}${scrollIntoViewQueryParam ? `&${scrollIntoViewQueryParam}` : ""}`;
|
|
904
|
+
return sm_link ? parseSpecialConfigSyntax({
|
|
905
|
+
config: sm_link,
|
|
906
|
+
content: { contentType, contentId }
|
|
907
|
+
}) : standard_link;
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
// src/utils/routePathGenerators/getRoutePathToEditContent.ts
|
|
911
|
+
var getRoutePathToEditContent = ({
|
|
912
|
+
contentType,
|
|
913
|
+
contentId,
|
|
914
|
+
SELF_MANAGED_BASE_CONFIGS
|
|
915
|
+
}) => {
|
|
916
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToEdit;
|
|
917
|
+
const standard_link = `/edit/${contentType}?id=${contentId}`;
|
|
918
|
+
return sm_link ? parseSpecialConfigSyntax({ config: sm_link, content: { contentType, contentId } }) : standard_link;
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
// src/utils/routePathGenerators/getRoutePathToModerateContent.ts
|
|
922
|
+
var getRoutePathToModerateContent = ({
|
|
923
|
+
contentType,
|
|
924
|
+
contentId,
|
|
925
|
+
SELF_MANAGED_BASE_CONFIGS
|
|
926
|
+
}) => {
|
|
927
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToModerate;
|
|
928
|
+
const standard_link = `/moderate/${contentType}?id=${contentId}`;
|
|
929
|
+
return sm_link ? parseSpecialConfigSyntax({ config: sm_link, content: { contentType, contentId } }) : standard_link;
|
|
930
|
+
};
|
|
853
931
|
// Annotate the CommonJS export names for ESM import in node:
|
|
854
932
|
0 && (module.exports = {
|
|
855
933
|
BASE_BULLMQ_CONFIG,
|
|
@@ -858,8 +936,12 @@ var mergeAnnoDataIntoAnnotationsTags = ({
|
|
|
858
936
|
genTagId,
|
|
859
937
|
getPlatformContextContent,
|
|
860
938
|
getRollupPossibilities,
|
|
939
|
+
getRoutePathToEditContent,
|
|
940
|
+
getRoutePathToModerateContent,
|
|
941
|
+
getRoutePathToPublishedContent,
|
|
861
942
|
getVal,
|
|
862
943
|
mergeAnnoDataIntoAnnotationsTags,
|
|
944
|
+
parseSpecialConfigSyntax,
|
|
863
945
|
recursivelyExtractBlocks,
|
|
864
946
|
segrigateDocs,
|
|
865
947
|
setVal,
|
package/dist/browser.mjs
CHANGED
|
@@ -813,6 +813,80 @@ var mergeAnnoDataIntoAnnotationsTags = ({
|
|
|
813
813
|
});
|
|
814
814
|
return newConsolidated;
|
|
815
815
|
};
|
|
816
|
+
|
|
817
|
+
// src/utils/parseSpecialConfigSyntax.ts
|
|
818
|
+
var parseSpecialConfigSyntax = ({
|
|
819
|
+
config,
|
|
820
|
+
// can be string or JSON
|
|
821
|
+
content,
|
|
822
|
+
returnUndefinedIfReplacementWordNotFound = false
|
|
823
|
+
}) => {
|
|
824
|
+
let filterConfigString = typeof config === "string" ? config : JSON.stringify(config);
|
|
825
|
+
filterConfigString = parseDynamicValuePaths({ filterConfigString, content });
|
|
826
|
+
if (filterConfigString === "replacement-word-not-found" && returnUndefinedIfReplacementWordNotFound) {
|
|
827
|
+
return void 0;
|
|
828
|
+
}
|
|
829
|
+
return typeof config === "string" ? filterConfigString : JSON.parse(filterConfigString);
|
|
830
|
+
};
|
|
831
|
+
var parseDynamicValuePaths = ({ filterConfigString, content }) => {
|
|
832
|
+
let valPathRegex = /\$valuePath\(.*?\)/g;
|
|
833
|
+
let valPathMatch = filterConfigString.match(valPathRegex);
|
|
834
|
+
if (!valPathMatch) return filterConfigString;
|
|
835
|
+
let toReturn = filterConfigString;
|
|
836
|
+
for (let singleMatch of valPathMatch) {
|
|
837
|
+
let actualValPath = singleMatch.replace("$valuePath(", "");
|
|
838
|
+
actualValPath = actualValPath.replace(")", "");
|
|
839
|
+
let replacementWord = getVal(content, actualValPath);
|
|
840
|
+
if (replacementWord === void 0) {
|
|
841
|
+
return "replacement-word-not-found";
|
|
842
|
+
}
|
|
843
|
+
if (Array.isArray(replacementWord)) {
|
|
844
|
+
replacementWord = '["' + replacementWord.join('", "') + '"]';
|
|
845
|
+
toReturn = toReturn.replace('"' + singleMatch + '"', replacementWord);
|
|
846
|
+
} else {
|
|
847
|
+
toReturn = toReturn.replace(singleMatch, replacementWord);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
return toReturn;
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
// src/utils/routePathGenerators/getRoutePathToPublishedContent.ts
|
|
854
|
+
var getRoutePathToPublishedContent = ({
|
|
855
|
+
contentType,
|
|
856
|
+
contentId,
|
|
857
|
+
SELF_MANAGED_BASE_CONFIGS,
|
|
858
|
+
scrollIntoViewElemId
|
|
859
|
+
}) => {
|
|
860
|
+
const scrollIntoViewQueryParam = scrollIntoViewElemId ? `scrollIntoViewElemId=${scrollIntoViewElemId}` : void 0;
|
|
861
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.enable && SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToPublishedPage + (scrollIntoViewQueryParam ? `?${scrollIntoViewQueryParam}` : "");
|
|
862
|
+
const standard_link = `/published-page/${contentType}?id=${contentId}${scrollIntoViewQueryParam ? `&${scrollIntoViewQueryParam}` : ""}`;
|
|
863
|
+
return sm_link ? parseSpecialConfigSyntax({
|
|
864
|
+
config: sm_link,
|
|
865
|
+
content: { contentType, contentId }
|
|
866
|
+
}) : standard_link;
|
|
867
|
+
};
|
|
868
|
+
|
|
869
|
+
// src/utils/routePathGenerators/getRoutePathToEditContent.ts
|
|
870
|
+
var getRoutePathToEditContent = ({
|
|
871
|
+
contentType,
|
|
872
|
+
contentId,
|
|
873
|
+
SELF_MANAGED_BASE_CONFIGS
|
|
874
|
+
}) => {
|
|
875
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToEdit;
|
|
876
|
+
const standard_link = `/edit/${contentType}?id=${contentId}`;
|
|
877
|
+
return sm_link ? parseSpecialConfigSyntax({ config: sm_link, content: { contentType, contentId } }) : standard_link;
|
|
878
|
+
};
|
|
879
|
+
|
|
880
|
+
// src/utils/routePathGenerators/getRoutePathToModerateContent.ts
|
|
881
|
+
var getRoutePathToModerateContent = ({
|
|
882
|
+
contentType,
|
|
883
|
+
contentId,
|
|
884
|
+
SELF_MANAGED_BASE_CONFIGS
|
|
885
|
+
}) => {
|
|
886
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToModerate;
|
|
887
|
+
const standard_link = `/moderate/${contentType}?id=${contentId}`;
|
|
888
|
+
return sm_link ? parseSpecialConfigSyntax({ config: sm_link, content: { contentType, contentId } }) : standard_link;
|
|
889
|
+
};
|
|
816
890
|
export {
|
|
817
891
|
BASE_BULLMQ_CONFIG,
|
|
818
892
|
deleteVal,
|
|
@@ -820,8 +894,12 @@ export {
|
|
|
820
894
|
genTagId,
|
|
821
895
|
getPlatformContextContent,
|
|
822
896
|
getRollupPossibilities,
|
|
897
|
+
getRoutePathToEditContent,
|
|
898
|
+
getRoutePathToModerateContent,
|
|
899
|
+
getRoutePathToPublishedContent,
|
|
823
900
|
getVal,
|
|
824
901
|
mergeAnnoDataIntoAnnotationsTags,
|
|
902
|
+
parseSpecialConfigSyntax,
|
|
825
903
|
_recursExtractBlocks as recursivelyExtractBlocks,
|
|
826
904
|
segrigateDocs,
|
|
827
905
|
setVal,
|
package/dist/node.d.mts
CHANGED
|
@@ -757,6 +757,52 @@ interface MergeParams {
|
|
|
757
757
|
*/
|
|
758
758
|
declare const mergeAnnoDataIntoAnnotationsTags: ({ prevObj, newLexValue, thisBlockValuePath, author, }: MergeParams) => any;
|
|
759
759
|
|
|
760
|
+
declare const parseSpecialConfigSyntax: ({ config, content, returnUndefinedIfReplacementWordNotFound }: {
|
|
761
|
+
config: string | object;
|
|
762
|
+
content: Record<string, any>;
|
|
763
|
+
returnUndefinedIfReplacementWordNotFound?: boolean;
|
|
764
|
+
}) => any;
|
|
765
|
+
|
|
766
|
+
declare const getRoutePathToPublishedContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, scrollIntoViewElemId, }: {
|
|
767
|
+
contentType: string;
|
|
768
|
+
contentId: string;
|
|
769
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
770
|
+
enable?: boolean;
|
|
771
|
+
contentPageRelated?: {
|
|
772
|
+
linkToPublishedPage?: string;
|
|
773
|
+
[key: string]: any;
|
|
774
|
+
};
|
|
775
|
+
[key: string]: any;
|
|
776
|
+
};
|
|
777
|
+
scrollIntoViewElemId?: string;
|
|
778
|
+
}) => string;
|
|
779
|
+
|
|
780
|
+
declare const getRoutePathToEditContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, }: {
|
|
781
|
+
contentType: string;
|
|
782
|
+
contentId: string;
|
|
783
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
784
|
+
enable?: boolean;
|
|
785
|
+
contentPageRelated?: {
|
|
786
|
+
linkToEdit?: string;
|
|
787
|
+
[key: string]: any;
|
|
788
|
+
};
|
|
789
|
+
[key: string]: any;
|
|
790
|
+
};
|
|
791
|
+
}) => string;
|
|
792
|
+
|
|
793
|
+
declare const getRoutePathToModerateContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, }: {
|
|
794
|
+
contentType: string;
|
|
795
|
+
contentId: string;
|
|
796
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
797
|
+
enable?: boolean;
|
|
798
|
+
contentPageRelated?: {
|
|
799
|
+
linkToModerate?: string;
|
|
800
|
+
[key: string]: any;
|
|
801
|
+
};
|
|
802
|
+
[key: string]: any;
|
|
803
|
+
};
|
|
804
|
+
}) => string;
|
|
805
|
+
|
|
760
806
|
declare class MongoConnector {
|
|
761
807
|
static getInstance(): any;
|
|
762
808
|
static getClusterConnections(): any;
|
|
@@ -1019,7 +1065,7 @@ declare const AnnotationSchema: mongoose__default.Schema<IAnnotation, mongoose__
|
|
|
1019
1065
|
_id: Types.ObjectId;
|
|
1020
1066
|
}> & {
|
|
1021
1067
|
__v: number;
|
|
1022
|
-
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, IAnnotation, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<IAnnotation>, {}, mongoose__default.
|
|
1068
|
+
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, IAnnotation, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<IAnnotation>, {}, mongoose__default.DefaultSchemaOptions> & mongoose__default.FlatRecord<IAnnotation> & Required<{
|
|
1023
1069
|
_id: Types.ObjectId;
|
|
1024
1070
|
}> & {
|
|
1025
1071
|
__v: number;
|
|
@@ -1036,6 +1082,13 @@ interface IMessage {
|
|
|
1036
1082
|
chunks: typeof AnnotationSchema[];
|
|
1037
1083
|
};
|
|
1038
1084
|
relatedChunks: mongoose__default.Schema.Types.ObjectId[];
|
|
1085
|
+
relatedDocumentFields: {
|
|
1086
|
+
documentId: mongoose__default.Schema.Types.ObjectId;
|
|
1087
|
+
contentType: string;
|
|
1088
|
+
documentTitle: string;
|
|
1089
|
+
valuePath: string;
|
|
1090
|
+
fieldLabel: string;
|
|
1091
|
+
}[];
|
|
1039
1092
|
args: {
|
|
1040
1093
|
query: string;
|
|
1041
1094
|
reframedQuery: string;
|
|
@@ -1058,7 +1111,7 @@ declare const AIChatSchema: mongoose__default.Schema<IAIChat, mongoose__default.
|
|
|
1058
1111
|
_id: mongoose__default.Types.ObjectId;
|
|
1059
1112
|
}> & {
|
|
1060
1113
|
__v: number;
|
|
1061
|
-
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, IAIChat, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<IAIChat>, {}, mongoose__default.
|
|
1114
|
+
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, IAIChat, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<IAIChat>, {}, mongoose__default.DefaultSchemaOptions> & mongoose__default.FlatRecord<IAIChat> & Required<{
|
|
1062
1115
|
_id: mongoose__default.Types.ObjectId;
|
|
1063
1116
|
}> & {
|
|
1064
1117
|
__v: number;
|
|
@@ -1076,7 +1129,7 @@ declare const PlatformConfigsSchema: mongoose__default.Schema<IPlatformConfig, m
|
|
|
1076
1129
|
_id: mongoose__default.Types.ObjectId;
|
|
1077
1130
|
}> & {
|
|
1078
1131
|
__v: number;
|
|
1079
|
-
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, IPlatformConfig, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<IPlatformConfig>, {}, mongoose__default.
|
|
1132
|
+
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, IPlatformConfig, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<IPlatformConfig>, {}, mongoose__default.DefaultSchemaOptions> & mongoose__default.FlatRecord<IPlatformConfig> & Required<{
|
|
1080
1133
|
_id: mongoose__default.Types.ObjectId;
|
|
1081
1134
|
}> & {
|
|
1082
1135
|
__v: number;
|
|
@@ -1163,7 +1216,7 @@ declare const TplSchema: mongoose__default.Schema<ITplDocument, mongoose__defaul
|
|
|
1163
1216
|
_id: mongoose__default.Types.ObjectId;
|
|
1164
1217
|
}> & {
|
|
1165
1218
|
__v: number;
|
|
1166
|
-
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, ITplDocument, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<ITplDocument>, {}, mongoose__default.
|
|
1219
|
+
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, ITplDocument, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<ITplDocument>, {}, mongoose__default.DefaultSchemaOptions> & mongoose__default.FlatRecord<ITplDocument> & Required<{
|
|
1167
1220
|
_id: mongoose__default.Types.ObjectId;
|
|
1168
1221
|
}> & {
|
|
1169
1222
|
__v: number;
|
|
@@ -1188,7 +1241,7 @@ declare const GeneratedTopicsSchema: Schema<IGeneratedTopic, mongoose.Model<IGen
|
|
|
1188
1241
|
_id: mongoose.Types.ObjectId;
|
|
1189
1242
|
} & {
|
|
1190
1243
|
__v: number;
|
|
1191
|
-
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IGeneratedTopic, mongoose.Document<unknown, {}, mongoose.FlatRecord<IGeneratedTopic>, {}, mongoose.
|
|
1244
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IGeneratedTopic, mongoose.Document<unknown, {}, mongoose.FlatRecord<IGeneratedTopic>, {}, mongoose.DefaultSchemaOptions> & mongoose.FlatRecord<IGeneratedTopic> & {
|
|
1192
1245
|
_id: mongoose.Types.ObjectId;
|
|
1193
1246
|
} & {
|
|
1194
1247
|
__v: number;
|
|
@@ -1347,4 +1400,4 @@ declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
|
|
|
1347
1400
|
};
|
|
1348
1401
|
}): Object;
|
|
1349
1402
|
|
|
1350
|
-
export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseProducer, BaseWorker, ChunksElasticSyncProducer, ElasticSearchConnector, GET_GLOBAL_BULLMQ_CONFIG, GeneratedTopicsSchema, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, TplSchema, WorkerManager, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getGeneratedTopicsModelByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getTplModelByTenant, getVal, mergeAnnoDataIntoAnnotationsTags, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
|
1403
|
+
export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseProducer, BaseWorker, ChunksElasticSyncProducer, ElasticSearchConnector, GET_GLOBAL_BULLMQ_CONFIG, GeneratedTopicsSchema, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, TplSchema, WorkerManager, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getGeneratedTopicsModelByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToPublishedContent, getTplModelByTenant, getVal, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
package/dist/node.d.ts
CHANGED
|
@@ -757,6 +757,52 @@ interface MergeParams {
|
|
|
757
757
|
*/
|
|
758
758
|
declare const mergeAnnoDataIntoAnnotationsTags: ({ prevObj, newLexValue, thisBlockValuePath, author, }: MergeParams) => any;
|
|
759
759
|
|
|
760
|
+
declare const parseSpecialConfigSyntax: ({ config, content, returnUndefinedIfReplacementWordNotFound }: {
|
|
761
|
+
config: string | object;
|
|
762
|
+
content: Record<string, any>;
|
|
763
|
+
returnUndefinedIfReplacementWordNotFound?: boolean;
|
|
764
|
+
}) => any;
|
|
765
|
+
|
|
766
|
+
declare const getRoutePathToPublishedContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, scrollIntoViewElemId, }: {
|
|
767
|
+
contentType: string;
|
|
768
|
+
contentId: string;
|
|
769
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
770
|
+
enable?: boolean;
|
|
771
|
+
contentPageRelated?: {
|
|
772
|
+
linkToPublishedPage?: string;
|
|
773
|
+
[key: string]: any;
|
|
774
|
+
};
|
|
775
|
+
[key: string]: any;
|
|
776
|
+
};
|
|
777
|
+
scrollIntoViewElemId?: string;
|
|
778
|
+
}) => string;
|
|
779
|
+
|
|
780
|
+
declare const getRoutePathToEditContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, }: {
|
|
781
|
+
contentType: string;
|
|
782
|
+
contentId: string;
|
|
783
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
784
|
+
enable?: boolean;
|
|
785
|
+
contentPageRelated?: {
|
|
786
|
+
linkToEdit?: string;
|
|
787
|
+
[key: string]: any;
|
|
788
|
+
};
|
|
789
|
+
[key: string]: any;
|
|
790
|
+
};
|
|
791
|
+
}) => string;
|
|
792
|
+
|
|
793
|
+
declare const getRoutePathToModerateContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, }: {
|
|
794
|
+
contentType: string;
|
|
795
|
+
contentId: string;
|
|
796
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
797
|
+
enable?: boolean;
|
|
798
|
+
contentPageRelated?: {
|
|
799
|
+
linkToModerate?: string;
|
|
800
|
+
[key: string]: any;
|
|
801
|
+
};
|
|
802
|
+
[key: string]: any;
|
|
803
|
+
};
|
|
804
|
+
}) => string;
|
|
805
|
+
|
|
760
806
|
declare class MongoConnector {
|
|
761
807
|
static getInstance(): any;
|
|
762
808
|
static getClusterConnections(): any;
|
|
@@ -1019,7 +1065,7 @@ declare const AnnotationSchema: mongoose__default.Schema<IAnnotation, mongoose__
|
|
|
1019
1065
|
_id: Types.ObjectId;
|
|
1020
1066
|
}> & {
|
|
1021
1067
|
__v: number;
|
|
1022
|
-
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, IAnnotation, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<IAnnotation>, {}, mongoose__default.
|
|
1068
|
+
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, IAnnotation, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<IAnnotation>, {}, mongoose__default.DefaultSchemaOptions> & mongoose__default.FlatRecord<IAnnotation> & Required<{
|
|
1023
1069
|
_id: Types.ObjectId;
|
|
1024
1070
|
}> & {
|
|
1025
1071
|
__v: number;
|
|
@@ -1036,6 +1082,13 @@ interface IMessage {
|
|
|
1036
1082
|
chunks: typeof AnnotationSchema[];
|
|
1037
1083
|
};
|
|
1038
1084
|
relatedChunks: mongoose__default.Schema.Types.ObjectId[];
|
|
1085
|
+
relatedDocumentFields: {
|
|
1086
|
+
documentId: mongoose__default.Schema.Types.ObjectId;
|
|
1087
|
+
contentType: string;
|
|
1088
|
+
documentTitle: string;
|
|
1089
|
+
valuePath: string;
|
|
1090
|
+
fieldLabel: string;
|
|
1091
|
+
}[];
|
|
1039
1092
|
args: {
|
|
1040
1093
|
query: string;
|
|
1041
1094
|
reframedQuery: string;
|
|
@@ -1058,7 +1111,7 @@ declare const AIChatSchema: mongoose__default.Schema<IAIChat, mongoose__default.
|
|
|
1058
1111
|
_id: mongoose__default.Types.ObjectId;
|
|
1059
1112
|
}> & {
|
|
1060
1113
|
__v: number;
|
|
1061
|
-
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, IAIChat, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<IAIChat>, {}, mongoose__default.
|
|
1114
|
+
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, IAIChat, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<IAIChat>, {}, mongoose__default.DefaultSchemaOptions> & mongoose__default.FlatRecord<IAIChat> & Required<{
|
|
1062
1115
|
_id: mongoose__default.Types.ObjectId;
|
|
1063
1116
|
}> & {
|
|
1064
1117
|
__v: number;
|
|
@@ -1076,7 +1129,7 @@ declare const PlatformConfigsSchema: mongoose__default.Schema<IPlatformConfig, m
|
|
|
1076
1129
|
_id: mongoose__default.Types.ObjectId;
|
|
1077
1130
|
}> & {
|
|
1078
1131
|
__v: number;
|
|
1079
|
-
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, IPlatformConfig, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<IPlatformConfig>, {}, mongoose__default.
|
|
1132
|
+
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, IPlatformConfig, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<IPlatformConfig>, {}, mongoose__default.DefaultSchemaOptions> & mongoose__default.FlatRecord<IPlatformConfig> & Required<{
|
|
1080
1133
|
_id: mongoose__default.Types.ObjectId;
|
|
1081
1134
|
}> & {
|
|
1082
1135
|
__v: number;
|
|
@@ -1163,7 +1216,7 @@ declare const TplSchema: mongoose__default.Schema<ITplDocument, mongoose__defaul
|
|
|
1163
1216
|
_id: mongoose__default.Types.ObjectId;
|
|
1164
1217
|
}> & {
|
|
1165
1218
|
__v: number;
|
|
1166
|
-
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, ITplDocument, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<ITplDocument>, {}, mongoose__default.
|
|
1219
|
+
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, ITplDocument, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<ITplDocument>, {}, mongoose__default.DefaultSchemaOptions> & mongoose__default.FlatRecord<ITplDocument> & Required<{
|
|
1167
1220
|
_id: mongoose__default.Types.ObjectId;
|
|
1168
1221
|
}> & {
|
|
1169
1222
|
__v: number;
|
|
@@ -1188,7 +1241,7 @@ declare const GeneratedTopicsSchema: Schema<IGeneratedTopic, mongoose.Model<IGen
|
|
|
1188
1241
|
_id: mongoose.Types.ObjectId;
|
|
1189
1242
|
} & {
|
|
1190
1243
|
__v: number;
|
|
1191
|
-
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IGeneratedTopic, mongoose.Document<unknown, {}, mongoose.FlatRecord<IGeneratedTopic>, {}, mongoose.
|
|
1244
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IGeneratedTopic, mongoose.Document<unknown, {}, mongoose.FlatRecord<IGeneratedTopic>, {}, mongoose.DefaultSchemaOptions> & mongoose.FlatRecord<IGeneratedTopic> & {
|
|
1192
1245
|
_id: mongoose.Types.ObjectId;
|
|
1193
1246
|
} & {
|
|
1194
1247
|
__v: number;
|
|
@@ -1347,4 +1400,4 @@ declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
|
|
|
1347
1400
|
};
|
|
1348
1401
|
}): Object;
|
|
1349
1402
|
|
|
1350
|
-
export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseProducer, BaseWorker, ChunksElasticSyncProducer, ElasticSearchConnector, GET_GLOBAL_BULLMQ_CONFIG, GeneratedTopicsSchema, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, TplSchema, WorkerManager, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getGeneratedTopicsModelByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getTplModelByTenant, getVal, mergeAnnoDataIntoAnnotationsTags, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
|
1403
|
+
export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseProducer, BaseWorker, ChunksElasticSyncProducer, ElasticSearchConnector, GET_GLOBAL_BULLMQ_CONFIG, GeneratedTopicsSchema, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, TplSchema, WorkerManager, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getGeneratedTopicsModelByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToPublishedContent, getTplModelByTenant, getVal, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
package/dist/node.js
CHANGED
|
@@ -968,6 +968,13 @@ var init_AIChat = __esm({
|
|
|
968
968
|
chunks: [Annotations_default]
|
|
969
969
|
},
|
|
970
970
|
relatedChunks: [{ type: import_mongoose4.default.Schema.Types.ObjectId, ref: "chunks" }],
|
|
971
|
+
relatedDocumentFields: [{
|
|
972
|
+
documentId: { type: import_mongoose4.default.Schema.Types.ObjectId },
|
|
973
|
+
contentType: String,
|
|
974
|
+
documentTitle: String,
|
|
975
|
+
valuePath: String,
|
|
976
|
+
fieldLabel: String
|
|
977
|
+
}],
|
|
971
978
|
args: {
|
|
972
979
|
//depracated in favour of metadata
|
|
973
980
|
query: String,
|
|
@@ -1680,9 +1687,13 @@ __export(node_exports, {
|
|
|
1680
1687
|
getPlatformConfigsModelByTenant: () => import_getModelByTenant2.getPlatformConfigsModelByTenant,
|
|
1681
1688
|
getPlatformContextContent: () => getPlatformContextContent,
|
|
1682
1689
|
getRollupPossibilities: () => getRollupPossibilities,
|
|
1690
|
+
getRoutePathToEditContent: () => getRoutePathToEditContent,
|
|
1691
|
+
getRoutePathToModerateContent: () => getRoutePathToModerateContent,
|
|
1692
|
+
getRoutePathToPublishedContent: () => getRoutePathToPublishedContent,
|
|
1683
1693
|
getTplModelByTenant: () => import_getModelByTenant2.getTplModelByTenant,
|
|
1684
1694
|
getVal: () => getVal,
|
|
1685
1695
|
mergeAnnoDataIntoAnnotationsTags: () => mergeAnnoDataIntoAnnotationsTags,
|
|
1696
|
+
parseSpecialConfigSyntax: () => parseSpecialConfigSyntax,
|
|
1686
1697
|
recursivelyExtractBlocks: () => _recursExtractBlocks,
|
|
1687
1698
|
segrigateDocs: () => segrigateDocs,
|
|
1688
1699
|
setVal: () => setVal,
|
|
@@ -2206,6 +2217,80 @@ var mergeAnnoDataIntoAnnotationsTags = ({
|
|
|
2206
2217
|
return newConsolidated;
|
|
2207
2218
|
};
|
|
2208
2219
|
|
|
2220
|
+
// src/utils/parseSpecialConfigSyntax.ts
|
|
2221
|
+
var parseSpecialConfigSyntax = ({
|
|
2222
|
+
config,
|
|
2223
|
+
// can be string or JSON
|
|
2224
|
+
content,
|
|
2225
|
+
returnUndefinedIfReplacementWordNotFound = false
|
|
2226
|
+
}) => {
|
|
2227
|
+
let filterConfigString = typeof config === "string" ? config : JSON.stringify(config);
|
|
2228
|
+
filterConfigString = parseDynamicValuePaths({ filterConfigString, content });
|
|
2229
|
+
if (filterConfigString === "replacement-word-not-found" && returnUndefinedIfReplacementWordNotFound) {
|
|
2230
|
+
return void 0;
|
|
2231
|
+
}
|
|
2232
|
+
return typeof config === "string" ? filterConfigString : JSON.parse(filterConfigString);
|
|
2233
|
+
};
|
|
2234
|
+
var parseDynamicValuePaths = ({ filterConfigString, content }) => {
|
|
2235
|
+
let valPathRegex = /\$valuePath\(.*?\)/g;
|
|
2236
|
+
let valPathMatch = filterConfigString.match(valPathRegex);
|
|
2237
|
+
if (!valPathMatch) return filterConfigString;
|
|
2238
|
+
let toReturn = filterConfigString;
|
|
2239
|
+
for (let singleMatch of valPathMatch) {
|
|
2240
|
+
let actualValPath = singleMatch.replace("$valuePath(", "");
|
|
2241
|
+
actualValPath = actualValPath.replace(")", "");
|
|
2242
|
+
let replacementWord = getVal(content, actualValPath);
|
|
2243
|
+
if (replacementWord === void 0) {
|
|
2244
|
+
return "replacement-word-not-found";
|
|
2245
|
+
}
|
|
2246
|
+
if (Array.isArray(replacementWord)) {
|
|
2247
|
+
replacementWord = '["' + replacementWord.join('", "') + '"]';
|
|
2248
|
+
toReturn = toReturn.replace('"' + singleMatch + '"', replacementWord);
|
|
2249
|
+
} else {
|
|
2250
|
+
toReturn = toReturn.replace(singleMatch, replacementWord);
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
return toReturn;
|
|
2254
|
+
};
|
|
2255
|
+
|
|
2256
|
+
// src/utils/routePathGenerators/getRoutePathToPublishedContent.ts
|
|
2257
|
+
var getRoutePathToPublishedContent = ({
|
|
2258
|
+
contentType,
|
|
2259
|
+
contentId,
|
|
2260
|
+
SELF_MANAGED_BASE_CONFIGS,
|
|
2261
|
+
scrollIntoViewElemId
|
|
2262
|
+
}) => {
|
|
2263
|
+
const scrollIntoViewQueryParam = scrollIntoViewElemId ? `scrollIntoViewElemId=${scrollIntoViewElemId}` : void 0;
|
|
2264
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.enable && SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToPublishedPage + (scrollIntoViewQueryParam ? `?${scrollIntoViewQueryParam}` : "");
|
|
2265
|
+
const standard_link = `/published-page/${contentType}?id=${contentId}${scrollIntoViewQueryParam ? `&${scrollIntoViewQueryParam}` : ""}`;
|
|
2266
|
+
return sm_link ? parseSpecialConfigSyntax({
|
|
2267
|
+
config: sm_link,
|
|
2268
|
+
content: { contentType, contentId }
|
|
2269
|
+
}) : standard_link;
|
|
2270
|
+
};
|
|
2271
|
+
|
|
2272
|
+
// src/utils/routePathGenerators/getRoutePathToEditContent.ts
|
|
2273
|
+
var getRoutePathToEditContent = ({
|
|
2274
|
+
contentType,
|
|
2275
|
+
contentId,
|
|
2276
|
+
SELF_MANAGED_BASE_CONFIGS
|
|
2277
|
+
}) => {
|
|
2278
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToEdit;
|
|
2279
|
+
const standard_link = `/edit/${contentType}?id=${contentId}`;
|
|
2280
|
+
return sm_link ? parseSpecialConfigSyntax({ config: sm_link, content: { contentType, contentId } }) : standard_link;
|
|
2281
|
+
};
|
|
2282
|
+
|
|
2283
|
+
// src/utils/routePathGenerators/getRoutePathToModerateContent.ts
|
|
2284
|
+
var getRoutePathToModerateContent = ({
|
|
2285
|
+
contentType,
|
|
2286
|
+
contentId,
|
|
2287
|
+
SELF_MANAGED_BASE_CONFIGS
|
|
2288
|
+
}) => {
|
|
2289
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToModerate;
|
|
2290
|
+
const standard_link = `/moderate/${contentType}?id=${contentId}`;
|
|
2291
|
+
return sm_link ? parseSpecialConfigSyntax({ config: sm_link, content: { contentType, contentId } }) : standard_link;
|
|
2292
|
+
};
|
|
2293
|
+
|
|
2209
2294
|
// src/node.ts
|
|
2210
2295
|
var import_MongoConnector3 = __toESM(require_MongoConnector());
|
|
2211
2296
|
var import_ElasticSearchConnector = __toESM(require_ElasticSearchConnector());
|
|
@@ -2577,9 +2662,13 @@ var import_GET_GLOBAL_BULLMQ_CONFIG = __toESM(require_GET_GLOBAL_BULLMQ_CONFIG()
|
|
|
2577
2662
|
getPlatformConfigsModelByTenant,
|
|
2578
2663
|
getPlatformContextContent,
|
|
2579
2664
|
getRollupPossibilities,
|
|
2665
|
+
getRoutePathToEditContent,
|
|
2666
|
+
getRoutePathToModerateContent,
|
|
2667
|
+
getRoutePathToPublishedContent,
|
|
2580
2668
|
getTplModelByTenant,
|
|
2581
2669
|
getVal,
|
|
2582
2670
|
mergeAnnoDataIntoAnnotationsTags,
|
|
2671
|
+
parseSpecialConfigSyntax,
|
|
2583
2672
|
recursivelyExtractBlocks,
|
|
2584
2673
|
segrigateDocs,
|
|
2585
2674
|
setVal,
|
package/dist/node.mjs
CHANGED
|
@@ -973,6 +973,13 @@ var init_AIChat = __esm({
|
|
|
973
973
|
chunks: [Annotations_default]
|
|
974
974
|
},
|
|
975
975
|
relatedChunks: [{ type: mongoose4.Schema.Types.ObjectId, ref: "chunks" }],
|
|
976
|
+
relatedDocumentFields: [{
|
|
977
|
+
documentId: { type: mongoose4.Schema.Types.ObjectId },
|
|
978
|
+
contentType: String,
|
|
979
|
+
documentTitle: String,
|
|
980
|
+
valuePath: String,
|
|
981
|
+
fieldLabel: String
|
|
982
|
+
}],
|
|
976
983
|
args: {
|
|
977
984
|
//depracated in favour of metadata
|
|
978
985
|
query: String,
|
|
@@ -2171,6 +2178,80 @@ var mergeAnnoDataIntoAnnotationsTags = ({
|
|
|
2171
2178
|
return newConsolidated;
|
|
2172
2179
|
};
|
|
2173
2180
|
|
|
2181
|
+
// src/utils/parseSpecialConfigSyntax.ts
|
|
2182
|
+
var parseSpecialConfigSyntax = ({
|
|
2183
|
+
config,
|
|
2184
|
+
// can be string or JSON
|
|
2185
|
+
content,
|
|
2186
|
+
returnUndefinedIfReplacementWordNotFound = false
|
|
2187
|
+
}) => {
|
|
2188
|
+
let filterConfigString = typeof config === "string" ? config : JSON.stringify(config);
|
|
2189
|
+
filterConfigString = parseDynamicValuePaths({ filterConfigString, content });
|
|
2190
|
+
if (filterConfigString === "replacement-word-not-found" && returnUndefinedIfReplacementWordNotFound) {
|
|
2191
|
+
return void 0;
|
|
2192
|
+
}
|
|
2193
|
+
return typeof config === "string" ? filterConfigString : JSON.parse(filterConfigString);
|
|
2194
|
+
};
|
|
2195
|
+
var parseDynamicValuePaths = ({ filterConfigString, content }) => {
|
|
2196
|
+
let valPathRegex = /\$valuePath\(.*?\)/g;
|
|
2197
|
+
let valPathMatch = filterConfigString.match(valPathRegex);
|
|
2198
|
+
if (!valPathMatch) return filterConfigString;
|
|
2199
|
+
let toReturn = filterConfigString;
|
|
2200
|
+
for (let singleMatch of valPathMatch) {
|
|
2201
|
+
let actualValPath = singleMatch.replace("$valuePath(", "");
|
|
2202
|
+
actualValPath = actualValPath.replace(")", "");
|
|
2203
|
+
let replacementWord = getVal(content, actualValPath);
|
|
2204
|
+
if (replacementWord === void 0) {
|
|
2205
|
+
return "replacement-word-not-found";
|
|
2206
|
+
}
|
|
2207
|
+
if (Array.isArray(replacementWord)) {
|
|
2208
|
+
replacementWord = '["' + replacementWord.join('", "') + '"]';
|
|
2209
|
+
toReturn = toReturn.replace('"' + singleMatch + '"', replacementWord);
|
|
2210
|
+
} else {
|
|
2211
|
+
toReturn = toReturn.replace(singleMatch, replacementWord);
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
return toReturn;
|
|
2215
|
+
};
|
|
2216
|
+
|
|
2217
|
+
// src/utils/routePathGenerators/getRoutePathToPublishedContent.ts
|
|
2218
|
+
var getRoutePathToPublishedContent = ({
|
|
2219
|
+
contentType,
|
|
2220
|
+
contentId,
|
|
2221
|
+
SELF_MANAGED_BASE_CONFIGS,
|
|
2222
|
+
scrollIntoViewElemId
|
|
2223
|
+
}) => {
|
|
2224
|
+
const scrollIntoViewQueryParam = scrollIntoViewElemId ? `scrollIntoViewElemId=${scrollIntoViewElemId}` : void 0;
|
|
2225
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.enable && SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToPublishedPage + (scrollIntoViewQueryParam ? `?${scrollIntoViewQueryParam}` : "");
|
|
2226
|
+
const standard_link = `/published-page/${contentType}?id=${contentId}${scrollIntoViewQueryParam ? `&${scrollIntoViewQueryParam}` : ""}`;
|
|
2227
|
+
return sm_link ? parseSpecialConfigSyntax({
|
|
2228
|
+
config: sm_link,
|
|
2229
|
+
content: { contentType, contentId }
|
|
2230
|
+
}) : standard_link;
|
|
2231
|
+
};
|
|
2232
|
+
|
|
2233
|
+
// src/utils/routePathGenerators/getRoutePathToEditContent.ts
|
|
2234
|
+
var getRoutePathToEditContent = ({
|
|
2235
|
+
contentType,
|
|
2236
|
+
contentId,
|
|
2237
|
+
SELF_MANAGED_BASE_CONFIGS
|
|
2238
|
+
}) => {
|
|
2239
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToEdit;
|
|
2240
|
+
const standard_link = `/edit/${contentType}?id=${contentId}`;
|
|
2241
|
+
return sm_link ? parseSpecialConfigSyntax({ config: sm_link, content: { contentType, contentId } }) : standard_link;
|
|
2242
|
+
};
|
|
2243
|
+
|
|
2244
|
+
// src/utils/routePathGenerators/getRoutePathToModerateContent.ts
|
|
2245
|
+
var getRoutePathToModerateContent = ({
|
|
2246
|
+
contentType,
|
|
2247
|
+
contentId,
|
|
2248
|
+
SELF_MANAGED_BASE_CONFIGS
|
|
2249
|
+
}) => {
|
|
2250
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToModerate;
|
|
2251
|
+
const standard_link = `/moderate/${contentType}?id=${contentId}`;
|
|
2252
|
+
return sm_link ? parseSpecialConfigSyntax({ config: sm_link, content: { contentType, contentId } }) : standard_link;
|
|
2253
|
+
};
|
|
2254
|
+
|
|
2174
2255
|
// src/node.ts
|
|
2175
2256
|
var import_MongoConnector3 = __toESM(require_MongoConnector());
|
|
2176
2257
|
var import_ElasticSearchConnector = __toESM(require_ElasticSearchConnector());
|
|
@@ -2556,9 +2637,13 @@ export {
|
|
|
2556
2637
|
export_getPlatformConfigsModelByTenant as getPlatformConfigsModelByTenant,
|
|
2557
2638
|
getPlatformContextContent,
|
|
2558
2639
|
getRollupPossibilities,
|
|
2640
|
+
getRoutePathToEditContent,
|
|
2641
|
+
getRoutePathToModerateContent,
|
|
2642
|
+
getRoutePathToPublishedContent,
|
|
2559
2643
|
export_getTplModelByTenant as getTplModelByTenant,
|
|
2560
2644
|
getVal,
|
|
2561
2645
|
mergeAnnoDataIntoAnnotationsTags,
|
|
2646
|
+
parseSpecialConfigSyntax,
|
|
2562
2647
|
_recursExtractBlocks as recursivelyExtractBlocks,
|
|
2563
2648
|
segrigateDocs,
|
|
2564
2649
|
setVal,
|
package/dist/universal.d.mts
CHANGED
|
@@ -749,4 +749,50 @@ interface MergeParams {
|
|
|
749
749
|
*/
|
|
750
750
|
declare const mergeAnnoDataIntoAnnotationsTags: ({ prevObj, newLexValue, thisBlockValuePath, author, }: MergeParams) => any;
|
|
751
751
|
|
|
752
|
-
|
|
752
|
+
declare const parseSpecialConfigSyntax: ({ config, content, returnUndefinedIfReplacementWordNotFound }: {
|
|
753
|
+
config: string | object;
|
|
754
|
+
content: Record<string, any>;
|
|
755
|
+
returnUndefinedIfReplacementWordNotFound?: boolean;
|
|
756
|
+
}) => any;
|
|
757
|
+
|
|
758
|
+
declare const getRoutePathToPublishedContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, scrollIntoViewElemId, }: {
|
|
759
|
+
contentType: string;
|
|
760
|
+
contentId: string;
|
|
761
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
762
|
+
enable?: boolean;
|
|
763
|
+
contentPageRelated?: {
|
|
764
|
+
linkToPublishedPage?: string;
|
|
765
|
+
[key: string]: any;
|
|
766
|
+
};
|
|
767
|
+
[key: string]: any;
|
|
768
|
+
};
|
|
769
|
+
scrollIntoViewElemId?: string;
|
|
770
|
+
}) => string;
|
|
771
|
+
|
|
772
|
+
declare const getRoutePathToEditContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, }: {
|
|
773
|
+
contentType: string;
|
|
774
|
+
contentId: string;
|
|
775
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
776
|
+
enable?: boolean;
|
|
777
|
+
contentPageRelated?: {
|
|
778
|
+
linkToEdit?: string;
|
|
779
|
+
[key: string]: any;
|
|
780
|
+
};
|
|
781
|
+
[key: string]: any;
|
|
782
|
+
};
|
|
783
|
+
}) => string;
|
|
784
|
+
|
|
785
|
+
declare const getRoutePathToModerateContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, }: {
|
|
786
|
+
contentType: string;
|
|
787
|
+
contentId: string;
|
|
788
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
789
|
+
enable?: boolean;
|
|
790
|
+
contentPageRelated?: {
|
|
791
|
+
linkToModerate?: string;
|
|
792
|
+
[key: string]: any;
|
|
793
|
+
};
|
|
794
|
+
[key: string]: any;
|
|
795
|
+
};
|
|
796
|
+
}) => string;
|
|
797
|
+
|
|
798
|
+
export { BASE_BULLMQ_CONFIG, deleteVal, extractAllBlocksFromTpl, genTagId, getPlatformContextContent, getRollupPossibilities, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToPublishedContent, getVal, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
package/dist/universal.d.ts
CHANGED
|
@@ -749,4 +749,50 @@ interface MergeParams {
|
|
|
749
749
|
*/
|
|
750
750
|
declare const mergeAnnoDataIntoAnnotationsTags: ({ prevObj, newLexValue, thisBlockValuePath, author, }: MergeParams) => any;
|
|
751
751
|
|
|
752
|
-
|
|
752
|
+
declare const parseSpecialConfigSyntax: ({ config, content, returnUndefinedIfReplacementWordNotFound }: {
|
|
753
|
+
config: string | object;
|
|
754
|
+
content: Record<string, any>;
|
|
755
|
+
returnUndefinedIfReplacementWordNotFound?: boolean;
|
|
756
|
+
}) => any;
|
|
757
|
+
|
|
758
|
+
declare const getRoutePathToPublishedContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, scrollIntoViewElemId, }: {
|
|
759
|
+
contentType: string;
|
|
760
|
+
contentId: string;
|
|
761
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
762
|
+
enable?: boolean;
|
|
763
|
+
contentPageRelated?: {
|
|
764
|
+
linkToPublishedPage?: string;
|
|
765
|
+
[key: string]: any;
|
|
766
|
+
};
|
|
767
|
+
[key: string]: any;
|
|
768
|
+
};
|
|
769
|
+
scrollIntoViewElemId?: string;
|
|
770
|
+
}) => string;
|
|
771
|
+
|
|
772
|
+
declare const getRoutePathToEditContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, }: {
|
|
773
|
+
contentType: string;
|
|
774
|
+
contentId: string;
|
|
775
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
776
|
+
enable?: boolean;
|
|
777
|
+
contentPageRelated?: {
|
|
778
|
+
linkToEdit?: string;
|
|
779
|
+
[key: string]: any;
|
|
780
|
+
};
|
|
781
|
+
[key: string]: any;
|
|
782
|
+
};
|
|
783
|
+
}) => string;
|
|
784
|
+
|
|
785
|
+
declare const getRoutePathToModerateContent: ({ contentType, contentId, SELF_MANAGED_BASE_CONFIGS, }: {
|
|
786
|
+
contentType: string;
|
|
787
|
+
contentId: string;
|
|
788
|
+
SELF_MANAGED_BASE_CONFIGS?: {
|
|
789
|
+
enable?: boolean;
|
|
790
|
+
contentPageRelated?: {
|
|
791
|
+
linkToModerate?: string;
|
|
792
|
+
[key: string]: any;
|
|
793
|
+
};
|
|
794
|
+
[key: string]: any;
|
|
795
|
+
};
|
|
796
|
+
}) => string;
|
|
797
|
+
|
|
798
|
+
export { BASE_BULLMQ_CONFIG, deleteVal, extractAllBlocksFromTpl, genTagId, getPlatformContextContent, getRollupPossibilities, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToPublishedContent, getVal, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
package/dist/universal.js
CHANGED
|
@@ -26,8 +26,12 @@ __export(universal_exports, {
|
|
|
26
26
|
genTagId: () => genTagId,
|
|
27
27
|
getPlatformContextContent: () => getPlatformContextContent,
|
|
28
28
|
getRollupPossibilities: () => getRollupPossibilities,
|
|
29
|
+
getRoutePathToEditContent: () => getRoutePathToEditContent,
|
|
30
|
+
getRoutePathToModerateContent: () => getRoutePathToModerateContent,
|
|
31
|
+
getRoutePathToPublishedContent: () => getRoutePathToPublishedContent,
|
|
29
32
|
getVal: () => getVal,
|
|
30
33
|
mergeAnnoDataIntoAnnotationsTags: () => mergeAnnoDataIntoAnnotationsTags,
|
|
34
|
+
parseSpecialConfigSyntax: () => parseSpecialConfigSyntax,
|
|
31
35
|
recursivelyExtractBlocks: () => _recursExtractBlocks,
|
|
32
36
|
segrigateDocs: () => segrigateDocs,
|
|
33
37
|
setVal: () => setVal,
|
|
@@ -850,6 +854,80 @@ var mergeAnnoDataIntoAnnotationsTags = ({
|
|
|
850
854
|
});
|
|
851
855
|
return newConsolidated;
|
|
852
856
|
};
|
|
857
|
+
|
|
858
|
+
// src/utils/parseSpecialConfigSyntax.ts
|
|
859
|
+
var parseSpecialConfigSyntax = ({
|
|
860
|
+
config,
|
|
861
|
+
// can be string or JSON
|
|
862
|
+
content,
|
|
863
|
+
returnUndefinedIfReplacementWordNotFound = false
|
|
864
|
+
}) => {
|
|
865
|
+
let filterConfigString = typeof config === "string" ? config : JSON.stringify(config);
|
|
866
|
+
filterConfigString = parseDynamicValuePaths({ filterConfigString, content });
|
|
867
|
+
if (filterConfigString === "replacement-word-not-found" && returnUndefinedIfReplacementWordNotFound) {
|
|
868
|
+
return void 0;
|
|
869
|
+
}
|
|
870
|
+
return typeof config === "string" ? filterConfigString : JSON.parse(filterConfigString);
|
|
871
|
+
};
|
|
872
|
+
var parseDynamicValuePaths = ({ filterConfigString, content }) => {
|
|
873
|
+
let valPathRegex = /\$valuePath\(.*?\)/g;
|
|
874
|
+
let valPathMatch = filterConfigString.match(valPathRegex);
|
|
875
|
+
if (!valPathMatch) return filterConfigString;
|
|
876
|
+
let toReturn = filterConfigString;
|
|
877
|
+
for (let singleMatch of valPathMatch) {
|
|
878
|
+
let actualValPath = singleMatch.replace("$valuePath(", "");
|
|
879
|
+
actualValPath = actualValPath.replace(")", "");
|
|
880
|
+
let replacementWord = getVal(content, actualValPath);
|
|
881
|
+
if (replacementWord === void 0) {
|
|
882
|
+
return "replacement-word-not-found";
|
|
883
|
+
}
|
|
884
|
+
if (Array.isArray(replacementWord)) {
|
|
885
|
+
replacementWord = '["' + replacementWord.join('", "') + '"]';
|
|
886
|
+
toReturn = toReturn.replace('"' + singleMatch + '"', replacementWord);
|
|
887
|
+
} else {
|
|
888
|
+
toReturn = toReturn.replace(singleMatch, replacementWord);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
return toReturn;
|
|
892
|
+
};
|
|
893
|
+
|
|
894
|
+
// src/utils/routePathGenerators/getRoutePathToPublishedContent.ts
|
|
895
|
+
var getRoutePathToPublishedContent = ({
|
|
896
|
+
contentType,
|
|
897
|
+
contentId,
|
|
898
|
+
SELF_MANAGED_BASE_CONFIGS,
|
|
899
|
+
scrollIntoViewElemId
|
|
900
|
+
}) => {
|
|
901
|
+
const scrollIntoViewQueryParam = scrollIntoViewElemId ? `scrollIntoViewElemId=${scrollIntoViewElemId}` : void 0;
|
|
902
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.enable && SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToPublishedPage + (scrollIntoViewQueryParam ? `?${scrollIntoViewQueryParam}` : "");
|
|
903
|
+
const standard_link = `/published-page/${contentType}?id=${contentId}${scrollIntoViewQueryParam ? `&${scrollIntoViewQueryParam}` : ""}`;
|
|
904
|
+
return sm_link ? parseSpecialConfigSyntax({
|
|
905
|
+
config: sm_link,
|
|
906
|
+
content: { contentType, contentId }
|
|
907
|
+
}) : standard_link;
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
// src/utils/routePathGenerators/getRoutePathToEditContent.ts
|
|
911
|
+
var getRoutePathToEditContent = ({
|
|
912
|
+
contentType,
|
|
913
|
+
contentId,
|
|
914
|
+
SELF_MANAGED_BASE_CONFIGS
|
|
915
|
+
}) => {
|
|
916
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToEdit;
|
|
917
|
+
const standard_link = `/edit/${contentType}?id=${contentId}`;
|
|
918
|
+
return sm_link ? parseSpecialConfigSyntax({ config: sm_link, content: { contentType, contentId } }) : standard_link;
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
// src/utils/routePathGenerators/getRoutePathToModerateContent.ts
|
|
922
|
+
var getRoutePathToModerateContent = ({
|
|
923
|
+
contentType,
|
|
924
|
+
contentId,
|
|
925
|
+
SELF_MANAGED_BASE_CONFIGS
|
|
926
|
+
}) => {
|
|
927
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToModerate;
|
|
928
|
+
const standard_link = `/moderate/${contentType}?id=${contentId}`;
|
|
929
|
+
return sm_link ? parseSpecialConfigSyntax({ config: sm_link, content: { contentType, contentId } }) : standard_link;
|
|
930
|
+
};
|
|
853
931
|
// Annotate the CommonJS export names for ESM import in node:
|
|
854
932
|
0 && (module.exports = {
|
|
855
933
|
BASE_BULLMQ_CONFIG,
|
|
@@ -858,8 +936,12 @@ var mergeAnnoDataIntoAnnotationsTags = ({
|
|
|
858
936
|
genTagId,
|
|
859
937
|
getPlatformContextContent,
|
|
860
938
|
getRollupPossibilities,
|
|
939
|
+
getRoutePathToEditContent,
|
|
940
|
+
getRoutePathToModerateContent,
|
|
941
|
+
getRoutePathToPublishedContent,
|
|
861
942
|
getVal,
|
|
862
943
|
mergeAnnoDataIntoAnnotationsTags,
|
|
944
|
+
parseSpecialConfigSyntax,
|
|
863
945
|
recursivelyExtractBlocks,
|
|
864
946
|
segrigateDocs,
|
|
865
947
|
setVal,
|
package/dist/universal.mjs
CHANGED
|
@@ -813,6 +813,80 @@ var mergeAnnoDataIntoAnnotationsTags = ({
|
|
|
813
813
|
});
|
|
814
814
|
return newConsolidated;
|
|
815
815
|
};
|
|
816
|
+
|
|
817
|
+
// src/utils/parseSpecialConfigSyntax.ts
|
|
818
|
+
var parseSpecialConfigSyntax = ({
|
|
819
|
+
config,
|
|
820
|
+
// can be string or JSON
|
|
821
|
+
content,
|
|
822
|
+
returnUndefinedIfReplacementWordNotFound = false
|
|
823
|
+
}) => {
|
|
824
|
+
let filterConfigString = typeof config === "string" ? config : JSON.stringify(config);
|
|
825
|
+
filterConfigString = parseDynamicValuePaths({ filterConfigString, content });
|
|
826
|
+
if (filterConfigString === "replacement-word-not-found" && returnUndefinedIfReplacementWordNotFound) {
|
|
827
|
+
return void 0;
|
|
828
|
+
}
|
|
829
|
+
return typeof config === "string" ? filterConfigString : JSON.parse(filterConfigString);
|
|
830
|
+
};
|
|
831
|
+
var parseDynamicValuePaths = ({ filterConfigString, content }) => {
|
|
832
|
+
let valPathRegex = /\$valuePath\(.*?\)/g;
|
|
833
|
+
let valPathMatch = filterConfigString.match(valPathRegex);
|
|
834
|
+
if (!valPathMatch) return filterConfigString;
|
|
835
|
+
let toReturn = filterConfigString;
|
|
836
|
+
for (let singleMatch of valPathMatch) {
|
|
837
|
+
let actualValPath = singleMatch.replace("$valuePath(", "");
|
|
838
|
+
actualValPath = actualValPath.replace(")", "");
|
|
839
|
+
let replacementWord = getVal(content, actualValPath);
|
|
840
|
+
if (replacementWord === void 0) {
|
|
841
|
+
return "replacement-word-not-found";
|
|
842
|
+
}
|
|
843
|
+
if (Array.isArray(replacementWord)) {
|
|
844
|
+
replacementWord = '["' + replacementWord.join('", "') + '"]';
|
|
845
|
+
toReturn = toReturn.replace('"' + singleMatch + '"', replacementWord);
|
|
846
|
+
} else {
|
|
847
|
+
toReturn = toReturn.replace(singleMatch, replacementWord);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
return toReturn;
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
// src/utils/routePathGenerators/getRoutePathToPublishedContent.ts
|
|
854
|
+
var getRoutePathToPublishedContent = ({
|
|
855
|
+
contentType,
|
|
856
|
+
contentId,
|
|
857
|
+
SELF_MANAGED_BASE_CONFIGS,
|
|
858
|
+
scrollIntoViewElemId
|
|
859
|
+
}) => {
|
|
860
|
+
const scrollIntoViewQueryParam = scrollIntoViewElemId ? `scrollIntoViewElemId=${scrollIntoViewElemId}` : void 0;
|
|
861
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.enable && SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToPublishedPage + (scrollIntoViewQueryParam ? `?${scrollIntoViewQueryParam}` : "");
|
|
862
|
+
const standard_link = `/published-page/${contentType}?id=${contentId}${scrollIntoViewQueryParam ? `&${scrollIntoViewQueryParam}` : ""}`;
|
|
863
|
+
return sm_link ? parseSpecialConfigSyntax({
|
|
864
|
+
config: sm_link,
|
|
865
|
+
content: { contentType, contentId }
|
|
866
|
+
}) : standard_link;
|
|
867
|
+
};
|
|
868
|
+
|
|
869
|
+
// src/utils/routePathGenerators/getRoutePathToEditContent.ts
|
|
870
|
+
var getRoutePathToEditContent = ({
|
|
871
|
+
contentType,
|
|
872
|
+
contentId,
|
|
873
|
+
SELF_MANAGED_BASE_CONFIGS
|
|
874
|
+
}) => {
|
|
875
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToEdit;
|
|
876
|
+
const standard_link = `/edit/${contentType}?id=${contentId}`;
|
|
877
|
+
return sm_link ? parseSpecialConfigSyntax({ config: sm_link, content: { contentType, contentId } }) : standard_link;
|
|
878
|
+
};
|
|
879
|
+
|
|
880
|
+
// src/utils/routePathGenerators/getRoutePathToModerateContent.ts
|
|
881
|
+
var getRoutePathToModerateContent = ({
|
|
882
|
+
contentType,
|
|
883
|
+
contentId,
|
|
884
|
+
SELF_MANAGED_BASE_CONFIGS
|
|
885
|
+
}) => {
|
|
886
|
+
const sm_link = SELF_MANAGED_BASE_CONFIGS?.contentPageRelated?.linkToModerate;
|
|
887
|
+
const standard_link = `/moderate/${contentType}?id=${contentId}`;
|
|
888
|
+
return sm_link ? parseSpecialConfigSyntax({ config: sm_link, content: { contentType, contentId } }) : standard_link;
|
|
889
|
+
};
|
|
816
890
|
export {
|
|
817
891
|
BASE_BULLMQ_CONFIG,
|
|
818
892
|
deleteVal,
|
|
@@ -820,8 +894,12 @@ export {
|
|
|
820
894
|
genTagId,
|
|
821
895
|
getPlatformContextContent,
|
|
822
896
|
getRollupPossibilities,
|
|
897
|
+
getRoutePathToEditContent,
|
|
898
|
+
getRoutePathToModerateContent,
|
|
899
|
+
getRoutePathToPublishedContent,
|
|
823
900
|
getVal,
|
|
824
901
|
mergeAnnoDataIntoAnnotationsTags,
|
|
902
|
+
parseSpecialConfigSyntax,
|
|
825
903
|
_recursExtractBlocks as recursivelyExtractBlocks,
|
|
826
904
|
segrigateDocs,
|
|
827
905
|
setVal,
|