@sdflc/backend-helpers 1.0.125 → 1.0.127

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.
@@ -702,7 +702,7 @@ class BaseGateway {
702
702
  const ids = [];
703
703
  for (const filter of arr) {
704
704
  if (filter[idName]) {
705
- ids.push(filter[idName]);
705
+ ids.push(...(0, lodash_1.castArray)(filter[idName]));
706
706
  }
707
707
  }
708
708
  if (ids.length > 0) {
@@ -696,7 +696,7 @@ class BaseGateway {
696
696
  const ids = [];
697
697
  for (const filter of arr) {
698
698
  if (filter[idName]) {
699
- ids.push(filter[idName]);
699
+ ids.push(...castArray(filter[idName]));
700
700
  }
701
701
  }
702
702
  if (ids.length > 0) {
@@ -1,4 +1,5 @@
1
1
  import path from 'path';
2
+ import { Buffer } from 'buffer';
2
3
  import { snakeCase } from 'lodash';
3
4
  import { camelKeys } from '@sdflc/utils';
4
5
  const defaultMigrationsTable = 'migrations';
@@ -36,6 +37,13 @@ const lowercaseUuids = (value) => {
36
37
  if (Array.isArray(value)) {
37
38
  return value.map(lowercaseUuids);
38
39
  }
40
+ // Date and Buffer are the only non-null object types a MSSQL driver can
41
+ // return for a column value. Both must pass through unchanged — without
42
+ // this guard, Object.entries(Date) returns [] producing {}, and
43
+ // Object.entries(Buffer) returns numeric index keys producing garbage.
44
+ if (value instanceof Date || Buffer.isBuffer(value)) {
45
+ return value;
46
+ }
39
47
  if (value !== null && typeof value === 'object') {
40
48
  const result = {};
41
49
  for (const [k, v] of Object.entries(value)) {
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.buildKnexConfig = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
+ const buffer_1 = require("buffer");
8
9
  const lodash_1 = require("lodash");
9
10
  const utils_1 = require("@sdflc/utils");
10
11
  const defaultMigrationsTable = 'migrations';
@@ -42,6 +43,13 @@ const lowercaseUuids = (value) => {
42
43
  if (Array.isArray(value)) {
43
44
  return value.map(lowercaseUuids);
44
45
  }
46
+ // Date and Buffer are the only non-null object types a MSSQL driver can
47
+ // return for a column value. Both must pass through unchanged — without
48
+ // this guard, Object.entries(Date) returns [] producing {}, and
49
+ // Object.entries(Buffer) returns numeric index keys producing garbage.
50
+ if (value instanceof Date || buffer_1.Buffer.isBuffer(value)) {
51
+ return value;
52
+ }
45
53
  if (value !== null && typeof value === 'object') {
46
54
  const result = {};
47
55
  for (const [k, v] of Object.entries(value)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdflc/backend-helpers",
3
- "version": "1.0.125",
3
+ "version": "1.0.127",
4
4
  "description": "Set of helper functions and classes to simplify building backend apps within @sdflc ecosystem",
5
5
  "type": "commonjs",
6
6
  "exports": {