@microsoft/paris
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -0,1 +1,2 @@ | ||
import * as jsonStringify from 'json-stringify-safe'; | ||
import { from, of } from "rxjs"; | ||
@@ -101,3 +102,3 @@ import { finalize, share, tap } from "rxjs/operators"; | ||
DataCache.prototype.getCacheKey = function (key, params) { | ||
return key + (params !== undefined && params !== null ? "_" + JSON.stringify(params) : ""); | ||
return key + (params !== undefined && params !== null ? "_" + jsonStringify(params) : ""); | ||
}; | ||
@@ -104,0 +105,0 @@ /** |
@@ -0,5 +1,5 @@ | ||
import { Observable } from "rxjs"; | ||
import { AjaxRequest } from "rxjs/ajax"; | ||
import { ParisConfig } from "../config/paris-config"; | ||
import { HttpOptions, RequestMethod, SaveRequestMethod } from "./http.service"; | ||
import { Observable } from "rxjs"; | ||
import { AjaxRequest } from "rxjs/ajax"; | ||
export declare class DataStoreService { | ||
@@ -6,0 +6,0 @@ private config; |
@@ -0,3 +1,4 @@ | ||
import * as jsonStringify from 'json-stringify-safe'; | ||
import { finalize, share, tap } from "rxjs/operators"; | ||
import { Http } from "./http.service"; | ||
import { finalize, share, tap } from "rxjs/operators"; | ||
var DataStoreService = /** @class */ (function () { | ||
@@ -40,3 +41,3 @@ function DataStoreService(config) { | ||
DataStoreService.getActiveRequestId = function (method, endpoint, data) { | ||
return method + "__" + endpoint + "__" + (data ? JSON.stringify(data) : '|'); | ||
return method + "__" + endpoint + "__" + (data ? jsonStringify(data) : '|'); | ||
}; | ||
@@ -43,0 +44,0 @@ return DataStoreService; |
@@ -1,20 +0,20 @@ | ||
import { ParisConfig } from "./config/paris-config"; | ||
import { Observable } from "rxjs"; | ||
import { ApiCallType } from "./api/api-calls/api-call.model"; | ||
import { DataEntityType } from "./api/entity/data-entity.base"; | ||
import { EntityErrorEvent } from "./api/events/entity-error.event"; | ||
import { RemoveEntitiesEvent } from "./api/events/remove-entities.event"; | ||
import { SaveEntityEvent } from "./api/events/save-entity.event"; | ||
import { RelationshipRepository } from "./api/repository/relationship-repository"; | ||
import { Repository } from "./api/repository/repository"; | ||
import { EntityModelBase } from "./config/entity-model.base"; | ||
import { EntityBackendConfig } from "./config/entity.config"; | ||
import { DataStoreService } from "./data_access/data-store.service"; | ||
import { EntityConfigBase } from "./config/model-config"; | ||
import { Observable } from "rxjs"; | ||
import { SaveEntityEvent } from "./api/events/save-entity.event"; | ||
import { RemoveEntitiesEvent } from "./api/events/remove-entities.event"; | ||
import { RelationshipRepository } from "./api/repository/relationship-repository"; | ||
import { ModelBase } from "./config/model.base"; | ||
import { EntityErrorEvent } from "./api/events/entity-error.event"; | ||
import { ApiCallType } from "./api/api-calls/api-call.model"; | ||
import { Modeler } from "./modeling/modeler"; | ||
import { EntityModelBase } from "./config/entity-model.base"; | ||
import { EntityId } from "./modeling/entity-id.type"; | ||
import { ParisConfig } from "./config/paris-config"; | ||
import { DataQuery } from "./data_access/data-query"; | ||
import { DataStoreService } from "./data_access/data-store.service"; | ||
import { DataOptions } from "./data_access/data.options"; | ||
import { DataSet } from "./data_access/dataset"; | ||
import { EntityId } from "./modeling/entity-id.type"; | ||
import { Modeler } from "./modeling/modeler"; | ||
export declare class Paris<TConfigData = any> { | ||
@@ -21,0 +21,0 @@ private readonly repositories; |
@@ -9,17 +9,18 @@ var __assign = (this && this.__assign) || Object.assign || function(t) { | ||
}; | ||
import * as jsonStringify from 'json-stringify-safe'; | ||
import { clone } from "lodash-es"; | ||
import { of, Subject, throwError } from "rxjs"; | ||
import { catchError, map, mergeMap, switchMap, tap } from "rxjs/operators"; | ||
import { EntityErrorTypes } from "./api/events/entity-error.event"; | ||
import { RelationshipRepository } from "./api/repository/relationship-repository"; | ||
import { Repository } from "./api/repository/repository"; | ||
import { defaultConfig } from "./config/paris-config"; | ||
import { Repository } from "./api/repository/repository"; | ||
import { entitiesService } from "./config/services/entities.service"; | ||
import { DataStoreService } from "./data_access/data-store.service"; | ||
import { of, Subject, throwError } from "rxjs"; | ||
import { RelationshipRepository } from "./api/repository/relationship-repository"; | ||
import { valueObjectsService } from "./config/services/value-objects.service"; | ||
import { EntityErrorTypes } from "./api/events/entity-error.event"; | ||
import { Modeler } from "./modeling/modeler"; | ||
import { catchError, map, mergeMap, switchMap, tap } from "rxjs/operators"; | ||
import { DataTransformersService } from "./modeling/data-transformers.service"; | ||
import { DataCache } from "./data_access/cache"; | ||
import { clone } from "lodash-es"; | ||
import { DataStoreService } from "./data_access/data-store.service"; | ||
import { defaultDataOptions } from "./data_access/data.options"; | ||
import { queryToHttpOptions } from "./data_access/query-to-http"; | ||
import { DataTransformersService } from "./modeling/data-transformers.service"; | ||
import { Modeler } from "./modeling/modeler"; | ||
var Paris = /** @class */ (function () { | ||
@@ -109,3 +110,3 @@ function Paris(config) { | ||
if (dataOptions === void 0) { dataOptions = defaultDataOptions; } | ||
var cacheKey = JSON.stringify(input) || "{}"; | ||
var cacheKey = jsonStringify(input || {}); | ||
if (dataOptions.allowCache) { | ||
@@ -112,0 +113,0 @@ var apiCallTypeCache = this.getApiCallCache(apiCallType); |
@@ -0,0 +0,0 @@ # Paris |
{ | ||
"name": "@microsoft/paris", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Library for the implementation of Domain Driven Design in Angular/TypeScript apps", | ||
@@ -52,2 +52,3 @@ "repository": { | ||
"@types/jest": "^23.3.1", | ||
"@types/json-stringify-safe": "^5.0.0", | ||
"@types/lodash-es": "4.17.1", | ||
@@ -67,2 +68,3 @@ "@types/node": "^8.0.25", | ||
"jest": "^23.5.0", | ||
"json-stringify-safe": "^5.0.1", | ||
"lodash-es": "4.17.10", | ||
@@ -90,2 +92,5 @@ "merge2": "^1.0.2", | ||
}, | ||
"bundledDependencies": [ | ||
"json-stringify-safe" | ||
], | ||
"jest": { | ||
@@ -92,0 +97,0 @@ "transform": { |
@@ -0,0 +0,0 @@ # Paris |
@@ -0,0 +0,0 @@ import {Paris} from '../../lib/paris'; |
@@ -0,0 +0,0 @@ import {Paris} from '../../lib/paris'; |
@@ -0,0 +0,0 @@ import {Paris} from '../../lib/paris'; |
@@ -0,0 +0,0 @@ import {DataStoreService} from "../../lib/data_access/data-store.service"; |
@@ -0,0 +0,0 @@ import {ApiCall} from "../../lib/config/decorators/api-call.decorator"; |
@@ -0,0 +0,0 @@ import {of} from "rxjs"; |
interface MockConfigData { | ||
version: number | ||
} |
@@ -0,0 +0,0 @@ import {ModelBase} from "../../lib/config/model.base"; |
@@ -0,0 +0,0 @@ import {EntityField} from '../../lib/config/decorators/entity-field.decorator'; |
@@ -0,0 +0,0 @@ import {ModelBase} from "../../lib/config/model.base"; |
@@ -0,0 +0,0 @@ import {EntityModelBase} from "../../lib/config/entity-model.base"; |
@@ -0,0 +0,0 @@ import {TodoList} from "./todo-list.entity"; |
@@ -0,0 +0,0 @@ import {Entity} from "../../lib/config/decorators/entity.decorator"; |
@@ -0,0 +0,0 @@ import {EntityModelBase} from "../../lib/config/entity-model.base"; |
@@ -0,0 +0,0 @@ import 'reflect-metadata'; |
@@ -0,0 +0,0 @@ import {Observable, of} from 'rxjs'; |
@@ -1,15 +0,17 @@ | ||
import {Observable, of} from 'rxjs'; | ||
import {CreateTodoListApiCall} from './mock/create-new-list.api-call'; | ||
import {Todo} from './mock/todo.entity'; | ||
import {Repository} from '../lib/api/repository/repository'; | ||
import {Http} from '../lib/data_access/http.service'; | ||
import {Paris} from '../lib/paris'; | ||
import {Tag} from "./mock/tag.value-object"; | ||
import {DataOptions, defaultDataOptions} from "../lib/data_access/data.options"; | ||
import {DataEntityType} from "../lib/api/entity/data-entity.base"; | ||
import {DataQuery} from "../lib/data_access/data-query"; | ||
import {TodoStatus} from "./mock/todo-status.entity"; | ||
import {TodoListItemsRelationship} from "./mock/todo-list.relationships"; | ||
import {RelationshipRepository} from "../lib/api/repository/relationship-repository"; | ||
import {TodoList} from "./mock/todo-list.entity"; | ||
import { Observable, of } from 'rxjs'; | ||
import { DataEntityType } from '../lib/api/entity/data-entity.base'; | ||
import { RelationshipRepository } from '../lib/api/repository/relationship-repository'; | ||
import { Repository } from '../lib/api/repository/repository'; | ||
import { DataQuery } from '../lib/data_access/data-query'; | ||
import { DataOptions, defaultDataOptions } from '../lib/data_access/data.options'; | ||
import { Http } from '../lib/data_access/http.service'; | ||
import { Paris } from '../lib/paris'; | ||
import { mergeMap } from '../node_modules/rxjs/operators'; | ||
import { CreateTodoListApiCall } from './mock/create-new-list.api-call'; | ||
import { Tag } from './mock/tag.value-object'; | ||
import { TodoList } from './mock/todo-list.entity'; | ||
import { TodoListItemsRelationship } from './mock/todo-list.relationships'; | ||
import { TodoStatus } from './mock/todo-status.entity'; | ||
import { Todo } from './mock/todo.entity'; | ||
import { UpdateTodoApiCall } from './mock/update-todo.api-call'; | ||
@@ -183,2 +185,21 @@ describe('Paris main', () => { | ||
it('should be able to serialize complex objects with circular dependencies', done => { | ||
jestMakeApiCallSpy.mockReturnValue(of(null)); | ||
const todoItem = paris.createItem(Todo, { | ||
id: 1, | ||
text: 'myTodo', | ||
time: new Date(), | ||
tags: [], | ||
status: { name: 'Open' }, | ||
}); | ||
todoItem | ||
.pipe(mergeMap(todoItem => paris.apiCall(UpdateTodoApiCall, todoItem))) | ||
.subscribe(() => { | ||
done(); | ||
}); | ||
}); | ||
it('should always add newer data to cache if cache exists', () => {}); | ||
@@ -241,3 +262,3 @@ | ||
describe('createItem', () => { | ||
let createItem$:Observable<Todo>; | ||
let createItem$: Observable<Todo>; | ||
@@ -289,8 +310,11 @@ beforeEach(() => { | ||
it("should throw an error if the relationship doesn't support OneToMany", () => { | ||
expect(() => paris.getRelatedItem(TodoListItemsRelationship, new TodoList({ id: 1 }))).toThrow(); | ||
expect(() => | ||
paris.getRelatedItem(TodoListItemsRelationship, new TodoList({ id: 1 })) | ||
).toThrow(); | ||
}); | ||
it("should return an Observable", () => { | ||
it('should return an Observable', () => { | ||
expect( | ||
paris.queryForItem(TodoListItemsRelationship, new TodoList({ id: 1 }))).toBeInstanceOf(Observable); | ||
paris.queryForItem(TodoListItemsRelationship, new TodoList({ id: 1 })) | ||
).toBeInstanceOf(Observable); | ||
}); | ||
@@ -305,3 +329,3 @@ }); | ||
it("should return null if repo doesn't exist", () => { | ||
class SomeClass{} | ||
class SomeClass {} | ||
expect(paris.getValue(SomeClass, 1)).toBe(null); | ||
@@ -315,3 +339,5 @@ }); | ||
it("should call valueId if it's a function (predicate)", () => { | ||
expect(paris.getValue(TodoStatus, status => /done/i.test(status.name)).name).toBe('Done'); | ||
expect(paris.getValue(TodoStatus, status => /done/i.test(status.name)).name).toBe( | ||
'Done' | ||
); | ||
}); | ||
@@ -338,5 +364,7 @@ | ||
it('should return a RelationshipRepository', () => { | ||
expect(paris.getRelationshipRepository(TodoListItemsRelationship)).toBeInstanceOf(RelationshipRepository); | ||
expect(paris.getRelationshipRepository(TodoListItemsRelationship)).toBeInstanceOf( | ||
RelationshipRepository | ||
); | ||
}); | ||
}); | ||
}); |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
239420
143
4880
0
46
1