New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mockoon/commons

Package Overview
Dependencies
Maintainers
0
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mockoon/commons - npm Package Compare versions

Comparing version

to
8.4.0

4

dist/cjs/libs/environment-mutators.d.ts

@@ -21,3 +21,3 @@ import { Callback, DataBucket, Environment } from '../models/environment.model';

*/
export declare const addRouteMutator: (environment: Environment, newRoute: Route, parentId: string | 'root') => Environment;
export declare const addRouteMutator: (environment: Environment, newRoute: Route, parentId: string | "root") => Environment;
/**

@@ -81,3 +81,3 @@ * Update a route direct properties in an environment

*/
export declare const addFolderMutator: (environment: Environment, newFolder: Folder, parentId: string | 'root') => Environment;
export declare const addFolderMutator: (environment: Environment, newFolder: Folder, parentId: string | "root") => Environment;
/**

@@ -84,0 +84,0 @@ * Update a folder direct properties in an environment

@@ -47,7 +47,7 @@ import { RouteDefault, RouteResponseDefault } from '../constants/environment-schema.constants';

headers: Header[];
body?: string | undefined;
filePath?: string | undefined;
sendFileAsBody?: boolean | undefined;
body?: string;
filePath?: string;
sendFileAsBody?: boolean;
bodyType: BodyTypes;
databucketID?: string | undefined;
databucketID?: string;
};

@@ -54,0 +54,0 @@ /**

@@ -91,2 +91,6 @@ import { Environment } from './environment.model';

maxTransactionLogs: number;
/**
* Enable random latency from 0 to value specified in the route settings. |
*/
enableRandomLatency: boolean;
};

@@ -43,5 +43,5 @@ import { Environment } from '../models/environment.model';

*/
export declare const moveItemAtTarget: <T extends string | {
export declare const moveItemAtTarget: <T extends {
uuid: string;
}>(items: T[], actionType: ReorderActionType, sourceId: string, targetId: string) => T[];
} | string>(items: T[], actionType: ReorderActionType, sourceId: string, targetId: string) => T[];
/**

@@ -64,2 +64,2 @@ * Sort a list of items by a list of UUIDs

*/
export declare const findRouteOrFolderContainer: (routeOrFolderUuid: string, environment: Environment) => 'root' | string | null;
export declare const findRouteOrFolderContainer: (routeOrFolderUuid: string, environment: Environment) => "root" | string | null;

@@ -80,1 +80,8 @@ import { Environment } from '../models/environment.model';

export declare const isContentTypeApplicationJson: (headers: Header[]) => boolean;
/**
* Get latency value (ms) depending on whether it should be randomized or not
*
* @param latency
* @param enableRandomLatency
*/
export declare const getLatency: (latency: number, enableRandomLatency: boolean) => number;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isContentTypeApplicationJson = exports.stringIncludesArrayItems = exports.deterministicStringify = exports.randomArrayItem = exports.RandomInt = exports.generateUUID = exports.repairRefs = exports.GenerateUniqueID = exports.RemoveLeadingSlash = exports.IsEqual = exports.CloneObject = exports.IsValidURL = exports.GetResponseCallbackContentType = exports.GetRouteResponseContentType = exports.GetContentType = void 0;
exports.getLatency = exports.isContentTypeApplicationJson = exports.stringIncludesArrayItems = exports.deterministicStringify = exports.randomArrayItem = exports.RandomInt = exports.generateUUID = exports.repairRefs = exports.GenerateUniqueID = exports.RemoveLeadingSlash = exports.IsEqual = exports.CloneObject = exports.IsValidURL = exports.GetResponseCallbackContentType = exports.GetRouteResponseContentType = exports.GetContentType = void 0;
const common_constants_1 = require("../constants/common.constants");

@@ -198,2 +198,10 @@ /**

exports.isContentTypeApplicationJson = isContentTypeApplicationJson;
/**
* Get latency value (ms) depending on whether it should be randomized or not
*
* @param latency
* @param enableRandomLatency
*/
const getLatency = (latency, enableRandomLatency) => enableRandomLatency ? (0, exports.RandomInt)(0, latency) : latency;
exports.getLatency = getLatency;
//# sourceMappingURL=utils.js.map

@@ -21,3 +21,3 @@ import { Callback, DataBucket, Environment } from '../models/environment.model';

*/
export declare const addRouteMutator: (environment: Environment, newRoute: Route, parentId: string | 'root') => Environment;
export declare const addRouteMutator: (environment: Environment, newRoute: Route, parentId: string | "root") => Environment;
/**

@@ -81,3 +81,3 @@ * Update a route direct properties in an environment

*/
export declare const addFolderMutator: (environment: Environment, newFolder: Folder, parentId: string | 'root') => Environment;
export declare const addFolderMutator: (environment: Environment, newFolder: Folder, parentId: string | "root") => Environment;
/**

@@ -84,0 +84,0 @@ * Update a folder direct properties in an environment

@@ -47,7 +47,7 @@ import { RouteDefault, RouteResponseDefault } from '../constants/environment-schema.constants';

headers: Header[];
body?: string | undefined;
filePath?: string | undefined;
sendFileAsBody?: boolean | undefined;
body?: string;
filePath?: string;
sendFileAsBody?: boolean;
bodyType: BodyTypes;
databucketID?: string | undefined;
databucketID?: string;
};

@@ -54,0 +54,0 @@ /**

@@ -91,2 +91,6 @@ import { Environment } from './environment.model';

maxTransactionLogs: number;
/**
* Enable random latency from 0 to value specified in the route settings. |
*/
enableRandomLatency: boolean;
};

@@ -43,5 +43,5 @@ import { Environment } from '../models/environment.model';

*/
export declare const moveItemAtTarget: <T extends string | {
export declare const moveItemAtTarget: <T extends {
uuid: string;
}>(items: T[], actionType: ReorderActionType, sourceId: string, targetId: string) => T[];
} | string>(items: T[], actionType: ReorderActionType, sourceId: string, targetId: string) => T[];
/**

@@ -64,2 +64,2 @@ * Sort a list of items by a list of UUIDs

*/
export declare const findRouteOrFolderContainer: (routeOrFolderUuid: string, environment: Environment) => 'root' | string | null;
export declare const findRouteOrFolderContainer: (routeOrFolderUuid: string, environment: Environment) => "root" | string | null;

@@ -80,1 +80,8 @@ import { Environment } from '../models/environment.model';

export declare const isContentTypeApplicationJson: (headers: Header[]) => boolean;
/**
* Get latency value (ms) depending on whether it should be randomized or not
*
* @param latency
* @param enableRandomLatency
*/
export declare const getLatency: (latency: number, enableRandomLatency: boolean) => number;

@@ -180,2 +180,9 @@ import { ParsedJSONBodyMimeTypes } from '../constants/common.constants';

};
/**
* Get latency value (ms) depending on whether it should be randomized or not
*
* @param latency
* @param enableRandomLatency
*/
export const getLatency = (latency, enableRandomLatency) => enableRandomLatency ? RandomInt(0, latency) : latency;
//# sourceMappingURL=utils.js.map
{
"name": "@mockoon/commons",
"description": "Mockoon's commons library. Used in Mockoon desktop application and CLI.",
"version": "8.3.0",
"version": "8.4.0",
"author": {

@@ -35,16 +35,16 @@ "name": "Guillaume Monnet",

"dependencies": {
"joi": "17.13.0"
"joi": "17.13.3"
},
"devDependencies": {
"@types/mocha": "10.0.6",
"@types/node": "20.12.7",
"@typescript-eslint/eslint-plugin": "7.7.1",
"@typescript-eslint/parser": "7.7.1",
"@types/mocha": "10.0.7",
"@types/node": "22.0.0",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
"eslint": "8.57.0",
"eslint-plugin-jsdoc": "48.2.3",
"mocha": "10.4.0",
"eslint-plugin-jsdoc": "48.10.2",
"mocha": "10.7.0",
"ts-mocha": "10.0.0",
"typescript": "5.4.5"
"typescript": "5.5.4"
},
"gitHead": "e47a16b88354c68ec344c5ebbad556e4e3b4db9f"
"gitHead": "12a46dcdae435270d9974bb390ef88d8a4c95c0f"
}

@@ -32,5 +32,5 @@ <div align="center">

## Subscribe to Mockoon Pro
## Subscribe to Mockoon Cloud
With advanced features for solo developers and teams, Mockoon Pro supercharges your API development:
With advanced features for solo developers and teams, Mockoon Cloud supercharges your API development:

@@ -40,3 +40,3 @@ - ☁️ [cloud deployments](https://mockoon.com/docs/latest/mockoon-cloud/api-mock-cloud-deployments/)

- 🤖 [AI powered API mocking](https://mockoon.com/ai-powered-api-mocking/)
- 📃 Access to dozens of [ready to use JSON templates](https://mockoon.com/templates/).
- 📃 Access to dozens of [ready-to-use JSON templates](https://mockoon.com/templates/).
- 💬 Priority support and training.

@@ -47,3 +47,3 @@

<div align="center" style="margin-top:20px;margin-bottom:20px;">
<a href="https://mockoon.com/pro/"><img src="https://mockoon.com/images/pro-btn.png?" width="250" alt="pro button" /></a>
<a href="https://mockoon.com/cloud/"><img src="https://mockoon.com/images/cloud-btn.png?" width="250" alt="cloud button" /></a>
</div>

@@ -50,0 +50,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet