Socket
Socket
Sign inDemoInstall

mappersmith

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mappersmith - npm Package Compare versions

Comparing version 2.32.1 to 2.33.0

2

mappersmith.js

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

/* global VERSION */
var version = "2.32.1";
var version = "2.33.0";
exports.version = version;

@@ -19,0 +19,0 @@ var configs = {

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

* @param {String} obj.host
* @param {String} obj.path
* @param {String|Function} obj.path
* @param {String} obj.method

@@ -15,0 +15,0 @@ * @param {Object} obj.headers

{
"name": "mappersmith",
"version": "2.32.1",
"version": "2.33.0",
"description": "It is a lightweight rest client for node.js and the browser",

@@ -5,0 +5,0 @@ "author": "Tulio Ornelas <ornelas.tulio@gmail.com>",

@@ -125,3 +125,3 @@ [![npm version](https://badge.fury.io/js/mappersmith.svg)](http://badge.fury.io/js/mappersmith)

// {group} is also a dynamic segment but it has default value "general"
byGroup: { path: '/users/groups/{group}', params: { group: 'general' } }
byGroup: { path: '/users/groups/{group}', params: { group: 'general' } },

@@ -144,3 +144,6 @@ // {market?} is an optional dynamic segment. If called without a value

// constructing the query string
bySubject: { path: '/blogs', queryParamAlias: { subjectId: 'subject_id' } }
bySubject: { path: '/blogs', queryParamAlias: { subjectId: 'subject_id' } },
// `path` is a function to map passed params to a custom path
byDate: { path: ({date}) => `${date.getYear()}/${date.getMonth()}/${date.getDate()}` }
}

@@ -147,0 +150,0 @@ }

@@ -80,10 +80,16 @@ "use strict";

var path = this.methodDescriptor.path;
var params = this.params();
var path;
if (this.methodDescriptor.path[0] !== '/') {
path = "/".concat(this.methodDescriptor.path);
if (typeof this.methodDescriptor.path === 'function') {
path = this.methodDescriptor.path(params);
} else {
path = this.methodDescriptor.path;
}
var params = this.params(); // RegExp with 'g'-flag is stateful, therefore defining it locally
if (path[0] !== '/') {
path = "/".concat(path);
} // RegExp with 'g'-flag is stateful, therefore defining it locally
var regexp = new RegExp(REGEXP_DYNAMIC_SEGMENT, 'g');

@@ -90,0 +96,0 @@ var dynamicSegmentKeys = [];

@@ -13,2 +13,3 @@ /// <reference path="./middleware/basic-auth.d.ts" />

declare module 'mappersmith' {
export interface Headers {

@@ -26,3 +27,3 @@ readonly [header: string]: string

readonly timeout?: number
[param: string]: object | string | number | undefined
[param: string]: object | string | number | boolean | undefined
}

@@ -141,3 +142,2 @@

export interface HTTPGateway extends Gateway, NetworkGateway {
configure(): object
createResponse(response: Response, rawData: string): Response

@@ -165,5 +165,21 @@ onError(error: Error): void

export interface HTTPRequestParams {
[key: string]: any
}
export interface HTTPGatewayConfiguration {
configure?(requestParams: HTTPRequestParams): HTTPRequestParams
onRequestWillStart?(requestParams: HTTPRequestParams): void
onRequestSocketAssigned?(requestParams: HTTPRequestParams): void
onSocketLookup?(requestParams: HTTPRequestParams): void
onSocketConnect?(requestParams: HTTPRequestParams): void
onSocketSecureConnect?(requestParams: HTTPRequestParams): void
onResponseReadable?(requestParams: HTTPRequestParams): void
onResponseEnd?(requestParams: HTTPRequestParams): void
useSocketConnectionTimeout?: boolean
}
export interface GatewayConfiguration {
Fetch: object
HTTP: Partial<HTTPGateway>
HTTP: HTTPGatewayConfiguration
Mock: object

@@ -170,0 +186,0 @@ XHR: Partial<XhrGateway>

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc