@dereekb/nestjs 13.4.0 → 13.4.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 (59) hide show
  1. package/discord/index.cjs.js +31 -8
  2. package/discord/index.esm.js +31 -8
  3. package/discord/package.json +3 -3
  4. package/discord/src/lib/discord.api.d.ts +14 -0
  5. package/discord/src/lib/discord.api.page.d.ts +23 -5
  6. package/discord/src/lib/discord.module.d.ts +3 -0
  7. package/discord/src/lib/discord.util.d.ts +3 -0
  8. package/discord/src/lib/webhook/webhook.discord.d.ts +1 -0
  9. package/discord/src/lib/webhook/webhook.discord.module.d.ts +3 -0
  10. package/discord/src/lib/webhook/webhook.discord.verify.d.ts +1 -0
  11. package/index.cjs.js +52 -13
  12. package/index.esm.js +53 -14
  13. package/mailgun/index.cjs.js +58 -30
  14. package/mailgun/index.esm.js +59 -31
  15. package/mailgun/package.json +6 -6
  16. package/mailgun/src/lib/mailgun.api.d.ts +5 -3
  17. package/mailgun/src/lib/mailgun.d.ts +20 -4
  18. package/mailgun/src/lib/mailgun.service.d.ts +1 -0
  19. package/mailgun/src/lib/mailgun.service.module.d.ts +15 -0
  20. package/mailgun/src/lib/mailgun.util.d.ts +3 -0
  21. package/openai/index.cjs.js +31 -9
  22. package/openai/index.esm.js +31 -9
  23. package/openai/package.json +6 -6
  24. package/openai/src/lib/openai.module.d.ts +13 -0
  25. package/openai/src/lib/webhook/webhook.openai.module.d.ts +13 -0
  26. package/openai/src/lib/webhook/webhook.openai.verify.d.ts +3 -3
  27. package/package.json +2 -2
  28. package/src/lib/decorators/local.decorator.d.ts +8 -0
  29. package/src/lib/decorators/rawbody.d.ts +0 -13
  30. package/src/lib/module/client/client.module.d.ts +13 -0
  31. package/src/lib/module/env/env.config.d.ts +5 -4
  32. package/src/lib/module/env/env.d.ts +3 -1
  33. package/src/lib/module/env/env.nest.d.ts +8 -0
  34. package/src/lib/module/env/env.service.d.ts +2 -1
  35. package/src/lib/module/module.d.ts +11 -3
  36. package/src/lib/util/encryption/json.encrypt.d.ts +3 -0
  37. package/stripe/index.cjs.js +35 -8
  38. package/stripe/index.esm.js +35 -8
  39. package/stripe/package.json +6 -6
  40. package/stripe/src/lib/stripe.api.d.ts +11 -1
  41. package/stripe/src/lib/stripe.config.d.ts +4 -4
  42. package/stripe/src/lib/stripe.module.d.ts +13 -0
  43. package/stripe/src/lib/webhook/webhook.stripe.d.ts +10 -2
  44. package/typeform/index.cjs.js +56 -15
  45. package/typeform/index.esm.js +56 -15
  46. package/typeform/package.json +6 -6
  47. package/typeform/src/lib/typeform.module.d.ts +13 -0
  48. package/typeform/src/lib/typeform.type.d.ts +2 -2
  49. package/typeform/src/lib/typeform.util.d.ts +8 -0
  50. package/typeform/src/lib/webhook/webhook.typeform.form.d.ts +11 -1
  51. package/typeform/src/lib/webhook/webhook.typeform.module.d.ts +13 -0
  52. package/typeform/src/lib/webhook/webhook.typeform.verify.d.ts +2 -2
  53. package/vapiai/index.cjs.js +35 -13
  54. package/vapiai/index.esm.js +35 -13
  55. package/vapiai/package.json +6 -6
  56. package/vapiai/src/lib/vapiai.api.d.ts +2 -2
  57. package/vapiai/src/lib/vapiai.module.d.ts +13 -0
  58. package/vapiai/src/lib/webhook/webhook.vapiai.module.d.ts +13 -0
  59. package/vapiai/src/lib/webhook/webhook.vapiai.verify.d.ts +5 -3
@@ -238,25 +238,26 @@ function _ts_generator$2(thisArg, body) {
238
238
  }
239
239
  }
240
240
  /**
241
- * Verifies a VapiAi webhook event header.
241
+ * Creates a verifier for Vapi AI webhook events.
242
242
  *
243
- * @param vapiSecretTokenGetter The VapiAi secret token. The Vapi client allows for using an AsyncGetterOrValue type, so the verifier supports that as well.
244
- * @returns A function that verifies a VapiAi webhook event.
243
+ * Supports secret token, HMAC SHA-256, and no-op verification modes based on the provided configuration.
244
+ *
245
+ * @param config - the verification configuration including secret tokens, verification type, and signature prefix
246
+ * @returns a VapiAiWebhookEventVerifier function that validates incoming webhook requests
245
247
  */ function vapiAiWebhookEventVerifier(config) {
246
248
  var _ref;
247
249
  var inputVerificationType = config.verificationType, inputSecret = config.secret, inputHmacSecret = config.hmacSecret, inputSignaturePrefix = config.signaturePrefix;
248
250
  var verificationType = inputVerificationType !== null && inputVerificationType !== void 0 ? inputVerificationType : inputHmacSecret != null ? 'hmac' : 'secret'; // default to secret always, never default to none
249
251
  var secretToken = (_ref = verificationType === 'hmac' ? inputHmacSecret !== null && inputHmacSecret !== void 0 ? inputHmacSecret : inputSecret : inputSecret) !== null && _ref !== void 0 ? _ref : '';
250
252
  var signaturePrefix = inputSignaturePrefix !== null && inputSignaturePrefix !== void 0 ? inputSignaturePrefix : '';
251
- function verifyNone(input) {
253
+ function verifyNone(_input) {
252
254
  return true;
253
255
  }
254
256
  function verifySecret(input) {
255
257
  var request = input.request;
256
258
  var headers = request.headers;
257
259
  var vapiSecret = headers['x-vapi-secret'];
258
- var valid = vapiSecret === secretToken;
259
- return valid;
260
+ return vapiSecret === secretToken;
260
261
  }
261
262
  function verifyHmac(input) {
262
263
  var request = input.request, requestBodyString = input.requestBodyString;
@@ -266,11 +267,10 @@ function _ts_generator$2(thisArg, body) {
266
267
  var message = "".concat(timestamp, ".").concat(requestBodyString);
267
268
  var hashForVerify = crypto.createHmac('sha256', secretToken).update(message).digest('hex');
268
269
  var signature = "".concat(signaturePrefix).concat(hashForVerify);
269
- var valid = vapiSignature === signature;
270
- return valid;
270
+ return vapiSignature === signature;
271
271
  }
272
272
  var verify = verificationType === 'hmac' ? verifyHmac : verificationType === 'secret' ? verifySecret : verifyNone;
273
- return function(request, rawBody) {
273
+ return function(request, _rawBody) {
274
274
  return _async_to_generator$2(function() {
275
275
  var requestBodyString, valid, requestBody, result;
276
276
  return _ts_generator$2(this, function(_state) {
@@ -830,7 +830,14 @@ function _class_call_check$3(instance, Constructor) {
830
830
  throw new TypeError("Cannot call a class as a function");
831
831
  }
832
832
  }
833
- function vapiaiWebhookServiceConfigFactory(configService) {
833
+ /**
834
+ * Factory that creates a VapiAiWebhookServiceConfig from environment variables.
835
+ *
836
+ * Reads the webhook secret, HMAC secret, verification type, and signature prefix from environment variables.
837
+ *
838
+ * @param configService - NestJS config service for reading environment variables
839
+ * @returns a validated VapiAiWebhookServiceConfig
840
+ */ function vapiaiWebhookServiceConfigFactory(configService) {
834
841
  var config = {
835
842
  webhookConfig: {
836
843
  secret: configService.get(VAPI_AI_WEBHOOK_SECRET_TOKEN_ENV_VAR),
@@ -842,7 +849,11 @@ function vapiaiWebhookServiceConfigFactory(configService) {
842
849
  VapiAiWebhookServiceConfig.assertValidConfig(config);
843
850
  return config;
844
851
  }
845
- exports.VapiAiWebhookModule = function VapiAiWebhookModule() {
852
+ /**
853
+ * NestJS module that handles incoming Vapi AI webhook events.
854
+ *
855
+ * Provides the VapiAiWebhookService and controller for verifying and processing Vapi AI webhook payloads.
856
+ */ exports.VapiAiWebhookModule = function VapiAiWebhookModule() {
846
857
  _class_call_check$3(this, VapiAiWebhookModule);
847
858
  };
848
859
  exports.VapiAiWebhookModule = __decorate([
@@ -989,7 +1000,14 @@ function _class_call_check(instance, Constructor) {
989
1000
  throw new TypeError("Cannot call a class as a function");
990
1001
  }
991
1002
  }
992
- function vapiaiServiceConfigFactory(configService) {
1003
+ /**
1004
+ * Factory that creates a VapiAiServiceConfig from environment variables.
1005
+ *
1006
+ * Reads the Vapi AI secret token from environment variables.
1007
+ *
1008
+ * @param configService - NestJS config service for reading environment variables
1009
+ * @returns a validated VapiAiServiceConfig
1010
+ */ function vapiaiServiceConfigFactory(configService) {
993
1011
  var config = {
994
1012
  vapiai: {
995
1013
  config: {
@@ -1000,7 +1018,11 @@ function vapiaiServiceConfigFactory(configService) {
1000
1018
  VapiAiServiceConfig.assertValidConfig(config);
1001
1019
  return config;
1002
1020
  }
1003
- exports.VapiAiModule = function VapiAiModule() {
1021
+ /**
1022
+ * NestJS module that provides the VapiAiApi service.
1023
+ *
1024
+ * Reads the Vapi AI secret token from environment variables for API authentication.
1025
+ */ exports.VapiAiModule = function VapiAiModule() {
1004
1026
  _class_call_check(this, VapiAiModule);
1005
1027
  };
1006
1028
  exports.VapiAiModule = __decorate([
@@ -236,25 +236,26 @@ function _ts_generator$2(thisArg, body) {
236
236
  }
237
237
  }
238
238
  /**
239
- * Verifies a VapiAi webhook event header.
239
+ * Creates a verifier for Vapi AI webhook events.
240
240
  *
241
- * @param vapiSecretTokenGetter The VapiAi secret token. The Vapi client allows for using an AsyncGetterOrValue type, so the verifier supports that as well.
242
- * @returns A function that verifies a VapiAi webhook event.
241
+ * Supports secret token, HMAC SHA-256, and no-op verification modes based on the provided configuration.
242
+ *
243
+ * @param config - the verification configuration including secret tokens, verification type, and signature prefix
244
+ * @returns a VapiAiWebhookEventVerifier function that validates incoming webhook requests
243
245
  */ function vapiAiWebhookEventVerifier(config) {
244
246
  var _ref;
245
247
  var inputVerificationType = config.verificationType, inputSecret = config.secret, inputHmacSecret = config.hmacSecret, inputSignaturePrefix = config.signaturePrefix;
246
248
  var verificationType = inputVerificationType !== null && inputVerificationType !== void 0 ? inputVerificationType : inputHmacSecret != null ? 'hmac' : 'secret'; // default to secret always, never default to none
247
249
  var secretToken = (_ref = verificationType === 'hmac' ? inputHmacSecret !== null && inputHmacSecret !== void 0 ? inputHmacSecret : inputSecret : inputSecret) !== null && _ref !== void 0 ? _ref : '';
248
250
  var signaturePrefix = inputSignaturePrefix !== null && inputSignaturePrefix !== void 0 ? inputSignaturePrefix : '';
249
- function verifyNone(input) {
251
+ function verifyNone(_input) {
250
252
  return true;
251
253
  }
252
254
  function verifySecret(input) {
253
255
  var request = input.request;
254
256
  var headers = request.headers;
255
257
  var vapiSecret = headers['x-vapi-secret'];
256
- var valid = vapiSecret === secretToken;
257
- return valid;
258
+ return vapiSecret === secretToken;
258
259
  }
259
260
  function verifyHmac(input) {
260
261
  var request = input.request, requestBodyString = input.requestBodyString;
@@ -264,11 +265,10 @@ function _ts_generator$2(thisArg, body) {
264
265
  var message = "".concat(timestamp, ".").concat(requestBodyString);
265
266
  var hashForVerify = createHmac('sha256', secretToken).update(message).digest('hex');
266
267
  var signature = "".concat(signaturePrefix).concat(hashForVerify);
267
- var valid = vapiSignature === signature;
268
- return valid;
268
+ return vapiSignature === signature;
269
269
  }
270
270
  var verify = verificationType === 'hmac' ? verifyHmac : verificationType === 'secret' ? verifySecret : verifyNone;
271
- return function(request, rawBody) {
271
+ return function(request, _rawBody) {
272
272
  return _async_to_generator$2(function() {
273
273
  var requestBodyString, valid, requestBody, result;
274
274
  return _ts_generator$2(this, function(_state) {
@@ -828,7 +828,14 @@ function _class_call_check$3(instance, Constructor) {
828
828
  throw new TypeError("Cannot call a class as a function");
829
829
  }
830
830
  }
831
- function vapiaiWebhookServiceConfigFactory(configService) {
831
+ /**
832
+ * Factory that creates a VapiAiWebhookServiceConfig from environment variables.
833
+ *
834
+ * Reads the webhook secret, HMAC secret, verification type, and signature prefix from environment variables.
835
+ *
836
+ * @param configService - NestJS config service for reading environment variables
837
+ * @returns a validated VapiAiWebhookServiceConfig
838
+ */ function vapiaiWebhookServiceConfigFactory(configService) {
832
839
  var config = {
833
840
  webhookConfig: {
834
841
  secret: configService.get(VAPI_AI_WEBHOOK_SECRET_TOKEN_ENV_VAR),
@@ -840,7 +847,11 @@ function vapiaiWebhookServiceConfigFactory(configService) {
840
847
  VapiAiWebhookServiceConfig.assertValidConfig(config);
841
848
  return config;
842
849
  }
843
- var VapiAiWebhookModule = function VapiAiWebhookModule() {
850
+ /**
851
+ * NestJS module that handles incoming Vapi AI webhook events.
852
+ *
853
+ * Provides the VapiAiWebhookService and controller for verifying and processing Vapi AI webhook payloads.
854
+ */ var VapiAiWebhookModule = function VapiAiWebhookModule() {
844
855
  _class_call_check$3(this, VapiAiWebhookModule);
845
856
  };
846
857
  VapiAiWebhookModule = __decorate([
@@ -987,7 +998,14 @@ function _class_call_check(instance, Constructor) {
987
998
  throw new TypeError("Cannot call a class as a function");
988
999
  }
989
1000
  }
990
- function vapiaiServiceConfigFactory(configService) {
1001
+ /**
1002
+ * Factory that creates a VapiAiServiceConfig from environment variables.
1003
+ *
1004
+ * Reads the Vapi AI secret token from environment variables.
1005
+ *
1006
+ * @param configService - NestJS config service for reading environment variables
1007
+ * @returns a validated VapiAiServiceConfig
1008
+ */ function vapiaiServiceConfigFactory(configService) {
991
1009
  var config = {
992
1010
  vapiai: {
993
1011
  config: {
@@ -998,7 +1016,11 @@ function vapiaiServiceConfigFactory(configService) {
998
1016
  VapiAiServiceConfig.assertValidConfig(config);
999
1017
  return config;
1000
1018
  }
1001
- var VapiAiModule = function VapiAiModule() {
1019
+ /**
1020
+ * NestJS module that provides the VapiAiApi service.
1021
+ *
1022
+ * Reads the Vapi AI secret token from environment variables for API authentication.
1023
+ */ var VapiAiModule = function VapiAiModule() {
1002
1024
  _class_call_check(this, VapiAiModule);
1003
1025
  };
1004
1026
  VapiAiModule = __decorate([
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@dereekb/nestjs/vapiai",
3
- "version": "13.4.0",
3
+ "version": "13.4.1",
4
4
  "peerDependencies": {
5
- "@dereekb/date": "13.4.0",
6
- "@dereekb/model": "13.4.0",
7
- "@dereekb/nestjs": "13.4.0",
8
- "@dereekb/rxjs": "13.4.0",
9
- "@dereekb/util": "13.4.0",
5
+ "@dereekb/date": "13.4.1",
6
+ "@dereekb/model": "13.4.1",
7
+ "@dereekb/nestjs": "13.4.1",
8
+ "@dereekb/rxjs": "13.4.1",
9
+ "@dereekb/util": "13.4.1",
10
10
  "@nestjs/common": "^11.1.16",
11
11
  "@nestjs/config": "^4.0.3",
12
12
  "@vapi-ai/server-sdk": "^0.11.0",
@@ -1,6 +1,6 @@
1
1
  import { VapiClient } from '@vapi-ai/server-sdk';
2
2
  import { VapiAiServiceConfig } from './vapiai.config';
3
- import { type VapiCallWithTranscript } from './vapiai.type';
3
+ import { type VapiCallId, type VapiCallWithTranscript } from './vapiai.type';
4
4
  export declare class VapiAiApi {
5
5
  readonly config: VapiAiServiceConfig;
6
6
  readonly vapiClient: VapiClient;
@@ -11,5 +11,5 @@ export declare class VapiAiApi {
11
11
  * @param callId
12
12
  * @returns
13
13
  */
14
- getCall(callId: string): Promise<VapiCallWithTranscript>;
14
+ getCall(callId: VapiCallId): Promise<VapiCallWithTranscript>;
15
15
  }
@@ -1,5 +1,18 @@
1
1
  import { ConfigService } from '@nestjs/config';
2
2
  import { VapiAiServiceConfig } from './vapiai.config';
3
+ /**
4
+ * Factory that creates a VapiAiServiceConfig from environment variables.
5
+ *
6
+ * Reads the Vapi AI secret token from environment variables.
7
+ *
8
+ * @param configService - NestJS config service for reading environment variables
9
+ * @returns a validated VapiAiServiceConfig
10
+ */
3
11
  export declare function vapiaiServiceConfigFactory(configService: ConfigService): VapiAiServiceConfig;
12
+ /**
13
+ * NestJS module that provides the VapiAiApi service.
14
+ *
15
+ * Reads the Vapi AI secret token from environment variables for API authentication.
16
+ */
4
17
  export declare class VapiAiModule {
5
18
  }
@@ -1,5 +1,18 @@
1
1
  import { VapiAiWebhookServiceConfig } from './webhook.vapi.config';
2
2
  import { ConfigService } from '@nestjs/config';
3
+ /**
4
+ * Factory that creates a VapiAiWebhookServiceConfig from environment variables.
5
+ *
6
+ * Reads the webhook secret, HMAC secret, verification type, and signature prefix from environment variables.
7
+ *
8
+ * @param configService - NestJS config service for reading environment variables
9
+ * @returns a validated VapiAiWebhookServiceConfig
10
+ */
3
11
  export declare function vapiaiWebhookServiceConfigFactory(configService: ConfigService): VapiAiWebhookServiceConfig;
12
+ /**
13
+ * NestJS module that handles incoming Vapi AI webhook events.
14
+ *
15
+ * Provides the VapiAiWebhookService and controller for verifying and processing Vapi AI webhook payloads.
16
+ */
4
17
  export declare class VapiAiWebhookModule {
5
18
  }
@@ -37,9 +37,11 @@ export interface VapiAiWebhookEventVerificationResult {
37
37
  */
38
38
  export type VapiAiWebhookEventVerifier = (req: Request, rawBody: Buffer) => Promise<VapiAiWebhookEventVerificationResult>;
39
39
  /**
40
- * Verifies a VapiAi webhook event header.
40
+ * Creates a verifier for Vapi AI webhook events.
41
41
  *
42
- * @param vapiSecretTokenGetter The VapiAi secret token. The Vapi client allows for using an AsyncGetterOrValue type, so the verifier supports that as well.
43
- * @returns A function that verifies a VapiAi webhook event.
42
+ * Supports secret token, HMAC SHA-256, and no-op verification modes based on the provided configuration.
43
+ *
44
+ * @param config - the verification configuration including secret tokens, verification type, and signature prefix
45
+ * @returns a VapiAiWebhookEventVerifier function that validates incoming webhook requests
44
46
  */
45
47
  export declare function vapiAiWebhookEventVerifier(config: VapiApiWebhookEventVerificationConfig): VapiAiWebhookEventVerifier;