pangea-server 1.0.48 → 1.0.49

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.
@@ -3,7 +3,7 @@ type AttributeField = string;
3
3
  type AttributeOp = 'COUNT' | 'SUM';
4
4
  type AttributeColumn = AttributeField | [AttributeOp, AttributeField];
5
5
  type AttributeAlias = string;
6
- type Attribute = AttributeField | Record<AttributeAlias, AttributeColumn>;
6
+ type Attributes = Record<AttributeAlias, AttributeColumn>;
7
7
  type IncludeItem = {
8
8
  relation?: string;
9
9
  active?: boolean;
@@ -14,13 +14,13 @@ type Group = string[];
14
14
  type Order = Record<string, 'asc' | 'desc'>;
15
15
  type FindOneOptions = {
16
16
  scopes?: string[];
17
- attributes?: Attribute[];
17
+ attributes?: Attributes;
18
18
  include?: IncludeItem[];
19
19
  order?: Order;
20
20
  paranoid?: boolean;
21
21
  };
22
22
  type FindManyOptions<BM extends BaseModel> = {
23
- attributes?: Attribute[];
23
+ attributes?: Attributes;
24
24
  include?: IncludeItem[];
25
25
  where?: Where<BM>;
26
26
  searchFields?: string[];
@@ -190,22 +190,12 @@ exports.Db = Db;
190
190
  function getFinalAttributes(attributes) {
191
191
  if (!attributes)
192
192
  return;
193
- const attt = attributes.map((attribute) => {
194
- console.log('attribute: ', attribute);
195
- if (typeof attribute === 'string')
196
- return [(0, sequelize_1.col)((0, pangea_helpers_1.camelToSnake)(attribute)), attribute];
197
- console.log('--- [alias, column] --- ');
198
- const [alias, column] = Object.entries(attribute)[0];
199
- console.log(alias, ': ', column);
193
+ return Object.entries(attributes).map(([alias, column]) => {
200
194
  if (typeof column === 'string')
201
195
  return [(0, sequelize_1.col)((0, pangea_helpers_1.camelToSnake)(column)), alias];
202
- console.log('--- [op, field] --- ');
203
196
  const [op, field] = column;
204
- console.log(op, ': ', field);
205
- return [(0, sequelize_1.fn)(op, (0, sequelize_1.col)(field)), alias];
197
+ return [(0, sequelize_1.fn)(op, (0, sequelize_1.col)((0, pangea_helpers_1.camelToSnake)(field))), alias];
206
198
  });
207
- console.log('attt: ', attt);
208
- return attt;
209
199
  }
210
200
  function convertWhereKeys(obj) {
211
201
  if (Array.isArray(obj)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pangea-server",
3
3
  "description": "",
4
- "version": "1.0.48",
4
+ "version": "1.0.49",
5
5
  "files": [
6
6
  "dist"
7
7
  ],