@8ms/helpers 1.2.12 → 1.2.14

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.
@@ -0,0 +1,29 @@
1
+ declare const columns: {
2
+ CUSTOM_EXTRACTION_1: string;
3
+ CUSTOM_EXTRACTION_2: string;
4
+ DEEP_RANK: string;
5
+ DESCRIPTION: string;
6
+ DUPLICATE_PAGE: string;
7
+ DUPLICATE_DESCRIPTION_FROM: string;
8
+ DUPLICATE_TITLE_FROM: string;
9
+ FOUND_AT_URL: string;
10
+ FOUND_IN_CRAWL: string;
11
+ FOUND_IN_SEARCH_CONSOLE: string;
12
+ FOUND_IN_SITEMAP: string;
13
+ LEVEL: string;
14
+ PAGE_TITLE: string;
15
+ PRIMARY_PAGE: string;
16
+ PRIMARY_URL_FROM: string;
17
+ PRIMARY_URL_FROM_STATUS_CODE: string;
18
+ REDIRECTED_TO_URL: string;
19
+ REDIRECTED_TO_STATUS_CODE: string;
20
+ REDIRECTION_CHAIN: string;
21
+ SOURCE_URL: string;
22
+ STATUS_CODE: string;
23
+ TARGET_STATUS_CODE: string;
24
+ URL: string;
25
+ URL_COUNT: string;
26
+ URL_TO: string;
27
+ URL_TO_STATUS_CODE: string;
28
+ };
29
+ export default columns;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const columns = {
4
+ CUSTOM_EXTRACTION_1: 'customExtraction1',
5
+ CUSTOM_EXTRACTION_2: 'customExtraction2',
6
+ DEEP_RANK: 'deepRank',
7
+ DESCRIPTION: 'description',
8
+ DUPLICATE_PAGE: 'duplicatePage',
9
+ DUPLICATE_DESCRIPTION_FROM: 'duplicateDescriptionPrimaryUrl',
10
+ DUPLICATE_TITLE_FROM: 'duplicateTitlePrimaryUrl',
11
+ FOUND_AT_URL: 'foundAtUrl',
12
+ FOUND_IN_CRAWL: 'foundInWebCrawl',
13
+ FOUND_IN_SEARCH_CONSOLE: 'foundInGoogleSearchConsole',
14
+ FOUND_IN_SITEMAP: 'foundInSitemap',
15
+ LEVEL: 'level',
16
+ PAGE_TITLE: 'pageTitle',
17
+ PRIMARY_PAGE: 'primaryPage',
18
+ PRIMARY_URL_FROM: 'primaryUrlFrom',
19
+ PRIMARY_URL_FROM_STATUS_CODE: 'primaryUrlFromStatusCode',
20
+ REDIRECTED_TO_URL: 'redirectedToUrl',
21
+ REDIRECTED_TO_STATUS_CODE: 'redirectedToStatusCode',
22
+ REDIRECTION_CHAIN: 'redirectionChain',
23
+ SOURCE_URL: 'sourceUrl',
24
+ STATUS_CODE: 'httpStatusCode',
25
+ TARGET_STATUS_CODE: 'targetStatusCode',
26
+ URL: 'url',
27
+ URL_COUNT: 'urlCount',
28
+ URL_TO: 'urlTo',
29
+ URL_TO_STATUS_CODE: 'urlToStatusCode',
30
+ };
31
+ exports.default = columns;
@@ -0,0 +1,9 @@
1
+ type GetReportKey = {
2
+ templateCode: string;
3
+ typeCode: string;
4
+ };
5
+ /**
6
+ * Shorthand function to return the report key.
7
+ */
8
+ declare const getReportKey: ({ templateCode, typeCode }: GetReportKey) => string;
9
+ export default getReportKey;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Shorthand function to return the report key.
5
+ */
6
+ const getReportKey = ({ templateCode, typeCode }) => {
7
+ return `${templateCode}-${typeCode}`.toLowerCase();
8
+ };
9
+ exports.default = getReportKey;
@@ -0,0 +1,16 @@
1
+ declare const operands: {
2
+ CONTAINS: string;
3
+ DOESNT_CONTAIN: string;
4
+ DOESNT_MATCH_REGEX: string;
5
+ ENDS_WITH: string;
6
+ EQUALS: string;
7
+ GREATER_THAN: string;
8
+ GREATER_THAN_OR_EQUAL: string;
9
+ IS_EMPTY: string;
10
+ LESS_THAN: string;
11
+ LESS_THAN_OR_EQUAL: string;
12
+ MATCHES_REGEX: string;
13
+ NOT_EQUALS: string;
14
+ STARTS_WITH: string;
15
+ };
16
+ export default operands;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const operands = {
4
+ CONTAINS: 'contains',
5
+ DOESNT_CONTAIN: 'notContains',
6
+ DOESNT_MATCH_REGEX: 'notMatchesRegex',
7
+ ENDS_WITH: 'endsWith',
8
+ EQUALS: 'eq',
9
+ GREATER_THAN: 'gt',
10
+ GREATER_THAN_OR_EQUAL: 'ge',
11
+ IS_EMPTY: 'isEmpty',
12
+ LESS_THAN: 'lt',
13
+ LESS_THAN_OR_EQUAL: 'le',
14
+ MATCHES_REGEX: 'matchesRegex',
15
+ NOT_EQUALS: 'ne',
16
+ STARTS_WITH: 'beginsWith',
17
+ };
18
+ exports.default = operands;
@@ -0,0 +1,5 @@
1
+ export type Crawl = {
2
+ finishedAt: string;
3
+ id: number;
4
+ status: string;
5
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ type GetCrawls = {
2
+ first: number;
3
+ projectId: number;
4
+ };
5
+ /**
6
+ * For a given Project ID return all the crawls that were completed in descending order.
7
+ */
8
+ declare const getCrawls: ({ first, projectId }: GetCrawls) => {
9
+ id: string;
10
+ first: number;
11
+ projectId: number;
12
+ query: string;
13
+ variables: {
14
+ first: number;
15
+ projectId: number;
16
+ };
17
+ };
18
+ export default getCrawls;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * For a given Project ID return all the crawls that were completed in descending order.
5
+ */
6
+ const getCrawls = ({ first, projectId }) => ({
7
+ id: `get-crawls-${projectId}`.toLowerCase(),
8
+ first,
9
+ projectId,
10
+ query: `
11
+ query GetCrawls($projectId: ObjectID!, $first: Int) {
12
+ getProject(id: $projectId) {
13
+ id
14
+ rawID
15
+ crawls(
16
+ first: $first
17
+ orderBy: [{field: finishedAt, direction: DESC}]
18
+ ) {
19
+ nodes {
20
+ finishedAt
21
+ rawID
22
+ status
23
+ }
24
+ }
25
+ }
26
+ }
27
+ `,
28
+ variables: {
29
+ first,
30
+ projectId,
31
+ },
32
+ });
33
+ exports.default = getCrawls;
@@ -0,0 +1,24 @@
1
+ type GetReportDifferences = {
2
+ crawlId: number;
3
+ filter: object;
4
+ reportTemplateCode: string;
5
+ };
6
+ /**
7
+ * Used to return the number for: Basic, Added, Missing, Removed for a given report.
8
+ */
9
+ declare const getReportDifferences: ({ crawlId, filter, reportTemplateCode }: GetReportDifferences) => {
10
+ id: string;
11
+ crawlId: number;
12
+ filter: object;
13
+ query: string;
14
+ reportTemplateCode: string;
15
+ variables: {
16
+ filter: object;
17
+ input: {
18
+ crawlId: number;
19
+ reportTemplateCode: string;
20
+ reportTypeCode: string;
21
+ };
22
+ };
23
+ };
24
+ export default getReportDifferences;
@@ -0,0 +1,40 @@
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
+ const reportTypes_1 = __importDefault(require("../reportTypes"));
7
+ /**
8
+ * Used to return the number for: Basic, Added, Missing, Removed for a given report.
9
+ */
10
+ const getReportDifferences = ({ crawlId, filter, reportTemplateCode }) => ({
11
+ id: `get-report-differences-${crawlId}-${reportTemplateCode}`.toLowerCase(),
12
+ crawlId,
13
+ filter,
14
+ query: `
15
+ query GetReportDifferences($input: GetReportInputType!, $filter: JSONObject) {
16
+ getReport(input: $input) {
17
+ rawID
18
+ reportTemplateCode
19
+ reportTypeCode
20
+ totalRows
21
+ id
22
+ diffReportTotals(includeSelf: true, filter: $filter) {
23
+ totalRows
24
+ reportTypeCode
25
+ __typename
26
+ }
27
+ }
28
+ }
29
+ `,
30
+ reportTemplateCode,
31
+ variables: {
32
+ filter,
33
+ input: {
34
+ crawlId,
35
+ reportTemplateCode,
36
+ reportTypeCode: reportTypes_1.default.BASIC,
37
+ },
38
+ },
39
+ });
40
+ exports.default = getReportDifferences;
@@ -0,0 +1,38 @@
1
+ type GetRows = {
2
+ after?: string;
3
+ before?: string;
4
+ crawlId: number;
5
+ first: number;
6
+ filter: object;
7
+ last: number;
8
+ orderBy?: object;
9
+ reportTemplateCode: string;
10
+ reportTypeCode: string;
11
+ };
12
+ declare const getRows: ({ after, before, crawlId, filter, first, last, orderBy, reportTemplateCode, reportTypeCode }: GetRows) => {
13
+ id: string;
14
+ after: string;
15
+ before: string;
16
+ crawlId: number;
17
+ filter: object;
18
+ first: number;
19
+ last: number;
20
+ orderBy: object;
21
+ query: string;
22
+ reportTemplateCode: string;
23
+ reportTypeCode: string;
24
+ variables: {
25
+ after: string;
26
+ before: string;
27
+ filter: object;
28
+ first: number;
29
+ input: {
30
+ crawlId: number;
31
+ reportTemplateCode: string;
32
+ reportTypeCode: string;
33
+ };
34
+ last: number;
35
+ orderBy: object;
36
+ };
37
+ };
38
+ export default getRows;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const getRows = ({ after, before, crawlId, filter, first, last, orderBy, reportTemplateCode, reportTypeCode }) => ({
4
+ id: `get-rows-${crawlId}-${reportTemplateCode}-${reportTypeCode}`.toLowerCase(),
5
+ after,
6
+ before,
7
+ crawlId,
8
+ filter,
9
+ first,
10
+ last,
11
+ orderBy,
12
+ query: `
13
+ query GetRows($input: GetReportInputType!, $orderBy: [JSONObject!], $filter: JSONObject, $first: Int, $after: String, $last: Int, $before: String) {
14
+ getReport(input: $input) {
15
+ totalRows
16
+ rawID
17
+ reportTemplateCode
18
+ reportTypeCode
19
+ id
20
+ rowsWithAllMetrics(
21
+ filter: $filter
22
+ orderBy: $orderBy
23
+ last: $last
24
+ first: $first
25
+ before: $before
26
+ after: $after
27
+ ) {
28
+ __typename
29
+ totalCount
30
+ nodes
31
+ pageInfo {
32
+ hasNextPage
33
+ endCursor
34
+ startCursor
35
+ hasPreviousPage
36
+ }
37
+ }
38
+ }
39
+ }
40
+ `,
41
+ reportTemplateCode,
42
+ reportTypeCode,
43
+ variables: {
44
+ after,
45
+ before,
46
+ filter,
47
+ first,
48
+ input: {
49
+ crawlId,
50
+ reportTemplateCode,
51
+ reportTypeCode,
52
+ },
53
+ last,
54
+ orderBy: orderBy || null,
55
+ },
56
+ });
57
+ exports.default = getRows;
@@ -0,0 +1,25 @@
1
+ type GetTotals = {
2
+ crawlId: number;
3
+ filter: object;
4
+ filterKey?: string;
5
+ reportTemplateCode: string;
6
+ reportTypeCode: string;
7
+ };
8
+ declare const getTotals: ({ crawlId, filter, filterKey, reportTemplateCode, reportTypeCode }: GetTotals) => {
9
+ id: string;
10
+ crawlId: number;
11
+ filter: object;
12
+ filterKey: string;
13
+ query: string;
14
+ reportTemplateCode: string;
15
+ reportTypeCode: string;
16
+ variables: {
17
+ filter: object;
18
+ input: {
19
+ crawlId: number;
20
+ reportTemplateCode: string;
21
+ reportTypeCode: string;
22
+ };
23
+ };
24
+ };
25
+ export default getTotals;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const getTotals = ({ crawlId, filter, filterKey, reportTemplateCode, reportTypeCode }) => ({
4
+ id: `get-totals-${crawlId}-${reportTemplateCode}-${reportTypeCode}`.toLowerCase(),
5
+ crawlId,
6
+ filter,
7
+ filterKey,
8
+ query: `
9
+ query GetTotals($input: GetReportInputType!, $filter: JSONObject) {
10
+ getReport(input: $input) {
11
+ rawID
12
+ reportTemplateCode
13
+ reportTypeCode
14
+ totalRows
15
+ id
16
+ diffReportTotals(includeSelf: true, filter: $filter) {
17
+ totalRows
18
+ reportTypeCode
19
+ __typename
20
+ }
21
+ rows(
22
+ filter: $filter
23
+ ) {
24
+ totalCount
25
+ }
26
+ }
27
+ }
28
+ `,
29
+ reportTemplateCode,
30
+ reportTypeCode,
31
+ variables: {
32
+ filter,
33
+ input: {
34
+ crawlId,
35
+ reportTemplateCode,
36
+ reportTypeCode,
37
+ },
38
+ },
39
+ });
40
+ exports.default = getTotals;
@@ -0,0 +1,157 @@
1
+ type RedirectChain = {
2
+ "isMetaRedirect": boolean;
3
+ "redirectsTo": null | string;
4
+ "result": string;
5
+ "statusCode": string;
6
+ "url": string;
7
+ };
8
+ export type Row = {
9
+ "canonicalLinksInCount": number;
10
+ "canonicalUrlIsConsistent": boolean;
11
+ "canonicalizedPage": boolean;
12
+ "contentHtmlRatio": string;
13
+ "contentSize": number;
14
+ "crawlDatetime": string;
15
+ "css": boolean;
16
+ "customExtractionMatch": boolean;
17
+ "customExtraction1": any[];
18
+ "customExtraction2": any[];
19
+ "deeprank": number;
20
+ "description": string;
21
+ "descriptionLengthPx": number;
22
+ "descriptionLength": number;
23
+ "disallowedPage": boolean;
24
+ "duplicateBodyCount": number;
25
+ "duplicateBodyNonIndexable": boolean;
26
+ "duplicateBody": boolean;
27
+ "duplicateDescriptionCount": number;
28
+ "duplicateDescriptionNonIndexable": boolean;
29
+ "duplicateDescriptionPrimaryUrl": string;
30
+ "duplicateDescription": boolean;
31
+ "duplicatePageCount": number;
32
+ "duplicatePageNonIndexable": boolean;
33
+ "duplicatePage": boolean;
34
+ "duplicateTitleCount": number;
35
+ "duplicateTitleNonIndexable": boolean;
36
+ "duplicateTitlePrimaryUrl": string;
37
+ "duplicateTitle": boolean;
38
+ "encodingHeader": string;
39
+ "externalLinksCount": number;
40
+ "fetchTime": string;
41
+ "folderCount": number;
42
+ "followedExternalLinksOutCount": number;
43
+ "followedLinksInCount": number;
44
+ "foundAtUrl": string;
45
+ "foundInBacklinks": boolean;
46
+ "foundInGoogleAnalytics": boolean;
47
+ "foundInGoogleSearchConsole": boolean;
48
+ "foundInList": boolean;
49
+ "foundInLogSummary": boolean;
50
+ "foundInSitemap": boolean;
51
+ "foundInWebCrawl": boolean;
52
+ "h1Count": number;
53
+ "h1Length": number;
54
+ "headerContentType": string;
55
+ "headerNoarchive": boolean;
56
+ "headerNofollow": boolean;
57
+ "headerNoindex": boolean;
58
+ "headerNoodp": boolean;
59
+ "headerNosnippet": boolean;
60
+ "headerNoydir": boolean;
61
+ "hreflangLinksInCount": number;
62
+ "hreflangLinksOutCount": number;
63
+ "hreflangOnHeader": boolean;
64
+ "hreflangOnPage": boolean;
65
+ "hreflangOnSitemap": boolean;
66
+ "hreflangUrlCount": number;
67
+ "hsts": string;
68
+ "htmlSize": number;
69
+ "httpStatusCode": number;
70
+ "https": boolean;
71
+ "indexable": boolean;
72
+ "internalLinksCount": number;
73
+ "internal": boolean;
74
+ "isImage": boolean;
75
+ "isRedirectLoop": boolean;
76
+ "isRedirect": boolean;
77
+ "isSelfCanonical": boolean;
78
+ "js": boolean;
79
+ "level": number;
80
+ "linksInCount": number;
81
+ "linksOutCount": number;
82
+ "metaDisabledSitelinks": boolean;
83
+ "metaNoarchive": boolean;
84
+ "metaNofollow": boolean;
85
+ "metaNoindex": boolean;
86
+ "metaNoodp": boolean;
87
+ "metaNosnippet": boolean;
88
+ "metaNoydir": boolean;
89
+ "metaRedirect": boolean;
90
+ "mobileDesktopContentMismatch": boolean;
91
+ "mobileRelAlternateUrlIsConsistent": boolean;
92
+ "mobileRelAlternate": boolean;
93
+ "mobileRelAmphtml": boolean;
94
+ "newsarticleAuthorSchemaValue": string;
95
+ "noarchive": boolean;
96
+ "nofollowedPage": boolean;
97
+ "noindex": boolean;
98
+ "noodp": boolean;
99
+ "nosnippet": boolean;
100
+ "noydir": boolean;
101
+ "page1": boolean;
102
+ "pageTitle": string;
103
+ "pageTitleLengthPx": number;
104
+ "pageTitleLength": number;
105
+ "paginatedPage": boolean;
106
+ "productAvailabilitySchemaValue": string;
107
+ "productBrandSchemaValue": string;
108
+ "productSkuSchemaValue": string;
109
+ "primaryPage": boolean;
110
+ "primaryUrlFrom": string;
111
+ "primaryUrlFromStatusCode": string;
112
+ "paramCount": number;
113
+ "path0": string;
114
+ "path1": string;
115
+ "path2": string;
116
+ "path3": string;
117
+ "pathCount": number;
118
+ "performanceCls"?: number;
119
+ "performanceDcl"?: number;
120
+ "performanceFcp"?: number;
121
+ "performanceLcp"?: number;
122
+ "performanceTtfb"?: number;
123
+ "performanceTti"?: number;
124
+ "previousPath": string;
125
+ "previousPathDigest": string;
126
+ "rawHeader": {
127
+ [key: string]: string;
128
+ };
129
+ "redirectChain": RedirectChain[];
130
+ "redirectCount": number;
131
+ "redirectedToStatusCode": number;
132
+ "redirectedToUrlDigest": string;
133
+ "redirectedToUrl": string;
134
+ "redirectsInCount": number;
135
+ "relLinksInCount": number;
136
+ "relNextUrlIsConsistent": boolean;
137
+ "relPrevUrlIsConsistent": boolean;
138
+ "responsive": boolean;
139
+ "robotsNoindex": boolean;
140
+ "secureFormInputField": boolean;
141
+ "separateDesktop": boolean;
142
+ "separateMobile": boolean;
143
+ "sitemapsInCount": number;
144
+ "sourceUrl": string;
145
+ "urlAliasDigest": string;
146
+ "urlAlias": string;
147
+ "urlDigest": string;
148
+ "urlLength": number;
149
+ "url": string;
150
+ "urlCount": number;
151
+ "urlTo": string;
152
+ "urlToStatusCode": number;
153
+ "validTwitterCard": boolean;
154
+ "varyUserAgent": boolean;
155
+ "wordCount": number;
156
+ };
157
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,68 @@
1
+ declare const reportTemplates: {
2
+ "200_PAGES": string;
3
+ "301_REDIRECTS": string;
4
+ "4XX_ERRORS": string;
5
+ "5XX_ERRORS": string;
6
+ ALL_PAGES: string;
7
+ BROKEN_EXTERNAL_LINKS: string;
8
+ BROKEN_INTERNAL_LINKS: string;
9
+ BROKEN_SITEMAP_PAGES: string;
10
+ CANONICAL_CONFLICTING: string;
11
+ CANONICAL_NON_200: string;
12
+ CANONICAL_NON_INDEXABLE: string;
13
+ CANONICAL_ORPHANED: string;
14
+ CUSTOM_EXTRACTION_1: string;
15
+ CUSTOM_EXTRACTION_2: string;
16
+ DUPLICATE_CONTENT: string;
17
+ DUPLICATE_DESCRIPTIONS: string;
18
+ DUPLICATE_TITLES: string;
19
+ EMPTY_PAGES: string;
20
+ INDEXABLE_PAGES: string;
21
+ LINKED_DOMAINS: string;
22
+ MAX_DESCRIPTIONS: string;
23
+ MAX_MOBILE_DESCRIPTIONS: string;
24
+ MAX_TITLES: string;
25
+ MISSING_DESCRIPTIONS: string;
26
+ MISSING_TITLES: string;
27
+ NON_301_REDIRECTS: string;
28
+ NON_INDEXABLE_PAGES: string;
29
+ NON_INDEXABLE_SITEMAP_PAGES: string;
30
+ ORPHANED_CANONICAL: string;
31
+ ORPHANED_ANALYTICS_PAGES: string;
32
+ ORPHANED_SEARCH_CONSOLE_PAGES: string;
33
+ ORPHANED_SITEMAP_PAGES: string;
34
+ PAGES_WITH_HIGH_EXTERNAL_LINKS: string;
35
+ PERFORMANCE_MAX_FETCH_TIME: string;
36
+ PERFORMANCE_POOR_CLS: string;
37
+ PERFORMANCE_SLOW_DCL: string;
38
+ PERFORMANCE_SLOW_FCP: string;
39
+ PERFORMANCE_SLOW_LCP: string;
40
+ PERFORMANCE_SLOW_TTFB: string;
41
+ PERFORMANCE_SLOW_TTI: string;
42
+ PRIMARY_PAGES: string;
43
+ REDIRECTS_BROKEN: string;
44
+ REDIRECTS_CHAIN: string;
45
+ REDIRECTS_LOOP: string;
46
+ SCHEMA_BREADCRUMB: string;
47
+ SCHEMA_EVENT: string;
48
+ SCHEMA_FAQ: string;
49
+ SCHEMA_HOW_TO: string;
50
+ SCHEMA_NEWS_ARTICLE: string;
51
+ SCHEMA_PRODUCT: string;
52
+ SCHEMA_QA: string;
53
+ SCHEMA_RECIPE: string;
54
+ SCHEMA_REVIEW: string;
55
+ SCHEMA_VIDEO: string;
56
+ SHORT_DESCRIPTIONS: string;
57
+ SHORT_TITLES: string;
58
+ SITEMAP_PAGES: string;
59
+ SITEMAPS_NON_INDEXABLE_PAGES: string;
60
+ SITEMAPS_ORPHANED_PAGES: string;
61
+ SITEMAPS_MISSING_PAGES: string;
62
+ THIN_PAGES: string;
63
+ TRUE_UNIQUE_PAGES: string;
64
+ UNIQUE_EXTERNAL_LINKS: string;
65
+ UNIQUE_INTERNAL_LINKS: string;
66
+ XML_SITEMAPS: string;
67
+ };
68
+ export default reportTemplates;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const reportTemplates = {
4
+ "200_PAGES": "200_pages",
5
+ "301_REDIRECTS": "301_redirects",
6
+ "4XX_ERRORS": "4xx_errors",
7
+ "5XX_ERRORS": "5xx_errors",
8
+ ALL_PAGES: 'all_pages',
9
+ BROKEN_EXTERNAL_LINKS: 'broken_links_external',
10
+ BROKEN_INTERNAL_LINKS: 'all_broken_links',
11
+ BROKEN_SITEMAP_PAGES: 'broken_sitemap_links',
12
+ CANONICAL_CONFLICTING: 'conflicting_canonical_tags',
13
+ CANONICAL_NON_200: 'canonical_to_non_200',
14
+ CANONICAL_NON_INDEXABLE: 'non_indexable_canonical_links_in',
15
+ CANONICAL_ORPHANED: 'unlinked_canonical_pages',
16
+ CUSTOM_EXTRACTION_1: 'custom_extraction_1',
17
+ CUSTOM_EXTRACTION_2: 'custom_extraction_2',
18
+ DUPLICATE_CONTENT: 'duplicate_body_content',
19
+ DUPLICATE_DESCRIPTIONS: 'pages_with_duplicate_descriptions',
20
+ DUPLICATE_TITLES: 'pages_with_duplicate_titles',
21
+ EMPTY_PAGES: 'empty_pages',
22
+ INDEXABLE_PAGES: 'indexable_pages',
23
+ LINKED_DOMAINS: 'linked_domains',
24
+ MAX_DESCRIPTIONS: 'max_description_length',
25
+ MAX_MOBILE_DESCRIPTIONS: 'max_mobile_description_length',
26
+ MAX_TITLES: 'max_title_length',
27
+ MISSING_DESCRIPTIONS: 'missing_descriptions',
28
+ MISSING_TITLES: 'missing_titles',
29
+ NON_301_REDIRECTS: 'non_301_redirects',
30
+ NON_INDEXABLE_PAGES: 'non_indexable_pages',
31
+ NON_INDEXABLE_SITEMAP_PAGES: 'sitemaps_non_indexable_links',
32
+ ORPHANED_CANONICAL: 'unlinked_canonical_pages',
33
+ ORPHANED_ANALYTICS_PAGES: 'orphaned_organic_landing_pages',
34
+ ORPHANED_SEARCH_CONSOLE_PAGES: 'orphaned_google_search_console_pages',
35
+ ORPHANED_SITEMAP_PAGES: 'orphaned_sitemaps_pages',
36
+ PAGES_WITH_HIGH_EXTERNAL_LINKS: 'max_external_links',
37
+ PERFORMANCE_MAX_FETCH_TIME: 'max_load_time',
38
+ PERFORMANCE_POOR_CLS: 'poor_cls',
39
+ PERFORMANCE_SLOW_DCL: 'slow_dcl',
40
+ PERFORMANCE_SLOW_FCP: 'slow_fcp',
41
+ PERFORMANCE_SLOW_LCP: 'slow_lcp',
42
+ PERFORMANCE_SLOW_TTFB: 'slow_server_response',
43
+ PERFORMANCE_SLOW_TTI: 'slow_tti',
44
+ PRIMARY_PAGES: 'unique_pages',
45
+ REDIRECTS_BROKEN: 'all_broken_redirects',
46
+ REDIRECTS_CHAIN: 'redirect_chains',
47
+ REDIRECTS_LOOP: 'redirection_loop',
48
+ SCHEMA_BREADCRUMB: 'pages_with_breadcrumb_schema',
49
+ SCHEMA_EVENT: 'pages_with_event_schema',
50
+ SCHEMA_FAQ: 'pages_with_faqpage_schema',
51
+ SCHEMA_HOW_TO: 'pages_with_howto_schema',
52
+ SCHEMA_NEWS_ARTICLE: 'pages_with_news_article_schema',
53
+ SCHEMA_PRODUCT: 'pages_with_product_schema',
54
+ SCHEMA_QA: 'pages_with_qapage_schema',
55
+ SCHEMA_RECIPE: 'pages_with_recipe_schema',
56
+ SCHEMA_REVIEW: 'pages_with_review_schema',
57
+ SCHEMA_VIDEO: 'pages_with_videoobject_schema',
58
+ SHORT_DESCRIPTIONS: 'short_descriptions',
59
+ SHORT_TITLES: 'short_titles',
60
+ SITEMAP_PAGES: 'all_sitemaps_links',
61
+ SITEMAPS_NON_INDEXABLE_PAGES: 'sitemaps_non_indexable_links',
62
+ SITEMAPS_ORPHANED_PAGES: 'orphaned_sitemaps_pages',
63
+ SITEMAPS_MISSING_PAGES: 'not_in_sitemaps_primary_indexable',
64
+ THIN_PAGES: 'thin_pages',
65
+ TRUE_UNIQUE_PAGES: 'true_uniques',
66
+ UNIQUE_EXTERNAL_LINKS: 'unique_external_links',
67
+ UNIQUE_INTERNAL_LINKS: 'unique_internal_links',
68
+ XML_SITEMAPS: 'xml_sitemaps',
69
+ };
70
+ exports.default = reportTemplates;
@@ -0,0 +1,7 @@
1
+ declare const reportTypes: {
2
+ ADDED: string;
3
+ BASIC: string;
4
+ MISSING: string;
5
+ REMOVED: string;
6
+ };
7
+ export default reportTypes;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const reportTypes = {
4
+ ADDED: "Added",
5
+ BASIC: "Basic",
6
+ MISSING: "Missing",
7
+ REMOVED: "Removed",
8
+ };
9
+ exports.default = reportTypes;
@@ -5,19 +5,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  */
6
6
  const forceUpdate = async ({ key }) => {
7
7
  // Doesn't exist
8
- if (undefined === global[key] || null === global[key]) {
8
+ if (undefined === global['ems_cache'][key] || null === global['ems_cache'][key]) {
9
9
  // Throw error - should always exist
10
10
  throw `Global key '${key}' does not exist, requires initialisation.`;
11
11
  }
12
- // Reassign the global key
12
+ // Reassign the global key using the update function
13
13
  else {
14
- global[key] = {
15
- expires: global[key].expires,
14
+ global['ems_cache'][key] = {
15
+ expires: global['ems_cache'][key].expires,
16
16
  insertedAt: Date.now(),
17
- updateFn: global[key].updateFn,
18
- value: await global[key].updateFn(),
17
+ updateFn: global['ems_cache'][key].updateFn,
18
+ value: await global['ems_cache'][key].updateFn(),
19
19
  };
20
20
  }
21
- return global[key];
21
+ return global['ems_cache'][key];
22
22
  };
23
23
  exports.default = forceUpdate;
package/global/init.js CHANGED
@@ -4,12 +4,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  * Initialise a new global data.
5
5
  */
6
6
  const init = async ({ expires, key, updateFn }) => {
7
- global[key] = {
7
+ if (undefined === global['ems_cache']) {
8
+ global['ems_cache'] = {};
9
+ }
10
+ global['ems_cache'][key] = {
8
11
  expires,
9
12
  insertedAt: Date.now(),
10
13
  updateFn,
11
14
  value: await updateFn(),
12
15
  };
13
- return global[key];
16
+ return global['ems_cache'][key];
14
17
  };
15
18
  exports.default = init;
@@ -0,0 +1,8 @@
1
+ type IsSet = {
2
+ key: string;
3
+ };
4
+ /**
5
+ * Checks to see if a global key is set.
6
+ */
7
+ declare const isSet: ({ key }: IsSet) => Promise<boolean>;
8
+ export default isSet;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Checks to see if a global key is set.
5
+ */
6
+ const isSet = async ({ key }) => {
7
+ return undefined === global['ems_cache'][key];
8
+ };
9
+ exports.default = isSet;
@@ -0,0 +1,8 @@
1
+ type MaxCache = {
2
+ limit: number;
3
+ };
4
+ /**
5
+ * Clear cache more than the provided number of cache.
6
+ */
7
+ declare const maxCache: ({ limit }: MaxCache) => void;
8
+ export default maxCache;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Clear cache more than the provided number of cache.
5
+ */
6
+ const maxCache = ({ limit }) => {
7
+ if (undefined !== global['ems_cache']) {
8
+ let counter = 0;
9
+ for (let cacheKey in global['ems_cache']) {
10
+ if (counter > limit) {
11
+ delete global['ems_cache'][cacheKey];
12
+ }
13
+ counter++;
14
+ }
15
+ }
16
+ };
17
+ exports.default = maxCache;
package/global/read.js CHANGED
@@ -9,12 +9,12 @@ const forceUpdate_1 = __importDefault(require("./forceUpdate"));
9
9
  */
10
10
  const read = async ({ key }) => {
11
11
  // Doesn't exist
12
- if (undefined === global[key] || null === global[key]) {
12
+ if (undefined === global['ems_cache'][key] || null === global['ems_cache'][key]) {
13
13
  // Throw error - should always exist
14
14
  throw `Global key '${key}' does not exist, requires initialisation.`;
15
15
  }
16
16
  // Exists (0 is determined as forever)
17
- else if (0 != global[key].expires) {
17
+ else if (0 != global['ems_cache'][key].expires) {
18
18
  // https://ui.dev/get-current-timestamp-javascript
19
19
  const expiresAt = Math.floor(global[key].insertedAt / 1000) + global[key].expires;
20
20
  const now = Math.floor(Date.now() / 1000);
@@ -23,6 +23,6 @@ const read = async ({ key }) => {
23
23
  await (0, forceUpdate_1.default)({ key });
24
24
  }
25
25
  }
26
- return global[key].value;
26
+ return global['ems_cache'][key].value;
27
27
  };
28
28
  exports.default = read;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "1.2.12",
4
+ "version": "1.2.14",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"