@remult/core
Advanced tools
Comparing version 3.0.23 to 3.0.24
{ | ||
"name": "@remult/core", | ||
"schematics": "./schematics/collection.json", | ||
"version": "3.0.23", | ||
"version": "3.0.24", | ||
"description": "remult core lib", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -29,2 +29,3 @@ import { DataProvider } from "./data-interfaces"; | ||
getPathInUrl(): string; | ||
getOrigin(): string; | ||
_dataSource: DataProvider; | ||
@@ -42,4 +43,6 @@ setDataProvider(dataProvider: DataProvider): void; | ||
isAllowed(roles: Allowed): any; | ||
repCache: Map<ClassType<any>, Repository<any>>; | ||
for<T>(entity: ClassType<T>): Repository<T>; | ||
repCache: Map<DataProvider, Map<ClassType<any>, Repository<any>>>; | ||
for<T>(entity: ClassType<T>, dataProvider?: DataProvider): Repository<T>; | ||
protected req: DataApiRequest; | ||
setReq(req: DataApiRequest): void; | ||
} | ||
@@ -52,4 +55,2 @@ export declare type DataProviderFactoryBuilder = (req: Context) => DataProvider; | ||
getCookie(name: string): string; | ||
private req; | ||
setReq(req: DataApiRequest): void; | ||
getOrigin(): string; | ||
@@ -56,0 +57,0 @@ } |
@@ -109,3 +109,3 @@ "use strict"; | ||
function Context(http) { | ||
this._backend = false; | ||
this._backend = server_action_1.actionInfo.runningOnServer; | ||
this._userChangeEvent = new EventSource(); | ||
@@ -139,2 +139,5 @@ this.repCache = new Map(); | ||
}; | ||
Context.prototype.getOrigin = function () { | ||
return ''; | ||
}; | ||
Context.prototype.setDataProvider = function (dataProvider) { | ||
@@ -248,9 +251,18 @@ this._dataSource = dataProvider; | ||
}; | ||
Context.prototype.for = function (entity) { | ||
var r = this.repCache.get(entity); | ||
Context.prototype.for = function (entity, dataProvider) { | ||
if (dataProvider === undefined) | ||
dataProvider = this._dataSource; | ||
var dpCache = this.repCache.get(dataProvider); | ||
if (!dpCache) | ||
this.repCache.set(dataProvider, dpCache = new Map()); | ||
var r = dpCache.get(entity); | ||
if (!r) { | ||
this.repCache.set(entity, r = new RepositoryImplementation_1.RepositoryImplementation(entity, this, this._dataSource)); | ||
dpCache.set(entity, r = new RepositoryImplementation_1.RepositoryImplementation(entity, this, dataProvider)); | ||
} | ||
return r; | ||
}; | ||
Context.prototype.setReq = function (req) { | ||
this.req = req; | ||
this._user = req.user ? req.user : undefined; | ||
}; | ||
Context.apiBaseUrl = 'api'; | ||
@@ -303,6 +315,2 @@ return Context; | ||
}; | ||
ServerContext.prototype.setReq = function (req) { | ||
this.req = req; | ||
this._user = req.user ? req.user : undefined; | ||
}; | ||
ServerContext.prototype.getOrigin = function () { | ||
@@ -309,0 +317,0 @@ if (!this.req) |
@@ -81,3 +81,3 @@ "use strict"; | ||
hasId_1 = false; | ||
w = filter_interfaces_2.Filter.translateWhereToFilter(filter_interfaces_2.Filter.createFilterOf(this.repository.metadata), findOptions.where); | ||
w = filter_interfaces_2.Filter.translateWhereToFilter(filter_interfaces_2.Filter.createFilterFactories(this.repository.metadata), findOptions.where); | ||
if (w) { | ||
@@ -84,0 +84,0 @@ w.__applyToConsumer({ |
@@ -9,3 +9,3 @@ import { FieldMetadata } from "../column-interfaces"; | ||
or(filter: Filter): Filter; | ||
static createFilterOf<T>(entityDefs: EntityMetadata<T>): FilterFactories<T>; | ||
static createFilterFactories<T>(entityDefs: EntityMetadata<T>): FilterFactories<T>; | ||
static translateWhereToFilter<T>(entity: FilterFactories<T>, where: EntityWhere<T>): Filter; | ||
@@ -12,0 +12,0 @@ static packWhere<T>(entityDefs: EntityMetadata<T>, where: EntityWhere<T>): any; |
@@ -22,3 +22,3 @@ "use strict"; | ||
}; | ||
Filter.createFilterOf = function (entityDefs) { | ||
Filter.createFilterFactories = function (entityDefs) { | ||
var e_1, _a; | ||
@@ -64,3 +64,3 @@ var r = {}; | ||
return {}; | ||
return packToRawWhere(this.translateWhereToFilter(this.createFilterOf(entityDefs), where)); | ||
return packToRawWhere(this.translateWhereToFilter(this.createFilterFactories(entityDefs), where)); | ||
}; | ||
@@ -67,0 +67,0 @@ Filter.unpackWhere = function (entityDefs, packed) { |
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
1223816
18890