Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nestlab/google-recaptcha

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestlab/google-recaptcha - npm Package Compare versions

Comparing version 3.2.0 to 3.3.0

1

google-recaptcha.module.d.ts

@@ -12,3 +12,2 @@ import { DynamicModule } from '@nestjs/common';

private static isGoogleRecaptchaFactory;
private static createAxiosInstance;
}

@@ -11,3 +11,3 @@ "use strict";

const core_1 = require("@nestjs/core");
const axios = require("axios");
const axios_1 = require("axios");
const https_1 = require("https");

@@ -17,3 +17,2 @@ const recaptcha_validator_resolver_1 = require("./services/recaptcha-validator.resolver");

const xor_1 = require("./helpers/xor");
const axios_1 = require("@nestjs/axios");
class GoogleRecaptchaModule {

@@ -41,9 +40,4 @@ static forRoot(options) {

{
provide: provider_declarations_1.RECAPTCHA_HTTP_SERVICE,
useFactory: (axiosInstance) => new axios_1.HttpService(axiosInstance),
inject: [provider_declarations_1.RECAPTCHA_AXIOS_INSTANCE],
},
{
provide: provider_declarations_1.RECAPTCHA_AXIOS_INSTANCE,
useFactory: () => this.createAxiosInstance(this.transformAxiosConfig(Object.assign(Object.assign(Object.assign({}, this.axiosDefaultConfig), options.axiosConfig), { headers: null }))),
useFactory: () => axios_1.default.create(this.transformAxiosConfig(Object.assign(Object.assign(Object.assign({}, this.axiosDefaultConfig), options.axiosConfig), { headers: null }))),
},

@@ -76,7 +70,2 @@ ];

{
provide: provider_declarations_1.RECAPTCHA_HTTP_SERVICE,
useFactory: (axiosInstance) => new axios_1.HttpService(axiosInstance),
inject: [provider_declarations_1.RECAPTCHA_AXIOS_INSTANCE],
},
{
provide: provider_declarations_1.RECAPTCHA_AXIOS_INSTANCE,

@@ -86,3 +75,3 @@ useFactory: (options) => {

const transformedAxiosConfig = this.transformAxiosConfig(Object.assign(Object.assign(Object.assign({}, this.axiosDefaultConfig), options.axiosConfig), { headers: null }));
return this.createAxiosInstance(transformedAxiosConfig);
return axios_1.default.create(transformedAxiosConfig);
},

@@ -152,5 +141,2 @@ inject: [provider_declarations_1.RECAPTCHA_OPTIONS],

}
static createAxiosInstance(axiosConfig) {
return axios['create'](axiosConfig); // TODO: Updated when axios ts declaration will be fixed
}
}

@@ -157,0 +143,0 @@ exports.GoogleRecaptchaModule = GoogleRecaptchaModule;

12

package.json
{
"name": "@nestlab/google-recaptcha",
"version": "3.2.0",
"version": "3.3.0",
"description": "Google recaptcha module for NestJS.",

@@ -33,8 +33,8 @@ "keywords": [

"homepage": "https://github.com/chvarkov/google-recaptcha",
"dependencies": {
"axios": "^1.3.4"
},
"peerDependencies": {
"@nestjs/axios": ">=1.0.0 <2.0.0",
"@nestjs/common": ">=8.0.0 <10.0.0",
"@nestjs/core": ">=8.0.0 <10.0.0",
"rxjs": ">=7.0.0 <8.0.0",
"axios": ">=1.0.0 <2.0.0"
"@nestjs/core": ">=8.0.0 <10.0.0"
},

@@ -48,3 +48,3 @@ "peerDependenciesMeta": {

"@nestjs/apollo": "^10.0.22",
"@nestjs/axios": "^1.0.0",
"@nestjs/axios": "^2.0.0",
"@nestjs/common": "^9.0.11",

@@ -51,0 +51,0 @@ "@nestjs/core": "^9.0.11",

export declare const RECAPTCHA_OPTIONS: unique symbol;
export declare const RECAPTCHA_VALIDATION_OPTIONS: unique symbol;
export declare const RECAPTCHA_AXIOS_INSTANCE = "RECAPTCHA_AXIOS_INSTANCE";
export declare const RECAPTCHA_HTTP_SERVICE = "RECAPTCHA_HTTP_SERVICE";
export declare const RECAPTCHA_LOGGER = "RECAPTCHA_LOGGER";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RECAPTCHA_LOGGER = exports.RECAPTCHA_HTTP_SERVICE = exports.RECAPTCHA_AXIOS_INSTANCE = exports.RECAPTCHA_VALIDATION_OPTIONS = exports.RECAPTCHA_OPTIONS = void 0;
exports.RECAPTCHA_LOGGER = exports.RECAPTCHA_AXIOS_INSTANCE = exports.RECAPTCHA_VALIDATION_OPTIONS = exports.RECAPTCHA_OPTIONS = void 0;
exports.RECAPTCHA_OPTIONS = Symbol('RECAPTCHA_OPTIONS');
exports.RECAPTCHA_VALIDATION_OPTIONS = Symbol('RECAPTCHA_VALIDATION_OPTIONS');
exports.RECAPTCHA_AXIOS_INSTANCE = 'RECAPTCHA_AXIOS_INSTANCE';
exports.RECAPTCHA_HTTP_SERVICE = 'RECAPTCHA_HTTP_SERVICE';
exports.RECAPTCHA_LOGGER = 'RECAPTCHA_LOGGER';
//# sourceMappingURL=provider.declarations.js.map

@@ -238,3 +238,3 @@ # Google recaptcha module

@Post('send')
async send(@RecaptchaResult() recaptchaResult: GoogleRecaptchaValidationResult): Promise<any> {
async send(@RecaptchaResult() recaptchaResult: RecaptchaVerificationResult): Promise<any> {
console.log(`Action: ${recaptchaResult.action} Score: ${recaptchaResult.score}`);

@@ -241,0 +241,0 @@ // TODO: Your implementation.

import { Logger } from '@nestjs/common';
import { HttpService } from '@nestjs/axios';
import { GoogleRecaptchaModuleOptions } from '../../interfaces/google-recaptcha-module-options';

@@ -9,10 +8,11 @@ import { VerifyResponseOptions } from '../../interfaces/verify-response-decorator-options';

import { EnterpriseReasonTransformer } from '../enterprise-reason.transformer';
import { AxiosInstance } from 'axios';
export declare class GoogleRecaptchaEnterpriseValidator extends AbstractGoogleRecaptchaValidator<VerifyResponseEnterprise> {
private readonly http;
private readonly axios;
private readonly logger;
private readonly enterpriseReasonTransformer;
private readonly headers;
constructor(http: HttpService, logger: Logger, options: GoogleRecaptchaModuleOptions, enterpriseReasonTransformer: EnterpriseReasonTransformer);
constructor(axios: AxiosInstance, logger: Logger, options: GoogleRecaptchaModuleOptions, enterpriseReasonTransformer: EnterpriseReasonTransformer);
validate(options: VerifyResponseOptions): Promise<RecaptchaVerificationResult<VerifyResponseEnterprise>>;
private verifyResponse;
}

@@ -18,3 +18,2 @@ "use strict";

const provider_declarations_1 = require("../../provider.declarations");
const axios_1 = require("@nestjs/axios");
const abstract_google_recaptcha_validator_1 = require("./abstract-google-recaptcha-validator");

@@ -26,8 +25,7 @@ const recaptcha_verification_result_1 = require("../../models/recaptcha-verification-result");

const enterprise_reason_transformer_1 = require("../enterprise-reason.transformer");
const rxjs_1 = require("rxjs");
const get_error_info_1 = require("../../helpers/get-error-info");
let GoogleRecaptchaEnterpriseValidator = class GoogleRecaptchaEnterpriseValidator extends abstract_google_recaptcha_validator_1.AbstractGoogleRecaptchaValidator {
constructor(http, logger, options, enterpriseReasonTransformer) {
constructor(axios, logger, options, enterpriseReasonTransformer) {
super(options);
this.http = http;
this.axios = axios;
this.logger = logger;

@@ -91,3 +89,3 @@ this.enterpriseReasonTransformer = enterpriseReasonTransformer;

}
return (0, rxjs_1.firstValueFrom)(this.http.post(url, body, config))
return this.axios.post(url, body, config)
.then((res) => res.data)

@@ -118,9 +116,8 @@ .then((data) => {

(0, common_1.Injectable)(),
__param(0, (0, common_1.Inject)(provider_declarations_1.RECAPTCHA_HTTP_SERVICE)),
__param(0, (0, common_1.Inject)(provider_declarations_1.RECAPTCHA_AXIOS_INSTANCE)),
__param(1, (0, common_1.Inject)(provider_declarations_1.RECAPTCHA_LOGGER)),
__param(2, (0, common_1.Inject)(provider_declarations_1.RECAPTCHA_OPTIONS)),
__metadata("design:paramtypes", [axios_1.HttpService,
common_1.Logger, Object, enterprise_reason_transformer_1.EnterpriseReasonTransformer])
__metadata("design:paramtypes", [Function, common_1.Logger, Object, enterprise_reason_transformer_1.EnterpriseReasonTransformer])
], GoogleRecaptchaEnterpriseValidator);
exports.GoogleRecaptchaEnterpriseValidator = GoogleRecaptchaEnterpriseValidator;
//# sourceMappingURL=google-recaptcha-enterprise.validator.js.map
import { Logger } from '@nestjs/common';
import { VerifyResponseOptions } from '../../interfaces/verify-response-decorator-options';
import { VerifyResponseV3 } from '../../interfaces/verify-response';
import { HttpService } from '@nestjs/axios';
import { GoogleRecaptchaModuleOptions } from '../../interfaces/google-recaptcha-module-options';
import { AbstractGoogleRecaptchaValidator } from './abstract-google-recaptcha-validator';
import { RecaptchaVerificationResult } from '../../models/recaptcha-verification-result';
import { AxiosInstance } from 'axios';
export declare class GoogleRecaptchaValidator extends AbstractGoogleRecaptchaValidator<VerifyResponseV3> {
private readonly http;
private readonly axios;
private readonly logger;
private readonly defaultNetwork;
private readonly headers;
constructor(http: HttpService, logger: Logger, options: GoogleRecaptchaModuleOptions);
constructor(axios: AxiosInstance, logger: Logger, options: GoogleRecaptchaModuleOptions);
/**

@@ -15,0 +15,0 @@ * @throws GoogleRecaptchaNetworkException

@@ -22,12 +22,10 @@ "use strict";

const google_recaptcha_network_exception_1 = require("../../exceptions/google-recaptcha-network.exception");
const axios_1 = require("@nestjs/axios");
const abstract_google_recaptcha_validator_1 = require("./abstract-google-recaptcha-validator");
const recaptcha_verification_result_1 = require("../../models/recaptcha-verification-result");
const google_recaptcha_context_1 = require("../../enums/google-recaptcha-context");
const rxjs_1 = require("rxjs");
const get_error_info_1 = require("../../helpers/get-error-info");
let GoogleRecaptchaValidator = class GoogleRecaptchaValidator extends abstract_google_recaptcha_validator_1.AbstractGoogleRecaptchaValidator {
constructor(http, logger, options) {
constructor(axios, logger, options) {
super(options);
this.http = http;
this.axios = axios;
this.logger = logger;

@@ -81,3 +79,3 @@ this.defaultNetwork = google_recaptcha_network_1.GoogleRecaptchaNetwork.Google;

}
return (0, rxjs_1.firstValueFrom)(this.http.post(url, body, config))
return this.axios.post(url, body, config)
.then((res) => res.data)

@@ -115,9 +113,8 @@ .then((data) => {

(0, common_1.Injectable)(),
__param(0, (0, common_1.Inject)(provider_declarations_1.RECAPTCHA_HTTP_SERVICE)),
__param(0, (0, common_1.Inject)(provider_declarations_1.RECAPTCHA_AXIOS_INSTANCE)),
__param(1, (0, common_1.Inject)(provider_declarations_1.RECAPTCHA_LOGGER)),
__param(2, (0, common_1.Inject)(provider_declarations_1.RECAPTCHA_OPTIONS)),
__metadata("design:paramtypes", [axios_1.HttpService,
common_1.Logger, Object])
__metadata("design:paramtypes", [Function, common_1.Logger, Object])
], GoogleRecaptchaValidator);
exports.GoogleRecaptchaValidator = GoogleRecaptchaValidator;
//# sourceMappingURL=google-recaptcha.validator.js.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc