@ruiapp/rapid-core 0.10.7 → 0.10.8

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.
package/dist/index.js CHANGED
@@ -2742,12 +2742,16 @@ async function findEntities(server, dataAccessor, options) {
2742
2742
  return entities;
2743
2743
  }
2744
2744
  async function findEntity(server, dataAccessor, options) {
2745
- const entities = await findEntities(server, dataAccessor, {
2746
- ...options,
2747
- ...{
2745
+ if (options.pagination) {
2746
+ options.pagination.limit = 1;
2747
+ }
2748
+ else {
2749
+ options.pagination = {
2750
+ offset: 0,
2748
2751
  limit: 1,
2749
- },
2750
- });
2752
+ };
2753
+ }
2754
+ const entities = await findEntities(server, dataAccessor, options);
2751
2755
  return lodash.first(entities);
2752
2756
  }
2753
2757
  async function findById(server, dataAccessor, options) {
@@ -2973,7 +2977,7 @@ async function convertEntityFiltersToRowFilters(routeContext, server, model, bas
2973
2977
  }
2974
2978
  let itemType;
2975
2979
  if (filter.operator === "in" || filter.operator === "notIn") {
2976
- itemType = filter.itemType || pgPropertyTypeColumnMap[property.type];
2980
+ itemType = filter.itemType || (property && pgPropertyTypeColumnMap[property.type]);
2977
2981
  }
2978
2982
  replacedFilters.push({
2979
2983
  operator: filter.operator,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruiapp/rapid-core",
3
- "version": "0.10.7",
3
+ "version": "0.10.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -362,12 +362,15 @@ async function findEntities(server: IRpdServer, dataAccessor: IRpdDataAccessor,
362
362
  }
363
363
 
364
364
  async function findEntity(server: IRpdServer, dataAccessor: IRpdDataAccessor, options: FindEntityOptions) {
365
- const entities = await findEntities(server, dataAccessor, {
366
- ...options,
367
- ...{
365
+ if (options.pagination) {
366
+ options.pagination.limit = 1;
367
+ } else {
368
+ options.pagination = {
369
+ offset: 0,
368
370
  limit: 1,
369
- },
370
- });
371
+ };
372
+ }
373
+ const entities = await findEntities(server, dataAccessor, options);
371
374
  return first(entities);
372
375
  }
373
376
 
@@ -614,7 +617,7 @@ async function convertEntityFiltersToRowFilters(
614
617
 
615
618
  let itemType: string | undefined;
616
619
  if (filter.operator === "in" || filter.operator === "notIn") {
617
- itemType = filter.itemType || pgPropertyTypeColumnMap[property.type];
620
+ itemType = filter.itemType || (property && pgPropertyTypeColumnMap[property.type]);
618
621
  }
619
622
 
620
623
  replacedFilters.push({