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

@monkvision/network

Package Overview
Dependencies
Maintainers
0
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@monkvision/network - npm Package Compare versions

Comparing version 4.3.2 to 4.3.3

18

lib/package.json
{
"name": "@monkvision/network",
"version": "4.3.1",
"version": "4.3.2",
"license": "BSD-3-Clause-Clear",

@@ -31,4 +31,4 @@ "packageManager": "yarn@3.2.4",

"dependencies": {
"@monkvision/common": "4.3.1",
"@monkvision/sights": "4.3.1",
"@monkvision/common": "4.3.2",
"@monkvision/sights": "4.3.2",
"jsonwebtoken": "^9.0.2",

@@ -46,8 +46,8 @@ "jwt-decode": "^4.0.0",

"devDependencies": {
"@monkvision/eslint-config-base": "4.3.1",
"@monkvision/eslint-config-typescript": "4.3.1",
"@monkvision/jest-config": "4.3.1",
"@monkvision/prettier-config": "4.3.1",
"@monkvision/types": "4.3.1",
"@monkvision/typescript-config": "4.3.1",
"@monkvision/eslint-config-base": "4.3.2",
"@monkvision/eslint-config-typescript": "4.3.2",
"@monkvision/jest-config": "4.3.2",
"@monkvision/prettier-config": "4.3.2",
"@monkvision/types": "4.3.2",
"@monkvision/typescript-config": "4.3.2",
"@types/jest": "^29.2.2",

@@ -54,0 +54,0 @@ "@types/jsonwebtoken": "^9.0.5",

@@ -1,2 +0,2 @@

import { getInspection, createInspection, updateAdditionalData } from './inspection';
import { getInspection, createInspection, updateAdditionalData, getInspections } from './inspection';
import { addImage } from './image';

@@ -14,2 +14,3 @@ import { startInspectionTasks, updateTaskStatus } from './task';

getInspection: typeof getInspection;
getInspections: typeof getInspections;
createInspection: typeof createInspection;

@@ -16,0 +17,0 @@ addImage: typeof addImage;

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

getInspection: inspection_1.getInspection,
getInspections: inspection_1.getInspections,
createInspection: inspection_1.createInspection,

@@ -19,0 +20,0 @@ addImage: image_1.addImage,

import { MonkState } from '@monkvision/common';
import { ComplianceOptions, CreateInspectionOptions } from '@monkvision/types';
import { ApiInspectionGet, ApiInspectionPost } from '../models';
import { ComplianceOptions, CreateInspectionOptions, SortOrder } from '@monkvision/types';
import { ApiInspectionGet, ApiInspectionPost, ApiInspectionsGet } from '../models';
export declare function mapApiInspectionsGet(response: ApiInspectionsGet, thumbnailDomain: string): MonkState;
export declare function mapApiInspectionGet(response: ApiInspectionGet, thumbnailDomain: string, complianceOptions?: ComplianceOptions): MonkState;
export declare function mapApiInspectionPost(options: CreateInspectionOptions): ApiInspectionPost;
/**
* Parameters for pagination requests.
*/
export interface PaginationRequestParams {
/**
* The number of inspections fetched.
*
* @default 100
*/
limit?: number;
/**
* The inspection ID to filter that occurred before this ID.
*/
before?: string;
/**
* The inspection ID to filter that occurred after this date.
*/
after?: string;
}
/**
* Parameters for sorting requests.
*/
export interface SortRequestParams {
/**
* The property to sort by.
*/
sortByProperty: string;
/**
* The order of the pagination.
*
* @default SortOrder.DESC
*/
sortOrder?: SortOrder;
}
/**
* Options passed to the `getInspections` API request.
*/
export interface GetInspectionsOptions {
/**
* If true, only the total count of inspections will be returned.
*
* @default false
*/
count?: boolean;
/**
* The filter request parameters.
*/
filters?: Record<string, string | number>;
/**
* The pagination request parameters.
*/
pagination?: PaginationRequestParams;
/**
* The sort request parameters.
*/
sort?: SortRequestParams;
}
export declare function mapApiInspectionsUrlParamsGet(options: GetInspectionsOptions): string;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.mapApiInspectionPost = exports.mapApiInspectionGet = void 0;
exports.mapApiInspectionsUrlParamsGet = exports.mapApiInspectionPost = exports.mapApiInspectionGet = exports.mapApiInspectionsGet = void 0;
var types_1 = require("@monkvision/types");

@@ -283,2 +283,50 @@ var mappers_1 = require("../image/mappers");

}
function mapApiInspectionsGet(response, thumbnailDomain) {
var state = {
damages: [],
images: [],
inspections: [],
parts: [],
renderedOutputs: [],
severityResults: [],
tasks: [],
vehicles: [],
views: [],
pricings: [],
partOperations: [],
};
if (!response.data) {
return state;
}
return response.data.reduce(function (acc, inspection) {
var _a, _b, _c, _d, _e;
var _f = mapImages(inspection, thumbnailDomain), images = _f.images, renderedOutputs = _f.renderedOutputs, imageIds = _f.imageIds, renderedOutputIds = _f.renderedOutputIds, viewIds = _f.viewIds;
var _g = mapDamages(inspection), damages = _g.damages, damageIds = _g.damageIds;
var _h = mapParts(inspection), parts = _h.parts, partIds = _h.partIds;
var _j = mapPricingV2(inspection), pricings = _j.pricings, pricingIds = _j.pricingIds;
var vehicle = mapVehicle(inspection);
var mappedInspection = mapInspection(inspection, {
imageIds: imageIds,
renderedOutputIds: renderedOutputIds,
viewIds: viewIds,
damageIds: damageIds,
partIds: partIds,
severityResultIds: [],
taskIds: [],
pricingIds: pricingIds,
vehicleId: vehicle === null || vehicle === void 0 ? void 0 : vehicle.id,
});
(_a = acc.damages).push.apply(_a, damages);
(_b = acc.images).push.apply(_b, images);
acc.inspections.push(mappedInspection);
(_c = acc.parts).push.apply(_c, parts);
(_d = acc.renderedOutputs).push.apply(_d, renderedOutputs);
if (vehicle) {
acc.vehicles.push(vehicle);
}
(_e = acc.pricings).push.apply(_e, pricings);
return acc;
}, state);
}
exports.mapApiInspectionsGet = mapApiInspectionsGet;
function mapApiInspectionGet(response, thumbnailDomain, complianceOptions) {

@@ -440,1 +488,26 @@ var _a = mapImages(response, thumbnailDomain, complianceOptions), images = _a.images, renderedOutputs = _a.renderedOutputs, views = _a.views, imageIds = _a.imageIds, renderedOutputIds = _a.renderedOutputIds, viewIds = _a.viewIds;

exports.mapApiInspectionPost = mapApiInspectionPost;
function mapApiInspectionsUrlParamsGet(options) {
var params = new URLSearchParams();
var url = options.count ? '/count' : '';
url = options.filters || options.pagination ? "".concat(url, "?") : url;
if (options.filters) {
Object.entries(options.filters).forEach(function (_a) {
var key = _a[0], value = _a[1];
params.append(key, value.toString());
});
}
if (options.pagination) {
Object.entries(options.pagination).forEach(function (_a) {
var key = _a[0], value = _a[1];
params.append(key, value.toString());
});
}
if (options.sort) {
Object.entries(options.sort).forEach(function (_a) {
var key = _a[0], value = _a[1];
params.append(key, value.toString());
});
}
return "".concat(url).concat(params.toString());
}
exports.mapApiInspectionsUrlParamsGet = mapApiInspectionsUrlParamsGet;

@@ -5,3 +5,4 @@ import { MonkAction, MonkGotOneInspectionAction, MonkState, MonkUpdatedOneInspectionAdditionalDataAction } from '@monkvision/common';

import { MonkApiConfig } from '../config';
import { ApiInspectionGet } from '../models';
import { ApiInspectionGet, ApiInspectionsGet } from '../models';
import { GetInspectionsOptions } from './mappers';
import { MonkApiResponse } from '../types';

@@ -73,1 +74,10 @@ /**

export declare function updateAdditionalData(options: UpdateAdditionalDataOptions, config: MonkApiConfig, dispatch?: Dispatch<MonkUpdatedOneInspectionAdditionalDataAction>): Promise<MonkApiResponse>;
/**
* Fetch the details of multiple inspections.
*
* @param options The options of the request.
* @param config The API config.
* @param [dispatch] Optional MonkState dispatch function that you can pass if you want this request to handle React
* state management for you.
*/
export declare function getInspections(options: GetInspectionsOptions, config: MonkApiConfig, dispatch?: Dispatch<MonkGotOneInspectionAction>): Promise<MonkApiResponse | MonkApiResponse<GetInspectionResponse, ApiInspectionsGet>>;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.updateAdditionalData = exports.createInspection = exports.getInspection = void 0;
exports.getInspections = exports.updateAdditionalData = exports.createInspection = exports.getInspection = void 0;
var ky_1 = __importDefault(require("ky"));

@@ -170,1 +170,33 @@ var common_1 = require("@monkvision/common");

exports.updateAdditionalData = updateAdditionalData;
/**
* Fetch the details of multiple inspections.
*
* @param options The options of the request.
* @param config The API config.
* @param [dispatch] Optional MonkState dispatch function that you can pass if you want this request to handle React
* state management for you.
*/
function getInspections(options, config, dispatch) {
return __awaiter(this, void 0, void 0, function () {
var kyOptions, response, body, entities;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
kyOptions = (0, config_1.getDefaultOptions)(config);
return [4 /*yield*/, ky_1.default.get("inspections".concat((0, mappers_1.mapApiInspectionsUrlParamsGet)(options)), kyOptions)];
case 1:
response = _a.sent();
return [4 /*yield*/, response.json()];
case 2:
body = _a.sent();
entities = (0, mappers_1.mapApiInspectionsGet)(body, config.thumbnailDomain);
dispatch === null || dispatch === void 0 ? void 0 : dispatch({
type: common_1.MonkActionType.GOT_ONE_INSPECTION,
payload: entities,
});
return [2 /*return*/, { entities: entities, response: response, body: body }];
}
});
});
}
exports.getInspections = getInspections;

@@ -0,1 +1,2 @@

import { SortOrder } from '@monkvision/types';
import type { ApiAdditionalData } from './common';

@@ -29,2 +30,24 @@ import type { ApiDamages } from './damage';

}
interface ApiData extends Pick<ApiInspectionGet, 'id' | 'additional_data' | 'images' | 'damages' | 'pricing' | 'parts' | 'vehicle'> {
pdf_url?: string;
}
interface ApiPaginationParams {
limit?: number;
before?: string;
after?: string;
pagination_order?: SortOrder;
}
interface ApiCursors {
before?: Pick<ApiPaginationParams, 'before'>;
after?: Pick<ApiPaginationParams, 'after'>;
next?: ApiPaginationParams;
previous?: ApiPaginationParams;
}
interface ApiPagination {
cursors: ApiCursors;
}
export interface ApiInspectionsGet {
data: ApiData[];
paging: ApiPagination;
}
export interface ApiDamageSeverity {

@@ -40,1 +63,2 @@ output_format: ApiBusinessClients;

}
export {};

@@ -19,2 +19,8 @@ import { MonkApiConfig } from './config';

/**
* Fetch multiple inspection.
*
* @param options The options of the request.
*/
getInspections: (options: import("./inspection/mappers").GetInspectionsOptions) => Promise<import("./types").MonkApiResponse<import("./types").MonkId, import("./models").ApiIdColumn> | import("./types").MonkApiResponse<import("./inspection").GetInspectionResponse, import("./models").ApiInspectionsGet>>;
/**
* Create a new inspection with the given options. See the `CreateInspectionOptions` interface for more details.

@@ -21,0 +27,0 @@ *

@@ -56,2 +56,8 @@ "use strict";

/**
* Fetch multiple inspection.
*
* @param options The options of the request.
*/
getInspections: reactify(api_1.MonkApi.getInspections, config, dispatch, handleError),
/**
* Create a new inspection with the given options. See the `CreateInspectionOptions` interface for more details.

@@ -58,0 +64,0 @@ *

{
"name": "@monkvision/network",
"version": "4.3.2",
"version": "4.3.3",
"license": "BSD-3-Clause-Clear",

@@ -31,4 +31,4 @@ "packageManager": "yarn@3.2.4",

"dependencies": {
"@monkvision/common": "4.3.2",
"@monkvision/sights": "4.3.2",
"@monkvision/common": "4.3.3",
"@monkvision/sights": "4.3.3",
"jsonwebtoken": "^9.0.2",

@@ -46,8 +46,8 @@ "jwt-decode": "^4.0.0",

"devDependencies": {
"@monkvision/eslint-config-base": "4.3.2",
"@monkvision/eslint-config-typescript": "4.3.2",
"@monkvision/jest-config": "4.3.2",
"@monkvision/prettier-config": "4.3.2",
"@monkvision/types": "4.3.2",
"@monkvision/typescript-config": "4.3.2",
"@monkvision/eslint-config-base": "4.3.3",
"@monkvision/eslint-config-typescript": "4.3.3",
"@monkvision/jest-config": "4.3.3",
"@monkvision/prettier-config": "4.3.3",
"@monkvision/types": "4.3.3",
"@monkvision/typescript-config": "4.3.3",
"@types/jest": "^29.2.2",

@@ -89,3 +89,3 @@ "@types/jsonwebtoken": "^9.0.5",

"homepage": "https://github.com/monkvision/monkjs",
"gitHead": "79cad6f0e22de9347582794b822d7843847e0d82"
"gitHead": "333b427e8497da0654c4ac6e4c72f81a8c89d93b"
}

@@ -213,2 +213,16 @@ # @monkvision/network

### getInspections
```typescript
import { MonkApi } from '@monkvision/network';
MonkApi.getInspections(options, apiConfig, dispatch);
```
Fetch the details of multiple inspections using the provided filters. The resulting action of this request will contain
a list of all entities that match the specified criteria.
| Parameter | Type | Description | Required |
|-----------|-----------------------|-----------------------------|----------|
| options | getInspectionsOptions | The options of the request. | ✔️ |
# React Tools

@@ -215,0 +229,0 @@ In order to simply integrate the Monk Api requests into your React app, you can make use of the `useMonkApi` hook. This

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