@8ms/helpers 1.0.22 → 1.1.1

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 (177) hide show
  1. package/dist/api/index.d.ts +5 -4
  2. package/dist/api/index.js +7 -5
  3. package/dist/api/response.d.ts +7 -0
  4. package/dist/api/response.js +9 -0
  5. package/dist/api/states.d.ts +8 -0
  6. package/dist/api/states.js +10 -0
  7. package/dist/api/unexpectedError.d.ts +1 -0
  8. package/dist/api/unexpectedError.js +4 -0
  9. package/dist/array/tests/contains.test.d.ts +1 -0
  10. package/dist/array/tests/contains.test.js +18 -0
  11. package/dist/atInternet/index.d.ts +1 -1
  12. package/dist/atInternet/{types.d.ts → request.d.ts} +0 -0
  13. package/dist/{api/types.js → atInternet/request.js} +0 -0
  14. package/dist/aws/athenaExpress/getClient.d.ts +2 -2
  15. package/dist/aws/{types.d.ts → config.d.ts} +1 -1
  16. package/dist/{atInternet/types.js → aws/config.js} +0 -0
  17. package/dist/aws/getConfig.d.ts +2 -2
  18. package/dist/aws/glue/getClient.d.ts +2 -2
  19. package/dist/aws/index.d.ts +2 -2
  20. package/dist/aws/lambda/getClient.d.ts +2 -2
  21. package/dist/aws/s3/deleteDirectory.js +1 -1
  22. package/dist/aws/s3/getClient.d.ts +2 -2
  23. package/dist/aws/s3/getSignedUrl.d.ts +2 -2
  24. package/dist/aws/s3/getSignedUrl.js +17 -6
  25. package/dist/aws/s3/listFiles.js +1 -1
  26. package/dist/aws/s3/listFolders.js +1 -1
  27. package/dist/aws/s3/readFile.js +1 -1
  28. package/dist/aws/s3/writePresignedPost.d.ts +4 -4
  29. package/dist/aws/s3/writePresignedPost.js +14 -3
  30. package/dist/aws/s3cache/cache.d.ts +6 -0
  31. package/dist/aws/s3cache/{types.js → cache.js} +0 -0
  32. package/dist/aws/s3cache/getCache.d.ts +2 -2
  33. package/dist/aws/s3cache/getKey.d.ts +2 -2
  34. package/dist/aws/s3cache/index.d.ts +2 -2
  35. package/dist/aws/s3cache/saveCache.d.ts +2 -2
  36. package/dist/aws/s3cache/updateCache.d.ts +2 -2
  37. package/dist/aws/ses/SimpleEmail.d.ts +2 -2
  38. package/dist/aws/ses/SimpleEmail.js +7 -7
  39. package/dist/aws/ses/getClient.d.ts +2 -2
  40. package/dist/aws/ssm/getClient.d.ts +2 -2
  41. package/dist/axios/get.d.ts +6 -1
  42. package/dist/axios/get.js +1 -1
  43. package/dist/axios/index.d.ts +2 -3
  44. package/dist/axios/post.d.ts +7 -1
  45. package/dist/axios/post.js +1 -1
  46. package/dist/crud/index.d.ts +3 -4
  47. package/dist/crud/index.js +3 -3
  48. package/dist/crud/states.d.ts +7 -0
  49. package/dist/crud/{constants.js → states.js} +2 -2
  50. package/dist/date/date.d.ts +4 -0
  51. package/dist/{aws/types.js → date/date.js} +0 -0
  52. package/dist/date/duration.d.ts +5 -0
  53. package/dist/{axios/types.js → date/duration.js} +0 -0
  54. package/dist/date/durationComparisons.d.ts +4 -0
  55. package/dist/date/durationComparisons.js +7 -0
  56. package/dist/date/durations.d.ts +7 -0
  57. package/dist/date/durations.js +10 -0
  58. package/dist/date/financialYear.d.ts +4 -0
  59. package/dist/{crud/types.js → date/financialYear.js} +0 -0
  60. package/dist/date/financialYearWeek.d.ts +6 -0
  61. package/dist/date/{types.js → financialYearWeek.js} +0 -0
  62. package/dist/date/format.d.ts +1 -1
  63. package/dist/date/getDate.d.ts +1 -1
  64. package/dist/date/getFinancialYear.d.ts +1 -1
  65. package/dist/date/getFinancialYearToDate.d.ts +1 -1
  66. package/dist/date/getFinancialYearWeeks.d.ts +1 -1
  67. package/dist/date/getLastWeek.d.ts +1 -1
  68. package/dist/date/getMax.d.ts +1 -1
  69. package/dist/date/getMin.d.ts +1 -1
  70. package/dist/date/getMonday.d.ts +1 -1
  71. package/dist/date/getNumber.d.ts +1 -1
  72. package/dist/date/getPredefinedTimeframe.d.ts +3 -2
  73. package/dist/date/getPredefinedTimeframe.js +4 -4
  74. package/dist/date/getSunday.d.ts +1 -1
  75. package/dist/date/getThisWeek.d.ts +1 -1
  76. package/dist/date/getTwoWeeksAgo.d.ts +1 -1
  77. package/dist/date/getWeeksAgo.d.ts +1 -1
  78. package/dist/date/index.d.ts +11 -4
  79. package/dist/date/index.js +9 -6
  80. package/dist/date/isLastWeek.d.ts +1 -1
  81. package/dist/date/isThisWeek.d.ts +1 -1
  82. package/dist/date/predefinedTimeframes.d.ts +7 -0
  83. package/dist/date/predefinedTimeframes.js +9 -0
  84. package/dist/date/timeframe.d.ts +8 -0
  85. package/dist/{environment/types.js → date/timeframe.js} +0 -0
  86. package/dist/date/timeframes.d.ts +4 -0
  87. package/dist/date/timeframes.js +7 -0
  88. package/dist/environment/environments.d.ts +6 -0
  89. package/dist/environment/{constants.js → environments.js} +2 -6
  90. package/dist/environment/getEnvironment.d.ts +4 -3
  91. package/dist/environment/getEnvironment.js +4 -4
  92. package/dist/environment/index.d.ts +4 -4
  93. package/dist/environment/index.js +5 -4
  94. package/dist/environment/isAws.d.ts +2 -2
  95. package/dist/environment/isAws.js +2 -2
  96. package/dist/environment/isDevelopment.d.ts +2 -2
  97. package/dist/environment/isDevelopment.js +2 -2
  98. package/dist/environment/isLocalhost.d.ts +2 -2
  99. package/dist/environment/isProduction.d.ts +2 -2
  100. package/dist/environment/isProduction.js +2 -2
  101. package/dist/environment/isStaging.d.ts +2 -2
  102. package/dist/environment/isStaging.js +2 -2
  103. package/dist/environment/isVercel.d.ts +2 -2
  104. package/dist/environment/isVercel.js +2 -2
  105. package/dist/environment/platforms.d.ts +5 -0
  106. package/dist/environment/platforms.js +7 -0
  107. package/dist/eskimi/accessToken.d.ts +9 -0
  108. package/dist/eskimi/{types.js → accessToken.js} +0 -0
  109. package/dist/eskimi/ageGroups.d.ts +4 -0
  110. package/dist/eskimi/ageGroups.js +41 -0
  111. package/dist/eskimi/{types.d.ts → campaign.d.ts} +0 -0
  112. package/dist/{google/types.js → eskimi/campaign.js} +0 -0
  113. package/dist/eskimi/devices.d.ts +4 -0
  114. package/dist/eskimi/devices.js +13 -0
  115. package/dist/eskimi/{constants.d.ts → endpoints.d.ts} +1 -13
  116. package/dist/eskimi/endpoints.js +18 -0
  117. package/dist/eskimi/genders.d.ts +4 -0
  118. package/dist/eskimi/genders.js +13 -0
  119. package/dist/eskimi/getAccessToken.d.ts +1 -9
  120. package/dist/eskimi/getAgeGroup.js +2 -2
  121. package/dist/eskimi/getDevice.js +2 -2
  122. package/dist/eskimi/getGender.js +2 -2
  123. package/dist/eskimi/index.d.ts +8 -4
  124. package/dist/eskimi/index.js +9 -6
  125. package/dist/google/getCredentials.d.ts +18 -1
  126. package/dist/google/index.d.ts +2 -3
  127. package/dist/google/sheets/getAuth.d.ts +1 -1
  128. package/dist/google/sheets/getAuth.js +5 -2
  129. package/dist/googleAds/{types.d.ts → client.d.ts} +0 -0
  130. package/dist/googleAds/{types.js → client.js} +0 -0
  131. package/dist/googleAds/getClient.d.ts +3 -3
  132. package/dist/googleAds/index.d.ts +1 -1
  133. package/dist/myTarget/getAccessToken.d.ts +2 -2
  134. package/dist/nextAuth/index.d.ts +2 -2
  135. package/dist/nextAuth/index.js +3 -3
  136. package/dist/nextAuth/{constants.d.ts → states.d.ts} +1 -1
  137. package/dist/nextAuth/{constants.js → states.js} +2 -2
  138. package/dist/number/getNumber.d.ts +1 -1
  139. package/dist/number/getNumber.js +15 -4
  140. package/dist/number/tests/getNumber.test.d.ts +1 -0
  141. package/dist/number/tests/getNumber.test.js +21 -0
  142. package/dist/snapchat/getAccessToken.d.ts +2 -2
  143. package/dist/string/getCleanFolder.d.ts +3 -1
  144. package/dist/string/getCleanFolder.js +5 -2
  145. package/dist/string/getStringFromStream.d.ts +3 -1
  146. package/dist/string/getStringFromStream.js +2 -1
  147. package/dist/string/tests/getCleanFolder.test.js +1 -1
  148. package/dist/url/buildUrl.d.ts +3 -3
  149. package/dist/url/index.d.ts +1 -1
  150. package/dist/url/{types.d.ts → url.d.ts} +0 -0
  151. package/dist/url/{types.js → url.js} +0 -0
  152. package/dist/util/defaultTo.d.ts +3 -0
  153. package/dist/util/defaultTo.js +1 -1
  154. package/dist/util/tests/defaultTo.test.d.ts +1 -0
  155. package/dist/util/tests/defaultTo.test.js +27 -0
  156. package/dist/webWorker/index.d.ts +3 -4
  157. package/dist/webWorker/index.js +3 -3
  158. package/dist/webWorker/states.d.ts +6 -0
  159. package/dist/webWorker/{constant.js → states.js} +2 -2
  160. package/package.json +4 -4
  161. package/dist/api/constants.d.ts +0 -10
  162. package/dist/api/constants.js +0 -16
  163. package/dist/api/types.d.ts +0 -7
  164. package/dist/aws/s3cache/types.d.ts +0 -6
  165. package/dist/axios/types.d.ts +0 -13
  166. package/dist/crud/constants.d.ts +0 -6
  167. package/dist/crud/types.d.ts +0 -2
  168. package/dist/date/constants.d.ts +0 -21
  169. package/dist/date/constants.js +0 -24
  170. package/dist/date/types.d.ts +0 -28
  171. package/dist/environment/constants.d.ts +0 -9
  172. package/dist/environment/types.d.ts +0 -3
  173. package/dist/eskimi/constants.js +0 -76
  174. package/dist/google/types.d.ts +0 -18
  175. package/dist/webWorker/constant.d.ts +0 -5
  176. package/dist/webWorker/types.d.ts +0 -2
  177. package/dist/webWorker/types.js +0 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
- "version": "1.0.22",
3
+ "version": "1.1.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
@@ -24,12 +24,12 @@
24
24
  "@babel/preset-flow": "7.16.7",
25
25
  "@babel/preset-typescript": "7.16.7",
26
26
  "@types/jest": "27.4.1",
27
- "@types/lodash": "4.14.180",
28
- "@types/node": "17.0.21",
27
+ "@types/lodash": "4.14.181",
28
+ "@types/node": "17.0.23",
29
29
  "babel-jest": "27.5.1",
30
30
  "jest": "27.5.1",
31
31
  "ts-node": "10.7.0",
32
32
  "tslib": "2.3.1",
33
- "typescript": "4.6.2"
33
+ "typescript": "4.6.3"
34
34
  }
35
35
  }
@@ -1,10 +0,0 @@
1
- import { ApiResponseType } from './types';
2
- export declare const ApiStatus: {
3
- ERROR: string;
4
- IDLE: string;
5
- PENDING: string;
6
- SUCCESS: string;
7
- VALIDATION_ERROR: string;
8
- };
9
- export declare const ApiPlaceholder: ApiResponseType;
10
- export declare const UnexpectedError: string;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnexpectedError = exports.ApiPlaceholder = exports.ApiStatus = void 0;
4
- exports.ApiStatus = {
5
- ERROR: 'error',
6
- IDLE: 'idle',
7
- PENDING: 'pending',
8
- SUCCESS: 'success',
9
- VALIDATION_ERROR: 'validationError',
10
- };
11
- exports.ApiPlaceholder = {
12
- body: null,
13
- error: null,
14
- status: exports.ApiStatus.IDLE,
15
- };
16
- exports.UnexpectedError = 'An unexpected error occurred, please try again.';
@@ -1,7 +0,0 @@
1
- import { ApiStatus } from './constants';
2
- export declare type ApiResponseType = {
3
- body: any | null;
4
- error: string | null;
5
- status: ApiStatusType;
6
- };
7
- export declare type ApiStatusType = typeof ApiStatus.ERROR | typeof ApiStatus.IDLE | typeof ApiStatus.PENDING | typeof ApiStatus.SUCCESS | typeof ApiStatus.VALIDATION_ERROR;
@@ -1,6 +0,0 @@
1
- import { Duration, DurationComparison } from '../../date';
2
- export declare type CacheExpiresType = {
3
- duration: number;
4
- from: typeof DurationComparison.VS_MIDNIGHT | typeof DurationComparison.VS_NOW;
5
- timeframe: typeof Duration.FOREVER | typeof Duration.MONTHS | typeof Duration.DAYS | typeof Duration.HOURS | typeof Duration.MINUTES;
6
- };
@@ -1,13 +0,0 @@
1
- export declare type GetType = {
2
- config?: object;
3
- onError?: Function;
4
- onSuccess?: Function;
5
- url: string;
6
- };
7
- export declare type PostType = {
8
- config?: object;
9
- data?: object;
10
- onError?: Function;
11
- onSuccess?: Function;
12
- url: string;
13
- };
@@ -1,6 +0,0 @@
1
- export declare const CrudStatus: {
2
- CREATE: string;
3
- READ: string;
4
- UPDATE: string;
5
- DELETE: string;
6
- };
@@ -1,2 +0,0 @@
1
- import { CrudStatus } from './constants';
2
- export declare type CrudType = typeof CrudStatus.CREATE | typeof CrudStatus.READ | typeof CrudStatus.UPDATE | typeof CrudStatus.DELETE;
@@ -1,21 +0,0 @@
1
- export declare const Duration: {
2
- FOREVER: string;
3
- MONTHS: string;
4
- DAYS: string;
5
- HOURS: string;
6
- MINUTES: string;
7
- };
8
- export declare const DurationComparison: {
9
- VS_NOW: string;
10
- VS_MIDNIGHT: string;
11
- };
12
- export declare const Timeframe: {
13
- CURRENT: string;
14
- COMPARISON: string;
15
- };
16
- export declare const TimeframePredefined: {
17
- NONE: string;
18
- CUSTOM: string;
19
- THIS_WEEK: string;
20
- LAST_WEEK: string;
21
- };
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TimeframePredefined = exports.Timeframe = exports.DurationComparison = exports.Duration = void 0;
4
- exports.Duration = {
5
- FOREVER: 'forever',
6
- MONTHS: 'months',
7
- DAYS: 'days',
8
- HOURS: 'hours',
9
- MINUTES: 'minutes',
10
- };
11
- exports.DurationComparison = {
12
- VS_NOW: 'vsNow',
13
- VS_MIDNIGHT: 'vsMidnight',
14
- };
15
- exports.Timeframe = {
16
- CURRENT: 'current',
17
- COMPARISON: 'comparison',
18
- };
19
- exports.TimeframePredefined = {
20
- NONE: 'none',
21
- CUSTOM: 'custom',
22
- THIS_WEEK: 'thisWeek',
23
- LAST_WEEK: 'lastWeek',
24
- };
@@ -1,28 +0,0 @@
1
- import { TimeframePredefined } from './constants';
2
- /**
3
- * A date can be either a number (YYYYMMDD), string (YYYY-MM-DD) or Date instance.
4
- */
5
- export declare type DateType = number | string | Date;
6
- export declare type FinancialYearType = {
7
- end: Date;
8
- start: Date;
9
- };
10
- export declare type FinancialYearWeekType = {
11
- end: Date;
12
- financialWeek: number;
13
- financialYear: number;
14
- start: Date;
15
- };
16
- /**
17
- * A timeframe has a start and an end date.
18
- */
19
- export declare type TimeframeType = {
20
- end: DateType;
21
- start: DateType;
22
- };
23
- export declare type DurationType = {
24
- hours: number;
25
- minutes: number;
26
- seconds: number;
27
- };
28
- export declare type TimeframePredefinedType = typeof TimeframePredefined.NONE | typeof TimeframePredefined.CUSTOM | typeof TimeframePredefined.LAST_WEEK | typeof TimeframePredefined.THIS_WEEK;
@@ -1,9 +0,0 @@
1
- export declare const Environment: {
2
- DEVELOPMENT: string;
3
- STAGING: string;
4
- PRODUCTION: string;
5
- };
6
- export declare const Platform: {
7
- AWS: string;
8
- VERCEL: string;
9
- };
@@ -1,3 +0,0 @@
1
- import { Environment, Platform } from './constants';
2
- export declare type EnvironmentType = typeof Environment.DEVELOPMENT | typeof Environment.STAGING | typeof Environment.PRODUCTION;
3
- export declare type PlatformType = typeof Platform.AWS | typeof Platform.VERCEL;
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Genders = exports.Devices = exports.AgeGroups = exports.Endpoints = void 0;
4
- /**
5
- * https://dsp-api.eskimi.com/docs/api/v1/#api-Report-GetCampaignReportByAgeGroups
6
- */
7
- exports.Endpoints = {
8
- campaign: {
9
- age: 'https://dsp-api.eskimi.com/api/v1/report/ageGroups/get',
10
- gender: 'https://dsp-api.eskimi.com/api/v1/report/genders/get',
11
- list: 'https://dsp-api.eskimi.com/api/v1/campaign/get',
12
- performance: 'https://dsp-api.eskimi.com/api/v1/report/campaigns/get',
13
- video: 'https://dsp-api.eskimi.com/api/v1/report/videoCampaigns/get',
14
- },
15
- site: {
16
- list: 'https://dsp-api.eskimi.com/api/v1/report/sites/get',
17
- },
18
- };
19
- exports.AgeGroups = [
20
- {
21
- "id": 0,
22
- "name": "0-17",
23
- },
24
- {
25
- "id": 1,
26
- "name": "18-24",
27
- },
28
- {
29
- "id": 2,
30
- "name": "25-29",
31
- },
32
- {
33
- "id": 3,
34
- "name": "30-34",
35
- },
36
- {
37
- "id": 4,
38
- "name": "35-39",
39
- },
40
- {
41
- "id": 5,
42
- "name": "40-44",
43
- },
44
- {
45
- "id": 6,
46
- "name": "45-54",
47
- },
48
- {
49
- "id": 7,
50
- "name": "55-64",
51
- },
52
- {
53
- "id": 8,
54
- "name": "65+",
55
- },
56
- ];
57
- exports.Devices = [
58
- {
59
- "id": 2,
60
- "name": "Personal Computer",
61
- },
62
- {
63
- "id": 3,
64
- "name": "Connected TV",
65
- },
66
- ];
67
- exports.Genders = [
68
- {
69
- "id": 1,
70
- "name": "Male",
71
- },
72
- {
73
- "id": 2,
74
- "name": "Female",
75
- },
76
- ];
@@ -1,18 +0,0 @@
1
- import { AwsConfigType } from '../aws';
2
- export declare type GetCredentialsType = {
3
- SsmLib: any;
4
- awsConfig: AwsConfigType;
5
- parameterName: string;
6
- };
7
- export declare type CredentialsType = {
8
- type: string;
9
- project_id: string;
10
- private_key_id: string;
11
- private_key: string;
12
- client_email: string;
13
- client_id: string;
14
- auth_uri: string;
15
- token_uri: string;
16
- auth_provider_x509_cert_url: string;
17
- client_x509_cert_url: string;
18
- };
@@ -1,5 +0,0 @@
1
- export declare const WebWorkerData: {
2
- ERROR: string;
3
- SUCCESS: string;
4
- PROGRESS: string;
5
- };
@@ -1,2 +0,0 @@
1
- import { WebWorkerData } from './constant';
2
- export declare type WebWorkerDataType = typeof WebWorkerData.SUCCESS | typeof WebWorkerData.ERROR | typeof WebWorkerData.PROGRESS;
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });