@vannizhang/living-atlas-content-validator 1.5.19-beta.11 → 1.5.19-beta.13
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/index.d.ts +4 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/featureServiceFieldAliases/checkFeatureServiceFieldAliases.js +8 -6
- 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 +20 -16
- 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 +8 -5
- 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/package-info.json +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -35,12 +35,15 @@ import { containsProfanity } from './lib/checkProfanities/checkProfanities';
|
|
|
35
35
|
import { getLivingAtlasSupportedItemTypes, checkIsLivingAtlasSupportedItemType } from './lib/util/getLivingAtlasSupportedItemTypes';
|
|
36
36
|
import { LivingAtlasSupportedItemType } from './lib/config';
|
|
37
37
|
import { checkFeatureServiceFieldDescriptions } from './lib/featureServiceFieldDescriptions/checkFeatureServiceFieldDescriptions';
|
|
38
|
+
import { getPercentOfValidFieldDescriptions, isValidFieldDescription } from './lib/featureServiceFieldDescriptions/helpers';
|
|
38
39
|
import { checkFeatureServiceFieldAliases } from './lib/featureServiceFieldAliases/checkFeatureServiceFieldAliases';
|
|
40
|
+
import { getPercentOfValidFieldAliases, isValidFieldAlias } from './lib/featureServiceFieldAliases/helpers';
|
|
39
41
|
import { checkFeatureServiceFieldValueTypes } from './lib/featureServiceFieldValueTypes/checkFeatureServiceFieldValueTypes';
|
|
42
|
+
import { getPercentFieldsWithValueType, isValidFieldValueType } from './lib/featureServiceFieldValueTypes/helpers';
|
|
40
43
|
import { fetchFeatureServiceLayersAndTables } from './services/feature-service/fetchFeatureServiceLayersAndTables';
|
|
41
44
|
import { getRelevantFeatureLayerFields } from './lib/util/getRelevantFeatureLayerFields';
|
|
42
45
|
import { getFeatureLayerFieldValueTypes } from './lib/util/getFeatureLayerFieldValueTypes';
|
|
43
|
-
export { configureSettings, validate, isValidTitle, isValidAccessInformation, isValidDescription, isValidLicenseInfo, isValidAccess, isValidSSL, isValidSummary, isValidTags, isValidThumbnail, isValidUserProfileDescription, isValidUserProfileName, isValidUserProfileThumbnail, isDeprecated, isDeleteProtectionEnabled, checkTitleAndSnippetSearchability, matchLocationInfo, matchDateTimeInfo, matchSourceInfo, matchTopicInfo, isRecognizedLocation, isRecognizedDateTimeInfo, isRecognizedSource, isRecognizedTopic, isRejectedLocationInfo, isRejectedDateTimeInfo, isRejectedSourceInfo, isRejectedTopicInfo, isEligibleForCheckingTitleAndSnippetSearchability, getLivingAtlasSupportedItemTypes, checkIsLivingAtlasSupportedItemType, sanitizeTags, getStringsConfig, getDefaultStringsConfig, checkFeatureServiceFieldAliases, checkFeatureServiceFieldDescriptions, checkFeatureServiceFieldValueTypes, fetchFeatureServiceLayersAndTables, getRelevantFeatureLayerFields, getFeatureLayerFieldValueTypes, };
|
|
46
|
+
export { configureSettings, validate, isValidTitle, isValidAccessInformation, isValidDescription, isValidLicenseInfo, isValidAccess, isValidSSL, isValidSummary, isValidTags, isValidThumbnail, isValidUserProfileDescription, isValidUserProfileName, isValidUserProfileThumbnail, isDeprecated, isDeleteProtectionEnabled, checkTitleAndSnippetSearchability, matchLocationInfo, matchDateTimeInfo, matchSourceInfo, matchTopicInfo, isRecognizedLocation, isRecognizedDateTimeInfo, isRecognizedSource, isRecognizedTopic, isRejectedLocationInfo, isRejectedDateTimeInfo, isRejectedSourceInfo, isRejectedTopicInfo, isEligibleForCheckingTitleAndSnippetSearchability, getLivingAtlasSupportedItemTypes, checkIsLivingAtlasSupportedItemType, sanitizeTags, getStringsConfig, getDefaultStringsConfig, checkFeatureServiceFieldAliases, checkFeatureServiceFieldDescriptions, checkFeatureServiceFieldValueTypes, fetchFeatureServiceLayersAndTables, getRelevantFeatureLayerFields, getFeatureLayerFieldValueTypes, getPercentOfValidFieldDescriptions, isValidFieldDescription, getPercentOfValidFieldAliases, isValidFieldAlias, getPercentFieldsWithValueType, isValidFieldValueType, };
|
|
44
47
|
export { fetchAdditonalPatterns4TitleAndSnippetSearchability, fetchProfanitiesData, getSubmittedCustomTerms, getMyCustomTerms, addCustomTerms2FeatureTable, updateStatusOfCustomTermsInFeatureTable, getPackagedReviewResults, getReviewedReviewResults, getUnarchivedReviewResults, getDeployedReviewResults, getReviewResultsByTermAndCategory, addReviewResults2FeatureTable, updateReviewResultsInFeatureTable, getCustomTermsFeatureTableItemInfo, getCustomTermsReviewResultsFeatureTableItemInfo, containsProfanity, };
|
|
45
48
|
export { isValidRegexPattern, escapeSpecialCharacters };
|
|
46
49
|
export type { ValidationMessage, ValidationInfo, ValidationResult, ValidationRulesStringJSON, ValidationResultStatus, MatchResult, CustomTermFeature, CustomTermCategory, CustomTermStatus, CustomTermsReviewResultLifecycle, CustomTermReviewResultFeature, AdditionalPatterns4TitleAndSnippetSearchability, AddFeaturesResponse, LivingAtlasSupportedItemType, FeatureLayerFieldRaw, FeatureLayerFieldFormatted, FeatureLayerJSON, FeatureLayerFieldValueType, FeatureServiceJSON, };
|
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.escapeSpecialCharacters = exports.isValidRegexPattern = exports.containsProfanity = exports.getCustomTermsReviewResultsFeatureTableItemInfo = exports.getCustomTermsFeatureTableItemInfo = exports.updateReviewResultsInFeatureTable = exports.addReviewResults2FeatureTable = exports.getReviewResultsByTermAndCategory = exports.getDeployedReviewResults = void 0;
|
|
3
|
+
exports.getSubmittedCustomTerms = exports.fetchProfanitiesData = exports.fetchAdditonalPatterns4TitleAndSnippetSearchability = exports.isValidFieldValueType = exports.getPercentFieldsWithValueType = exports.isValidFieldAlias = exports.getPercentOfValidFieldAliases = exports.isValidFieldDescription = exports.getPercentOfValidFieldDescriptions = exports.getFeatureLayerFieldValueTypes = exports.getRelevantFeatureLayerFields = exports.fetchFeatureServiceLayersAndTables = 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.escapeSpecialCharacters = exports.isValidRegexPattern = exports.containsProfanity = exports.getCustomTermsReviewResultsFeatureTableItemInfo = exports.getCustomTermsFeatureTableItemInfo = exports.updateReviewResultsInFeatureTable = exports.addReviewResults2FeatureTable = exports.getReviewResultsByTermAndCategory = exports.getDeployedReviewResults = exports.getUnarchivedReviewResults = exports.getReviewedReviewResults = exports.getPackagedReviewResults = exports.updateStatusOfCustomTermsInFeatureTable = exports.addCustomTerms2FeatureTable = exports.getMyCustomTerms = 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");
|
|
@@ -91,10 +91,19 @@ Object.defineProperty(exports, "getLivingAtlasSupportedItemTypes", { enumerable:
|
|
|
91
91
|
Object.defineProperty(exports, "checkIsLivingAtlasSupportedItemType", { enumerable: true, get: function () { return getLivingAtlasSupportedItemTypes_1.checkIsLivingAtlasSupportedItemType; } });
|
|
92
92
|
const checkFeatureServiceFieldDescriptions_1 = require("./lib/featureServiceFieldDescriptions/checkFeatureServiceFieldDescriptions");
|
|
93
93
|
Object.defineProperty(exports, "checkFeatureServiceFieldDescriptions", { enumerable: true, get: function () { return checkFeatureServiceFieldDescriptions_1.checkFeatureServiceFieldDescriptions; } });
|
|
94
|
+
const helpers_2 = require("./lib/featureServiceFieldDescriptions/helpers");
|
|
95
|
+
Object.defineProperty(exports, "getPercentOfValidFieldDescriptions", { enumerable: true, get: function () { return helpers_2.getPercentOfValidFieldDescriptions; } });
|
|
96
|
+
Object.defineProperty(exports, "isValidFieldDescription", { enumerable: true, get: function () { return helpers_2.isValidFieldDescription; } });
|
|
94
97
|
const checkFeatureServiceFieldAliases_1 = require("./lib/featureServiceFieldAliases/checkFeatureServiceFieldAliases");
|
|
95
98
|
Object.defineProperty(exports, "checkFeatureServiceFieldAliases", { enumerable: true, get: function () { return checkFeatureServiceFieldAliases_1.checkFeatureServiceFieldAliases; } });
|
|
99
|
+
const helpers_3 = require("./lib/featureServiceFieldAliases/helpers");
|
|
100
|
+
Object.defineProperty(exports, "getPercentOfValidFieldAliases", { enumerable: true, get: function () { return helpers_3.getPercentOfValidFieldAliases; } });
|
|
101
|
+
Object.defineProperty(exports, "isValidFieldAlias", { enumerable: true, get: function () { return helpers_3.isValidFieldAlias; } });
|
|
96
102
|
const checkFeatureServiceFieldValueTypes_1 = require("./lib/featureServiceFieldValueTypes/checkFeatureServiceFieldValueTypes");
|
|
97
103
|
Object.defineProperty(exports, "checkFeatureServiceFieldValueTypes", { enumerable: true, get: function () { return checkFeatureServiceFieldValueTypes_1.checkFeatureServiceFieldValueTypes; } });
|
|
104
|
+
const helpers_4 = require("./lib/featureServiceFieldValueTypes/helpers");
|
|
105
|
+
Object.defineProperty(exports, "getPercentFieldsWithValueType", { enumerable: true, get: function () { return helpers_4.getPercentFieldsWithValueType; } });
|
|
106
|
+
Object.defineProperty(exports, "isValidFieldValueType", { enumerable: true, get: function () { return helpers_4.isValidFieldValueType; } });
|
|
98
107
|
const fetchFeatureServiceLayersAndTables_1 = require("./services/feature-service/fetchFeatureServiceLayersAndTables");
|
|
99
108
|
Object.defineProperty(exports, "fetchFeatureServiceLayersAndTables", { enumerable: true, get: function () { return fetchFeatureServiceLayersAndTables_1.fetchFeatureServiceLayersAndTables; } });
|
|
100
109
|
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,2DA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HAAmH;AA0D/G,gHA1DK,iEAA+B,OA0DL;AAxDnC,sEAGkD;AA6D9C,8GA/DA,uCAA6B,OA+DA;AAC7B,kGA/DA,2BAAiB,OA+DA;AA5DrB,+HAA4H;AAqDxH,mHArDK,uEAAkC,OAqDL;AAnDtC,yEAGqD;AAwDjD,8GA1DA,uCAA6B,OA0DA;AAC7B,sGA1DA,+BAAqB,OA0DA;AAvDzB,sHAAmH;AA+C/G,mHA/CK,uEAAkC,OA+CL;AA7CtC,4FAAyF;AA8CrF,8GA9CK,6DAA6B,OA8CL;AA5CjC,8FAA2F;AA6CvF,+GA7CK,+DAA8B,OA6CL"}
|
|
@@ -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,12 +63,13 @@ 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
|
-
|
|
68
|
-
|
|
69
|
-
}).length;
|
|
70
|
-
const percentWithAlias = countOfFieldsWithAlias / relevantFields.length;
|
|
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);
|
|
71
73
|
// if percentWithAlias is 0, then there are no fields with aliases
|
|
72
74
|
// it should receive a score of 0 and a message to add field aliases
|
|
73
75
|
if (percentWithAlias === 0) {
|
|
@@ -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,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,
|
|
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,6BAA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EAAyE;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;YAC1B,cAAc,CAAC,sBAAsB,GAAG,CAAC,CAAC;QAC9C,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;AAjFW,QAAA,+BAA+B,mCAiF1C"}
|
|
@@ -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,22 +65,25 @@ 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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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);
|
|
83
87
|
// if percentWithDescription is 0, then there are no fields with aliases
|
|
84
88
|
// it should receive a score of 0 and a message to add field aliases
|
|
85
89
|
if (percentWithDescription === 0) {
|
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;;;;;;;;;;;;;;;;;;G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QACH,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,wDAAwD;IACxD,sDAAsD;IACtD,4CAA4C;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,wEAAwE;IACxE,oEAAoE;IACpE,IAAI,sBAAsB,KAAK,CAAC,EAAE,CAAC;QAC/B,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC3B,OAAO,EACH,OAAO,CAAC,6BAA6B,CAAC,qBAAqB;SAClE,CAAC,CAAC;QACH,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,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;YAC1B,cAAc,CAAC,2BAA2B,GAAG,CAAC,CAAC;QACnD,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;AArGW,QAAA,oCAAoC,wCAqG/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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AC1C,CAAC,CAAC,CAAC,MAAM,CAAC;IAEV,MAAM,gBAAgB,GAAG,2BAA2B,GAAG,MAAM,CAAC,MAAM,CAAC;IAErE,OAAO,gBAAgB,CAAC;AAC5B,CAAC,CAAC;AAdW,QAAA,kCAAkC,sCAc7C"}
|
|
@@ -4,6 +4,7 @@ exports.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,11 +59,13 @@ 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 =
|
|
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);
|
|
66
69
|
// if percentWithValueType is 0, then there are no fields with aliases
|
|
67
70
|
// it should receive a score of 0 and a message to add field aliases
|
|
68
71
|
if (percentWithValueType === 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkFeatureServiceFieldValueTypes.js","sourceRoot":"","sources":["../../../src/lib/featureServiceFieldValueTypes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AAC,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;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,MA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AAO,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"}
|
package/dist/package-info.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"lastCompiledTime":
|
|
1
|
+
{"lastCompiledTime":1749163188846}
|
package/package.json
CHANGED