@8ms/helpers 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. package/.github/workflows/deploy_npmjs.yml +7 -0
  2. package/.yarn/install-state.gz +0 -0
  3. package/_class/BaseClass.d.ts +18 -0
  4. package/_class/BaseClass.js +53 -0
  5. package/_class/BaseNamespace.d.ts +9 -0
  6. package/_class/BaseNamespace.js +27 -0
  7. package/_class/index.d.ts +2 -0
  8. package/_class/index.js +7 -0
  9. package/adverity/getJobs.d.ts +15 -0
  10. package/adverity/getJobs.js +30 -0
  11. package/adverity/index.d.ts +112 -0
  12. package/adverity/index.js +61 -0
  13. package/api/ApiResponseClass.d.ts +35 -0
  14. package/api/ApiResponseClass.js +97 -0
  15. package/api/index.d.ts +22 -0
  16. package/api/index.js +44 -0
  17. package/array/index.d.ts +8 -0
  18. package/array/index.js +17 -0
  19. package/atInternet/index.d.ts +16 -0
  20. package/atInternet/index.js +18 -0
  21. package/aws/athenaExpress/AwsAthenaNamespace.d.ts +8 -0
  22. package/aws/athenaExpress/AwsAthenaNamespace.js +82 -0
  23. package/aws/athenaExpress/index.d.ts +10 -0
  24. package/aws/athenaExpress/index.js +40 -0
  25. package/aws/ec2/AwsEc2Namespace.d.ts +10 -0
  26. package/aws/ec2/AwsEc2Namespace.js +78 -0
  27. package/aws/ec2/index.d.ts +3 -0
  28. package/aws/ec2/index.js +16 -0
  29. package/aws/ecs/AwsEcsNamespace.d.ts +53 -0
  30. package/aws/ecs/AwsEcsNamespace.js +159 -0
  31. package/aws/ecs/index.d.ts +3 -0
  32. package/aws/ecs/index.js +16 -0
  33. package/aws/glue/AwsGlueNamespace.d.ts +12 -0
  34. package/aws/glue/AwsGlueNamespace.js +70 -0
  35. package/aws/glue/index.d.ts +3 -0
  36. package/aws/glue/index.js +16 -0
  37. package/aws/index.d.ts +9 -0
  38. package/aws/index.js +34 -0
  39. package/aws/isResponse200.d.ts +4 -0
  40. package/aws/isResponse200.js +16 -0
  41. package/aws/lambda/AwsLambdaNamespace.d.ts +21 -0
  42. package/aws/lambda/AwsLambdaNamespace.js +110 -0
  43. package/aws/lambda/index.d.ts +4 -0
  44. package/aws/lambda/index.js +21 -0
  45. package/aws/s3/AwsS3Namespace.d.ts +60 -0
  46. package/aws/s3/AwsS3Namespace.js +401 -0
  47. package/aws/s3/index.d.ts +25 -0
  48. package/aws/s3/index.js +36 -0
  49. package/aws/s3/payload.d.ts +42 -0
  50. package/aws/s3/payload.js +46 -0
  51. package/aws/ses/AwsSesNamespace.d.ts +18 -0
  52. package/aws/ses/AwsSesNamespace.js +69 -0
  53. package/aws/ses/SimpleEmail.d.ts +56 -0
  54. package/aws/ses/SimpleEmail.js +106 -0
  55. package/aws/ses/index.d.ts +4 -0
  56. package/aws/ses/index.js +18 -0
  57. package/aws/sqs/AwsSqsNamespace.d.ts +34 -0
  58. package/aws/sqs/AwsSqsNamespace.js +96 -0
  59. package/aws/sqs/index.d.ts +3 -0
  60. package/aws/sqs/index.js +16 -0
  61. package/aws/ssm/AwsSsmNamespace.d.ts +11 -0
  62. package/aws/ssm/AwsSsmNamespace.js +89 -0
  63. package/aws/ssm/index.d.ts +3 -0
  64. package/aws/ssm/index.js +16 -0
  65. package/axios/deleteRequest.d.ts +6 -0
  66. package/axios/deleteRequest.js +33 -0
  67. package/axios/get.d.ts +5 -0
  68. package/axios/get.js +31 -0
  69. package/axios/index.d.ts +3 -0
  70. package/axios/index.js +9 -0
  71. package/axios/post.d.ts +5 -0
  72. package/axios/post.js +32 -0
  73. package/boolean/getBoolean.d.ts +4 -0
  74. package/boolean/getBoolean.js +23 -0
  75. package/boolean/index.d.ts +1 -0
  76. package/boolean/index.js +5 -0
  77. package/brightData/index.d.ts +15 -0
  78. package/brightData/index.js +20 -0
  79. package/brightData/serpApi/buildGoogleSerpUrl.d.ts +32 -0
  80. package/brightData/serpApi/buildGoogleSerpUrl.js +116 -0
  81. package/brightData/serpApi/buildGoogleTrendsUrl.d.ts +22 -0
  82. package/brightData/serpApi/buildGoogleTrendsUrl.js +61 -0
  83. package/brightData/serpApi/getAsyncRequestId.d.ts +8 -0
  84. package/brightData/serpApi/getAsyncRequestId.js +36 -0
  85. package/brightData/serpApi/getAsyncResults.d.ts +7 -0
  86. package/brightData/serpApi/getAsyncResults.js +35 -0
  87. package/brightData/serpApi/getRealtime.d.ts +5 -0
  88. package/brightData/serpApi/getRealtime.js +30 -0
  89. package/brightData/serpApi/index.d.ts +14 -0
  90. package/brightData/serpApi/index.js +23 -0
  91. package/brightData/webScraperIde/getBatch.d.ts +7 -0
  92. package/brightData/webScraperIde/getBatch.js +28 -0
  93. package/brightData/webScraperIde/getRealtime.d.ts +7 -0
  94. package/brightData/webScraperIde/getRealtime.js +49 -0
  95. package/brightData/webScraperIde/index.d.ts +2 -0
  96. package/brightData/webScraperIde/index.js +7 -0
  97. package/cache/index.d.ts +2 -0
  98. package/cache/index.js +48 -0
  99. package/cache/test/cache.test.d.ts +1 -0
  100. package/cache/test/cache.test.js +10 -0
  101. package/crud/index.d.ts +6 -0
  102. package/crud/index.js +10 -0
  103. package/crypto/getDecrypt.d.ts +5 -0
  104. package/crypto/getDecrypt.js +47 -0
  105. package/crypto/getEncrypt.d.ts +5 -0
  106. package/crypto/getEncrypt.js +47 -0
  107. package/crypto/getRandom.d.ts +4 -0
  108. package/crypto/getRandom.js +12 -0
  109. package/crypto/getSha256.d.ts +5 -0
  110. package/crypto/getSha256.js +48 -0
  111. package/crypto/index.d.ts +4 -0
  112. package/crypto/index.js +11 -0
  113. package/date/calculation.d.ts +75 -0
  114. package/date/calculation.js +207 -0
  115. package/date/financialYear.d.ts +19 -0
  116. package/date/financialYear.js +85 -0
  117. package/date/format.d.ts +68 -0
  118. package/date/format.js +150 -0
  119. package/date/index.d.ts +35 -0
  120. package/date/index.js +57 -0
  121. package/environment/index.d.ts +32 -0
  122. package/environment/index.js +92 -0
  123. package/eskimi/getAgeGroup.d.ts +4 -0
  124. package/eskimi/getAgeGroup.js +15 -0
  125. package/eskimi/getData.d.ts +4 -0
  126. package/eskimi/getData.js +17 -0
  127. package/eskimi/getDevice.d.ts +4 -0
  128. package/eskimi/getDevice.js +15 -0
  129. package/eskimi/getGender.d.ts +4 -0
  130. package/eskimi/getGender.js +15 -0
  131. package/eskimi/index.d.ts +49 -0
  132. package/eskimi/index.js +96 -0
  133. package/file/createDirectory.d.ts +5 -0
  134. package/file/createDirectory.js +50 -0
  135. package/file/index.d.ts +1 -0
  136. package/file/index.js +5 -0
  137. package/geo/countries.d.ts +12 -0
  138. package/geo/countries.js +222 -0
  139. package/geo/index.d.ts +2 -0
  140. package/geo/index.js +7 -0
  141. package/geo/languages.d.ts +9 -0
  142. package/geo/languages.js +58 -0
  143. package/google/bigQuery/GoogleBigQueryNamespace.d.ts +51 -0
  144. package/google/bigQuery/GoogleBigQueryNamespace.js +165 -0
  145. package/google/bigQuery/index.d.ts +5 -0
  146. package/google/bigQuery/index.js +37 -0
  147. package/google/bigQuery/loadData.d.ts +19 -0
  148. package/google/bigQuery/loadData.js +18 -0
  149. package/google/index.d.ts +27 -0
  150. package/google/index.js +24 -0
  151. package/google/sheets/GoogleSheetsNamespace.d.ts +16 -0
  152. package/google/sheets/GoogleSheetsNamespace.js +81 -0
  153. package/google/sheets/getAssociatedData.d.ts +10 -0
  154. package/google/sheets/getAssociatedData.js +43 -0
  155. package/google/sheets/index.d.ts +8 -0
  156. package/google/sheets/index.js +37 -0
  157. package/google/storage/GoogleCloudStorageNamespace.d.ts +20 -0
  158. package/google/storage/GoogleCloudStorageNamespace.js +108 -0
  159. package/google/storage/index.d.ts +3 -0
  160. package/google/storage/index.js +30 -0
  161. package/googleAds/GoogleAdsNamespace.d.ts +11 -0
  162. package/googleAds/GoogleAdsNamespace.js +73 -0
  163. package/googleAds/index.d.ts +11 -0
  164. package/googleAds/index.js +30 -0
  165. package/googleAds/keywordPlanner/index.d.ts +40 -0
  166. package/googleAds/keywordPlanner/index.js +59 -0
  167. package/googlePageSpeed/GooglePageSpeedNamespace.d.ts +11 -0
  168. package/googlePageSpeed/GooglePageSpeedNamespace.js +35 -0
  169. package/googlePageSpeed/index.d.ts +17 -0
  170. package/googlePageSpeed/index.js +44 -0
  171. package/googleSearchIncidents/index.d.ts +69 -0
  172. package/googleSearchIncidents/index.js +46 -0
  173. package/greenDomain/index.d.ts +21 -0
  174. package/greenDomain/index.js +41 -0
  175. package/inngest/index.d.ts +6 -0
  176. package/inngest/index.js +10 -0
  177. package/json/getJsonNewline.d.ts +1 -0
  178. package/json/getJsonNewline.js +13 -0
  179. package/json/index.d.ts +2 -0
  180. package/json/index.js +7 -0
  181. package/json/isJson.d.ts +1 -0
  182. package/json/isJson.js +26 -0
  183. package/littleWarden/LittleWardenNamespace.d.ts +11 -0
  184. package/littleWarden/LittleWardenNamespace.js +38 -0
  185. package/littleWarden/getUrlStatus.d.ts +4 -0
  186. package/littleWarden/getUrlStatus.js +16 -0
  187. package/littleWarden/index.d.ts +29 -0
  188. package/littleWarden/index.js +74 -0
  189. package/lumar/api/buildRequest.d.ts +13 -0
  190. package/lumar/api/buildRequest.js +80 -0
  191. package/lumar/api/getData.d.ts +5 -0
  192. package/lumar/api/getData.js +13 -0
  193. package/lumar/api/index.d.ts +36 -0
  194. package/lumar/api/index.js +33 -0
  195. package/lumar/api/initClient.d.ts +6 -0
  196. package/lumar/api/initClient.js +26 -0
  197. package/lumar/graphql/columns.d.ts +28 -0
  198. package/lumar/graphql/columns.js +31 -0
  199. package/lumar/graphql/getData.d.ts +1 -0
  200. package/lumar/graphql/getData.js +20 -0
  201. package/lumar/graphql/index.d.ts +29 -0
  202. package/lumar/graphql/index.js +39 -0
  203. package/lumar/graphql/initClient.d.ts +5 -0
  204. package/lumar/graphql/initClient.js +25 -0
  205. package/lumar/graphql/queries/crawl.d.ts +5 -0
  206. package/lumar/graphql/queries/crawl.js +2 -0
  207. package/lumar/graphql/queries/getCrawls.d.ts +18 -0
  208. package/lumar/graphql/queries/getCrawls.js +33 -0
  209. package/lumar/graphql/queries/getReportDifferences.d.ts +24 -0
  210. package/lumar/graphql/queries/getReportDifferences.js +37 -0
  211. package/lumar/graphql/queries/getRows.d.ts +38 -0
  212. package/lumar/graphql/queries/getRows.js +57 -0
  213. package/lumar/graphql/queries/getTotals.d.ts +25 -0
  214. package/lumar/graphql/queries/getTotals.js +40 -0
  215. package/lumar/graphql/queries/row.d.ts +157 -0
  216. package/lumar/graphql/queries/row.js +2 -0
  217. package/lumar/graphql/reportTemplates.d.ts +67 -0
  218. package/lumar/graphql/reportTemplates.js +70 -0
  219. package/myTarget/request.d.ts +5 -0
  220. package/myTarget/request.js +17 -0
  221. package/nextAuth/index.d.ts +6 -0
  222. package/nextAuth/index.js +11 -0
  223. package/nextAuth/isSessionReady.d.ts +1 -0
  224. package/nextAuth/isSessionReady.js +13 -0
  225. package/nextJs/getIp.d.ts +6 -0
  226. package/nextJs/getIp.js +14 -0
  227. package/nextJs/getUserAgent.d.ts +6 -0
  228. package/nextJs/getUserAgent.js +8 -0
  229. package/nextJs/index.d.ts +2 -0
  230. package/nextJs/index.js +7 -0
  231. package/number/format.d.ts +12 -0
  232. package/number/format.js +20 -0
  233. package/number/formatCurrency.d.ts +5 -0
  234. package/number/formatCurrency.js +21 -0
  235. package/number/getDecimal.d.ts +4 -0
  236. package/number/getDecimal.js +12 -0
  237. package/number/getNumber.d.ts +4 -0
  238. package/number/getNumber.js +48 -0
  239. package/number/getPercentIncrease.d.ts +4 -0
  240. package/number/getPercentIncrease.js +16 -0
  241. package/number/getSafeDivide.d.ts +11 -0
  242. package/number/getSafeDivide.js +20 -0
  243. package/number/index.d.ts +6 -0
  244. package/number/index.js +15 -0
  245. package/object/index.d.ts +1 -0
  246. package/object/index.js +5 -0
  247. package/object/replaceKeys.d.ts +5 -0
  248. package/object/replaceKeys.js +25 -0
  249. package/onePassword/OnePasswordNamespace.d.ts +13 -0
  250. package/onePassword/OnePasswordNamespace.js +81 -0
  251. package/onePassword/index.d.ts +7 -0
  252. package/onePassword/index.js +25 -0
  253. package/openAi/OpenAiNamespace.d.ts +11 -0
  254. package/openAi/OpenAiNamespace.js +44 -0
  255. package/openAi/index.d.ts +5 -0
  256. package/openAi/index.js +30 -0
  257. package/package.json +2 -2
  258. package/prisma/PrismaNamespace.d.ts +8 -0
  259. package/prisma/PrismaNamespace.js +79 -0
  260. package/prisma/getDecimal.d.ts +4 -0
  261. package/prisma/getDecimal.js +23 -0
  262. package/prisma/index.d.ts +8 -0
  263. package/prisma/index.js +29 -0
  264. package/snapchat/SnapchatNamespace.d.ts +15 -0
  265. package/snapchat/SnapchatNamespace.js +30 -0
  266. package/snapchat/index.d.ts +7 -0
  267. package/snapchat/index.js +30 -0
  268. package/sorting/byNumberAscending.d.ts +4 -0
  269. package/sorting/byNumberAscending.js +19 -0
  270. package/sorting/byNumberDescending.d.ts +4 -0
  271. package/sorting/byNumberDescending.js +22 -0
  272. package/sorting/byStringAscending.d.ts +4 -0
  273. package/sorting/byStringAscending.js +16 -0
  274. package/sorting/byStringDescending.d.ts +4 -0
  275. package/sorting/byStringDescending.js +16 -0
  276. package/sorting/index.d.ts +4 -0
  277. package/sorting/index.js +11 -0
  278. package/stream/index.d.ts +1 -0
  279. package/stream/index.js +5 -0
  280. package/stream/sort.d.ts +13 -0
  281. package/stream/sort.js +51 -0
  282. package/string/getCapitalised.d.ts +5 -0
  283. package/string/getCapitalised.js +18 -0
  284. package/string/getClean.d.ts +18 -0
  285. package/string/getClean.js +51 -0
  286. package/string/getFolder.d.ts +4 -0
  287. package/string/getFolder.js +15 -0
  288. package/string/getProperCase.d.ts +11 -0
  289. package/string/getProperCase.js +25 -0
  290. package/string/getString.d.ts +4 -0
  291. package/string/getString.js +34 -0
  292. package/string/getStringFromStream.d.ts +5 -0
  293. package/string/getStringFromStream.js +17 -0
  294. package/string/getUnescaped.d.ts +6 -0
  295. package/string/getUnescaped.js +26 -0
  296. package/string/getWithoutAccents.d.ts +5 -0
  297. package/string/getWithoutAccents.js +13 -0
  298. package/string/getWithoutHtmlTags.d.ts +5 -0
  299. package/string/getWithoutHtmlTags.js +12 -0
  300. package/string/getWithoutPunctuation.d.ts +5 -0
  301. package/string/getWithoutPunctuation.js +13 -0
  302. package/string/getWithoutUnderscores.d.ts +4 -0
  303. package/string/getWithoutUnderscores.js +11 -0
  304. package/string/getWithoutWhitespaces.d.ts +5 -0
  305. package/string/getWithoutWhitespaces.js +13 -0
  306. package/string/index.d.ts +12 -0
  307. package/string/index.js +27 -0
  308. package/swr/index.d.ts +42 -0
  309. package/swr/index.js +59 -0
  310. package/upTimeRobot/UpTimeRobotNamespace.d.ts +31 -0
  311. package/upTimeRobot/UpTimeRobotNamespace.js +52 -0
  312. package/upTimeRobot/index.d.ts +38 -0
  313. package/upTimeRobot/index.js +63 -0
  314. package/url/index.d.ts +30 -0
  315. package/url/index.js +72 -0
  316. package/url/writeUrlContents.d.ts +6 -0
  317. package/url/writeUrlContents.js +75 -0
  318. package/util/defaultTo.d.ts +4 -0
  319. package/util/defaultTo.js +44 -0
  320. package/util/getBrotliCompressed.d.ts +5 -0
  321. package/util/getBrotliCompressed.js +23 -0
  322. package/util/getBrotliDecompressed.d.ts +5 -0
  323. package/util/getBrotliDecompressed.js +24 -0
  324. package/util/getClean.d.ts +11 -0
  325. package/util/getClean.js +23 -0
  326. package/util/getGzipCompressed.d.ts +5 -0
  327. package/util/getGzipCompressed.js +23 -0
  328. package/util/getGzipDecompressed.d.ts +5 -0
  329. package/util/getGzipDecompressed.js +24 -0
  330. package/util/getWithoutHash.d.ts +4 -0
  331. package/util/getWithoutHash.js +18 -0
  332. package/util/getWithoutParameter.d.ts +4 -0
  333. package/util/getWithoutParameter.js +18 -0
  334. package/util/index.d.ts +11 -0
  335. package/util/index.js +25 -0
  336. package/util/isUndefined.d.ts +4 -0
  337. package/util/isUndefined.js +13 -0
  338. package/util/promiseChunks.d.ts +5 -0
  339. package/util/promiseChunks.js +19 -0
  340. package/util/sleep.d.ts +1 -0
  341. package/util/sleep.js +7 -0
  342. package/webWorker/index.d.ts +5 -0
  343. package/webWorker/index.js +9 -0
  344. package/xml/getXml.d.ts +1 -0
  345. package/xml/getXml.js +18 -0
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUrlStatus = void 0;
4
+ const axios_1 = require("../axios");
5
+ /**
6
+ * Get the URL Status for a given URL ID from Little Warden.
7
+ */
8
+ const getUrlStatus = async (apiKey, urlId) => {
9
+ const response = await (0, axios_1.get)(`https://littlewarden.com/api/sites/${urlId}`, {
10
+ headers: {
11
+ "Authorization": `Token token="${apiKey}"`,
12
+ },
13
+ });
14
+ return response.getBodyDefaultTo(["data", "site"], {});
15
+ };
16
+ exports.getUrlStatus = getUrlStatus;
@@ -0,0 +1,29 @@
1
+ import { LittleWardenNamespace } from "./LittleWardenNamespace";
2
+ export type LittleWardenConfig = {
3
+ apiKey: string;
4
+ };
5
+ export declare const littleWardenClient: (key?: string, config?: LittleWardenConfig, vaultId?: string, itemId?: string) => Promise<LittleWardenNamespace>;
6
+ export declare enum LittleWardenState {
7
+ ALL_GOOD = "all_good",
8
+ DANGER = "danger",
9
+ WARNING = "warning"
10
+ }
11
+ /**
12
+ * Check if the field is All Good.
13
+ */
14
+ export declare const isAllGood: ({ field }: {
15
+ field: any;
16
+ }) => boolean;
17
+ /**
18
+ * Check if the field is Warning.
19
+ */
20
+ export declare const isWarning: ({ field }: {
21
+ field: any;
22
+ }) => boolean;
23
+ /**
24
+ * Check if the field is Danger.
25
+ */
26
+ export declare const isDanger: ({ field }: {
27
+ field: any;
28
+ }) => boolean;
29
+ export { getUrlStatus } from "./getUrlStatus";
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getUrlStatus = exports.isDanger = exports.isWarning = exports.isAllGood = exports.LittleWardenState = exports.littleWardenClient = void 0;
4
+ const LittleWardenNamespace_1 = require("./LittleWardenNamespace");
5
+ const onePassword_1 = require("../onePassword");
6
+ const littleWardenNamespaces = new Map();
7
+ const littleWardenClient = async (key = "default", config, vaultId, itemId) => {
8
+ if (littleWardenNamespaces.has(key)) {
9
+ return littleWardenNamespaces.get(key);
10
+ }
11
+ let instanceConfig;
12
+ if (config) {
13
+ instanceConfig = config;
14
+ }
15
+ else if (vaultId && itemId) {
16
+ instanceConfig = await (await (0, onePassword_1.onePasswordClient)())
17
+ .getJsonNote(vaultId, itemId);
18
+ }
19
+ else if ("default" === key && process.env.LITTLE_WARDEN_VAULT_ID && process.env.LITTLE_WARDEN_ITEM_ID) {
20
+ instanceConfig = await (await (0, onePassword_1.onePasswordClient)())
21
+ .getJsonNote(process.env.LITTLE_WARDEN_VAULT_ID, process.env.LITTLE_WARDEN_ITEM_ID);
22
+ }
23
+ else {
24
+ throw new Error(`Config required for namespace '${key}'`);
25
+ }
26
+ const namespace = new LittleWardenNamespace_1.LittleWardenNamespace(key, instanceConfig);
27
+ littleWardenNamespaces.set(key, namespace);
28
+ return namespace;
29
+ };
30
+ exports.littleWardenClient = littleWardenClient;
31
+ var LittleWardenState;
32
+ (function (LittleWardenState) {
33
+ LittleWardenState["ALL_GOOD"] = "all_good";
34
+ LittleWardenState["DANGER"] = "danger";
35
+ LittleWardenState["WARNING"] = "warning";
36
+ })(LittleWardenState || (exports.LittleWardenState = LittleWardenState = {}));
37
+ /**
38
+ * Check if the field is All Good.
39
+ */
40
+ const isAllGood = ({ field }) => {
41
+ let response = false;
42
+ // Check that the status field exists
43
+ if (undefined !== field && undefined !== field["status"]) {
44
+ response = LittleWardenState.ALL_GOOD === field["status"];
45
+ }
46
+ return response;
47
+ };
48
+ exports.isAllGood = isAllGood;
49
+ /**
50
+ * Check if the field is Warning.
51
+ */
52
+ const isWarning = ({ field }) => {
53
+ let response = false;
54
+ // Check that the status field exists
55
+ if (undefined !== field && undefined !== field["status"]) {
56
+ response = LittleWardenState.WARNING === field["status"];
57
+ }
58
+ return response;
59
+ };
60
+ exports.isWarning = isWarning;
61
+ /**
62
+ * Check if the field is Danger.
63
+ */
64
+ const isDanger = ({ field }) => {
65
+ let response = false;
66
+ // Check that the status field exists
67
+ if (undefined !== field && undefined !== field["status"]) {
68
+ response = LittleWardenState.DANGER === field["status"];
69
+ }
70
+ return response;
71
+ };
72
+ exports.isDanger = isDanger;
73
+ var getUrlStatus_1 = require("./getUrlStatus");
74
+ Object.defineProperty(exports, "getUrlStatus", { enumerable: true, get: function () { return getUrlStatus_1.getUrlStatus; } });
@@ -0,0 +1,13 @@
1
+ import { Filter, Order } from "./";
2
+ export type BuildRequestProps = {
3
+ crawlId?: number;
4
+ customPath?: string;
5
+ filters?: Filter[];
6
+ limit?: number;
7
+ orders?: Order[];
8
+ page?: number;
9
+ projectId?: number;
10
+ report?: string;
11
+ subReport?: string;
12
+ };
13
+ export declare const buildRequest: (props: BuildRequestProps) => string;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildRequest = void 0;
4
+ const _1 = require("./");
5
+ const buildRequest = (props) => {
6
+ let url = `https://api.deepcrawl.com/accounts/37204`;
7
+ // Limit must be greater than 0 but also less than 200
8
+ if (undefined !== props.limit) {
9
+ if (props.limit > 200) {
10
+ throw `Maximum row limit is 200.`;
11
+ }
12
+ else if (0 === props.limit) {
13
+ throw `Row limit must be greater than 0.`;
14
+ }
15
+ }
16
+ // Set limit to 200 by default
17
+ else {
18
+ props.limit = 200;
19
+ }
20
+ // If a report other than List Crawls is selected, Crawl ID must be defined
21
+ if (undefined !== props.report && _1.reports.LIST_CRAWLS !== props.report && undefined == props.crawlId) {
22
+ throw `Crawl ID must be defined.`;
23
+ }
24
+ switch (props.report) {
25
+ case _1.reports.LIST_CRAWLS:
26
+ url += `/projects/${props.projectId}/crawls`;
27
+ break;
28
+ case _1.reports.LIST_PROJECTS:
29
+ url += `/projects`;
30
+ break;
31
+ case _1.reports.CUSTOM:
32
+ url += props.customPath;
33
+ url = url.replace("[PROJECT]", props.projectId.toString());
34
+ url = url.replace("[CRAWL]", props.crawlId.toString());
35
+ break;
36
+ case _1.reports.CRAWL_STATISTICS:
37
+ url += `/projects/${props.projectId}/crawls/${props.crawlId}/statistics`;
38
+ break;
39
+ case _1.reports.LIST_REPORTS:
40
+ url += `/projects/${props.projectId}/crawls/${props.crawlId}/reports`;
41
+ break;
42
+ case _1.reports.REPORT_ROWS:
43
+ case _1.reports.REPORT_STATISTICS:
44
+ case _1.reports.REPORT_SUMMARY:
45
+ url += `/projects/${props.projectId}/crawls/${props.crawlId}/reports/${props.subReport}`;
46
+ if (_1.reports.REPORT_ROWS === props.report) {
47
+ url += `/report_rows`;
48
+ }
49
+ else if (_1.reports.REPORT_STATISTICS === props.report) {
50
+ url += `/statistics`;
51
+ }
52
+ break;
53
+ }
54
+ // Specify the limit
55
+ url += -1 === url.indexOf("?") ? "?" : "&";
56
+ url += `per_page=${props.limit}`;
57
+ // Set the page number
58
+ if (undefined !== props.page) {
59
+ url += -1 === url.indexOf("?") ? "?" : "&";
60
+ url += `page=${props.page}`;
61
+ }
62
+ // Apply any filters
63
+ if (undefined !== props.filters) {
64
+ props.filters.map(filter => {
65
+ url += -1 === url.indexOf("?") ? "?" : "&";
66
+ url += `q[${filter.field}_${filter.operand}]=${filter.value}`;
67
+ });
68
+ }
69
+ // Order the data
70
+ if (undefined !== props.orders) {
71
+ url += -1 === url.indexOf("?") ? "?" : "&";
72
+ props.orders.map((order, index) => {
73
+ url += 0 === index ? "sort=" : ",";
74
+ url += _1.orders.DESCENDING === order.direction ? "-" : "";
75
+ url += order.field;
76
+ });
77
+ }
78
+ return url;
79
+ };
80
+ exports.buildRequest = buildRequest;
@@ -0,0 +1,5 @@
1
+ type GetData = {
2
+ url: string;
3
+ };
4
+ export declare const getData: ({ url }: GetData) => Promise<import("../../api").ApiResponseClass<any, any>>;
5
+ export {};
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getData = void 0;
4
+ const axios_1 = require("../../axios");
5
+ const getData = async ({ url }) => {
6
+ const apiResponse = await (0, axios_1.get)(url, {
7
+ headers: {
8
+ "X-AUTH-TOKEN": global.deepcrawlApi.token,
9
+ },
10
+ });
11
+ return apiResponse;
12
+ };
13
+ exports.getData = getData;
@@ -0,0 +1,36 @@
1
+ export type Filter = {
2
+ field: string;
3
+ operand: string;
4
+ value: string;
5
+ };
6
+ export declare const operands: {
7
+ EQUALS: string;
8
+ CONTAINS: string;
9
+ LESS_THAN: string;
10
+ LESS_THAN_OR_EQUAL: string;
11
+ GREATER_THAN: string;
12
+ GREATER_THAN_OR_EQUAL: string;
13
+ REGEX: string;
14
+ NOT_REGEX: string;
15
+ };
16
+ export type Order = {
17
+ direction: string;
18
+ field: string;
19
+ };
20
+ export declare const orders: {
21
+ ASCENDING: string;
22
+ DESCENDING: string;
23
+ };
24
+ export declare const reports: {
25
+ CRAWL_STATISTICS: string;
26
+ CUSTOM: string;
27
+ LIST_PROJECTS: string;
28
+ LIST_CRAWLS: string;
29
+ LIST_REPORTS: string;
30
+ REPORT_ROWS: string;
31
+ REPORT_STATISTICS: string;
32
+ REPORT_SUMMARY: string;
33
+ };
34
+ export { buildRequest } from "./buildRequest";
35
+ export { getData } from "./getData";
36
+ export { initClient } from "./initClient";
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initClient = exports.getData = exports.buildRequest = exports.reports = exports.orders = exports.operands = void 0;
4
+ exports.operands = {
5
+ EQUALS: 'eql',
6
+ CONTAINS: 'cont',
7
+ LESS_THAN: 'lt',
8
+ LESS_THAN_OR_EQUAL: 'lte',
9
+ GREATER_THAN: 'gt',
10
+ GREATER_THAN_OR_EQUAL: 'gte',
11
+ REGEX: 'rgx',
12
+ NOT_REGEX: 'nrgx',
13
+ };
14
+ exports.orders = {
15
+ ASCENDING: 'asc',
16
+ DESCENDING: 'desc',
17
+ };
18
+ exports.reports = {
19
+ CRAWL_STATISTICS: 'crawl_statistics',
20
+ CUSTOM: 'custom',
21
+ LIST_PROJECTS: 'list_projects',
22
+ LIST_CRAWLS: 'list_crawls',
23
+ LIST_REPORTS: 'list_reports',
24
+ REPORT_ROWS: 'report_rows',
25
+ REPORT_STATISTICS: 'report_statistics',
26
+ REPORT_SUMMARY: 'report_summary',
27
+ };
28
+ var buildRequest_1 = require("./buildRequest");
29
+ Object.defineProperty(exports, "buildRequest", { enumerable: true, get: function () { return buildRequest_1.buildRequest; } });
30
+ var getData_1 = require("./getData");
31
+ Object.defineProperty(exports, "getData", { enumerable: true, get: function () { return getData_1.getData; } });
32
+ var initClient_1 = require("./initClient");
33
+ Object.defineProperty(exports, "initClient", { enumerable: true, get: function () { return initClient_1.initClient; } });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * http://api-docs.deepcrawl.com/
3
+ * Renew the Lumar user token.
4
+ * Token lasts for 6 hours.
5
+ */
6
+ export declare const initClient: (apiId: string, apiKey: string) => Promise<any>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initClient = void 0;
4
+ const axios_1 = require("../../axios");
5
+ const lumarApis = new Map();
6
+ /**
7
+ * http://api-docs.deepcrawl.com/
8
+ * Renew the Lumar user token.
9
+ * Token lasts for 6 hours.
10
+ */
11
+ const initClient = async (apiId, apiKey) => {
12
+ if (lumarApis.has(apiId)) {
13
+ return lumarApis.get(apiId);
14
+ }
15
+ const apiResponse = await (0, axios_1.post)(`https://api.deepcrawl.com/sessions`, {
16
+ auth: {
17
+ username: apiId,
18
+ password: apiKey,
19
+ },
20
+ });
21
+ // Ensure the value exists
22
+ const token = apiResponse.getBodyDefaultTo(["token"], null);
23
+ lumarApis.set(apiId, token);
24
+ return token;
25
+ };
26
+ exports.initClient = initClient;
@@ -0,0 +1,28 @@
1
+ export 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
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.columns = void 0;
4
+ exports.columns = {
5
+ CUSTOM_EXTRACTION_1: 'customExtraction1',
6
+ CUSTOM_EXTRACTION_2: 'customExtraction2',
7
+ DEEP_RANK: 'deepRank',
8
+ DESCRIPTION: 'description',
9
+ DUPLICATE_PAGE: 'duplicatePage',
10
+ DUPLICATE_DESCRIPTION_FROM: 'duplicateDescriptionPrimaryUrl',
11
+ DUPLICATE_TITLE_FROM: 'duplicateTitlePrimaryUrl',
12
+ FOUND_AT_URL: 'foundAtUrl',
13
+ FOUND_IN_CRAWL: 'foundInWebCrawl',
14
+ FOUND_IN_SEARCH_CONSOLE: 'foundInGoogleSearchConsole',
15
+ FOUND_IN_SITEMAP: 'foundInSitemap',
16
+ LEVEL: 'level',
17
+ PAGE_TITLE: 'pageTitle',
18
+ PRIMARY_PAGE: 'primaryPage',
19
+ PRIMARY_URL_FROM: 'primaryUrlFrom',
20
+ PRIMARY_URL_FROM_STATUS_CODE: 'primaryUrlFromStatusCode',
21
+ REDIRECTED_TO_URL: 'redirectedToUrl',
22
+ REDIRECTED_TO_STATUS_CODE: 'redirectedToStatusCode',
23
+ REDIRECTION_CHAIN: 'redirectionChain',
24
+ SOURCE_URL: 'sourceUrl',
25
+ STATUS_CODE: 'httpStatusCode',
26
+ TARGET_STATUS_CODE: 'targetStatusCode',
27
+ URL: 'url',
28
+ URL_COUNT: 'urlCount',
29
+ URL_TO: 'urlTo',
30
+ URL_TO_STATUS_CODE: 'urlToStatusCode',
31
+ };
@@ -0,0 +1 @@
1
+ export declare const getData: (query: string, variables?: {}) => Promise<import("../../api").ApiResponseClass<any, any>>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getData = void 0;
4
+ const axios_1 = require("../../axios");
5
+ const getData = async (query, variables = {}) => {
6
+ let queryClean = query.trim();
7
+ queryClean = queryClean.replace(/\n/g, " ");
8
+ queryClean = queryClean.replace(/\t/g, " ");
9
+ queryClean = queryClean.replace(/ /g, " ");
10
+ const apiResponse = await (0, axios_1.post)("https://api.lumar.io/graphql", {
11
+ query: queryClean,
12
+ variables,
13
+ }, {
14
+ headers: {
15
+ "x-auth-token": global.lumarGraphql.token,
16
+ },
17
+ });
18
+ return apiResponse;
19
+ };
20
+ exports.getData = getData;
@@ -0,0 +1,29 @@
1
+ export 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 declare const reportTypes: {
17
+ ADDED: string;
18
+ BASIC: string;
19
+ MISSING: string;
20
+ REMOVED: string;
21
+ };
22
+ /**
23
+ * Shorthand function to return the report key.
24
+ */
25
+ export declare const getReportKey: (templateCode: string, typeCode: string) => string;
26
+ export { columns } from "./columns";
27
+ export { reportTemplates } from "./reportTemplates";
28
+ export { getData } from "./getData";
29
+ export { initClient } from "./initClient";
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initClient = exports.getData = exports.reportTemplates = exports.columns = exports.getReportKey = exports.reportTypes = exports.operands = void 0;
4
+ exports.operands = {
5
+ CONTAINS: "contains",
6
+ DOESNT_CONTAIN: "notContains",
7
+ DOESNT_MATCH_REGEX: "notMatchesRegex",
8
+ ENDS_WITH: "endsWith",
9
+ EQUALS: "eq",
10
+ GREATER_THAN: "gt",
11
+ GREATER_THAN_OR_EQUAL: "ge",
12
+ IS_EMPTY: "isEmpty",
13
+ LESS_THAN: "lt",
14
+ LESS_THAN_OR_EQUAL: "le",
15
+ MATCHES_REGEX: "matchesRegex",
16
+ NOT_EQUALS: "ne",
17
+ STARTS_WITH: "beginsWith",
18
+ };
19
+ exports.reportTypes = {
20
+ ADDED: "Added",
21
+ BASIC: "Basic",
22
+ MISSING: "Missing",
23
+ REMOVED: "Removed",
24
+ };
25
+ /**
26
+ * Shorthand function to return the report key.
27
+ */
28
+ const getReportKey = (templateCode, typeCode) => {
29
+ return `${templateCode}-${typeCode}`.toLowerCase();
30
+ };
31
+ exports.getReportKey = getReportKey;
32
+ var columns_1 = require("./columns");
33
+ Object.defineProperty(exports, "columns", { enumerable: true, get: function () { return columns_1.columns; } });
34
+ var reportTemplates_1 = require("./reportTemplates");
35
+ Object.defineProperty(exports, "reportTemplates", { enumerable: true, get: function () { return reportTemplates_1.reportTemplates; } });
36
+ var getData_1 = require("./getData");
37
+ Object.defineProperty(exports, "getData", { enumerable: true, get: function () { return getData_1.getData; } });
38
+ var initClient_1 = require("./initClient");
39
+ Object.defineProperty(exports, "initClient", { enumerable: true, get: function () { return initClient_1.initClient; } });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * https://api-docs.lumar.io/graphql/explorer/
3
+ * Renew the Lumar user token.
4
+ */
5
+ export declare const initClient: (id: string, secret: string) => Promise<any>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initClient = void 0;
4
+ const axios_1 = require("../../axios");
5
+ const lumarGraphQls = new Map();
6
+ /**
7
+ * https://api-docs.lumar.io/graphql/explorer/
8
+ * Renew the Lumar user token.
9
+ */
10
+ const initClient = async (id, secret) => {
11
+ if (lumarGraphQls.has(id)) {
12
+ return lumarGraphQls.get(id);
13
+ }
14
+ const apiResponse = await (0, axios_1.post)(`https://api.lumar.io/graphql`, {
15
+ query: "mutation LoginWithUserKey($secret: String!, $userKeyId: ObjectID!) { createSessionUsingUserKey(input: {userKeyId: $userKeyId, secret: $secret}) { token }}",
16
+ variables: {
17
+ userKeyId: id,
18
+ secret: secret,
19
+ },
20
+ });
21
+ const token = apiResponse.getBodyDefaultTo(["data", "createSessionUsingUserKey", "token"], null);
22
+ lumarGraphQls.set(id, token);
23
+ return token;
24
+ };
25
+ exports.initClient = initClient;
@@ -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,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const __1 = require("../");
4
+ /**
5
+ * Used to return the number for: Basic, Added, Missing, Removed for a given report.
6
+ */
7
+ const getReportDifferences = ({ crawlId, filter, reportTemplateCode }) => ({
8
+ id: `get-report-differences-${crawlId}-${reportTemplateCode}`.toLowerCase(),
9
+ crawlId,
10
+ filter,
11
+ query: `
12
+ query GetReportDifferences($input: GetReportInputType!, $filter: JSONObject) {
13
+ getReport(input: $input) {
14
+ rawID
15
+ reportTemplateCode
16
+ reportTypeCode
17
+ totalRows
18
+ id
19
+ diffReportTotals(includeSelf: true, filter: $filter) {
20
+ totalRows
21
+ reportTypeCode
22
+ __typename
23
+ }
24
+ }
25
+ }
26
+ `,
27
+ reportTemplateCode,
28
+ variables: {
29
+ filter,
30
+ input: {
31
+ crawlId,
32
+ reportTemplateCode,
33
+ reportTypeCode: __1.reportTypes.BASIC,
34
+ },
35
+ },
36
+ });
37
+ exports.default = getReportDifferences;