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

remult

Package Overview
Dependencies
Maintainers
1
Versions
618
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remult - npm Package Compare versions

Comparing version 0.3.2 to 0.3.3

2

package.json
{
"name": "remult",
"version": "0.3.2",
"version": "0.3.3",
"description": "remult core lib",

@@ -5,0 +5,0 @@ "homepage": "https://remult.github.io/",

@@ -77,7 +77,3 @@ "use strict";

.get(this.process(function (c, req, res) {
if (req.get("__action") == "count") {
return dataApiFactory(c).count(res, req);
}
else
return dataApiFactory(c).getArray(res, req);
return dataApiFactory(c).httpGet(res, req);
})).put(this.process(function (c, req, res, orig) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {

@@ -89,15 +85,5 @@ return [2 /*return*/, dataApiFactory(c).put(res, '', orig.body)];

}); }); }))
.post(this.process(function (c, req, res, orig) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
return tslib_1.__generator(this, function (_a) {
switch (req.get("__action")) {
case "get":
return [2 /*return*/, dataApiFactory(c).getArray(res, req, orig.body)];
case "count":
return [2 /*return*/, dataApiFactory(c).count(res, req, orig.body)];
default:
return [2 /*return*/, dataApiFactory(c).post(res, orig.body)];
}
return [2 /*return*/];
});
}); }));
.post(this.process(function (c, req, res, orig) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
return [2 /*return*/, dataApiFactory(c).httpPost(res, req, orig.body)];
}); }); }));
this.app.route(myRoute + '/:id')

@@ -104,0 +90,0 @@ //@ts-ignore

@@ -10,2 +10,4 @@ import { Remult } from './context';

constructor(repository: Repository<T>, remult: Remult);
httpGet(res: DataApiResponse, req: DataApiRequest): Promise<void>;
httpPost(res: DataApiResponse, req: DataApiRequest, body: any): Promise<void>;
get(response: DataApiResponse, id: any): Promise<void>;

@@ -12,0 +14,0 @@ count(response: DataApiResponse, request: DataApiRequest, filterBody?: any): Promise<void>;

@@ -13,2 +13,19 @@ "use strict";

}
DataApi.prototype.httpGet = function (res, req) {
if (req.get("__action") == "count") {
return this.count(res, req);
}
else
return this.getArray(res, req);
};
DataApi.prototype.httpPost = function (res, req, body) {
switch (req.get("__action")) {
case "get":
return this.getArray(res, req, body);
case "count":
return this.count(res, req, body);
default:
return this.post(res, body);
}
};
DataApi.prototype.get = function (response, id) {

@@ -15,0 +32,0 @@ return tslib_1.__awaiter(this, void 0, void 0, function () {

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

var idMatches = this.idMatches(id);
var keys = Object.keys(data);
for (var i = 0; i < this.rows.length; i++) {

@@ -141,3 +142,3 @@ var r = this.rows[i];

if (!f.dbReadOnly && !f.isServerExpression) {
if (data[f.key] !== undefined) {
if (keys.includes(f.key)) {
newR[f.key] = f.valueConverter.toJson(data[f.key]);

@@ -144,0 +145,0 @@ }

@@ -1,3 +0,4 @@

import { EntityDataProvider, DataProvider, RestDataProviderHttpProvider } from '../data-interfaces';
import { EntityDataProvider, DataProvider, EntityDataProviderFindOptions, RestDataProviderHttpProvider } from '../data-interfaces';
import { UrlBuilder } from '../../urlBuilder';
import { Filter } from '../filter/filter-interfaces';
import { EntityMetadata } from '../remult3';

@@ -12,2 +13,15 @@ export declare class RestDataProvider implements DataProvider {

}
export declare class RestEntityDataProvider implements EntityDataProvider {
private url;
private http;
private entity;
constructor(url: string, http: RestDataProviderHttpProvider, entity: EntityMetadata);
translateFromJson(row: any): {};
translateToJson(row: any): {};
count(where: Filter): Promise<number>;
find(options: EntityDataProviderFindOptions): Promise<Array<any>>;
update(id: any, data: any): Promise<any>;
delete(id: any): Promise<void>;
insert(data: any): Promise<any>;
}
export declare class RestDataProviderHttpProviderUsingFetch implements RestDataProviderHttpProvider {

@@ -14,0 +28,0 @@ private addRequestHeader?;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addFilterToUrlAndReturnTrueIfSuccessful = exports.RestDataProviderHttpProviderUsingFetch = exports.RestDataProvider = void 0;
exports.addFilterToUrlAndReturnTrueIfSuccessful = exports.RestDataProviderHttpProviderUsingFetch = exports.RestEntityDataProvider = exports.RestDataProvider = void 0;
var tslib_1 = require("tslib");

@@ -130,6 +130,7 @@ var urlBuilder_1 = require("../../urlBuilder");

var result = {};
var keys = Object.keys(data);
try {
for (var _b = tslib_1.__values(this.entity.fields), _c = _b.next(); !_c.done; _c = _b.next()) {
var col = _c.value;
if (data[col.key] !== undefined)
if (keys.includes(col.key))
result[col.key] = col.valueConverter.toJson(data[col.key]);

@@ -156,2 +157,3 @@ }

}());
exports.RestEntityDataProvider = RestEntityDataProvider;
function JsonContent(add) {

@@ -158,0 +160,0 @@ add('Content-type', "application/json");

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 too big to display

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