@vannizhang/living-atlas-content-validator 1.5.17 → 1.5.18-beta.2
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/README.md +1376 -162
- package/dist/configureSettings.d.ts +133 -0
- package/dist/configureSettings.js +61 -0
- package/dist/configureSettings.js.map +1 -0
- package/dist/data/TitleSummaryMatchingPatterns_Locations.json +829 -0
- package/dist/data/TitleSummaryMatchingPatterns_Sources.json +382 -0
- package/dist/data/TitleSummaryMatchingPatterns_Time.json +25 -0
- package/dist/data/TitleSummaryMatchingPatterns_Topics.json +1365 -0
- package/dist/data/TitleSummaryRejectedPatterns.json +44 -0
- package/dist/index.d.ts +27 -9
- package/dist/index.js +55 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/accessInformation/isValidAccessInformation.js +4 -6
- package/dist/lib/accessInformation/isValidAccessInformation.js.map +1 -1
- package/dist/lib/checkProfanities/checkProfanities.d.ts +7 -0
- package/dist/lib/checkProfanities/checkProfanities.js +26 -0
- package/dist/lib/checkProfanities/checkProfanities.js.map +1 -0
- package/dist/lib/checkTitleAndSnippetSearchability/checkTitleAndSnippetSearchability.d.ts +34 -0
- package/dist/lib/{recommendedText/checkRecommendedText.js → checkTitleAndSnippetSearchability/checkTitleAndSnippetSearchability.js} +51 -25
- package/dist/lib/checkTitleAndSnippetSearchability/checkTitleAndSnippetSearchability.js.map +1 -0
- package/dist/lib/checkTitleAndSnippetSearchability/config.d.ts +97 -0
- package/dist/lib/checkTitleAndSnippetSearchability/config.js +41 -0
- package/dist/lib/checkTitleAndSnippetSearchability/config.js.map +1 -0
- package/dist/lib/checkTitleAndSnippetSearchability/data.d.ts +0 -0
- package/dist/lib/checkTitleAndSnippetSearchability/data.js +693 -0
- package/dist/lib/checkTitleAndSnippetSearchability/data.js.map +1 -0
- package/dist/lib/checkTitleAndSnippetSearchability/helpers.d.ts +117 -0
- package/dist/lib/checkTitleAndSnippetSearchability/helpers.js +241 -0
- package/dist/lib/checkTitleAndSnippetSearchability/helpers.js.map +1 -0
- package/dist/lib/checkTitleAndSnippetSearchability/matchDateTimeInfo.d.ts +34 -0
- package/dist/lib/checkTitleAndSnippetSearchability/matchDateTimeInfo.js +207 -0
- package/dist/lib/checkTitleAndSnippetSearchability/matchDateTimeInfo.js.map +1 -0
- package/dist/lib/checkTitleAndSnippetSearchability/matchLocationInfo.d.ts +34 -0
- package/dist/lib/checkTitleAndSnippetSearchability/matchLocationInfo.js +170 -0
- package/dist/lib/checkTitleAndSnippetSearchability/matchLocationInfo.js.map +1 -0
- package/dist/lib/checkTitleAndSnippetSearchability/matchSourceInfo.d.ts +34 -0
- package/dist/lib/checkTitleAndSnippetSearchability/matchSourceInfo.js +172 -0
- package/dist/lib/checkTitleAndSnippetSearchability/matchSourceInfo.js.map +1 -0
- package/dist/lib/checkTitleAndSnippetSearchability/matchTopicInfo.d.ts +36 -0
- package/dist/lib/checkTitleAndSnippetSearchability/matchTopicInfo.js +175 -0
- package/dist/lib/checkTitleAndSnippetSearchability/matchTopicInfo.js.map +1 -0
- package/dist/lib/checkTitleAndSnippetSearchability/scoringConfig.js.map +1 -0
- package/dist/lib/config.d.ts +4 -1
- package/dist/lib/config.js +5 -5
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/deleteProtection/isDeleteProtectionEnabled.js +6 -2
- package/dist/lib/deleteProtection/isDeleteProtectionEnabled.js.map +1 -1
- package/dist/lib/deprecated/isDeprecated.js +5 -2
- package/dist/lib/deprecated/isDeprecated.js.map +1 -1
- package/dist/lib/description/isValidDescription.js +8 -5
- package/dist/lib/description/isValidDescription.js.map +1 -1
- package/dist/lib/licenseInfo/isValidLicenseInfo.js +5 -2
- package/dist/lib/licenseInfo/isValidLicenseInfo.js.map +1 -1
- package/dist/lib/sharing/isValidAccess.js +5 -2
- package/dist/lib/sharing/isValidAccess.js.map +1 -1
- package/dist/lib/ssl/isValidSSL.js +15 -6
- package/dist/lib/ssl/isValidSSL.js.map +1 -1
- package/dist/lib/summary/isValidSummary.js +6 -3
- package/dist/lib/summary/isValidSummary.js.map +1 -1
- package/dist/lib/tags/isValidTags.js +7 -3
- package/dist/lib/tags/isValidTags.js.map +1 -1
- package/dist/lib/thumbnail/isValidThumbnail.d.ts +6 -1
- package/dist/lib/thumbnail/isValidThumbnail.js +10 -7
- package/dist/lib/thumbnail/isValidThumbnail.js.map +1 -1
- package/dist/lib/title/isValidTitle.js +9 -3
- package/dist/lib/title/isValidTitle.js.map +1 -1
- package/dist/lib/userProfileDescription/isValidUserProfileDescription.js +44 -38
- package/dist/lib/userProfileDescription/isValidUserProfileDescription.js.map +1 -1
- package/dist/lib/userProfileName/isValidUserProfileName.js +8 -5
- package/dist/lib/userProfileName/isValidUserProfileName.js.map +1 -1
- package/dist/lib/userProfileThumbnail/isValidUserProfileThumbnail.js +6 -3
- package/dist/lib/userProfileThumbnail/isValidUserProfileThumbnail.js.map +1 -1
- package/dist/lib/util/containsNonEnglishCharacters.d.ts +13 -0
- package/dist/lib/util/containsNonEnglishCharacters.js +30 -0
- package/dist/lib/util/containsNonEnglishCharacters.js.map +1 -0
- package/dist/lib/util/countSentences.d.ts +23 -0
- package/dist/lib/util/countSentences.js +54 -0
- package/dist/lib/util/countSentences.js.map +1 -0
- package/dist/lib/util/createWordBoundaryRegex.d.ts +46 -0
- package/dist/lib/util/createWordBoundaryRegex.js +77 -0
- package/dist/lib/util/createWordBoundaryRegex.js.map +1 -0
- package/dist/lib/util/escapeSpecialCharacters.d.ts +7 -0
- package/dist/lib/util/escapeSpecialCharacters.js +22 -0
- package/dist/lib/util/escapeSpecialCharacters.js.map +1 -0
- package/dist/lib/util/getLivingAtlasSupportedItemTypes.d.ts +21 -0
- package/dist/lib/util/getLivingAtlasSupportedItemTypes.js +34 -0
- package/dist/lib/util/getLivingAtlasSupportedItemTypes.js.map +1 -0
- package/dist/lib/util/getNumberOfWords.js +6 -2
- package/dist/lib/util/getNumberOfWords.js.map +1 -1
- package/dist/lib/util/getScoringRules.js +6 -0
- package/dist/lib/util/getScoringRules.js.map +1 -1
- package/dist/lib/util/isLayer.js +3 -2
- package/dist/lib/util/isLayer.js.map +1 -1
- package/dist/lib/util/isUrl.d.ts +6 -0
- package/dist/lib/util/isUrl.js +16 -1
- package/dist/lib/util/isUrl.js.map +1 -1
- package/dist/lib/util/isValidRegexPattern.d.ts +7 -0
- package/dist/lib/util/isValidRegexPattern.js +20 -0
- package/dist/lib/util/isValidRegexPattern.js.map +1 -0
- package/dist/lib/util/sanitizeTags.d.ts +6 -0
- package/dist/lib/util/sanitizeTags.js +16 -0
- package/dist/lib/util/sanitizeTags.js.map +1 -0
- package/dist/lib/util/shouldValidateByBetaRules.js +6 -1
- package/dist/lib/util/shouldValidateByBetaRules.js.map +1 -1
- package/dist/lib/util/stringsConfig.d.ts +9 -0
- package/dist/lib/util/stringsConfig.js +9 -1
- package/dist/lib/util/stringsConfig.js.map +1 -1
- package/dist/lib/validate/validate.d.ts +57 -12
- package/dist/lib/validate/validate.js +87 -213
- package/dist/lib/validate/validate.js.map +1 -1
- package/dist/lib/validate/validateHelpers.d.ts +63 -0
- package/dist/lib/validate/validateHelpers.js +157 -0
- package/dist/lib/validate/validateHelpers.js.map +1 -0
- package/dist/locale/de.json +1 -1
- package/dist/locale/en.json +23 -23
- package/dist/locale/es.json +1 -1
- package/dist/locale/fr.json +1 -1
- package/dist/locale/ja.json +1 -1
- package/dist/locale/pt-br.json +1 -1
- package/dist/package-info.json +1 -1
- package/dist/services/content-validator-assets/config.d.ts +4 -0
- package/dist/services/content-validator-assets/config.js +8 -0
- package/dist/services/content-validator-assets/config.js.map +1 -0
- package/dist/services/content-validator-assets/fetchAdditonalPatterns4TitleAndSnippetSearchability.d.ts +95 -0
- package/dist/services/content-validator-assets/fetchAdditonalPatterns4TitleAndSnippetSearchability.js +92 -0
- package/dist/services/content-validator-assets/fetchAdditonalPatterns4TitleAndSnippetSearchability.js.map +1 -0
- package/dist/services/content-validator-assets/fetchProfanitiesData.d.ts +18 -0
- package/dist/services/content-validator-assets/fetchProfanitiesData.js +55 -0
- package/dist/services/content-validator-assets/fetchProfanitiesData.js.map +1 -0
- package/dist/services/content-validator-assets/helpers.d.ts +16 -0
- package/dist/services/content-validator-assets/helpers.js +35 -0
- package/dist/services/content-validator-assets/helpers.js.map +1 -0
- package/dist/services/custom-terms/config.d.ts +27 -0
- package/dist/services/custom-terms/config.js +79 -0
- package/dist/services/custom-terms/config.js.map +1 -0
- package/dist/services/custom-terms/customTerms.d.ts +229 -0
- package/dist/services/custom-terms/customTerms.js +394 -0
- package/dist/services/custom-terms/customTerms.js.map +1 -0
- package/dist/services/custom-terms/helpers.d.ts +8 -0
- package/dist/services/custom-terms/helpers.js +25 -0
- package/dist/services/custom-terms/helpers.js.map +1 -0
- package/dist/services/custom-terms/index.d.ts +3 -0
- package/dist/services/custom-terms/index.js +10 -0
- package/dist/services/custom-terms/index.js.map +1 -0
- package/dist/services/custom-terms-review-results/config.d.ts +31 -0
- package/dist/services/custom-terms-review-results/config.js +78 -0
- package/dist/services/custom-terms-review-results/config.js.map +1 -0
- package/dist/services/custom-terms-review-results/customTermsReviewResults.d.ts +133 -0
- package/dist/services/custom-terms-review-results/customTermsReviewResults.js +276 -0
- package/dist/services/custom-terms-review-results/customTermsReviewResults.js.map +1 -0
- package/dist/services/custom-terms-review-results/helpers.d.ts +24 -0
- package/dist/services/custom-terms-review-results/helpers.js +52 -0
- package/dist/services/custom-terms-review-results/helpers.js.map +1 -0
- package/dist/services/custom-terms-review-results/index.d.ts +4 -0
- package/dist/services/custom-terms-review-results/index.js +13 -0
- package/dist/services/custom-terms-review-results/index.js.map +1 -0
- package/dist/services/shared/addFeatures.d.ts +28 -0
- package/dist/services/shared/addFeatures.js +52 -0
- package/dist/services/shared/addFeatures.js.map +1 -0
- package/dist/services/shared/applyEdits.d.ts +28 -0
- package/dist/services/shared/applyEdits.js +53 -0
- package/dist/services/shared/applyEdits.js.map +1 -0
- package/dist/services/shared/config.d.ts +44 -0
- package/dist/services/shared/config.js +35 -0
- package/dist/services/shared/config.js.map +1 -0
- package/dist/services/shared/getItemInfo.d.ts +36 -0
- package/dist/services/shared/getItemInfo.js +56 -0
- package/dist/services/shared/getItemInfo.js.map +1 -0
- package/dist/types/index.d.ts +25 -22
- package/package.json +4 -3
- package/dist/__tests__/test-data/title-summary-data.json +0 -14654
- package/dist/data/TitleSummaryMatchingPatterns.json +0 -1902
- package/dist/lib/layers/isValidLayerCount.d.ts +0 -12
- package/dist/lib/layers/isValidLayerCount.js +0 -171
- package/dist/lib/layers/isValidLayerCount.js.map +0 -1
- package/dist/lib/layers/scoringConfig.d.ts +0 -10
- package/dist/lib/layers/scoringConfig.js +0 -20
- package/dist/lib/layers/scoringConfig.js.map +0 -1
- package/dist/lib/recommendedText/checkRecommendedText.d.ts +0 -15
- package/dist/lib/recommendedText/checkRecommendedText.js.map +0 -1
- package/dist/lib/recommendedText/helpers.d.ts +0 -15
- package/dist/lib/recommendedText/helpers.js +0 -62
- package/dist/lib/recommendedText/helpers.js.map +0 -1
- package/dist/lib/recommendedText/matchDateTimeInfo.d.ts +0 -9
- package/dist/lib/recommendedText/matchDateTimeInfo.js +0 -81
- package/dist/lib/recommendedText/matchDateTimeInfo.js.map +0 -1
- package/dist/lib/recommendedText/matchLocationInfo.d.ts +0 -9
- package/dist/lib/recommendedText/matchLocationInfo.js +0 -745
- package/dist/lib/recommendedText/matchLocationInfo.js.map +0 -1
- package/dist/lib/recommendedText/matchSourceInfo.d.ts +0 -9
- package/dist/lib/recommendedText/matchSourceInfo.js +0 -32
- package/dist/lib/recommendedText/matchSourceInfo.js.map +0 -1
- package/dist/lib/recommendedText/matchTopicInfo.d.ts +0 -9
- package/dist/lib/recommendedText/matchTopicInfo.js +0 -32
- package/dist/lib/recommendedText/matchTopicInfo.js.map +0 -1
- package/dist/lib/recommendedText/scoringConfig.js.map +0 -1
- /package/dist/lib/{recommendedText → checkTitleAndSnippetSearchability}/scoringConfig.d.ts +0 -0
- /package/dist/lib/{recommendedText → checkTitleAndSnippetSearchability}/scoringConfig.js +0 -0
|
@@ -77,8 +77,14 @@ const getScoringRulesLocaleByItemOwner = (owner) => {
|
|
|
77
77
|
'EsriSuisse_Content',
|
|
78
78
|
'EsriEspanaContenidos',
|
|
79
79
|
'Esri_JP_Content',
|
|
80
|
+
'Esri_KR_Content',
|
|
80
81
|
'esri_DE_content',
|
|
81
82
|
'CommunityMaps_EsriColombia',
|
|
83
|
+
'Esri_SE_Content',
|
|
84
|
+
'Esri Sverige Content',
|
|
85
|
+
'Esri_cy_TW',
|
|
86
|
+
'EsriThailand_Content',
|
|
87
|
+
'Publicetajs_Envirotech',
|
|
82
88
|
];
|
|
83
89
|
if (internationalDistributors.includes(owner)) {
|
|
84
90
|
return 'international';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getScoringRules.js","sourceRoot":"","sources":["../../../src/lib/util/getScoringRules.ts"],"names":[],"mappings":";AAAA,WAAW;AACX,aAAa;AACb,mBAAmB;AACnB,oBAAoB;AACpB,0BAA0B;AAC1B,0BAA0B;AAC1B,wBAAwB;AACxB,wBAAwB;AACxB,4DAA4D;;;AAO5D,MAAM;AACN,wGAAwG;AACxG,MAAM;AACN,sCAAsC;AACtC,oCAAoC;AACpC,uBAAuB;AACvB,QAAQ;AACR,uCAAuC;AACvC,oCAAoC;AACpC,kCAAkC;AAClC,gCAAgC;AAChC,4BAA4B;AAC5B,wCAAwC;AACxC,2CAA2C;AAC3C,4CAA4C;AAC5C,+CAA+C;AAC/C,mCAAmC;AACnC,oCAAoC;AACpC,0BAA0B;AAC1B,oCAAoC;AACpC,gCAAgC;AAChC,gCAAgC;AAChC,sCAAsC;AACtC,wCAAwC;AACxC,+BAA+B;AAC/B,uCAAuC;AACvC,gDAAgD;AAChD,gDAAgD;AAChD,0BAA0B;AAC1B,KAAK;AAEL;;;;;;GAMG;AACI,MAAM,qBAAqB,GAAG,CAAC,OAAe,EAAsB,EAAE;IACzE,IAAI,CAAC,OAAO,EAAE;QACV,OAAO,IAAI,CAAC;KACf;IAED,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAExC,IACI,UAAU,KAAK,IAAI;QACnB,OAAO,KAAK,yBAAyB;QACrC,OAAO,KAAK,EAAE,EAChB;QACE,OAAO,IAAI,CAAC;KACf;IAED,OAAO,eAAe,CAAC;AAC3B,CAAC,CAAC;AAhBW,QAAA,qBAAqB,yBAgBhC;AAEF;;;;;;GAMG;AACI,MAAM,gCAAgC,GAAG,CAC5C,KAAa,EACK,EAAE;IACpB,IAAI,CAAC,KAAK,EAAE;QACR,OAAO,IAAI,CAAC;KACf;IAED,MAAM,yBAAyB,GAAG;QAC9B,iBAAiB;QACjB,qBAAqB;QACrB,oBAAoB;QACpB,sBAAsB;QACtB,iBAAiB;QACjB,iBAAiB;QACjB,4BAA4B;
|
|
1
|
+
{"version":3,"file":"getScoringRules.js","sourceRoot":"","sources":["../../../src/lib/util/getScoringRules.ts"],"names":[],"mappings":";AAAA,WAAW;AACX,aAAa;AACb,mBAAmB;AACnB,oBAAoB;AACpB,0BAA0B;AAC1B,0BAA0B;AAC1B,wBAAwB;AACxB,wBAAwB;AACxB,4DAA4D;;;AAO5D,MAAM;AACN,wGAAwG;AACxG,MAAM;AACN,sCAAsC;AACtC,oCAAoC;AACpC,uBAAuB;AACvB,QAAQ;AACR,uCAAuC;AACvC,oCAAoC;AACpC,kCAAkC;AAClC,gCAAgC;AAChC,4BAA4B;AAC5B,wCAAwC;AACxC,2CAA2C;AAC3C,4CAA4C;AAC5C,+CAA+C;AAC/C,mCAAmC;AACnC,oCAAoC;AACpC,0BAA0B;AAC1B,oCAAoC;AACpC,gCAAgC;AAChC,gCAAgC;AAChC,sCAAsC;AACtC,wCAAwC;AACxC,+BAA+B;AAC/B,uCAAuC;AACvC,gDAAgD;AAChD,gDAAgD;AAChD,0BAA0B;AAC1B,KAAK;AAEL;;;;;;GAMG;AACI,MAAM,qBAAqB,GAAG,CAAC,OAAe,EAAsB,EAAE;IACzE,IAAI,CAAC,OAAO,EAAE;QACV,OAAO,IAAI,CAAC;KACf;IAED,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAExC,IACI,UAAU,KAAK,IAAI;QACnB,OAAO,KAAK,yBAAyB;QACrC,OAAO,KAAK,EAAE,EAChB;QACE,OAAO,IAAI,CAAC;KACf;IAED,OAAO,eAAe,CAAC;AAC3B,CAAC,CAAC;AAhBW,QAAA,qBAAqB,yBAgBhC;AAEF;;;;;;GAMG;AACI,MAAM,gCAAgC,GAAG,CAC5C,KAAa,EACK,EAAE;IACpB,IAAI,CAAC,KAAK,EAAE;QACR,OAAO,IAAI,CAAC;KACf;IAED,MAAM,yBAAyB,GAAG;QAC9B,iBAAiB;QACjB,qBAAqB;QACrB,oBAAoB;QACpB,sBAAsB;QACtB,iBAAiB;QACjB,iBAAiB;QACjB,iBAAiB;QACjB,4BAA4B;QAC5B,iBAAiB;QACjB,sBAAsB;QACtB,YAAY;QACZ,sBAAsB;QACtB,wBAAwB;KAC3B,CAAC;IAEF,IAAI,yBAAyB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC3C,OAAO,eAAe,CAAC;KAC1B;IAED,OAAO,IAAI,CAAC;IACZ,0BAA0B;AAC9B,CAAC,CAAC;AA7BW,QAAA,gCAAgC,oCA6B3C;AAEF,MAAM;AACN,kFAAkF;AAClF,qBAAqB;AACrB,+BAA+B;AAC/B,cAAc;AACd,MAAM;AACN,mCAAmC;AACnC,mBAAmB;AACnB,6CAA6C;AAC7C,uBAAuB;AACvB,kDAAkD;AAElD,8CAA8C;AAE9C,+BAA+B;AAC/B,qEAAqE;AAErE,kEAAkE;AAElE,8DAA8D;AAE9D,6BAA6B;AAC7B,wCAAwC;AACxC,qCAAqC;AACrC,mCAAmC;AACnC,iCAAiC;AACjC,6BAA6B;AAC7B,yCAAyC;AACzC,6DAA6D;AAC7D,wBAAwB;AACxB,0CAA0C;AAC1C,2CAA2C;AAC3C,8CAA8C;AAC9C,kCAAkC;AAClC,mCAAmC;AACnC,2BAA2B;AAC3B,mCAAmC;AACnC,+BAA+B;AAC/B,+DAA+D;AAC/D,wBAAwB;AACxB,+BAA+B;AAC/B,mCAAmC;AACnC,qCAAqC;AACrC,8BAA8B;AAC9B,oCAAoC;AACpC,6CAA6C;AAC7C,6CAA6C;AAC7C,yBAAyB;AACzB,iEAAiE;AACjE,wBAAwB;AACxB,sBAAsB;AACtB,wBAAwB;AACxB,2BAA2B;AAC3B,WAAW;AAEX,wDAAwD;AACxD,KAAK"}
|
package/dist/lib/util/isLayer.js
CHANGED
|
@@ -19,8 +19,9 @@ const isLayer = (item) => {
|
|
|
19
19
|
itemType === 'Vector Tile Service' ||
|
|
20
20
|
itemType === 'WMS' ||
|
|
21
21
|
itemType === 'Group Layer' ||
|
|
22
|
-
itemType === 'Scene Service'
|
|
23
|
-
|
|
22
|
+
itemType === 'Scene Service'
|
|
23
|
+
// itemType === 'Media Layer'
|
|
24
|
+
);
|
|
24
25
|
};
|
|
25
26
|
exports.isLayer = isLayer;
|
|
26
27
|
//# sourceMappingURL=isLayer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isLayer.js","sourceRoot":"","sources":["../../../src/lib/util/isLayer.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;GASG;AACI,MAAM,OAAO,GAAG,CAAC,IAAW,EAAW,EAAE;IAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAoC,CAAC;IAE3D,OAAO,CACH,QAAQ,KAAK,iBAAiB;QAC9B,QAAQ,KAAK,eAAe;QAC5B,QAAQ,KAAK,aAAa;QAC1B,QAAQ,KAAK,qBAAqB;QAClC,QAAQ,KAAK,KAAK;QAClB,QAAQ,KAAK,aAAa;QAC1B,QAAQ,KAAK,eAAe;
|
|
1
|
+
{"version":3,"file":"isLayer.js","sourceRoot":"","sources":["../../../src/lib/util/isLayer.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;;GASG;AACI,MAAM,OAAO,GAAG,CAAC,IAAW,EAAW,EAAE;IAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAoC,CAAC;IAE3D,OAAO,CACH,QAAQ,KAAK,iBAAiB;QAC9B,QAAQ,KAAK,eAAe;QAC5B,QAAQ,KAAK,aAAa;QAC1B,QAAQ,KAAK,qBAAqB;QAClC,QAAQ,KAAK,KAAK;QAClB,QAAQ,KAAK,aAAa;QAC1B,QAAQ,KAAK,eAAe;IAC5B,6BAA6B;KAChC,CAAC;AACN,CAAC,CAAC;AAbW,QAAA,OAAO,WAalB"}
|
package/dist/lib/util/isUrl.d.ts
CHANGED
|
@@ -2,3 +2,9 @@
|
|
|
2
2
|
* Check if input string is a valid URL, ignoring leading/trailing characters like parentheses, dots, or whitespace
|
|
3
3
|
*/
|
|
4
4
|
export declare const isUrl: (str: string) => boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Check if input string contains a valid URL
|
|
7
|
+
* @param str - The input string to check
|
|
8
|
+
* @returns true if the string contains a valid URL, false otherwise
|
|
9
|
+
*/
|
|
10
|
+
export declare const containsUrl: (str: string) => boolean;
|
package/dist/lib/util/isUrl.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isUrl = void 0;
|
|
3
|
+
exports.containsUrl = exports.isUrl = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Check if input string is a valid URL, ignoring leading/trailing characters like parentheses, dots, or whitespace
|
|
6
6
|
*/
|
|
@@ -11,4 +11,19 @@ const isUrl = (str) => {
|
|
|
11
11
|
return regexp.test(trimmedStr);
|
|
12
12
|
};
|
|
13
13
|
exports.isUrl = isUrl;
|
|
14
|
+
/**
|
|
15
|
+
* Check if input string contains a valid URL
|
|
16
|
+
* @param str - The input string to check
|
|
17
|
+
* @returns true if the string contains a valid URL, false otherwise
|
|
18
|
+
*/
|
|
19
|
+
const containsUrl = (str) => {
|
|
20
|
+
if (!str) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
str = str.replace(/ | /g, '\n'); // Replace HTML new lines with actual new lines
|
|
24
|
+
// Split the string by spaces and check each word
|
|
25
|
+
const words = str.split(/\s+|\n+/);
|
|
26
|
+
return words.some((word) => (0, exports.isUrl)(word));
|
|
27
|
+
};
|
|
28
|
+
exports.containsUrl = containsUrl;
|
|
14
29
|
//# sourceMappingURL=isUrl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUrl.js","sourceRoot":"","sources":["../../../src/lib/util/isUrl.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,KAAK,GAAG,CAAC,GAAW,EAAW,EAAE;IAC1C,gFAAgF;IAChF,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAE9D,MAAM,MAAM,GACR,8aAA8a,CAAC;IAEnb,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACnC,CAAC,CAAC;AARW,QAAA,KAAK,SAQhB"}
|
|
1
|
+
{"version":3,"file":"isUrl.js","sourceRoot":"","sources":["../../../src/lib/util/isUrl.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,KAAK,GAAG,CAAC,GAAW,EAAW,EAAE;IAC1C,gFAAgF;IAChF,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAE9D,MAAM,MAAM,GACR,8aAA8a,CAAC;IAEnb,OAAO,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACnC,CAAC,CAAC;AARW,QAAA,KAAK,SAQhB;AAEF;;;;GAIG;AACI,MAAM,WAAW,GAAG,CAAC,GAAW,EAAW,EAAE;IAChD,IAAI,CAAC,GAAG,EAAE;QACN,OAAO,KAAK,CAAC;KAChB;IAED,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,CAAC,+CAA+C;IAExF,iDAAiD;IACjD,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAEnC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,aAAK,EAAC,IAAI,CAAC,CAAC,CAAC;AAC7C,CAAC,CAAC;AAXW,QAAA,WAAW,eAWtB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the given string is a valid regular expression pattern.
|
|
3
|
+
*
|
|
4
|
+
* @param pattern - The string to be tested as a regular expression pattern.
|
|
5
|
+
* @returns {boolean} `true` if the pattern is a valid regular expression, otherwise `false`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isValidRegexPattern: (pattern: string) => boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isValidRegexPattern = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the given string is a valid regular expression pattern.
|
|
6
|
+
*
|
|
7
|
+
* @param pattern - The string to be tested as a regular expression pattern.
|
|
8
|
+
* @returns {boolean} `true` if the pattern is a valid regular expression, otherwise `false`.
|
|
9
|
+
*/
|
|
10
|
+
const isValidRegexPattern = (pattern) => {
|
|
11
|
+
try {
|
|
12
|
+
new RegExp(pattern);
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
exports.isValidRegexPattern = isValidRegexPattern;
|
|
20
|
+
//# sourceMappingURL=isValidRegexPattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidRegexPattern.js","sourceRoot":"","sources":["../../../src/lib/util/isValidRegexPattern.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACI,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAW,EAAE;IAC5D,IAAI;QACA,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;KACf;IAAC,OAAO,CAAC,EAAE;QACR,OAAO,KAAK,CAAC;KAChB;AACL,CAAC,CAAC;AAPW,QAAA,mBAAmB,uBAO9B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sanitizeTags = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Cleans up an array of tags by trimming whitespace and removing empty strings.
|
|
6
|
+
* @param tags - An array of tags to be cleaned up.
|
|
7
|
+
* @returns A new array of cleaned tags.
|
|
8
|
+
*/
|
|
9
|
+
const sanitizeTags = (tags) => {
|
|
10
|
+
if (!tags || !Array.isArray(tags)) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
return tags.map((tag) => tag.trim()).filter((tag) => tag.length > 0);
|
|
14
|
+
};
|
|
15
|
+
exports.sanitizeTags = sanitizeTags;
|
|
16
|
+
//# sourceMappingURL=sanitizeTags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitizeTags.js","sourceRoot":"","sources":["../../../src/lib/util/sanitizeTags.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,MAAM,YAAY,GAAG,CAAC,IAAc,EAAY,EAAE;IACrD,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC/B,OAAO,EAAE,CAAC;KACb;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACzE,CAAC,CAAC;AANW,QAAA,YAAY,gBAMvB"}
|
|
@@ -33,7 +33,12 @@ const additonalAccounts = [
|
|
|
33
33
|
'EsriUKContent',
|
|
34
34
|
'jzhang_content',
|
|
35
35
|
];
|
|
36
|
-
const additonalAccountsDevext = [
|
|
36
|
+
const additonalAccountsDevext = [
|
|
37
|
+
'kbaloun_dev',
|
|
38
|
+
'Curator_JZhang',
|
|
39
|
+
'jinnanzhang',
|
|
40
|
+
'jherries_mapit',
|
|
41
|
+
];
|
|
37
42
|
/**
|
|
38
43
|
* Determine if the item qualifies for validation under beta rules.
|
|
39
44
|
* Beta rules are applied to items owned by Esri and other specific accounts decided by Jim Herries.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shouldValidateByBetaRules.js","sourceRoot":"","sources":["../../../src/lib/util/shouldValidateByBetaRules.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAa;IAChC,MAAM;IACN,wBAAwB;IACxB,gBAAgB;IAChB,SAAS;IACT,gBAAgB;IAChB,WAAW;IACX,eAAe;IACf,UAAU;IACV,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,iBAAiB;IACjB,SAAS;IACT,iBAAiB;IACjB,gBAAgB;IAChB,cAAc;IACd,sBAAsB;IACtB,kBAAkB;IAClB,gBAAgB;IAChB,gBAAgB;CACnB,CAAC;AAEF,MAAM,iBAAiB,GAAG;IACtB,YAAY;IACZ,0BAA0B;IAC1B,iBAAiB;IACjB,aAAa;IACb,eAAe;IACf,gBAAgB;CACnB,CAAC;AAEF,MAAM,uBAAuB,GAAG,
|
|
1
|
+
{"version":3,"file":"shouldValidateByBetaRules.js","sourceRoot":"","sources":["../../../src/lib/util/shouldValidateByBetaRules.ts"],"names":[],"mappings":";;;AAEa,QAAA,UAAU,GAAa;IAChC,MAAM;IACN,wBAAwB;IACxB,gBAAgB;IAChB,SAAS;IACT,gBAAgB;IAChB,WAAW;IACX,eAAe;IACf,UAAU;IACV,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,mBAAmB;IACnB,mBAAmB;IACnB,iBAAiB;IACjB,SAAS;IACT,iBAAiB;IACjB,gBAAgB;IAChB,cAAc;IACd,sBAAsB;IACtB,kBAAkB;IAClB,gBAAgB;IAChB,gBAAgB;CACnB,CAAC;AAEF,MAAM,iBAAiB,GAAG;IACtB,YAAY;IACZ,0BAA0B;IAC1B,iBAAiB;IACjB,aAAa;IACb,eAAe;IACf,gBAAgB;CACnB,CAAC;AAEF,MAAM,uBAAuB,GAAG;IAC5B,aAAa;IACb,gBAAgB;IAChB,aAAa;IACb,gBAAgB;CACnB,CAAC;AAEF;;;;;;GAMG;AACI,MAAM,yBAAyB,GAAG,CAAC,IAAW,EAAW,EAAE;IAC9D,MAAM,KAAK,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC;IAE1B,IAAI,CAAC,KAAK,EAAE;QACR,OAAO,KAAK,CAAC;KAChB;IAED,OAAO,CACH,kBAAU,CAAC,QAAQ,CAAC,KAAK,CAAC;QAC1B,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC;QACjC,uBAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAC1C,CAAC;AACN,CAAC,CAAC;AAZW,QAAA,yBAAyB,6BAYpC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import enStringsConfig from '../../locale/en.json';
|
|
2
|
+
/**
|
|
3
|
+
* Living Atlas Supported language. There are JSON files for each of these six languages
|
|
4
|
+
*/
|
|
5
|
+
export type Locale = 'en' | 'de' | 'es' | 'fr' | 'ja' | 'pt-br';
|
|
2
6
|
/**
|
|
3
7
|
* A JSON file contains strings for all validation rules
|
|
4
8
|
*/
|
|
@@ -13,3 +17,8 @@ export declare const setStrings: (preferredLocale: string) => void;
|
|
|
13
17
|
* @returns
|
|
14
18
|
*/
|
|
15
19
|
export declare const getStringsConfig: () => ValidationRulesStringJSON;
|
|
20
|
+
/**
|
|
21
|
+
* Get default strings config, which is English
|
|
22
|
+
* @returns Default strings config
|
|
23
|
+
*/
|
|
24
|
+
export declare const getDefaultStringsConfig: () => ValidationRulesStringJSON;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getStringsConfig = exports.setStrings = void 0;
|
|
6
|
+
exports.getDefaultStringsConfig = exports.getStringsConfig = exports.setStrings = void 0;
|
|
7
7
|
// import config from '../config';
|
|
8
8
|
const de_json_1 = __importDefault(require("../../locale/de.json"));
|
|
9
9
|
const en_json_1 = __importDefault(require("../../locale/en.json"));
|
|
@@ -42,4 +42,12 @@ const getStringsConfig = () => {
|
|
|
42
42
|
return stringsByLocale[locale] || en_json_1.default;
|
|
43
43
|
};
|
|
44
44
|
exports.getStringsConfig = getStringsConfig;
|
|
45
|
+
/**
|
|
46
|
+
* Get default strings config, which is English
|
|
47
|
+
* @returns Default strings config
|
|
48
|
+
*/
|
|
49
|
+
const getDefaultStringsConfig = () => {
|
|
50
|
+
return en_json_1.default;
|
|
51
|
+
};
|
|
52
|
+
exports.getDefaultStringsConfig = getDefaultStringsConfig;
|
|
45
53
|
//# sourceMappingURL=stringsConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringsConfig.js","sourceRoot":"","sources":["../../../src/lib/util/stringsConfig.ts"],"names":[],"mappings":";;;;;;AAAA,kCAAkC;AAClC,mEAAmD;AACnD,mEAAmD;AACnD,mEAAmD;AACnD,mEAAmD;AACnD,mEAAmD;AACnD,yEAAwD;AAYxD;;GAEG;AACH,IAAI,MAAM,GAAW,IAAI,CAAC;AAE1B,MAAM,eAAe,GAA8C;IAC/D,EAAE,EAAE,iBAAe;IACnB,EAAE,EAAE,iBAAe;IACnB,EAAE,EAAE,iBAAe;IACnB,EAAE,EAAE,iBAAe;IACnB,EAAE,EAAE,iBAAe;IACnB,OAAO,EAAE,oBAAiB;CAC7B,CAAC;AAEF;;;GAGG;AACI,MAAM,UAAU,GAAG,CAAC,eAAuB,EAAE,EAAE;IAClD,MAAM,YAAY,GAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAEvE,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,eAAyB,CAAC;QACrD,CAAC,CAAE,eAA0B;QAC7B,CAAC,CAAC,IAAI,CAAC;AACf,CAAC,CAAC;AANW,QAAA,UAAU,cAMrB;AAEF;;;GAGG;AACI,MAAM,gBAAgB,GAAG,GAA8B,EAAE;IAC5D,OAAO,eAAe,CAAC,MAAM,CAAC,IAAI,iBAAe,CAAC;AACtD,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B"}
|
|
1
|
+
{"version":3,"file":"stringsConfig.js","sourceRoot":"","sources":["../../../src/lib/util/stringsConfig.ts"],"names":[],"mappings":";;;;;;AAAA,kCAAkC;AAClC,mEAAmD;AACnD,mEAAmD;AACnD,mEAAmD;AACnD,mEAAmD;AACnD,mEAAmD;AACnD,yEAAwD;AAYxD;;GAEG;AACH,IAAI,MAAM,GAAW,IAAI,CAAC;AAE1B,MAAM,eAAe,GAA8C;IAC/D,EAAE,EAAE,iBAAe;IACnB,EAAE,EAAE,iBAAe;IACnB,EAAE,EAAE,iBAAe;IACnB,EAAE,EAAE,iBAAe;IACnB,EAAE,EAAE,iBAAe;IACnB,OAAO,EAAE,oBAAiB;CAC7B,CAAC;AAEF;;;GAGG;AACI,MAAM,UAAU,GAAG,CAAC,eAAuB,EAAE,EAAE;IAClD,MAAM,YAAY,GAAa,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAEvE,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,eAAyB,CAAC;QACrD,CAAC,CAAE,eAA0B;QAC7B,CAAC,CAAC,IAAI,CAAC;AACf,CAAC,CAAC;AANW,QAAA,UAAU,cAMrB;AAEF;;;GAGG;AACI,MAAM,gBAAgB,GAAG,GAA8B,EAAE;IAC5D,OAAO,eAAe,CAAC,MAAM,CAAC,IAAI,iBAAe,CAAC;AACtD,CAAC,CAAC;AAFW,QAAA,gBAAgB,oBAE3B;AAEF;;;GAGG;AACI,MAAM,uBAAuB,GAAG,GAA8B,EAAE;IACnE,OAAO,iBAAe,CAAC;AAC3B,CAAC,CAAC;AAFW,QAAA,uBAAuB,2BAElC"}
|
|
@@ -1,18 +1,63 @@
|
|
|
1
1
|
import { IItem, IUser, ValidationResult } from '../../types';
|
|
2
|
+
type ValidateOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* Custom patterns for location information.
|
|
5
|
+
*/
|
|
6
|
+
customPatternsForLocationInfo?: string[];
|
|
7
|
+
/**
|
|
8
|
+
* Custom patterns for data vintage information.
|
|
9
|
+
*/
|
|
10
|
+
customPatternsForDataVintageInfo?: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Custom patterns for source information.
|
|
13
|
+
*/
|
|
14
|
+
customPatternsForSourceInfo?: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Custom patterns for time information.
|
|
17
|
+
*/
|
|
18
|
+
customPatternsForTopicInfo?: string[];
|
|
19
|
+
/**
|
|
20
|
+
* The dimension of the largest thumbnail
|
|
21
|
+
* that we can retrieve from ArcGIS Online.
|
|
22
|
+
*/
|
|
23
|
+
thumbnailDimension?: {
|
|
24
|
+
width: number;
|
|
25
|
+
height: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
2
28
|
/**
|
|
3
|
-
*
|
|
29
|
+
* Validates an ArcGIS item and user profile against Living Atlas criteria.
|
|
4
30
|
*
|
|
5
|
-
*
|
|
31
|
+
* @param item - The ArcGIS item to validate
|
|
32
|
+
* @param userProfile - The user profile associated with the item
|
|
33
|
+
* @param options - Optional validation configuration
|
|
34
|
+
* @param options.customPatternsForLocationInfo - Custom patterns to check for location information
|
|
35
|
+
* @param options.customPatternsForDataVintageInfo - Custom patterns to check for data vintage information
|
|
36
|
+
* @param options.customPatternsForSourceInfo - Custom patterns to check for source information
|
|
37
|
+
* @param options.customPatternsForTopicInfo - Custom patterns to check for topic information
|
|
38
|
+
* @param options.thumbnailDimension - Expected thumbnail dimensions
|
|
39
|
+
* @returns A ValidationResult object containing detailed validation results and an overall score
|
|
6
40
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
41
|
+
* The validation checks multiple aspects of the item including:
|
|
42
|
+
* - Access settings
|
|
43
|
+
* - Access information
|
|
44
|
+
* - Description
|
|
45
|
+
* - License information
|
|
46
|
+
* - Summary/snippet
|
|
47
|
+
* - SSL configuration
|
|
48
|
+
* - Tags
|
|
49
|
+
* - Thumbnail
|
|
50
|
+
* - Title
|
|
51
|
+
* - Deprecation status
|
|
52
|
+
* - Delete protection
|
|
53
|
+
* - Searchability of title and summary
|
|
54
|
+
*
|
|
55
|
+
* It also validates user profile aspects:
|
|
56
|
+
* - Profile description
|
|
57
|
+
* - Full name
|
|
58
|
+
* - Profile thumbnail
|
|
14
59
|
*
|
|
15
|
-
*
|
|
16
|
-
* @returns true if it meets the minimum threshold
|
|
60
|
+
* The result includes a total score and whether the item meets criteria for nomination.
|
|
17
61
|
*/
|
|
18
|
-
export declare const
|
|
62
|
+
export declare const validate: (item: IItem, userProfile: IUser, { customPatternsForLocationInfo, customPatternsForDataVintageInfo, customPatternsForSourceInfo, customPatternsForTopicInfo, thumbnailDimension, }?: ValidateOptions) => ValidationResult;
|
|
63
|
+
export {};
|
|
@@ -1,126 +1,95 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const __1 = require("../../");
|
|
5
|
-
const config_1 = require("../config");
|
|
6
|
-
const round_1 = require("../util/round");
|
|
3
|
+
exports.validate = void 0;
|
|
7
4
|
const isDeleteProtectionEnabled_1 = require("../deleteProtection/isDeleteProtectionEnabled");
|
|
8
|
-
const
|
|
5
|
+
const checkTitleAndSnippetSearchability_1 = require("../checkTitleAndSnippetSearchability/checkTitleAndSnippetSearchability");
|
|
6
|
+
const isValidAccess_1 = require("../sharing/isValidAccess");
|
|
7
|
+
const isValidAccessInformation_1 = require("../accessInformation/isValidAccessInformation");
|
|
8
|
+
const isValidDescription_1 = require("../description/isValidDescription");
|
|
9
|
+
// import { isValidLayerCount } from '../layers/isValidLayerCount';
|
|
10
|
+
const isValidLicenseInfo_1 = require("../licenseInfo/isValidLicenseInfo");
|
|
11
|
+
const isValidSummary_1 = require("../summary/isValidSummary");
|
|
12
|
+
const isValidSSL_1 = require("../ssl/isValidSSL");
|
|
13
|
+
const isValidTags_1 = require("../tags/isValidTags");
|
|
14
|
+
const isValidThumbnail_1 = require("../thumbnail/isValidThumbnail");
|
|
15
|
+
const isValidTitle_1 = require("../title/isValidTitle");
|
|
16
|
+
const isDeprecated_1 = require("../deprecated/isDeprecated");
|
|
17
|
+
const isValidUserProfileDescription_1 = require("../userProfileDescription/isValidUserProfileDescription");
|
|
18
|
+
const isValidUserProfileName_1 = require("../userProfileName/isValidUserProfileName");
|
|
19
|
+
const isValidUserProfileThumbnail_1 = require("../userProfileThumbnail/isValidUserProfileThumbnail");
|
|
20
|
+
const getLivingAtlasSupportedItemTypes_1 = require("../util/getLivingAtlasSupportedItemTypes");
|
|
21
|
+
const validateHelpers_1 = require("./validateHelpers");
|
|
9
22
|
/**
|
|
10
|
-
*
|
|
23
|
+
* Validates an ArcGIS item and user profile against Living Atlas criteria.
|
|
11
24
|
*
|
|
12
|
-
*
|
|
25
|
+
* @param item - The ArcGIS item to validate
|
|
26
|
+
* @param userProfile - The user profile associated with the item
|
|
27
|
+
* @param options - Optional validation configuration
|
|
28
|
+
* @param options.customPatternsForLocationInfo - Custom patterns to check for location information
|
|
29
|
+
* @param options.customPatternsForDataVintageInfo - Custom patterns to check for data vintage information
|
|
30
|
+
* @param options.customPatternsForSourceInfo - Custom patterns to check for source information
|
|
31
|
+
* @param options.customPatternsForTopicInfo - Custom patterns to check for topic information
|
|
32
|
+
* @param options.thumbnailDimension - Expected thumbnail dimensions
|
|
33
|
+
* @returns A ValidationResult object containing detailed validation results and an overall score
|
|
13
34
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
35
|
+
* The validation checks multiple aspects of the item including:
|
|
36
|
+
* - Access settings
|
|
37
|
+
* - Access information
|
|
38
|
+
* - Description
|
|
39
|
+
* - License information
|
|
40
|
+
* - Summary/snippet
|
|
41
|
+
* - SSL configuration
|
|
42
|
+
* - Tags
|
|
43
|
+
* - Thumbnail
|
|
44
|
+
* - Title
|
|
45
|
+
* - Deprecation status
|
|
46
|
+
* - Delete protection
|
|
47
|
+
* - Searchability of title and summary
|
|
48
|
+
*
|
|
49
|
+
* It also validates user profile aspects:
|
|
50
|
+
* - Profile description
|
|
51
|
+
* - Full name
|
|
52
|
+
* - Profile thumbnail
|
|
53
|
+
*
|
|
54
|
+
* The result includes a total score and whether the item meets criteria for nomination.
|
|
17
55
|
*/
|
|
18
|
-
const validate = (item, userProfile) => {
|
|
19
|
-
const { type } = item;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
56
|
+
const validate = (item, userProfile, { customPatternsForLocationInfo, customPatternsForDataVintageInfo, customPatternsForSourceInfo, customPatternsForTopicInfo, thumbnailDimension, } = {}) => {
|
|
57
|
+
// const { type } = item;
|
|
58
|
+
const isSupportedItemType = (0, getLivingAtlasSupportedItemTypes_1.checkIsLivingAtlasSupportedItemType)(item);
|
|
59
|
+
// create a copy of the item to avoid mutating the original item
|
|
60
|
+
const copyOfItem = Object.assign({}, item);
|
|
61
|
+
// create a copy of the user profile to avoid mutating the original user profile
|
|
62
|
+
const copyOfUserProfile = Object.assign({}, userProfile);
|
|
63
|
+
const access = (0, isValidAccess_1.isValidAccess)(copyOfItem);
|
|
64
|
+
const accessInformation = (0, isValidAccessInformation_1.isValidAccessInformation)(copyOfItem);
|
|
65
|
+
const description = (0, isValidDescription_1.isValidDescription)(copyOfItem);
|
|
66
|
+
// const layerCount = isValidLayerCount(item);
|
|
67
|
+
const licenseInfo = (0, isValidLicenseInfo_1.isValidLicenseInfo)(copyOfItem);
|
|
68
|
+
const snippet = (0, isValidSummary_1.isValidSummary)(copyOfItem);
|
|
69
|
+
const ssl = (0, isValidSSL_1.isValidSSL)(copyOfItem);
|
|
70
|
+
const tags = (0, isValidTags_1.isValidTags)(copyOfItem);
|
|
71
|
+
const thumbnail = (0, isValidThumbnail_1.isValidThumbnail)(copyOfItem, thumbnailDimension);
|
|
72
|
+
const title = (0, isValidTitle_1.isValidTitle)(copyOfItem);
|
|
73
|
+
const deprecated = (0, isDeprecated_1.isDeprecated)(copyOfItem);
|
|
74
|
+
const deleteProtection = (0, isDeleteProtectionEnabled_1.isDeleteProtectionEnabled)(copyOfItem);
|
|
75
|
+
const recommendedTextInTitleAndSummary = (0, checkTitleAndSnippetSearchability_1.checkTitleAndSnippetSearchability)(copyOfItem, {
|
|
76
|
+
customPatternsForLocationInfo,
|
|
77
|
+
customPatternsForDataVintageInfo,
|
|
78
|
+
customPatternsForSourceInfo,
|
|
79
|
+
customPatternsForTopicInfo,
|
|
80
|
+
});
|
|
81
|
+
const userProfileDescription = (0, isValidUserProfileDescription_1.isValidUserProfileDescription)(copyOfUserProfile
|
|
38
82
|
// item
|
|
39
83
|
);
|
|
40
|
-
const userProfileFullName = (0,
|
|
41
|
-
const userProfileThumbnail = (0,
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
// accessInformation,
|
|
45
|
-
// description,
|
|
46
|
-
// layerCount,
|
|
47
|
-
// licenseInfo,
|
|
48
|
-
// snippet,
|
|
49
|
-
// ssl,
|
|
50
|
-
// tags,
|
|
51
|
-
// thumbnail,
|
|
52
|
-
// title,
|
|
53
|
-
// userProfileDescription,
|
|
54
|
-
// userProfileFullName,
|
|
55
|
-
// userProfileThumbnail,
|
|
56
|
-
// deprecated
|
|
57
|
-
// ]);
|
|
58
|
-
assignFinalScores({
|
|
59
|
-
validatedItem: {
|
|
60
|
-
access,
|
|
61
|
-
accessInformation,
|
|
62
|
-
description,
|
|
63
|
-
layerCount,
|
|
64
|
-
licenseInfo,
|
|
65
|
-
snippet,
|
|
66
|
-
ssl,
|
|
67
|
-
tags,
|
|
68
|
-
thumbnail,
|
|
69
|
-
title,
|
|
70
|
-
deprecated,
|
|
71
|
-
deleteProtection,
|
|
72
|
-
recommendedTextInTitleAndSummary,
|
|
73
|
-
},
|
|
74
|
-
validatedProfile: {
|
|
75
|
-
userProfileDescription,
|
|
76
|
-
userProfileFullName,
|
|
77
|
-
userProfileThumbnail,
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
// const totalScore = getTotalScore([
|
|
81
|
-
// access,
|
|
82
|
-
// accessInformation,
|
|
83
|
-
// description,
|
|
84
|
-
// layerCount,
|
|
85
|
-
// licenseInfo,
|
|
86
|
-
// snippet,
|
|
87
|
-
// ssl,
|
|
88
|
-
// tags,
|
|
89
|
-
// thumbnail,
|
|
90
|
-
// title,
|
|
91
|
-
// userProfileDescription,
|
|
92
|
-
// userProfileFullName,
|
|
93
|
-
// userProfileThumbnail,
|
|
94
|
-
// deprecated
|
|
95
|
-
// ]);
|
|
96
|
-
const totalScore = getTotalScore({
|
|
97
|
-
validatedItem: {
|
|
98
|
-
access,
|
|
99
|
-
accessInformation,
|
|
100
|
-
description,
|
|
101
|
-
layerCount,
|
|
102
|
-
licenseInfo,
|
|
103
|
-
snippet,
|
|
104
|
-
ssl,
|
|
105
|
-
tags,
|
|
106
|
-
thumbnail,
|
|
107
|
-
title,
|
|
108
|
-
deprecated,
|
|
109
|
-
deleteProtection,
|
|
110
|
-
recommendedTextInTitleAndSummary,
|
|
111
|
-
},
|
|
112
|
-
validatedProfile: {
|
|
113
|
-
userProfileDescription,
|
|
114
|
-
userProfileFullName,
|
|
115
|
-
userProfileThumbnail,
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
const validationResult = {
|
|
84
|
+
const userProfileFullName = (0, isValidUserProfileName_1.isValidUserProfileName)(copyOfUserProfile);
|
|
85
|
+
const userProfileThumbnail = (0, isValidUserProfileThumbnail_1.isValidUserProfileThumbnail)(copyOfUserProfile);
|
|
86
|
+
// Assigns final scores and statuses to each validation result within the given validation result object
|
|
87
|
+
const validationResult = (0, validateHelpers_1.assignFinalScoresAndStatus)({
|
|
119
88
|
validatedItem: {
|
|
120
89
|
access,
|
|
121
90
|
accessInformation,
|
|
122
91
|
description,
|
|
123
|
-
layerCount,
|
|
92
|
+
// layerCount,
|
|
124
93
|
licenseInfo,
|
|
125
94
|
snippet,
|
|
126
95
|
ssl,
|
|
@@ -136,110 +105,15 @@ const validate = (item, userProfile) => {
|
|
|
136
105
|
userProfileFullName,
|
|
137
106
|
userProfileThumbnail,
|
|
138
107
|
},
|
|
139
|
-
id: item.id,
|
|
140
|
-
totalScore,
|
|
141
|
-
|
|
142
|
-
|
|
108
|
+
id: item === null || item === void 0 ? void 0 : item.id,
|
|
109
|
+
totalScore: 0,
|
|
110
|
+
canBeNominated: false,
|
|
111
|
+
}, isSupportedItemType);
|
|
112
|
+
// Get total score of the validation result
|
|
113
|
+
validationResult.totalScore = (0, validateHelpers_1.getTotalScore)(validationResult, isSupportedItemType);
|
|
114
|
+
// Checks if an item can be nominated to Living Atlas based on a set of minimum requirements.
|
|
115
|
+
validationResult.canBeNominated = (0, validateHelpers_1.meetRequiredThresholds)(validationResult, isSupportedItemType);
|
|
143
116
|
return validationResult;
|
|
144
117
|
};
|
|
145
118
|
exports.validate = validate;
|
|
146
|
-
/**
|
|
147
|
-
* Flat the `ValidationResult` object and return an array of `ValidationInfo`
|
|
148
|
-
* @param validationResult
|
|
149
|
-
* @returns {ValidationInfo[]} array of all `ValidationInfo` from `validatedItem` and `validatedProfile` objects
|
|
150
|
-
*/
|
|
151
|
-
const flatValidationResults = (validationResult) => {
|
|
152
|
-
const { validatedItem, validatedProfile } = validationResult;
|
|
153
|
-
return [
|
|
154
|
-
...Object.values(validatedItem),
|
|
155
|
-
...Object.values(validatedProfile),
|
|
156
|
-
];
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Get total score by summing up scores from individaul validated items
|
|
160
|
-
* @param ValidationResult
|
|
161
|
-
* @returns total score
|
|
162
|
-
*/
|
|
163
|
-
const getTotalScore = (validationResult) => {
|
|
164
|
-
const validationResults = flatValidationResults(validationResult);
|
|
165
|
-
const totalScore = validationResults.reduce((prev, curr) => prev + curr.score, 0);
|
|
166
|
-
return (0, round_1.round)(totalScore);
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* This function calculates the maximum score and actual score for each validation result.
|
|
170
|
-
* @param ValidationResult An array of objects representing validation results.
|
|
171
|
-
* @returns void
|
|
172
|
-
*/
|
|
173
|
-
const assignFinalScores = (validationResult) => {
|
|
174
|
-
const validationResults = flatValidationResults(validationResult);
|
|
175
|
-
// Calculate the sum of weights from all validation rules that can be applied to the input item.
|
|
176
|
-
const totalWeight = validationResults.reduce((prev, curr) => prev + curr.weight, 0);
|
|
177
|
-
// Calculate the score associated with each weight.
|
|
178
|
-
const scorePerWeight = 100 / totalWeight;
|
|
179
|
-
for (const validationResult of validationResults) {
|
|
180
|
-
const { weight, weightFactor } = validationResult;
|
|
181
|
-
// Calculate the maximum score and actual score based on the weight.
|
|
182
|
-
const maxScore = weight * scorePerWeight;
|
|
183
|
-
const score = weightFactor * maxScore;
|
|
184
|
-
// Assign the calculated values to the validation result object.
|
|
185
|
-
validationResult.maxScore = maxScore;
|
|
186
|
-
validationResult.score = score;
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
/**
|
|
190
|
-
* Return `true` if the total score of the validation result meets the minimum threshold, which is 80.
|
|
191
|
-
*
|
|
192
|
-
* @param totalScore total score from the validation result
|
|
193
|
-
* @returns true if it meets the minimum threshold
|
|
194
|
-
*/
|
|
195
|
-
const meetMinimumTotalScore = (totalScore) => {
|
|
196
|
-
return totalScore >= config_1.MINIMUM_SCORE_THRESHHOLD;
|
|
197
|
-
};
|
|
198
|
-
exports.meetMinimumTotalScore = meetMinimumTotalScore;
|
|
199
|
-
/**
|
|
200
|
-
* Checks if an item can be nominated to Living Atlas based on a set of minimum requirements.
|
|
201
|
-
*
|
|
202
|
-
* An item can be nominated only if its total score meets the minimum required threshold of **80** and it also passes all of
|
|
203
|
-
* the following checks:
|
|
204
|
-
*
|
|
205
|
-
* - It is shared with the public
|
|
206
|
-
* - It is NOT marked as deprecated
|
|
207
|
-
* - It has Delete Protection enabled
|
|
208
|
-
* - Its thumbnail image meets the required dimension
|
|
209
|
-
* - It has a snippet text
|
|
210
|
-
* - It has a description text
|
|
211
|
-
* - The item owner has a user profile description
|
|
212
|
-
*
|
|
213
|
-
* @param validationResult The validation result
|
|
214
|
-
* @returns A boolean value that indicates whether all the scores meet the required thresholds.
|
|
215
|
-
*/
|
|
216
|
-
const meetRequiredThresholds = (validationResult) => {
|
|
217
|
-
if (!validationResult) {
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
if ((0, exports.meetMinimumTotalScore)(validationResult.totalScore) === false) {
|
|
221
|
-
return false;
|
|
222
|
-
}
|
|
223
|
-
const { validatedItem, validatedProfile } = validationResult;
|
|
224
|
-
const { access, thumbnail, snippet, description, deprecated, deleteProtection, } = validatedItem;
|
|
225
|
-
const { userProfileDescription } = validatedProfile;
|
|
226
|
-
if (
|
|
227
|
-
// must be shared with public
|
|
228
|
-
access.score !== access.maxScore ||
|
|
229
|
-
// must have perfect thumbnail
|
|
230
|
-
thumbnail.score !== thumbnail.maxScore ||
|
|
231
|
-
// must not be deprecated
|
|
232
|
-
deprecated.score !== deprecated.maxScore ||
|
|
233
|
-
// must have delete protection enabled
|
|
234
|
-
deleteProtection.score !== deleteProtection.maxScore ||
|
|
235
|
-
// snippet cannot be empty
|
|
236
|
-
snippet.score === 0 ||
|
|
237
|
-
// description cannot be empty
|
|
238
|
-
description.score === 0 ||
|
|
239
|
-
// user profile cannot be empty
|
|
240
|
-
userProfileDescription.score === 0) {
|
|
241
|
-
return false;
|
|
242
|
-
}
|
|
243
|
-
return true;
|
|
244
|
-
};
|
|
245
119
|
//# sourceMappingURL=validate.js.map
|