av6-core 2.0.5 → 2.0.7

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/dist/index.js CHANGED
@@ -428,11 +428,12 @@ function normalizeWhere(where) {
428
428
  const commonKey = keysArr[0][0];
429
429
  const allSameKey = keysArr.every((ks) => ks[0] === commonKey);
430
430
  const isLogicalKey = commonKey === "AND" || commonKey === "OR" || commonKey === "NOT";
431
- if (allSameKey && !isLogicalKey) {
431
+ if (allSameKey && !isLogicalKey && orItems.length > 1) {
432
432
  const innerList = orItems.map((it) => it[commonKey]).filter((v) => isPlainObject(v));
433
433
  const anyScalar = innerList.some(isScalarFilterObject);
434
- if (!anyScalar) {
435
- const shouldFold = innerList.some(isRelationFilterObject) || innerList.some(
434
+ const anyRelation = innerList.some(isRelationFilterObject);
435
+ if (!anyScalar && !anyRelation) {
436
+ const shouldFold = innerList.some(
436
437
  (o) => Object.keys(o).some((k) => !SCALAR_OPS.has(k) && k !== "AND" && k !== "OR" && k !== "NOT")
437
438
  );
438
439
  if (shouldFold) {
@@ -2486,7 +2487,7 @@ var approvalRepository = (deps) => {
2486
2487
  ( cam.staff_id = ${staffId} or scc.staff_id = ${staffId} )
2487
2488
  and cai.status in (${import_client.Prisma.join(status)})
2488
2489
  and LOWER(cai.service) like LOWER(${serviceLike})
2489
- and (LOWER(cai.ref_no) like LOWER(${pattern}) or LOWER(cai.extra) like LOWER(${pattern}) )
2490
+ and (LOWER(cai.ref_no) like LOWER(${pattern}) or LOWER(cai.extra) like LOWER(${pattern}) or LOWER(s.name) like LOWER(${pattern}) or LOWER(s.email) like LOWER(${pattern}) or LOWER(s.contact_no) like LOWER(${pattern}) or LOWER(s.employee_id) like LOWER(${pattern}) )
2490
2491
  and cam.cc_id = ${ccId}
2491
2492
  and cai.is_active = 1
2492
2493
  and cas.is_active = 1
package/dist/index.mjs CHANGED
@@ -365,11 +365,12 @@ function normalizeWhere(where) {
365
365
  const commonKey = keysArr[0][0];
366
366
  const allSameKey = keysArr.every((ks) => ks[0] === commonKey);
367
367
  const isLogicalKey = commonKey === "AND" || commonKey === "OR" || commonKey === "NOT";
368
- if (allSameKey && !isLogicalKey) {
368
+ if (allSameKey && !isLogicalKey && orItems.length > 1) {
369
369
  const innerList = orItems.map((it) => it[commonKey]).filter((v) => isPlainObject(v));
370
370
  const anyScalar = innerList.some(isScalarFilterObject);
371
- if (!anyScalar) {
372
- const shouldFold = innerList.some(isRelationFilterObject) || innerList.some(
371
+ const anyRelation = innerList.some(isRelationFilterObject);
372
+ if (!anyScalar && !anyRelation) {
373
+ const shouldFold = innerList.some(
373
374
  (o) => Object.keys(o).some((k) => !SCALAR_OPS.has(k) && k !== "AND" && k !== "OR" && k !== "NOT")
374
375
  );
375
376
  if (shouldFold) {
@@ -2423,7 +2424,7 @@ var approvalRepository = (deps) => {
2423
2424
  ( cam.staff_id = ${staffId} or scc.staff_id = ${staffId} )
2424
2425
  and cai.status in (${Prisma.join(status)})
2425
2426
  and LOWER(cai.service) like LOWER(${serviceLike})
2426
- and (LOWER(cai.ref_no) like LOWER(${pattern}) or LOWER(cai.extra) like LOWER(${pattern}) )
2427
+ and (LOWER(cai.ref_no) like LOWER(${pattern}) or LOWER(cai.extra) like LOWER(${pattern}) or LOWER(s.name) like LOWER(${pattern}) or LOWER(s.email) like LOWER(${pattern}) or LOWER(s.contact_no) like LOWER(${pattern}) or LOWER(s.employee_id) like LOWER(${pattern}) )
2427
2428
  and cam.cc_id = ${ccId}
2428
2429
  and cai.is_active = 1
2429
2430
  and cas.is_active = 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "av6-core",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",