code cleanup and version 1.0.0-alpha.1 release
This commit is contained in:
parent
a8999f81c7
commit
fc543977fb
22
angular.json
22
angular.json
@ -3,7 +3,7 @@
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"data": {
|
||||
"demo": {
|
||||
"projectType": "application",
|
||||
"schematics": {},
|
||||
"root": "",
|
||||
@ -121,33 +121,33 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@poweredsoft/data": {
|
||||
"data": {
|
||||
"projectType": "library",
|
||||
"root": "projects/poweredsoft/data",
|
||||
"sourceRoot": "projects/poweredsoft/data/src",
|
||||
"root": "projects/data",
|
||||
"sourceRoot": "projects/data/src",
|
||||
"prefix": "lib",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-ng-packagr:build",
|
||||
"options": {
|
||||
"tsConfig": "projects/poweredsoft/data/tsconfig.lib.json",
|
||||
"project": "projects/poweredsoft/data/ng-package.json"
|
||||
"tsConfig": "projects/data/tsconfig.lib.json",
|
||||
"project": "projects/data/ng-package.json"
|
||||
}
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular-devkit/build-angular:karma",
|
||||
"options": {
|
||||
"main": "projects/poweredsoft/data/src/test.ts",
|
||||
"tsConfig": "projects/poweredsoft/data/tsconfig.spec.json",
|
||||
"karmaConfig": "projects/poweredsoft/data/karma.conf.js"
|
||||
"main": "projects/data/src/test.ts",
|
||||
"tsConfig": "projects/data/tsconfig.spec.json",
|
||||
"karmaConfig": "projects/data/karma.conf.js"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"options": {
|
||||
"tsConfig": [
|
||||
"projects/poweredsoft/data/tsconfig.lib.json",
|
||||
"projects/poweredsoft/data/tsconfig.spec.json"
|
||||
"projects/data/tsconfig.lib.json",
|
||||
"projects/data/tsconfig.spec.json"
|
||||
],
|
||||
"exclude": [
|
||||
"**/node_modules/**"
|
||||
|
14093
package-lock.json
generated
14093
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@ -2,16 +2,11 @@
|
||||
"name": "data",
|
||||
"version": "0.0.30",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
"build-lib": "ng build @poweredsoft/data",
|
||||
"publish-lib": "npm publish dist/poweredsoft/data"
|
||||
"serve": "ng serve",
|
||||
"build": "ng build data",
|
||||
"publish": "npm publish dist/data --access public"
|
||||
},
|
||||
"private": true,
|
||||
"private": false,
|
||||
"dependencies": {
|
||||
"@angular/animations": "~8.2.4",
|
||||
"@angular/common": "~8.2.4",
|
||||
@ -48,5 +43,6 @@
|
||||
"tsickle": "^0.37.0",
|
||||
"tslint": "~5.15.0",
|
||||
"typescript": "~3.5.3"
|
||||
}
|
||||
},
|
||||
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
|
||||
}
|
||||
|
7
projects/data/ng-package.json
Normal file
7
projects/data/ng-package.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../../dist/data",
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts"
|
||||
}
|
||||
}
|
8
projects/data/package.json
Normal file
8
projects/data/package.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "@openharbor/data",
|
||||
"version": "1.0.0-alpha.1",
|
||||
"repository": "https://git.openharbor.io/Open-Harbor/ts-data",
|
||||
"peerDependencies": {
|
||||
"rxjs": "^6.5.3"
|
||||
}
|
||||
}
|
@ -157,7 +157,7 @@ export class DataSource<TModel> implements IDataSource<TModel>
|
||||
map(t => {
|
||||
this._notifyMessageSubject.next({
|
||||
type: 'success',
|
||||
message: 'COMMAND_EXECUTED_SUCCESFULLY',
|
||||
message: 'COMMAND_EXECUTED_SUCCESSFULLY',
|
||||
messageParams: {
|
||||
command: name
|
||||
}
|
||||
@ -179,34 +179,34 @@ export class DataSource<TModel> implements IDataSource<TModel>
|
||||
}
|
||||
|
||||
private _query() : Observable<IQueryExecutionResult<TModel> & IQueryExecutionGroupResult<TModel>> {
|
||||
return Observable.create((o: Observer<IQueryExecutionResult<TModel> & IQueryExecutionGroupResult<TModel>>) => {
|
||||
this._loadingSubject.next(true);
|
||||
this.options.transport.query.adapter.handle(this._criteria)
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
o.complete();
|
||||
this._loadingSubject.next(false);
|
||||
})
|
||||
)
|
||||
.subscribe(
|
||||
result => {
|
||||
this.data = result;
|
||||
o.next(result);
|
||||
this._dataSubject.next(this.data);
|
||||
this._notifyMessageSubject.next({
|
||||
message: 'NEW_DATA_READ_SUCCESFULLY',
|
||||
type: 'info'
|
||||
});
|
||||
},
|
||||
err => {
|
||||
o.error(err);
|
||||
this._notifyMessageSubject.next({
|
||||
message: 'UNEXPECTED_ERROR_OCCURED',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
return new Observable<IQueryExecutionResult<TModel> & IQueryExecutionGroupResult<TModel>>((o: Observer<IQueryExecutionResult<TModel> & IQueryExecutionGroupResult<TModel>>) => {
|
||||
this._loadingSubject.next(true);
|
||||
this.options.transport.query.adapter.handle(this._criteria)
|
||||
.pipe(
|
||||
finalize(() => {
|
||||
o.complete();
|
||||
this._loadingSubject.next(false);
|
||||
})
|
||||
)
|
||||
.subscribe(
|
||||
result => {
|
||||
this.data = result;
|
||||
o.next(result);
|
||||
this._dataSubject.next(this.data);
|
||||
this._notifyMessageSubject.next({
|
||||
message: 'NEW_DATA_READ_SUCCESSFULLY',
|
||||
type: 'info'
|
||||
});
|
||||
},
|
||||
err => {
|
||||
o.error(err);
|
||||
this._notifyMessageSubject.next({
|
||||
message: 'UNEXPECTED_ERROR_OCCURRED',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
query<TQuery extends IQueryCriteria>(query: TQuery) {
|
||||
@ -219,15 +219,13 @@ export class DataSource<TModel> implements IDataSource<TModel>
|
||||
return this.refresh();
|
||||
}
|
||||
|
||||
excuteQuery<TQuery extends IQueryCriteria>(query: TQuery): Observable<IQueryExecutionGroupResult<TModel> & IQueryExecutionGroupResult<TModel>>{
|
||||
executeQuery<TQuery extends IQueryCriteria>(query: TQuery): Observable<IQueryExecutionGroupResult<TModel>>{
|
||||
return this.options.transport.query.adapter.handle(query);
|
||||
}
|
||||
|
||||
refresh() {
|
||||
return this._query().subscribe(
|
||||
res => {},
|
||||
err => {}
|
||||
);
|
||||
return this._query()
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
get sorts() {
|
@ -10,7 +10,7 @@ export interface IDataSource<TModel>
|
||||
resolveCommandModelByName<T extends any>(event: IResolveCommandModelEvent<TModel>) : Observable<T>;
|
||||
executeCommandByName<TCommand, TResult>(name: string, command: TCommand) : Observable<TResult>;
|
||||
query<TQuery extends IQueryCriteria>(query: TQuery);
|
||||
excuteQuery<TQuery extends IQueryCriteria>(query: TQuery): Observable<IQueryExecutionGroupResult<TModel> & IQueryExecutionGroupResult<TModel>>;
|
||||
executeQuery<TQuery extends IQueryCriteria>(query: TQuery): Observable<IQueryExecutionGroupResult<TModel> & IQueryExecutionGroupResult<TModel>>;
|
||||
refresh();
|
||||
resolveIdField<TKeyType extends any>(model: TModel) : TKeyType;
|
||||
clear();
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../out-tsc/lib",
|
||||
"target": "es2015",
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.json",
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../../../out-tsc/spec",
|
||||
"types": [
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../../../tslint.json",
|
||||
"extends": "../../tslint.json",
|
||||
"rules": {
|
||||
"directive-selector": [
|
||||
true,
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
|
||||
"dest": "../../../dist/poweredsoft/data",
|
||||
"lib": {
|
||||
"entryFile": "src/public-api.ts"
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
{
|
||||
"name": "@poweredsoft/data",
|
||||
"version": "0.0.36",
|
||||
"peerDependencies": {
|
||||
"rxjs": "^6.5.3"
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
import { TestBed, async } from '@angular/core/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it(`should have as title 'data'`, () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app.title).toEqual('data');
|
||||
});
|
||||
|
||||
it('should render title', () => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.debugElement.nativeElement;
|
||||
expect(compiled.querySelector('.content span').textContent).toContain('data app is running!');
|
||||
});
|
||||
});
|
@ -1,9 +1,18 @@
|
||||
import { Component, OnInit, Pipe } from '@angular/core';
|
||||
import { IDataSource } from 'projects/poweredsoft/data/src/lib/IDataSource';
|
||||
import { IDataSourceNotifyMessage } from 'projects/poweredsoft/data/src/lib/IDataSourceNotifyMessage';
|
||||
import { DataSource, IDataSourceTransportOptions, IDataSourceQueryAdapterOptions, IQueryCriteria, IQueryExecutionResult, IQueryExecutionGroupResult, IDataSourceCommandAdapterOptions, IDataSourceValidationError } from 'projects/poweredsoft/data/src/public-api';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {IDataSourceNotifyMessage} from '../../projects/data/src/lib/IDataSourceNotifyMessage';
|
||||
import {
|
||||
DataSource,
|
||||
IDataSource,
|
||||
IDataSourceCommandAdapterOptions,
|
||||
IDataSourceQueryAdapterOptions,
|
||||
IDataSourceTransportOptions,
|
||||
IDataSourceValidationError,
|
||||
IQueryCriteria,
|
||||
IQueryExecutionGroupResult,
|
||||
IQueryExecutionResult
|
||||
} from '@openharbor/data';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {of, throwError} from 'rxjs';
|
||||
|
||||
export interface MyModel {
|
||||
id: number;
|
||||
|
@ -19,12 +19,9 @@
|
||||
"dom"
|
||||
],
|
||||
"paths": {
|
||||
"@poweredsoft/data": [
|
||||
"dist/poweredsoft/data"
|
||||
"@openharbor/data": [
|
||||
"./projects/data/src/public-api"
|
||||
],
|
||||
"@poweredsoft/data/*": [
|
||||
"dist/poweredsoft/data/*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
|
Loading…
Reference in New Issue
Block a user