@romandmitri/ai-patch 0.1.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/README.md +86 -0
- package/dist/content/Content.d.ts +2 -0
- package/dist/content/Content.d.ts.map +1 -0
- package/dist/content/Content.js +2 -0
- package/dist/content/Content.js.map +1 -0
- package/dist/content/ContentFormat.d.ts +4 -0
- package/dist/content/ContentFormat.d.ts.map +1 -0
- package/dist/content/ContentFormat.js +7 -0
- package/dist/content/ContentFormat.js.map +1 -0
- package/dist/content/ContentLineNumber.d.ts +2 -0
- package/dist/content/ContentLineNumber.d.ts.map +1 -0
- package/dist/content/ContentLineNumber.js +2 -0
- package/dist/content/ContentLineNumber.js.map +1 -0
- package/dist/content/ContentPartial.d.ts +2 -0
- package/dist/content/ContentPartial.d.ts.map +1 -0
- package/dist/content/ContentPartial.js +2 -0
- package/dist/content/ContentPartial.js.map +1 -0
- package/dist/content/ContentPosition.d.ts +2 -0
- package/dist/content/ContentPosition.d.ts.map +1 -0
- package/dist/content/ContentPosition.js +2 -0
- package/dist/content/ContentPosition.js.map +1 -0
- package/dist/error/PatchError.d.ts +19 -0
- package/dist/error/PatchError.d.ts.map +1 -0
- package/dist/error/PatchError.js +26 -0
- package/dist/error/PatchError.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/operation/Operation.d.ts +6 -0
- package/dist/operation/Operation.d.ts.map +1 -0
- package/dist/operation/Operation.js +2 -0
- package/dist/operation/Operation.js.map +1 -0
- package/dist/operation/OperationType.d.ts +8 -0
- package/dist/operation/OperationType.d.ts.map +1 -0
- package/dist/operation/OperationType.js +11 -0
- package/dist/operation/OperationType.js.map +1 -0
- package/dist/operation/Operation_Delete.d.ts +15 -0
- package/dist/operation/Operation_Delete.d.ts.map +1 -0
- package/dist/operation/Operation_Delete.js +12 -0
- package/dist/operation/Operation_Delete.js.map +1 -0
- package/dist/operation/Operation_InsertAfter.d.ts +17 -0
- package/dist/operation/Operation_InsertAfter.d.ts.map +1 -0
- package/dist/operation/Operation_InsertAfter.js +13 -0
- package/dist/operation/Operation_InsertAfter.js.map +1 -0
- package/dist/operation/Operation_InsertBefore.d.ts +17 -0
- package/dist/operation/Operation_InsertBefore.d.ts.map +1 -0
- package/dist/operation/Operation_InsertBefore.js +13 -0
- package/dist/operation/Operation_InsertBefore.js.map +1 -0
- package/dist/operation/Operation_Replace.d.ts +17 -0
- package/dist/operation/Operation_Replace.d.ts.map +1 -0
- package/dist/operation/Operation_Replace.js +13 -0
- package/dist/operation/Operation_Replace.js.map +1 -0
- package/dist/patch/Edit.d.ts +11 -0
- package/dist/patch/Edit.d.ts.map +1 -0
- package/dist/patch/Edit.js +2 -0
- package/dist/patch/Edit.js.map +1 -0
- package/dist/patch/InputIndex.d.ts +2 -0
- package/dist/patch/InputIndex.d.ts.map +1 -0
- package/dist/patch/InputIndex.js +2 -0
- package/dist/patch/InputIndex.js.map +1 -0
- package/dist/patch/Patcher.d.ts +8 -0
- package/dist/patch/Patcher.d.ts.map +1 -0
- package/dist/patch/Patcher.js +7 -0
- package/dist/patch/Patcher.js.map +1 -0
- package/dist/patch/Patcher_Text.d.ts +13 -0
- package/dist/patch/Patcher_Text.d.ts.map +1 -0
- package/dist/patch/Patcher_Text.js +106 -0
- package/dist/patch/Patcher_Text.js.map +1 -0
- package/dist/target/Target.d.ts +23 -0
- package/dist/target/Target.d.ts.map +1 -0
- package/dist/target/Target.js +76 -0
- package/dist/target/Target.js.map +1 -0
- package/dist/target/test/Target.apply.test.d.ts +2 -0
- package/dist/target/test/Target.apply.test.d.ts.map +1 -0
- package/dist/target/test/Target.apply.test.js +127 -0
- package/dist/target/test/Target.apply.test.js.map +1 -0
- package/dist/target/test/Target.complex.test.d.ts +2 -0
- package/dist/target/test/Target.complex.test.d.ts.map +1 -0
- package/dist/target/test/Target.complex.test.js +217 -0
- package/dist/target/test/Target.complex.test.js.map +1 -0
- package/dist/target/test/Target.errors.test.d.ts +2 -0
- package/dist/target/test/Target.errors.test.d.ts.map +1 -0
- package/dist/target/test/Target.errors.test.js +108 -0
- package/dist/target/test/Target.errors.test.js.map +1 -0
- package/dist/target/test/Target.schema.test.d.ts +2 -0
- package/dist/target/test/Target.schema.test.d.ts.map +1 -0
- package/dist/target/test/Target.schema.test.js +101 -0
- package/dist/target/test/Target.schema.test.js.map +1 -0
- package/dist/target/test/Target.tool.test.d.ts +2 -0
- package/dist/target/test/Target.tool.test.d.ts.map +1 -0
- package/dist/target/test/Target.tool.test.js +76 -0
- package/dist/target/test/Target.tool.test.js.map +1 -0
- package/docs/development.md +28 -0
- package/package.json +67 -0
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# `@romandmitri/ai-patch`
|
|
2
|
+
|
|
3
|
+
https://www.npmjs.com/package/@romandmitri/ai-patch
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Problem
|
|
8
|
+
|
|
9
|
+
AI generation loops often rewrite an entire prompt or document for a small change. That consumes more tokens, costs more, takes longer, and increases the risk
|
|
10
|
+
of hallucinations, context drift, and unintended rewrites.
|
|
11
|
+
|
|
12
|
+
## Solution
|
|
13
|
+
|
|
14
|
+
`@romandmitri/ai-patch` bridges the gap between AI generation and diff-based updates. It lets an LLM return small, structured patches, then validates and
|
|
15
|
+
applies them atomically while leaving unrelated content unchanged.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npm install @romandmitri/ai-patch
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Text is the currently supported content format. JSON coming... if needed.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# Vercel AI SDK
|
|
28
|
+
|
|
29
|
+
## Structured Output
|
|
30
|
+
|
|
31
|
+
`Target.toSchema()` returns a Zod schema for one operation array. Use it directly for a single target or compose several target schemas into a caller-owned
|
|
32
|
+
object.
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import {ContentFormat, Target} from "@romandmitri/ai-patch";
|
|
36
|
+
import {Output, generateText} from "ai";
|
|
37
|
+
import {z} from "zod";
|
|
38
|
+
|
|
39
|
+
const documentTarget = new Target({
|
|
40
|
+
content: "# Guide\n\nOld instructions.\n",
|
|
41
|
+
format: ContentFormat.Markdown,
|
|
42
|
+
});
|
|
43
|
+
const summaryTarget = new Target({
|
|
44
|
+
content: "# Summary\n\nOld summary.\n",
|
|
45
|
+
format: ContentFormat.Markdown,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const {output} = await generateText({
|
|
49
|
+
model,
|
|
50
|
+
prompt: "Update the guide and its summary.",
|
|
51
|
+
output: Output.object({
|
|
52
|
+
schema: z.object({
|
|
53
|
+
documentOperations: documentTarget.toSchema(),
|
|
54
|
+
summaryOperations: summaryTarget.toSchema(),
|
|
55
|
+
}),
|
|
56
|
+
}),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const updatedDocument = documentTarget.apply(output.documentOperations);
|
|
60
|
+
const updatedSummary = summaryTarget.apply(output.summaryOperations);
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Each schema describes one immutable target. Operations cannot address another target or change which content snapshot supplies their coordinates.
|
|
64
|
+
|
|
65
|
+
## Tools
|
|
66
|
+
|
|
67
|
+
`Target.toVercelTool()` creates a target-bound AI SDK tool. Its strict input is `{ patches: Operation[] }`, and execution returns the updated content string.
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import {ContentFormat, Target} from "@romandmitri/ai-patch";
|
|
71
|
+
import {generateText, isStepCount} from "ai";
|
|
72
|
+
|
|
73
|
+
const target = new Target({
|
|
74
|
+
content: "# Guide\n\nOld instructions.\n",
|
|
75
|
+
format: ContentFormat.Markdown,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
await generateText({
|
|
79
|
+
model,
|
|
80
|
+
prompt: "Update the guide with the patch tool.",
|
|
81
|
+
tools: {
|
|
82
|
+
patchGuide: target.toVercelTool(),
|
|
83
|
+
},
|
|
84
|
+
stopWhen: isStepCount(5),
|
|
85
|
+
});
|
|
86
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../src/content/Content.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Content.js","sourceRoot":"","sources":["../../src/content/Content.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentFormat.d.ts","sourceRoot":"","sources":["../../src/content/ContentFormat.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IAGxB,IAAI,SAAS;CACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentFormat.js","sourceRoot":"","sources":["../../src/content/ContentFormat.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACxB,2DAA2D;IAC3D,iBAAiB;IACjB,8BAAa,CAAA;AACd,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentLineNumber.d.ts","sourceRoot":"","sources":["../../src/content/ContentLineNumber.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentLineNumber.js","sourceRoot":"","sources":["../../src/content/ContentLineNumber.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPartial.d.ts","sourceRoot":"","sources":["../../src/content/ContentPartial.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPartial.js","sourceRoot":"","sources":["../../src/content/ContentPartial.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPosition.d.ts","sourceRoot":"","sources":["../../src/content/ContentPosition.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentPosition.js","sourceRoot":"","sources":["../../src/content/ContentPosition.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare enum PatchErrorCode {
|
|
2
|
+
AnchorMismatch = "anchor_mismatch",
|
|
3
|
+
ConflictingInsertion = "conflicting_insertion",
|
|
4
|
+
InsertionInsideRange = "insertion_inside_range",
|
|
5
|
+
InvalidExpectedLine = "invalid_expected_line",
|
|
6
|
+
InvalidOperation = "invalid_operation",
|
|
7
|
+
InvalidNewText = "invalid_new_text",
|
|
8
|
+
InvalidOldText = "invalid_old_text",
|
|
9
|
+
InvalidPatch = "invalid_patch",
|
|
10
|
+
OverlappingRange = "overlapping_range"
|
|
11
|
+
}
|
|
12
|
+
export declare class PatchError extends Error {
|
|
13
|
+
readonly code: PatchErrorCode;
|
|
14
|
+
readonly patchIndex: number;
|
|
15
|
+
readonly name = "PatchError";
|
|
16
|
+
constructor(code: PatchErrorCode, patchIndex: number, message: string);
|
|
17
|
+
}
|
|
18
|
+
export declare const fail: (patchIndex: number, code: PatchErrorCode, message: string) => never;
|
|
19
|
+
//# sourceMappingURL=PatchError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PatchError.d.ts","sourceRoot":"","sources":["../../src/error/PatchError.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACzB,cAAc,oBAAoB;IAClC,oBAAoB,0BAA0B;IAC9C,oBAAoB,2BAA2B;IAC/C,mBAAmB,0BAA0B;IAC7C,gBAAgB,sBAAsB;IACtC,cAAc,qBAAqB;IACnC,cAAc,qBAAqB;IACnC,YAAY,kBAAkB;IAC9B,gBAAgB,sBAAsB;CACtC;AAED,qBAAa,UAAW,SAAQ,KAAK;IAInC,QAAQ,CAAC,IAAI,EAAE,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM;IAJ5B,QAAQ,CAAC,IAAI,gBAAgB;IAE7B,YACU,IAAI,EAAE,cAAc,EACpB,UAAU,EAAE,MAAM,EAC3B,OAAO,EAAE,MAAM,EAGf;CACD;AAED,eAAO,MAAM,IAAI,eAAgB,MAAM,QAAQ,cAAc,WAAW,MAAM,KAAG,KAEhF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export var PatchErrorCode;
|
|
2
|
+
(function (PatchErrorCode) {
|
|
3
|
+
PatchErrorCode["AnchorMismatch"] = "anchor_mismatch";
|
|
4
|
+
PatchErrorCode["ConflictingInsertion"] = "conflicting_insertion";
|
|
5
|
+
PatchErrorCode["InsertionInsideRange"] = "insertion_inside_range";
|
|
6
|
+
PatchErrorCode["InvalidExpectedLine"] = "invalid_expected_line";
|
|
7
|
+
PatchErrorCode["InvalidOperation"] = "invalid_operation";
|
|
8
|
+
PatchErrorCode["InvalidNewText"] = "invalid_new_text";
|
|
9
|
+
PatchErrorCode["InvalidOldText"] = "invalid_old_text";
|
|
10
|
+
PatchErrorCode["InvalidPatch"] = "invalid_patch";
|
|
11
|
+
PatchErrorCode["OverlappingRange"] = "overlapping_range";
|
|
12
|
+
})(PatchErrorCode || (PatchErrorCode = {}));
|
|
13
|
+
export class PatchError extends Error {
|
|
14
|
+
code;
|
|
15
|
+
patchIndex;
|
|
16
|
+
name = "PatchError";
|
|
17
|
+
constructor(code, patchIndex, message) {
|
|
18
|
+
super(`Patch at index ${patchIndex}: ${message}`);
|
|
19
|
+
this.code = code;
|
|
20
|
+
this.patchIndex = patchIndex;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export const fail = (patchIndex, code, message) => {
|
|
24
|
+
throw new PatchError(code, patchIndex, message);
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=PatchError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PatchError.js","sourceRoot":"","sources":["../../src/error/PatchError.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAUX;AAVD,WAAY,cAAc;IACzB,oDAAkC,CAAA;IAClC,gEAA8C,CAAA;IAC9C,iEAA+C,CAAA;IAC/C,+DAA6C,CAAA;IAC7C,wDAAsC,CAAA;IACtC,qDAAmC,CAAA;IACnC,qDAAmC,CAAA;IACnC,gDAA8B,CAAA;IAC9B,wDAAsC,CAAA;AACvC,CAAC,EAVW,cAAc,KAAd,cAAc,QAUzB;AAED,MAAM,OAAO,UAAW,SAAQ,KAAK;IAI1B,IAAI;IACJ,UAAU;IAJX,IAAI,GAAG,YAAY,CAAC;IAE7B,YACU,IAAoB,EACpB,UAAkB,EAC3B,OAAe;QAEf,KAAK,CAAC,kBAAkB,UAAU,KAAK,OAAO,EAAE,CAAC,CAAC;oBAJzC,IAAI;0BACJ,UAAU;IAIpB,CAAC;CACD;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,UAAkB,EAAE,IAAoB,EAAE,OAAe,EAAS,EAAE;IACxF,MAAM,IAAI,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { ContentFormat } from "#src/content/ContentFormat.js";
|
|
2
|
+
export { PatchError, PatchErrorCode } from "#src/error/PatchError.js";
|
|
3
|
+
export type { Operation } from "#src/operation/Operation.js";
|
|
4
|
+
export type { Operation_Delete } from "#src/operation/Operation_Delete.js";
|
|
5
|
+
export type { Operation_InsertAfter } from "#src/operation/Operation_InsertAfter.js";
|
|
6
|
+
export type { Operation_InsertBefore } from "#src/operation/Operation_InsertBefore.js";
|
|
7
|
+
export type { Operation_Replace } from "#src/operation/Operation_Replace.js";
|
|
8
|
+
export { OperationType } from "#src/operation/OperationType.js";
|
|
9
|
+
export { Target } from "#src/target/Target.js";
|
|
10
|
+
export type { TargetOptions, TargetTool } from "#src/target/Target.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AACtE,YAAY,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,YAAY,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,YAAY,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,YAAY,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AACvF,YAAY,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ContentFormat } from "#src/content/ContentFormat.js";
|
|
2
|
+
export { PatchError, PatchErrorCode } from "#src/error/PatchError.js";
|
|
3
|
+
export { OperationType } from "#src/operation/OperationType.js";
|
|
4
|
+
export { Target } from "#src/target/Target.js";
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAMtE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Operation_Delete } from "#src/operation/Operation_Delete.js";
|
|
2
|
+
import type { Operation_InsertAfter } from "#src/operation/Operation_InsertAfter.js";
|
|
3
|
+
import type { Operation_InsertBefore } from "#src/operation/Operation_InsertBefore.js";
|
|
4
|
+
import type { Operation_Replace } from "#src/operation/Operation_Replace.js";
|
|
5
|
+
export type Operation = Operation_Replace | Operation_InsertBefore | Operation_InsertAfter | Operation_Delete;
|
|
6
|
+
//# sourceMappingURL=Operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operation.d.ts","sourceRoot":"","sources":["../../src/operation/Operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG,sBAAsB,GAAG,qBAAqB,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operation.js","sourceRoot":"","sources":["../../src/operation/Operation.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare enum OperationType {
|
|
2
|
+
Replace = "replace",
|
|
3
|
+
InsertBefore = "insertBefore",
|
|
4
|
+
InsertAfter = "insertAfter",
|
|
5
|
+
Delete = "delete"
|
|
6
|
+
}
|
|
7
|
+
export declare const isValidOperationType: (type: OperationType) => boolean;
|
|
8
|
+
//# sourceMappingURL=OperationType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationType.d.ts","sourceRoot":"","sources":["../../src/operation/OperationType.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACxB,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,WAAW,gBAAgB;IAC3B,MAAM,WAAW;CACjB;AAED,eAAO,MAAM,oBAAoB,SAAU,aAAa,KAAG,OAE1D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var OperationType;
|
|
2
|
+
(function (OperationType) {
|
|
3
|
+
OperationType["Replace"] = "replace";
|
|
4
|
+
OperationType["InsertBefore"] = "insertBefore";
|
|
5
|
+
OperationType["InsertAfter"] = "insertAfter";
|
|
6
|
+
OperationType["Delete"] = "delete";
|
|
7
|
+
})(OperationType || (OperationType = {}));
|
|
8
|
+
export const isValidOperationType = (type) => {
|
|
9
|
+
return Object.values(OperationType).includes(type);
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=OperationType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationType.js","sourceRoot":"","sources":["../../src/operation/OperationType.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACxB,oCAAmB,CAAA;IACnB,8CAA6B,CAAA;IAC7B,4CAA2B,CAAA;IAC3B,kCAAiB,CAAA;AAClB,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAmB,EAAW,EAAE;IACpE,OAAO,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACpD,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ContentLineNumber } from "#src/content/ContentLineNumber.js";
|
|
2
|
+
import type { ContentPartial } from "#src/content/ContentPartial.js";
|
|
3
|
+
import { OperationType } from "#src/operation/OperationType.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
export type Operation_Delete = {
|
|
6
|
+
readonly operation: OperationType.Delete;
|
|
7
|
+
readonly expectedLine: ContentLineNumber;
|
|
8
|
+
readonly oldText: ContentPartial;
|
|
9
|
+
};
|
|
10
|
+
export declare const PatchOperation_Delete_Schema: z.ZodObject<{
|
|
11
|
+
operation: z.ZodLiteral<OperationType.Delete>;
|
|
12
|
+
expectedLine: z.ZodNumber;
|
|
13
|
+
oldText: z.ZodString;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
//# sourceMappingURL=Operation_Delete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operation_Delete.d.ts","sourceRoot":"","sources":["../../src/operation/Operation_Delete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,gBAAgB,GAAG;IAC9B,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC;IACzC,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;kBAQ4D,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { OperationType } from "#src/operation/OperationType.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export const PatchOperation_Delete_Schema = z
|
|
4
|
+
.strictObject({
|
|
5
|
+
operation: z.literal(OperationType.Delete).describe("Delete the exact oldText anchor."),
|
|
6
|
+
expectedLine: z.number().int().min(1).describe("The exact 1-based line in the original target content where oldText must begin."),
|
|
7
|
+
oldText: z
|
|
8
|
+
.string()
|
|
9
|
+
.describe("An exact text anchor that must start at expectedLine in the original target content; CRLF and LF are treated equivalently."),
|
|
10
|
+
})
|
|
11
|
+
.describe("Delete one exact anchored range from this target.");
|
|
12
|
+
//# sourceMappingURL=Operation_Delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operation_Delete.js","sourceRoot":"","sources":["../../src/operation/Operation_Delete.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC;KAC3C,YAAY,CAAC;IACb,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IACvF,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iFAAiF,CAAC;IACjI,OAAO,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CAAC,4HAA4H,CAAC;CACxI,CAAC;KACD,QAAQ,CAAC,mDAAmD,CAAuC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContentLineNumber } from "#src/content/ContentLineNumber.js";
|
|
2
|
+
import type { ContentPartial } from "#src/content/ContentPartial.js";
|
|
3
|
+
import { OperationType } from "#src/operation/OperationType.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
export type Operation_InsertAfter = {
|
|
6
|
+
readonly operation: OperationType.InsertAfter;
|
|
7
|
+
readonly expectedLine: ContentLineNumber;
|
|
8
|
+
readonly oldText: ContentPartial;
|
|
9
|
+
readonly newText: ContentPartial;
|
|
10
|
+
};
|
|
11
|
+
export declare const PatchOperation_InsertAfter_Schema: z.ZodObject<{
|
|
12
|
+
operation: z.ZodLiteral<OperationType.InsertAfter>;
|
|
13
|
+
expectedLine: z.ZodNumber;
|
|
14
|
+
oldText: z.ZodString;
|
|
15
|
+
newText: z.ZodString;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
//# sourceMappingURL=Operation_InsertAfter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operation_InsertAfter.d.ts","sourceRoot":"","sources":["../../src/operation/Operation_InsertAfter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,qBAAqB,GAAG;IACnC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC;IAC9C,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;kBAS6D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OperationType } from "#src/operation/OperationType.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export const PatchOperation_InsertAfter_Schema = z
|
|
4
|
+
.strictObject({
|
|
5
|
+
operation: z.literal(OperationType.InsertAfter).describe("Insert newText immediately after the exact oldText anchor."),
|
|
6
|
+
expectedLine: z.number().int().min(1).describe("The exact 1-based line in the original target content where oldText must begin."),
|
|
7
|
+
oldText: z
|
|
8
|
+
.string()
|
|
9
|
+
.describe("An exact text anchor that must start at expectedLine in the original target content; CRLF and LF are treated equivalently."),
|
|
10
|
+
newText: z.string().describe("The text inserted after the matched oldText anchor."),
|
|
11
|
+
})
|
|
12
|
+
.describe("Insert text after one exact anchor in this target.");
|
|
13
|
+
//# sourceMappingURL=Operation_InsertAfter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operation_InsertAfter.js","sourceRoot":"","sources":["../../src/operation/Operation_InsertAfter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC;KAChD,YAAY,CAAC;IACb,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,4DAA4D,CAAC;IACtH,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iFAAiF,CAAC;IACjI,OAAO,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CAAC,4HAA4H,CAAC;IACxI,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;CACnF,CAAC;KACD,QAAQ,CAAC,oDAAoD,CAA4C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContentLineNumber } from "#src/content/ContentLineNumber.js";
|
|
2
|
+
import type { ContentPartial } from "#src/content/ContentPartial.js";
|
|
3
|
+
import { OperationType } from "#src/operation/OperationType.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
export type Operation_InsertBefore = {
|
|
6
|
+
readonly operation: OperationType.InsertBefore;
|
|
7
|
+
readonly expectedLine: ContentLineNumber;
|
|
8
|
+
readonly oldText: ContentPartial;
|
|
9
|
+
readonly newText: ContentPartial;
|
|
10
|
+
};
|
|
11
|
+
export declare const PatchOperation_InsertBefore_Schema: z.ZodObject<{
|
|
12
|
+
operation: z.ZodLiteral<OperationType.InsertBefore>;
|
|
13
|
+
expectedLine: z.ZodNumber;
|
|
14
|
+
oldText: z.ZodString;
|
|
15
|
+
newText: z.ZodString;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
//# sourceMappingURL=Operation_InsertBefore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operation_InsertBefore.d.ts","sourceRoot":"","sources":["../../src/operation/Operation_InsertBefore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,sBAAsB,GAAG;IACpC,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,YAAY,CAAC;IAC/C,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;;;kBAS8D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OperationType } from "#src/operation/OperationType.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export const PatchOperation_InsertBefore_Schema = z
|
|
4
|
+
.strictObject({
|
|
5
|
+
operation: z.literal(OperationType.InsertBefore).describe("Insert newText immediately before the exact oldText anchor."),
|
|
6
|
+
expectedLine: z.number().int().min(1).describe("The exact 1-based line in the original target content where oldText must begin."),
|
|
7
|
+
oldText: z
|
|
8
|
+
.string()
|
|
9
|
+
.describe("An exact text anchor that must start at expectedLine in the original target content; CRLF and LF are treated equivalently."),
|
|
10
|
+
newText: z.string().describe("The text inserted before the matched oldText anchor."),
|
|
11
|
+
})
|
|
12
|
+
.describe("Insert text before one exact anchor in this target.");
|
|
13
|
+
//# sourceMappingURL=Operation_InsertBefore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operation_InsertBefore.js","sourceRoot":"","sources":["../../src/operation/Operation_InsertBefore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC;KACjD,YAAY,CAAC;IACb,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,6DAA6D,CAAC;IACxH,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iFAAiF,CAAC;IACjI,OAAO,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CAAC,4HAA4H,CAAC;IACxI,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;CACpF,CAAC;KACD,QAAQ,CAAC,qDAAqD,CAA6C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContentLineNumber } from "#src/content/ContentLineNumber.js";
|
|
2
|
+
import type { ContentPartial } from "#src/content/ContentPartial.js";
|
|
3
|
+
import { OperationType } from "#src/operation/OperationType.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
export type Operation_Replace = {
|
|
6
|
+
readonly operation: OperationType.Replace;
|
|
7
|
+
readonly expectedLine: ContentLineNumber;
|
|
8
|
+
readonly oldText: ContentPartial;
|
|
9
|
+
readonly newText: ContentPartial;
|
|
10
|
+
};
|
|
11
|
+
export declare const PatchOperation_Replace_Schema: z.ZodObject<{
|
|
12
|
+
operation: z.ZodLiteral<OperationType.Replace>;
|
|
13
|
+
expectedLine: z.ZodNumber;
|
|
14
|
+
oldText: z.ZodString;
|
|
15
|
+
newText: z.ZodString;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
//# sourceMappingURL=Operation_Replace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operation_Replace.d.ts","sourceRoot":"","sources":["../../src/operation/Operation_Replace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC;IAC1C,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;kBAS2D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OperationType } from "#src/operation/OperationType.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
export const PatchOperation_Replace_Schema = z
|
|
4
|
+
.strictObject({
|
|
5
|
+
operation: z.literal(OperationType.Replace).describe("Replace the exact oldText anchor with newText."),
|
|
6
|
+
expectedLine: z.number().int().min(1).describe("The exact 1-based line in the original target content where oldText must begin."),
|
|
7
|
+
oldText: z
|
|
8
|
+
.string()
|
|
9
|
+
.describe("An exact text anchor that must start at expectedLine in the original target content; CRLF and LF are treated equivalently."),
|
|
10
|
+
newText: z.string().describe("The text that replaces the matched oldText anchor."),
|
|
11
|
+
})
|
|
12
|
+
.describe("Replace one exact anchored range in this target.");
|
|
13
|
+
//# sourceMappingURL=Operation_Replace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operation_Replace.js","sourceRoot":"","sources":["../../src/operation/Operation_Replace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC;KAC5C,YAAY,CAAC;IACb,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,gDAAgD,CAAC;IACtG,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iFAAiF,CAAC;IACjI,OAAO,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CAAC,4HAA4H,CAAC;IACxI,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;CAClF,CAAC;KACD,QAAQ,CAAC,kDAAkD,CAAwC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ContentPartial } from "#src/content/ContentPartial.js";
|
|
2
|
+
import type { ContentPosition } from "#src/content/ContentPosition.js";
|
|
3
|
+
import type { InputIndex } from "#src/patch/InputIndex.js";
|
|
4
|
+
export interface Edit {
|
|
5
|
+
readonly inputIndex: InputIndex;
|
|
6
|
+
readonly start: ContentPosition;
|
|
7
|
+
readonly end: ContentPosition;
|
|
8
|
+
readonly replacement: ContentPartial;
|
|
9
|
+
readonly isInsertion: boolean;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=Edit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Edit.d.ts","sourceRoot":"","sources":["../../src/patch/Edit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,WAAW,IAAI;IACpB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC,QAAQ,CAAC,GAAG,EAAE,eAAe,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Edit.js","sourceRoot":"","sources":["../../src/patch/Edit.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputIndex.d.ts","sourceRoot":"","sources":["../../src/patch/InputIndex.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputIndex.js","sourceRoot":"","sources":["../../src/patch/InputIndex.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Content } from "#src/content/Content.js";
|
|
2
|
+
import type { Operation } from "#src/operation/Operation.js";
|
|
3
|
+
export declare abstract class Patcher {
|
|
4
|
+
readonly content: Content;
|
|
5
|
+
constructor(content: Content);
|
|
6
|
+
abstract apply(operations: readonly Operation[]): Content;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=Patcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Patcher.d.ts","sourceRoot":"","sources":["../../src/patch/Patcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D,8BAAsB,OAAO;IAC5B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,YAAY,OAAO,EAAE,OAAO,EAE3B;IAED,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,OAAO,CAAC;CAC1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Patcher.js","sourceRoot":"","sources":["../../src/patch/Patcher.ts"],"names":[],"mappings":"AAGA,MAAM,OAAgB,OAAO;IACnB,OAAO,CAAU;IAE1B,YAAY,OAAgB;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;CAGD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Content } from "#src/content/Content.js";
|
|
2
|
+
import type { Operation } from "#src/operation/Operation.js";
|
|
3
|
+
import { Patcher } from "#src/patch/Patcher.js";
|
|
4
|
+
export declare class Patcher_Text extends Patcher {
|
|
5
|
+
apply(operations: readonly Operation[]): Content;
|
|
6
|
+
private normalizeNewlines;
|
|
7
|
+
private detectNewline;
|
|
8
|
+
private buildLineStarts;
|
|
9
|
+
private createEdit;
|
|
10
|
+
private rangesOverlap;
|
|
11
|
+
private validateConflicts;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=Patcher_Text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Patcher_Text.d.ts","sourceRoot":"","sources":["../../src/patch/Patcher_Text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAIvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAI7D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,qBAAa,YAAa,SAAQ,OAAO;IACxC,KAAK,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,OAAO,CAoB/C;IAED,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,UAAU;IAiDlB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,iBAAiB;CA8BzB"}
|