@adeu/core 1.15.1 → 1.16.0

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.cjs CHANGED
@@ -3772,6 +3772,12 @@ var RedlineEngine = class {
3772
3772
  errors.push(...validate_edit_strings(edits));
3773
3773
  for (let i = 0; i < edits.length; i++) {
3774
3774
  const edit = edits[i];
3775
+ if (typeof edit !== "object" || edit === null) {
3776
+ errors.push(
3777
+ `- Edit ${i + 1} Failed: Invalid change format. Expected a JSON object, but received a primitive ${typeof edit}. Do not pass raw strings.`
3778
+ );
3779
+ continue;
3780
+ }
3775
3781
  if (!edit.target_text) continue;
3776
3782
  const is_regex = edit.regex || false;
3777
3783
  const match_mode = edit.match_mode || "strict";
@@ -3998,10 +4004,10 @@ var RedlineEngine = class {
3998
4004
  _process_batch_internal(changes, dry_run_mode = false) {
3999
4005
  this.skipped_details = [];
4000
4006
  const actions = changes.filter(
4001
- (c) => ["accept", "reject", "reply"].includes(c.type)
4007
+ (c) => c !== null && typeof c === "object" && ["accept", "reject", "reply"].includes(c.type)
4002
4008
  );
4003
4009
  const edits = changes.filter(
4004
- (c) => !["accept", "reject", "reply"].includes(c.type)
4010
+ (c) => c === null || typeof c !== "object" || !["accept", "reject", "reply"].includes(c.type)
4005
4011
  );
4006
4012
  if (!dry_run_mode) {
4007
4013
  const all_errors = [];
@@ -4151,10 +4157,15 @@ var RedlineEngine = class {
4151
4157
  }
4152
4158
  const resolved_edits = [];
4153
4159
  for (const edit of edits) {
4160
+ if (typeof edit !== "object" || edit === null) {
4161
+ skipped++;
4162
+ continue;
4163
+ }
4154
4164
  edit._applied_status = false;
4155
4165
  edit._error_msg = null;
4156
4166
  }
4157
4167
  for (const edit of edits) {
4168
+ if (typeof edit !== "object" || edit === null) continue;
4158
4169
  if (edit._resolved_start_idx !== void 0 && edit._resolved_start_idx !== null) {
4159
4170
  resolved_edits.push([edit, edit.new_text || null]);
4160
4171
  } else if (edit._match_start_index !== void 0 && edit._match_start_index !== null) {