@microsoft/paris
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -0,0 +0,0 @@ # [1.3.6] (2018-11-25) |
@@ -0,1 +1,9 @@ | ||
var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
import { clone } from "lodash-es"; | ||
@@ -196,9 +204,10 @@ import { merge, of, Subject } from "rxjs"; | ||
ReadonlyRepository.prototype.getQueryHttpOptions = function (query) { | ||
var httpOptions = this.entityBackendConfig.parseDataQuery ? { params: this.entityBackendConfig.parseDataQuery(query) } : queryToHttpOptions(query); | ||
if (this.entityBackendConfig.fixedData) { | ||
if (!httpOptions) | ||
httpOptions = {}; | ||
if (!httpOptions.params) | ||
httpOptions.params = {}; | ||
Object.assign(httpOptions.params, this.entityBackendConfig.fixedData); | ||
var _a = this.entityBackendConfig, fixedData = _a.fixedData, separateArrayParams = _a.separateArrayParams, parseDataQuery = _a.parseDataQuery; | ||
var httpOptions = { separateArrayParams: separateArrayParams }; | ||
if (parseDataQuery) | ||
httpOptions.params = parseDataQuery(query); | ||
else | ||
Object.assign(httpOptions, queryToHttpOptions(query)); | ||
if (fixedData) { | ||
httpOptions.params = __assign({}, httpOptions.params, fixedData); | ||
} | ||
@@ -205,0 +214,0 @@ return httpOptions; |
@@ -79,10 +79,3 @@ import { ModelBase } from "../config/model.base"; | ||
propertyEntityValues.forEach(function (propertyEntityValue) { return Object.assign(modelData, propertyEntityValue); }); | ||
var model; | ||
try { | ||
model = new entity.entityConstructor(modelData, rawData); | ||
} | ||
catch (e) { | ||
getModelDataError.message = getModelDataError.message + " Error: " + e.message; | ||
throw getModelDataError; | ||
} | ||
var model = instantiateModel(); | ||
_this.setModelLinks(model); | ||
@@ -93,5 +86,8 @@ return model; | ||
else { | ||
var model = void 0; | ||
model$ = of(instantiateModel()); | ||
} | ||
return entity.readonly ? model$.pipe(map(function (model) { return Object.freeze(model); })) : model$; | ||
function instantiateModel() { | ||
try { | ||
model = new entity.entityConstructor(modelData, rawData); | ||
var model = new entity.entityConstructor(modelData, rawData); | ||
if (Object.isFrozen(model) || Object.isSealed(model)) | ||
@@ -102,2 +98,3 @@ console.warn("Can't assign data to " + entity.singularName + ", since it's frozen or sealed."); | ||
model._init(modelData, rawData); | ||
return model; | ||
} | ||
@@ -108,5 +105,3 @@ catch (e) { | ||
} | ||
model$ = of(model); | ||
} | ||
return entity.readonly ? model$.pipe(map(function (model) { return Object.freeze(model); })) : model$; | ||
}; | ||
@@ -113,0 +108,0 @@ Modeler.prototype.validateFieldData = function (entityField, rawData) { |
{ | ||
"_from": "json-stringify-safe@*", | ||
"_args": [ | ||
[ | ||
"json-stringify-safe@5.0.1", | ||
"C:\\git\\paris" | ||
] | ||
], | ||
"_development": true, | ||
"_from": "json-stringify-safe@5.0.1", | ||
"_id": "json-stringify-safe@5.0.1", | ||
@@ -9,10 +16,10 @@ "_inBundle": false, | ||
"_requested": { | ||
"type": "range", | ||
"type": "version", | ||
"registry": true, | ||
"raw": "json-stringify-safe@*", | ||
"raw": "json-stringify-safe@5.0.1", | ||
"name": "json-stringify-safe", | ||
"escapedName": "json-stringify-safe", | ||
"rawSpec": "*", | ||
"rawSpec": "5.0.1", | ||
"saveSpec": null, | ||
"fetchSpec": "*" | ||
"fetchSpec": "5.0.1" | ||
}, | ||
@@ -25,5 +32,4 @@ "_requiredBy": [ | ||
"_resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", | ||
"_shasum": "1296a2d58fd45f19a0f6ce01d65701e2c735b6eb", | ||
"_spec": "json-stringify-safe@*", | ||
"_where": "C:\\Users\\oradler\\dev\\github\\oradler\\paris", | ||
"_spec": "5.0.1", | ||
"_where": "C:\\git\\paris", | ||
"author": { | ||
@@ -37,3 +43,2 @@ "name": "Isaac Z. Schlueter", | ||
}, | ||
"bundleDependencies": false, | ||
"contributors": [ | ||
@@ -46,3 +51,2 @@ { | ||
], | ||
"deprecated": false, | ||
"description": "Like JSON.stringify, but doesn't blow up on circular refs.", | ||
@@ -49,0 +53,0 @@ "devDependencies": { |
{ | ||
"name": "@microsoft/paris", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "Library for the implementation of Domain Driven Design with TypeScript + RxJS", | ||
@@ -14,3 +14,3 @@ "repository": { | ||
"dev": "rollup -c -w", | ||
"prepublish": "npm run build && npm run test", | ||
"prepublish": "npm run build", | ||
"test": "jest", | ||
@@ -17,0 +17,0 @@ "test:watch": "jest --watch", |
@@ -63,2 +63,9 @@ import {Paris} from '../../lib/paris'; | ||
describe('getQueryHttpOptions', () => { | ||
it ('sends the separateArrayParams defined in the entity backend config', () => { | ||
const queryHttpOptions = todoRepo.getQueryHttpOptions({ where: { params: { foo: 'bar' } }}); | ||
expect(queryHttpOptions.separateArrayParams).toBe(true); | ||
}); | ||
}); | ||
describe('caching', () => { | ||
@@ -65,0 +72,0 @@ setMockData({ |
@@ -0,0 +0,0 @@ import {Entity} from "../../lib/config/decorators/entity.decorator"; |
@@ -0,0 +0,0 @@ import { EntityModelBase } from '../../lib/config/entity-model.base'; |
@@ -13,2 +13,3 @@ import {EntityModelBase} from "../../lib/config/entity-model.base"; | ||
timeout: 20000, | ||
separateArrayParams: true, | ||
customHeaders: (data, config) => data ? (data.text === "New todo item" ? {"keyForNewTodoItem": "valueForNewTodoItem"} : {"keyForRegularTodoItem": "valueForRegularTodoItem"}) : {} | ||
@@ -15,0 +16,0 @@ }) |
@@ -0,0 +0,0 @@ import { Observable, of, forkJoin } from 'rxjs'; |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
254700
5209
0