@h-ai/iam 0.1.0-alpha5 → 0.1.0-alpha7

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
@@ -3209,9 +3209,9 @@ function createRbacManager(config) {
3209
3209
  whereParams.push(options.type);
3210
3210
  }
3211
3211
  if (options?.search) {
3212
- whereClauses.push("(code LIKE ? OR name LIKE ?)");
3213
3212
  const escaped = options.search.replace(/[%_\\]/g, "\\$&");
3214
3213
  const pattern = `%${escaped}%`;
3214
+ whereClauses.push("(code LIKE ? ESCAPE '\\' OR name LIKE ? ESCAPE '\\')");
3215
3215
  whereParams.push(pattern, pattern);
3216
3216
  }
3217
3217
  const result = await permissionRepository.findPage({
@@ -4204,7 +4204,7 @@ function buildUserQueryOps(ctx) {
4204
4204
  if (options?.search) {
4205
4205
  const escaped = options.search.replace(/[%_\\]/g, "\\$&");
4206
4206
  const keyword = `%${escaped}%`;
4207
- conditions.push("(username LIKE ? OR email LIKE ? OR phone LIKE ? OR display_name LIKE ?)");
4207
+ conditions.push("(username LIKE ? ESCAPE '\\' OR email LIKE ? ESCAPE '\\' OR phone LIKE ? ESCAPE '\\' OR display_name LIKE ? ESCAPE '\\')");
4208
4208
  params.push(keyword, keyword, keyword, keyword);
4209
4209
  }
4210
4210
  if (options?.enabled !== void 0) {