@8ms/helpers 1.0.23 → 1.1.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 (155) 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/aws/athenaExpress/getClient.d.ts +2 -2
  10. package/dist/aws/{types.d.ts → config.d.ts} +1 -1
  11. package/dist/{api/types.js → aws/config.js} +0 -0
  12. package/dist/aws/getConfig.d.ts +2 -2
  13. package/dist/aws/glue/getClient.d.ts +2 -2
  14. package/dist/aws/index.d.ts +2 -2
  15. package/dist/aws/lambda/getClient.d.ts +2 -2
  16. package/dist/aws/s3/getClient.d.ts +2 -2
  17. package/dist/aws/s3/getSignedUrl.d.ts +2 -2
  18. package/dist/aws/s3/getSignedUrl.js +17 -6
  19. package/dist/aws/s3/writePresignedPost.d.ts +4 -4
  20. package/dist/aws/s3/writePresignedPost.js +14 -3
  21. package/dist/aws/s3cache/cache.d.ts +6 -0
  22. package/dist/aws/s3cache/{types.js → cache.js} +0 -0
  23. package/dist/aws/s3cache/getCache.d.ts +2 -2
  24. package/dist/aws/s3cache/getKey.d.ts +2 -2
  25. package/dist/aws/s3cache/index.d.ts +2 -2
  26. package/dist/aws/s3cache/saveCache.d.ts +2 -2
  27. package/dist/aws/s3cache/updateCache.d.ts +2 -2
  28. package/dist/aws/ses/SimpleEmail.d.ts +2 -2
  29. package/dist/aws/ses/SimpleEmail.js +7 -7
  30. package/dist/aws/ses/getClient.d.ts +2 -2
  31. package/dist/aws/ssm/getClient.d.ts +2 -2
  32. package/dist/axios/get.d.ts +6 -1
  33. package/dist/axios/get.js +1 -1
  34. package/dist/axios/index.d.ts +2 -3
  35. package/dist/axios/post.d.ts +7 -1
  36. package/dist/axios/post.js +1 -1
  37. package/dist/crud/index.d.ts +3 -4
  38. package/dist/crud/index.js +3 -3
  39. package/dist/crud/states.d.ts +7 -0
  40. package/dist/crud/{constants.js → states.js} +2 -2
  41. package/dist/date/date.d.ts +4 -0
  42. package/dist/{aws/types.js → date/date.js} +0 -0
  43. package/dist/date/duration.d.ts +5 -0
  44. package/dist/{axios/types.js → date/duration.js} +0 -0
  45. package/dist/date/durationComparisons.d.ts +4 -0
  46. package/dist/date/durationComparisons.js +7 -0
  47. package/dist/date/durations.d.ts +7 -0
  48. package/dist/date/durations.js +10 -0
  49. package/dist/date/financialYear.d.ts +4 -0
  50. package/dist/{crud/types.js → date/financialYear.js} +0 -0
  51. package/dist/date/financialYearWeek.d.ts +6 -0
  52. package/dist/date/{types.js → financialYearWeek.js} +0 -0
  53. package/dist/date/format.d.ts +1 -1
  54. package/dist/date/getDate.d.ts +1 -1
  55. package/dist/date/getFinancialYear.d.ts +1 -1
  56. package/dist/date/getFinancialYearToDate.d.ts +1 -1
  57. package/dist/date/getFinancialYearWeeks.d.ts +1 -1
  58. package/dist/date/getLastWeek.d.ts +1 -1
  59. package/dist/date/getMax.d.ts +1 -1
  60. package/dist/date/getMin.d.ts +1 -1
  61. package/dist/date/getMonday.d.ts +1 -1
  62. package/dist/date/getNumber.d.ts +1 -1
  63. package/dist/date/getPredefinedTimeframe.d.ts +3 -2
  64. package/dist/date/getPredefinedTimeframe.js +4 -4
  65. package/dist/date/getSunday.d.ts +1 -1
  66. package/dist/date/getThisWeek.d.ts +1 -1
  67. package/dist/date/getTwoWeeksAgo.d.ts +1 -1
  68. package/dist/date/getWeeksAgo.d.ts +1 -1
  69. package/dist/date/index.d.ts +11 -4
  70. package/dist/date/index.js +9 -6
  71. package/dist/date/isLastWeek.d.ts +1 -1
  72. package/dist/date/isThisWeek.d.ts +1 -1
  73. package/dist/date/predefinedTimeframes.d.ts +7 -0
  74. package/dist/date/predefinedTimeframes.js +9 -0
  75. package/dist/date/timeframe.d.ts +8 -0
  76. package/dist/{environment/types.js → date/timeframe.js} +0 -0
  77. package/dist/date/timeframes.d.ts +4 -0
  78. package/dist/date/timeframes.js +7 -0
  79. package/dist/environment/environments.d.ts +6 -0
  80. package/dist/environment/{constants.js → environments.js} +2 -6
  81. package/dist/environment/getEnvironment.d.ts +4 -3
  82. package/dist/environment/getEnvironment.js +4 -4
  83. package/dist/environment/index.d.ts +4 -4
  84. package/dist/environment/index.js +5 -4
  85. package/dist/environment/isAws.d.ts +2 -2
  86. package/dist/environment/isAws.js +2 -2
  87. package/dist/environment/isDevelopment.d.ts +2 -2
  88. package/dist/environment/isDevelopment.js +2 -2
  89. package/dist/environment/isLocalhost.d.ts +2 -2
  90. package/dist/environment/isProduction.d.ts +2 -2
  91. package/dist/environment/isProduction.js +2 -2
  92. package/dist/environment/isStaging.d.ts +2 -2
  93. package/dist/environment/isStaging.js +2 -2
  94. package/dist/environment/isVercel.d.ts +2 -2
  95. package/dist/environment/isVercel.js +2 -2
  96. package/dist/environment/platforms.d.ts +5 -0
  97. package/dist/environment/platforms.js +7 -0
  98. package/dist/eskimi/accessToken.d.ts +9 -0
  99. package/dist/eskimi/{types.js → accessToken.js} +0 -0
  100. package/dist/eskimi/ageGroups.d.ts +4 -0
  101. package/dist/eskimi/ageGroups.js +41 -0
  102. package/dist/eskimi/{types.d.ts → campaign.d.ts} +0 -0
  103. package/dist/{google/types.js → eskimi/campaign.js} +0 -0
  104. package/dist/eskimi/devices.d.ts +4 -0
  105. package/dist/eskimi/devices.js +13 -0
  106. package/dist/eskimi/{constants.d.ts → endpoints.d.ts} +1 -13
  107. package/dist/eskimi/endpoints.js +18 -0
  108. package/dist/eskimi/genders.d.ts +4 -0
  109. package/dist/eskimi/genders.js +13 -0
  110. package/dist/eskimi/getAccessToken.d.ts +1 -9
  111. package/dist/eskimi/getAgeGroup.js +2 -2
  112. package/dist/eskimi/getDevice.js +2 -2
  113. package/dist/eskimi/getGender.js +2 -2
  114. package/dist/eskimi/index.d.ts +8 -4
  115. package/dist/eskimi/index.js +9 -6
  116. package/dist/google/getCredentials.d.ts +18 -1
  117. package/dist/google/index.d.ts +2 -3
  118. package/dist/google/sheets/getAuth.d.ts +1 -1
  119. package/dist/google/sheets/getAuth.js +5 -2
  120. package/dist/googleAds/{types.d.ts → client.d.ts} +0 -0
  121. package/dist/googleAds/{types.js → client.js} +0 -0
  122. package/dist/googleAds/getClient.d.ts +3 -3
  123. package/dist/googleAds/index.d.ts +1 -1
  124. package/dist/myTarget/getAccessToken.d.ts +2 -2
  125. package/dist/nextAuth/{constants.d.ts → authStates.d.ts} +1 -1
  126. package/dist/nextAuth/{constants.js → authStates.js} +2 -2
  127. package/dist/nextAuth/index.d.ts +2 -2
  128. package/dist/nextAuth/index.js +3 -3
  129. package/dist/snapchat/getAccessToken.d.ts +2 -2
  130. package/dist/url/buildUrl.d.ts +3 -3
  131. package/dist/url/index.d.ts +1 -1
  132. package/dist/url/{types.d.ts → url.d.ts} +0 -0
  133. package/dist/url/{types.js → url.js} +0 -0
  134. package/dist/webWorker/index.d.ts +3 -4
  135. package/dist/webWorker/index.js +3 -3
  136. package/dist/webWorker/states.d.ts +6 -0
  137. package/dist/webWorker/{constant.js → states.js} +2 -2
  138. package/package.json +1 -1
  139. package/dist/api/constants.d.ts +0 -10
  140. package/dist/api/constants.js +0 -16
  141. package/dist/api/types.d.ts +0 -7
  142. package/dist/aws/s3cache/types.d.ts +0 -6
  143. package/dist/axios/types.d.ts +0 -13
  144. package/dist/crud/constants.d.ts +0 -6
  145. package/dist/crud/types.d.ts +0 -2
  146. package/dist/date/constants.d.ts +0 -21
  147. package/dist/date/constants.js +0 -24
  148. package/dist/date/types.d.ts +0 -28
  149. package/dist/environment/constants.d.ts +0 -9
  150. package/dist/environment/types.d.ts +0 -3
  151. package/dist/eskimi/constants.js +0 -76
  152. package/dist/google/types.d.ts +0 -18
  153. package/dist/webWorker/constant.d.ts +0 -5
  154. package/dist/webWorker/types.d.ts +0 -2
  155. package/dist/webWorker/types.js +0 -2
@@ -1,4 +1,5 @@
1
- import { ApiPlaceholder, ApiStatus, UnexpectedError } from './constants';
2
- import { ApiResponseType } from './types';
3
- export type { ApiResponseType, };
4
- export { ApiPlaceholder, ApiStatus, UnexpectedError, };
1
+ import { response, ResponseType } from './response';
2
+ import { states, StateType } from './states';
3
+ import { unexpectedError } from './unexpectedError';
4
+ export type { ResponseType, StateType, };
5
+ export { response, states, unexpectedError, };
package/dist/api/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnexpectedError = exports.ApiStatus = exports.ApiPlaceholder = void 0;
4
- var constants_1 = require("./constants");
5
- Object.defineProperty(exports, "ApiPlaceholder", { enumerable: true, get: function () { return constants_1.ApiPlaceholder; } });
6
- Object.defineProperty(exports, "ApiStatus", { enumerable: true, get: function () { return constants_1.ApiStatus; } });
7
- Object.defineProperty(exports, "UnexpectedError", { enumerable: true, get: function () { return constants_1.UnexpectedError; } });
3
+ exports.unexpectedError = exports.states = exports.response = void 0;
4
+ var response_1 = require("./response");
5
+ Object.defineProperty(exports, "response", { enumerable: true, get: function () { return response_1.response; } });
6
+ var states_1 = require("./states");
7
+ Object.defineProperty(exports, "states", { enumerable: true, get: function () { return states_1.states; } });
8
+ var unexpectedError_1 = require("./unexpectedError");
9
+ Object.defineProperty(exports, "unexpectedError", { enumerable: true, get: function () { return unexpectedError_1.unexpectedError; } });
@@ -0,0 +1,7 @@
1
+ import { StateType } from './states';
2
+ export declare type ResponseType = {
3
+ body: any | null;
4
+ error: string | null;
5
+ status: StateType;
6
+ };
7
+ export declare const response: ResponseType;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.response = void 0;
4
+ var states_1 = require("./states");
5
+ exports.response = {
6
+ body: null,
7
+ error: null,
8
+ status: states_1.states.IDLE,
9
+ };
@@ -0,0 +1,8 @@
1
+ export declare const states: {
2
+ ERROR: string;
3
+ IDLE: string;
4
+ PENDING: string;
5
+ SUCCESS: string;
6
+ VALIDATION_ERROR: string;
7
+ };
8
+ export declare type StateType = typeof states.ERROR | typeof states.IDLE | typeof states.PENDING | typeof states.SUCCESS | typeof states.VALIDATION_ERROR;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.states = void 0;
4
+ exports.states = {
5
+ ERROR: 'error',
6
+ IDLE: 'idle',
7
+ PENDING: 'pending',
8
+ SUCCESS: 'success',
9
+ VALIDATION_ERROR: 'validationError',
10
+ };
@@ -0,0 +1 @@
1
+ export declare const unexpectedError: string;
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unexpectedError = void 0;
4
+ exports.unexpectedError = 'An unexpected error occurred, please try again.';
@@ -1,9 +1,9 @@
1
- import { AwsConfigType } from '../types';
1
+ import { ConfigType } from '../config';
2
2
  declare type GetClientType = {
3
3
  AthenaExpress: any;
4
4
  AwsSdk: any;
5
5
  athenaS3: string;
6
- config: AwsConfigType;
6
+ config: ConfigType;
7
7
  database: string;
8
8
  };
9
9
  /**
@@ -1,4 +1,4 @@
1
- export declare type AwsConfigType = {
1
+ export declare type ConfigType = {
2
2
  accessKeyId: string;
3
3
  region: string;
4
4
  secretAccessKey: string;
File without changes
@@ -1,9 +1,9 @@
1
- import { AwsConfigType } from './types';
1
+ import { ConfigType } from './config';
2
2
  /**
3
3
  * The config must be in a specific structure, if the properties aren't defined don't specify them as they could be inferred (e.g. Lambda).
4
4
  */
5
5
  declare const getConfig: ({ config, isAthenaExpress }: {
6
- config: AwsConfigType;
6
+ config: ConfigType;
7
7
  isAthenaExpress: boolean;
8
8
  }) => object;
9
9
  export default getConfig;
@@ -1,10 +1,10 @@
1
- import { AwsConfigType } from '../types';
1
+ import { ConfigType } from '../config';
2
2
  /**
3
3
  * Shorthand function to get the Glue Client.
4
4
  * Library: @aws-sdk/client-glue
5
5
  */
6
6
  declare const getClient: ({ GlueLib, config }: {
7
7
  GlueLib: any;
8
- config: AwsConfigType;
8
+ config: ConfigType;
9
9
  }) => any;
10
10
  export default getClient;
@@ -1,4 +1,4 @@
1
1
  import isResponse200 from './isResponse200';
2
- import { AwsConfigType } from './types';
3
- export type { AwsConfigType, };
2
+ import { ConfigType } from './config';
3
+ export type { ConfigType, };
4
4
  export { isResponse200, };
@@ -1,10 +1,10 @@
1
- import { AwsConfigType } from '../types';
1
+ import { ConfigType } from '../config';
2
2
  /**
3
3
  * Shorthand function to get the Lambda Client.
4
4
  * Library: @aws-sdk/client-lambda
5
5
  */
6
6
  declare const getClient: ({ LambdaLib, config }: {
7
7
  LambdaLib: any;
8
- config: AwsConfigType;
8
+ config: ConfigType;
9
9
  }) => any;
10
10
  export default getClient;
@@ -1,10 +1,10 @@
1
- import { AwsConfigType } from '../types';
1
+ import { ConfigType } from '../config';
2
2
  /**
3
3
  * Shorthand function to get the S3 Client.
4
4
  * Library: @aws-sdk/client-s3
5
5
  */
6
6
  declare const getClient: ({ S3Lib, config }: {
7
7
  S3Lib: any;
8
- config: AwsConfigType;
8
+ config: ConfigType;
9
9
  }) => any;
10
10
  export default getClient;
@@ -1,4 +1,4 @@
1
- import { ApiResponseType } from '../../api';
1
+ import { ResponseType } from '../../api';
2
2
  declare type GetSignedUrlType = {
3
3
  S3Lib: any;
4
4
  S3PresignerLib: any;
@@ -11,5 +11,5 @@ declare type GetSignedUrlType = {
11
11
  * Returns a signed for URL to allow download of private buckets for a given duration.
12
12
  * Library: @aws-sdk/s3-request-presigner
13
13
  */
14
- declare const getSignedUrl: ({ S3Lib, S3PresignerLib, bucket, client, expires, file }: GetSignedUrlType) => Promise<ApiResponseType>;
14
+ declare const getSignedUrl: ({ S3Lib, S3PresignerLib, bucket, client, expires, file }: GetSignedUrlType) => Promise<ResponseType>;
15
15
  export default getSignedUrl;
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -44,11 +55,11 @@ var api_1 = require("../../api");
44
55
  var getSignedUrl = function (_a) {
45
56
  var S3Lib = _a.S3Lib, S3PresignerLib = _a.S3PresignerLib, bucket = _a.bucket, client = _a.client, expires = _a.expires, file = _a.file;
46
57
  return __awaiter(void 0, void 0, void 0, function () {
47
- var response, GetObjectCommand, getSignedUrl, command, apiResponse;
58
+ var response, GetObjectCommand, getSignedUrl, command, awsResponse;
48
59
  return __generator(this, function (_b) {
49
60
  switch (_b.label) {
50
61
  case 0:
51
- response = api_1.ApiPlaceholder;
62
+ response = __assign({}, api_1.response);
52
63
  GetObjectCommand = S3Lib.GetObjectCommand;
53
64
  getSignedUrl = S3PresignerLib.getSignedUrl;
54
65
  command = new GetObjectCommand({
@@ -57,10 +68,10 @@ var getSignedUrl = function (_a) {
57
68
  });
58
69
  return [4 /*yield*/, getSignedUrl(client, command, { expiresIn: expires })];
59
70
  case 1:
60
- apiResponse = _b.sent();
61
- if (apiResponse && 'string' === typeof apiResponse) {
62
- response.status = api_1.ApiStatus.SUCCESS;
63
- response.body = apiResponse;
71
+ awsResponse = _b.sent();
72
+ if (awsResponse && 'string' === typeof awsResponse) {
73
+ response.status = api_1.states.SUCCESS;
74
+ response.body = awsResponse;
64
75
  }
65
76
  return [2 /*return*/, response];
66
77
  }
@@ -1,8 +1,8 @@
1
- import { ApiResponseType } from '../../api';
2
- import { AwsConfigType } from '../types';
1
+ import { ResponseType } from '../../api';
2
+ import { ConfigType } from '../config';
3
3
  declare type WritePresignedPostType = {
4
4
  bucket: string;
5
- config: AwsConfigType;
5
+ config: ConfigType;
6
6
  fields: any;
7
7
  file: any;
8
8
  fileName: string;
@@ -11,5 +11,5 @@ declare type WritePresignedPostType = {
11
11
  /**
12
12
  * Get a presigned post URL so we can upload directly to S3 via frontend.
13
13
  */
14
- declare const writePresignedPost: ({ bucket, config, fields, file, fileName, url }: WritePresignedPostType) => Promise<ApiResponseType>;
14
+ declare const writePresignedPost: ({ bucket, config, fields, file, fileName, url }: WritePresignedPostType) => Promise<ResponseType>;
15
15
  export default writePresignedPost;
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
14
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
15
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -49,7 +60,7 @@ var writePresignedPost = function (_a) {
49
60
  return __generator(this, function (_a) {
50
61
  switch (_a.label) {
51
62
  case 0:
52
- response = api_1.ApiPlaceholder;
63
+ response = __assign({}, api_1.response);
53
64
  formData = new FormData();
54
65
  Object.entries({ fields: fields, file: file })
55
66
  .forEach(function (_a) {
@@ -65,7 +76,7 @@ var writePresignedPost = function (_a) {
65
76
  upload = _a.sent();
66
77
  // Uploaded to S3
67
78
  if (upload.ok) {
68
- response.status = api_1.ApiStatus.SUCCESS;
79
+ response.status = api_1.states.SUCCESS;
69
80
  response.body = {
70
81
  url: "https://".concat(bucket, ".s3.").concat(config.region, ".amazonaws.com/").concat(fileName),
71
82
  };
@@ -73,7 +84,7 @@ var writePresignedPost = function (_a) {
73
84
  }
74
85
  // Failed to upload to S3
75
86
  else {
76
- response.status = api_1.ApiStatus.ERROR;
87
+ response.status = api_1.states.ERROR;
77
88
  response.error = 'Failed to upload file, please try again.';
78
89
  reject(response);
79
90
  }
@@ -0,0 +1,6 @@
1
+ import { durationComparisons, durations } from '../../date';
2
+ export declare type CacheType = {
3
+ duration: number;
4
+ from: typeof durationComparisons.VS_MIDNIGHT | typeof durationComparisons.VS_NOW;
5
+ timeframe: typeof durations.FOREVER | typeof durations.MONTHS | typeof durations.DAYS | typeof durations.HOURS | typeof durations.MINUTES;
6
+ };
File without changes
@@ -1,4 +1,4 @@
1
- import { AwsConfigType } from '../types';
1
+ import { ConfigType } from '../config';
2
2
  /**
3
3
  * Get the stored cache if it exists.
4
4
  */
@@ -6,7 +6,7 @@ declare const getCache: {
6
6
  ({ S3Lib, bucket, config, key, isJson }: {
7
7
  S3Lib: any;
8
8
  bucket: string;
9
- config: AwsConfigType;
9
+ config: ConfigType;
10
10
  key: string;
11
11
  isJson: boolean;
12
12
  }): Promise<any>;
@@ -1,4 +1,4 @@
1
- import { PlatformType } from '../../environment/types';
1
+ import { PlatformsType } from '../../environment/platforms';
2
2
  /**
3
3
  * Take an input and return the key.
4
4
  * Always in the "_cache" folder with the "environment" followed by the optional folder then the key.
@@ -7,6 +7,6 @@ declare const getKey: ({ CryptoLib, fileName, folder, platform }: {
7
7
  CryptoLib: any;
8
8
  fileName: any;
9
9
  folder: string;
10
- platform: PlatformType;
10
+ platform: PlatformsType;
11
11
  }) => string;
12
12
  export default getKey;
@@ -1,7 +1,7 @@
1
1
  import getCache from './getCache';
2
2
  import getKey from './getKey';
3
3
  import saveCache from './saveCache';
4
- import { CacheExpiresType } from './types';
4
+ import { CacheType } from './cache';
5
5
  import updateCache from './updateCache';
6
- export type { CacheExpiresType, };
6
+ export type { CacheType, };
7
7
  export { getCache, getKey, saveCache, updateCache, };
@@ -1,11 +1,11 @@
1
- import { AwsConfigType } from '../types';
1
+ import { ConfigType } from '../config';
2
2
  /**
3
3
  * Save the cache.
4
4
  */
5
5
  declare const saveCache: ({ S3Lib, bucket, config, data, key }: {
6
6
  S3Lib: any;
7
7
  bucket: string;
8
- config: AwsConfigType;
8
+ config: ConfigType;
9
9
  key: string;
10
10
  data: any;
11
11
  }) => Promise<void>;
@@ -1,11 +1,11 @@
1
- import { AwsConfigType } from '../types';
1
+ import { ConfigType } from '../config';
2
2
  /**
3
3
  * Delete other caches if present, then save the new file.
4
4
  */
5
5
  declare const updateCache: ({ S3Lib, bucket, config, data, key }: {
6
6
  S3Lib: any;
7
7
  bucket: string;
8
- config: AwsConfigType;
8
+ config: ConfigType;
9
9
  data: any;
10
10
  key: string;
11
11
  }) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import { ApiResponseType } from '../../api';
1
+ import { ResponseType } from '../../api';
2
2
  import { BaseClass } from '../../Class';
3
3
  /**
4
4
  * Class to build and send an AWS SES email.
@@ -48,7 +48,7 @@ declare class SimpleEmail extends BaseClass {
48
48
  send({ SesLib, client }: {
49
49
  SesLib: any;
50
50
  client: any;
51
- }): Promise<ApiResponseType>;
51
+ }): Promise<ResponseType>;
52
52
  private _filterRecipients;
53
53
  }
54
54
  export default SimpleEmail;
@@ -142,12 +142,12 @@ var SimpleEmail = /** @class */ (function (_super) {
142
142
  SimpleEmail.prototype.send = function (_a) {
143
143
  var SesLib = _a.SesLib, client = _a.client;
144
144
  return __awaiter(this, void 0, void 0, function () {
145
- var SendEmailCommand, response, params, command, apiResponse, error_1;
145
+ var SendEmailCommand, response, params, command, apiResponse_1, error_1;
146
146
  return __generator(this, function (_b) {
147
147
  switch (_b.label) {
148
148
  case 0:
149
149
  SendEmailCommand = SesLib.SendEmailCommand;
150
- response = __assign({}, api_1.ApiPlaceholder);
150
+ response = __assign({}, api_1.response);
151
151
  params = {
152
152
  Destination: {
153
153
  BccAddresses: this._filterRecipients({ field: 'bcc' }),
@@ -178,19 +178,19 @@ var SimpleEmail = /** @class */ (function (_super) {
178
178
  command = new SendEmailCommand(params);
179
179
  return [4 /*yield*/, client.send(command)];
180
180
  case 2:
181
- apiResponse = _b.sent();
182
- if ((0, isResponse200_1.default)({ apiResponse: apiResponse })) {
183
- response.status = api_1.ApiStatus.SUCCESS;
181
+ apiResponse_1 = _b.sent();
182
+ if ((0, isResponse200_1.default)({ apiResponse: apiResponse_1 })) {
183
+ response.status = api_1.states.SUCCESS;
184
184
  }
185
185
  else {
186
- response.status = api_1.ApiStatus.ERROR;
186
+ response.status = api_1.states.ERROR;
187
187
  // @ts-ignore
188
188
  response.error = "An unexpected error occurred.";
189
189
  }
190
190
  return [3 /*break*/, 4];
191
191
  case 3:
192
192
  error_1 = _b.sent();
193
- response.status = api_1.ApiStatus.ERROR;
193
+ response.status = api_1.states.ERROR;
194
194
  // @ts-ignore
195
195
  response.error = error_1.message;
196
196
  return [3 /*break*/, 4];
@@ -1,10 +1,10 @@
1
- import { AwsConfigType } from '../types';
1
+ import { ConfigType } from '../config';
2
2
  /**
3
3
  * Shorthand function to get the SES Client.
4
4
  * Library: @aws-sdk/client-ses
5
5
  */
6
6
  declare const getClient: ({ SesLib, config }: {
7
7
  SesLib: any;
8
- config: AwsConfigType;
8
+ config: ConfigType;
9
9
  }) => any;
10
10
  export default getClient;
@@ -1,10 +1,10 @@
1
- import { AwsConfigType } from '../types';
1
+ import { ConfigType } from '../config';
2
2
  /**
3
3
  * Shorthand function to get the Lambda Client.
4
4
  * Library: @aws-sdk/client-ssm
5
5
  */
6
6
  declare const getClient: ({ SsmLib, config }: {
7
7
  SsmLib: any;
8
- config: AwsConfigType;
8
+ config: ConfigType;
9
9
  }) => any;
10
10
  export default getClient;
@@ -1,3 +1,8 @@
1
- import { GetType } from './types';
1
+ export declare type GetType = {
2
+ config?: object;
3
+ onError?: Function;
4
+ onSuccess?: Function;
5
+ url: string;
6
+ };
2
7
  declare const get: ({ config, onError, onSuccess, url }: GetType) => Promise<any>;
3
8
  export default get;
package/dist/axios/get.js CHANGED
@@ -55,7 +55,7 @@ var get = function (_a) {
55
55
  case 0:
56
56
  if (!(200 === response.status)) return [3 /*break*/, 12];
57
57
  if (!(undefined !== response.data.body && undefined !== response.data.error && undefined !== response.data.status)) return [3 /*break*/, 8];
58
- if (!(api_1.ApiStatus.SUCCESS === response.data.status)) return [3 /*break*/, 4];
58
+ if (!(api_1.states.SUCCESS === response.data.status)) return [3 /*break*/, 4];
59
59
  if (!onSuccess) return [3 /*break*/, 2];
60
60
  return [4 /*yield*/, onSuccess(response.data.body)];
61
61
  case 1:
@@ -1,5 +1,4 @@
1
- import { GetType, PostType } from './types';
2
- import get from './get';
3
- import post from './post';
1
+ import get, { GetType } from './get';
2
+ import post, { PostType } from './post';
4
3
  export type { GetType, PostType, };
5
4
  export { get, post, };
@@ -1,4 +1,10 @@
1
- import { PostType } from './types';
1
+ export declare type PostType = {
2
+ config?: object;
3
+ data?: object;
4
+ onError?: Function;
5
+ onSuccess?: Function;
6
+ url: string;
7
+ };
2
8
  /**
3
9
  * Make a POST request.
4
10
  */
@@ -58,7 +58,7 @@ var post = function (_a) {
58
58
  case 0:
59
59
  if (!(200 === response.status)) return [3 /*break*/, 12];
60
60
  if (!(undefined !== response.data.body && undefined !== response.data.error && undefined !== response.data.status)) return [3 /*break*/, 8];
61
- if (!(api_1.ApiStatus.SUCCESS === response.data.status)) return [3 /*break*/, 4];
61
+ if (!(api_1.states.SUCCESS === response.data.status)) return [3 /*break*/, 4];
62
62
  if (!onSuccess) return [3 /*break*/, 2];
63
63
  return [4 /*yield*/, onSuccess(response.data.body)];
64
64
  case 1:
@@ -1,4 +1,3 @@
1
- import { CrudStatus } from './constants';
2
- import { CrudType } from './types';
3
- export type { CrudType, };
4
- export { CrudStatus, };
1
+ import { states, StateType } from './states';
2
+ export type { StateType, };
3
+ export { states, };
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CrudStatus = void 0;
4
- var constants_1 = require("./constants");
5
- Object.defineProperty(exports, "CrudStatus", { enumerable: true, get: function () { return constants_1.CrudStatus; } });
3
+ exports.states = void 0;
4
+ var states_1 = require("./states");
5
+ Object.defineProperty(exports, "states", { enumerable: true, get: function () { return states_1.states; } });
@@ -0,0 +1,7 @@
1
+ export declare const states: {
2
+ CREATE: string;
3
+ READ: string;
4
+ UPDATE: string;
5
+ DELETE: string;
6
+ };
7
+ export declare type StateType = typeof states.CREATE | typeof states.READ | typeof states.UPDATE | typeof states.DELETE;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CrudStatus = void 0;
4
- exports.CrudStatus = {
3
+ exports.states = void 0;
4
+ exports.states = {
5
5
  CREATE: 'create',
6
6
  READ: 'read',
7
7
  UPDATE: 'update',
@@ -0,0 +1,4 @@
1
+ /**
2
+ * A date can be either a number (YYYYMMDD), string (YYYY-MM-DD) or Date instance.
3
+ */
4
+ export declare type DateType = number | string | Date;
File without changes
@@ -0,0 +1,5 @@
1
+ export declare type DurationType = {
2
+ hours: number;
3
+ minutes: number;
4
+ seconds: number;
5
+ };
File without changes
@@ -0,0 +1,4 @@
1
+ export declare const durationComparisons: {
2
+ VS_NOW: string;
3
+ VS_MIDNIGHT: string;
4
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.durationComparisons = void 0;
4
+ exports.durationComparisons = {
5
+ VS_NOW: 'vsNow',
6
+ VS_MIDNIGHT: 'vsMidnight',
7
+ };
@@ -0,0 +1,7 @@
1
+ export declare const durations: {
2
+ FOREVER: string;
3
+ MONTHS: string;
4
+ DAYS: string;
5
+ HOURS: string;
6
+ MINUTES: string;
7
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.durations = void 0;
4
+ exports.durations = {
5
+ FOREVER: 'forever',
6
+ MONTHS: 'months',
7
+ DAYS: 'days',
8
+ HOURS: 'hours',
9
+ MINUTES: 'minutes',
10
+ };
@@ -0,0 +1,4 @@
1
+ export declare type FinancialYearType = {
2
+ end: Date;
3
+ start: Date;
4
+ };
File without changes
@@ -0,0 +1,6 @@
1
+ export declare type FinancialYearWeekType = {
2
+ end: Date;
3
+ financialWeek: number;
4
+ financialYear: number;
5
+ start: Date;
6
+ };
File without changes
@@ -1,4 +1,4 @@
1
- import { DateType } from './types';
1
+ import { DateType } from './date';
2
2
  /**
3
3
  * Convert a (number | string | Date) into a "yyyy-MM-dd" string or a specified format.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { DateType } from './types';
1
+ import { DateType } from './date';
2
2
  /**
3
3
  * Convert a (number | string | Date) into a Date object.
4
4
  */