@vannizhang/living-atlas-content-validator 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +101 -0
- package/README.md +196 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/accessInformation/isValidAccessInformation.d.ts +10 -0
- package/dist/lib/accessInformation/isValidAccessInformation.js +48 -0
- package/dist/lib/accessInformation/isValidAccessInformation.js.map +1 -0
- package/dist/lib/accessInformation/scoringRulesConfig.d.ts +3 -0
- package/dist/lib/accessInformation/scoringRulesConfig.js +37 -0
- package/dist/lib/accessInformation/scoringRulesConfig.js.map +1 -0
- package/dist/lib/config.d.ts +6 -0
- package/dist/lib/config.js +61 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/description/isValidDescription.d.ts +18 -0
- package/dist/lib/description/isValidDescription.js +95 -0
- package/dist/lib/description/isValidDescription.js.map +1 -0
- package/dist/lib/description/scoringRulesConfig.d.ts +3 -0
- package/dist/lib/description/scoringRulesConfig.js +49 -0
- package/dist/lib/description/scoringRulesConfig.js.map +1 -0
- package/dist/lib/layers/isValidLayerCount.d.ts +12 -0
- package/dist/lib/layers/isValidLayerCount.js +148 -0
- package/dist/lib/layers/isValidLayerCount.js.map +1 -0
- package/dist/lib/layers/scoringRulesConfig.d.ts +3 -0
- package/dist/lib/layers/scoringRulesConfig.js +49 -0
- package/dist/lib/layers/scoringRulesConfig.js.map +1 -0
- package/dist/lib/licenseInfo/isValidLicenseInfo.d.ts +36 -0
- package/dist/lib/licenseInfo/isValidLicenseInfo.js +108 -0
- package/dist/lib/licenseInfo/isValidLicenseInfo.js.map +1 -0
- package/dist/lib/licenseInfo/scoringRulesConfig.d.ts +3 -0
- package/dist/lib/licenseInfo/scoringRulesConfig.js +49 -0
- package/dist/lib/licenseInfo/scoringRulesConfig.js.map +1 -0
- package/dist/lib/sharing/isValidAccess.d.ts +22 -0
- package/dist/lib/sharing/isValidAccess.js +79 -0
- package/dist/lib/sharing/isValidAccess.js.map +1 -0
- package/dist/lib/sharing/scoringRulesConfig.d.ts +3 -0
- package/dist/lib/sharing/scoringRulesConfig.js +49 -0
- package/dist/lib/sharing/scoringRulesConfig.js.map +1 -0
- package/dist/lib/ssl/isValidSSL.d.ts +14 -0
- package/dist/lib/ssl/isValidSSL.js +62 -0
- package/dist/lib/ssl/isValidSSL.js.map +1 -0
- package/dist/lib/ssl/scoringRulesConfig.d.ts +3 -0
- package/dist/lib/ssl/scoringRulesConfig.js +43 -0
- package/dist/lib/ssl/scoringRulesConfig.js.map +1 -0
- package/dist/lib/summary/isValidSummary.d.ts +17 -0
- package/dist/lib/summary/isValidSummary.js +114 -0
- package/dist/lib/summary/isValidSummary.js.map +1 -0
- package/dist/lib/summary/scoringRulesConfig.d.ts +3 -0
- package/dist/lib/summary/scoringRulesConfig.js +55 -0
- package/dist/lib/summary/scoringRulesConfig.js.map +1 -0
- package/dist/lib/tags/isValidTags.d.ts +14 -0
- package/dist/lib/tags/isValidTags.js +82 -0
- package/dist/lib/tags/isValidTags.js.map +1 -0
- package/dist/lib/tags/scoringRulesConfig.d.ts +3 -0
- package/dist/lib/tags/scoringRulesConfig.js +43 -0
- package/dist/lib/tags/scoringRulesConfig.js.map +1 -0
- package/dist/lib/thumbnail/isValidThumbnail.d.ts +10 -0
- package/dist/lib/thumbnail/isValidThumbnail.js +90 -0
- package/dist/lib/thumbnail/isValidThumbnail.js.map +1 -0
- package/dist/lib/thumbnail/scoringRulesConfig.d.ts +3 -0
- package/dist/lib/thumbnail/scoringRulesConfig.js +43 -0
- package/dist/lib/thumbnail/scoringRulesConfig.js.map +1 -0
- package/dist/lib/title/isValidTitle.d.ts +23 -0
- package/dist/lib/title/isValidTitle.js +128 -0
- package/dist/lib/title/isValidTitle.js.map +1 -0
- package/dist/lib/title/scoringRulesConfig.d.ts +3 -0
- package/dist/lib/title/scoringRulesConfig.js +54 -0
- package/dist/lib/title/scoringRulesConfig.js.map +1 -0
- package/dist/lib/userProfileDescription/isValidUserProfileDescription.d.ts +23 -0
- package/dist/lib/userProfileDescription/isValidUserProfileDescription.js +138 -0
- package/dist/lib/userProfileDescription/isValidUserProfileDescription.js.map +1 -0
- package/dist/lib/userProfileDescription/scoringRulesConfig.d.ts +3 -0
- package/dist/lib/userProfileDescription/scoringRulesConfig.js +61 -0
- package/dist/lib/userProfileDescription/scoringRulesConfig.js.map +1 -0
- package/dist/lib/userProfileName/isValidUserProfileName.d.ts +10 -0
- package/dist/lib/userProfileName/isValidUserProfileName.js +60 -0
- package/dist/lib/userProfileName/isValidUserProfileName.js.map +1 -0
- package/dist/lib/userProfileName/scoringRulesConfig.d.ts +3 -0
- package/dist/lib/userProfileName/scoringRulesConfig.js +43 -0
- package/dist/lib/userProfileName/scoringRulesConfig.js.map +1 -0
- package/dist/lib/userProfileThumbnail/isValidUserProfileThumbnail.d.ts +22 -0
- package/dist/lib/userProfileThumbnail/isValidUserProfileThumbnail.js +62 -0
- package/dist/lib/userProfileThumbnail/isValidUserProfileThumbnail.js.map +1 -0
- package/dist/lib/userProfileThumbnail/scoringRulesConfig.d.ts +3 -0
- package/dist/lib/userProfileThumbnail/scoringRulesConfig.js +37 -0
- package/dist/lib/userProfileThumbnail/scoringRulesConfig.js.map +1 -0
- package/dist/lib/util/assertString.d.ts +11 -0
- package/dist/lib/util/assertString.js +20 -0
- package/dist/lib/util/assertString.js.map +1 -0
- package/dist/lib/util/contains.d.ts +7 -0
- package/dist/lib/util/contains.js +17 -0
- package/dist/lib/util/contains.js.map +1 -0
- package/dist/lib/util/getNumberOfStrings.d.ts +6 -0
- package/dist/lib/util/getNumberOfStrings.js +25 -0
- package/dist/lib/util/getNumberOfStrings.js.map +1 -0
- package/dist/lib/util/getScoringRules.d.ts +21 -0
- package/dist/lib/util/getScoringRules.js +99 -0
- package/dist/lib/util/getScoringRules.js.map +1 -0
- package/dist/lib/util/getThumbnailFileName.d.ts +15 -0
- package/dist/lib/util/getThumbnailFileName.js +26 -0
- package/dist/lib/util/getThumbnailFileName.js.map +1 -0
- package/dist/lib/util/isArcGISDomain.d.ts +6 -0
- package/dist/lib/util/isArcGISDomain.js +16 -0
- package/dist/lib/util/isArcGISDomain.js.map +1 -0
- package/dist/lib/util/isArcGISOnlineReservedThumbnailName.d.ts +6 -0
- package/dist/lib/util/isArcGISOnlineReservedThumbnailName.js +19 -0
- package/dist/lib/util/isArcGISOnlineReservedThumbnailName.js.map +1 -0
- package/dist/lib/util/isDefined.d.ts +8 -0
- package/dist/lib/util/isDefined.js +15 -0
- package/dist/lib/util/isDefined.js.map +1 -0
- package/dist/lib/util/isEmail.d.ts +6 -0
- package/dist/lib/util/isEmail.js +14 -0
- package/dist/lib/util/isEmail.js.map +1 -0
- package/dist/lib/util/isEmpty.d.ts +6 -0
- package/dist/lib/util/isEmpty.js +17 -0
- package/dist/lib/util/isEmpty.js.map +1 -0
- package/dist/lib/util/isFeatureCollection.d.ts +7 -0
- package/dist/lib/util/isFeatureCollection.js +13 -0
- package/dist/lib/util/isFeatureCollection.js.map +1 -0
- package/dist/lib/util/isHosted.d.ts +7 -0
- package/dist/lib/util/isHosted.js +17 -0
- package/dist/lib/util/isHosted.js.map +1 -0
- package/dist/lib/util/isSecureProtocol.d.ts +6 -0
- package/dist/lib/util/isSecureProtocol.js +16 -0
- package/dist/lib/util/isSecureProtocol.js.map +1 -0
- package/dist/lib/util/isUppercase.d.ts +4 -0
- package/dist/lib/util/isUppercase.js +14 -0
- package/dist/lib/util/isUppercase.js.map +1 -0
- package/dist/lib/util/isUrl.d.ts +4 -0
- package/dist/lib/util/isUrl.js +12 -0
- package/dist/lib/util/isUrl.js.map +1 -0
- package/dist/lib/util/matches.d.ts +12 -0
- package/dist/lib/util/matches.js +22 -0
- package/dist/lib/util/matches.js.map +1 -0
- package/dist/lib/util/stringsConfig.d.ts +17 -0
- package/dist/lib/util/stringsConfig.js +42 -0
- package/dist/lib/util/stringsConfig.js.map +1 -0
- package/dist/lib/util/toString.d.ts +11 -0
- package/dist/lib/util/toString.js +31 -0
- package/dist/lib/util/toString.js.map +1 -0
- package/dist/lib/validate/validate.d.ts +11 -0
- package/dist/lib/validate/validate.js +62 -0
- package/dist/lib/validate/validate.js.map +1 -0
- package/dist/locale/de.json +195 -0
- package/dist/locale/en.json +195 -0
- package/dist/locale/es.json +195 -0
- package/dist/locale/fr.json +195 -0
- package/dist/locale/ja.json +195 -0
- package/dist/locale/pt-br.json +195 -0
- package/dist/types/index.d.ts +114 -0
- package/dist/types/index.js +16 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidUserProfileName = void 0;
|
|
7
|
+
const scoringRulesConfig_1 = __importDefault(require("./scoringRulesConfig"));
|
|
8
|
+
const getScoringRules_1 = require("../util/getScoringRules");
|
|
9
|
+
const stringsConfig_1 = require("../util/stringsConfig");
|
|
10
|
+
const assertString_1 = require("../util/assertString");
|
|
11
|
+
const isEmpty_1 = require("../util/isEmpty");
|
|
12
|
+
const contains_1 = require("../util/contains");
|
|
13
|
+
/**
|
|
14
|
+
* Validate an item owner's profile name
|
|
15
|
+
*
|
|
16
|
+
* Living Atlas specific (local):
|
|
17
|
+
* - Cannot be empty
|
|
18
|
+
* - Cannot contain blacklisted character(s)
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
const isValidUserProfileName = (userProfile, item) => {
|
|
22
|
+
const { fullName } = userProfile;
|
|
23
|
+
// scoring rules locale
|
|
24
|
+
const culture = (0, getScoringRules_1.getScoringRulesLocale)(item);
|
|
25
|
+
// scoring rules
|
|
26
|
+
const SCORING = (0, getScoringRules_1.getScoringRules)(item, scoringRulesConfig_1.default);
|
|
27
|
+
const stringsConfig = (0, stringsConfig_1.getStringsConfig)();
|
|
28
|
+
// issues
|
|
29
|
+
const issues = {
|
|
30
|
+
property: 'userProfileName',
|
|
31
|
+
label: stringsConfig.userProfileName.LABEL,
|
|
32
|
+
maxScore: SCORING.EMPTY_STRING_SCORE +
|
|
33
|
+
SCORING.HAS_USERNAME_SCORE +
|
|
34
|
+
SCORING.NO_UNDERSCORE_SCORE,
|
|
35
|
+
score: SCORING.EMPTY_STRING_SCORE,
|
|
36
|
+
messages: [],
|
|
37
|
+
weight: stringsConfig.userProfileName.WEIGHT,
|
|
38
|
+
critical: false,
|
|
39
|
+
};
|
|
40
|
+
if (!(0, assertString_1.assertString)(userProfile.fullName) || (0, isEmpty_1.isEmpty)(fullName)) {
|
|
41
|
+
issues.messages.push({
|
|
42
|
+
code: stringsConfig.userProfileName.EMPTY_STRING_CODE,
|
|
43
|
+
message: stringsConfig.userProfileName.EMPTY_STRING_MESSAGE,
|
|
44
|
+
});
|
|
45
|
+
return issues;
|
|
46
|
+
}
|
|
47
|
+
issues.score = SCORING.HAS_USERNAME_SCORE;
|
|
48
|
+
if (culture === 'en' && (0, contains_1.contains)(fullName, '_')) {
|
|
49
|
+
issues.messages.push({
|
|
50
|
+
code: stringsConfig.userProfileName.BLACKLISTED_CHARS_CODE,
|
|
51
|
+
message: stringsConfig.userProfileName.BLACKLISTED_CHARS_MESSAGE,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
issues.score += SCORING.NO_UNDERSCORE_SCORE;
|
|
56
|
+
}
|
|
57
|
+
return issues;
|
|
58
|
+
};
|
|
59
|
+
exports.isValidUserProfileName = isValidUserProfileName;
|
|
60
|
+
//# sourceMappingURL=isValidUserProfileName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidUserProfileName.js","sourceRoot":"","sources":["../../../src/lib/userProfileName/isValidUserProfileName.ts"],"names":[],"mappings":";;;;;;AAAA,8EAAsD;AACtD,6DAGiC;AAEjC,yDAAyD;AACzD,uDAAoD;AACpD,6CAA0C;AAC1C,+CAA4C;AAE5C;;;;;;;GAOG;AACI,MAAM,sBAAsB,GAAG,CAClC,WAAwB,EACxB,IAAW,EACG,EAAE;IAChB,MAAM,EAAE,QAAQ,EAAE,GAAG,WAAW,CAAC;IAEjC,uBAAuB;IACvB,MAAM,OAAO,GAAG,IAAA,uCAAqB,EAAC,IAAI,CAAC,CAAC;IAE5C,gBAAgB;IAChB,MAAM,OAAO,GAAG,IAAA,iCAAe,EAAC,IAAI,EAAE,4BAAkB,CAAC,CAAC;IAE1D,MAAM,aAAa,GAAG,IAAA,gCAAgB,GAAE,CAAC;IAEzC,SAAS;IACT,MAAM,MAAM,GAAmB;QAC3B,QAAQ,EAAE,iBAAiB;QAC3B,KAAK,EAAE,aAAa,CAAC,eAAe,CAAC,KAAK;QAC1C,QAAQ,EACJ,OAAO,CAAC,kBAAkB;YAC1B,OAAO,CAAC,kBAAkB;YAC1B,OAAO,CAAC,mBAAmB;QAC/B,KAAK,EAAE,OAAO,CAAC,kBAAkB;QACjC,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,aAAa,CAAC,eAAe,CAAC,MAAM;QAC5C,QAAQ,EAAE,KAAK;KAClB,CAAC;IAEF,IAAI,CAAC,IAAA,2BAAY,EAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,IAAA,iBAAO,EAAC,QAAQ,CAAC,EAAE;QAC1D,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YACjB,IAAI,EAAE,aAAa,CAAC,eAAe,CAAC,iBAAiB;YACrD,OAAO,EAAE,aAAa,CAAC,eAAe,CAAC,oBAAoB;SAC9D,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;KACjB;IAED,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAE1C,IAAI,OAAO,KAAK,IAAI,IAAI,IAAA,mBAAQ,EAAC,QAAQ,EAAE,GAAG,CAAC,EAAE;QAC7C,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YACjB,IAAI,EAAE,aAAa,CAAC,eAAe,CAAC,sBAAsB;YAC1D,OAAO,EAAE,aAAa,CAAC,eAAe,CAAC,yBAAyB;SACnE,CAAC,CAAC;KACN;SAAM;QACH,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,mBAAmB,CAAC;KAC/C;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAjDW,QAAA,sBAAsB,0BAiDjC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config = {
|
|
4
|
+
// Scoring
|
|
5
|
+
SCORING: {
|
|
6
|
+
DEFAULT: {
|
|
7
|
+
WEB_MAP: {
|
|
8
|
+
EMPTY_STRING_SCORE: 0,
|
|
9
|
+
HAS_USERNAME_SCORE: 5,
|
|
10
|
+
NO_UNDERSCORE_SCORE: 2,
|
|
11
|
+
},
|
|
12
|
+
WEB_SCENE: {
|
|
13
|
+
EMPTY_STRING_SCORE: 0,
|
|
14
|
+
HAS_USERNAME_SCORE: 5,
|
|
15
|
+
NO_UNDERSCORE_SCORE: 3,
|
|
16
|
+
},
|
|
17
|
+
APPLICATION: {
|
|
18
|
+
EMPTY_STRING_SCORE: 0,
|
|
19
|
+
HAS_USERNAME_SCORE: 5,
|
|
20
|
+
NO_UNDERSCORE_SCORE: 2,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
INTERNATIONAL: {
|
|
24
|
+
WEB_MAP: {
|
|
25
|
+
EMPTY_STRING_SCORE: 0,
|
|
26
|
+
HAS_USERNAME_SCORE: 5,
|
|
27
|
+
NO_UNDERSCORE_SCORE: 2,
|
|
28
|
+
},
|
|
29
|
+
WEB_SCENE: {
|
|
30
|
+
EMPTY_STRING_SCORE: 0,
|
|
31
|
+
HAS_USERNAME_SCORE: 5,
|
|
32
|
+
NO_UNDERSCORE_SCORE: 2,
|
|
33
|
+
},
|
|
34
|
+
APPLICATION: {
|
|
35
|
+
EMPTY_STRING_SCORE: 0,
|
|
36
|
+
HAS_USERNAME_SCORE: 5,
|
|
37
|
+
NO_UNDERSCORE_SCORE: 2,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
exports.default = config;
|
|
43
|
+
//# sourceMappingURL=scoringRulesConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scoringRulesConfig.js","sourceRoot":"","sources":["../../../src/lib/userProfileName/scoringRulesConfig.ts"],"names":[],"mappings":";;AAEA,MAAM,MAAM,GAAuB;IAC/B,UAAU;IACV,OAAO,EAAE;QACL,OAAO,EAAE;YACL,OAAO,EAAE;gBACL,kBAAkB,EAAE,CAAC;gBACrB,kBAAkB,EAAE,CAAC;gBACrB,mBAAmB,EAAE,CAAC;aACzB;YACD,SAAS,EAAE;gBACP,kBAAkB,EAAE,CAAC;gBACrB,kBAAkB,EAAE,CAAC;gBACrB,mBAAmB,EAAE,CAAC;aACzB;YACD,WAAW,EAAE;gBACT,kBAAkB,EAAE,CAAC;gBACrB,kBAAkB,EAAE,CAAC;gBACrB,mBAAmB,EAAE,CAAC;aACzB;SACJ;QAED,aAAa,EAAE;YACX,OAAO,EAAE;gBACL,kBAAkB,EAAE,CAAC;gBACrB,kBAAkB,EAAE,CAAC;gBACrB,mBAAmB,EAAE,CAAC;aACzB;YACD,SAAS,EAAE;gBACP,kBAAkB,EAAE,CAAC;gBACrB,kBAAkB,EAAE,CAAC;gBACrB,mBAAmB,EAAE,CAAC;aACzB;YACD,WAAW,EAAE;gBACT,kBAAkB,EAAE,CAAC;gBACrB,kBAAkB,EAAE,CAAC;gBACrB,mBAAmB,EAAE,CAAC;aACzB;SACJ;KACJ;CACJ,CAAC;AAEF,kBAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IItem, UserProfile } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Validate the user's profile thumbnail.
|
|
4
|
+
*
|
|
5
|
+
* The file name of the thumbnail used for the user. All user thumbnails are relative to the URL https://<community-url>/users/<userName>/info.
|
|
6
|
+
* It's useful for users to include a thumbnail image, a logo, or anything that represents him/her.
|
|
7
|
+
* The image should be 150 pixels wide by 150 pixels high in a web file format such as PNG, GIF, or JPEG.
|
|
8
|
+
* The maximum file size is 1 MB. If the image is a different dimension, it is automatically resized to 150 by 150 and may appear warped.
|
|
9
|
+
*
|
|
10
|
+
* Living Atlas specific
|
|
11
|
+
* - Cannot be empty
|
|
12
|
+
* - The thumbnail file name cannot be one of the ArcGIS Online Reserved
|
|
13
|
+
*/
|
|
14
|
+
export declare const isValidUserProfileThumbnail: (userProfile: UserProfile, item: IItem) => {
|
|
15
|
+
property: string;
|
|
16
|
+
label: string;
|
|
17
|
+
maxScore: number;
|
|
18
|
+
score: number;
|
|
19
|
+
messages: any[];
|
|
20
|
+
weight: number;
|
|
21
|
+
critical: boolean;
|
|
22
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidUserProfileThumbnail = void 0;
|
|
7
|
+
const scoringRulesConfig_1 = __importDefault(require("./scoringRulesConfig"));
|
|
8
|
+
const getScoringRules_1 = require("../util/getScoringRules");
|
|
9
|
+
const stringsConfig_1 = require("../util/stringsConfig");
|
|
10
|
+
const getThumbnailFileName_1 = require("../util/getThumbnailFileName");
|
|
11
|
+
const isArcGISOnlineReservedThumbnailName_1 = require("../util/isArcGISOnlineReservedThumbnailName");
|
|
12
|
+
/**
|
|
13
|
+
* Validate the user's profile thumbnail.
|
|
14
|
+
*
|
|
15
|
+
* The file name of the thumbnail used for the user. All user thumbnails are relative to the URL https://<community-url>/users/<userName>/info.
|
|
16
|
+
* It's useful for users to include a thumbnail image, a logo, or anything that represents him/her.
|
|
17
|
+
* The image should be 150 pixels wide by 150 pixels high in a web file format such as PNG, GIF, or JPEG.
|
|
18
|
+
* The maximum file size is 1 MB. If the image is a different dimension, it is automatically resized to 150 by 150 and may appear warped.
|
|
19
|
+
*
|
|
20
|
+
* Living Atlas specific
|
|
21
|
+
* - Cannot be empty
|
|
22
|
+
* - The thumbnail file name cannot be one of the ArcGIS Online Reserved
|
|
23
|
+
*/
|
|
24
|
+
const isValidUserProfileThumbnail = (userProfile, item) => {
|
|
25
|
+
const { thumbnail } = userProfile;
|
|
26
|
+
// scoring rules
|
|
27
|
+
const SCORING = (0, getScoringRules_1.getScoringRules)(item, scoringRulesConfig_1.default);
|
|
28
|
+
const stringsConfig = (0, stringsConfig_1.getStringsConfig)();
|
|
29
|
+
const issues = {
|
|
30
|
+
property: 'userProfileThumbnail',
|
|
31
|
+
label: stringsConfig.userProfileThumbnail.LABEL,
|
|
32
|
+
maxScore: SCORING.EMPTY_STRING_SCORE +
|
|
33
|
+
SCORING.USER_PROFILE_HAS_THUMBNAIL_SCORE,
|
|
34
|
+
score: SCORING.EMPTY_STRING_SCORE,
|
|
35
|
+
messages: [],
|
|
36
|
+
weight: stringsConfig.userProfileThumbnail.WEIGHT,
|
|
37
|
+
critical: false,
|
|
38
|
+
};
|
|
39
|
+
if (!thumbnail) {
|
|
40
|
+
issues.messages.push({
|
|
41
|
+
code: stringsConfig.userProfileThumbnail.EMPTY_STRING_CODE,
|
|
42
|
+
message: stringsConfig.userProfileThumbnail.EMPTY_STRING_MESSAGE,
|
|
43
|
+
});
|
|
44
|
+
return issues;
|
|
45
|
+
}
|
|
46
|
+
const thumbnailFileName = (0, getThumbnailFileName_1.getThumbnailFileName)(thumbnail);
|
|
47
|
+
// check if the user is not using the default thumbnail
|
|
48
|
+
if ((0, isArcGISOnlineReservedThumbnailName_1.isArcGISOnlineReservedThumbnailName)(thumbnailFileName)) {
|
|
49
|
+
issues.messages.push({
|
|
50
|
+
code: stringsConfig.userProfileThumbnail.EMPTY_STRING_CODE,
|
|
51
|
+
message: stringsConfig.userProfileThumbnail.EMPTY_STRING_MESSAGE,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
issues.score =
|
|
56
|
+
SCORING.EMPTY_STRING_SCORE +
|
|
57
|
+
SCORING.USER_PROFILE_HAS_THUMBNAIL_SCORE;
|
|
58
|
+
}
|
|
59
|
+
return issues;
|
|
60
|
+
};
|
|
61
|
+
exports.isValidUserProfileThumbnail = isValidUserProfileThumbnail;
|
|
62
|
+
//# sourceMappingURL=isValidUserProfileThumbnail.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidUserProfileThumbnail.js","sourceRoot":"","sources":["../../../src/lib/userProfileThumbnail/isValidUserProfileThumbnail.ts"],"names":[],"mappings":";;;;;;AAAA,8EAAsD;AACtD,6DAGiC;AAEjC,yDAAyD;AACzD,uEAAoE;AACpE,qGAAkG;AAElG;;;;;;;;;;;GAWG;AACI,MAAM,2BAA2B,GAAG,CACvC,WAAwB,EACxB,IAAW,EACb,EAAE;IACA,MAAM,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC;IAElC,gBAAgB;IAChB,MAAM,OAAO,GAAG,IAAA,iCAAe,EAAC,IAAI,EAAE,4BAAkB,CAAC,CAAC;IAE1D,MAAM,aAAa,GAAG,IAAA,gCAAgB,GAAE,CAAC;IAEzC,MAAM,MAAM,GAAG;QACX,QAAQ,EAAE,sBAAsB;QAChC,KAAK,EAAE,aAAa,CAAC,oBAAoB,CAAC,KAAK;QAC/C,QAAQ,EACJ,OAAO,CAAC,kBAAkB;YAC1B,OAAO,CAAC,gCAAgC;QAC5C,KAAK,EAAE,OAAO,CAAC,kBAAkB;QACjC,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,aAAa,CAAC,oBAAoB,CAAC,MAAM;QACjD,QAAQ,EAAE,KAAK;KAClB,CAAC;IAEF,IAAI,CAAC,SAAS,EAAE;QACZ,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YACjB,IAAI,EAAE,aAAa,CAAC,oBAAoB,CAAC,iBAAiB;YAC1D,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,oBAAoB;SACnE,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;KACjB;IAED,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,SAAS,CAAC,CAAC;IAE1D,uDAAuD;IACvD,IAAI,IAAA,yEAAmC,EAAC,iBAAiB,CAAC,EAAE;QACxD,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YACjB,IAAI,EAAE,aAAa,CAAC,oBAAoB,CAAC,iBAAiB;YAC1D,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,oBAAoB;SACnE,CAAC,CAAC;KACN;SAAM;QACH,MAAM,CAAC,KAAK;YACR,OAAO,CAAC,kBAAkB;gBAC1B,OAAO,CAAC,gCAAgC,CAAC;KAChD;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AA/CW,QAAA,2BAA2B,+BA+CtC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config = {
|
|
4
|
+
// Scoring
|
|
5
|
+
SCORING: {
|
|
6
|
+
DEFAULT: {
|
|
7
|
+
WEB_MAP: {
|
|
8
|
+
EMPTY_STRING_SCORE: 0,
|
|
9
|
+
USER_PROFILE_HAS_THUMBNAIL_SCORE: 7,
|
|
10
|
+
},
|
|
11
|
+
WEB_SCENE: {
|
|
12
|
+
EMPTY_STRING_SCORE: 0,
|
|
13
|
+
USER_PROFILE_HAS_THUMBNAIL_SCORE: 8,
|
|
14
|
+
},
|
|
15
|
+
APPLICATION: {
|
|
16
|
+
EMPTY_STRING_SCORE: 0,
|
|
17
|
+
USER_PROFILE_HAS_THUMBNAIL_SCORE: 7,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
INTERNATIONAL: {
|
|
21
|
+
WEB_MAP: {
|
|
22
|
+
EMPTY_STRING_SCORE: 0,
|
|
23
|
+
USER_PROFILE_HAS_THUMBNAIL_SCORE: 7,
|
|
24
|
+
},
|
|
25
|
+
WEB_SCENE: {
|
|
26
|
+
EMPTY_STRING_SCORE: 0,
|
|
27
|
+
USER_PROFILE_HAS_THUMBNAIL_SCORE: 8,
|
|
28
|
+
},
|
|
29
|
+
APPLICATION: {
|
|
30
|
+
EMPTY_STRING_SCORE: 0,
|
|
31
|
+
USER_PROFILE_HAS_THUMBNAIL_SCORE: 7,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
exports.default = config;
|
|
37
|
+
//# sourceMappingURL=scoringRulesConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scoringRulesConfig.js","sourceRoot":"","sources":["../../../src/lib/userProfileThumbnail/scoringRulesConfig.ts"],"names":[],"mappings":";;AAEA,MAAM,MAAM,GAAuB;IAC/B,UAAU;IACV,OAAO,EAAE;QACL,OAAO,EAAE;YACL,OAAO,EAAE;gBACL,kBAAkB,EAAE,CAAC;gBACrB,gCAAgC,EAAE,CAAC;aACtC;YACD,SAAS,EAAE;gBACP,kBAAkB,EAAE,CAAC;gBACrB,gCAAgC,EAAE,CAAC;aACtC;YACD,WAAW,EAAE;gBACT,kBAAkB,EAAE,CAAC;gBACrB,gCAAgC,EAAE,CAAC;aACtC;SACJ;QAED,aAAa,EAAE;YACX,OAAO,EAAE;gBACL,kBAAkB,EAAE,CAAC;gBACrB,gCAAgC,EAAE,CAAC;aACtC;YACD,SAAS,EAAE;gBACP,kBAAkB,EAAE,CAAC;gBACrB,gCAAgC,EAAE,CAAC;aACtC;YACD,WAAW,EAAE;gBACT,kBAAkB,EAAE,CAAC;gBACrB,gCAAgC,EAAE,CAAC;aACtC;SACJ;KACJ;CACJ,CAAC;AAEF,kBAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The function then checks whether the input is a string or not by using the typeof operator to compare it
|
|
3
|
+
* with the string "string" and checking if it is an instance of the String constructor.
|
|
4
|
+
*
|
|
5
|
+
* This function can be used to check if a given value is a string, which can be useful in situations where a string is required,
|
|
6
|
+
* such as validating user input in a form or checking if a variable is a string before manipulating it.
|
|
7
|
+
*
|
|
8
|
+
* @param input
|
|
9
|
+
* @returns a boolean value, true if input is a string, false otherwise.
|
|
10
|
+
*/
|
|
11
|
+
export declare const assertString: (input: any) => boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertString = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The function then checks whether the input is a string or not by using the typeof operator to compare it
|
|
6
|
+
* with the string "string" and checking if it is an instance of the String constructor.
|
|
7
|
+
*
|
|
8
|
+
* This function can be used to check if a given value is a string, which can be useful in situations where a string is required,
|
|
9
|
+
* such as validating user input in a form or checking if a variable is a string before manipulating it.
|
|
10
|
+
*
|
|
11
|
+
* @param input
|
|
12
|
+
* @returns a boolean value, true if input is a string, false otherwise.
|
|
13
|
+
*/
|
|
14
|
+
const assertString = (input) => {
|
|
15
|
+
// The typeof operator returns a string indicating the type of the unevaluated operand.
|
|
16
|
+
const isString = typeof input === 'string' || input instanceof String;
|
|
17
|
+
return isString;
|
|
18
|
+
};
|
|
19
|
+
exports.assertString = assertString;
|
|
20
|
+
//# sourceMappingURL=assertString.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertString.js","sourceRoot":"","sources":["../../../src/lib/util/assertString.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACI,MAAM,YAAY,GAAG,CAAC,KAAU,EAAW,EAAE;IAChD,uFAAuF;IACvF,MAAM,QAAQ,GAAG,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,YAAY,MAAM,CAAC;IACtE,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAJW,QAAA,YAAY,gBAIvB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if the input string contains a string representation of searchElem
|
|
3
|
+
* @param str
|
|
4
|
+
* @param searchElem element to search
|
|
5
|
+
* @returns a boolean value, true if input `str` contains searchElem, false otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare const contains: (str: string, searchElem: any) => boolean;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.contains = void 0;
|
|
4
|
+
const toString_1 = require("./toString");
|
|
5
|
+
/**
|
|
6
|
+
* Check if the input string contains a string representation of searchElem
|
|
7
|
+
* @param str
|
|
8
|
+
* @param searchElem element to search
|
|
9
|
+
* @returns a boolean value, true if input `str` contains searchElem, false otherwise.
|
|
10
|
+
*/
|
|
11
|
+
const contains = (str, searchElem) => {
|
|
12
|
+
// The toString() function is used to ensure that the searchElem is converted to a string before being searched for in the str
|
|
13
|
+
searchElem = (0, toString_1.toString)(searchElem);
|
|
14
|
+
return str.includes(searchElem);
|
|
15
|
+
};
|
|
16
|
+
exports.contains = contains;
|
|
17
|
+
//# sourceMappingURL=contains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contains.js","sourceRoot":"","sources":["../../../src/lib/util/contains.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AAEtC;;;;;GAKG;AACI,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,UAAU,EAAE,EAAE;IAChD,8HAA8H;IAC9H,UAAU,GAAG,IAAA,mBAAQ,EAAC,UAAU,CAAC,CAAC;IAClC,OAAO,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AACpC,CAAC,CAAC;AAJW,QAAA,QAAQ,YAInB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNumberOfStrings = void 0;
|
|
4
|
+
const assertString_1 = require("./assertString");
|
|
5
|
+
/**
|
|
6
|
+
* Retrieve the number of words in string separated by space
|
|
7
|
+
* @param s
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
const getNumberOfStrings = (s) => {
|
|
11
|
+
if (!(0, assertString_1.assertString)(s)) {
|
|
12
|
+
return 0;
|
|
13
|
+
}
|
|
14
|
+
// exclude white space
|
|
15
|
+
let str = s.replace(/(^\s*)|(\s*$)/gi, '');
|
|
16
|
+
str = str.replace(/[ ]{2,}/gi, ' ');
|
|
17
|
+
// exclude newline with a space at beginning
|
|
18
|
+
str = str.replace(/\n /, '\n');
|
|
19
|
+
if (str.split(' ').length === 1 && str.trim() === '') {
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
return str.split(' ').length;
|
|
23
|
+
};
|
|
24
|
+
exports.getNumberOfStrings = getNumberOfStrings;
|
|
25
|
+
//# sourceMappingURL=getNumberOfStrings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNumberOfStrings.js","sourceRoot":"","sources":["../../../src/lib/util/getNumberOfStrings.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAE9C;;;;GAIG;AACI,MAAM,kBAAkB,GAAG,CAAC,CAAS,EAAU,EAAE;IACpD,IAAI,CAAC,IAAA,2BAAY,EAAC,CAAC,CAAC,EAAE;QAClB,OAAO,CAAC,CAAC;KACZ;IAED,sBAAsB;IACtB,IAAI,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;IAC3C,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAEpC,4CAA4C;IAC5C,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAE/B,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAClD,OAAO,CAAC,CAAC;KACZ;IAED,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;AACjC,CAAC,CAAC;AAjBW,QAAA,kBAAkB,sBAiB7B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IItem, ScoringRules, ScoringRulesConfig } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Scoring Rule locale
|
|
4
|
+
*/
|
|
5
|
+
type ScoringRulesLocale = 'en' | 'international';
|
|
6
|
+
/**
|
|
7
|
+
* Determines the locale of scoring rules based on the `culture` property of the input item.
|
|
8
|
+
* English and Non-English items are scored using different rules.
|
|
9
|
+
*
|
|
10
|
+
* @param item An ArcGIS Online item.
|
|
11
|
+
* @returns Returns 'en' for English items, otherwise returns 'international'.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getScoringRulesLocale: (item: IItem) => ScoringRulesLocale;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the rules that will be used to score the item based on the item type
|
|
16
|
+
* @param itemType
|
|
17
|
+
* @param scoringRulesByType
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare const getScoringRules: (item: IItem, scoringRulesConfig: ScoringRulesConfig) => ScoringRules;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getScoringRules = exports.getScoringRulesLocale = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Look up table that maps Living Atlas supported item types to the corresponding Scoring Rules Type.
|
|
6
|
+
*/
|
|
7
|
+
const itemType2ScoringType = {
|
|
8
|
+
'Feature Collection': 'WEB_MAP',
|
|
9
|
+
'Feature Service': 'WEB_MAP',
|
|
10
|
+
'Image Service': 'WEB_MAP',
|
|
11
|
+
'Map Service': 'WEB_MAP',
|
|
12
|
+
'Web Map': 'WEB_MAP',
|
|
13
|
+
'Vector Tile Service': 'WEB_MAP',
|
|
14
|
+
'CityEngine Web Scene': 'WEB_SCENE',
|
|
15
|
+
'Deep Learning Package': 'WEB_SCENE',
|
|
16
|
+
'Raster function template': 'WEB_SCENE',
|
|
17
|
+
'Rule Package': 'WEB_SCENE',
|
|
18
|
+
'Scene Service': 'WEB_SCENE',
|
|
19
|
+
Style: 'WEB_SCENE',
|
|
20
|
+
'Desktop Style': 'WEB_SCENE',
|
|
21
|
+
'Web Scene': 'WEB_SCENE',
|
|
22
|
+
Dashboard: 'APPLICATION',
|
|
23
|
+
'Document Link': 'APPLICATION',
|
|
24
|
+
'Project Package': 'APPLICATION',
|
|
25
|
+
StoryMap: 'APPLICATION',
|
|
26
|
+
'Web Experience': 'APPLICATION',
|
|
27
|
+
'Web Experience Template': 'APPLICATION',
|
|
28
|
+
'Web Mapping Application': 'APPLICATION',
|
|
29
|
+
WMS: 'APPLICATION',
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Determines the locale of scoring rules based on the `culture` property of the input item.
|
|
33
|
+
* English and Non-English items are scored using different rules.
|
|
34
|
+
*
|
|
35
|
+
* @param item An ArcGIS Online item.
|
|
36
|
+
* @returns Returns 'en' for English items, otherwise returns 'international'.
|
|
37
|
+
*/
|
|
38
|
+
const getScoringRulesLocale = (item) => {
|
|
39
|
+
if (!item.culture) {
|
|
40
|
+
return 'en';
|
|
41
|
+
}
|
|
42
|
+
const [itemRegion] = item.culture.split('-');
|
|
43
|
+
if (itemRegion === 'en' ||
|
|
44
|
+
item.culture === 'english (united states)' ||
|
|
45
|
+
item.culture === '') {
|
|
46
|
+
return 'en';
|
|
47
|
+
}
|
|
48
|
+
return 'international';
|
|
49
|
+
};
|
|
50
|
+
exports.getScoringRulesLocale = getScoringRulesLocale;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the rules that will be used to score the item based on the item type
|
|
53
|
+
* @param itemType
|
|
54
|
+
* @param scoringRulesByType
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
const getScoringRules = (item, scoringRulesConfig) => {
|
|
58
|
+
const locale = (0, exports.getScoringRulesLocale)(item);
|
|
59
|
+
const { SCORING } = scoringRulesConfig;
|
|
60
|
+
const scoringRulesData = locale === 'en' ? SCORING.DEFAULT : SCORING.INTERNATIONAL;
|
|
61
|
+
const itemType = item.type;
|
|
62
|
+
const scoringRuleType = itemType2ScoringType[itemType];
|
|
63
|
+
// switch (itemType) {
|
|
64
|
+
// case 'Feature Collection':
|
|
65
|
+
// case 'Feature Service':
|
|
66
|
+
// case 'Image Service':
|
|
67
|
+
// case 'Map Service':
|
|
68
|
+
// case 'Web Map':
|
|
69
|
+
// case 'Vector Tile Service':
|
|
70
|
+
// scoringRules = scoringRulesData['WEB_MAP'];
|
|
71
|
+
// break;
|
|
72
|
+
// case 'CityEngine Web Scene':
|
|
73
|
+
// case 'Deep Learning Package':
|
|
74
|
+
// case 'Raster function template':
|
|
75
|
+
// case 'Rule Package':
|
|
76
|
+
// case 'Scene Service':
|
|
77
|
+
// case 'Style':
|
|
78
|
+
// case 'Desktop Style':
|
|
79
|
+
// case 'Web Scene':
|
|
80
|
+
// scoringRules = scoringRulesData['WEB_SCENE'];
|
|
81
|
+
// break;
|
|
82
|
+
// case 'Dashboard':
|
|
83
|
+
// case 'Document Link':
|
|
84
|
+
// case 'Project Package':
|
|
85
|
+
// case 'StoryMap':
|
|
86
|
+
// case 'Web Experience':
|
|
87
|
+
// case 'Web Experience Template':
|
|
88
|
+
// case 'Web Mapping Application':
|
|
89
|
+
// case 'WMS':
|
|
90
|
+
// scoringRules = scoringRulesData['APPLICATION'];
|
|
91
|
+
// break;
|
|
92
|
+
// default:
|
|
93
|
+
// break;
|
|
94
|
+
// // code block
|
|
95
|
+
// }
|
|
96
|
+
return scoringRulesData[scoringRuleType] || null;
|
|
97
|
+
};
|
|
98
|
+
exports.getScoringRules = getScoringRules;
|
|
99
|
+
//# sourceMappingURL=getScoringRules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getScoringRules.js","sourceRoot":"","sources":["../../../src/lib/util/getScoringRules.ts"],"names":[],"mappings":";;;AAcA;;GAEG;AACH,MAAM,oBAAoB,GAGtB;IACA,oBAAoB,EAAE,SAAS;IAC/B,iBAAiB,EAAE,SAAS;IAC5B,eAAe,EAAE,SAAS;IAC1B,aAAa,EAAE,SAAS;IACxB,SAAS,EAAE,SAAS;IACpB,qBAAqB,EAAE,SAAS;IAChC,sBAAsB,EAAE,WAAW;IACnC,uBAAuB,EAAE,WAAW;IACpC,0BAA0B,EAAE,WAAW;IACvC,cAAc,EAAE,WAAW;IAC3B,eAAe,EAAE,WAAW;IAC5B,KAAK,EAAE,WAAW;IAClB,eAAe,EAAE,WAAW;IAC5B,WAAW,EAAE,WAAW;IACxB,SAAS,EAAE,aAAa;IACxB,eAAe,EAAE,aAAa;IAC9B,iBAAiB,EAAE,aAAa;IAChC,QAAQ,EAAE,aAAa;IACvB,gBAAgB,EAAE,aAAa;IAC/B,yBAAyB,EAAE,aAAa;IACxC,yBAAyB,EAAE,aAAa;IACxC,GAAG,EAAE,aAAa;CACrB,CAAC;AAEF;;;;;;GAMG;AACI,MAAM,qBAAqB,GAAG,CAAC,IAAW,EAAsB,EAAE;IACrE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;QACf,OAAO,IAAI,CAAC;KACf;IAED,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAE7C,IACI,UAAU,KAAK,IAAI;QACnB,IAAI,CAAC,OAAO,KAAK,yBAAyB;QAC1C,IAAI,CAAC,OAAO,KAAK,EAAE,EACrB;QACE,OAAO,IAAI,CAAC;KACf;IAED,OAAO,eAAe,CAAC;AAC3B,CAAC,CAAC;AAhBW,QAAA,qBAAqB,yBAgBhC;AAEF;;;;;GAKG;AACI,MAAM,eAAe,GAAG,CAC3B,IAAW,EACX,kBAAsC,EAC1B,EAAE;IACd,MAAM,MAAM,GAAG,IAAA,6BAAqB,EAAC,IAAI,CAAC,CAAC;IAE3C,MAAM,EAAE,OAAO,EAAE,GAAG,kBAAkB,CAAC;IAEvC,MAAM,gBAAgB,GAClB,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;IAE9D,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAoC,CAAC;IAE3D,MAAM,eAAe,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAEvD,sBAAsB;IACtB,iCAAiC;IACjC,8BAA8B;IAC9B,4BAA4B;IAC5B,0BAA0B;IAC1B,sBAAsB;IACtB,kCAAkC;IAClC,sDAAsD;IACtD,iBAAiB;IACjB,mCAAmC;IACnC,oCAAoC;IACpC,uCAAuC;IACvC,2BAA2B;IAC3B,4BAA4B;IAC5B,oBAAoB;IACpB,4BAA4B;IAC5B,wBAAwB;IACxB,wDAAwD;IACxD,iBAAiB;IACjB,wBAAwB;IACxB,4BAA4B;IAC5B,8BAA8B;IAC9B,uBAAuB;IACvB,6BAA6B;IAC7B,sCAAsC;IACtC,sCAAsC;IACtC,kBAAkB;IAClB,0DAA0D;IAC1D,iBAAiB;IACjB,eAAe;IACf,iBAAiB;IACjB,oBAAoB;IACpB,IAAI;IAEJ,OAAO,gBAAgB,CAAC,eAAe,CAAC,IAAI,IAAI,CAAC;AACrD,CAAC,CAAC;AAlDW,QAAA,eAAe,mBAkD1B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get thumbnail image file name.
|
|
3
|
+
*
|
|
4
|
+
* For an ArcGIS Online Item, the thumbnail property contains values like `thumbnail/thumbnail1681504014799.png`,
|
|
5
|
+
* The string after backslash is the actual file name of the thumbnail image.
|
|
6
|
+
* @param thumbnail
|
|
7
|
+
* @returns file name of the thumbnail image
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```
|
|
11
|
+
* getThumbnailFileName('thumbnail/thumbnail1681504014799.png');
|
|
12
|
+
* // returns `thumbnail1681504014799.png`
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare const getThumbnailFileName: (thumbnail: string) => string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getThumbnailFileName = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Get thumbnail image file name.
|
|
6
|
+
*
|
|
7
|
+
* For an ArcGIS Online Item, the thumbnail property contains values like `thumbnail/thumbnail1681504014799.png`,
|
|
8
|
+
* The string after backslash is the actual file name of the thumbnail image.
|
|
9
|
+
* @param thumbnail
|
|
10
|
+
* @returns file name of the thumbnail image
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* getThumbnailFileName('thumbnail/thumbnail1681504014799.png');
|
|
15
|
+
* // returns `thumbnail1681504014799.png`
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
const getThumbnailFileName = (thumbnail) => {
|
|
19
|
+
if (thumbnail.includes('/') === false) {
|
|
20
|
+
return thumbnail;
|
|
21
|
+
}
|
|
22
|
+
const [prefix, filename] = thumbnail.split('/');
|
|
23
|
+
return filename || '';
|
|
24
|
+
};
|
|
25
|
+
exports.getThumbnailFileName = getThumbnailFileName;
|
|
26
|
+
//# sourceMappingURL=getThumbnailFileName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getThumbnailFileName.js","sourceRoot":"","sources":["../../../src/lib/util/getThumbnailFileName.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;GAaG;AACI,MAAM,oBAAoB,GAAG,CAAC,SAAiB,EAAE,EAAE;IACtD,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE;QACnC,OAAO,SAAS,CAAC;KACpB;IAED,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAChD,OAAO,QAAQ,IAAI,EAAE,CAAC;AAC1B,CAAC,CAAC;AAPW,QAAA,oBAAoB,wBAO/B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isArcGISDomain = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Check if input URL is hosted under ArcGIS Domain
|
|
6
|
+
* @param url
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
const isArcGISDomain = (url) => {
|
|
10
|
+
if (!url) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return url.includes('arcgis.com') || url.includes('arcgisonline.com');
|
|
14
|
+
};
|
|
15
|
+
exports.isArcGISDomain = isArcGISDomain;
|
|
16
|
+
//# sourceMappingURL=isArcGISDomain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isArcGISDomain.js","sourceRoot":"","sources":["../../../src/lib/util/isArcGISDomain.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,MAAM,cAAc,GAAG,CAAC,GAAW,EAAW,EAAE;IACnD,IAAI,CAAC,GAAG,EAAE;QACN,OAAO,KAAK,CAAC;KAChB;IAED,OAAO,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAC1E,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isArcGISOnlineReservedThumbnailName = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* check and see if the input thumbnail name is one of the reserved names used by ArcGIS online
|
|
6
|
+
* @param smallThumbnailFileName
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
const isArcGISOnlineReservedThumbnailName = (thumbnailName) => {
|
|
10
|
+
return [
|
|
11
|
+
'thumbnail.jpeg',
|
|
12
|
+
'nullThumbnail.png',
|
|
13
|
+
'no-user-thumb.jpg',
|
|
14
|
+
'ago_downloaded.png',
|
|
15
|
+
'ago_downloaded.jpg',
|
|
16
|
+
].includes(thumbnailName);
|
|
17
|
+
};
|
|
18
|
+
exports.isArcGISOnlineReservedThumbnailName = isArcGISOnlineReservedThumbnailName;
|
|
19
|
+
//# sourceMappingURL=isArcGISOnlineReservedThumbnailName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isArcGISOnlineReservedThumbnailName.js","sourceRoot":"","sources":["../../../src/lib/util/isArcGISOnlineReservedThumbnailName.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACI,MAAM,mCAAmC,GAAG,CAAC,aAAqB,EAAE,EAAE;IACzE,OAAO;QACH,gBAAgB;QAChB,mBAAmB;QACnB,mBAAmB;QACnB,oBAAoB;QACpB,oBAAoB;KACvB,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AAC9B,CAAC,CAAC;AARW,QAAA,mCAAmC,uCAQ9C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDefined = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Check if value is defined
|
|
6
|
+
*
|
|
7
|
+
* A value is defined if it is not undefined or null
|
|
8
|
+
* @param value
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
const isDefined = (value) => {
|
|
12
|
+
return value !== undefined && value !== null;
|
|
13
|
+
};
|
|
14
|
+
exports.isDefined = isDefined;
|
|
15
|
+
//# sourceMappingURL=isDefined.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isDefined.js","sourceRoot":"","sources":["../../../src/lib/util/isDefined.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACI,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,EAAE;IAC/B,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;AACjD,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB"}
|