pg-mvc-service 2.0.102 → 2.0.104

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.
@@ -244,9 +244,18 @@ class TableModel {
244
244
  where(param1, param2, right) {
245
245
  if (typeof param1 === 'string') {
246
246
  if (param2 === undefined || right === undefined || Array.isArray(param2)) {
247
- this.whereExpressions.push(param1);
248
247
  if (Array.isArray(param2)) {
248
+ let expression = param1;
249
+ const startIndex = this.vars.length + 1;
250
+ expression = expression.replace(/\$(\d+)/g, (match, num) => {
251
+ const originalNum = parseInt(num, 10);
252
+ return `$${startIndex + originalNum - 1}`;
253
+ });
249
254
  this.vars = [...this.vars, ...param2];
255
+ this.whereExpressions.push(expression);
256
+ }
257
+ else {
258
+ this.whereExpressions.push(param1);
250
259
  }
251
260
  }
252
261
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pg-mvc-service",
3
- "version": "2.0.102",
3
+ "version": "2.0.104",
4
4
  "description": "",
5
5
  "homepage": "https://github.com/n-daira/npm-pack_mvc-service#readme",
6
6
  "bugs": {
@@ -21,7 +21,7 @@ export class Base64Client {
21
21
  // return Buffer.from(text).toString('base64');
22
22
  // }
23
23
 
24
- public tryDecode(base64: string): Buffer<ArrayBuffer> | false {
24
+ public tryDecode(base64: string): Buffer | false {
25
25
  try {
26
26
  // Data URLのパターンをチェック
27
27
  if (base64.startsWith('data:')) {
@@ -48,7 +48,7 @@ export class Base64Client {
48
48
  }
49
49
  }
50
50
 
51
- public getMimeType(data: string | Buffer<ArrayBuffer>): TImage | TPdf {
51
+ public getMimeType(data: string | Buffer): TImage | TPdf {
52
52
  try {
53
53
  let buffer;
54
54
  if (typeof data === 'string') {
@@ -293,9 +293,17 @@ export class TableModel {
293
293
  public where(param1: string | TColumnInfo | Array<TNestedCondition>, param2?: Array<any> | TOperator, right?: TColumnInfo | any): void {
294
294
  if (typeof param1 === 'string') {
295
295
  if (param2 === undefined || right === undefined || Array.isArray(param2)) {
296
- this.whereExpressions.push(param1);
297
296
  if (Array.isArray(param2)) {
297
+ let expression = param1;
298
+ const startIndex = this.vars.length + 1;
299
+ expression = expression.replace(/\$(\d+)/g, (match, num) => {
300
+ const originalNum = parseInt(num, 10);
301
+ return `$${startIndex + originalNum - 1}`;
302
+ });
298
303
  this.vars = [...this.vars, ...param2];
304
+ this.whereExpressions.push(expression);
305
+ } else {
306
+ this.whereExpressions.push(param1);
299
307
  }
300
308
  } else {
301
309
  const query = WhereExpression.create({model: this, name: param1}, param2, right, this.vars.length + 1);