@dereekb/nestjs 13.4.0 → 13.4.2

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 -9
  2. package/discord/index.esm.js +31 -9
  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 +59 -32
  14. package/mailgun/index.esm.js +60 -33
  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 +24 -7
  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 -10
  22. package/openai/index.esm.js +31 -10
  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 -9
  38. package/stripe/index.esm.js +35 -9
  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 -16
  45. package/typeform/index.esm.js +56 -16
  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 +1 -1
  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 -14
  54. package/vapiai/index.esm.js +35 -14
  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
@@ -76,7 +76,6 @@ var vapiaiEventHandlerFactory = util.handlerFactory(function(x) {
76
76
  });
77
77
  var vapiaiEventHandlerConfigurerFactory = util.handlerConfigurerFactory({
78
78
  configurerForAccessor: function configurerForAccessor(accessor) {
79
- // eslint-disable-next-line
80
79
  var fnWithKey = util.handlerMappedSetFunctionFactory(accessor, vapiAiWebhookEvent);
81
80
  var configurer = _object_spread_props(_object_spread$1({}, accessor), {
82
81
  handleAssistantRequest: fnWithKey('assistant-request'),
@@ -238,25 +237,26 @@ function _ts_generator$2(thisArg, body) {
238
237
  }
239
238
  }
240
239
  /**
241
- * Verifies a VapiAi webhook event header.
240
+ * Creates a verifier for Vapi AI webhook events.
242
241
  *
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.
242
+ * Supports secret token, HMAC SHA-256, and no-op verification modes based on the provided configuration.
243
+ *
244
+ * @param config - the verification configuration including secret tokens, verification type, and signature prefix
245
+ * @returns a VapiAiWebhookEventVerifier function that validates incoming webhook requests
245
246
  */ function vapiAiWebhookEventVerifier(config) {
246
247
  var _ref;
247
248
  var inputVerificationType = config.verificationType, inputSecret = config.secret, inputHmacSecret = config.hmacSecret, inputSignaturePrefix = config.signaturePrefix;
248
249
  var verificationType = inputVerificationType !== null && inputVerificationType !== void 0 ? inputVerificationType : inputHmacSecret != null ? 'hmac' : 'secret'; // default to secret always, never default to none
249
250
  var secretToken = (_ref = verificationType === 'hmac' ? inputHmacSecret !== null && inputHmacSecret !== void 0 ? inputHmacSecret : inputSecret : inputSecret) !== null && _ref !== void 0 ? _ref : '';
250
251
  var signaturePrefix = inputSignaturePrefix !== null && inputSignaturePrefix !== void 0 ? inputSignaturePrefix : '';
251
- function verifyNone(input) {
252
+ function verifyNone(_input) {
252
253
  return true;
253
254
  }
254
255
  function verifySecret(input) {
255
256
  var request = input.request;
256
257
  var headers = request.headers;
257
258
  var vapiSecret = headers['x-vapi-secret'];
258
- var valid = vapiSecret === secretToken;
259
- return valid;
259
+ return vapiSecret === secretToken;
260
260
  }
261
261
  function verifyHmac(input) {
262
262
  var request = input.request, requestBodyString = input.requestBodyString;
@@ -266,11 +266,10 @@ function _ts_generator$2(thisArg, body) {
266
266
  var message = "".concat(timestamp, ".").concat(requestBodyString);
267
267
  var hashForVerify = crypto.createHmac('sha256', secretToken).update(message).digest('hex');
268
268
  var signature = "".concat(signaturePrefix).concat(hashForVerify);
269
- var valid = vapiSignature === signature;
270
- return valid;
269
+ return vapiSignature === signature;
271
270
  }
272
271
  var verify = verificationType === 'hmac' ? verifyHmac : verificationType === 'secret' ? verifySecret : verifyNone;
273
- return function(request, rawBody) {
272
+ return function(request, _rawBody) {
274
273
  return _async_to_generator$2(function() {
275
274
  var requestBodyString, valid, requestBody, result;
276
275
  return _ts_generator$2(this, function(_state) {
@@ -830,7 +829,14 @@ function _class_call_check$3(instance, Constructor) {
830
829
  throw new TypeError("Cannot call a class as a function");
831
830
  }
832
831
  }
833
- function vapiaiWebhookServiceConfigFactory(configService) {
832
+ /**
833
+ * Factory that creates a VapiAiWebhookServiceConfig from environment variables.
834
+ *
835
+ * Reads the webhook secret, HMAC secret, verification type, and signature prefix from environment variables.
836
+ *
837
+ * @param configService - NestJS config service for reading environment variables
838
+ * @returns a validated VapiAiWebhookServiceConfig
839
+ */ function vapiaiWebhookServiceConfigFactory(configService) {
834
840
  var config = {
835
841
  webhookConfig: {
836
842
  secret: configService.get(VAPI_AI_WEBHOOK_SECRET_TOKEN_ENV_VAR),
@@ -842,7 +848,11 @@ function vapiaiWebhookServiceConfigFactory(configService) {
842
848
  VapiAiWebhookServiceConfig.assertValidConfig(config);
843
849
  return config;
844
850
  }
845
- exports.VapiAiWebhookModule = function VapiAiWebhookModule() {
851
+ /**
852
+ * NestJS module that handles incoming Vapi AI webhook events.
853
+ *
854
+ * Provides the VapiAiWebhookService and controller for verifying and processing Vapi AI webhook payloads.
855
+ */ exports.VapiAiWebhookModule = function VapiAiWebhookModule() {
846
856
  _class_call_check$3(this, VapiAiWebhookModule);
847
857
  };
848
858
  exports.VapiAiWebhookModule = __decorate([
@@ -989,7 +999,14 @@ function _class_call_check(instance, Constructor) {
989
999
  throw new TypeError("Cannot call a class as a function");
990
1000
  }
991
1001
  }
992
- function vapiaiServiceConfigFactory(configService) {
1002
+ /**
1003
+ * Factory that creates a VapiAiServiceConfig from environment variables.
1004
+ *
1005
+ * Reads the Vapi AI secret token from environment variables.
1006
+ *
1007
+ * @param configService - NestJS config service for reading environment variables
1008
+ * @returns a validated VapiAiServiceConfig
1009
+ */ function vapiaiServiceConfigFactory(configService) {
993
1010
  var config = {
994
1011
  vapiai: {
995
1012
  config: {
@@ -1000,7 +1017,11 @@ function vapiaiServiceConfigFactory(configService) {
1000
1017
  VapiAiServiceConfig.assertValidConfig(config);
1001
1018
  return config;
1002
1019
  }
1003
- exports.VapiAiModule = function VapiAiModule() {
1020
+ /**
1021
+ * NestJS module that provides the VapiAiApi service.
1022
+ *
1023
+ * Reads the Vapi AI secret token from environment variables for API authentication.
1024
+ */ exports.VapiAiModule = function VapiAiModule() {
1004
1025
  _class_call_check(this, VapiAiModule);
1005
1026
  };
1006
1027
  exports.VapiAiModule = __decorate([
@@ -74,7 +74,6 @@ var vapiaiEventHandlerFactory = handlerFactory(function(x) {
74
74
  });
75
75
  var vapiaiEventHandlerConfigurerFactory = handlerConfigurerFactory({
76
76
  configurerForAccessor: function configurerForAccessor(accessor) {
77
- // eslint-disable-next-line
78
77
  var fnWithKey = handlerMappedSetFunctionFactory(accessor, vapiAiWebhookEvent);
79
78
  var configurer = _object_spread_props(_object_spread$1({}, accessor), {
80
79
  handleAssistantRequest: fnWithKey('assistant-request'),
@@ -236,25 +235,26 @@ function _ts_generator$2(thisArg, body) {
236
235
  }
237
236
  }
238
237
  /**
239
- * Verifies a VapiAi webhook event header.
238
+ * Creates a verifier for Vapi AI webhook events.
240
239
  *
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.
240
+ * Supports secret token, HMAC SHA-256, and no-op verification modes based on the provided configuration.
241
+ *
242
+ * @param config - the verification configuration including secret tokens, verification type, and signature prefix
243
+ * @returns a VapiAiWebhookEventVerifier function that validates incoming webhook requests
243
244
  */ function vapiAiWebhookEventVerifier(config) {
244
245
  var _ref;
245
246
  var inputVerificationType = config.verificationType, inputSecret = config.secret, inputHmacSecret = config.hmacSecret, inputSignaturePrefix = config.signaturePrefix;
246
247
  var verificationType = inputVerificationType !== null && inputVerificationType !== void 0 ? inputVerificationType : inputHmacSecret != null ? 'hmac' : 'secret'; // default to secret always, never default to none
247
248
  var secretToken = (_ref = verificationType === 'hmac' ? inputHmacSecret !== null && inputHmacSecret !== void 0 ? inputHmacSecret : inputSecret : inputSecret) !== null && _ref !== void 0 ? _ref : '';
248
249
  var signaturePrefix = inputSignaturePrefix !== null && inputSignaturePrefix !== void 0 ? inputSignaturePrefix : '';
249
- function verifyNone(input) {
250
+ function verifyNone(_input) {
250
251
  return true;
251
252
  }
252
253
  function verifySecret(input) {
253
254
  var request = input.request;
254
255
  var headers = request.headers;
255
256
  var vapiSecret = headers['x-vapi-secret'];
256
- var valid = vapiSecret === secretToken;
257
- return valid;
257
+ return vapiSecret === secretToken;
258
258
  }
259
259
  function verifyHmac(input) {
260
260
  var request = input.request, requestBodyString = input.requestBodyString;
@@ -264,11 +264,10 @@ function _ts_generator$2(thisArg, body) {
264
264
  var message = "".concat(timestamp, ".").concat(requestBodyString);
265
265
  var hashForVerify = createHmac('sha256', secretToken).update(message).digest('hex');
266
266
  var signature = "".concat(signaturePrefix).concat(hashForVerify);
267
- var valid = vapiSignature === signature;
268
- return valid;
267
+ return vapiSignature === signature;
269
268
  }
270
269
  var verify = verificationType === 'hmac' ? verifyHmac : verificationType === 'secret' ? verifySecret : verifyNone;
271
- return function(request, rawBody) {
270
+ return function(request, _rawBody) {
272
271
  return _async_to_generator$2(function() {
273
272
  var requestBodyString, valid, requestBody, result;
274
273
  return _ts_generator$2(this, function(_state) {
@@ -828,7 +827,14 @@ function _class_call_check$3(instance, Constructor) {
828
827
  throw new TypeError("Cannot call a class as a function");
829
828
  }
830
829
  }
831
- function vapiaiWebhookServiceConfigFactory(configService) {
830
+ /**
831
+ * Factory that creates a VapiAiWebhookServiceConfig from environment variables.
832
+ *
833
+ * Reads the webhook secret, HMAC secret, verification type, and signature prefix from environment variables.
834
+ *
835
+ * @param configService - NestJS config service for reading environment variables
836
+ * @returns a validated VapiAiWebhookServiceConfig
837
+ */ function vapiaiWebhookServiceConfigFactory(configService) {
832
838
  var config = {
833
839
  webhookConfig: {
834
840
  secret: configService.get(VAPI_AI_WEBHOOK_SECRET_TOKEN_ENV_VAR),
@@ -840,7 +846,11 @@ function vapiaiWebhookServiceConfigFactory(configService) {
840
846
  VapiAiWebhookServiceConfig.assertValidConfig(config);
841
847
  return config;
842
848
  }
843
- var VapiAiWebhookModule = function VapiAiWebhookModule() {
849
+ /**
850
+ * NestJS module that handles incoming Vapi AI webhook events.
851
+ *
852
+ * Provides the VapiAiWebhookService and controller for verifying and processing Vapi AI webhook payloads.
853
+ */ var VapiAiWebhookModule = function VapiAiWebhookModule() {
844
854
  _class_call_check$3(this, VapiAiWebhookModule);
845
855
  };
846
856
  VapiAiWebhookModule = __decorate([
@@ -987,7 +997,14 @@ function _class_call_check(instance, Constructor) {
987
997
  throw new TypeError("Cannot call a class as a function");
988
998
  }
989
999
  }
990
- function vapiaiServiceConfigFactory(configService) {
1000
+ /**
1001
+ * Factory that creates a VapiAiServiceConfig from environment variables.
1002
+ *
1003
+ * Reads the Vapi AI secret token from environment variables.
1004
+ *
1005
+ * @param configService - NestJS config service for reading environment variables
1006
+ * @returns a validated VapiAiServiceConfig
1007
+ */ function vapiaiServiceConfigFactory(configService) {
991
1008
  var config = {
992
1009
  vapiai: {
993
1010
  config: {
@@ -998,7 +1015,11 @@ function vapiaiServiceConfigFactory(configService) {
998
1015
  VapiAiServiceConfig.assertValidConfig(config);
999
1016
  return config;
1000
1017
  }
1001
- var VapiAiModule = function VapiAiModule() {
1018
+ /**
1019
+ * NestJS module that provides the VapiAiApi service.
1020
+ *
1021
+ * Reads the Vapi AI secret token from environment variables for API authentication.
1022
+ */ var VapiAiModule = function VapiAiModule() {
1002
1023
  _class_call_check(this, VapiAiModule);
1003
1024
  };
1004
1025
  VapiAiModule = __decorate([
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@dereekb/nestjs/vapiai",
3
- "version": "13.4.0",
3
+ "version": "13.4.2",
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.2",
6
+ "@dereekb/model": "13.4.2",
7
+ "@dereekb/nestjs": "13.4.2",
8
+ "@dereekb/rxjs": "13.4.2",
9
+ "@dereekb/util": "13.4.2",
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;