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

@remult/core

Package Overview
Dependencies
Maintainers
2
Versions
220
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remult/core - npm Package Compare versions

Comparing version 3.0.6 to 3.0.7

2

package.json
{
"name": "@remult/core",
"schematics": "./schematics/collection.json",
"version": "3.0.6",
"version": "3.0.7",
"description": "remult core lib",

@@ -6,0 +6,0 @@ "license": "MIT",

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

x = _c.value;
if (!x.dbReadOnly) {
if (!x.dbReadOnly && !x.isServerExpression) {
if (result.length != 0)

@@ -270,3 +270,3 @@ result += ',';

case 0:
if (c(e).dbReadOnly)
if (c(e).dbReadOnly || c(e).isServerExpression)
return [2 /*return*/];

@@ -315,3 +315,3 @@ _a.label = 1;

col = _c.value;
if (!!col.dbReadOnly) return [3 /*break*/, 5];
if (!(!col.dbReadOnly && !col.isServerExpression)) return [3 /*break*/, 5];
if (!!cols.includes(col.dbName.toLocaleLowerCase())) return [3 /*break*/, 5];

@@ -318,0 +318,0 @@ sql = "alter table " + e.dbName + " add column " + this.addColumnSqlSyntax(col);

@@ -18,3 +18,3 @@ import { DataApi, DataApiResponse, DataApiRequest, UserInfo, DataProvider, DataProviderFactoryBuilder, ServerContext, queuedJobInfoResponse, IdEntity } from '../';

private firstArea;
addArea(rootUrl: string): SiteArea;
addArea(rootUrl: string, isUserValidForArea?: (origReq: DataApiRequest) => boolean): SiteArea;
getValidContext(req: express.Request): Promise<ServerContext>;

@@ -27,3 +27,4 @@ }

private logApiEndpoints;
constructor(bridge: ExpressBridge, app: express.Express, rootUrl: string, logApiEndpoints: boolean);
private isUserValidForArea;
constructor(bridge: ExpressBridge, app: express.Express, rootUrl: string, logApiEndpoints: boolean, isUserValidForArea: (origReq: DataApiRequest) => boolean);
private _dataProviderFactory;

@@ -30,0 +31,0 @@ setDataProviderFactory(dataProvider: DataProviderFactoryBuilder): void;

@@ -55,4 +55,4 @@ "use strict";

}
ExpressBridge.prototype.addArea = function (rootUrl) {
var r = new SiteArea(this, this.app, rootUrl, this.logApiEndPoints);
ExpressBridge.prototype.addArea = function (rootUrl, isUserValidForArea) {
var r = new SiteArea(this, this.app, rootUrl, this.logApiEndPoints, isUserValidForArea);
if (!this.firstArea) {

@@ -74,3 +74,3 @@ this.firstArea = r;

var SiteArea = /** @class */ (function () {
function SiteArea(bridge, app, rootUrl, logApiEndpoints) {
function SiteArea(bridge, app, rootUrl, logApiEndpoints, isUserValidForArea) {
this.bridge = bridge;

@@ -80,2 +80,3 @@ this.app = app;

this.logApiEndpoints = logApiEndpoints;
this.isUserValidForArea = isUserValidForArea;
}

@@ -146,2 +147,5 @@ SiteArea.prototype.setDataProviderFactory = function (dataProvider) {

_a.user = _b.sent();
if (this.isUserValidForArea)
if (!this.isUserValidForArea(myReq))
myReq.user = null;
what(myReq, myRes, req);

@@ -148,0 +152,0 @@ return [2 /*return*/];

@@ -9,3 +9,3 @@ import { Allowed, Context, EntityAllowed } from './context';

displayValue?: (entity: entityType, value: valueType) => string;
defaultValue?: (entity: entityType) => valueType | Promise<valueType>;
defaultValue?: (entity: entityType, context: Context) => valueType | Promise<valueType>;
validate?: ColumnValidator<valueType, entityType> | ColumnValidator<valueType, entityType>[];

@@ -33,2 +33,3 @@ inputType?: string;

readonly valueConverter: ValueConverter<T>;
readonly evilOriginalSettings: ColumnSettings;
}

@@ -35,0 +36,0 @@ export interface ValueConverter<T> {

@@ -6,4 +6,29 @@ import { ValueConverter } from "../column-interfaces";

export declare const BoolValueConverter: ValueConverter<Boolean>;
export declare const IntValueConverter: ValueConverter<Number>;
export declare const IntValueConverter: ValueConverter<number>;
export declare const DecimalValueConverter: ValueConverter<Number>;
export declare const DefaultValueConverter: ValueConverter<any>;
export declare class StoreAsStringValueConverter<T> implements ValueConverter<T> {
_toJson: (x: T) => string;
_fromJson: (x: string) => T;
constructor(_toJson: (x: T) => string, _fromJson: (x: string) => T);
fromJson(val: any): T;
toJson(val: T): string;
fromDb(val: any): T;
toDb(val: T): string;
toInput(val: T, inputType: string): string;
fromInput(val: string, inputType: string): T;
displayValue?(val: T): string;
columnTypeInDb?: string;
inputType?: string;
}
export declare class JsonValueLoader<T> implements ValueConverter<T> {
fromJson(val: any): T;
toJson(val: T): T;
fromDb(val: any): T;
toDb(val: T): string;
toInput(val: T, inputType: string): string;
fromInput(val: string, inputType: string): T;
displayValue?(val: T): string;
columnTypeInDb?: string;
inputType?: string;
}

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

toDb: function (val) { return val; },
inputType: 'checkbox',
inputType: remult3_1.InputTypes.checkbox,
fromDb: function (value) {

@@ -134,2 +134,64 @@ return exports.BoolValueConverter.fromJson(value);

};
var StoreAsStringValueConverter = /** @class */ (function () {
function StoreAsStringValueConverter(_toJson, _fromJson) {
this._toJson = _toJson;
this._fromJson = _fromJson;
}
StoreAsStringValueConverter.prototype.fromJson = function (val) {
return this._fromJson(val);
};
StoreAsStringValueConverter.prototype.toJson = function (val) {
if (val === undefined)
return undefined;
return this._toJson(val);
};
StoreAsStringValueConverter.prototype.fromDb = function (val) {
return this.fromJson(val);
};
StoreAsStringValueConverter.prototype.toDb = function (val) {
return this.toJson(val);
};
StoreAsStringValueConverter.prototype.toInput = function (val, inputType) {
return this.toJson(val);
};
StoreAsStringValueConverter.prototype.fromInput = function (val, inputType) {
return this.fromJson(val);
};
StoreAsStringValueConverter.prototype.displayValue = function (val) {
return this.toJson(val);
};
return StoreAsStringValueConverter;
}());
exports.StoreAsStringValueConverter = StoreAsStringValueConverter;
var JsonValueLoader = /** @class */ (function () {
function JsonValueLoader() {
}
JsonValueLoader.prototype.fromJson = function (val) {
return val;
};
JsonValueLoader.prototype.toJson = function (val) {
return val;
};
JsonValueLoader.prototype.fromDb = function (val) {
if (val !== undefined)
return JSON.parse(val);
return undefined;
};
JsonValueLoader.prototype.toDb = function (val) {
if (val !== undefined)
return JSON.stringify(val);
return undefined;
};
JsonValueLoader.prototype.toInput = function (val, inputType) {
return this.toDb(val);
};
JsonValueLoader.prototype.fromInput = function (val, inputType) {
return this.fromDb(val);
};
JsonValueLoader.prototype.displayValue = function (val) {
return this.toDb(val);
};
return JsonValueLoader;
}());
exports.JsonValueLoader = JsonValueLoader;
//# sourceMappingURL=loaders.js.map
import { UserInfo } from './context';
import { FindOptions, Repository } from './remult3';
import { SortSegment } from './sort';
export declare class DataApi<T = any> {

@@ -47,1 +48,2 @@ private repository;

}
export declare function determineSort(sortUrlParm: string, dirUrlParam: string): (x: any) => SortSegment[];

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

return tslib_1.__awaiter(this, void 0, void 0, function () {
var findOptions, hasId_1, w, sort_1, dir, dirItems_1, limit, err_2;
var findOptions, hasId_1, w, sort, dir, limit, err_2;
var _this = this;

@@ -104,16 +104,6 @@ return tslib_1.__generator(this, function (_a) {

if (request) {
sort_1 = request.get("_sort");
if (sort_1 != undefined) {
sort = request.get("_sort");
if (sort != undefined) {
dir = request.get('_order');
dirItems_1 = [];
if (dir)
dirItems_1 = dir.split(',');
findOptions.orderBy = function (x) {
return sort_1.split(',').map(function (name, i) {
var r = x[name];
if (i < dirItems_1.length && dirItems_1[i].toLowerCase().trim().startsWith("d"))
return { column: r.column, isDescending: true };
return r;
});
};
findOptions.orderBy = determineSort(sort, dir);
}

@@ -303,2 +293,16 @@ limit = +request.get("_limit");

exports.DataApi = DataApi;
function determineSort(sortUrlParm, dirUrlParam) {
var dirItems = [];
if (dirUrlParam)
dirItems = dirUrlParam.split(',');
return function (x) {
return sortUrlParm.split(',').map(function (name, i) {
var r = x[name.trim()];
if (i < dirItems.length && dirItems[i].toLowerCase().trim().startsWith("d"))
return { column: r.column, isDescending: true };
return r;
});
};
}
exports.determineSort = determineSort;
//# sourceMappingURL=data-api.js.map

@@ -100,4 +100,4 @@ "use strict";

if (sort_1.length > 0) {
sort_1 += ", ";
order_1 += ", ";
sort_1 += ",";
order_1 += ",";
}

@@ -104,0 +104,0 @@ sort_1 += c.column.key;

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

}
if (x.dbReadOnly) { }
if (x.dbReadOnly || x.isServerExpression) { }
else {

@@ -352,3 +352,3 @@ v = x.valueConverter.toDb(data[x.key]);

}
if (x.dbReadOnly) { }
if (x.dbReadOnly || x.isServerExpression) { }
else {

@@ -355,0 +355,0 @@ v = x.valueConverter.toDb(data[x.key]);

import { ColumnDefinitions } from "../column-interfaces";
import { IterateToArrayOptions } from "../context";
import { EntityOptions } from "../entity";
import { Filter } from "../filter/filter-interfaces";

@@ -25,3 +26,3 @@ import { Sort, SortSegment } from "../sort";

} & {
find(col: ColumnDefinitions): EntityColumn<any, Type>;
find(col: ColumnDefinitions | string): EntityColumn<any, Type>;
[Symbol.iterator]: () => IterableIterator<EntityColumn<any, Type>>;

@@ -33,3 +34,3 @@ idColumn: EntityColumn<any, Type>;

} & {
find(col: ColumnDefinitions): ColumnDefinitions;
find(col: ColumnDefinitions | string): ColumnDefinitions;
[Symbol.iterator]: () => IterableIterator<ColumnDefinitions>;

@@ -68,4 +69,6 @@ idColumn: ColumnDefinitions;

readonly caption: string;
readonly evilOriginalSettings: EntityOptions;
}
export interface Repository<T> {
fromPojo(x: any): any;
defs: EntityDefinitions<T>;

@@ -166,2 +169,6 @@ find(options?: FindOptions<T>): Promise<T[]>;

_: rowHelper<this>;
save(): Promise<this>;
delete(): Promise<void>;
isNew(): boolean;
wasChanged(): boolean;
readonly $: EntityColumns<this>;

@@ -168,0 +175,0 @@ }

@@ -6,2 +6,6 @@ "use strict";

}
EntityBase.prototype.save = function () { return this._.save(); };
EntityBase.prototype.delete = function () { return this._.delete(); };
EntityBase.prototype.isNew = function () { return this._.isNew(); };
EntityBase.prototype.wasChanged = function () { return this._.wasChanged(); };
Object.defineProperty(EntityBase.prototype, "$", {

@@ -8,0 +12,0 @@ get: function () { return this._.columns; },

@@ -21,2 +21,3 @@ import { ColumnDefinitions, ColumnSettings, ValueConverter } from "../column-interfaces";

constructor(entity: ClassType<T>, context: Context, dataProvider: DataProvider);
fromPojo(x: any): void;
lookupId(id: any): T;

@@ -136,2 +137,3 @@ lookupIdAsync(id: any): Promise<T>;

constructor(colInfo: columnInfo, entityDefs: EntityFullInfo<any>, context: Context);
evilOriginalSettings: ColumnSettings<any, any>;
target: ClassType<any>;

@@ -142,3 +144,3 @@ readonly: boolean;

caption: string;
readonly dbName: string;
readonly dbName: any;
inputType: string;

@@ -154,2 +156,3 @@ key: string;

private context;
evilOriginalSettings: EntityOptions<any>;
constructor(columnsInfo: columnInfo[], entityInfo: EntityOptions, context: Context);

@@ -190,2 +193,3 @@ dbAutoIncrementId: boolean;

constructor(...columns: ColumnDefinitions[]);
evilOriginalSettings: ColumnSettings<any, any>;
valueConverter: ValueConverter<string>;

@@ -192,0 +196,0 @@ target: ClassType<any>;

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

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