deprecated manage message

This commit is contained in:
David Lebee
2021-02-17 10:38:56 -05:00
parent fe2c6bfe02
commit f403025ced
6 changed files with 21 additions and 23 deletions
@@ -2,7 +2,7 @@
"name": "@poweredsoft/ngx-data-apollo",
"version": "0.0.8",
"peerDependencies": {
"@poweredsoft/data": "^0.0.26",
"@poweredsoft/data": "^0.0.31",
"@angular/common": "^8.2.4",
"@angular/core": "^8.2.4",
"apollo-angular-link-http": "^1.9.0",
+1 -1
View File
@@ -4,7 +4,7 @@
"peerDependencies": {
"@angular/common": "^8.2.4",
"@angular/core": "^8.2.4",
"@poweredsoft/data": "^0.0.26",
"@poweredsoft/data": "^0.0.31",
"rxjs": "^6.5.3"
}
}
@@ -12,7 +12,6 @@ export class HttpDataSourceOptionsBuilder<TModel, TKey> {
private _keyResolver: (model: TModel) => TKey;
private _defaultCriteria: IQueryCriteria;
private _query: IDataSourceQueryAdapterOptions<TModel>;
private _manageNotificationMessage: boolean = false;
constructor(private http: HttpClient) {
@@ -22,17 +21,11 @@ export class HttpDataSourceOptionsBuilder<TModel, TKey> {
let ret: IDataSourceOptions<TModel> = {
resolveIdField: this._keyResolver,
defaultCriteria: this._defaultCriteria,
manageNotificationMessage: this._manageNotificationMessage,
transport: this.createTransport()
};
return ret;
}
manageNotificationMessage(shouldManage: boolean) {
this._manageNotificationMessage = shouldManage;
return this;
}
createDataSource() : IDataSource<TModel>{
return new DataSource<TModel>(this.createOptions());
}
@@ -147,9 +140,15 @@ export class HttpDataSourceOptionsBuilder<TModel, TKey> {
return this;
}
public addCommandByUrl<TCommand, TCommandResult>(name: string, url: string, resolveCommandModel?: (event: IResolveCommandModelEvent<TModel>) => Observable<TCommand & any>) {
public addCommandByUrl<TCommand, TCommandResult>(name: string, url: string, resolveCommandModel?: (event: IResolveCommandModelEvent<TModel>) => Observable<TCommand & any>, beforeCommand?: (command: TCommand) => Observable<TCommand>) {
const handleWrapper = command => {
return this.http.post<TCommandResult>(url, command).pipe(catchError(this._handleErrorPipe));
const finalBeforeCommand = beforeCommand || (_ => of(command));
return finalBeforeCommand(command)
.pipe(
switchMap(finalCommand => {
return this.http.post<TCommandResult>(url, finalCommand).pipe(catchError(this._handleErrorPipe));
})
);
};
this._commands[name] = <IDataSourceCommandAdapterOptions<TModel>> {
@@ -62,7 +62,6 @@ export class GenericRestDataSourceService
const dataSourceOptions: IDataSourceOptions<TModel> = {
defaultCriteria: defaultCriteria,
resolveIdField: keyResolver,
manageNotificationMessage: manageNotificationMessage,
transport: dataSourceTransportOptions
};