@ngrx/data 13.0.1 → 13.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.
@@ -615,10 +615,10 @@ class DefaultHttpUrlGenerator {
615
615
  * @param entityName {string} Name of the entity type, e.g, 'Hero'
616
616
  * @param root {string} Root path to the resource, e.g., 'some-api`
617
617
  */
618
- getResourceUrls(entityName, root) {
618
+ getResourceUrls(entityName, root, trailingSlashEndpoints = false) {
619
619
  let resourceUrls = this.knownHttpResourceUrls[entityName];
620
620
  if (!resourceUrls) {
621
- const nRoot = normalizeRoot(root);
621
+ const nRoot = trailingSlashEndpoints ? root : normalizeRoot(root);
622
622
  resourceUrls = {
623
623
  entityResourceUrl: `${nRoot}/${entityName}/`.toLowerCase(),
624
624
  collectionResourceUrl: `${nRoot}/${this.pluralizer.pluralize(entityName)}/`.toLowerCase(),
@@ -633,8 +633,8 @@ class DefaultHttpUrlGenerator {
633
633
  * @param root {string} Root path to the resource, e.g., 'some-api`
634
634
  * @returns complete path to resource, e.g, 'some-api/hero'
635
635
  */
636
- entityResource(entityName, root) {
637
- return this.getResourceUrls(entityName, root).entityResourceUrl;
636
+ entityResource(entityName, root, trailingSlashEndpoints) {
637
+ return this.getResourceUrls(entityName, root, trailingSlashEndpoints).entityResourceUrl;
638
638
  }
639
639
  /**
640
640
  * Create the path to a multiple entity (collection) resource
@@ -677,11 +677,12 @@ class DefaultDataService {
677
677
  this.getDelay = 0;
678
678
  this.saveDelay = 0;
679
679
  this.timeout = 0;
680
+ this.trailingSlashEndpoints = false;
680
681
  this._name = `${entityName} DefaultDataService`;
681
682
  this.entityName = entityName;
682
- const { root = 'api', delete404OK = true, getDelay = 0, saveDelay = 0, timeout: to = 0, } = config || {};
683
+ const { root = 'api', delete404OK = true, getDelay = 0, saveDelay = 0, timeout: to = 0, trailingSlashEndpoints = false, } = config || {};
683
684
  this.delete404OK = delete404OK;
684
- this.entityUrl = httpUrlGenerator.entityResource(entityName, root);
685
+ this.entityUrl = httpUrlGenerator.entityResource(entityName, root, trailingSlashEndpoints);
685
686
  this.entitiesUrl = httpUrlGenerator.collectionResource(entityName, root);
686
687
  this.getDelay = getDelay;
687
688
  this.saveDelay = saveDelay;
@@ -771,7 +772,7 @@ class DefaultDataService {
771
772
  }
772
773
  default: {
773
774
  const error = new Error('Unimplemented HTTP method, ' + method);
774
- result$ = throwError(error);
775
+ result$ = throwError(() => error);
775
776
  }
776
777
  }
777
778
  if (this.timeout) {
@@ -786,7 +787,7 @@ class DefaultDataService {
786
787
  return ok;
787
788
  }
788
789
  const error = new DataServiceError(err, reqData);
789
- return throwError(error);
790
+ return throwError(() => error);
790
791
  };
791
792
  }
792
793
  handleDelete404(error, reqData) {
@@ -993,7 +994,7 @@ class EntityCacheDataService {
993
994
  handleError(reqData) {
994
995
  return (err) => {
995
996
  const error = new DataServiceError(err, reqData);
996
- return throwError(error);
997
+ return throwError(() => error);
997
998
  };
998
999
  }
999
1000
  /**
@@ -1062,8 +1063,8 @@ class EntityCacheDataService {
1062
1063
  getIdSelector(entityName) {
1063
1064
  let idSelector = this.idSelectors[entityName];
1064
1065
  if (!idSelector) {
1065
- idSelector = this.entityDefinitionService.getDefinition(entityName)
1066
- .selectId;
1066
+ idSelector =
1067
+ this.entityDefinitionService.getDefinition(entityName).selectId;
1067
1068
  this.idSelectors[entityName] = idSelector;
1068
1069
  }
1069
1070
  return idSelector;
@@ -1384,10 +1385,10 @@ class EntityCacheDispatcher {
1384
1385
  act.type === EntityCacheAction.SAVE_ENTITIES_ERROR ||
1385
1386
  act.type === EntityCacheAction.SAVE_ENTITIES_CANCEL), filter((act) => crid === act.payload.correlationId), take(1), mergeMap((act) => {
1386
1387
  return act.type === EntityCacheAction.SAVE_ENTITIES_CANCEL
1387
- ? throwError(new PersistanceCanceled(act.payload.reason))
1388
+ ? throwError(() => new PersistanceCanceled(act.payload.reason))
1388
1389
  : act.type === EntityCacheAction.SAVE_ENTITIES_SUCCESS
1389
1390
  ? of(act.payload.changeSet)
1390
- : throwError(act.payload);
1391
+ : throwError(() => act.payload);
1391
1392
  }));
1392
1393
  }
1393
1394
  }
@@ -1771,10 +1772,10 @@ class EntityDispatcherBase {
1771
1772
  }), take(1), mergeMap((act) => {
1772
1773
  const { entityOp } = act.payload;
1773
1774
  return entityOp === EntityOp.CANCEL_PERSIST
1774
- ? throwError(new PersistanceCanceled(act.payload.data))
1775
+ ? throwError(() => new PersistanceCanceled(act.payload.data))
1775
1776
  : entityOp.endsWith(OP_SUCCESS)
1776
1777
  ? of(act.payload.data)
1777
- : throwError(act.payload.data.error);
1778
+ : throwError(() => act.payload.data.error);
1778
1779
  }));
1779
1780
  }
1780
1781
  setQueryEntityActionOptions(options) {
@@ -4890,3 +4891,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.0", ngImpor
4890
4891
  */
4891
4892
 
4892
4893
  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, toUpdateFactory };
4894
+ //# sourceMappingURL=ngrx-data.mjs.map