@8ms/helpers 1.33.2 → 1.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/api/ApiResponse.d.ts +2 -2
  2. package/api/ApiResponse.js +11 -11
  3. package/api/index.d.ts +8 -0
  4. package/api/index.js +12 -0
  5. package/api/isError.d.ts +2 -2
  6. package/api/isError.js +3 -6
  7. package/api/isSuccess.d.ts +1 -1
  8. package/api/isSuccess.js +3 -6
  9. package/api/response.d.ts +1 -1
  10. package/api/response.js +2 -5
  11. package/aws/s3/listFilesIteratively.d.ts +9 -0
  12. package/aws/s3/listFilesIteratively.js +44 -0
  13. package/aws/s3/readBuffer.d.ts +1 -1
  14. package/aws/s3/readBuffer.js +6 -19
  15. package/aws/s3/readFile.d.ts +3 -2
  16. package/aws/s3/readFile.js +13 -10
  17. package/aws/s3cache/getCache.d.ts +2 -2
  18. package/aws/s3cache/getCache.js +2 -2
  19. package/aws/s3cache/index.d.ts +6 -0
  20. package/aws/s3cache/updateCache.d.ts +1 -1
  21. package/brightData/webScraperIde/getRealtime.js +5 -5
  22. package/crud/index.d.ts +6 -0
  23. package/crud/index.js +10 -0
  24. package/date/getDate.d.ts +1 -1
  25. package/date/getDatesBetween.d.ts +1 -1
  26. package/date/getFinancialYear.d.ts +1 -1
  27. package/date/getFinancialYear.js +3 -6
  28. package/date/getFinancialYearToDate.d.ts +1 -1
  29. package/date/getFinancialYearToYesterday.d.ts +1 -1
  30. package/date/getFinancialYearWeeks.d.ts +1 -1
  31. package/date/getFinancialYearWeeks.js +1 -2
  32. package/date/getLastWeek.d.ts +1 -1
  33. package/date/getMax.d.ts +1 -1
  34. package/date/getMin.d.ts +1 -1
  35. package/date/getMonday.d.ts +3 -3
  36. package/date/getMonday.js +3 -5
  37. package/date/getPredefinedTimeframe.d.ts +2 -3
  38. package/date/getPredefinedTimeframe.js +4 -4
  39. package/date/getSunday.d.ts +1 -1
  40. package/date/getThisWeek.d.ts +1 -1
  41. package/date/getTwoWeeksAgo.d.ts +1 -1
  42. package/date/getWeeksAgo.d.ts +1 -1
  43. package/date/index.d.ts +55 -0
  44. package/date/index.js +36 -0
  45. package/date/isLastWeek.d.ts +1 -1
  46. package/date/isThisWeek.d.ts +2 -2
  47. package/date/isThisWeek.js +1 -1
  48. package/environment/getEnvironment.d.ts +1 -1
  49. package/environment/getEnvironment.js +8 -8
  50. package/environment/index.d.ts +9 -0
  51. package/environment/index.js +14 -0
  52. package/environment/isAws.js +2 -5
  53. package/environment/isDevelopment.js +2 -2
  54. package/environment/isProduction.js +2 -2
  55. package/environment/isStaging.js +2 -2
  56. package/googleAds/keywordPlanner/index.d.ts +238 -0
  57. package/googleAds/keywordPlanner/index.js +245 -0
  58. package/{google → googleAds}/keywordPlanner/request.d.ts +1 -3
  59. package/{google → googleAds}/keywordPlanner/request.js +2 -5
  60. package/{google → googleAds}/keywordPlanner/response.d.ts +1 -1
  61. package/littleWarden/index.d.ts +5 -0
  62. package/littleWarden/index.js +9 -0
  63. package/littleWarden/isAllGood.js +3 -6
  64. package/littleWarden/isDanger.js +2 -5
  65. package/littleWarden/isWarning.js +2 -5
  66. package/package.json +27 -26
  67. package/util/promiseChunks.d.ts +10 -0
  68. package/util/promiseChunks.js +18 -0
  69. package/webWorker/index.d.ts +5 -0
  70. package/webWorker/index.js +9 -0
  71. package/api/states.d.ts +0 -9
  72. package/api/states.js +0 -10
  73. package/api/unexpectedError.d.ts +0 -2
  74. package/api/unexpectedError.js +0 -4
  75. package/aws/s3cache/cache.d.ts +0 -7
  76. package/crud/actions.d.ts +0 -8
  77. package/crud/actions.js +0 -10
  78. package/date/date.d.ts +0 -4
  79. package/date/date.js +0 -2
  80. package/date/duration.d.ts +0 -5
  81. package/date/duration.js +0 -2
  82. package/date/durationComparisons.d.ts +0 -5
  83. package/date/durationComparisons.js +0 -7
  84. package/date/durations.d.ts +0 -8
  85. package/date/durations.js +0 -10
  86. package/date/financialYear.d.ts +0 -4
  87. package/date/financialYear.js +0 -2
  88. package/date/financialYearWeek.d.ts +0 -6
  89. package/date/financialYearWeek.js +0 -2
  90. package/date/predefinedTimeframes.d.ts +0 -7
  91. package/date/predefinedTimeframes.js +0 -9
  92. package/date/timeframe.d.ts +0 -8
  93. package/date/timeframe.js +0 -2
  94. package/date/timeframes.d.ts +0 -4
  95. package/date/timeframes.js +0 -7
  96. package/environment/environments.d.ts +0 -7
  97. package/environment/environments.js +0 -8
  98. package/environment/platforms.d.ts +0 -6
  99. package/environment/platforms.js +0 -7
  100. package/google/keywordPlanner/countries.d.ts +0 -222
  101. package/google/keywordPlanner/countries.js +0 -223
  102. package/google/keywordPlanner/months.d.ts +0 -16
  103. package/google/keywordPlanner/months.js +0 -17
  104. package/google/keywordPlanner/networks.d.ts +0 -6
  105. package/google/keywordPlanner/networks.js +0 -7
  106. package/littleWarden/states.d.ts +0 -7
  107. package/littleWarden/states.js +0 -8
  108. package/webWorker/states.d.ts +0 -7
  109. package/webWorker/states.js +0 -8
  110. /package/aws/s3cache/{cache.js → index.js} +0 -0
  111. /package/{google → googleAds}/keywordPlanner/response.js +0 -0
@@ -0,0 +1,245 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Network = exports.Month = exports.Country = void 0;
4
+ /**
5
+ * As defined in=
6
+ * https=//docs.google.com/spreadsheets/d/1T2ObmYoo6BNzrqYKb2ts75A6IKfnXmnndr2wujgNpak/edit#gid=2146701026
7
+ */
8
+ var Country;
9
+ (function (Country) {
10
+ Country[Country["AFGHANISTAN"] = 2004] = "AFGHANISTAN";
11
+ Country[Country["ALBANIA"] = 2008] = "ALBANIA";
12
+ Country[Country["ANTARCTICA"] = 2010] = "ANTARCTICA";
13
+ Country[Country["ALGERIA"] = 2012] = "ALGERIA";
14
+ Country[Country["AMERICAN_SAMOA"] = 2016] = "AMERICAN_SAMOA";
15
+ Country[Country["ANDORRA"] = 2020] = "ANDORRA";
16
+ Country[Country["ANGOLA"] = 2024] = "ANGOLA";
17
+ Country[Country["ANTIGUA_AND_BARBUDA"] = 2028] = "ANTIGUA_AND_BARBUDA";
18
+ Country[Country["AZERBAIJAN"] = 2031] = "AZERBAIJAN";
19
+ Country[Country["ARGENTINA"] = 2032] = "ARGENTINA";
20
+ Country[Country["AUSTRALIA"] = 2036] = "AUSTRALIA";
21
+ Country[Country["AUSTRIA"] = 2040] = "AUSTRIA";
22
+ Country[Country["THE_BAHAMAS"] = 2044] = "THE_BAHAMAS";
23
+ Country[Country["BAHRAIN"] = 2048] = "BAHRAIN";
24
+ Country[Country["BANGLADESH"] = 2050] = "BANGLADESH";
25
+ Country[Country["ARMENIA"] = 2051] = "ARMENIA";
26
+ Country[Country["BARBADOS"] = 2052] = "BARBADOS";
27
+ Country[Country["BELGIUM"] = 2056] = "BELGIUM";
28
+ Country[Country["BHUTAN"] = 2064] = "BHUTAN";
29
+ Country[Country["BOLIVIA"] = 2068] = "BOLIVIA";
30
+ Country[Country["BOSNIA_AND_HERZEGOVINA"] = 2070] = "BOSNIA_AND_HERZEGOVINA";
31
+ Country[Country["BOTSWANA"] = 2072] = "BOTSWANA";
32
+ Country[Country["BRAZIL"] = 2076] = "BRAZIL";
33
+ Country[Country["BELIZE"] = 2084] = "BELIZE";
34
+ Country[Country["SOLOMON_ISLANDS"] = 2090] = "SOLOMON_ISLANDS";
35
+ Country[Country["BRUNEI"] = 2096] = "BRUNEI";
36
+ Country[Country["BULGARIA"] = 2100] = "BULGARIA";
37
+ Country[Country["MYANMAR_BURMA"] = 2104] = "MYANMAR_BURMA";
38
+ Country[Country["BURUNDI"] = 2108] = "BURUNDI";
39
+ Country[Country["BELARUS"] = 2112] = "BELARUS";
40
+ Country[Country["CAMBODIA"] = 2116] = "CAMBODIA";
41
+ Country[Country["CAMEROON"] = 2120] = "CAMEROON";
42
+ Country[Country["CANADA"] = 2124] = "CANADA";
43
+ Country[Country["CAPE_VERDE"] = 2132] = "CAPE_VERDE";
44
+ Country[Country["CENTRAL_AFRICAN_REPUBLIC"] = 2140] = "CENTRAL_AFRICAN_REPUBLIC";
45
+ Country[Country["SRI_LANKA"] = 2144] = "SRI_LANKA";
46
+ Country[Country["CHAD"] = 2148] = "CHAD";
47
+ Country[Country["CHILE"] = 2152] = "CHILE";
48
+ Country[Country["CHINA"] = 2156] = "CHINA";
49
+ Country[Country["CHRISTMAS_ISLAND"] = 2162] = "CHRISTMAS_ISLAND";
50
+ Country[Country["COCOS_KEELING_ISLANDS"] = 2166] = "COCOS_KEELING_ISLANDS";
51
+ Country[Country["COLOMBIA"] = 2170] = "COLOMBIA";
52
+ Country[Country["COMOROS"] = 2174] = "COMOROS";
53
+ Country[Country["REPUBLIC_OF_THE_CONGO"] = 2178] = "REPUBLIC_OF_THE_CONGO";
54
+ Country[Country["DEMOCRATIC_REPUBLIC_OF_THE_CONGO"] = 2180] = "DEMOCRATIC_REPUBLIC_OF_THE_CONGO";
55
+ Country[Country["COOK_ISLANDS"] = 2184] = "COOK_ISLANDS";
56
+ Country[Country["COSTA_RICA"] = 2188] = "COSTA_RICA";
57
+ Country[Country["CROATIA"] = 2191] = "CROATIA";
58
+ Country[Country["CYPRUS"] = 2196] = "CYPRUS";
59
+ Country[Country["CZECHIA"] = 2203] = "CZECHIA";
60
+ Country[Country["BENIN"] = 2204] = "BENIN";
61
+ Country[Country["DENMARK"] = 2208] = "DENMARK";
62
+ Country[Country["DOMINICA"] = 2212] = "DOMINICA";
63
+ Country[Country["DOMINICAN_REPUBLIC"] = 2214] = "DOMINICAN_REPUBLIC";
64
+ Country[Country["ECUADOR"] = 2218] = "ECUADOR";
65
+ Country[Country["EL_SALVADOR"] = 2222] = "EL_SALVADOR";
66
+ Country[Country["EQUATORIAL_GUINEA"] = 2226] = "EQUATORIAL_GUINEA";
67
+ Country[Country["ETHIOPIA"] = 2231] = "ETHIOPIA";
68
+ Country[Country["ERITREA"] = 2232] = "ERITREA";
69
+ Country[Country["ESTONIA"] = 2233] = "ESTONIA";
70
+ Country[Country["SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS"] = 2239] = "SOUTH_GEORGIA_AND_THE_SOUTH_SANDWICH_ISLANDS";
71
+ Country[Country["FIJI"] = 2242] = "FIJI";
72
+ Country[Country["FINLAND"] = 2246] = "FINLAND";
73
+ Country[Country["FRANCE"] = 2250] = "FRANCE";
74
+ Country[Country["FRENCH_POLYNESIA"] = 2258] = "FRENCH_POLYNESIA";
75
+ Country[Country["FRENCH_SOUTHERN_AND_ANTARCTIC_LANDS"] = 2260] = "FRENCH_SOUTHERN_AND_ANTARCTIC_LANDS";
76
+ Country[Country["DJIBOUTI"] = 2262] = "DJIBOUTI";
77
+ Country[Country["GABON"] = 2266] = "GABON";
78
+ Country[Country["GEORGIA"] = 2268] = "GEORGIA";
79
+ Country[Country["THE_GAMBIA"] = 2270] = "THE_GAMBIA";
80
+ Country[Country["GERMANY"] = 2276] = "GERMANY";
81
+ Country[Country["GHANA"] = 2288] = "GHANA";
82
+ Country[Country["KIRIBATI"] = 2296] = "KIRIBATI";
83
+ Country[Country["GREECE"] = 2300] = "GREECE";
84
+ Country[Country["GRENADA"] = 2308] = "GRENADA";
85
+ Country[Country["GUAM"] = 2316] = "GUAM";
86
+ Country[Country["GUATEMALA"] = 2320] = "GUATEMALA";
87
+ Country[Country["GUINEA"] = 2324] = "GUINEA";
88
+ Country[Country["GUYANA"] = 2328] = "GUYANA";
89
+ Country[Country["HAITI"] = 2332] = "HAITI";
90
+ Country[Country["HEARD_ISLAND_AND_MCDONALD_ISLANDS"] = 2334] = "HEARD_ISLAND_AND_MCDONALD_ISLANDS";
91
+ Country[Country["VATICAN_CITY"] = 2336] = "VATICAN_CITY";
92
+ Country[Country["HONDURAS"] = 2340] = "HONDURAS";
93
+ Country[Country["HUNGARY"] = 2348] = "HUNGARY";
94
+ Country[Country["ICELAND"] = 2352] = "ICELAND";
95
+ Country[Country["INDIA"] = 2356] = "INDIA";
96
+ Country[Country["INDONESIA"] = 2360] = "INDONESIA";
97
+ Country[Country["IRAQ"] = 2368] = "IRAQ";
98
+ Country[Country["IRELAND"] = 2372] = "IRELAND";
99
+ Country[Country["ISRAEL"] = 2376] = "ISRAEL";
100
+ Country[Country["ITALY"] = 2380] = "ITALY";
101
+ Country[Country["COTE_DIVOIRE"] = 2384] = "COTE_DIVOIRE";
102
+ Country[Country["JAMAICA"] = 2388] = "JAMAICA";
103
+ Country[Country["JAPAN"] = 2392] = "JAPAN";
104
+ Country[Country["KAZAKHSTAN"] = 2398] = "KAZAKHSTAN";
105
+ Country[Country["JORDAN"] = 2400] = "JORDAN";
106
+ Country[Country["KENYA"] = 2404] = "KENYA";
107
+ Country[Country["SOUTH_KOREA"] = 2410] = "SOUTH_KOREA";
108
+ Country[Country["KUWAIT"] = 2414] = "KUWAIT";
109
+ Country[Country["KYRGYZSTAN"] = 2417] = "KYRGYZSTAN";
110
+ Country[Country["LAOS"] = 2418] = "LAOS";
111
+ Country[Country["LEBANON"] = 2422] = "LEBANON";
112
+ Country[Country["LESOTHO"] = 2426] = "LESOTHO";
113
+ Country[Country["LATVIA"] = 2428] = "LATVIA";
114
+ Country[Country["LIBERIA"] = 2430] = "LIBERIA";
115
+ Country[Country["LIBYA"] = 2434] = "LIBYA";
116
+ Country[Country["LIECHTENSTEIN"] = 2438] = "LIECHTENSTEIN";
117
+ Country[Country["LITHUANIA"] = 2440] = "LITHUANIA";
118
+ Country[Country["LUXEMBOURG"] = 2442] = "LUXEMBOURG";
119
+ Country[Country["MADAGASCAR"] = 2450] = "MADAGASCAR";
120
+ Country[Country["MALAWI"] = 2454] = "MALAWI";
121
+ Country[Country["MALAYSIA"] = 2458] = "MALAYSIA";
122
+ Country[Country["MALDIVES"] = 2462] = "MALDIVES";
123
+ Country[Country["MALI"] = 2466] = "MALI";
124
+ Country[Country["MALTA"] = 2470] = "MALTA";
125
+ Country[Country["MAURITANIA"] = 2478] = "MAURITANIA";
126
+ Country[Country["MAURITIUS"] = 2480] = "MAURITIUS";
127
+ Country[Country["MEXICO"] = 2484] = "MEXICO";
128
+ Country[Country["MONACO"] = 2492] = "MONACO";
129
+ Country[Country["MONGOLIA"] = 2496] = "MONGOLIA";
130
+ Country[Country["MOLDOVA"] = 2498] = "MOLDOVA";
131
+ Country[Country["MONTENEGRO"] = 2499] = "MONTENEGRO";
132
+ Country[Country["MOROCCO"] = 2504] = "MOROCCO";
133
+ Country[Country["MOZAMBIQUE"] = 2508] = "MOZAMBIQUE";
134
+ Country[Country["OMAN"] = 2512] = "OMAN";
135
+ Country[Country["NAMIBIA"] = 2516] = "NAMIBIA";
136
+ Country[Country["NAURU"] = 2520] = "NAURU";
137
+ Country[Country["NEPAL"] = 2524] = "NEPAL";
138
+ Country[Country["NETHERLANDS"] = 2528] = "NETHERLANDS";
139
+ Country[Country["CURACAO"] = 2531] = "CURACAO";
140
+ Country[Country["SINT_MAARTEN"] = 2534] = "SINT_MAARTEN";
141
+ Country[Country["CARIBBEAN_NETHERLANDS"] = 2535] = "CARIBBEAN_NETHERLANDS";
142
+ Country[Country["NEW_CALEDONIA"] = 2540] = "NEW_CALEDONIA";
143
+ Country[Country["VANUATU"] = 2548] = "VANUATU";
144
+ Country[Country["NEW_ZEALAND"] = 2554] = "NEW_ZEALAND";
145
+ Country[Country["NICARAGUA"] = 2558] = "NICARAGUA";
146
+ Country[Country["NIGER"] = 2562] = "NIGER";
147
+ Country[Country["NIGERIA"] = 2566] = "NIGERIA";
148
+ Country[Country["NIUE"] = 2570] = "NIUE";
149
+ Country[Country["NORFOLK_ISLAND"] = 2574] = "NORFOLK_ISLAND";
150
+ Country[Country["NORWAY"] = 2578] = "NORWAY";
151
+ Country[Country["NORTHERN_MARIANA_ISLANDS"] = 2580] = "NORTHERN_MARIANA_ISLANDS";
152
+ Country[Country["UNITED_STATES_MINOR_OUTLYING_ISLANDS"] = 2581] = "UNITED_STATES_MINOR_OUTLYING_ISLANDS";
153
+ Country[Country["FEDERATED_STATES_OF_MICRONESIA"] = 2583] = "FEDERATED_STATES_OF_MICRONESIA";
154
+ Country[Country["MARSHALL_ISLANDS"] = 2584] = "MARSHALL_ISLANDS";
155
+ Country[Country["PALAU"] = 2585] = "PALAU";
156
+ Country[Country["PAKISTAN"] = 2586] = "PAKISTAN";
157
+ Country[Country["PANAMA"] = 2591] = "PANAMA";
158
+ Country[Country["PAPUA_NEW_GUINEA"] = 2598] = "PAPUA_NEW_GUINEA";
159
+ Country[Country["PARAGUAY"] = 2600] = "PARAGUAY";
160
+ Country[Country["PERU"] = 2604] = "PERU";
161
+ Country[Country["PHILIPPINES"] = 2608] = "PHILIPPINES";
162
+ Country[Country["PITCAIRN_ISLANDS"] = 2612] = "PITCAIRN_ISLANDS";
163
+ Country[Country["POLAND"] = 2616] = "POLAND";
164
+ Country[Country["PORTUGAL"] = 2620] = "PORTUGAL";
165
+ Country[Country["GUINEA_BISSAU"] = 2624] = "GUINEA_BISSAU";
166
+ Country[Country["TIMOR_LESTE"] = 2626] = "TIMOR_LESTE";
167
+ Country[Country["QATAR"] = 2634] = "QATAR";
168
+ Country[Country["ROMANIA"] = 2642] = "ROMANIA";
169
+ Country[Country["RUSSIA"] = 2643] = "RUSSIA";
170
+ Country[Country["RWANDA"] = 2646] = "RWANDA";
171
+ Country[Country["SAINT_HELENA__ASCENSION_AND_TRISTAN_DA_CUNHA"] = 2654] = "SAINT_HELENA__ASCENSION_AND_TRISTAN_DA_CUNHA";
172
+ Country[Country["SAINT_KITTS_AND_NEVIS"] = 2659] = "SAINT_KITTS_AND_NEVIS";
173
+ Country[Country["SAINT_LUCIA"] = 2662] = "SAINT_LUCIA";
174
+ Country[Country["SAINT_PIERRE_AND_MIQUELON"] = 2666] = "SAINT_PIERRE_AND_MIQUELON";
175
+ Country[Country["SAINT_VINCENT_AND_THE_GRENADINES"] = 2670] = "SAINT_VINCENT_AND_THE_GRENADINES";
176
+ Country[Country["SAN_MARINO"] = 2674] = "SAN_MARINO";
177
+ Country[Country["SAO_TOME_AND_PRINCIPE"] = 2678] = "SAO_TOME_AND_PRINCIPE";
178
+ Country[Country["SAUDI_ARABIA"] = 2682] = "SAUDI_ARABIA";
179
+ Country[Country["SENEGAL"] = 2686] = "SENEGAL";
180
+ Country[Country["SERBIA"] = 2688] = "SERBIA";
181
+ Country[Country["SEYCHELLES"] = 2690] = "SEYCHELLES";
182
+ Country[Country["SIERRA_LEONE"] = 2694] = "SIERRA_LEONE";
183
+ Country[Country["SINGAPORE"] = 2702] = "SINGAPORE";
184
+ Country[Country["SLOVAKIA"] = 2703] = "SLOVAKIA";
185
+ Country[Country["VIETNAM"] = 2704] = "VIETNAM";
186
+ Country[Country["SLOVENIA"] = 2705] = "SLOVENIA";
187
+ Country[Country["SOMALIA"] = 2706] = "SOMALIA";
188
+ Country[Country["SOUTH_AFRICA"] = 2710] = "SOUTH_AFRICA";
189
+ Country[Country["ZIMBABWE"] = 2716] = "ZIMBABWE";
190
+ Country[Country["SPAIN"] = 2724] = "SPAIN";
191
+ Country[Country["SUDAN"] = 2736] = "SUDAN";
192
+ Country[Country["SURINAME"] = 2740] = "SURINAME";
193
+ Country[Country["ESWATINI"] = 2748] = "ESWATINI";
194
+ Country[Country["SWEDEN"] = 2752] = "SWEDEN";
195
+ Country[Country["SWITZERLAND"] = 2756] = "SWITZERLAND";
196
+ Country[Country["TAJIKISTAN"] = 2762] = "TAJIKISTAN";
197
+ Country[Country["THAILAND"] = 2764] = "THAILAND";
198
+ Country[Country["TOGO"] = 2768] = "TOGO";
199
+ Country[Country["TOKELAU"] = 2772] = "TOKELAU";
200
+ Country[Country["TONGA"] = 2776] = "TONGA";
201
+ Country[Country["TRINIDAD_AND_TOBAGO"] = 2780] = "TRINIDAD_AND_TOBAGO";
202
+ Country[Country["UNITED_ARAB_EMIRATES"] = 2784] = "UNITED_ARAB_EMIRATES";
203
+ Country[Country["TUNISIA"] = 2788] = "TUNISIA";
204
+ Country[Country["TURKEY"] = 2792] = "TURKEY";
205
+ Country[Country["TURKMENISTAN"] = 2795] = "TURKMENISTAN";
206
+ Country[Country["TUVALU"] = 2798] = "TUVALU";
207
+ Country[Country["UGANDA"] = 2800] = "UGANDA";
208
+ Country[Country["UKRAINE"] = 2804] = "UKRAINE";
209
+ Country[Country["NORTH_MACEDONIA"] = 2807] = "NORTH_MACEDONIA";
210
+ Country[Country["EGYPT"] = 2818] = "EGYPT";
211
+ Country[Country["UNITED_KINGDOM"] = 2826] = "UNITED_KINGDOM";
212
+ Country[Country["GUERNSEY"] = 2831] = "GUERNSEY";
213
+ Country[Country["JERSEY"] = 2832] = "JERSEY";
214
+ Country[Country["TANZANIA"] = 2834] = "TANZANIA";
215
+ Country[Country["UNITED_STATES"] = 2840] = "UNITED_STATES";
216
+ Country[Country["BURKINA_FASO"] = 2854] = "BURKINA_FASO";
217
+ Country[Country["URUGUAY"] = 2858] = "URUGUAY";
218
+ Country[Country["UZBEKISTAN"] = 2860] = "UZBEKISTAN";
219
+ Country[Country["VENEZUELA"] = 2862] = "VENEZUELA";
220
+ Country[Country["WALLIS_AND_FUTUNA"] = 2876] = "WALLIS_AND_FUTUNA";
221
+ Country[Country["SAMOA"] = 2882] = "SAMOA";
222
+ Country[Country["YEMEN"] = 2887] = "YEMEN";
223
+ Country[Country["ZAMBIA"] = 2894] = "ZAMBIA";
224
+ })(Country || (exports.Country = Country = {}));
225
+ ;
226
+ var Month;
227
+ (function (Month) {
228
+ Month["JANUARY"] = "JANUARY";
229
+ Month["FEBRUARY"] = "FEBRUARY";
230
+ Month["MARCH"] = "MARCH";
231
+ Month["APRIL"] = "APRIL";
232
+ Month["MAY"] = "MAY";
233
+ Month["JUNE"] = "JUNE";
234
+ Month["JULY"] = "JULY";
235
+ Month["AUGUST"] = "AUGUST";
236
+ Month["SEPTEMBER"] = "SEPTEMBER";
237
+ Month["OCTOBER"] = "OCTOBER";
238
+ Month["NOVEMBER"] = "NOVEMBER";
239
+ Month["DECEMBER"] = "DECEMBER";
240
+ })(Month || (exports.Month = Month = {}));
241
+ var Network;
242
+ (function (Network) {
243
+ Network[Network["GOOGLE_SEARCH_ONLY"] = 2] = "GOOGLE_SEARCH_ONLY";
244
+ Network[Network["GOOGLE_SEARCH_AND_PARTNERS"] = 3] = "GOOGLE_SEARCH_AND_PARTNERS";
245
+ })(Network || (exports.Network = Network = {}));
@@ -1,6 +1,4 @@
1
- import { Country } from './countries';
2
- import { Month } from './months';
3
- import { Network } from './networks';
1
+ import { Country, Month, Network } from "./";
4
2
  export type Request = {
5
3
  customerId: string;
6
4
  geoTargetConstants?: Country[];
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const networks_1 = __importDefault(require("./networks"));
3
+ const _1 = require("./");
7
4
  const request = {
8
5
  customerId: '',
9
6
  geoTargetConstants: [],
10
7
  historicalMetricsOptions: null,
11
8
  includeAdultKeywords: false,
12
- keywordPlanNetwork: networks_1.default.GOOGLE_SEARCH_ONLY,
9
+ keywordPlanNetwork: _1.Network.GOOGLE_SEARCH_ONLY,
13
10
  keywords: [],
14
11
  language: null,
15
12
  };
@@ -1,4 +1,4 @@
1
- import { State } from '../../api/states';
1
+ import { State } from '../../api';
2
2
  type Month = {
3
3
  date: string;
4
4
  month: number;
@@ -0,0 +1,5 @@
1
+ export declare enum State {
2
+ ALL_GOOD = "all_good",
3
+ DANGER = "danger",
4
+ WARNING = "warning"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.State = void 0;
4
+ var State;
5
+ (function (State) {
6
+ State["ALL_GOOD"] = "all_good";
7
+ State["DANGER"] = "danger";
8
+ State["WARNING"] = "warning";
9
+ })(State || (exports.State = State = {}));
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const states_1 = __importDefault(require("./states"));
3
+ const _1 = require("./");
7
4
  /**
8
5
  * Check if the field is All Good.
9
6
  */
10
7
  const isAllGood = ({ field }) => {
11
8
  let response = false;
12
9
  // Check that the status field exists
13
- if (undefined !== field && undefined !== field['status']) {
14
- response = states_1.default.ALL_GOOD === field['status'];
10
+ if (undefined !== field && undefined !== field["status"]) {
11
+ response = _1.State.ALL_GOOD === field["status"];
15
12
  }
16
13
  return response;
17
14
  };
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const states_1 = __importDefault(require("./states"));
3
+ const _1 = require("./");
7
4
  /**
8
5
  * Check if the field is Danger.
9
6
  */
@@ -11,7 +8,7 @@ const isDanger = ({ field }) => {
11
8
  let response = false;
12
9
  // Check that the status field exists
13
10
  if (undefined !== field && undefined !== field['status']) {
14
- response = states_1.default.DANGER === field['status'];
11
+ response = _1.State.DANGER === field['status'];
15
12
  }
16
13
  return response;
17
14
  };
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const states_1 = __importDefault(require("./states"));
3
+ const _1 = require("./");
7
4
  /**
8
5
  * Check if the field is Warning.
9
6
  */
@@ -11,7 +8,7 @@ const isWarning = ({ field }) => {
11
8
  let response = false;
12
9
  // Check that the status field exists
13
10
  if (undefined !== field && undefined !== field['status']) {
14
- response = states_1.default.WARNING === field['status'];
11
+ response = _1.State.WARNING === field['status'];
15
12
  }
16
13
  return response;
17
14
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "1.33.2",
4
+ "version": "1.35.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
@@ -13,39 +13,40 @@
13
13
  "jest": "jest --watch"
14
14
  },
15
15
  "dependencies": {
16
- "axios": "1.7.2",
17
- "crypto-js": "4.2.0",
18
- "date-fns": "3.6.0",
19
- "date-fns-tz": "3.1.3",
20
- "lodash": "4.17.21",
21
- "zod": "3.23.8"
16
+ "@date-fns/tz": "1.1.2",
17
+ "@date-fns/utc": "2.1.0",
18
+ "axios": "1.7.7",
19
+ "crypto-js": "4.2.0",
20
+ "date-fns": "4.1.0",
21
+ "lodash": "4.17.21",
22
+ "zod": "3.23.8"
22
23
  },
23
24
  "devDependencies": {
24
- "@aws-sdk/client-s3": "3.617.0",
25
- "@aws-sdk/client-ses": "3.616.0",
26
- "@aws-sdk/client-sqs": "3.616.0",
27
- "@aws-sdk/client-ssm": "3.616.0",
28
- "@aws-sdk/lib-storage": "3.617.0",
29
- "@aws-sdk/s3-request-presigner": "3.617.0",
30
- "@babel/preset-env": "7.24.8",
31
- "@babel/preset-flow": "7.24.7",
32
- "@babel/preset-typescript": "7.24.7",
33
- "@google-cloud/bigquery": "7.8.0",
34
- "@google-cloud/storage": "7.12.0",
35
- "@planetscale/database": "1.18.0",
36
- "@prisma/adapter-planetscale": "5.17.0",
37
- "@prisma/client": "5.17.0",
38
- "@types/jest": "29.5.12",
39
- "@types/lodash": "4.17.7",
25
+ "@aws-sdk/client-s3": "3.666.0",
26
+ "@aws-sdk/client-ses": "3.666.0",
27
+ "@aws-sdk/client-sqs": "3.666.0",
28
+ "@aws-sdk/client-ssm": "3.666.0",
29
+ "@aws-sdk/lib-storage": "3.666.0",
30
+ "@aws-sdk/s3-request-presigner": "3.666.0",
31
+ "@babel/preset-env": "7.25.7",
32
+ "@babel/preset-flow": "7.25.7",
33
+ "@babel/preset-typescript": "7.25.7",
34
+ "@google-cloud/bigquery": "7.9.1",
35
+ "@google-cloud/storage": "7.13.0",
36
+ "@planetscale/database": "1.19.0",
37
+ "@prisma/adapter-planetscale": "5.20.0",
38
+ "@prisma/client": "5.20.0",
39
+ "@types/jest": "29.5.13",
40
+ "@types/lodash": "4.17.10",
40
41
  "@types/node": "20.14.12",
41
42
  "babel-jest": "29.7.0",
42
43
  "jest": "29.7.0",
43
44
  "node-fetch": "3.3.2",
44
- "stream-chain": "2.2.5",
45
+ "stream-chain": "3.3.1",
45
46
  "stream-json": "1.8.0",
46
47
  "timezone-mock": "1.3.6",
47
48
  "ts-node": "10.9.2",
48
- "tslib": "2.6.3",
49
- "typescript": "5.5.4"
49
+ "tslib": "2.7.0",
50
+ "typescript": "5.6.2"
50
51
  }
51
52
  }
@@ -0,0 +1,10 @@
1
+ type PromiseChunks = {
2
+ promises: Promise<any>[];
3
+ size: number;
4
+ };
5
+ /**
6
+ * Chunk a queue of promises into controlled chunks to prevent overloading.
7
+ * https://stackoverflow.com/a/53964407
8
+ */
9
+ declare const promiseChunks: (props: PromiseChunks) => Promise<any[]>;
10
+ export default promiseChunks;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const lodash_1 = require("lodash");
4
+ /**
5
+ * Chunk a queue of promises into controlled chunks to prevent overloading.
6
+ * https://stackoverflow.com/a/53964407
7
+ */
8
+ const promiseChunks = async (props) => {
9
+ const batches = (0, lodash_1.chunk)(props.promises, props.size);
10
+ let results = [];
11
+ while (batches.length) {
12
+ const batch = batches.shift();
13
+ const result = await Promise.all(batch);
14
+ results.push(result);
15
+ }
16
+ return (0, lodash_1.flatten)(results);
17
+ };
18
+ exports.default = promiseChunks;
@@ -0,0 +1,5 @@
1
+ export declare enum State {
2
+ ERROR = "ERROR",
3
+ SUCCESS = "SUCCESS",
4
+ PROGRESS = "PROGRESS"
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.State = void 0;
4
+ var State;
5
+ (function (State) {
6
+ State["ERROR"] = "ERROR";
7
+ State["SUCCESS"] = "SUCCESS";
8
+ State["PROGRESS"] = "PROGRESS";
9
+ })(State || (exports.State = State = {}));
package/api/states.d.ts DELETED
@@ -1,9 +0,0 @@
1
- declare const states: {
2
- ERROR: string;
3
- IDLE: string;
4
- PENDING: string;
5
- SUCCESS: string;
6
- VALIDATION_ERROR: string;
7
- };
8
- export type State = typeof states.ERROR | typeof states.IDLE | typeof states.PENDING | typeof states.SUCCESS | typeof states.VALIDATION_ERROR;
9
- export default states;
package/api/states.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const states = {
4
- ERROR: 'error',
5
- IDLE: 'idle',
6
- PENDING: 'pending',
7
- SUCCESS: 'success',
8
- VALIDATION_ERROR: 'validationError',
9
- };
10
- exports.default = states;
@@ -1,2 +0,0 @@
1
- declare const unexpectedError: string;
2
- export default unexpectedError;
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const unexpectedError = 'An unexpected error occurred, please try again.';
4
- exports.default = unexpectedError;
@@ -1,7 +0,0 @@
1
- import durationComparisons from '../../date/durationComparisons';
2
- import durations from '../../date/durations';
3
- export type Cache = {
4
- duration: number;
5
- from: typeof durationComparisons.VS_MIDNIGHT | typeof durationComparisons.VS_NOW;
6
- timeframe: typeof durations.FOREVER | typeof durations.MONTHS | typeof durations.DAYS | typeof durations.HOURS | typeof durations.MINUTES;
7
- };
package/crud/actions.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export declare const actions: {
2
- CREATE: string;
3
- READ: string;
4
- UPDATE: string;
5
- DELETE: string;
6
- };
7
- export type Action = typeof actions.CREATE | typeof actions.READ | typeof actions.UPDATE | typeof actions.DELETE;
8
- export default actions;
package/crud/actions.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.actions = void 0;
4
- exports.actions = {
5
- CREATE: 'create',
6
- READ: 'read',
7
- UPDATE: 'update',
8
- DELETE: 'delete',
9
- };
10
- exports.default = exports.actions;
package/date/date.d.ts DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * A date can be either a number (YYYYMMDD), string (YYYY-MM-DD) or Date instance.
3
- */
4
- export type DateType = number | string | Date;
package/date/date.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export type Duration = {
2
- hours: number;
3
- minutes: number;
4
- seconds: number;
5
- };
package/date/duration.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- declare const durationComparisons: {
2
- VS_NOW: string;
3
- VS_MIDNIGHT: string;
4
- };
5
- export default durationComparisons;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const durationComparisons = {
4
- VS_NOW: 'vsNow',
5
- VS_MIDNIGHT: 'vsMidnight',
6
- };
7
- exports.default = durationComparisons;
@@ -1,8 +0,0 @@
1
- declare const durations: {
2
- FOREVER: string;
3
- MONTHS: string;
4
- DAYS: string;
5
- HOURS: string;
6
- MINUTES: string;
7
- };
8
- export default durations;
package/date/durations.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const durations = {
4
- FOREVER: 'forever',
5
- MONTHS: 'months',
6
- DAYS: 'days',
7
- HOURS: 'hours',
8
- MINUTES: 'minutes',
9
- };
10
- exports.default = durations;
@@ -1,4 +0,0 @@
1
- export type FinancialYear = {
2
- end: Date;
3
- start: Date;
4
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- export type FinancialYearWeekType = {
2
- end: Date;
3
- financialWeek: number;
4
- financialYear: number;
5
- start: Date;
6
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +0,0 @@
1
- export declare const predefinedTimeframes: {
2
- NONE: string;
3
- CUSTOM: string;
4
- THIS_WEEK: string;
5
- LAST_WEEK: string;
6
- };
7
- export type PredefinedTimeframes = typeof predefinedTimeframes.NONE | typeof predefinedTimeframes.CUSTOM | typeof predefinedTimeframes.LAST_WEEK | typeof predefinedTimeframes.THIS_WEEK;