@vannizhang/living-atlas-content-validator 1.5.19-beta.9 → 1.5.19
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 +196 -199
- package/dist/configureSettings.d.ts +27 -25
- package/dist/configureSettings.js +14 -13
- package/dist/configureSettings.js.map +1 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.js +6 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/featureServiceFieldAliases/checkFeatureServiceFieldAliases.js +17 -13
- package/dist/lib/featureServiceFieldAliases/checkFeatureServiceFieldAliases.js.map +1 -1
- package/dist/lib/featureServiceFieldAliases/helpers.d.ts +19 -0
- package/dist/lib/featureServiceFieldAliases/helpers.js +48 -0
- package/dist/lib/featureServiceFieldAliases/helpers.js.map +1 -0
- package/dist/lib/featureServiceFieldDescriptions/checkFeatureServiceFieldDescriptions.js +30 -15
- package/dist/lib/featureServiceFieldDescriptions/checkFeatureServiceFieldDescriptions.js.map +1 -1
- package/dist/lib/featureServiceFieldDescriptions/helpers.d.ts +20 -0
- package/dist/lib/featureServiceFieldDescriptions/helpers.js +53 -0
- package/dist/lib/featureServiceFieldDescriptions/helpers.js.map +1 -0
- package/dist/lib/featureServiceFieldDescriptions/scoringConfig.js +1 -1
- package/dist/lib/featureServiceFieldValueTypes/checkFeatureServiceFieldValueTypes.js +18 -15
- package/dist/lib/featureServiceFieldValueTypes/checkFeatureServiceFieldValueTypes.js.map +1 -1
- package/dist/lib/featureServiceFieldValueTypes/helpers.d.ts +16 -0
- package/dist/lib/featureServiceFieldValueTypes/helpers.js +35 -0
- package/dist/lib/featureServiceFieldValueTypes/helpers.js.map +1 -0
- package/dist/lib/featureServiceFieldValueTypes/scoringConfig.js +1 -1
- package/dist/lib/ssl/isValidSSL.js +3 -1
- package/dist/lib/ssl/isValidSSL.js.map +1 -1
- package/dist/locale/de.json +21 -24
- package/dist/locale/en.json +7 -10
- package/dist/locale/es.json +21 -24
- package/dist/locale/fr.json +21 -24
- package/dist/locale/ja.json +21 -24
- package/dist/locale/pt-br.json +21 -24
- package/dist/package-info.json +1 -1
- package/dist/services/feature-service/fetchFeatureServiceLayersAndTables.d.ts +11 -6
- package/dist/services/feature-service/fetchFeatureServiceLayersAndTables.js +56 -16
- package/dist/services/feature-service/fetchFeatureServiceLayersAndTables.js.map +1 -1
- package/dist/services/feature-service/getFeatureServerURL.d.ts +12 -0
- package/dist/services/feature-service/getFeatureServerURL.js +37 -0
- package/dist/services/feature-service/getFeatureServerURL.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
3
|
+
exports.addReviewResults2FeatureTable = exports.getReviewResultsByTermAndCategory = exports.getDeployedReviewResults = exports.getUnarchivedReviewResults = exports.getReviewedReviewResults = exports.getPackagedReviewResults = exports.updateStatusOfCustomTermsInFeatureTable = exports.addCustomTerms2FeatureTable = exports.getMyCustomTerms = exports.getSubmittedCustomTerms = exports.fetchProfanitiesData = exports.fetchAdditonalPatterns4TitleAndSnippetSearchability = exports.checkFeatureServiceFieldValueTypes = exports.checkFeatureServiceFieldDescriptions = exports.checkFeatureServiceFieldAliases = exports.getDefaultStringsConfig = exports.getStringsConfig = exports.sanitizeTags = exports.checkIsLivingAtlasSupportedItemType = exports.getLivingAtlasSupportedItemTypes = exports.isEligibleForCheckingTitleAndSnippetSearchability = exports.isRejectedTopicInfo = exports.isRejectedSourceInfo = exports.isRejectedDateTimeInfo = exports.isRejectedLocationInfo = exports.isRecognizedTopic = exports.isRecognizedSource = exports.isRecognizedDateTimeInfo = exports.isRecognizedLocation = exports.matchTopicInfo = exports.matchSourceInfo = exports.matchDateTimeInfo = exports.matchLocationInfo = exports.checkTitleAndSnippetSearchability = exports.isDeleteProtectionEnabled = exports.isDeprecated = exports.isValidUserProfileThumbnail = exports.isValidUserProfileName = exports.isValidUserProfileDescription = exports.isValidThumbnail = exports.isValidTags = exports.isValidSummary = exports.isValidSSL = exports.isValidAccess = exports.isValidLicenseInfo = exports.isValidDescription = exports.isValidAccessInformation = exports.isValidTitle = exports.validate = exports.configureSettings = void 0;
|
|
4
|
+
exports.isValidFieldValueType = exports.getPercentFieldsWithValueType = exports.isValidFieldAlias = exports.getPercentOfValidFieldAliases = exports.isValidFieldDescription = exports.getPercentOfValidFieldDescriptions = exports.getFeatureLayerFieldValueTypes = exports.getRelevantFeatureLayerFields = exports.fetchFeatureServiceLayersAndTables = exports.getFeatureServerRootURL = exports.escapeSpecialCharacters = exports.isValidRegexPattern = exports.containsProfanity = exports.getCustomTermsReviewResultsFeatureTableItemInfo = exports.getCustomTermsFeatureTableItemInfo = exports.updateReviewResultsInFeatureTable = void 0;
|
|
5
5
|
const isValidTitle_1 = require("./lib/title/isValidTitle");
|
|
6
6
|
Object.defineProperty(exports, "isValidTitle", { enumerable: true, get: function () { return isValidTitle_1.isValidTitle; } });
|
|
7
7
|
const isValidAccessInformation_1 = require("./lib/accessInformation/isValidAccessInformation");
|
|
@@ -95,6 +95,17 @@ const checkFeatureServiceFieldAliases_1 = require("./lib/featureServiceFieldAlia
|
|
|
95
95
|
Object.defineProperty(exports, "checkFeatureServiceFieldAliases", { enumerable: true, get: function () { return checkFeatureServiceFieldAliases_1.checkFeatureServiceFieldAliases; } });
|
|
96
96
|
const checkFeatureServiceFieldValueTypes_1 = require("./lib/featureServiceFieldValueTypes/checkFeatureServiceFieldValueTypes");
|
|
97
97
|
Object.defineProperty(exports, "checkFeatureServiceFieldValueTypes", { enumerable: true, get: function () { return checkFeatureServiceFieldValueTypes_1.checkFeatureServiceFieldValueTypes; } });
|
|
98
|
+
const getFeatureServerURL_1 = require("./services/feature-service/getFeatureServerURL");
|
|
99
|
+
Object.defineProperty(exports, "getFeatureServerRootURL", { enumerable: true, get: function () { return getFeatureServerURL_1.getFeatureServerRootURL; } });
|
|
100
|
+
const helpers_2 = require("./lib/featureServiceFieldDescriptions/helpers");
|
|
101
|
+
Object.defineProperty(exports, "getPercentOfValidFieldDescriptions", { enumerable: true, get: function () { return helpers_2.getPercentOfValidFieldDescriptions; } });
|
|
102
|
+
Object.defineProperty(exports, "isValidFieldDescription", { enumerable: true, get: function () { return helpers_2.isValidFieldDescription; } });
|
|
103
|
+
const helpers_3 = require("./lib/featureServiceFieldAliases/helpers");
|
|
104
|
+
Object.defineProperty(exports, "getPercentOfValidFieldAliases", { enumerable: true, get: function () { return helpers_3.getPercentOfValidFieldAliases; } });
|
|
105
|
+
Object.defineProperty(exports, "isValidFieldAlias", { enumerable: true, get: function () { return helpers_3.isValidFieldAlias; } });
|
|
106
|
+
const helpers_4 = require("./lib/featureServiceFieldValueTypes/helpers");
|
|
107
|
+
Object.defineProperty(exports, "getPercentFieldsWithValueType", { enumerable: true, get: function () { return helpers_4.getPercentFieldsWithValueType; } });
|
|
108
|
+
Object.defineProperty(exports, "isValidFieldValueType", { enumerable: true, get: function () { return helpers_4.isValidFieldValueType; } });
|
|
98
109
|
const fetchFeatureServiceLayersAndTables_1 = require("./services/feature-service/fetchFeatureServiceLayersAndTables");
|
|
99
110
|
Object.defineProperty(exports, "fetchFeatureServiceLayersAndTables", { enumerable: true, get: function () { return fetchFeatureServiceLayersAndTables_1.fetchFeatureServiceLayersAndTables; } });
|
|
100
111
|
const getRelevantFeatureLayerFields_1 = require("./lib/util/getRelevantFeatureLayerFields");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAiBA,2DAAwD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings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uD;AAuBnD,mHAzBA,4CAAkC,OAyBA;AAClC,wGAzBA,iCAAuB,OAyBA;AAtB3B,sEAGkD;AAoB9C,8GAtBA,uCAA6B,OAsBA;AAC7B,kGAtBA,2BAAiB,OAsBA;AAnBrB,yEAGqD;AAiBjD,8GAnBA,uCAA6B,OAmBA;AAC7B,sGAnBA,+BAAqB,OAmBA;AAhBzB,sHAAmH;AAQ/G,mHARK,uEAAkC,OAQL;AANtC,4FAAyF;AAOrF,8GAPK,6DAA6B,OAOL;AALjC,8FAA2F;AAMvF,+GANK,+DAA8B,OAML"}
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const PROHIBITED_LIST: RegExp[];
|
|
|
9
9
|
/**
|
|
10
10
|
* array of item types that are supported by the Living Atlas
|
|
11
11
|
*/
|
|
12
|
-
export declare const LIVING_ATLAS_SUPPORTED_ITEM_TYPES: readonly ["CityEngine Web Scene", "Dashboard", "Deep Learning Package", "Desktop Style", "Document Link", "Feature Collection", "Feature Service", "Image Service", "Map Service", "Project Package", "Raster function template", "Rule Package", "Scene Service", "StoryMap", "Style", "Vector Tile Service", "Web Experience", "Web Experience Template", "Web Map", "Web Mapping Application", "Web Scene", "WMS", "Group Layer"];
|
|
12
|
+
export declare const LIVING_ATLAS_SUPPORTED_ITEM_TYPES: readonly ["CityEngine Web Scene", "Dashboard", "Deep Learning Package", "Desktop Style", "Document Link", "Feature Collection", "Feature Service", "Image Service", "Map Service", "Project Package", "Raster function template", "Rule Package", "Scene Service", "StoryMap", "Style", "Vector Tile Service", "Web Experience", "Web Experience Template", "Web Map", "Web Mapping Application", "Web Scene", "WMS", "Group Layer", "Geoprocessing Sample"];
|
|
13
13
|
/**
|
|
14
14
|
* Type definition for Living Atlas supported item types.
|
|
15
15
|
*/
|
package/dist/lib/config.js
CHANGED
|
@@ -162,6 +162,12 @@ exports.LIVING_ATLAS_SUPPORTED_ITEM_TYPES = [
|
|
|
162
162
|
// * https://www.arcgis.com/home/item.html?id=388cc480a7894f64ae8d42663de32e89
|
|
163
163
|
// */
|
|
164
164
|
// 'Media Layer',
|
|
165
|
+
/**
|
|
166
|
+
* @example
|
|
167
|
+
* https://www.arcgis.com/home/item.html?id=fe221371b77940749ff96e90f2de3d10
|
|
168
|
+
*
|
|
169
|
+
*/
|
|
170
|
+
'Geoprocessing Sample',
|
|
165
171
|
];
|
|
166
172
|
// export default config;
|
|
167
173
|
//# sourceMappingURL=config.js.map
|
package/dist/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":";AAAA,mBAAmB;AACnB,qDAAqD;AACrD,8BAA8B;AAC9B,sCAAsC;AACtC,gDAAgD;AAChD,0CAA0C;AAC1C,sCAAsC;AACtC,kCAAkC;AAClC,0CAA0C;AAC1C,4DAA4D;AAC5D,oCAAoC;AACpC,sDAAsD;AACtD,sCAAsC;AACtC,6BAA6B;AAC7B,sBAAsB;AACtB,sCAAsC;AACtC,kDAAkD;AAClD,wCAAwC;AACxC,0DAA0D;AAC1D,0BAA0B;AAC1B,0DAA0D;AAC1D,8BAA8B;AAC9B,kBAAkB;AAClB,yDAAyD;AACzD,yCAAyC;AACzC,mDAAmD;AACnD,qCAAqC;AACrC,KAAK;;;AAEL;;GAEG;AACU,QAAA,wBAAwB,GAAG,EAAE,CAAC;AAE3C;;GAEG;AACU,QAAA,eAAe,GAAG;IAC3B,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;CACd,CAAC;AAEF;;GAEG;AACU,QAAA,iCAAiC,GAAG;IAC7C;;;OAGG;IACH,sBAAsB;IACtB;;;OAGG;IACH,WAAW;IACX;;;OAGG;IACH,uBAAuB;IACvB;;;OAGG;IACH,eAAe;IACf;;;OAGG;IACH,eAAe;IACf,oBAAoB;IACpB;;;OAGG;IACH,iBAAiB;IACjB;;;OAGG;IACH,eAAe;IACf;;;OAGG;IACH,aAAa;IACb;;;OAGG;IACH,iBAAiB;IACjB;;;OAGG;IACH,0BAA0B;IAC1B;;;OAGG;IACH,cAAc;IACd;;;OAGG;IACH,eAAe;IACf;;;OAGG;IACH,UAAU;IACV;;;OAGG;IACH,OAAO;IACP;;;OAGG;IACH,qBAAqB;IACrB;;;OAGG;IACH,gBAAgB;IAChB;;;OAGG;IACH,yBAAyB;IACzB;;;OAGG;IACH,SAAS;IACT;;;OAGG;IACH,yBAAyB;IACzB;;;OAGG;IACH,WAAW;IACX;;;OAGG;IACH,KAAK;IACL;;;OAGG;IACH,aAAa;IACb,MAAM;IACN,cAAc;IACd,+EAA+E;IAC/E,MAAM;IACN,iBAAiB;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":";AAAA,mBAAmB;AACnB,qDAAqD;AACrD,8BAA8B;AAC9B,sCAAsC;AACtC,gDAAgD;AAChD,0CAA0C;AAC1C,sCAAsC;AACtC,kCAAkC;AAClC,0CAA0C;AAC1C,4DAA4D;AAC5D,oCAAoC;AACpC,sDAAsD;AACtD,sCAAsC;AACtC,6BAA6B;AAC7B,sBAAsB;AACtB,sCAAsC;AACtC,kDAAkD;AAClD,wCAAwC;AACxC,0DAA0D;AAC1D,0BAA0B;AAC1B,0DAA0D;AAC1D,8BAA8B;AAC9B,kBAAkB;AAClB,yDAAyD;AACzD,yCAAyC;AACzC,mDAAmD;AACnD,qCAAqC;AACrC,KAAK;;;AAEL;;GAEG;AACU,QAAA,wBAAwB,GAAG,EAAE,CAAC;AAE3C;;GAEG;AACU,QAAA,eAAe,GAAG;IAC3B,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;CACd,CAAC;AAEF;;GAEG;AACU,QAAA,iCAAiC,GAAG;IAC7C;;;OAGG;IACH,sBAAsB;IACtB;;;OAGG;IACH,WAAW;IACX;;;OAGG;IACH,uBAAuB;IACvB;;;OAGG;IACH,eAAe;IACf;;;OAGG;IACH,eAAe;IACf,oBAAoB;IACpB;;;OAGG;IACH,iBAAiB;IACjB;;;OAGG;IACH,eAAe;IACf;;;OAGG;IACH,aAAa;IACb;;;OAGG;IACH,iBAAiB;IACjB;;;OAGG;IACH,0BAA0B;IAC1B;;;OAGG;IACH,cAAc;IACd;;;OAGG;IACH,eAAe;IACf;;;OAGG;IACH,UAAU;IACV;;;OAGG;IACH,OAAO;IACP;;;OAGG;IACH,qBAAqB;IACrB;;;OAGG;IACH,gBAAgB;IAChB;;;OAGG;IACH,yBAAyB;IACzB;;;OAGG;IACH,SAAS;IACT;;;OAGG;IACH,yBAAyB;IACzB;;;OAGG;IACH,WAAW;IACX;;;OAGG;IACH,KAAK;IACL;;;OAGG;IACH,aAAa;IACb,MAAM;IACN,cAAc;IACd,+EAA+E;IAC/E,MAAM;IACN,iBAAiB;IACjB;;;;OAIG;IACH,sBAAsB;CAChB,CAAC;AAQX,yBAAyB"}
|
|
@@ -4,6 +4,7 @@ exports.checkFeatureServiceFieldAliases = exports.FIELD_ALIASES_REQUIRED_PERCENT
|
|
|
4
4
|
const getRelevantFeatureLayerFields_1 = require("../util/getRelevantFeatureLayerFields");
|
|
5
5
|
const isFeatureService_1 = require("../util/isFeatureService");
|
|
6
6
|
const stringsConfig_1 = require("../util/stringsConfig");
|
|
7
|
+
const helpers_1 = require("./helpers");
|
|
7
8
|
const scoringConfig_1 = require("./scoringConfig");
|
|
8
9
|
/**
|
|
9
10
|
* requires 90% of field aliases to be present to receive a full score
|
|
@@ -62,25 +63,28 @@ const checkFeatureServiceFieldAliases = (item, featureLayers) => {
|
|
|
62
63
|
});
|
|
63
64
|
return validationResult;
|
|
64
65
|
}
|
|
65
|
-
// get the count of fields with aliases
|
|
66
|
-
const countOfFieldsWithAlias = relevantFields.filter((field) =>
|
|
67
|
-
const
|
|
68
|
-
//
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
66
|
+
// // get the count of fields with aliases
|
|
67
|
+
// const countOfFieldsWithAlias = relevantFields.filter((field) => {
|
|
68
|
+
// const alias = field.alias ? field.alias.trim().toLowerCase() : '';
|
|
69
|
+
// return alias && alias !== field.name.toLowerCase();
|
|
70
|
+
// }).length;
|
|
71
|
+
// const percentWithAlias = countOfFieldsWithAlias / relevantFields.length;
|
|
72
|
+
const percentWithAlias = (0, helpers_1.getPercentOfValidFieldAliases)(relevantFields);
|
|
73
|
+
// // if percentWithAlias is 0, then there are no fields with aliases
|
|
74
|
+
// // it should receive a score of 0 and a message to add field aliases
|
|
75
|
+
// if (percentWithAlias === 0) {
|
|
76
|
+
// validationResult.messages.push({
|
|
77
|
+
// message: strings.featureLayerFieldAliases.ADD_FIELD_ALIAS,
|
|
78
|
+
// });
|
|
79
|
+
// return validationResult;
|
|
80
|
+
// }
|
|
76
81
|
// if percentWithAlias is less than 0.9, then there are some fields with aliases
|
|
77
82
|
// it should receive half of score and a message to improve field aliases
|
|
78
83
|
if (percentWithAlias < exports.FIELD_ALIASES_REQUIRED_PERCENT) {
|
|
79
84
|
validationResult.messages.push({
|
|
80
85
|
message: strings.featureLayerFieldAliases.IMPROVE_FIELD_ALIAS,
|
|
81
86
|
});
|
|
82
|
-
validationResult.scoringFactor =
|
|
83
|
-
scoringFactors.CONTAINS_FIELD_ALIASES / 2;
|
|
87
|
+
validationResult.scoringFactor = 0;
|
|
84
88
|
return validationResult;
|
|
85
89
|
}
|
|
86
90
|
// if percentWithAlias is greater than 0.8, then there are most fields with aliases
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkFeatureServiceFieldAliases.js","sourceRoot":"","sources":["../../../src/lib/featureServiceFieldAliases/checkFeatureServiceFieldAliases.ts"],"names":[],"mappings":";;;AACA,yFAAsF;AACtF,+DAA4D;AAC5D,yDAAyD;AACzD,mDAAgD;AAEhD;;GAEG;AACU,QAAA,8BAA8B,GAAG,GAAG,CAAC;AAElD;;;;;;;;;;;;;;;;;;;GAmBG;AACI,MAAM,+BAA+B,GA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B,CAAC;IAED,
|
|
1
|
+
{"version":3,"file":"checkFeatureServiceFieldAliases.js","sourceRoot":"","sources":["../../../src/lib/featureServiceFieldAliases/checkFeatureServiceFieldAliases.ts"],"names":[],"mappings":";;;AACA,yFAAsF;AACtF,+DAA4D;AAC5D,yDAAyD;AACzD,uCAA0D;AAC1D,mDAAgD;AAEhD;;GAEG;AACU,QAAA,8BAA8B,GAAG,GAAG,CAAC;AAElD;;;;;;;;;;;;;;;;;;;GAmBG;AACI,MAAM,+BAA+B,GAAG,CAC3C,IAAW,EACX,aAAiC,EACnB,EAAE;IAChB,MAAM,OAAO,GAAG,IAAA,gCAAgB,GAAE,CAAC;IAEnC,MAAM,cAAc,GAAG,6BAAa,CAAC,cAAc,CAAC,OAAO,CAAC;IAE5D,MAAM,gBAAgB,GAAmB;QACrC,gBAAgB,EAAE,+BAA+B;QACjD,KAAK,EAAE,OAAO,CAAC,wBAAwB,CAAC,KAAK;QAC7C,KAAK,EAAE,OAAO,CAAC,wBAAwB,CAAC,KAAK;QAC7C,QAAQ,EAAE,CAAC;QACX,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,6BAAa,CAAC,MAAM;QAC5B,aAAa,EAAE,CAAC;QAChB,MAAM,EAAE,SAAS;QACjB,aAAa,EAAE,KAAK;KACvB,CAAC;IAEF,uGAAuG;IACvG,sCAAsC;IACtC,IAAI,CAAC,IAAA,mCAAgB,EAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,uCACO,gBAAgB,KACnB,MAAM,EAAE,CAAC,IACX;IACN,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,MAAK,CAAC,EAAE,CAAC;QAC/D,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC3B,OAAO,EAAE,OAAO,CAAC,wBAAwB,CAAC,gBAAgB;SAC7D,CAAC,CAAC;QACH,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,MAAM,cAAc,GAAG,IAAA,6DAA6B,EAAC,aAAa,IAAI,EAAE,CAAC,CAAC;IAE1E,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC3B,OAAO,EAAE,OAAO,CAAC,6BAA6B,CAAC,iBAAiB;SACnE,CAAC,CAAC;QACH,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,0CAA0C;IAC1C,oEAAoE;IACpE,yEAAyE;IACzE,0DAA0D;IAC1D,aAAa;IAEb,2EAA2E;IAE3E,MAAM,gBAAgB,GAAG,IAAA,uCAA6B,EAAC,cAAc,CAAC,CAAC;IAEvE,qEAAqE;IACrE,uEAAuE;IACvE,gCAAgC;IAChC,uCAAuC;IACvC,qEAAqE;IACrE,UAAU;IACV,+BAA+B;IAC/B,IAAI;IAEJ,gFAAgF;IAChF,yEAAyE;IACzE,IAAI,gBAAgB,GAAG,sCAA8B,EAAE,CAAC;QACpD,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC3B,OAAO,EAAE,OAAO,CAAC,wBAAwB,CAAC,mBAAmB;SAChE,CAAC,CAAC;QACH,gBAAgB,CAAC,aAAa,GAAG,CAAC,CAAC;QACnC,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,mFAAmF;IACnF,+BAA+B;IAC/B,gBAAgB,CAAC,aAAa,GAAG,CAAC,CAAC;IAEnC,OAAO,gBAAgB,CAAC;AAC5B,CAAC,CAAC;AAhFW,QAAA,+BAA+B,mCAgF1C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FeatureLayerFieldFormatted } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Determines if a field alias is valid based on the following criteria:
|
|
4
|
+
* - `alias` must be present and non-empty.
|
|
5
|
+
* - The trimmed, lowercased `alias` must not be empty.
|
|
6
|
+
* - The trimmed, lowercased `alias` must not be identical to the trimmed, lowercased `name`.
|
|
7
|
+
*
|
|
8
|
+
* @param fieldInfo - The field information object containing `alias` and `name` properties.
|
|
9
|
+
* @returns `true` if the alias is valid, otherwise `false`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const isValidFieldAlias: (fieldInfo: FeatureLayerFieldFormatted) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Calculates the percentage of fields that have a valid alias.
|
|
14
|
+
*
|
|
15
|
+
* @param fields - An array of formatted feature layer fields to check.
|
|
16
|
+
* @returns The percentage (as a number between 0 and 1) of fields with a valid alias.
|
|
17
|
+
* Returns 0 if the input array is empty, not an array, or undefined.
|
|
18
|
+
*/
|
|
19
|
+
export declare const getPercentOfValidFieldAliases: (fields: FeatureLayerFieldFormatted[]) => number;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPercentOfValidFieldAliases = exports.isValidFieldAlias = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Determines if a field alias is valid based on the following criteria:
|
|
6
|
+
* - `alias` must be present and non-empty.
|
|
7
|
+
* - The trimmed, lowercased `alias` must not be empty.
|
|
8
|
+
* - The trimmed, lowercased `alias` must not be identical to the trimmed, lowercased `name`.
|
|
9
|
+
*
|
|
10
|
+
* @param fieldInfo - The field information object containing `alias` and `name` properties.
|
|
11
|
+
* @returns `true` if the alias is valid, otherwise `false`.
|
|
12
|
+
*/
|
|
13
|
+
const isValidFieldAlias = (fieldInfo) => {
|
|
14
|
+
const alias = (fieldInfo === null || fieldInfo === void 0 ? void 0 : fieldInfo.alias) || '';
|
|
15
|
+
const name = (fieldInfo === null || fieldInfo === void 0 ? void 0 : fieldInfo.name) || '';
|
|
16
|
+
if (!alias) {
|
|
17
|
+
return false; // no alias
|
|
18
|
+
}
|
|
19
|
+
const trimmedAlias = alias.trim().toLowerCase();
|
|
20
|
+
const trimmedName = name.trim().toLowerCase();
|
|
21
|
+
if (!trimmedAlias) {
|
|
22
|
+
return false; // alias is empty
|
|
23
|
+
}
|
|
24
|
+
if (trimmedAlias === trimmedName) {
|
|
25
|
+
return false; // alias is the same as name
|
|
26
|
+
}
|
|
27
|
+
return true; // valid alias
|
|
28
|
+
};
|
|
29
|
+
exports.isValidFieldAlias = isValidFieldAlias;
|
|
30
|
+
/**
|
|
31
|
+
* Calculates the percentage of fields that have a valid alias.
|
|
32
|
+
*
|
|
33
|
+
* @param fields - An array of formatted feature layer fields to check.
|
|
34
|
+
* @returns The percentage (as a number between 0 and 1) of fields with a valid alias.
|
|
35
|
+
* Returns 0 if the input array is empty, not an array, or undefined.
|
|
36
|
+
*/
|
|
37
|
+
const getPercentOfValidFieldAliases = (fields) => {
|
|
38
|
+
if (!fields || !Array.isArray(fields) || fields.length === 0) {
|
|
39
|
+
return 0; // no fields to check
|
|
40
|
+
}
|
|
41
|
+
const countOfFieldsWithValidAlias = fields.filter((field) => {
|
|
42
|
+
return (0, exports.isValidFieldAlias)(field);
|
|
43
|
+
}).length;
|
|
44
|
+
const percentWithAlias = countOfFieldsWithValidAlias / fields.length;
|
|
45
|
+
return percentWithAlias;
|
|
46
|
+
};
|
|
47
|
+
exports.getPercentOfValidFieldAliases = getPercentOfValidFieldAliases;
|
|
48
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/lib/featureServiceFieldAliases/helpers.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;GAQG;AACI,MAAM,iBAAiB,GAAG,CAC7B,SAAqC,EAC9B,EAAE;IACT,MAAM,KAAK,GAAG,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,KAAK,KAAI,EAAE,CAAC;IACrC,MAAM,IAAI,GAAG,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,KAAI,EAAE,CAAC;IAEnC,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,OAAO,KAAK,CAAC,CAAC,WAAW;IAC7B,CAAC;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAChD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAE9C,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC,CAAC,iBAAiB;IACnC,CAAC;IAED,IAAI,YAAY,KAAK,WAAW,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC,CAAC,4BAA4B;IAC9C,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,cAAc;AAC/B,CAAC,CAAC;AAtBW,QAAA,iBAAiB,qBAsB5B;AAEF;;;;;;GAMG;AACI,MAAM,6BAA6B,GAAG,CACzC,MAAoC,EAC9B,EAAE;IACR,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3D,OAAO,CAAC,CAAC,CAAC,qBAAqB;IACnC,CAAC;IAED,MAAM,2BAA2B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QACxD,OAAO,IAAA,yBAAiB,EAAC,KAAK,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC,MAAM,CAAC;IAEV,MAAM,gBAAgB,GAAG,2BAA2B,GAAG,MAAM,CAAC,MAAM,CAAC;IAErE,OAAO,gBAAgB,CAAC;AAC5B,CAAC,CAAC;AAdW,QAAA,6BAA6B,iCAcxC"}
|
|
@@ -4,6 +4,7 @@ exports.checkFeatureServiceFieldDescriptions = exports.FIELD_DESCRIPTIONS_REQUIR
|
|
|
4
4
|
const getRelevantFeatureLayerFields_1 = require("../util/getRelevantFeatureLayerFields");
|
|
5
5
|
const isFeatureService_1 = require("../util/isFeatureService");
|
|
6
6
|
const stringsConfig_1 = require("../util/stringsConfig");
|
|
7
|
+
const helpers_1 = require("./helpers");
|
|
7
8
|
const scoringConfig_1 = require("./scoringConfig");
|
|
8
9
|
/**
|
|
9
10
|
* requires 90% of field descriptions to be present to receive a full score
|
|
@@ -64,27 +65,41 @@ const checkFeatureServiceFieldDescriptions = (item, featureLayers) => {
|
|
|
64
65
|
});
|
|
65
66
|
return validationResult;
|
|
66
67
|
}
|
|
67
|
-
// get the count of fields with descriptions provided
|
|
68
|
-
const countOfFieldsWithDescription = relevantFields
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
//
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
// // get the count of fields with descriptions provided
|
|
69
|
+
// const countOfFieldsWithDescription = relevantFields
|
|
70
|
+
// .filter((field) => field.description)
|
|
71
|
+
// .filter((field) => {
|
|
72
|
+
// const value = field.description?.value
|
|
73
|
+
// ? field.description?.value.trim().toLowerCase()
|
|
74
|
+
// : '';
|
|
75
|
+
// const fieldAlias = field.alias
|
|
76
|
+
// ? field.alias.trim().toLowerCase()
|
|
77
|
+
// : '';
|
|
78
|
+
// return (
|
|
79
|
+
// value &&
|
|
80
|
+
// value !== field.name.toLowerCase() &&
|
|
81
|
+
// value !== fieldAlias
|
|
82
|
+
// );
|
|
83
|
+
// }).length;
|
|
84
|
+
// const percentWithDescription =
|
|
85
|
+
// countOfFieldsWithDescription / relevantFields.length;
|
|
86
|
+
const percentWithDescription = (0, helpers_1.getPercentOfValidFieldDescriptions)(relevantFields);
|
|
87
|
+
// // if percentWithDescription is 0, then there are no fields with aliases
|
|
88
|
+
// // it should receive a score of 0 and a message to add field aliases
|
|
89
|
+
// if (percentWithDescription === 0) {
|
|
90
|
+
// validationResult.messages.push({
|
|
91
|
+
// message:
|
|
92
|
+
// strings.featureLayerFieldDescriptions.ADD_FIELD_DESCRIPTION,
|
|
93
|
+
// });
|
|
94
|
+
// return validationResult;
|
|
95
|
+
// }
|
|
80
96
|
// if percentWithDescription is less than 0.9, then there are some fields with aliases
|
|
81
97
|
// it should receive half of score and a message to improve field aliases
|
|
82
98
|
if (percentWithDescription < exports.FIELD_DESCRIPTIONS_REQUIRED_PERCENT) {
|
|
83
99
|
validationResult.messages.push({
|
|
84
100
|
message: strings.featureLayerFieldDescriptions.IMRPOVE_FIELD_DESCRIPTION,
|
|
85
101
|
});
|
|
86
|
-
validationResult.scoringFactor =
|
|
87
|
-
scoringFactors.CONTAINS_FIELD_DESCRIPTIONS / 2;
|
|
102
|
+
validationResult.scoringFactor = 0;
|
|
88
103
|
return validationResult;
|
|
89
104
|
}
|
|
90
105
|
// if percentWithDescription is greater than 0.8, then there are most fields with aliases
|
package/dist/lib/featureServiceFieldDescriptions/checkFeatureServiceFieldDescriptions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkFeatureServiceFieldDescriptions.js","sourceRoot":"","sources":["../../../src/lib/featureServiceFieldDescriptions/checkFeatureServiceFieldDescriptions.ts"],"names":[],"mappings":";;;AACA,yFAAsF;AACtF,+DAA4D;AAC5D,yDAAyD;AACzD,mDAAgD;AAEhD;;GAEG;AACU,QAAA,mCAAmC,GAAG,GAAG,CAAC;AAEvD;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,oCAAoC,GAAG,CAChD,IAAW,EACX,aAAiC,EACnB,EAAE;IAChB,MAAM,OAAO,GAAG,IAAA,gCAAgB,GAAE,CAAC;IAEnC,MAAM,cAAc,GAAG,6BAAa,CAAC,cAAc,CAAC,OAAO,CAAC;IAE5D,MAAM,gBAAgB,GAAmB;QACrC,gBAAgB,EAAE,oCAAoC;QACtD,KAAK,EAAE,OAAO,CAAC,6BAA6B,CAAC,KAAK;QAClD,KAAK,EAAE,OAAO,CAAC,6BAA6B,CAAC,KAAK;QAClD,QAAQ,EAAE,CAAC;QACX,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,6BAAa,CAAC,MAAM;QAC5B,aAAa,EAAE,CAAC;QAChB,MAAM,EAAE,SAAS;QACjB,aAAa,EAAE,KAAK;KACvB,CAAC;IAEF,uGAAuG;IACvG,sCAAsC;IACtC,IAAI,CAAC,IAAA,mCAAgB,EAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,uCACO,gBAAgB,KACnB,MAAM,EAAE,CAAC,IACX;IACN,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;QACzD,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC3B,OAAO,EAAE,OAAO,CAAC,6BAA6B,CAAC,gBAAgB;SAClE,CAAC,CAAC;QACH,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,MAAM,cAAc,GAAG,IAAA,6DAA6B,EAAC,aAAa,IAAI,EAAE,CAAC,CAAC;IAE1E,iEAAiE;IACjE,6EAA6E;IAC7E,6DAA6D;IAC7D,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC3B,OAAO,EAAE,OAAO,CAAC,6BAA6B,CAAC,iBAAiB;SACnE,CAAC,CAAC;QACH,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,
|
|
1
|
+
{"version":3,"file":"checkFeatureServiceFieldDescriptions.js","sourceRoot":"","sources":["../../../src/lib/featureServiceFieldDescriptions/checkFeatureServiceFieldDescriptions.ts"],"names":[],"mappings":";;;AACA,yFAAsF;AACtF,+DAA4D;AAC5D,yDAAyD;AACzD,uCAA+D;AAC/D,mDAAgD;AAEhD;;GAEG;AACU,QAAA,mCAAmC,GAAG,GAAG,CAAC;AAEvD;;;;;;;;;;;;;;;;;;GAkBG;AACI,MAAM,oCAAoC,GAAG,CAChD,IAAW,EACX,aAAiC,EACnB,EAAE;IAChB,MA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A4C;IAC5C,2BAA2B;IAC3B,iDAAiD;IACjD,8DAA8D;IAC9D,oBAAoB;IAEpB,yCAAyC;IACzC,iDAAiD;IACjD,oBAAoB;IAEpB,mBAAmB;IACnB,uBAAuB;IACvB,oDAAoD;IACpD,mCAAmC;IACnC,aAAa;IACb,iBAAiB;IAEjB,iCAAiC;IACjC,4DAA4D;IAE5D,MAAM,sBAAsB,GACxB,IAAA,4CAAkC,EAAC,cAAc,CAAC,CAAC;IAEvD,2EAA2E;IAC3E,uEAAuE;IACvE,sCAAsC;IACtC,uCAAuC;IACvC,mBAAmB;IACnB,2EAA2E;IAC3E,UAAU;IACV,+BAA+B;IAC/B,IAAI;IAEJ,sFAAsF;IACtF,yEAAyE;IACzE,IAAI,sBAAsB,GAAG,2CAAmC,EAAE,CAAC;QAC/D,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC3B,OAAO,EACH,OAAO,CAAC,6BAA6B,CAAC,yBAAyB;SACtE,CAAC,CAAC;QACH,gBAAgB,CAAC,aAAa,GAAG,CAAC,CAAC;QACnC,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,yFAAyF;IACzF,+BAA+B;IAC/B,gBAAgB,CAAC,aAAa,GAAG,CAAC,CAAC;IAEnC,OAAO,gBAAgB,CAAC;AAC5B,CAAC,CAAC;AApGW,QAAA,oCAAoC,wCAoG/C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FeatureLayerFieldFormatted } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Determines if a field's description is valid.
|
|
4
|
+
*
|
|
5
|
+
* A valid description must:
|
|
6
|
+
* - Exist and not be empty after trimming.
|
|
7
|
+
* - Not be identical (case-insensitive, trimmed) to the field's name or alias.
|
|
8
|
+
*
|
|
9
|
+
* @param fieldInfo - The field information object containing description, name, and alias.
|
|
10
|
+
* @returns `true` if the description is valid, otherwise `false`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const isValidFieldDescription: (fieldInfo: FeatureLayerFieldFormatted) => boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Calculates the percentage of fields that have a valid description.
|
|
15
|
+
*
|
|
16
|
+
* @param fields - An array of formatted feature layer fields to check.
|
|
17
|
+
* @returns The percentage (as a number between 0 and 1) of fields with a valid description.
|
|
18
|
+
* Returns 0 if the input array is empty, not an array, or undefined.
|
|
19
|
+
*/
|
|
20
|
+
export declare const getPercentOfValidFieldDescriptions: (fields: FeatureLayerFieldFormatted[]) => number;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPercentOfValidFieldDescriptions = exports.isValidFieldDescription = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Determines if a field's description is valid.
|
|
6
|
+
*
|
|
7
|
+
* A valid description must:
|
|
8
|
+
* - Exist and not be empty after trimming.
|
|
9
|
+
* - Not be identical (case-insensitive, trimmed) to the field's name or alias.
|
|
10
|
+
*
|
|
11
|
+
* @param fieldInfo - The field information object containing description, name, and alias.
|
|
12
|
+
* @returns `true` if the description is valid, otherwise `false`.
|
|
13
|
+
*/
|
|
14
|
+
const isValidFieldDescription = (fieldInfo) => {
|
|
15
|
+
var _a;
|
|
16
|
+
const description = ((_a = fieldInfo === null || fieldInfo === void 0 ? void 0 : fieldInfo.description) === null || _a === void 0 ? void 0 : _a.value) || '';
|
|
17
|
+
const name = (fieldInfo === null || fieldInfo === void 0 ? void 0 : fieldInfo.name) || '';
|
|
18
|
+
const alias = (fieldInfo === null || fieldInfo === void 0 ? void 0 : fieldInfo.alias) || '';
|
|
19
|
+
if (!description) {
|
|
20
|
+
return false; // no description
|
|
21
|
+
}
|
|
22
|
+
const trimmedDescription = description.trim().toLowerCase();
|
|
23
|
+
const trimmedName = name.trim().toLowerCase();
|
|
24
|
+
const trimmedAlias = alias.trim().toLowerCase();
|
|
25
|
+
if (!trimmedDescription) {
|
|
26
|
+
return false; // description is empty
|
|
27
|
+
}
|
|
28
|
+
if (trimmedDescription === trimmedName ||
|
|
29
|
+
trimmedDescription === trimmedAlias) {
|
|
30
|
+
return false; // description is the same as name
|
|
31
|
+
}
|
|
32
|
+
return true; // valid description
|
|
33
|
+
};
|
|
34
|
+
exports.isValidFieldDescription = isValidFieldDescription;
|
|
35
|
+
/**
|
|
36
|
+
* Calculates the percentage of fields that have a valid description.
|
|
37
|
+
*
|
|
38
|
+
* @param fields - An array of formatted feature layer fields to check.
|
|
39
|
+
* @returns The percentage (as a number between 0 and 1) of fields with a valid description.
|
|
40
|
+
* Returns 0 if the input array is empty, not an array, or undefined.
|
|
41
|
+
*/
|
|
42
|
+
const getPercentOfValidFieldDescriptions = (fields) => {
|
|
43
|
+
if (!fields || !Array.isArray(fields) || fields.length === 0) {
|
|
44
|
+
return 0; // no fields to check
|
|
45
|
+
}
|
|
46
|
+
const countOfFieldsWithValidAlias = fields.filter((field) => {
|
|
47
|
+
return (0, exports.isValidFieldDescription)(field);
|
|
48
|
+
}).length;
|
|
49
|
+
const percentWithAlias = countOfFieldsWithValidAlias / fields.length;
|
|
50
|
+
return percentWithAlias;
|
|
51
|
+
};
|
|
52
|
+
exports.getPercentOfValidFieldDescriptions = getPercentOfValidFieldDescriptions;
|
|
53
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/lib/featureServiceFieldDescriptions/helpers.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;GASG;AACI,MAAM,uBAAuB,GAAG,CACnC,SAAqC,EAC9B,EAAE;;IACT,MAAM,WAAW,GAAG,CAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,0CAAE,KAAK,KAAI,EAAE,CAAC;IACxD,MAAM,IAAI,GAAG,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,KAAI,EAAE,CAAC;IACnC,MAAM,KAAK,GAAG,CAAA,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ports.checkFeatureServiceFieldValueTypes = exports.FIELD_VALUE_TYPES_REQUIRED_
|
|
|
4
4
|
const getRelevantFeatureLayerFields_1 = require("../util/getRelevantFeatureLayerFields");
|
|
5
5
|
const isFeatureService_1 = require("../util/isFeatureService");
|
|
6
6
|
const stringsConfig_1 = require("../util/stringsConfig");
|
|
7
|
+
const helpers_1 = require("./helpers");
|
|
7
8
|
const scoringConfig_1 = require("./scoringConfig");
|
|
8
9
|
/**
|
|
9
10
|
* requires 90% of field value types to be present to receive a full score
|
|
@@ -58,27 +59,29 @@ const checkFeatureServiceFieldValueTypes = (item, featureLayers) => {
|
|
|
58
59
|
});
|
|
59
60
|
return validationResult;
|
|
60
61
|
}
|
|
61
|
-
// get the count of fields with descriptions provided
|
|
62
|
-
const countOfFieldsWithValueType = relevantFields
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const percentWithValueType =
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
if
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
62
|
+
// // get the count of fields with descriptions provided
|
|
63
|
+
// const countOfFieldsWithValueType = relevantFields
|
|
64
|
+
// .filter((field) => field.description)
|
|
65
|
+
// .filter((field) => field.description?.fieldValueType).length;
|
|
66
|
+
// const percentWithValueType =
|
|
67
|
+
// countOfFieldsWithValueType / relevantFields.length;
|
|
68
|
+
const percentWithValueType = (0, helpers_1.getPercentFieldsWithValueType)(relevantFields);
|
|
69
|
+
// // if percentWithValueType is 0, then there are no fields with aliases
|
|
70
|
+
// // it should receive a score of 0 and a message to add field aliases
|
|
71
|
+
// if (percentWithValueType === 0) {
|
|
72
|
+
// validationResult.messages.push({
|
|
73
|
+
// message: strings.featureLayerFieldTypes.ADD_FIELD_TYPE,
|
|
74
|
+
// });
|
|
75
|
+
// return validationResult;
|
|
76
|
+
// }
|
|
74
77
|
// if percentWithValueType is less than 0.9, then there are some fields with aliases
|
|
75
78
|
// it should receive half of score and a message to improve field aliases
|
|
76
79
|
if (percentWithValueType < exports.FIELD_VALUE_TYPES_REQUIRED_PERCENT) {
|
|
77
80
|
validationResult.messages.push({
|
|
78
81
|
message: strings.featureLayerFieldTypes.IMRPOVE_FIELD_TYPE,
|
|
79
82
|
});
|
|
80
|
-
validationResult.scoringFactor =
|
|
81
|
-
|
|
83
|
+
validationResult.scoringFactor = 0;
|
|
84
|
+
// scoringFactors.CONTAINS_FIELD_VALUE_TYPES / 2;
|
|
82
85
|
return validationResult;
|
|
83
86
|
}
|
|
84
87
|
// if percentWithValueType is greater than 0.8, then there are most fields with aliases
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkFeatureServiceFieldValueTypes.js","sourceRoot":"","sources":["../../../src/lib/featureServiceFieldValueTypes/checkFeatureServiceFieldValueTypes.ts"],"names":[],"mappings":";;;AACA,yFAAsF;AACtF,+DAA4D;AAC5D,yDAAyD;AACzD,mDAAgD;AAEhD;;GAEG;AACU,QAAA,kCAAkC,GAAG,GAAG,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AACI,MAAM,kCAAkC,GAAG,CAC9C,IAAW,EACX,aAAiC,EACnB,EAAE;IAChB,MAAM,OAAO,GAAG,IAAA,gCAAgB,GAAE,CAAC;IAEnC,MAAM,cAAc,GAAG,6BAAa,CAAC,cAAc,CAAC,OAAO,CAAC;IAE5D,MAAM,gBAAgB,GAAmB;QACrC,gBAAgB,EAAE,mCAAmC;QACrD,KAAK,EAAE,OAAO,CAAC,sBAAsB,CAAC,KAAK;QAC3C,KAAK,EAAE,OAAO,CAAC,sBAAsB,CAAC,KAAK;QAC3C,QAAQ,EAAE,CAAC;QACX,KAAK,EAAE,CAAC;QACR,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,6BAAa,CAAC,MAAM;QAC5B,aAAa,EAAE,CAAC;QAChB,MAAM,EAAE,SAAS;QACjB,aAAa,EAAE,KAAK;KACvB,CAAC;IAEF,uGAAuG;IACvG,sCAAsC;IACtC,IAAI,CAAC,IAAA,mCAAgB,EAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,uCACO,gBAAgB,KACnB,MAAM,EAAE,CAAC,IACX;IACN,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;QACzD,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC3B,OAAO,EAAE,OAAO,CAAC,sBAAsB,CAAC,gBAAgB;SAC3D,CAAC,CAAC;QACH,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,MAAM,cAAc,GAAG,IAAA,6DAA6B,EAAC,aAAa,IAAI,EAAE,CAAC,CAAC;IAE1E,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC3B,OAAO,EAAE,OAAO,CAAC,6BAA6B,CAAC,iBAAiB;SACnE,CAAC,CAAC;QACH,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,
|
|
1
|
+
{"version":3,"file":"checkFeatureServiceFieldValueTypes.js","sourceRoot":"","sources":["../../../src/lib/featureServiceFieldValueTypes/checkFeatureServiceFieldValueTypes.ts"],"names":[],"mappings":";;;AACA,yFAAsF;AACtF,+DAA4D;AAC5D,yDAAyD;AACzD,uCAA0D;AAC1D,mDAAgD;AAEhD;;GAEG;AACU,QAAA,kCAAkC,GAAG,GAAG,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AACI,MAAM,kCAAkC,GAAG,CAC9C,IAAW,EACX,aAAiC,EACnB,EAAE;IAChB,MAAM,OAAO,GAAG,IAAA,gCAAgB,GAAE,CAAC;IAEnC,MAAM,cAAc,GAAG,6BAAa,CAAC,cAAc,CAAC,OAAO,CAAC;IAE5D,MAAM,gBAAgB,GAAmB;QACrC,gBAAgB,EAAE,mCAAmC;QACrD,KAAK,EAAE,OAAO,CAAC,sBAAsB,CAAC,KAAK;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AyE;IACzE,IAAI,oBAAoB,GAAG,0CAAkC,EAAE,CAAC;QAC5D,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC3B,OAAO,EAAE,OAAO,CAAC,sBAAsB,CAAC,kBAAkB;SAC7D,CAAC,CAAC;QACH,gBAAgB,CAAC,aAAa,GAAG,CAAC,CAAC;QACnC,iDAAiD;QACjD,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,uFAAuF;IACvF,+BAA+B;IAC/B,gBAAgB,CAAC,aAAa,GAAG,CAAC,CAAC;IAEnC,OAAO,gBAAgB,CAAC;AAC5B,CAAC,CAAC;AAjFW,QAAA,kCAAkC,sCAiF7C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FeatureLayerFieldFormatted } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the provided field information object has a valid field value type.
|
|
4
|
+
*
|
|
5
|
+
* @param fieldInfo - The field information object to validate.
|
|
6
|
+
* @returns `true` if the field information contains a valid `fieldValueType` in its description; otherwise, `false`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const isValidFieldValueType: (fieldInfo: FeatureLayerFieldFormatted) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Calculates the proportion of fields in the provided array that have a valid field value type assigned.
|
|
11
|
+
*
|
|
12
|
+
* @param fields - An array of `FeatureLayerFieldFormatted` objects to be evaluated.
|
|
13
|
+
* @returns The proportion (between 0 and 1) of fields that have a valid value type.
|
|
14
|
+
* Returns 0 if the input array is empty, not an array, or undefined.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getPercentFieldsWithValueType: (fields: FeatureLayerFieldFormatted[]) => number;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPercentFieldsWithValueType = exports.isValidFieldValueType = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if the provided field information object has a valid field value type.
|
|
6
|
+
*
|
|
7
|
+
* @param fieldInfo - The field information object to validate.
|
|
8
|
+
* @returns `true` if the field information contains a valid `fieldValueType` in its description; otherwise, `false`.
|
|
9
|
+
*/
|
|
10
|
+
const isValidFieldValueType = (fieldInfo) => {
|
|
11
|
+
var _a;
|
|
12
|
+
if (!fieldInfo ||
|
|
13
|
+
!(fieldInfo === null || fieldInfo === void 0 ? void 0 : fieldInfo.description) ||
|
|
14
|
+
!((_a = fieldInfo === null || fieldInfo === void 0 ? void 0 : fieldInfo.description) === null || _a === void 0 ? void 0 : _a.fieldValueType)) {
|
|
15
|
+
return false; // Invalid field or missing value type
|
|
16
|
+
}
|
|
17
|
+
return true; // Valid field with a value type
|
|
18
|
+
};
|
|
19
|
+
exports.isValidFieldValueType = isValidFieldValueType;
|
|
20
|
+
/**
|
|
21
|
+
* Calculates the proportion of fields in the provided array that have a valid field value type assigned.
|
|
22
|
+
*
|
|
23
|
+
* @param fields - An array of `FeatureLayerFieldFormatted` objects to be evaluated.
|
|
24
|
+
* @returns The proportion (between 0 and 1) of fields that have a valid value type.
|
|
25
|
+
* Returns 0 if the input array is empty, not an array, or undefined.
|
|
26
|
+
*/
|
|
27
|
+
const getPercentFieldsWithValueType = (fields) => {
|
|
28
|
+
if (!fields || !Array.isArray(fields) || fields.length === 0) {
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
const countOfFieldsWithValueType = fields.filter((field) => (0, exports.isValidFieldValueType)(field)).length;
|
|
32
|
+
return countOfFieldsWithValueType / fields.length;
|
|
33
|
+
};
|
|
34
|
+
exports.getPercentFieldsWithValueType = getPercentFieldsWithValueType;
|
|
35
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/lib/featureServiceFieldValueTypes/helpers.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACI,MAAM,qBAAqB,GAAG,CACjC,SAAqC,EAC9B,EAAE;;IACT,IACI,CAAC,SAAS;QACV,CAAC,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,CAAA;QACvB,CAAC,CAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,0CAAE,cAAc,CAAA,EACzC,CAAC;QACC,OAAO,KAAK,CAAC,CAAC,sCAAsC;IACxD,CAAC;IAED,OAAO,IAAI,CAAC,CAAC,gCAAgC;AACjD,CAAC,CAAC;AAZW,QAAA,qBAAqB,yBAYhC;AAEF;;;;;;GAMG;AACI,MAAM,6BAA6B,GAAG,CACzC,MAAoC,EAC9B,EAAE;IACR,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3D,OAAO,CAAC,CAAC;IACb,CAAC;IAED,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CACvD,IAAA,6BAAqB,EAAC,KAAK,CAAC,CAC/B,CAAC,MAAM,CAAC;IAET,OAAO,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC;AACtD,CAAC,CAAC;AAZW,QAAA,6BAA6B,iCAYxC"}
|
|
@@ -33,7 +33,8 @@ const isValidSSL = (item) => {
|
|
|
33
33
|
type === 'Scene Service' ||
|
|
34
34
|
type === 'Style' ||
|
|
35
35
|
type === 'Desktop Style' ||
|
|
36
|
-
type === 'Web Scene'
|
|
36
|
+
type === 'Web Scene' ||
|
|
37
|
+
type === 'Geoprocessing Sample') {
|
|
37
38
|
return {
|
|
38
39
|
validationRuleId: 'item-ssl',
|
|
39
40
|
label: stringsConfig.ssl.LABEL,
|
|
@@ -49,6 +50,7 @@ const isValidSSL = (item) => {
|
|
|
49
50
|
isBinaryCheck: false,
|
|
50
51
|
};
|
|
51
52
|
}
|
|
53
|
+
// only check SSL for items that have a URL
|
|
52
54
|
let isSSL = url ? (0, isSecureProtocol_1.isSecureProtocol)(url) || (0, isArcGISDomain_1.isArcGISDomain)(url) : true;
|
|
53
55
|
if (!isSSL) {
|
|
54
56
|
isSSL = (0, isHosted_1.isHosted)(item);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isValidSSL.js","sourceRoot":"","sources":["../../../src/lib/ssl/isValidSSL.ts"],"names":[],"mappings":";;;AAGA,yDAAyD;AACzD,iDAAiD;AACjD,+CAA4C;AAC5C,+DAA4D;AAC5D,iEAAiE;AACjE,2DAAwD;AACxD,4DAA4D;AAC5D,mDAAgD;AAGhD;;;;;;;;;;;GAWG;AACI,MAAM,UAAU,GAAG,CAAC,IAAW,EAAkB,EAAE;IACtD,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAErB,MAAM,aAAa,GAAG,IAAA,gCAAgB,GAAE,CAAC;IAEzC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAoC,CAAC;IAEvD,2EAA2E;IAC3E,IACI,IAAI,KAAK,sBAAsB;QAC/B,IAAI,KAAK,uBAAuB;QAChC,IAAI,KAAK,0BAA0B;QACnC,IAAI,KAAK,cAAc;QACvB,IAAI,KAAK,eAAe;QACxB,IAAI,KAAK,OAAO;QAChB,IAAI,KAAK,eAAe;QACxB,IAAI,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"isValidSSL.js","sourceRoot":"","sources":["../../../src/lib/ssl/isValidSSL.ts"],"names":[],"mappings":";;;AAGA,yDAAyD;AACzD,iDAAiD;AACjD,+CAA4C;AAC5C,+DAA4D;AAC5D,iEAAiE;AACjE,2DAAwD;AACxD,4DAA4D;AAC5D,mDAAgD;AAGhD;;;;;;;;;;;GAWG;AACI,MAAM,UAAU,GAAG,CAAC,IAAW,EAAkB,EAAE;IACtD,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAErB,MAAM,aAAa,GAAG,IAAA,gCAAgB,GAAE,CAAC;IAEzC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAo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