clanka 0.2.18 → 0.2.19
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/ScriptPreprocessing.d.ts.map +1 -1
- package/dist/ScriptPreprocessing.js +128 -9
- package/dist/ScriptPreprocessing.js.map +1 -1
- package/dist/ScriptPreprocessing.test.js +4 -0
- package/dist/ScriptPreprocessing.test.js.map +1 -1
- package/package.json +1 -1
- package/src/ScriptPreprocessing.test.ts +4 -0
- package/src/ScriptPreprocessing.ts +161 -9
- package/src/fixtures/patch10-broken.txt +95 -0
- package/src/fixtures/patch10-fixed.txt +95 -0
- package/src/fixtures/patch11-broken.txt +219 -0
- package/src/fixtures/patch11-fixed.txt +219 -0
- package/src/fixtures/patch8-broken.txt +30 -0
- package/src/fixtures/patch8-fixed.txt +30 -0
- package/src/fixtures/patch9-broken.txt +10 -0
- package/src/fixtures/patch9-fixed.txt +10 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScriptPreprocessing.d.ts","sourceRoot":"","sources":["../src/ScriptPreprocessing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ScriptPreprocessing.d.ts","sourceRoot":"","sources":["../src/ScriptPreprocessing.ts"],"names":[],"mappings":"AA0oBA,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,MAM/C,CAAA"}
|
|
@@ -31,6 +31,99 @@ const parseIdentifier = (text, start) => {
|
|
|
31
31
|
end,
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
+
const findPreviousNonWhitespace = (text, from) => {
|
|
35
|
+
let i = from;
|
|
36
|
+
while (i >= 0 && /\s/.test(text[i])) {
|
|
37
|
+
i--;
|
|
38
|
+
}
|
|
39
|
+
return i;
|
|
40
|
+
};
|
|
41
|
+
const findNextNonWhitespace = (text, from) => {
|
|
42
|
+
let i = from;
|
|
43
|
+
while (i < text.length && /\s/.test(text[i])) {
|
|
44
|
+
i++;
|
|
45
|
+
}
|
|
46
|
+
return i;
|
|
47
|
+
};
|
|
48
|
+
const findObjectValueTerminator = (text, start) => {
|
|
49
|
+
let parenDepth = 0;
|
|
50
|
+
let bracketDepth = 0;
|
|
51
|
+
let braceDepth = 0;
|
|
52
|
+
let stringDelimiter;
|
|
53
|
+
for (let i = start; i < text.length; i++) {
|
|
54
|
+
const char = text[i];
|
|
55
|
+
if (stringDelimiter !== undefined) {
|
|
56
|
+
if (char === stringDelimiter && !isEscaped(text, i)) {
|
|
57
|
+
stringDelimiter = undefined;
|
|
58
|
+
}
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (char === '"' || char === "'" || char === "`") {
|
|
62
|
+
stringDelimiter = char;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (char === "(") {
|
|
66
|
+
parenDepth++;
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
if (char === ")") {
|
|
70
|
+
if (parenDepth > 0) {
|
|
71
|
+
parenDepth--;
|
|
72
|
+
}
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (char === "[") {
|
|
76
|
+
bracketDepth++;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (char === "]") {
|
|
80
|
+
if (bracketDepth > 0) {
|
|
81
|
+
bracketDepth--;
|
|
82
|
+
}
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (char === "{") {
|
|
86
|
+
braceDepth++;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
if (char === "}") {
|
|
90
|
+
if (parenDepth === 0 && bracketDepth === 0 && braceDepth === 0) {
|
|
91
|
+
return i;
|
|
92
|
+
}
|
|
93
|
+
if (braceDepth > 0) {
|
|
94
|
+
braceDepth--;
|
|
95
|
+
}
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (char === "," &&
|
|
99
|
+
parenDepth === 0 &&
|
|
100
|
+
bracketDepth === 0 &&
|
|
101
|
+
braceDepth === 0) {
|
|
102
|
+
return i;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return -1;
|
|
106
|
+
};
|
|
107
|
+
const collectExpressionIdentifiers = (text, start, end) => {
|
|
108
|
+
const out = new Set();
|
|
109
|
+
let cursor = start;
|
|
110
|
+
while (cursor < end) {
|
|
111
|
+
const identifier = parseIdentifier(text, cursor);
|
|
112
|
+
if (identifier === undefined) {
|
|
113
|
+
cursor++;
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
const previousNonWhitespace = findPreviousNonWhitespace(text, cursor - 1);
|
|
117
|
+
const nextNonWhitespace = findNextNonWhitespace(text, identifier.end);
|
|
118
|
+
if (text[previousNonWhitespace] !== "." &&
|
|
119
|
+
text[nextNonWhitespace] !== "." &&
|
|
120
|
+
text[nextNonWhitespace] !== "(") {
|
|
121
|
+
out.add(identifier.name);
|
|
122
|
+
}
|
|
123
|
+
cursor = identifier.end;
|
|
124
|
+
}
|
|
125
|
+
return out;
|
|
126
|
+
};
|
|
34
127
|
const isEscaped = (text, index) => {
|
|
35
128
|
let slashCount = 0;
|
|
36
129
|
let i = index - 1;
|
|
@@ -53,12 +146,33 @@ const needsTemplateEscaping = (text) => {
|
|
|
53
146
|
return false;
|
|
54
147
|
};
|
|
55
148
|
const normalizePatchEscapedQuotes = (text) => text.includes("*** Begin Patch")
|
|
56
|
-
? text.replace(/\\"([A-Za-z0-9_$.-]+)\\"/g,
|
|
149
|
+
? text.replace(/\\"([A-Za-z0-9_$.-]+)\\"/g, (match, content, index) => {
|
|
150
|
+
const previous = text[findPreviousNonWhitespace(text, index - 1)];
|
|
151
|
+
const next = text[findNextNonWhitespace(text, index + match.length)];
|
|
152
|
+
if (previous === "{" ||
|
|
153
|
+
previous === "[" ||
|
|
154
|
+
previous === ":" ||
|
|
155
|
+
previous === "," ||
|
|
156
|
+
next === ":" ||
|
|
157
|
+
next === "}" ||
|
|
158
|
+
next === "]" ||
|
|
159
|
+
next === ",") {
|
|
160
|
+
return match;
|
|
161
|
+
}
|
|
162
|
+
return `"${content}"`;
|
|
163
|
+
})
|
|
57
164
|
: text;
|
|
165
|
+
const normalizeNonPatchEscapedTemplateMarkers = (text) => text
|
|
166
|
+
.replace(/\\{2,}(?=`|\$\{)/g, "\\")
|
|
167
|
+
.replace(/(^|\s)\\+(?=\.[A-Za-z0-9_-]+\/)/g, "$1");
|
|
58
168
|
const escapeTemplateLiteralContent = (text) => {
|
|
59
|
-
const
|
|
60
|
-
const isPatchContent =
|
|
61
|
-
|
|
169
|
+
const normalizedPatchQuotes = normalizePatchEscapedQuotes(text);
|
|
170
|
+
const isPatchContent = normalizedPatchQuotes.includes("*** Begin Patch");
|
|
171
|
+
const normalized = isPatchContent
|
|
172
|
+
? normalizedPatchQuotes
|
|
173
|
+
: normalizeNonPatchEscapedTemplateMarkers(normalizedPatchQuotes);
|
|
174
|
+
if (!needsTemplateEscaping(normalized) &&
|
|
175
|
+
!(isPatchContent && normalized.includes("\\"))) {
|
|
62
176
|
return normalized;
|
|
63
177
|
}
|
|
64
178
|
let out = "";
|
|
@@ -94,6 +208,10 @@ const findTemplateEnd = (text, start, isTerminator) => {
|
|
|
94
208
|
if (text[i] !== "`" || isEscaped(text, i)) {
|
|
95
209
|
continue;
|
|
96
210
|
}
|
|
211
|
+
if (isTerminator(text[i + 1])) {
|
|
212
|
+
end = i;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
97
215
|
const next = skipWhitespace(text, i + 1);
|
|
98
216
|
if (isTerminator(text[next])) {
|
|
99
217
|
end = i;
|
|
@@ -270,11 +388,10 @@ const collectCallObjectPropertyIdentifiers = (script, functionName, propertyName
|
|
|
270
388
|
const afterProperty = skipWhitespace(script, propertyKey + propertyName.length);
|
|
271
389
|
if (script[afterProperty] === ":") {
|
|
272
390
|
const valueStart = skipWhitespace(script, afterProperty + 1);
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
out.add(identifier.name);
|
|
391
|
+
const valueEnd = findObjectValueTerminator(script, valueStart);
|
|
392
|
+
if (valueEnd !== -1) {
|
|
393
|
+
for (const identifier of collectExpressionIdentifiers(script, valueStart, valueEnd)) {
|
|
394
|
+
out.add(identifier);
|
|
278
395
|
}
|
|
279
396
|
}
|
|
280
397
|
cursor = valueStart + 1;
|
|
@@ -322,6 +439,8 @@ const fixAssignedTemplate = (script, variableName) => {
|
|
|
322
439
|
continue;
|
|
323
440
|
}
|
|
324
441
|
const templateEnd = findTemplateEnd(out, templateStart, (char) => char === undefined ||
|
|
442
|
+
char === "\n" ||
|
|
443
|
+
char === "\r" ||
|
|
325
444
|
char === ";" ||
|
|
326
445
|
char === "," ||
|
|
327
446
|
char === ")" ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScriptPreprocessing.js","sourceRoot":"","sources":["../src/ScriptPreprocessing.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,CAAC,IAAwB,EAAW,EAAE,CAC7D,IAAI,KAAK,SAAS,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAElD,MAAM,qBAAqB,GAAG,CAAC,IAAwB,EAAW,EAAE,CAClE,IAAI,KAAK,SAAS,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAE/C,MAAM,qBAAqB,GAAG,CAC5B,IAAY,EACZ,KAAa,EACb,MAAc,EACL,EAAE,CACX,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,CAAC,CAAA;AAE/E,MAAM,kBAAkB,GAAG,CACzB,IAAY,EACZ,UAAkB,EAClB,IAAY,EACJ,EAAE;IACV,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IAC1C,OAAO,KAAK,KAAK,CAAC,CAAC,EAAE,CA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IAED,IAAI,GAAG,GAAG,MAAM,CAAA;IAChB,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,GAAG,GAAG,mBAAmB,CAAC,GAAG,EAAE,UAAU,CAAC,CAAA;IAC5C,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAU,EAAE,CACzD,gCAAgC,CAC9B,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,MAAM,CACnC,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,CAAC,uBAAuB,CAAC,OAAO,EAAE,YAAY,CAAC,EACzE,oCAAoC,CAAC,MAAM,CAAC,CAC7C,CACF,CAAA"}
|
|
@@ -107,6 +107,10 @@ describe("preprocessScript", () => {
|
|
|
107
107
|
"patch5",
|
|
108
108
|
"patch6",
|
|
109
109
|
"patch7",
|
|
110
|
+
"patch8",
|
|
111
|
+
"patch9",
|
|
112
|
+
"patch10",
|
|
113
|
+
"patch11",
|
|
110
114
|
])("fixes broken %s", (fixture) => {
|
|
111
115
|
const content = readFileSync(join(__dirname, "fixtures", `${fixture}-broken.txt`), "utf-8");
|
|
112
116
|
const fixed = readFileSync(join(__dirname, "fixtures", `${fixture}-fixed.txt`), "utf-8");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScriptPreprocessing.test.js","sourceRoot":"","sources":["../src/ScriptPreprocessing.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,MAAM,IAAI,GAAG,GAAG,CAAA;AAChB,MAAM,OAAO,GAAG,KAAK,CAAA;AACrB,MA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CAAC,CAAA;IAChD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -165,6 +165,10 @@ describe("preprocessScript", () => {
|
|
|
165
165
|
"patch5",
|
|
166
166
|
"patch6",
|
|
167
167
|
"patch7",
|
|
168
|
+
"patch8",
|
|
169
|
+
"patch9",
|
|
170
|
+
"patch10",
|
|
171
|
+
"patch11",
|
|
168
172
|
])("fixes broken %s", (fixture) => {
|
|
169
173
|
const content = readFileSync(
|
|
170
174
|
join(__dirname, "fixtures", `${fixture}-broken.txt`),
|
|
@@ -51,6 +51,121 @@ const parseIdentifier = (
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
const findPreviousNonWhitespace = (text: string, from: number): number => {
|
|
55
|
+
let i = from
|
|
56
|
+
while (i >= 0 && /\s/.test(text[i]!)) {
|
|
57
|
+
i--
|
|
58
|
+
}
|
|
59
|
+
return i
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const findNextNonWhitespace = (text: string, from: number): number => {
|
|
63
|
+
let i = from
|
|
64
|
+
while (i < text.length && /\s/.test(text[i]!)) {
|
|
65
|
+
i++
|
|
66
|
+
}
|
|
67
|
+
return i
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const findObjectValueTerminator = (text: string, start: number): number => {
|
|
71
|
+
let parenDepth = 0
|
|
72
|
+
let bracketDepth = 0
|
|
73
|
+
let braceDepth = 0
|
|
74
|
+
let stringDelimiter: '"' | "'" | "`" | undefined
|
|
75
|
+
|
|
76
|
+
for (let i = start; i < text.length; i++) {
|
|
77
|
+
const char = text[i]!
|
|
78
|
+
|
|
79
|
+
if (stringDelimiter !== undefined) {
|
|
80
|
+
if (char === stringDelimiter && !isEscaped(text, i)) {
|
|
81
|
+
stringDelimiter = undefined
|
|
82
|
+
}
|
|
83
|
+
continue
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (char === '"' || char === "'" || char === "`") {
|
|
87
|
+
stringDelimiter = char
|
|
88
|
+
continue
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (char === "(") {
|
|
92
|
+
parenDepth++
|
|
93
|
+
continue
|
|
94
|
+
}
|
|
95
|
+
if (char === ")") {
|
|
96
|
+
if (parenDepth > 0) {
|
|
97
|
+
parenDepth--
|
|
98
|
+
}
|
|
99
|
+
continue
|
|
100
|
+
}
|
|
101
|
+
if (char === "[") {
|
|
102
|
+
bracketDepth++
|
|
103
|
+
continue
|
|
104
|
+
}
|
|
105
|
+
if (char === "]") {
|
|
106
|
+
if (bracketDepth > 0) {
|
|
107
|
+
bracketDepth--
|
|
108
|
+
}
|
|
109
|
+
continue
|
|
110
|
+
}
|
|
111
|
+
if (char === "{") {
|
|
112
|
+
braceDepth++
|
|
113
|
+
continue
|
|
114
|
+
}
|
|
115
|
+
if (char === "}") {
|
|
116
|
+
if (parenDepth === 0 && bracketDepth === 0 && braceDepth === 0) {
|
|
117
|
+
return i
|
|
118
|
+
}
|
|
119
|
+
if (braceDepth > 0) {
|
|
120
|
+
braceDepth--
|
|
121
|
+
}
|
|
122
|
+
continue
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (
|
|
126
|
+
char === "," &&
|
|
127
|
+
parenDepth === 0 &&
|
|
128
|
+
bracketDepth === 0 &&
|
|
129
|
+
braceDepth === 0
|
|
130
|
+
) {
|
|
131
|
+
return i
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return -1
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const collectExpressionIdentifiers = (
|
|
139
|
+
text: string,
|
|
140
|
+
start: number,
|
|
141
|
+
end: number,
|
|
142
|
+
): ReadonlySet<string> => {
|
|
143
|
+
const out = new Set<string>()
|
|
144
|
+
let cursor = start
|
|
145
|
+
|
|
146
|
+
while (cursor < end) {
|
|
147
|
+
const identifier = parseIdentifier(text, cursor)
|
|
148
|
+
if (identifier === undefined) {
|
|
149
|
+
cursor++
|
|
150
|
+
continue
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const previousNonWhitespace = findPreviousNonWhitespace(text, cursor - 1)
|
|
154
|
+
const nextNonWhitespace = findNextNonWhitespace(text, identifier.end)
|
|
155
|
+
if (
|
|
156
|
+
text[previousNonWhitespace] !== "." &&
|
|
157
|
+
text[nextNonWhitespace] !== "." &&
|
|
158
|
+
text[nextNonWhitespace] !== "("
|
|
159
|
+
) {
|
|
160
|
+
out.add(identifier.name)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
cursor = identifier.end
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return out
|
|
167
|
+
}
|
|
168
|
+
|
|
54
169
|
const isEscaped = (text: string, index: number): boolean => {
|
|
55
170
|
let slashCount = 0
|
|
56
171
|
let i = index - 1
|
|
@@ -76,13 +191,41 @@ const needsTemplateEscaping = (text: string): boolean => {
|
|
|
76
191
|
|
|
77
192
|
const normalizePatchEscapedQuotes = (text: string): string =>
|
|
78
193
|
text.includes("*** Begin Patch")
|
|
79
|
-
? text.replace(/\\"([A-Za-z0-9_$.-]+)\\"/g,
|
|
194
|
+
? text.replace(/\\"([A-Za-z0-9_$.-]+)\\"/g, (match, content, index) => {
|
|
195
|
+
const previous = text[findPreviousNonWhitespace(text, index - 1)]
|
|
196
|
+
const next = text[findNextNonWhitespace(text, index + match.length)]
|
|
197
|
+
if (
|
|
198
|
+
previous === "{" ||
|
|
199
|
+
previous === "[" ||
|
|
200
|
+
previous === ":" ||
|
|
201
|
+
previous === "," ||
|
|
202
|
+
next === ":" ||
|
|
203
|
+
next === "}" ||
|
|
204
|
+
next === "]" ||
|
|
205
|
+
next === ","
|
|
206
|
+
) {
|
|
207
|
+
return match
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return `"${content}"`
|
|
211
|
+
})
|
|
80
212
|
: text
|
|
81
213
|
|
|
214
|
+
const normalizeNonPatchEscapedTemplateMarkers = (text: string): string =>
|
|
215
|
+
text
|
|
216
|
+
.replace(/\\{2,}(?=`|\$\{)/g, "\\")
|
|
217
|
+
.replace(/(^|\s)\\+(?=\.[A-Za-z0-9_-]+\/)/g, "$1")
|
|
218
|
+
|
|
82
219
|
const escapeTemplateLiteralContent = (text: string): string => {
|
|
83
|
-
const
|
|
84
|
-
const isPatchContent =
|
|
85
|
-
|
|
220
|
+
const normalizedPatchQuotes = normalizePatchEscapedQuotes(text)
|
|
221
|
+
const isPatchContent = normalizedPatchQuotes.includes("*** Begin Patch")
|
|
222
|
+
const normalized = isPatchContent
|
|
223
|
+
? normalizedPatchQuotes
|
|
224
|
+
: normalizeNonPatchEscapedTemplateMarkers(normalizedPatchQuotes)
|
|
225
|
+
if (
|
|
226
|
+
!needsTemplateEscaping(normalized) &&
|
|
227
|
+
!(isPatchContent && normalized.includes("\\"))
|
|
228
|
+
) {
|
|
86
229
|
return normalized
|
|
87
230
|
}
|
|
88
231
|
|
|
@@ -128,6 +271,10 @@ const findTemplateEnd = (
|
|
|
128
271
|
if (text[i] !== "`" || isEscaped(text, i)) {
|
|
129
272
|
continue
|
|
130
273
|
}
|
|
274
|
+
if (isTerminator(text[i + 1])) {
|
|
275
|
+
end = i
|
|
276
|
+
continue
|
|
277
|
+
}
|
|
131
278
|
const next = skipWhitespace(text, i + 1)
|
|
132
279
|
if (isTerminator(text[next])) {
|
|
133
280
|
end = i
|
|
@@ -364,11 +511,14 @@ const collectCallObjectPropertyIdentifiers = (
|
|
|
364
511
|
)
|
|
365
512
|
if (script[afterProperty] === ":") {
|
|
366
513
|
const valueStart = skipWhitespace(script, afterProperty + 1)
|
|
367
|
-
const
|
|
368
|
-
if (
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
|
|
514
|
+
const valueEnd = findObjectValueTerminator(script, valueStart)
|
|
515
|
+
if (valueEnd !== -1) {
|
|
516
|
+
for (const identifier of collectExpressionIdentifiers(
|
|
517
|
+
script,
|
|
518
|
+
valueStart,
|
|
519
|
+
valueEnd,
|
|
520
|
+
)) {
|
|
521
|
+
out.add(identifier)
|
|
372
522
|
}
|
|
373
523
|
}
|
|
374
524
|
cursor = valueStart + 1
|
|
@@ -441,6 +591,8 @@ const fixAssignedTemplate = (script: string, variableName: string): string => {
|
|
|
441
591
|
templateStart,
|
|
442
592
|
(char) =>
|
|
443
593
|
char === undefined ||
|
|
594
|
+
char === "\n" ||
|
|
595
|
+
char === "\r" ||
|
|
444
596
|
char === ";" ||
|
|
445
597
|
char === "," ||
|
|
446
598
|
char === ")" ||
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const patch = `*** Begin Patch
|
|
2
|
+
*** Update File: packages/ai/openai/test/OpenAiLanguageModel.test.ts
|
|
3
|
+
@@
|
|
4
|
+
describe("streamText", () => {
|
|
5
|
+
it.effect("emits valid apply_patch tool params JSON for update_file diffs", () =>
|
|
6
|
+
Effect.gen(function*() {
|
|
7
|
+
@@
|
|
8
|
+
deepStrictEqual(params, {
|
|
9
|
+
call_id: outputItem.call_id,
|
|
10
|
+
operation: {
|
|
11
|
+
type: "update_file",
|
|
12
|
+
path: "src/example.ts",
|
|
13
|
+
diff
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
}))
|
|
17
|
+
+
|
|
18
|
+
+ it.effect("emits tool call from function_call_arguments.done when output_item.done is missing", () =>
|
|
19
|
+
+ Effect.gen(function*() {
|
|
20
|
+
+ const streamEvents = [
|
|
21
|
+
+ {
|
|
22
|
+
+ type: "response.created",
|
|
23
|
+
+ sequence_number: 1,
|
|
24
|
+
+ response: makeDefaultResponse({
|
|
25
|
+
+ id: "resp_function_call_done",
|
|
26
|
+
+ status: "in_progress",
|
|
27
|
+
+ output: []
|
|
28
|
+
+ })
|
|
29
|
+
+ },
|
|
30
|
+
+ {
|
|
31
|
+
+ type: "response.output_item.added",
|
|
32
|
+
+ sequence_number: 2,
|
|
33
|
+
+ output_index: 0,
|
|
34
|
+
+ item: {
|
|
35
|
+
+ type: "function_call",
|
|
36
|
+
+ id: "fc_1",
|
|
37
|
+
+ call_id: "call_1",
|
|
38
|
+
+ name: "TestTool",
|
|
39
|
+
+ arguments: "",
|
|
40
|
+
+ status: "in_progress"
|
|
41
|
+
+ }
|
|
42
|
+
+ },
|
|
43
|
+
+ {
|
|
44
|
+
+ type: "response.function_call_arguments.delta",
|
|
45
|
+
+ sequence_number: 3,
|
|
46
|
+
+ output_index: 0,
|
|
47
|
+
+ item_id: "fc_1",
|
|
48
|
+
+ delta: "{\"input\":\"hel"
|
|
49
|
+
+ },
|
|
50
|
+
+ {
|
|
51
|
+
+ type: "response.function_call_arguments.done",
|
|
52
|
+
+ sequence_number: 4,
|
|
53
|
+
+ output_index: 0,
|
|
54
|
+
+ item_id: "fc_1",
|
|
55
|
+
+ name: "TestTool",
|
|
56
|
+
+ arguments: "{\"input\":\"hello\"}"
|
|
57
|
+
+ },
|
|
58
|
+
+ {
|
|
59
|
+
+ type: "response.completed",
|
|
60
|
+
+ sequence_number: 5,
|
|
61
|
+
+ response: makeDefaultResponse({
|
|
62
|
+
+ id: "resp_function_call_done",
|
|
63
|
+
+ status: "completed",
|
|
64
|
+
+ output: []
|
|
65
|
+
+ })
|
|
66
|
+
+ }
|
|
67
|
+
+ ] as unknown as ReadonlyArray<typeof Generated.ResponseStreamEvent.Type>
|
|
68
|
+
+
|
|
69
|
+
+ const partsChunk = yield* LanguageModel.streamText({
|
|
70
|
+
+ prompt: "Use the test tool",
|
|
71
|
+
+ toolkit: TestToolkit,
|
|
72
|
+
+ disableToolCallResolution: true
|
|
73
|
+
+ }).pipe(
|
|
74
|
+
+ Stream.runCollect,
|
|
75
|
+
+ Effect.provide(OpenAiLanguageModel.model("gpt-4o-mini")),
|
|
76
|
+
+ Effect.provide(makeStreamTestLayer(streamEvents)),
|
|
77
|
+
+ Effect.provide(TestToolkitLayer)
|
|
78
|
+
+ )
|
|
79
|
+
+
|
|
80
|
+
+ const parts = globalThis.Array.from(partsChunk)
|
|
81
|
+
+ const toolCalls = parts.filter((part) => part.type === "tool-call" && part.id === "call_1")
|
|
82
|
+
+ strictEqual(toolCalls.length, 1)
|
|
83
|
+
+ const toolCall = toolCalls[0]
|
|
84
|
+
+ assert.isDefined(toolCall)
|
|
85
|
+
+ if (toolCall?.type === "tool-call") {
|
|
86
|
+
+ strictEqual(toolCall.name, "TestTool")
|
|
87
|
+
+ deepStrictEqual(toolCall.params, { input: "hello" })
|
|
88
|
+
+ }
|
|
89
|
+
+
|
|
90
|
+
+ const toolParamsEnd = parts.find((part) => part.type === "tool-params-end" && part.id === "call_1")
|
|
91
|
+
+ assert.isDefined(toolParamsEnd)
|
|
92
|
+
+ }))
|
|
93
|
+
})
|
|
94
|
+
*** End Patch`;
|
|
95
|
+
console.log(await applyPatch(patch));
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
const patch = `*** Begin Patch
|
|
2
|
+
*** Update File: packages/ai/openai/test/OpenAiLanguageModel.test.ts
|
|
3
|
+
@@
|
|
4
|
+
describe("streamText", () => {
|
|
5
|
+
it.effect("emits valid apply_patch tool params JSON for update_file diffs", () =>
|
|
6
|
+
Effect.gen(function*() {
|
|
7
|
+
@@
|
|
8
|
+
deepStrictEqual(params, {
|
|
9
|
+
call_id: outputItem.call_id,
|
|
10
|
+
operation: {
|
|
11
|
+
type: "update_file",
|
|
12
|
+
path: "src/example.ts",
|
|
13
|
+
diff
|
|
14
|
+
}
|
|
15
|
+
})
|
|
16
|
+
}))
|
|
17
|
+
+
|
|
18
|
+
+ it.effect("emits tool call from function_call_arguments.done when output_item.done is missing", () =>
|
|
19
|
+
+ Effect.gen(function*() {
|
|
20
|
+
+ const streamEvents = [
|
|
21
|
+
+ {
|
|
22
|
+
+ type: "response.created",
|
|
23
|
+
+ sequence_number: 1,
|
|
24
|
+
+ response: makeDefaultResponse({
|
|
25
|
+
+ id: "resp_function_call_done",
|
|
26
|
+
+ status: "in_progress",
|
|
27
|
+
+ output: []
|
|
28
|
+
+ })
|
|
29
|
+
+ },
|
|
30
|
+
+ {
|
|
31
|
+
+ type: "response.output_item.added",
|
|
32
|
+
+ sequence_number: 2,
|
|
33
|
+
+ output_index: 0,
|
|
34
|
+
+ item: {
|
|
35
|
+
+ type: "function_call",
|
|
36
|
+
+ id: "fc_1",
|
|
37
|
+
+ call_id: "call_1",
|
|
38
|
+
+ name: "TestTool",
|
|
39
|
+
+ arguments: "",
|
|
40
|
+
+ status: "in_progress"
|
|
41
|
+
+ }
|
|
42
|
+
+ },
|
|
43
|
+
+ {
|
|
44
|
+
+ type: "response.function_call_arguments.delta",
|
|
45
|
+
+ sequence_number: 3,
|
|
46
|
+
+ output_index: 0,
|
|
47
|
+
+ item_id: "fc_1",
|
|
48
|
+
+ delta: "{\\"input\\":\\"hel"
|
|
49
|
+
+ },
|
|
50
|
+
+ {
|
|
51
|
+
+ type: "response.function_call_arguments.done",
|
|
52
|
+
+ sequence_number: 4,
|
|
53
|
+
+ output_index: 0,
|
|
54
|
+
+ item_id: "fc_1",
|
|
55
|
+
+ name: "TestTool",
|
|
56
|
+
+ arguments: "{\\"input\\":\\"hello\\"}"
|
|
57
|
+
+ },
|
|
58
|
+
+ {
|
|
59
|
+
+ type: "response.completed",
|
|
60
|
+
+ sequence_number: 5,
|
|
61
|
+
+ response: makeDefaultResponse({
|
|
62
|
+
+ id: "resp_function_call_done",
|
|
63
|
+
+ status: "completed",
|
|
64
|
+
+ output: []
|
|
65
|
+
+ })
|
|
66
|
+
+ }
|
|
67
|
+
+ ] as unknown as ReadonlyArray<typeof Generated.ResponseStreamEvent.Type>
|
|
68
|
+
+
|
|
69
|
+
+ const partsChunk = yield* LanguageModel.streamText({
|
|
70
|
+
+ prompt: "Use the test tool",
|
|
71
|
+
+ toolkit: TestToolkit,
|
|
72
|
+
+ disableToolCallResolution: true
|
|
73
|
+
+ }).pipe(
|
|
74
|
+
+ Stream.runCollect,
|
|
75
|
+
+ Effect.provide(OpenAiLanguageModel.model("gpt-4o-mini")),
|
|
76
|
+
+ Effect.provide(makeStreamTestLayer(streamEvents)),
|
|
77
|
+
+ Effect.provide(TestToolkitLayer)
|
|
78
|
+
+ )
|
|
79
|
+
+
|
|
80
|
+
+ const parts = globalThis.Array.from(partsChunk)
|
|
81
|
+
+ const toolCalls = parts.filter((part) => part.type === "tool-call" && part.id === "call_1")
|
|
82
|
+
+ strictEqual(toolCalls.length, 1)
|
|
83
|
+
+ const toolCall = toolCalls[0]
|
|
84
|
+
+ assert.isDefined(toolCall)
|
|
85
|
+
+ if (toolCall?.type === "tool-call") {
|
|
86
|
+
+ strictEqual(toolCall.name, "TestTool")
|
|
87
|
+
+ deepStrictEqual(toolCall.params, { input: "hello" })
|
|
88
|
+
+ }
|
|
89
|
+
+
|
|
90
|
+
+ const toolParamsEnd = parts.find((part) => part.type === "tool-params-end" && part.id === "call_1")
|
|
91
|
+
+ assert.isDefined(toolParamsEnd)
|
|
92
|
+
+ }))
|
|
93
|
+
})
|
|
94
|
+
*** End Patch`;
|
|
95
|
+
console.log(await applyPatch(patch));
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
const patch = `*** Begin Patch
|
|
2
|
+
*** Update File: packages/effect/src/Cron.ts
|
|
3
|
+
@@
|
|
4
|
+
export const next = (cron: Cron, now?: DateTime.DateTime.Input): Date => {
|
|
5
|
+
+ return stepCron(cron, now, "next")
|
|
6
|
+
+}
|
|
7
|
+
+
|
|
8
|
+
+/**
|
|
9
|
+
+ * Returns the previous scheduled date/time for the given Cron instance.
|
|
10
|
+
+ *
|
|
11
|
+
+ * This function calculates the most recent date and time when the cron
|
|
12
|
+
+ * schedule should have triggered, before the specified date (or current
|
|
13
|
+
+ * time if not provided).
|
|
14
|
+
+ *
|
|
15
|
+
+ * @example
|
|
16
|
+
+ * ```ts
|
|
17
|
+
+ * import { Cron, Result } from "effect"
|
|
18
|
+
+ *
|
|
19
|
+
+ * const cron = Result.getOrThrow(Cron.parse("0 0 4 8-14 * *"))
|
|
20
|
+
+ *
|
|
21
|
+
+ * // Get previous run before a specific date
|
|
22
|
+
+ * const before = new Date("2021-01-15T00:00:00Z")
|
|
23
|
+
+ * const previousRun = Cron.prev(cron, before)
|
|
24
|
+
+ * console.log(previousRun) // 2021-01-14T04:00:00.000Z
|
|
25
|
+
+ *
|
|
26
|
+
+ * // Get previous run from current time
|
|
27
|
+
+ * const previousFromNow = Cron.prev(cron)
|
|
28
|
+
+ * console.log(previousFromNow) // Previous occurrence from now
|
|
29
|
+
+ * ```
|
|
30
|
+
+ *
|
|
31
|
+
+ * @since 4.0.0
|
|
32
|
+
+ * @category utils
|
|
33
|
+
+ */
|
|
34
|
+
+export const prev = (cron: Cron, now?: DateTime.DateTime.Input): Date => {
|
|
35
|
+
+ return stepCron(cron, now, "prev")
|
|
36
|
+
+}
|
|
37
|
+
+
|
|
38
|
+
+const stepCron = (cron: Cron, now: DateTime.DateTime.Input | undefined, direction: "next" | "prev"): Date => {
|
|
39
|
+
const tz = Option.getOrUndefined(cron.tz)
|
|
40
|
+
const zoned = dateTime.makeZonedUnsafe(now ?? new Date(), {
|
|
41
|
+
timeZone: tz
|
|
42
|
+
})
|
|
43
|
+
+
|
|
44
|
+
+ const reverse = direction === "prev"
|
|
45
|
+
+ const tick = reverse ? -1 : 1
|
|
46
|
+
+ const table = cron[direction]
|
|
47
|
+
+ const boundary = reverse ? cron.last : cron.first
|
|
48
|
+
+
|
|
49
|
+
+ const needsStep = reverse ?
|
|
50
|
+
+ (next: number, current: number) => next < current :
|
|
51
|
+
+ (next: number, current: number) => next > current
|
|
52
|
+
|
|
53
|
+
const utc = tz !== undefined && dateTime.isTimeZoneNamed(tz) && tz.id === "UTC"
|
|
54
|
+
const adjustDst = utc ? constVoid : (current: Date) => {
|
|
55
|
+
const adjusted = dateTime.makeZonedUnsafe(current, {
|
|
56
|
+
timeZone: zoned.zone,
|
|
57
|
+
- adjustForTimeZone: true
|
|
58
|
+
+ adjustForTimeZone: true,
|
|
59
|
+
+ disambiguation: reverse ? "later" : undefined
|
|
60
|
+
}).pipe(dateTime.toDate)
|
|
61
|
+
|
|
62
|
+
- // TODO: This implementation currently only skips forward when transitioning into daylight savings time.
|
|
63
|
+
const drift = current.getTime() - adjusted.getTime()
|
|
64
|
+
- if (drift > 0) {
|
|
65
|
+
- current.setTime(current.getTime() + drift)
|
|
66
|
+
+ if (reverse ? drift !== 0 : drift > 0) {
|
|
67
|
+
+ current.setTime(adjusted.getTime())
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const result = dateTime.mutate(zoned, (current) => {
|
|
72
|
+
- current.setUTCSeconds(current.getUTCSeconds() + 1, 0)
|
|
73
|
+
+ current.setUTCSeconds(current.getUTCSeconds() + tick, 0)
|
|
74
|
+
|
|
75
|
+
for (let i = 0; i < 10_000; i++) {
|
|
76
|
+
if (cron.seconds.size !== 0) {
|
|
77
|
+
const currentSecond = current.getUTCSeconds()
|
|
78
|
+
- const nextSecond = cron.next.second[currentSecond]
|
|
79
|
+
+ const nextSecond = table.second[currentSecond]
|
|
80
|
+
if (nextSecond === undefined) {
|
|
81
|
+
- current.setUTCMinutes(current.getUTCMinutes() + 1, cron.first.second)
|
|
82
|
+
+ current.setUTCMinutes(current.getUTCMinutes() + tick, boundary.second)
|
|
83
|
+
adjustDst(current)
|
|
84
|
+
continue
|
|
85
|
+
}
|
|
86
|
+
- if (nextSecond > currentSecond) {
|
|
87
|
+
+ if (needsStep(nextSecond, currentSecond)) {
|
|
88
|
+
current.setUTCSeconds(nextSecond)
|
|
89
|
+
adjustDst(current)
|
|
90
|
+
continue
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (cron.minutes.size !== 0) {
|
|
95
|
+
const currentMinute = current.getUTCMinutes()
|
|
96
|
+
- const nextMinute = cron.next.minute[currentMinute]
|
|
97
|
+
+ const nextMinute = table.minute[currentMinute]
|
|
98
|
+
if (nextMinute === undefined) {
|
|
99
|
+
- current.setUTCHours(current.getUTCHours() + 1, cron.first.minute, cron.first.second)
|
|
100
|
+
+ current.setUTCHours(current.getUTCHours() + tick, boundary.minute, boundary.second)
|
|
101
|
+
adjustDst(current)
|
|
102
|
+
continue
|
|
103
|
+
}
|
|
104
|
+
- if (nextMinute > currentMinute) {
|
|
105
|
+
- current.setUTCMinutes(nextMinute, cron.first.second)
|
|
106
|
+
+ if (needsStep(nextMinute, currentMinute)) {
|
|
107
|
+
+ current.setUTCMinutes(nextMinute, boundary.second)
|
|
108
|
+
adjustDst(current)
|
|
109
|
+
continue
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (cron.hours.size !== 0) {
|
|
114
|
+
const currentHour = current.getUTCHours()
|
|
115
|
+
- const nextHour = cron.next.hour[currentHour]
|
|
116
|
+
+ const nextHour = table.hour[currentHour]
|
|
117
|
+
if (nextHour === undefined) {
|
|
118
|
+
- current.setUTCDate(current.getUTCDate() + 1)
|
|
119
|
+
- current.setUTCHours(cron.first.hour, cron.first.minute, cron.first.second)
|
|
120
|
+
+ current.setUTCDate(current.getUTCDate() + tick)
|
|
121
|
+
+ current.setUTCHours(boundary.hour, boundary.minute, boundary.second)
|
|
122
|
+
adjustDst(current)
|
|
123
|
+
continue
|
|
124
|
+
}
|
|
125
|
+
- if (nextHour > currentHour) {
|
|
126
|
+
- current.setUTCHours(nextHour, cron.first.minute, cron.first.second)
|
|
127
|
+
+ if (needsStep(nextHour, currentHour)) {
|
|
128
|
+
+ current.setUTCHours(nextHour, boundary.minute, boundary.second)
|
|
129
|
+
adjustDst(current)
|
|
130
|
+
continue
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (cron.weekdays.size !== 0 || cron.days.size !== 0) {
|
|
135
|
+
- let a: number = Infinity
|
|
136
|
+
- let b: number = Infinity
|
|
137
|
+
+ let a: number = reverse ? -Infinity : Infinity
|
|
138
|
+
+ let b: number = reverse ? -Infinity : Infinity
|
|
139
|
+
|
|
140
|
+
if (cron.weekdays.size !== 0) {
|
|
141
|
+
const currentWeekday = current.getUTCDay()
|
|
142
|
+
- const nextWeekday = cron.next.weekday[currentWeekday]
|
|
143
|
+
- a = nextWeekday === undefined ? 7 - currentWeekday + cron.first.weekday : nextWeekday - currentWeekday
|
|
144
|
+
+ const nextWeekday = table.weekday[currentWeekday]
|
|
145
|
+
+ if (nextWeekday === undefined) {
|
|
146
|
+
+ a = reverse ?
|
|
147
|
+
+ currentWeekday - 7 + boundary.weekday :
|
|
148
|
+
+ 7 - currentWeekday + boundary.weekday
|
|
149
|
+
+ } else {
|
|
150
|
+
+ a = nextWeekday - currentWeekday
|
|
151
|
+
+ }
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (cron.days.size !== 0 && a !== 0) {
|
|
155
|
+
const currentDay = current.getUTCDate()
|
|
156
|
+
- const nextDay = cron.next.day[currentDay]
|
|
157
|
+
- b = nextDay === undefined ? daysInMonth(current) - currentDay + cron.first.day : nextDay - currentDay
|
|
158
|
+
+ const nextDay = table.day[currentDay]
|
|
159
|
+
+ if (nextDay === undefined) {
|
|
160
|
+
+ if (reverse) {
|
|
161
|
+
+ const prevMonthDays = daysInMonth(new Date(Date.UTC(current.getUTCFullYear(), current.getUTCMonth(), 0)))
|
|
162
|
+
+ b = -(currentDay + (prevMonthDays - boundary.day))
|
|
163
|
+
+ } else {
|
|
164
|
+
+ b = daysInMonth(current) - currentDay + boundary.day
|
|
165
|
+
+ }
|
|
166
|
+
+ } else {
|
|
167
|
+
+ b = nextDay - currentDay
|
|
168
|
+
+ }
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
- const addDays = Math.min(a, b)
|
|
172
|
+
+ const addDays = reverse ? Math.max(a, b) : Math.min(a, b)
|
|
173
|
+
if (addDays !== 0) {
|
|
174
|
+
current.setUTCDate(current.getUTCDate() + addDays)
|
|
175
|
+
- current.setUTCHours(cron.first.hour, cron.first.minute, cron.first.second)
|
|
176
|
+
+ current.setUTCHours(boundary.hour, boundary.minute, boundary.second)
|
|
177
|
+
adjustDst(current)
|
|
178
|
+
continue
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (cron.months.size !== 0) {
|
|
183
|
+
const currentMonth = current.getUTCMonth() + 1
|
|
184
|
+
- const nextMonth = cron.next.month[currentMonth]
|
|
185
|
+
+ const nextMonth = table.month[currentMonth]
|
|
186
|
+
+ const clampBoundaryDay = (targetMonthIndex: number): number => {
|
|
187
|
+
+ if (cron.days.size !== 0) {
|
|
188
|
+
+ return boundary.day
|
|
189
|
+
+ }
|
|
190
|
+
+ const maxDayInMonth = daysInMonth(new Date(Date.UTC(current.getUTCFullYear(), targetMonthIndex + 1, 0)))
|
|
191
|
+
+ return Math.min(boundary.day, maxDayInMonth)
|
|
192
|
+
+ }
|
|
193
|
+
if (nextMonth === undefined) {
|
|
194
|
+
- current.setUTCFullYear(current.getUTCFullYear() + 1)
|
|
195
|
+
- current.setUTCMonth(cron.first.month, cron.first.day)
|
|
196
|
+
- current.setUTCHours(cron.first.hour, cron.first.minute, cron.first.second)
|
|
197
|
+
+ current.setUTCFullYear(current.getUTCFullYear() + tick)
|
|
198
|
+
+ current.setUTCMonth(boundary.month, clampBoundaryDay(boundary.month))
|
|
199
|
+
+ current.setUTCHours(boundary.hour, boundary.minute, boundary.second)
|
|
200
|
+
adjustDst(current)
|
|
201
|
+
continue
|
|
202
|
+
}
|
|
203
|
+
- if (nextMonth > currentMonth) {
|
|
204
|
+
- current.setUTCMonth(nextMonth - 1, cron.first.day)
|
|
205
|
+
- current.setUTCHours(cron.first.hour, cron.first.minute, cron.first.second)
|
|
206
|
+
+ if (needsStep(nextMonth, currentMonth)) {
|
|
207
|
+
+ const targetMonthIndex = nextMonth - 1
|
|
208
|
+
+ current.setUTCMonth(targetMonthIndex, clampBoundaryDay(targetMonthIndex))
|
|
209
|
+
+ current.setUTCHours(boundary.hour, boundary.minute, boundary.second)
|
|
210
|
+
adjustDst(current)
|
|
211
|
+
continue
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
@@
|
|
215
|
+
- throw new Error("Unable to find next cron date")
|
|
216
|
+
+ throw new Error(`Unable to find ${direction} cron date`)
|
|
217
|
+
})
|
|
218
|
+
*** End Patch`
|
|
219
|
+
console.log(await applyPatch(patch))
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
const patch = `*** Begin Patch
|
|
2
|
+
*** Update File: packages/effect/src/Cron.ts
|
|
3
|
+
@@
|
|
4
|
+
export const next = (cron: Cron, now?: DateTime.DateTime.Input): Date => {
|
|
5
|
+
+ return stepCron(cron, now, "next")
|
|
6
|
+
+}
|
|
7
|
+
+
|
|
8
|
+
+/**
|
|
9
|
+
+ * Returns the previous scheduled date/time for the given Cron instance.
|
|
10
|
+
+ *
|
|
11
|
+
+ * This function calculates the most recent date and time when the cron
|
|
12
|
+
+ * schedule should have triggered, before the specified date (or current
|
|
13
|
+
+ * time if not provided).
|
|
14
|
+
+ *
|
|
15
|
+
+ * @example
|
|
16
|
+
+ * \`\`\`ts
|
|
17
|
+
+ * import { Cron, Result } from "effect"
|
|
18
|
+
+ *
|
|
19
|
+
+ * const cron = Result.getOrThrow(Cron.parse("0 0 4 8-14 * *"))
|
|
20
|
+
+ *
|
|
21
|
+
+ * // Get previous run before a specific date
|
|
22
|
+
+ * const before = new Date("2021-01-15T00:00:00Z")
|
|
23
|
+
+ * const previousRun = Cron.prev(cron, before)
|
|
24
|
+
+ * console.log(previousRun) // 2021-01-14T04:00:00.000Z
|
|
25
|
+
+ *
|
|
26
|
+
+ * // Get previous run from current time
|
|
27
|
+
+ * const previousFromNow = Cron.prev(cron)
|
|
28
|
+
+ * console.log(previousFromNow) // Previous occurrence from now
|
|
29
|
+
+ * \`\`\`
|
|
30
|
+
+ *
|
|
31
|
+
+ * @since 4.0.0
|
|
32
|
+
+ * @category utils
|
|
33
|
+
+ */
|
|
34
|
+
+export const prev = (cron: Cron, now?: DateTime.DateTime.Input): Date => {
|
|
35
|
+
+ return stepCron(cron, now, "prev")
|
|
36
|
+
+}
|
|
37
|
+
+
|
|
38
|
+
+const stepCron = (cron: Cron, now: DateTime.DateTime.Input | undefined, direction: "next" | "prev"): Date => {
|
|
39
|
+
const tz = Option.getOrUndefined(cron.tz)
|
|
40
|
+
const zoned = dateTime.makeZonedUnsafe(now ?? new Date(), {
|
|
41
|
+
timeZone: tz
|
|
42
|
+
})
|
|
43
|
+
+
|
|
44
|
+
+ const reverse = direction === "prev"
|
|
45
|
+
+ const tick = reverse ? -1 : 1
|
|
46
|
+
+ const table = cron[direction]
|
|
47
|
+
+ const boundary = reverse ? cron.last : cron.first
|
|
48
|
+
+
|
|
49
|
+
+ const needsStep = reverse ?
|
|
50
|
+
+ (next: number, current: number) => next < current :
|
|
51
|
+
+ (next: number, current: number) => next > current
|
|
52
|
+
|
|
53
|
+
const utc = tz !== undefined && dateTime.isTimeZoneNamed(tz) && tz.id === "UTC"
|
|
54
|
+
const adjustDst = utc ? constVoid : (current: Date) => {
|
|
55
|
+
const adjusted = dateTime.makeZonedUnsafe(current, {
|
|
56
|
+
timeZone: zoned.zone,
|
|
57
|
+
- adjustForTimeZone: true
|
|
58
|
+
+ adjustForTimeZone: true,
|
|
59
|
+
+ disambiguation: reverse ? "later" : undefined
|
|
60
|
+
}).pipe(dateTime.toDate)
|
|
61
|
+
|
|
62
|
+
- // TODO: This implementation currently only skips forward when transitioning into daylight savings time.
|
|
63
|
+
const drift = current.getTime() - adjusted.getTime()
|
|
64
|
+
- if (drift > 0) {
|
|
65
|
+
- current.setTime(current.getTime() + drift)
|
|
66
|
+
+ if (reverse ? drift !== 0 : drift > 0) {
|
|
67
|
+
+ current.setTime(adjusted.getTime())
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const result = dateTime.mutate(zoned, (current) => {
|
|
72
|
+
- current.setUTCSeconds(current.getUTCSeconds() + 1, 0)
|
|
73
|
+
+ current.setUTCSeconds(current.getUTCSeconds() + tick, 0)
|
|
74
|
+
|
|
75
|
+
for (let i = 0; i < 10_000; i++) {
|
|
76
|
+
if (cron.seconds.size !== 0) {
|
|
77
|
+
const currentSecond = current.getUTCSeconds()
|
|
78
|
+
- const nextSecond = cron.next.second[currentSecond]
|
|
79
|
+
+ const nextSecond = table.second[currentSecond]
|
|
80
|
+
if (nextSecond === undefined) {
|
|
81
|
+
- current.setUTCMinutes(current.getUTCMinutes() + 1, cron.first.second)
|
|
82
|
+
+ current.setUTCMinutes(current.getUTCMinutes() + tick, boundary.second)
|
|
83
|
+
adjustDst(current)
|
|
84
|
+
continue
|
|
85
|
+
}
|
|
86
|
+
- if (nextSecond > currentSecond) {
|
|
87
|
+
+ if (needsStep(nextSecond, currentSecond)) {
|
|
88
|
+
current.setUTCSeconds(nextSecond)
|
|
89
|
+
adjustDst(current)
|
|
90
|
+
continue
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (cron.minutes.size !== 0) {
|
|
95
|
+
const currentMinute = current.getUTCMinutes()
|
|
96
|
+
- const nextMinute = cron.next.minute[currentMinute]
|
|
97
|
+
+ const nextMinute = table.minute[currentMinute]
|
|
98
|
+
if (nextMinute === undefined) {
|
|
99
|
+
- current.setUTCHours(current.getUTCHours() + 1, cron.first.minute, cron.first.second)
|
|
100
|
+
+ current.setUTCHours(current.getUTCHours() + tick, boundary.minute, boundary.second)
|
|
101
|
+
adjustDst(current)
|
|
102
|
+
continue
|
|
103
|
+
}
|
|
104
|
+
- if (nextMinute > currentMinute) {
|
|
105
|
+
- current.setUTCMinutes(nextMinute, cron.first.second)
|
|
106
|
+
+ if (needsStep(nextMinute, currentMinute)) {
|
|
107
|
+
+ current.setUTCMinutes(nextMinute, boundary.second)
|
|
108
|
+
adjustDst(current)
|
|
109
|
+
continue
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (cron.hours.size !== 0) {
|
|
114
|
+
const currentHour = current.getUTCHours()
|
|
115
|
+
- const nextHour = cron.next.hour[currentHour]
|
|
116
|
+
+ const nextHour = table.hour[currentHour]
|
|
117
|
+
if (nextHour === undefined) {
|
|
118
|
+
- current.setUTCDate(current.getUTCDate() + 1)
|
|
119
|
+
- current.setUTCHours(cron.first.hour, cron.first.minute, cron.first.second)
|
|
120
|
+
+ current.setUTCDate(current.getUTCDate() + tick)
|
|
121
|
+
+ current.setUTCHours(boundary.hour, boundary.minute, boundary.second)
|
|
122
|
+
adjustDst(current)
|
|
123
|
+
continue
|
|
124
|
+
}
|
|
125
|
+
- if (nextHour > currentHour) {
|
|
126
|
+
- current.setUTCHours(nextHour, cron.first.minute, cron.first.second)
|
|
127
|
+
+ if (needsStep(nextHour, currentHour)) {
|
|
128
|
+
+ current.setUTCHours(nextHour, boundary.minute, boundary.second)
|
|
129
|
+
adjustDst(current)
|
|
130
|
+
continue
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (cron.weekdays.size !== 0 || cron.days.size !== 0) {
|
|
135
|
+
- let a: number = Infinity
|
|
136
|
+
- let b: number = Infinity
|
|
137
|
+
+ let a: number = reverse ? -Infinity : Infinity
|
|
138
|
+
+ let b: number = reverse ? -Infinity : Infinity
|
|
139
|
+
|
|
140
|
+
if (cron.weekdays.size !== 0) {
|
|
141
|
+
const currentWeekday = current.getUTCDay()
|
|
142
|
+
- const nextWeekday = cron.next.weekday[currentWeekday]
|
|
143
|
+
- a = nextWeekday === undefined ? 7 - currentWeekday + cron.first.weekday : nextWeekday - currentWeekday
|
|
144
|
+
+ const nextWeekday = table.weekday[currentWeekday]
|
|
145
|
+
+ if (nextWeekday === undefined) {
|
|
146
|
+
+ a = reverse ?
|
|
147
|
+
+ currentWeekday - 7 + boundary.weekday :
|
|
148
|
+
+ 7 - currentWeekday + boundary.weekday
|
|
149
|
+
+ } else {
|
|
150
|
+
+ a = nextWeekday - currentWeekday
|
|
151
|
+
+ }
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (cron.days.size !== 0 && a !== 0) {
|
|
155
|
+
const currentDay = current.getUTCDate()
|
|
156
|
+
- const nextDay = cron.next.day[currentDay]
|
|
157
|
+
- b = nextDay === undefined ? daysInMonth(current) - currentDay + cron.first.day : nextDay - currentDay
|
|
158
|
+
+ const nextDay = table.day[currentDay]
|
|
159
|
+
+ if (nextDay === undefined) {
|
|
160
|
+
+ if (reverse) {
|
|
161
|
+
+ const prevMonthDays = daysInMonth(new Date(Date.UTC(current.getUTCFullYear(), current.getUTCMonth(), 0)))
|
|
162
|
+
+ b = -(currentDay + (prevMonthDays - boundary.day))
|
|
163
|
+
+ } else {
|
|
164
|
+
+ b = daysInMonth(current) - currentDay + boundary.day
|
|
165
|
+
+ }
|
|
166
|
+
+ } else {
|
|
167
|
+
+ b = nextDay - currentDay
|
|
168
|
+
+ }
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
- const addDays = Math.min(a, b)
|
|
172
|
+
+ const addDays = reverse ? Math.max(a, b) : Math.min(a, b)
|
|
173
|
+
if (addDays !== 0) {
|
|
174
|
+
current.setUTCDate(current.getUTCDate() + addDays)
|
|
175
|
+
- current.setUTCHours(cron.first.hour, cron.first.minute, cron.first.second)
|
|
176
|
+
+ current.setUTCHours(boundary.hour, boundary.minute, boundary.second)
|
|
177
|
+
adjustDst(current)
|
|
178
|
+
continue
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (cron.months.size !== 0) {
|
|
183
|
+
const currentMonth = current.getUTCMonth() + 1
|
|
184
|
+
- const nextMonth = cron.next.month[currentMonth]
|
|
185
|
+
+ const nextMonth = table.month[currentMonth]
|
|
186
|
+
+ const clampBoundaryDay = (targetMonthIndex: number): number => {
|
|
187
|
+
+ if (cron.days.size !== 0) {
|
|
188
|
+
+ return boundary.day
|
|
189
|
+
+ }
|
|
190
|
+
+ const maxDayInMonth = daysInMonth(new Date(Date.UTC(current.getUTCFullYear(), targetMonthIndex + 1, 0)))
|
|
191
|
+
+ return Math.min(boundary.day, maxDayInMonth)
|
|
192
|
+
+ }
|
|
193
|
+
if (nextMonth === undefined) {
|
|
194
|
+
- current.setUTCFullYear(current.getUTCFullYear() + 1)
|
|
195
|
+
- current.setUTCMonth(cron.first.month, cron.first.day)
|
|
196
|
+
- current.setUTCHours(cron.first.hour, cron.first.minute, cron.first.second)
|
|
197
|
+
+ current.setUTCFullYear(current.getUTCFullYear() + tick)
|
|
198
|
+
+ current.setUTCMonth(boundary.month, clampBoundaryDay(boundary.month))
|
|
199
|
+
+ current.setUTCHours(boundary.hour, boundary.minute, boundary.second)
|
|
200
|
+
adjustDst(current)
|
|
201
|
+
continue
|
|
202
|
+
}
|
|
203
|
+
- if (nextMonth > currentMonth) {
|
|
204
|
+
- current.setUTCMonth(nextMonth - 1, cron.first.day)
|
|
205
|
+
- current.setUTCHours(cron.first.hour, cron.first.minute, cron.first.second)
|
|
206
|
+
+ if (needsStep(nextMonth, currentMonth)) {
|
|
207
|
+
+ const targetMonthIndex = nextMonth - 1
|
|
208
|
+
+ current.setUTCMonth(targetMonthIndex, clampBoundaryDay(targetMonthIndex))
|
|
209
|
+
+ current.setUTCHours(boundary.hour, boundary.minute, boundary.second)
|
|
210
|
+
adjustDst(current)
|
|
211
|
+
continue
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
@@
|
|
215
|
+
- throw new Error("Unable to find next cron date")
|
|
216
|
+
+ throw new Error(\`Unable to find \${direction} cron date\`)
|
|
217
|
+
})
|
|
218
|
+
*** End Patch`
|
|
219
|
+
console.log(await applyPatch(patch))
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
await taskComplete(`Implemented backport of Cron reverse scheduling support.
|
|
2
|
+
|
|
3
|
+
### ✅ Changes made
|
|
4
|
+
- Added internal reverse lookup support to \\`Cron\\`:
|
|
5
|
+
- new internal \\`last\\` boundary values
|
|
6
|
+
- new internal \\`prev\\` lookup tables
|
|
7
|
+
- generalized lookup table builder for both directions
|
|
8
|
+
- Added new public APIs in \\`packages/effect/src/Cron.ts\\`:
|
|
9
|
+
- \\`Cron.prev(cron, now?)\\`
|
|
10
|
+
- \\`Cron.sequenceReverse(cron, now?)\\`
|
|
11
|
+
- Refactored \\`Cron.next\\` and \\`Cron.prev\\` to share core stepping logic via internal \\`stepCron\\`.
|
|
12
|
+
- Included DST-aware reverse stepping behavior (including fall-back disambiguation handling).
|
|
13
|
+
- Added test coverage in \\`packages/effect/test/Cron.test.ts\\` for:
|
|
14
|
+
- basic \\`prev\\` behavior
|
|
15
|
+
- \\`sequenceReverse\\`
|
|
16
|
+
- month/day edge cases (e.g. day 31 skipping shorter months)
|
|
17
|
+
- month-clamping behavior with month-only constraints
|
|
18
|
+
- DST fall-back reverse behavior
|
|
19
|
+
- Added changeset:
|
|
20
|
+
- \\`.changeset/backport-cron-prev.md\\` (
|
|
21
|
+
\\`"effect": minor\\`
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
### ✅ Validation run
|
|
25
|
+
- \\`pnpm lint-fix\\`
|
|
26
|
+
- \\`pnpm test packages/effect/test/Cron.test.ts\\`
|
|
27
|
+
- \\`pnpm check:tsgo\\`
|
|
28
|
+
- \\`pnpm docgen\\`
|
|
29
|
+
|
|
30
|
+
All completed successfully.`);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
await taskComplete(`Implemented backport of Cron reverse scheduling support.
|
|
2
|
+
|
|
3
|
+
### ✅ Changes made
|
|
4
|
+
- Added internal reverse lookup support to \`Cron\`:
|
|
5
|
+
- new internal \`last\` boundary values
|
|
6
|
+
- new internal \`prev\` lookup tables
|
|
7
|
+
- generalized lookup table builder for both directions
|
|
8
|
+
- Added new public APIs in \`packages/effect/src/Cron.ts\`:
|
|
9
|
+
- \`Cron.prev(cron, now?)\`
|
|
10
|
+
- \`Cron.sequenceReverse(cron, now?)\`
|
|
11
|
+
- Refactored \`Cron.next\` and \`Cron.prev\` to share core stepping logic via internal \`stepCron\`.
|
|
12
|
+
- Included DST-aware reverse stepping behavior (including fall-back disambiguation handling).
|
|
13
|
+
- Added test coverage in \`packages/effect/test/Cron.test.ts\` for:
|
|
14
|
+
- basic \`prev\` behavior
|
|
15
|
+
- \`sequenceReverse\`
|
|
16
|
+
- month/day edge cases (e.g. day 31 skipping shorter months)
|
|
17
|
+
- month-clamping behavior with month-only constraints
|
|
18
|
+
- DST fall-back reverse behavior
|
|
19
|
+
- Added changeset:
|
|
20
|
+
- \`.changeset/backport-cron-prev.md\` (
|
|
21
|
+
\`"effect": minor\`
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
### ✅ Validation run
|
|
25
|
+
- \`pnpm lint-fix\`
|
|
26
|
+
- \`pnpm test packages/effect/test/Cron.test.ts\`
|
|
27
|
+
- \`pnpm check:tsgo\`
|
|
28
|
+
- \`pnpm docgen\`
|
|
29
|
+
|
|
30
|
+
All completed successfully.`);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const tasks = await listTasks({});
|
|
2
|
+
const task = tasks.find((t) => t.id === 'EFF-738');
|
|
3
|
+
if (!task) throw new Error('Task EFF-738 not found');
|
|
4
|
+
const addition = `\n\nDiscovery update:\n\n* Archived regression tests are in \\.repos/effect-old/packages/effect/test/Cron.test.ts (not Cron.ts) and include extensive \\`prev\\` + \\`sequenceReverse\\` coverage that maps cleanly to current APIs by renaming \\`unsafeParse\\` -> \\`parseUnsafe\\` and DateTime helpers to \\`zoneMakeNamedUnsafe\\` / \\`makeZonedUnsafe\\`.\n* Old \\`prev\\` implementation depends on internal cron metadata additions: \\`last\\` boundaries + reverse lookup tables \\`prev\\`; these need to be added to current \\`Cron.make\\` output before implementing reverse stepping.`;
|
|
5
|
+
await updateTask({
|
|
6
|
+
taskId: 'EFF-738',
|
|
7
|
+
description: task.description + addition,
|
|
8
|
+
state: 'in-progress'
|
|
9
|
+
});
|
|
10
|
+
console.log('updated task');
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const tasks = await listTasks({});
|
|
2
|
+
const task = tasks.find((t) => t.id === 'EFF-738');
|
|
3
|
+
if (!task) throw new Error('Task EFF-738 not found');
|
|
4
|
+
const addition = `\n\nDiscovery update:\n\n* Archived regression tests are in .repos/effect-old/packages/effect/test/Cron.test.ts (not Cron.ts) and include extensive \`prev\` + \`sequenceReverse\` coverage that maps cleanly to current APIs by renaming \`unsafeParse\` -> \`parseUnsafe\` and DateTime helpers to \`zoneMakeNamedUnsafe\` / \`makeZonedUnsafe\`.\n* Old \`prev\` implementation depends on internal cron metadata additions: \`last\` boundaries + reverse lookup tables \`prev\`; these need to be added to current \`Cron.make\` output before implementing reverse stepping.`;
|
|
5
|
+
await updateTask({
|
|
6
|
+
taskId: 'EFF-738',
|
|
7
|
+
description: task.description + addition,
|
|
8
|
+
state: 'in-progress'
|
|
9
|
+
});
|
|
10
|
+
console.log('updated task');
|