@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
@@ -18,6 +18,13 @@ jobs:
18
18
 
19
19
  - run: yarn set version berry
20
20
 
21
+ # Install ALL dependencies (including devDependencies with TypeScript)
22
+ - run: yarn install --immutable
23
+
24
+ # Build the project (TypeScript now available)
25
+ - run: yarn build
26
+
27
+ # Optional: prune to production-only after build
21
28
  - run: yarn workspaces focus --production
22
29
 
23
30
  - uses: JS-DevTools/npm-publish@v3.1.1
Binary file
@@ -0,0 +1,18 @@
1
+ export declare class BaseClass {
2
+ /**
3
+ * Shortcut to set a value to an array and return the instance.
4
+ */
5
+ protected _setArray: (fields: any | any[], input: any | any[]) => this;
6
+ /**
7
+ * Shortcut to set a value and return the instance.
8
+ */
9
+ protected _setValue: (fields: any | any[], input: any) => this;
10
+ /**
11
+ * Shortcut to add a value to an existing array.
12
+ */
13
+ protected _push: (fields: any | any[], input: any | any[]) => this;
14
+ /**
15
+ * Shortcut to get a value, but default if the fields don't exist.
16
+ */
17
+ protected _get: (fields: any | any[], defaultValue?: any) => any;
18
+ }
@@ -0,0 +1,53 @@
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.BaseClass = void 0;
7
+ const isArray_1 = __importDefault(require("lodash/isArray"));
8
+ const set_1 = __importDefault(require("lodash/set"));
9
+ const util_1 = require("../util");
10
+ class BaseClass {
11
+ constructor() {
12
+ /**
13
+ * Shortcut to set a value to an array and return the instance.
14
+ */
15
+ this._setArray = (fields, input) => {
16
+ if ((0, isArray_1.default)(input)) {
17
+ (0, set_1.default)(this, fields, input);
18
+ }
19
+ else {
20
+ (0, set_1.default)(this, fields, [input]);
21
+ }
22
+ return this;
23
+ };
24
+ /**
25
+ * Shortcut to set a value and return the instance.
26
+ */
27
+ this._setValue = (fields, input) => {
28
+ (0, set_1.default)(this, fields, input);
29
+ return this;
30
+ };
31
+ /**
32
+ * Shortcut to add a value to an existing array.
33
+ */
34
+ this._push = (fields, input) => {
35
+ let temp = this._get(fields, []);
36
+ if ((0, isArray_1.default)(input)) {
37
+ temp = temp.concat(input);
38
+ }
39
+ else {
40
+ temp = temp.push(input);
41
+ }
42
+ (0, set_1.default)(this, fields, temp);
43
+ return this;
44
+ };
45
+ /**
46
+ * Shortcut to get a value, but default if the fields don't exist.
47
+ */
48
+ this._get = (fields, defaultValue = null) => {
49
+ return (0, util_1.defaultTo)(this, fields, defaultValue);
50
+ };
51
+ }
52
+ }
53
+ exports.BaseClass = BaseClass;
@@ -0,0 +1,9 @@
1
+ export declare class BaseNamespace {
2
+ client: any;
3
+ key: string;
4
+ config: any;
5
+ constructor(key: string, config: any);
6
+ ensureInit: () => Promise<void>;
7
+ reset: () => void;
8
+ getClient: () => Promise<any>;
9
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseNamespace = void 0;
4
+ const environment_1 = require("../environment");
5
+ class BaseNamespace {
6
+ constructor(key, config) {
7
+ this.client = null;
8
+ this.config = null;
9
+ // To be superseded by child
10
+ this.ensureInit = async () => {
11
+ };
12
+ // Reset the client
13
+ this.reset = () => {
14
+ this.client = null;
15
+ };
16
+ // Return the raw client if needed
17
+ this.getClient = async () => {
18
+ return this.client();
19
+ };
20
+ if (!environment_1.isServer) {
21
+ throw new Error("Server-side only class accessed from client");
22
+ }
23
+ this.key = key;
24
+ this.config = config;
25
+ }
26
+ }
27
+ exports.BaseNamespace = BaseNamespace;
@@ -0,0 +1,2 @@
1
+ export { BaseClass } from "./BaseClass";
2
+ export { BaseNamespace } from "./BaseNamespace";
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseNamespace = exports.BaseClass = void 0;
4
+ var BaseClass_1 = require("./BaseClass");
5
+ Object.defineProperty(exports, "BaseClass", { enumerable: true, get: function () { return BaseClass_1.BaseClass; } });
6
+ var BaseNamespace_1 = require("./BaseNamespace");
7
+ Object.defineProperty(exports, "BaseNamespace", { enumerable: true, get: function () { return BaseNamespace_1.BaseNamespace; } });
@@ -0,0 +1,15 @@
1
+ import { InputDate } from "../date";
2
+ import { JobSchemaType } from "./index";
3
+ type AdverityJobsResponse = {
4
+ count: number;
5
+ next: string | null;
6
+ previous: string | null;
7
+ results: JobSchemaType[];
8
+ };
9
+ /**
10
+ * Fetch all the jobs that ran yesterday by default.
11
+ * A job can either by in Fetch, Enrich or Transfer states, but all have different job ids. This makes it difficult to track and we would be reliant on the start/end time which could varu.
12
+ * As a result, we only store the Transfer jobs as this is when it gets moved into Bigquery. If it's not in Bigquery we cant use it anyway.
13
+ */
14
+ export declare const getJobs: (apiKey: string, start?: InputDate, end?: InputDate, url?: string) => Promise<AdverityJobsResponse[]>;
15
+ export {};
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getJobs = void 0;
4
+ const date_1 = require("../date");
5
+ const axios_1 = require("../axios");
6
+ /**
7
+ * Fetch all the jobs that ran yesterday by default.
8
+ * A job can either by in Fetch, Enrich or Transfer states, but all have different job ids. This makes it difficult to track and we would be reliant on the start/end time which could varu.
9
+ * As a result, we only store the Transfer jobs as this is when it gets moved into Bigquery. If it's not in Bigquery we cant use it anyway.
10
+ */
11
+ const getJobs = async (apiKey, start, end, url) => {
12
+ const startYmd = (0, date_1.getYmdString)(start ? (0, date_1.getDate)(start) : (0, date_1.getYesterday)());
13
+ const endYmd = (0, date_1.getYmdString)(end ? (0, date_1.getDate)(end) : (0, date_1.getToday)());
14
+ const finalUrl = "undefined" !== typeof url ? url : `https://8ms.datatap.adverity.com/api/jobs/?start=${startYmd}&end=${endYmd}&page_size=300`;
15
+ let response = [];
16
+ const apiResponse = await (0, axios_1.get)(finalUrl, {
17
+ headers: {
18
+ Authorization: `Bearer ${apiKey}`,
19
+ }
20
+ });
21
+ if (apiResponse.isSuccess()) {
22
+ const apiResponseBody = apiResponse.getBody();
23
+ // Move to the next page
24
+ if (apiResponseBody.next) {
25
+ response = [...apiResponse.getBody(), await (0, exports.getJobs)(apiKey, start, end, apiResponseBody.next)];
26
+ }
27
+ }
28
+ return response;
29
+ };
30
+ exports.getJobs = getJobs;
@@ -0,0 +1,112 @@
1
+ import { z } from "zod/v4";
2
+ export declare const stackSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ uuid: z.ZodString;
5
+ name: z.ZodString;
6
+ slug: z.ZodString;
7
+ url: z.ZodString;
8
+ change_url: z.ZodString;
9
+ extracts_url: z.ZodString;
10
+ issues_url: z.ZodString;
11
+ overview_url: z.ZodString;
12
+ permissions: z.ZodObject<{
13
+ isCreator: z.ZodBoolean;
14
+ isDatastreamManager: z.ZodBoolean;
15
+ isViewer: z.ZodBoolean;
16
+ }, z.core.$strip>;
17
+ }, z.core.$strip>;
18
+ export type StackSchemaType = z.infer<typeof stackSchema>;
19
+ export declare const datastreamSchema: z.ZodObject<{
20
+ id: z.ZodNumber;
21
+ stack: z.ZodObject<{
22
+ id: z.ZodString;
23
+ uuid: z.ZodString;
24
+ name: z.ZodString;
25
+ slug: z.ZodString;
26
+ url: z.ZodString;
27
+ change_url: z.ZodString;
28
+ extracts_url: z.ZodString;
29
+ issues_url: z.ZodString;
30
+ overview_url: z.ZodString;
31
+ permissions: z.ZodObject<{
32
+ isCreator: z.ZodBoolean;
33
+ isDatastreamManager: z.ZodBoolean;
34
+ isViewer: z.ZodBoolean;
35
+ }, z.core.$strip>;
36
+ }, z.core.$strip>;
37
+ stack_id: z.ZodNumber;
38
+ name: z.ZodString;
39
+ slug: z.ZodString;
40
+ app_label: z.ZodString;
41
+ absolute_url: z.ZodString;
42
+ change_url: z.ZodString;
43
+ extracts_url: z.ZodString;
44
+ fetch_url: z.ZodString;
45
+ overview_url: z.ZodString;
46
+ schema_mapping_url: z.ZodString;
47
+ enabled: z.ZodBigInt;
48
+ next_run: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"Not Scheduled">]>;
49
+ url: z.ZodString;
50
+ datastream_type_id: z.ZodNumber;
51
+ logo_url: z.ZodString;
52
+ extracts_stream_url: z.ZodString;
53
+ supports_extended_intervals: z.ZodNumber;
54
+ updated: z.ZodString;
55
+ created: z.ZodString;
56
+ creator: z.ZodString;
57
+ can_be_fetched: z.ZodNumber;
58
+ }, z.core.$strip>;
59
+ export type DatastreamSchemaType = z.infer<typeof datastreamSchema>;
60
+ export declare const jobSchema: z.ZodObject<{
61
+ id: z.ZodNumber;
62
+ url: z.ZodString;
63
+ job_start: z.ZodNullable<z.ZodString>;
64
+ job_end: z.ZodNullable<z.ZodString>;
65
+ progress: z.ZodNumber;
66
+ state: z.ZodNumber;
67
+ state_label: z.ZodString;
68
+ state_color: z.ZodString;
69
+ datastream: z.ZodObject<{
70
+ id: z.ZodNumber;
71
+ stack: z.ZodObject<{
72
+ id: z.ZodString;
73
+ uuid: z.ZodString;
74
+ name: z.ZodString;
75
+ slug: z.ZodString;
76
+ url: z.ZodString;
77
+ change_url: z.ZodString;
78
+ extracts_url: z.ZodString;
79
+ issues_url: z.ZodString;
80
+ overview_url: z.ZodString;
81
+ permissions: z.ZodObject<{
82
+ isCreator: z.ZodBoolean;
83
+ isDatastreamManager: z.ZodBoolean;
84
+ isViewer: z.ZodBoolean;
85
+ }, z.core.$strip>;
86
+ }, z.core.$strip>;
87
+ stack_id: z.ZodNumber;
88
+ name: z.ZodString;
89
+ slug: z.ZodString;
90
+ app_label: z.ZodString;
91
+ absolute_url: z.ZodString;
92
+ change_url: z.ZodString;
93
+ extracts_url: z.ZodString;
94
+ fetch_url: z.ZodString;
95
+ overview_url: z.ZodString;
96
+ schema_mapping_url: z.ZodString;
97
+ enabled: z.ZodBigInt;
98
+ next_run: z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<"Not Scheduled">]>;
99
+ url: z.ZodString;
100
+ datastream_type_id: z.ZodNumber;
101
+ logo_url: z.ZodString;
102
+ extracts_stream_url: z.ZodString;
103
+ supports_extended_intervals: z.ZodNumber;
104
+ updated: z.ZodString;
105
+ created: z.ZodString;
106
+ creator: z.ZodString;
107
+ can_be_fetched: z.ZodNumber;
108
+ }, z.core.$strip>;
109
+ issues: z.ZodArray<z.ZodAny>;
110
+ type: z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodString]>;
111
+ }, z.core.$strip>;
112
+ export type JobSchemaType = z.infer<typeof jobSchema>;
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.jobSchema = exports.datastreamSchema = exports.stackSchema = void 0;
4
+ const v4_1 = require("zod/v4");
5
+ exports.stackSchema = v4_1.z.object({
6
+ id: v4_1.z.string(),
7
+ uuid: v4_1.z.string(),
8
+ name: v4_1.z.string(),
9
+ slug: v4_1.z.string(),
10
+ url: v4_1.z.string(),
11
+ change_url: v4_1.z.string(),
12
+ extracts_url: v4_1.z.string(),
13
+ issues_url: v4_1.z.string(),
14
+ overview_url: v4_1.z.string(),
15
+ permissions: v4_1.z.object({
16
+ isCreator: v4_1.z.boolean(),
17
+ isDatastreamManager: v4_1.z.boolean(),
18
+ isViewer: v4_1.z.boolean(),
19
+ })
20
+ });
21
+ exports.datastreamSchema = v4_1.z.object({
22
+ id: v4_1.z.number(),
23
+ stack: exports.stackSchema,
24
+ stack_id: v4_1.z.number(),
25
+ name: v4_1.z.string(),
26
+ slug: v4_1.z.string(),
27
+ app_label: v4_1.z.string(),
28
+ absolute_url: v4_1.z.string(),
29
+ change_url: v4_1.z.string(),
30
+ extracts_url: v4_1.z.string(),
31
+ fetch_url: v4_1.z.string(),
32
+ overview_url: v4_1.z.string(),
33
+ schema_mapping_url: v4_1.z.string(),
34
+ enabled: v4_1.z.bigint(),
35
+ next_run: v4_1.z.union([v4_1.z.string(), v4_1.z.literal("Not Scheduled")]),
36
+ url: v4_1.z.string(),
37
+ datastream_type_id: v4_1.z.number(),
38
+ logo_url: v4_1.z.string(),
39
+ extracts_stream_url: v4_1.z.string(),
40
+ supports_extended_intervals: v4_1.z.number(),
41
+ updated: v4_1.z.string(),
42
+ created: v4_1.z.string(),
43
+ creator: v4_1.z.string(),
44
+ can_be_fetched: v4_1.z.number(),
45
+ });
46
+ exports.jobSchema = v4_1.z.object({
47
+ id: v4_1.z.number(),
48
+ url: v4_1.z.string(),
49
+ job_start: v4_1.z.string()
50
+ .nullable(),
51
+ job_end: v4_1.z.string()
52
+ .nullable(),
53
+ progress: v4_1.z.number(),
54
+ state: v4_1.z.number(),
55
+ state_label: v4_1.z.string(),
56
+ state_color: v4_1.z.string(),
57
+ datastream: exports.datastreamSchema,
58
+ issues: v4_1.z.any()
59
+ .array(),
60
+ type: v4_1.z.union([v4_1.z.string("Fetch"), v4_1.z.string("Enrich"), v4_1.z.string("Transfer")]),
61
+ });
@@ -0,0 +1,35 @@
1
+ import { ApiState, ApiResponse } from "./";
2
+ import { z } from "zod/v4";
3
+ type ConstructorProps = {
4
+ body?: any;
5
+ error?: any;
6
+ state?: ApiState;
7
+ };
8
+ /**
9
+ * Class version of the API to enable quicker instances.
10
+ */
11
+ export declare class ApiResponseClass<T = any, E = any> {
12
+ state: ApiState;
13
+ body: T | null;
14
+ error: E | null;
15
+ constructor({ body, error, state }?: ConstructorProps);
16
+ fromJson: (input: ApiResponse) => this;
17
+ getBody: () => any;
18
+ getBodyDefaultTo: (keys: any | any[], defaultValue: any) => any;
19
+ getError: () => any;
20
+ getJson: () => ApiResponse<T, E>;
21
+ getApiState: () => ApiState;
22
+ isError: () => boolean;
23
+ isIdle: () => boolean;
24
+ isPending: () => boolean;
25
+ isSuccess: () => boolean;
26
+ setToIdle: () => this;
27
+ setToPending: () => this;
28
+ setToError: (body: any, error: any) => this;
29
+ setToSuccess: (body: any) => this;
30
+ setBody: (body: any) => this;
31
+ setError: (error: any) => this;
32
+ setApiState: (state: ApiState) => this;
33
+ validateZod: <T_1>(schema: z.ZodSchema<T_1>) => ApiResponseClass<T_1, E>;
34
+ }
35
+ export {};
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiResponseClass = void 0;
4
+ const util_1 = require("../util");
5
+ const _1 = require("./");
6
+ /**
7
+ * Class version of the API to enable quicker instances.
8
+ */
9
+ class ApiResponseClass {
10
+ constructor({ body, error, state } = {}) {
11
+ this.state = _1.ApiState.IDLE;
12
+ this.body = null;
13
+ this.error = null;
14
+ this.fromJson = (input) => {
15
+ this.body = input.body;
16
+ this.error = input.error;
17
+ this.state = input.state;
18
+ return this;
19
+ };
20
+ this.getBody = () => {
21
+ return this.body;
22
+ };
23
+ this.getBodyDefaultTo = (keys, defaultValue) => {
24
+ return (0, util_1.defaultTo)(this.body, keys, defaultValue);
25
+ };
26
+ this.getError = () => {
27
+ return this.error;
28
+ };
29
+ this.getJson = () => {
30
+ return {
31
+ body: this.body,
32
+ error: this.error,
33
+ state: this.state,
34
+ };
35
+ };
36
+ this.getApiState = () => {
37
+ return this.state;
38
+ };
39
+ this.isError = () => {
40
+ return this.state === _1.ApiState.ERROR;
41
+ };
42
+ this.isIdle = () => {
43
+ return this.state === _1.ApiState.IDLE;
44
+ };
45
+ this.isPending = () => {
46
+ return this.state === _1.ApiState.PENDING;
47
+ };
48
+ this.isSuccess = () => {
49
+ return this.state === _1.ApiState.SUCCESS;
50
+ };
51
+ this.setToIdle = () => {
52
+ this.state = _1.ApiState.IDLE;
53
+ return this;
54
+ };
55
+ this.setToPending = () => {
56
+ this.state = _1.ApiState.PENDING;
57
+ return this;
58
+ };
59
+ this.setToError = (body, error) => {
60
+ this.body = body || null;
61
+ this.error = error;
62
+ this.state = _1.ApiState.ERROR;
63
+ return this;
64
+ };
65
+ this.setToSuccess = (body) => {
66
+ this.body = body;
67
+ this.state = _1.ApiState.SUCCESS;
68
+ return this;
69
+ };
70
+ this.setBody = (body) => {
71
+ this.body = body;
72
+ return this;
73
+ };
74
+ this.setError = (error) => {
75
+ this.error = error;
76
+ return this;
77
+ };
78
+ this.setApiState = (state) => {
79
+ this.state = state;
80
+ return this;
81
+ };
82
+ this.validateZod = (schema) => {
83
+ try {
84
+ const validatedBody = schema.parse(this.body);
85
+ return new ApiResponseClass({ body: validatedBody, state: this.state });
86
+ }
87
+ catch (error) {
88
+ return new ApiResponseClass({ error, state: _1.ApiState.ERROR });
89
+ }
90
+ };
91
+ this.body = body || null;
92
+ this.error = error || null;
93
+ this.state = state || _1.ApiState.IDLE;
94
+ return this;
95
+ }
96
+ }
97
+ exports.ApiResponseClass = ApiResponseClass;
package/api/index.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ export { ApiResponseClass } from "./ApiResponseClass";
2
+ export declare enum ApiState {
3
+ CANCELLED = "CANCELLED",
4
+ ERROR = "ERROR",
5
+ IDLE = "IDLE",
6
+ PENDING = "PENDING",
7
+ SUCCESS = "SUCCESS",
8
+ VALIDATION_ERROR = "VALIDATION_ERROR"
9
+ }
10
+ export type ApiResponse<T = any, E = any> = {
11
+ body: T | null;
12
+ error: E | null;
13
+ state: ApiState;
14
+ };
15
+ export declare const defaultResponse: ApiResponse;
16
+ export declare const unexpectedError: string;
17
+ export declare const isCancelled: (apiResponse: ApiResponse) => boolean;
18
+ export declare const isError: (apiResponse: ApiResponse) => boolean;
19
+ export declare const isIdle: (apiResponse: ApiResponse) => boolean;
20
+ export declare const isPending: (apiResponse: ApiResponse) => boolean;
21
+ export declare const isSuccess: (apiResponse: ApiResponse) => boolean;
22
+ export declare const isValidationError: (apiResponse: ApiResponse) => boolean;
package/api/index.js ADDED
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidationError = exports.isSuccess = exports.isPending = exports.isIdle = exports.isError = exports.isCancelled = exports.unexpectedError = exports.defaultResponse = exports.ApiState = exports.ApiResponseClass = void 0;
4
+ var ApiResponseClass_1 = require("./ApiResponseClass");
5
+ Object.defineProperty(exports, "ApiResponseClass", { enumerable: true, get: function () { return ApiResponseClass_1.ApiResponseClass; } });
6
+ var ApiState;
7
+ (function (ApiState) {
8
+ ApiState["CANCELLED"] = "CANCELLED";
9
+ ApiState["ERROR"] = "ERROR";
10
+ ApiState["IDLE"] = "IDLE";
11
+ ApiState["PENDING"] = "PENDING";
12
+ ApiState["SUCCESS"] = "SUCCESS";
13
+ ApiState["VALIDATION_ERROR"] = "VALIDATION_ERROR";
14
+ })(ApiState || (exports.ApiState = ApiState = {}));
15
+ exports.defaultResponse = {
16
+ body: null,
17
+ error: null,
18
+ state: ApiState.IDLE,
19
+ };
20
+ exports.unexpectedError = "An unexpected error occurred, please try again.";
21
+ const isCancelled = (apiResponse) => {
22
+ return ApiState.CANCELLED === apiResponse.state;
23
+ };
24
+ exports.isCancelled = isCancelled;
25
+ const isError = (apiResponse) => {
26
+ return ApiState.ERROR === apiResponse.state;
27
+ };
28
+ exports.isError = isError;
29
+ const isIdle = (apiResponse) => {
30
+ return ApiState.IDLE === apiResponse.state;
31
+ };
32
+ exports.isIdle = isIdle;
33
+ const isPending = (apiResponse) => {
34
+ return ApiState.PENDING === apiResponse.state;
35
+ };
36
+ exports.isPending = isPending;
37
+ const isSuccess = (apiResponse) => {
38
+ return ApiState.SUCCESS === apiResponse.state;
39
+ };
40
+ exports.isSuccess = isSuccess;
41
+ const isValidationError = (apiResponse) => {
42
+ return ApiState.VALIDATION_ERROR === apiResponse.state;
43
+ };
44
+ exports.isValidationError = isValidationError;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shorthand to check if an array or string contains a needle.
3
+ */
4
+ export declare const contains: <T>(haystack: T[], needle: T) => boolean;
5
+ /**
6
+ * Convert an array into an array or return if already an array.
7
+ */
8
+ export declare const getArray: <T>(input: T) => T[];
package/array/index.js ADDED
@@ -0,0 +1,17 @@
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.getArray = exports.contains = void 0;
7
+ const isArray_1 = __importDefault(require("lodash/isArray"));
8
+ /**
9
+ * Shorthand to check if an array or string contains a needle.
10
+ */
11
+ const contains = (haystack, needle) => -1 !== haystack.indexOf(needle);
12
+ exports.contains = contains;
13
+ /**
14
+ * Convert an array into an array or return if already an array.
15
+ */
16
+ const getArray = (input) => (0, isArray_1.default)(input) ? input : [input];
17
+ exports.getArray = getArray;
@@ -0,0 +1,16 @@
1
+ import { z } from "zod/v4";
2
+ /**
3
+ * The request in the structure required by AT Internet.
4
+ */
5
+ export declare const requestSchema: z.ZodObject<{
6
+ columns: z.ZodArray<z.ZodString>;
7
+ evo: z.ZodObject<{}, z.core.$strip>;
8
+ filter: z.ZodObject<{}, z.core.$strip>;
9
+ "max-results": z.ZodNumber;
10
+ options: z.ZodObject<{
11
+ ignore_null_properties: z.ZodBoolean;
12
+ }, z.core.$strip>;
13
+ "page-num": z.ZodNumber;
14
+ period: z.ZodObject<{}, z.core.$strip>;
15
+ }, z.core.$strip>;
16
+ export type RequestSchemaType = z.infer<typeof requestSchema>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requestSchema = void 0;
4
+ const v4_1 = require("zod/v4");
5
+ /**
6
+ * The request in the structure required by AT Internet.
7
+ */
8
+ exports.requestSchema = v4_1.z.object({
9
+ columns: v4_1.z.array(v4_1.z.string()),
10
+ evo: v4_1.z.object({}),
11
+ filter: v4_1.z.object({}),
12
+ "max-results": v4_1.z.number(),
13
+ options: v4_1.z.object({
14
+ "ignore_null_properties": v4_1.z.boolean(),
15
+ }),
16
+ "page-num": v4_1.z.number(),
17
+ period: v4_1.z.object({}),
18
+ });
@@ -0,0 +1,8 @@
1
+ import { BaseNamespace } from "../../_class";
2
+ import { AthenaConfig } from "./index";
3
+ export declare class AwsAthenaNamespace extends BaseNamespace {
4
+ client: any | null;
5
+ config: AthenaConfig;
6
+ ensureInit: () => Promise<void>;
7
+ query: (query: string) => Promise<any>;
8
+ }