@medyll/idae-query 0.34.0 → 0.36.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.
@@ -1,11 +1,11 @@
1
- import { type DotPath } from '../path/pathResolver.js';
1
+ import { type DotPath } from "../path/pathResolver.js";
2
2
  /**
3
3
  * Represents the options for a result set.
4
4
  * @template T - The type of the result set.
5
5
  */
6
6
  export type ResultsetOptions<T = any> = {
7
7
  /** Can receive a dot path for sorting. */
8
- sort?: Record<DotPath<T>, 'asc' | 'desc'>;
8
+ sort?: Record<DotPath<T>, "asc" | "desc">;
9
9
  /** Specifies the property to group the result set by. */
10
10
  groupBy?: DotPath<T>;
11
11
  /** Specifies the page size of the result set. */
@@ -18,7 +18,7 @@ export type ResultsetOptions<T = any> = {
18
18
  export type ResultSet<T> = T[] & {
19
19
  setOptions: (options: ResultsetOptions) => ResultSet<T>;
20
20
  /** Accepts a dot path */
21
- sortBy: (args: Record<string, 'asc' | 'desc'>) => ResultSet<T>;
21
+ sortBy: (args: Record<string, "asc" | "desc">) => ResultSet<T>;
22
22
  /** Accepts a dot path as fieldName */
23
23
  groupBy: (fieldName: string | string[],
24
24
  /** Transformer function to generate the grouped key */
@@ -1,4 +1,4 @@
1
- import { dotPath } from '../path/pathResolver.js';
1
+ import { dotPath } from "../path/pathResolver.js";
2
2
  /**
3
3
  * Generates a ResultSet based on the provided data array and defines additional properties like setOptions, sortBy, groupBy, and getPage for customization and manipulation.
4
4
  *
@@ -18,8 +18,8 @@ export function getResultset(data) {
18
18
  }
19
19
  return this;
20
20
  },
21
- enumerable: false,
22
- configurable: true
21
+ enumerable: true,
22
+ configurable: true,
23
23
  },
24
24
  sortBy: {
25
25
  value: function (args) {
@@ -31,7 +31,7 @@ export function getResultset(data) {
31
31
  while (i < keys.length && result === 0) {
32
32
  let value = keys[i];
33
33
  result =
34
- values[i] === 'asc'
34
+ values[i] === "asc"
35
35
  ? Number(dotPath(a, value)) - Number(dotPath(b, value))
36
36
  : Number(dotPath(b, value)) - Number(dotPath(a, value));
37
37
  i++;
@@ -41,14 +41,14 @@ export function getResultset(data) {
41
41
  // delete this?.sortBy;
42
42
  return this;
43
43
  },
44
- enumerable: false,
45
- configurable: true
44
+ enumerable: true,
45
+ configurable: true,
46
46
  },
47
47
  groupBy: {
48
48
  value: function (fieldName, transform) {
49
- const finalFieldName = typeof fieldName === 'string' ? [fieldName] : fieldName;
49
+ const finalFieldName = typeof fieldName === "string" ? [fieldName] : fieldName;
50
50
  return this.reduce((acc, curr) => {
51
- let key = '';
51
+ let key = "";
52
52
  for (let i = 0; i < finalFieldName.length; i++) {
53
53
  key += dotPath(curr, finalFieldName[i]);
54
54
  }
@@ -59,8 +59,8 @@ export function getResultset(data) {
59
59
  return acc;
60
60
  }, {});
61
61
  },
62
- enumerable: false,
63
- configurable: true
62
+ enumerable: true,
63
+ configurable: true,
64
64
  },
65
65
  getPage: {
66
66
  value: function (page, size) {
@@ -68,9 +68,9 @@ export function getResultset(data) {
68
68
  delete this?.getPage;
69
69
  return dta;
70
70
  },
71
- enumerable: false,
72
- configurable: true
73
- }
71
+ enumerable: true,
72
+ configurable: true,
73
+ },
74
74
  });
75
75
  return data;
76
76
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@medyll/idae-query",
3
3
  "scope": "@medyll",
4
- "version": "0.34.0",
4
+ "version": "0.36.0",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
7
7
  "build": "vite build && npm run package",