@platformatic/sql-mapper 2.55.0 → 2.56.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/lib/entity.js CHANGED
@@ -324,12 +324,14 @@ function createMapper (defaultDb, sql, log, table, fields, primaryKeys, relation
324
324
  query = sql`${query} ORDER BY ${sql.join(orderBy, sql`, `)}`
325
325
  }
326
326
 
327
- query = sql`${query} LIMIT ${sanitizeLimit(opts.limit, limitConfig)}`
328
- if (opts.offset !== undefined) {
329
- if (opts.offset < 0) {
330
- throw new errors.ParamNotAllowedError(opts.offset)
327
+ if (opts.paginate !== false) {
328
+ query = sql`${query} LIMIT ${sanitizeLimit(opts.limit, limitConfig)}`
329
+ if (opts.offset !== undefined) {
330
+ if (opts.offset < 0) {
331
+ throw new errors.ParamNotAllowedError(opts.offset)
332
+ }
333
+ query = sql`${query} OFFSET ${opts.offset}`
331
334
  }
332
- query = sql`${query} OFFSET ${opts.offset}`
333
335
  }
334
336
 
335
337
  const rows = await db.query(query)
package/mapper.d.ts CHANGED
@@ -162,6 +162,11 @@ interface Find<EntityFields> {
162
162
  * Number of entities to skip.
163
163
  */
164
164
  offset?: number,
165
+ /**
166
+ * If false pagination is disabled.
167
+ * @default true
168
+ */
169
+ paginate?: boolean,
165
170
  /**
166
171
  * If present, the entity participates in transaction
167
172
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/sql-mapper",
3
- "version": "2.55.0",
3
+ "version": "2.56.0",
4
4
  "description": "A data mapper utility for SQL databases",
5
5
  "main": "mapper.js",
6
6
  "types": "mapper.d.ts",
@@ -35,8 +35,8 @@
35
35
  "camelcase": "^6.3.0",
36
36
  "fastify-plugin": "^5.0.0",
37
37
  "inflected": "^2.1.0",
38
- "@platformatic/telemetry": "2.55.0",
39
- "@platformatic/utils": "2.55.0"
38
+ "@platformatic/telemetry": "2.56.0",
39
+ "@platformatic/utils": "2.56.0"
40
40
  },
41
41
  "tsd": {
42
42
  "directory": "test/types"