@objectstack/objectql 10.2.0 → 10.3.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.
package/dist/index.d.mts CHANGED
@@ -683,6 +683,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
683
683
  generatedBy?: string | undefined;
684
684
  } | undefined;
685
685
  } | undefined;
686
+ requiredPermissions?: string[] | undefined;
686
687
  shortcut?: string | undefined;
687
688
  bulkEnabled?: boolean | undefined;
688
689
  ai?: {
package/dist/index.d.ts CHANGED
@@ -683,6 +683,7 @@ declare class ObjectStackProtocolImplementation implements ObjectStackProtocol {
683
683
  generatedBy?: string | undefined;
684
684
  } | undefined;
685
685
  } | undefined;
686
+ requiredPermissions?: string[] | undefined;
686
687
  shortcut?: string | undefined;
687
688
  bulkEnabled?: boolean | undefined;
688
689
  ai?: {
package/dist/index.js CHANGED
@@ -4058,16 +4058,37 @@ var _ObjectStackProtocolImplementation = class _ObjectStackProtocolImplementatio
4058
4058
  return {
4059
4059
  object: request.object,
4060
4060
  records: limited,
4061
- total: limited.length,
4062
- hasMore: false
4061
+ total: records2.length,
4062
+ hasMore: limited.length < records2.length
4063
4063
  };
4064
4064
  }
4065
4065
  const records = await this.engine.find(request.object, options);
4066
+ const pageLimit = typeof options.limit === "number" && options.limit > 0 ? options.limit : void 0;
4067
+ const pageOffset = typeof options.offset === "number" && options.offset > 0 ? options.offset : 0;
4068
+ let total = records.length;
4069
+ let hasMore = false;
4070
+ if (pageLimit !== void 0) {
4071
+ const countable = options.search == null && options.distinct == null;
4072
+ if (countable) {
4073
+ try {
4074
+ total = await this.engine.count(request.object, {
4075
+ where: options.where,
4076
+ context: options.context
4077
+ });
4078
+ } catch {
4079
+ total = pageOffset + records.length;
4080
+ }
4081
+ hasMore = pageOffset + records.length < total;
4082
+ } else {
4083
+ hasMore = records.length === pageLimit;
4084
+ total = pageOffset + records.length + (hasMore ? 1 : 0);
4085
+ }
4086
+ }
4066
4087
  return {
4067
4088
  object: request.object,
4068
4089
  records,
4069
- total: records.length,
4070
- hasMore: false
4090
+ total,
4091
+ hasMore
4071
4092
  };
4072
4093
  }
4073
4094
  async getData(request) {