@ngrx/data 15.0.0 → 15.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -781,7 +781,7 @@ class DefaultDataService {
781
781
  }
782
782
  default: {
783
783
  const error = new Error('Unimplemented HTTP method, ' + method);
784
- result$ = throwError(() => error);
784
+ result$ = throwError(error);
785
785
  }
786
786
  }
787
787
  if (this.timeout) {
@@ -796,7 +796,7 @@ class DefaultDataService {
796
796
  return ok;
797
797
  }
798
798
  const error = new DataServiceError(err, reqData);
799
- return throwError(() => error);
799
+ return throwError(error);
800
800
  };
801
801
  }
802
802
  handleDelete404(error, reqData) {
@@ -1006,7 +1006,7 @@ class EntityCacheDataService {
1006
1006
  handleError(reqData) {
1007
1007
  return (err) => {
1008
1008
  const error = new DataServiceError(err, reqData);
1009
- return throwError(() => error);
1009
+ return throwError(error);
1010
1010
  };
1011
1011
  }
1012
1012
  /**
@@ -1401,10 +1401,10 @@ class EntityCacheDispatcher {
1401
1401
  act.type === EntityCacheAction.SAVE_ENTITIES_ERROR ||
1402
1402
  act.type === EntityCacheAction.SAVE_ENTITIES_CANCEL), filter((act) => crid === act.payload.correlationId), take(1), mergeMap((act) => {
1403
1403
  return act.type === EntityCacheAction.SAVE_ENTITIES_CANCEL
1404
- ? throwError(() => new PersistanceCanceled(act.payload.reason))
1404
+ ? throwError(new PersistanceCanceled(act.payload.reason))
1405
1405
  : act.type === EntityCacheAction.SAVE_ENTITIES_SUCCESS
1406
1406
  ? of(act.payload.changeSet)
1407
- : throwError(() => act.payload);
1407
+ : throwError(act.payload);
1408
1408
  }));
1409
1409
  }
1410
1410
  }
@@ -1608,6 +1608,21 @@ class EntityDispatcherBase {
1608
1608
  this.dispatch(action);
1609
1609
  return this.getResponseData$(options.correlationId).pipe(shareReplay(1));
1610
1610
  }
1611
+ /**
1612
+ * Dispatch action to query remote storage for the entities that satisfy a query expressed
1613
+ * with either a query parameter map or an HTTP URL query string,
1614
+ * and completely replace the cached collection with the queried entities.
1615
+ * @param queryParams the query in a form understood by the server
1616
+ * @param [options] options that influence load behavior
1617
+ * @returns A terminating Observable of the queried entities
1618
+ * after server reports successful query or the query error.
1619
+ */
1620
+ loadWithQuery(queryParams, options) {
1621
+ options = this.setQueryEntityActionOptions(options);
1622
+ const action = this.createEntityAction(EntityOp.QUERY_MANY, queryParams, options);
1623
+ this.dispatch(action);
1624
+ return this.getResponseData$(options.correlationId).pipe(shareReplay(1));
1625
+ }
1611
1626
  /**
1612
1627
  * Dispatch action to save the updated entity (or partial entity) in remote storage.
1613
1628
  * The update entity may be partial (but must have its key)
@@ -1790,10 +1805,10 @@ class EntityDispatcherBase {
1790
1805
  }), take(1), mergeMap((act) => {
1791
1806
  const { entityOp } = act.payload;
1792
1807
  return entityOp === EntityOp.CANCEL_PERSIST
1793
- ? throwError(() => new PersistanceCanceled(act.payload.data))
1808
+ ? throwError(new PersistanceCanceled(act.payload.data))
1794
1809
  : entityOp.endsWith(OP_SUCCESS)
1795
1810
  ? of(act.payload.data)
1796
- : throwError(() => act.payload.data.error);
1811
+ : throwError(act.payload.data.error);
1797
1812
  }));
1798
1813
  }
1799
1814
  setQueryEntityActionOptions(options) {
@@ -2281,6 +2296,18 @@ class EntityCollectionServiceBase {
2281
2296
  load(options) {
2282
2297
  return this.dispatcher.load(options);
2283
2298
  }
2299
+ /**
2300
+ * Dispatch action to query remote storage for the entities that satisfy a query expressed
2301
+ * with either a query parameter map or an HTTP URL query string,
2302
+ * and completely replace the cached collection with the queried entities.
2303
+ * @param queryParams the query in a form understood by the server
2304
+ * @param [options] options that influence load behavior
2305
+ * @returns Observable of the queried entities
2306
+ * after server reports successful query or the query error.
2307
+ */
2308
+ loadWithQuery(queryParams, options) {
2309
+ return this.dispatcher.loadWithQuery(queryParams, options);
2310
+ }
2284
2311
  /**
2285
2312
  * Dispatch action to save the updated entity (or partial entity) in remote storage.
2286
2313
  * The update entity may be partial (but must have its key)
@@ -4939,4 +4966,3 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImpor
4939
4966
 
4940
4967
  export { ChangeSetItemFactory, ChangeSetOperation, ChangeType, ClearCollections, CorrelationIdGenerator, DataServiceError, DefaultDataService, DefaultDataServiceConfig, DefaultDataServiceFactory, DefaultHttpUrlGenerator, DefaultLogger, DefaultPersistenceResultHandler, DefaultPluralizer, ENTITY_CACHE_META_REDUCERS, ENTITY_CACHE_NAME, ENTITY_CACHE_NAME_TOKEN, ENTITY_CACHE_SELECTOR_TOKEN, ENTITY_COLLECTION_META_REDUCERS, ENTITY_METADATA_TOKEN, EntityActionFactory, EntityActionGuard, EntityCacheAction, EntityCacheDataService, EntityCacheDispatcher, EntityCacheEffects, EntityCacheReducerFactory, EntityChangeTrackerBase, EntityCollectionCreator, EntityCollectionReducerFactory, EntityCollectionReducerMethods, EntityCollectionReducerMethodsFactory, EntityCollectionReducerRegistry, EntityCollectionServiceBase, EntityCollectionServiceElementsFactory, EntityCollectionServiceFactory, EntityDataModule, EntityDataModuleWithoutEffects, EntityDataService, EntityDefinitionService, EntityDispatcherBase, EntityDispatcherDefaultOptions, EntityDispatcherFactory, EntityEffects, EntityHttpResourceUrls, EntityOp, EntitySelectors$Factory, EntitySelectorsFactory, EntityServices, EntityServicesBase, EntityServicesElements, HttpUrlGenerator, INITIAL_ENTITY_CACHE_STATE, LoadCollections, Logger, MergeQuerySet, MergeStrategy, OP_ERROR, OP_SUCCESS, PLURAL_NAMES_TOKEN, PersistanceCanceled, PersistenceResultHandler, Pluralizer, PropsFilterFnFactory, SaveEntities, SaveEntitiesCancel, SaveEntitiesCanceled, SaveEntitiesError, SaveEntitiesSuccess, SetEntityCache, changeSetItemFactory, createEmptyEntityCollection, createEntityCacheSelector, createEntityDefinition, defaultSelectId, entityCacheSelectorProvider, excludeEmptyChangeSetItems, flattenArgs, getGuid, getGuidComb, guidComparer, makeErrorOp, makeSuccessOp, normalizeRoot, ofEntityOp, ofEntityType, persistOps, provideEntityData, toUpdateFactory, withEffects };
4941
4968
  //# sourceMappingURL=ngrx-data.mjs.map
4942
- //# sourceMappingURL=ngrx-data.mjs.map