db-model-router 1.0.14 → 1.0.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "db-model-router",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Generative API Creation using mysql2 and express libraries in node js",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/cli/init.js CHANGED
@@ -239,14 +239,17 @@ function updatePackageJson(answers, outputDir) {
239
239
  const { dependencies, devDependencies } = collectDependencies(answers);
240
240
  const scripts = getScripts(outputDir);
241
241
 
242
+ const normalizedOutput = outputDir ? outputDir.replace(/\/+$/, "") : "";
243
+ const importPrefix = normalizedOutput ? `./${normalizedOutput}/` : "./";
244
+
242
245
  pkg.type = "module";
243
246
  pkg.imports = {
244
247
  "#root/*.js": "./*.js",
245
- "#models": "./models/index.js",
246
- "#models/*.js": "./models/*.js",
247
- "#routes/*.js": "./routes/*.js",
248
- "#commons/*.js": "./commons/*.js",
249
- "#middleware/*.js": "./middleware/*.js",
248
+ "#models": `${importPrefix}models/index.js`,
249
+ "#models/*.js": `${importPrefix}models/*.js`,
250
+ "#routes/*.js": `${importPrefix}routes/*.js`,
251
+ "#commons/*.js": `${importPrefix}commons/*.js`,
252
+ "#middleware/*.js": `${importPrefix}middleware/*.js`,
250
253
  };
251
254
  pkg.scripts = Object.assign({}, pkg.scripts || {}, scripts);
252
255
  pkg.dependencies = Object.assign({}, pkg.dependencies || {}, dependencies);
@@ -304,8 +304,9 @@ function where(filter, safeDelete = null) {
304
304
  ),
305
305
  );
306
306
  } else if (j[1] === "like" || j[1] === "not like") {
307
+ const pgOp = j[1] === "like" ? "ILIKE" : "NOT ILIKE";
307
308
  bindIdx++;
308
- conditionAnd.push(`${escapeId(j[0])} ${j[1]} $${bindIdx}`);
309
+ conditionAnd.push(`${escapeId(j[0])} ${pgOp} $${bindIdx}`);
309
310
  value.push("%" + j[2] + "%");
310
311
  } else {
311
312
  bindIdx++;