@okf/ootils 1.21.5 → 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 +101 -5
- package/dist/node.mjs +97 -5
- 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
|
@@ -681,7 +681,7 @@ var require_MongoConnector = __commonJS({
|
|
|
681
681
|
var AnnotationsSchema = (init_Annotations(), __toCommonJS(Annotations_exports));
|
|
682
682
|
var PlatformConfigsSchema2 = (init_PlatformConfigs(), __toCommonJS(PlatformConfigs_exports));
|
|
683
683
|
var TplSchema2 = (init_Tpl(), __toCommonJS(Tpl_exports));
|
|
684
|
-
var
|
|
684
|
+
var MongoConnector4 = class _MongoConnector {
|
|
685
685
|
constructor(options) {
|
|
686
686
|
__publicField(this, "initiateConnectionEventListeners", (CLUSTER_NAME) => {
|
|
687
687
|
this.clusterConnections[CLUSTER_NAME].on("open", () => {
|
|
@@ -861,9 +861,9 @@ var require_MongoConnector = __commonJS({
|
|
|
861
861
|
console.log("\u{1F389} All MongoDB clusterConnections closed gracefully");
|
|
862
862
|
}
|
|
863
863
|
};
|
|
864
|
-
|
|
864
|
+
MongoConnector4.instance = null;
|
|
865
865
|
module2.exports = {
|
|
866
|
-
MongoConnector:
|
|
866
|
+
MongoConnector: MongoConnector4
|
|
867
867
|
};
|
|
868
868
|
}
|
|
869
869
|
});
|
|
@@ -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,
|
|
@@ -1663,7 +1670,7 @@ __export(node_exports, {
|
|
|
1663
1670
|
ElasticSearchConnector: () => import_ElasticSearchConnector.ElasticSearchConnector,
|
|
1664
1671
|
GET_GLOBAL_BULLMQ_CONFIG: () => import_GET_GLOBAL_BULLMQ_CONFIG.GET_GLOBAL_BULLMQ_CONFIG,
|
|
1665
1672
|
GeneratedTopicsSchema: () => GeneratedTopics_default,
|
|
1666
|
-
MongoConnector: () =>
|
|
1673
|
+
MongoConnector: () => import_MongoConnector3.MongoConnector,
|
|
1667
1674
|
PlatformConfigsSchema: () => PlatformConfigs_default,
|
|
1668
1675
|
ProducerManager: () => import_ProducerManager.ProducerManager,
|
|
1669
1676
|
RedisCacheConnector: () => RedisCacheConnector,
|
|
@@ -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,14 +2217,89 @@ 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
|
-
var
|
|
2295
|
+
var import_MongoConnector3 = __toESM(require_MongoConnector());
|
|
2211
2296
|
var import_ElasticSearchConnector = __toESM(require_ElasticSearchConnector());
|
|
2212
2297
|
|
|
2213
2298
|
// src/RedisCacheConnector.js
|
|
2214
2299
|
var import_ioredis = __toESM(require("ioredis"));
|
|
2215
2300
|
init_models();
|
|
2216
2301
|
var import_getModelByTenant = __toESM(require_getModelByTenant());
|
|
2302
|
+
var import_MongoConnector2 = __toESM(require_MongoConnector());
|
|
2217
2303
|
init_platformConfigTypes();
|
|
2218
2304
|
var BASE_SETTINGS_FOR_CONFIGS_CACHE = [
|
|
2219
2305
|
{
|
|
@@ -2477,7 +2563,13 @@ var RedisCacheConnector = class _RedisCacheConnector {
|
|
|
2477
2563
|
const environment = this.getEnv();
|
|
2478
2564
|
if (!tenant) throw new Error("No tenant/s defined to recache");
|
|
2479
2565
|
console.log(`Loading configs and templates into cache...`);
|
|
2566
|
+
const tenantToClusterMapping = import_MongoConnector2.MongoConnector.getTenantToClusterMapping();
|
|
2480
2567
|
const tenantCollectionPromises = toArray(tenant).map(async (tenant2) => {
|
|
2568
|
+
const clusterName = tenantToClusterMapping[tenant2]?.CLUSTER_NAME?.[environment];
|
|
2569
|
+
if (clusterName && import_MongoConnector2.MongoConnector.isClusterUnavailable(clusterName)) {
|
|
2570
|
+
console.log(`\u23ED\uFE0F Skipping cache load for tenant ${tenant2} (cluster ${clusterName} is unavailable)`);
|
|
2571
|
+
return;
|
|
2572
|
+
}
|
|
2481
2573
|
return Promise.all(
|
|
2482
2574
|
BASE_SETTINGS_FOR_CONFIGS_CACHE.map(
|
|
2483
2575
|
async ({ modelName, schema, defaultQuery, typeKey }) => {
|
|
@@ -2570,9 +2662,13 @@ var import_GET_GLOBAL_BULLMQ_CONFIG = __toESM(require_GET_GLOBAL_BULLMQ_CONFIG()
|
|
|
2570
2662
|
getPlatformConfigsModelByTenant,
|
|
2571
2663
|
getPlatformContextContent,
|
|
2572
2664
|
getRollupPossibilities,
|
|
2665
|
+
getRoutePathToEditContent,
|
|
2666
|
+
getRoutePathToModerateContent,
|
|
2667
|
+
getRoutePathToPublishedContent,
|
|
2573
2668
|
getTplModelByTenant,
|
|
2574
2669
|
getVal,
|
|
2575
2670
|
mergeAnnoDataIntoAnnotationsTags,
|
|
2671
|
+
parseSpecialConfigSyntax,
|
|
2576
2672
|
recursivelyExtractBlocks,
|
|
2577
2673
|
segrigateDocs,
|
|
2578
2674
|
setVal,
|
package/dist/node.mjs
CHANGED
|
@@ -686,7 +686,7 @@ var require_MongoConnector = __commonJS({
|
|
|
686
686
|
var AnnotationsSchema = (init_Annotations(), __toCommonJS(Annotations_exports));
|
|
687
687
|
var PlatformConfigsSchema2 = (init_PlatformConfigs(), __toCommonJS(PlatformConfigs_exports));
|
|
688
688
|
var TplSchema2 = (init_Tpl(), __toCommonJS(Tpl_exports));
|
|
689
|
-
var
|
|
689
|
+
var MongoConnector4 = class _MongoConnector {
|
|
690
690
|
constructor(options) {
|
|
691
691
|
__publicField(this, "initiateConnectionEventListeners", (CLUSTER_NAME) => {
|
|
692
692
|
this.clusterConnections[CLUSTER_NAME].on("open", () => {
|
|
@@ -866,9 +866,9 @@ var require_MongoConnector = __commonJS({
|
|
|
866
866
|
console.log("\u{1F389} All MongoDB clusterConnections closed gracefully");
|
|
867
867
|
}
|
|
868
868
|
};
|
|
869
|
-
|
|
869
|
+
MongoConnector4.instance = null;
|
|
870
870
|
module.exports = {
|
|
871
|
-
MongoConnector:
|
|
871
|
+
MongoConnector: MongoConnector4
|
|
872
872
|
};
|
|
873
873
|
}
|
|
874
874
|
});
|
|
@@ -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,14 +2178,89 @@ 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
|
-
var
|
|
2256
|
+
var import_MongoConnector3 = __toESM(require_MongoConnector());
|
|
2176
2257
|
var import_ElasticSearchConnector = __toESM(require_ElasticSearchConnector());
|
|
2177
2258
|
|
|
2178
2259
|
// src/RedisCacheConnector.js
|
|
2179
2260
|
init_models();
|
|
2180
2261
|
import Redis from "ioredis";
|
|
2181
2262
|
var import_getModelByTenant = __toESM(require_getModelByTenant());
|
|
2263
|
+
var import_MongoConnector2 = __toESM(require_MongoConnector());
|
|
2182
2264
|
init_platformConfigTypes();
|
|
2183
2265
|
var BASE_SETTINGS_FOR_CONFIGS_CACHE = [
|
|
2184
2266
|
{
|
|
@@ -2442,7 +2524,13 @@ var RedisCacheConnector = class _RedisCacheConnector {
|
|
|
2442
2524
|
const environment = this.getEnv();
|
|
2443
2525
|
if (!tenant) throw new Error("No tenant/s defined to recache");
|
|
2444
2526
|
console.log(`Loading configs and templates into cache...`);
|
|
2527
|
+
const tenantToClusterMapping = import_MongoConnector2.MongoConnector.getTenantToClusterMapping();
|
|
2445
2528
|
const tenantCollectionPromises = toArray(tenant).map(async (tenant2) => {
|
|
2529
|
+
const clusterName = tenantToClusterMapping[tenant2]?.CLUSTER_NAME?.[environment];
|
|
2530
|
+
if (clusterName && import_MongoConnector2.MongoConnector.isClusterUnavailable(clusterName)) {
|
|
2531
|
+
console.log(`\u23ED\uFE0F Skipping cache load for tenant ${tenant2} (cluster ${clusterName} is unavailable)`);
|
|
2532
|
+
return;
|
|
2533
|
+
}
|
|
2446
2534
|
return Promise.all(
|
|
2447
2535
|
BASE_SETTINGS_FOR_CONFIGS_CACHE.map(
|
|
2448
2536
|
async ({ modelName, schema, defaultQuery, typeKey }) => {
|
|
@@ -2512,7 +2600,7 @@ var export_BaseWorker = import_BaseWorker.BaseWorker;
|
|
|
2512
2600
|
var export_ChunksElasticSyncProducer = import_ChunksElasticSyncProducer.ChunksElasticSyncProducer;
|
|
2513
2601
|
var export_ElasticSearchConnector = import_ElasticSearchConnector.ElasticSearchConnector;
|
|
2514
2602
|
var export_GET_GLOBAL_BULLMQ_CONFIG = import_GET_GLOBAL_BULLMQ_CONFIG.GET_GLOBAL_BULLMQ_CONFIG;
|
|
2515
|
-
var export_MongoConnector =
|
|
2603
|
+
var export_MongoConnector = import_MongoConnector3.MongoConnector;
|
|
2516
2604
|
var export_ProducerManager = import_ProducerManager.ProducerManager;
|
|
2517
2605
|
var export_WorkerManager = import_WorkerManager.WorkerManager;
|
|
2518
2606
|
var export_getAIChatModelByTenant = import_getModelByTenant2.getAIChatModelByTenant;
|
|
@@ -2549,9 +2637,13 @@ export {
|
|
|
2549
2637
|
export_getPlatformConfigsModelByTenant as getPlatformConfigsModelByTenant,
|
|
2550
2638
|
getPlatformContextContent,
|
|
2551
2639
|
getRollupPossibilities,
|
|
2640
|
+
getRoutePathToEditContent,
|
|
2641
|
+
getRoutePathToModerateContent,
|
|
2642
|
+
getRoutePathToPublishedContent,
|
|
2552
2643
|
export_getTplModelByTenant as getTplModelByTenant,
|
|
2553
2644
|
getVal,
|
|
2554
2645
|
mergeAnnoDataIntoAnnotationsTags,
|
|
2646
|
+
parseSpecialConfigSyntax,
|
|
2555
2647
|
_recursExtractBlocks as recursivelyExtractBlocks,
|
|
2556
2648
|
segrigateDocs,
|
|
2557
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,
|