@creator.co/wapi 1.2.5 → 1.2.6

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 (115) hide show
  1. package/README.md +216 -5
  2. package/dist/index.d.ts +15 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/package.json +6 -1
  5. package/dist/src/API/Request.d.ts +45 -82
  6. package/dist/src/API/Request.js +49 -77
  7. package/dist/src/API/Request.js.map +1 -1
  8. package/dist/src/API/Response.d.ts +94 -163
  9. package/dist/src/API/Response.js +101 -161
  10. package/dist/src/API/Response.js.map +1 -1
  11. package/dist/src/API/Utils.d.ts +21 -42
  12. package/dist/src/API/Utils.js +22 -43
  13. package/dist/src/API/Utils.js.map +1 -1
  14. package/dist/src/BaseEvent/EventProcessor.d.ts +32 -55
  15. package/dist/src/BaseEvent/EventProcessor.js +30 -38
  16. package/dist/src/BaseEvent/EventProcessor.js.map +1 -1
  17. package/dist/src/BaseEvent/Process.d.ts +20 -43
  18. package/dist/src/BaseEvent/Process.js +16 -27
  19. package/dist/src/BaseEvent/Process.js.map +1 -1
  20. package/dist/src/BaseEvent/Transaction.d.ts +94 -2
  21. package/dist/src/BaseEvent/Transaction.js +49 -4
  22. package/dist/src/BaseEvent/Transaction.js.map +1 -1
  23. package/dist/src/Config/Configuration.d.ts +48 -66
  24. package/dist/src/Config/Configuration.js +25 -42
  25. package/dist/src/Config/Configuration.js.map +1 -1
  26. package/dist/src/Config/EnvironmentVar.d.ts +30 -57
  27. package/dist/src/Config/EnvironmentVar.js +28 -41
  28. package/dist/src/Config/EnvironmentVar.js.map +1 -1
  29. package/dist/src/Crypto/Crypto.d.ts +17 -35
  30. package/dist/src/Crypto/Crypto.js +12 -21
  31. package/dist/src/Crypto/Crypto.js.map +1 -1
  32. package/dist/src/Crypto/JWT.d.ts +21 -32
  33. package/dist/src/Crypto/JWT.js +14 -22
  34. package/dist/src/Crypto/JWT.js.map +1 -1
  35. package/dist/src/Globals.d.ts +26 -94
  36. package/dist/src/Globals.js +26 -95
  37. package/dist/src/Globals.js.map +1 -1
  38. package/dist/src/Logger/Logger.d.ts +82 -105
  39. package/dist/src/Logger/Logger.js +111 -136
  40. package/dist/src/Logger/Logger.js.map +1 -1
  41. package/dist/src/Mailer/Mailer.d.ts +39 -75
  42. package/dist/src/Mailer/Mailer.js +36 -65
  43. package/dist/src/Mailer/Mailer.js.map +1 -1
  44. package/dist/src/Publisher/Publisher.d.ts +17 -25
  45. package/dist/src/Publisher/Publisher.js +21 -32
  46. package/dist/src/Publisher/Publisher.js.map +1 -1
  47. package/dist/src/Server/RouteResolver.d.ts +14 -22
  48. package/dist/src/Server/RouteResolver.js +21 -34
  49. package/dist/src/Server/RouteResolver.js.map +1 -1
  50. package/dist/src/Server/Router.d.ts +72 -51
  51. package/dist/src/Server/Router.js +8 -17
  52. package/dist/src/Server/Router.js.map +1 -1
  53. package/dist/src/Server/lib/ContainerServer.d.ts +15 -31
  54. package/dist/src/Server/lib/ContainerServer.js +13 -28
  55. package/dist/src/Server/lib/ContainerServer.js.map +1 -1
  56. package/dist/src/Server/lib/Server.d.ts +17 -32
  57. package/dist/src/Server/lib/Server.js +18 -28
  58. package/dist/src/Server/lib/Server.js.map +1 -1
  59. package/dist/src/Server/lib/container/GenericHandler.d.ts +5 -0
  60. package/dist/src/Server/lib/container/GenericHandler.js +16 -3
  61. package/dist/src/Server/lib/container/GenericHandler.js.map +1 -1
  62. package/dist/src/Server/lib/container/GenericHandlerEvent.d.ts +22 -37
  63. package/dist/src/Server/lib/container/GenericHandlerEvent.js +29 -41
  64. package/dist/src/Server/lib/container/GenericHandlerEvent.js.map +1 -1
  65. package/dist/src/Server/lib/container/HealthHandler.d.ts +6 -0
  66. package/dist/src/Server/lib/container/HealthHandler.js +6 -0
  67. package/dist/src/Server/lib/container/HealthHandler.js.map +1 -1
  68. package/dist/src/Server/lib/container/Proxy.d.ts +24 -52
  69. package/dist/src/Server/lib/container/Proxy.js +49 -50
  70. package/dist/src/Server/lib/container/Proxy.js.map +1 -1
  71. package/dist/src/Server/lib/container/Utils.d.ts +6 -10
  72. package/dist/src/Server/lib/container/Utils.js +6 -10
  73. package/dist/src/Server/lib/container/Utils.js.map +1 -1
  74. package/dist/src/Validation/Validator.d.ts +9 -13
  75. package/dist/src/Validation/Validator.js +8 -12
  76. package/dist/src/Validation/Validator.js.map +1 -1
  77. package/index.ts +15 -0
  78. package/package.json +6 -1
  79. package/src/API/Request.ts +66 -84
  80. package/src/API/Response.ts +144 -203
  81. package/src/API/Utils.ts +28 -44
  82. package/src/BaseEvent/EventProcessor.ts +52 -77
  83. package/src/BaseEvent/Process.ts +27 -52
  84. package/src/BaseEvent/Transaction.ts +100 -10
  85. package/src/Config/Configuration.ts +59 -76
  86. package/src/Config/EnvironmentVar.ts +39 -62
  87. package/src/Crypto/Crypto.ts +20 -36
  88. package/src/Crypto/JWT.ts +31 -35
  89. package/src/Globals.ts +28 -96
  90. package/src/Logger/Logger.ts +141 -160
  91. package/src/Mailer/Mailer.ts +43 -76
  92. package/src/Publisher/Publisher.ts +31 -40
  93. package/src/Server/RouteResolver.ts +31 -52
  94. package/src/Server/Router.ts +75 -54
  95. package/src/Server/lib/ContainerServer.ts +20 -32
  96. package/src/Server/lib/Server.ts +19 -34
  97. package/src/Server/lib/container/GenericHandler.ts +17 -3
  98. package/src/Server/lib/container/GenericHandlerEvent.ts +44 -54
  99. package/src/Server/lib/container/HealthHandler.ts +6 -0
  100. package/src/Server/lib/container/Proxy.ts +37 -57
  101. package/src/Server/lib/container/Utils.ts +7 -10
  102. package/src/Validation/Validator.ts +11 -13
  103. package/tests/API/Response.test.ts +55 -56
  104. package/tests/BaseEvent/EventProcessor.test.ts +49 -50
  105. package/tests/BaseEvent/Process.test.ts +2 -2
  106. package/tests/BaseEvent/Transaction.test.ts +48 -49
  107. package/tests/Config/Config.test.ts +27 -27
  108. package/tests/Config/EnvironmentVar.test.ts +54 -18
  109. package/tests/Publisher/Publisher.test.ts +3 -3
  110. package/tests/Server/lib/ContainerServer.test.ts +21 -22
  111. package/tests/Server/lib/container/GenericHandler.test.ts +31 -32
  112. package/tests/Server/lib/container/GenericHandlerEvent.test.ts +2 -2
  113. package/tests/Server/lib/container/HealthHandler.test.ts +6 -7
  114. package/tests/Server/lib/container/Proxy.test.ts +37 -35
  115. package/tsconfig.json +1 -1
@@ -78,10 +78,29 @@ var DatabaseManager_1 = require("../Database/DatabaseManager");
78
78
  var Globals_1 = require("../Globals");
79
79
  var Logger_1 = require("../Logger/Logger");
80
80
  var Publisher_1 = require("../Publisher/Publisher");
81
+ /**
82
+ * Represents a transaction object that handles the execution of a request and manages the response.
83
+ * @template InputType - The type of the input data for the transaction.
84
+ * @template ResponseInnerType - The type of the inner response data for the transaction.
85
+ * @template MiscRespType - The type of miscellaneous response data for the transaction.
86
+ */
81
87
  var Transaction = /** @class */ (function () {
82
- //
88
+ /**
89
+ * Constructs a new instance of the Transaction class.
90
+ * @param {APIGatewayEvent | SQSEvent} event - The event object passed to the Lambda function.
91
+ * @param {Context} context - The context object passed to the Lambda function.
92
+ * @param {TransactionConfig} [config] - Optional configuration object for the transaction.
93
+ * @returns None
94
+ */
83
95
  function Transaction(event, context, config) {
96
+ /**
97
+ * The instance of the DatabaseManager class used for managing the database.
98
+ */
84
99
  this.databaseManager = DatabaseManager_1.DatabaseManager.INSTANCE;
100
+ /**
101
+ * An array of database transactions.
102
+ * @type {DatabaseTransaction[]}
103
+ */
85
104
  this.transactions = [];
86
105
  var transactionId = context.awsRequestId
87
106
  ? context.awsRequestId
@@ -102,7 +121,12 @@ var Transaction = /** @class */ (function () {
102
121
  this.request = new Request_1.default(this.event, this.context, this.logger);
103
122
  this.publisher = new Publisher_1.default(config === null || config === void 0 ? void 0 : config.publisher);
104
123
  }
105
- //Main interface
124
+ /**
125
+ * Executes a transaction using the provided execution function and returns a promise
126
+ * that resolves to the response or miscellaneous response.
127
+ * @param {TransactionExecution<Transaction<InputType, ResponseInnerType, MiscRespType>, ResponseInnerType, MiscRespType>} executionFunc - The execution function to be executed.
128
+ * @returns {Promise<Response<ResponseInnerType | ResponseErrorType> | MiscRespType>} - A promise that resolves to the response or miscellaneous response.
129
+ */
106
130
  Transaction.prototype.execute = function (executionFunc) {
107
131
  return __awaiter(this, void 0, void 0, function () {
108
132
  var _this = this;
@@ -141,7 +165,11 @@ var Transaction = /** @class */ (function () {
141
165
  });
142
166
  });
143
167
  };
144
- //Executions
168
+ /**
169
+ * Executes a transaction using the provided execution function and handles the response.
170
+ * @param {TransactionExecution<Transaction<InputType, ResponseInnerType, MiscRespType>, ResponseInnerType, MiscRespType>} executionFunc - The function to execute the transaction.
171
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the execution failed or not.
172
+ */
145
173
  Transaction.prototype.iexecute = function (executionFunc) {
146
174
  return __awaiter(this, void 0, void 0, function () {
147
175
  var executionFailed, _a, e_1;
@@ -222,6 +250,12 @@ var Transaction = /** @class */ (function () {
222
250
  });
223
251
  });
224
252
  };
253
+ /*
254
+ * Executes a series of database transactions in a safe manner.
255
+ * @param {Function} safeExecution - The function that contains the database transactions to be executed.
256
+ * @returns None
257
+ * @throws {Error} - If an exception occurs during the execution of the transactions and `retrowErrors` is true.
258
+ */
225
259
  Transaction.prototype.executeDBTransactions = function (safeExecution) {
226
260
  return __awaiter(this, void 0, void 0, function () {
227
261
  var execFailed, _a, _b, transaction, e_2, e_3_1, e_4, _c, _d, transaction, e_5, e_6_1;
@@ -317,6 +351,12 @@ var Transaction = /** @class */ (function () {
317
351
  });
318
352
  });
319
353
  };
354
+ /**
355
+ * Executes a logger flush operation with error handling and logging.
356
+ * @param {Function} safeExecution - The function to execute safely.
357
+ * @returns None
358
+ * @throws {Error} - If `retrowErrors` is true and an error occurs during execution.
359
+ */
320
360
  Transaction.prototype.executeLoggerFlush = function (safeExecution) {
321
361
  return __awaiter(this, void 0, void 0, function () {
322
362
  var e_7;
@@ -344,7 +384,12 @@ var Transaction = /** @class */ (function () {
344
384
  });
345
385
  });
346
386
  };
347
- /* Response support */
387
+ /**
388
+ * Returns an error response with the specified error message and error code.
389
+ * @param {string} error - The error message.
390
+ * @param {string} code - The error code.
391
+ * @returns {Response<ResponseErrorType>} - The error response.
392
+ */
348
393
  Transaction.prototype.getErrorResponse = function (error, code) {
349
394
  return Response_1.default.BadRequestResponseWithRollback(error, code);
350
395
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../src/BaseEvent/Transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0CAAoC;AACpC,4CAA6D;AAC7D,+DAA6D;AAG7D,sCAAgC;AAChC,2CAAuD;AACvD,oDAAmE;AAenE;IAkBE,EAAE;IACF,qBAAY,KAAiC,EAAE,OAAgB,EAAE,MAA0B;QAdnF,oBAAe,GAAoB,iCAAe,CAAC,QAAQ,CAAA;QAC3D,iBAAY,GAA0B,EAAE,CAAA;QAc9C,IAAM,aAAa,GAAG,OAAO,CAAC,YAAY;YACxC,CAAC,CAAC,OAAO,CAAC,YAAY;YACtB,CAAC,CAAmB,KAAM,CAAC,cAAc;gBACzC,CAAC,CAAmB,KAAM,CAAC,cAAc,CAAC,SAAS;gBACnD,CAAC,CAAC,SAAS,CAAA;QACb,kBAAkB;QAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;QACpB,kJAAkJ;QAClJ,IAAI,CAAC,aAAa,GAAG,IAAI,CAAA;QACzB,oBAAoB;QACpB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,CAAA,CAAA;QACtC,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAA,MAAM,aAAN,MAAM,uB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AAA;wBAClD,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAC,CAAC,CAAA;wBACxB,SAAS;wBACT,IAAI,IAAI,CAAC,YAAY;4BAAE,MAAM,GAAC,CAAA;;;wBAE9B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAA;;;;;;KAEzC;IAED;;;;;OAKG;IACK,sCAAgB,GAAxB,UAAyB,KAAa,EAAE,IAAY;QAClD,OAAO,kBAAQ,CAAC,8BAA8B,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;IAC7D,CAAC;IACH,kBAAC;AAAD,CAAC,AAjPD,IAiPC"}
@@ -1,8 +1,11 @@
1
1
  /**
2
- * ${1:Description placeholder}
3
- *
4
- * @export
5
- * @typedef {ConfigurationSchema}
2
+ * Represents the schema for the configuration object.
3
+ * @typedef {Object} ConfigurationSchema
4
+ * @property {Object} [name] - The name of the configuration property.
5
+ * @property {boolean} [name.isLocal] - Indicates if the property is for local use.
6
+ * @property {boolean} [name.isRemote] - Indicates if the property is for remote use.
7
+ * @property {boolean} [name.required] - Indicates if the property is required.
8
+ * @property {string} [name.cachingPolicy] - The caching policy for the property.
6
9
  */
7
10
  export type ConfigurationSchema = {
8
11
  [name: string]: {
@@ -13,10 +16,9 @@ export type ConfigurationSchema = {
13
16
  };
14
17
  };
15
18
  /**
16
- * ${1:Description placeholder}
17
- *
18
- * @typedef {ExtractRemote}
19
- * @template Type
19
+ * Extracts the properties from a given type that have the `isRemote` property set to `true`.
20
+ * @param {Type} - The type to extract properties from.
21
+ * @returns An object type with the extracted properties.
20
22
  */
21
23
  type ExtractRemote<Type> = {
22
24
  [Property in keyof Type]-?: Type[Property] extends {
@@ -24,10 +26,9 @@ type ExtractRemote<Type> = {
24
26
  } ? Property : null;
25
27
  };
26
28
  /**
27
- * ${1:Description placeholder}
28
- *
29
- * @typedef {ExtractLocal}
30
- * @template Type
29
+ * Extracts the properties from a given type that have the `isLocal` property set to `true`.
30
+ * @typeparam Type - The type to extract properties from.
31
+ * @returns An object type with the extracted properties as keys and their corresponding types.
31
32
  */
32
33
  type ExtractLocal<Type> = {
33
34
  [Property in keyof Type]-?: Type[Property] extends {
@@ -35,96 +36,77 @@ type ExtractLocal<Type> = {
35
36
  } ? Property : null;
36
37
  };
37
38
  /**
38
- * ${1:Description placeholder}
39
- *
40
- * @typedef {OmitKeysByValueType}
41
- * @template T
42
- * @template U
39
+ * Creates a new type by omitting keys from type T whose values are of type U.
40
+ * @param {T} - The original type
41
+ * @param {U} - The type to omit from T
42
+ * @returns A new type with the omitted keys
43
43
  */
44
44
  type OmitKeysByValueType<T, U> = {
45
45
  [P in keyof T]: T[P] extends U ? never : P;
46
46
  }[keyof T];
47
47
  /**
48
- * ${1:Description placeholder}
49
- *
50
- * @typedef {OmitByValueType}
51
- * @template T
52
- * @template V
48
+ * Omit properties from an object type by their value type.
49
+ * @template T - The object type to omit properties from.
50
+ * @template V - The value type of properties to omit.
51
+ * @typedef OmitByValueType
52
+ * @property {T} T - The object type to omit properties from.
53
+ * @property {V} V - The value type of properties to omit.
54
+ * @returns {OmitKeysByValueType<T, V>} - The resulting object type after omitting properties.
53
55
  */
54
56
  type OmitByValueType<T, V> = T extends infer _ ? {
55
57
  [key in OmitKeysByValueType<T, V>]: T[key];
56
58
  } : never;
57
59
  /**
58
- * ${1:Description placeholder}
59
- *
60
- * @export
61
- * @class Configuration
62
- * @typedef {Configuration}
63
- * @template {ConfigurationSchema} T
60
+ * Represents a configuration object with a specified schema and remote prefix.
61
+ * @template T - The type of the configuration schema.
64
62
  */
65
63
  export default class Configuration<T extends ConfigurationSchema> {
66
64
  /**
67
- * ${1:Description placeholder}
68
- *
69
- * @private
70
- * @readonly
65
+ * The schema for the private readonly property.
71
66
  * @type {T}
72
67
  */
73
68
  private readonly schema;
74
69
  /**
75
- * ${1:Description placeholder}
76
- *
77
- * @private
78
- * @readonly
70
+ * The prefix used for remote resources.
79
71
  * @type {string}
80
72
  */
81
73
  private readonly remotePrefix;
82
74
  /**
83
- * Creates an instance of Configuration.
84
- *
85
- * @constructor
86
- * @param {T} schema
87
- * @param {string} remotePrefix
75
+ * Constructs a new instance of the class.
76
+ * @param {T} schema - The schema object.
77
+ * @param {string} remotePrefix - The remote prefix string.
78
+ * @returns None
88
79
  */
89
80
  constructor(schema: T, remotePrefix: string);
90
81
  /**
91
- * ${1:Description placeholder}
92
- *
93
- * @public
94
- * @param {keyof OmitByValueType<ExtractLocal<T>, null>} propName
95
- * @returns {*}
82
+ * Retrieves the value of a property from the environment variables or cache.
83
+ * @param {keyof OmitByValueType<ExtractLocal<T>, null>} propName - The name of the property to retrieve.
84
+ * @returns The value of the property.
96
85
  */
97
86
  get(propName: keyof OmitByValueType<ExtractLocal<T>, null>): any;
98
87
  /**
99
- * ${1:Description placeholder}
100
- *
101
- * @public
102
- * @async
103
- * @param {keyof OmitByValueType<ExtractRemote<T>, null>} propName
104
- * @returns {Promise<any>}
88
+ * Asynchronously retrieves the value of a property from the remote environment.
89
+ * @param {keyof OmitByValueType<ExtractRemote<T>, null>} propName - The name of the property to retrieve.
90
+ * @returns {Promise<any>} - A promise that resolves to the value of the property.
105
91
  */
106
92
  asyncGet(propName: keyof OmitByValueType<ExtractRemote<T>, null>): Promise<any>;
107
93
  /**
108
- * ${1:Description placeholder}
109
- *
110
- * @private
111
- * @param {string} valueKey
112
- * @returns {*}
94
+ * Retrieves the cached value associated with the given key from the cache store.
95
+ * @param {string} valueKey - The key of the value to retrieve from the cache.
96
+ * @returns The cached value associated with the given key, or undefined if the key does not exist in the cache.
113
97
  */
114
98
  private getCachedValue;
115
99
  /**
116
- * ${1:Description placeholder}
117
- *
118
- * @private
119
- * @param {string} valueKey
120
- * @param {*} value
121
- * @param {string} [policy="1d"]
100
+ * Caches a value with the specified key and expiration policy.
101
+ * @param {string} valueKey - The key to associate with the cached value.
102
+ * @param {any} value - The value to be cached.
103
+ * @param {string} [policy='1d'] - The expiration policy for the cached value. Defaults to '1d' (1 day).
104
+ * @returns None
122
105
  */
123
106
  private cacheValue;
124
107
  /**
125
- * ${1:Description placeholder}
126
- *
127
- * @private
108
+ * Resets the cache by creating a new instance of the MemCache class and assigning it to the cacheStore variable.
109
+ * @returns None
128
110
  */
129
111
  private resetCache;
130
112
  }
@@ -42,37 +42,29 @@ var EnvironmentVar_1 = require("./EnvironmentVar");
42
42
  // Hold cached values at nodeVM level
43
43
  // eslint-disable-next-line no-var
44
44
  /**
45
- * ${1:Description placeholder}
46
- *
47
- * @type {*}
45
+ * Creates a new instance of a memory cache store.
46
+ * @returns {MemCache} A new instance of a memory cache store.
48
47
  */
49
48
  var cacheStore = new MemCache();
50
49
  /**
51
- * ${1:Description placeholder}
52
- *
53
- * @export
54
- * @class Configuration
55
- * @typedef {Configuration}
56
- * @template {ConfigurationSchema} T
50
+ * Represents a configuration object with a specified schema and remote prefix.
51
+ * @template T - The type of the configuration schema.
57
52
  */
58
53
  var Configuration = /** @class */ (function () {
59
54
  /**
60
- * Creates an instance of Configuration.
61
- *
62
- * @constructor
63
- * @param {T} schema
64
- * @param {string} remotePrefix
55
+ * Constructs a new instance of the class.
56
+ * @param {T} schema - The schema object.
57
+ * @param {string} remotePrefix - The remote prefix string.
58
+ * @returns None
65
59
  */
66
60
  function Configuration(schema, remotePrefix) {
67
61
  this.schema = schema;
68
62
  this.remotePrefix = remotePrefix;
69
63
  }
70
64
  /**
71
- * ${1:Description placeholder}
72
- *
73
- * @public
74
- * @param {keyof OmitByValueType<ExtractLocal<T>, null>} propName
75
- * @returns {*}
65
+ * Retrieves the value of a property from the environment variables or cache.
66
+ * @param {keyof OmitByValueType<ExtractLocal<T>, null>} propName - The name of the property to retrieve.
67
+ * @returns The value of the property.
76
68
  */
77
69
  Configuration.prototype.get = function (propName) {
78
70
  var propString = propName;
@@ -85,12 +77,9 @@ var Configuration = /** @class */ (function () {
85
77
  return v;
86
78
  };
87
79
  /**
88
- * ${1:Description placeholder}
89
- *
90
- * @public
91
- * @async
92
- * @param {keyof OmitByValueType<ExtractRemote<T>, null>} propName
93
- * @returns {Promise<any>}
80
+ * Asynchronously retrieves the value of a property from the remote environment.
81
+ * @param {keyof OmitByValueType<ExtractRemote<T>, null>} propName - The name of the property to retrieve.
82
+ * @returns {Promise<any>} - A promise that resolves to the value of the property.
94
83
  */
95
84
  Configuration.prototype.asyncGet = function (propName) {
96
85
  return __awaiter(this, void 0, void 0, function () {
@@ -115,34 +104,28 @@ var Configuration = /** @class */ (function () {
115
104
  });
116
105
  });
117
106
  };
118
- // caching layer
119
107
  /**
120
- * ${1:Description placeholder}
121
- *
122
- * @private
123
- * @param {string} valueKey
124
- * @returns {*}
108
+ * Retrieves the cached value associated with the given key from the cache store.
109
+ * @param {string} valueKey - The key of the value to retrieve from the cache.
110
+ * @returns The cached value associated with the given key, or undefined if the key does not exist in the cache.
125
111
  */
126
112
  Configuration.prototype.getCachedValue = function (valueKey) {
127
113
  return cacheStore.get(valueKey);
128
114
  };
129
115
  /**
130
- * ${1:Description placeholder}
131
- *
132
- * @private
133
- * @param {string} valueKey
134
- * @param {*} value
135
- * @param {string} [policy="1d"]
116
+ * Caches a value with the specified key and expiration policy.
117
+ * @param {string} valueKey - The key to associate with the cached value.
118
+ * @param {any} value - The value to be cached.
119
+ * @param {string} [policy='1d'] - The expiration policy for the cached value. Defaults to '1d' (1 day).
120
+ * @returns None
136
121
  */
137
122
  Configuration.prototype.cacheValue = function (valueKey, value, policy) {
138
123
  if (policy === void 0) { policy = '1d'; }
139
- cacheStore.set(valueKey, value, DurationParser(policy, 's'));
124
+ cacheStore.set(valueKey, value, DurationParser(policy, 's') || '');
140
125
  };
141
- // unit-test support
142
126
  /**
143
- * ${1:Description placeholder}
144
- *
145
- * @private
127
+ * Resets the cache by creating a new instance of the MemCache class and assigning it to the cacheStore variable.
128
+ * @returns None
146
129
  */
147
130
  Configuration.prototype.resetCache = function () {
148
131
  cacheStore = new MemCache();
@@ -1 +1 @@
1
- {"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../src/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E,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;IACpE,CAAC;IAED;;;OAGG;IACK,kCAAU,GAAlB;QACE,UAAU,GAAG,IAAI,QAAQ,EAAE,CAAA;IAC7B,CAAC;IACH,oBAAC;AAAD,CAAC,AA5FD,IA4FC"}
@@ -1,8 +1,10 @@
1
1
  /**
2
- * ${1:Description placeholder}
3
- *
4
- * @export
2
+ * An enumeration representing different types of environments.
5
3
  * @enum {number}
4
+ * @readonly
5
+ * @property {number} PlainRemote - Represents a plain remote environment.
6
+ * @property {number} SecureRemote - Represents a secure remote environment.
7
+ * @property {number} Local - Represents a local environment.
6
8
  */
7
9
  export declare enum EnvironmentType {
8
10
  PlainRemote = 0,
@@ -10,92 +12,63 @@ export declare enum EnvironmentType {
10
12
  Local = 2
11
13
  }
12
14
  /**
13
- * ${1:Description placeholder}
14
- *
15
- * @export
16
- * @class EnvironmentVar
17
- * @typedef {EnvironmentVar}
18
- * @template T
15
+ * Represents an environment variable with methods to resolve its value based on the environment type.
16
+ * @template T - The type of the environment variable value.
19
17
  */
20
18
  export default class EnvironmentVar<T> {
21
19
  /**
22
- * ${1:Description placeholder}
23
- *
24
- * @private
25
- * @readonly
26
- * @type {string}
20
+ * The name of the parameter.
27
21
  */
28
22
  private readonly paramName;
29
23
  /**
30
- * ${1:Description placeholder}
31
- *
32
- * @private
24
+ * The type of environment.
33
25
  * @readonly
34
- * @type {EnvironmentType}
35
26
  */
36
27
  private readonly type;
37
28
  /**
38
- * ${1:Description placeholder}
39
- *
40
- * @private
41
- * @readonly
42
- * @type {boolean}
29
+ * A boolean flag indicating whether the field is optional or not.
43
30
  */
44
31
  private readonly optional;
45
32
  /**
46
- * ${1:Description placeholder}
47
- *
48
- * @private
49
- * @readonly
33
+ * The prefix used for parameters in the class.
50
34
  * @type {string}
51
35
  */
52
36
  private readonly paramPrefix;
53
37
  /**
54
- * Creates an instance of EnvironmentVar.
55
- *
56
- * @constructor
57
- * @param {string} paramName
58
- * @param {EnvironmentType} type
59
- * @param {?boolean} [optional]
60
- * @param {string} [paramPrefix=`/creatorco-api-\${process.env.STAGE\}/env/`]
38
+ * Constructs a new instance of the EnvironmentVar class.
39
+ * @param {string} paramName - The name of the environment variable.
40
+ * @param {EnvironmentType} type - The type of the environment.
41
+ * @param {boolean} [optional] - Indicates whether the environment variable is optional.
42
+ * @param {string} [paramPrefix] - The prefix to be added to the environment variable name.
61
43
  */
62
44
  constructor(paramName: string, type: EnvironmentType, optional?: boolean, paramPrefix?: string);
63
45
  /**
64
- * ${1:Description placeholder}
65
- *
66
- * @public
67
- * @returns {T}
46
+ * Resolves the value of the environment variable synchronously.
47
+ * @returns {T} - The resolved value of the environment variable.
48
+ * @throws {Error} - If the environment type is not 'Local'.
68
49
  */
69
50
  syncResolve(): T;
70
51
  /**
71
- * ${1:Description placeholder}
72
- *
73
- * @public
74
- * @async
75
- * @returns {unknown}
52
+ * Resolves the value based on the environment type.
53
+ * @returns {Promise<any>} - The resolved value.
76
54
  */
77
55
  resolve(): Promise<T>;
78
56
  /**
79
- * ${1:Description placeholder}
80
- *
81
- * @private
82
- * @returns {T}
57
+ * Retrieves the value of a local environment variable.
58
+ * @returns {T} - The value of the local environment variable.
59
+ * @throws {Error} - If the local environment variable is not defined and is not optional.
83
60
  */
84
61
  private getLocalValue;
85
62
  /**
86
- * ${1:Description placeholder}
87
- *
88
- * @private
89
- * @async
90
- * @returns {Promise<T>}
63
+ * Retrieves the plain value of a remote environment parameter.
64
+ * @returns {Promise<T>} - A promise that resolves to the plain value of the parameter.
65
+ * @throws {Error} - If the parameter cannot be retrieved and is not optional.
91
66
  */
92
67
  private getPlainValue;
93
68
  /**
94
- * ${1:Description placeholder}
95
- *
96
- * @private
97
- * @async
98
- * @returns {Promise<T>}
69
+ * Retrieves a secure value from the secrets manager.
70
+ * @returns {Promise<T>} - A promise that resolves to the secure value.
71
+ * @throws {Error} - Throws an error if the secure value cannot be retrieved and is not optional.
99
72
  */
100
73
  private getSecureValue;
101
74
  }