@adeu/core 1.15.2 → 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.js CHANGED
@@ -3721,6 +3721,12 @@ var RedlineEngine = class {
3721
3721
  errors.push(...validate_edit_strings(edits));
3722
3722
  for (let i = 0; i < edits.length; i++) {
3723
3723
  const edit = edits[i];
3724
+ if (typeof edit !== "object" || edit === null) {
3725
+ errors.push(
3726
+ `- Edit ${i + 1} Failed: Invalid change format. Expected a JSON object, but received a primitive ${typeof edit}. Do not pass raw strings.`
3727
+ );
3728
+ continue;
3729
+ }
3724
3730
  if (!edit.target_text) continue;
3725
3731
  const is_regex = edit.regex || false;
3726
3732
  const match_mode = edit.match_mode || "strict";
@@ -3947,10 +3953,10 @@ var RedlineEngine = class {
3947
3953
  _process_batch_internal(changes, dry_run_mode = false) {
3948
3954
  this.skipped_details = [];
3949
3955
  const actions = changes.filter(
3950
- (c) => ["accept", "reject", "reply"].includes(c.type)
3956
+ (c) => c !== null && typeof c === "object" && ["accept", "reject", "reply"].includes(c.type)
3951
3957
  );
3952
3958
  const edits = changes.filter(
3953
- (c) => !["accept", "reject", "reply"].includes(c.type)
3959
+ (c) => c === null || typeof c !== "object" || !["accept", "reject", "reply"].includes(c.type)
3954
3960
  );
3955
3961
  if (!dry_run_mode) {
3956
3962
  const all_errors = [];
@@ -4100,10 +4106,15 @@ var RedlineEngine = class {
4100
4106
  }
4101
4107
  const resolved_edits = [];
4102
4108
  for (const edit of edits) {
4109
+ if (typeof edit !== "object" || edit === null) {
4110
+ skipped++;
4111
+ continue;
4112
+ }
4103
4113
  edit._applied_status = false;
4104
4114
  edit._error_msg = null;
4105
4115
  }
4106
4116
  for (const edit of edits) {
4117
+ if (typeof edit !== "object" || edit === null) continue;
4107
4118
  if (edit._resolved_start_idx !== void 0 && edit._resolved_start_idx !== null) {
4108
4119
  resolved_edits.push([edit, edit.new_text || null]);
4109
4120
  } else if (edit._match_start_index !== void 0 && edit._match_start_index !== null) {